forked from KolibriOS/kolibrios
Renaming exported function 'EthReceiver' to 'ETH_input'
git-svn-id: svn://kolibrios.org@2981 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
c287a04d42
commit
ce2dee6a2b
@ -95,7 +95,8 @@ iglobal
|
|||||||
szNetRegDev db 'NetRegDev',0
|
szNetRegDev db 'NetRegDev',0
|
||||||
szNetUnRegDev db 'NetUnRegDev',0
|
szNetUnRegDev db 'NetUnRegDev',0
|
||||||
szNetPtrToNum db 'NetPtrToNum',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
|
szIPv4_input db 'IPv4_input',0
|
||||||
|
|
||||||
|
|
||||||
@ -183,7 +184,7 @@ kernel_export:
|
|||||||
dd szNetRegDev , NET_add_device
|
dd szNetRegDev , NET_add_device
|
||||||
dd szNetUnRegDev , NET_remove_device
|
dd szNetUnRegDev , NET_remove_device
|
||||||
dd szNetPtrToNum , NET_ptr_to_num
|
dd szNetPtrToNum , NET_ptr_to_num
|
||||||
dd szEthReceiver , ETH_input
|
dd szEth_input , ETH_input
|
||||||
dd szIPv4_input , IPv4_input
|
dd szIPv4_input , IPv4_input
|
||||||
|
|
||||||
exp_lfb:
|
exp_lfb:
|
||||||
|
@ -132,11 +132,6 @@ virtual at 0
|
|||||||
upd UPD
|
upd UPD
|
||||||
end virtual
|
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
|
; Registers
|
||||||
REG_POWER_MGMT_CTRL = 0x7c
|
REG_POWER_MGMT_CTRL = 0x7c
|
||||||
REG_UP_LIST_PTR = 0x38
|
REG_UP_LIST_PTR = 0x38
|
||||||
@ -594,7 +589,7 @@ probe:
|
|||||||
|
|
||||||
DEBUGF 1,"Vendor id: 0x%x\n", ax
|
DEBUGF 1,"Vendor id: 0x%x\n", ax
|
||||||
|
|
||||||
cmp ax , 0x10B7
|
cmp ax, 0x10B7
|
||||||
jne .notfound
|
jne .notfound
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
|
|
||||||
@ -603,10 +598,9 @@ probe:
|
|||||||
; get chip version
|
; get chip version
|
||||||
mov ecx, HW_VERSIONS_SIZE/4-1
|
mov ecx, HW_VERSIONS_SIZE/4-1
|
||||||
.loop:
|
.loop:
|
||||||
cmp ax , [hw_versions+ecx*4]
|
cmp ax, [hw_versions+ecx*4]
|
||||||
jz .found
|
jz .found
|
||||||
loop .loop
|
loop .loop
|
||||||
DEBUGF 1,"ecx: %u\n", ecx
|
|
||||||
.notfound:
|
.notfound:
|
||||||
DEBUGF 1,"Device id not found in list!\n"
|
DEBUGF 1,"Device id not found in list!\n"
|
||||||
or eax, -1
|
or eax, -1
|
||||||
@ -2598,7 +2592,7 @@ int_vortex:
|
|||||||
jnz .dma_loop
|
jnz .dma_loop
|
||||||
|
|
||||||
; registrate the received packet to kernel
|
; registrate the received packet to kernel
|
||||||
jmp EthReceiver
|
jmp Eth_input
|
||||||
|
|
||||||
; discard the top frame received
|
; discard the top frame received
|
||||||
.discard_frame:
|
.discard_frame:
|
||||||
@ -2896,80 +2890,43 @@ strtbl hw_str, \
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
hw_versions:
|
hw_versions:
|
||||||
dw 0x5900, IS_VORTEX
|
dw 0x5900, IS_VORTEX ; 3c590 Vortex 10Mbps
|
||||||
; 3c590 Vortex 10Mbps
|
dw 0x5920, IS_VORTEX ; 3c592 EISA 10Mbps Demon/Vortex
|
||||||
dw 0x5920, IS_VORTEX
|
dw 0x5970, IS_VORTEX ; 3c597 EISA Fast Demon/Vortex
|
||||||
; 3c592 EISA 10Mbps Demon/Vortex
|
dw 0x5950, IS_VORTEX ; 3c595 Vortex 100baseTx
|
||||||
dw 0x5970, IS_VORTEX
|
dw 0x5951, IS_VORTEX ; 3c595 Vortex 100baseT4
|
||||||
; 3c597 EISA Fast Demon/Vortex
|
dw 0x5952, IS_VORTEX ; 3c595 Vortex 100base-MII
|
||||||
dw 0x5950, IS_VORTEX
|
dw 0x9000, IS_BOOMERANG ; 3c900 Boomerang 10baseT
|
||||||
; 3c595 Vortex 100baseTx
|
dw 0x9001, IS_BOOMERANG ; 3c900 Boomerang 10Mbps Combo
|
||||||
dw 0x5951, IS_VORTEX
|
dw 0x9004, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM ; 3c900 Cyclone 10Mbps TPO
|
||||||
; 3c595 Vortex 100baseT4
|
dw 0x9005, IS_CYCLONE or HAS_HWCKSM ; 3c900 Cyclone 10Mbps Combo
|
||||||
dw 0x5952, IS_VORTEX
|
dw 0x9006, IS_CYCLONE or HAS_HWCKSM ; 3c900 Cyclone 10Mbps TPC
|
||||||
; 3c595 Vortex 100base-MII
|
dw 0x900A, IS_CYCLONE or HAS_HWCKSM ; 3c900B-FL Cyclone 10base-FL
|
||||||
dw 0x9000, IS_BOOMERANG
|
dw 0x9050, IS_BOOMERANG or HAS_MII ; 3c905 Boomerang 100baseTx
|
||||||
; 3c900 Boomerang 10baseT
|
dw 0x9051, IS_BOOMERANG or HAS_MII ; 3c905 Boomerang 100baseT4
|
||||||
dw 0x9001, IS_BOOMERANG
|
dw 0x9055, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM or EXTRA_PREAMBLE ; 3c905B Cyclone 100baseTx
|
||||||
; 3c900 Boomerang 10Mbps Combo
|
dw 0x9058, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM ; 3c905B Cyclone 10/100/BNC
|
||||||
dw 0x9004, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM
|
dw 0x905A, IS_CYCLONE or HAS_HWCKSM ; 3c905B-FX Cyclone 100baseFx
|
||||||
; 3c900 Cyclone 10Mbps TPO
|
dw 0x9200, IS_TORNADO or HAS_NWAY or HAS_HWCKSM ; 3c905C Tornado
|
||||||
dw 0x9005, IS_CYCLONE or HAS_HWCKSM
|
dw 0x9800, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM ; 3c980 Cyclone
|
||||||
; 3c900 Cyclone 10Mbps Combo
|
dw 0x9805, IS_TORNADO or HAS_NWAY or HAS_HWCKSM ; 3c982 Dual Port Server Cyclone
|
||||||
dw 0x9006, IS_CYCLONE or HAS_HWCKSM
|
dw 0x7646, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM ; 3cSOHO100-TX Hurricane
|
||||||
; 3c900 Cyclone 10Mbps TPC
|
dw 0x5055, IS_CYCLONE or EEPROM_8BIT or HAS_HWCKSM ; 3c555 Laptop Hurricane
|
||||||
dw 0x900A, IS_CYCLONE or HAS_HWCKSM
|
dw 0x6055, IS_TORNADO or HAS_NWAY or EEPROM_8BIT or HAS_CB_FNS or INVERT_MII_PWR or HAS_HWCKSM ; 3c556 Laptop Tornado
|
||||||
; 3c900B-FL Cyclone 10base-FL
|
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 0x9050, IS_BOOMERANG or HAS_MII
|
dw 0x5b57, IS_BOOMERANG or HAS_MII or EEPROM_8BIT ; 3c575 [Megahertz] 10/100 LAN CardBus
|
||||||
; 3c905 Boomerang 100baseTx
|
dw 0x5057, IS_BOOMERANG or HAS_MII or EEPROM_8BIT ; 3c575 Boomerang CardBus
|
||||||
dw 0x9051, IS_BOOMERANG or HAS_MII
|
dw 0x5157, IS_CYCLONE or HAS_NWAY or HAS_CB_FNS or EEPROM_8BIT or INVERT_LED_PWR or HAS_HWCKSM ; 3CCFE575BT Cyclone CardBus
|
||||||
; 3c905 Boomerang 100baseT4
|
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 0x9055, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM or EXTRA_PREAMBLE
|
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
|
||||||
; 3c905B Cyclone 100baseTx
|
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 0x9058, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM
|
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
|
||||||
; 3c905B Cyclone 10/100/BNC
|
dw 0x4500, IS_TORNADO or HAS_NWAY or HAS_HWCKSM ; 3c450 HomePNA Tornado
|
||||||
dw 0x905A, IS_CYCLONE or HAS_HWCKSM
|
dw 0x9201, IS_TORNADO or HAS_NWAY or HAS_HWCKSM ; 3c920 Tornado
|
||||||
; 3c905B-FX Cyclone 100baseFx
|
dw 0x1201, IS_TORNADO or HAS_HWCKSM or HAS_NWAY ; 3c982 Hydra Dual Port A
|
||||||
dw 0x9200, IS_TORNADO or HAS_NWAY or HAS_HWCKSM
|
dw 0x1202, IS_TORNADO or HAS_HWCKSM or HAS_NWAY ; 3c982 Hydra Dual Port B
|
||||||
; 3c905C Tornado
|
dw 0x9056, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM or EXTRA_PREAMBLE ; 3c905B-T4
|
||||||
dw 0x9800, IS_CYCLONE or HAS_NWAY or HAS_HWCKSM
|
dw 0x9210, IS_TORNADO or HAS_NWAY or HAS_HWCKSM ; 3c920B-EMB-WNM Tornado
|
||||||
; 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
|
HW_VERSIONS_SIZE = $ - hw_versions
|
||||||
|
|
||||||
include_debug_strings ; All data wich FDO uses will be included here
|
include_debug_strings ; All data wich FDO uses will be included here
|
||||||
|
@ -929,7 +929,7 @@ int_handler:
|
|||||||
|
|
||||||
; At last, send packet to kernel
|
; At last, send packet to kernel
|
||||||
|
|
||||||
jmp EthReceiver
|
jmp Eth_input
|
||||||
|
|
||||||
|
|
||||||
.no_RX:
|
.no_RX:
|
||||||
|
@ -939,7 +939,7 @@ int_handler:
|
|||||||
out dx, al
|
out dx, al
|
||||||
|
|
||||||
add esp, 14
|
add esp, 14
|
||||||
jmp EthReceiver ; send it to the kernel
|
jmp Eth_input
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
add esp, 14+8
|
add esp, 14+8
|
||||||
|
@ -664,9 +664,9 @@ transmit:
|
|||||||
[eax+13]:2,[eax+12]:2
|
[eax+13]:2,[eax+12]:2
|
||||||
|
|
||||||
cmp dword [esp+8], MAX_ETH_FRAME_SIZE
|
cmp dword [esp+8], MAX_ETH_FRAME_SIZE
|
||||||
jg .fail
|
ja .fail
|
||||||
cmp dword [esp+8], 60
|
cmp dword [esp+8], 60
|
||||||
jl .fail
|
jb .fail
|
||||||
|
|
||||||
; check if we own the current discriptor
|
; check if we own the current discriptor
|
||||||
set_io 0
|
set_io 0
|
||||||
@ -710,7 +710,7 @@ transmit:
|
|||||||
DEBUGF 1,"Waiting for timeout\n"
|
DEBUGF 1,"Waiting for timeout\n"
|
||||||
|
|
||||||
push edx
|
push edx
|
||||||
mov esi, 300
|
mov esi, 30
|
||||||
stdcall Sleep
|
stdcall Sleep
|
||||||
pop edx
|
pop edx
|
||||||
|
|
||||||
@ -831,7 +831,7 @@ int_handler:
|
|||||||
rep movsd
|
rep movsd
|
||||||
.nd:
|
.nd:
|
||||||
|
|
||||||
jmp EthReceiver ; Send it to kernel
|
jmp Eth_input ; Send it to kernel
|
||||||
|
|
||||||
.abort:
|
.abort:
|
||||||
pop eax ebx
|
pop eax ebx
|
||||||
|
@ -1209,7 +1209,7 @@ int_handler:
|
|||||||
inc [tpc.cur_rx]
|
inc [tpc.cur_rx]
|
||||||
and [tpc.cur_rx], NUM_RX_DESC - 1
|
and [tpc.cur_rx], NUM_RX_DESC - 1
|
||||||
|
|
||||||
jmp EthReceiver
|
jmp Eth_input
|
||||||
.rx_return:
|
.rx_return:
|
||||||
|
|
||||||
pop ax
|
pop ax
|
||||||
|
@ -1176,7 +1176,7 @@ int_handler:
|
|||||||
.nw:
|
.nw:
|
||||||
rep movsd
|
rep movsd
|
||||||
|
|
||||||
jmp EthReceiver
|
jmp Eth_input
|
||||||
|
|
||||||
.continue_rx:
|
.continue_rx:
|
||||||
pop edi
|
pop edi
|
||||||
|
@ -506,6 +506,16 @@ reset_dontstart:
|
|||||||
|
|
||||||
mov esi, [device.mmio_addr]
|
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 dword [esi + REG_IMC], 0xffffffff ; Disable all interrupt causes
|
||||||
mov eax, dword [esi + REG_ICR] ; Clear any pending interrupts
|
mov eax, dword [esi + REG_ICR] ; Clear any pending interrupts
|
||||||
mov dword [esi + REG_ITR], 0 ; Disable interrupt throttling logic
|
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_RADV], eax ; Clear the Receive Interrupt Absolute Delay Timer
|
||||||
mov [esi + REG_RSRPD], eax ; Clear the Receive Small Packet Detect Interrupt
|
mov [esi + REG_RSRPD], eax ; Clear the Receive Small Packet Detect Interrupt
|
||||||
or eax, 1 shl 0 + 1 shl 7 ; TXDW + RXT0
|
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 [esi + REG_IMS], eax ; Enable interrupt types
|
||||||
|
|
||||||
mov [device.mtu], 1514
|
mov [device.mtu], 1514
|
||||||
@ -748,7 +758,7 @@ int_handler:
|
|||||||
mov dword [esi + REG_RDH], 0x00000000 ; Receive Descriptor Head
|
mov dword [esi + REG_RDH], 0x00000000 ; Receive Descriptor Head
|
||||||
mov dword [esi + REG_RDT], 0x00000001 ; Receive Descriptor Tail
|
mov dword [esi + REG_RDT], 0x00000001 ; Receive Descriptor Tail
|
||||||
|
|
||||||
jmp EthReceiver
|
jmp Eth_input
|
||||||
.retaddr:
|
.retaddr:
|
||||||
pop eax
|
pop eax
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ virtual at ebx
|
|||||||
|
|
||||||
.ee_bus_width dd ?
|
.ee_bus_width dd ?
|
||||||
|
|
||||||
rb 5+8 ;;;; align
|
rb 0x100 - (($ - device) and 0xff)
|
||||||
|
|
||||||
rxfd:
|
rxfd:
|
||||||
.status dw ?
|
.status dw ?
|
||||||
@ -64,7 +64,7 @@ virtual at ebx
|
|||||||
.size dw ?
|
.size dw ?
|
||||||
.packet dd ?
|
.packet dd ?
|
||||||
|
|
||||||
rb 12 ;;;;
|
rb 0x100 - (($ - device) and 0xff)
|
||||||
|
|
||||||
txfd:
|
txfd:
|
||||||
.status dw ?
|
.status dw ?
|
||||||
@ -77,12 +77,16 @@ virtual at ebx
|
|||||||
.tx_buf_addr1 dd ?
|
.tx_buf_addr1 dd ?
|
||||||
.tx_buf_size1 dd ?
|
.tx_buf_size1 dd ?
|
||||||
|
|
||||||
|
rb 0x100 - (($ - device) and 0xff)
|
||||||
|
|
||||||
confcmd:
|
confcmd:
|
||||||
.status: dw ?
|
.status: dw ?
|
||||||
.command: dw ?
|
.command: dw ?
|
||||||
.link: dd ?
|
.link: dd ?
|
||||||
.data rb 64
|
.data rb 64
|
||||||
|
|
||||||
|
rb 0x100 - (($ - device) and 0xff)
|
||||||
|
|
||||||
lstats:
|
lstats:
|
||||||
tx_good_frames dd ?
|
tx_good_frames dd ?
|
||||||
tx_coll16_errs dd ?
|
tx_coll16_errs dd ?
|
||||||
@ -102,17 +106,17 @@ virtual at ebx
|
|||||||
rx_colls_errs dd ?
|
rx_colls_errs dd ?
|
||||||
rx_runt_errs dd ?
|
rx_runt_errs dd ?
|
||||||
|
|
||||||
device_size = $ - device
|
sizeof.device_struct = $ - device
|
||||||
|
|
||||||
end virtual
|
end virtual
|
||||||
|
|
||||||
|
|
||||||
; Serial EEPROM
|
; Serial EEPROM
|
||||||
|
|
||||||
EE_SK = 1 shl 16 ; serial clock
|
EE_SK = 1 shl 0 ; serial clock
|
||||||
EE_CS = 1 shl 17 ; chip select
|
EE_CS = 1 shl 1 ; chip select
|
||||||
EE_DI = 1 shl 18 ; data in
|
EE_DI = 1 shl 2 ; data in
|
||||||
EE_DO = 1 shl 19 ; data out
|
EE_DO = 1 shl 3 ; data out
|
||||||
|
|
||||||
EE_READ = 110b
|
EE_READ = 110b
|
||||||
EE_WRITE = 101b
|
EE_WRITE = 101b
|
||||||
@ -182,7 +186,7 @@ proc START stdcall, state:dword
|
|||||||
|
|
||||||
.entry:
|
.entry:
|
||||||
|
|
||||||
DEBUGF 1,"Loading i8255x driver\n"
|
DEBUGF 1,"Loading %s driver\n", my_service
|
||||||
stdcall RegService, my_service, service_proc
|
stdcall RegService, my_service, service_proc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -252,20 +256,15 @@ proc service_proc stdcall, ioctl:dword
|
|||||||
; This device doesnt have its own eth_device structure yet, lets create one
|
; This device doesnt have its own eth_device structure yet, lets create one
|
||||||
.firstdevice:
|
.firstdevice:
|
||||||
cmp [devices], MAX_DEVICES ; First check if the driver can handle one more card
|
cmp [devices], MAX_DEVICES ; First check if the driver can handle one more card
|
||||||
jge .fail
|
jae .fail
|
||||||
|
|
||||||
push edx
|
allocate_and_clear ebx, sizeof.device_struct, .fail ; Allocate the buffer for device structure
|
||||||
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)
|
|
||||||
|
|
||||||
; Fill in the direct call addresses into the struct
|
; Fill in the direct call addresses into the struct
|
||||||
|
|
||||||
mov [device.reset], reset
|
mov [device.reset], reset
|
||||||
mov [device.transmit], transmit
|
mov [device.transmit], transmit
|
||||||
; mov [device.get_MAC], read_mac
|
mov [device.get_MAC], read_mac
|
||||||
mov [device.set_MAC], MAC_write
|
mov [device.set_MAC], MAC_write
|
||||||
mov [device.unload], unload
|
mov [device.unload], unload
|
||||||
mov [device.name], my_service
|
mov [device.name], my_service
|
||||||
@ -273,9 +272,9 @@ proc service_proc stdcall, ioctl:dword
|
|||||||
; save the pci bus and device numbers
|
; save the pci bus and device numbers
|
||||||
|
|
||||||
mov eax, [IOCTL.input]
|
mov eax, [IOCTL.input]
|
||||||
mov cl , [eax+1]
|
mov cl, [eax+1]
|
||||||
mov [device.pci_bus], cl
|
mov [device.pci_bus], cl
|
||||||
mov cl , [eax+2]
|
mov cl, [eax+2]
|
||||||
mov [device.pci_dev], cl
|
mov [device.pci_dev], cl
|
||||||
|
|
||||||
; Now, it's time to find the base io addres of the PCI device
|
; Now, it's time to find the base io addres of the PCI device
|
||||||
@ -660,34 +659,33 @@ transmit:
|
|||||||
align 4
|
align 4
|
||||||
int_handler:
|
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
|
; find pointer of device wich made IRQ occur
|
||||||
|
|
||||||
mov esi, device_list
|
|
||||||
mov ecx, [devices]
|
mov ecx, [devices]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .fail
|
jz .nothing
|
||||||
.nextdevice:
|
mov esi, device_list
|
||||||
mov ebx, dword [esi]
|
.nextdevice:
|
||||||
|
mov ebx, [esi]
|
||||||
|
|
||||||
set_io 0
|
set_io 0
|
||||||
;; set_io REG_ISR
|
set_io REG_ISR
|
||||||
;; in ax , dx
|
in ax, dx
|
||||||
;; out dx , ax ; send it back to ACK
|
out dx, ax ; send it back to ACK
|
||||||
|
test ax, ax
|
||||||
add esi, 4
|
|
||||||
|
|
||||||
test ax , ax
|
|
||||||
jnz .got_it
|
jnz .got_it
|
||||||
|
.continue:
|
||||||
|
add esi, 4
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz .nextdevice
|
jnz .nextdevice
|
||||||
|
.nothing:
|
||||||
ret ; If no device was found, abort (The irq was probably for a device, not registered to this driver)
|
ret ; If no device was found, abort (The irq was probably for a device, not registered to this driver)
|
||||||
|
|
||||||
.got_it:
|
.got_it:
|
||||||
|
|
||||||
|
DEBUGF 1,"Device: %x Status: %x ", ebx, ax
|
||||||
|
|
||||||
;;; receive
|
;;; receive
|
||||||
|
|
||||||
@ -730,7 +728,7 @@ int_handler:
|
|||||||
rep movsd
|
rep movsd
|
||||||
.nd:
|
.nd:
|
||||||
|
|
||||||
jmp EthReceiver ; Send it to kernel
|
jmp Eth_input
|
||||||
|
|
||||||
.nodata:
|
.nodata:
|
||||||
.fail:
|
.fail:
|
||||||
@ -899,39 +897,26 @@ ee_get_width:
|
|||||||
set_io 0
|
set_io 0
|
||||||
set_io reg_eeprom
|
set_io reg_eeprom
|
||||||
|
|
||||||
mov esi, EE_READ shl 28
|
mov si, EE_READ shl 12
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
|
|
||||||
.loop:
|
.loop:
|
||||||
mov eax, EE_CS
|
mov ax, EE_CS
|
||||||
out dx , eax
|
out dx, ax
|
||||||
delay
|
delay
|
||||||
|
|
||||||
or eax, EE_SK
|
or ax, EE_SK
|
||||||
out dx , eax
|
out dx, ax
|
||||||
delay
|
delay
|
||||||
|
|
||||||
inc ecx
|
inc ecx
|
||||||
|
|
||||||
in eax, dx
|
in ax, dx
|
||||||
test eax, EE_DO
|
test ax, EE_DO
|
||||||
jnz .loop
|
jnz .loop
|
||||||
|
|
||||||
mov [device.ee_bus_width], ecx
|
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
|
; de-activate the eeprom
|
||||||
@ -1000,12 +985,27 @@ mdio_write:
|
|||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
read_mac:
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
MAC_read_eeprom:
|
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
|
ret
|
||||||
|
|
||||||
|
@ -97,4 +97,6 @@ kernel_export \
|
|||||||
NetRegDev,\
|
NetRegDev,\
|
||||||
NetUnRegDev,\
|
NetUnRegDev,\
|
||||||
NetPtrToNum,\
|
NetPtrToNum,\
|
||||||
EthReceiver
|
EthReceiver,\
|
||||||
|
Eth_input,\
|
||||||
|
IPv4_input
|
||||||
|
@ -1157,7 +1157,7 @@ int_handler:
|
|||||||
|
|
||||||
push [esi + mtd_desc.skbuff]
|
push [esi + mtd_desc.skbuff]
|
||||||
|
|
||||||
jmp EthReceiver
|
jmp Eth_input
|
||||||
|
|
||||||
.rx_complete:
|
.rx_complete:
|
||||||
mov esi, [device.cur_rx]
|
mov esi, [device.cur_rx]
|
||||||
|
@ -1128,7 +1128,7 @@ int_handler:
|
|||||||
inc [device.cur_rx] ; update descriptor
|
inc [device.cur_rx] ; update descriptor
|
||||||
and [device.cur_rx], 3 ;
|
and [device.cur_rx], 3 ;
|
||||||
|
|
||||||
jmp EthReceiver ; Send the copied packet to kernel
|
jmp Eth_input
|
||||||
|
|
||||||
.abort:
|
.abort:
|
||||||
|
|
||||||
|
@ -1112,7 +1112,7 @@ int_handler:
|
|||||||
push ecx ; packet size
|
push ecx ; packet size
|
||||||
pushd [device.rxd + eax + 12] ; packet ptr
|
pushd [device.rxd + eax + 12] ; packet ptr
|
||||||
DEBUGF 1, "Packet received OK\n"
|
DEBUGF 1, "Packet received OK\n"
|
||||||
jmp EthReceiver
|
jmp Eth_input
|
||||||
.return:
|
.return:
|
||||||
pop ebx
|
pop ebx
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user