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