/kernel/branches/net/drivers/3c59x.asm |
---|
132,6 → 132,11 |
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 |
589,7 → 594,7 |
DEBUGF 1,"Vendor id: 0x%x\n", ax |
cmp ax, 0x10B7 |
cmp ax , 0x10B7 |
jne .notfound |
shr eax, 16 |
598,9 → 603,10 |
; 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 |
2592,7 → 2598,7 |
jnz .dma_loop |
; registrate the received packet to kernel |
jmp Eth_input |
jmp EthReceiver |
; discard the top frame received |
.discard_frame: |
2890,43 → 2896,80 |
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 Eth_input |
jmp EthReceiver |
.no_RX: |
/kernel/branches/net/drivers/RTL8029.asm |
---|
939,7 → 939,7 |
out dx, al |
add esp, 14 |
jmp Eth_input |
jmp EthReceiver ; send it to the kernel |
.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 |
ja .fail |
jg .fail |
cmp dword [esp+8], 60 |
jb .fail |
jl .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, 30 |
mov esi, 300 |
stdcall Sleep |
pop edx |
831,7 → 831,7 |
rep movsd |
.nd: |
jmp Eth_input ; Send it to kernel |
jmp EthReceiver ; 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 Eth_input |
jmp EthReceiver |
.rx_return: |
pop ax |
/kernel/branches/net/drivers/dec21x4x.asm |
---|
1176,7 → 1176,7 |
.nw: |
rep movsd |
jmp Eth_input |
jmp EthReceiver |
.continue_rx: |
pop edi |
/kernel/branches/net/drivers/i8254x.asm |
---|
506,16 → 506,6 |
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 |
576,7 → 566,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+4+16 ;;;; hack! |
mov eax, -1 ;;;; hack! |
mov [esi + REG_IMS], eax ; Enable interrupt types |
mov [device.mtu], 1514 |
758,7 → 748,7 |
mov dword [esi + REG_RDH], 0x00000000 ; Receive Descriptor Head |
mov dword [esi + REG_RDT], 0x00000001 ; Receive Descriptor Tail |
jmp Eth_input |
jmp EthReceiver |
.retaddr: |
pop eax |
/kernel/branches/net/drivers/mtd80x.asm |
---|
1157,7 → 1157,7 |
push [esi + mtd_desc.skbuff] |
jmp Eth_input |
jmp EthReceiver |
.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 Eth_input |
jmp EthReceiver ; Send the copied packet to kernel |
.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 Eth_input |
jmp EthReceiver |
.return: |
pop ebx |
/kernel/branches/net/drivers/i8255x.asm |
---|
53,7 → 53,7 |
.ee_bus_width dd ? |
rb 0x100 - (($ - device) and 0xff) |
rb 5+8 ;;;; align |
rxfd: |
.status dw ? |
64,7 → 64,7 |
.size dw ? |
.packet dd ? |
rb 0x100 - (($ - device) and 0xff) |
rb 12 ;;;; |
txfd: |
.status dw ? |
77,8 → 77,6 |
.tx_buf_addr1 dd ? |
.tx_buf_size1 dd ? |
rb 0x100 - (($ - device) and 0xff) |
confcmd: |
.status: dw ? |
.command: dw ? |
85,8 → 83,6 |
.link: dd ? |
.data rb 64 |
rb 0x100 - (($ - device) and 0xff) |
lstats: |
tx_good_frames dd ? |
tx_coll16_errs dd ? |
106,7 → 102,7 |
rx_colls_errs dd ? |
rx_runt_errs dd ? |
sizeof.device_struct = $ - device |
device_size = $ - device |
end virtual |
113,10 → 109,10 |
; Serial EEPROM |
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_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_READ = 110b |
EE_WRITE = 101b |
186,7 → 182,7 |
.entry: |
DEBUGF 1,"Loading %s driver\n", my_service |
DEBUGF 1,"Loading i8255x driver\n" |
stdcall RegService, my_service, service_proc |
ret |
256,15 → 252,20 |
; 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 |
jae .fail |
jge .fail |
allocate_and_clear ebx, sizeof.device_struct, .fail ; Allocate the buffer for device structure |
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) |
; 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 |
272,9 → 273,9 |
; 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 |
659,33 → 660,34 |
align 4 |
int_handler: |
DEBUGF 1,"\n%s int\n", my_service |
DEBUGF 1,"IRQ %x ",eax:2 ; no, you cant replace 'eax:2' with 'al', this must be a bug in FDO |
; find pointer of device wich made IRQ occur |
mov esi, device_list |
mov ecx, [devices] |
test ecx, ecx |
jz .nothing |
mov esi, device_list |
.nextdevice: |
mov ebx, [esi] |
jz .fail |
.nextdevice: |
mov ebx, dword [esi] |
set_io 0 |
set_io REG_ISR |
in ax, dx |
out dx, ax ; send it back to ACK |
test ax, ax |
;; set_io REG_ISR |
;; in ax , dx |
;; out dx , ax ; send it back to ACK |
add esi, 4 |
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 |
728,7 → 730,7 |
rep movsd |
.nd: |
jmp Eth_input |
jmp EthReceiver ; Send it to kernel |
.nodata: |
.fail: |
897,27 → 899,40 |
set_io 0 |
set_io reg_eeprom |
mov si, EE_READ shl 12 |
mov esi, EE_READ shl 28 |
xor ecx, ecx |
.loop: |
mov ax, EE_CS |
out dx, ax |
mov eax, EE_CS |
out dx , eax |
delay |
or ax, EE_SK |
out dx, ax |
or eax, EE_SK |
out dx , eax |
delay |
inc ecx |
in ax, dx |
test ax, EE_DO |
in eax, dx |
test eax, 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 |
985,28 → 1000,13 |
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,6 → 97,4 |
NetRegDev,\ |
NetUnRegDev,\ |
NetPtrToNum,\ |
EthReceiver,\ |
Eth_input,\ |
IPv4_input |
EthReceiver |
/kernel/branches/net/core/exports.inc |
---|
95,8 → 95,7 |
szNetRegDev db 'NetRegDev',0 |
szNetUnRegDev db 'NetUnRegDev',0 |
szNetPtrToNum db 'NetPtrToNum',0 |
szEth_input db 'EthReceiver',0 ; To be removed ! |
szEth_input db 'Eth_input',0 |
szEthReceiver db 'EthReceiver',0 |
szIPv4_input db 'IPv4_input',0 |
184,7 → 183,7 |
dd szNetRegDev , NET_add_device |
dd szNetUnRegDev , NET_remove_device |
dd szNetPtrToNum , NET_ptr_to_num |
dd szEth_input , ETH_input |
dd szEthReceiver , ETH_input |
dd szIPv4_input , IPv4_input |
exp_lfb: |