Renaming exported function 'EthReceiver' to 'ETH_input'

git-svn-id: svn://kolibrios.org@2981 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2012-10-07 14:23:05 +00:00
parent c287a04d42
commit ce2dee6a2b
13 changed files with 124 additions and 154 deletions

View File

@ -95,7 +95,8 @@ iglobal
szNetRegDev db 'NetRegDev',0
szNetUnRegDev db 'NetUnRegDev',0
szNetPtrToNum db 'NetPtrToNum',0
szEthReceiver db 'EthReceiver',0
szEth_input db 'EthReceiver',0 ; To be removed !
szEth_input db 'Eth_input',0
szIPv4_input db 'IPv4_input',0
@ -183,7 +184,7 @@ kernel_export:
dd szNetRegDev , NET_add_device
dd szNetUnRegDev , NET_remove_device
dd szNetPtrToNum , NET_ptr_to_num
dd szEthReceiver , ETH_input
dd szEth_input , ETH_input
dd szIPv4_input , IPv4_input
exp_lfb:

View File

@ -132,11 +132,6 @@ virtual at 0
upd UPD
end virtual
; Ethernet frame symbols
ETH_ALEN = 6
ETH_HLEN = (2*ETH_ALEN+2)
ETH_ZLEN = 60 ; 60 + 4bytes auto payload for
; mininmum 64bytes frame length
; Registers
REG_POWER_MGMT_CTRL = 0x7c
REG_UP_LIST_PTR = 0x38
@ -594,7 +589,7 @@ probe:
DEBUGF 1,"Vendor id: 0x%x\n", ax
cmp ax , 0x10B7
cmp ax, 0x10B7
jne .notfound
shr eax, 16
@ -603,10 +598,9 @@ probe:
; get chip version
mov ecx, HW_VERSIONS_SIZE/4-1
.loop:
cmp ax , [hw_versions+ecx*4]
cmp ax, [hw_versions+ecx*4]
jz .found
loop .loop
DEBUGF 1,"ecx: %u\n", ecx
.notfound:
DEBUGF 1,"Device id not found in list!\n"
or eax, -1
@ -2598,7 +2592,7 @@ int_vortex:
jnz .dma_loop
; registrate the received packet to kernel
jmp EthReceiver
jmp Eth_input
; discard the top frame received
.discard_frame:
@ -2896,80 +2890,43 @@ strtbl hw_str, \
align 4
hw_versions:
dw 0x5900, IS_VORTEX
; 3c590 Vortex 10Mbps
dw 0x5920, IS_VORTEX
; 3c592 EISA 10Mbps Demon/Vortex
dw 0x5970, IS_VORTEX
; 3c597 EISA Fast Demon/Vortex
dw 0x5950, IS_VORTEX
; 3c595 Vortex 100baseTx
dw 0x5951, IS_VORTEX
; 3c595 Vortex 100baseT4
dw 0x5952, IS_VORTEX
; 3c595 Vortex 100base-MII
dw 0x9000, IS_BOOMERANG
; 3c900 Boomerang 10baseT
dw 0x9001, IS_BOOMERANG
; 3c900 Boomerang 10Mbps Combo
dw 0x9004, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM
; 3c900 Cyclone 10Mbps TPO
dw 0x9005, IS_CYCLONE or HAS_HWCKSM
; 3c900 Cyclone 10Mbps Combo
dw 0x9006, IS_CYCLONE or HAS_HWCKSM
; 3c900 Cyclone 10Mbps TPC
dw 0x900A, IS_CYCLONE or HAS_HWCKSM
; 3c900B-FL Cyclone 10base-FL
dw 0x9050, IS_BOOMERANG or HAS_MII
; 3c905 Boomerang 100baseTx
dw 0x9051, IS_BOOMERANG or HAS_MII
; 3c905 Boomerang 100baseT4
dw 0x9055, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM or EXTRA_PREAMBLE
; 3c905B Cyclone 100baseTx
dw 0x9058, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM
; 3c905B Cyclone 10/100/BNC
dw 0x905A, IS_CYCLONE or HAS_HWCKSM
; 3c905B-FX Cyclone 100baseFx
dw 0x9200, IS_TORNADO or HAS_NWAY or HAS_HWCKSM
; 3c905C Tornado
dw 0x9800, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM
; 3c980 Cyclone
dw 0x9805, IS_TORNADO or HAS_NWAY or HAS_HWCKSM
; 3c982 Dual Port Server Cyclone
dw 0x7646, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM
; 3cSOHO100-TX Hurricane
dw 0x5055, IS_CYCLONE or EEPROM_8BIT or HAS_HWCKSM
; 3c555 Laptop Hurricane
dw 0x6055, IS_TORNADO or HAS_NWAY or EEPROM_8BIT or HAS_CB_FNS or INVERT_MII_PWR or HAS_HWCKSM
; 3c556 Laptop Tornado
dw 0x6056, IS_TORNADO or HAS_NWAY or EEPROM_OFFSET or HAS_CB_FNS or INVERT_MII_PWR or HAS_HWCKSM
; 3c556B Laptop Hurricane
dw 0x5b57, IS_BOOMERANG or HAS_MII or EEPROM_8BIT
; 3c575 [Megahertz] 10/100 LAN CardBus
dw 0x5057, IS_BOOMERANG or HAS_MII or EEPROM_8BIT
; 3c575 Boomerang CardBus
dw 0x5157, IS_CYCLONE or HAS_NWAY or HAS_CB_FNS or EEPROM_8BIT or INVERT_LED_PWR or HAS_HWCKSM
; 3CCFE575BT Cyclone CardBus
dw 0x5257, IS_TORNADO or HAS_NWAY or HAS_CB_FNS or EEPROM_8BIT or INVERT_MII_PWR or MAX_COLLISION_RESET or HAS_HWCKSM
; 3CCFE575CT Tornado CardBus
dw 0x6560, IS_CYCLONE or HAS_NWAY or HAS_CB_FNS or EEPROM_8BIT or INVERT_MII_PWR or INVERT_LED_PWR or HAS_HWCKSM
; 3CCFE656 Cyclone CardBus
dw 0x6562, IS_CYCLONE or HAS_NWAY or HAS_CB_FNS or EEPROM_8BIT or INVERT_MII_PWR or INVERT_LED_PWR or HAS_HWCKSM
; 3CCFEM656B Cyclone+Winmodem CardBus
dw 0x6564, IS_TORNADO or HAS_NWAY or HAS_CB_FNS or EEPROM_8BIT or INVERT_MII_PWR or MAX_COLLISION_RESET or HAS_HWCKSM
; 3CXFEM656C Tornado+Winmodem CardBus
dw 0x4500, IS_TORNADO or HAS_NWAY or HAS_HWCKSM
; 3c450 HomePNA Tornado
dw 0x9201, IS_TORNADO or HAS_NWAY or HAS_HWCKSM
; 3c920 Tornado
dw 0x1201, IS_TORNADO or HAS_HWCKSM or HAS_NWAY
; 3c982 Hydra Dual Port A
dw 0x1202, IS_TORNADO or HAS_HWCKSM or HAS_NWAY
; 3c982 Hydra Dual Port B
dw 0x9056, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM or EXTRA_PREAMBLE
; 3c905B-T4
dw 0x9210, IS_TORNADO or HAS_NWAY or HAS_HWCKSM
; 3c920B-EMB-WNM Tornado
dw 0x5900, IS_VORTEX ; 3c590 Vortex 10Mbps
dw 0x5920, IS_VORTEX ; 3c592 EISA 10Mbps Demon/Vortex
dw 0x5970, IS_VORTEX ; 3c597 EISA Fast Demon/Vortex
dw 0x5950, IS_VORTEX ; 3c595 Vortex 100baseTx
dw 0x5951, IS_VORTEX ; 3c595 Vortex 100baseT4
dw 0x5952, IS_VORTEX ; 3c595 Vortex 100base-MII
dw 0x9000, IS_BOOMERANG ; 3c900 Boomerang 10baseT
dw 0x9001, IS_BOOMERANG ; 3c900 Boomerang 10Mbps Combo
dw 0x9004, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM ; 3c900 Cyclone 10Mbps TPO
dw 0x9005, IS_CYCLONE or HAS_HWCKSM ; 3c900 Cyclone 10Mbps Combo
dw 0x9006, IS_CYCLONE or HAS_HWCKSM ; 3c900 Cyclone 10Mbps TPC
dw 0x900A, IS_CYCLONE or HAS_HWCKSM ; 3c900B-FL Cyclone 10base-FL
dw 0x9050, IS_BOOMERANG or HAS_MII ; 3c905 Boomerang 100baseTx
dw 0x9051, IS_BOOMERANG or HAS_MII ; 3c905 Boomerang 100baseT4
dw 0x9055, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM or EXTRA_PREAMBLE ; 3c905B Cyclone 100baseTx
dw 0x9058, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM ; 3c905B Cyclone 10/100/BNC
dw 0x905A, IS_CYCLONE or HAS_HWCKSM ; 3c905B-FX Cyclone 100baseFx
dw 0x9200, IS_TORNADO or HAS_NWAY or HAS_HWCKSM ; 3c905C Tornado
dw 0x9800, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM ; 3c980 Cyclone
dw 0x9805, IS_TORNADO or HAS_NWAY or HAS_HWCKSM ; 3c982 Dual Port Server Cyclone
dw 0x7646, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM ; 3cSOHO100-TX Hurricane
dw 0x5055, IS_CYCLONE or EEPROM_8BIT or HAS_HWCKSM ; 3c555 Laptop Hurricane
dw 0x6055, IS_TORNADO or HAS_NWAY or EEPROM_8BIT or HAS_CB_FNS or INVERT_MII_PWR or HAS_HWCKSM ; 3c556 Laptop Tornado
dw 0x6056, IS_TORNADO or HAS_NWAY or EEPROM_OFFSET or HAS_CB_FNS or INVERT_MII_PWR or HAS_HWCKSM ; 3c556B Laptop Hurricane
dw 0x5b57, IS_BOOMERANG or HAS_MII or EEPROM_8BIT ; 3c575 [Megahertz] 10/100 LAN CardBus
dw 0x5057, IS_BOOMERANG or HAS_MII or EEPROM_8BIT ; 3c575 Boomerang CardBus
dw 0x5157, IS_CYCLONE or HAS_NWAY or HAS_CB_FNS or EEPROM_8BIT or INVERT_LED_PWR or HAS_HWCKSM ; 3CCFE575BT Cyclone CardBus
dw 0x5257, IS_TORNADO or HAS_NWAY or HAS_CB_FNS or EEPROM_8BIT or INVERT_MII_PWR or MAX_COLLISION_RESET or HAS_HWCKSM ; 3CCFE575CT Tornado CardBus
dw 0x6560, IS_CYCLONE or HAS_NWAY or HAS_CB_FNS or EEPROM_8BIT or INVERT_MII_PWR or INVERT_LED_PWR or HAS_HWCKSM ; 3CCFE656 Cyclone CardBus
dw 0x6562, IS_CYCLONE or HAS_NWAY or HAS_CB_FNS or EEPROM_8BIT or INVERT_MII_PWR or INVERT_LED_PWR or HAS_HWCKSM ; 3CCFEM656B Cyclone+Winmodem CardBus
dw 0x6564, IS_TORNADO or HAS_NWAY or HAS_CB_FNS or EEPROM_8BIT or INVERT_MII_PWR or MAX_COLLISION_RESET or HAS_HWCKSM ; 3CXFEM656C Tornado+Winmodem CardBus
dw 0x4500, IS_TORNADO or HAS_NWAY or HAS_HWCKSM ; 3c450 HomePNA Tornado
dw 0x9201, IS_TORNADO or HAS_NWAY or HAS_HWCKSM ; 3c920 Tornado
dw 0x1201, IS_TORNADO or HAS_HWCKSM or HAS_NWAY ; 3c982 Hydra Dual Port A
dw 0x1202, IS_TORNADO or HAS_HWCKSM or HAS_NWAY ; 3c982 Hydra Dual Port B
dw 0x9056, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM or EXTRA_PREAMBLE ; 3c905B-T4
dw 0x9210, IS_TORNADO or HAS_NWAY or HAS_HWCKSM ; 3c920B-EMB-WNM Tornado
HW_VERSIONS_SIZE = $ - hw_versions
include_debug_strings ; All data wich FDO uses will be included here

View File

@ -929,7 +929,7 @@ int_handler:
; At last, send packet to kernel
jmp EthReceiver
jmp Eth_input
.no_RX:

View File

@ -939,7 +939,7 @@ int_handler:
out dx, al
add esp, 14
jmp EthReceiver ; send it to the kernel
jmp Eth_input
.fail:
add esp, 14+8

View File

@ -664,9 +664,9 @@ transmit:
[eax+13]:2,[eax+12]:2
cmp dword [esp+8], MAX_ETH_FRAME_SIZE
jg .fail
ja .fail
cmp dword [esp+8], 60
jl .fail
jb .fail
; check if we own the current discriptor
set_io 0
@ -710,7 +710,7 @@ transmit:
DEBUGF 1,"Waiting for timeout\n"
push edx
mov esi, 300
mov esi, 30
stdcall Sleep
pop edx
@ -831,7 +831,7 @@ int_handler:
rep movsd
.nd:
jmp EthReceiver ; Send it to kernel
jmp Eth_input ; Send it to kernel
.abort:
pop eax ebx

View File

@ -1209,7 +1209,7 @@ int_handler:
inc [tpc.cur_rx]
and [tpc.cur_rx], NUM_RX_DESC - 1
jmp EthReceiver
jmp Eth_input
.rx_return:
pop ax

View File

@ -1176,7 +1176,7 @@ int_handler:
.nw:
rep movsd
jmp EthReceiver
jmp Eth_input
.continue_rx:
pop edi

View File

@ -506,6 +506,16 @@ reset_dontstart:
mov esi, [device.mmio_addr]
or dword [esi + REG_CTRL], CTRL_RST ; reset device
.loop:
push esi
xor esi, esi
inc esi
call Sleep
pop esi
test dword [esi + REG_CTRL], CTRL_RST
jnz .loop
mov dword [esi + REG_IMC], 0xffffffff ; Disable all interrupt causes
mov eax, dword [esi + REG_ICR] ; Clear any pending interrupts
mov dword [esi + REG_ITR], 0 ; Disable interrupt throttling logic
@ -566,7 +576,7 @@ start_i8254x:
mov [esi + REG_RADV], eax ; Clear the Receive Interrupt Absolute Delay Timer
mov [esi + REG_RSRPD], eax ; Clear the Receive Small Packet Detect Interrupt
or eax, 1 shl 0 + 1 shl 7 ; TXDW + RXT0
mov eax, -1 ;;;; hack!
mov eax, 1+4+16 ;;;; hack!
mov [esi + REG_IMS], eax ; Enable interrupt types
mov [device.mtu], 1514
@ -748,7 +758,7 @@ int_handler:
mov dword [esi + REG_RDH], 0x00000000 ; Receive Descriptor Head
mov dword [esi + REG_RDT], 0x00000001 ; Receive Descriptor Tail
jmp EthReceiver
jmp Eth_input
.retaddr:
pop eax

View File

@ -53,7 +53,7 @@ virtual at ebx
.ee_bus_width dd ?
rb 5+8 ;;;; align
rb 0x100 - (($ - device) and 0xff)
rxfd:
.status dw ?
@ -64,7 +64,7 @@ virtual at ebx
.size dw ?
.packet dd ?
rb 12 ;;;;
rb 0x100 - (($ - device) and 0xff)
txfd:
.status dw ?
@ -77,12 +77,16 @@ virtual at ebx
.tx_buf_addr1 dd ?
.tx_buf_size1 dd ?
rb 0x100 - (($ - device) and 0xff)
confcmd:
.status: dw ?
.command: dw ?
.link: dd ?
.data rb 64
rb 0x100 - (($ - device) and 0xff)
lstats:
tx_good_frames dd ?
tx_coll16_errs dd ?
@ -102,17 +106,17 @@ virtual at ebx
rx_colls_errs dd ?
rx_runt_errs dd ?
device_size = $ - device
sizeof.device_struct = $ - device
end virtual
; Serial EEPROM
EE_SK = 1 shl 16 ; serial clock
EE_CS = 1 shl 17 ; chip select
EE_DI = 1 shl 18 ; data in
EE_DO = 1 shl 19 ; data out
EE_SK = 1 shl 0 ; serial clock
EE_CS = 1 shl 1 ; chip select
EE_DI = 1 shl 2 ; data in
EE_DO = 1 shl 3 ; data out
EE_READ = 110b
EE_WRITE = 101b
@ -182,7 +186,7 @@ proc START stdcall, state:dword
.entry:
DEBUGF 1,"Loading i8255x driver\n"
DEBUGF 1,"Loading %s driver\n", my_service
stdcall RegService, my_service, service_proc
ret
@ -252,20 +256,15 @@ proc service_proc stdcall, ioctl:dword
; This device doesnt have its own eth_device structure yet, lets create one
.firstdevice:
cmp [devices], MAX_DEVICES ; First check if the driver can handle one more card
jge .fail
jae .fail
push edx
stdcall KernelAlloc, device_size
pop edx
test eax, eax
jz .fail
mov ebx, eax ; ebx is always used as a pointer to the structure (in driver, but also in kernel code)
allocate_and_clear ebx, sizeof.device_struct, .fail ; Allocate the buffer for device structure
; Fill in the direct call addresses into the struct
mov [device.reset], reset
mov [device.transmit], transmit
; mov [device.get_MAC], read_mac
mov [device.get_MAC], read_mac
mov [device.set_MAC], MAC_write
mov [device.unload], unload
mov [device.name], my_service
@ -273,9 +272,9 @@ proc service_proc stdcall, ioctl:dword
; save the pci bus and device numbers
mov eax, [IOCTL.input]
mov cl , [eax+1]
mov cl, [eax+1]
mov [device.pci_bus], cl
mov cl , [eax+2]
mov cl, [eax+2]
mov [device.pci_dev], cl
; Now, it's time to find the base io addres of the PCI device
@ -660,34 +659,33 @@ transmit:
align 4
int_handler:
DEBUGF 1,"IRQ %x ",eax:2 ; no, you cant replace 'eax:2' with 'al', this must be a bug in FDO
DEBUGF 1,"\n%s int\n", my_service
; find pointer of device wich made IRQ occur
mov esi, device_list
mov ecx, [devices]
test ecx, ecx
jz .fail
.nextdevice:
mov ebx, dword [esi]
jz .nothing
mov esi, device_list
.nextdevice:
mov ebx, [esi]
set_io 0
;; set_io REG_ISR
;; in ax , dx
;; out dx , ax ; send it back to ACK
add esi, 4
test ax , ax
set_io REG_ISR
in ax, dx
out dx, ax ; send it back to ACK
test ax, ax
jnz .got_it
.continue:
add esi, 4
dec ecx
jnz .nextdevice
.nothing:
ret ; If no device was found, abort (The irq was probably for a device, not registered to this driver)
.got_it:
DEBUGF 1,"Device: %x Status: %x ", ebx, ax
;;; receive
@ -730,7 +728,7 @@ int_handler:
rep movsd
.nd:
jmp EthReceiver ; Send it to kernel
jmp Eth_input
.nodata:
.fail:
@ -899,39 +897,26 @@ ee_get_width:
set_io 0
set_io reg_eeprom
mov esi, EE_READ shl 28
mov si, EE_READ shl 12
xor ecx, ecx
.loop:
mov eax, EE_CS
out dx , eax
mov ax, EE_CS
out dx, ax
delay
or eax, EE_SK
out dx , eax
or ax, EE_SK
out dx, ax
delay
inc ecx
in eax, dx
test eax, EE_DO
in ax, dx
test ax, EE_DO
jnz .loop
mov [device.ee_bus_width], ecx
DEBUGF 1,"ee width=%u\n", ecx
;------------------------------
; Now read the data from eeprom
mov ecx, 16
.loop2:
mov eax, EE_CS + EE_SK
out dx , eax
delay
mov eax, EE_CS
out dx , eax
delay
loop .loop2
;-----------------------
; de-activate the eeprom
@ -1000,12 +985,27 @@ mdio_write:
ret
read_mac:
ret
align 4
MAC_read_eeprom:
;;;;
mov esi, 0
call ee_read
mov esi, 1
call ee_read
mov esi, 14
call ee_read
mov esi, 5
call ee_read
ret

View File

@ -97,4 +97,6 @@ kernel_export \
NetRegDev,\
NetUnRegDev,\
NetPtrToNum,\
EthReceiver
EthReceiver,\
Eth_input,\
IPv4_input

View File

@ -1157,7 +1157,7 @@ int_handler:
push [esi + mtd_desc.skbuff]
jmp EthReceiver
jmp Eth_input
.rx_complete:
mov esi, [device.cur_rx]

View File

@ -1128,7 +1128,7 @@ int_handler:
inc [device.cur_rx] ; update descriptor
and [device.cur_rx], 3 ;
jmp EthReceiver ; Send the copied packet to kernel
jmp Eth_input
.abort:

View File

@ -1112,7 +1112,7 @@ int_handler:
push ecx ; packet size
pushd [device.rxd + eax + 12] ; packet ptr
DEBUGF 1, "Packet received OK\n"
jmp EthReceiver
jmp Eth_input
.return:
pop ebx