summaryrefslogtreecommitdiff
path: root/usr/src/cmd/stmsboot
diff options
context:
space:
mode:
authorjiang wu - Sun Microsystems - Beijing China <Javen.Wu@Sun.COM>2009-06-19 20:12:07 +0800
committerjiang wu - Sun Microsystems - Beijing China <Javen.Wu@Sun.COM>2009-06-19 20:12:07 +0800
commit5b5046010dc014958659914f953b1197da4054ac (patch)
tree1b291264c06f41c02cb2604ad346069e31660a5e /usr/src/cmd/stmsboot
parent9fa05d92f6b225eb418fb782225c991b887ea8b7 (diff)
downloadillumos-joyent-5b5046010dc014958659914f953b1197da4054ac.tar.gz
PSARC 2008/443 Driver for LSI MPT2.0 compliant SAS controller
6770908 Solaris needs driver for LSI SAS2004/SAS2008 with IT/IR firmware 6846720 memory leak in scsi_hba_bus_config_iports() 6847050 reboot fails after run "stmsboot -d -D mpt_sas" on das_x86 system
Diffstat (limited to 'usr/src/cmd/stmsboot')
-rw-r--r--usr/src/cmd/stmsboot/stmsboot.sh10
-rw-r--r--usr/src/cmd/stmsboot/stmsboot_util.c57
2 files changed, 55 insertions, 12 deletions
diff --git a/usr/src/cmd/stmsboot/stmsboot.sh b/usr/src/cmd/stmsboot/stmsboot.sh
index 0650561e82..08caf6e749 100644
--- a/usr/src/cmd/stmsboot/stmsboot.sh
+++ b/usr/src/cmd/stmsboot/stmsboot.sh
@@ -39,7 +39,7 @@ SAVEDIR=/etc/mpxio
BOOTDEVICES=$SAVEDIR/boot-devices
RECOVERFILE=$SAVEDIR/recover_instructions
SVCCFG_RECOVERY=$SAVEDIR/svccfg_recover
-SUPPORTED_DRIVERS="fp|mpt"
+SUPPORTED_DRIVERS="fp|mpt|mpt_sas"
USAGE=`gettext "Usage: stmsboot [-D $SUPPORTED_DRIVERS] -e | -d | -u | -L | -l controller_number"`
TEXTDOMAIN=SUNW_OST_OSCMD
export TEXTDOMAIN
@@ -290,7 +290,7 @@ update_sysfiles()
# Returns 0 on success, 1 on failure.
#
# Args: $cmd = {enable | disable}
-# $d = {fp | mpt}
+# $d = {fp | mpt | mpt_sas}
#
# the global variable $DRVLIST is used
#
@@ -417,7 +417,7 @@ get_newbootpath_for_stmsdev() {
# Emit a warning message to the user that by default we
# operate on all multipath-capable controllers that are
# attached to the system, and that if they want to operate
-# on only a specific controller type (fp|mpt|....) then
+# on only a specific controller type (fp|mpt|mpt_sas|....) then
# they need to re-invoke stmsboot with "-D $driver" in
# their argument list
#
@@ -437,7 +437,7 @@ emit_driver_warning_msg() {
echo ""
gettext "If you do NOT wish to operate on these controllers, please quit stmsboot\n"
- gettext "and re-invoke with -D { fp | mpt } to specify which controllers you wish\n"
+ gettext "and re-invoke with -D { fp | mpt | mpt_sas} to specify which controllers you wish\n"
gettext "to modify your multipathing configuration for.\n"
echo ""
@@ -480,7 +480,7 @@ if [ "x$cmd" = xnone ]; then
fi
if [ "x$DRV" = "x" ]; then
- DRVLIST="fp mpt"
+ DRVLIST="fp mpt mpt_sas"
else
DRVLIST=$DRV
fi
diff --git a/usr/src/cmd/stmsboot/stmsboot_util.c b/usr/src/cmd/stmsboot/stmsboot_util.c
index a57a5ab2cb..4abfcce035 100644
--- a/usr/src/cmd/stmsboot/stmsboot_util.c
+++ b/usr/src/cmd/stmsboot/stmsboot_util.c
@@ -141,6 +141,8 @@ main(int argc, char **argv)
devinfo_root));
print_mpx_capable(di_drv_first_node("mpt",
devinfo_root));
+ print_mpx_capable(di_drv_first_node("mpt_sas",
+ devinfo_root));
}
di_fini(devinfo_root);
return (0);
@@ -398,7 +400,8 @@ parse_args(int argc, char *argv[])
bcopy(optarg, drvlimit, strlen(optarg));
/* update this if adding support for a new driver */
if ((strncmp(drvlimit, "fp", 2) == NULL) &&
- (strncmp(drvlimit, "mpt", 3) == NULL)) {
+ (strncmp(drvlimit, "mpt", 3) == NULL) &&
+ (strncmp(drvlimit, "mpt_sas", 7) == NULL)) {
logmsg(MSG_ERROR,
gettext("invalid parent driver (%s) "
"specified"), drvlimit);
@@ -1218,6 +1221,25 @@ print_bootpath()
}
}
+static void
+get_phci_driver_name(char *phci_path, char **driver_name)
+{
+ di_node_t phci_node = DI_NODE_NIL;
+ char *tmp = NULL;
+
+ phci_node = di_init(phci_path, DINFOCPYONE);
+ if (phci_node == DI_NODE_NIL) {
+ logmsg(MSG_ERROR,
+ gettext("Unable to take phci snapshot "
+ "(%s: %d)\n"), strerror(errno), errno);
+ return;
+ }
+ tmp = di_driver_name(phci_node);
+ if (tmp != NULL) {
+ (void) strncpy(*driver_name, tmp, 10);
+ }
+ di_fini(phci_node);
+}
/*
* We only call this routine if we have a scsi_vhci node and must
* determine the actual physical path of its first online client
@@ -1268,18 +1290,39 @@ vhci_to_phci(char *devpath, char *physpath)
pi = (sv_path_info_t *)ioc.ret_buf;
while (npaths--) {
if (pi->ret_state == MDI_PATHINFO_STATE_ONLINE) {
- char nodename[4];
+ char nodename[5];
+ char *phci_driver = NULL;
- bzero(nodename, 4);
- /* A hack, but nicer than a platform-specific ifdef */
+ bzero(nodename, 5);
+ phci_driver = malloc(10);
+ if (phci_driver == NULL) {
+ logmsg(MSG_INFO,
+ "vhci_to_phci: Memory allocation failed\n");
+ goto failure;
+ }
+ bzero(phci_driver, 10);
+ get_phci_driver_name(pi->device.ret_phci,
+ &phci_driver);
+ logmsg(MSG_INFO, "phci driver name: %s\n", phci_driver);
+ /*
+ * A hack, but nicer than a platform-specific ifdef
+ * fp on SPARC using "ssd" as nodename
+ * mpt use "sd" when mpxio disabled, use "disk" when
+ * mpxio is enabled
+ * for alll other cases, "disk" should be used as the
+ * nodename
+ */
if (strstr(devpath, "ssd") != NULL) {
- (void) snprintf(nodename, 4, "ssd");
+ (void) snprintf(nodename, 5, "ssd");
+ } else if (strncmp(phci_driver, "mpt", 10) == 0) {
+ (void) snprintf(nodename, 5, "sd");
} else {
- (void) snprintf(nodename, 4, "sd");
+ (void) snprintf(nodename, 5, "disk");
}
(void) snprintf(physpath, MAXPATHLEN, "%s/%s@%s",
pi->device.ret_phci, nodename, pi->ret_addr);
free(ioc.ret_buf);
+ free(phci_driver);
return;
}
pi++;
@@ -1294,7 +1337,7 @@ failure:
* names substituted.
*
* Returns:
- * 0 successful operation
+ * 0 successful operation
* -1 failed
*/
static int