diff options
| author | Brian Kuyper <Brian.Kuyper@Sun.COM> | 2009-01-20 14:03:28 -0600 |
|---|---|---|
| committer | Brian Kuyper <Brian.Kuyper@Sun.COM> | 2009-01-20 14:03:28 -0600 |
| commit | f081dbc94e8b328991b5b6f050aa277d4be53935 (patch) | |
| tree | e70344c84e3fbbd5c9194f26555dfa10e5c14cd9 /usr/src | |
| parent | 980cf3cfb78cea51775ad56a7449d18d866e0e34 (diff) | |
| download | illumos-joyent-f081dbc94e8b328991b5b6f050aa277d4be53935.tar.gz | |
6618272 RFE: Qualify SDLT 600 tape drive on SMMS
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/cmd/mms/dm/common/dm.c | 3 | ||||
| -rw-r--r-- | usr/src/cmd/mms/dm/common/dm_drive.h | 6 | ||||
| -rw-r--r-- | usr/src/cmd/mms/dm/common/dm_proto.h | 3 | ||||
| -rw-r--r-- | usr/src/cmd/mms/mm/common/mm_types.xml | 5 | ||||
| -rw-r--r-- | usr/src/lib/mms/dm/Makefile | 5 | ||||
| -rw-r--r-- | usr/src/lib/mms/dm/libQUANTUM_SDLT600/Makefile | 55 | ||||
| -rw-r--r-- | usr/src/lib/mms/dm/libQUANTUM_SDLT600/Makefile.com | 64 | ||||
| -rw-r--r-- | usr/src/lib/mms/dm/libQUANTUM_SDLT600/common/dm_QUANTUM_SDLT600.c | 211 | ||||
| -rw-r--r-- | usr/src/lib/mms/dm/libQUANTUM_SDLT600/common/mapfile-vers | 54 | ||||
| -rw-r--r-- | usr/src/lib/mms/dm/libQUANTUM_SDLT600/i386/Makefile | 28 | ||||
| -rw-r--r-- | usr/src/lib/mms/dm/libQUANTUM_SDLT600/sparc/Makefile | 29 | ||||
| -rw-r--r-- | usr/src/pkgdefs/SUNWmmsu/prototype_com | 5 |
12 files changed, 461 insertions, 7 deletions
diff --git a/usr/src/cmd/mms/dm/common/dm.c b/usr/src/cmd/mms/dm/common/dm.c index 3f5664d924..3ca07a62f1 100644 --- a/usr/src/cmd/mms/dm/common/dm.c +++ b/usr/src/cmd/mms/dm/common/dm.c @@ -18,7 +18,7 @@ * * CDDL HEADER END * - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -263,6 +263,7 @@ dm_init_dev_lib(void *hdl, int init) DM_INIT_JTAB(drv_get_capacity); DM_INIT_JTAB(drv_get_avail_capacity); DM_INIT_JTAB(drv_log_sense); + DM_INIT_JTAB(drv_read_attribute); DM_INIT_JTAB(drv_bind_raw_dev); /* diff --git a/usr/src/cmd/mms/dm/common/dm_drive.h b/usr/src/cmd/mms/dm/common/dm_drive.h index 1b050caba9..6d93c531ce 100644 --- a/usr/src/cmd/mms/dm/common/dm_drive.h +++ b/usr/src/cmd/mms/dm/common/dm_drive.h @@ -18,7 +18,7 @@ * * CDDL HEADER END * - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -577,6 +577,9 @@ typedef int (drv_locate_t)(tapepos_t *); drv_locate_t drv_locate; typedef int (drv_log_sense_t)(uchar_t *, int, int, int); drv_log_sense_t drv_log_sense; +typedef int (drv_read_attribute_t)(uchar_t *, int32_t, int, + int32_t); +drv_read_attribute_t drv_read_attribute; typedef int (drv_blk_limit_t)(mms_blk_limit_t *); drv_blk_limit_t drv_blk_limit; typedef int (drv_reserve_t)(void); @@ -656,6 +659,7 @@ typedef struct drv_jtab { drv_mtrestpos_t *drv_mtrestpos; drv_locate_t *drv_locate; drv_log_sense_t *drv_log_sense; + drv_read_attribute_t *drv_read_attribute; drv_blk_limit_t *drv_blk_limit; drv_reserve_t *drv_reserve; drv_release_t *drv_release; diff --git a/usr/src/cmd/mms/dm/common/dm_proto.h b/usr/src/cmd/mms/dm/common/dm_proto.h index 8349803455..5ca2e2fc25 100644 --- a/usr/src/cmd/mms/dm/common/dm_proto.h +++ b/usr/src/cmd/mms/dm/common/dm_proto.h @@ -18,7 +18,7 @@ * * CDDL HEADER END * - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -227,6 +227,7 @@ int drv_prsv_release(void); int drv_prsv_reserve(void); int drv_read(char *buf, int len); int drv_read_tm(void); +int drv_read_attribute(uchar_t *buf, int32_t len, int servact, int32_t attr); int drv_rebind_target(void); int drv_release(void); int drv_req_sense(int len); diff --git a/usr/src/cmd/mms/mm/common/mm_types.xml b/usr/src/cmd/mms/mm/common/mm_types.xml index 496ba1fbc0..297209a569 100644 --- a/usr/src/cmd/mms/mm/common/mm_types.xml +++ b/usr/src/cmd/mms/mm/common/mm_types.xml @@ -19,7 +19,7 @@ information: Portions Copyright [yyyy] [name of copyright owner] CDDL HEADER END - Copyright 2008 Sun Microsystems, Inc. All rights reserved. + Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. --> @@ -36,6 +36,7 @@ <mm_drive_string value="LTO2"/> <mm_drive_string value="LTO3"/> <mm_drive_string value="LTO4"/> + <mm_drive_string value="SDLT600"/> </mm_drive_list> <mm_cartridge_list> <mm_cartridge_string value="DISK"/> @@ -45,6 +46,7 @@ <mm_cartridge_string value="LTO2"/> <mm_cartridge_string value="LTO3"/> <mm_cartridge_string value="LTO4"/> + <mm_cartridge_string value="SDLT2"/> </mm_cartridge_list> <mm_library_list> <mm_library> @@ -69,6 +71,7 @@ <mm_cartridgeshape name="LTO2"/> <mm_cartridgeshape name="LTO3"/> <mm_cartridgeshape name="LTO4"/> + <mm_cartridgeshape name="SDLT2"/> </mm_cartridgeshape_list> </mm_library> </mm_library_list> diff --git a/usr/src/lib/mms/dm/Makefile b/usr/src/lib/mms/dm/Makefile index 46a285970e..4698927143 100644 --- a/usr/src/lib/mms/dm/Makefile +++ b/usr/src/lib/mms/dm/Makefile @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # @@ -40,7 +40,8 @@ SUBDIRS = \ libSTK_T9840C \ libSTK_T9940A \ libSTK_T9940B \ - libdefault + libdefault \ + libQUANTUM_SDLT600 .KEEP_STATE: diff --git a/usr/src/lib/mms/dm/libQUANTUM_SDLT600/Makefile b/usr/src/lib/mms/dm/libQUANTUM_SDLT600/Makefile new file mode 100644 index 0000000000..d7ba2908b8 --- /dev/null +++ b/usr/src/lib/mms/dm/libQUANTUM_SDLT600/Makefile @@ -0,0 +1,55 @@ +# +# 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 +# or http://www.opensolaris.org/os/licensing. +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# + +include $(SRC)/lib/Makefile.lib +include ../Makefile.defs + +SUBDIRS = $(MACH) +#$(BUILD64)SUBDIRS += $(MACH64) + +all := TARGET = all +clean := TARGET = clean +clobber := TARGET = clobber +install := TARGET = install +lint := TARGET = lint + +.KEEP_STATE: + +all clean clobber lint: $(SUBDIRS) + +install: $(ROOTMMSDMLIBDIR) $(SUBDIRS) + +install_h: + +check: + +$(SUBDIRS): FRC + @cd $@; pwd; $(MAKE) $(TARGET) + +FRC: + +include ../Makefile.rootdirs +include $(SRC)/lib/Makefile.targ diff --git a/usr/src/lib/mms/dm/libQUANTUM_SDLT600/Makefile.com b/usr/src/lib/mms/dm/libQUANTUM_SDLT600/Makefile.com new file mode 100644 index 0000000000..35f7d828ef --- /dev/null +++ b/usr/src/lib/mms/dm/libQUANTUM_SDLT600/Makefile.com @@ -0,0 +1,64 @@ +# +# 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 +# or http://www.opensolaris.org/os/licensing. +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# + +LIBRARY = libQUANTUM_SDLT600.a +VERS = +OBJECTS = dm_QUANTUM_SDLT600.o + +include $(SRC)/lib/Makefile.lib +include ../../Makefile.defs + +LIBLINKS = + +LIBS = $(DYNLIB) $(LINTLIB) + +SRCDIR = ../common + +SRCS = $(OBJECTS:%.o=$(SRCDIR)/%.c) + +ROOTLIBDIR = $(ROOTMMSDMLIBDIR) + +LDLIBS += -lc +LDLIBS += -L$(SRC)/lib/mms/mms/$(MACH) -lmms + +CFLAGS += $(CCVERBOSE) + +CPPFLAGS += -DMMS_OPENSSL +CPPFLAGS += -I$(SRCDIR) -I$(SRC)/common/mms/mms +CPPFLAGS += -I$(SRC)/cmd/mms/dm/common -I../../../mms/common +CPPFLAGS += -I$(SRC)/uts/common/io/mms/dda +CPPFLAGS += -I$(SRC)/uts/common/io/mms/dmd +CPPFLAGS += -I$(SRC)/cmd/mms/wcr/common +CPPFLAGS += -erroff=E_NON_CONST_INIT + +.KEEP_STATE: + +all: $(LIBS) + +lint: $(LINTLIB) lintcheck + +include $(SRC)/lib/Makefile.targ +include ../../Makefile.rootdirs diff --git a/usr/src/lib/mms/dm/libQUANTUM_SDLT600/common/dm_QUANTUM_SDLT600.c b/usr/src/lib/mms/dm/libQUANTUM_SDLT600/common/dm_QUANTUM_SDLT600.c new file mode 100644 index 0000000000..c7b42f918d --- /dev/null +++ b/usr/src/lib/mms/dm/libQUANTUM_SDLT600/common/dm_QUANTUM_SDLT600.c @@ -0,0 +1,211 @@ +/* + * 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 + * or http://www.opensolaris.org/os/licensing. + * 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 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + + +#include <sys/types.h> +#include <sys/scsi/impl/uscsi.h> +#include <string.h> +#include <errno.h> +#include <mms_dmd.h> +#include <mms_trace.h> +#include <dmd_impl.h> +#include <dm_drive.h> +#include <mms_sym.h> + +static char *_SrcFile = __FILE__; + +/* + * Specify whether the persistent reserve out command is supported or not. + * 0 - not supported + * 1 - supported + * + * If the persistent reserve out command is supported, then it will be used + * to reserve the drive. + * If the persistent reserve out command is not supported, then the reserve + * command will be used to reserve the drive. + */ +int drv_prsv_supported = 1; /* persistent reserve out supported */ + +/* + * specify timeouts for this drive. Time is specified in seconds. + */ +drv_timeout_t drv_timeout = { + (151 *60), /* For really long commands */ + (20 *60), /* Normal commands */ + (1 *60), /* short commands */ +}; + +/* + * Specify drive type of this drive + * drv_drive_type must be a string. + */ +char drv_drive_type[] = "dt_SDLT600"; + +/* + * drv_density[] + * - Specify density names with their density codes supported by this DM. + * - Densities must be specified in the order of their selection priority. + * The ones at the beginning of the list will be selected before those + * at the end of the list. + * - Density names must start with "den_" to avoid conflict with other names. + */ +mms_sym_t drv_density[] = { + "den_SDLT2", 0x4A, + "den_SDLT1_220", 0x48, + "den_SDLT1_320", 0x49, + "den_VStape_160", 0x50, + NULL /* Must be last entry */ +}; + +/* + * drv_shape[] + * - Specify shape names of cartridge types supported by this DM. + * - Shape names must be specified in the order of their selection priority. + * The ones at the beginning of the list will be selected before those + * at the end of the list. + * - Shape name must be a well known and published name. + */ +char *drv_shape[] = { + "SDLT2", + "SDLT1", + "VStape1", + NULL /* Must be last entry */ +}; + +/* + * drv_shape_den[] + * Specify the shape of a cartridge and the density on it that can be + * written over by a readwrite density. + * All shape names and density names must have been specified in + * drv_density[] and drv_shape[]. + * Each entry of the array consists of: + * {shapename, density on cart, readwrite density}. + * If the density on cartridge is the same as the readwrite density, then + * the drive can read and write with that density. + * If the density on cartridge is read only, then the readwrite density + * is NULL. + * If the readwrite density is not NULL and it is different from the density + * on cartridge, then the drive is able to write over the existing data + * starting from the beginning of medium. + */ + +drv_shape_density_t drv_shape_den[] = { + /* shapename existing den readwrite density */ + /* + * Specify readwrite density + */ + "SDLT2", "den_SDLT2", "den_SDLT2", + + /* + * Specify readonly density + */ + "VStape1", "den_VStape_160", NULL, + "SDLT1", "den_SDLT1_220", NULL, + "SDLT1", "den_SDLT1_320", NULL, + NULL /* Must be last entry */ +}; + +int +drv_get_capacity(mms_capacity_t *cap) +{ + uchar_t buf[30]; + int off; + int i; + uint32_t code; + uint32_t max = 0; + uint32_t avail = 0; + + if (DRV_CALL(drv_read_attribute, + (buf, sizeof (buf), 0x00, 0x00)) != 0) { + return (EIO); + } + + for (i = 0; i < 2; i++) { + off = 4 + i * 13; + char_to_uint32(buf + off, 2, &code); + if (code == 0x0000) { /* capacity left */ + char_to_uint32(buf + off + 5, 8, &avail); + cap->mms_avail = avail; + break; + } + } + + for (i = 0; i < 2; i++) { + off = 4 + i * 13; + char_to_uint32(buf + off, 2, &code); + if (code == 0x0001) { /* Max capacity */ + char_to_uint32(buf + off + 5, 8, &max); + cap->mms_max = max; + break; + } + } + + if (max > 0) { + cap->mms_pc_avail = (avail * 100) / max; + if (cap->mms_pc_avail > 100) { + cap->mms_pc_avail = 100; + } + } else { + cap->mms_pc_avail = 0; + } + + TRACE((MMS_INFO, "Capacity: max %lld, avail %lld, avail %d%%", + cap->mms_max, cap->mms_avail, cap->mms_pc_avail)); + + return (0); +} + +int +drv_read_attribute(uchar_t *buf, int32_t len, int servact, int32_t attr) +{ + struct uscsi_cmd us; + uchar_t cdb[] = + { 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x64, 0x00, 0x00 }; + char dumpbuf[1024]; + + (void) memset(&us, 0, sizeof (us)); + us.uscsi_flags = USCSI_READ; + us.uscsi_cdb = (char *)cdb; + us.uscsi_cdblen = sizeof (cdb); + us.uscsi_timeout = drv->drv_timeout->drv_short_timeout; + us.uscsi_bufaddr = (char *)buf; + us.uscsi_buflen = len; + + cdb[1] = (servact & 0x1F); + int32_to_char(len, cdb + 10, 4); + int32_to_char(attr, cdb + 8, 2); + + TRACE((MMS_DEBUG, "Read attribute")); + if (dm_uscsi(&us)) { + return (EIO); + } + if (serr->se_status != STATUS_GOOD) { + return (EIO); + } + (void) mms_trace_dump((char *)buf, len, dumpbuf, sizeof (dumpbuf)); + TRACE((MMS_DEBUG, "read attribute data:\n%s", dumpbuf)); + + return (0); +} diff --git a/usr/src/lib/mms/dm/libQUANTUM_SDLT600/common/mapfile-vers b/usr/src/lib/mms/dm/libQUANTUM_SDLT600/common/mapfile-vers new file mode 100644 index 0000000000..5eb18f817e --- /dev/null +++ b/usr/src/lib/mms/dm/libQUANTUM_SDLT600/common/mapfile-vers @@ -0,0 +1,54 @@ +# +# 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 +# or http://www.opensolaris.org/os/licensing. +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# + +SUNWprivate_1.1 { + global: + drv_density; + drv_drive_type; + drv_get_capacity; + drv_prsv_supported; + drv_read_attribute; + drv_shape; + drv_shape_den; + drv_timeout; + + char_to_uint32 = extern; + dm_silent = extern; + dm_trace = extern; + dm_uscsi = extern; + drv = extern; + int32_to_char = extern; + jtab = extern; + mnt = extern; + serr = extern; + + local: + *; +}; + + + + diff --git a/usr/src/lib/mms/dm/libQUANTUM_SDLT600/i386/Makefile b/usr/src/lib/mms/dm/libQUANTUM_SDLT600/i386/Makefile new file mode 100644 index 0000000000..95bf998d7d --- /dev/null +++ b/usr/src/lib/mms/dm/libQUANTUM_SDLT600/i386/Makefile @@ -0,0 +1,28 @@ +# +# 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 +# or http://www.opensolaris.org/os/licensing. +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# +include ../Makefile.com + +install: all $(ROOTLIBS) diff --git a/usr/src/lib/mms/dm/libQUANTUM_SDLT600/sparc/Makefile b/usr/src/lib/mms/dm/libQUANTUM_SDLT600/sparc/Makefile new file mode 100644 index 0000000000..92a1313276 --- /dev/null +++ b/usr/src/lib/mms/dm/libQUANTUM_SDLT600/sparc/Makefile @@ -0,0 +1,29 @@ +# +# 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 +# or http://www.opensolaris.org/os/licensing. +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# + +include ../Makefile.com + +install: all $(ROOTLIBS) diff --git a/usr/src/pkgdefs/SUNWmmsu/prototype_com b/usr/src/pkgdefs/SUNWmmsu/prototype_com index e193b2b235..e06e7dcca5 100644 --- a/usr/src/pkgdefs/SUNWmmsu/prototype_com +++ b/usr/src/pkgdefs/SUNWmmsu/prototype_com @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # @@ -122,6 +122,9 @@ f none usr/lib/mms/dm/libSUNW_DISK_ARCHIVING.so.1 0755 root bin s none usr/lib/mms/dm/libSUNW_DISK_ARCHIVING.so=libSUNW_DISK_ARCHIVING.so.1 f none usr/lib/mms/dm/llib-lSUNW_DISK_ARCHIVING.ln 0644 root bin +f none usr/lib/mms/dm/libQUANTUM_SDLT600.so 0755 root bin +f none usr/lib/mms/dm/llib-lQUANTUM_SDLT600.ln 0644 root bin + d none usr/lib/mms/lm 0755 root bin f none usr/lib/mms/lm/libDISK.so.1 0755 root other s none usr/lib/mms/lm/libDISK.so=libDISK.so.1 |
