Home | History | Annotate | Line # | Download | only in include
pci_machdep.h revision 1.4
      1  1.4  cgd /* $NetBSD: pci_machdep.h,v 1.4 2000/06/01 00:04:50 cgd 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.1  cgd 
     34  1.1  cgd /*
     35  1.3  cgd  * Types provided to machine-independent PCI code
     36  1.3  cgd  */
     37  1.3  cgd typedef struct alpha_pci_chipset *pci_chipset_tag_t;
     38  1.3  cgd typedef u_long pcitag_t;
     39  1.3  cgd typedef u_long pci_intr_handle_t;
     40  1.3  cgd 
     41  1.3  cgd /*
     42  1.3  cgd  * Forward declarations.
     43  1.3  cgd  */
     44  1.3  cgd struct pci_attach_args;
     45  1.3  cgd 
     46  1.3  cgd /*
     47  1.3  cgd  * alpha-specific PCI structure and type definitions.
     48  1.3  cgd  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
     49  1.3  cgd  */
     50  1.3  cgd struct alpha_pci_chipset {
     51  1.3  cgd 	void		*pc_conf_v;
     52  1.4  cgd 	void		(*pc_attach_hook)(struct device *,
     53  1.4  cgd 			    struct device *, struct pcibus_attach_args *);
     54  1.4  cgd 	int		(*pc_bus_maxdevs)(void *, int);
     55  1.4  cgd 	pcitag_t	(*pc_make_tag)(void *, int, int, int);
     56  1.4  cgd 	pcireg_t	(*pc_conf_read)(void *, pcitag_t, int);
     57  1.4  cgd 	void		(*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
     58  1.3  cgd 
     59  1.3  cgd 	void		*pc_intr_v;
     60  1.4  cgd 	int		(*pc_intr_map)(void *, pcitag_t, int, int,
     61  1.4  cgd 			    pci_intr_handle_t *);
     62  1.4  cgd 	const char	*(*pc_intr_string)(void *, pci_intr_handle_t);
     63  1.4  cgd 	void		*(*pc_intr_establish)(void *, pci_intr_handle_t,
     64  1.4  cgd 			    int, int (*)(void *), void *);
     65  1.4  cgd 	void		(*pc_intr_disestablish)(void *, void *);
     66  1.3  cgd 
     67  1.3  cgd 	/* alpha-specific */
     68  1.4  cgd 	void		(*pc_decompose_tag)(void *, pcitag_t, int *,
     69  1.4  cgd 			    int *, int *);
     70  1.4  cgd 	void		*(*pc_pciide_compat_intr_establish)(void *,
     71  1.3  cgd 			    struct device *, struct pci_attach_args *, int,
     72  1.4  cgd 			    int (*)(void *), void *);
     73  1.3  cgd };
     74  1.3  cgd 
     75  1.3  cgd /*
     76  1.3  cgd  * Functions provided to machine-independent PCI code.
     77  1.3  cgd  */
     78  1.3  cgd #define	pci_attach_hook(p, s, pba)					\
     79  1.3  cgd     (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
     80  1.3  cgd #define	pci_bus_maxdevs(c, b)						\
     81  1.3  cgd     (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
     82  1.3  cgd #define	pci_make_tag(c, b, d, f)					\
     83  1.3  cgd     (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
     84  1.3  cgd #define	pci_conf_read(c, t, r)						\
     85  1.3  cgd     (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
     86  1.3  cgd #define	pci_conf_write(c, t, r, v)					\
     87  1.3  cgd     (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
     88  1.3  cgd #define	pci_intr_map(c, it, ip, il, ihp)				\
     89  1.3  cgd     (*(c)->pc_intr_map)((c)->pc_intr_v, (it), (ip), (il), (ihp))
     90  1.3  cgd #define	pci_intr_string(c, ih)						\
     91  1.3  cgd     (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
     92  1.3  cgd #define	pci_intr_establish(c, ih, l, h, a)				\
     93  1.3  cgd     (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a))
     94  1.3  cgd #define	pci_intr_disestablish(c, iv)					\
     95  1.3  cgd     (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
     96  1.3  cgd 
     97  1.3  cgd /*
     98  1.3  cgd  * alpha-specific PCI functions.
     99  1.3  cgd  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
    100  1.1  cgd  */
    101  1.4  cgd void	pci_display_console(bus_space_tag_t, bus_space_tag_t,
    102  1.4  cgd 	    pci_chipset_tag_t, int, int, int);
    103  1.3  cgd #define	alpha_pci_decompose_tag(c, t, bp, dp, fp)			\
    104  1.3  cgd     (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
    105  1.3  cgd #define	alpha_pciide_compat_intr_establish(c, d, p, ch, f, a)		\
    106  1.3  cgd     ((c)->pc_pciide_compat_intr_establish == NULL ? NULL :		\
    107  1.3  cgd      (*(c)->pc_pciide_compat_intr_establish)((c)->pc_conf_v, (d), (p),	\
    108  1.3  cgd 	(ch), (f), (a)))
    109