From fa4b32fa800a31351180823a809ef1f36e4270ff Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 3 Jul 2003 14:00:57 +0000 Subject: All current uses of pci_set_powerstate are bogus, at least in theory. However, they are presently necessary due to bigger bogusness in the pci bus layer not doing the right thing on suspend/resume or on initial device probe. This is exactly the sort of thing that the BURN_BRIDGES option was invented for. Mark all of them as BURN_BRIDGES. As soon as I have the powerstate stuff properly integrated into the pci bus code, I intend to remove all these workarounds. --- sys/dev/firewire/fwohci_pci.c | 2 ++ sys/dev/fxp/if_fxp.c | 12 ++++++++---- sys/dev/lge/if_lge.c | 4 ++-- sys/dev/nge/if_nge.c | 4 ++-- sys/dev/pccbb/pccbb.c | 5 +++-- sys/dev/txp/if_txp.c | 4 ++-- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/sys/dev/firewire/fwohci_pci.c b/sys/dev/firewire/fwohci_pci.c index 044621f80921..41662397a17c 100644 --- a/sys/dev/firewire/fwohci_pci.c +++ b/sys/dev/firewire/fwohci_pci.c @@ -403,9 +403,11 @@ fwohci_pci_resume(device_t dev) { fwohci_softc_t *sc = device_get_softc(dev); +#ifndef BURN_BRIDGES device_printf(dev, "fwohci_pci_resume: power_state = 0x%08x\n", pci_get_powerstate(dev)); pci_set_powerstate(dev, PCI_POWERSTATE_D0); +#endif fwohci_pci_init(dev); fwohci_resume(sc, dev); return 0; diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index 69bb5de5eb0d..302666267f65 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -193,7 +193,9 @@ static void fxp_intr_body(struct fxp_softc *sc, struct ifnet *ifp, static void fxp_init(void *xsc); static void fxp_init_body(struct fxp_softc *sc); static void fxp_tick(void *xsc); +#ifndef BURN_BRIDGES static void fxp_powerstate_d0(device_t dev); +#endif static void fxp_start(struct ifnet *ifp); static void fxp_start_body(struct ifnet *ifp); static void fxp_stop(struct fxp_softc *sc); @@ -335,6 +337,7 @@ fxp_probe(device_t dev) return (ENXIO); } +#ifndef BURN_BRIDGES static void fxp_powerstate_d0(device_t dev) { @@ -360,6 +363,7 @@ fxp_powerstate_d0(device_t dev) } #endif } +#endif static void fxp_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) @@ -401,9 +405,9 @@ fxp_attach(device_t dev) */ pci_enable_busmaster(dev); val = pci_read_config(dev, PCIR_COMMAND, 2); - +#ifndef BURN_BRIDGES fxp_powerstate_d0(dev); - +#endif /* * Figure out which we should try first - memory mapping or i/o mapping? * We default to memory mapping. Then we accept an override from the @@ -999,9 +1003,9 @@ fxp_resume(device_t dev) FXP_LOCK(sc); s = splimp(); - +#ifndef BURN_BRIDGES fxp_powerstate_d0(dev); - +#endif /* better way to do this? */ for (i = 0; i < 5; i++) pci_write_config(dev, PCIR_MAPS + i * 4, sc->saved_maps[i], 4); diff --git a/sys/dev/lge/if_lge.c b/sys/dev/lge/if_lge.c index 703f46de0efa..34e19de21555 100644 --- a/sys/dev/lge/if_lge.c +++ b/sys/dev/lge/if_lge.c @@ -501,7 +501,7 @@ lge_attach(dev) sc = device_get_softc(dev); unit = device_get_unit(dev); bzero(sc, sizeof(struct lge_softc)); - +#ifndef BURN_BRIDGES /* * Handle power management nonsense. */ @@ -524,7 +524,7 @@ lge_attach(dev) pci_write_config(dev, LGE_PCI_LOMEM, membase, 4); pci_write_config(dev, LGE_PCI_INTLINE, irq, 4); } - +#endif /* * Map control/status registers. */ diff --git a/sys/dev/nge/if_nge.c b/sys/dev/nge/if_nge.c index 5c9e3c6d414a..044fdc2ffffb 100644 --- a/sys/dev/nge/if_nge.c +++ b/sys/dev/nge/if_nge.c @@ -835,7 +835,7 @@ nge_attach(dev) mtx_init(&sc->nge_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE); - +#ifndef BURN_BRIDGES /* * Handle power management nonsense. */ @@ -858,7 +858,7 @@ nge_attach(dev) pci_write_config(dev, NGE_PCI_LOMEM, membase, 4); pci_write_config(dev, NGE_PCI_INTLINE, irq, 4); } - +#endif /* * Map control/status registers. */ diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c index b3e655c6900c..fe4c44543b08 100644 --- a/sys/dev/pccbb/pccbb.c +++ b/sys/dev/pccbb/pccbb.c @@ -585,6 +585,7 @@ cbb_chipinit(struct cbb_softc *sc) pci_write_config(sc->dev, CBBR_IOLIMIT1, 0, 4); } +#ifndef BURN_BRIDGES static void cbb_powerstate_d0(device_t dev) { @@ -606,6 +607,7 @@ cbb_powerstate_d0(device_t dev) pci_write_config(dev, PCIR_INTLINE, irq, 4); } } +#endif /* * Print out the config space @@ -640,10 +642,9 @@ cbb_attach(device_t brdev) sc->subbus = pci_read_config(brdev, PCIR_SUBBUS_2, 1); SLIST_INIT(&sc->rl); STAILQ_INIT(&sc->intr_handlers); - +#ifndef BURN_BRIDGES cbb_powerstate_d0(brdev); -#ifndef BURN_BRIDGES /* * The PCI bus code should assign us memory in the absense * of the BIOS doing so. However, 'should' isn't 'is,' so we kludge diff --git a/sys/dev/txp/if_txp.c b/sys/dev/txp/if_txp.c index 542f6927fc2d..866a120cebdb 100644 --- a/sys/dev/txp/if_txp.c +++ b/sys/dev/txp/if_txp.c @@ -223,7 +223,7 @@ txp_attach(dev) mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE); - +#ifndef BURN_BRIDGES /* * Handle power management nonsense. */ @@ -245,7 +245,7 @@ txp_attach(dev) pci_write_config(dev, TXP_PCI_LOMEM, membase, 4); pci_write_config(dev, TXP_PCI_INTLINE, irq, 4); } - +#endif /* * Map control/status registers. */ -- cgit v1.2.3