Rev 2981 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2981 | Rev 3155 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2013. 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 | ;; Ethernet driver for KolibriOS ;; |
6 | ;; Ethernet driver for KolibriOS ;; |
7 | ;; This is an adaptation of MenuetOS driver with minimal changes. ;; |
7 | ;; This is an adaptation of MenuetOS driver with minimal changes. ;; |
8 | ;; Changes were made by CleverMouse. Original copyright follows. ;; |
8 | ;; Changes were made by CleverMouse. Original copyright follows. ;; |
Line 269... | Line 269... | ||
269 | test eax, eax ; check for SRV_GETVERSION |
269 | test eax, eax ; check for SRV_GETVERSION |
270 | jnz @f |
270 | jnz @f |
271 | ; 3. This is SRV_GETVERSION request, no input, 4 bytes output, API_VERSION. |
271 | ; 3. This is SRV_GETVERSION request, no input, 4 bytes output, API_VERSION. |
272 | ; 3a. Output size must be at least 4 bytes. |
272 | ; 3a. Output size must be at least 4 bytes. |
273 | cmp [IOCTL.out_size], 4 |
273 | cmp [IOCTL.out_size], 4 |
274 | jl .fail |
274 | jb .fail |
275 | ; 3b. Write result to the output buffer. |
275 | ; 3b. Write result to the output buffer. |
276 | mov eax, [IOCTL.output] |
276 | mov eax, [IOCTL.output] |
277 | mov [eax], dword API_VERSION |
277 | mov [eax], dword API_VERSION |
278 | ; 3c. Return success. |
278 | ; 3c. Return success. |
279 | xor eax, eax |
279 | xor eax, eax |
Line 283... | Line 283... | ||
283 | jnz .fail |
283 | jnz .fail |
284 | ; 4. This is SRV_HOOK request, input defines the device to hook, no output. |
284 | ; 4. This is SRV_HOOK request, input defines the device to hook, no output. |
285 | ; 4a. The driver works only with PCI devices, |
285 | ; 4a. The driver works only with PCI devices, |
286 | ; so input must be at least 3 bytes long. |
286 | ; so input must be at least 3 bytes long. |
287 | cmp [IOCTL.inp_size], 3 |
287 | cmp [IOCTL.inp_size], 3 |
288 | jl .fail |
288 | jb .fail |
289 | ; 4b. First byte of input is bus type, 1 stands for PCI. |
289 | ; 4b. First byte of input is bus type, 1 stands for PCI. |
290 | mov eax, [IOCTL.input] |
290 | mov eax, [IOCTL.input] |
291 | cmp byte [eax], 1 |
291 | cmp byte [eax], 1 |
292 | jne .fail |
292 | jne .fail |
293 | ; 4c. Second and third bytes of the input define the device: bus and dev. |
293 | ; 4c. Second and third bytes of the input define the device: bus and dev. |
Line 311... | Line 311... | ||
311 | loop .nextdevice |
311 | loop .nextdevice |
312 | ; 4e. This device doesn't have its own eth_device structure yet, let's create one |
312 | ; 4e. This device doesn't have its own eth_device structure yet, let's create one |
313 | .firstdevice: |
313 | .firstdevice: |
314 | ; 4f. Check that we have place for new device. |
314 | ; 4f. Check that we have place for new device. |
315 | cmp [devices], MAX_DEVICES |
315 | cmp [devices], MAX_DEVICES |
316 | jge .fail |
316 | jae .fail |
317 | ; 4g. Allocate memory for device descriptor and receive+transmit buffers. |
317 | ; 4g. Allocate memory for device descriptor and receive+transmit buffers. |
318 | ; 4h. Zero the structure. |
318 | ; 4h. Zero the structure. |
319 | allocate_and_clear ebx, device.size, .fail |
319 | allocate_and_clear ebx, device.size, .fail |
320 | ; 4i. Save PCI coordinates |
320 | ; 4i. Save PCI coordinates |
321 | mov eax, [IOCTL.input] |
321 | mov eax, [IOCTL.input] |