dr_util.c revision 79afa7fba66c808623862442107f913bce5ea783
/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* sun4v DR Utility functions
*/
#include <sys/sysevent.h>
extern int ppvm_enable;
{
/*
* The type argument is currently unused. However, it
* keeps the interface flexible enough to allows for
* only disabling certain types of DR.
*/
/*
* DR requires that the kernel is using its own CIF
* handler. If that is not the case, either because
* domaining has been explicitly disabled, or because
* the firmware does not support it, the system must
* remain static and DR must be disabled.
*/
if (!domaining_enabled()) {
"is not available\n");
return (B_TRUE);
}
return (B_TRUE);
}
return (B_FALSE);
}
/*
* Generate a DR sysevent based on the type of resource and
* sysevent hint specified. The hint indicates whether the
* resource was added or removed.
*/
void
{
int rv;
/*
* Add the attachment point attribute
*/
if (rv != 0) {
DR_DBG_ALL("generate_event: failed to add attr '%s' for "
goto done;
}
/*
* Add the DR hint attribute
*/
if (rv != 0) {
DR_DBG_ALL("generate_event: failed to add attr '%s' for "
goto done;
}
/*
* Attach the attribute list to the event
*/
if (rv != 0) {
DR_DBG_ALL("generate_event: failed to add attr list for "
"'%s' event\n", EC_DR);
goto done;
}
/*
* Log the event
*/
if (rv != 0) {
}
done:
}
struct memlist *
{
return (NULL);
KM_SLEEP);
}
return (hl);
}
/*
* Free a memlist and its elements
*/
void
{
}
}
/*
* Debugging Features
*/
#ifdef DEBUG
#define BYTESPERLINE 8
/*
* Output a buffer formatted with a set number of bytes on
* each line. Append each line with the ASCII equivalent of
* each byte if it falls within the printable ASCII range,
* and '.' otherwise.
*/
void
{
int i, j;
char *curr;
char *aoff;
/* abort if not debugging transport */
if (!(dr_debug & DR_DBG_FLAG_TRANS)) {
return;
}
/* walk the buffer one line at a time */
for (i = 0; i < len; i += BYTESPERLINE) {
/*
* Walk the bytes in the current line, storing
* the hex value for the byte as well as the
* ASCII representation in a temporary buffer.
* All ASCII values are placed at the end of
* the line.
*/
for (j = 0; (j < BYTESPERLINE) && ((i + j) < len); j++) {
curr += 3;
aoff++;
}
/*
* Fill in to the start of the ASCII translation
* with spaces. This will only be necessary if
* this is the last line and there are not enough
* bytes to fill the whole line.
*/
*curr++ = ' ';
}
}
#endif /* DEBUG */