Rev 5522 | Rev 6119 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3545 | hidnplayr | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
5363 | yogev_ezra | 3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3545 | hidnplayr | 4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
||
6 | ;; RTL8169 driver for KolibriOS ;; |
||
7 | ;; ;; |
||
8 | ;; Copyright 2007 mike.dld, ;; |
||
9 | ;; mike.dld@gmail.com ;; |
||
10 | ;; ;; |
||
11 | ;; port to net branch by hidnplayr ;; |
||
12 | ;; ;; |
||
13 | ;; References: ;; |
||
14 | ;; r8169.c - linux driver (etherboot project) ;; |
||
15 | ;; ;; |
||
16 | ;; GNU GENERAL PUBLIC LICENSE ;; |
||
17 | ;; Version 2, June 1991 ;; |
||
18 | ;; ;; |
||
19 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
20 | |||
5050 | hidnplayr | 21 | format PE DLL native |
22 | entry START |
||
3545 | hidnplayr | 23 | |
5050 | hidnplayr | 24 | CURRENT_API = 0x0200 |
25 | COMPATIBLE_API = 0x0100 |
||
26 | API_VERSION = (COMPATIBLE_API shl 16) + CURRENT_API |
||
3545 | hidnplayr | 27 | |
28 | MAX_DEVICES = 16 |
||
29 | |||
30 | __DEBUG__ = 1 |
||
5050 | hidnplayr | 31 | __DEBUG_LEVEL__ = 2 ; 1 = verbose, 2 = errors only |
3545 | hidnplayr | 32 | |
33 | NUM_TX_DESC = 4 |
||
34 | NUM_RX_DESC = 4 |
||
35 | |||
5050 | hidnplayr | 36 | section '.flat' readable writable executable |
37 | |||
38 | include '../proc32.inc' |
||
4467 | hidnplayr | 39 | include '../struct.inc' |
40 | include '../macros.inc' |
||
3545 | hidnplayr | 41 | include '../fdo.inc' |
5074 | hidnplayr | 42 | include '../netdrv.inc' |
3545 | hidnplayr | 43 | |
44 | REG_MAC0 = 0x0 ; Ethernet hardware address |
||
45 | REG_MAR0 = 0x8 ; Multicast filter |
||
46 | REG_TxDescStartAddr = 0x20 |
||
47 | REG_TxHDescStartAddr = 0x28 |
||
48 | REG_FLASH = 0x30 |
||
49 | REG_ERSR = 0x36 |
||
50 | REG_ChipCmd = 0x37 |
||
51 | REG_TxPoll = 0x38 |
||
52 | REG_IntrMask = 0x3C |
||
53 | REG_IntrStatus = 0x3E |
||
54 | REG_TxConfig = 0x40 |
||
55 | REG_RxConfig = 0x44 |
||
56 | REG_RxMissed = 0x4C |
||
57 | REG_Cfg9346 = 0x50 |
||
58 | REG_Config0 = 0x51 |
||
59 | REG_Config1 = 0x52 |
||
60 | REG_Config2 = 0x53 |
||
61 | REG_Config3 = 0x54 |
||
62 | REG_Config4 = 0x55 |
||
63 | REG_Config5 = 0x56 |
||
64 | REG_MultiIntr = 0x5C |
||
65 | REG_PHYAR = 0x60 |
||
66 | REG_TBICSR = 0x64 |
||
67 | REG_TBI_ANAR = 0x68 |
||
68 | REG_TBI_LPAR = 0x6A |
||
69 | REG_PHYstatus = 0x6C |
||
70 | REG_RxMaxSize = 0xDA |
||
71 | REG_CPlusCmd = 0xE0 |
||
72 | REG_RxDescStartAddr = 0xE4 |
||
73 | REG_ETThReg = 0xEC |
||
74 | REG_FuncEvent = 0xF0 |
||
75 | REG_FuncEventMask = 0xF4 |
||
76 | REG_FuncPresetState = 0xF8 |
||
77 | REG_FuncForceEvent = 0xFC |
||
78 | |||
79 | ; InterruptStatusBits |
||
80 | ISB_SYSErr = 0x8000 |
||
81 | ISB_PCSTimeout = 0x4000 |
||
82 | ISB_SWInt = 0x0100 |
||
83 | ISB_TxDescUnavail = 0x80 |
||
84 | ISB_RxFIFOOver = 0x40 |
||
85 | ISB_LinkChg = 0x20 |
||
86 | ISB_RxOverflow = 0x10 |
||
87 | ISB_TxErr = 0x08 |
||
88 | ISB_TxOK = 0x04 |
||
89 | ISB_RxErr = 0x02 |
||
90 | ISB_RxOK = 0x01 |
||
91 | |||
92 | ; RxStatusDesc |
||
93 | SD_RxRES = 0x00200000 |
||
94 | SD_RxCRC = 0x00080000 |
||
95 | SD_RxRUNT = 0x00100000 |
||
96 | SD_RxRWT = 0x00400000 |
||
97 | |||
98 | ; ChipCmdBits |
||
99 | CMD_Reset = 0x10 |
||
100 | CMD_RxEnb = 0x08 |
||
101 | CMD_TxEnb = 0x04 |
||
102 | CMD_RxBufEmpty = 0x01 |
||
103 | |||
104 | ; Cfg9346Bits |
||
105 | CFG_9346_Lock = 0x00 |
||
106 | CFG_9346_Unlock = 0xC0 |
||
107 | |||
108 | ; rx_mode_bits |
||
109 | RXM_AcceptErr = 0x20 |
||
110 | RXM_AcceptRunt = 0x10 |
||
111 | RXM_AcceptBroadcast = 0x08 |
||
112 | RXM_AcceptMulticast = 0x04 |
||
113 | RXM_AcceptMyPhys = 0x02 |
||
114 | RXM_AcceptAllPhys = 0x01 |
||
115 | |||
116 | ; RxConfigBits |
||
117 | RXC_FIFOShift = 13 |
||
118 | RXC_DMAShift = 8 |
||
119 | |||
120 | ; TxConfigBits |
||
121 | TXC_InterFrameGapShift = 24 |
||
122 | TXC_DMAShift = 8 ; DMA burst value (0-7) is shift this many bits |
||
123 | |||
124 | ; PHYstatus |
||
125 | PHYS_TBI_Enable = 0x80 |
||
126 | PHYS_TxFlowCtrl = 0x40 |
||
127 | PHYS_RxFlowCtrl = 0x20 |
||
128 | PHYS_1000bpsF = 0x10 |
||
129 | PHYS_100bps = 0x08 |
||
130 | PHYS_10bps = 0x04 |
||
131 | PHYS_LinkStatus = 0x02 |
||
132 | PHYS_FullDup = 0x01 |
||
133 | |||
134 | ; GIGABIT_PHY_registers |
||
135 | PHY_CTRL_REG = 0 |
||
136 | PHY_STAT_REG = 1 |
||
137 | PHY_AUTO_NEGO_REG = 4 |
||
138 | PHY_1000_CTRL_REG = 9 |
||
139 | |||
140 | ; GIGABIT_PHY_REG_BIT |
||
141 | PHY_Restart_Auto_Nego = 0x0200 |
||
142 | PHY_Enable_Auto_Nego = 0x1000 |
||
143 | |||
144 | ; PHY_STAT_REG = 1 |
||
145 | PHY_Auto_Neco_Comp = 0x0020 |
||
146 | |||
147 | ; PHY_AUTO_NEGO_REG = 4 |
||
148 | PHY_Cap_10_Half = 0x0020 |
||
149 | PHY_Cap_10_Full = 0x0040 |
||
150 | PHY_Cap_100_Half = 0x0080 |
||
151 | PHY_Cap_100_Full = 0x0100 |
||
152 | |||
153 | ; PHY_1000_CTRL_REG = 9 |
||
154 | PHY_Cap_1000_Full = 0x0200 |
||
155 | PHY_Cap_1000_Half = 0x0100 |
||
156 | |||
157 | PHY_Cap_PAUSE = 0x0400 |
||
158 | PHY_Cap_ASYM_PAUSE = 0x0800 |
||
159 | |||
160 | PHY_Cap_Null = 0x0 |
||
161 | |||
162 | ; _MediaType |
||
163 | MT_10_Half = 0x01 |
||
164 | MT_10_Full = 0x02 |
||
165 | MT_100_Half = 0x04 |
||
166 | MT_100_Full = 0x08 |
||
167 | MT_1000_Full = 0x10 |
||
168 | |||
169 | ; _TBICSRBit |
||
5567 | hidnplayr | 170 | TBI_RESET = 0x80000000 |
171 | TBI_LOOPBACK = 0x40000000 |
||
172 | TBI_NW_ENABLE = 0x20000000 |
||
173 | TBI_NW_RESTART = 0x10000000 |
||
174 | TBI_LINK_OK = 0x02000000 |
||
175 | TBI_NW_COMPLETE = 0x01000000 |
||
3545 | hidnplayr | 176 | |
177 | ; _DescStatusBit |
||
178 | DSB_OWNbit = 0x80000000 |
||
179 | DSB_EORbit = 0x40000000 |
||
180 | DSB_FSbit = 0x20000000 |
||
181 | DSB_LSbit = 0x10000000 |
||
182 | |||
5522 | hidnplayr | 183 | RX_BUF_SIZE = 1514 ; Rx Buffer size |
3545 | hidnplayr | 184 | |
185 | ; max supported gigabit ethernet frame size -- must be at least (dev->mtu+14+4) |
||
5522 | hidnplayr | 186 | MAX_ETH_FRAME_SIZE = 1514 |
3545 | hidnplayr | 187 | |
188 | TX_FIFO_THRESH = 256 ; In bytes |
||
189 | |||
190 | RX_FIFO_THRESH = 7 ; 7 means NO threshold, Rx buffer level before first PCI xfer |
||
191 | RX_DMA_BURST = 7 ; Maximum PCI burst, '6' is 1024 |
||
192 | TX_DMA_BURST = 7 ; Maximum PCI burst, '6' is 1024 |
||
193 | ETTh = 0x3F ; 0x3F means NO threshold |
||
194 | |||
195 | EarlyTxThld = 0x3F ; 0x3F means NO early transmit |
||
196 | RxPacketMaxSize = 0x0800 ; Maximum size supported is 16K-1 |
||
197 | InterFrameGap = 0x03 ; 3 means InterFrameGap = the shortest one |
||
198 | |||
199 | HZ = 1000 |
||
200 | |||
201 | RTL_MIN_IO_SIZE = 0x80 |
||
202 | TX_TIMEOUT = (6*HZ) |
||
203 | |||
204 | TIMER_EXPIRE_TIME = 100 |
||
205 | |||
206 | ETH_HDR_LEN = 14 |
||
207 | DEFAULT_MTU = 1500 |
||
5522 | hidnplayr | 208 | DEFAULT_RX_BUF_LEN = 1514 |
3545 | hidnplayr | 209 | |
210 | |||
211 | ;ifdef JUMBO_FRAME_SUPPORT |
||
212 | ; MAX_JUMBO_FRAME_MTU = 10000 |
||
213 | ; MAX_RX_SKBDATA_SIZE = (MAX_JUMBO_FRAME_MTU + ETH_HDR_LEN ) |
||
214 | ;else |
||
215 | MAX_RX_SKBDATA_SIZE = 1600 |
||
216 | ;end if |
||
217 | |||
218 | MCFG_METHOD_01 = 0x01 |
||
219 | MCFG_METHOD_02 = 0x02 |
||
220 | MCFG_METHOD_03 = 0x03 |
||
221 | MCFG_METHOD_04 = 0x04 |
||
222 | MCFG_METHOD_05 = 0x05 |
||
223 | MCFG_METHOD_11 = 0x0b |
||
224 | MCFG_METHOD_12 = 0x0c |
||
225 | MCFG_METHOD_13 = 0x0d |
||
226 | MCFG_METHOD_14 = 0x0e |
||
227 | MCFG_METHOD_15 = 0x0f |
||
228 | |||
229 | PCFG_METHOD_1 = 0x01 ; PHY Reg 0x03 bit0-3 == 0x0000 |
||
230 | PCFG_METHOD_2 = 0x02 ; PHY Reg 0x03 bit0-3 == 0x0001 |
||
231 | PCFG_METHOD_3 = 0x03 ; PHY Reg 0x03 bit0-3 == 0x0002 |
||
232 | |||
5050 | hidnplayr | 233 | struct tx_desc |
234 | status dd ? |
||
235 | vlan_tag dd ? |
||
236 | buf_addr dq ? |
||
237 | ends |
||
238 | tx_desc.buf_soft_addr = NUM_TX_DESC*sizeof.tx_desc |
||
3545 | hidnplayr | 239 | |
5050 | hidnplayr | 240 | struct rx_desc |
241 | status dd ? |
||
242 | vlan_tag dd ? |
||
243 | buf_addr dq ? |
||
244 | ends |
||
245 | rx_desc.buf_soft_addr = NUM_RX_DESC*sizeof.rx_desc |
||
3545 | hidnplayr | 246 | |
5050 | hidnplayr | 247 | struct device ETH_DEVICE |
3545 | hidnplayr | 248 | |
5050 | hidnplayr | 249 | io_addr dd ? |
250 | pci_bus dd ? |
||
251 | pci_dev dd ? |
||
252 | irq_line db ? |
||
253 | rb 3 ; align 4 |
||
254 | mmio_addr dd ? ; memory map physical address |
||
255 | pcfg dd ? |
||
256 | mcfg dd ? |
||
5498 | hidnplayr | 257 | |
5050 | hidnplayr | 258 | cur_rx dd ? ; Index into the Rx descriptor buffer of next Rx pkt |
259 | cur_tx dd ? ; Index into the Tx descriptor buffer of next Rx pkt |
||
5498 | hidnplayr | 260 | last_tx dd ? |
5494 | hidnplayr | 261 | mac_version dd ? |
3545 | hidnplayr | 262 | |
5050 | hidnplayr | 263 | rb 0x100-($ and 0xff) ; align 256 |
264 | tx_ring rb NUM_TX_DESC * sizeof.tx_desc * 2 |
||
3545 | hidnplayr | 265 | |
5050 | hidnplayr | 266 | rb 0x100-($ and 0xff) ; align 256 |
267 | rx_ring rb NUM_RX_DESC * sizeof.rx_desc * 2 |
||
3545 | hidnplayr | 268 | |
5050 | hidnplayr | 269 | ends |
3545 | hidnplayr | 270 | |
271 | intr_mask = ISB_LinkChg or ISB_RxOverflow or ISB_RxFIFOOver or ISB_TxErr or ISB_TxOK or ISB_RxErr or ISB_RxOK |
||
272 | rx_config = (RX_FIFO_THRESH shl RXC_FIFOShift) or (RX_DMA_BURST shl RXC_DMAShift) or 0x0000000E |
||
273 | |||
274 | |||
275 | macro udelay msec { |
||
276 | |||
4803 | hidnplayr | 277 | push esi ecx |
3545 | hidnplayr | 278 | mov esi, msec |
5050 | hidnplayr | 279 | invoke Sleep |
4803 | hidnplayr | 280 | pop ecx esi |
3545 | hidnplayr | 281 | |
282 | } |
||
283 | |||
284 | macro WRITE_GMII_REG RegAddr, value { |
||
285 | |||
5050 | hidnplayr | 286 | set_io [ebx + device.io_addr], REG_PHYAR |
3545 | hidnplayr | 287 | if value eq ax |
288 | and eax, 0x0000ffff |
||
289 | or eax, 0x80000000 + (RegAddr shl 16) |
||
290 | else |
||
291 | mov eax, 0x80000000 + (RegAddr shl 16) + value |
||
292 | end if |
||
293 | out dx, eax |
||
294 | |||
295 | call PHY_WAIT_WRITE |
||
296 | } |
||
297 | |||
298 | macro READ_GMII_REG RegAddr { |
||
299 | |||
300 | local .error, .done |
||
301 | |||
5050 | hidnplayr | 302 | set_io [ebx + device.io_addr], REG_PHYAR |
3545 | hidnplayr | 303 | mov eax, RegAddr shl 16 |
304 | out dx, eax |
||
305 | |||
306 | call PHY_WAIT_READ |
||
307 | jz .error |
||
308 | |||
309 | in eax, dx |
||
310 | and eax, 0xFFFF |
||
311 | jmp .done |
||
312 | |||
313 | .error: |
||
314 | or eax, -1 |
||
315 | .done: |
||
316 | } |
||
317 | |||
318 | align 4 |
||
319 | PHY_WAIT_READ: ; io addr must already be set to REG_PHYAR |
||
320 | |||
321 | udelay 1 ;;;1000 |
||
322 | |||
323 | push ecx |
||
324 | mov ecx, 2000 |
||
325 | ; Check if the RTL8169 has completed writing/reading to the specified MII register |
||
326 | @@: |
||
327 | in eax, dx |
||
328 | test eax, 0x80000000 |
||
329 | jnz .exit |
||
330 | udelay 1 ;;;100 |
||
331 | loop @b |
||
332 | .exit: |
||
333 | pop ecx |
||
334 | ret |
||
335 | |||
336 | align 4 |
||
337 | PHY_WAIT_WRITE: ; io addr must already be set to REG_PHYAR |
||
338 | |||
339 | udelay 1 ;;;1000 |
||
340 | |||
341 | push ecx |
||
342 | mov ecx, 2000 |
||
343 | ; Check if the RTL8169 has completed writing/reading to the specified MII register |
||
344 | @@: |
||
345 | in eax, dx |
||
346 | test eax, 0x80000000 |
||
347 | jz .exit |
||
348 | udelay 1 ;;;100 |
||
349 | loop @b |
||
350 | .exit: |
||
351 | pop ecx |
||
352 | ret |
||
353 | |||
354 | |||
355 | |||
356 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
357 | ;; ;; |
||
358 | ;; proc START ;; |
||
359 | ;; ;; |
||
360 | ;; (standard driver proc) ;; |
||
361 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
362 | |||
5050 | hidnplayr | 363 | proc START c, reason:dword, cmdline:dword |
3545 | hidnplayr | 364 | |
5050 | hidnplayr | 365 | cmp [reason], DRV_ENTRY |
366 | jne .fail |
||
3545 | hidnplayr | 367 | |
5050 | hidnplayr | 368 | DEBUGF 2,"Loading driver\n" |
369 | invoke RegService, my_service, service_proc |
||
3545 | hidnplayr | 370 | ret |
371 | |||
372 | .fail: |
||
5050 | hidnplayr | 373 | xor eax, eax |
3545 | hidnplayr | 374 | ret |
375 | |||
376 | endp |
||
377 | |||
378 | |||
379 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
380 | ;; ;; |
||
381 | ;; proc SERVICE_PROC ;; |
||
382 | ;; ;; |
||
383 | ;; (standard driver proc) ;; |
||
384 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
385 | |||
386 | proc service_proc stdcall, ioctl:dword |
||
387 | |||
388 | mov edx, [ioctl] |
||
4470 | hidnplayr | 389 | mov eax, [edx + IOCTL.io_code] |
3545 | hidnplayr | 390 | |
391 | ;------------------------------------------------------ |
||
392 | |||
393 | cmp eax, 0 ;SRV_GETVERSION |
||
394 | jne @F |
||
395 | |||
4470 | hidnplayr | 396 | cmp [edx + IOCTL.out_size], 4 |
3545 | hidnplayr | 397 | jb .fail |
4470 | hidnplayr | 398 | mov eax, [edx + IOCTL.output] |
3545 | hidnplayr | 399 | mov [eax], dword API_VERSION |
400 | |||
401 | xor eax, eax |
||
402 | ret |
||
403 | |||
404 | ;------------------------------------------------------ |
||
405 | @@: |
||
406 | cmp eax, 1 ;SRV_HOOK |
||
407 | jne .fail |
||
408 | |||
4470 | hidnplayr | 409 | cmp [edx + IOCTL.inp_size], 3 ; Data input must be at least 3 bytes |
3545 | hidnplayr | 410 | jb .fail |
411 | |||
4470 | hidnplayr | 412 | mov eax, [edx + IOCTL.input] |
3545 | hidnplayr | 413 | cmp byte [eax], 1 ; 1 means device number and bus number (pci) are given |
414 | jne .fail ; other types arent supported for this card yet |
||
415 | |||
416 | ; check if the device is already listed |
||
417 | |||
418 | mov esi, device_list |
||
419 | mov ecx, [devices] |
||
420 | test ecx, ecx |
||
421 | jz .firstdevice |
||
422 | |||
4470 | hidnplayr | 423 | ; mov eax, [edx + IOCTL.input] ; get the pci bus and device numbers |
424 | mov ax, [eax+1] ; |
||
3545 | hidnplayr | 425 | .nextdevice: |
426 | mov ebx, [esi] |
||
5050 | hidnplayr | 427 | cmp al, byte[ebx + device.pci_bus] |
3545 | hidnplayr | 428 | jne @f |
5050 | hidnplayr | 429 | cmp ah, byte[ebx + device.pci_dev] |
3545 | hidnplayr | 430 | je .find_devicenum ; Device is already loaded, let's find it's device number |
431 | @@: |
||
432 | add esi, 4 |
||
433 | loop .nextdevice |
||
434 | |||
435 | |||
436 | ; This device doesnt have its own eth_device structure yet, lets create one |
||
437 | .firstdevice: |
||
438 | cmp [devices], MAX_DEVICES ; First check if the driver can handle one more card |
||
439 | jae .fail |
||
440 | |||
5050 | hidnplayr | 441 | allocate_and_clear ebx, sizeof.device, .fail ; Allocate memory to put the device structure in |
3545 | hidnplayr | 442 | |
443 | ; Fill in the direct call addresses into the struct |
||
444 | |||
5050 | hidnplayr | 445 | mov [ebx + device.reset], reset |
446 | mov [ebx + device.transmit], transmit |
||
447 | mov [ebx + device.unload], unload |
||
448 | mov [ebx + device.name], my_service |
||
3545 | hidnplayr | 449 | |
450 | ; save the pci bus and device numbers |
||
451 | |||
4470 | hidnplayr | 452 | mov eax, [edx + IOCTL.input] |
3545 | hidnplayr | 453 | movzx ecx, byte[eax+1] |
5050 | hidnplayr | 454 | mov [ebx + device.pci_bus], ecx |
3545 | hidnplayr | 455 | movzx ecx, byte[eax+2] |
5050 | hidnplayr | 456 | mov [ebx + device.pci_dev], ecx |
3545 | hidnplayr | 457 | |
458 | ; Now, it's time to find the base io addres of the PCI device |
||
459 | |||
5050 | hidnplayr | 460 | stdcall PCI_find_io, [ebx + device.pci_bus], [ebx + device.pci_dev] |
461 | mov [ebx + device.io_addr], eax |
||
3545 | hidnplayr | 462 | |
463 | ; We've found the io address, find IRQ now |
||
464 | |||
5050 | hidnplayr | 465 | invoke PciRead8, [ebx + device.pci_bus], [ebx + device.pci_dev], PCI_header00.interrupt_line |
466 | mov [ebx + device.irq_line], al |
||
3545 | hidnplayr | 467 | |
468 | DEBUGF 2,"Hooking into device, dev:%x, bus:%x, irq:%x, addr:%x\n",\ |
||
5050 | hidnplayr | 469 | [ebx + device.pci_dev]:1,[ebx + device.pci_bus]:1,[ebx + device.irq_line]:1,[ebx + device.io_addr]:8 |
3545 | hidnplayr | 470 | |
471 | ; Ok, the eth_device structure is ready, let's probe the device |
||
472 | ; Because initialization fires IRQ, IRQ handler must be aware of this device |
||
473 | mov eax, [devices] ; Add the device structure to our device list |
||
474 | mov [device_list + 4*eax], ebx ; (IRQ handler uses this list to find device) |
||
475 | inc [devices] ; |
||
476 | |||
477 | call probe ; this function will output in eax |
||
478 | test eax, eax |
||
479 | jnz .err2 ; If an error occured, exit |
||
480 | |||
5050 | hidnplayr | 481 | mov [ebx + device.type], NET_TYPE_ETH |
482 | invoke NetRegDev |
||
3545 | hidnplayr | 483 | |
484 | cmp eax, -1 |
||
485 | je .destroy |
||
486 | |||
487 | ret |
||
488 | |||
489 | ; If the device was already loaded, find the device number and return it in eax |
||
490 | |||
491 | .find_devicenum: |
||
492 | DEBUGF 2,"Trying to find device number of already registered device\n" |
||
5050 | hidnplayr | 493 | invoke NetPtrToNum ; This kernel procedure converts a pointer to device struct in ebx |
3545 | hidnplayr | 494 | ; into a device number in edi |
495 | mov eax, edi ; Application wants it in eax instead |
||
496 | DEBUGF 2,"Kernel says: %u\n", eax |
||
497 | ret |
||
498 | |||
499 | ; If an error occured, remove all allocated data and exit (returning -1 in eax) |
||
500 | |||
501 | .destroy: |
||
502 | ; todo: reset device into virgin state |
||
503 | |||
504 | .err2: |
||
505 | dec [devices] |
||
506 | .err: |
||
507 | DEBUGF 2,"removing device structure\n" |
||
5050 | hidnplayr | 508 | invoke KernelFree, ebx |
3545 | hidnplayr | 509 | .fail: |
510 | or eax, -1 |
||
511 | ret |
||
512 | |||
513 | ;------------------------------------------------------ |
||
514 | endp |
||
515 | |||
516 | |||
517 | align 4 |
||
518 | unload: |
||
519 | |||
520 | ret |
||
521 | |||
522 | |||
523 | align 4 |
||
524 | init_board: |
||
525 | |||
526 | DEBUGF 1,"init_board\n" |
||
527 | |||
5050 | hidnplayr | 528 | ; Make the device a bus master |
529 | invoke PciRead32, [ebx + device.pci_bus], [ebx + device.pci_dev], PCI_header00.command |
||
530 | or al, PCI_CMD_MASTER |
||
531 | invoke PciWrite32, [ebx + device.pci_bus], [ebx + device.pci_dev], PCI_header00.command, eax |
||
3545 | hidnplayr | 532 | |
533 | ; Soft reset the chip |
||
5050 | hidnplayr | 534 | set_io [ebx + device.io_addr], 0 |
535 | set_io [ebx + device.io_addr], REG_ChipCmd |
||
3545 | hidnplayr | 536 | mov al, CMD_Reset |
537 | out dx, al |
||
538 | |||
539 | ; Check that the chip has finished the reset |
||
540 | mov ecx, 1000 |
||
5050 | hidnplayr | 541 | set_io [ebx + device.io_addr], REG_ChipCmd |
5494 | hidnplayr | 542 | @@: |
543 | in al, dx |
||
3545 | hidnplayr | 544 | test al, CMD_Reset |
545 | jz @f |
||
546 | udelay 10 |
||
547 | loop @b |
||
5494 | hidnplayr | 548 | @@: |
3545 | hidnplayr | 549 | |
550 | |||
5050 | hidnplayr | 551 | set_io [ebx + device.io_addr], REG_TxConfig |
3545 | hidnplayr | 552 | in eax, dx |
5494 | hidnplayr | 553 | mov esi, MAC_VERSION_LIST |
554 | @@: |
||
555 | mov ecx, eax |
||
556 | and ecx, dword[esi] |
||
557 | cmp ecx, dword[esi+4] |
||
558 | je @f |
||
559 | add esi, 4*4 |
||
560 | jmp @r |
||
561 | @@: |
||
3545 | hidnplayr | 562 | |
5494 | hidnplayr | 563 | mov eax, [esi+8] |
564 | mov [ebx + device.mac_version], eax |
||
565 | mov eax, [esi+12] |
||
566 | mov [ebx + device.name], eax |
||
5567 | hidnplayr | 567 | DEBUGF 2, "Detected chip: %s\n", eax |
3545 | hidnplayr | 568 | |
569 | xor eax, eax |
||
570 | ret |
||
571 | |||
572 | |||
573 | |||
574 | ;*************************************************************************** |
||
575 | ; Function |
||
576 | ; probe |
||
577 | ; Description |
||
578 | ; Searches for an ethernet card, enables it and clears the rx buffer |
||
579 | ; If a card was found, it enables the ethernet -> TCPIP link |
||
580 | ; Destroyed registers |
||
581 | ; eax, ebx, ecx, edx |
||
582 | ; |
||
583 | ;*************************************************************************** |
||
584 | align 4 |
||
585 | probe: |
||
586 | |||
587 | DEBUGF 1,"probe\n" |
||
588 | |||
589 | call init_board |
||
590 | call read_mac |
||
591 | call PHY_config |
||
592 | |||
4334 | hidnplayr | 593 | DEBUGF 1,"Set MAC Reg C+CR Offset 0x82h = 0x01h\n" |
5050 | hidnplayr | 594 | set_io [ebx + device.io_addr], 0 |
595 | set_io [ebx + device.io_addr], 0x82 |
||
3545 | hidnplayr | 596 | mov al, 0x01 |
597 | out dx, al |
||
5050 | hidnplayr | 598 | cmp [ebx + device.mcfg], MCFG_METHOD_03 |
3545 | hidnplayr | 599 | jae @f |
4334 | hidnplayr | 600 | DEBUGF 1,"Set PCI Latency=0x40\n" |
5050 | hidnplayr | 601 | ; Adjust PCI latency to be at least 64 |
602 | invoke PciRead8, [ebx + device.pci_bus], [ebx + device.pci_dev], PCI_header00.max_latency |
||
603 | cmp al, 64 |
||
604 | jae @f |
||
605 | mov al, 64 |
||
606 | invoke PciWrite8, [ebx + device.pci_bus], [ebx + device.pci_dev], PCI_header00.max_latency, eax |
||
607 | @@: |
||
608 | cmp [ebx + device.mcfg], MCFG_METHOD_02 |
||
3545 | hidnplayr | 609 | jne @f |
4334 | hidnplayr | 610 | DEBUGF 1,"Set MAC Reg C+CR Offset 0x82h = 0x01h\n" |
5050 | hidnplayr | 611 | set_io [ebx + device.io_addr], 0 |
612 | set_io [ebx + device.io_addr], 0x82 |
||
3545 | hidnplayr | 613 | mov al, 0x01 |
614 | out dx, al |
||
4334 | hidnplayr | 615 | DEBUGF 1,"Set PHY Reg 0x0bh = 0x00h\n" |
3545 | hidnplayr | 616 | WRITE_GMII_REG 0x0b, 0x0000 ; w 0x0b 15 0 0 |
617 | @@: |
||
618 | ; if TBI is not enabled |
||
5050 | hidnplayr | 619 | set_io [ebx + device.io_addr], 0 |
620 | set_io [ebx + device.io_addr], REG_PHYstatus |
||
3545 | hidnplayr | 621 | in al, dx |
622 | test al, PHYS_TBI_Enable |
||
623 | jz .tbi_dis |
||
624 | READ_GMII_REG PHY_AUTO_NEGO_REG |
||
625 | |||
626 | ; enable 10/100 Full/Half Mode, leave PHY_AUTO_NEGO_REG bit4:0 unchanged |
||
627 | and eax, 0x0C1F |
||
628 | or eax, PHY_Cap_10_Half or PHY_Cap_10_Full or PHY_Cap_100_Half or PHY_Cap_100_Full |
||
629 | WRITE_GMII_REG PHY_AUTO_NEGO_REG, ax |
||
630 | |||
631 | ; enable 1000 Full Mode |
||
632 | WRITE_GMII_REG PHY_1000_CTRL_REG, PHY_Cap_1000_Full or PHY_Cap_1000_Half ; rtl8168 |
||
633 | |||
634 | ; Enable auto-negotiation and restart auto-nigotiation |
||
635 | WRITE_GMII_REG PHY_CTRL_REG, PHY_Enable_Auto_Nego or PHY_Restart_Auto_Nego |
||
636 | |||
4803 | hidnplayr | 637 | udelay 1 ; 100 |
638 | mov ecx, 200 ; 10000 |
||
639 | DEBUGF 1, "Waiting for auto-negotiation to complete\n" |
||
3545 | hidnplayr | 640 | ; wait for auto-negotiation process |
641 | @@: dec ecx |
||
642 | jz @f |
||
5050 | hidnplayr | 643 | set_io [ebx + device.io_addr], 0 |
3545 | hidnplayr | 644 | READ_GMII_REG PHY_STAT_REG |
4803 | hidnplayr | 645 | udelay 1 ; 100 |
3545 | hidnplayr | 646 | test eax, PHY_Auto_Neco_Comp |
647 | jz @b |
||
5050 | hidnplayr | 648 | set_io [ebx + device.io_addr], REG_PHYstatus |
3545 | hidnplayr | 649 | in al, dx |
650 | jmp @f |
||
651 | .tbi_dis: |
||
4803 | hidnplayr | 652 | udelay 1 ; 100 |
3545 | hidnplayr | 653 | @@: |
4803 | hidnplayr | 654 | DEBUGF 1, "auto-negotiation complete\n" |
3545 | hidnplayr | 655 | |
656 | ;*************************************************************************** |
||
657 | ; Function |
||
658 | ; rt8169_reset |
||
659 | ; Description |
||
660 | ; Place the chip (ie, the ethernet card) into a virgin state |
||
661 | ; Destroyed registers |
||
662 | ; eax, ebx, ecx, edx |
||
663 | ; |
||
664 | ;*************************************************************************** |
||
665 | align 4 |
||
666 | reset: |
||
667 | |||
4803 | hidnplayr | 668 | DEBUGF 1,"resetting\n" |
3545 | hidnplayr | 669 | |
670 | call init_ring |
||
5522 | hidnplayr | 671 | test eax, eax |
672 | jnz .err |
||
673 | |||
3545 | hidnplayr | 674 | call hw_start |
675 | |||
676 | ; clear packet/byte counters |
||
677 | |||
678 | xor eax, eax |
||
5050 | hidnplayr | 679 | lea edi, [ebx + device.bytes_tx] |
3545 | hidnplayr | 680 | mov ecx, 6 |
681 | rep stosd |
||
682 | |||
5050 | hidnplayr | 683 | mov [ebx + device.mtu], 1500 |
5498 | hidnplayr | 684 | call detect_link |
3545 | hidnplayr | 685 | |
4803 | hidnplayr | 686 | DEBUGF 2,"init OK!\n" |
3545 | hidnplayr | 687 | xor eax, eax |
688 | ret |
||
689 | |||
5522 | hidnplayr | 690 | .err: |
691 | DEBUGF 2,"failed!\n" |
||
692 | or eax, -1 |
||
693 | ret |
||
3545 | hidnplayr | 694 | |
695 | |||
696 | |||
697 | align 4 |
||
698 | PHY_config: |
||
699 | |||
5050 | hidnplayr | 700 | DEBUGF 1,"hw_PHY_config: priv.mcfg=%d, priv.pcfg=%d\n", [ebx + device.mcfg], [ebx + device.pcfg] |
3545 | hidnplayr | 701 | |
5050 | hidnplayr | 702 | cmp [ebx + device.mcfg], MCFG_METHOD_04 |
3545 | hidnplayr | 703 | jne .not_4 |
5050 | hidnplayr | 704 | set_io [ebx + device.io_addr], 0 |
3545 | hidnplayr | 705 | ; WRITE_GMII_REG 0x1F, 0x0001 |
706 | ; WRITE_GMII_REG 0x1b, 0x841e |
||
707 | ; WRITE_GMII_REG 0x0e, 0x7bfb |
||
708 | ; WRITE_GMII_REG 0x09, 0x273a |
||
709 | WRITE_GMII_REG 0x1F, 0x0002 |
||
710 | WRITE_GMII_REG 0x01, 0x90D0 |
||
711 | WRITE_GMII_REG 0x1F, 0x0000 |
||
712 | jmp .exit |
||
713 | .not_4: |
||
5050 | hidnplayr | 714 | cmp [ebx + device.mcfg], MCFG_METHOD_02 |
3545 | hidnplayr | 715 | je @f |
5050 | hidnplayr | 716 | cmp [ebx + device.mcfg], MCFG_METHOD_03 |
3545 | hidnplayr | 717 | jne .not_2_or_3 |
718 | @@: |
||
5050 | hidnplayr | 719 | set_io [ebx + device.io_addr], 0 |
3545 | hidnplayr | 720 | WRITE_GMII_REG 0x1F, 0x0001 |
721 | WRITE_GMII_REG 0x15, 0x1000 |
||
722 | WRITE_GMII_REG 0x18, 0x65C7 |
||
723 | WRITE_GMII_REG 0x04, 0x0000 |
||
724 | WRITE_GMII_REG 0x03, 0x00A1 |
||
725 | WRITE_GMII_REG 0x02, 0x0008 |
||
726 | WRITE_GMII_REG 0x01, 0x1020 |
||
727 | WRITE_GMII_REG 0x00, 0x1000 |
||
728 | WRITE_GMII_REG 0x04, 0x0800 |
||
729 | WRITE_GMII_REG 0x04, 0x0000 |
||
730 | WRITE_GMII_REG 0x04, 0x7000 |
||
731 | WRITE_GMII_REG 0x03, 0xFF41 |
||
732 | WRITE_GMII_REG 0x02, 0xDE60 |
||
733 | WRITE_GMII_REG 0x01, 0x0140 |
||
734 | WRITE_GMII_REG 0x00, 0x0077 |
||
735 | WRITE_GMII_REG 0x04, 0x7800 |
||
736 | WRITE_GMII_REG 0x04, 0x7000 |
||
737 | WRITE_GMII_REG 0x04, 0xA000 |
||
738 | WRITE_GMII_REG 0x03, 0xDF01 |
||
739 | WRITE_GMII_REG 0x02, 0xDF20 |
||
740 | WRITE_GMII_REG 0x01, 0xFF95 |
||
741 | WRITE_GMII_REG 0x00, 0xFA00 |
||
742 | WRITE_GMII_REG 0x04, 0xA800 |
||
743 | WRITE_GMII_REG 0x04, 0xA000 |
||
744 | WRITE_GMII_REG 0x04, 0xB000 |
||
745 | WRITE_GMII_REG 0x03, 0xFF41 |
||
746 | WRITE_GMII_REG 0x02, 0xDE20 |
||
747 | WRITE_GMII_REG 0x01, 0x0140 |
||
748 | WRITE_GMII_REG 0x00, 0x00BB |
||
749 | WRITE_GMII_REG 0x04, 0xB800 |
||
750 | WRITE_GMII_REG 0x04, 0xB000 |
||
751 | WRITE_GMII_REG 0x04, 0xF000 |
||
752 | WRITE_GMII_REG 0x03, 0xDF01 |
||
753 | WRITE_GMII_REG 0x02, 0xDF20 |
||
754 | WRITE_GMII_REG 0x01, 0xFF95 |
||
755 | WRITE_GMII_REG 0x00, 0xBF00 |
||
756 | WRITE_GMII_REG 0x04, 0xF800 |
||
757 | WRITE_GMII_REG 0x04, 0xF000 |
||
758 | WRITE_GMII_REG 0x04, 0x0000 |
||
759 | WRITE_GMII_REG 0x1F, 0x0000 |
||
760 | WRITE_GMII_REG 0x0B, 0x0000 |
||
761 | jmp .exit |
||
762 | .not_2_or_3: |
||
5050 | hidnplayr | 763 | DEBUGF 1,"mcfg=%d, discard hw PHY config\n", [ebx + device.mcfg] |
3545 | hidnplayr | 764 | .exit: |
765 | ret |
||
766 | |||
767 | |||
768 | |||
769 | align 4 |
||
770 | set_rx_mode: |
||
771 | |||
772 | DEBUGF 1,"set_rx_mode\n" |
||
773 | |||
774 | ; IFF_ALLMULTI |
||
775 | ; Too many to filter perfectly -- accept all multicasts |
||
5050 | hidnplayr | 776 | set_io [ebx + device.io_addr], 0 |
777 | set_io [ebx + device.io_addr], REG_RxConfig |
||
3545 | hidnplayr | 778 | in eax, dx |
5494 | hidnplayr | 779 | and eax, 0xff7e1880 |
3545 | hidnplayr | 780 | or eax, rx_config or (RXM_AcceptBroadcast or RXM_AcceptMulticast or RXM_AcceptMyPhys) |
781 | out dx, eax |
||
782 | |||
783 | ; Multicast hash filter |
||
5050 | hidnplayr | 784 | set_io [ebx + device.io_addr], REG_MAR0 + 0 |
3545 | hidnplayr | 785 | or eax, -1 |
786 | out dx, eax |
||
5050 | hidnplayr | 787 | set_io [ebx + device.io_addr], REG_MAR0 + 4 |
3545 | hidnplayr | 788 | out dx, eax |
789 | |||
790 | ret |
||
791 | |||
792 | |||
793 | align 4 |
||
794 | init_ring: |
||
795 | |||
796 | DEBUGF 1,"init_ring\n" |
||
797 | |||
798 | xor eax, eax |
||
5050 | hidnplayr | 799 | mov [ebx + device.cur_rx], eax |
800 | mov [ebx + device.cur_tx], eax |
||
5498 | hidnplayr | 801 | mov [ebx + device.last_tx], eax |
3545 | hidnplayr | 802 | |
5050 | hidnplayr | 803 | lea edi, [ebx + device.tx_ring] |
5498 | hidnplayr | 804 | mov ecx, (NUM_TX_DESC * sizeof.tx_desc) / 4 * 2 |
3545 | hidnplayr | 805 | rep stosd |
806 | |||
5050 | hidnplayr | 807 | lea edi, [ebx + device.rx_ring] |
808 | mov ecx, (NUM_RX_DESC * sizeof.rx_desc) / 4 |
||
3545 | hidnplayr | 809 | rep stosd |
810 | |||
5498 | hidnplayr | 811 | lea edi, [ebx + device.rx_ring] |
3545 | hidnplayr | 812 | mov ecx, NUM_RX_DESC |
813 | .loop: |
||
814 | push ecx |
||
5522 | hidnplayr | 815 | invoke NetAlloc, RX_BUF_SIZE+NET_BUFF.data |
816 | test eax, eax |
||
817 | jz .err |
||
5050 | hidnplayr | 818 | mov dword [edi + rx_desc.buf_soft_addr], eax |
5498 | hidnplayr | 819 | invoke GetPhysAddr |
5522 | hidnplayr | 820 | add eax, NET_BUFF.data |
3545 | hidnplayr | 821 | mov dword [edi + rx_desc.buf_addr], eax |
822 | mov [edi + rx_desc.status], DSB_OWNbit or RX_BUF_SIZE |
||
5050 | hidnplayr | 823 | add edi, sizeof.rx_desc |
3545 | hidnplayr | 824 | pop ecx |
5050 | hidnplayr | 825 | dec ecx |
826 | jnz .loop |
||
827 | or [edi - sizeof.rx_desc + rx_desc.status], DSB_EORbit |
||
3545 | hidnplayr | 828 | |
5522 | hidnplayr | 829 | xor eax, eax |
3545 | hidnplayr | 830 | ret |
831 | |||
5522 | hidnplayr | 832 | .err: |
833 | pop eax |
||
834 | or eax, -1 |
||
835 | ret |
||
3545 | hidnplayr | 836 | |
837 | align 4 |
||
838 | hw_start: |
||
839 | |||
840 | DEBUGF 1,"hw_start\n" |
||
841 | |||
842 | ; attach int handler |
||
5050 | hidnplayr | 843 | movzx eax, [ebx + device.irq_line] |
3545 | hidnplayr | 844 | DEBUGF 1,"Attaching int handler to irq %x\n", eax:1 |
5050 | hidnplayr | 845 | invoke AttachIntHandler, eax, int_handler, ebx |
846 | test eax, eax |
||
847 | jnz @f |
||
848 | DEBUGF 2,"Could not attach int handler!\n" |
||
849 | or eax, -1 |
||
850 | ret |
||
851 | @@: |
||
3545 | hidnplayr | 852 | |
853 | ; Soft reset the chip |
||
5050 | hidnplayr | 854 | set_io [ebx + device.io_addr], 0 |
855 | set_io [ebx + device.io_addr], REG_ChipCmd |
||
3545 | hidnplayr | 856 | mov al, CMD_Reset |
857 | out dx, al |
||
858 | |||
859 | DEBUGF 1,"Waiting for chip to reset... " |
||
860 | ; Check that the chip has finished the reset |
||
861 | mov ecx, 1000 |
||
5050 | hidnplayr | 862 | set_io [ebx + device.io_addr], REG_ChipCmd |
3545 | hidnplayr | 863 | @@: in al, dx |
864 | test al, CMD_Reset |
||
865 | jz @f |
||
866 | udelay 10 |
||
867 | loop @b |
||
868 | @@: |
||
869 | DEBUGF 1,"done!\n" |
||
870 | |||
5050 | hidnplayr | 871 | set_io [ebx + device.io_addr], REG_Cfg9346 |
3545 | hidnplayr | 872 | mov al, CFG_9346_Unlock |
873 | out dx, al |
||
874 | |||
5050 | hidnplayr | 875 | set_io [ebx + device.io_addr], REG_ChipCmd |
3545 | hidnplayr | 876 | mov al, CMD_TxEnb or CMD_RxEnb |
877 | out dx, al |
||
878 | |||
5050 | hidnplayr | 879 | set_io [ebx + device.io_addr], REG_ETThReg |
3545 | hidnplayr | 880 | mov al, ETTh |
881 | out dx, al |
||
882 | |||
883 | ; For gigabit rtl8169 |
||
5050 | hidnplayr | 884 | set_io [ebx + device.io_addr], REG_RxMaxSize |
3545 | hidnplayr | 885 | mov ax, RxPacketMaxSize |
886 | out dx, ax |
||
887 | |||
888 | ; Set Rx Config register |
||
5050 | hidnplayr | 889 | set_io [ebx + device.io_addr], REG_RxConfig |
3545 | hidnplayr | 890 | in ax, dx |
5494 | hidnplayr | 891 | and eax, 0xff7e1880 |
3545 | hidnplayr | 892 | or eax, rx_config |
893 | out dx, eax |
||
894 | |||
895 | ; Set DMA burst size and Interframe Gap Time |
||
5050 | hidnplayr | 896 | set_io [ebx + device.io_addr], REG_TxConfig |
3545 | hidnplayr | 897 | mov eax, (TX_DMA_BURST shl TXC_DMAShift) or (InterFrameGap shl TXC_InterFrameGapShift) |
898 | out dx, eax |
||
899 | |||
5050 | hidnplayr | 900 | set_io [ebx + device.io_addr], REG_CPlusCmd |
3545 | hidnplayr | 901 | in ax, dx |
902 | out dx, ax |
||
903 | |||
904 | in ax, dx |
||
905 | or ax, 1 shl 3 |
||
5050 | hidnplayr | 906 | cmp [ebx + device.mcfg], MCFG_METHOD_02 |
3545 | hidnplayr | 907 | jne @f |
5050 | hidnplayr | 908 | cmp [ebx + device.mcfg], MCFG_METHOD_03 |
3545 | hidnplayr | 909 | jne @f |
910 | or ax,1 shl 14 |
||
911 | DEBUGF 1,"Set MAC Reg C+CR Offset 0xE0: bit-3 and bit-14\n" |
||
912 | jmp .set |
||
913 | @@: |
||
914 | DEBUGF 1,"Set MAC Reg C+CR Offset 0xE0: bit-3\n" |
||
915 | .set: |
||
5050 | hidnplayr | 916 | set_io [ebx + device.io_addr], REG_CPlusCmd |
3545 | hidnplayr | 917 | out dx, ax |
918 | |||
5050 | hidnplayr | 919 | set_io [ebx + device.io_addr], 0xE2 |
3545 | hidnplayr | 920 | ; mov ax, 0x1517 |
921 | ; out dx, ax |
||
922 | ; mov ax, 0x152a |
||
923 | ; out dx, ax |
||
924 | ; mov ax, 0x282a |
||
925 | ; out dx, ax |
||
926 | xor ax, ax |
||
927 | out dx, ax |
||
928 | |||
929 | xor eax, eax |
||
5050 | hidnplayr | 930 | mov [ebx + device.cur_rx], eax |
931 | lea eax, [ebx + device.tx_ring] |
||
932 | invoke GetPhysAddr |
||
933 | set_io [ebx + device.io_addr], REG_TxDescStartAddr |
||
3545 | hidnplayr | 934 | out dx, eax |
5050 | hidnplayr | 935 | set_io [ebx + device.io_addr], REG_TxDescStartAddr + 4 |
4301 | clevermous | 936 | xor eax, eax |
937 | out dx, eax |
||
3545 | hidnplayr | 938 | |
5050 | hidnplayr | 939 | lea eax, [ebx + device.rx_ring] |
940 | invoke GetPhysAddr |
||
941 | set_io [ebx + device.io_addr], REG_RxDescStartAddr |
||
3545 | hidnplayr | 942 | out dx, eax |
4301 | clevermous | 943 | xor eax, eax |
5050 | hidnplayr | 944 | set_io [ebx + device.io_addr], REG_RxDescStartAddr + 4 |
4301 | clevermous | 945 | out dx, eax |
3545 | hidnplayr | 946 | |
5050 | hidnplayr | 947 | set_io [ebx + device.io_addr], REG_Cfg9346 |
3545 | hidnplayr | 948 | mov al, CFG_9346_Lock |
949 | out dx, al |
||
950 | |||
951 | udelay 10 |
||
952 | |||
953 | xor eax, eax |
||
5050 | hidnplayr | 954 | set_io [ebx + device.io_addr], REG_RxMissed |
3545 | hidnplayr | 955 | out dx, eax |
956 | |||
957 | call set_rx_mode |
||
958 | |||
5050 | hidnplayr | 959 | set_io [ebx + device.io_addr], 0 |
3545 | hidnplayr | 960 | ; no early-rx interrupts |
5050 | hidnplayr | 961 | set_io [ebx + device.io_addr], REG_MultiIntr |
3545 | hidnplayr | 962 | in ax, dx |
963 | and ax, 0xF000 |
||
964 | out dx, ax |
||
965 | |||
966 | ; set interrupt mask |
||
5050 | hidnplayr | 967 | set_io [ebx + device.io_addr], REG_IntrMask |
3545 | hidnplayr | 968 | mov ax, intr_mask |
969 | out dx, ax |
||
970 | |||
971 | xor eax, eax |
||
972 | ret |
||
973 | |||
974 | |||
975 | align 4 |
||
976 | read_mac: |
||
977 | |||
5050 | hidnplayr | 978 | set_io [ebx + device.io_addr], 0 |
979 | set_io [ebx + device.io_addr], REG_MAC0 |
||
3545 | hidnplayr | 980 | xor ecx, ecx |
5050 | hidnplayr | 981 | lea edi, [ebx + device.mac] |
3545 | hidnplayr | 982 | mov ecx, 6 |
983 | |||
984 | ; Get MAC address. FIXME: read EEPROM |
||
5498 | hidnplayr | 985 | @@: |
986 | in al, dx |
||
3545 | hidnplayr | 987 | stosb |
988 | inc edx |
||
989 | loop @r |
||
990 | |||
991 | DEBUGF 1,"MAC = %x-%x-%x-%x-%x-%x\n",\ |
||
5050 | hidnplayr | 992 | [ebx + device.mac+0]:2,[ebx + device.mac+1]:2,[ebx + device.mac+2]:2,[ebx + device.mac+3]:2,[ebx + device.mac+4]:2,[ebx + device.mac+5]:2 |
3545 | hidnplayr | 993 | |
994 | ret |
||
995 | |||
996 | align 4 |
||
997 | write_mac: |
||
998 | |||
999 | ret 6 |
||
1000 | |||
1001 | |||
1002 | ;*************************************************************************** |
||
1003 | ; Function |
||
1004 | ; transmit |
||
1005 | ; Description |
||
1006 | ; Transmits a packet of data via the ethernet card |
||
1007 | ; |
||
1008 | ; Destroyed registers |
||
1009 | ; eax, edx, esi, edi |
||
1010 | ; |
||
1011 | ;*************************************************************************** |
||
1012 | |||
5522 | hidnplayr | 1013 | proc transmit stdcall bufferptr |
5050 | hidnplayr | 1014 | |
1015 | pushf |
||
1016 | cli |
||
1017 | |||
5522 | hidnplayr | 1018 | mov esi, [bufferptr] |
1019 | DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n", [bufferptr], [esi + NET_BUFF.length] |
||
1020 | lea eax, [esi + NET_BUFF.data] |
||
3545 | hidnplayr | 1021 | DEBUGF 1,"To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\ |
1022 | [eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\ |
||
1023 | [eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\ |
||
1024 | [eax+13]:2,[eax+12]:2 |
||
1025 | |||
5522 | hidnplayr | 1026 | cmp [esi + NET_BUFF.length], 1514 |
3545 | hidnplayr | 1027 | ja .fail |
5522 | hidnplayr | 1028 | cmp [esi + NET_BUFF.length], 60 |
5050 | hidnplayr | 1029 | jb .fail |
3545 | hidnplayr | 1030 | |
1031 | ;---------------------------------- |
||
1032 | ; Find currentTX descriptor address |
||
1033 | |||
5050 | hidnplayr | 1034 | mov eax, sizeof.tx_desc |
1035 | mul [ebx + device.cur_tx] |
||
1036 | lea esi, [ebx + device.tx_ring + eax] |
||
3545 | hidnplayr | 1037 | |
1038 | DEBUGF 1,"Using TX desc: %x\n", esi |
||
1039 | |||
5498 | hidnplayr | 1040 | ;---------------------------------- |
1041 | ; Check if the descriptor is in use |
||
1042 | |||
1043 | test [esi + tx_desc.status], DSB_OWNbit |
||
1044 | jnz .desc |
||
1045 | |||
3545 | hidnplayr | 1046 | ;--------------------------- |
1047 | ; Program the packet pointer |
||
1048 | |||
5050 | hidnplayr | 1049 | mov eax, [bufferptr] |
5522 | hidnplayr | 1050 | mov ecx, [eax + NET_BUFF.length] |
3545 | hidnplayr | 1051 | mov [esi + tx_desc.buf_soft_addr], eax |
5522 | hidnplayr | 1052 | add eax, [eax + NET_BUFF.offset] |
5050 | hidnplayr | 1053 | invoke GetPhysAddr |
3545 | hidnplayr | 1054 | mov dword [esi + tx_desc.buf_addr], eax |
1055 | |||
1056 | ;------------------------ |
||
1057 | ; Program the packet size |
||
1058 | |||
5522 | hidnplayr | 1059 | mov eax, ecx |
5498 | hidnplayr | 1060 | or eax, DSB_OWNbit or DSB_FSbit or DSB_LSbit |
5050 | hidnplayr | 1061 | cmp [ebx + device.cur_tx], NUM_TX_DESC - 1 |
3545 | hidnplayr | 1062 | jne @f |
1063 | or eax, DSB_EORbit |
||
5498 | hidnplayr | 1064 | @@: |
1065 | mov [esi + tx_desc.status], eax |
||
3545 | hidnplayr | 1066 | |
1067 | ;----------------------------------------- |
||
1068 | ; Set the polling bit (start transmission) |
||
1069 | |||
5050 | hidnplayr | 1070 | set_io [ebx + device.io_addr], 0 |
1071 | set_io [ebx + device.io_addr], REG_TxPoll |
||
3545 | hidnplayr | 1072 | mov al, 0x40 ; set polling bit |
1073 | out dx, al |
||
1074 | |||
1075 | ;----------------------- |
||
1076 | ; Update TX descriptor |
||
1077 | |||
5050 | hidnplayr | 1078 | inc [ebx + device.cur_tx] |
1079 | and [ebx + device.cur_tx], NUM_TX_DESC - 1 |
||
3545 | hidnplayr | 1080 | |
1081 | ;------------- |
||
1082 | ; Update stats |
||
1083 | |||
5050 | hidnplayr | 1084 | inc [ebx + device.packets_tx] |
5522 | hidnplayr | 1085 | add dword [ebx + device.bytes_tx], ecx |
5050 | hidnplayr | 1086 | adc dword [ebx + device.bytes_tx + 4], 0 |
3545 | hidnplayr | 1087 | |
5126 | hidnplayr | 1088 | popf |
3545 | hidnplayr | 1089 | xor eax, eax |
5050 | hidnplayr | 1090 | ret |
3545 | hidnplayr | 1091 | |
5498 | hidnplayr | 1092 | .desc: |
1093 | DEBUGF 2,"Descriptor is still in use!\n" |
||
3545 | hidnplayr | 1094 | .fail: |
5050 | hidnplayr | 1095 | DEBUGF 2,"Transmit failed\n" |
5522 | hidnplayr | 1096 | invoke NetFree, [bufferptr] |
5050 | hidnplayr | 1097 | popf |
3545 | hidnplayr | 1098 | or eax, -1 |
5050 | hidnplayr | 1099 | ret |
3545 | hidnplayr | 1100 | |
5050 | hidnplayr | 1101 | endp |
3545 | hidnplayr | 1102 | |
5050 | hidnplayr | 1103 | |
3545 | hidnplayr | 1104 | |
1105 | ;;;;;;;;;;;;;;;;;;;;;;; |
||
1106 | ;; ;; |
||
1107 | ;; Interrupt handler ;; |
||
1108 | ;; ;; |
||
1109 | ;;;;;;;;;;;;;;;;;;;;;;; |
||
1110 | |||
1111 | align 4 |
||
1112 | int_handler: |
||
1113 | |||
1114 | push ebx esi edi |
||
1115 | |||
4334 | hidnplayr | 1116 | DEBUGF 1,"INT\n" |
3545 | hidnplayr | 1117 | |
1118 | ; find pointer of device wich made IRQ occur |
||
1119 | |||
1120 | mov ecx, [devices] |
||
1121 | test ecx, ecx |
||
1122 | jz .nothing |
||
1123 | mov esi, device_list |
||
1124 | .nextdevice: |
||
1125 | mov ebx, [esi] |
||
1126 | |||
5050 | hidnplayr | 1127 | set_io [ebx + device.io_addr], 0 |
1128 | set_io [ebx + device.io_addr], REG_IntrStatus |
||
3545 | hidnplayr | 1129 | in ax, dx |
5498 | hidnplayr | 1130 | out dx, ax ; ACK all interrupts |
1131 | cmp ax, 0xffff ; if so, hardware is no longer present |
||
1132 | je .nothing |
||
3545 | hidnplayr | 1133 | test ax, ax |
1134 | jnz .got_it |
||
1135 | .continue: |
||
1136 | add esi, 4 |
||
1137 | dec ecx |
||
1138 | jnz .nextdevice |
||
1139 | .nothing: |
||
1140 | pop edi esi ebx |
||
1141 | xor eax, eax |
||
1142 | |||
1143 | ret ; If no device was found, abort (The irq was probably for a device, not registered to this driver) |
||
1144 | |||
1145 | .got_it: |
||
5050 | hidnplayr | 1146 | DEBUGF 1,"Device: %x Status: %x\n", ebx, ax |
3545 | hidnplayr | 1147 | |
1148 | ;-------- |
||
1149 | ; Receive |
||
1150 | test ax, ISB_RxOK |
||
1151 | jz .no_rx |
||
1152 | |||
1153 | push ax |
||
1154 | push ebx |
||
1155 | |||
5567 | hidnplayr | 1156 | .rx_loop: |
3545 | hidnplayr | 1157 | pop ebx |
5050 | hidnplayr | 1158 | mov eax, sizeof.rx_desc |
1159 | mul [ebx + device.cur_rx] |
||
1160 | lea esi, [ebx + device.rx_ring + eax] |
||
3545 | hidnplayr | 1161 | |
1162 | DEBUGF 1,"RxDesc.status = 0x%x\n", [esi + rx_desc.status] |
||
5522 | hidnplayr | 1163 | mov ecx, [esi + rx_desc.status] |
5567 | hidnplayr | 1164 | test ecx, DSB_OWNbit |
5522 | hidnplayr | 1165 | jnz .rx_return |
3545 | hidnplayr | 1166 | |
5050 | hidnplayr | 1167 | DEBUGF 1,"cur_rx = %u\n", [ebx + device.cur_rx] |
5522 | hidnplayr | 1168 | test ecx, SD_RxRES |
5567 | hidnplayr | 1169 | jnz .rx_reuse |
3545 | hidnplayr | 1170 | |
1171 | push ebx |
||
5567 | hidnplayr | 1172 | push .rx_loop |
5522 | hidnplayr | 1173 | and ecx, 0x00001FFF |
1174 | add ecx, -4 ; we dont need CRC |
||
1175 | DEBUGF 1,"data length = %u\n", ecx |
||
1176 | mov eax, [esi + rx_desc.buf_soft_addr] |
||
3545 | hidnplayr | 1177 | push eax |
5522 | hidnplayr | 1178 | mov [eax + NET_BUFF.length], ecx |
1179 | mov [eax + NET_BUFF.device], ebx |
||
1180 | mov [eax + NET_BUFF.offset], NET_BUFF.data |
||
3545 | hidnplayr | 1181 | |
5522 | hidnplayr | 1182 | ;------------- |
1183 | ; Update stats |
||
3545 | hidnplayr | 1184 | |
5050 | hidnplayr | 1185 | add dword [ebx + device.bytes_rx], eax |
1186 | adc dword [ebx + device.bytes_rx + 4], 0 |
||
1187 | inc [ebx + device.packets_rx] |
||
3545 | hidnplayr | 1188 | |
5522 | hidnplayr | 1189 | ;---------------------- |
1190 | ; Allocate a new buffer |
||
3545 | hidnplayr | 1191 | |
5567 | hidnplayr | 1192 | mov [esi + rx_desc.status], 0 |
5522 | hidnplayr | 1193 | invoke NetAlloc, RX_BUF_SIZE+NET_BUFF.data |
5567 | hidnplayr | 1194 | test eax, eax |
1195 | jz .no_more_buffers |
||
3545 | hidnplayr | 1196 | mov [esi + rx_desc.buf_soft_addr], eax |
5050 | hidnplayr | 1197 | invoke GetPhysAddr |
5522 | hidnplayr | 1198 | add eax, NET_BUFF.data |
3545 | hidnplayr | 1199 | mov dword [esi + rx_desc.buf_addr], eax |
1200 | |||
5522 | hidnplayr | 1201 | ;--------------- |
1202 | ; re set OWN bit |
||
3545 | hidnplayr | 1203 | |
1204 | mov eax, DSB_OWNbit or RX_BUF_SIZE |
||
5050 | hidnplayr | 1205 | cmp [ebx + device.cur_rx], NUM_RX_DESC - 1 |
3545 | hidnplayr | 1206 | jne @f |
1207 | or eax, DSB_EORbit |
||
5050 | hidnplayr | 1208 | @@: |
1209 | mov [esi + rx_desc.status], eax |
||
3545 | hidnplayr | 1210 | |
5567 | hidnplayr | 1211 | .no_more_buffers: |
5522 | hidnplayr | 1212 | ;-------------- |
1213 | ; Update rx ptr |
||
3545 | hidnplayr | 1214 | |
5050 | hidnplayr | 1215 | inc [ebx + device.cur_rx] |
1216 | and [ebx + device.cur_rx], NUM_RX_DESC - 1 |
||
3545 | hidnplayr | 1217 | |
5522 | hidnplayr | 1218 | jmp [EthInput] |
5567 | hidnplayr | 1219 | |
1220 | .rx_reuse: |
||
1221 | mov eax, DSB_OWNbit or RX_BUF_SIZE |
||
1222 | cmp [ebx + device.cur_rx], NUM_RX_DESC - 1 |
||
1223 | jne @f |
||
1224 | or eax, DSB_EORbit |
||
1225 | @@: |
||
1226 | mov [esi + rx_desc.status], eax |
||
1227 | push ebx |
||
1228 | jmp .rx_loop |
||
1229 | |||
3545 | hidnplayr | 1230 | .rx_return: |
1231 | pop ax |
||
1232 | .no_rx: |
||
1233 | |||
5498 | hidnplayr | 1234 | ;----------------- |
1235 | ; Transmit cleanup |
||
3545 | hidnplayr | 1236 | |
5498 | hidnplayr | 1237 | test ax, ISB_TxOK or ISB_TxErr or ISB_TxDescUnavail |
3545 | hidnplayr | 1238 | jz .no_tx |
5522 | hidnplayr | 1239 | push ax |
3545 | hidnplayr | 1240 | |
5498 | hidnplayr | 1241 | DEBUGF 1,"TX done!\n" |
5522 | hidnplayr | 1242 | |
1243 | mov ecx, NUM_TX_DESC |
||
1244 | lea esi, [ebx + device.tx_ring] |
||
5498 | hidnplayr | 1245 | .txloop: |
5050 | hidnplayr | 1246 | cmp dword [esi + tx_desc.buf_soft_addr], 0 |
5522 | hidnplayr | 1247 | jz .maybenext |
3545 | hidnplayr | 1248 | |
1249 | test [esi + tx_desc.status], DSB_OWNbit |
||
5522 | hidnplayr | 1250 | jnz .maybenext |
3545 | hidnplayr | 1251 | |
5522 | hidnplayr | 1252 | push ecx |
1253 | DEBUGF 1,"Freeing up TX desc: %x\n", esi |
||
1254 | invoke NetFree, [esi + tx_desc.buf_soft_addr] |
||
1255 | pop ecx |
||
5050 | hidnplayr | 1256 | and dword [esi + tx_desc.buf_soft_addr], 0 |
3545 | hidnplayr | 1257 | |
5522 | hidnplayr | 1258 | .maybenext: |
1259 | add esi, sizeof.tx_desc |
||
1260 | dec ecx |
||
1261 | jnz .txloop |
||
1262 | |||
1263 | pop ax |
||
3545 | hidnplayr | 1264 | .no_tx: |
1265 | |||
5498 | hidnplayr | 1266 | test ax, ISB_LinkChg |
1267 | jz .no_linkchange |
||
1268 | DEBUGF 2, "Link change detected\n" |
||
1269 | call detect_link |
||
1270 | .no_linkchange: |
||
3545 | hidnplayr | 1271 | |
1272 | pop edi esi ebx |
||
1273 | xor eax, eax |
||
1274 | inc eax |
||
1275 | |||
1276 | ret |
||
1277 | |||
1278 | |||
1279 | |||
5498 | hidnplayr | 1280 | align 4 |
1281 | detect_link: |
||
1282 | |||
1283 | set_io [ebx + device.io_addr], 0 |
||
1284 | |||
1285 | ; set_io [ebx + device.io_addr], REG_TBICSR |
||
1286 | ; in eax, dx |
||
1287 | ; test eax, TBI_LinkOK |
||
1288 | ; jz .down |
||
1289 | |||
1290 | ; mov [ebx + device.state], ETH_LINK_UNKNOWN |
||
1291 | ; invoke NetLinkChanged |
||
1292 | ; ret |
||
1293 | |||
1294 | set_io [ebx + device.io_addr], REG_PHYstatus |
||
1295 | in al, dx |
||
1296 | test al, PHYS_LinkStatus |
||
1297 | jz .down |
||
1298 | DEBUGF 2, "Link is up, phystatus=0x%x\n", al |
||
1299 | xor ecx, ecx |
||
1300 | test al, PHYS_10bps |
||
1301 | jz @f |
||
1302 | or cl, ETH_LINK_10M |
||
1303 | @@: |
||
1304 | test al, PHYS_100bps |
||
1305 | jz @f |
||
1306 | or cl, ETH_LINK_100M |
||
1307 | @@: |
||
1308 | test al, PHYS_1000bpsF |
||
1309 | jz @f |
||
1310 | or cl, ETH_LINK_1G ;or ETH_LINK_FD |
||
1311 | @@: |
||
1312 | test al, PHYS_FullDup |
||
1313 | jz @f |
||
1314 | or cl, ETH_LINK_FD |
||
1315 | @@: |
||
1316 | mov [ebx + device.state], ecx |
||
1317 | invoke NetLinkChanged |
||
1318 | ret |
||
1319 | |||
1320 | .down: |
||
1321 | DEBUGF 2, "Link is down\n" |
||
1322 | mov [ebx + device.state], ETH_LINK_DOWN |
||
1323 | invoke NetLinkChanged |
||
1324 | ret |
||
1325 | |||
1326 | |||
1327 | |||
5050 | hidnplayr | 1328 | ; End of code |
3545 | hidnplayr | 1329 | |
5050 | hidnplayr | 1330 | data fixups |
1331 | end data |
||
3545 | hidnplayr | 1332 | |
5050 | hidnplayr | 1333 | include '../peimport.inc' |
3545 | hidnplayr | 1334 | |
1335 | my_service db 'RTL8169',0 ; max 16 chars include zero |
||
1336 | |||
1337 | include_debug_strings ; All data wich FDO uses will be included here |
||
1338 | |||
5494 | hidnplayr | 1339 | MAC_VERSION_LIST: |
3545 | hidnplayr | 1340 | |
5494 | hidnplayr | 1341 | ; 8168EP family. |
1342 | dd 0x7cf00000, 0x50200000, 51, name_49 |
||
1343 | dd 0x7cf00000, 0x50100000, 50, name_49 |
||
1344 | dd 0x7cf00000, 0x50000000, 49, name_49 |
||
3545 | hidnplayr | 1345 | |
5494 | hidnplayr | 1346 | ; 8168H family. |
1347 | dd 0x7cf00000, 0x54100000, 46, name_45 |
||
1348 | dd 0x7cf00000, 0x54000000, 45, name_45 |
||
3545 | hidnplayr | 1349 | |
5494 | hidnplayr | 1350 | ; 8168G family. |
1351 | dd 0x7cf00000, 0x5c800000, 44, name_44 |
||
1352 | dd 0x7cf00000, 0x50900000, 42, name_40 |
||
1353 | dd 0x7cf00000, 0x4c100000, 41, name_40 |
||
1354 | dd 0x7cf00000, 0x4c000000, 40, name_40 |
||
1355 | |||
1356 | ; 8168F family. |
||
1357 | dd 0x7c800000, 0x48800000, 38, name_38 |
||
1358 | dd 0x7cf00000, 0x48100000, 36, name_35 |
||
1359 | dd 0x7cf00000, 0x48000000, 35, name_35 |
||
1360 | |||
1361 | ; 8168E family. |
||
1362 | dd 0x7c800000, 0x2c800000, 34, name_34 |
||
1363 | dd 0x7cf00000, 0x2c200000, 33, name_32 |
||
1364 | dd 0x7cf00000, 0x2c100000, 32, name_32 |
||
1365 | dd 0x7c800000, 0x2c000000, 33, name_32 |
||
1366 | |||
1367 | ; 8168D family. |
||
1368 | dd 0x7cf00000, 0x28300000, 26, name_25 |
||
1369 | dd 0x7cf00000, 0x28100000, 25, name_25 |
||
1370 | dd 0x7c800000, 0x28000000, 26, name_25 |
||
1371 | |||
1372 | ; 8168DP family. |
||
1373 | dd 0x7cf00000, 0x28800000, 27, name_27 |
||
1374 | dd 0x7cf00000, 0x28a00000, 28, name_27 |
||
1375 | |||
1376 | ; 8168C family. |
||
5522 | hidnplayr | 1377 | dd 0x7cf00000, 0x3cb00000, 24, name_18 |
1378 | dd 0x7cf00000, 0x3c900000, 23, name_18 |
||
5494 | hidnplayr | 1379 | dd 0x7cf00000, 0x3c800000, 18, name_18 |
5522 | hidnplayr | 1380 | dd 0x7c800000, 0x3c800000, 24, name_18 |
5494 | hidnplayr | 1381 | dd 0x7cf00000, 0x3c000000, 19, name_19 |
1382 | dd 0x7cf00000, 0x3c200000, 20, name_19 |
||
1383 | dd 0x7cf00000, 0x3c300000, 21, name_19 |
||
1384 | dd 0x7cf00000, 0x3c400000, 22, name_19 |
||
1385 | dd 0x7c800000, 0x3c000000, 22, name_19 |
||
1386 | |||
1387 | ; 8168B family. |
||
1388 | dd 0x7cf00000, 0x38000000, 12, name_11 |
||
1389 | dd 0x7cf00000, 0x38500000, 17, name_10 |
||
1390 | dd 0x7c800000, 0x38000000, 17, name_10 |
||
1391 | dd 0x7c800000, 0x30000000, 11, name_11 |
||
1392 | |||
1393 | ; 8101 family. |
||
1394 | dd 0x7cf00000, 0x34a00000, 09, name_07 |
||
1395 | dd 0x7cf00000, 0x24a00000, 09, name_07 |
||
1396 | dd 0x7cf00000, 0x34900000, 08, name_07 |
||
1397 | dd 0x7cf00000, 0x24900000, 08, name_07 |
||
1398 | dd 0x7cf00000, 0x34800000, 07, name_07 |
||
1399 | dd 0x7cf00000, 0x24800000, 07, name_07 |
||
1400 | dd 0x7cf00000, 0x34000000, 13, name_10 |
||
1401 | dd 0x7cf00000, 0x34300000, 10, name_10 |
||
1402 | dd 0x7cf00000, 0x34200000, 16, name_11 |
||
1403 | dd 0x7c800000, 0x34800000, 09, name_07 |
||
1404 | dd 0x7c800000, 0x24800000, 09, name_07 |
||
1405 | dd 0x7c800000, 0x34000000, 16, name_11 |
||
1406 | dd 0xfc800000, 0x38800000, 15, name_14 |
||
1407 | dd 0xfc800000, 0x30800000, 14, name_14 |
||
1408 | |||
1409 | ; 8110 family. |
||
1410 | dd 0xfc800000, 0x98000000, 06, name_05 |
||
1411 | dd 0xfc800000, 0x18000000, 05, name_05 |
||
1412 | dd 0xfc800000, 0x10000000, 04, name_04 |
||
1413 | dd 0xfc800000, 0x04000000, 03, name_03 |
||
1414 | dd 0xfc800000, 0x00800000, 02, name_02 |
||
1415 | dd 0xfc800000, 0x00000000, 01, name_01 |
||
1416 | |||
1417 | ; Catch-all |
||
1418 | dd 0x00000000, 0x00000000, 0, name_unknown |
||
1419 | |||
1420 | ; PCI-devices |
||
1421 | name_01 db "RTL8169",0 |
||
1422 | name_02 db "RTL8169s",0 |
||
1423 | name_03 db "RTL8110s",0 |
||
1424 | name_04 db "RTL8169sb/8110sb",0 |
||
1425 | name_05 db "RTL8169sc/8110sc",0 |
||
1426 | ;name_06 db "RTL8169sc/8110sc",0 |
||
1427 | |||
1428 | ; PCI-E devices |
||
1429 | name_07 db "RTL8102e",0 |
||
1430 | ;name_08 db "RTL8102e",0 |
||
1431 | ;name_09 db "RTL8102e",0 |
||
1432 | name_10 db "RTL8101e",0 |
||
1433 | name_11 db "RTL8168b/8111b",0 |
||
1434 | ;name_12 db "RTL8168b/8111b",0 |
||
1435 | ;name_13 db "RTL8101e",0 |
||
1436 | name_14 db "RTL8100e",0 |
||
1437 | ;name_15 db "RTL8100e",0 |
||
1438 | ;name_16 db "RTL8168b/8111b",0 |
||
1439 | ;name_17 db "RTL8101e",0 |
||
1440 | name_18 db "RTL8168cp/8111cp",0 |
||
1441 | name_19 db "RTL8168c/8111c",0 |
||
1442 | ;name_20 db "RTL8168c/8111c",0 |
||
1443 | ;name_21 db "RTL8168c/8111c",0 |
||
1444 | ;name_22 db "RTL8168c/8111c",0 |
||
5522 | hidnplayr | 1445 | ;name_23 db "RTL8168cp/8111cp",0 |
5494 | hidnplayr | 1446 | ;name_24 db "RTL8168cp/8111cp",0 |
1447 | name_25 db "RTL8168d/8111d",0 |
||
1448 | ;name_26 db "RTL8168d/8111d",0 |
||
1449 | name_27 db "RTL8168dp/8111dp",0 |
||
1450 | ;name_28 db "RTL8168dp/8111dp",0 |
||
1451 | name_29 db "RTL8105e",0 |
||
1452 | ;name_30 db "RTL8105e",0 |
||
1453 | ;name_31 db "RTL8168dp/8111dp",0 |
||
1454 | name_32 db "RTL8168e/8111e",0 |
||
1455 | ;name_33 db "RTL8168e/8111e",0 |
||
1456 | name_34 db "RTL8168evl/8111evl",0 |
||
1457 | name_35 db "RTL8168f/8111f",0 |
||
1458 | ;name_36 db "RTL8168f/8111f",0 |
||
1459 | name_37 db "RTL8402",0 |
||
1460 | name_38 db "RTL8411",0 |
||
1461 | name_39 db "RTL8106e",0 |
||
1462 | name_40 db "RTL8168g/8111g",0 |
||
1463 | ;name_41 db "RTL8168g/8111g",0 |
||
1464 | ;name_42 db "RTL8168g/8111g",0 |
||
1465 | ;name_43 db "RTL8106e",0 |
||
1466 | name_44 db "RTL8411",0 |
||
1467 | name_45 db "RTL8168h/8111h",0 |
||
1468 | ;name_46 db "RTL8168h/8111h",0 |
||
1469 | name_47 db "RTL8107e",0 |
||
1470 | ;name_48 db "RTL8107e",0 |
||
1471 | name_49 db "RTL8168ep/8111ep",0 |
||
1472 | ;name_50 db "RTL8168ep/8111ep",0 |
||
1473 | ;name_51 db "RTL8168ep/8111ep",0 |
||
1474 | |||
1475 | name_unknown db "unknown RTL8169 clone",0 |
||
1476 | |||
5050 | hidnplayr | 1477 | align 4 |
1478 | devices dd 0 |
||
3545 | hidnplayr | 1479 | device_list rd MAX_DEVICES ; This list contains all pointers to device structures the driver is handling |
1480 |