pci_machdep.h revision 1.1
11.1Sthorpej/* $NetBSD: pci_machdep.h,v 1.1 2001/05/28 16:22:19 thorpej Exp $ */ 21.1Sthorpej 31.1Sthorpej/* 41.1Sthorpej * Copyright (c) 1996 Carnegie-Mellon University. 51.1Sthorpej * All rights reserved. 61.1Sthorpej * 71.1Sthorpej * Author: Chris G. Demetriou 81.1Sthorpej * 91.1Sthorpej * Permission to use, copy, modify and distribute this software and 101.1Sthorpej * its documentation is hereby granted, provided that both the copyright 111.1Sthorpej * notice and this permission notice appear in all copies of the 121.1Sthorpej * software, derivative works or modified versions, and any portions 131.1Sthorpej * thereof, and that both notices appear in supporting documentation. 141.1Sthorpej * 151.1Sthorpej * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 161.1Sthorpej * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 171.1Sthorpej * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 181.1Sthorpej * 191.1Sthorpej * Carnegie Mellon requests users of this software to return to 201.1Sthorpej * 211.1Sthorpej * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 221.1Sthorpej * School of Computer Science 231.1Sthorpej * Carnegie Mellon University 241.1Sthorpej * Pittsburgh PA 15213-3890 251.1Sthorpej * 261.1Sthorpej * any improvements or extensions that they make and grant Carnegie the 271.1Sthorpej * rights to redistribute these changes. 281.1Sthorpej */ 291.1Sthorpej 301.1Sthorpej/* 311.1Sthorpej * Machine-specific definitions for PCI autoconfiguration. 321.1Sthorpej */ 331.1Sthorpej 341.1Sthorpej/* 351.1Sthorpej * Types provided to machine-independent PCI code 361.1Sthorpej */ 371.1Sthorpejtypedef struct algor_pci_chipset *pci_chipset_tag_t; 381.1Sthorpejtypedef u_long pcitag_t; 391.1Sthorpejtypedef u_long pci_intr_handle_t; 401.1Sthorpej 411.1Sthorpej/* 421.1Sthorpej * Forward declarations. 431.1Sthorpej */ 441.1Sthorpejstruct pci_attach_args; 451.1Sthorpej 461.1Sthorpej/* 471.1Sthorpej * algor-specific PCI structure and type definitions. 481.1Sthorpej * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. 491.1Sthorpej */ 501.1Sthorpejstruct algor_pci_chipset { 511.1Sthorpej void *pc_conf_v; 521.1Sthorpej void (*pc_attach_hook)(struct device *, 531.1Sthorpej struct device *, struct pcibus_attach_args *); 541.1Sthorpej int (*pc_bus_maxdevs)(void *, int); 551.1Sthorpej pcitag_t (*pc_make_tag)(void *, int, int, int); 561.1Sthorpej void (*pc_decompose_tag)(void *, pcitag_t, int *, 571.1Sthorpej int *, int *); 581.1Sthorpej pcireg_t (*pc_conf_read)(void *, pcitag_t, int); 591.1Sthorpej void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t); 601.1Sthorpej 611.1Sthorpej void *pc_intr_v; 621.1Sthorpej int (*pc_intr_map)(struct pci_attach_args *, 631.1Sthorpej pci_intr_handle_t *); 641.1Sthorpej const char *(*pc_intr_string)(void *, pci_intr_handle_t); 651.1Sthorpej const struct evcnt *(*pc_intr_evcnt)(void *, pci_intr_handle_t); 661.1Sthorpej void *(*pc_intr_establish)(void *, pci_intr_handle_t, 671.1Sthorpej int, int (*)(void *), void *); 681.1Sthorpej void (*pc_intr_disestablish)(void *, void *); 691.1Sthorpej 701.1Sthorpej void (*pc_conf_interrupt)(void *, int, int, int, 711.1Sthorpej int, int *); 721.1Sthorpej 731.1Sthorpej /* algor-specific */ 741.1Sthorpej void *(*pc_pciide_compat_intr_establish)(void *, 751.1Sthorpej struct device *, struct pci_attach_args *, int, 761.1Sthorpej int (*)(void *), void *); 771.1Sthorpej}; 781.1Sthorpej 791.1Sthorpej/* 801.1Sthorpej * Functions provided to machine-independent PCI code. 811.1Sthorpej */ 821.1Sthorpej#define pci_attach_hook(p, s, pba) \ 831.1Sthorpej (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba)) 841.1Sthorpej#define pci_bus_maxdevs(c, b) \ 851.1Sthorpej (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b)) 861.1Sthorpej#define pci_make_tag(c, b, d, f) \ 871.1Sthorpej (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f)) 881.1Sthorpej#define pci_decompose_tag(c, t, bp, dp, fp) \ 891.1Sthorpej (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp)) 901.1Sthorpej#define pci_conf_read(c, t, r) \ 911.1Sthorpej (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r)) 921.1Sthorpej#define pci_conf_write(c, t, r, v) \ 931.1Sthorpej (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v)) 941.1Sthorpej#define pci_intr_map(pa, ihp) \ 951.1Sthorpej (*(pa)->pa_pc->pc_intr_map)((pa), (ihp)) 961.1Sthorpej#define pci_intr_string(c, ih) \ 971.1Sthorpej (*(c)->pc_intr_string)((c)->pc_intr_v, (ih)) 981.1Sthorpej#define pci_intr_evcnt(c, ih) \ 991.1Sthorpej (*(c)->pc_intr_evcnt)((c)->pc_intr_v, (ih)) 1001.1Sthorpej#define pci_intr_establish(c, ih, l, h, a) \ 1011.1Sthorpej (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a)) 1021.1Sthorpej#define pci_intr_disestablish(c, iv) \ 1031.1Sthorpej (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv)) 1041.1Sthorpej#define pci_conf_interrupt(c, b, d, f, s, lp) \ 1051.1Sthorpej (*(c)->pc_conf_interrupt)((c)->pc_intr_v, (b), (d), (f), (s), (lp)) 1061.1Sthorpej 1071.1Sthorpej/* 1081.1Sthorpej * algor-specific PCI functions. 1091.1Sthorpej * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. 1101.1Sthorpej */ 1111.1Sthorpej#define algor_pciide_compat_intr_establish(c, d, p, ch, f, a) \ 1121.1Sthorpej ((c)->pc_pciide_compat_intr_establish == NULL ? NULL : \ 1131.1Sthorpej (*(c)->pc_pciide_compat_intr_establish)((c)->pc_conf_v, (d), (p), \ 1141.1Sthorpej (ch), (f), (a))) 1151.1Sthorpej 1161.1Sthorpejint algor_get_ethaddr(struct pci_attach_args *, u_int8_t *); 117