From 02ac56354e1bc340d00c59c517830d05c8928bc4 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Sat, 26 Mar 2022 22:16:23 +0000 Subject: [PATCH] Rhine: Improved chip detection git-svn-id: svn://kolibrios.org@9751 a494cfbc-eb01-0410-851d-a64ba20cac60 --- drivers/ethernet/rhine.asm | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/ethernet/rhine.asm b/drivers/ethernet/rhine.asm index ef60e5cbf1..965a25c59a 100644 --- a/drivers/ethernet/rhine.asm +++ b/drivers/ethernet/rhine.asm @@ -510,7 +510,8 @@ struct device ETH_DEVICE pci_bus dd ? revision db ? irq_line db ? - chip_id dw ? + chip_vid dw ? + chip_did dw ? cur_rx dw ? cur_tx dw ? @@ -706,17 +707,18 @@ probe: invoke PciWrite32, [ebx + device.pci_bus], [ebx + device.pci_dev], PCI_header00.command, eax ; get device id - invoke PciRead16, [ebx + device.pci_bus], [ebx + device.pci_dev], PCI_header00.device_id - mov [ebx + device.chip_id], ax + invoke PciRead32, [ebx + device.pci_bus], [ebx + device.pci_dev], PCI_header00.vendor_id + mov dword[ebx + device.chip_vid], eax mov esi, chiplist .loop: - cmp word[esi+2], ax + cmp dword[esi], eax je .got_it - add esi, 8 - cmp esi, chiplist + 6*8 - jbe .loop - DEBUGF 2, "Unknown chip: 0x%x, continuing anyway\n", ax + add esi, 2*4 + cmp dword[esi], 0 + jne .loop + DEBUGF 2, "Unknown chip: 0x%x, continuing anyway\n", eax + mov [ebx + device.name], my_service jmp .done .got_it: mov eax, dword[esi+4] @@ -735,7 +737,7 @@ probe: cmp al, 0x40 jb .below_x40 - mov ax, [ebx + device.chip_id] + mov ax, [ebx + device.chip_did] DEBUGF 1, "Enabling Sticky Bit Workaround for Chip_id: 0x%x\n", ax ; clear sticky bit before reset & read ethernet address @@ -892,7 +894,7 @@ end if @@: ; set MII 10 FULL ON, only apply in vt3043 - cmp [ebx + device.chip_id], 0x3043 + cmp [ebx + device.chip_did], 0x3043 jne @f stdcall WriteMII, 0x17, 1 shl 1, 1 @@: