Home | History | Annotate | Line # | Download | only in include
pci_machdep.h revision 1.1
      1  1.1  enami /*	$NetBSD: pci_machdep.h,v 1.1 2001/06/13 07:32:47 enami Exp $	*/
      2  1.1  enami 
      3  1.1  enami /*-
      4  1.1  enami  * Copyright (c) 2001 Enami Tsugutomo.
      5  1.1  enami  * All rights reserved.
      6  1.1  enami  *
      7  1.1  enami  * Redistribution and use in source and binary forms, with or without
      8  1.1  enami  * modification, are permitted provided that the following conditions
      9  1.1  enami  * are met:
     10  1.1  enami  * 1. Redistributions of source code must retain the above copyright
     11  1.1  enami  *    notice, this list of conditions and the following disclaimer.
     12  1.1  enami  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  enami  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  enami  *    documentation and/or other materials provided with the distribution.
     15  1.1  enami  *
     16  1.1  enami  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     17  1.1  enami  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     18  1.1  enami  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     19  1.1  enami  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     20  1.1  enami  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     21  1.1  enami  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     22  1.1  enami  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  1.1  enami  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     24  1.1  enami  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25  1.1  enami  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  1.1  enami  * SUCH DAMAGE.
     27  1.1  enami  */
     28  1.1  enami 
     29  1.1  enami /*
     30  1.1  enami  * Machine-specific definitions for PCI autoconfiguration.
     31  1.1  enami  */
     32  1.1  enami 
     33  1.1  enami /*
     34  1.1  enami  * We want to contro both device probe order.
     35  1.1  enami  */
     36  1.1  enami #define	__PCI_BUS_DEVORDER
     37  1.1  enami 
     38  1.1  enami /*
     39  1.1  enami  * Types provided to machine-independent PCI code
     40  1.1  enami  */
     41  1.1  enami typedef struct hpcmips_pci_chipset *pci_chipset_tag_t;
     42  1.1  enami typedef u_long pcitag_t;
     43  1.1  enami typedef u_long pci_intr_handle_t;
     44  1.1  enami 
     45  1.1  enami /*
     46  1.1  enami  * Forward declarations.
     47  1.1  enami  */
     48  1.1  enami struct pci_attach_args;
     49  1.1  enami 
     50  1.1  enami /*
     51  1.1  enami  * hpcmips-specific PCI structure and type definitions.
     52  1.1  enami  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
     53  1.1  enami  */
     54  1.1  enami struct hpcmips_pci_chipset {
     55  1.1  enami 	struct device *pc_dev;
     56  1.1  enami 
     57  1.1  enami 	void (*pc_attach_hook)(struct device *, struct device *,
     58  1.1  enami 	    struct pcibus_attach_args *);
     59  1.1  enami 	int (*pc_bus_maxdevs)(pci_chipset_tag_t, int);
     60  1.1  enami 	int (*pc_bus_devorder)(pci_chipset_tag_t, int, char *);
     61  1.1  enami 	pcitag_t (*pc_make_tag)(pci_chipset_tag_t, int, int, int);
     62  1.1  enami 	void (*pc_decompose_tag)(pci_chipset_tag_t, pcitag_t, int *, int *,
     63  1.1  enami 	    int *);
     64  1.1  enami 	pcireg_t (*pc_conf_read)(pci_chipset_tag_t, pcitag_t, int);
     65  1.1  enami 	void (*pc_conf_write)(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
     66  1.1  enami 	int (*pc_intr_map)(struct pci_attach_args *, pci_intr_handle_t *);
     67  1.1  enami 	const char *(*pc_intr_string)(pci_chipset_tag_t, pci_intr_handle_t);
     68  1.1  enami 	const struct evcnt *(*pc_intr_evcnt)(pci_chipset_tag_t,
     69  1.1  enami 	    pci_intr_handle_t);
     70  1.1  enami 	void *(*pc_intr_establish)(pci_chipset_tag_t, pci_intr_handle_t, int,
     71  1.1  enami 	    int (*)(void *), void *);
     72  1.1  enami 	void (*pc_intr_disestablish)(pci_chipset_tag_t, void *);
     73  1.1  enami 
     74  1.1  enami 	/* hpcmips specific */
     75  1.1  enami 	void *(*pc_vrcintr_establish)(pci_chipset_tag_t, int,
     76  1.1  enami 	    int (*)(void *), void *);
     77  1.1  enami 	void (*pc_vrcintr_disestablish)(pci_chipset_tag_t, void *);
     78  1.1  enami };
     79  1.1  enami 
     80  1.1  enami /*
     81  1.1  enami  * Functions provided to machine-independent PCI code.
     82  1.1  enami  */
     83  1.1  enami #define	pci_attach_hook(p, s, pba)					\
     84  1.1  enami     (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
     85  1.1  enami #define	pci_bus_maxdevs(c, b)						\
     86  1.1  enami     (*(c)->pc_bus_maxdevs)((c), (b))
     87  1.1  enami #ifdef __PCI_BUS_DEVORDER
     88  1.1  enami #define	pci_bus_devorder(c, b, d)					\
     89  1.1  enami     (*(c)->pc_bus_devorder)((c), (b), (d))
     90  1.1  enami #endif
     91  1.1  enami #define	pci_make_tag(c, b, d, f)					\
     92  1.1  enami     (*(c)->pc_make_tag)((c), (b), (d), (f))
     93  1.1  enami #define	pci_decompose_tag(c, t, bp, dp, fp)				\
     94  1.1  enami     (*(c)->pc_decompose_tag)((c), (t), (bp), (dp), (fp))
     95  1.1  enami #define	pci_conf_read(c, t, r)						\
     96  1.1  enami     (*(c)->pc_conf_read)((c), (t), (r))
     97  1.1  enami #define	pci_conf_write(c, t, r, v)					\
     98  1.1  enami     (*(c)->pc_conf_write)((c), (t), (r), (v))
     99  1.1  enami #define	pci_intr_map(pa, ihp)						\
    100  1.1  enami     (*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
    101  1.1  enami #define	pci_intr_string(c, ih)						\
    102  1.1  enami     (*(c)->pc_intr_string)((c), (ih))
    103  1.1  enami #define	pci_intr_evcnt(c, ih)						\
    104  1.1  enami     (*(c)->pc_intr_evcnt)((c), (ih))
    105  1.1  enami #define	pci_intr_establish(c, ih, l, h, a)				\
    106  1.1  enami     (*(c)->pc_intr_establish)((c), (ih), (l), (h), (a))
    107  1.1  enami #define	pci_intr_disestablish(c, iv)					\
    108  1.1  enami     (*(c)->pc_intr_disestablish)((c), (iv))
    109  1.1  enami 
    110  1.1  enami /* XXX */
    111  1.1  enami #define	pci_vrcintr_establish(c, p, func, arg)				\
    112  1.1  enami     (*(c)->pc_vrcintr_establish)((c), (p), (func), (arg))
    113  1.1  enami #define	pci_vrcintr_disestablish(c, iv)					\
    114  1.1  enami     (*(c)->pc_vrcintr_disestablish)((c), (iv))
    115