Home | History | Annotate | Line # | Download | only in dev
aupci.c revision 1.13.10.1
      1  1.13.10.1     rmind /* $NetBSD: aupci.c,v 1.13.10.1 2014/05/18 17:45:17 rmind Exp $ */
      2        1.1   gdamore 
      3        1.1   gdamore /*-
      4        1.1   gdamore  * Copyright (c) 2006 Itronix Inc.
      5        1.1   gdamore  * All rights reserved.
      6        1.1   gdamore  *
      7        1.1   gdamore  * Written by Garrett D'Amore for Itronix Inc.
      8        1.1   gdamore  *
      9        1.1   gdamore  * Redistribution and use in source and binary forms, with or without
     10        1.1   gdamore  * modification, are permitted provided that the following conditions
     11        1.1   gdamore  * are met:
     12        1.1   gdamore  * 1. Redistributions of source code must retain the above copyright
     13        1.1   gdamore  *    notice, this list of conditions and the following disclaimer.
     14        1.1   gdamore  * 2. Redistributions in binary form must reproduce the above copyright
     15        1.1   gdamore  *    notice, this list of conditions and the following disclaimer in the
     16        1.1   gdamore  *    documentation and/or other materials provided with the distribution.
     17        1.1   gdamore  * 3. The name of Itronix Inc. may not be used to endorse
     18        1.1   gdamore  *    or promote products derived from this software without specific
     19        1.1   gdamore  *    prior written permission.
     20        1.1   gdamore  *
     21        1.1   gdamore  * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND
     22        1.1   gdamore  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     23        1.1   gdamore  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     24        1.1   gdamore  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY
     25        1.1   gdamore  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     26        1.1   gdamore  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     27        1.1   gdamore  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     28        1.1   gdamore  * ON ANY THEORY OF LIABILITY, WHETHER IN
     29        1.1   gdamore  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     30        1.1   gdamore  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     31        1.1   gdamore  * POSSIBILITY OF SUCH DAMAGE.
     32        1.1   gdamore  */
     33        1.1   gdamore 
     34        1.1   gdamore #include "opt_pci.h"
     35        1.1   gdamore #include "pci.h"
     36        1.1   gdamore 
     37        1.1   gdamore #include <sys/cdefs.h>
     38  1.13.10.1     rmind __KERNEL_RCSID(0, "$NetBSD: aupci.c,v 1.13.10.1 2014/05/18 17:45:17 rmind Exp $");
     39        1.1   gdamore 
     40        1.1   gdamore #include <sys/types.h>
     41        1.1   gdamore #include <sys/param.h>
     42        1.1   gdamore #include <sys/time.h>
     43        1.1   gdamore #include <sys/systm.h>
     44        1.1   gdamore #include <sys/errno.h>
     45        1.1   gdamore #include <sys/device.h>
     46        1.1   gdamore #include <sys/malloc.h>
     47        1.1   gdamore #include <sys/extent.h>
     48        1.1   gdamore 
     49        1.1   gdamore #include <uvm/uvm_extern.h>
     50        1.1   gdamore 
     51       1.11    dyoung #include <sys/bus.h>
     52        1.1   gdamore #include <machine/cpu.h>
     53        1.1   gdamore #include <machine/pte.h>
     54        1.1   gdamore 
     55        1.1   gdamore #include <dev/pci/pcivar.h>
     56        1.1   gdamore #include <dev/pci/pcireg.h>
     57        1.1   gdamore #include <dev/pci/pciconf.h>
     58        1.1   gdamore 
     59        1.1   gdamore #ifdef	PCI_NETBSD_CONFIGURE
     60        1.1   gdamore #include <mips/cache.h>
     61        1.1   gdamore #endif
     62        1.1   gdamore 
     63        1.3   gdamore #include <mips/alchemy/include/au_himem_space.h>
     64        1.1   gdamore #include <mips/alchemy/include/aubusvar.h>
     65        1.1   gdamore #include <mips/alchemy/include/aureg.h>
     66        1.1   gdamore #include <mips/alchemy/include/auvar.h>
     67        1.1   gdamore 
     68        1.1   gdamore #include <mips/alchemy/dev/aupcireg.h>
     69        1.1   gdamore #include <mips/alchemy/dev/aupcivar.h>
     70        1.1   gdamore 
     71        1.1   gdamore struct aupci_softc {
     72       1.12  kiyohara 	device_t			sc_dev;
     73        1.1   gdamore 	struct mips_pci_chipset		sc_pc;
     74        1.1   gdamore 	struct mips_bus_space		sc_mem_space;
     75        1.1   gdamore 	struct mips_bus_space		sc_io_space;
     76        1.3   gdamore 	struct mips_bus_space		sc_cfg_space;
     77        1.1   gdamore 
     78        1.1   gdamore 	bus_space_tag_t			sc_memt;
     79        1.1   gdamore 	bus_space_tag_t			sc_iot;
     80        1.3   gdamore 	bus_space_tag_t			sc_cfgt;
     81        1.1   gdamore 
     82        1.1   gdamore 	bus_space_tag_t			sc_bust;
     83        1.1   gdamore 
     84        1.1   gdamore 	bus_space_handle_t		sc_bush;
     85        1.1   gdamore 	paddr_t				sc_cfgbase;
     86        1.1   gdamore 	paddr_t				sc_membase;
     87        1.1   gdamore 	paddr_t				sc_iobase;
     88        1.1   gdamore 
     89        1.1   gdamore 	/* XXX: dma tag */
     90        1.1   gdamore };
     91        1.1   gdamore 
     92       1.12  kiyohara int		aupcimatch(device_t, struct cfdata *, void *);
     93       1.12  kiyohara void		aupciattach(device_t, device_t, void *);
     94        1.1   gdamore 
     95        1.1   gdamore #if NPCI > 0
     96       1.12  kiyohara static void aupci_attach_hook(device_t, device_t, struct pcibus_attach_args *);
     97        1.1   gdamore static int aupci_bus_maxdevs(void *, int);
     98        1.1   gdamore static pcitag_t aupci_make_tag(void *, int, int, int);
     99        1.1   gdamore static void aupci_decompose_tag(void *, pcitag_t, int *, int *, int *);
    100        1.1   gdamore static pcireg_t aupci_conf_read(void *, pcitag_t, int);
    101        1.1   gdamore static void aupci_conf_write(void *, pcitag_t, int, pcireg_t);
    102  1.13.10.1     rmind static const char *aupci_intr_string(void *, pci_intr_handle_t, char *, size_t);
    103        1.1   gdamore static void aupci_conf_interrupt(void *, int, int, int, int, int *);
    104        1.1   gdamore static void *aupci_intr_establish(void *, pci_intr_handle_t, int,
    105        1.1   gdamore     int (*)(void *), void *);
    106        1.1   gdamore static void aupci_intr_disestablish(void *, void *);
    107        1.1   gdamore 
    108        1.1   gdamore #ifdef	PCI_NETBSD_CONFIGURE
    109        1.1   gdamore static struct extent	*io_ex = NULL;
    110        1.1   gdamore static struct extent	*mem_ex = NULL;
    111        1.1   gdamore #endif	/* PCI_NETBSD_CONFIGURE */
    112        1.1   gdamore 
    113        1.1   gdamore #define	PCI_CFG_READ	0
    114        1.1   gdamore #define	PCI_CFG_WRITE	1
    115        1.1   gdamore 
    116        1.1   gdamore #endif	/* NPCI > 0 */
    117        1.1   gdamore 
    118       1.12  kiyohara CFATTACH_DECL_NEW(aupci, sizeof(struct aupci_softc),
    119        1.1   gdamore     aupcimatch, aupciattach, NULL, NULL);
    120        1.1   gdamore 
    121        1.1   gdamore int aupci_found = 0;
    122        1.1   gdamore 
    123        1.1   gdamore /*
    124        1.1   gdamore  * Physical PCI addresses are 36-bits long, so we need to have
    125        1.1   gdamore  * adequate storage space for them.
    126        1.1   gdamore  */
    127        1.1   gdamore #if NPCI > 0
    128        1.1   gdamore #if !defined(_MIPS_PADDR_T_64BIT) && !defined(_LP64)
    129        1.1   gdamore #error	"aupci requires 64 bit paddr_t!"
    130        1.1   gdamore #endif
    131        1.1   gdamore #endif
    132        1.1   gdamore 
    133        1.1   gdamore int
    134       1.12  kiyohara aupcimatch(device_t parent, struct cfdata *match, void *aux)
    135        1.1   gdamore {
    136        1.1   gdamore 	struct aubus_attach_args *aa = (struct aubus_attach_args *)aux;
    137        1.1   gdamore 
    138        1.1   gdamore 	if (strcmp(aa->aa_name, "aupci") != 0)
    139        1.1   gdamore 		return 0;
    140        1.1   gdamore 
    141        1.1   gdamore 	if (aupci_found)
    142        1.1   gdamore 		return 0;
    143        1.1   gdamore 
    144        1.1   gdamore 	return 1;
    145        1.1   gdamore }
    146        1.1   gdamore 
    147        1.1   gdamore void
    148       1.12  kiyohara aupciattach(device_t parent, device_t self, void *aux)
    149        1.1   gdamore {
    150       1.12  kiyohara 	struct aupci_softc		*sc = device_private(self);
    151        1.1   gdamore 	struct aubus_attach_args	*aa = (struct aubus_attach_args *)aux;
    152        1.1   gdamore 	uint32_t			cfg;
    153        1.1   gdamore #if NPCI > 0
    154        1.4   gdamore 	uint32_t			mbar, mask;
    155        1.4   gdamore 	bus_addr_t			mstart;
    156        1.1   gdamore 	struct pcibus_attach_args	pba;
    157        1.1   gdamore #endif
    158        1.1   gdamore 
    159        1.1   gdamore 	aupci_found = 1;
    160        1.1   gdamore 
    161       1.12  kiyohara 	sc->sc_dev = self;
    162        1.1   gdamore 	sc->sc_bust = aa->aa_st;
    163        1.1   gdamore 	if (bus_space_map(sc->sc_bust, aa->aa_addrs[0], 512, 0,
    164        1.1   gdamore 		&sc->sc_bush) != 0) {
    165       1.12  kiyohara 		aprint_error(": unable to map PCI registers\n");
    166        1.1   gdamore 		return;
    167        1.1   gdamore 	}
    168        1.1   gdamore 
    169        1.1   gdamore #if NPCI > 0
    170        1.1   gdamore 	/*
    171        1.3   gdamore 	 * These physical addresses are locked in on the CPUs we have
    172        1.1   gdamore 	 * seen.  Perhaps these should be passed in via locators, thru
    173        1.1   gdamore 	 * the configuration file.
    174        1.1   gdamore 	 */
    175        1.1   gdamore 	sc->sc_cfgbase = PCI_CONFIG_BASE;
    176        1.1   gdamore 	sc->sc_membase = PCI_MEM_BASE;
    177        1.1   gdamore 	sc->sc_iobase = PCI_IO_BASE;
    178        1.1   gdamore #endif
    179        1.1   gdamore 
    180        1.1   gdamore 	/*
    181        1.1   gdamore 	 * Configure byte swapping, as YAMON doesn't do it.  YAMON does take
    182        1.1   gdamore 	 * care of most of the rest of the details (clocking, etc.), however.
    183        1.1   gdamore 	 */
    184        1.1   gdamore #if _BYTE_ORDER == _BIG_ENDIAN
    185        1.1   gdamore 	/*
    186        1.1   gdamore 	 * N.B.: This still doesn't do the DMA thing properly.  I have
    187        1.1   gdamore 	 * not yet figured out how to get DMA access to work properly
    188        1.1   gdamore 	 * without having bytes swapped while the processor is in
    189        1.1   gdamore 	 * big-endian mode.  I'm not even sure that the Alchemy part
    190        1.1   gdamore 	 * can do it without swapping the bytes (which would be a
    191        1.1   gdamore 	 * bummer, since then only parts which had hardware detection
    192        1.1   gdamore 	 * and swapping support would work without special hacks in
    193        1.1   gdamore 	 * their drivers.)
    194        1.1   gdamore 	 */
    195        1.1   gdamore 	cfg = AUPCI_CONFIG_CH | AUPCI_CONFIG_R1H |
    196        1.1   gdamore 	    AUPCI_CONFIG_R2H | AUPCI_CONFIG_AEN |
    197        1.1   gdamore 	    AUPCI_CONFIG_SM | AUPCI_CONFIG_ST | AUPCI_CONFIG_SIC_DATA;
    198        1.1   gdamore #else
    199        1.1   gdamore 	cfg = AUPCI_CONFIG_CH | AUPCI_CONFIG_R1H |
    200        1.1   gdamore 	    AUPCI_CONFIG_R2H | AUPCI_CONFIG_AEN;
    201        1.1   gdamore #endif
    202        1.1   gdamore 	bus_space_write_4(sc->sc_bust, sc->sc_bush, AUPCI_CONFIG, cfg);
    203        1.1   gdamore 
    204        1.1   gdamore 	cfg = bus_space_read_4(sc->sc_bust, sc->sc_bush, AUPCI_COMMAND_STATUS);
    205        1.1   gdamore 
    206       1.12  kiyohara 	aprint_normal(": Alchemy Host-PCI Bridge, %sMHz\n",
    207       1.12  kiyohara 	    (cfg & PCI_STATUS_66MHZ_SUPPORT) ? "66" : "33");
    208       1.12  kiyohara 	aprint_naive("\n");
    209        1.1   gdamore 
    210        1.1   gdamore #if NPCI > 0
    211        1.1   gdamore 	/*
    212        1.3   gdamore 	 * PCI configuration space.  Address in this bus are
    213        1.3   gdamore 	 * orthogonal to other spaces.  We need to make the entire
    214        1.3   gdamore 	 * 32-bit address space available.
    215        1.3   gdamore 	 */
    216        1.3   gdamore 	sc->sc_cfgt = &sc->sc_cfg_space;
    217        1.3   gdamore 	au_himem_space_init(sc->sc_cfgt, "pcicfg", sc->sc_cfgbase,
    218        1.3   gdamore 	    0x00000000, 0xffffffff, AU_HIMEM_SPACE_IO);
    219        1.3   gdamore 
    220        1.3   gdamore 	/*
    221        1.3   gdamore 	 * Virtual PCI memory.  Configured so that we don't overlap
    222        1.3   gdamore 	 * with PCI memory space.
    223        1.1   gdamore 	 */
    224        1.3   gdamore 	mask = bus_space_read_4(sc->sc_bust, sc->sc_bush, AUPCI_MWMASK);
    225        1.3   gdamore 	mask >>= AUPCI_MWMASK_SHIFT;
    226        1.3   gdamore 	mask <<= AUPCI_MWMASK_SHIFT;
    227        1.3   gdamore 
    228        1.3   gdamore 	mbar = bus_space_read_4(sc->sc_bust, sc->sc_bush, AUPCI_MBAR);
    229        1.5   gdamore 	mstart = (mbar & mask) + (~mask + 1);
    230        1.3   gdamore 
    231        1.1   gdamore 	sc->sc_memt = &sc->sc_mem_space;
    232        1.3   gdamore 	au_himem_space_init(sc->sc_memt, "pcimem", sc->sc_membase,
    233        1.4   gdamore 	    mstart, 0xffffffff, AU_HIMEM_SPACE_LITTLE_ENDIAN);
    234        1.1   gdamore 
    235        1.1   gdamore 	/*
    236        1.3   gdamore 	 * IO space.  Address in this bus are orthogonal to other spaces.
    237        1.3   gdamore 	 * 16 MB should be plenty.  We don't start from zero to avoid
    238        1.3   gdamore 	 * potential device bugs.
    239        1.1   gdamore 	 */
    240        1.1   gdamore 	sc->sc_iot = &sc->sc_io_space;
    241        1.3   gdamore 	au_himem_space_init(sc->sc_iot, "pciio",
    242        1.3   gdamore 	    sc->sc_iobase, AUPCI_IO_START, AUPCI_IO_END,
    243        1.3   gdamore 	    AU_HIMEM_SPACE_LITTLE_ENDIAN | AU_HIMEM_SPACE_IO);
    244        1.1   gdamore 
    245        1.1   gdamore 	sc->sc_pc.pc_conf_v = sc;
    246        1.1   gdamore 	sc->sc_pc.pc_attach_hook = aupci_attach_hook;
    247        1.1   gdamore 	sc->sc_pc.pc_bus_maxdevs = aupci_bus_maxdevs;
    248        1.1   gdamore 	sc->sc_pc.pc_make_tag = aupci_make_tag;
    249        1.1   gdamore 	sc->sc_pc.pc_decompose_tag = aupci_decompose_tag;
    250        1.1   gdamore 	sc->sc_pc.pc_conf_read = aupci_conf_read;
    251        1.1   gdamore 	sc->sc_pc.pc_conf_write = aupci_conf_write;
    252        1.1   gdamore 
    253        1.1   gdamore 	sc->sc_pc.pc_intr_v = sc;
    254        1.1   gdamore 	sc->sc_pc.pc_intr_map = aupci_intr_map;
    255        1.1   gdamore 	sc->sc_pc.pc_intr_string = aupci_intr_string;
    256        1.1   gdamore 	sc->sc_pc.pc_intr_establish = aupci_intr_establish;
    257        1.1   gdamore 	sc->sc_pc.pc_intr_disestablish = aupci_intr_disestablish;
    258        1.1   gdamore 	sc->sc_pc.pc_conf_interrupt = aupci_conf_interrupt;
    259        1.1   gdamore 
    260        1.1   gdamore #ifdef PCI_NETBSD_CONFIGURE
    261        1.4   gdamore 	mem_ex = extent_create("pcimem", mstart, 0xffffffff,
    262       1.13      para 	    NULL, 0, EX_WAITOK);
    263        1.3   gdamore 
    264        1.3   gdamore 	io_ex = extent_create("pciio", AUPCI_IO_START, AUPCI_IO_END,
    265       1.13      para 	    NULL, 0, EX_WAITOK);
    266        1.3   gdamore 
    267        1.1   gdamore 	pci_configure_bus(&sc->sc_pc,
    268        1.9      matt 	    io_ex, mem_ex, NULL, 0, mips_cache_info.mci_dcache_align);
    269        1.1   gdamore 	extent_destroy(mem_ex);
    270        1.1   gdamore 	extent_destroy(io_ex);
    271        1.1   gdamore #endif
    272        1.1   gdamore 
    273        1.1   gdamore 	pba.pba_iot = sc->sc_iot;
    274        1.1   gdamore 	pba.pba_memt = sc->sc_memt;
    275        1.1   gdamore 	/* XXX: review dma tag logic */
    276        1.1   gdamore 	pba.pba_dmat = aa->aa_dt;
    277        1.1   gdamore 	pba.pba_dmat64 = NULL;
    278        1.1   gdamore 	pba.pba_pc = &sc->sc_pc;
    279       1.10    dyoung 	pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY;
    280        1.1   gdamore 	pba.pba_bus = 0;
    281        1.1   gdamore 	pba.pba_bridgetag = NULL;
    282        1.1   gdamore 
    283        1.1   gdamore 	config_found_ia(self, "pcibus", &pba, pcibusprint);
    284        1.1   gdamore #endif	/* NPCI > 0 */
    285        1.1   gdamore }
    286        1.1   gdamore 
    287        1.1   gdamore #if NPCI > 0
    288        1.1   gdamore 
    289        1.1   gdamore void
    290       1.12  kiyohara aupci_attach_hook(device_t parent, device_t self,
    291        1.1   gdamore     struct pcibus_attach_args *pba)
    292        1.1   gdamore {
    293        1.1   gdamore }
    294        1.1   gdamore 
    295        1.1   gdamore int
    296        1.1   gdamore aupci_bus_maxdevs(void *v, int busno)
    297        1.1   gdamore {
    298        1.1   gdamore 
    299        1.1   gdamore 	return 32;
    300        1.1   gdamore }
    301        1.1   gdamore 
    302        1.1   gdamore pcitag_t
    303        1.1   gdamore aupci_make_tag(void *v, int bus, int device, int function)
    304        1.1   gdamore {
    305        1.1   gdamore 	pcitag_t		tag;
    306        1.1   gdamore 
    307        1.1   gdamore 	if (bus >= 256 || device >= 32 || function >= 8)
    308        1.1   gdamore 		panic("aupci_make_tag: bad request");
    309        1.1   gdamore 
    310        1.1   gdamore 	tag = (bus << 16) | (device << 11) | (function << 8);
    311        1.1   gdamore 
    312        1.1   gdamore 	return tag;
    313        1.1   gdamore }
    314        1.1   gdamore 
    315        1.1   gdamore void
    316        1.1   gdamore aupci_decompose_tag(void *v, pcitag_t tag, int *b, int *d, int *f)
    317        1.1   gdamore {
    318        1.1   gdamore 
    319        1.1   gdamore 	if (b != NULL)
    320        1.1   gdamore 		*b = (tag >> 16) & 0xff;
    321        1.1   gdamore 	if (d != NULL)
    322        1.1   gdamore 		*d = (tag >> 11) & 0x1f;
    323        1.1   gdamore 	if (f != NULL)
    324        1.1   gdamore 		*f = (tag >> 8) & 0x07;
    325        1.1   gdamore }
    326        1.1   gdamore 
    327        1.7   thorpej static inline bool
    328        1.3   gdamore aupci_conf_access(void *v, int dir, pcitag_t tag, int reg, pcireg_t *datap)
    329        1.1   gdamore {
    330        1.3   gdamore 	struct aupci_softc	*sc = (struct aupci_softc *)v;
    331        1.3   gdamore 	uint32_t		status;
    332        1.3   gdamore 	int			s;
    333        1.3   gdamore 	bus_addr_t		addr;
    334        1.1   gdamore 	int			b, d, f;
    335        1.3   gdamore 	bus_space_handle_t	h;
    336        1.1   gdamore 
    337        1.1   gdamore 	aupci_decompose_tag(v, tag, &b, &d, &f);
    338        1.1   gdamore 	if (b) {
    339        1.1   gdamore 		/* configuration type 1 */
    340        1.3   gdamore 		addr = 0x80000000 | tag;
    341        1.1   gdamore 	} else if (d > 19) {
    342        1.1   gdamore 		/* device num too big for bus 0 */
    343        1.8   thorpej 		return false;
    344        1.1   gdamore 	} else {
    345        1.3   gdamore 		addr = (0x800 << d) | (f << 8);
    346        1.1   gdamore 	}
    347        1.1   gdamore 
    348        1.1   gdamore 	/* probing illegal target is OK, return an error indication */
    349        1.3   gdamore 	if (addr == 0)
    350        1.8   thorpej 		return false;
    351        1.1   gdamore 
    352        1.3   gdamore 	if (bus_space_map(sc->sc_cfgt, addr, 256, 0, &h) != 0)
    353        1.8   thorpej 		return false;
    354        1.1   gdamore 
    355        1.1   gdamore 	s = splhigh();
    356        1.1   gdamore 
    357        1.1   gdamore 	if (dir == PCI_CFG_WRITE)
    358        1.3   gdamore 		bus_space_write_4(sc->sc_cfgt, h, reg, *datap);
    359        1.1   gdamore 	else
    360        1.3   gdamore 		*datap = bus_space_read_4(sc->sc_cfgt, h, reg);
    361        1.1   gdamore 
    362        1.1   gdamore 	DELAY(2);
    363        1.1   gdamore 
    364        1.1   gdamore 	/* check for and clear master abort condition */
    365        1.1   gdamore 	status = bus_space_read_4(sc->sc_bust, sc->sc_bush, AUPCI_CONFIG);
    366        1.1   gdamore 	bus_space_write_4(sc->sc_bust, sc->sc_bush, AUPCI_CONFIG,
    367        1.1   gdamore 	    status & ~(AUPCI_CONFIG_EF));
    368        1.1   gdamore 
    369        1.3   gdamore 	splx(s);
    370        1.3   gdamore 
    371        1.3   gdamore 	bus_space_unmap(sc->sc_cfgt, h, 256);
    372        1.3   gdamore 
    373        1.1   gdamore 	/* if we got a PCI master abort, fail it */
    374        1.3   gdamore 	if (status & AUPCI_CONFIG_EF)
    375        1.8   thorpej 		return false;
    376        1.1   gdamore 
    377        1.8   thorpej 	return true;
    378        1.1   gdamore }
    379        1.1   gdamore 
    380        1.1   gdamore pcireg_t
    381        1.1   gdamore aupci_conf_read(void *v, pcitag_t tag, int reg)
    382        1.1   gdamore {
    383        1.1   gdamore 	pcireg_t		data;
    384        1.1   gdamore 
    385        1.8   thorpej 	if (aupci_conf_access(v, PCI_CFG_READ, tag, reg, &data) == false)
    386        1.1   gdamore 		return 0xffffffff;
    387        1.1   gdamore 
    388        1.1   gdamore 	return (data);
    389        1.1   gdamore }
    390        1.1   gdamore 
    391        1.1   gdamore void
    392        1.1   gdamore aupci_conf_write(void *v, pcitag_t tag, int reg, pcireg_t data)
    393        1.1   gdamore {
    394        1.1   gdamore 
    395        1.1   gdamore 	aupci_conf_access(v, PCI_CFG_WRITE, tag, reg, &data);
    396        1.1   gdamore }
    397        1.1   gdamore 
    398        1.1   gdamore const char *
    399  1.13.10.1     rmind aupci_intr_string(void *v, pci_intr_handle_t ih, char *buf, size_t len)
    400        1.1   gdamore {
    401  1.13.10.1     rmind 	snprintf(buf, len, "irq %u", (unsigned)ih);
    402  1.13.10.1     rmind 	return buf;
    403        1.1   gdamore }
    404        1.1   gdamore 
    405        1.1   gdamore void *
    406        1.1   gdamore aupci_intr_establish(void *v, pci_intr_handle_t ih, int ipl,
    407        1.1   gdamore     int (*handler)(void *), void *arg)
    408        1.1   gdamore {
    409        1.1   gdamore 
    410        1.1   gdamore 	return (au_intr_establish(ih, 0, ipl, IST_LEVEL_LOW, handler, arg));
    411        1.1   gdamore }
    412        1.1   gdamore 
    413        1.1   gdamore void
    414        1.1   gdamore aupci_intr_disestablish(void *v, void *cookie)
    415        1.1   gdamore {
    416        1.1   gdamore 
    417        1.1   gdamore 	au_intr_disestablish(cookie);
    418        1.1   gdamore }
    419        1.1   gdamore 
    420        1.1   gdamore void
    421        1.1   gdamore aupci_conf_interrupt(void *v, int bus, int dev, int ipin, int swiz, int *iline)
    422        1.1   gdamore {
    423        1.1   gdamore 	/*
    424        1.1   gdamore 	 * We let the machdep_pci_intr_map take care of IRQ routing.
    425        1.1   gdamore 	 * On some platforms the BIOS may have handled this properly,
    426        1.1   gdamore 	 * on others it might not have.  For now we avoid clobbering
    427        1.1   gdamore 	 * the settings establishsed by the BIOS, so that they will be
    428        1.1   gdamore 	 * there if the platform logic is confident that it can rely
    429        1.1   gdamore 	 * on them.
    430        1.1   gdamore 	 */
    431        1.1   gdamore }
    432        1.1   gdamore 
    433        1.1   gdamore #endif
    434