git: 27f56d337be3 - main - powerpcspe: fix PCI enumeration on ppce500
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 21 Mar 2022 19:11:51 UTC
The branch main has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=27f56d337be39a3f493febb585f3484c4cb6c3b6 commit 27f56d337be39a3f493febb585f3484c4cb6c3b6 Author: Alfredo Dal'Ava Junior <alfredo@FreeBSD.org> AuthorDate: 2022-03-21 10:57:07 +0000 Commit: Alfredo Dal'Ava Junior <alfredo@FreeBSD.org> CommitDate: 2022-03-21 19:11:33 +0000 powerpcspe: fix PCI enumeration on ppce500 This fixes PCI devices not being found on QEMU ppce500. This generic board used to have its first PCI slot at 0x11, like the mpc8544dsi and some real HW. After commit [1], it was changed to 0x1 and our driver wasn't prepared for that. [1] https://gitlab.com/qemu-project/qemu/-/commit/3bb7e02a9725a24e5bf915b35f914f82f5b07a1f Reviewed by: jhibbits, bdragon MFC after: 2 days Sponsored by: Institudo de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D34621 --- sys/powerpc/mpc85xx/pci_mpc85xx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/powerpc/mpc85xx/pci_mpc85xx.c b/sys/powerpc/mpc85xx/pci_mpc85xx.c index ced24d224860..8d0c21342215 100644 --- a/sys/powerpc/mpc85xx/pci_mpc85xx.c +++ b/sys/powerpc/mpc85xx/pci_mpc85xx.c @@ -138,7 +138,8 @@ __FBSDID("$FreeBSD$"); #define DEVFN(b, s, f) ((b << 16) | (s << 8) | f) -#define FSL_NUM_MSIS 256 /* 8 registers of 32 bits (8 hardware IRQs) */ +#define FSL_NUM_MSIS 256 /* 8 registers of 32 bits (8 hardware IRQs) */ +#define PCI_SLOT_FIRST 0x1 /* used to be 0x11 but qemu-ppce500 starts from 0x1 */ struct fsl_pcib_softc { struct ofw_pci_softc pci_sc; @@ -552,7 +553,8 @@ fsl_pcib_read_config(device_t dev, u_int bus, u_int slot, u_int func, struct fsl_pcib_softc *sc = device_get_softc(dev); u_int devfn; - if (bus == sc->sc_busnr && !sc->sc_pcie && slot < 10) + if (bus == sc->sc_busnr && !sc->sc_pcie && + slot < PCI_SLOT_FIRST) return (~0); devfn = DEVFN(bus, slot, func); @@ -565,7 +567,8 @@ fsl_pcib_write_config(device_t dev, u_int bus, u_int slot, u_int func, { struct fsl_pcib_softc *sc = device_get_softc(dev); - if (bus == sc->sc_busnr && !sc->sc_pcie && slot < 10) + if (bus == sc->sc_busnr && !sc->sc_pcie && + slot < PCI_SLOT_FIRST) return; fsl_pcib_cfgwrite(sc, bus, slot, func, reg, val, bytes); }