1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_DB21554_DEBUG_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_DB21554_DEBUG_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 33*7c478bd9Sstevel@tonic-gate extern "C" { 34*7c478bd9Sstevel@tonic-gate #endif 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #if defined(DEBUG) 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate /* driver modload functions */ 39*7c478bd9Sstevel@tonic-gate #define DB_INIT 0x10 40*7c478bd9Sstevel@tonic-gate #define DB_FINI 0x11 41*7c478bd9Sstevel@tonic-gate #define DB_INFO 0x12 42*7c478bd9Sstevel@tonic-gate #define DB_GETINFO 0x13 43*7c478bd9Sstevel@tonic-gate /* driver initialization functions */ 44*7c478bd9Sstevel@tonic-gate #define DB_INIT_FUNCS 0x100 45*7c478bd9Sstevel@tonic-gate #define DB_ATTACH 0x100 46*7c478bd9Sstevel@tonic-gate #define DB_DETACH 0x101 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate /* driver child initialization functions */ 49*7c478bd9Sstevel@tonic-gate #define DB_CTLOPS 0x1000 50*7c478bd9Sstevel@tonic-gate #define DB_INITCHILD 0x1001 51*7c478bd9Sstevel@tonic-gate #define DB_REMOVECHILD 0x1002 52*7c478bd9Sstevel@tonic-gate #define DB_INTR_OPS 0x1003 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gate /* child driver services invoked during runtime */ 55*7c478bd9Sstevel@tonic-gate #define DB_PCI_MAP 0x10000 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate /* CPR functions */ 58*7c478bd9Sstevel@tonic-gate #define DB_SAVE_CONF_REGS 0x100000 59*7c478bd9Sstevel@tonic-gate #define DB_REST_CONF_REGS 0x100001 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gate /* interrupt function */ 62*7c478bd9Sstevel@tonic-gate #define DB_INTR 0x1000000 63*7c478bd9Sstevel@tonic-gate 64*7c478bd9Sstevel@tonic-gate /* application call functions */ 65*7c478bd9Sstevel@tonic-gate #define DB_OPEN 0x10000000 66*7c478bd9Sstevel@tonic-gate #define DB_CLOSE 0x10000001 67*7c478bd9Sstevel@tonic-gate #define DB_IOCTL 0x10000002 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate /* DVMA functions */ 70*7c478bd9Sstevel@tonic-gate #define DB_DVMA 0x100000000 71*7c478bd9Sstevel@tonic-gate 72*7c478bd9Sstevel@tonic-gate /* Function types, to be assigned to db_debug_funcs variable below. */ 73*7c478bd9Sstevel@tonic-gate #define DB_MODLOAD_FUNCS 0x10 74*7c478bd9Sstevel@tonic-gate #define DB_CHILD_FUNCS 0x1000 75*7c478bd9Sstevel@tonic-gate #define DB_PCI_MEM_FUNCS 0x10000 76*7c478bd9Sstevel@tonic-gate #define DB_CPR_FUNCS 0x100000 77*7c478bd9Sstevel@tonic-gate #define DB_INTR_FUNCS 0x1000000 78*7c478bd9Sstevel@tonic-gate #define DB_APPL_FUNCS 0x10000000 79*7c478bd9Sstevel@tonic-gate #define DB_DVMA_FUNCS 0x100000000 80*7c478bd9Sstevel@tonic-gate 81*7c478bd9Sstevel@tonic-gate /* 82*7c478bd9Sstevel@tonic-gate * db_debug_funcs indicates the function types from which the debug messages 83*7c478bd9Sstevel@tonic-gate * are to be displayed. 84*7c478bd9Sstevel@tonic-gate * For example: Set db_debug_funcs = DB_CHILD_FUNCS | DB_PCI_MEM_FUNCS; 85*7c478bd9Sstevel@tonic-gate * to display debug statements in memory map function (DB_PCI_MEM_FUNCS) and 86*7c478bd9Sstevel@tonic-gate * child driver initialization function (DB_CHILD_FUNCS). 87*7c478bd9Sstevel@tonic-gate * 88*7c478bd9Sstevel@tonic-gate * See above for a list of all function types that can be assigned. 89*7c478bd9Sstevel@tonic-gate */ 90*7c478bd9Sstevel@tonic-gate static uint64_t db_debug_funcs = 0; 91*7c478bd9Sstevel@tonic-gate 92*7c478bd9Sstevel@tonic-gate /* 93*7c478bd9Sstevel@tonic-gate * the following flag can be used to the first argument of db_debug 94*7c478bd9Sstevel@tonic-gate * when dip information need not be displayed along with the actual 95*7c478bd9Sstevel@tonic-gate * function debug message. By default it is always displayed. 96*7c478bd9Sstevel@tonic-gate */ 97*7c478bd9Sstevel@tonic-gate #define DB_DONT_DISPLAY_DIP 0x1000000000000000 98*7c478bd9Sstevel@tonic-gate 99*7c478bd9Sstevel@tonic-gate #define DB_DEBUG0(func_id, dip, fmt) \ 100*7c478bd9Sstevel@tonic-gate db_debug(func_id, dip, fmt, 0, 0, 0, 0, 0); 101*7c478bd9Sstevel@tonic-gate #define DB_DEBUG1(func_id, dip, fmt, a1) \ 102*7c478bd9Sstevel@tonic-gate db_debug(func_id, dip, fmt, (uintptr_t)(a1), 0, 0, 0, 0); 103*7c478bd9Sstevel@tonic-gate #define DB_DEBUG2(func_id, dip, fmt, a1, a2) \ 104*7c478bd9Sstevel@tonic-gate db_debug(func_id, dip, fmt, (uintptr_t)(a1), (uintptr_t)(a2), 0, 0, 0); 105*7c478bd9Sstevel@tonic-gate #define DB_DEBUG3(func_id, dip, fmt, a1, a2, a3) \ 106*7c478bd9Sstevel@tonic-gate db_debug(func_id, dip, fmt, (uintptr_t)(a1), \ 107*7c478bd9Sstevel@tonic-gate (uintptr_t)(a2), (uintptr_t)(a3), 0, 0); 108*7c478bd9Sstevel@tonic-gate #define DB_DEBUG4(func_id, dip, fmt, a1, a2, a3, a4) \ 109*7c478bd9Sstevel@tonic-gate db_debug(func_id, dip, fmt, (uintptr_t)(a1), \ 110*7c478bd9Sstevel@tonic-gate (uintptr_t)(a2), (uintptr_t)(a3), \ 111*7c478bd9Sstevel@tonic-gate (uintptr_t)(a4), 0); 112*7c478bd9Sstevel@tonic-gate #define DB_DEBUG5(func_id, dip, fmt, a1, a2, a3, a4, a5) \ 113*7c478bd9Sstevel@tonic-gate db_debug(func_id, dip, fmt, (uintptr_t)(a1), \ 114*7c478bd9Sstevel@tonic-gate (uintptr_t)(a2), (uintptr_t)(a3), \ 115*7c478bd9Sstevel@tonic-gate (uintptr_t)(a4), (uintptr_t)(a5)); 116*7c478bd9Sstevel@tonic-gate 117*7c478bd9Sstevel@tonic-gate #else 118*7c478bd9Sstevel@tonic-gate 119*7c478bd9Sstevel@tonic-gate #define DB_DEBUG0(func_id, dip, fmt) 120*7c478bd9Sstevel@tonic-gate #define DB_DEBUG1(func_id, dip, fmt, a1) 121*7c478bd9Sstevel@tonic-gate #define DB_DEBUG2(func_id, dip, fmt, a1, a2) 122*7c478bd9Sstevel@tonic-gate #define DB_DEBUG3(func_id, dip, fmt, a1, a2, a3) 123*7c478bd9Sstevel@tonic-gate #define DB_DEBUG4(func_id, dip, fmt, a1, a2, a3, a4) 124*7c478bd9Sstevel@tonic-gate #define DB_DEBUG5(func_id, dip, fmt, a1, a2, a3, a4, a5) 125*7c478bd9Sstevel@tonic-gate #endif 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 128*7c478bd9Sstevel@tonic-gate } 129*7c478bd9Sstevel@tonic-gate #endif 130*7c478bd9Sstevel@tonic-gate 131*7c478bd9Sstevel@tonic-gate #endif /* _SYS_DB21554_DEBUG_H */ 132