/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
*
* - IBTF logging support
*/
/* Function Prototypes */
static void ibtf_clear_print_buf();
/*
* Print Buffer protected by mutex for debug stuff. The mutex also
* ensures serializing debug messages.
*/
/*
* Debug Stuff.
*/
#ifdef DEBUG
#else
#endif /* DEBUG */
/*
* Function:
* ibtl_ib2usec_init
* Input:
* none
* Output:
* none
* Returns:
* none
* Description:
* Initialize ibtl_ib2usec_tbl[64] for use by ibt_usec2ib and ibt_ib2usec.
*/
void
ibtl_ib2usec_init(void)
{
int i;
for (i = 0; i < 64; i++) {
if (i < 51) { /* shift first to avoid underflow */
} else if (i < 61) { /* divide first to avoid overflow */
} else { /* max'ed out, so use MAX LONGLONG */
ibtl_ib2usec_tbl[i] = 0x7FFFFFFFFFFFFFFFLL;
}
#if !defined(_LP64)
if (ibtl_ib2usec_tbl[i] > LONG_MAX)
ibtl_ib2usec_tbl[i] = LONG_MAX;
#endif
}
}
/*
* Function:
* ibt_usec2ib
* Input:
* time_val - Time in microsecs.
* Output:
* none
* Returns:
* Nearest IB Timeout Exponent value.
* Description:
* This function converts the standard input time in microseconds to
* IB's 6 bits of timeout exponent, calculated based on
* time = 4.096us * 2 ^ exp. This is done by searching through
* the ibtl_ib2usec_tbl for the closest value >= time_val.
*/
{
int i;
/* First, leap through the table by 4 entries at a time */
;
/* Find the return value; it's now between i and i + 4, inclusive */
while (ibtl_ib2usec_tbl[i] < time_val)
i++;
return (i);
}
/*
* Function:
* ibt_ib2usec
* Input:
* ib_time - IB Timeout Exponent value.
* Output:
* none
* Returns:
* Standard Time is microseconds.
* Description:
* This function converts the input IB timeout exponent (6 bits) to
* standard time in microseconds, calculated based on
* time = 4.096us * 2 ^ exp.
* This is implemented as a simple index into ibtl_ib2usec_tbl[].
*/
{
}
/* IBTF logging init */
void
{
}
/* if it is less that IBTF_MIN_DEBUG_BUF_SIZE, adjust it */
"%x, adjusted to %x", ibtf_debug_buf_size,
}
}
/* IBTF logging destroy */
void
{
if (ibtf_debug_buf) {
}
}
/*
* debug, log, and console message handling
*/
/*
* clear the IBTF trace buffer
*/
static void
{
if (ibtf_debug_buf) {
}
}
static void
{
char *msg_ptr;
/* if not using logging scheme; quit */
return;
}
/* if level doesn't match, we are done */
return;
}
/* If user requests to clear debug buffer, go ahead */
if (ibtf_clear_debug_buf_flag != 0) {
}
/*
* Check if we have a valid buf size?
* Suppress logging to ibtf_buffer if so.
*/
if (ibtf_debug_buf_size <= 0) {
ibtf_buffer_dprintf = 0;
}
/*
* put "label" into the buffer
*/
/*
* stuff the message in the debug buf
*/
if (ibtf_buffer_dprintf) {
/*
* overwrite >>>> that might be over the end of the
* the buffer
*/
*ibtf_buf_sptr = '\0';
} else {
ibtf_buf_sptr += len;
}
/* add marker */
}
/*
* LINTR, L5-L2 message may go to the ibtf_debug_buf
* L1 messages will go to the log buf in non-debug kernels and
* to console and log buf in debug kernels
* L0 messages are warnings and will go to console and log buf
*/
switch (level) {
case IBTF_LOG_LINTR:
case IBTF_LOG_L5:
case IBTF_LOG_L4:
case IBTF_LOG_L3:
case IBTF_LOG_L2:
if (!ibtf_buffer_dprintf) {
}
break;
case IBTF_LOG_L1:
#ifdef DEBUG
#else
if (!ibtf_buffer_dprintf) {
}
#endif
break;
case IBTF_LOG_L0:
/* Strip the "\n" added earlier */
}
}
break;
}
}
void
{
/* only log messages if "ibtf_allow_intr_msgs" is set */
if (!ibtf_allow_intr_msgs)
return;
}
/*
* Check individual subsystem err levels
*/
if (ibgen_errlevel < level) \
return; \
if (ibtl_errlevel < level) \
return; \
if (ibcm_errlevel < level) \
return; \
if (ibdm_errlevel < level) \
return; \
if (ibnex_errlevel < level) \
return; \
}
void
{
/* check if global errlevel matches or not */
if (ibtf_errlevel < IBTF_LOG_L5)
return;
}
void
{
/* check if global errlevel matches or not */
if (ibtf_errlevel < IBTF_LOG_L4)
return;
}
void
{
/* check if global errlevel matches or not */
if (ibtf_errlevel < IBTF_LOG_L3)
return;
}
void
{
/* check if global errlevel matches or not */
if (ibtf_errlevel < IBTF_LOG_L2)
return;
}
void
{
/* check if global errlevel matches or not */
if (ibtf_errlevel < IBTF_LOG_L1)
return;
}
/*
* Function:
* ibtf_dprintf0
* Input:
* name - Name of the subsystem generating the debug message
* fmt - The message to be displayed.
* Output:
* none
* Returns:
* none
* Description:
* A generic log function to display IBTF debug messages.
*/
void
{
/* check if global errlevel matches or not */
if (ibtf_errlevel < IBTF_LOG_L0)
return;
}