1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_PCI_DEBUG_H 28*0Sstevel@tonic-gate #define _SYS_PCI_DEBUG_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #ifdef __cplusplus 33*0Sstevel@tonic-gate extern "C" { 34*0Sstevel@tonic-gate #endif 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate typedef struct pci_debug_flag_to_string { 37*0Sstevel@tonic-gate uint64_t flag; 38*0Sstevel@tonic-gate char *string; 39*0Sstevel@tonic-gate } pci_debug_flag_to_string_t; 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate #if defined(DEBUG) 42*0Sstevel@tonic-gate #define DBG_ATTACH 0x1ull 43*0Sstevel@tonic-gate #define DBG_DETACH 0x2ull 44*0Sstevel@tonic-gate 45*0Sstevel@tonic-gate #define DBG_MAP 0x4ull 46*0Sstevel@tonic-gate #define DBG_RSV1 0x10ull 47*0Sstevel@tonic-gate #define DBG_A_INTX 0x20ull 48*0Sstevel@tonic-gate #define DBG_R_INTX 0x40ull 49*0Sstevel@tonic-gate #define DBG_INIT_CLD 0x80ull 50*0Sstevel@tonic-gate 51*0Sstevel@tonic-gate #define DBG_CTLOPS 0x100ull 52*0Sstevel@tonic-gate #define DBG_INTR 0x200ull 53*0Sstevel@tonic-gate #define DBG_ERR_INTR 0x400ull 54*0Sstevel@tonic-gate #define DBG_BUS_FAULT 0x800ull 55*0Sstevel@tonic-gate 56*0Sstevel@tonic-gate #define DBG_DMA_ALLOCH 0x10000ull 57*0Sstevel@tonic-gate #define DBG_DMA_FREEH 0x20000ull 58*0Sstevel@tonic-gate #define DBG_DMA_BINDH 0x40000ull 59*0Sstevel@tonic-gate #define DBG_DMA_UNBINDH 0x80000ull 60*0Sstevel@tonic-gate 61*0Sstevel@tonic-gate #define DBG_DMA_MAP 0x100000ull 62*0Sstevel@tonic-gate #define DBG_CHK_MOD 0x200000ull 63*0Sstevel@tonic-gate #define DBG_BYPASS 0x400000ull 64*0Sstevel@tonic-gate #define DBG_IOMMU 0x800000ull 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate #define DBG_DMA_WIN 0x1000000ull 67*0Sstevel@tonic-gate #define DBG_MAP_WIN 0x2000000ull 68*0Sstevel@tonic-gate #define DBG_UNMAP_WIN 0x4000000ull 69*0Sstevel@tonic-gate #define DBG_DMA_CTL 0x8000000ull 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gate #define DBG_DMA_SYNC 0x10000000ull 72*0Sstevel@tonic-gate #define DBG_DMA_SYNC_PBM 0x20000000ull 73*0Sstevel@tonic-gate #define DBG_FAST_DVMA 0x40000000ull 74*0Sstevel@tonic-gate 75*0Sstevel@tonic-gate #define DBG_SC (0x10ull << 32) 76*0Sstevel@tonic-gate #define DBG_IB (0x20ull << 32) 77*0Sstevel@tonic-gate #define DBG_CB (0x40ull << 32) 78*0Sstevel@tonic-gate #define DBG_PBM (0x80ull << 32) 79*0Sstevel@tonic-gate 80*0Sstevel@tonic-gate #define DBG_CONT (0x100ull << 32) 81*0Sstevel@tonic-gate 82*0Sstevel@tonic-gate #define DBG_OPEN (0x1000ull << 32) 83*0Sstevel@tonic-gate #define DBG_CLOSE (0x2000ull << 32) 84*0Sstevel@tonic-gate #define DBG_IOCTL (0x4000ull << 32) 85*0Sstevel@tonic-gate #define DBG_PWR (0x8000ull << 32) 86*0Sstevel@tonic-gate 87*0Sstevel@tonic-gate #define DBG_RELOC (0x10000ull << 32) 88*0Sstevel@tonic-gate #define DBG_TOOLS (0x40000ull << 32) 89*0Sstevel@tonic-gate #define DBG_PHYS_ACC (0x80000ull << 32) 90*0Sstevel@tonic-gate 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate 93*0Sstevel@tonic-gate #define DEBUG0(flag, dip, fmt) \ 94*0Sstevel@tonic-gate pci_debug(flag, dip, fmt, 0, 0, 0, 0, 0); 95*0Sstevel@tonic-gate #define DEBUG1(flag, dip, fmt, a1) \ 96*0Sstevel@tonic-gate pci_debug(flag, dip, fmt, (uintptr_t)(a1), 0, 0, 0, 0); 97*0Sstevel@tonic-gate #define DEBUG2(flag, dip, fmt, a1, a2) \ 98*0Sstevel@tonic-gate pci_debug(flag, dip, fmt, (uintptr_t)(a1), (uintptr_t)(a2), 0, 0, 0); 99*0Sstevel@tonic-gate #define DEBUG3(flag, dip, fmt, a1, a2, a3) \ 100*0Sstevel@tonic-gate pci_debug(flag, dip, fmt, (uintptr_t)(a1), \ 101*0Sstevel@tonic-gate (uintptr_t)(a2), (uintptr_t)(a3), 0, 0); 102*0Sstevel@tonic-gate #define DEBUG4(flag, dip, fmt, a1, a2, a3, a4) \ 103*0Sstevel@tonic-gate pci_debug(flag, dip, fmt, (uintptr_t)(a1), \ 104*0Sstevel@tonic-gate (uintptr_t)(a2), (uintptr_t)(a3), \ 105*0Sstevel@tonic-gate (uintptr_t)(a4), 0); 106*0Sstevel@tonic-gate #define DEBUG5(flag, dip, fmt, a1, a2, a3, a4, a5) \ 107*0Sstevel@tonic-gate pci_debug(flag, dip, fmt, (uintptr_t)(a1), \ 108*0Sstevel@tonic-gate (uintptr_t)(a2), (uintptr_t)(a3), \ 109*0Sstevel@tonic-gate (uintptr_t)(a4), (uintptr_t)(a5)); 110*0Sstevel@tonic-gate 111*0Sstevel@tonic-gate extern void pci_debug(uint64_t, dev_info_t *, char *, 112*0Sstevel@tonic-gate uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); 113*0Sstevel@tonic-gate #else 114*0Sstevel@tonic-gate #define DEBUG0(flag, dip, fmt) 115*0Sstevel@tonic-gate #define DEBUG1(flag, dip, fmt, a1) 116*0Sstevel@tonic-gate #define DEBUG2(flag, dip, fmt, a1, a2) 117*0Sstevel@tonic-gate #define DEBUG3(flag, dip, fmt, a1, a2, a3) 118*0Sstevel@tonic-gate #define DEBUG4(flag, dip, fmt, a1, a2, a3, a4) 119*0Sstevel@tonic-gate #define DEBUG5(flag, dip, fmt, a1, a2, a3, a4, a5) 120*0Sstevel@tonic-gate #endif 121*0Sstevel@tonic-gate 122*0Sstevel@tonic-gate #ifdef __cplusplus 123*0Sstevel@tonic-gate } 124*0Sstevel@tonic-gate #endif 125*0Sstevel@tonic-gate 126*0Sstevel@tonic-gate #endif /* _SYS_PCI_DEBUG_H */ 127