Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2980 → Rev 2981

/kernel/branches/net/core/exports.inc
95,7 → 95,8
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
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:
/kernel/branches/net/drivers/3c59x.asm
132,11 → 132,6
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
606,7 → 601,6
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
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
 
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
/kernel/branches/net/drivers/R6040.asm
929,7 → 929,7
 
; At last, send packet to kernel
 
jmp EthReceiver
jmp Eth_input
 
 
.no_RX:
/kernel/branches/net/drivers/RTL8029.asm
939,7 → 939,7
out dx, al
 
add esp, 14
jmp EthReceiver ; send it to the kernel
jmp Eth_input
 
.fail:
add esp, 14+8
/kernel/branches/net/drivers/RTL8139.asm
664,9 → 664,9
[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
DEBUGF 1,"Waiting for timeout\n"
 
push edx
mov esi, 300
mov esi, 30
stdcall Sleep
pop edx
 
831,7 → 831,7
rep movsd
.nd:
 
jmp EthReceiver ; Send it to kernel
jmp Eth_input ; Send it to kernel
 
.abort:
pop eax ebx
/kernel/branches/net/drivers/RTL8169.asm
1209,7 → 1209,7
inc [tpc.cur_rx]
and [tpc.cur_rx], NUM_RX_DESC - 1
 
jmp EthReceiver
jmp Eth_input
.rx_return:
 
pop ax
/kernel/branches/net/drivers/dec21x4x.asm
1176,7 → 1176,7
.nw:
rep movsd
 
jmp EthReceiver
jmp Eth_input
 
.continue_rx:
pop edi
/kernel/branches/net/drivers/i8254x.asm
506,6 → 506,16
 
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
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
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
 
/kernel/branches/net/drivers/i8255x.asm
53,7 → 53,7
 
.ee_bus_width dd ?
 
rb 5+8 ;;;; align
rb 0x100 - (($ - device) and 0xff)
 
rxfd:
.status dw ?
64,7 → 64,7
.size dw ?
.packet dd ?
 
rb 12 ;;;;
rb 0x100 - (($ - device) and 0xff)
 
txfd:
.status dw ?
77,6 → 77,8
.tx_buf_addr1 dd ?
.tx_buf_size1 dd ?
 
rb 0x100 - (($ - device) and 0xff)
 
confcmd:
.status: dw ?
.command: dw ?
83,6 → 85,8
.link: dd ?
.data rb 64
 
rb 0x100 - (($ - device) and 0xff)
 
lstats:
tx_good_frames dd ?
tx_coll16_errs dd ?
102,7 → 106,7
rx_colls_errs dd ?
rx_runt_errs dd ?
 
device_size = $ - device
sizeof.device_struct = $ - device
 
end virtual
 
109,10 → 113,10
 
; 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
 
.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
; 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
660,34 → 659,33
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
jz .nothing
mov esi, device_list
.nextdevice:
mov ebx, dword [esi]
mov ebx, [esi]
 
set_io 0
;; set_io REG_ISR
;; in ax , dx
;; out dx , ax ; send it back to ACK
 
add esi, 4
 
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
rep movsd
.nd:
 
jmp EthReceiver ; Send it to kernel
jmp Eth_input
 
.nodata:
.fail:
899,40 → 897,27
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,13 → 985,28
 
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
 
 
/kernel/branches/net/drivers/imports.inc
97,4 → 97,6
NetRegDev,\
NetUnRegDev,\
NetPtrToNum,\
EthReceiver
EthReceiver,\
Eth_input,\
IPv4_input
/kernel/branches/net/drivers/mtd80x.asm
1157,7 → 1157,7
 
push [esi + mtd_desc.skbuff]
 
jmp EthReceiver
jmp Eth_input
 
.rx_complete:
mov esi, [device.cur_rx]
/kernel/branches/net/drivers/pcnet32.asm
1128,7 → 1128,7
inc [device.cur_rx] ; update descriptor
and [device.cur_rx], 3 ;
 
jmp EthReceiver ; Send the copied packet to kernel
jmp Eth_input
 
.abort:
 
/kernel/branches/net/drivers/sis900.asm
1112,7 → 1112,7
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