Home | History | Annotate | Line # | Download | only in include
pci_machdep.h revision 1.3.8.2
      1  1.3.8.2  bouyer /* $NetBSD: pci_machdep.h,v 1.3.8.2 2001/01/05 17:33:46 bouyer 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.3.8.1  bouyer 	void		(*pc_attach_hook)(struct device *,
     53  1.3.8.1  bouyer 			    struct device *, struct pcibus_attach_args *);
     54  1.3.8.1  bouyer 	int		(*pc_bus_maxdevs)(void *, int);
     55  1.3.8.1  bouyer 	pcitag_t	(*pc_make_tag)(void *, int, int, int);
     56  1.3.8.1  bouyer 	pcireg_t	(*pc_conf_read)(void *, pcitag_t, int);
     57  1.3.8.1  bouyer 	void		(*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
     58      1.3     cgd 
     59      1.3     cgd 	void		*pc_intr_v;
     60  1.3.8.2  bouyer 	int		(*pc_intr_map)(struct pci_attach_args *,
     61  1.3.8.1  bouyer 			    pci_intr_handle_t *);
     62  1.3.8.1  bouyer 	const char	*(*pc_intr_string)(void *, pci_intr_handle_t);
     63  1.3.8.1  bouyer 	const struct evcnt *(*pc_intr_evcnt)(void *, pci_intr_handle_t);
     64  1.3.8.1  bouyer 	void		*(*pc_intr_establish)(void *, pci_intr_handle_t,
     65  1.3.8.1  bouyer 			    int, int (*)(void *), void *);
     66  1.3.8.1  bouyer 	void		(*pc_intr_disestablish)(void *, void *);
     67      1.3     cgd 
     68      1.3     cgd 	/* alpha-specific */
     69  1.3.8.1  bouyer 	void		(*pc_decompose_tag)(void *, pcitag_t, int *,
     70  1.3.8.1  bouyer 			    int *, int *);
     71  1.3.8.1  bouyer 	void		*(*pc_pciide_compat_intr_establish)(void *,
     72      1.3     cgd 			    struct device *, struct pci_attach_args *, int,
     73  1.3.8.1  bouyer 			    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.3     cgd #define	pci_conf_read(c, t, r)						\
     86      1.3     cgd     (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
     87      1.3     cgd #define	pci_conf_write(c, t, r, v)					\
     88      1.3     cgd     (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
     89  1.3.8.2  bouyer #define	pci_intr_map(pa, ihp)						\
     90  1.3.8.2  bouyer     (*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
     91      1.3     cgd #define	pci_intr_string(c, ih)						\
     92      1.3     cgd     (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
     93  1.3.8.1  bouyer #define	pci_intr_evcnt(c, ih)						\
     94  1.3.8.1  bouyer     (*(c)->pc_intr_evcnt)((c)->pc_intr_v, (ih))
     95      1.3     cgd #define	pci_intr_establish(c, ih, l, h, a)				\
     96      1.3     cgd     (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a))
     97      1.3     cgd #define	pci_intr_disestablish(c, iv)					\
     98      1.3     cgd     (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
     99      1.3     cgd 
    100      1.3     cgd /*
    101      1.3     cgd  * alpha-specific PCI functions.
    102      1.3     cgd  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
    103      1.1     cgd  */
    104  1.3.8.1  bouyer void	pci_display_console(bus_space_tag_t, bus_space_tag_t,
    105  1.3.8.1  bouyer 	    pci_chipset_tag_t, int, int, int);
    106      1.3     cgd #define	alpha_pci_decompose_tag(c, t, bp, dp, fp)			\
    107      1.3     cgd     (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
    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