Rev 9161 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9161 | Rev 10065 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;; Realtek 8139 driver for KolibriOS ;; |
6 | ;; Realtek 8139 driver for KolibriOS ;; |
7 | ;; ;; |
7 | ;; ;; |
8 | ;; based on RTL8139.asm driver for menuetos ;; |
8 | ;; based on RTL8139.asm driver for menuetos ;; |
Line 284... | Line 284... | ||
284 | cmp [edx + IOCTL.inp_size], 3 ; Data input must be at least 3 bytes |
284 | cmp [edx + IOCTL.inp_size], 3 ; Data input must be at least 3 bytes |
285 | jb .fail |
285 | jb .fail |
Line 286... | Line 286... | ||
286 | 286 | ||
287 | mov eax, [edx + IOCTL.input] |
287 | mov eax, [edx + IOCTL.input] |
288 | cmp byte [eax], 1 ; 1 means device number and bus number (pci) are given |
288 | cmp byte [eax], 1 ; 1 means device number and bus number (pci) are given |
Line 289... | Line 289... | ||
289 | jne .fail ; other types arent supported for this card yet |
289 | jne .fail ; other types aren't supported for this card yet |
Line 290... | Line 290... | ||
290 | 290 | ||
291 | ; check if the device is already listed |
291 | ; check if the device is already listed |
Line 299... | Line 299... | ||
299 | .nextdevice: |
299 | .nextdevice: |
300 | mov ebx, [esi] |
300 | mov ebx, [esi] |
301 | cmp al, byte[ebx + device.pci_bus] |
301 | cmp al, byte[ebx + device.pci_bus] |
302 | jne @f |
302 | jne @f |
303 | cmp ah, byte[ebx + device.pci_dev] |
303 | cmp ah, byte[ebx + device.pci_dev] |
304 | je .find_devicenum ; Device is already loaded, let's find it's device number |
304 | je .find_devicenum ; Device is already loaded, let's find its device number |
305 | @@: |
305 | @@: |
306 | add esi, 4 |
306 | add esi, 4 |
307 | loop .nextdevice |
307 | loop .nextdevice |
Line 308... | Line 308... | ||
308 | 308 | ||
309 | 309 | ||
310 | ; This device doesnt have its own eth_device structure yet, lets create one |
310 | ; This device doesn't have its own eth_device structure yet, let's create one |
311 | .firstdevice: |
311 | .firstdevice: |
Line 312... | Line 312... | ||
312 | cmp [devices], MAX_DEVICES ; First check if the driver can handle one more card |
312 | cmp [devices], MAX_DEVICES ; First check if the driver can handle one more card |
Line 327... | Line 327... | ||
327 | movzx ecx, byte[eax+1] |
327 | movzx ecx, byte[eax+1] |
328 | mov [ebx + device.pci_bus], ecx |
328 | mov [ebx + device.pci_bus], ecx |
329 | movzx ecx, byte[eax+2] |
329 | movzx ecx, byte[eax+2] |
330 | mov [ebx + device.pci_dev], ecx |
330 | mov [ebx + device.pci_dev], ecx |
Line 331... | Line 331... | ||
331 | 331 | ||
Line 332... | Line 332... | ||
332 | ; Now, it's time to find the base io addres of the PCI device |
332 | ; Now, it's time to find the base io address of the PCI device |
333 | 333 | ||
Line 334... | Line 334... | ||
334 | stdcall PCI_find_io, [ebx + device.pci_bus], [ebx + device.pci_dev] |
334 | stdcall PCI_find_io, [ebx + device.pci_bus], [ebx + device.pci_dev] |
Line 792... | Line 792... | ||
792 | jz .abort |
792 | jz .abort |
793 | mov [eax + NET_BUFF.length], ecx |
793 | mov [eax + NET_BUFF.length], ecx |
794 | mov [eax + NET_BUFF.device], ebx |
794 | mov [eax + NET_BUFF.device], ebx |
795 | mov [eax + NET_BUFF.offset], NET_BUFF.data |
795 | mov [eax + NET_BUFF.offset], NET_BUFF.data |
Line 796... | Line 796... | ||
796 | 796 | ||
797 | lea edi, [eax + NET_BUFF.data] ; Where we will copy too |
797 | lea edi, [eax + NET_BUFF.data] ; Where we will copy to |
798 | mov esi, [esp] ; The buffer we will copy from |
798 | mov esi, [esp] ; The buffer we will copy from |
Line 799... | Line 799... | ||
799 | add esi, 4 ; Dont copy CRC |
799 | add esi, 4 ; Don't copy CRC |
800 | 800 | ||
Line 801... | Line 801... | ||
801 | push .abort ; return addr for Eth_input |
801 | push .abort ; return addr for Eth_input |