pci_mpc85xx: Ensure access order for config-regs

The CFG_ADDR has to be written before reading or writing the CFG_DATA.
This commit is contained in:
Christian Mauderer 2023-10-20 10:52:14 +02:00
parent 42add0b7f1
commit 97962443ee

View File

@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$");
#include <powerpc/mpc85xx/mpc85xx.h> #include <powerpc/mpc85xx/mpc85xx.h>
#ifdef __rtems__ #ifdef __rtems__
#include <rtems/score/memory.h> #include <rtems/score/memory.h>
#include <libcpu/powerpc-utility.h>
#endif /* __rtems__ */ #endif /* __rtems__ */
#define REG_CFG_ADDR 0x0000 #define REG_CFG_ADDR 0x0000
@ -460,6 +461,9 @@ fsl_pcib_cfgread(struct fsl_pcib_softc *sc, u_int bus, u_int slot, u_int func,
mtx_lock_spin(&sc->sc_cfg_mtx); mtx_lock_spin(&sc->sc_cfg_mtx);
bus_space_write_4(sc->sc_bst, sc->sc_bsh, REG_CFG_ADDR, addr); bus_space_write_4(sc->sc_bst, sc->sc_bsh, REG_CFG_ADDR, addr);
#ifdef __rtems__
ppc_enforce_in_order_execution_of_io();
#endif
switch (bytes) { switch (bytes) {
case 1: case 1:
@ -498,6 +502,9 @@ fsl_pcib_cfgwrite(struct fsl_pcib_softc *sc, u_int bus, u_int slot, u_int func,
mtx_lock_spin(&sc->sc_cfg_mtx); mtx_lock_spin(&sc->sc_cfg_mtx);
bus_space_write_4(sc->sc_bst, sc->sc_bsh, REG_CFG_ADDR, addr); bus_space_write_4(sc->sc_bst, sc->sc_bsh, REG_CFG_ADDR, addr);
#ifdef __rtems__
ppc_enforce_in_order_execution_of_io();
#endif
switch (bytes) { switch (bytes) {
case 1: case 1: