Date: Wed, 27 Apr 2011 17:48:05 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 192199 for review Message-ID: <201104271748.p3RHm5Ln029538@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@192199?ac=10 Change 192199 by jhb@jhb_jhbbsd on 2011/04/27 17:47:25 Tidy. Affected files ... .. //depot/projects/pci/sys/dev/pci/pci_pci.c#16 edit Differences ... ==== //depot/projects/pci/sys/dev/pci/pci_pci.c#16 (text+ko) ==== @@ -60,7 +60,6 @@ static int pcib_resume(device_t dev); static int pcib_power_for_sleep(device_t pcib, device_t dev, int *pstate); -static void pcib_write_windows(struct pcib_softc *sc, int mask); static device_method_t pcib_methods[] = { /* Device interface */ @@ -161,6 +160,43 @@ } static void +pcib_write_windows(struct pcib_softc *sc, int mask) +{ + device_t dev; + uint32_t val; + + dev = sc->dev; + if (sc->io.valid && mask & WIN_IO) { + val = pci_read_config(dev, PCIR_IOBASEL_1, 1); + if ((val & PCIM_BRIO_MASK) == PCIM_BRIO_32) { + pci_write_config(dev, PCIR_IOBASEH_1, + sc->io.base >> 16, 2); + pci_write_config(dev, PCIR_IOLIMITH_1, + sc->io.limit >> 16, 2); + } + pci_write_config(dev, PCIR_IOBASEL_1, sc->io.base >> 8, 1); + pci_write_config(dev, PCIR_IOLIMITL_1, sc->io.limit >> 8, 1); + } + + if (mask & WIN_MEM) { + pci_write_config(dev, PCIR_MEMBASE_1, sc->mem.base >> 16, 2); + pci_write_config(dev, PCIR_MEMLIMIT_1, sc->mem.limit >> 16, 2); + } + + if (sc->pmem.valid && mask & WIN_PMEM) { + val = pci_read_config(dev, PCIR_PMBASEL_1, 2); + if ((val & PCIM_BRPM_MASK) == PCIM_BRPM_64) { + pci_write_config(dev, PCIR_PMBASEH_1, + sc->pmem.base >> 32, 4); + pci_write_config(dev, PCIR_PMLIMITH_1, + sc->pmem.limit >> 32, 4); + } + pci_write_config(dev, PCIR_PMBASEL_1, sc->pmem.base >> 16, 2); + pci_write_config(dev, PCIR_PMLIMITL_1, sc->pmem.limit >> 16, 2); + } +} + +static void pcib_alloc_window(struct pcib_softc *sc, struct pcib_window *w, int type, int flags, pci_addr_t max_address) { @@ -322,43 +358,6 @@ } } -static void -pcib_write_windows(struct pcib_softc *sc, int mask) -{ - device_t dev; - uint32_t val; - - dev = sc->dev; - if (sc->io.valid && mask & WIN_IO) { - val = pci_read_config(dev, PCIR_IOBASEL_1, 1); - if ((val & PCIM_BRIO_MASK) == PCIM_BRIO_32) { - pci_write_config(dev, PCIR_IOBASEH_1, - sc->io.base >> 16, 2); - pci_write_config(dev, PCIR_IOLIMITH_1, - sc->io.limit >> 16, 2); - } - pci_write_config(dev, PCIR_IOBASEL_1, sc->io.base >> 8, 1); - pci_write_config(dev, PCIR_IOLIMITL_1, sc->io.limit >> 8, 1); - } - - if (mask & WIN_MEM) { - pci_write_config(dev, PCIR_MEMBASE_1, sc->mem.base >> 16, 2); - pci_write_config(dev, PCIR_MEMLIMIT_1, sc->mem.limit >> 16, 2); - } - - if (sc->pmem.valid && mask & WIN_PMEM) { - val = pci_read_config(dev, PCIR_PMBASEL_1, 2); - if ((val & PCIM_BRPM_MASK) == PCIM_BRPM_64) { - pci_write_config(dev, PCIR_PMBASEH_1, - sc->pmem.base >> 32, 4); - pci_write_config(dev, PCIR_PMLIMITH_1, - sc->pmem.limit >> 32, 4); - } - pci_write_config(dev, PCIR_PMBASEL_1, sc->pmem.base >> 16, 2); - pci_write_config(dev, PCIR_PMLIMITL_1, sc->pmem.limit >> 16, 2); - } -} - #else /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104271748.p3RHm5Ln029538>