1 /* $NetBSD: pci_machdep.h,v 1.2 2002/05/15 19:23:52 thorpej Exp $ */ 2 3 /* 4 * Modified for arm32 by Mark Brinicombe 5 * 6 * from: sys/arch/alpha/pci/pci_machdep.h 7 * 8 * Copyright (c) 1996 Carnegie-Mellon University. 9 * All rights reserved. 10 * 11 * Author: Chris G. Demetriou 12 * 13 * Permission to use, copy, modify and distribute this software and 14 * its documentation is hereby granted, provided that both the copyright 15 * notice and this permission notice appear in all copies of the 16 * software, derivative works or modified versions, and any portions 17 * thereof, and that both notices appear in supporting documentation. 18 * 19 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 20 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 21 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 22 * 23 * Carnegie Mellon requests users of this software to return to 24 * 25 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 26 * School of Computer Science 27 * Carnegie Mellon University 28 * Pittsburgh PA 15213-3890 29 * 30 * any improvements or extensions that they make and grant Carnegie the 31 * rights to redistribute these changes. 32 */ 33 34 /* 35 * Machine-specific definitions for PCI autoconfiguration. 36 */ 37 38 /* 39 * Types provided to machine-independent PCI code 40 */ 41 typedef struct arm32_pci_chipset *pci_chipset_tag_t; 42 typedef u_long pcitag_t; 43 typedef u_long pci_intr_handle_t; 44 45 /* 46 * Forward declarations. 47 */ 48 struct pci_attach_args; 49 50 /* 51 * arm32-specific PCI structure and type definitions. 52 * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. 53 */ 54 struct arm32_pci_chipset { 55 void *pc_conf_v; 56 void (*pc_attach_hook)(struct device *, 57 struct device *, struct pcibus_attach_args *); 58 int (*pc_bus_maxdevs)(void *, int); 59 pcitag_t (*pc_make_tag)(void *, int, int, int); 60 void (*pc_decompose_tag)(void *, pcitag_t, int *, 61 int *, int *); 62 pcireg_t (*pc_conf_read)(void *, pcitag_t, int); 63 void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t); 64 65 void *pc_intr_v; 66 int (*pc_intr_map)(struct pci_attach_args *, 67 pci_intr_handle_t *); 68 const char *(*pc_intr_string)(void *, pci_intr_handle_t); 69 const struct evcnt *(*pc_intr_evcnt)(void *, pci_intr_handle_t); 70 void *(*pc_intr_establish)(void *, pci_intr_handle_t, 71 int, int (*)(void *), void *); 72 void (*pc_intr_disestablish)(void *, void *); 73 }; 74 75 /* 76 * Functions provided to machine-independent PCI code. 77 */ 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)->pc_conf_v, (b)) 82 #define pci_make_tag(c, b, d, f) \ 83 (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f)) 84 #define pci_decompose_tag(c, t, bp, dp, fp) \ 85 (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp)) 86 #define pci_conf_read(c, t, r) \ 87 (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r)) 88 #define pci_conf_write(c, t, r, v) \ 89 (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v)) 90 #define pci_intr_map(pa, ihp) \ 91 (*(pa)->pa_pc->pc_intr_map)((pa), (ihp)) 92 #define pci_intr_string(c, ih) \ 93 (*(c)->pc_intr_string)((c)->pc_intr_v, (ih)) 94 #define pci_intr_evcnt(c, ih) \ 95 (*(c)->pc_intr_evcnt)((c)->pc_intr_v, (ih)) 96 #define pci_intr_establish(c, ih, l, h, a) \ 97 (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a)) 98 #define pci_intr_disestablish(c, iv) \ 99 (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv)) 100 101 #define pci_enumerate_bus(sc, m, p) \ 102 pci_enumerate_bus_generic((sc), (m), (p)) 103