Home | History | Annotate | Line # | Download | only in pci
pci_machdep.c revision 1.32.8.5
      1  1.32.8.5  nathanw /*	$NetBSD: pci_machdep.c,v 1.32.8.5 2002/10/18 02:35:59 nathanw Exp $	*/
      2  1.32.8.2  nathanw 
      3  1.32.8.2  nathanw /*
      4  1.32.8.2  nathanw  * Copyright (c) 1996 Leo Weppelman.  All rights reserved.
      5  1.32.8.2  nathanw  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
      6  1.32.8.2  nathanw  * Copyright (c) 1994 Charles M. Hannum.  All rights reserved.
      7  1.32.8.2  nathanw  *
      8  1.32.8.2  nathanw  * Redistribution and use in source and binary forms, with or without
      9  1.32.8.2  nathanw  * modification, are permitted provided that the following conditions
     10  1.32.8.2  nathanw  * are met:
     11  1.32.8.2  nathanw  * 1. Redistributions of source code must retain the above copyright
     12  1.32.8.2  nathanw  *    notice, this list of conditions and the following disclaimer.
     13  1.32.8.2  nathanw  * 2. Redistributions in binary form must reproduce the above copyright
     14  1.32.8.2  nathanw  *    notice, this list of conditions and the following disclaimer in the
     15  1.32.8.2  nathanw  *    documentation and/or other materials provided with the distribution.
     16  1.32.8.2  nathanw  * 3. All advertising materials mentioning features or use of this software
     17  1.32.8.2  nathanw  *    must display the following acknowledgement:
     18  1.32.8.2  nathanw  *	This product includes software developed by Charles M. Hannum.
     19  1.32.8.2  nathanw  * 4. The name of the author may not be used to endorse or promote products
     20  1.32.8.2  nathanw  *    derived from this software without specific prior written permission.
     21  1.32.8.2  nathanw  *
     22  1.32.8.2  nathanw  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     23  1.32.8.2  nathanw  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     24  1.32.8.2  nathanw  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25  1.32.8.2  nathanw  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     26  1.32.8.2  nathanw  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     27  1.32.8.2  nathanw  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     28  1.32.8.2  nathanw  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     29  1.32.8.2  nathanw  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     30  1.32.8.2  nathanw  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     31  1.32.8.2  nathanw  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32  1.32.8.2  nathanw  */
     33  1.32.8.2  nathanw 
     34  1.32.8.2  nathanw #include "opt_mbtype.h"
     35  1.32.8.2  nathanw #include <sys/types.h>
     36  1.32.8.2  nathanw #include <sys/param.h>
     37  1.32.8.2  nathanw #include <sys/time.h>
     38  1.32.8.2  nathanw #include <sys/systm.h>
     39  1.32.8.2  nathanw #include <sys/errno.h>
     40  1.32.8.2  nathanw #include <sys/device.h>
     41  1.32.8.2  nathanw #include <sys/malloc.h>
     42  1.32.8.2  nathanw 
     43  1.32.8.2  nathanw #define _ATARI_BUS_DMA_PRIVATE
     44  1.32.8.2  nathanw #include <machine/bus.h>
     45  1.32.8.2  nathanw 
     46  1.32.8.2  nathanw #include <dev/pci/pcivar.h>
     47  1.32.8.2  nathanw #include <dev/pci/pcireg.h>
     48  1.32.8.2  nathanw 
     49  1.32.8.2  nathanw #include <uvm/uvm_extern.h>
     50  1.32.8.2  nathanw 
     51  1.32.8.2  nathanw #include <machine/cpu.h>
     52  1.32.8.2  nathanw #include <machine/iomap.h>
     53  1.32.8.2  nathanw #include <machine/mfp.h>
     54  1.32.8.2  nathanw 
     55  1.32.8.2  nathanw #include <atari/atari/device.h>
     56  1.32.8.2  nathanw #include <atari/pci/pci_vga.h>
     57  1.32.8.2  nathanw 
     58  1.32.8.2  nathanw /*
     59  1.32.8.2  nathanw  * Sizes of pci memory and I/O area.
     60  1.32.8.2  nathanw  */
     61  1.32.8.2  nathanw #define PCI_MEM_END     0x10000000      /* 256 MByte */
     62  1.32.8.2  nathanw #define PCI_IO_END      0x10000000      /* 256 MByte */
     63  1.32.8.2  nathanw 
     64  1.32.8.2  nathanw /*
     65  1.32.8.2  nathanw  * We preserve some space at the begin of the pci area for 32BIT_1M
     66  1.32.8.2  nathanw  * devices and standard vga.
     67  1.32.8.2  nathanw  */
     68  1.32.8.2  nathanw #define PCI_MEM_START   0x00100000      /*   1 MByte */
     69  1.32.8.2  nathanw #define PCI_IO_START    0x00004000      /*  16 kByte (some PCI cards allow only
     70  1.32.8.2  nathanw 					    I/O addresses up to 0xffff) */
     71  1.32.8.2  nathanw 
     72  1.32.8.2  nathanw /*
     73  1.32.8.2  nathanw  * PCI memory and IO should be aligned acording to this masks
     74  1.32.8.2  nathanw  */
     75  1.32.8.2  nathanw #define PCI_MACHDEP_IO_ALIGN_MASK	0xffffff00
     76  1.32.8.2  nathanw #define PCI_MACHDEP_MEM_ALIGN_MASK	0xfffff000
     77  1.32.8.2  nathanw 
     78  1.32.8.2  nathanw /*
     79  1.32.8.2  nathanw  * Convert a PCI 'device' number to a slot number.
     80  1.32.8.2  nathanw  */
     81  1.32.8.2  nathanw #define	DEV2SLOT(dev)	(3 - dev)
     82  1.32.8.2  nathanw 
     83  1.32.8.2  nathanw /*
     84  1.32.8.2  nathanw  * Struct to hold the memory and I/O datas of the pci devices
     85  1.32.8.2  nathanw  */
     86  1.32.8.2  nathanw struct pci_memreg {
     87  1.32.8.2  nathanw     LIST_ENTRY(pci_memreg) link;
     88  1.32.8.2  nathanw     int dev;
     89  1.32.8.2  nathanw     pcitag_t tag;
     90  1.32.8.2  nathanw     pcireg_t reg, address, mask;
     91  1.32.8.2  nathanw     u_int32_t size;
     92  1.32.8.2  nathanw     u_int32_t csr;
     93  1.32.8.2  nathanw };
     94  1.32.8.2  nathanw 
     95  1.32.8.2  nathanw typedef LIST_HEAD(pci_memreg_head, pci_memreg) PCI_MEMREG;
     96  1.32.8.2  nathanw 
     97  1.32.8.2  nathanw /*
     98  1.32.8.2  nathanw  * Entry points for PCI DMA.  Use only the 'standard' functions.
     99  1.32.8.2  nathanw  */
    100  1.32.8.2  nathanw int	_bus_dmamap_create __P((bus_dma_tag_t, bus_size_t, int, bus_size_t,
    101  1.32.8.2  nathanw 	    bus_size_t, int, bus_dmamap_t *));
    102  1.32.8.2  nathanw struct atari_bus_dma_tag pci_bus_dma_tag = {
    103  1.32.8.2  nathanw 	0,
    104  1.32.8.2  nathanw #if defined(_ATARIHW_)
    105  1.32.8.2  nathanw 	0x80000000, /* On the Hades, CPU memory starts here PCI-wise */
    106  1.32.8.2  nathanw #else
    107  1.32.8.2  nathanw 	0,
    108  1.32.8.2  nathanw #endif
    109  1.32.8.2  nathanw 	_bus_dmamap_create,
    110  1.32.8.2  nathanw 	_bus_dmamap_destroy,
    111  1.32.8.2  nathanw 	_bus_dmamap_load,
    112  1.32.8.2  nathanw 	_bus_dmamap_load_mbuf,
    113  1.32.8.2  nathanw 	_bus_dmamap_load_uio,
    114  1.32.8.2  nathanw 	_bus_dmamap_load_raw,
    115  1.32.8.2  nathanw 	_bus_dmamap_unload,
    116  1.32.8.2  nathanw 	_bus_dmamap_sync,
    117  1.32.8.2  nathanw };
    118  1.32.8.2  nathanw 
    119  1.32.8.2  nathanw int	pcibusprint __P((void *auxp, const char *));
    120  1.32.8.2  nathanw int	pcibusmatch __P((struct device *, struct cfdata *, void *));
    121  1.32.8.2  nathanw void	pcibusattach __P((struct device *, struct device *, void *));
    122  1.32.8.2  nathanw 
    123  1.32.8.2  nathanw static void enable_pci_devices __P((void));
    124  1.32.8.2  nathanw static void insert_into_list __P((PCI_MEMREG *head, struct pci_memreg *elem));
    125  1.32.8.2  nathanw static int overlap_pci_areas __P((struct pci_memreg *p,
    126  1.32.8.2  nathanw 	struct pci_memreg *self, u_int addr, u_int size, u_int what));
    127  1.32.8.2  nathanw 
    128  1.32.8.5  nathanw CFATTACH_DECL(pcibus, sizeof(struct device),
    129  1.32.8.5  nathanw     pcibusmatch, pcibusattach, NULL, NULL);
    130  1.32.8.2  nathanw 
    131  1.32.8.2  nathanw /*
    132  1.32.8.2  nathanw  * We need some static storage to probe pci-busses for VGA cards during
    133  1.32.8.2  nathanw  * early console init.
    134  1.32.8.2  nathanw  */
    135  1.32.8.2  nathanw static struct atari_bus_space	bs_storage[2];	/* 1 iot, 1 memt */
    136  1.32.8.2  nathanw 
    137  1.32.8.2  nathanw int
    138  1.32.8.2  nathanw pcibusmatch(pdp, cfp, auxp)
    139  1.32.8.2  nathanw struct device	*pdp;
    140  1.32.8.2  nathanw struct cfdata	*cfp;
    141  1.32.8.2  nathanw void		*auxp;
    142  1.32.8.2  nathanw {
    143  1.32.8.2  nathanw 	static int	nmatched = 0;
    144  1.32.8.2  nathanw 
    145  1.32.8.2  nathanw 	if (strcmp((char *)auxp, "pcibus"))
    146  1.32.8.2  nathanw 		return (0);	/* Wrong number... */
    147  1.32.8.2  nathanw 
    148  1.32.8.2  nathanw 	if(atari_realconfig == 0)
    149  1.32.8.2  nathanw 		return (1);
    150  1.32.8.2  nathanw 
    151  1.32.8.2  nathanw 	if (machineid & (ATARI_HADES|ATARI_MILAN)) {
    152  1.32.8.2  nathanw 		/*
    153  1.32.8.2  nathanw 		 * Both Hades and Milan have only one pci bus
    154  1.32.8.2  nathanw 		 */
    155  1.32.8.2  nathanw 		if (nmatched)
    156  1.32.8.2  nathanw 			return (0);
    157  1.32.8.2  nathanw 		nmatched++;
    158  1.32.8.2  nathanw 		return (1);
    159  1.32.8.2  nathanw 	}
    160  1.32.8.2  nathanw 	return (0);
    161  1.32.8.2  nathanw }
    162  1.32.8.2  nathanw 
    163  1.32.8.2  nathanw void
    164  1.32.8.2  nathanw pcibusattach(pdp, dp, auxp)
    165  1.32.8.2  nathanw struct device	*pdp, *dp;
    166  1.32.8.2  nathanw void		*auxp;
    167  1.32.8.2  nathanw {
    168  1.32.8.2  nathanw 	struct pcibus_attach_args	pba;
    169  1.32.8.2  nathanw 
    170  1.32.8.2  nathanw 	pba.pba_busname = "pci";
    171  1.32.8.2  nathanw 	pba.pba_pc      = NULL;
    172  1.32.8.2  nathanw 	pba.pba_bus     = 0;
    173  1.32.8.4  nathanw 	pba.pba_bridgetag = NULL;
    174  1.32.8.2  nathanw 	pba.pba_flags	= PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
    175  1.32.8.2  nathanw 	pba.pba_dmat	= &pci_bus_dma_tag;
    176  1.32.8.2  nathanw 	pba.pba_iot     = leb_alloc_bus_space_tag(&bs_storage[0]);
    177  1.32.8.2  nathanw 	pba.pba_memt    = leb_alloc_bus_space_tag(&bs_storage[1]);
    178  1.32.8.2  nathanw 	if ((pba.pba_iot == NULL) || (pba.pba_memt == NULL)) {
    179  1.32.8.2  nathanw 		printf("leb_alloc_bus_space_tag failed!\n");
    180  1.32.8.2  nathanw 		return;
    181  1.32.8.2  nathanw 	}
    182  1.32.8.2  nathanw 	pba.pba_iot->base  = PCI_IO_PHYS;
    183  1.32.8.2  nathanw 	pba.pba_memt->base = PCI_MEM_PHYS;
    184  1.32.8.2  nathanw 
    185  1.32.8.2  nathanw 	if (dp == NULL) {
    186  1.32.8.2  nathanw 		/*
    187  1.32.8.2  nathanw 		 * Scan the bus for a VGA-card that we support. If we
    188  1.32.8.2  nathanw 		 * find one, try to initialize it to a 'standard' text
    189  1.32.8.2  nathanw 		 * mode (80x25).
    190  1.32.8.2  nathanw 		 */
    191  1.32.8.2  nathanw 		check_for_vga(pba.pba_iot, pba.pba_memt);
    192  1.32.8.2  nathanw 		return;
    193  1.32.8.2  nathanw 	}
    194  1.32.8.2  nathanw 
    195  1.32.8.2  nathanw 	enable_pci_devices();
    196  1.32.8.2  nathanw 
    197  1.32.8.2  nathanw #if defined(_ATARIHW_)
    198  1.32.8.2  nathanw 	MFP2->mf_aer &= ~(0x27); /* PCI interrupts: HIGH -> LOW */
    199  1.32.8.2  nathanw #endif
    200  1.32.8.2  nathanw 
    201  1.32.8.2  nathanw 	printf("\n");
    202  1.32.8.2  nathanw 
    203  1.32.8.2  nathanw 	config_found(dp, &pba, pcibusprint);
    204  1.32.8.2  nathanw }
    205  1.32.8.2  nathanw 
    206  1.32.8.2  nathanw int
    207  1.32.8.2  nathanw pcibusprint(auxp, name)
    208  1.32.8.2  nathanw void		*auxp;
    209  1.32.8.2  nathanw const char	*name;
    210  1.32.8.2  nathanw {
    211  1.32.8.2  nathanw 	if(name == NULL)
    212  1.32.8.2  nathanw 		return(UNCONF);
    213  1.32.8.2  nathanw 	return(QUIET);
    214  1.32.8.2  nathanw }
    215  1.32.8.2  nathanw 
    216  1.32.8.2  nathanw void
    217  1.32.8.2  nathanw pci_attach_hook(parent, self, pba)
    218  1.32.8.2  nathanw 	struct device *parent, *self;
    219  1.32.8.2  nathanw 	struct pcibus_attach_args *pba;
    220  1.32.8.2  nathanw {
    221  1.32.8.2  nathanw }
    222  1.32.8.2  nathanw 
    223  1.32.8.2  nathanw /*
    224  1.32.8.2  nathanw  * Initialize the PCI-bus. The Atari-BIOS does not do this, so....
    225  1.32.8.2  nathanw  * We only disable all devices here. Memory and I/O enabling is done
    226  1.32.8.2  nathanw  * later at pcibusattach.
    227  1.32.8.2  nathanw  */
    228  1.32.8.2  nathanw void
    229  1.32.8.2  nathanw init_pci_bus()
    230  1.32.8.2  nathanw {
    231  1.32.8.2  nathanw 	pci_chipset_tag_t	pc = NULL; /* XXX */
    232  1.32.8.2  nathanw 	pcitag_t		tag;
    233  1.32.8.2  nathanw 	pcireg_t		csr;
    234  1.32.8.2  nathanw 	int			device, id, maxndevs;
    235  1.32.8.2  nathanw 
    236  1.32.8.2  nathanw 	tag   = 0;
    237  1.32.8.2  nathanw 	id    = 0;
    238  1.32.8.2  nathanw 
    239  1.32.8.2  nathanw 	maxndevs = pci_bus_maxdevs(pc, 0);
    240  1.32.8.2  nathanw 
    241  1.32.8.2  nathanw 	for (device = 0; device < maxndevs; device++) {
    242  1.32.8.2  nathanw 
    243  1.32.8.2  nathanw 		tag = pci_make_tag(pc, 0, device, 0);
    244  1.32.8.2  nathanw 		id  = pci_conf_read(pc, tag, PCI_ID_REG);
    245  1.32.8.2  nathanw 		if (id == 0 || id == 0xffffffff)
    246  1.32.8.2  nathanw 			continue;
    247  1.32.8.2  nathanw 
    248  1.32.8.2  nathanw 		csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
    249  1.32.8.2  nathanw 		csr &= ~(PCI_COMMAND_MEM_ENABLE|PCI_COMMAND_IO_ENABLE);
    250  1.32.8.2  nathanw 		csr &= ~PCI_COMMAND_MASTER_ENABLE;
    251  1.32.8.2  nathanw 		pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, csr);
    252  1.32.8.2  nathanw 	}
    253  1.32.8.2  nathanw }
    254  1.32.8.2  nathanw 
    255  1.32.8.2  nathanw /*
    256  1.32.8.2  nathanw  * insert a new element in an existing list that the ID's (size in struct
    257  1.32.8.2  nathanw  * pci_memreg) are sorted.
    258  1.32.8.2  nathanw  */
    259  1.32.8.2  nathanw static void
    260  1.32.8.2  nathanw insert_into_list(head, elem)
    261  1.32.8.2  nathanw     PCI_MEMREG *head;
    262  1.32.8.2  nathanw     struct pci_memreg *elem;
    263  1.32.8.2  nathanw {
    264  1.32.8.2  nathanw     struct pci_memreg *p, *q;
    265  1.32.8.2  nathanw 
    266  1.32.8.2  nathanw     p = LIST_FIRST(head);
    267  1.32.8.2  nathanw     q = NULL;
    268  1.32.8.2  nathanw 
    269  1.32.8.2  nathanw     for (; p != NULL && p->size < elem->size; q = p, p = LIST_NEXT(p, link));
    270  1.32.8.2  nathanw 
    271  1.32.8.2  nathanw     if (q == NULL) {
    272  1.32.8.2  nathanw 	LIST_INSERT_HEAD(head, elem, link);
    273  1.32.8.2  nathanw     } else {
    274  1.32.8.2  nathanw 	LIST_INSERT_AFTER(q, elem, link);
    275  1.32.8.2  nathanw     }
    276  1.32.8.2  nathanw }
    277  1.32.8.2  nathanw 
    278  1.32.8.2  nathanw /*
    279  1.32.8.2  nathanw  * Test if a new selected area overlaps with an already (probably preselected)
    280  1.32.8.2  nathanw  * pci area.
    281  1.32.8.2  nathanw  */
    282  1.32.8.2  nathanw static int
    283  1.32.8.2  nathanw overlap_pci_areas(p, self, addr, size, what)
    284  1.32.8.2  nathanw     struct pci_memreg *p, *self;
    285  1.32.8.2  nathanw     u_int addr, size, what;
    286  1.32.8.2  nathanw {
    287  1.32.8.2  nathanw     struct pci_memreg *q;
    288  1.32.8.2  nathanw 
    289  1.32.8.2  nathanw     if (p == NULL)
    290  1.32.8.2  nathanw 	return 0;
    291  1.32.8.2  nathanw 
    292  1.32.8.2  nathanw     q = p;
    293  1.32.8.2  nathanw     while (q != NULL) {
    294  1.32.8.2  nathanw       if ((q != self) && (q->csr & what)) {
    295  1.32.8.2  nathanw 	if ((addr >= q->address) && (addr < (q->address + q->size))) {
    296  1.32.8.2  nathanw #ifdef DEBUG_PCI_MACHDEP
    297  1.32.8.2  nathanw 	  printf("\noverlap area dev %d reg 0x%02x with dev %d reg 0x%02x",
    298  1.32.8.2  nathanw 			self->dev, self->reg, q->dev, q->reg);
    299  1.32.8.2  nathanw #endif
    300  1.32.8.2  nathanw 	  return 1;
    301  1.32.8.2  nathanw 	}
    302  1.32.8.2  nathanw 	if ((q->address >= addr) && (q->address < (addr + size))) {
    303  1.32.8.2  nathanw #ifdef DEBUG_PCI_MACHDEP
    304  1.32.8.2  nathanw 	  printf("\noverlap area dev %d reg 0x%02x with dev %d reg 0x%02x",
    305  1.32.8.2  nathanw 			self->dev, self->reg, q->dev, q->reg);
    306  1.32.8.2  nathanw #endif
    307  1.32.8.2  nathanw 	  return 1;
    308  1.32.8.2  nathanw 	}
    309  1.32.8.2  nathanw       }
    310  1.32.8.2  nathanw       q = LIST_NEXT(q, link);
    311  1.32.8.2  nathanw     }
    312  1.32.8.2  nathanw     return 0;
    313  1.32.8.2  nathanw }
    314  1.32.8.2  nathanw 
    315  1.32.8.2  nathanw /*
    316  1.32.8.2  nathanw  * Enable memory and I/O on pci devices. Care about already enabled devices
    317  1.32.8.2  nathanw  * (probabaly by the console driver).
    318  1.32.8.2  nathanw  *
    319  1.32.8.2  nathanw  * The idea behind the following code is:
    320  1.32.8.2  nathanw  * We build a by sizes sorted list of the requirements of the different
    321  1.32.8.2  nathanw  * pci devices. After that we choose the start addresses of that areas
    322  1.32.8.2  nathanw  * in such a way that they are placed as closed as possible together.
    323  1.32.8.2  nathanw  */
    324  1.32.8.2  nathanw static void
    325  1.32.8.2  nathanw enable_pci_devices()
    326  1.32.8.2  nathanw {
    327  1.32.8.2  nathanw     PCI_MEMREG memlist;
    328  1.32.8.2  nathanw     PCI_MEMREG iolist;
    329  1.32.8.2  nathanw     struct pci_memreg *p, *q;
    330  1.32.8.2  nathanw     int dev, reg, id, class;
    331  1.32.8.2  nathanw     pcitag_t tag;
    332  1.32.8.2  nathanw     pcireg_t csr, address, mask;
    333  1.32.8.2  nathanw     pci_chipset_tag_t pc;
    334  1.32.8.2  nathanw     int sizecnt, membase_1m;
    335  1.32.8.2  nathanw 
    336  1.32.8.2  nathanw     pc = 0;
    337  1.32.8.2  nathanw     csr = 0;
    338  1.32.8.2  nathanw     tag = 0;
    339  1.32.8.2  nathanw 
    340  1.32.8.2  nathanw     LIST_INIT(&memlist);
    341  1.32.8.2  nathanw     LIST_INIT(&iolist);
    342  1.32.8.2  nathanw 
    343  1.32.8.2  nathanw     /*
    344  1.32.8.2  nathanw      * first step: go through all devices and gather memory and I/O
    345  1.32.8.2  nathanw      * sizes
    346  1.32.8.2  nathanw      */
    347  1.32.8.2  nathanw     for (dev = 0; dev < pci_bus_maxdevs(pc,0); dev++) {
    348  1.32.8.2  nathanw 
    349  1.32.8.2  nathanw 	tag = pci_make_tag(pc, 0, dev, 0);
    350  1.32.8.2  nathanw 	id  = pci_conf_read(pc, tag, PCI_ID_REG);
    351  1.32.8.2  nathanw 	if (id == 0 || id == 0xffffffff)
    352  1.32.8.2  nathanw 	    continue;
    353  1.32.8.2  nathanw 
    354  1.32.8.2  nathanw 	csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
    355  1.32.8.2  nathanw 
    356  1.32.8.2  nathanw 	/*
    357  1.32.8.2  nathanw 	 * special case: if a display card is found and memory is enabled
    358  1.32.8.2  nathanw 	 * preserve 128k at 0xa0000 as vga memory.
    359  1.32.8.2  nathanw 	 * XXX: if a display card is found without being enabled, leave
    360  1.32.8.2  nathanw 	 *      it alone! You will usually only create conflicts by enabeling
    361  1.32.8.2  nathanw 	 *      it.
    362  1.32.8.2  nathanw 	 */
    363  1.32.8.2  nathanw 	class = pci_conf_read(pc, tag, PCI_CLASS_REG);
    364  1.32.8.2  nathanw 	switch (PCI_CLASS(class)) {
    365  1.32.8.2  nathanw 	    case PCI_CLASS_PREHISTORIC:
    366  1.32.8.2  nathanw 	    case PCI_CLASS_DISPLAY:
    367  1.32.8.2  nathanw 	      if (csr & (PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE)) {
    368  1.32.8.2  nathanw 		    p = (struct pci_memreg *)malloc(sizeof(struct pci_memreg),
    369  1.32.8.2  nathanw 				M_TEMP, M_WAITOK);
    370  1.32.8.2  nathanw 		    memset(p, '\0', sizeof(struct pci_memreg));
    371  1.32.8.2  nathanw 		    p->dev = dev;
    372  1.32.8.2  nathanw 		    p->csr = csr;
    373  1.32.8.2  nathanw 		    p->tag = tag;
    374  1.32.8.2  nathanw 		    p->reg = 0;     /* there is no register about this */
    375  1.32.8.2  nathanw 		    p->size = 0x20000;  /* 128kByte */
    376  1.32.8.2  nathanw 		    p->mask = 0xfffe0000;
    377  1.32.8.2  nathanw 		    p->address = 0xa0000;
    378  1.32.8.2  nathanw 
    379  1.32.8.2  nathanw 		    insert_into_list(&memlist, p);
    380  1.32.8.2  nathanw 	      }
    381  1.32.8.2  nathanw 	      else continue;
    382  1.32.8.2  nathanw 	}
    383  1.32.8.2  nathanw 
    384  1.32.8.2  nathanw 	for (reg = PCI_MAPREG_START; reg < PCI_MAPREG_END; reg += 4) {
    385  1.32.8.2  nathanw 
    386  1.32.8.2  nathanw 	    address = pci_conf_read(pc, tag, reg);
    387  1.32.8.2  nathanw 	    pci_conf_write(pc, tag, reg, 0xffffffff);
    388  1.32.8.2  nathanw 	    mask    = pci_conf_read(pc, tag, reg);
    389  1.32.8.2  nathanw 	    pci_conf_write(pc, tag, reg, address);
    390  1.32.8.2  nathanw 	    if (mask == 0)
    391  1.32.8.2  nathanw 		continue; /* Register unused */
    392  1.32.8.2  nathanw 
    393  1.32.8.2  nathanw 	    p = (struct pci_memreg *)malloc(sizeof(struct pci_memreg),
    394  1.32.8.2  nathanw 			M_TEMP, M_WAITOK);
    395  1.32.8.2  nathanw 	    memset(p, '\0', sizeof(struct pci_memreg));
    396  1.32.8.2  nathanw 	    p->dev = dev;
    397  1.32.8.2  nathanw 	    p->csr = csr;
    398  1.32.8.2  nathanw 	    p->tag = tag;
    399  1.32.8.2  nathanw 	    p->reg = reg;
    400  1.32.8.2  nathanw 	    p->mask = mask;
    401  1.32.8.2  nathanw 	    p->address = 0;
    402  1.32.8.2  nathanw 
    403  1.32.8.2  nathanw 	    if (mask & PCI_MAPREG_TYPE_IO) {
    404  1.32.8.2  nathanw 		p->size = PCI_MAPREG_IO_SIZE(mask);
    405  1.32.8.2  nathanw 
    406  1.32.8.2  nathanw 		/*
    407  1.32.8.2  nathanw 		 * Align IO if necessary
    408  1.32.8.2  nathanw 		 */
    409  1.32.8.2  nathanw 		if (p->size < PCI_MAPREG_IO_SIZE(PCI_MACHDEP_IO_ALIGN_MASK)) {
    410  1.32.8.2  nathanw 		    p->mask = PCI_MACHDEP_IO_ALIGN_MASK;
    411  1.32.8.2  nathanw 		    p->size = PCI_MAPREG_IO_SIZE(p->mask);
    412  1.32.8.2  nathanw 		}
    413  1.32.8.2  nathanw 
    414  1.32.8.2  nathanw 		/*
    415  1.32.8.2  nathanw 		 * if I/O is already enabled (probably by the console driver)
    416  1.32.8.2  nathanw 		 * save the address in order to take care about it later.
    417  1.32.8.2  nathanw 		 */
    418  1.32.8.2  nathanw 		if (csr & PCI_COMMAND_IO_ENABLE)
    419  1.32.8.2  nathanw 		    p->address = address;
    420  1.32.8.2  nathanw 
    421  1.32.8.2  nathanw 		insert_into_list(&iolist, p);
    422  1.32.8.2  nathanw 	    } else {
    423  1.32.8.2  nathanw 		p->size = PCI_MAPREG_MEM_SIZE(mask);
    424  1.32.8.2  nathanw 
    425  1.32.8.2  nathanw 		/*
    426  1.32.8.2  nathanw 		 * Align memory if necessary
    427  1.32.8.2  nathanw 		 */
    428  1.32.8.2  nathanw 		if (p->size < PCI_MAPREG_IO_SIZE(PCI_MACHDEP_MEM_ALIGN_MASK)) {
    429  1.32.8.2  nathanw 		    p->mask = PCI_MACHDEP_MEM_ALIGN_MASK;
    430  1.32.8.2  nathanw 		    p->size = PCI_MAPREG_MEM_SIZE(p->mask);
    431  1.32.8.2  nathanw 		}
    432  1.32.8.2  nathanw 
    433  1.32.8.2  nathanw 		/*
    434  1.32.8.2  nathanw 		 * if memory is already enabled (probably by the console driver)
    435  1.32.8.2  nathanw 		 * save the address in order to take care about it later.
    436  1.32.8.2  nathanw 		 */
    437  1.32.8.2  nathanw 		if (csr & PCI_COMMAND_MEM_ENABLE)
    438  1.32.8.2  nathanw 		    p->address = address;
    439  1.32.8.2  nathanw 
    440  1.32.8.2  nathanw 		insert_into_list(&memlist, p);
    441  1.32.8.2  nathanw 
    442  1.32.8.2  nathanw 		if (PCI_MAPREG_MEM_TYPE(mask) == PCI_MAPREG_MEM_TYPE_64BIT)
    443  1.32.8.2  nathanw 		    reg++;
    444  1.32.8.2  nathanw 	    }
    445  1.32.8.2  nathanw 	}
    446  1.32.8.2  nathanw 
    447  1.32.8.2  nathanw 
    448  1.32.8.2  nathanw #if defined(_ATARIHW_)
    449  1.32.8.2  nathanw 	/*
    450  1.32.8.2  nathanw 	 * Both interrupt pin & line are set to the device (== slot)
    451  1.32.8.2  nathanw 	 * number. This makes sense on the atari Hades because the
    452  1.32.8.2  nathanw 	 * individual slots are hard-wired to a specific MFP-pin.
    453  1.32.8.2  nathanw 	 */
    454  1.32.8.2  nathanw 	csr  = (DEV2SLOT(dev) << PCI_INTERRUPT_PIN_SHIFT);
    455  1.32.8.2  nathanw 	csr |= (DEV2SLOT(dev) << PCI_INTERRUPT_LINE_SHIFT);
    456  1.32.8.2  nathanw 	pci_conf_write(pc, tag, PCI_INTERRUPT_REG, csr);
    457  1.32.8.2  nathanw #else
    458  1.32.8.2  nathanw 	/*
    459  1.32.8.2  nathanw 	 * On the Milan, we accept the BIOS's choice.
    460  1.32.8.2  nathanw 	 */
    461  1.32.8.2  nathanw #endif
    462  1.32.8.2  nathanw     }
    463  1.32.8.2  nathanw 
    464  1.32.8.2  nathanw     /*
    465  1.32.8.2  nathanw      * second step: calculate the memory and I/O adresses beginning from
    466  1.32.8.2  nathanw      * PCI_MEM_START and PCI_IO_START. Care about already mapped areas.
    467  1.32.8.2  nathanw      *
    468  1.32.8.2  nathanw      * begin with memory list
    469  1.32.8.2  nathanw      */
    470  1.32.8.2  nathanw 
    471  1.32.8.2  nathanw     address = PCI_MEM_START;
    472  1.32.8.2  nathanw     sizecnt = 0;
    473  1.32.8.2  nathanw     membase_1m = 0;
    474  1.32.8.2  nathanw     p = LIST_FIRST(&memlist);
    475  1.32.8.2  nathanw     while (p != NULL) {
    476  1.32.8.2  nathanw 	if (!(p->csr & PCI_COMMAND_MEM_ENABLE)) {
    477  1.32.8.2  nathanw 	    if (PCI_MAPREG_MEM_TYPE(p->mask) == PCI_MAPREG_MEM_TYPE_32BIT_1M) {
    478  1.32.8.2  nathanw 		if (p->size > membase_1m)
    479  1.32.8.2  nathanw 		    membase_1m = p->size;
    480  1.32.8.2  nathanw 		do {
    481  1.32.8.2  nathanw 		    p->address = membase_1m;
    482  1.32.8.2  nathanw 		    membase_1m += p->size;
    483  1.32.8.2  nathanw 		} while (overlap_pci_areas(LIST_FIRST(&memlist), p, p->address,
    484  1.32.8.2  nathanw 					   p->size, PCI_COMMAND_MEM_ENABLE));
    485  1.32.8.2  nathanw 		if (membase_1m > 0x00100000) {
    486  1.32.8.2  nathanw 		    /*
    487  1.32.8.2  nathanw 		     * Should we panic here?
    488  1.32.8.2  nathanw 		     */
    489  1.32.8.2  nathanw 		    printf("\npcibus0: dev %d reg %d: memory not configured",
    490  1.32.8.2  nathanw 			    p->dev, p->reg);
    491  1.32.8.2  nathanw 		    p->reg = 0;
    492  1.32.8.2  nathanw 		}
    493  1.32.8.2  nathanw 	    } else {
    494  1.32.8.2  nathanw 
    495  1.32.8.2  nathanw 		if (sizecnt && (p->size > sizecnt))
    496  1.32.8.2  nathanw 		    sizecnt = ((p->size + sizecnt) & p->mask) &
    497  1.32.8.2  nathanw 			      PCI_MAPREG_MEM_ADDR_MASK;
    498  1.32.8.2  nathanw 		if (sizecnt > address) {
    499  1.32.8.2  nathanw 		    address = sizecnt;
    500  1.32.8.2  nathanw 		    sizecnt = 0;
    501  1.32.8.2  nathanw 		}
    502  1.32.8.2  nathanw 
    503  1.32.8.2  nathanw 		do {
    504  1.32.8.2  nathanw 		    p->address = address + sizecnt;
    505  1.32.8.2  nathanw 		    sizecnt += p->size;
    506  1.32.8.2  nathanw 		} while (overlap_pci_areas(LIST_FIRST(&memlist), p, p->address,
    507  1.32.8.2  nathanw 					   p->size, PCI_COMMAND_MEM_ENABLE));
    508  1.32.8.2  nathanw 
    509  1.32.8.2  nathanw 		if ((address + sizecnt) > PCI_MEM_END) {
    510  1.32.8.2  nathanw 		    /*
    511  1.32.8.2  nathanw 		     * Should we panic here?
    512  1.32.8.2  nathanw 		     */
    513  1.32.8.2  nathanw 		    printf("\npcibus0: dev %d reg %d: memory not configured",
    514  1.32.8.2  nathanw 			    p->dev, p->reg);
    515  1.32.8.2  nathanw 		    p->reg = 0;
    516  1.32.8.2  nathanw 		}
    517  1.32.8.2  nathanw 	    }
    518  1.32.8.2  nathanw 	    if (p->reg > 0) {
    519  1.32.8.2  nathanw 		pci_conf_write(pc, p->tag, p->reg, p->address);
    520  1.32.8.2  nathanw 		csr = pci_conf_read(pc, p->tag, PCI_COMMAND_STATUS_REG);
    521  1.32.8.2  nathanw 		csr |= PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE;
    522  1.32.8.2  nathanw 		pci_conf_write(pc, p->tag, PCI_COMMAND_STATUS_REG, csr);
    523  1.32.8.2  nathanw 		p->csr = csr;
    524  1.32.8.2  nathanw 	    }
    525  1.32.8.2  nathanw 	}
    526  1.32.8.2  nathanw 	p = LIST_NEXT(p, link);
    527  1.32.8.2  nathanw     }
    528  1.32.8.2  nathanw 
    529  1.32.8.2  nathanw     /*
    530  1.32.8.2  nathanw      * now the I/O list
    531  1.32.8.2  nathanw      */
    532  1.32.8.2  nathanw 
    533  1.32.8.2  nathanw     address = PCI_IO_START;
    534  1.32.8.2  nathanw     sizecnt = 0;
    535  1.32.8.2  nathanw     p = LIST_FIRST(&iolist);
    536  1.32.8.2  nathanw     while (p != NULL) {
    537  1.32.8.2  nathanw 	if (!(p->csr & PCI_COMMAND_IO_ENABLE)) {
    538  1.32.8.2  nathanw 
    539  1.32.8.2  nathanw 	    if (sizecnt && (p->size > sizecnt))
    540  1.32.8.2  nathanw 		sizecnt = ((p->size + sizecnt) & p->mask) &
    541  1.32.8.2  nathanw 			  PCI_MAPREG_IO_ADDR_MASK;
    542  1.32.8.2  nathanw 	    if (sizecnt > address) {
    543  1.32.8.2  nathanw 		address = sizecnt;
    544  1.32.8.2  nathanw 		sizecnt = 0;
    545  1.32.8.2  nathanw 	    }
    546  1.32.8.2  nathanw 
    547  1.32.8.2  nathanw 	    do {
    548  1.32.8.2  nathanw 		p->address = address + sizecnt;
    549  1.32.8.2  nathanw 		sizecnt += p->size;
    550  1.32.8.2  nathanw 	    } while (overlap_pci_areas(LIST_FIRST(&iolist), p, p->address,
    551  1.32.8.2  nathanw 				       p->size, PCI_COMMAND_IO_ENABLE));
    552  1.32.8.2  nathanw 
    553  1.32.8.2  nathanw 	    if ((address + sizecnt) > PCI_IO_END) {
    554  1.32.8.2  nathanw 		/*
    555  1.32.8.2  nathanw 		 * Should we panic here?
    556  1.32.8.2  nathanw 		 */
    557  1.32.8.2  nathanw 		printf("\npcibus0: dev %d reg %d: io not configured",
    558  1.32.8.2  nathanw 			p->dev, p->reg);
    559  1.32.8.2  nathanw 	    } else {
    560  1.32.8.2  nathanw 		pci_conf_write(pc, p->tag, p->reg, p->address);
    561  1.32.8.2  nathanw 		csr = pci_conf_read(pc, p->tag, PCI_COMMAND_STATUS_REG);
    562  1.32.8.2  nathanw 		csr |= PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MASTER_ENABLE;
    563  1.32.8.2  nathanw 		pci_conf_write(pc, p->tag, PCI_COMMAND_STATUS_REG, csr);
    564  1.32.8.2  nathanw 		p->csr = csr;
    565  1.32.8.2  nathanw 	    }
    566  1.32.8.2  nathanw 	}
    567  1.32.8.2  nathanw 	p = LIST_NEXT(p, link);
    568  1.32.8.2  nathanw     }
    569  1.32.8.2  nathanw 
    570  1.32.8.2  nathanw #ifdef DEBUG_PCI_MACHDEP
    571  1.32.8.2  nathanw     printf("\nI/O List:\n");
    572  1.32.8.2  nathanw     p = LIST_FIRST(&iolist);
    573  1.32.8.2  nathanw 
    574  1.32.8.2  nathanw     while (p != NULL) {
    575  1.32.8.2  nathanw 	printf("\ndev: %d, reg: 0x%02x, size: 0x%08x, addr: 0x%08x", p->dev,
    576  1.32.8.2  nathanw 			p->reg, p->size, p->address);
    577  1.32.8.2  nathanw 	p = LIST_NEXT(p, link);
    578  1.32.8.2  nathanw     }
    579  1.32.8.2  nathanw     printf("\nMemlist:");
    580  1.32.8.2  nathanw     p = LIST_FIRST(&memlist);
    581  1.32.8.2  nathanw 
    582  1.32.8.2  nathanw     while (p != NULL) {
    583  1.32.8.2  nathanw 	printf("\ndev: %d, reg: 0x%02x, size: 0x%08x, addr: 0x%08x", p->dev,
    584  1.32.8.2  nathanw 			p->reg, p->size, p->address);
    585  1.32.8.2  nathanw 	p = LIST_NEXT(p, link);
    586  1.32.8.2  nathanw     }
    587  1.32.8.2  nathanw #endif
    588  1.32.8.2  nathanw 
    589  1.32.8.2  nathanw     /*
    590  1.32.8.2  nathanw      * Free the lists
    591  1.32.8.2  nathanw      */
    592  1.32.8.2  nathanw     p = LIST_FIRST(&iolist);
    593  1.32.8.2  nathanw     while (p != NULL) {
    594  1.32.8.2  nathanw 	q = p;
    595  1.32.8.2  nathanw 	LIST_REMOVE(q, link);
    596  1.32.8.2  nathanw 	free(p, M_WAITOK);
    597  1.32.8.2  nathanw 	p = LIST_FIRST(&iolist);
    598  1.32.8.2  nathanw     }
    599  1.32.8.2  nathanw     p = LIST_FIRST(&memlist);
    600  1.32.8.2  nathanw     while (p != NULL) {
    601  1.32.8.2  nathanw 	q = p;
    602  1.32.8.2  nathanw 	LIST_REMOVE(q, link);
    603  1.32.8.2  nathanw 	free(p, M_WAITOK);
    604  1.32.8.2  nathanw 	p = LIST_FIRST(&memlist);
    605  1.32.8.2  nathanw     }
    606  1.32.8.2  nathanw }
    607  1.32.8.2  nathanw 
    608  1.32.8.2  nathanw pcitag_t
    609  1.32.8.2  nathanw pci_make_tag(pc, bus, device, function)
    610  1.32.8.2  nathanw 	pci_chipset_tag_t pc;
    611  1.32.8.2  nathanw 	int bus, device, function;
    612  1.32.8.2  nathanw {
    613  1.32.8.2  nathanw 	return ((bus << 16) | (device << 11) | (function << 8));
    614  1.32.8.2  nathanw }
    615  1.32.8.2  nathanw 
    616  1.32.8.4  nathanw void
    617  1.32.8.4  nathanw pci_decompose_tag(pc, tag, bp, dp, fp)
    618  1.32.8.4  nathanw 	pci_chipset_tag_t pc;
    619  1.32.8.4  nathanw 	pcitag_t tag;
    620  1.32.8.4  nathanw 	int *bp, *dp, *fp;
    621  1.32.8.4  nathanw {
    622  1.32.8.4  nathanw 
    623  1.32.8.4  nathanw 	if (bp != NULL)
    624  1.32.8.4  nathanw 		*bp = (tag >> 16) & 0xff;
    625  1.32.8.4  nathanw 	if (dp != NULL)
    626  1.32.8.4  nathanw 		*dp = (tag >> 11) & 0x1f;
    627  1.32.8.4  nathanw 	if (fp != NULL)
    628  1.32.8.4  nathanw 		*fp = (tag >> 8) & 0x7;
    629  1.32.8.4  nathanw }
    630  1.32.8.4  nathanw 
    631  1.32.8.2  nathanw int
    632  1.32.8.2  nathanw pci_intr_map(pa, ihp)
    633  1.32.8.2  nathanw 	struct pci_attach_args *pa;
    634  1.32.8.2  nathanw 	pci_intr_handle_t *ihp;
    635  1.32.8.2  nathanw {
    636  1.32.8.2  nathanw 	int line = pa->pa_intrline;
    637  1.32.8.2  nathanw 
    638  1.32.8.2  nathanw #if defined(_MILANHW_)
    639  1.32.8.2  nathanw 	/*
    640  1.32.8.2  nathanw 	 * On the Hades, the 'pin' info is useless.
    641  1.32.8.2  nathanw 	 */
    642  1.32.8.2  nathanw 	{
    643  1.32.8.2  nathanw 		int pin = pa->pa_intrpin;
    644  1.32.8.2  nathanw 
    645  1.32.8.2  nathanw 		if (pin == 0) {
    646  1.32.8.2  nathanw 			/* No IRQ used. */
    647  1.32.8.2  nathanw 			goto bad;
    648  1.32.8.2  nathanw 		}
    649  1.32.8.2  nathanw 		if (pin > PCI_INTERRUPT_PIN_MAX) {
    650  1.32.8.2  nathanw 			printf("pci_intr_map: bad interrupt pin %d\n", pin);
    651  1.32.8.2  nathanw 			goto bad;
    652  1.32.8.2  nathanw 		}
    653  1.32.8.2  nathanw 	}
    654  1.32.8.2  nathanw #endif /* _MILANHW_ */
    655  1.32.8.2  nathanw 
    656  1.32.8.2  nathanw 	/*
    657  1.32.8.2  nathanw 	 * According to the PCI-spec, 255 means `unknown' or `no connection'.
    658  1.32.8.2  nathanw 	 * Interpret this as 'no interrupt assigned'.
    659  1.32.8.2  nathanw 	 */
    660  1.32.8.2  nathanw 	if (line == 255)
    661  1.32.8.2  nathanw 		goto bad;
    662  1.32.8.2  nathanw 
    663  1.32.8.2  nathanw 	/*
    664  1.32.8.2  nathanw 	 * Values are pretty useless on the Hades since all interrupt
    665  1.32.8.2  nathanw 	 * lines for a card are tied together and hardwired to a
    666  1.32.8.2  nathanw 	 * specific TT-MFP I/O port.
    667  1.32.8.2  nathanw 	 * On the Milan, they are tied to the ICU.
    668  1.32.8.2  nathanw 	 */
    669  1.32.8.2  nathanw #if defined(_MILANHW_)
    670  1.32.8.2  nathanw 	if (line >= 16) {
    671  1.32.8.2  nathanw 		printf("pci_intr_map: bad interrupt line %d\n", line);
    672  1.32.8.2  nathanw 		goto bad;
    673  1.32.8.2  nathanw 	}
    674  1.32.8.2  nathanw 	if (line == 2) {
    675  1.32.8.2  nathanw 		printf("pci_intr_map: changed line 2 to line 9\n");
    676  1.32.8.2  nathanw 		line = 9;
    677  1.32.8.2  nathanw 	}
    678  1.32.8.2  nathanw 	/* Assume line == 0 means unassigned */
    679  1.32.8.2  nathanw 	if (line == 0)
    680  1.32.8.2  nathanw 		goto bad;
    681  1.32.8.2  nathanw #endif
    682  1.32.8.2  nathanw 	*ihp = line;
    683  1.32.8.2  nathanw 	return 0;
    684  1.32.8.2  nathanw 
    685  1.32.8.2  nathanw bad:
    686  1.32.8.2  nathanw 	*ihp = -1;
    687  1.32.8.2  nathanw 	return 1;
    688  1.32.8.2  nathanw }
    689  1.32.8.2  nathanw 
    690  1.32.8.2  nathanw const char *
    691  1.32.8.2  nathanw pci_intr_string(pc, ih)
    692  1.32.8.2  nathanw 	pci_chipset_tag_t pc;
    693  1.32.8.2  nathanw 	pci_intr_handle_t ih;
    694  1.32.8.2  nathanw {
    695  1.32.8.2  nathanw 	static char irqstr[8];		/* 4 + 2 + NULL + sanity */
    696  1.32.8.2  nathanw 
    697  1.32.8.2  nathanw 	if (ih == -1)
    698  1.32.8.5  nathanw 		panic("pci_intr_string: bogus handle 0x%x", ih);
    699  1.32.8.2  nathanw 
    700  1.32.8.2  nathanw 	sprintf(irqstr, "irq %d", ih);
    701  1.32.8.2  nathanw 	return (irqstr);
    702  1.32.8.2  nathanw 
    703  1.32.8.2  nathanw }
    704  1.32.8.2  nathanw 
    705  1.32.8.2  nathanw const struct evcnt *
    706  1.32.8.2  nathanw pci_intr_evcnt(pc, ih)
    707  1.32.8.2  nathanw 	pci_chipset_tag_t pc;
    708  1.32.8.2  nathanw 	pci_intr_handle_t ih;
    709  1.32.8.2  nathanw {
    710  1.32.8.2  nathanw 
    711  1.32.8.2  nathanw 	/* XXX for now, no evcnt parent reported */
    712  1.32.8.2  nathanw 	return NULL;
    713  1.32.8.2  nathanw }
    714