Rev 3155 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3155 | Rev 3205 | ||
---|---|---|---|
Line 487... | Line 487... | ||
487 | device: |
487 | device: |
Line 488... | Line 488... | ||
488 | 488 | ||
Line 489... | Line 489... | ||
489 | ETH_DEVICE |
489 | ETH_DEVICE |
490 | 490 | ||
491 | .io_addr dd ? |
491 | .io_addr dd ? |
492 | .pci_dev db ? |
492 | .pci_dev dd ? |
493 | .pci_bus db ? |
493 | .pci_bus dd ? |
494 | .revision db ? |
494 | .revision db ? |
Line 495... | Line 495... | ||
495 | .irq_line db ? |
495 | .irq_line db ? |
Line 612... | Line 612... | ||
612 | 612 | ||
613 | ; mov eax, [IOCTL.input] ; get the pci bus and device numbers |
613 | ; mov eax, [IOCTL.input] ; get the pci bus and device numbers |
614 | mov ax , [eax+1] ; |
614 | mov ax , [eax+1] ; |
615 | .nextdevice: |
615 | .nextdevice: |
616 | mov ebx, [esi] |
616 | mov ebx, [esi] |
- | 617 | cmp al, byte[device.pci_bus] |
|
- | 618 | jne @f |
|
617 | cmp ax , word [device.pci_bus] ; compare with pci and device num in device list (notice the usage of word instead of byte) |
619 | cmp ah, byte[device.pci_dev] |
- | 620 | je .find_devicenum ; Device is already loaded, let's find it's device number |
|
618 | je .find_devicenum ; Device is already loaded, let's find it's device number |
621 | @@: |
619 | add esi, 4 |
622 | add esi, 4 |
Line 620... | Line 623... | ||
620 | loop .nextdevice |
623 | loop .nextdevice |
Line 637... | Line 640... | ||
637 | mov [device.name], my_service |
640 | mov [device.name], my_service |
Line 638... | Line 641... | ||
638 | 641 | ||
Line 639... | Line 642... | ||
639 | ; save the pci bus and device numbers |
642 | ; save the pci bus and device numbers |
640 | 643 | ||
641 | mov eax, [IOCTL.input] |
644 | mov eax, [IOCTL.input] |
642 | mov cl , [eax+1] |
645 | movzx ecx, byte[eax+1] |
643 | mov [device.pci_bus], cl |
646 | mov [device.pci_bus], ecx |
Line 644... | Line 647... | ||
644 | mov cl , [eax+2] |
647 | movzx ecx, byte[eax+2] |
Line 645... | Line 648... | ||
645 | mov [device.pci_dev], cl |
648 | mov [device.pci_dev], ecx |
Line 646... | Line 649... | ||
646 | 649 | ||
Line 647... | Line 650... | ||
647 | ; Now, it's time to find the base io addres of the PCI device |
650 | ; Now, it's time to find the base io addres of the PCI device |
Line 648... | Line 651... | ||
648 | 651 | ||
649 | find_io [device.pci_bus], [device.pci_dev], [device.io_addr] |
652 | PCI_find_io |
Line 650... | Line 653... | ||
650 | 653 | ||
Line 716... | Line 719... | ||
716 | 719 | ||
717 | mov eax, [device.io_addr] |
720 | mov eax, [device.io_addr] |
Line 718... | Line 721... | ||
718 | DEBUGF 1, "Probing card at 0x%x\n", eax |
721 | DEBUGF 1, "Probing card at 0x%x\n", eax |
719 | 722 | ||
Line 720... | Line 723... | ||
720 | ; make the card a bus master |
723 | ; make the card a bus master |
721 | make_bus_master [device.pci_bus], [device.pci_dev] |
- | |
722 | - | ||
723 | ; get device id |
724 | PCI_make_bus_master |
724 | movzx ecx, [device.pci_bus] |
725 | |
Line 725... | Line 726... | ||
725 | movzx edx, [device.pci_dev] |
726 | ; get device id |
726 | stdcall PciRead16, ecx, edx, PCI_DEVICE_ID |
727 | stdcall PciRead16, [device.pci_bus], [device.pci_dev], PCI_DEVICE_ID |
Line 727... | Line 728... | ||
727 | mov [device.chip_id], ax |
728 | mov [device.chip_id], ax |
728 | 729 | ||
Line 729... | Line 730... | ||
729 | ; get revision id. |
730 | ; get revision id. |
Line 806... | Line 807... | ||
806 | in al, dx |
807 | in al, dx |
807 | and al, 0xFE |
808 | and al, 0xFE |
808 | out dx, al |
809 | out dx, al |
Line 809... | Line 810... | ||
809 | 810 | ||
810 | ; turn on bit2 in PCI configuration register 0x53 , only for 3065 |
- | |
811 | movzx ecx, [device.pci_bus] |
- | |
812 | movzx edx, [device.pci_dev] |
811 | ; turn on bit2 in PCI configuration register 0x53 , only for 3065 |
813 | stdcall PciRead8, ecx, edx, PCI_REG_MODE3 |
812 | stdcall PciRead8, [device.pci_bus], [device.pci_dev], PCI_REG_MODE3 |
814 | or al, MODE3_MIION |
813 | or al, MODE3_MIION |
815 | stdcall PciWrite8, ecx, edx, PCI_REG_MODE3, eax |
814 | stdcall PciWrite8, [device.pci_bus], [device.pci_dev], PCI_REG_MODE3, eax |
Line 816... | Line 815... | ||
816 | .not_vt3065: |
815 | .not_vt3065: |
817 | 816 | ||
818 | ; back off algorithm, disable the right-most 4-bit off CFGD |
817 | ; back off algorithm, disable the right-most 4-bit off CFGD |