From a0e63efdb88447db80c33fccc16f89ad6b0723dc Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Fri, 5 Feb 2010 20:47:16 +0000 Subject: Compute and pass resource extents to the MI pci code when attaching pci@bonito. --- sys/arch/loongson/dev/bonito.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'sys') diff --git a/sys/arch/loongson/dev/bonito.c b/sys/arch/loongson/dev/bonito.c index b9cfbec1095..78c42b997f3 100644 --- a/sys/arch/loongson/dev/bonito.c +++ b/sys/arch/loongson/dev/bonito.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bonito.c,v 1.4 2010/01/31 19:12:12 miod Exp $ */ +/* $OpenBSD: bonito.c,v 1.5 2010/02/05 20:47:15 miod Exp $ */ /* $NetBSD: bonito_mainbus.c,v 1.11 2008/04/28 20:23:10 martin Exp $ */ /* $NetBSD: bonito_pci.c,v 1.5 2008/04/28 20:23:28 martin Exp $ */ @@ -54,6 +54,8 @@ #include #include #include +#include +#include #include #include @@ -236,6 +238,7 @@ bonito_attach(struct device *parent, struct device *self, void *aux) struct pcibus_attach_args pba; pci_chipset_tag_t pc = &sc->sc_pc; const struct bonito_config *bc; + struct extent *ioex, *memex; uint32_t reg; printf(": memory and PCI-X controller, rev. %d\n", @@ -279,6 +282,30 @@ bonito_attach(struct device *parent, struct device *self, void *aux) set_intr(INTPRI_ISA, CR_INT_0, bonito_isa_intr); register_splx_handler(bonito_splx); + /* + * Setup PCI resource extents. + */ + + ioex = extent_create("pciio", 0, 0xffffffff, M_DEVBUF, NULL, 0, + EX_NOWAIT | EX_FILLED); + if (ioex != NULL) + (void)extent_free(ioex, 0, BONITO_PCIIO_SIZE, EX_NOWAIT); + + memex = extent_create("pcimem", 0, 0xffffffff, M_DEVBUF, NULL, 0, + EX_NOWAIT | EX_FILLED); + if (memex != NULL) { + reg = REGVAL(BONITO_PCIMAP); + (void)extent_free(memex, BONITO_PCIMAP_WINBASE((reg & + BONITO_PCIMAP_PCIMAP_LO0) >> BONITO_PCIMAP_PCIMAP_LO0_SHIFT), + BONITO_PCIMAP_WINSIZE, EX_NOWAIT); + (void)extent_free(memex, BONITO_PCIMAP_WINBASE((reg & + BONITO_PCIMAP_PCIMAP_LO1) >> BONITO_PCIMAP_PCIMAP_LO1_SHIFT), + BONITO_PCIMAP_WINSIZE, EX_NOWAIT); + (void)extent_free(memex, BONITO_PCIMAP_WINBASE((reg & + BONITO_PCIMAP_PCIMAP_LO2) >> BONITO_PCIMAP_PCIMAP_LO2_SHIFT), + BONITO_PCIMAP_WINSIZE, EX_NOWAIT); + } + /* * Attach PCI bus. */ @@ -305,8 +332,8 @@ bonito_attach(struct device *parent, struct device *self, void *aux) pba.pba_pc = pc; pba.pba_domain = pci_ndomains++; pba.pba_bus = 0; - /* XXX setup extents: I/O is only BONITO_PCIIO_SIZE long, memory is - BONITO_PCILO_SIZE and BONITO_PCIHI_SIZE */ + pba.pba_ioex = ioex; + pba.pba_memex = memex; config_found(&sc->sc_dev, &pba, bonito_print); } -- cgit v1.2.3