svn commit: r231772 - in stable/9: share/examples/scsi_target
sys/amd64/conf sys/cam/ctl sys/cam/scsi sys/conf sys/dev/ata
sys/dev/ciss sys/i386/conf sys/ia64/conf sys/sparc64/conf
usr.bin usr.bin/...
Kenneth D. Merry
ken at FreeBSD.org
Wed Feb 15 17:28:10 UTC 2012
Author: ken
Date: Wed Feb 15 17:28:09 2012
New Revision: 231772
URL: http://svn.freebsd.org/changeset/base/231772
Log:
MFC r229997, r230033, and r230334
Bring the CAM Target Layer into stable/9.
r230334 | ken | 2012-01-19 11:42:03 -0700 (Thu, 19 Jan 2012) | 19 lines
Quiet some clang warnings when compiling CTL.
ctl_error.c,
ctl_error.h: Take out the ctl_sense_format enumeration, and use
scsi_sense_data_type instead.
Remove ctl_get_sense_format() and switch ctl_build_ua()
over to using scsi_sense_data_type.
ctl_backend_ramdisk.c,
ctl_backend_block.c:
Use C99 structure initializers instead of GNU initializers.
ctl.c: Switch over to using the SCSI sense format enumeration
instead of the CTL-specific enumeration.
Submitted by: dim (partially)
MFC after: 1 month
r230033 | ken | 2012-01-12 15:08:33 -0700 (Thu, 12 Jan 2012) | 5 lines
Silence some unnecessary verbosity.
Reported by: mav
MFC after: 1 month
r229997 | ken | 2012-01-11 17:34:33 -0700 (Wed, 11 Jan 2012) | 170 lines
Add the CAM Target Layer (CTL).
CTL is a disk and processor device emulation subsystem originally written
for Copan Systems under Linux starting in 2003. It has been shipping in
Copan (now SGI) products since 2005.
It was ported to FreeBSD in 2008, and thanks to an agreement between SGI
(who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is
available under a BSD-style license. The intent behind the agreement was
that Spectra would work to get CTL into the FreeBSD tree.
Some CTL features:
- Disk and processor device emulation.
- Tagged queueing
- SCSI task attribute support (ordered, head of queue, simple tags)
- SCSI implicit command ordering support. (e.g. if a read follows a mode
select, the read will be blocked until the mode select completes.)
- Full task management support (abort, LUN reset, target reset, etc.)
- Support for multiple ports
- Support for multiple simultaneous initiators
- Support for multiple simultaneous backing stores
- Persistent reservation support
- Mode sense/select support
- Error injection support
- High Availability support (1)
- All I/O handled in-kernel, no userland context switch overhead.
(1) HA Support is just an API stub, and needs much more to be fully
functional.
ctl.c: The core of CTL. Command handlers and processing,
character driver, and HA support are here.
ctl.h: Basic function declarations and data structures.
ctl_backend.c,
ctl_backend.h: The basic CTL backend API.
ctl_backend_block.c,
ctl_backend_block.h: The block and file backend. This allows for using
a disk or a file as the backing store for a LUN.
Multiple threads are started to do I/O to the
backing device, primarily because the VFS API
requires that to get any concurrency.
ctl_backend_ramdisk.c: A "fake" ramdisk backend. It only allocates a
small amount of memory to act as a source and sink
for reads and writes from an initiator. Therefore
it cannot be used for any real data, but it can be
used to test for throughput. It can also be used
to test initiators' support for extremely large LUNs.
ctl_cmd_table.c: This is a table with all 256 possible SCSI opcodes,
and command handler functions defined for supported
opcodes.
ctl_debug.h: Debugging support.
ctl_error.c,
ctl_error.h: CTL-specific wrappers around the CAM sense building
functions.
ctl_frontend.c,
ctl_frontend.h: These files define the basic CTL frontend port API.
ctl_frontend_cam_sim.c: This is a CTL frontend port that is also a CAM SIM.
This frontend allows for using CTL without any
target-capable hardware. So any LUNs you create in
CTL are visible in CAM via this port.
ctl_frontend_internal.c,
ctl_frontend_internal.h:
This is a frontend port written for Copan to do
some system-specific tasks that required sending
commands into CTL from inside the kernel. This
isn't entirely relevant to FreeBSD in general,
but can perhaps be repurposed.
ctl_ha.h: This is a stubbed-out High Availability API. Much
more is needed for full HA support. See the
comments in the header and the description of what
is needed in the README.ctl.txt file for more
details.
ctl_io.h: This defines most of the core CTL I/O structures.
union ctl_io is conceptually very similar to CAM's
union ccb.
ctl_ioctl.h: This defines all ioctls available through the CTL
character device, and the data structures needed
for those ioctls.
ctl_mem_pool.c,
ctl_mem_pool.h: Generic memory pool implementation used by the
internal frontend.
ctl_private.h: Private data structres (e.g. CTL softc) and
function prototypes. This also includes the SCSI
vendor and product names used by CTL.
ctl_scsi_all.c,
ctl_scsi_all.h: CTL wrappers around CAM sense printing functions.
ctl_ser_table.c: Command serialization table. This defines what
happens when one type of command is followed by
another type of command.
ctl_util.c,
ctl_util.h: CTL utility functions, primarily designed to be
used from userland. See ctladm for the primary
consumer of these functions. These include CDB
building functions.
scsi_ctl.c: CAM target peripheral driver and CTL frontend port.
This is the path into CTL for commands from
target-capable hardware/SIMs.
README.ctl.txt: CTL code features, roadmap, to-do list.
usr.sbin/Makefile: Add ctladm.
ctladm/Makefile,
ctladm/ctladm.8,
ctladm/ctladm.c,
ctladm/ctladm.h,
ctladm/util.c: ctladm(8) is the CTL management utility.
It fills a role similar to camcontrol(8).
It allow configuring LUNs, issuing commands,
injecting errors and various other control
functions.
usr.bin/Makefile: Add ctlstat.
ctlstat/Makefile
ctlstat/ctlstat.8,
ctlstat/ctlstat.c: ctlstat(8) fills a role similar to iostat(8).
It reports I/O statistics for CTL.
sys/conf/files: Add CTL files.
sys/conf/NOTES: Add device ctl.
sys/cam/scsi_all.h: To conform to more recent specs, the inquiry CDB
length field is now 2 bytes long.
Add several mode page definitions for CTL.
sys/cam/scsi_all.c: Handle the new 2 byte inquiry length.
sys/dev/ciss/ciss.c,
sys/dev/ata/atapi-cam.c,
sys/cam/scsi/scsi_targ_bh.c,
scsi_target/scsi_cmds.c,
mlxcontrol/interface.c: Update for 2 byte inquiry length field.
scsi_da.h: Add versions of the format and rigid disk pages
that are in a more reasonable format for CTL.
amd64/conf/GENERIC,
i386/conf/GENERIC,
ia64/conf/GENERIC,
sparc64/conf/GENERIC: Add device ctl.
i386/conf/PAE: The CTL frontend SIM at least does not compile
cleanly on PAE.
Sponsored by: Copan Systems, SGI and Spectra Logic
MFC after: 1 month
Added:
stable/9/sys/cam/ctl/
- copied from r229997, head/sys/cam/ctl/
- copied from r229997, head/usr.bin/ctlstat/
stable/9/usr.sbin/ctladm/
- copied from r229997, head/usr.sbin/ctladm/
Directory Properties:
stable/9/usr.bin/ctlstat/ (props changed)
Modified:
stable/9/share/examples/scsi_target/scsi_cmds.c
stable/9/sys/amd64/conf/GENERIC
stable/9/sys/cam/ctl/ctl.c
stable/9/sys/cam/ctl/ctl_backend_block.c
stable/9/sys/cam/ctl/ctl_backend_ramdisk.c
stable/9/sys/cam/ctl/ctl_error.c
stable/9/sys/cam/ctl/ctl_error.h
stable/9/sys/cam/ctl/scsi_ctl.c
stable/9/sys/cam/scsi/scsi_all.c
stable/9/sys/cam/scsi/scsi_all.h
stable/9/sys/cam/scsi/scsi_da.h
stable/9/sys/cam/scsi/scsi_targ_bh.c
stable/9/sys/conf/NOTES
stable/9/sys/conf/files
stable/9/sys/dev/ata/atapi-cam.c
stable/9/sys/dev/ciss/ciss.c
stable/9/sys/i386/conf/GENERIC
stable/9/sys/i386/conf/PAE
stable/9/sys/ia64/conf/GENERIC
stable/9/sys/sparc64/conf/GENERIC
stable/9/usr.bin/Makefile
stable/9/usr.bin/ctlstat/ctlstat.c
stable/9/usr.sbin/Makefile
stable/9/usr.sbin/mlxcontrol/interface.c
Directory Properties:
stable/9/ (props changed)
stable/9/share/ (props changed)
stable/9/share/examples/ (props changed)
stable/9/sys/ (props changed)
stable/9/sys/conf/ (props changed)
stable/9/usr.bin/ (props changed)
Modified: stable/9/share/examples/scsi_target/scsi_cmds.c
==============================================================================
--- stable/9/share/examples/scsi_target/scsi_cmds.c Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/share/examples/scsi_target/scsi_cmds.c Wed Feb 15 17:28:09 2012 (r231772)
@@ -328,7 +328,7 @@ tcmd_inquiry(struct ccb_accept_tio *atio
bcopy(&inq_data, ctio->data_ptr, sizeof(inq_data));
ctio->dxfer_len = inq_data.additional_length + 4;
ctio->dxfer_len = min(ctio->dxfer_len,
- SCSI_CDB6_LEN(inq->length));
+ scsi_2btoul(inq->length));
ctio->ccb_h.flags |= CAM_DIR_IN | CAM_SEND_STATUS;
ctio->scsi_status = SCSI_STATUS_OK;
}
Modified: stable/9/sys/amd64/conf/GENERIC
==============================================================================
--- stable/9/sys/amd64/conf/GENERIC Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/sys/amd64/conf/GENERIC Wed Feb 15 17:28:09 2012 (r231772)
@@ -118,7 +118,8 @@ device da # Direct Access (disks)
device sa # Sequential Access (tape etc)
device cd # CD
device pass # Passthrough device (direct ATA/SCSI access)
-device ses # SCSI Environmental Services (and SAF-TE)
+device ses # Enclosure Services (SES and SAF-TE)
+device ctl # CAM Target Layer
# RAID controllers interfaced to the SCSI subsystem
device amr # AMI MegaRAID
Modified: stable/9/sys/cam/ctl/ctl.c
==============================================================================
--- head/sys/cam/ctl/ctl.c Thu Jan 12 00:34:33 2012 (r229997)
+++ stable/9/sys/cam/ctl/ctl.c Wed Feb 15 17:28:09 2012 (r231772)
@@ -8736,7 +8736,7 @@ ctl_request_sense(struct ctl_scsiio *cts
struct ctl_lun *lun;
uint32_t initidx;
int have_error;
- ctl_sense_format sense_format;
+ scsi_sense_data_type sense_format;
cdb = (struct scsi_request_sense *)ctsio->cdb;
@@ -8748,9 +8748,9 @@ ctl_request_sense(struct ctl_scsiio *cts
* Determine which sense format the user wants.
*/
if (cdb->byte2 & SRS_DESC)
- sense_format = CTL_SENSE_DESCRIPTOR;
+ sense_format = SSD_TYPE_DESC;
else
- sense_format = CTL_SENSE_FIXED;
+ sense_format = SSD_TYPE_FIXED;
ctsio->kern_data_ptr = malloc(sizeof(*sense_ptr), M_CTL, M_WAITOK);
if (ctsio->kern_data_ptr == NULL) {
@@ -8789,13 +8789,13 @@ ctl_request_sense(struct ctl_scsiio *cts
*/
mtx_lock(&lun->ctl_softc->ctl_lock);
if (ctl_is_set(lun->have_ca, initidx)) {
- ctl_sense_format stored_format;
+ scsi_sense_data_type stored_format;
/*
* Check to see which sense format was used for the stored
* sense data.
*/
- stored_format = ctl_get_sense_format(
+ stored_format = scsi_sense_type(
&lun->pending_sense[initidx].sense);
/*
@@ -8804,14 +8804,17 @@ ctl_request_sense(struct ctl_scsiio *cts
* format. If we're going from descriptor to fixed format
* sense data, we may lose things in translation, depending
* on what options were used.
+ *
+ * If the stored format is SSD_TYPE_NONE (i.e. invalid),
+ * for some reason we'll just copy it out as-is.
*/
- if ((stored_format == CTL_SENSE_FIXED)
- && (sense_format == CTL_SENSE_DESCRIPTOR))
+ if ((stored_format == SSD_TYPE_FIXED)
+ && (sense_format == SSD_TYPE_DESC))
ctl_sense_to_desc((struct scsi_sense_data_fixed *)
&lun->pending_sense[initidx].sense,
(struct scsi_sense_data_desc *)sense_ptr);
- else if ((stored_format == CTL_SENSE_DESCRIPTOR)
- && (sense_format == CTL_SENSE_FIXED))
+ else if ((stored_format == SSD_TYPE_DESC)
+ && (sense_format == SSD_TYPE_FIXED))
ctl_sense_to_fixed((struct scsi_sense_data_desc *)
&lun->pending_sense[initidx].sense,
(struct scsi_sense_data_fixed *)sense_ptr);
@@ -10459,14 +10462,14 @@ ctl_scsiio_precheck(struct ctl_softc *ct
ua_type = lun->pending_sense[initidx].ua_pending;
if (ua_type != CTL_UA_NONE) {
- ctl_sense_format sense_format;
+ scsi_sense_data_type sense_format;
if (lun != NULL)
sense_format = (lun->flags &
- CTL_LUN_SENSE_DESC) ? CTL_SENSE_DESCRIPTOR :
- CTL_SENSE_FIXED;
+ CTL_LUN_SENSE_DESC) ? SSD_TYPE_DESC :
+ SSD_TYPE_FIXED;
else
- sense_format = CTL_SENSE_FIXED;
+ sense_format = SSD_TYPE_FIXED;
ua_type = ctl_build_ua(ua_type, &ctsio->sense_data,
sense_format);
Modified: stable/9/sys/cam/ctl/ctl_backend_block.c
==============================================================================
--- head/sys/cam/ctl/ctl_backend_block.c Thu Jan 12 00:34:33 2012 (r229997)
+++ stable/9/sys/cam/ctl/ctl_backend_block.c Wed Feb 15 17:28:09 2012 (r231772)
@@ -260,15 +260,15 @@ int ctl_be_block_init(void);
static struct ctl_backend_driver ctl_be_block_driver =
{
- name: "block",
- flags: CTL_BE_FLAG_HAS_CONFIG,
- init: ctl_be_block_init,
- data_submit: ctl_be_block_submit,
- data_move_done: ctl_be_block_move_done,
- config_read: ctl_be_block_config_read,
- config_write: ctl_be_block_config_write,
- ioctl: ctl_be_block_ioctl,
- lun_info: ctl_be_block_lun_info
+ .name = "block",
+ .flags = CTL_BE_FLAG_HAS_CONFIG,
+ .init = ctl_be_block_init,
+ .data_submit = ctl_be_block_submit,
+ .data_move_done = ctl_be_block_move_done,
+ .config_read = ctl_be_block_config_read,
+ .config_write = ctl_be_block_config_write,
+ .ioctl = ctl_be_block_ioctl,
+ .lun_info = ctl_be_block_lun_info
};
MALLOC_DEFINE(M_CTLBLK, "ctlblk", "Memory used for CTL block backend");
Modified: stable/9/sys/cam/ctl/ctl_backend_ramdisk.c
==============================================================================
--- head/sys/cam/ctl/ctl_backend_ramdisk.c Thu Jan 12 00:34:33 2012 (r229997)
+++ stable/9/sys/cam/ctl/ctl_backend_ramdisk.c Wed Feb 15 17:28:09 2012 (r231772)
@@ -110,14 +110,14 @@ static int ctl_backend_ramdisk_config_re
static struct ctl_backend_driver ctl_be_ramdisk_driver =
{
- name: "ramdisk",
- flags: CTL_BE_FLAG_HAS_CONFIG,
- init: ctl_backend_ramdisk_init,
- data_submit: ctl_backend_ramdisk_submit,
- data_move_done: ctl_backend_ramdisk_move_done,
- config_read: ctl_backend_ramdisk_config_read,
- config_write: ctl_backend_ramdisk_config_write,
- ioctl: ctl_backend_ramdisk_ioctl
+ .name = "ramdisk",
+ .flags = CTL_BE_FLAG_HAS_CONFIG,
+ .init = ctl_backend_ramdisk_init,
+ .data_submit = ctl_backend_ramdisk_submit,
+ .data_move_done = ctl_backend_ramdisk_move_done,
+ .config_read = ctl_backend_ramdisk_config_read,
+ .config_write = ctl_backend_ramdisk_config_write,
+ .ioctl = ctl_backend_ramdisk_ioctl
};
MALLOC_DEFINE(M_RAMDISK, "ramdisk", "Memory used for CTL RAMdisk");
Modified: stable/9/sys/cam/ctl/ctl_error.c
==============================================================================
--- head/sys/cam/ctl/ctl_error.c Thu Jan 12 00:34:33 2012 (r229997)
+++ stable/9/sys/cam/ctl/ctl_error.c Wed Feb 15 17:28:09 2012 (r231772)
@@ -354,21 +354,6 @@ ctl_sense_to_fixed(struct scsi_sense_dat
SSD_ELEM_NONE);
}
-ctl_sense_format
-ctl_get_sense_format(struct scsi_sense_data *sense_data)
-{
- switch (sense_data->error_code & SSD_ERRCODE) {
- case SSD_DESC_CURRENT_ERROR:
- case SSD_DESC_DEFERRED_ERROR:
- return (SSD_TYPE_DESC);
- case SSD_CURRENT_ERROR:
- case SSD_DEFERRED_ERROR:
- default:
- return (SSD_TYPE_FIXED);
- break;
- }
-}
-
void
ctl_set_ua(struct ctl_scsiio *ctsio, int asc, int ascq)
{
@@ -382,7 +367,7 @@ ctl_set_ua(struct ctl_scsiio *ctsio, int
ctl_ua_type
ctl_build_ua(ctl_ua_type ua_type, struct scsi_sense_data *sense,
- ctl_sense_format sense_format)
+ scsi_sense_data_type sense_format)
{
ctl_ua_type ua_to_build;
int i, asc, ascq;
Modified: stable/9/sys/cam/ctl/ctl_error.h
==============================================================================
--- head/sys/cam/ctl/ctl_error.h Thu Jan 12 00:34:33 2012 (r229997)
+++ stable/9/sys/cam/ctl/ctl_error.h Wed Feb 15 17:28:09 2012 (r231772)
@@ -42,12 +42,6 @@
#ifndef _CTL_ERROR_H_
#define _CTL_ERROR_H_
-typedef enum {
- CTL_SENSE_NOT_SPECIFIED,
- CTL_SENSE_FIXED,
- CTL_SENSE_DESCRIPTOR
-} ctl_sense_format;
-
void ctl_set_sense_data_va(struct scsi_sense_data *sense_data, void *lun,
scsi_sense_data_type sense_format, int current_error,
int sense_key, int asc, int ascq, va_list ap);
@@ -60,10 +54,9 @@ void ctl_sense_to_desc(struct scsi_sense
struct scsi_sense_data_desc *sense_dest);
void ctl_sense_to_fixed(struct scsi_sense_data_desc *sense_src,
struct scsi_sense_data_fixed *sense_dest);
-ctl_sense_format ctl_get_sense_format(struct scsi_sense_data *sense_data);
void ctl_set_ua(struct ctl_scsiio *ctsio, int asc, int ascq);
ctl_ua_type ctl_build_ua(ctl_ua_type ua_type, struct scsi_sense_data *sense,
- ctl_sense_format sense_format);
+ scsi_sense_data_type sense_format);
void ctl_set_overlapped_cmd(struct ctl_scsiio *ctsio);
void ctl_set_overlapped_tag(struct ctl_scsiio *ctsio, uint8_t tag);
void ctl_set_invalid_field(struct ctl_scsiio *ctsio, int sks_valid, int command,
Modified: stable/9/sys/cam/ctl/scsi_ctl.c
==============================================================================
--- head/sys/cam/ctl/scsi_ctl.c Thu Jan 12 00:34:33 2012 (r229997)
+++ stable/9/sys/cam/ctl/scsi_ctl.c Wed Feb 15 17:28:09 2012 (r231772)
@@ -305,8 +305,10 @@ ctlfeasync(void *callback_arg, uint32_t
/* Don't attach if it doesn't support target mode */
if ((cpi->target_sprt & PIT_PROCESSOR) == 0) {
+#ifdef CTLFEDEBUG
printf("%s: SIM %s%d doesn't support target mode\n",
__func__, cpi->dev_name, cpi->unit_number);
+#endif
break;
}
@@ -421,8 +423,10 @@ ctlfeasync(void *callback_arg, uint32_t
* XXX KDM need to figure out whether we're the master or
* slave.
*/
+#ifdef CTLFEDEBUG
printf("%s: calling ctl_frontend_register() for %s%d\n",
__func__, cpi->dev_name, cpi->unit_number);
+#endif
retval = ctl_frontend_register(fe, /*master_SC*/ 1);
if (retval != 0) {
printf("%s: ctl_frontend_register() failed with "
Modified: stable/9/sys/cam/scsi/scsi_all.c
==============================================================================
--- stable/9/sys/cam/scsi/scsi_all.c Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/sys/cam/scsi/scsi_all.c Wed Feb 15 17:28:09 2012 (r231772)
@@ -5057,14 +5057,7 @@ scsi_inquiry(struct ccb_scsiio *csio, u_
scsi_cmd->byte2 |= SI_EVPD;
scsi_cmd->page_code = page_code;
}
- /*
- * A 'transfer units' count of 256 is coded as
- * zero for all commands with a single byte count
- * field.
- */
- if (inq_len == 256)
- inq_len = 0;
- scsi_cmd->length = inq_len;
+ scsi_ulto2b(inq_len, scsi_cmd->length);
}
void
Modified: stable/9/sys/cam/scsi/scsi_all.h
==============================================================================
--- stable/9/sys/cam/scsi/scsi_all.h Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/sys/cam/scsi/scsi_all.h Wed Feb 15 17:28:09 2012 (r231772)
@@ -175,8 +175,7 @@ struct scsi_inquiry
#define SI_EVPD 0x01
#define SI_CMDDT 0x02
u_int8_t page_code;
- u_int8_t reserved;
- u_int8_t length;
+ u_int8_t length[2];
u_int8_t control;
};
@@ -532,6 +531,55 @@ struct scsi_caching_page {
uint8_t non_cache_seg_size[3];
};
+/*
+ * XXX KDM move this off to a vendor shim.
+ */
+struct copan_power_subpage {
+ uint8_t page_code;
+#define PWR_PAGE_CODE 0x00
+ uint8_t subpage;
+#define PWR_SUBPAGE_CODE 0x02
+ uint8_t page_length[2];
+ uint8_t page_version;
+#define PWR_VERSION 0x01
+ uint8_t total_luns;
+ uint8_t max_active_luns;
+#define PWR_DFLT_MAX_LUNS 0x07
+ uint8_t reserved[25];
+};
+
+/*
+ * XXX KDM move this off to a vendor shim.
+ */
+struct copan_aps_subpage {
+ uint8_t page_code;
+#define APS_PAGE_CODE 0x00
+ uint8_t subpage;
+#define APS_SUBPAGE_CODE 0x03
+ uint8_t page_length[2];
+ uint8_t page_version;
+#define APS_VERSION 0x00
+ uint8_t lock_active;
+#define APS_LOCK_ACTIVE 0x01
+#define APS_LOCK_INACTIVE 0x00
+ uint8_t reserved[26];
+};
+
+/*
+ * XXX KDM move this off to a vendor shim.
+ */
+struct copan_debugconf_subpage {
+ uint8_t page_code;
+#define DBGCNF_PAGE_CODE 0x00
+ uint8_t subpage;
+#define DBGCNF_SUBPAGE_CODE 0xF0
+ uint8_t page_length[2];
+ uint8_t page_version;
+#define DBGCNF_VERSION 0x00
+ uint8_t ctl_time_io_secs[2];
+};
+
+
struct scsi_info_exceptions_page {
u_int8_t page_code;
#define SIEP_PAGE_SAVABLE 0x80 /* Page is savable */
Modified: stable/9/sys/cam/scsi/scsi_da.h
==============================================================================
--- stable/9/sys/cam/scsi/scsi_da.h Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/sys/cam/scsi/scsi_da.h Wed Feb 15 17:28:09 2012 (r231772)
@@ -421,6 +421,56 @@ union disk_pages /* this is the structur
} flexible_disk;
};
+/*
+ * XXX KDM
+ * Here for CTL compatibility, reconcile this.
+ */
+struct scsi_format_page {
+ uint8_t page_code;
+ uint8_t page_length;
+ uint8_t tracks_per_zone[2];
+ uint8_t alt_sectors_per_zone[2];
+ uint8_t alt_tracks_per_zone[2];
+ uint8_t alt_tracks_per_lun[2];
+ uint8_t sectors_per_track[2];
+ uint8_t bytes_per_sector[2];
+ uint8_t interleave[2];
+ uint8_t track_skew[2];
+ uint8_t cylinder_skew[2];
+ uint8_t flags;
+#define SFP_SSEC 0x80
+#define SFP_HSEC 0x40
+#define SFP_RMB 0x20
+#define SFP_SURF 0x10
+ uint8_t reserved[3];
+};
+
+/*
+ * XXX KDM
+ * Here for CTL compatibility, reconcile this.
+ */
+struct scsi_rigid_disk_page {
+ uint8_t page_code;
+#define SMS_RIGID_DISK_PAGE 0x04
+ uint8_t page_length;
+ uint8_t cylinders[3];
+ uint8_t heads;
+ uint8_t start_write_precomp[3];
+ uint8_t start_reduced_current[3];
+ uint8_t step_rate[2];
+ uint8_t landing_zone_cylinder[3];
+ uint8_t rpl;
+#define SRDP_RPL_DISABLED 0x00
+#define SRDP_RPL_SLAVE 0x01
+#define SRDP_RPL_MASTER 0x02
+#define SRDP_RPL_MASTER_CONTROL 0x03
+ uint8_t rotational_offset;
+ uint8_t reserved1;
+ uint8_t rotation_rate[2];
+ uint8_t reserved2[2];
+};
+
+
struct scsi_da_rw_recovery_page {
u_int8_t page_code;
#define SMS_RW_ERROR_RECOVERY_PAGE 0x01
Modified: stable/9/sys/cam/scsi/scsi_targ_bh.c
==============================================================================
--- stable/9/sys/cam/scsi/scsi_targ_bh.c Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/sys/cam/scsi/scsi_targ_bh.c Wed Feb 15 17:28:09 2012 (r231772)
@@ -604,7 +604,7 @@ targbhdone(struct cam_periph *periph, un
atio->ccb_h.flags |= CAM_DIR_IN;
descr->data = &no_lun_inq_data;
descr->data_resid = MIN(sizeof(no_lun_inq_data),
- SCSI_CDB6_LEN(inq->length));
+ scsi_2btoul(inq->length));
descr->data_increment = descr->data_resid;
descr->timeout = 5 * 1000;
descr->status = SCSI_STATUS_OK;
Modified: stable/9/sys/conf/NOTES
==============================================================================
--- stable/9/sys/conf/NOTES Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/sys/conf/NOTES Wed Feb 15 17:28:09 2012 (r231772)
@@ -1283,6 +1283,7 @@ device targ #SCSI Target Mode Code
device targbh #SCSI Target Mode Blackhole Device
device pass #CAM passthrough driver
device sg #Linux SCSI passthrough
+device ctl #CAM Target Layer
# CAM OPTIONS:
# debugging options:
Modified: stable/9/sys/conf/files
==============================================================================
--- stable/9/sys/conf/files Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/sys/conf/files Wed Feb 15 17:28:09 2012 (r231772)
@@ -115,6 +115,19 @@ cam/scsi/scsi_all.c optional scbus
cam/scsi/scsi_cd.c optional cd
cam/scsi/scsi_ch.c optional ch
cam/ata/ata_da.c optional ada | da
+cam/ctl/ctl.c optional ctl
+cam/ctl/ctl_backend.c optional ctl
+cam/ctl/ctl_backend_block.c optional ctl
+cam/ctl/ctl_backend_ramdisk.c optional ctl
+cam/ctl/ctl_cmd_table.c optional ctl
+cam/ctl/ctl_frontend.c optional ctl
+cam/ctl/ctl_frontend_cam_sim.c optional ctl
+cam/ctl/ctl_frontend_internal.c optional ctl
+cam/ctl/ctl_mem_pool.c optional ctl
+cam/ctl/ctl_scsi_all.c optional ctl
+cam/ctl/ctl_error.c optional ctl
+cam/ctl/ctl_util.c optional ctl
+cam/ctl/scsi_ctl.c optional ctl
cam/scsi/scsi_da.c optional da
cam/scsi/scsi_low.c optional ct | ncv | nsp | stg
cam/scsi/scsi_low_pisa.c optional ct | ncv | nsp | stg
Modified: stable/9/sys/dev/ata/atapi-cam.c
==============================================================================
--- stable/9/sys/dev/ata/atapi-cam.c Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/sys/dev/ata/atapi-cam.c Wed Feb 15 17:28:09 2012 (r231772)
@@ -576,9 +576,10 @@ atapi_action(struct cam_sim *sim, union
struct scsi_inquiry *inq = (struct scsi_inquiry *) &request->u.atapi.ccb[0];
if (inq->byte2 == 0 && inq->page_code == 0 &&
- inq->length > SHORT_INQUIRY_LENGTH) {
+ scsi_2btoul(inq->length) > SHORT_INQUIRY_LENGTH) {
bzero(buf, len);
- len = inq->length = SHORT_INQUIRY_LENGTH;
+ len = SHORT_INQUIRY_LENGTH;
+ scsi_ulto2b(len, inq->length);
}
break;
}
Modified: stable/9/sys/dev/ciss/ciss.c
==============================================================================
--- stable/9/sys/dev/ciss/ciss.c Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/sys/dev/ciss/ciss.c Wed Feb 15 17:28:09 2012 (r231772)
@@ -1620,7 +1620,7 @@ ciss_inquiry_logical(struct ciss_softc *
inq->opcode = INQUIRY;
inq->byte2 = SI_EVPD;
inq->page_code = CISS_VPD_LOGICAL_DRIVE_GEOMETRY;
- inq->length = sizeof(ld->cl_geometry);
+ scsi_ulto2b(sizeof(ld->cl_geometry), inq->length);
if ((error = ciss_synch_request(cr, 60 * 1000)) != 0) {
ciss_printf(sc, "error getting geometry (%d)\n", error);
Modified: stable/9/sys/i386/conf/GENERIC
==============================================================================
--- stable/9/sys/i386/conf/GENERIC Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/sys/i386/conf/GENERIC Wed Feb 15 17:28:09 2012 (r231772)
@@ -125,7 +125,8 @@ device da # Direct Access (disks)
device sa # Sequential Access (tape etc)
device cd # CD
device pass # Passthrough device (direct ATA/SCSI access)
-device ses # SCSI Environmental Services (and SAF-TE)
+device ses # Enclosure Services (SES and SAF-TE)
+device ctl # CAM Target Layer
# RAID controllers interfaced to the SCSI subsystem
device amr # AMI MegaRAID
Modified: stable/9/sys/i386/conf/PAE
==============================================================================
--- stable/9/sys/i386/conf/PAE Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/sys/i386/conf/PAE Wed Feb 15 17:28:09 2012 (r231772)
@@ -23,6 +23,7 @@ device ispfw
# address properly may cause data corruption when used in a machine with more
# than 4 gigabytes of memory.
+
nodevice ahb
nodevice amd
nodevice sym
@@ -38,6 +39,8 @@ nodevice ncv
nodevice nsp
nodevice stg
+nodevice ctl
+
nodevice asr
nodevice dpt
nodevice mly
Modified: stable/9/sys/ia64/conf/GENERIC
==============================================================================
--- stable/9/sys/ia64/conf/GENERIC Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/sys/ia64/conf/GENERIC Wed Feb 15 17:28:09 2012 (r231772)
@@ -99,7 +99,8 @@ device ch # Media changer
device da # Direct Access (ie disk)
device pass # Passthrough (direct ATA/SCSI access)
device sa # Sequential Access (ie tape)
-device ses # Environmental Services (and SAF-TE)
+device ses # Enclosure Services (SES and SAF-TE)
+device ctl # CAM Target Layer
# RAID controllers
device aac # Adaptec FSA RAID
Modified: stable/9/sys/sparc64/conf/GENERIC
==============================================================================
--- stable/9/sys/sparc64/conf/GENERIC Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/sys/sparc64/conf/GENERIC Wed Feb 15 17:28:09 2012 (r231772)
@@ -105,6 +105,7 @@ device sa # Sequential Access (tape et
device cd # CD
device pass # Passthrough device (direct ATA/SCSI access)
device ses # SCSI Environmental Services (and SAF-TE)
+device ctl # CAM Target Layer
# RAID controllers
#device amr # AMI MegaRAID
Modified: stable/9/usr.bin/Makefile
==============================================================================
--- stable/9/usr.bin/Makefile Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/usr.bin/Makefile Wed Feb 15 17:28:09 2012 (r231772)
@@ -33,6 +33,7 @@ SUBDIR= alias \
compress \
cpuset \
csplit \
+ ctlstat \
cut \
dirname \
du \
Modified: stable/9/usr.bin/ctlstat/ctlstat.c
==============================================================================
--- head/usr.bin/ctlstat/ctlstat.c Thu Jan 12 00:34:33 2012 (r229997)
+++ stable/9/usr.bin/ctlstat/ctlstat.c Wed Feb 15 17:28:09 2012 (r231772)
@@ -146,7 +146,7 @@ static void compute_stats(struct ctl_lun
static void
usage(int error)
{
- fprintf(error ? stderr : stdout, ctlstat_usage);
+ fputs(ctlstat_usage, error ? stderr : stdout);
}
static int
Modified: stable/9/usr.sbin/Makefile
==============================================================================
--- stable/9/usr.sbin/Makefile Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/usr.sbin/Makefile Wed Feb 15 17:28:09 2012 (r231772)
@@ -16,6 +16,7 @@ SUBDIR= adduser \
clear_locks \
crashinfo \
cron \
+ ctladm \
daemon \
dconschat \
devinfo \
Modified: stable/9/usr.sbin/mlxcontrol/interface.c
==============================================================================
--- stable/9/usr.sbin/mlxcontrol/interface.c Wed Feb 15 17:09:26 2012 (r231771)
+++ stable/9/usr.sbin/mlxcontrol/interface.c Wed Feb 15 17:28:09 2012 (r231772)
@@ -253,7 +253,7 @@ mlx_scsi_inquiry(int unit, int channel,
/* build the cdb */
inq_cmd->opcode = INQUIRY;
- inq_cmd->length = SHORT_INQUIRY_LENGTH;
+ scsi_ulto2b(SHORT_INQUIRY_LENGTH, inq_cmd->length);
/* hand it off for processing */
mlx_perform(unit, mlx_command, &cmd);
More information about the svn-src-all
mailing list