From b092fc2903d0183d278fab5eec91b0fec3a27884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Sun, 27 Oct 2013 13:50:26 +0000 Subject: [PATCH] PCI controller and USB controller (3 functions) correctly detected now --- BaS_gcc/sources/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BaS_gcc/sources/pci.c b/BaS_gcc/sources/pci.c index c1e645c..ccb2457 100644 --- a/BaS_gcc/sources/pci.c +++ b/BaS_gcc/sources/pci.c @@ -138,7 +138,7 @@ uint32_t pci_read_config_longword(uint16_t bus, uint16_t slot, uint16_t function MCF_PCI_PCICAR_BUSNUM(bus) | MCF_PCI_PCICAR_DEVNUM(slot) | /* device number, devices 0 - 9 are reserved */ MCF_PCI_PCICAR_FUNCNUM(function) | /* function number */ - MCF_PCI_PCICAR_DWORD(offset / 2); + MCF_PCI_PCICAR_DWORD(offset / 4); wait(1000); value = * (volatile uint32_t *) PCI_IO_OFFSET; /* access device */ @@ -177,14 +177,14 @@ void pci_scan(void) if (value != 0xffffffff) { xprintf("[%02x] [%02x] [%02x]: %08x\r\n", bus, slot, function, value); - for (i = 0; i < 0x40; i += 2) + for (i = 0; i < 0x40; i += 4) { value = pci_read_config_longword(bus, slot, function, i); xprintf("register %02x value= %08x\r\n", i, value); } /* test for multi-function device to avoid ghost device detects */ value = pci_read_config_longword(bus, slot, function, 0x0c); - if (!(value & 0x8000000)) /* no multi function device */ + if (function == 0 && !(value & 0x800000)) /* no multi function device */ function = 8; } }