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