The SUN,simba device doesn't have a ranges properties and so Linux will calculate the PCI memory/IO ranges by probing the PBM "Memory Address Map" and "I/O Address Map" registers (see apb_fake_ranges()).
Set sensible default values for both SUNW,simba devices during PCI configuration and document accordingly.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- drivers/pci.c | 37 +++++++++++++++++++++++++++++++++++++ drivers/pci_database.c | 2 +- drivers/pci_database.h | 1 + 3 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/drivers/pci.c b/drivers/pci.c index ec637d9..510ebb7 100644 --- a/drivers/pci.c +++ b/drivers/pci.c @@ -553,6 +553,43 @@ int bridge_config_cb(const pci_config_t *config) return 0; }
+int simba_config_cb(const pci_config_t *config) +{ + bridge_config_cb(config); + + /* Configure the simba ranges as per the mostly undocumented + PCI config register in Linux's apb_fake_ranges(): + + pci@1,1 (pciA): + IO: 0x1fe02000000-0x1fe027fffff + MEM: 0x1ff20000000-0x1ff5fffffff + + pci@1 (pciB): + IO: 0x1fe02800000-0x1fe02ffffff + MEM: 0x1ff60000000-0x1ff9fffffff + */ + + switch (PCI_FN(config->dev)) { + case 1: + /* IO: 0x1fe02000000-0x1fe027fffff */ + pci_config_write8(config->dev, 0xde, 0x0f); + + /* MEM: 0x1ff20000000-0x1ff5fffffff */ + pci_config_write8(config->dev, 0xdf, 0x06); + break; + + case 0: + /* IO: 0x1fe02800000-0x1fe02ffffff */ + pci_config_write8(config->dev, 0xde, 0xf0); + + /* MEM: 0x1ff60000000-0x1ff9fffffff */ + pci_config_write8(config->dev, 0xdf, 0x18); + break; + } + + return 0; +} + int ide_config_cb2 (const pci_config_t *config) { ob_ide_init(config->path, diff --git a/drivers/pci_database.c b/drivers/pci_database.c index b220586..3155ee3 100644 --- a/drivers/pci_database.c +++ b/drivers/pci_database.c @@ -371,7 +371,7 @@ static const pci_dev_t PCIbrg_devices[] = { PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_SIMBA, NULL, "pci", "SUNW,simba", "pci108e,5000\0pciclass,060400\0", 3, 2, 1, - bridge_config_cb, NULL, + simba_config_cb, NULL, }, { 0xFFFF, 0xFFFF, diff --git a/drivers/pci_database.h b/drivers/pci_database.h index 1cc1e56..241bac3 100644 --- a/drivers/pci_database.h +++ b/drivers/pci_database.h @@ -36,6 +36,7 @@ extern int vga_config_cb(const pci_config_t *config); extern int host_config_cb(const pci_config_t *config); extern int sabre_config_cb(const pci_config_t *config); extern int bridge_config_cb(const pci_config_t *config); +extern int simba_config_cb(const pci_config_t *config); extern int ebus_config_cb(const pci_config_t *config); extern int i82378_config_cb(const pci_config_t *config); extern int usb_ohci_config_cb(const pci_config_t *config);