1*8542SHaik.Aftandilian@Sun.COM /* 2*8542SHaik.Aftandilian@Sun.COM * CDDL HEADER START 3*8542SHaik.Aftandilian@Sun.COM * 4*8542SHaik.Aftandilian@Sun.COM * The contents of this file are subject to the terms of the 5*8542SHaik.Aftandilian@Sun.COM * Common Development and Distribution License (the "License"). 6*8542SHaik.Aftandilian@Sun.COM * You may not use this file except in compliance with the License. 7*8542SHaik.Aftandilian@Sun.COM * 8*8542SHaik.Aftandilian@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*8542SHaik.Aftandilian@Sun.COM * or http://www.opensolaris.org/os/licensing. 10*8542SHaik.Aftandilian@Sun.COM * See the License for the specific language governing permissions 11*8542SHaik.Aftandilian@Sun.COM * and limitations under the License. 12*8542SHaik.Aftandilian@Sun.COM * 13*8542SHaik.Aftandilian@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 14*8542SHaik.Aftandilian@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*8542SHaik.Aftandilian@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 16*8542SHaik.Aftandilian@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 17*8542SHaik.Aftandilian@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 18*8542SHaik.Aftandilian@Sun.COM * 19*8542SHaik.Aftandilian@Sun.COM * CDDL HEADER END 20*8542SHaik.Aftandilian@Sun.COM */ 21*8542SHaik.Aftandilian@Sun.COM /* 22*8542SHaik.Aftandilian@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23*8542SHaik.Aftandilian@Sun.COM * Use is subject to license terms. 24*8542SHaik.Aftandilian@Sun.COM */ 25*8542SHaik.Aftandilian@Sun.COM 26*8542SHaik.Aftandilian@Sun.COM #include <sys/param.h> 27*8542SHaik.Aftandilian@Sun.COM 28*8542SHaik.Aftandilian@Sun.COM /* 29*8542SHaik.Aftandilian@Sun.COM * In-Kernel Logical Domain Channel (LDC) Functionality 30*8542SHaik.Aftandilian@Sun.COM * 31*8542SHaik.Aftandilian@Sun.COM * Provides a mechanism for LDC channels to be reset when entering 32*8542SHaik.Aftandilian@Sun.COM * the prom or kmdb by invoking a callback before entry. 33*8542SHaik.Aftandilian@Sun.COM */ 34*8542SHaik.Aftandilian@Sun.COM 35*8542SHaik.Aftandilian@Sun.COM /* 36*8542SHaik.Aftandilian@Sun.COM * Setting this to zero disables debug_enter/debug_exit callbacks 37*8542SHaik.Aftandilian@Sun.COM * which may be useful when debugging LDC related issues. 38*8542SHaik.Aftandilian@Sun.COM */ 39*8542SHaik.Aftandilian@Sun.COM static int kldc_callback_enabled = 1; 40*8542SHaik.Aftandilian@Sun.COM 41*8542SHaik.Aftandilian@Sun.COM /* 42*8542SHaik.Aftandilian@Sun.COM * Callback function pointer. 43*8542SHaik.Aftandilian@Sun.COM */ 44*8542SHaik.Aftandilian@Sun.COM static void (*kldc_debug_enter_cb)(void); 45*8542SHaik.Aftandilian@Sun.COM 46*8542SHaik.Aftandilian@Sun.COM void kldc_set_debug_cb(void (* debug_enter_cb)(void))47*8542SHaik.Aftandilian@Sun.COMkldc_set_debug_cb(void (*debug_enter_cb)(void)) 48*8542SHaik.Aftandilian@Sun.COM { 49*8542SHaik.Aftandilian@Sun.COM kldc_debug_enter_cb = debug_enter_cb; 50*8542SHaik.Aftandilian@Sun.COM } 51*8542SHaik.Aftandilian@Sun.COM 52*8542SHaik.Aftandilian@Sun.COM /* 53*8542SHaik.Aftandilian@Sun.COM * Called just before entering the prom or kmdb but after all other CPUs 54*8542SHaik.Aftandilian@Sun.COM * have entered the idle loop. 55*8542SHaik.Aftandilian@Sun.COM */ 56*8542SHaik.Aftandilian@Sun.COM void kldc_debug_enter(void)57*8542SHaik.Aftandilian@Sun.COMkldc_debug_enter(void) 58*8542SHaik.Aftandilian@Sun.COM { 59*8542SHaik.Aftandilian@Sun.COM if (kldc_callback_enabled != 0 && kldc_debug_enter_cb != NULL) { 60*8542SHaik.Aftandilian@Sun.COM (*kldc_debug_enter_cb)(); 61*8542SHaik.Aftandilian@Sun.COM } 62*8542SHaik.Aftandilian@Sun.COM } 63