1/*	$NetBSD: pci_machdep.h,v 1.1 2006/09/01 21:26:18 uwe Exp $	*/
2
3/*
4 * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
5 * Copyright (c) 1994 Charles M. Hannum.  All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
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.
15 * 3. All advertising materials mentioning features or use of this software
16 *    must display the following acknowledgement:
17 *	This product includes software developed by Charles M. Hannum.
18 * 4. The name of the author may not be used to endorse or promote products
19 *    derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifndef _LANDISK_PCI_MACHDEP_H
34#define _LANDISK_PCI_MACHDEP_H
35
36/*
37 * Machine-specific definitions for PCI autoconfiguration.
38 */
39#define	__HAVE_PCI_CONF_HOOK
40
41/*
42 * Types provided to machine-independent PCI code
43 */
44typedef void *pci_chipset_tag_t;
45typedef int pcitag_t;
46typedef int pci_intr_handle_t;
47
48#include <sh3/dev/shpcicvar.h>
49
50/*
51 * Forward declarations.
52 */
53struct pci_attach_args;
54
55/*
56 * Functions provided to machine-independent PCI code.
57 */
58void landisk_pci_attach_hook(struct device *, struct device *,
59    struct pcibus_attach_args *);
60int landisk_pci_intr_map(const struct pci_attach_args *, pci_intr_handle_t *);
61const char *landisk_pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t);
62const struct evcnt *landisk_pci_intr_evcnt(pci_chipset_tag_t,pci_intr_handle_t);
63void *landisk_pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, int,
64    int (*)(void *), void *);
65void landisk_pci_intr_disestablish(pci_chipset_tag_t, void *);
66void landisk_pci_conf_interrupt(void *v, int bus, int dev, int pin,
67    int swiz, int *iline);
68int landisk_pci_conf_hook(void *, int, int, int, pcireg_t);
69
70#define	pci_bus_maxdevs(v, busno) \
71	shpcic_bus_maxdevs(v, busno)
72#define	pci_make_tag(v, bus, dev, func) \
73	shpcic_make_tag(v, bus, dev, func)
74#define	pci_decompose_tag(v, tag, bp, dp, fp) \
75	shpcic_decompose_tag(v, tag, bp, dp, fp)
76#define	pci_conf_read(v, tag, reg) \
77	shpcic_conf_read(v, tag, reg)
78#define	pci_conf_write(v, tag, reg, data) \
79	shpcic_conf_write(v, tag, reg, data)
80
81#define	pci_attach_hook(pa, self, pba) \
82	landisk_pci_attach_hook(pa, self, pba)
83#define	pci_intr_map(pa, ihp) \
84	landisk_pci_intr_map(pa, ihp)
85#define	pci_intr_string(v, ih) \
86	landisk_pci_intr_string(v, ih)
87#define	pci_intr_evcnt(v, ih) \
88	landisk_pci_intr_evcnt(v, ih)
89#define	pci_intr_establish(v, ih, level, ih_fun, ih_arg) \
90	landisk_pci_intr_establish(v, ih, level, ih_fun, ih_arg)
91#define	pci_intr_disestablish(v, cookie) \
92	landisk_pci_intr_disestablish(v, cookie)
93#define	pci_conf_interrupt(v, bus, dev, pin, swiz, iline) \
94	landisk_pci_conf_interrupt(v, bus, dev, pin, swiz, iline)
95#define	pci_conf_hook(v, bus, dev, func, id) \
96	landisk_pci_conf_hook(v, bus, dev, func, id)
97
98#ifdef _KERNEL
99/*
100 * ALL OF THE FOLLOWING ARE MACHINE-DEPENDENT, AND SHOULD NOT BE USED
101 * BY PORTABLE CODE.
102 */
103#endif
104
105#endif /* _LANDISK_PCI_MACHDEP_H */
106