pci_machdep.h revision 1.1
11.1Ssimonb/*	$NetBSD: pci_machdep.h,v 1.1 2002/03/07 14:44:01 simonb Exp $	*/
21.1Ssimonb
31.1Ssimonb/*
41.1Ssimonb * Copyright (c) 1996 Carnegie-Mellon University.
51.1Ssimonb * All rights reserved.
61.1Ssimonb *
71.1Ssimonb * Author: Chris G. Demetriou
81.1Ssimonb *
91.1Ssimonb * Permission to use, copy, modify and distribute this software and
101.1Ssimonb * its documentation is hereby granted, provided that both the copyright
111.1Ssimonb * notice and this permission notice appear in all copies of the
121.1Ssimonb * software, derivative works or modified versions, and any portions
131.1Ssimonb * thereof, and that both notices appear in supporting documentation.
141.1Ssimonb *
151.1Ssimonb * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
161.1Ssimonb * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
171.1Ssimonb * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
181.1Ssimonb *
191.1Ssimonb * Carnegie Mellon requests users of this software to return to
201.1Ssimonb *
211.1Ssimonb *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
221.1Ssimonb *  School of Computer Science
231.1Ssimonb *  Carnegie Mellon University
241.1Ssimonb *  Pittsburgh PA 15213-3890
251.1Ssimonb *
261.1Ssimonb * any improvements or extensions that they make and grant Carnegie the
271.1Ssimonb * rights to redistribute these changes.
281.1Ssimonb */
291.1Ssimonb
301.1Ssimonb/*
311.1Ssimonb * Machine-specific definitions for PCI autoconfiguration.
321.1Ssimonb */
331.1Ssimonb#define	__HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
341.1Ssimonb
351.1Ssimonb/*
361.1Ssimonb * Types provided to machine-independent PCI code
371.1Ssimonb */
381.1Ssimonbtypedef struct evbmips_pci_chipset *pci_chipset_tag_t;
391.1Ssimonbtypedef u_long pcitag_t;
401.1Ssimonbtypedef u_long pci_intr_handle_t;
411.1Ssimonbextern struct evbmips_bus_dma_tag pci_bus_dma_tag;
421.1Ssimonb
431.1Ssimonb/*
441.1Ssimonb * Forward declarations.
451.1Ssimonb */
461.1Ssimonbstruct pci_attach_args;
471.1Ssimonb
481.1Ssimonb/*
491.1Ssimonb * evbmips-specific PCI structure and type definitions.
501.1Ssimonb * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
511.1Ssimonb */
521.1Ssimonbstruct evbmips_pci_chipset {
531.1Ssimonb	void		*pc_conf_v;
541.1Ssimonb	void		(*pc_attach_hook)(struct device *,
551.1Ssimonb			    struct device *, struct pcibus_attach_args *);
561.1Ssimonb	int		(*pc_bus_maxdevs)(void *, int);
571.1Ssimonb	pcitag_t	(*pc_make_tag)(void *, int, int, int);
581.1Ssimonb	void		(*pc_decompose_tag)(void *, pcitag_t, int *,
591.1Ssimonb			    int *, int *);
601.1Ssimonb	pcireg_t	(*pc_conf_read)(void *, pcitag_t, int);
611.1Ssimonb	void		(*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
621.1Ssimonb
631.1Ssimonb	void		*pc_intr_v;
641.1Ssimonb	int		(*pc_intr_map)(struct pci_attach_args *,
651.1Ssimonb			    pci_intr_handle_t *);
661.1Ssimonb	const char	*(*pc_intr_string)(void *, pci_intr_handle_t);
671.1Ssimonb	const struct evcnt *(*pc_intr_evcnt)(void *, pci_intr_handle_t);
681.1Ssimonb	void		*(*pc_intr_establish)(void *, pci_intr_handle_t,
691.1Ssimonb			    int, int (*)(void *), void *);
701.1Ssimonb	void		(*pc_intr_disestablish)(void *, void *);
711.1Ssimonb
721.1Ssimonb	void		(*pc_conf_interrupt)(void *, int, int, int,
731.1Ssimonb			    int, int *);
741.1Ssimonb
751.1Ssimonb	/* evbmips-specific */
761.1Ssimonb	void		*(*pc_pciide_compat_intr_establish)(void *,
771.1Ssimonb			    struct device *, struct pci_attach_args *, int,
781.1Ssimonb			    int (*)(void *), void *);
791.1Ssimonb};
801.1Ssimonb
811.1Ssimonb/*
821.1Ssimonb * Functions provided to machine-independent PCI code.
831.1Ssimonb */
841.1Ssimonb#define	pci_attach_hook(p, s, pba)					\
851.1Ssimonb    (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
861.1Ssimonb#define	pci_bus_maxdevs(c, b)						\
871.1Ssimonb    (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
881.1Ssimonb#define	pci_make_tag(c, b, d, f)					\
891.1Ssimonb    (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
901.1Ssimonb#define	pci_decompose_tag(c, t, bp, dp, fp)				\
911.1Ssimonb    (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
921.1Ssimonb#define	pci_conf_read(c, t, r)						\
931.1Ssimonb    (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
941.1Ssimonb#define	pci_conf_write(c, t, r, v)					\
951.1Ssimonb    (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
961.1Ssimonb#define	pci_intr_map(pa, ihp)						\
971.1Ssimonb    (*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
981.1Ssimonb#define	pci_intr_string(c, ih)						\
991.1Ssimonb    (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
1001.1Ssimonb#define	pci_intr_evcnt(c, ih)						\
1011.1Ssimonb    (*(c)->pc_intr_evcnt)((c)->pc_intr_v, (ih))
1021.1Ssimonb#define	pci_intr_establish(c, ih, l, h, a)				\
1031.1Ssimonb    (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a))
1041.1Ssimonb#define	pci_intr_disestablish(c, iv)					\
1051.1Ssimonb    (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
1061.1Ssimonb#define	pci_conf_interrupt(c, b, d, p, s, lp)				\
1071.1Ssimonb    (*(c)->pc_conf_interrupt)((c)->pc_intr_v, (b), (d), (p), (s), (lp))
1081.1Ssimonb
1091.1Ssimonb/*
1101.1Ssimonb * evbmips-specific PCI functions.
1111.1Ssimonb * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
1121.1Ssimonb */
1131.1Ssimonb#define	evbmips_pciide_compat_intr_establish(c, d, p, ch, f, a)		\
1141.1Ssimonb    ((c)->pc_pciide_compat_intr_establish == NULL ? NULL :		\
1151.1Ssimonb     (*(c)->pc_pciide_compat_intr_establish)((c)->pc_conf_v, (d), (p),	\
1161.1Ssimonb	(ch), (f), (a)))
117