Rev 5522 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5522 | Rev 9188 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2021. 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 | ;; 3Com network driver for KolibriOS ;; |
6 | ;; 3Com network driver for KolibriOS ;; |
7 | ;; ;; |
7 | ;; ;; |
8 | ;; Ported to KolibriOS net-branch by hidnplayr ;; |
8 | ;; Ported to KolibriOS net-branch by hidnplayr ;; |
Line 88... | Line 88... | ||
88 | 88 | ||
89 | CURRENT_API = 0x0200 |
89 | CURRENT_API = 0x0200 |
90 | COMPATIBLE_API = 0x0100 |
90 | COMPATIBLE_API = 0x0100 |
Line -... | Line 91... | ||
- | 91 | API_VERSION = (COMPATIBLE_API shl 16) + CURRENT_API |
|
- | 92 | ||
91 | API_VERSION = (COMPATIBLE_API shl 16) + CURRENT_API |
93 | ; configureable area |
- | 94 | ||
92 | 95 | MAX_DEVICES = 16 ; Maximum number of devices this driver may handle |
|
Line 93... | Line 96... | ||
93 | MAX_DEVICES = 16 |
96 | |
94 | FORCE_FD = 0 ; forcing full duplex mode makes sense at some cards and link types |
97 | FORCE_FD = 0 ; forcing full duplex mode makes sense at some cards and link types |
Line 95... | Line 98... | ||
95 | 98 | ||
96 | NUM_RX_DESC = 4 ; a power of 2 number |
99 | NUM_RX_DESC = 32 ; Number of receive descriptors (must be power of 2) |
Line -... | Line 100... | ||
- | 100 | NUM_TX_DESC = 16 ; Number of transmit descriptors (must be power of 2) |
|
- | 101 | ||
97 | NUM_TX_DESC = 4 ; a power of 2 number |
102 | __DEBUG__ = 1 ; 1 = on, 0 = off |
Line 98... | Line 103... | ||
98 | 103 | __DEBUG_LEVEL__ = 2 ; 1 = verbose, 2 = errors only |
|
99 | __DEBUG__ = 1 |
104 | |
100 | __DEBUG_LEVEL__ = 2 ; 1 = verbose, 2 = errors only |
105 | ; end configureable area |
101 | 106 | ||
102 | section '.flat' readable writable executable |
107 | section '.flat' readable writable executable |
Line -... | Line 108... | ||
- | 108 | ||
- | 109 | include '../proc32.inc' |
|
- | 110 | include '../struct.inc' |
|
- | 111 | include '../macros.inc' |
|
- | 112 | include '../fdo.inc' |
|
- | 113 | include '../netdrv.inc' |
|
- | 114 | ||
- | 115 | ||
- | 116 | if (bsr NUM_RX_DESC)>(bsf NUM_RX_DESC) |
|
- | 117 | display 'NUM_RX_DESC must be a power of two' |
|
- | 118 | err |
|
103 | 119 | end if |
|
104 | include '../proc32.inc' |
120 | |
105 | include '../struct.inc' |
121 | if (bsr NUM_TX_DESC)>(bsf NUM_TX_DESC) |
106 | include '../macros.inc' |
122 | display 'NUM_TX_DESC must be a power of two' |
107 | include '../fdo.inc' |
123 | err |
Line 400... | Line 416... | ||
400 | cmp byte [eax], 1 ; 1 means device number and bus number (pci) are given |
416 | cmp byte [eax], 1 ; 1 means device number and bus number (pci) are given |
401 | jne .fail ; other types of this hardware dont exist |
417 | jne .fail ; other types of this hardware dont exist |
Line 402... | Line 418... | ||
402 | 418 | ||
Line 403... | Line 419... | ||
403 | ; check if the device is already listed |
419 | ; check if the device is already listed |
404 | 420 | ||
405 | mov ecx, [vortex_devices] |
421 | mov ecx, [devices] |
Line 406... | Line 422... | ||
406 | test ecx, ecx |
422 | test ecx, ecx |
407 | jz .maybeboomerang |
423 | jz .firstdevice |
408 | 424 | ||
409 | mov esi, vortex_list |
425 | mov esi, device_list |
410 | mov eax, [edx + IOCTL.input] ; get the pci bus and device numbers |
426 | mov eax, [edx + IOCTL.input] ; get the pci bus and device numbers |
411 | mov ax , [eax+1] ; |
427 | mov ax , [eax+1] ; |
Line 417... | Line 433... | ||
417 | je .find_devicenum ; Device is already loaded, let's find it's device number |
433 | je .find_devicenum ; Device is already loaded, let's find it's device number |
418 | @@: |
434 | @@: |
419 | add esi, 4 |
435 | add esi, 4 |
420 | loop .nextdevice |
436 | loop .nextdevice |
Line 421... | Line -... | ||
421 | - | ||
422 | - | ||
423 | .maybeboomerang: |
- | |
424 | mov ecx, [boomerang_devices] |
- | |
425 | test ecx, ecx |
- | |
426 | jz .firstdevice |
- | |
427 | - | ||
428 | mov esi, boomerang_list |
- | |
429 | mov eax, [edx + IOCTL.input] ; get the pci bus and device numbers |
- | |
430 | mov ax, [eax+1] ; |
- | |
431 | .nextdevice2: |
- | |
432 | mov ebx, [esi] |
- | |
433 | cmp al, byte[ebx + device.pci_bus] |
- | |
434 | jne @f |
- | |
435 | cmp ah, byte[ebx + device.pci_dev] |
- | |
436 | je .find_devicenum ; Device is already loaded, let's find it's device number |
- | |
437 | @@: |
- | |
438 | add esi, 4 |
- | |
439 | loop .nextdevice2 |
- | |
440 | - | ||
441 | 437 | ||
442 | ; This device doesnt have its own eth_device structure yet, lets create one |
438 | ; This device doesnt have its own eth_device structure yet, lets create one |
443 | .firstdevice: |
- | |
444 | mov ecx, [boomerang_devices] |
- | |
445 | add ecx, [vortex_devices] |
439 | .firstdevice: |
446 | cmp ecx, MAX_DEVICES ; First check if the driver can handle one more card |
440 | cmp [devices], MAX_DEVICES ; First check if the driver can handle one more card |
Line 447... | Line 441... | ||
447 | jae .fail |
441 | jae .fail |
Line 448... | Line 442... | ||
448 | 442 | ||
Line 479... | Line 473... | ||
479 | ; Ok, the eth_device structure is ready, let's probe the device |
473 | ; Ok, the eth_device structure is ready, let's probe the device |
480 | call probe ; this function will output in eax |
474 | call probe ; this function will output in eax |
481 | test eax, eax |
475 | test eax, eax |
482 | jnz .err ; If an error occured, exit |
476 | jnz .err ; If an error occured, exit |
Line 483... | Line -... | ||
483 | - | ||
484 | - | ||
485 | movzx ecx, [ebx + device.ver_id] |
- | |
486 | test word [hw_versions+2+ecx*4], IS_VORTEX |
- | |
487 | jz .not_vortex |
- | |
488 | 477 | ||
489 | mov eax, [vortex_devices] ; Add the device structure to our device list |
478 | mov eax, [devices] ; Add the device structure to our device list |
490 | mov [vortex_list+4*eax], ebx ; (IRQ handler uses this list to find device) |
479 | mov [device_list+4*eax], ebx ; |
Line 491... | Line 480... | ||
491 | inc [vortex_devices] ; |
480 | inc [devices] ; |
492 | 481 | ||
493 | .register: |
482 | .register: |
Line 498... | Line 487... | ||
498 | je .destroy |
487 | je .destroy |
Line 499... | Line 488... | ||
499 | 488 | ||
500 | call start_device |
489 | call start_device |
Line 501... | Line -... | ||
501 | ret |
- | |
502 | - | ||
503 | .not_vortex: |
- | |
504 | mov eax, [boomerang_devices] ; Add the device structure to our device list |
- | |
505 | mov [boomerang_list+4*eax], ebx ; (IRQ handler uses this list to find device) |
- | |
506 | inc [boomerang_devices] |
- | |
507 | - | ||
508 | jmp .register |
490 | ret |
Line 509... | Line 491... | ||
509 | 491 | ||
510 | ; If the device was already loaded, find the device number and return it in eax |
492 | ; If the device was already loaded, find the device number and return it in eax |
511 | 493 | ||
Line 695... | Line 677... | ||
695 | set_io [ebx + device.io_addr], REG_COMMAND |
677 | set_io [ebx + device.io_addr], REG_COMMAND |
696 | xor eax, eax |
678 | xor eax, eax |
697 | ; or al, 0x14 |
679 | ; or al, 0x14 |
698 | out dx, ax |
680 | out dx, ax |
699 | ; wait for GlobalReset to complete |
681 | ; wait for GlobalReset to complete |
700 | mov ecx, 64000 |
682 | mov ecx, 2000 |
701 | .rsloop: |
683 | .rsloop: |
702 | in ax , dx |
684 | in ax, dx |
703 | test ah , 10000b ; CmdInProgress |
685 | test ah, 10000b ; CmdInProgress |
- | 686 | ||
- | 687 | pusha |
|
- | 688 | mov esi, 1 |
|
- | 689 | invoke Sleep |
|
- | 690 | popa |
|
- | 691 | ||
704 | loopz .rsloop |
692 | loopz .rsloop |
Line 705... | Line 693... | ||
705 | 693 | ||
706 | DEBUGF 1,"Waiting for nic to boot..\n" |
694 | DEBUGF 1,"Waiting for NIC to boot..\n" |
707 | ; wait for 2 seconds for NIC to boot |
695 | ; wait for 2 seconds for NIC to boot |
708 | mov esi, 2000 ; WTF? FIXME |
696 | mov esi, 2000 ; WTF? FIXME |
Line 709... | Line 697... | ||
709 | invoke Sleep ; 2 seconds |
697 | invoke Sleep ; 2 seconds |
Line 1138... | Line 1126... | ||
1138 | DEBUGF 1,"PHY=%u\n", ah |
1126 | DEBUGF 1,"PHY=%u\n", ah |
1139 | DEBUGF 1,"Detecting if device is auto-negotiation capable\n" |
1127 | DEBUGF 1,"Detecting if device is auto-negotiation capable\n" |
Line 1140... | Line 1128... | ||
1140 | 1128 | ||
1141 | mov al, MII_BMCR |
1129 | mov al, MII_BMCR |
1142 | push eax |
1130 | push eax |
1143 | call mdio_read ; returns with window #4 |
1131 | call mdio_read |
1144 | or ah, 0x80 ; software reset |
1132 | or ax, BMCR_RESET |
1145 | mov esi, eax |
1133 | mov esi, eax |
1146 | mov eax, [esp] |
1134 | mov eax, [esp] |
Line 1147... | Line 1135... | ||
1147 | call mdio_write ; returns with window #4 |
1135 | call mdio_write |
1148 | 1136 | ||
1149 | ; wait for reset to complete |
1137 | ; wait for reset to complete |
- | 1138 | mov esi, 2000 |
|
1150 | mov esi, 2000 |
1139 | invoke Sleep ; 2s FIXME |
- | 1140 | ||
1151 | invoke Sleep ; 2s FIXME |
1141 | mov eax, [esp] |
1152 | mov eax, [esp] |
1142 | mov al, MII_BMCR |
1153 | call mdio_read ; returns with window #4 |
1143 | call mdio_read |
1154 | test ah, 0x80 |
- | |
Line 1155... | Line 1144... | ||
1155 | jnz .fail1 |
1144 | test ax, BMCR_RESET |
1156 | mov eax, [esp] |
1145 | jnz .fail1 |
1157 | 1146 | ||
- | 1147 | ; wait for a while after reset |
|
1158 | ; wait for a while after reset |
1148 | mov esi, 20 |
1159 | mov esi, 20 |
1149 | invoke Sleep ; 20ms |
1160 | invoke Sleep ; 20ms |
1150 | |
1161 | mov eax, [esp] |
1151 | mov eax, [esp] |
1162 | mov al , MII_BMSR |
1152 | mov al, MII_BMSR |
1163 | call mdio_read ; returns with window #4 |
1153 | call mdio_read |
1164 | test al, 1 ; extended capability supported? |
- | |
1165 | jz .fail2 |
- | |
1166 | DEBUGF 1,"Extended capability supported\n" |
1154 | test al, BMSR_ERCAP |
1167 | 1155 | jz .fail2 |
|
1168 | ; auto-neg capable? |
1156 | DEBUGF 1,"Extended capability supported\n" |
1169 | test al , 1000b |
- | |
1170 | jz .fail2 ; not auto-negotiation capable |
- | |
1171 | DEBUGF 1,"Auto-negotiation capable\n" |
1157 | test al, BMSR_ANEGCAPABLE |
1172 | 1158 | jz .fail2 |
|
1173 | ; auto-neg complete? |
1159 | DEBUGF 1,"Auto-negotiation capable\n" |
Line 1174... | Line 1160... | ||
1174 | test al , 100000b |
1160 | test al, BMSR_ANEGCOMPLETE |
1175 | jnz .auto_neg_ok |
1161 | jnz .auto_neg_ok |
1176 | DEBUGF 1,"Restarting auto-negotiation\n" |
1162 | DEBUGF 1,"Restarting auto-negotiation\n" |
1177 | 1163 | ||
1178 | ; restart auto-negotiation |
1164 | ; restart auto-negotiation |
1179 | mov eax, [esp] |
1165 | mov eax, [esp] |
1180 | mov al, MII_ADVERTISE |
1166 | mov al, MII_ADVERTISE |
1181 | push eax |
1167 | push eax |
1182 | call mdio_read ; returns with window #4 |
1168 | call mdio_read ; returns with window #4 |
1183 | or ax , 1111b shl 5; advertise only 10base-T and 100base-TX |
1169 | or ax, ADVERTISE_10HALF or ADVERTISE_10FULL or ADVERTISE_100HALF or ADVERTISE_100FULL |
1184 | mov esi, eax |
1170 | mov esi, eax |
1185 | pop eax |
1171 | pop eax |
1186 | call mdio_write ; returns with window #4 |
1172 | call mdio_write ; returns with window #4 |
1187 | mov eax, [esp] |
1173 | mov eax, [esp] |
1188 | call mdio_read ; returns with window #4 |
1174 | call mdio_read ; returns with window #4 |
1189 | mov esi, eax |
1175 | mov esi, eax |
1190 | or bh , 10010b ; restart auto-negotiation |
1176 | or bx, BMCR_ANENABLE or BMCR_ANRESTART |
1191 | mov eax, [esp] |
1177 | mov eax, [esp] |
- | 1178 | call mdio_write ; returns with window #4 |
|
1192 | call mdio_write ; returns with window #4 |
1179 | mov esi, 4000 |
1193 | mov esi, 4000 |
1180 | invoke Sleep ; 4 seconds |
1194 | invoke Sleep ; 4 seconds |
1181 | mov eax, [esp] |
1195 | mov eax, [esp] |
1182 | |
- | 1183 | mov al, MII_BMSR |
|
1196 | mov al , MII_BMSR |
1184 | call mdio_read ; returns with window #4 |
1197 | call mdio_read ; returns with window #4 |
1185 | test al, BMSR_ANEGCOMPLETE |
1198 | test al , 100000b ; auto-neg complete? |
1186 | jnz .auto_neg_ok |
Line 1199... | Line 1187... | ||
1199 | jnz .auto_neg_ok |
1187 | |
Line 2135... | Line 2123... | ||
2135 | 2123 | ||
2136 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2124 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2137 | ;; ;; |
2125 | ;; ;; |
2138 | ;; Transmit (vortex) ;; |
2126 | ;; Transmit (vortex) ;; |
2139 | ;; ;; |
2127 | ;; ;; |
2140 | ;; In: buffer pointer in [esp+4] ;; |
2128 | ;; In: pointer to device structure in ebx ;; |
2141 | ;; pointer to device structure in ebx ;; |
2129 | ;; Out: eax = 0 on success ;; |
2142 | ;; ;; |
2130 | ;; ;; |
2143 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2131 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2144 | 2132 | align 16 |
|
Line 2145... | Line 2133... | ||
2145 | proc vortex_transmit stdcall bufferptr |
2133 | proc vortex_transmit stdcall bufferptr |
2146 | - | ||
Line 2147... | Line 2134... | ||
2147 | pushf |
2134 | |
2148 | cli |
2135 | spin_lock_irqsave |
2149 | 2136 | ||
2150 | mov esi, [bufferptr] |
2137 | mov esi, [bufferptr] |
2151 | DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n", [bufferptr], [esi + NET_BUFF.length] |
2138 | DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n", [bufferptr], [esi + NET_BUFF.length] |
2152 | lea eax, [esi + NET_BUFF.data] |
2139 | lea eax, [esi + NET_BUFF.data] |
2153 | DEBUGF 1,"To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\ |
2140 | DEBUGF 1,"To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\ |
Line 2154... | Line 2141... | ||
2154 | [eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\ |
2141 | [eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\ |
2155 | [eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\ |
2142 | [eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\ |
2156 | [eax+13]:2,[eax+12]:2 |
2143 | [eax+13]:2,[eax+12]:2 |
2157 | 2144 | ||
Line 2158... | Line 2145... | ||
2158 | cmp [esi + NET_BUFF.length], 1514 |
2145 | cmp [esi + NET_BUFF.length], 1514 |
Line 2159... | Line 2146... | ||
2159 | ja .fail |
2146 | ja .error |
2160 | cmp [esi + NET_BUFF.length], 60 |
2147 | cmp [esi + NET_BUFF.length], 60 |
Line 2170... | Line 2157... | ||
2170 | 2157 | ||
2171 | ; check for master operation in progress |
2158 | ; check for master operation in progress |
2172 | set_io [ebx + device.io_addr], REG_MASTER_STATUS |
2159 | set_io [ebx + device.io_addr], REG_MASTER_STATUS |
2173 | in ax, dx |
2160 | in ax, dx |
2174 | test ah, 0x80 |
2161 | test ah, 0x80 |
Line 2175... | Line 2162... | ||
2175 | jnz .fail ; no DMA for sending |
2162 | jnz .overrun ; no DMA for sending |
2176 | 2163 | ||
2177 | ; program frame address to be sent |
2164 | ; program frame address to be sent |
2178 | set_io [ebx + device.io_addr], REG_MASTER_ADDRESS |
2165 | set_io [ebx + device.io_addr], REG_MASTER_ADDRESS |
Line 2188... | Line 2175... | ||
2188 | 2175 | ||
2189 | ; start DMA Down |
2176 | ; start DMA Down |
2190 | set_io [ebx + device.io_addr], REG_COMMAND |
2177 | set_io [ebx + device.io_addr], REG_COMMAND |
2191 | mov ax, (10100b shl 11) + 1 ; StartDMADown |
2178 | mov ax, (10100b shl 11) + 1 ; StartDMADown |
- | 2179 | out dx, ax |
|
2192 | out dx, ax |
2180 | |
- | 2181 | ; Update stats |
|
- | 2182 | inc [ebx + device.packets_tx] |
|
- | 2183 | mov eax, [esi + NET_BUFF.length] |
|
- | 2184 | add dword[ebx + device.bytes_tx], eax |
|
- | 2185 | adc dword[ebx + device.bytes_tx + 4], 0 |
|
2193 | .finish: |
2186 | |
2194 | popf |
2187 | spin_unlock_irqrestore |
2195 | xor eax, eax |
2188 | xor eax, eax |
Line 2196... | Line 2189... | ||
2196 | ret |
2189 | ret |
- | 2190 | ||
- | 2191 | .error: |
|
- | 2192 | DEBUGF 2, "TX packet error\n" |
|
- | 2193 | inc [ebx + device.packets_tx_err] |
|
- | 2194 | invoke NetFree, [bufferptr] |
|
- | 2195 | ||
- | 2196 | spin_unlock_irqrestore |
|
- | 2197 | or eax, -1 |
|
- | 2198 | ret |
|
2197 | 2199 | ||
- | 2200 | .overrun: |
|
2198 | .fail: |
2201 | DEBUGF 2, "TX overrun\n" |
- | 2202 | inc [ebx + device.packets_tx_ovr] |
|
2199 | DEBUGF 2,"Send failed\n" |
2203 | invoke NetFree, [bufferptr] |
2200 | invoke NetFree, [bufferptr] |
2204 | |
2201 | popf |
2205 | spin_unlock_irqrestore |
Line 2202... | Line 2206... | ||
2202 | or eax, -1 |
2206 | or eax, -1 |
Line 2203... | Line 2207... | ||
2203 | ret |
2207 | ret |
2204 | 2208 | ||
2205 | endp |
2209 | endp |
2206 | 2210 | ||
2207 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2211 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2208 | ;; ;; |
2212 | ;; ;; |
2209 | ;; Transmit (boomerang) ;; |
2213 | ;; Transmit (boomerang) ;; |
2210 | ;; ;; |
2214 | ;; ;; |
2211 | ;; In: buffer pointer in [esp+4] ;; |
2215 | ;; In: pointer to device structure in ebx ;; |
2212 | ;; pointer to device structure in ebx ;; |
2216 | ;; Out: eax = 0 on success ;; |
Line 2213... | Line 2217... | ||
2213 | ;; ;; |
2217 | ;; ;; |
2214 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
- | |
Line 2215... | Line 2218... | ||
2215 | 2218 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
2216 | proc boomerang_transmit stdcall bufferptr |
2219 | align 16 |
2217 | 2220 | proc boomerang_transmit stdcall bufferptr |
|
2218 | pushf |
2221 | |
2219 | cli |
2222 | spin_lock_irqsave |
2220 | 2223 | ||
2221 | mov esi, [bufferptr] |
2224 | mov esi, [bufferptr] |
Line 2222... | Line 2225... | ||
2222 | DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n", [bufferptr], [esi + NET_BUFF.length] |
2225 | DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n", [bufferptr], [esi + NET_BUFF.length] |
2223 | lea eax, [esi + NET_BUFF.data] |
2226 | lea eax, [esi + NET_BUFF.data] |
2224 | DEBUGF 1,"To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\ |
2227 | DEBUGF 1,"To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\ |
2225 | [eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\ |
2228 | [eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\ |
Line 2226... | Line 2229... | ||
2226 | [eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\ |
2229 | [eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\ |
Line 2227... | Line 2230... | ||
2227 | [eax+13]:2,[eax+12]:2 |
2230 | [eax+13]:2,[eax+12]:2 |
2228 | 2231 | ||
Line 2337... | Line 2340... | ||
2337 | mov ax, ((110b shl 11)+3) |
2340 | mov ax, ((110b shl 11)+3) |
2338 | out dx, ax |
2341 | out dx, ax |
Line 2339... | Line 2342... | ||
2339 | 2342 | ||
2340 | .finish: |
2343 | .finish: |
- | 2344 | mov [ebx + device.curr_tx], edi |
|
2341 | mov [ebx + device.curr_tx], edi |
2345 | |
- | 2346 | ; Update stats |
|
- | 2347 | inc [ebx + device.packets_tx] |
|
- | 2348 | mov eax, [esi + NET_BUFF.length] |
|
- | 2349 | add dword[ebx + device.bytes_tx], eax |
|
- | 2350 | adc dword[ebx + device.bytes_tx + 4], 0 |
|
- | 2351 | ||
2342 | popf |
2352 | spin_unlock_irqrestore |
2343 | xor eax, eax |
2353 | xor eax, eax |
Line 2344... | Line 2354... | ||
2344 | ret |
2354 | ret |
- | 2355 | ||
- | 2356 | .error: |
|
- | 2357 | DEBUGF 2, "TX packet error\n" |
|
- | 2358 | inc [ebx + device.packets_tx_err] |
|
- | 2359 | invoke NetFree, [bufferptr] |
|
- | 2360 | ||
- | 2361 | spin_unlock_irqrestore |
|
- | 2362 | or eax, -1 |
|
- | 2363 | ret |
|
2345 | 2364 | ||
- | 2365 | .overrun: |
|
2346 | .fail: |
2366 | DEBUGF 2, "TX overrun\n" |
- | 2367 | inc [ebx + device.packets_tx_ovr] |
|
2347 | DEBUGF 2,"Send failed\n" |
2368 | invoke NetFree, [bufferptr] |
2348 | invoke NetFree, [bufferptr] |
2369 | |
2349 | popf |
2370 | spin_unlock_irqrestore |
Line 2350... | Line 2371... | ||
2350 | or eax, -1 |
2371 | or eax, -1 |
Line 2446... | Line 2467... | ||
2446 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2467 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2447 | ;; ;; |
2468 | ;; ;; |
2448 | ;; Vortex Interrupt handler ;; |
2469 | ;; Vortex Interrupt handler ;; |
2449 | ;; ;; |
2470 | ;; ;; |
2450 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2471 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2451 | - | ||
2452 | align 4 |
2472 | align 16 |
2453 | int_vortex: |
2473 | int_vortex: |
Line 2454... | Line 2474... | ||
2454 | 2474 | ||
Line 2455... | Line -... | ||
2455 | push ebx esi edi |
- | |
2456 | - | ||
2457 | DEBUGF 1,"INT\n" |
- | |
2458 | - | ||
2459 | ; find pointer of device wich made IRQ occur |
2475 | push ebx esi edi |
2460 | 2476 | ||
2461 | mov ecx, [vortex_devices] |
- | |
2462 | test ecx, ecx |
- | |
2463 | jz .nothing |
- | |
2464 | mov esi, vortex_list |
- | |
Line -... | Line 2477... | ||
- | 2477 | mov ebx, [esp+4*4] |
|
Line 2465... | Line 2478... | ||
2465 | .nextdevice: |
2478 | DEBUGF 1,"INT for 0x%x\n", ebx |
2466 | mov ebx, [esi] |
2479 | |
2467 | 2480 | ; TODO? if we are paranoid, we can check that the value from ebx is present in the current device_list |
|
2468 | 2481 | ||
2469 | set_io [ebx + device.io_addr], 0 |
2482 | set_io [ebx + device.io_addr], 0 |
Line 2470... | Line -... | ||
2470 | set_io [ebx + device.io_addr], REG_INT_STATUS |
- | |
2471 | in ax, dx |
- | |
2472 | and ax, S_5_INTS |
- | |
2473 | jnz .nothing |
- | |
2474 | - | ||
2475 | add esi, 4 |
- | |
2476 | - | ||
2477 | test ax , ax |
- | |
2478 | jnz .got_it |
- | |
2479 | loop .nextdevice |
- | |
2480 | - | ||
2481 | .nothing: |
- | |
2482 | pop edi esi ebx |
- | |
2483 | xor eax, eax |
- | |
2484 | 2483 | set_io [ebx + device.io_addr], REG_INT_STATUS |
|
Line 2485... | Line 2484... | ||
2485 | ret |
2484 | in ax, dx |
2486 | 2485 | and ax, S_5_INTS |
|
Line 2487... | Line 2486... | ||
2487 | .got_it: |
2486 | jnz .nothing |
Line 2574... | Line 2573... | ||
2574 | set_io [ebx + device.io_addr], REG_COMMAND |
2573 | set_io [ebx + device.io_addr], REG_COMMAND |
2575 | mov ax, (01000b shl 11) |
2574 | mov ax, (01000b shl 11) |
2576 | out dx, ax |
2575 | out dx, ax |
Line 2577... | Line 2576... | ||
2577 | 2576 | ||
2578 | .finish: |
- | |
2579 | - | ||
2580 | 2577 | .finish: |
|
2581 | .noRX: |
- | |
2582 | 2578 | .noRX: |
|
2583 | test ax, DMADone |
2579 | test ax, DMADone |
Line 2584... | Line 2580... | ||
2584 | jz .noDMA |
2580 | jz .noDMA |
Line 2593... | Line 2589... | ||
2593 | 2589 | ||
2594 | mov ax, 0x1000 |
2590 | mov ax, 0x1000 |
Line 2595... | Line 2591... | ||
2595 | out dx, ax |
2591 | out dx, ax |
2596 | - | ||
2597 | .nodmaclear: |
2592 | |
Line 2598... | Line 2593... | ||
2598 | 2593 | .nodmaclear: |
|
Line 2599... | Line -... | ||
2599 | pop ax |
- | |
2600 | - | ||
2601 | DEBUGF 1, "DMA Done!\n", cx |
2594 | pop ax |
2602 | - | ||
2603 | - | ||
2604 | - | ||
2605 | .noDMA: |
2595 | |
2606 | 2596 | DEBUGF 1, "DMA Done!\n", cx |
|
2607 | 2597 | ||
2608 | 2598 | .noDMA: |
|
2609 | .ACK: |
2599 | .ACK: |
Line 2610... | Line 2600... | ||
2610 | set_io [ebx + device.io_addr], 0 |
2600 | set_io [ebx + device.io_addr], 0 |
- | 2601 | set_io [ebx + device.io_addr], REG_COMMAND |
|
- | 2602 | mov ax, AckIntr + IntReq + IntLatch |
|
- | 2603 | out dx, ax |
|
- | 2604 | ||
- | 2605 | pop edi esi ebx |
|
- | 2606 | xor eax, eax |
|
- | 2607 | inc eax |
|
- | 2608 | ||
Line 2611... | Line 2609... | ||
2611 | set_io [ebx + device.io_addr], REG_COMMAND |
2609 | ret |
Line 2622... | Line 2620... | ||
2622 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2620 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2623 | ;; ;; |
2621 | ;; ;; |
2624 | ;; Boomerang Interrupt handler ;; |
2622 | ;; Boomerang Interrupt handler ;; |
2625 | ;; ;; |
2623 | ;; ;; |
2626 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2624 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2627 | - | ||
2628 | align 4 |
2625 | align 16 |
2629 | int_boomerang: |
2626 | int_boomerang: |
Line 2630... | Line 2627... | ||
2630 | 2627 | ||
Line -... | Line 2628... | ||
- | 2628 | push ebx esi edi |
|
2631 | push ebx esi edi |
2629 | |
Line 2632... | Line -... | ||
2632 | - | ||
2633 | DEBUGF 1,"INT\n" |
- | |
2634 | 2630 | mov ebx, [esp+4*4] |
|
2635 | ; find pointer of device wich made IRQ occur |
- | |
2636 | - | ||
2637 | mov ecx, [boomerang_devices] |
- | |
2638 | test ecx, ecx |
- | |
2639 | jz .nothing |
- | |
Line 2640... | Line 2631... | ||
2640 | mov esi, boomerang_list |
2631 | DEBUGF 1,"INT for 0x%x\n", ebx |
2641 | .nextdevice: |
2632 | |
2642 | mov ebx, [esi] |
2633 | ; TODO? if we are paranoid, we can check that the value from ebx is present in the current device_list |
2643 | 2634 | ||
2644 | set_io [ebx + device.io_addr], 0 |
2635 | set_io [ebx + device.io_addr], 0 |
2645 | set_io [ebx + device.io_addr], REG_INT_STATUS |
- | |
2646 | in ax, dx |
- | |
2647 | test ax, S_5_INTS |
- | |
2648 | jnz .got_it |
- | |
2649 | .continue: |
- | |
2650 | add esi, 4 |
- | |
2651 | dec ecx |
- | |
2652 | jnz .nextdevice |
- | |
2653 | .nothing: |
- | |
2654 | pop edi esi ebx |
- | |
2655 | xor eax, eax |
2636 | set_io [ebx + device.io_addr], REG_INT_STATUS |
- | 2637 | in ax, dx |
|
Line 2656... | Line -... | ||
2656 | - | ||
2657 | ret |
2638 | test ax, S_5_INTS |
Line 2658... | Line 2639... | ||
2658 | 2639 | jz .nothing |
|
Line 2659... | Line 2640... | ||
2659 | .got_it: |
2640 | .got_it: |
Line 2794... | Line 2775... | ||
2794 | set_io [ebx + device.io_addr], REG_COMMAND |
2775 | set_io [ebx + device.io_addr], REG_COMMAND |
2795 | mov ax, SetIntrEnb + S_5_INTS |
2776 | mov ax, SetIntrEnb + S_5_INTS |
2796 | out dx, ax |
2777 | out dx, ax |
Line 2797... | Line 2778... | ||
2797 | 2778 | ||
- | 2779 | pop edi esi ebx |
|
- | 2780 | xor eax, eax |
|
- | 2781 | inc eax |
|
- | 2782 | ||
- | 2783 | ret |
|
- | 2784 | ||
- | 2785 | .nothing: |
|
- | 2786 | pop edi esi ebx |
|
Line 2798... | Line 2787... | ||
2798 | pop edi esi ebx |
2787 | xor eax, eax |
Line 2917... | Line 2906... | ||
2917 | HW_VERSIONS_SIZE = $ - hw_versions |
2906 | HW_VERSIONS_SIZE = $ - hw_versions |
Line 2918... | Line 2907... | ||
2918 | 2907 | ||
Line 2919... | Line 2908... | ||
2919 | include_debug_strings ; All data wich FDO uses will be included here |
2908 | include_debug_strings ; All data wich FDO uses will be included here |
2920 | 2909 | ||
2921 | align 4 |
- | |
2922 | vortex_devices dd 0 |
2910 | align 4 |
2923 | boomerang_devices dd 0 |
- |