Home | History | Annotate | Line # | Download | only in include
pci_machdep.h revision 1.1.2.1
      1  1.1.2.1  garbled /* $NetBSD: pci_machdep.h,v 1.1.2.1 2007/05/01 08:02:25 garbled Exp $ */
      2  1.1.2.1  garbled 
      3  1.1.2.1  garbled /*-
      4  1.1.2.1  garbled  * Copyright (c) 2002,2007 The NetBSD Foundation, Inc.
      5  1.1.2.1  garbled  * All rights reserved.
      6  1.1.2.1  garbled  *
      7  1.1.2.1  garbled  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1.2.1  garbled  * by Klaus Klein and Tim Rightnour
      9  1.1.2.1  garbled  *
     10  1.1.2.1  garbled  * Redistribution and use in source and binary forms, with or without
     11  1.1.2.1  garbled  * modification, are permitted provided that the following conditions
     12  1.1.2.1  garbled  * are met:
     13  1.1.2.1  garbled  * 1. Redistributions of source code must retain the above copyright
     14  1.1.2.1  garbled  *    notice, this list of conditions and the following disclaimer.
     15  1.1.2.1  garbled  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1.2.1  garbled  *    notice, this list of conditions and the following disclaimer in the
     17  1.1.2.1  garbled  *    documentation and/or other materials provided with the distribution.
     18  1.1.2.1  garbled  * 3. All advertising materials mentioning features or use of this software
     19  1.1.2.1  garbled  *    must display the following acknowledgement:
     20  1.1.2.1  garbled  *        This product includes software developed by the NetBSD
     21  1.1.2.1  garbled  *        Foundation, Inc. and its contributors.
     22  1.1.2.1  garbled  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.1.2.1  garbled  *    contributors may be used to endorse or promote products derived
     24  1.1.2.1  garbled  *    from this software without specific prior written permission.
     25  1.1.2.1  garbled  *
     26  1.1.2.1  garbled  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.1.2.1  garbled  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.1.2.1  garbled  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.1.2.1  garbled  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.1.2.1  garbled  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.1.2.1  garbled  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.1.2.1  garbled  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.1.2.1  garbled  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.1.2.1  garbled  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.1.2.1  garbled  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.1.2.1  garbled  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1.2.1  garbled  */
     38  1.1.2.1  garbled 
     39  1.1.2.1  garbled #ifndef _PCI_MACHDEP_H_
     40  1.1.2.1  garbled #define _PCI_MACHDEP_H_
     41  1.1.2.1  garbled 
     42  1.1.2.1  garbled #include <prop/proplib.h>
     43  1.1.2.1  garbled 
     44  1.1.2.1  garbled /*
     45  1.1.2.1  garbled  * Machine-specific definitions for PCI autoconfiguration.
     46  1.1.2.1  garbled  */
     47  1.1.2.1  garbled 
     48  1.1.2.1  garbled #define __HAVE_PCI_CONF_HOOK
     49  1.1.2.1  garbled 
     50  1.1.2.1  garbled /*
     51  1.1.2.1  garbled  * Types provided to machine-independent PCI code
     52  1.1.2.1  garbled  */
     53  1.1.2.1  garbled typedef struct genppc_pci_chipset *pci_chipset_tag_t;
     54  1.1.2.1  garbled typedef int pcitag_t;
     55  1.1.2.1  garbled typedef int pci_intr_handle_t;
     56  1.1.2.1  garbled 
     57  1.1.2.1  garbled /*
     58  1.1.2.1  garbled  * Forward declarations.
     59  1.1.2.1  garbled  */
     60  1.1.2.1  garbled struct pci_attach_args;
     61  1.1.2.1  garbled 
     62  1.1.2.1  garbled /* Per bus information structure */
     63  1.1.2.1  garbled struct genppc_pci_chipset_businfo {
     64  1.1.2.1  garbled 	SIMPLEQ_ENTRY(genppc_pci_chipset_businfo) next;
     65  1.1.2.1  garbled 	prop_dictionary_t	pbi_properties; /* chipset properties */
     66  1.1.2.1  garbled };
     67  1.1.2.1  garbled 
     68  1.1.2.1  garbled /*
     69  1.1.2.1  garbled  * Generic PPC PCI structure and type definitions.
     70  1.1.2.1  garbled  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
     71  1.1.2.1  garbled  */
     72  1.1.2.1  garbled struct genppc_pci_chipset {
     73  1.1.2.1  garbled 	void		*pc_conf_v;
     74  1.1.2.1  garbled 	void		(*pc_attach_hook)(struct device *,
     75  1.1.2.1  garbled 			    struct device *, struct pcibus_attach_args *);
     76  1.1.2.1  garbled 	int		(*pc_bus_maxdevs)(pci_chipset_tag_t, int);
     77  1.1.2.1  garbled 	pcitag_t	(*pc_make_tag)(void *, int, int, int);
     78  1.1.2.1  garbled 	pcireg_t	(*pc_conf_read)(void *, pcitag_t, int);
     79  1.1.2.1  garbled 	void		(*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
     80  1.1.2.1  garbled 
     81  1.1.2.1  garbled 	void		*pc_intr_v;
     82  1.1.2.1  garbled 	int		(*pc_intr_map)(struct pci_attach_args *,
     83  1.1.2.1  garbled 			    pci_intr_handle_t *);
     84  1.1.2.1  garbled 	const char	*(*pc_intr_string)(void *, pci_intr_handle_t);
     85  1.1.2.1  garbled 	const struct evcnt *(*pc_intr_evcnt)(void *, pci_intr_handle_t);
     86  1.1.2.1  garbled 	void		*(*pc_intr_establish)(void *, pci_intr_handle_t,
     87  1.1.2.1  garbled 			    int, int (*)(void *), void *);
     88  1.1.2.1  garbled 	void		(*pc_intr_disestablish)(void *, void *);
     89  1.1.2.1  garbled 	void		(*pc_conf_interrupt)(void *, int, int, int, int, int *);
     90  1.1.2.1  garbled 	void		(*pc_decompose_tag)(void *, pcitag_t, int *,
     91  1.1.2.1  garbled 			    int *, int *);
     92  1.1.2.1  garbled 	int		(*pc_conf_hook)(pci_chipset_tag_t, int, int, int,
     93  1.1.2.1  garbled 			    pcireg_t);
     94  1.1.2.1  garbled 
     95  1.1.2.1  garbled 	u_int32_t	*pc_addr;
     96  1.1.2.1  garbled 	u_int32_t	*pc_data;
     97  1.1.2.1  garbled 	int		pc_node;
     98  1.1.2.1  garbled 	int		pc_bus;
     99  1.1.2.1  garbled 	bus_space_tag_t	pc_memt;
    100  1.1.2.1  garbled 	bus_space_tag_t	pc_iot;
    101  1.1.2.1  garbled 
    102  1.1.2.1  garbled 	SIMPLEQ_HEAD(, genppc_pci_chipset_businfo) pc_pbi;
    103  1.1.2.1  garbled };
    104  1.1.2.1  garbled 
    105  1.1.2.1  garbled /*
    106  1.1.2.1  garbled  * Functions provided to machine-independent PCI code.
    107  1.1.2.1  garbled  */
    108  1.1.2.1  garbled #define	pci_attach_hook(p, s, pba)					\
    109  1.1.2.1  garbled     (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
    110  1.1.2.1  garbled #define	pci_bus_maxdevs(c, b)						\
    111  1.1.2.1  garbled     (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
    112  1.1.2.1  garbled #define	pci_make_tag(c, b, d, f)					\
    113  1.1.2.1  garbled     (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
    114  1.1.2.1  garbled #define	pci_conf_read(c, t, r)						\
    115  1.1.2.1  garbled     (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
    116  1.1.2.1  garbled #define	pci_conf_write(c, t, r, v)					\
    117  1.1.2.1  garbled     (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
    118  1.1.2.1  garbled #define	pci_intr_map(pa, ihp)						\
    119  1.1.2.1  garbled     (*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
    120  1.1.2.1  garbled #define	pci_intr_string(c, ih)						\
    121  1.1.2.1  garbled     (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
    122  1.1.2.1  garbled #define	pci_intr_evcnt(c, ih)						\
    123  1.1.2.1  garbled     (*(c)->pc_intr_evcnt)((c)->pc_intr_v, (ih))
    124  1.1.2.1  garbled #define	pci_intr_establish(c, ih, l, h, a)				\
    125  1.1.2.1  garbled     (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a))
    126  1.1.2.1  garbled #define	pci_intr_disestablish(c, iv)					\
    127  1.1.2.1  garbled     (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
    128  1.1.2.1  garbled #define	pci_conf_interrupt(c, b, d, p, s, ip)				\
    129  1.1.2.1  garbled     (*(c)->pc_conf_interrupt)((c)->pc_conf_v, (b), (d), (p), (s), (ip))
    130  1.1.2.1  garbled #define	pci_decompose_tag(c, t, bp, dp, fp)				\
    131  1.1.2.1  garbled     (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
    132  1.1.2.1  garbled #define	pci_conf_hook(c, b, d, f, i)					\
    133  1.1.2.1  garbled     (*(c)->pc_conf_hook)((c)->pc_conf_v, (b), (d), (f), (i))
    134  1.1.2.1  garbled 
    135  1.1.2.1  garbled #ifdef _KERNEL
    136  1.1.2.1  garbled 
    137  1.1.2.1  garbled /*
    138  1.1.2.1  garbled  * Generic PowerPC PCI functions.  Override if necc.
    139  1.1.2.1  garbled  */
    140  1.1.2.1  garbled 
    141  1.1.2.1  garbled int genppc_pci_bus_maxdevs(pci_chipset_tag_t, int);
    142  1.1.2.1  garbled const char *genppc_pci_intr_string(void *, pci_intr_handle_t);
    143  1.1.2.1  garbled const struct evcnt *genppc_pci_intr_evcnt(void *, pci_intr_handle_t);
    144  1.1.2.1  garbled void *genppc_pci_intr_establish(void *, pci_intr_handle_t, int, int (*)(void *),
    145  1.1.2.1  garbled     void *);
    146  1.1.2.1  garbled void genppc_pci_intr_disestablish(void *, void *);
    147  1.1.2.1  garbled void genppc_pci_conf_interrupt(void *, int, int, int, int, int *);
    148  1.1.2.1  garbled int genppc_pci_conf_hook(pci_chipset_tag_t, int, int, int, pcireg_t);
    149  1.1.2.1  garbled 
    150  1.1.2.1  garbled extern struct powerpc_bus_dma_tag pci_bus_dma_tag;
    151  1.1.2.1  garbled #endif /* _KERNEL */
    152  1.1.2.1  garbled 
    153  1.1.2.1  garbled #endif /* _PCI_MACHDEP_H_ */
    154