Home | History | Annotate | Line # | Download | only in include
pci_machdep.h revision 1.12.8.1
      1  1.12.8.1   bouyer /*	$NetBSD: pci_machdep.h,v 1.12.8.1 2000/11/20 20:09:29 bouyer Exp $	*/
      2       1.2      cgd 
      3       1.1  mycroft /*
      4       1.5      cgd  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
      5      1.11  mycroft  * Copyright (c) 1994 Charles M. Hannum.  All rights reserved.
      6       1.1  mycroft  *
      7       1.1  mycroft  * Redistribution and use in source and binary forms, with or without
      8       1.1  mycroft  * modification, are permitted provided that the following conditions
      9       1.1  mycroft  * are met:
     10       1.1  mycroft  * 1. Redistributions of source code must retain the above copyright
     11       1.1  mycroft  *    notice, this list of conditions and the following disclaimer.
     12       1.1  mycroft  * 2. Redistributions in binary form must reproduce the above copyright
     13       1.1  mycroft  *    notice, this list of conditions and the following disclaimer in the
     14       1.1  mycroft  *    documentation and/or other materials provided with the distribution.
     15       1.1  mycroft  * 3. All advertising materials mentioning features or use of this software
     16       1.1  mycroft  *    must display the following acknowledgement:
     17      1.11  mycroft  *	This product includes software developed by Charles M. Hannum.
     18       1.1  mycroft  * 4. The name of the author may not be used to endorse or promote products
     19       1.1  mycroft  *    derived from this software without specific prior written permission.
     20       1.1  mycroft  *
     21       1.1  mycroft  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22       1.1  mycroft  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23       1.1  mycroft  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24       1.1  mycroft  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25       1.1  mycroft  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26       1.1  mycroft  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27       1.1  mycroft  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28       1.1  mycroft  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29       1.1  mycroft  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30       1.1  mycroft  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31       1.1  mycroft  */
     32       1.1  mycroft 
     33       1.1  mycroft /*
     34       1.1  mycroft  * Machine-specific definitions for PCI autoconfiguration.
     35       1.1  mycroft  */
     36       1.8  thorpej 
     37       1.8  thorpej /*
     38       1.8  thorpej  * Many i386 PCI systems only work properly with I/O mapped space, in
     39       1.8  thorpej  * particular, buses behind PCI-PCI bridges may not have memory
     40       1.8  thorpej  * space mapped at all.  For this reason, tell drivers that have
     41       1.8  thorpej  * a choice that we "prefer" I/O space.
     42       1.8  thorpej  */
     43       1.8  thorpej #define	PCI_PREFER_IOSPACE
     44       1.1  mycroft 
     45       1.1  mycroft /*
     46       1.5      cgd  * i386-specific PCI structure and type definitions.
     47       1.5      cgd  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
     48       1.5      cgd  *
     49       1.1  mycroft  * Configuration tag; created from a {bus,device,function} triplet by
     50       1.1  mycroft  * pci_make_tag(), and passed to pci_conf_read() and pci_conf_write().
     51       1.1  mycroft  * We could instead always pass the {bus,device,function} triplet to
     52       1.1  mycroft  * the read and write routines, but this would cause extra overhead.
     53       1.1  mycroft  *
     54       1.5      cgd  * Mode 2 is historical and deprecated by the Revision 2.0 specification.
     55       1.1  mycroft  */
     56       1.5      cgd union i386_pci_tag_u {
     57       1.5      cgd 	u_int32_t mode1;
     58       1.1  mycroft 	struct {
     59       1.5      cgd 		u_int16_t port;
     60       1.5      cgd 		u_int8_t enable;
     61       1.5      cgd 		u_int8_t forward;
     62       1.1  mycroft 	} mode2;
     63       1.5      cgd };
     64       1.7  thorpej 
     65       1.7  thorpej extern struct i386_bus_dma_tag pci_bus_dma_tag;
     66       1.1  mycroft 
     67       1.1  mycroft /*
     68       1.5      cgd  * Types provided to machine-independent PCI code
     69       1.1  mycroft  */
     70       1.5      cgd typedef void *pci_chipset_tag_t;
     71       1.5      cgd typedef union i386_pci_tag_u pcitag_t;
     72       1.5      cgd typedef int pci_intr_handle_t;
     73       1.1  mycroft 
     74       1.4      cgd /*
     75       1.5      cgd  * i386-specific PCI variables and functions.
     76       1.5      cgd  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
     77       1.4      cgd  */
     78       1.5      cgd extern int pci_mode;
     79  1.12.8.1   bouyer int		pci_mode_detect(void);
     80  1.12.8.1   bouyer int		pci_bus_flags(void);
     81       1.4      cgd 
     82       1.4      cgd /*
     83       1.5      cgd  * Functions provided to machine-independent PCI code.
     84       1.4      cgd  */
     85  1.12.8.1   bouyer void		pci_attach_hook(struct device *, struct device *,
     86  1.12.8.1   bouyer 		    struct pcibus_attach_args *);
     87  1.12.8.1   bouyer int		pci_bus_maxdevs(pci_chipset_tag_t, int);
     88  1.12.8.1   bouyer pcitag_t	pci_make_tag(pci_chipset_tag_t, int, int, int);
     89  1.12.8.1   bouyer void		pci_decompose_tag(pci_chipset_tag_t, pcitag_t,
     90  1.12.8.1   bouyer 		    int *, int *, int *);
     91  1.12.8.1   bouyer pcireg_t	pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
     92  1.12.8.1   bouyer void		pci_conf_write(pci_chipset_tag_t, pcitag_t, int,
     93  1.12.8.1   bouyer 		    pcireg_t);
     94  1.12.8.1   bouyer int		pci_intr_map(pci_chipset_tag_t, pcitag_t, int, int,
     95  1.12.8.1   bouyer 		    pci_intr_handle_t *);
     96  1.12.8.1   bouyer const char	*pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t);
     97  1.12.8.1   bouyer const struct evcnt *pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
     98  1.12.8.1   bouyer void		*pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
     99  1.12.8.1   bouyer 		    int, int (*)(void *), void *);
    100  1.12.8.1   bouyer void		pci_intr_disestablish(pci_chipset_tag_t, void *);
    101  1.12.8.1   bouyer 
    102  1.12.8.1   bouyer /*
    103  1.12.8.1   bouyer  * ALL OF THE FOLLOWING ARE MACHINE-DEPENDENT, AND SHOULD NOT BE USED
    104  1.12.8.1   bouyer  * BY PORTABLE CODE.
    105  1.12.8.1   bouyer  */
    106  1.12.8.1   bouyer 
    107  1.12.8.1   bouyer /*
    108  1.12.8.1   bouyer  * Section 6.2.4, `Miscellaneous Functions' of the PCI Specification,
    109  1.12.8.1   bouyer  * says that 255 means `unknown' or `no connection' to the interrupt
    110  1.12.8.1   bouyer  * controller on a PC.
    111  1.12.8.1   bouyer  */
    112  1.12.8.1   bouyer #define	I386_PCI_INTERRUPT_LINE_NO_CONNECTION	0xff
    113