/*
* 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
*/
/*
*/
#include <sys/dditypes.h>
#include <sys/mdb_modapi.h>
#include <lpif.h>
#include <stmf.h>
#include <stmf_ioctl.h>
#include <portif.h>
#include <stmf_sbd.h>
#include <sbd_impl.h>
#define ARRAY_SIZE(a) (sizeof (a) / sizeof (*a))
/* structure to pass arguments to mdb_walker callback function */
typedef struct stmf_sbd_cb_s {
static const char *stmf_protocol_str[] = {
"FIBRE_CHANNEL", /* PROTOCOL_FIBRE_CHANNEL 0 */
"PARALLEL_SCSI", /* PROTOCOL_PARALLEL_SCSI 1 */
"SSA", /* PROTOCOL_SSA 2 */
"IEEE_1394", /* PROTOCOL_IEEE_1394 3 */
"SRP", /* PROTOCOL_SRP 4 */
"iSCSI", /* PROTOCOL_iSCSI 5 */
"SAS", /* PROTOCOL_SAS 6 */
"ADT", /* PROTOCOL_ADT 7 */
"ATAPI" /* PROTOCOL_ATAPI 8 */
};
/*
* Support functions.
*/
static uint64_t
return (dest);
}
/*
* Variable 'bits' is a collection of flags for which a corresponding
* description string is available at flag_ary.
* So flag_ary should be an ary of strings with total_bits strings.
*/
static void
int i, delim = 0;
for (i = 0; i < total_bits; i++) {
delim = 1;
}
curbit <<= 1;
}
mdb_printf("\n");
}
static void
{
static const char *pgr_flag_str[] = {
"SBD_PGR_APTPL", /* 0x01 */
"SBD_PGR_RSVD_ONE", /* 0x02 */
"SBD_PGR_RSVD_ALL_REGISTRANTS", /* 0x04 */
"SBD_PGR_ALL_KEYS_HAS_IT" /* 0x08 */
};
static const char *pgr_type_desc[] = {
"ILLEGAL", /* 0x0 */
"Write Exclusive", /* 0x1 */
"ILLEGAL", /* 0x2 */
"Exclusive Access", /* 0x3 */
"ILLEGAL", /* 0x4 */
"Write Exclusive, Registrants Only", /* 0x5 */
"Exclusive Access, Registrants Only", /* 0x6 */
"Write Exclusive, All Registrants", /* 0x7 */
"Exclusive Access, All Registrants" /* 0x8 */
};
mdb_printf("PGR flags: ");
mdb_printf("Reservation Details \n");
mdb_printf("\tReservation holder: ");
if (pgr->pgr_rsvholder)
else
mdb_printf("All Registrants\n");
mdb_printf("\t type : %d => %s\n",
} else {
mdb_printf("No reservations.\n");
}
}
void
{
mdb_warn("%sError: Devid Size = %d < sizeof(scsi_devid_desc_t)"
return;
}
return;
}
} else {
}
mdb_printf("\n");
}
/*
* Decipher and print transport id which is pointed by addr variable.
*/
static int
{
mdb_warn("%sError: Transport ID Size = %d < "
return (DCMD_ERR);
}
return (DCMD_ERR);
}
switch (tpd->protocol_id) {
case PROTOCOL_FIBRE_CHANNEL:
{
nhconvert_8bytes(p));
}
break;
case PROTOCOL_PARALLEL_SCSI:
case PROTOCOL_SSA:
case PROTOCOL_IEEE_1394:
break;
case PROTOCOL_SRP:
{
/* Print 8 byte initiator extention and guid in order */
}
break;
case PROTOCOL_iSCSI:
break;
case PROTOCOL_SAS:
case PROTOCOL_ADT:
case PROTOCOL_ATAPI:
default:
break;
}
return (DCMD_OK);
}
void
{
"Prints info about pgr keys and reservations on the given lun.\n\n"
"Usage: <addr>::stmf_sbd_pgr_key [-akv]\n"
" where <addr> represent the address of\n"
" sbd_lu_t by default\n"
" or\n"
" sbd_pgr_key_t if '-a' option is specified.\n"
"Options:\n"
" -a if specified, <addr> represents address of sbd_pgr_key_t\n"
" -k if specified, only prints key information\n"
" -v verbose output\n");
}
/*
* MDB WALKERS implementations
*/
static int
{
mdb_warn("failed to read sbd_lu_list\n");
return (WALK_ERR);
}
}
return (WALK_NEXT);
}
static int
{
return (WALK_DONE);
return (WALK_ERR);
}
}
char *
return (str);
}
static int
{
/* sl_device_id contains 4 bytes hdr + 16 bytes(GUID) */
mdb_printf("\tsl_deviceid: %-?p GUID => %016llX%016llX\n",
mdb_printf("\tsl_meta_filename: %-?p %s\n",
mdb_printf("\tsl_data_filename: %-?p %s\n",
} else {
}
return (WALK_NEXT);
}
static int
{
mdb_warn("<pgr_key_list addr>::walk stmf_sbd_pgr_key\n");
return (WALK_ERR);
}
return (WALK_NEXT);
}
static int
{
return (WALK_DONE);
return (WALK_ERR);
}
}
static int
{
static const char *key_flag_str [] = {
"SBD_PGR_KEY_ALL_TG_PT", /* 0x01 */
"SBD_PGR_KEY_TPT_ID_FLAG" /* 0x02 */
};
mdb_printf("\tKey Flags: ");
key->pgr_key_flags);
mdb_printf("\tLocal Device ID: %?-p\n",
mdb_printf("\tRemote Transport ID: %?-p\n",
} else {
}
return (WALK_NEXT);
}
static int
{
mdb_warn("<sbd_it_list addr>::walk stmf_sbd_pgr_key\n");
return (WALK_ERR);
}
return (WALK_NEXT);
}
static int
{
return (WALK_DONE);
return (WALK_ERR);
}
}
static int
{
static const char *it_flag_str [] = {
"SBD_IT_HAS_SCSI2_RESERVATION", /* 0x0001 */
"SBD_IT_PGR_REGISTERED", /* 0x0002 */
"SBD_IT_PGR_EXCLUSIVE_RSV_HOLDER", /* 0x0004 */
"SBD_IT_PGR_CHECK_FLAG" /* 0x0008 */
};
mdb_printf("\tIT Flags: ");
it->sbd_it_flags);
} else {
}
return (WALK_NEXT);
}
/*
* MDB DCMDS implementations.
*/
int
{
!= argc)
return (DCMD_USAGE);
if (verbose)
if (flags & DCMD_ADDRSPEC) {
return (DCMD_ERR);
}
return (DCMD_ERR);
} else {
&cb_st) == -1) {
mdb_warn("failed to walk sbd_lu_list\n");
return (DCMD_ERR);
}
}
return (DCMD_OK);
}
static int
{
if (!(flags & DCMD_ADDRSPEC))
return (DCMD_USAGE);
return (DCMD_USAGE);
if (pgrkeyaddr || verbose)
/* If address of pgr_key is given, just print that key and return */
if (pgrkeyaddr) {
return (DCMD_ERR);
}
return (DCMD_ERR);
}
return (DCMD_OK);
} else {
return (DCMD_ERR);
}
}
if (verbose) {
}
/* Just a sanity check, not necessarily needed */
if (verbose)
return (DCMD_OK);
}
return (DCMD_ERR);
}
if (!keyonly)
if (verbose)
mdb_printf("No registered pgr keys found\n");
return (DCMD_OK);
} else {
if (!keyonly)
mdb_printf("\nKeys\n");
}
mdb_warn("failed to walk pgr_keylist\n");
return (DCMD_ERR);
}
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
if (!(flags & DCMD_ADDRSPEC))
return (DCMD_USAGE);
return (DCMD_ERR);
}
return (ret);
}
static int
{
if (!(flags & DCMD_ADDRSPEC))
return (DCMD_USAGE);
return (DCMD_USAGE);
if (verbose) {
}
/* If address of pgr_key is given, just print that key and return */
return (DCMD_ERR);
}
/* Just a sanity check, not necessarily needed */
if (verbose)
return (DCMD_OK);
}
mdb_warn("failed to walk sbd_lu_it_list\n");
return (DCMD_ERR);
}
return (DCMD_OK);
}
/*
* MDB dmcds and walkers definitions
*/
{ "stmf_sbd_lu", "?[-v]", "Print the list of sbd_lu_t",
stmf_sbd_lu, NULL },
{ "stmf_sbd_it", ":[-v]", "Print the list of sbd_it_data for given lu",
stmf_sbd_it, NULL },
{ "stmf_sbd_pgr_key", ":[-kov]", "Print the list of pgr keys",
{ "stmf_remote_port", ":", "decipher info in a stmf_remote_port",
stmf_remote_port, NULL },
{ NULL }
};
{ "stmf_sbd_lu", "walk list of stmf_sbd_lu structures",
{ "stmf_sbd_pgr_key", "walk the pgr keys of the given pgr key list",
{ "stmf_sbd_it", "walk the sbd_it_data for the given it list",
{ NULL }
};
};
const mdb_modinfo_t *
_mdb_init(void)
{
return (&modinfo);
}