1 /* $NetBSD: pci_machdep.h,v 1.7 2022/10/31 15:57:52 martin 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 */ 44 typedef void *pci_chipset_tag_t; 45 typedef int pcitag_t; 46 typedef int pci_intr_handle_t; 47 48 #include <sh3/dev/shpcicvar.h> 49 50 /* 51 * Forward declarations. 52 */ 53 struct pci_attach_args; 54 55 /* 56 * Functions provided to machine-independent PCI code. 57 */ 58 void landisk_pci_attach_hook(device_t, device_t, 59 struct pcibus_attach_args *); 60 int landisk_pci_intr_map(const struct pci_attach_args *, pci_intr_handle_t *); 61 const char *landisk_pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t, 62 char *, size_t); 63 const struct evcnt *landisk_pci_intr_evcnt(pci_chipset_tag_t,pci_intr_handle_t); 64 void *landisk_pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, int, 65 int (*)(void *), void *); 66 void landisk_pci_intr_disestablish(pci_chipset_tag_t, void *); 67 void landisk_pci_conf_interrupt(void *v, int bus, int dev, int pin, 68 int swiz, int *iline); 69 int landisk_pci_conf_hook(void *, int, int, int, pcireg_t); 70 71 #define pci_bus_maxdevs(v, busno) \ 72 shpcic_bus_maxdevs(v, busno) 73 #define pci_make_tag(v, bus, dev, func) \ 74 shpcic_make_tag(v, bus, dev, func) 75 #define pci_decompose_tag(v, tag, bp, dp, fp) \ 76 shpcic_decompose_tag(v, tag, bp, dp, fp) 77 #define pci_conf_read(v, tag, reg) \ 78 shpcic_conf_read(v, tag, reg) 79 #define pci_conf_write(v, tag, reg, data) \ 80 shpcic_conf_write(v, tag, reg, data) 81 82 #define pci_attach_hook(pa, self, pba) \ 83 landisk_pci_attach_hook(pa, self, pba) 84 #define pci_intr_map(pa, ihp) \ 85 landisk_pci_intr_map(pa, ihp) 86 #define pci_intr_setattr(pa, ihp, attr, data) \ 87 landisk_pci_intr_setattr(pa, ihp, attr, data) 88 #define pci_intr_string(v, ih, buf, len) \ 89 landisk_pci_intr_string(v, ih, buf, len) 90 #define pci_intr_evcnt(v, ih) \ 91 landisk_pci_intr_evcnt(v, ih) 92 #define pci_intr_establish(v, ih, level, ih_fun, ih_arg) \ 93 landisk_pci_intr_establish(v, ih, level, ih_fun, ih_arg) 94 #define pci_intr_disestablish(v, cookie) \ 95 landisk_pci_intr_disestablish(v, cookie) 96 #define pci_conf_interrupt(v, bus, dev, pin, swiz, iline) \ 97 landisk_pci_conf_interrupt(v, bus, dev, pin, swiz, iline) 98 #define pci_conf_hook(v, bus, dev, func, id) \ 99 landisk_pci_conf_hook(v, bus, dev, func, id) 100 101 #ifdef _KERNEL 102 /* 103 * ALL OF THE FOLLOWING ARE MACHINE-DEPENDENT, AND SHOULD NOT BE USED 104 * BY PORTABLE CODE. 105 */ 106 #endif 107 108 #endif /* _LANDISK_PCI_MACHDEP_H */ 109