PCI controller and USB controller (3 functions) correctly detected now

This commit is contained in:
Markus Fröschle
2013-10-27 13:50:26 +00:00
parent 96862663c6
commit b092fc2903

View File

@@ -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_BUSNUM(bus) |
MCF_PCI_PCICAR_DEVNUM(slot) | /* device number, devices 0 - 9 are reserved */ MCF_PCI_PCICAR_DEVNUM(slot) | /* device number, devices 0 - 9 are reserved */
MCF_PCI_PCICAR_FUNCNUM(function) | /* function number */ MCF_PCI_PCICAR_FUNCNUM(function) | /* function number */
MCF_PCI_PCICAR_DWORD(offset / 2); MCF_PCI_PCICAR_DWORD(offset / 4);
wait(1000); wait(1000);
value = * (volatile uint32_t *) PCI_IO_OFFSET; /* access device */ value = * (volatile uint32_t *) PCI_IO_OFFSET; /* access device */
@@ -177,14 +177,14 @@ void pci_scan(void)
if (value != 0xffffffff) if (value != 0xffffffff)
{ {
xprintf("[%02x] [%02x] [%02x]: %08x\r\n", bus, slot, function, value); 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); value = pci_read_config_longword(bus, slot, function, i);
xprintf("register %02x value= %08x\r\n", i, value); xprintf("register %02x value= %08x\r\n", i, value);
} }
/* test for multi-function device to avoid ghost device detects */ /* test for multi-function device to avoid ghost device detects */
value = pci_read_config_longword(bus, slot, function, 0x0c); 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; function = 8;
} }
} }