1*1772Sjl139090 /* 2*1772Sjl139090 * CDDL HEADER START 3*1772Sjl139090 * 4*1772Sjl139090 * The contents of this file are subject to the terms of the 5*1772Sjl139090 * Common Development and Distribution License (the "License"). 6*1772Sjl139090 * You may not use this file except in compliance with the License. 7*1772Sjl139090 * 8*1772Sjl139090 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*1772Sjl139090 * or http://www.opensolaris.org/os/licensing. 10*1772Sjl139090 * See the License for the specific language governing permissions 11*1772Sjl139090 * and limitations under the License. 12*1772Sjl139090 * 13*1772Sjl139090 * When distributing Covered Code, include this CDDL HEADER in each 14*1772Sjl139090 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*1772Sjl139090 * If applicable, add the following below this CDDL HEADER, with the 16*1772Sjl139090 * fields enclosed by brackets "[]" replaced with your own identifying 17*1772Sjl139090 * information: Portions Copyright [yyyy] [name of copyright owner] 18*1772Sjl139090 * 19*1772Sjl139090 * CDDL HEADER END 20*1772Sjl139090 */ 21*1772Sjl139090 /* 22*1772Sjl139090 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23*1772Sjl139090 * Use is subject to license terms. 24*1772Sjl139090 */ 25*1772Sjl139090 26*1772Sjl139090 #ifndef _SYS_PCMU_UTIL_H 27*1772Sjl139090 #define _SYS_PCMU_UTIL_H 28*1772Sjl139090 29*1772Sjl139090 #pragma ident "%Z%%M% %I% %E% SMI" 30*1772Sjl139090 31*1772Sjl139090 #ifdef __cplusplus 32*1772Sjl139090 extern "C" { 33*1772Sjl139090 #endif 34*1772Sjl139090 35*1772Sjl139090 36*1772Sjl139090 /* 37*1772Sjl139090 * Prototypes 38*1772Sjl139090 */ 39*1772Sjl139090 extern int pcmu_init_child(pcmu_t *, dev_info_t *); 40*1772Sjl139090 extern int pcmu_uninit_child(pcmu_t *, dev_info_t *); 41*1772Sjl139090 extern int pcmu_report_dev(dev_info_t *); 42*1772Sjl139090 extern int get_pcmu_properties(pcmu_t *, dev_info_t *); 43*1772Sjl139090 extern void free_pcmu_properties(pcmu_t *); 44*1772Sjl139090 extern int pcmu_get_portid(dev_info_t *); 45*1772Sjl139090 extern int pcmu_reloc_reg(dev_info_t *, dev_info_t *, pcmu_t *, 46*1772Sjl139090 pci_regspec_t *); 47*1772Sjl139090 extern int pcmu_xlate_reg(pcmu_t *, pci_regspec_t *, struct regspec *); 48*1772Sjl139090 extern off_t pcmu_get_reg_set_size(dev_info_t *, int); 49*1772Sjl139090 extern uint_t pcmu_get_nreg_set(dev_info_t *); 50*1772Sjl139090 extern uint64_t pcmu_get_cfg_pabase(pcmu_t *); 51*1772Sjl139090 extern int pcmu_cfg_report(dev_info_t *, ddi_fm_error_t *, 52*1772Sjl139090 pcmu_errstate_t *, int, uint32_t); 53*1772Sjl139090 54*1772Sjl139090 #ifdef DEBUG 55*1772Sjl139090 56*1772Sjl139090 extern uint64_t pcmu_debug_flags; 57*1772Sjl139090 58*1772Sjl139090 typedef struct pcmu_dflag_to_str { 59*1772Sjl139090 uint64_t flag; 60*1772Sjl139090 char *string; 61*1772Sjl139090 } pcmu_dflag_to_str_t; 62*1772Sjl139090 63*1772Sjl139090 #define PCMU_DBG_ATTACH 0x1ull 64*1772Sjl139090 #define PCMU_DBG_DETACH 0x2ull 65*1772Sjl139090 #define PCMU_DBG_MAP 0x4ull 66*1772Sjl139090 #define PCMU_DBG_A_INTX 0x8ull 67*1772Sjl139090 #define PCMU_DBG_R_INTX 0x10ull 68*1772Sjl139090 #define PCMU_DBG_INIT_CLD 0x20ull 69*1772Sjl139090 #define PCMU_DBG_CTLOPS 0x40ull 70*1772Sjl139090 #define PCMU_DBG_INTR 0x80ull 71*1772Sjl139090 #define PCMU_DBG_ERR_INTR 0x100ull 72*1772Sjl139090 #define PCMU_DBG_BUS_FAULT 0x200ull 73*1772Sjl139090 #define PCMU_DBG_IB (0x20ull << 32) 74*1772Sjl139090 #define PCMU_DBG_CB (0x40ull << 32) 75*1772Sjl139090 #define PCMU_DBG_PBM (0x80ull << 32) 76*1772Sjl139090 #define PCMU_DBG_CONT (0x100ull << 32) 77*1772Sjl139090 #define PCMU_DBG_OPEN (0x1000ull << 32) 78*1772Sjl139090 #define PCMU_DBG_CLOSE (0x2000ull << 32) 79*1772Sjl139090 #define PCMU_DBG_IOCTL (0x4000ull << 32) 80*1772Sjl139090 #define PCMU_DBG_PWR (0x8000ull << 32) 81*1772Sjl139090 82*1772Sjl139090 83*1772Sjl139090 #define PCMU_DBG0(flag, dip, fmt) \ 84*1772Sjl139090 pcmu_debug(flag, dip, fmt, 0, 0, 0, 0, 0); 85*1772Sjl139090 86*1772Sjl139090 #define PCMU_DBG1(flag, dip, fmt, a1) \ 87*1772Sjl139090 pcmu_debug(flag, dip, fmt, (uintptr_t)(a1), 0, 0, 0, 0); 88*1772Sjl139090 89*1772Sjl139090 #define PCMU_DBG2(flag, dip, fmt, a1, a2) \ 90*1772Sjl139090 pcmu_debug(flag, dip, fmt, (uintptr_t)(a1), (uintptr_t)(a2), 0, 0, 0); 91*1772Sjl139090 92*1772Sjl139090 #define PCMU_DBG3(flag, dip, fmt, a1, a2, a3) \ 93*1772Sjl139090 pcmu_debug(flag, dip, fmt, (uintptr_t)(a1), \ 94*1772Sjl139090 (uintptr_t)(a2), (uintptr_t)(a3), 0, 0); 95*1772Sjl139090 96*1772Sjl139090 #define PCMU_DBG4(flag, dip, fmt, a1, a2, a3, a4) \ 97*1772Sjl139090 pcmu_debug(flag, dip, fmt, (uintptr_t)(a1), \ 98*1772Sjl139090 (uintptr_t)(a2), (uintptr_t)(a3), \ 99*1772Sjl139090 (uintptr_t)(a4), 0); 100*1772Sjl139090 101*1772Sjl139090 #define PCMU_DBG5(flag, dip, fmt, a1, a2, a3, a4, a5) \ 102*1772Sjl139090 pcmu_debug(flag, dip, fmt, (uintptr_t)(a1), \ 103*1772Sjl139090 (uintptr_t)(a2), (uintptr_t)(a3), \ 104*1772Sjl139090 (uintptr_t)(a4), (uintptr_t)(a5)); 105*1772Sjl139090 106*1772Sjl139090 extern void pcmu_debug(uint64_t, dev_info_t *, char *, 107*1772Sjl139090 uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); 108*1772Sjl139090 #else /* DEBUG */ 109*1772Sjl139090 110*1772Sjl139090 #define PCMU_DBG0(flag, dip, fmt) 111*1772Sjl139090 #define PCMU_DBG1(flag, dip, fmt, a1) 112*1772Sjl139090 #define PCMU_DBG2(flag, dip, fmt, a1, a2) 113*1772Sjl139090 #define PCMU_DBG3(flag, dip, fmt, a1, a2, a3) 114*1772Sjl139090 #define PCMU_DBG4(flag, dip, fmt, a1, a2, a3, a4) 115*1772Sjl139090 #define PCMU_DBG5(flag, dip, fmt, a1, a2, a3, a4, a5) 116*1772Sjl139090 117*1772Sjl139090 #endif /* DEBUG */ 118*1772Sjl139090 119*1772Sjl139090 #ifdef __cplusplus 120*1772Sjl139090 } 121*1772Sjl139090 #endif 122*1772Sjl139090 123*1772Sjl139090 #endif /* _SYS_PCMU_UTIL_H */ 124