1 /* $NetBSD: pci_machdep.h,v 1.3.10.3 2004/09/21 13:16:11 skrll Exp $ */
4 * Copyright (c) 2001 Enami Tsugutomo.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * Machine-specific definitions for PCI autoconfiguration.
34 * We want to control both device probe order.
36 #define __PCI_BUS_DEVORDER
39 * Types provided to machine-independent PCI code
41 typedef struct hpcmips_pci_chipset
*pci_chipset_tag_t
;
42 typedef u_long pcitag_t
;
43 typedef u_long pci_intr_handle_t
;
46 * Forward declarations.
48 struct pci_attach_args
;
51 * hpcmips-specific PCI structure and type definitions.
52 * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
54 struct hpcmips_pci_chipset
{
55 struct device
*pc_dev
;
57 void (*pc_attach_hook
)(struct device
*, struct device
*,
58 struct pcibus_attach_args
*);
59 int (*pc_bus_maxdevs
)(pci_chipset_tag_t
, int);
60 int (*pc_bus_devorder
)(pci_chipset_tag_t
, int, char *);
61 pcitag_t (*pc_make_tag
)(pci_chipset_tag_t
, int, int, int);
62 void (*pc_decompose_tag
)(pci_chipset_tag_t
, pcitag_t
, int *, int *,
64 pcireg_t (*pc_conf_read
)(pci_chipset_tag_t
, pcitag_t
, int);
65 void (*pc_conf_write
)(pci_chipset_tag_t
, pcitag_t
, int, pcireg_t
);
66 int (*pc_intr_map
)(struct pci_attach_args
*, pci_intr_handle_t
*);
67 const char *(*pc_intr_string
)(pci_chipset_tag_t
, pci_intr_handle_t
);
68 const struct evcnt
*(*pc_intr_evcnt
)(pci_chipset_tag_t
,
70 void *(*pc_intr_establish
)(pci_chipset_tag_t
, pci_intr_handle_t
, int,
71 int (*)(void *), void *);
72 void (*pc_intr_disestablish
)(pci_chipset_tag_t
, void *);
76 * Functions provided to machine-independent PCI code.
78 #define pci_attach_hook(p, s, pba) \
79 (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
80 #define pci_bus_maxdevs(c, b) \
81 (*(c)->pc_bus_maxdevs)((c), (b))
82 #ifdef __PCI_BUS_DEVORDER
83 #define pci_bus_devorder(c, b, d) \
84 (*(c)->pc_bus_devorder)((c), (b), (d))
86 #define pci_make_tag(c, b, d, f) \
87 (*(c)->pc_make_tag)((c), (b), (d), (f))
88 #define pci_decompose_tag(c, t, bp, dp, fp) \
89 (*(c)->pc_decompose_tag)((c), (t), (bp), (dp), (fp))
90 #define pci_conf_read(c, t, r) \
91 (*(c)->pc_conf_read)((c), (t), (r))
92 #define pci_conf_write(c, t, r, v) \
93 (*(c)->pc_conf_write)((c), (t), (r), (v))
94 #define pci_intr_map(pa, ihp) \
95 (*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
96 #define pci_intr_string(c, ih) \
97 (*(c)->pc_intr_string)((c), (ih))
98 #define pci_intr_evcnt(c, ih) \
99 (*(c)->pc_intr_evcnt)((c), (ih))
100 #define pci_intr_establish(c, ih, l, h, a) \
101 (*(c)->pc_intr_establish)((c), (ih), (l), (h), (a))
102 #define pci_intr_disestablish(c, iv) \
103 (*(c)->pc_intr_disestablish)((c), (iv))