From 75b7bd825ca2f5b9586587f0e1e7ec14afd645e0 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Fri, 24 Apr 2009 20:03:56 +0000 Subject: Fix two issues with resource accounting: 1. Simba, the UltraSPARC-IIi Advanced PCI Bridge doesn't support the standard address range registers. Skip resource accounting on these devices for now. 2. Some machines (for example sparc64) actually implement a 32-bit I/O space, so start parsing the registers that gives us the upper 16 bits and make sure the extent covers the entire 32-bit address range. --- sys/dev/pci/ppb.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/pci/ppb.c b/sys/dev/pci/ppb.c index ee3302e5d46..2744e2e575a 100644 --- a/sys/dev/pci/ppb.c +++ b/sys/dev/pci/ppb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ppb.c,v 1.30 2009/04/22 20:45:57 kettenis Exp $ */ +/* $OpenBSD: ppb.c,v 1.31 2009/04/24 20:03:55 kettenis Exp $ */ /* $NetBSD: ppb.c,v 1.16 1997/06/06 23:48:05 thorpej Exp $ */ /* @@ -167,15 +167,26 @@ ppbattach(struct device *parent, struct device *self, void *aux) pci_intr_map(pa, &sc->sc_ih[pin - PCI_INTERRUPT_PIN_A]); } + /* + * The UltraSPARC-IIi APB doesn't implement the standard + * address range registers. + */ + if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_SUN && + PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SUN_SIMBA) + goto attach; + /* Figure out the I/O address range of the bridge. */ blr = pci_conf_read(pc, pa->pa_tag, PPB_REG_IOSTATUS); sc->sc_iobase = (blr & 0x000000f0) << 8; sc->sc_iolimit = (blr & 0x000f000) | 0x00000fff; + blr = pci_conf_read(pc, pa->pa_tag, PPB_REG_IO_HI); + sc->sc_iobase |= (blr & 0x0000ffff) << 16; + sc->sc_iolimit |= (blr & 0xffff0000); if (sc->sc_iolimit > sc->sc_iobase) { name = malloc(32, M_DEVBUF, M_NOWAIT); if (name) { snprintf(name, 32, "%s pciio", sc->sc_dev.dv_xname); - sc->sc_ioex = extent_create(name, 0, 0xffff, + sc->sc_ioex = extent_create(name, 0, 0xffffffff, M_DEVBUF, NULL, 0, EX_NOWAIT | EX_FILLED); extent_free(sc->sc_ioex, sc->sc_iobase, sc->sc_iolimit - sc->sc_iobase + 1, EX_NOWAIT); @@ -198,6 +209,7 @@ ppbattach(struct device *parent, struct device *self, void *aux) } } + attach: /* * Attach the PCI bus that hangs off of it. * -- cgit v1.2.3