Rev 3545 | Rev 4334 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3545 | Rev 3758 | ||
---|---|---|---|
Line 655... | Line 655... | ||
655 | 655 | ||
656 | DEBUGF 1,"Hooking into device, dev:%x, bus:%x, irq:%x, addr:%x\n",\ |
656 | DEBUGF 1,"Hooking into device, dev:%x, bus:%x, irq:%x, addr:%x\n",\ |
Line 657... | Line 657... | ||
657 | [device.pci_dev]:1,[device.pci_bus]:1,[device.irq_line]:1,[device.io_addr]:4 |
657 | [device.pci_dev]:1,[device.pci_bus]:1,[device.irq_line]:1,[device.io_addr]:4 |
658 | - | ||
659 | ; Ok, the eth_device structure is ready, let's probe the device |
- | |
660 | ;;; cli |
658 | |
661 | 659 | ; Ok, the eth_device structure is ready, let's probe the device |
|
662 | call probe ; this function will output in eax |
660 | call probe ; this function will output in eax |
Line 663... | Line 661... | ||
663 | test eax, eax |
661 | test eax, eax |
664 | jnz .err_sti ; If an error occured, exit |
662 | jnz .err ; If an error occured, exit |
665 | 663 | ||
Line 666... | Line 664... | ||
666 | mov eax, [devices] ; Add the device structure to our device list |
664 | mov eax, [devices] ; Add the device structure to our device list |
667 | mov [device_list+4*eax], ebx ; (IRQ handler uses this list to find device) |
665 | mov [device_list+4*eax], ebx ; (IRQ handler uses this list to find device) |
668 | inc [devices] ; |
- | |
Line 669... | Line 666... | ||
669 | 666 | inc [devices] ; |
|
670 | mov [device.type], NET_TYPE_ETH |
667 | |
Line 671... | Line 668... | ||
671 | call NetRegDev |
668 | mov [device.type], NET_TYPE_ETH |
Line 689... | Line 686... | ||
689 | ; If an error occured, remove all allocated data and exit (returning -1 in eax) |
686 | ; If an error occured, remove all allocated data and exit (returning -1 in eax) |
Line 690... | Line 687... | ||
690 | 687 | ||
691 | .destroy: |
688 | .destroy: |
Line 692... | Line -... | ||
692 | ; todo: reset device into virgin state |
- | |
693 | - | ||
694 | .err_sti: |
- | |
695 | sti |
689 | ; todo: reset device into virgin state |
696 | 690 | ||
Line 697... | Line 691... | ||
697 | .err: |
691 | .err: |
698 | stdcall KernelFree, ebx |
692 | stdcall KernelFree, ebx |
Line 723... | Line 717... | ||
723 | 717 | ||
724 | ; get device id |
718 | ; get device id |
725 | stdcall PciRead16, [device.pci_bus], [device.pci_dev], PCI_DEVICE_ID |
719 | stdcall PciRead16, [device.pci_bus], [device.pci_dev], PCI_DEVICE_ID |
Line -... | Line 720... | ||
- | 720 | mov [device.chip_id], ax |
|
- | 721 | ||
- | 722 | mov esi, chiplist |
|
- | 723 | .loop: |
|
- | 724 | cmp word[esi+2], ax |
|
- | 725 | je .got_it |
|
- | 726 | add esi, 8 |
|
- | 727 | cmp esi, chiplist + 6*8 |
|
- | 728 | jbe .loop |
|
- | 729 | DEBUGF 2, "Unknown chip: 0x%x, continueing anyway\n", ax |
|
- | 730 | jmp .done |
|
- | 731 | .got_it: |
|
- | 732 | mov eax, dword[esi+4] |
|
- | 733 | mov [device.name], eax |
|
- | 734 | DEBUGF 1, "Chip type = %s\n", eax |
|
726 | mov [device.chip_id], ax |
735 | .done: |
727 | 736 | ||
Line 728... | Line 737... | ||
728 | ; get revision id. |
737 | ; get revision id. |
729 | PCI_find_rev |
738 | PCI_find_rev |
Line 928... | Line 937... | ||
928 | DEBUGF 1, "reset\n" |
937 | DEBUGF 1, "reset\n" |
Line 929... | Line 938... | ||
929 | 938 | ||
Line 930... | Line 939... | ||
930 | ; attach int handler |
939 | ; attach int handler |
931 | 940 | ||
932 | movzx eax, [device.irq_line] |
941 | movzx eax, [device.irq_line] |
933 | DEBUGF 2,"Attaching int handler to irq %x\n", eax:1 |
942 | DEBUGF 1,"Attaching int handler to irq %x\n", eax:1 |
934 | stdcall AttachIntHandler, eax, int_handler, dword 0 |
943 | stdcall AttachIntHandler, eax, int_handler, dword 0 |
935 | test eax, eax |
944 | test eax, eax |
936 | jnz @f |
945 | jnz @f |
Line 1397... | Line 1406... | ||
1397 | ;; pointer to device structure in ebx ;; |
1406 | ;; pointer to device structure in ebx ;; |
1398 | ;; ;; |
1407 | ;; ;; |
1399 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1408 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1400 | align 4 |
1409 | align 4 |
1401 | transmit: |
1410 | transmit: |
1402 | DEBUGF 2,"\nTransmitting packet, buffer:%x, size:%u\n", [esp+4], [esp+8] |
1411 | DEBUGF 1,"\nTransmitting packet, buffer:%x, size:%u\n", [esp+4], [esp+8] |
1403 | mov eax, [esp+4] |
1412 | mov eax, [esp+4] |
1404 | DEBUGF 2,"To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\ |
1413 | DEBUGF 1,"To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\ |
1405 | [eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\ |
1414 | [eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\ |
1406 | [eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\ |
1415 | [eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\ |
1407 | [eax+13]:2,[eax+12]:2 |
1416 | [eax+13]:2,[eax+12]:2 |
Line 1408... | Line 1417... | ||
1408 | 1417 | ||
Line 1448... | Line 1457... | ||
1448 | adc dword [device.bytes_tx + 4], 0 |
1457 | adc dword [device.bytes_tx + 4], 0 |
Line 1449... | Line 1458... | ||
1449 | 1458 | ||
Line 1450... | Line 1459... | ||
1450 | ret 8 |
1459 | ret 8 |
1451 | 1460 | ||
Line 1452... | Line 1461... | ||
1452 | .fail: |
1461 | .fail: |
Line 1655... | Line 1664... | ||
1655 | 1664 | ||
1656 | devices dd 0 |
1665 | devices dd 0 |
1657 | version dd (DRIVER_VERSION shl 16) or (API_VERSION and 0xFFFF) |
1666 | version dd (DRIVER_VERSION shl 16) or (API_VERSION and 0xFFFF) |
Line 1658... | Line 1667... | ||
1658 | my_service db 'RHINE',0 ; max 16 chars including zero |
1667 | my_service db 'RHINE',0 ; max 16 chars including zero |
1659 | 1668 | ||
1660 | devicelist: |
1669 | chiplist: |
1661 | dd 0x30431106, rhine_3043;, RHINE_IOTYPE, RHINE_I_IOSIZE, CanHaveMII or ReqTxAlign or HasV1TxStat |
1670 | dd 0x30431106, rhine_3043;, RHINE_IOTYPE, RHINE_I_IOSIZE, CanHaveMII or ReqTxAlign or HasV1TxStat |
1662 | dd 0x61001106, rhine_6100;, RHINE_IOTYPE, RHINE_I_IOSIZE, CanHaveMII or ReqTxAlign or HasV1TxStat |
1671 | dd 0x61001106, rhine_6100;, RHINE_IOTYPE, RHINE_I_IOSIZE, CanHaveMII or ReqTxAlign or HasV1TxStat |
1663 | dd 0x30651106, rhine_6102;, RHINE_IOTYPE, RHINEII_IOSIZE, CanHaveMII or HasWOL |
1672 | dd 0x30651106, rhine_6102;, RHINE_IOTYPE, RHINEII_IOSIZE, CanHaveMII or HasWOL |