/*
* 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
* 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 (c) 2004-2011 Emulex. All rights reserved.
* Use is subject to license terms.
*/
#define DUMP_SUPPORT
#include <emlxs_mdb.h>
#include <emlxs_msg.h>
#include <emlxs_dump.h>
#include <emlxs_device.h>
/*
* MDB module linkage information:
*/
{
{ NULL }
};
{
};
const mdb_modinfo_t *
_mdb_init(void)
{
return (&modinfo);
}
/*
* emlxs_msgbuf library
*/
void
{
mdb_printf(" <instance> This is the %s driver instance " \
"number in hex.\n", DRIVER_NAME);
mdb_printf(" (e.g. 0, 1,..., e, f, etc.)\n");
} /* emlxs_msgbuf_help() */
/*ARGSUSED*/
{
uint32_t i;
char *level;
if (argc != 1) {
mdb_printf("Usage: ::%s_msgbuf <instance(hex)>\n",
mdb_printf("mdb: try \"::help %s_msgbuf\" for more information",
return (DCMD_ERR);
}
/* Get the device address */
"%s not found.\n", buffer);
"Is the %s driver loaded ?\n", DRIVER_NAME);
return (DCMD_ERR);
}
/* Get the device instance table */
buffer);
"Is the %s driver loaded ?\n", DRIVER_NAME);
return (DCMD_ERR);
}
/* Get the device instance count */
buffer);
"Is the %s driver loaded ?\n", DRIVER_NAME);
return (DCMD_ERR);
}
break;
}
}
if (brd_no == instance_count) {
return (DCMD_ERR);
}
/* Check if buffer is null */
if (addr == 0) {
return (0);
}
sizeof (emlxs_msg_log_t)) {
mdb_warn("\nUnable to read %d bytes @ %llx.\n",
sizeof (emlxs_msg_log_t), addr);
return (0);
}
/* Check if buffer is empty */
mdb_warn("Log buffer empty.\n");
return (0);
}
/* Get last entry id saved */
/* Check if buffer has already been filled once */
} else {
/* Buffer not yet filled */
first = 0;
idx = 0;
}
/* Get the total number of messages available for return */
mdb_printf("\n");
/* Print the messages */
for (i = 0; i < count; i++) {
mdb_warn("Cannot read log entry. index=%d count=%d\n",
return (DCMD_ERR);
}
mdb_warn("Cannot read msg. index=%d count=%d\n",
return (DCMD_ERR);
}
case EMLXS_DEBUG:
level = " DEBUG";
break;
case EMLXS_NOTICE:
level = " NOTICE";
break;
case EMLXS_WARNING:
level = "WARNING";
break;
case EMLXS_ERROR:
level = " ERROR";
break;
case EMLXS_PANIC:
level = " PANIC";
break;
default:
level = "UNKNOWN";
break;
}
} else {
}
/* Generate the message string */
"[%Y:%03d:%03d:%03d] "
"%6d:[%1X.%04X]%s:%7s:%4d:\n%s\n(%s)\n",
} else {
"[%Y:%03d:%03d:%03d] "
"%6d:[%1X.%04X]%s:%7s:%4d:\n%s\n",
}
} else {
"[%Y:%03d:%03d:%03d] "
"%6d:[%1X.%04X]%s:%7s:%4d:\n(%s)\n",
} else {
"[%Y:%03d:%03d:%03d] "
"%6d:[%1X.%04X]%s:%7s:%4d:\n%s\n",
}
}
/* Increment index */
idx = 0;
}
}
mdb_printf("\n");
return (0);
} /* emlxs_msgbuf() */
void
{
mdb_printf("\n");
mdb_printf(" txt Display firmware text summary " \
"file.\n");
mdb_printf(" dmp Display firmware dmp binary file.\n");
mdb_printf(" cee Display firmware cee binary file. " \
"(FCOE adapters only)\n");
mdb_printf(" all Display all firmware core files.\n");
mdb_printf(" <instance> This is the %s driver instance " \
"number in hex.\n", DRIVER_NAME);
mdb_printf(" (e.g. 0, 1,..., e, f, etc.)\n");
} /* emlxs_dump_help() */
/*ARGSUSED*/
int
{
uint32_t i;
char *cptr;
if (argc != 2) {
goto usage;
}
file = 0;
file = 1;
file = 2;
file = 3;
} else {
goto usage;
}
/* Get the device address */
"%s not found.\n", buffer);
"Is the %s driver loaded ?\n", DRIVER_NAME);
return (DCMD_ERR);
}
/* Get the device instance table */
buffer);
"Is the %s driver loaded ?\n", DRIVER_NAME);
return (DCMD_ERR);
}
/* Get the device instance count */
buffer);
"Is the %s driver loaded ?\n", DRIVER_NAME);
return (DCMD_ERR);
}
break;
}
}
if (brd_no == instance_count) {
return (DCMD_ERR);
}
if (addr == 0) {
mdb_warn("TXT file: Device instance not found. " \
"ddinst=%d\n", ddiinst);
goto dmp_file;
}
!= sizeof (dump_txtfile)) {
mdb_warn("TXT file: Unable to read %d bytes @ %llx.\n",
sizeof (dump_txtfile), addr);
goto dmp_file;
}
if (size == 0) {
mdb_printf("TXT file: Not available.\n");
goto dmp_file;
}
if (bptr == 0) {
mdb_warn("TXT file: Unable to allocate file buffer. " \
goto dmp_file;
}
!= size) {
mdb_warn("TXT file: Unable to read %d bytes @ %llx.\n",
goto dmp_file;
}
mdb_printf("<TXT File Start>\n");
mdb_printf("\n");
mdb_printf("\n");
mdb_printf("<TXT File End>\n");
}
if (addr == 0) {
mdb_warn("DMP file: Device instance not found. " \
"ddinst=%d\n", ddiinst);
goto cee_file;
}
!= sizeof (dump_dmpfile)) {
mdb_warn("DMP file: Unable to read %d bytes @ %llx.\n",
sizeof (dump_dmpfile), addr);
goto cee_file;
}
if (size == 0) {
mdb_printf("DMP file: Not available.\n");
goto cee_file;
}
if (bptr == 0) {
mdb_warn("DMP file: Unable to allocate file buffer. " \
goto cee_file;
}
!= size) {
mdb_warn("DMP file: Unable to read %d bytes @ %llx.\n",
goto cee_file;
}
mdb_printf("<DMP File Start>\n");
mdb_printf("\n");
for (i = 0; i < size; i++) {
if (i && !(i % 16)) {
}
if (!(i % 16)) {
mdb_printf("%08X: ", i);
}
if (!(i % 4)) {
mdb_printf(" ");
}
} else {
*cptr++ = '.';
}
}
if (!(i % 4)) {
mdb_printf(" ");
}
mdb_printf(" ");
}
mdb_printf("\n");
mdb_printf("<DMP File End>\n");
}
if (addr == 0) {
mdb_warn("CEE file: Device instance not found. " \
"ddinst=%d\n", ddiinst);
goto done;
}
!= sizeof (dump_ceefile)) {
mdb_warn("CEE file: Unable to read %d bytes @ %llx.\n",
sizeof (dump_ceefile), addr);
goto done;
}
if (size == 0) {
mdb_printf("CEE file: Not available.\n");
goto done;
}
if (bptr == 0) {
mdb_warn("CEE file: Unable to allocate file buffer. " \
goto done;
}
!= size) {
mdb_warn("CEE file: Unable to read %d bytes @ %llx.\n",
goto done;
}
mdb_printf("<CEE File Start>\n");
mdb_printf("\n");
for (i = 0; i < size; i++) {
if (i && !(i % 16)) {
}
if (!(i % 16)) {
mdb_printf("%08X: ", i);
}
if (!(i % 4)) {
mdb_printf(" ");
}
} else {
*cptr++ = '.';
}
}
if (!(i % 4)) {
mdb_printf(" ");
}
mdb_printf(" ");
}
mdb_printf("\n");
mdb_printf("<CEE File End>\n");
}
done:
mdb_printf("\n");
return (0);
mdb_printf("Usage: ::%s_dump <file> <instance (hex)>\n",
mdb_printf("mdb: try \"::help %s_dump\" for more information",
return (DCMD_ERR);
} /* emlxs_dump() */