Home | History | Annotate | Line # | Download | only in include
pci_machdep.h revision 1.9
      1  1.9   thorpej /* $NetBSD: pci_machdep.h,v 1.9 2002/05/15 17:09:58 thorpej Exp $ */
      2  1.1       cgd 
      3  1.1       cgd /*
      4  1.3       cgd  * Copyright (c) 1996 Carnegie-Mellon University.
      5  1.1       cgd  * All rights reserved.
      6  1.1       cgd  *
      7  1.1       cgd  * Author: Chris G. Demetriou
      8  1.1       cgd  *
      9  1.1       cgd  * Permission to use, copy, modify and distribute this software and
     10  1.1       cgd  * its documentation is hereby granted, provided that both the copyright
     11  1.1       cgd  * notice and this permission notice appear in all copies of the
     12  1.1       cgd  * software, derivative works or modified versions, and any portions
     13  1.1       cgd  * thereof, and that both notices appear in supporting documentation.
     14  1.1       cgd  *
     15  1.1       cgd  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16  1.1       cgd  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17  1.1       cgd  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18  1.1       cgd  *
     19  1.1       cgd  * Carnegie Mellon requests users of this software to return to
     20  1.1       cgd  *
     21  1.1       cgd  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22  1.1       cgd  *  School of Computer Science
     23  1.1       cgd  *  Carnegie Mellon University
     24  1.1       cgd  *  Pittsburgh PA 15213-3890
     25  1.1       cgd  *
     26  1.1       cgd  * any improvements or extensions that they make and grant Carnegie the
     27  1.1       cgd  * rights to redistribute these changes.
     28  1.1       cgd  */
     29  1.3       cgd 
     30  1.1       cgd /*
     31  1.1       cgd  * Machine-specific definitions for PCI autoconfiguration.
     32  1.1       cgd  */
     33  1.7    simonb #define	__HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
     34  1.1       cgd 
     35  1.1       cgd /*
     36  1.3       cgd  * Types provided to machine-independent PCI code
     37  1.3       cgd  */
     38  1.3       cgd typedef struct alpha_pci_chipset *pci_chipset_tag_t;
     39  1.3       cgd typedef u_long pcitag_t;
     40  1.3       cgd typedef u_long pci_intr_handle_t;
     41  1.3       cgd 
     42  1.3       cgd /*
     43  1.3       cgd  * Forward declarations.
     44  1.3       cgd  */
     45  1.3       cgd struct pci_attach_args;
     46  1.3       cgd 
     47  1.3       cgd /*
     48  1.3       cgd  * alpha-specific PCI structure and type definitions.
     49  1.3       cgd  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
     50  1.3       cgd  */
     51  1.3       cgd struct alpha_pci_chipset {
     52  1.3       cgd 	void		*pc_conf_v;
     53  1.4       cgd 	void		(*pc_attach_hook)(struct device *,
     54  1.4       cgd 			    struct device *, struct pcibus_attach_args *);
     55  1.4       cgd 	int		(*pc_bus_maxdevs)(void *, int);
     56  1.4       cgd 	pcitag_t	(*pc_make_tag)(void *, int, int, int);
     57  1.9   thorpej 	void		(*pc_decompose_tag)(void *, pcitag_t, int *,
     58  1.9   thorpej 			    int *, int *);
     59  1.4       cgd 	pcireg_t	(*pc_conf_read)(void *, pcitag_t, int);
     60  1.4       cgd 	void		(*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
     61  1.3       cgd 
     62  1.3       cgd 	void		*pc_intr_v;
     63  1.6  sommerfe 	int		(*pc_intr_map)(struct pci_attach_args *,
     64  1.4       cgd 			    pci_intr_handle_t *);
     65  1.4       cgd 	const char	*(*pc_intr_string)(void *, pci_intr_handle_t);
     66  1.5       cgd 	const struct evcnt *(*pc_intr_evcnt)(void *, pci_intr_handle_t);
     67  1.4       cgd 	void		*(*pc_intr_establish)(void *, pci_intr_handle_t,
     68  1.4       cgd 			    int, int (*)(void *), void *);
     69  1.4       cgd 	void		(*pc_intr_disestablish)(void *, void *);
     70  1.3       cgd 
     71  1.4       cgd 	void		*(*pc_pciide_compat_intr_establish)(void *,
     72  1.3       cgd 			    struct device *, struct pci_attach_args *, int,
     73  1.4       cgd 			    int (*)(void *), void *);
     74  1.3       cgd };
     75  1.3       cgd 
     76  1.3       cgd /*
     77  1.3       cgd  * Functions provided to machine-independent PCI code.
     78  1.3       cgd  */
     79  1.3       cgd #define	pci_attach_hook(p, s, pba)					\
     80  1.3       cgd     (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
     81  1.3       cgd #define	pci_bus_maxdevs(c, b)						\
     82  1.3       cgd     (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
     83  1.3       cgd #define	pci_make_tag(c, b, d, f)					\
     84  1.3       cgd     (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
     85  1.8   thorpej #define	pci_decompose_tag(c, t, bp, dp, fp)				\
     86  1.8   thorpej     (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
     87  1.3       cgd #define	pci_conf_read(c, t, r)						\
     88  1.3       cgd     (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
     89  1.3       cgd #define	pci_conf_write(c, t, r, v)					\
     90  1.3       cgd     (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
     91  1.6  sommerfe #define	pci_intr_map(pa, ihp)						\
     92  1.6  sommerfe     (*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
     93  1.3       cgd #define	pci_intr_string(c, ih)						\
     94  1.3       cgd     (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
     95  1.5       cgd #define	pci_intr_evcnt(c, ih)						\
     96  1.5       cgd     (*(c)->pc_intr_evcnt)((c)->pc_intr_v, (ih))
     97  1.3       cgd #define	pci_intr_establish(c, ih, l, h, a)				\
     98  1.3       cgd     (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a))
     99  1.3       cgd #define	pci_intr_disestablish(c, iv)					\
    100  1.3       cgd     (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
    101  1.3       cgd 
    102  1.3       cgd /*
    103  1.3       cgd  * alpha-specific PCI functions.
    104  1.3       cgd  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
    105  1.1       cgd  */
    106  1.4       cgd void	pci_display_console(bus_space_tag_t, bus_space_tag_t,
    107  1.4       cgd 	    pci_chipset_tag_t, int, int, int);
    108  1.3       cgd #define	alpha_pciide_compat_intr_establish(c, d, p, ch, f, a)		\
    109  1.3       cgd     ((c)->pc_pciide_compat_intr_establish == NULL ? NULL :		\
    110  1.3       cgd      (*(c)->pc_pciide_compat_intr_establish)((c)->pc_conf_v, (d), (p),	\
    111  1.3       cgd 	(ch), (f), (a)))
    112