1 /* $OpenBSD: pci_machdep.h,v 1.1 2003/09/29 19:23:02 mickey Exp $ */
4 * Copyright (c) 2003 Michael Shalayeff
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 AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
20 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
25 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26 * THE POSSIBILITY OF SUCH DAMAGE.
29 #ifndef _MACHINE_PCI_MACHDEP_H_
30 #define _MACHINE_PCI_MACHDEP_H_
33 * Types provided to machine-independent PCI code
35 typedef struct hppa_pci_chipset_tag
*pci_chipset_tag_t
;
36 typedef u_long pcitag_t
;
37 typedef u_long pci_intr_handle_t
;
39 struct pci_attach_args
;
41 struct hppa_pci_chipset_tag
{
43 void (*pc_attach_hook
)(device_t
,
44 device_t
, struct pcibus_attach_args
*);
45 int (*pc_bus_maxdevs
)(void *, int);
46 pcitag_t (*pc_make_tag
)(void *, int, int, int);
47 void (*pc_decompose_tag
)(void *, pcitag_t
, int *,
49 pcireg_t (*pc_conf_read
)(void *, pcitag_t
, int);
50 void (*pc_conf_write
)(void *, pcitag_t
, int, pcireg_t
);
52 int (*pc_intr_map
)(struct pci_attach_args
*,
54 const char *(*pc_intr_string
)(void *, pci_intr_handle_t
);
55 void *(*pc_intr_establish
)(void *, pci_intr_handle_t
,
56 int, int (*)(void *), void *);
57 void (*pc_intr_disestablish
)(void *, void *);
59 void *(*pc_alloc_parent
)(device_t
,
60 struct pci_attach_args
*, int);
64 * Functions provided to machine-independent PCI code.
66 #define pci_attach_hook(p, s, pba) \
67 (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
68 #define pci_bus_maxdevs(c, b) \
69 (*(c)->pc_bus_maxdevs)((c)->_cookie, (b))
70 #define pci_make_tag(c, b, d, f) \
71 (*(c)->pc_make_tag)((c)->_cookie, (b), (d), (f))
72 #define pci_decompose_tag(c, t, bp, dp, fp) \
73 (*(c)->pc_decompose_tag)((c)->_cookie, (t), (bp), (dp), (fp))
74 #define pci_conf_read(c, t, r) \
75 (*(c)->pc_conf_read)((c)->_cookie, (t), (r))
76 #define pci_conf_write(c, t, r, v) \
77 (*(c)->pc_conf_write)((c)->_cookie, (t), (r), (v))
78 #define pci_intr_map(p, ihp) \
79 (*(p)->pa_pc->pc_intr_map)((p), (ihp))
80 #define pci_intr_line(ih) (ih)
81 #define pci_intr_string(c, ih) \
82 (*(c)->pc_intr_string)((c)->_cookie, (ih))
83 #define pci_intr_establish(c, ih, l, h, a) \
84 (*(c)->pc_intr_establish)((c)->_cookie, (ih), (l), (h), (a))
85 #define pci_intr_disestablish(c, iv) \
86 (*(c)->pc_intr_disestablish)((c)->_cookie, (iv))
88 #define pciide_machdep_compat_intr_establish(a, b, c, d, e) (NULL)
89 #define pciide_machdep_compat_intr_disestablish(a, b) ((void)(a), (void)(b))
91 #define pci_intr_evcnt(a, b) (NULL)
93 #endif /* _MACHINE_PCI_MACHDEP_H_ */