diff -ur linux-2.3.15-VIRGIN/arch/alpha/kernel/bios32.c linux-2.3.15/arch/alpha/kernel/bios32.c --- linux-2.3.15-VIRGIN/arch/alpha/kernel/bios32.c Sun Aug 25 19:38:43 2019 +++ linux-2.3.15/arch/alpha/kernel/bios32.c Sun Aug 25 22:20:51 2019 @@ -83,54 +83,36 @@ static void layout_hoses(void); -int -pcibios_present(void) -{ - return alpha_mv.hose_read_config_byte != NULL; -} - -void __init -pcibios_init(void) -{ - if (!pcibios_present()) - return; - - printk("Alpha PCI BIOS32 revision %d.%02d\n", MAJOR_REV, MINOR_REV); - if (alpha_use_srm_setup) - printk(" NOT modifying existing (SRM) PCI configuration\n"); -} - char * __init pcibios_setup(char *str) { return str; } -void __init -pcibios_fixup(void) -{ - alpha_mv.pci_fixup(); -} +struct pci_fixup pcibios_fixups[] = { + { 0 } +}; void __init pcibios_fixup_bus(struct pci_bus *bus) { } -int -pcibios_read_config_byte (u8 bus, u8 dev, u8 where, u8 *value) +static int +pcibios_dev_read_config_byte (struct pci_dev *dev, int where, u8 *value) { int r = PCIBIOS_FUNC_NOT_SUPPORTED; *value = 0xff; if (alpha_mv.hose_read_config_byte) { r = (alpha_mv.hose_read_config_byte - (bus, dev, where, value, bus2hose[bus])); + (dev->bus->number, dev->devfn, + where, value, bus2hose[dev->bus->number])); } return r; } -int -pcibios_read_config_word (u8 bus, u8 dev, u8 where, u16 *value) +static int +pcibios_dev_read_config_word (struct pci_dev *dev, int where, u16 *value) { int r = PCIBIOS_FUNC_NOT_SUPPORTED; *value = 0xffff; @@ -138,13 +120,14 @@ r = PCIBIOS_BAD_REGISTER_NUMBER; if (!(where & 1)) r = (alpha_mv.hose_read_config_word - (bus, dev, where, value, bus2hose[bus])); + (dev->bus->number, dev->devfn, + where, value, bus2hose[dev->bus->number])); } return r; } -int -pcibios_read_config_dword (u8 bus, u8 dev, u8 where, u32 *value) +static int +pcibios_dev_read_config_dword (struct pci_dev *dev, int where, u32 *value) { int r = PCIBIOS_FUNC_NOT_SUPPORTED; *value = 0xffffffff; @@ -152,48 +135,61 @@ r = PCIBIOS_BAD_REGISTER_NUMBER; if (!(where & 3)) r = (alpha_mv.hose_read_config_dword - (bus, dev, where, value, bus2hose[bus])); + (dev->bus->number, dev->devfn, + where, value, bus2hose[dev->bus->number])); } return r; } -int -pcibios_write_config_byte (u8 bus, u8 dev, u8 where, u8 value) +static int +pcibios_dev_write_config_byte (struct pci_dev *dev, int where, u8 value) { int r = PCIBIOS_FUNC_NOT_SUPPORTED; if (alpha_mv.hose_write_config_byte) { r = (alpha_mv.hose_write_config_byte - (bus, dev, where, value, bus2hose[bus])); + (dev->bus->number, dev->devfn, + where, value, bus2hose[dev->bus->number])); } return r; } -int -pcibios_write_config_word (u8 bus, u8 dev, u8 where, u16 value) +static int +pcibios_dev_write_config_word (struct pci_dev *dev, int where, u16 value) { int r = PCIBIOS_FUNC_NOT_SUPPORTED; if (alpha_mv.hose_write_config_word) { r = PCIBIOS_BAD_REGISTER_NUMBER; if (!(where & 1)) r = (alpha_mv.hose_write_config_word - (bus, dev, where, value, bus2hose[bus])); + (dev->bus->number, dev->devfn, + where, value, bus2hose[dev->bus->number])); } return r; } -int -pcibios_write_config_dword (u8 bus, u8 dev, u8 where, u32 value) +static int +pcibios_dev_write_config_dword (struct pci_dev *dev, int where, u32 value) { int r = PCIBIOS_FUNC_NOT_SUPPORTED; if (alpha_mv.hose_write_config_dword) { r = PCIBIOS_BAD_REGISTER_NUMBER; if (!(where & 3)) r = (alpha_mv.hose_write_config_dword - (bus, dev, where, value, bus2hose[bus])); + (dev->bus->number, dev->devfn, + where, value, bus2hose[dev->bus->number])); } return r; } +static struct pci_ops pcibios_ops = { + pcibios_dev_read_config_byte, + pcibios_dev_read_config_word, + pcibios_dev_read_config_dword, + pcibios_dev_write_config_byte, + pcibios_dev_write_config_word, + pcibios_dev_write_config_dword +}; + asmlinkage int sys_pciconfig_read(unsigned long bus, unsigned long dfn, unsigned long off, unsigned long len, @@ -279,6 +275,19 @@ return err; } +void __init +pcibios_init(void) +{ + if (alpha_mv.hose_read_config_byte == NULL) + return; + + printk("Alpha PCI BIOS32 revision %d.%02d\n", MAJOR_REV, MINOR_REV); + if (alpha_use_srm_setup) + printk(" NOT modifying existing (SRM) PCI configuration\n"); + printk("PCI: Probing PCI hardware\n"); + pci_scan_bus(0, &pcibios_ops, &bus2hose[0]); + alpha_mv.pci_fixup(); +} /* * Gory details start here... @@ -481,6 +490,15 @@ pcibios_read_config_word(bus->number, dev->devfn, PCI_COMMAND, &cmd); for (idx = 0; idx <= 5; idx++) { + /* We don't want to disturb normal IDE functions, so + we don't touch the first two I/O ports on the + Cypress. */ + if (dev->vendor == PCI_VENDOR_ID_CONTAQ + && dev->device == PCI_DEVICE_ID_CONTAQ_82C693 + && idx < 2) { + continue; + } + off = PCI_BASE_ADDRESS_0 + 4*idx; /* * Figure out how much space and of what type this @@ -517,15 +535,6 @@ mask = (~base << 1) | 0x1; size = (mask & base) & 0xffffffff; - /* We don't want to disturb normal IDE functions, so - we don't touch the first two I/O ports on the - Cypress. */ - if (dev->vendor == PCI_VENDOR_ID_CONTAQ - && dev->device == PCI_DEVICE_ID_CONTAQ_82C693 - && idx < 2) { - continue; - } - /* * Aligning to 0x800 rather than the minimum base of * 0x400 is an attempt to avoid having devices in @@ -847,10 +856,10 @@ * Sigh; check_region() will need changing to accept a PCI_HANDLE, * if we allocate I/O space addresses on a per-bus basis. * For now, make the I/O bases unique across all busses, so - * that check_region() will not get confused... ;-} + * that check_region() will not get confused... ;-) */ io_base = default_io_base; - for (cur = &pci_root; cur; cur = cur->next) { + for (cur = pci_root; cur; cur = cur->next) { mem_base = default_mem_base; DBG_DEVS(("layout_all_busses: calling layout_bus()\n")); layout_bus(cur); @@ -1295,7 +1304,6 @@ layout_one_hose(struct linux_hose_info *hose) { static struct pci_bus *pchain = NULL; - struct pci_bus *pbus = &hose->pci_bus; static unsigned char busno = 0; DBG_HOSE(("layout_one_hose: entry\n")); @@ -1307,37 +1315,38 @@ * hose's root PCI device hierarchy. */ - pbus->number = pbus->secondary = busno; - pbus->sysdata = hose; - DBG_HOSE(("layout_one_hose: before hose_fixup_busno()\n")); hose_fixup_busno(hose, busno); DBG_HOSE(("layout_one_hose: before pci_scan_bus()\n")); - pbus->subordinate = pci_scan_bus(pbus); /* the original! */ + hose->pci_bus = pci_scan_bus(busno, &pcibios_ops, hose); /* * Set the maximum subordinate bus of this hose. */ - hose->pci_last_busno = pbus->subordinate; + hose->pci_last_busno = hose->pci_bus->subordinate; #if 0 alpha_mv.hose_write_config_byte(busno, 0, 0x41, hose->pci_last_busno, hose); #endif - busno = pbus->subordinate + 1; + busno = hose->pci_bus->subordinate + 1; /* * Fixup the chain of primary PCI busses. */ - if (pchain) { - pchain->next = &hose->pci_bus; - pchain = pchain->next; - } else { - pchain = &pci_root; - memcpy(pchain, &hose->pci_bus, sizeof(pci_root)); - } + /* + * NOTE - I have no idea what this was supposed to do since + * pci_scan_bus maintains a linked list using ->next already. + * I just did a transliteration of the code to post-2.3.15pre2-era + * PCI --mitch + */ + if (pchain) + pchain->next = hose->pci_bus; + pchain = hose->pci_bus; + if (!pci_root) + pci_root = pchain; DBG_HOSE(("layout_one_hose: returning...\n")); } diff -ur linux-2.3.15-VIRGIN/include/asm-alpha/pci.h linux-2.3.15/include/asm-alpha/pci.h --- linux-2.3.15-VIRGIN/include/asm-alpha/pci.h Thu Jan 7 11:25:02 1999 +++ linux-2.3.15/include/asm-alpha/pci.h Sun Aug 25 20:47:29 2019 @@ -13,7 +13,7 @@ */ struct linux_hose_info { - struct pci_bus pci_bus; + struct pci_bus *pci_bus; struct linux_hose_info *next; unsigned long pci_io_space; unsigned long pci_mem_space;