smp.c revision ac88567a7a5bb7f01cf22cf366bc9d6203e24d7a
/*
* 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/ccompile.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <strings.h>
#include <ctype.h>
#include <scsi/libsmp_plugin.h>
static void fatal(int, const char *, ...) __NORETURN;
static void
{
}
int
{
void *x;
uint_t i, j;
if (argc < 3)
errno = 0;
if (errno != 0)
if (smp_init(LIBSMP_VERSION) != 0)
smp_fini();
}
smp_fini();
}
if (func == SMP_FUNC_DISCOVER) {
if (argc < 4)
fatal(-1,
"Usage: %s <device> 0x10 <phy identifier>\n",
argv[0]);
} else if (func == SMP_FUNC_REPORT_ROUTE_INFO) {
if (argc < 5)
"index> <phy identifier>\n",
argv[0]);
} else if (func == SMP_FUNC_ENABLE_DISABLE_ZONING) {
if (argc < 4)
fatal(-1,
"Usage: %s <device> 0x81 "
"[0(no change) | 1(enable)| 2(disable)]\n",
argv[0]);
} else if (func == SMP_FUNC_PHY_CONTROL) {
if (argc < 5)
fatal(-1,
"Usage: %s <device> 0x91 <phy identifier> "
" <phy operation>\n",
argv[0]);
} else if (func == SMP_FUNC_REPORT_EXP_ROUTE_TABLE_LIST) {
if (argc < 4)
fatal(-1,
"Usage: %s <device> 0x22 <SAS Address Index> \n",
argv[0]);
}
smp_fini();
}
if (result != SMP_RES_FUNCTION_ACCEPTED) {
smp_fini();
}
for (i = 0; i < len; i += 8) {
(void) printf("%02x: ", i);
for (j = i; j < i + 8; j++)
if (j < len)
else
(void) printf(" ");
for (j = i; j < i + 8; j++)
(void) printf("%c",
(void) printf("\n");
}
if (func == SMP_FUNC_DISCOVER) {
(void) printf("Addr: %016llx Phy: %02x\n",
(void) printf("Peer: %016llx Phy: %02x\n",
(void) printf("Device type: %01x\n",
}
smp_fini();
return (0);
}