Part 1 of a cleanup pass over the SCSI subsystem. The aim is to name
everything "scsi_*", since we really are talking about the SCSI command set, ATAPI transport not withstanding. Improve the names of many structures, and prepend "SCSI_" onto all SCSI command opcodes. Place items described by the SCSI Primary Commands document into scsi_spc.h.
This commit is contained in:
parent
738be40c8f
commit
df9803ce96
distrib/sets/lists/comp
sbin/scsictl
sys
arch
amiga/dev
arc/dti
atari/dev
mac68k/dev
next68k/stand/boot
x68k/dev
dev
eisa
ic
adv.cadv.hadw.cadw.hadwlib.haha.cahareg.haic6360.caic79xx.caic79xx_osm.caic79xx_osm.haic7xxx.caic7xxx_inline.haic7xxx_osm.haic7xxxvar.hbhareg.hdptvar.hicpsp.cicpvar.hiha.cncr53c9x.cuha.cuhareg.h
ieee1394
isa
pci
scsipi
Makefileatapi_base.catapi_tape.hcd.cch.cscsi_all.hscsi_spc.hscsipi_all.hscsipi_base.cscsipi_verbose.cscsipiconf.hsd.cst.cst_scsi.c
usb
@ -1,4 +1,4 @@
|
||||
# $NetBSD: mi,v 1.764 2005/02/20 06:49:01 christos Exp $
|
||||
# $NetBSD: mi,v 1.765 2005/02/21 00:29:08 thorpej Exp $
|
||||
./etc/mtree/set.comp comp-sys-root
|
||||
./usr/bin/addr2line comp-debug-bin bfd
|
||||
./usr/bin/ar comp-util-bin bfd
|
||||
@ -413,6 +413,7 @@
|
||||
./usr/include/dev/scsipi/scsi_disk.h comp-c-include
|
||||
./usr/include/dev/scsipi/scsi_message.h comp-obsolete obsolete
|
||||
./usr/include/dev/scsipi/scsi_scanner.h comp-obsolete obsolete
|
||||
./usr/include/dev/scsipi/scsi_spc.h comp-c-include
|
||||
./usr/include/dev/scsipi/scsi_tape.h comp-obsolete obsolete
|
||||
./usr/include/dev/scsipi/scsiconf.h comp-c-include
|
||||
./usr/include/dev/scsipi/scsipi_all.h comp-c-include
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: scsi_subr.c,v 1.10 2005/02/05 13:37:39 xtraeme Exp $ */
|
||||
/* $NetBSD: scsi_subr.c,v 1.11 2005/02/21 00:29:08 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -45,7 +45,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: scsi_subr.c,v 1.10 2005/02/05 13:37:39 xtraeme Exp $");
|
||||
__RCSID("$NetBSD: scsi_subr.c,v 1.11 2005/02/21 00:29:08 thorpej Exp $");
|
||||
#endif
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ __RCSID("$NetBSD: scsi_subr.c,v 1.10 2005/02/05 13:37:39 xtraeme Exp $");
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
@ -104,12 +104,12 @@ scsi_command(int fd, void *cmd, size_t cmdlen, void *data, size_t datalen,
|
||||
void
|
||||
scsi_mode_sense(int fd, u_int8_t pgcode, u_int8_t pctl, void *buf, size_t len)
|
||||
{
|
||||
struct scsipi_mode_sense cmd;
|
||||
struct scsi_mode_sense_6 cmd;
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
memset(buf, 0, len);
|
||||
|
||||
cmd.opcode = MODE_SENSE;
|
||||
cmd.opcode = SCSI_MODE_SENSE_6;
|
||||
cmd.page = pgcode | pctl;
|
||||
cmd.length = len;
|
||||
|
||||
@ -119,11 +119,11 @@ scsi_mode_sense(int fd, u_int8_t pgcode, u_int8_t pctl, void *buf, size_t len)
|
||||
void
|
||||
scsi_mode_select(int fd, u_int8_t byte2, void *buf, size_t len)
|
||||
{
|
||||
struct scsipi_mode_select cmd;
|
||||
struct scsi_mode_select_6 cmd;
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
|
||||
cmd.opcode = MODE_SELECT;
|
||||
cmd.opcode = SCSI_MODE_SELECT_6;
|
||||
cmd.byte2 = SMS_PF | byte2;
|
||||
cmd.length = len;
|
||||
|
||||
@ -133,12 +133,12 @@ scsi_mode_select(int fd, u_int8_t byte2, void *buf, size_t len)
|
||||
void
|
||||
scsi_request_sense(int fd, void *buf, size_t len)
|
||||
{
|
||||
struct scsipi_sense cmd;
|
||||
struct scsi_request_sense cmd;
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
memset(buf, 0, len);
|
||||
|
||||
cmd.opcode = REQUEST_SENSE;
|
||||
cmd.opcode = SCSI_REQUEST_SENSE;
|
||||
cmd.length = len;
|
||||
scsi_command(fd, &cmd, sizeof(cmd), buf, len, 10000, SCCMD_READ);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: scsictl.c,v 1.26 2005/02/05 13:37:39 xtraeme Exp $ */
|
||||
/* $NetBSD: scsictl.c,v 1.27 2005/02/21 00:29:08 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
|
||||
@ -43,7 +43,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: scsictl.c,v 1.26 2005/02/05 13:37:39 xtraeme Exp $");
|
||||
__RCSID("$NetBSD: scsictl.c,v 1.27 2005/02/21 00:29:08 thorpej Exp $");
|
||||
#endif
|
||||
|
||||
|
||||
@ -60,8 +60,8 @@ __RCSID("$NetBSD: scsictl.c,v 1.26 2005/02/05 13:37:39 xtraeme Exp $");
|
||||
#include <unistd.h>
|
||||
#include <util.h>
|
||||
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsi_disk.h>
|
||||
#include <dev/scsipi/scsipiconf.h>
|
||||
|
||||
@ -461,7 +461,7 @@ device_format(int argc, char *argv[])
|
||||
PC*1, PC*2, PC*3, PC*4, PC*5, PC*6, PC*7, PC*8, PC*9, 65536
|
||||
};
|
||||
char *cp, buffer[64];
|
||||
struct scsipi_sense_data sense;
|
||||
struct scsi_sense_data sense;
|
||||
struct scsi_format_unit cmd;
|
||||
struct {
|
||||
struct scsi_format_unit_defect_list_header header;
|
||||
@ -469,13 +469,13 @@ device_format(int argc, char *argv[])
|
||||
/* optional defect list */
|
||||
} dfl;
|
||||
struct {
|
||||
struct scsipi_mode_header header;
|
||||
struct scsi_blk_desc blk_desc;
|
||||
struct scsi_mode_parameter_header_6 header;
|
||||
struct scsi_general_block_descriptor blk_desc;
|
||||
struct page_disk_format format_page;
|
||||
} mode_page;
|
||||
struct {
|
||||
struct scsipi_mode_header header;
|
||||
struct scsi_blk_desc blk_desc;
|
||||
struct scsi_mode_parameter_header_6 header;
|
||||
struct scsi_general_block_descriptor blk_desc;
|
||||
} data_select;
|
||||
|
||||
|
||||
@ -491,7 +491,7 @@ device_format(int argc, char *argv[])
|
||||
*/
|
||||
for (i = 0; i < 8; i++) {
|
||||
scsi_request_sense(fd, &sense, sizeof (sense));
|
||||
if ((j = sense.flags & SSD_KEY) == SKEY_NO_SENSE)
|
||||
if ((j = SSD_SENSE_KEY(sense.flags)) == SKEY_NO_SENSE)
|
||||
break;
|
||||
}
|
||||
/*
|
||||
@ -541,7 +541,8 @@ device_format(int argc, char *argv[])
|
||||
|
||||
memset(&data_select, 0, sizeof(data_select));
|
||||
|
||||
data_select.header.blk_desc_len = sizeof(struct scsi_blk_desc);
|
||||
data_select.header.blk_desc_len =
|
||||
sizeof(struct scsi_general_block_descriptor);
|
||||
/*
|
||||
* blklen in desc is 3 bytes with a leading reserved byte
|
||||
*/
|
||||
@ -591,10 +592,10 @@ device_format(int argc, char *argv[])
|
||||
fflush(stdout);
|
||||
do {
|
||||
scsireq_t req;
|
||||
struct scsipi_test_unit_ready tcmd;
|
||||
struct scsi_test_unit_ready tcmd;
|
||||
|
||||
memset(&tcmd, 0, sizeof(cmd));
|
||||
tcmd.opcode = TEST_UNIT_READY;
|
||||
tcmd.opcode = SCSI_TEST_UNIT_READY;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
memcpy(req.cmd, &tcmd, 6);
|
||||
@ -623,16 +624,16 @@ device_format(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
memcpy(&sense, req.sense, SENSEBUFLEN);
|
||||
if (sense.sense_key_spec_1 == SSD_SCS_VALID) {
|
||||
j = (sense.sense_key_spec_2 << 8) |
|
||||
(sense.sense_key_spec_3);
|
||||
if (sense.sks.sks_bytes[0] & SSD_SKSV) {
|
||||
j = (sense.sks.sks_bytes[1] << 8) |
|
||||
(sense.sks.sks_bytes[2]);
|
||||
if (j >= complete[i]) {
|
||||
printf(".%d0%%.", ++i);
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
sleep(10);
|
||||
} while ((sense.flags & SSD_KEY) == SKEY_NOT_READY);
|
||||
} while (SSD_SENSE_KEY(sense.flags) == SKEY_NOT_READY);
|
||||
printf(".100%%..done.\n");
|
||||
}
|
||||
return;
|
||||
@ -746,7 +747,7 @@ device_reassign(int argc, char *argv[])
|
||||
void
|
||||
device_release(int argc, char *argv[])
|
||||
{
|
||||
struct scsipi_test_unit_ready cmd; /* close enough */
|
||||
struct scsi_test_unit_ready cmd; /* close enough */
|
||||
|
||||
/* No arguments. */
|
||||
if (argc != 0)
|
||||
@ -774,7 +775,7 @@ device_release(int argc, char *argv[])
|
||||
void
|
||||
device_reserve(int argc, char *argv[])
|
||||
{
|
||||
struct scsipi_test_unit_ready cmd; /* close enough */
|
||||
struct scsi_test_unit_ready cmd; /* close enough */
|
||||
|
||||
/* No arguments. */
|
||||
if (argc != 0)
|
||||
@ -839,8 +840,8 @@ void
|
||||
device_getcache(int argc, char *argv[])
|
||||
{
|
||||
struct {
|
||||
struct scsipi_mode_header header;
|
||||
struct scsi_blk_desc blk_desc;
|
||||
struct scsi_mode_parameter_header_6 header;
|
||||
struct scsi_general_block_descriptor blk_desc;
|
||||
struct page_caching caching_params;
|
||||
} data;
|
||||
|
||||
@ -872,8 +873,8 @@ void
|
||||
device_setcache(int argc, char *argv[])
|
||||
{
|
||||
struct {
|
||||
struct scsipi_mode_header header;
|
||||
struct scsi_blk_desc blk_desc;
|
||||
struct scsi_mode_parameter_header_6 header;
|
||||
struct scsi_general_block_descriptor blk_desc;
|
||||
struct page_caching caching_params;
|
||||
} data;
|
||||
int dlen;
|
||||
@ -928,7 +929,7 @@ device_setcache(int argc, char *argv[])
|
||||
void
|
||||
device_flushcache(int argc, char *argv[])
|
||||
{
|
||||
struct scsipi_test_unit_ready cmd; /* close enough */
|
||||
struct scsi_test_unit_ready cmd; /* close enough */
|
||||
|
||||
/* No arguments. */
|
||||
if (argc != 0)
|
||||
@ -951,7 +952,7 @@ device_flushcache(int argc, char *argv[])
|
||||
void
|
||||
device_prevent(int argc, char *argv[])
|
||||
{
|
||||
struct scsipi_prevent cmd;
|
||||
struct scsi_prevent_allow_medium_removal cmd;
|
||||
|
||||
/* No arguments. */
|
||||
if (argc != 0)
|
||||
@ -959,8 +960,8 @@ device_prevent(int argc, char *argv[])
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
|
||||
cmd.opcode = PREVENT_ALLOW;
|
||||
cmd.how = PR_PREVENT;
|
||||
cmd.opcode = SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL;
|
||||
cmd.how = SPAMR_PREVENT_DT; /* XXX SMAMR_PREVENT_ALL? */
|
||||
|
||||
scsi_command(fd, &cmd, sizeof(cmd), NULL, 0, 10000, 0);
|
||||
|
||||
@ -975,7 +976,7 @@ device_prevent(int argc, char *argv[])
|
||||
void
|
||||
device_allow(int argc, char *argv[])
|
||||
{
|
||||
struct scsipi_prevent cmd;
|
||||
struct scsi_prevent_allow_medium_removal cmd;
|
||||
|
||||
/* No arguments. */
|
||||
if (argc != 0)
|
||||
@ -983,8 +984,8 @@ device_allow(int argc, char *argv[])
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
|
||||
cmd.opcode = PREVENT_ALLOW;
|
||||
cmd.how = PR_ALLOW;
|
||||
cmd.opcode = SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL;
|
||||
cmd.how = SPAMR_ALLOW;
|
||||
|
||||
scsi_command(fd, &cmd, sizeof(cmd), NULL, 0, 10000, 0);
|
||||
|
||||
@ -1047,7 +1048,7 @@ device_stop(int argc, char *argv[])
|
||||
void
|
||||
device_tur(int argc, char *argv[])
|
||||
{
|
||||
struct scsipi_test_unit_ready cmd;
|
||||
struct scsi_test_unit_ready cmd;
|
||||
|
||||
/* No arguments. */
|
||||
if (argc != 0)
|
||||
@ -1055,7 +1056,7 @@ device_tur(int argc, char *argv[])
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
|
||||
cmd.opcode = TEST_UNIT_READY;
|
||||
cmd.opcode = SCSI_TEST_UNIT_READY;
|
||||
|
||||
scsi_command(fd, &cmd, sizeof(cmd), NULL, 0, 10000, 0);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: idesc.c,v 1.57 2004/12/07 23:14:03 thorpej Exp $ */
|
||||
/* $NetBSD: idesc.c,v 1.58 2005/02/21 00:29:06 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -93,7 +93,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: idesc.c,v 1.57 2004/12/07 23:14:03 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: idesc.c,v 1.58 2005/02/21 00:29:06 thorpej Exp $");
|
||||
|
||||
/*
|
||||
* A4000 IDE interface, emulating a SCSI controller
|
||||
@ -109,6 +109,7 @@ __KERNEL_RCSID(0, "$NetBSD: idesc.c,v 1.57 2004/12/07 23:14:03 thorpej Exp $");
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsipi_disk.h>
|
||||
@ -711,12 +712,12 @@ ide_scsidone(struct idec_softc *dev, int stat)
|
||||
int
|
||||
idegetsense(struct idec_softc *dev, struct scsipi_xfer *xs)
|
||||
{
|
||||
struct scsipi_sense rqs;
|
||||
struct scsi_request_sense rqs;
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
|
||||
if (dev->sc_cur->sc_flags & IDEF_ATAPI)
|
||||
return (0);
|
||||
rqs.opcode = REQUEST_SENSE;
|
||||
rqs.opcode = SCSI_REQUEST_SENSE;
|
||||
rqs.byte2 = periph->periph_lun << 5;
|
||||
#ifdef not_yet
|
||||
rqs.length = xs->req_sense_length ? xs->req_sense_length :
|
||||
@ -960,8 +961,8 @@ ideicmd(struct idec_softc *dev, int target, void *cbuf, int clen, void *buf,
|
||||
int nblks;
|
||||
struct scsipi_inquiry_data *inqbuf;
|
||||
struct {
|
||||
struct scsipi_mode_header header;
|
||||
struct scsi_blk_desc blk_desc;
|
||||
struct scsi_mode_parameter_header_6 header;
|
||||
struct scsi_general_block_descriptor blk_desc;
|
||||
union scsi_disk_pages pages;
|
||||
} *mdsnbuf;
|
||||
|
||||
@ -985,10 +986,10 @@ ideicmd(struct idec_softc *dev, int target, void *cbuf, int clen, void *buf,
|
||||
return (ide_atapi_icmd(dev, target, cbuf, clen, buf, len));
|
||||
}
|
||||
|
||||
if (*((u_char *)cbuf) != REQUEST_SENSE)
|
||||
if (*((u_char *)cbuf) != SCSI_REQUEST_SENSE)
|
||||
ide->sc_error = 0;
|
||||
switch (*((u_char *)cbuf)) {
|
||||
case TEST_UNIT_READY:
|
||||
case SCSI_TEST_UNIT_READY:
|
||||
dev->sc_stat[0] = 0;
|
||||
return (0);
|
||||
|
||||
@ -1045,12 +1046,12 @@ ideicmd(struct idec_softc *dev, int target, void *cbuf, int clen, void *buf,
|
||||
nblks = 256;
|
||||
return (ideiwrite(ide, lba, buf, nblks));
|
||||
|
||||
case PREVENT_ALLOW:
|
||||
case SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL:
|
||||
case START_STOP: /* and LOAD */
|
||||
dev->sc_stat[0] = 0;
|
||||
return (0);
|
||||
|
||||
case MODE_SENSE:
|
||||
case SCSI_MODE_SENSE_6:
|
||||
mdsnbuf = (void*) buf;
|
||||
bzero(buf, *((u_char *)cbuf + 4));
|
||||
switch (*((u_char *)cbuf + 2) & 0x3f) {
|
||||
@ -1072,7 +1073,7 @@ ideicmd(struct idec_softc *dev, int target, void *cbuf, int clen, void *buf,
|
||||
return (-1);
|
||||
}
|
||||
|
||||
case REQUEST_SENSE:
|
||||
case SCSI_REQUEST_SENSE:
|
||||
/* convert sc_error to SCSI sense */
|
||||
bzero (buf, *((u_char *)cbuf + 4));
|
||||
*((u_char *) buf) = 0x70;
|
||||
@ -1094,7 +1095,7 @@ ideicmd(struct idec_softc *dev, int target, void *cbuf, int clen, void *buf,
|
||||
case SCSI_REASSIGN_BLOCKS:
|
||||
case 0x10 /*WRITE_FILEMARKS*/:
|
||||
case 0x11 /*SPACE*/:
|
||||
case MODE_SELECT:
|
||||
case SCSI_MODE_SELECT_6:
|
||||
default:
|
||||
printf ("ide: unhandled SCSI command %02x\n", *((u_char *)cbuf));
|
||||
ide->sc_error = 0x04;
|
||||
@ -1317,7 +1318,7 @@ int ide_atapi_start(struct idec_softc *dev)
|
||||
u_short *bf;
|
||||
union {
|
||||
struct scsipi_rw_10 rw_big;
|
||||
struct scsipi_mode_sense_big md_big;
|
||||
struct scsi_mode_sense_10 md_big;
|
||||
} cmd;
|
||||
|
||||
/* Wait for cmd i/o phase */
|
||||
@ -1348,8 +1349,8 @@ int ide_atapi_start(struct idec_softc *dev)
|
||||
cmd.rw_big.length[0] = 1;
|
||||
bf = (u_short *)&cmd.rw_big;
|
||||
break;
|
||||
case MODE_SENSE:
|
||||
case MODE_SELECT:
|
||||
case SCSI_MODE_SENSE_6:
|
||||
case SCSI_MODE_SELECT_6:
|
||||
bzero((char *)&cmd, sizeof(cmd.md_big));
|
||||
cmd.md_big.opcode = xs->cmd->opcode |= 0x40;
|
||||
cmd.md_big.byte2 = xs->cmd->bytes[0];
|
||||
@ -1452,7 +1453,7 @@ ide_atapi_intr(struct idec_softc *dev)
|
||||
int retries = 0;
|
||||
union {
|
||||
struct scsipi_rw_10 rw_big;
|
||||
struct scsipi_mode_sense_big md_big;
|
||||
struct scsi_mode_sense_10 md_big;
|
||||
} cmd;
|
||||
|
||||
if (wait_for_unbusy(dev) < 0) {
|
||||
@ -1501,8 +1502,8 @@ again:
|
||||
cmd.rw_big.length[0] = 1;
|
||||
bf = (u_short *)&cmd.rw_big;
|
||||
break;
|
||||
case MODE_SENSE:
|
||||
case MODE_SELECT:
|
||||
case SCSI_MODE_SENSE_6:
|
||||
case SCSI_MODE_SELECT_6:
|
||||
bzero((char *)&cmd, sizeof(cmd.md_big));
|
||||
cmd.md_big.opcode = xs->cmd->opcode |= 0x40;
|
||||
cmd.md_big.byte2 = xs->cmd->bytes[0];
|
||||
@ -1580,7 +1581,7 @@ again:
|
||||
if ((status & IDES_ERR) == 0)
|
||||
xs->error = XS_SENSE;
|
||||
} else if (status & IDES_ERR) {
|
||||
struct scsipi_sense rqs;
|
||||
struct scsi_request_sense rqs;
|
||||
|
||||
#ifdef DEBUG_ATAPI
|
||||
printf("ide_atapi_intr: error status %x err %x\n",
|
||||
@ -1589,7 +1590,7 @@ again:
|
||||
xs->error = XS_SHORTSENSE;
|
||||
xs->sense.atapi_sense = err;
|
||||
ide->sc_flags |= IDEF_SENSE;
|
||||
rqs.opcode = REQUEST_SENSE;
|
||||
rqs.opcode = SCSI_REQUEST_SENSE;
|
||||
rqs.byte2 = xs->xs_periph->periph_lun << 5;
|
||||
rqs.length = sizeof(xs->sense.scsi_sense);
|
||||
rqs.unused[0] = rqs.unused[1] = rqs.control = 0;
|
||||
@ -1629,7 +1630,7 @@ ide_atapi_done(struct idec_softc *dev)
|
||||
int atapi_sense = xs->sense.atapi_sense;
|
||||
|
||||
bzero((char *)&xs->sense.scsi_sense, sizeof(xs->sense.scsi_sense));
|
||||
xs->sense.scsi_sense.error_code = 0x70;
|
||||
xs->sense.scsi_sense.response_code = 0x70;
|
||||
xs->sense.scsi_sense.flags = atapi_sense >> 4;
|
||||
if (atapi_sense & 0x01)
|
||||
xs->sense.scsi_sense.flags |= SSD_ILI;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: btl.c,v 1.17 2005/01/22 07:44:33 tsutsui Exp $ */
|
||||
/* $NetBSD: btl.c,v 1.18 2005/02/21 00:29:06 thorpej Exp $ */
|
||||
/* NetBSD: bt.c,v 1.10 1996/05/12 23:51:54 mycroft Exp */
|
||||
|
||||
#undef BTDIAG
|
||||
@ -51,7 +51,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: btl.c,v 1.17 2005/01/22 07:44:33 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: btl.c,v 1.18 2005/02/21 00:29:06 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -797,7 +797,7 @@ bt_start_ccbs(struct bt_softc *sc)
|
||||
void
|
||||
bt_done(struct bt_softc *sc, struct bt_ccb *ccb)
|
||||
{
|
||||
struct scsipi_sense_data *s1, *s2;
|
||||
struct scsi_sense_data *s1, *s2;
|
||||
struct scsipi_xfer *xs = ccb->xs;
|
||||
|
||||
u_long thiskv, thisbounce;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: btlreg.h,v 1.6 2005/01/22 07:35:34 tsutsui Exp $ */
|
||||
/* $NetBSD: btlreg.h,v 1.7 2005/02/21 00:29:06 thorpej Exp $ */
|
||||
|
||||
typedef uint8_t physaddr[4];
|
||||
typedef uint8_t physlen[4];
|
||||
@ -133,7 +133,7 @@ struct bt_ccb {
|
||||
/*------------------------------------longword boundary */
|
||||
physaddr sense_ptr;
|
||||
/*-----end of HW fields-----------------------longword boundary */
|
||||
struct scsipi_sense_data scsi_sense;
|
||||
struct scsi_sense_data scsi_sense;
|
||||
/*------------------------------------longword boundary */
|
||||
struct bt_scat_gath scat_gath[BT_NSEG];
|
||||
/*------------------------------------longword boundary */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ncr5380.c,v 1.47 2004/12/07 21:12:42 thorpej Exp $ */
|
||||
/* $NetBSD: ncr5380.c,v 1.48 2005/02/21 00:29:06 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Leo Weppelman.
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ncr5380.c,v 1.47 2004/12/07 21:12:42 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ncr5380.c,v 1.48 2005/02/21 00:29:06 thorpej Exp $");
|
||||
|
||||
/*
|
||||
* Bit mask of targets you want debugging to be shown
|
||||
@ -67,7 +67,7 @@ u_char ncr_will_link = 0x00;
|
||||
* This is the default sense-command we send.
|
||||
*/
|
||||
static u_char sense_cmd[] = {
|
||||
REQUEST_SENSE, 0, 0, 0, sizeof(struct scsipi_sense_data), 0
|
||||
SCSI_REQUEST_SENSE, 0, 0, 0, sizeof(struct scsi_sense_data), 0
|
||||
};
|
||||
|
||||
/*
|
||||
@ -343,7 +343,8 @@ ncr5380_scsi_request(chan, req, arg)
|
||||
*/
|
||||
sps = splbio();
|
||||
link = NULL;
|
||||
if ((issue_q == NULL) || (reqp->xcmd.opcode == REQUEST_SENSE)) {
|
||||
if ((issue_q == NULL) ||
|
||||
(reqp->xcmd.opcode == SCSI_REQUEST_SENSE)) {
|
||||
reqp->next = issue_q;
|
||||
issue_q = reqp;
|
||||
}
|
||||
@ -400,8 +401,9 @@ ncr5380_scsi_request(chan, req, arg)
|
||||
|
||||
#ifdef DBG_REQ
|
||||
if (dbg_target_mask & (1 << reqp->targ_id))
|
||||
show_request(reqp, (reqp->xcmd.opcode == REQUEST_SENSE) ?
|
||||
"HEAD":"TAIL");
|
||||
show_request(reqp,
|
||||
(reqp->xcmd.opcode == SCSI_REQUEST_SENSE) ?
|
||||
"HEAD":"TAIL");
|
||||
#endif
|
||||
|
||||
run_main(sc);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ncr5380.c,v 1.57 2005/01/15 16:00:59 chs Exp $ */
|
||||
/* $NetBSD: ncr5380.c,v 1.58 2005/02/21 00:29:06 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Leo Weppelman.
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ncr5380.c,v 1.57 2005/01/15 16:00:59 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ncr5380.c,v 1.58 2005/02/21 00:29:06 thorpej Exp $");
|
||||
|
||||
/*
|
||||
* Bit mask of targets you want debugging to be shown
|
||||
@ -67,7 +67,7 @@ u_char ncr_test_link = 0x7f;
|
||||
* This is the default sense-command we send.
|
||||
*/
|
||||
static u_char sense_cmd[] = {
|
||||
REQUEST_SENSE, 0, 0, 0, sizeof(struct scsipi_sense_data), 0
|
||||
SCSI_REQUEST_SENSE, 0, 0, 0, sizeof(struct scsi_sense_data), 0
|
||||
};
|
||||
|
||||
/*
|
||||
@ -337,7 +337,8 @@ ncr5380_scsi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||
*/
|
||||
sps = splbio();
|
||||
link = NULL;
|
||||
if ((issue_q == NULL) || (reqp->xcmd.opcode == REQUEST_SENSE)) {
|
||||
if ((issue_q == NULL) ||
|
||||
(reqp->xcmd.opcode == SCSI_REQUEST_SENSE)) {
|
||||
reqp->next = issue_q;
|
||||
issue_q = reqp;
|
||||
} else {
|
||||
@ -395,8 +396,9 @@ ncr5380_scsi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||
|
||||
#ifdef DBG_REQ
|
||||
if (dbg_target_mask & (1 << reqp->targ_id))
|
||||
show_request(reqp, (reqp->xcmd.opcode == REQUEST_SENSE) ?
|
||||
"HEAD":"TAIL");
|
||||
show_request(reqp,
|
||||
(reqp->xcmd.opcode == SCSI_REQUEST_SENSE) ?
|
||||
"HEAD":"TAIL");
|
||||
#endif
|
||||
|
||||
run_main(sc);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sd.c,v 1.6 2004/12/07 23:14:03 thorpej Exp $ */
|
||||
/* $NetBSD: sd.c,v 1.7 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1994 Rolf Grossmann
|
||||
* All rights reserved.
|
||||
@ -31,6 +31,7 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsipi_disk.h>
|
||||
@ -72,14 +73,14 @@ int sdclose(struct open_file *f);
|
||||
int
|
||||
sdprobe(char target, char lun)
|
||||
{
|
||||
struct scsipi_test_unit_ready cdb1;
|
||||
struct scsi_test_unit_ready cdb1;
|
||||
struct scsipi_inquiry cdb2;
|
||||
struct scsipi_inquiry_data inq;
|
||||
int error, retries;
|
||||
int count;
|
||||
|
||||
bzero(&cdb1, sizeof(cdb1));
|
||||
cdb1.opcode = TEST_UNIT_READY;
|
||||
cdb1.opcode = SCSI_TEST_UNIT_READY;
|
||||
|
||||
retries = 0;
|
||||
do {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mha.c,v 1.35 2005/01/18 07:12:15 chs Exp $ */
|
||||
/* $NetBSD: mha.c,v 1.36 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996-1999 The NetBSD Foundation, Inc.
|
||||
@ -66,7 +66,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mha.c,v 1.35 2005/01/18 07:12:15 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mha.c,v 1.36 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
@ -114,6 +114,7 @@ __KERNEL_RCSID(0, "$NetBSD: mha.c,v 1.35 2005/01/18 07:12:15 chs Exp $");
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsi_message.h>
|
||||
@ -928,7 +929,7 @@ mha_done(struct mha_softc *sc, struct acb *acb)
|
||||
if (xs->resid != 0)
|
||||
printf("resid=%d ", xs->resid);
|
||||
if (xs->error == XS_SENSE)
|
||||
printf("sense=0x%02x\n", xs->sense.scsi_sense.error_code);
|
||||
printf("sense=0x%02x\n", xs->sense.scsi_sense.response_code);
|
||||
else
|
||||
printf("error=%d\n", xs->error);
|
||||
}
|
||||
@ -1626,7 +1627,7 @@ mha_datain(struct mha_softc *sc, u_char *p, int n)
|
||||
|
||||
if (n == 0)
|
||||
return n;
|
||||
if (acb->cmd.opcode == REQUEST_SENSE || (n & 1))
|
||||
if (acb->cmd.opcode == SCSI_REQUEST_SENSE || (n & 1))
|
||||
return mha_datain_pio(sc, p, n);
|
||||
return mha_dataio_dma(MHA_DMA_DATAIN, CMD_RECEIVE_TO_DMA, sc, p, n);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ahb.c,v 1.41 2004/12/07 14:50:56 thorpej Exp $ */
|
||||
/* $NetBSD: ahb.c,v 1.42 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -53,7 +53,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ahb.c,v 1.41 2004/12/07 14:50:56 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ahb.c,v 1.42 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
@ -541,7 +541,7 @@ static void
|
||||
ahb_done(struct ahb_softc *sc, struct ahb_ecb *ecb)
|
||||
{
|
||||
bus_dma_tag_t dmat = sc->sc_dmat;
|
||||
struct scsipi_sense_data *s1, *s2;
|
||||
struct scsi_sense_data *s1, *s2;
|
||||
struct scsipi_xfer *xs = ecb->xs;
|
||||
|
||||
SC_DEBUG(xs->xs_periph, SCSIPI_DB2, ("ahb_done\n"));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ahbreg.h,v 1.13 2004/12/07 19:14:57 thorpej Exp $ */
|
||||
/* $NetBSD: ahbreg.h,v 1.14 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -216,7 +216,7 @@ struct ahb_ecb {
|
||||
|
||||
struct ahb_dma_seg ahb_dma[AHB_NSEG];
|
||||
struct ahb_ecb_status ecb_status;
|
||||
struct scsipi_sense_data ecb_sense;
|
||||
struct scsi_sense_data ecb_sense;
|
||||
|
||||
TAILQ_ENTRY(ahb_ecb) chain;
|
||||
struct ahb_ecb *nexthash;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: adv.c,v 1.34 2005/02/04 02:10:36 perry Exp $ */
|
||||
/* $NetBSD: adv.c,v 1.35 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Generic driver for the Advanced Systems Inc. Narrow SCSI controllers
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: adv.c,v 1.34 2005/02/04 02:10:36 perry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: adv.c,v 1.35 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -607,7 +607,7 @@ adv_scsipi_request(chan, req, arg)
|
||||
ccb->scsiq.q1.sense_addr =
|
||||
sc->sc_dmamap_control->dm_segs[0].ds_addr +
|
||||
ADV_CCB_OFF(ccb) + offsetof(struct adv_ccb, scsi_sense);
|
||||
ccb->scsiq.q1.sense_len = sizeof(struct scsipi_sense_data);
|
||||
ccb->scsiq.q1.sense_len = sizeof(struct scsi_sense_data);
|
||||
|
||||
/*
|
||||
* If there are any outstanding requests for the current
|
||||
@ -893,7 +893,7 @@ adv_narrow_isr_callback(sc, qdonep)
|
||||
bus_dma_tag_t dmat = sc->sc_dmat;
|
||||
ADV_CCB *ccb;
|
||||
struct scsipi_xfer *xs;
|
||||
struct scsipi_sense_data *s1, *s2;
|
||||
struct scsi_sense_data *s1, *s2;
|
||||
|
||||
|
||||
ccb = adv_ccb_phys_kv(sc, qdonep->d2.ccb_ptr);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: adv.h,v 1.10 2005/02/04 02:10:36 perry Exp $ */
|
||||
/* $NetBSD: adv.h,v 1.11 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Generic driver definitions and exported functions for the Advanced
|
||||
@ -51,7 +51,7 @@ struct adv_ccb
|
||||
ASC_SG_HEAD sghead;
|
||||
ASC_SCSI_Q scsiq;
|
||||
|
||||
struct scsipi_sense_data scsi_sense;
|
||||
struct scsi_sense_data scsi_sense;
|
||||
|
||||
struct callout ccb_watchdog;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: adw.c,v 1.43 2003/11/02 11:07:44 wiz Exp $ */
|
||||
/* $NetBSD: adw.c,v 1.44 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Generic driver for the Advanced Systems Inc. SCSI controllers
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: adw.c,v 1.43 2003/11/02 11:07:44 wiz Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: adw.c,v 1.44 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -668,7 +668,7 @@ adw_build_req(ADW_SOFTC *sc, ADW_CCB *ccb)
|
||||
scsiqp->vsense_addr = &ccb->scsi_sense;
|
||||
scsiqp->sense_addr = htole32(sc->sc_dmamap_control->dm_segs[0].ds_addr +
|
||||
ADW_CCB_OFF(ccb) + offsetof(struct adw_ccb, scsi_sense));
|
||||
scsiqp->sense_len = sizeof(struct scsipi_sense_data);
|
||||
scsiqp->sense_len = sizeof(struct scsi_sense_data);
|
||||
|
||||
/*
|
||||
* Build ADW_SCSI_REQ_Q for a scatter-gather buffer command.
|
||||
@ -1040,7 +1040,7 @@ adw_isr_callback(ADW_SOFTC *sc, ADW_SCSI_REQ_Q *scsiq)
|
||||
bus_dma_tag_t dmat = sc->sc_dmat;
|
||||
ADW_CCB *ccb;
|
||||
struct scsipi_xfer *xs;
|
||||
struct scsipi_sense_data *s1, *s2;
|
||||
struct scsi_sense_data *s1, *s2;
|
||||
|
||||
|
||||
ccb = adw_ccb_phys_kv(sc, scsiq->ccb_ptr);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: adw.h,v 1.11 2005/02/04 02:10:36 perry Exp $ */
|
||||
/* $NetBSD: adw.h,v 1.12 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Generic driver definitions and exported functions for the Advanced
|
||||
@ -68,7 +68,7 @@ struct adw_ccb {
|
||||
ADW_SCSI_REQ_Q scsiq;
|
||||
ADW_SG_BLOCK sg_block[ADW_NUM_SG_BLOCK];
|
||||
|
||||
struct scsipi_sense_data scsi_sense;
|
||||
struct scsi_sense_data scsi_sense;
|
||||
|
||||
TAILQ_ENTRY(adw_ccb) chain;
|
||||
struct adw_ccb *nexthash;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: adwlib.h,v 1.16 2005/02/04 02:10:36 perry Exp $ */
|
||||
/* $NetBSD: adwlib.h,v 1.17 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Definitions for low level routines and data structures
|
||||
@ -825,7 +825,7 @@ typedef struct adw_scsi_req_q {
|
||||
* End of microcode structure - 60 bytes. The rest of the structure
|
||||
* is used by the Adw Library and ignored by the microcode.
|
||||
*/
|
||||
struct scsipi_sense_data *vsense_addr; /* Sense buffer virtual address. */
|
||||
struct scsi_sense_data *vsense_addr; /* Sense buffer virtual address. */
|
||||
u_char *vdata_addr; /* Data buffer virtual address. */
|
||||
} ADW_SCSI_REQ_Q;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: aha.c,v 1.45 2004/12/07 14:50:56 thorpej Exp $ */
|
||||
/* $NetBSD: aha.c,v 1.46 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -53,7 +53,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: aha.c,v 1.45 2004/12/07 14:50:56 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: aha.c,v 1.46 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
@ -666,7 +666,7 @@ static void
|
||||
aha_done(struct aha_softc *sc, struct aha_ccb *ccb)
|
||||
{
|
||||
bus_dma_tag_t dmat = sc->sc_dmat;
|
||||
struct scsipi_sense_data *s1, *s2;
|
||||
struct scsi_sense_data *s1, *s2;
|
||||
struct scsipi_xfer *xs = ccb->xs;
|
||||
|
||||
SC_DEBUG(xs->xs_periph, SCSIPI_DB2, ("aha_done\n"));
|
||||
@ -714,7 +714,7 @@ aha_done(struct aha_softc *sc, struct aha_ccb *ccb)
|
||||
} else if (ccb->target_stat != SCSI_OK) {
|
||||
switch (ccb->target_stat) {
|
||||
case SCSI_CHECK:
|
||||
s1 = (struct scsipi_sense_data *) (((char *) (&ccb->scsi_cmd)) +
|
||||
s1 = (struct scsi_sense_data *) (((char *) (&ccb->scsi_cmd)) +
|
||||
ccb->scsi_cmd_length);
|
||||
s2 = &xs->sense.scsi_sense;
|
||||
*s2 = *s1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ahareg.h,v 1.10 2004/12/07 14:50:56 thorpej Exp $ */
|
||||
/* $NetBSD: ahareg.h,v 1.11 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-99 The NetBSD Foundation, Inc.
|
||||
@ -181,7 +181,7 @@ struct aha_ccb {
|
||||
u_char target_stat;
|
||||
u_char reserved[2];
|
||||
u_char scsi_cmd[12];
|
||||
struct scsipi_sense_data scsi_sense;
|
||||
struct scsi_sense_data scsi_sense;
|
||||
struct aha_scat_gath scat_gath[AHA_NSEG];
|
||||
/*----------------------------------------------------------------*/
|
||||
TAILQ_ENTRY(aha_ccb) chain;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: aic6360.c,v 1.82 2004/08/24 00:53:29 thorpej Exp $ */
|
||||
/* $NetBSD: aic6360.c,v 1.83 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996 Charles M. Hannum. All rights reserved.
|
||||
@ -58,7 +58,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: aic6360.c,v 1.82 2004/08/24 00:53:29 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: aic6360.c,v 1.83 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
@ -133,6 +133,7 @@ __KERNEL_RCSID(0, "$NetBSD: aic6360.c,v 1.82 2004/08/24 00:53:29 thorpej Exp $")
|
||||
#include <machine/bus.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsi_message.h>
|
||||
@ -865,17 +866,17 @@ aic_sense(struct aic_softc *sc, struct aic_acb *acb)
|
||||
struct scsipi_xfer *xs = acb->xs;
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
struct aic_tinfo *ti = &sc->sc_tinfo[periph->periph_target];
|
||||
struct scsipi_sense *ss = (void *)&acb->scsipi_cmd;
|
||||
struct scsi_request_sense *ss = (void *)&acb->scsipi_cmd;
|
||||
|
||||
AIC_MISC(("requesting sense "));
|
||||
/* Next, setup a request sense command block */
|
||||
memset(ss, 0, sizeof(*ss));
|
||||
ss->opcode = REQUEST_SENSE;
|
||||
ss->opcode = SCSI_REQUEST_SENSE;
|
||||
ss->byte2 = periph->periph_lun << 5;
|
||||
ss->length = sizeof(struct scsipi_sense_data);
|
||||
ss->length = sizeof(struct scsi_sense_data);
|
||||
acb->scsipi_cmd_length = sizeof(*ss);
|
||||
acb->data_addr = (char *)&xs->sense.scsi_sense;
|
||||
acb->data_length = sizeof(struct scsipi_sense_data);
|
||||
acb->data_length = sizeof(struct scsi_sense_data);
|
||||
acb->flags |= ACB_SENSE;
|
||||
ti->senses++;
|
||||
if (acb->flags & ACB_NEXUS)
|
||||
@ -931,7 +932,7 @@ aic_done(struct aic_softc *sc, struct aic_acb *acb)
|
||||
if (xs->resid != 0)
|
||||
printf("resid=%d ", xs->resid);
|
||||
if (xs->error == XS_SENSE)
|
||||
printf("sense=0x%02x\n", xs->sense.scsi_sense.error_code);
|
||||
printf("sense=0x%02x\n", xs->sense.scsi_sense.response_code);
|
||||
else
|
||||
printf("error=%d\n", xs->error);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: aic79xx.c,v 1.28 2004/04/21 18:03:13 itojun Exp $ */
|
||||
/* $NetBSD: aic79xx.c,v 1.29 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Core routines and tables shareable across OS platforms.
|
||||
@ -49,7 +49,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.28 2004/04/21 18:03:13 itojun Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.29 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include <dev/ic/aic79xx_osm.h>
|
||||
#include <dev/ic/aic79xx_inline.h>
|
||||
@ -7930,7 +7930,7 @@ ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb)
|
||||
{
|
||||
struct ahd_devinfo devinfo;
|
||||
struct ahd_dma_seg *sg;
|
||||
struct scsipi_sense *sc;
|
||||
struct scsi_request_sense *sc;
|
||||
struct ahd_initiator_tinfo *targ_info;
|
||||
struct ahd_tmode_tstate *tstate;
|
||||
struct ahd_transinfo *tinfo;
|
||||
@ -7957,7 +7957,7 @@ ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb)
|
||||
&tstate);
|
||||
tinfo = &targ_info->curr;
|
||||
sg = scb->sg_list;
|
||||
sc = (struct scsipi_sense *)hscb->shared_data.idata.cdb;
|
||||
sc = (struct scsi_request_sense *)hscb->shared_data.idata.cdb;
|
||||
/*
|
||||
* Save off the residual if there is one.
|
||||
*/
|
||||
@ -7972,12 +7972,9 @@ ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb)
|
||||
sg = ahd_sg_setup(ahd, scb, sg, ahd_get_sense_bufaddr(ahd, scb),
|
||||
ahd_get_sense_bufsize(ahd, scb),
|
||||
/*last*/TRUE);
|
||||
sc->opcode = REQUEST_SENSE;
|
||||
sc->byte2 = 0;
|
||||
sc->unused[0] = 0;
|
||||
sc->unused[1] = 0;
|
||||
memset(sc, 0, sizeof(*sc));
|
||||
sc->opcode = SCSI_REQUEST_SENSE;
|
||||
sc->length = ahd_get_sense_bufsize(ahd, scb);
|
||||
sc->control = 0;
|
||||
|
||||
/*
|
||||
* We can't allow the target to disconnect.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: aic79xx_osm.c,v 1.10 2004/10/04 11:23:39 fvdl Exp $ */
|
||||
/* $NetBSD: aic79xx_osm.c,v 1.11 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Bus independent NetBSD shim for the aic7xxx based adaptec SCSI controllers
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: aic79xx_osm.c,v 1.10 2004/10/04 11:23:39 fvdl Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: aic79xx_osm.c,v 1.11 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include <dev/ic/aic79xx_osm.h>
|
||||
#include <dev/ic/aic7xxx_cam.h>
|
||||
@ -227,7 +227,7 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)
|
||||
*/
|
||||
memset(&xs->sense.scsi_sense, 0, sizeof(xs->sense.scsi_sense));
|
||||
memcpy(&xs->sense.scsi_sense, ahd_get_sense_buf(ahd, scb),
|
||||
sizeof(struct scsipi_sense_data));
|
||||
sizeof(struct scsi_sense_data));
|
||||
|
||||
ahd_set_transaction_status(scb, XS_SENSE);
|
||||
} else if ((scb->flags & SCB_PKT_SENSE) != 0) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: aic79xx_osm.h,v 1.5 2003/11/02 11:07:44 wiz Exp $ */
|
||||
/* $NetBSD: aic79xx_osm.h,v 1.6 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* NetBSD platform specific driver option settings, data structures,
|
||||
@ -32,9 +32,9 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $NetBSD: aic79xx_osm.h,v 1.5 2003/11/02 11:07:44 wiz Exp $
|
||||
* $NetBSD: aic79xx_osm.h,v 1.6 2005/02/21 00:29:07 thorpej Exp $
|
||||
*
|
||||
* //depot/aic7xxx/freebsd/dev/aic7xxx/aic79xx_osm.h#19 $$NetBSD: aic79xx_osm.h,v 1.5 2003/11/02 11:07:44 wiz Exp $
|
||||
* //depot/aic7xxx/freebsd/dev/aic7xxx/aic79xx_osm.h#19 $$NetBSD: aic79xx_osm.h,v 1.6 2005/02/21 00:29:07 thorpej Exp $
|
||||
*
|
||||
* $FreeBSD: src/sys/dev/aic7xxx/aic79xx_osm.h,v 1.9 2003/05/26 21:43:29 gibbs Exp $
|
||||
*/
|
||||
@ -408,7 +408,7 @@ int ahd_perform_autosense(struct scb *scb)
|
||||
static __inline uint32_t
|
||||
ahd_get_sense_bufsize(struct ahd_softc *ahd, struct scb *scb)
|
||||
{
|
||||
return (sizeof(struct scsipi_sense_data));
|
||||
return (sizeof(struct scsi_sense_data));
|
||||
}
|
||||
|
||||
static __inline void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: aic7xxx.c,v 1.110 2004/04/21 18:03:13 itojun Exp $ */
|
||||
/* $NetBSD: aic7xxx.c,v 1.111 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Core routines and tables shareable across OS platforms.
|
||||
@ -39,7 +39,7 @@
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* $Id: aic7xxx.c,v 1.110 2004/04/21 18:03:13 itojun Exp $
|
||||
* $Id: aic7xxx.c,v 1.111 2005/02/21 00:29:07 thorpej Exp $
|
||||
*
|
||||
* //depot/aic7xxx/aic7xxx/aic7xxx.c#112 $
|
||||
*
|
||||
@ -50,7 +50,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: aic7xxx.c,v 1.110 2004/04/21 18:03:13 itojun Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: aic7xxx.c,v 1.111 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include <dev/ic/aic7xxx_osm.h>
|
||||
#include <dev/ic/aic7xxx_inline.h>
|
||||
@ -493,7 +493,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat)
|
||||
case SCSI_STATUS_CHECK_COND:
|
||||
{
|
||||
struct ahc_dma_seg *sg;
|
||||
struct scsipi_sense *sc;
|
||||
struct scsi_request_sense *sc;
|
||||
struct ahc_initiator_tinfo *targ_info;
|
||||
struct ahc_tmode_tstate *tstate;
|
||||
struct ahc_transinfo *tinfo;
|
||||
@ -515,7 +515,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat)
|
||||
&tstate);
|
||||
tinfo = &targ_info->curr;
|
||||
sg = scb->sg_list;
|
||||
sc = (struct scsipi_sense *)(&hscb->shared_data.cdb);
|
||||
sc = (struct scsi_request_sense *)(&hscb->shared_data.cdb);
|
||||
/*
|
||||
* Save off the residual if there is one.
|
||||
*/
|
||||
@ -534,15 +534,12 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat)
|
||||
sg->addr = ahc_htole32(sg->addr);
|
||||
sg->len = ahc_htole32(sg->len);
|
||||
|
||||
sc->opcode = REQUEST_SENSE;
|
||||
sc->byte2 = 0;
|
||||
memset(sc, 0, sizeof(*sc));
|
||||
sc->opcode = SCSI_REQUEST_SENSE;
|
||||
if (tinfo->protocol_version <= SCSI_REV_2
|
||||
&& SCB_GET_LUN(scb) < 8)
|
||||
sc->byte2 = SCB_GET_LUN(scb) << 5;
|
||||
sc->unused[0] = 0;
|
||||
sc->unused[1] = 0;
|
||||
sc->length = sg->len;
|
||||
sc->control = 0;
|
||||
|
||||
/*
|
||||
* We can't allow the target to disconnect.
|
||||
@ -4227,7 +4224,7 @@ ahc_init_scbdata(struct ahc_softc *ahc)
|
||||
scb_data->init_level++;
|
||||
|
||||
if (ahc_createdmamem(ahc->parent_dmat,
|
||||
AHC_SCB_MAX * sizeof(struct scsipi_sense_data), ahc->sc_dmaflags,
|
||||
AHC_SCB_MAX * sizeof(struct scsi_sense_data), ahc->sc_dmaflags,
|
||||
&scb_data->sense_dmamap, (caddr_t *)&scb_data->sense,
|
||||
&scb_data->sense_busaddr, &scb_data->sense_seg,
|
||||
&scb_data->sense_nseg, ahc_name(ahc), "sense buffers") < 0)
|
||||
@ -4290,7 +4287,7 @@ ahc_fini_scbdata(struct ahc_softc *ahc)
|
||||
/*FALLTHROUGH*/
|
||||
case 4:
|
||||
ahc_freedmamem(ahc->parent_dmat,
|
||||
AHC_SCB_MAX * sizeof(struct scsipi_sense_data),
|
||||
AHC_SCB_MAX * sizeof(struct scsi_sense_data),
|
||||
scb_data->sense_dmamap, (caddr_t)scb_data->sense,
|
||||
&scb_data->sense_seg, scb_data->sense_nseg);
|
||||
/*FALLTHROUGH*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: aic7xxx_inline.h,v 1.4 2003/11/02 11:07:44 wiz Exp $ */
|
||||
/* $NetBSD: aic7xxx_inline.h,v 1.5 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Inline routines shareable across OS platforms.
|
||||
@ -261,7 +261,7 @@ static __inline void ahc_free_scb(struct ahc_softc *ahc, struct scb *scb);
|
||||
static __inline void ahc_swap_with_next_hscb(struct ahc_softc *ahc,
|
||||
struct scb *scb);
|
||||
static __inline void ahc_queue_scb(struct ahc_softc *ahc, struct scb *scb);
|
||||
static __inline struct scsipi_sense_data *
|
||||
static __inline struct scsi_sense_data *
|
||||
ahc_get_sense_buf(struct ahc_softc *ahc,
|
||||
struct scb *scb);
|
||||
static __inline uint32_t
|
||||
@ -481,7 +481,7 @@ ahc_queue_scb(struct ahc_softc *ahc, struct scb *scb)
|
||||
}
|
||||
}
|
||||
|
||||
static __inline struct scsipi_sense_data *
|
||||
static __inline struct scsi_sense_data *
|
||||
ahc_get_sense_buf(struct ahc_softc *ahc, struct scb *scb)
|
||||
{
|
||||
int offset;
|
||||
@ -497,7 +497,7 @@ ahc_get_sense_bufaddr(struct ahc_softc *ahc, struct scb *scb)
|
||||
|
||||
offset = scb - ahc->scb_data->scbarray;
|
||||
return (ahc->scb_data->sense_busaddr
|
||||
+ (offset * sizeof(struct scsipi_sense_data)));
|
||||
+ (offset * sizeof(struct scsi_sense_data)));
|
||||
}
|
||||
|
||||
/************************** Interrupt Processing ******************************/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: aic7xxx_osm.h,v 1.7 2003/11/02 11:07:44 wiz Exp $ */
|
||||
/* $NetBSD: aic7xxx_osm.h,v 1.8 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* NetBSD platform specific driver option settings, data structures,
|
||||
@ -401,7 +401,7 @@ int ahc_perform_autosense(struct scb *scb)
|
||||
static __inline uint32_t
|
||||
ahc_get_sense_bufsize(struct ahc_softc *ahc, struct scb *scb)
|
||||
{
|
||||
return (sizeof(struct scsipi_sense_data));
|
||||
return (sizeof(struct scsi_sense_data));
|
||||
}
|
||||
|
||||
static __inline void
|
||||
|
@ -37,7 +37,7 @@
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* $Id: aic7xxxvar.h,v 1.45 2004/04/21 18:03:13 itojun Exp $
|
||||
* $Id: aic7xxxvar.h,v 1.46 2005/02/21 00:29:07 thorpej Exp $
|
||||
*
|
||||
* $FreeBSD: /repoman/r/ncvs/src/sys/dev/aic7xxx/aic7xxx.h,v 1.44 2003/01/20 20:44:55 gibbs Exp $
|
||||
*/
|
||||
@ -705,7 +705,7 @@ struct scb_data {
|
||||
*/
|
||||
struct hardware_scb *hscbs; /* Array of hardware SCBs */
|
||||
struct scb *scbarray; /* Array of kernel SCBs */
|
||||
struct scsipi_sense_data *sense; /* Per SCB sense data */
|
||||
struct scsi_sense_data *sense; /* Per SCB sense data */
|
||||
|
||||
/*
|
||||
* "Bus" addresses of our data structures.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bhareg.h,v 1.17 2003/11/02 11:07:45 wiz Exp $ */
|
||||
/* $NetBSD: bhareg.h,v 1.18 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -233,7 +233,7 @@ struct bha_ccb {
|
||||
/*------------------------------------longword boundary */
|
||||
physaddr sense_ptr;
|
||||
/*-----end of HW fields-----------------------longword boundary */
|
||||
struct scsipi_sense_data scsi_sense;
|
||||
struct scsi_sense_data scsi_sense;
|
||||
/*------------------------------------longword boundary */
|
||||
struct bha_scat_gath scat_gath[BHA_NSEG];
|
||||
/*------------------------------------longword boundary */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dptvar.h,v 1.10 2003/12/04 13:57:30 keihan Exp $ */
|
||||
/* $NetBSD: dptvar.h,v 1.11 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999, 2000, 2001 Andrew Doran <ad@NetBSD.org>
|
||||
@ -48,7 +48,7 @@ struct dpt_ccb {
|
||||
/* Data that will be touched by the HBA */
|
||||
struct eata_cp ccb_eata_cp; /* EATA command packet */
|
||||
struct eata_sg ccb_sg[DPT_SG_SIZE]; /* SG element list */
|
||||
struct scsipi_sense_data ccb_sense; /* SCSI sense data on error */
|
||||
struct scsi_sense_data ccb_sense; /* SCSI sense data on error */
|
||||
|
||||
/* Data that will not be touched by the HBA */
|
||||
volatile int ccb_flg; /* CCB flags */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: icpsp.c,v 1.9 2003/09/18 01:33:59 mycroft Exp $ */
|
||||
/* $NetBSD: icpsp.c,v 1.10 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: icpsp.c,v 1.9 2003/09/18 01:33:59 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: icpsp.c,v 1.10 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -181,7 +181,7 @@ icpsp_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||
ic->ic_sg = rc->rc_sg;
|
||||
ic->ic_service = ICP_SCSIRAWSERVICE;
|
||||
soff = ICP_SCRATCH_SENSE + ic->ic_ident *
|
||||
sizeof(struct scsipi_sense_data);
|
||||
sizeof(struct scsi_sense_data);
|
||||
|
||||
/*
|
||||
* Build the command. We don't need to actively prevent
|
||||
@ -287,7 +287,7 @@ icpsp_intr(struct icp_ccb *ic)
|
||||
xs = (struct scsipi_xfer *)ic->ic_context;
|
||||
icp = (struct icp_softc *)ic->ic_dv->dv_parent;
|
||||
soff = ICP_SCRATCH_SENSE + ic->ic_ident *
|
||||
sizeof(struct scsipi_sense_data);
|
||||
sizeof(struct scsi_sense_data);
|
||||
|
||||
SC_DEBUG(xs->xs_periph, SCSIPI_DB2, ("icpsp_intr\n"));
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: icpvar.h,v 1.4 2004/09/13 12:55:47 drochner Exp $ */
|
||||
/* $NetBSD: icpvar.h,v 1.5 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
|
||||
@ -51,7 +51,7 @@
|
||||
#define ICP_UCMD_SCRATCH_SIZE 4096
|
||||
#define ICP_SCRATCH_SIZE (8192 + ICP_UCMD_SCRATCH_SIZE)
|
||||
#define ICP_SCRATCH_SENSE \
|
||||
(ICP_SCRATCH_SIZE - sizeof(struct scsipi_sense_data) * ICP_NCCBS)
|
||||
(ICP_SCRATCH_SIZE - sizeof(struct scsi_sense_data) * ICP_NCCBS)
|
||||
#define ICP_SCRATCH_UCMD (ICP_SCRATCH_SENSE - ICP_UCMD_SCRATCH_SIZE)
|
||||
|
||||
#define ICP_NCCBS ICP_MAX_CMDS
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: iha.c,v 1.27 2005/01/02 12:22:19 tsutsui Exp $ */
|
||||
/* $NetBSD: iha.c,v 1.28 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Device driver for the INI-9XXXU/UW or INIC-940/950 PCI SCSI Controller.
|
||||
@ -39,7 +39,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: iha.c,v 1.27 2005/01/02 12:22:19 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: iha.c,v 1.28 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: iha.c,v 1.27 2005/01/02 12:22:19 tsutsui Exp $");
|
||||
#include <machine/bus.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsiconf.h>
|
||||
@ -332,7 +333,7 @@ iha_find_pend_scb(struct iha_softc *sc)
|
||||
if (tcs->ntagscb == NULL)
|
||||
break;
|
||||
|
||||
} else if (scb->cmd[0] == REQUEST_SENSE) {
|
||||
} else if (scb->cmd[0] == SCSI_REQUEST_SENSE) {
|
||||
/*
|
||||
* OK to do a non-tagged request sense
|
||||
* even if a non-tagged I/O has been
|
||||
@ -1158,7 +1159,7 @@ iha_exec_scb(struct iha_softc *sc, struct iha_scb *scb)
|
||||
s = splbio();
|
||||
|
||||
if (((scb->xs->xs_control & XS_RESET) != 0) ||
|
||||
(scb->cmd[0] == REQUEST_SENSE))
|
||||
(scb->cmd[0] == SCSI_REQUEST_SENSE))
|
||||
iha_push_pend_scb(sc, scb); /* Insert SCB at head of Pend */
|
||||
else
|
||||
iha_append_pend_scb(sc, scb); /* Append SCB to tail of Pend */
|
||||
@ -1293,15 +1294,14 @@ iha_push_sense_request(struct iha_softc *sc, struct iha_scb *scb)
|
||||
{
|
||||
struct scsipi_xfer *xs = scb->xs;
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
struct scsipi_sense *ss = (struct scsipi_sense *)scb->cmd;
|
||||
struct scsi_request_sense *ss = (struct scsi_request_sense *)scb->cmd;
|
||||
int lun = periph->periph_lun;
|
||||
int err;
|
||||
|
||||
ss->opcode = REQUEST_SENSE;
|
||||
memset(ss, 0, sizeof(*ss));
|
||||
ss->opcode = SCSI_REQUEST_SENSE;
|
||||
ss->byte2 = lun << SCSI_CMD_LUN_SHIFT;
|
||||
ss->unused[0] = ss->unused[1] = 0;
|
||||
ss->length = sizeof(struct scsipi_sense_data);
|
||||
ss->control = 0;
|
||||
ss->length = sizeof(struct scsi_sense_data);
|
||||
|
||||
scb->flags = FLAG_RSENS | FLAG_DATAIN;
|
||||
|
||||
@ -1310,7 +1310,7 @@ iha_push_sense_request(struct iha_softc *sc, struct iha_scb *scb)
|
||||
scb->scb_tagmsg = 0;
|
||||
scb->ta_stat = SCSI_OK;
|
||||
|
||||
scb->cmdlen = sizeof(struct scsipi_sense);
|
||||
scb->cmdlen = sizeof(struct scsi_request_sense);
|
||||
scb->buflen = ss->length;
|
||||
|
||||
err = bus_dmamap_load(sc->sc_dmat, scb->dmap,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ncr53c9x.c,v 1.112 2004/09/10 23:44:29 bouyer Exp $ */
|
||||
/* $NetBSD: ncr53c9x.c,v 1.113 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
|
||||
@ -77,7 +77,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.112 2004/09/10 23:44:29 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.113 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -93,6 +93,7 @@ __KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.112 2004/09/10 23:44:29 bouyer Exp $"
|
||||
#include <sys/pool.h>
|
||||
#include <sys/scsiio.h>
|
||||
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsiconf.h>
|
||||
@ -1161,19 +1162,19 @@ ncr53c9x_sense(sc, ecb)
|
||||
struct scsipi_xfer *xs = ecb->xs;
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
struct ncr53c9x_tinfo *ti = &sc->sc_tinfo[periph->periph_target];
|
||||
struct scsipi_sense *ss = (void *)&ecb->cmd.cmd;
|
||||
struct scsi_request_sense *ss = (void *)&ecb->cmd.cmd;
|
||||
struct ncr53c9x_linfo *li;
|
||||
int lun = periph->periph_lun;
|
||||
|
||||
NCR_TRACE(("requesting sense "));
|
||||
/* Next, setup a request sense command block */
|
||||
memset(ss, 0, sizeof(*ss));
|
||||
ss->opcode = REQUEST_SENSE;
|
||||
ss->opcode = SCSI_REQUEST_SENSE;
|
||||
ss->byte2 = periph->periph_lun << SCSI_CMD_LUN_SHIFT;
|
||||
ss->length = sizeof(struct scsipi_sense_data);
|
||||
ss->length = sizeof(struct scsi_sense_data);
|
||||
ecb->clen = sizeof(*ss);
|
||||
ecb->daddr = (char *)&xs->sense.scsi_sense;
|
||||
ecb->dleft = sizeof(struct scsipi_sense_data);
|
||||
ecb->dleft = sizeof(struct scsi_sense_data);
|
||||
ecb->flags |= ECB_SENSE;
|
||||
ecb->timeout = NCR_SENSE_TIMEOUT;
|
||||
ti->senses++;
|
||||
@ -1243,7 +1244,7 @@ ncr53c9x_done(sc, ecb)
|
||||
printf("resid=%d ", xs->resid);
|
||||
if (xs->error == XS_SENSE)
|
||||
printf("sense=0x%02x\n",
|
||||
xs->sense.scsi_sense.error_code);
|
||||
xs->sense.scsi_sense.response_code);
|
||||
else
|
||||
printf("error=%d\n", xs->error);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uha.c,v 1.34 2005/02/04 02:10:37 perry Exp $ */
|
||||
/* $NetBSD: uha.c,v 1.35 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -60,7 +60,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uha.c,v 1.34 2005/02/04 02:10:37 perry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uha.c,v 1.35 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#undef UHADEBUG
|
||||
#ifdef DDB
|
||||
@ -343,7 +343,7 @@ uha_done(sc, mscp)
|
||||
struct uha_mscp *mscp;
|
||||
{
|
||||
bus_dma_tag_t dmat = sc->sc_dmat;
|
||||
struct scsipi_sense_data *s1, *s2;
|
||||
struct scsi_sense_data *s1, *s2;
|
||||
struct scsipi_xfer *xs = mscp->xs;
|
||||
|
||||
SC_DEBUG(xs->xs_periph, SCSIPI_DB2, ("uha_done\n"));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uhareg.h,v 1.10 2004/12/07 14:50:56 thorpej Exp $ */
|
||||
/* $NetBSD: uhareg.h,v 1.11 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -224,7 +224,7 @@ struct uha_mscp {
|
||||
physaddr sense_ptr; /* if 0 no auto sense */
|
||||
|
||||
struct uha_dma_seg uha_dma[UHA_NSEG];
|
||||
struct scsipi_sense_data mscp_sense;
|
||||
struct scsi_sense_data mscp_sense;
|
||||
/*-----------------end of hardware supported fields----------------*/
|
||||
TAILQ_ENTRY(uha_mscp) chain;
|
||||
struct uha_mscp *nexthash;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sbpscsi.c,v 1.7 2004/02/13 21:22:13 enami Exp $ */
|
||||
/* $NetBSD: sbpscsi.c,v 1.8 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sbpscsi.c,v 1.7 2004/02/13 21:22:13 enami Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sbpscsi.c,v 1.8 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -261,7 +261,7 @@ sbpscsi_status(struct sbp2_status *status, void *arg)
|
||||
}
|
||||
|
||||
if (status->datalen) {
|
||||
xs->sense.scsi_sense.error_code =
|
||||
xs->sense.scsi_sense.response_code =
|
||||
SBPSCSI_STATUS_GET_STATUS(status->data[0]);
|
||||
vflag = SBPSCSI_STATUS_GET_VFLAG(status->data[0]);
|
||||
mflag = SBPSCSI_STATUS_GET_MFLAG(status->data[0]);
|
||||
@ -287,25 +287,25 @@ sbpscsi_status(struct sbp2_status *status, void *arg)
|
||||
xs->sense.scsi_sense.info[3] =
|
||||
status->data[1] & 0x000000ff;
|
||||
}
|
||||
xs->sense.scsi_sense.cmd_spec_info[0] =
|
||||
xs->sense.scsi_sense.csi[0] =
|
||||
(status->data[2] & 0xff000000) >> 24;
|
||||
xs->sense.scsi_sense.cmd_spec_info[1] =
|
||||
xs->sense.scsi_sense.csi[1] =
|
||||
(status->data[2] & 0x00ff0000) >> 16;
|
||||
xs->sense.scsi_sense.cmd_spec_info[2] =
|
||||
xs->sense.scsi_sense.csi[2] =
|
||||
(status->data[2] & 0x0000ff00) >> 8;
|
||||
xs->sense.scsi_sense.cmd_spec_info[3] =
|
||||
xs->sense.scsi_sense.csi[3] =
|
||||
status->data[2] & 0x000000ff;
|
||||
xs->sense.scsi_sense.add_sense_code =
|
||||
xs->sense.scsi_sense.asc =
|
||||
SBPSCSI_STATUS_GET_SENSECODE(status->data[0]);
|
||||
xs->sense.scsi_sense.add_sense_code_qual =
|
||||
xs->sense.scsi_sense.ascq =
|
||||
SBPSCSI_STATUS_GET_SENSEQUAL(status->data[0]);
|
||||
xs->sense.scsi_sense.fru =
|
||||
SBPSCSI_STATUS_GET_FRU(status->data[3]);
|
||||
xs->sense.scsi_sense.sense_key_spec_1 =
|
||||
xs->sense.scsi_sense.sks.sks_bytes[0] =
|
||||
SBPSCSI_STATUS_GET_SENSE1(status->data[3]);
|
||||
xs->sense.scsi_sense.sense_key_spec_2 =
|
||||
xs->sense.scsi_sense.sks.sks_bytes[1] =
|
||||
SBPSCSI_STATUS_GET_SENSE2(status->data[3]);
|
||||
xs->sense.scsi_sense.sense_key_spec_3 =
|
||||
xs->sense.scsi_sense.sks.sks_bytes[3] =
|
||||
SBPSCSI_STATUS_GET_SENSE3(status->data[3]);
|
||||
}
|
||||
scsipi_done(xs);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wdsreg.h,v 1.6 2004/12/07 14:50:56 thorpej Exp $ */
|
||||
/* $NetBSD: wdsreg.h,v 1.7 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
typedef u_char physaddr[3];
|
||||
typedef u_char physlen[3];
|
||||
@ -67,7 +67,7 @@ struct wds_scb {
|
||||
struct wds_cmd sense;
|
||||
|
||||
struct wds_scat_gath scat_gath[WDS_NSEG];
|
||||
struct scsipi_sense_data sense_data;
|
||||
struct scsi_sense_data sense_data;
|
||||
|
||||
TAILQ_ENTRY(wds_scb) chain;
|
||||
struct wds_scb *nexthash;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mly.c,v 1.21 2003/06/29 22:30:25 fvdl Exp $ */
|
||||
/* $NetBSD: mly.c,v 1.22 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -77,7 +77,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mly.c,v 1.21 2003/06/29 22:30:25 fvdl Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mly.c,v 1.22 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -1131,11 +1131,11 @@ mly_complete_event(struct mly_softc *mly, struct mly_ccb *mc)
|
||||
static void
|
||||
mly_process_event(struct mly_softc *mly, struct mly_event *me)
|
||||
{
|
||||
struct scsipi_sense_data *ssd;
|
||||
struct scsi_sense_data *ssd;
|
||||
int bus, target, event, class, action;
|
||||
const char *fp, *tp;
|
||||
|
||||
ssd = (struct scsipi_sense_data *)&me->sense[0];
|
||||
ssd = (struct scsi_sense_data *)&me->sense[0];
|
||||
|
||||
/*
|
||||
* Errors can be reported using vendor-unique sense data. In this
|
||||
@ -1146,10 +1146,10 @@ mly_process_event(struct mly_softc *mly, struct mly_event *me)
|
||||
* (low seven bits of the high byte).
|
||||
*/
|
||||
if (le32toh(me->code) == 0x1c &&
|
||||
(ssd->flags & SSD_KEY) == SKEY_VENDOR_UNIQUE &&
|
||||
(ssd->add_sense_code & 0x80) != 0) {
|
||||
event = ((int)(ssd->add_sense_code & ~0x80) << 8) +
|
||||
ssd->add_sense_code_qual;
|
||||
SSD_SENSE_KEY(ssd->flags) == SKEY_VENDOR_SPECIFIC &&
|
||||
(ssd->asc & 0x80) != 0) {
|
||||
event = ((int)(ssd->asc & ~0x80) << 8) +
|
||||
ssd->ascq;
|
||||
} else
|
||||
event = le32toh(me->code);
|
||||
|
||||
@ -1202,11 +1202,11 @@ mly_process_event(struct mly_softc *mly, struct mly_event *me)
|
||||
/*
|
||||
* Report of sense data.
|
||||
*/
|
||||
if (((ssd->flags & SSD_KEY) == SKEY_NO_SENSE ||
|
||||
(ssd->flags & SSD_KEY) == SKEY_NOT_READY) &&
|
||||
ssd->add_sense_code == 0x04 &&
|
||||
(ssd->add_sense_code_qual == 0x01 ||
|
||||
ssd->add_sense_code_qual == 0x02)) {
|
||||
if ((SSD_SENSE_KEY(ssd->flags) == SKEY_NO_SENSE ||
|
||||
SSD_SENSE_KEY(ssd->flags) == SKEY_NOT_READY) &&
|
||||
ssd->asc == 0x04 &&
|
||||
(ssd->ascq == 0x01 ||
|
||||
ssd->ascq == 0x02)) {
|
||||
/* Ignore NO_SENSE or NOT_READY in one case */
|
||||
break;
|
||||
}
|
||||
@ -1217,13 +1217,13 @@ mly_process_event(struct mly_softc *mly, struct mly_event *me)
|
||||
printf("%s: physical device %d:%d %s\n", mly->mly_dv.dv_xname,
|
||||
me->channel, me->target, tp);
|
||||
printf("%s: sense key %d asc %02x ascq %02x\n",
|
||||
mly->mly_dv.dv_xname, ssd->flags & SSD_KEY,
|
||||
ssd->add_sense_code, ssd->add_sense_code_qual);
|
||||
mly->mly_dv.dv_xname, SSD_SENSE_KEY(ssd->flags),
|
||||
ssd->asc, ssd->ascq);
|
||||
printf("%s: info %x%x%x%x csi %x%x%x%x\n",
|
||||
mly->mly_dv.dv_xname, ssd->info[0], ssd->info[1],
|
||||
ssd->info[2], ssd->info[3], ssd->cmd_spec_info[0],
|
||||
ssd->cmd_spec_info[1], ssd->cmd_spec_info[2],
|
||||
ssd->cmd_spec_info[3]);
|
||||
ssd->info[2], ssd->info[3], ssd->csi[0],
|
||||
ssd->csi[1], ssd->csi[2],
|
||||
ssd->csi[3]);
|
||||
if (action == 'r')
|
||||
mly->mly_btl[me->channel][me->target].mb_flags |=
|
||||
MLY_BTL_RESCAN;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trm.c,v 1.16 2005/01/02 12:10:34 tsutsui Exp $ */
|
||||
/* $NetBSD: trm.c,v 1.17 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
/*
|
||||
* Device Driver for Tekram DC395U/UW/F, DC315/U
|
||||
* PCI SCSI Bus Master Host Adapter
|
||||
@ -42,7 +42,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: trm.c,v 1.16 2005/01/02 12:10:34 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: trm.c,v 1.17 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
/* #define TRM_DEBUG */
|
||||
#ifdef TRM_DEBUG
|
||||
@ -65,6 +65,7 @@ int trm_debug = 1;
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsi_message.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
@ -2246,7 +2247,7 @@ trm_request_sense(struct trm_softc *sc, struct trm_srb *srb)
|
||||
struct scsipi_periph *periph;
|
||||
struct trm_tinfo *ti;
|
||||
struct trm_linfo *li;
|
||||
struct scsipi_sense *ss = (struct scsipi_sense *)srb->cmd;
|
||||
struct scsi_request_sense *ss = (struct scsi_request_sense *)srb->cmd;
|
||||
int error;
|
||||
|
||||
DPRINTF(("trm_request_sense...\n"));
|
||||
@ -2260,16 +2261,15 @@ trm_request_sense(struct trm_softc *sc, struct trm_srb *srb)
|
||||
srb->hastat = 0;
|
||||
srb->tastat = 0;
|
||||
|
||||
ss->opcode = REQUEST_SENSE;
|
||||
memset(ss, 0, sizeof(*ss));
|
||||
ss->opcode = SCSI_REQUEST_SENSE;
|
||||
ss->byte2 = periph->periph_lun << SCSI_CMD_LUN_SHIFT;
|
||||
ss->unused[0] = ss->unused[1] = 0;
|
||||
ss->length = sizeof(struct scsipi_sense_data);
|
||||
ss->control = 0;
|
||||
ss->length = sizeof(struct scsi_sense_data);
|
||||
|
||||
srb->buflen = sizeof(struct scsipi_sense_data);
|
||||
srb->buflen = sizeof(struct scsi_sense_data);
|
||||
srb->sgcnt = 1;
|
||||
srb->sgindex = 0;
|
||||
srb->cmdlen = sizeof(struct scsipi_sense);
|
||||
srb->cmdlen = sizeof(struct scsi_request_sense);
|
||||
|
||||
if ((error = bus_dmamap_load(sc->sc_dmat, srb->dmap,
|
||||
&xs->sense.scsi_sense, srb->buflen, NULL,
|
||||
@ -2280,7 +2280,7 @@ trm_request_sense(struct trm_softc *sc, struct trm_srb *srb)
|
||||
srb->buflen, BUS_DMASYNC_PREREAD);
|
||||
|
||||
srb->sgentry[0].address = htole32(srb->dmap->dm_segs[0].ds_addr);
|
||||
srb->sgentry[0].length = htole32(sizeof(struct scsipi_sense_data));
|
||||
srb->sgentry[0].length = htole32(sizeof(struct scsi_sense_data));
|
||||
bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, srb->sgoffset,
|
||||
TRM_SG_SIZE, BUS_DMASYNC_PREWRITE);
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
# $NetBSD: Makefile,v 1.4 2001/05/31 21:54:07 tron Exp $
|
||||
# $NetBSD: Makefile,v 1.5 2005/02/21 00:29:07 thorpej Exp $
|
||||
|
||||
INCSDIR= /usr/include/dev/scsipi
|
||||
|
||||
# Only install includes which are used by userland
|
||||
INCS= scsipi_all.h scsi_all.h scsipi_cd.h scsipi_debug.h scsi_disk.h \
|
||||
INCS= scsi_spc.h
|
||||
INCS+= scsipi_all.h scsi_all.h scsipi_cd.h scsipi_debug.h scsi_disk.h \
|
||||
scsipiconf.h scsiconf.h ses.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: atapi_base.c,v 1.23 2004/09/17 23:30:22 mycroft Exp $ */
|
||||
/* $NetBSD: atapi_base.c,v 1.24 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: atapi_base.c,v 1.23 2004/09/17 23:30:22 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: atapi_base.c,v 1.24 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -136,7 +136,7 @@ atapi_interpret_sense(struct scsipi_xfer *xs)
|
||||
msg = "unit attention";
|
||||
error = EIO;
|
||||
break;
|
||||
case SKEY_WRITE_PROTECT:
|
||||
case SKEY_DATA_PROTECT:
|
||||
msg = "readonly device";
|
||||
error = EROFS;
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: atapi_tape.h,v 1.4 2005/02/01 00:19:34 reinoud Exp $ */
|
||||
/* $NetBSD: atapi_tape.h,v 1.5 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
|
||||
/*-
|
||||
@ -41,7 +41,7 @@
|
||||
/* ATAPI tape drive Capabilities and Mechanical Status Page */
|
||||
struct atapi_cappage {
|
||||
/* mode page data header */
|
||||
struct scsipi_mode_header header;
|
||||
struct scsi_mode_parameter_header_6 header;
|
||||
/* capabilities page */
|
||||
u_int8_t page_code;
|
||||
#define ATAPI_TAPE_CAP_PAGE 0x2a
|
||||
@ -103,7 +103,7 @@ struct ast_transferpage {
|
||||
/* ATAPI OnStream ADR vendor identification mode page (ADR unique) */
|
||||
struct ast_identifypage {
|
||||
/* mode page data header */
|
||||
struct scsipi_mode_header header;
|
||||
struct scsi_mode_parameter_header_6 header;
|
||||
/* data transfer page */
|
||||
u_int8_t page_code;
|
||||
#define ATAPI_TAPE_IDENTIFY_PAGE 0x36
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cd.c,v 1.218 2005/02/01 00:19:34 reinoud Exp $ */
|
||||
/* $NetBSD: cd.c,v 1.219 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2001, 2003, 2004 The NetBSD Foundation, Inc.
|
||||
@ -54,7 +54,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.218 2005/02/01 00:19:34 reinoud Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.219 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include "rnd.h"
|
||||
|
||||
@ -82,6 +82,7 @@ __KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.218 2005/02/01 00:19:34 reinoud Exp $");
|
||||
#include <sys/rnd.h>
|
||||
#endif
|
||||
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsipi_cd.h>
|
||||
#include <dev/scsipi/scsipi_disk.h> /* rw_big and start_stop come */
|
||||
@ -433,7 +434,7 @@ cdopen(dev_t dev, int flag, int fmt, struct proc *p)
|
||||
periph->periph_flags |= PERIPH_OPEN;
|
||||
|
||||
/* Lock the pack in. */
|
||||
error = scsipi_prevent(periph, PR_PREVENT,
|
||||
error = scsipi_prevent(periph, SPAMR_PREVENT_DT,
|
||||
XS_CTL_IGNORE_ILLEGAL_REQUEST | XS_CTL_IGNORE_MEDIA_CHANGE);
|
||||
SC_DEBUG(periph, SCSIPI_DB1,
|
||||
("cdopen: scsipi_prevent, error=%d\n", error));
|
||||
@ -485,7 +486,7 @@ bad2:
|
||||
|
||||
bad:
|
||||
if (cd->sc_dk.dk_openmask == 0) {
|
||||
scsipi_prevent(periph, PR_ALLOW,
|
||||
scsipi_prevent(periph, SPAMR_ALLOW,
|
||||
XS_CTL_IGNORE_ILLEGAL_REQUEST | XS_CTL_IGNORE_MEDIA_CHANGE);
|
||||
periph->periph_flags &= ~PERIPH_OPEN;
|
||||
}
|
||||
@ -528,7 +529,7 @@ cdclose(dev_t dev, int flag, int fmt, struct proc *p)
|
||||
if (cd->sc_dk.dk_openmask == 0) {
|
||||
scsipi_wait_drain(periph);
|
||||
|
||||
scsipi_prevent(periph, PR_ALLOW,
|
||||
scsipi_prevent(periph, SPAMR_ALLOW,
|
||||
XS_CTL_IGNORE_ILLEGAL_REQUEST | XS_CTL_IGNORE_MEDIA_CHANGE |
|
||||
XS_CTL_IGNORE_NOT_READY);
|
||||
periph->periph_flags &= ~PERIPH_OPEN;
|
||||
@ -987,17 +988,17 @@ static int
|
||||
cd_interpret_sense(struct scsipi_xfer *xs)
|
||||
{
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
struct scsipi_sense_data *sense = &xs->sense.scsi_sense;
|
||||
struct scsi_sense_data *sense = &xs->sense.scsi_sense;
|
||||
int retval = EJUSTRETURN;
|
||||
|
||||
/*
|
||||
* If it isn't a extended or extended/deferred error, let
|
||||
* the generic code handle it.
|
||||
*/
|
||||
if ((sense->error_code & SSD_ERRCODE) != 0x70 &&
|
||||
(sense->error_code & SSD_ERRCODE) != 0x71) { /* DEFERRED */
|
||||
if ((sense->response_code & SSD_RCODE_VALID) == 0 ||
|
||||
(SSD_RCODE(sense->response_code) != SSD_RCODE_CURRENT &&
|
||||
SSD_RCODE(sense->response_code) != SSD_RCODE_DEFERRED))
|
||||
return (retval);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we got a "Unit not ready" (SKEY_NOT_READY) and "Logical Unit
|
||||
@ -1005,9 +1006,9 @@ cd_interpret_sense(struct scsipi_xfer *xs)
|
||||
* wait a bit for the drive to spin up
|
||||
*/
|
||||
|
||||
if ((sense->flags & SSD_KEY) == SKEY_NOT_READY &&
|
||||
sense->add_sense_code == 0x4 &&
|
||||
sense->add_sense_code_qual == 0x01) {
|
||||
if (SSD_SENSE_KEY(sense->flags) == SKEY_NOT_READY &&
|
||||
sense->asc == 0x4 &&
|
||||
sense->ascq == 0x01) {
|
||||
/*
|
||||
* Sleep for 5 seconds to wait for the drive to spin up
|
||||
*/
|
||||
@ -1427,7 +1428,7 @@ bad:
|
||||
if ((cd->sc_dk.dk_openmask & ~(1 << part)) == 0 &&
|
||||
cd->sc_dk.dk_bopenmask + cd->sc_dk.dk_copenmask ==
|
||||
cd->sc_dk.dk_openmask) {
|
||||
error = scsipi_prevent(periph, PR_ALLOW,
|
||||
error = scsipi_prevent(periph, SPAMR_ALLOW,
|
||||
XS_CTL_IGNORE_NOT_READY);
|
||||
if (error)
|
||||
return (error);
|
||||
@ -1440,12 +1441,12 @@ bad:
|
||||
case ODIOCEJECT:
|
||||
return (scsipi_start(periph, SSS_STOP|SSS_LOEJ, 0));
|
||||
case CDIOCALLOW:
|
||||
return (scsipi_prevent(periph, PR_ALLOW, 0));
|
||||
return (scsipi_prevent(periph, SPAMR_ALLOW, 0));
|
||||
case CDIOCPREVENT:
|
||||
return (scsipi_prevent(periph, PR_PREVENT, 0));
|
||||
return (scsipi_prevent(periph, SPAMR_PREVENT_DT, 0));
|
||||
case DIOCLOCK:
|
||||
return (scsipi_prevent(periph,
|
||||
(*(int *)addr) ? PR_PREVENT : PR_ALLOW, 0));
|
||||
(*(int *)addr) ? SPAMR_PREVENT_DT : SPAMR_ALLOW, 0));
|
||||
case CDIOCSETDEBUG:
|
||||
cd->sc_periph->periph_dbflags |= (SCSIPI_DB1 | SCSIPI_DB2);
|
||||
return (0);
|
||||
@ -2150,12 +2151,12 @@ cd_mode_sense(struct cd_softc *cd, u_int8_t byte2, void *sense, size_t size,
|
||||
if (cd->sc_periph->periph_quirks & PQUIRK_ONLYBIG) {
|
||||
*big = 1;
|
||||
return scsipi_mode_sense_big(cd->sc_periph, byte2, page, sense,
|
||||
size + sizeof(struct scsipi_mode_header_big),
|
||||
size + sizeof(struct scsi_mode_parameter_header_10),
|
||||
flags | XS_CTL_DATA_ONSTACK, CDRETRIES, 20000);
|
||||
} else {
|
||||
*big = 0;
|
||||
return scsipi_mode_sense(cd->sc_periph, byte2, page, sense,
|
||||
size + sizeof(struct scsipi_mode_header),
|
||||
size + sizeof(struct scsi_mode_parameter_header_6),
|
||||
flags | XS_CTL_DATA_ONSTACK, CDRETRIES, 20000);
|
||||
}
|
||||
}
|
||||
@ -2166,18 +2167,18 @@ cd_mode_select(struct cd_softc *cd, u_int8_t byte2, void *sense, size_t size,
|
||||
{
|
||||
|
||||
if (big) {
|
||||
struct scsipi_mode_header_big *header = sense;
|
||||
struct scsi_mode_parameter_header_10 *header = sense;
|
||||
|
||||
_lto2b(0, header->data_length);
|
||||
return scsipi_mode_select_big(cd->sc_periph, byte2, sense,
|
||||
size + sizeof(struct scsipi_mode_header_big),
|
||||
size + sizeof(struct scsi_mode_parameter_header_10),
|
||||
flags | XS_CTL_DATA_ONSTACK, CDRETRIES, 20000);
|
||||
} else {
|
||||
struct scsipi_mode_header *header = sense;
|
||||
struct scsi_mode_parameter_header_6 *header = sense;
|
||||
|
||||
header->data_length = 0;
|
||||
return scsipi_mode_select(cd->sc_periph, byte2, sense,
|
||||
size + sizeof(struct scsipi_mode_header),
|
||||
size + sizeof(struct scsi_mode_parameter_header_6),
|
||||
flags | XS_CTL_DATA_ONSTACK, CDRETRIES, 20000);
|
||||
}
|
||||
}
|
||||
@ -2187,8 +2188,8 @@ cd_set_pa_immed(struct cd_softc *cd, int flags)
|
||||
{
|
||||
struct {
|
||||
union {
|
||||
struct scsipi_mode_header small;
|
||||
struct scsipi_mode_header_big big;
|
||||
struct scsi_mode_parameter_header_6 small;
|
||||
struct scsi_mode_parameter_header_10 big;
|
||||
} header;
|
||||
struct cd_audio_page page;
|
||||
} data;
|
||||
@ -2225,7 +2226,7 @@ try_again:
|
||||
return (0);
|
||||
|
||||
return (cd_mode_select(cd, SMS_PF, &data,
|
||||
sizeof(struct scsipi_mode_page_header) + page->pg_length,
|
||||
sizeof(struct scsi_mode_page_header) + page->pg_length,
|
||||
flags, big));
|
||||
}
|
||||
|
||||
@ -2234,8 +2235,8 @@ cd_setchan(struct cd_softc *cd, int p0, int p1, int p2, int p3, int flags)
|
||||
{
|
||||
struct {
|
||||
union {
|
||||
struct scsipi_mode_header small;
|
||||
struct scsipi_mode_header_big big;
|
||||
struct scsi_mode_parameter_header_6 small;
|
||||
struct scsi_mode_parameter_header_10 big;
|
||||
} header;
|
||||
struct cd_audio_page page;
|
||||
} data;
|
||||
@ -2270,7 +2271,7 @@ try_again:
|
||||
page->port[3].channels = p3;
|
||||
|
||||
return (cd_mode_select(cd, SMS_PF, &data,
|
||||
sizeof(struct scsipi_mode_page_header) + page->pg_length,
|
||||
sizeof(struct scsi_mode_page_header) + page->pg_length,
|
||||
flags, big));
|
||||
}
|
||||
|
||||
@ -2279,8 +2280,8 @@ cd_getvol(struct cd_softc *cd, struct ioc_vol *arg, int flags)
|
||||
{
|
||||
struct {
|
||||
union {
|
||||
struct scsipi_mode_header small;
|
||||
struct scsipi_mode_header_big big;
|
||||
struct scsi_mode_parameter_header_6 small;
|
||||
struct scsi_mode_parameter_header_10 big;
|
||||
} header;
|
||||
struct cd_audio_page page;
|
||||
} data;
|
||||
@ -2322,8 +2323,8 @@ cd_setvol(struct cd_softc *cd, const struct ioc_vol *arg, int flags)
|
||||
{
|
||||
struct {
|
||||
union {
|
||||
struct scsipi_mode_header small;
|
||||
struct scsipi_mode_header_big big;
|
||||
struct scsi_mode_parameter_header_6 small;
|
||||
struct scsi_mode_parameter_header_10 big;
|
||||
} header;
|
||||
struct cd_audio_page page;
|
||||
} data, mask;
|
||||
@ -2343,7 +2344,7 @@ try_again:
|
||||
return (error);
|
||||
}
|
||||
if ((error = cd_mode_sense(cd, byte2, &mask, sizeof(mask.page),
|
||||
AUDIO_PAGE|SMS_PAGE_CTRL_CHANGEABLE, flags, &big)) != 0)
|
||||
AUDIO_PAGE|SMS_PCTRL_CHANGEABLE, flags, &big)) != 0)
|
||||
return (error);
|
||||
|
||||
if (big) {
|
||||
@ -2371,7 +2372,7 @@ try_again:
|
||||
page->port[1].channels = CHANNEL_1;
|
||||
|
||||
return (cd_mode_select(cd, SMS_PF, &data,
|
||||
sizeof(struct scsipi_mode_page_header) + page->pg_length,
|
||||
sizeof(struct scsi_mode_page_header) + page->pg_length,
|
||||
flags, big));
|
||||
}
|
||||
|
||||
@ -2394,14 +2395,14 @@ cd_setblksize(struct cd_softc *cd)
|
||||
{
|
||||
struct {
|
||||
union {
|
||||
struct scsipi_mode_header small;
|
||||
struct scsipi_mode_header_big big;
|
||||
struct scsi_mode_parameter_header_6 small;
|
||||
struct scsi_mode_parameter_header_10 big;
|
||||
} header;
|
||||
struct scsi_blk_desc blk_desc;
|
||||
struct scsi_general_block_descriptor blk_desc;
|
||||
} data;
|
||||
int error;
|
||||
int big, bsize;
|
||||
struct scsi_blk_desc *bdesc;
|
||||
struct scsi_general_block_descriptor *bdesc;
|
||||
|
||||
if ((error = cd_mode_sense(cd, 0, &data, sizeof(data.blk_desc), 0, 0,
|
||||
&big)) != 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ch.c,v 1.67 2005/02/01 00:19:34 reinoud Exp $ */
|
||||
/* $NetBSD: ch.c,v 1.68 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 1999, 2004 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ch.c,v 1.67 2005/02/01 00:19:34 reinoud Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ch.c,v 1.68 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -517,7 +517,7 @@ static int
|
||||
ch_interpret_sense(struct scsipi_xfer *xs)
|
||||
{
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
struct scsipi_sense_data *sense = &xs->sense.scsi_sense;
|
||||
struct scsi_sense_data *sense = &xs->sense.scsi_sense;
|
||||
struct ch_softc *sc = (void *)periph->periph_dev;
|
||||
u_int16_t asc_ascq;
|
||||
|
||||
@ -532,8 +532,9 @@ ch_interpret_sense(struct scsipi_xfer *xs)
|
||||
* If it isn't an extended or extended/deferred error, let
|
||||
* the generic code handle it.
|
||||
*/
|
||||
if ((sense->error_code & SSD_ERRCODE) != 0x70 &&
|
||||
(sense->error_code & SSD_ERRCODE) != 0x71)
|
||||
if ((sense->response_code & SSD_RCODE_VALID) == 0 ||
|
||||
(SSD_RCODE(sense->response_code) != SSD_RCODE_CURRENT &&
|
||||
SSD_RCODE(sense->response_code) != SSD_RCODE_DEFERRED))
|
||||
return (EJUSTRETURN);
|
||||
|
||||
/*
|
||||
@ -543,8 +544,8 @@ ch_interpret_sense(struct scsipi_xfer *xs)
|
||||
* We use ASC/ASCQ codes for this.
|
||||
*/
|
||||
|
||||
asc_ascq = (((u_int16_t) sense->add_sense_code) << 8) |
|
||||
sense->add_sense_code_qual;
|
||||
asc_ascq = (((u_int16_t) sense->asc) << 8) |
|
||||
sense->ascq;
|
||||
|
||||
switch (asc_ascq) {
|
||||
case 0x2800:
|
||||
@ -1157,7 +1158,7 @@ static int
|
||||
ch_get_params(struct ch_softc *sc, int scsiflags)
|
||||
{
|
||||
struct scsi_mode_sense_data {
|
||||
struct scsipi_mode_header header;
|
||||
struct scsi_mode_parameter_header_6 header;
|
||||
union {
|
||||
struct page_element_address_assignment ea;
|
||||
struct page_transport_geometry_parameters tg;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: scsi_all.h,v 1.22 2005/02/01 00:19:34 reinoud Exp $ */
|
||||
/* $NetBSD: scsi_all.h,v 1.23 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* SCSI-specific interface description.
|
||||
@ -39,37 +39,6 @@
|
||||
#define SCSI_CMD_LUN_MASK 0xe0
|
||||
#define SCSI_CMD_LUN_SHIFT 5
|
||||
|
||||
/* XXX Is this a command ? What's its opcode ? */
|
||||
struct scsi_send_diag {
|
||||
u_int8_t opcode;
|
||||
u_int8_t byte2;
|
||||
#define SSD_UOL 0x01
|
||||
#define SSD_DOL 0x02
|
||||
#define SSD_SELFTEST 0x04
|
||||
#define SSD_PF 0x10
|
||||
u_int8_t unused[1];
|
||||
u_int8_t paramlen[2];
|
||||
u_int8_t control;
|
||||
};
|
||||
|
||||
#define SCSI_RESERVE 0x16
|
||||
struct scsi_reserve {
|
||||
u_int8_t opcode;
|
||||
u_int8_t byte2;
|
||||
u_int8_t unused[2];
|
||||
u_int8_t length;
|
||||
u_int8_t control;
|
||||
};
|
||||
|
||||
#define SCSI_RELEASE 0x17
|
||||
struct scsi_release {
|
||||
u_int8_t opcode;
|
||||
u_int8_t byte2;
|
||||
u_int8_t unused[2];
|
||||
u_int8_t length;
|
||||
u_int8_t control;
|
||||
};
|
||||
|
||||
#define SCSI_CHANGE_DEFINITION 0x40
|
||||
struct scsi_changedef {
|
||||
u_int8_t opcode;
|
||||
@ -83,14 +52,6 @@ struct scsi_changedef {
|
||||
#define SC_SCSI_1 0x01
|
||||
#define SC_SCSI_2 0x03
|
||||
|
||||
/* block descriptor, for mode sense/mode select */
|
||||
struct scsi_blk_desc {
|
||||
u_int8_t density;
|
||||
u_int8_t nblocks[3];
|
||||
u_int8_t reserved;
|
||||
u_int8_t blklen[3];
|
||||
};
|
||||
|
||||
/*
|
||||
* Status Byte
|
||||
*/
|
||||
|
571
sys/dev/scsipi/scsi_spc.h
Normal file
571
sys/dev/scsipi/scsi_spc.h
Normal file
@ -0,0 +1,571 @@
|
||||
/* $NetBSD: scsi_spc.h,v 1.1 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SCSI Primary Commands (SPC) --
|
||||
* Commands for all device types
|
||||
*/
|
||||
|
||||
/*
|
||||
* Largely written by Julian Elischer (julian@tfs.com)
|
||||
* for TRW Financial Systems.
|
||||
*
|
||||
* TRW Financial Systems, in accordance with their agreement with Carnegie
|
||||
* Mellon University, makes this software available to CMU to distribute
|
||||
* or use in any manner that they see fit as long as this message is kept with
|
||||
* the software. For this reason TFS also grants any other persons or
|
||||
* organisations permission to use or modify this software.
|
||||
*
|
||||
* TFS supplies this software to be publicly redistributed
|
||||
* on the understanding that TFS is not responsible for the correct
|
||||
* functioning of this software in any circumstances.
|
||||
*
|
||||
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
|
||||
*/
|
||||
|
||||
#ifndef _DEV_SCSIPI_SCSI_SPC_H_
|
||||
#define _DEV_SCSIPI_SCSI_SPC_H_
|
||||
|
||||
/*
|
||||
* EXTENDED COPY
|
||||
*/
|
||||
|
||||
/*
|
||||
* INQUIRY
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOG SELECT
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOG SENSE
|
||||
*/
|
||||
|
||||
/*
|
||||
* MODE SELECT
|
||||
*/
|
||||
|
||||
#define SCSI_MODE_SELECT_6 0x15
|
||||
struct scsi_mode_select_6 {
|
||||
uint8_t opcode;
|
||||
uint8_t byte2;
|
||||
#define SMS_SP 0x01 /* save page */
|
||||
#define SMS_PF 0x10 /* page format (0 = SCSI-1, 1 = SCSI-2) */
|
||||
uint8_t reserved[2];
|
||||
uint8_t length;
|
||||
uint8_t control;
|
||||
};
|
||||
|
||||
#define SCSI_MODE_SELECT_10 0x55
|
||||
struct scsi_mode_select_10 {
|
||||
uint8_t opcode;
|
||||
uint8_t byte2; /* see MODE SELECT (6) */
|
||||
uint8_t reserved[5];
|
||||
uint8_t length[2];
|
||||
uint8_t control;
|
||||
};
|
||||
|
||||
/*
|
||||
* MODE SENSE
|
||||
*/
|
||||
|
||||
#define SCSI_MODE_SENSE_6 0x1a
|
||||
struct scsi_mode_sense_6 {
|
||||
uint8_t opcode;
|
||||
uint8_t byte2;
|
||||
#define SMS_DBD 0x08 /* disable block descriptors */
|
||||
uint8_t page;
|
||||
#define SMS_PAGE_MASK 0x3f
|
||||
#define SMS_PCTRL_MASK 0xc0
|
||||
#define SMS_PCTRL_CURRENT 0x00
|
||||
#define SMS_PCTRL_CHANGEABLE 0x40
|
||||
#define SMS_PCTRL_DEFAULT 0x80
|
||||
#define SMS_PCTRL_SAVED 0xc0
|
||||
uint8_t reserved;
|
||||
uint8_t length;
|
||||
uint8_t control;
|
||||
};
|
||||
|
||||
#define SCSI_MODE_SENSE_10 0x5a
|
||||
struct scsi_mode_sense_10 {
|
||||
uint8_t opcode;
|
||||
uint8_t byte2; /* see MODE SENSE (6) */
|
||||
#define SMS_LLBAA 0x10
|
||||
uint8_t page; /* See MODE SENSE (6) */
|
||||
uint8_t reserved[4];
|
||||
uint8_t length[2];
|
||||
uint8_t control;
|
||||
};
|
||||
|
||||
/*
|
||||
* Page code usage:
|
||||
* 0x00 Vendor-specific (does not require page format)
|
||||
* 0x01 - 0x1f Device-type-specific pages
|
||||
* 0x20 - 0x3e Vendor-specific (page format required)
|
||||
* 0x3f Return all mode pages
|
||||
*/
|
||||
#define SMS_PAGE_ALL_PAGES 0x3f
|
||||
|
||||
/*
|
||||
* Mode parameters are returned in the following format:
|
||||
*
|
||||
* Mode parameter header
|
||||
* Block descriptor(s) [zero or more]
|
||||
* Page(s) [zero or more, variable-length]
|
||||
*/
|
||||
|
||||
struct scsi_mode_parameter_header_6 {
|
||||
uint8_t data_length;
|
||||
uint8_t medium_type;
|
||||
uint8_t dev_spec;
|
||||
uint8_t blk_desc_len; /* unused on ATAPI */
|
||||
};
|
||||
|
||||
struct scsi_mode_parameter_header_10 {
|
||||
uint8_t data_length[2];
|
||||
uint8_t medium_type;
|
||||
uint8_t dev_spec;
|
||||
uint8_t byte5;
|
||||
#define SMPH_LONGLBA 0x01
|
||||
uint8_t reserved;
|
||||
uint8_t blk_desc_len[2];
|
||||
};
|
||||
|
||||
struct scsi_general_block_descriptor {
|
||||
uint8_t density;
|
||||
uint8_t nblocks[3];
|
||||
uint8_t reserved;
|
||||
uint8_t blklen[3];
|
||||
};
|
||||
|
||||
struct scsi_da_block_descriptor {
|
||||
uint8_t nblocks[4];
|
||||
uint8_t density;
|
||||
uint8_t blklen[3];
|
||||
};
|
||||
|
||||
struct scsi_longlba_block_descriptor {
|
||||
uint8_t nblocks[8];
|
||||
uint8_t density;
|
||||
uint8_t reserved[3];
|
||||
uint8_t blklen[4];
|
||||
};
|
||||
|
||||
/*
|
||||
* Header common to all mode parameter pages.
|
||||
*/
|
||||
struct scsi_mode_page_header {
|
||||
uint8_t pg_code;
|
||||
#define PGCODE_MASK 0x3f /* page code mask */
|
||||
#define PGCODE_PS 0x80 /* page is saveable */
|
||||
uint8_t pg_length; /* page length (not including header) */
|
||||
};
|
||||
|
||||
/*
|
||||
* Control mode page
|
||||
*/
|
||||
#define SCSI_CONTROL_MODE_PAGE 0x0a
|
||||
struct scsi_control_mode_page {
|
||||
uint8_t pg_code; /* 0x0a */
|
||||
uint8_t pg_length; /* 0x0a */
|
||||
uint8_t byte3;
|
||||
#define SCMP_RLEC 0x01 /* report log exception condition */
|
||||
#define SCMP_GLTSD 0x02 /* global logging target save disable */
|
||||
#define SCMP_TST_mask 0x7 /* task set type */
|
||||
#define SCMP_TST_shift 5
|
||||
#define SCMP_TST_ALL_INIT 0 /* per LU for all initiators */
|
||||
#define SCMP_TST_PER_INIT 1 /* per initiator per LU */
|
||||
uint8_t queue_params;
|
||||
#define SCMP_DQue 0x01 /* disable queueing */
|
||||
#define SCMP_QErr_mask 0x3 /* queue error management */
|
||||
#define SCMP_QErr_shift 1
|
||||
#define SCMP_QAM_mask 0xf /* queue algorithm modifier */
|
||||
#define SCMP_QAM_shift 4
|
||||
#define SCMP_QAM_RESTRICTED 0x0 /* restricted reordering allowed */
|
||||
#define SCMP_QAM_UNRESTRICTED 0x1 /* unrestricted reordering allowed */
|
||||
/* 0x2 - 0x7 Reserved */
|
||||
/* 0x8 - 0xf Vendor-specific */
|
||||
uint8_t byte5;
|
||||
#define SCMP_EAERP 0x01
|
||||
#define SCMP_UAAERP 0x02
|
||||
#define SCMP_RAERP 0x04
|
||||
#define SCMP_SWP 0x08
|
||||
#define SCMP_RAC 0x40
|
||||
#define SCMP_TAS 0x80
|
||||
uint8_t byte6;
|
||||
#define SCMP_AM_mask 0x7 /* autload mode */
|
||||
#define SCMP_AM_FULL 0
|
||||
#define SCMP_AM_AUXMEM 1
|
||||
#define SCMP_AM_NOLOAD 2
|
||||
uint8_t rahp[2]; /* ready aer holdoff period */
|
||||
uint8_t btp[2]; /* busy timeout period */
|
||||
uint8_t estct[2]; /* extended self-test completion time */
|
||||
};
|
||||
|
||||
/*
|
||||
* Disconnect-reconnect page
|
||||
*/
|
||||
#define SCSI_DISCONNECT_RECONNECT_PAGE 0x02
|
||||
struct scsi_disconnect_reconnect_page {
|
||||
uint8_t pg_code; /* 0x02 */
|
||||
uint8_t pg_length; /* 0x0e */
|
||||
uint8_t buffer_full_ratio;
|
||||
uint8_t buffer_empty_ratio;
|
||||
uint8_t bus_inactivity_limit[2];
|
||||
uint8_t disconnect_time_limit[2];
|
||||
uint8_t connect_time_limit[2];
|
||||
uint8_t maximum_burst_size[2];
|
||||
uint8_t flags;
|
||||
#define SDRP_DTDC_mask 0x7 /* data transfer disconnect control */
|
||||
#define SDRP_DImm 0x08
|
||||
#define SDRP_FA_mask 0x7
|
||||
#define SDRP_FA_shift 4
|
||||
#define SDRP_EMDP 0x80
|
||||
uint8_t reserved;
|
||||
uint8_t first_burst_size[2];
|
||||
};
|
||||
|
||||
/*
|
||||
* Informational exceptions control page
|
||||
*/
|
||||
#define SCSI_INFORMATIONAL_EXCEPTIONS_CONTROL_PAGE 0x1c
|
||||
struct scsi_informational_exceptions_control_page {
|
||||
uint8_t pg_code; /* 0x1c */
|
||||
uint8_t pg_length; /* 0x0a */
|
||||
uint8_t byte3;
|
||||
#define SIECP_LogErr 0x01
|
||||
#define SIECP_TEST 0x04
|
||||
#define SIECP_DExcpt 0x08
|
||||
#define SIECP_EWasc 0x10
|
||||
#define SIECP_EBF 0x20
|
||||
#define SIECP_PERF 0x80
|
||||
uint8_t byte4;
|
||||
#define SIECP_MRIE_mask 0xf /* method of reporting
|
||||
informational exceptions */
|
||||
#define SIECP_MRIE_NO_REPORTING 0x00
|
||||
#define SIECP_MRIE_ASYNC_EVENT 0x01
|
||||
#define SIECP_MRIE_UNIT_ATN 0x02
|
||||
#define SIECP_MRIE_COND_RECOV_ERR 0x03
|
||||
#define SIECP_MRIE_UNCOND_RECOV_ERR 0x04
|
||||
#define SIECP_MRIE_NO_SENSE 0x05
|
||||
#define SIECP_MRIE_ON_REQUEST 0x06
|
||||
/* 0x07 - 0x0b reserved */
|
||||
/* 0x0c - 0x0f Vendor-specific */
|
||||
uint8_t interval_timer[2];
|
||||
uint8_t report_count[2];
|
||||
};
|
||||
|
||||
/*
|
||||
* Power condition page
|
||||
*/
|
||||
#define SCSI_POWER_CONDITION_PAGE 0x1a
|
||||
struct scsi_power_condition_page {
|
||||
uint8_t pg_code; /* 0x1a */
|
||||
uint8_t pg_length; /* 0x0a */
|
||||
uint8_t reserved;
|
||||
uint8_t byte4;
|
||||
#define SPCP_STANDBY 0x01
|
||||
#define SPCP_IDLE 0x02
|
||||
uint8_t idle_timer[2]; /* 100ms increments */
|
||||
uint8_t standby_timer[2]; /* 100ms increments */
|
||||
};
|
||||
|
||||
/*
|
||||
* Protocol specific LUN page
|
||||
*/
|
||||
#define SCSI_PROTOCOL_SPECIFIC_LUN_PAGE 0x18
|
||||
struct scsi_protocol_specific_lun_page {
|
||||
uint8_t pg_code; /* 0x18 */
|
||||
uint8_t pg_length; /* variable */
|
||||
uint8_t byte3;
|
||||
#define SPSLP_PROTOCOL_mask 0xf
|
||||
#define SPSLP_PROTOCOL_FCP 0x00 /* Fibre Channel */
|
||||
#define SPSLP_PROTOCOL_SPI 0x01 /* parallel SCSI */
|
||||
#define SPSLP_PROTOCOL_SSA 0x02 /* SSA-S2P or SSA-S3P */
|
||||
#define SPSLP_PROTOCOL_SBP2 0x03 /* IEEE 1394 */
|
||||
#define SPSLP_PROTOCOL_SRP 0x04 /* SCSI RDMA */
|
||||
#define SPSLP_PROTOCOL_ISCSI 0x05 /* iSCSI */
|
||||
/* protocol specific mode parameters follow */
|
||||
};
|
||||
|
||||
/*
|
||||
* Protocol specific port page
|
||||
*/
|
||||
#define SCSI_PROTOCOL_SPECIFIC_PORT_PAGE 0x19
|
||||
struct scsi_protocol_specific_port_page {
|
||||
uint8_t pg_code; /* 0x18 */
|
||||
uint8_t pg_length; /* variable */
|
||||
uint8_t byte3; /* see SCSI PROTOCOL SPECIFIC LUN PAGE */
|
||||
/* protocol specific mode parameters follow */
|
||||
};
|
||||
|
||||
/*
|
||||
* PERSISTENT RESERVE IN
|
||||
*/
|
||||
|
||||
/*
|
||||
* PERSISTENT RESERVE OUT
|
||||
*/
|
||||
|
||||
/*
|
||||
* PREVENT ALLOW MEDIUM REMOVAL
|
||||
*/
|
||||
|
||||
#define SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e
|
||||
struct scsi_prevent_allow_medium_removal {
|
||||
uint8_t opcode;
|
||||
uint8_t byte2;
|
||||
uint8_t reserved[2];
|
||||
uint8_t how;
|
||||
#define SPAMR_ALLOW 0x00
|
||||
#define SPAMR_PREVENT_DT 0x01
|
||||
#define SPAMR_PREVENT_MC 0x02
|
||||
#define SPAMR_PREVENT_ALL 0x03
|
||||
uint8_t control;
|
||||
};
|
||||
|
||||
/*
|
||||
* READ BUFFER
|
||||
*/
|
||||
|
||||
/*
|
||||
* RECEIVE COPY RESULTS
|
||||
*/
|
||||
|
||||
/*
|
||||
* RECEIVE DIAGNOSTIC RESULTS
|
||||
*/
|
||||
|
||||
/*
|
||||
* RESERVE / RELEASE
|
||||
*/
|
||||
|
||||
#define SCSI_RESERVE_6 0x16
|
||||
#define SCSI_RELEASE_6 0x17
|
||||
struct scsi_reserve_release_6 {
|
||||
uint8_t opcode;
|
||||
uint8_t byte2;
|
||||
uint8_t obsolete;
|
||||
uint8_t reserved[2];
|
||||
uint8_t control;
|
||||
};
|
||||
|
||||
#define SCSI_RESERVE_10 0x56
|
||||
#define SCSI_RELEASE_10 0x57
|
||||
struct scsi_reserve_release_10 {
|
||||
uint8_t opcode;
|
||||
uint8_t byte2;
|
||||
#define SR_LongID 0x02
|
||||
#define SR_3rdPty 0x10
|
||||
uint8_t obsolete;
|
||||
uint8_t thirdpartyid;
|
||||
uint8_t reserved[3];
|
||||
uint8_t paramlen[2];
|
||||
uint8_t control;
|
||||
};
|
||||
|
||||
struct scsi_reserve_release_10_idparam {
|
||||
uint8_t thirdpartyid[8];
|
||||
};
|
||||
|
||||
/*
|
||||
* REPORT DEVICE IDENTIFIER
|
||||
*/
|
||||
|
||||
/*
|
||||
* REPORT LUNS
|
||||
*/
|
||||
|
||||
/*
|
||||
* REQUEST SENSE
|
||||
*/
|
||||
|
||||
#define SCSI_REQUEST_SENSE 0x03
|
||||
struct scsi_request_sense {
|
||||
uint8_t opcode;
|
||||
uint8_t byte2;
|
||||
uint8_t reserved[2];
|
||||
uint8_t length;
|
||||
uint8_t control;
|
||||
};
|
||||
|
||||
struct scsi_sense_data {
|
||||
/* 1*/ uint8_t response_code;
|
||||
#define SSD_RCODE(x) ((x) & 0x7f)
|
||||
#define SSD_RCODE_CURRENT 0x70
|
||||
#define SSD_RCODE_DEFERRED 0x71
|
||||
#define SSD_RCODE_VALID 0x80
|
||||
/* 2*/ uint8_t segment; /* obsolete */
|
||||
/* 3*/ uint8_t flags;
|
||||
#define SSD_SENSE_KEY(x) ((x) & 0x0f)
|
||||
#define SSD_ILI 0x20
|
||||
#define SSD_EOM 0x40
|
||||
#define SSD_FILEMARK 0x80
|
||||
/* 7*/ uint8_t info[4];
|
||||
/* 8*/ uint8_t extra_len;
|
||||
/*12*/ uint8_t csi[4];
|
||||
/*13*/ uint8_t asc;
|
||||
/*14*/ uint8_t ascq;
|
||||
/*15*/ uint8_t fru;
|
||||
union {
|
||||
uint8_t sks_bytes[3];
|
||||
|
||||
/* ILLEGAL REQUEST */
|
||||
struct {
|
||||
uint8_t byte0;
|
||||
#define SSD_SKS_FP_BIT(x) ((x) & 0x7)
|
||||
#define SSD_SKS_FP_BPV 0x08
|
||||
#define SSK_SKS_FP_CD 0x40 /* 1=command, 0=data */
|
||||
uint8_t val[2];
|
||||
} field_pointer;
|
||||
|
||||
/* RECOVERED ERROR, HARDWARE ERROR, MEDIUM ERROR */
|
||||
struct {
|
||||
uint8_t byte0;
|
||||
uint8_t val[2];
|
||||
} actual_retry_count;
|
||||
|
||||
/* NOT READY, NO SENSE */
|
||||
struct {
|
||||
uint8_t byte0;
|
||||
uint8_t val[2];
|
||||
} progress_indication;
|
||||
|
||||
/* COPY ABORTED */
|
||||
struct {
|
||||
uint8_t byte0;
|
||||
#define SSD_SKS_SP_BIT(x) ((x) & 0x7)
|
||||
#define SSD_SKS_SP_BPV 0x08
|
||||
#define SSD_SKS_SP_SD 0x20 /* 0=param list, 1=segment desc */
|
||||
uint8_t val[2];
|
||||
} segment_pointer;
|
||||
/*18*/ } sks;
|
||||
#define SSD_SKSV 0x80 /* byte0 of sks field */
|
||||
/*32*/ uint8_t extra_bytes[14]; /* really variable length */
|
||||
};
|
||||
|
||||
/*
|
||||
* Sense bytes described by the extra_len field start at csi[], and can
|
||||
* only continue up to the end of the 32-byte sense structure that we
|
||||
* have defined (which might be too short for some cases).
|
||||
*/
|
||||
#define SSD_ADD_BYTES_LIM(sp) \
|
||||
((((int)(sp)->extra_len) < (int)sizeof(struct scsi_sense_data) - 8) ? \
|
||||
(sp)->extra_len : sizeof(struct scsi_sense_data) - 8)
|
||||
|
||||
#define SKEY_NO_SENSE 0x00
|
||||
#define SKEY_RECOVERED_ERROR 0x01
|
||||
#define SKEY_NOT_READY 0x02
|
||||
#define SKEY_MEDIUM_ERROR 0x03
|
||||
#define SKEY_HARDWARE_ERROR 0x04
|
||||
#define SKEY_ILLEGAL_REQUEST 0x05
|
||||
#define SKEY_UNIT_ATTENTION 0x06
|
||||
#define SKEY_DATA_PROTECT 0x07
|
||||
#define SKEY_BLANK_CHECK 0x08
|
||||
#define SKEY_VENDOR_SPECIFIC 0x09
|
||||
#define SKEY_COPY_ABORTED 0x0a
|
||||
#define SKEY_ABORTED_COMMAND 0x0b
|
||||
#define SKEY_EQUAL 0x0c /* obsolete */
|
||||
#define SKEY_VOLUME_OVERFLOW 0x0d
|
||||
#define SKEY_MISCOMPARE 0x0e
|
||||
/* 0x0f reserved */
|
||||
|
||||
/* XXX This is not described in SPC-2. */
|
||||
struct scsi_sense_data_unextended {
|
||||
uint8_t response_code;
|
||||
uint8_t block[3];
|
||||
};
|
||||
|
||||
/*
|
||||
* SEND DIAGNOSTIC
|
||||
*/
|
||||
|
||||
#define SCSI_SEND_DIAGNOSTIC 0x1d
|
||||
struct scsi_send_diagnostic {
|
||||
uint8_t opcode;
|
||||
uint8_t byte2;
|
||||
#define SSD_UnitOffL 0x01
|
||||
#define SSD_DevOffL 0x02
|
||||
#define SSD_SelfTest 0x04 /* standard self-test */
|
||||
#define SSD_PF 0x10 /* results in page format */
|
||||
#define SSD_CODE(x) ((x) << 5)
|
||||
/*
|
||||
* Codes:
|
||||
*
|
||||
* 0 This value shall be used when the SelfTest bit is
|
||||
* set to one or if the SEND DIAGNOSTIC command is not
|
||||
* invoking one of the other self-test functions such
|
||||
* as enclosure services or the Translate Address page.
|
||||
*
|
||||
* 1 Background short self-test. Parameter length is 0.
|
||||
*
|
||||
* 2 Background extended self-test. Parameter length is 0.
|
||||
*
|
||||
* 4 Abort background self-test. Parameter length is 0.
|
||||
*
|
||||
* 5 Foreground short self-test. Parameter length is 0.
|
||||
*
|
||||
* 6 Foreground extended self-test. Parameter length is 0.
|
||||
*/
|
||||
uint8_t reserved;
|
||||
uint8_t paramlen[2];
|
||||
uint8_t control;
|
||||
};
|
||||
|
||||
/*
|
||||
* SET DEVICE IDENTIFIER
|
||||
*/
|
||||
|
||||
/*
|
||||
* TEST UNIT READY
|
||||
*/
|
||||
|
||||
#define SCSI_TEST_UNIT_READY 0x00
|
||||
struct scsi_test_unit_ready {
|
||||
uint8_t opcode;
|
||||
uint8_t byte2;
|
||||
uint8_t reserved[3];
|
||||
uint8_t control;
|
||||
};
|
||||
|
||||
/*
|
||||
* WRITE BUFFER
|
||||
*/
|
||||
|
||||
#endif /* _DEV_SCSIPI_SCSI_SPC_H_ */
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: scsipi_all.h,v 1.27 2005/02/01 00:19:34 reinoud Exp $ */
|
||||
/* $NetBSD: scsipi_all.h,v 1.28 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* SCSI and SCSI-like general interface description
|
||||
@ -54,69 +54,6 @@
|
||||
/*
|
||||
* Some basic, common SCSI commands
|
||||
*/
|
||||
#define TEST_UNIT_READY 0x00
|
||||
struct scsipi_test_unit_ready {
|
||||
u_int8_t opcode;
|
||||
u_int8_t byte2;
|
||||
u_int8_t unused[3];
|
||||
u_int8_t control;
|
||||
};
|
||||
|
||||
#define REQUEST_SENSE 0x03
|
||||
struct scsipi_sense {
|
||||
u_int8_t opcode;
|
||||
u_int8_t byte2;
|
||||
u_int8_t unused[2];
|
||||
u_int8_t length;
|
||||
u_int8_t control;
|
||||
};
|
||||
|
||||
#define MODE_SENSE 0x1a
|
||||
struct scsipi_mode_sense {
|
||||
u_int8_t opcode;
|
||||
u_int8_t byte2;
|
||||
#define SMS_DBD 0x08 /* disable block descriptors */
|
||||
u_int8_t page;
|
||||
#define SMS_PAGE_CODE 0x3F
|
||||
#define SMS_PAGE_CTRL 0xC0
|
||||
#define SMS_PAGE_CTRL_CURRENT 0x00
|
||||
#define SMS_PAGE_CTRL_CHANGEABLE 0x40
|
||||
#define SMS_PAGE_CTRL_DEFAULT 0x80
|
||||
#define SMS_PAGE_CTRL_SAVED 0xC0
|
||||
u_int8_t unused;
|
||||
u_int8_t length;
|
||||
u_int8_t control;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define MODE_SENSE_BIG 0x5A
|
||||
struct scsipi_mode_sense_big {
|
||||
u_int8_t opcode;
|
||||
u_int8_t byte2; /* same bits as small version */
|
||||
u_int8_t page; /* same bits as small version */
|
||||
u_int8_t unused[4];
|
||||
u_int8_t length[2];
|
||||
u_int8_t control;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define MODE_SELECT 0x15
|
||||
struct scsipi_mode_select {
|
||||
u_int8_t opcode;
|
||||
u_int8_t byte2;
|
||||
#define SMS_SP 0x01 /* save page */
|
||||
#define SMS_PF 0x10 /* page format (0 = SCSI-1, 1 = SCSI-2) */
|
||||
u_int8_t unused[2];
|
||||
u_int8_t length;
|
||||
u_int8_t control;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define MODE_SELECT_BIG 0x55
|
||||
struct scsipi_mode_select_big {
|
||||
u_int8_t opcode;
|
||||
u_int8_t byte2; /* same bits as small version */
|
||||
u_int8_t unused[5];
|
||||
u_int8_t length[2];
|
||||
u_int8_t control;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define INQUIRY 0x12
|
||||
struct scsipi_inquiry {
|
||||
@ -139,76 +76,10 @@ struct scsipi_start_stop {
|
||||
u_int8_t control;
|
||||
};
|
||||
|
||||
#define PREVENT_ALLOW 0x1e
|
||||
struct scsipi_prevent {
|
||||
u_int8_t opcode;
|
||||
u_int8_t byte2;
|
||||
u_int8_t unused[2];
|
||||
u_int8_t how;
|
||||
u_int8_t control;
|
||||
} __attribute__((packed));
|
||||
#define PR_PREVENT 0x01
|
||||
#define PR_ALLOW 0x00
|
||||
|
||||
/*
|
||||
* inquiry and sense data format
|
||||
* inquiry data format
|
||||
*/
|
||||
|
||||
struct scsipi_sense_data {
|
||||
/* 1*/ u_int8_t error_code;
|
||||
#define SSD_ERRCODE 0x7F
|
||||
#define SSD_ERRCODE_VALID 0x80
|
||||
/* 2*/ u_int8_t segment;
|
||||
/* 3*/ u_int8_t flags;
|
||||
#define SSD_KEY 0x0F
|
||||
#define SSD_ILI 0x20
|
||||
#define SSD_EOM 0x40
|
||||
#define SSD_FILEMARK 0x80
|
||||
/* 7*/ u_int8_t info[4];
|
||||
/* 8*/ u_int8_t extra_len;
|
||||
/*12*/ u_int8_t cmd_spec_info[4];
|
||||
/*13*/ u_int8_t add_sense_code;
|
||||
/*14*/ u_int8_t add_sense_code_qual;
|
||||
/*15*/ u_int8_t fru;
|
||||
/*16*/ u_int8_t sense_key_spec_1;
|
||||
#define SSD_SCS_VALID 0x80
|
||||
/*17*/ u_int8_t sense_key_spec_2;
|
||||
/*18*/ u_int8_t sense_key_spec_3;
|
||||
/*32*/ u_int8_t extra_bytes[14];
|
||||
} __attribute__((packed));
|
||||
|
||||
#define SKEY_NO_SENSE 0x00
|
||||
#define SKEY_RECOVERED_ERROR 0x01
|
||||
#define SKEY_NOT_READY 0x02
|
||||
#define SKEY_MEDIUM_ERROR 0x03
|
||||
#define SKEY_HARDWARE_ERROR 0x04
|
||||
#define SKEY_ILLEGAL_REQUEST 0x05
|
||||
#define SKEY_UNIT_ATTENTION 0x06
|
||||
#define SKEY_WRITE_PROTECT 0x07
|
||||
#define SKEY_BLANK_CHECK 0x08
|
||||
#define SKEY_VENDOR_UNIQUE 0x09
|
||||
#define SKEY_COPY_ABORTED 0x0A
|
||||
#define SKEY_ABORTED_COMMAND 0x0B
|
||||
#define SKEY_EQUAL 0x0C
|
||||
#define SKEY_VOLUME_OVERFLOW 0x0D
|
||||
#define SKEY_MISCOMPARE 0x0E
|
||||
#define SKEY_RESERVED 0x0F
|
||||
|
||||
/*
|
||||
* Sense bytes described by the extra_len tag start at cmd_spec_info,
|
||||
* and can only continue up to the end of the structure we've defined
|
||||
* (which is too short for some cases).
|
||||
*/
|
||||
#define ADD_BYTES_LIM(sp) \
|
||||
((((int)(sp)->extra_len) < (int) sizeof(struct scsipi_sense_data) - 8)? \
|
||||
((sp)->extra_len) : (sizeof (struct scsipi_sense_data) - 8))
|
||||
|
||||
|
||||
struct scsipi_sense_data_unextended {
|
||||
/* 1*/ u_int8_t error_code;
|
||||
/* 4*/ u_int8_t block[3];
|
||||
} __attribute__((packed));
|
||||
|
||||
#define T_REMOV 1 /* device is removable */
|
||||
#define T_FIXED 0 /* device is not removable */
|
||||
|
||||
@ -294,30 +165,4 @@ struct scsipi_inquiry_data {
|
||||
#define SCSIPI_INQUIRY_LENGTH_SCSI3 74
|
||||
} __attribute__((packed)); /* 74 Bytes */
|
||||
|
||||
/* Data structures for mode select/mode sense */
|
||||
struct scsipi_mode_header {
|
||||
u_int8_t data_length; /* Sense data length */
|
||||
u_int8_t medium_type;
|
||||
u_int8_t dev_spec;
|
||||
u_int8_t blk_desc_len; /* unused on ATAPI */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct scsipi_mode_header_big {
|
||||
u_int8_t data_length[2]; /* Sense data length */
|
||||
u_int8_t medium_type;
|
||||
u_int8_t dev_spec;
|
||||
u_int8_t unused[2]; /* unused on ATAPI */
|
||||
u_int8_t blk_desc_len[2]; /* unused on ATAPI */
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* This part is common to all mode pages.
|
||||
*/
|
||||
struct scsipi_mode_page_header {
|
||||
u_int8_t pg_code; /* page code */
|
||||
#define PGCODE_MASK 0x3f /* page code mask */
|
||||
#define PGCODE_PS 0x80 /* page is savable */
|
||||
u_int8_t pg_length; /* page length (not including hdr) */
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#endif /* _DEV_SCSIPI_SCSIPI_ALL_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: scsipi_base.c,v 1.126 2005/02/01 00:19:34 reinoud Exp $ */
|
||||
/* $NetBSD: scsipi_base.c,v 1.127 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.126 2005/02/01 00:19:34 reinoud Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.127 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include "opt_scsi.h"
|
||||
|
||||
@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.126 2005/02/01 00:19:34 reinoud Ex
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsipi_disk.h>
|
||||
#include <dev/scsipi/scsipiconf.h>
|
||||
@ -759,7 +760,7 @@ scsipi_print_cdb(struct scsipi_generic *cmd)
|
||||
int
|
||||
scsipi_interpret_sense(struct scsipi_xfer *xs)
|
||||
{
|
||||
struct scsipi_sense_data *sense;
|
||||
struct scsi_sense_data *sense;
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
u_int8_t key;
|
||||
int error;
|
||||
@ -783,12 +784,12 @@ scsipi_interpret_sense(struct scsipi_xfer *xs)
|
||||
int count;
|
||||
scsipi_printaddr(periph);
|
||||
printf(" sense debug information:\n");
|
||||
printf("\tcode 0x%x valid 0x%x\n",
|
||||
sense->error_code & SSD_ERRCODE,
|
||||
sense->error_code & SSD_ERRCODE_VALID ? 1 : 0);
|
||||
printf("\tcode 0x%x valid %d\n",
|
||||
SSD_RCODE(sense->response_code),
|
||||
sense->response_code & SSD_RCODE_VALID ? 1 : 0);
|
||||
printf("\tseg 0x%x key 0x%x ili 0x%x eom 0x%x fmark 0x%x\n",
|
||||
sense->segment,
|
||||
sense->flags & SSD_KEY,
|
||||
SSD_SENSE_KEY(sense->flags),
|
||||
sense->flags & SSD_ILI ? 1 : 0,
|
||||
sense->flags & SSD_EOM ? 1 : 0,
|
||||
sense->flags & SSD_FILEMARK ? 1 : 0);
|
||||
@ -800,8 +801,8 @@ scsipi_interpret_sense(struct scsipi_xfer *xs)
|
||||
sense->info[3],
|
||||
sense->extra_len);
|
||||
printf("\textra: ");
|
||||
for (count = 0; count < ADD_BYTES_LIM(sense); count++)
|
||||
printf("0x%x ", sense->cmd_spec_info[count]);
|
||||
for (count = 0; count < SSD_ADD_BYTES_LIM(sense); count++)
|
||||
printf("0x%x ", sense->csi[count]);
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
@ -819,7 +820,7 @@ scsipi_interpret_sense(struct scsipi_xfer *xs)
|
||||
return (error);
|
||||
}
|
||||
/* otherwise use the default */
|
||||
switch (sense->error_code & SSD_ERRCODE) {
|
||||
switch (SSD_RCODE(sense->response_code)) {
|
||||
|
||||
/*
|
||||
* Old SCSI-1 and SASI devices respond with
|
||||
@ -848,17 +849,17 @@ scsipi_interpret_sense(struct scsipi_xfer *xs)
|
||||
*/
|
||||
case 0x71: /* delayed error */
|
||||
scsipi_printaddr(periph);
|
||||
key = sense->flags & SSD_KEY;
|
||||
key = SSD_SENSE_KEY(sense->flags);
|
||||
printf(" DEFERRED ERROR, key = 0x%x\n", key);
|
||||
/* FALLTHROUGH */
|
||||
case 0x70:
|
||||
#ifndef SCSIVERBOSE
|
||||
if ((sense->error_code & SSD_ERRCODE_VALID) != 0)
|
||||
if ((sense->response_code & SSD_RCODE_VALID) != 0)
|
||||
info = _4btol(sense->info);
|
||||
else
|
||||
info = 0;
|
||||
#endif
|
||||
key = sense->flags & SSD_KEY;
|
||||
key = SSD_SENSE_KEY(sense->flags);
|
||||
|
||||
switch (key) {
|
||||
case SKEY_NO_SENSE:
|
||||
@ -877,7 +878,7 @@ scsipi_interpret_sense(struct scsipi_xfer *xs)
|
||||
periph->periph_flags &= ~PERIPH_MEDIA_LOADED;
|
||||
if ((xs->xs_control & XS_CTL_IGNORE_NOT_READY) != 0)
|
||||
return (0);
|
||||
if (sense->add_sense_code == 0x3A) {
|
||||
if (sense->asc == 0x3A) {
|
||||
error = ENODEV; /* Medium not present */
|
||||
if (xs->xs_control & XS_CTL_SILENT_NODEV)
|
||||
return (error);
|
||||
@ -895,16 +896,16 @@ scsipi_interpret_sense(struct scsipi_xfer *xs)
|
||||
* Logical Unit Not Supported during discovery.
|
||||
*/
|
||||
if ((xs->xs_control & XS_CTL_DISCOVERY) != 0 &&
|
||||
sense->add_sense_code == 0x25 &&
|
||||
sense->add_sense_code_qual == 0x00)
|
||||
sense->asc == 0x25 &&
|
||||
sense->ascq == 0x00)
|
||||
return (EINVAL);
|
||||
if ((xs->xs_control & XS_CTL_SILENT) != 0)
|
||||
return (EIO);
|
||||
error = EINVAL;
|
||||
break;
|
||||
case SKEY_UNIT_ATTENTION:
|
||||
if (sense->add_sense_code == 0x29 &&
|
||||
sense->add_sense_code_qual == 0x00) {
|
||||
if (sense->asc == 0x29 &&
|
||||
sense->ascq == 0x00) {
|
||||
/* device or bus reset */
|
||||
return (ERESTART);
|
||||
}
|
||||
@ -921,7 +922,7 @@ scsipi_interpret_sense(struct scsipi_xfer *xs)
|
||||
return (EIO);
|
||||
error = EIO;
|
||||
break;
|
||||
case SKEY_WRITE_PROTECT:
|
||||
case SKEY_DATA_PROTECT:
|
||||
error = EROFS;
|
||||
break;
|
||||
case SKEY_BLANK_CHECK:
|
||||
@ -949,12 +950,12 @@ scsipi_interpret_sense(struct scsipi_xfer *xs)
|
||||
if (key) {
|
||||
scsipi_printaddr(periph);
|
||||
printf("%s", error_mes[key - 1]);
|
||||
if ((sense->error_code & SSD_ERRCODE_VALID) != 0) {
|
||||
if ((sense->response_code & SSD_RCODE_VALID) != 0) {
|
||||
switch (key) {
|
||||
case SKEY_NOT_READY:
|
||||
case SKEY_ILLEGAL_REQUEST:
|
||||
case SKEY_UNIT_ATTENTION:
|
||||
case SKEY_WRITE_PROTECT:
|
||||
case SKEY_DATA_PROTECT:
|
||||
break;
|
||||
case SKEY_BLANK_CHECK:
|
||||
printf(", requested size: %d (decimal)",
|
||||
@ -975,7 +976,7 @@ scsipi_interpret_sense(struct scsipi_xfer *xs)
|
||||
printf(", data =");
|
||||
for (n = 0; n < sense->extra_len; n++)
|
||||
printf(" %02x",
|
||||
sense->cmd_spec_info[n]);
|
||||
sense->csi[n]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
@ -1005,10 +1006,10 @@ scsipi_interpret_sense(struct scsipi_xfer *xs)
|
||||
#else
|
||||
scsipi_printaddr(periph);
|
||||
printf("Sense Error Code 0x%x",
|
||||
sense->error_code & SSD_ERRCODE);
|
||||
if ((sense->error_code & SSD_ERRCODE_VALID) != 0) {
|
||||
struct scsipi_sense_data_unextended *usense =
|
||||
(struct scsipi_sense_data_unextended *)sense;
|
||||
SSD_RCODE(sense->response_code));
|
||||
if ((sense->response_code & SSD_RCODE_VALID) != 0) {
|
||||
struct scsi_sense_data_unextended *usense =
|
||||
(struct scsi_sense_data_unextended *)sense;
|
||||
printf(" at block no. %d (decimal)",
|
||||
_3btol(usense->block));
|
||||
}
|
||||
@ -1077,10 +1078,10 @@ scsipi_size(struct scsipi_periph *periph, int flags)
|
||||
int
|
||||
scsipi_test_unit_ready(struct scsipi_periph *periph, int flags)
|
||||
{
|
||||
struct scsipi_test_unit_ready cmd;
|
||||
struct scsi_test_unit_ready cmd;
|
||||
int retries;
|
||||
|
||||
/* some ATAPI drives don't support TEST_UNIT_READY. Sigh */
|
||||
/* some ATAPI drives don't support TEST UNIT READY. Sigh */
|
||||
if (periph->periph_quirks & PQUIRK_NOTUR)
|
||||
return (0);
|
||||
|
||||
@ -1090,7 +1091,7 @@ scsipi_test_unit_ready(struct scsipi_periph *periph, int flags)
|
||||
retries = SCSIPIRETRIES;
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
cmd.opcode = TEST_UNIT_READY;
|
||||
cmd.opcode = SCSI_TEST_UNIT_READY;
|
||||
|
||||
return (scsipi_command(periph, (void *)&cmd, sizeof(cmd), 0, 0,
|
||||
retries, 10000, NULL, flags));
|
||||
@ -1197,10 +1198,10 @@ printf("inquire: error=%d\n", error);
|
||||
int
|
||||
scsipi_prevent(struct scsipi_periph *periph, int type, int flags)
|
||||
{
|
||||
struct scsipi_prevent cmd;
|
||||
struct scsi_prevent_allow_medium_removal cmd;
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
cmd.opcode = PREVENT_ALLOW;
|
||||
cmd.opcode = SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL;
|
||||
cmd.how = type;
|
||||
|
||||
return (scsipi_command(periph, (void *)&cmd, sizeof(cmd), 0, 0,
|
||||
@ -1233,13 +1234,13 @@ scsipi_start(struct scsipi_periph *periph, int type, int flags)
|
||||
|
||||
int
|
||||
scsipi_mode_sense(struct scsipi_periph *periph, int byte2, int page,
|
||||
struct scsipi_mode_header *data, int len, int flags, int retries,
|
||||
struct scsi_mode_parameter_header_6 *data, int len, int flags, int retries,
|
||||
int timeout)
|
||||
{
|
||||
struct scsipi_mode_sense cmd;
|
||||
struct scsi_mode_sense_6 cmd;
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
cmd.opcode = MODE_SENSE;
|
||||
cmd.opcode = SCSI_MODE_SENSE_6;
|
||||
cmd.byte2 = byte2;
|
||||
cmd.page = page;
|
||||
cmd.length = len & 0xff;
|
||||
@ -1250,13 +1251,13 @@ scsipi_mode_sense(struct scsipi_periph *periph, int byte2, int page,
|
||||
|
||||
int
|
||||
scsipi_mode_sense_big(struct scsipi_periph *periph, int byte2, int page,
|
||||
struct scsipi_mode_header_big *data, int len, int flags, int retries,
|
||||
struct scsi_mode_parameter_header_10 *data, int len, int flags, int retries,
|
||||
int timeout)
|
||||
{
|
||||
struct scsipi_mode_sense_big cmd;
|
||||
struct scsi_mode_sense_10 cmd;
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
cmd.opcode = MODE_SENSE_BIG;
|
||||
cmd.opcode = SCSI_MODE_SENSE_10;
|
||||
cmd.byte2 = byte2;
|
||||
cmd.page = page;
|
||||
_lto2b(len, cmd.length);
|
||||
@ -1267,13 +1268,13 @@ scsipi_mode_sense_big(struct scsipi_periph *periph, int byte2, int page,
|
||||
|
||||
int
|
||||
scsipi_mode_select(struct scsipi_periph *periph, int byte2,
|
||||
struct scsipi_mode_header *data, int len, int flags, int retries,
|
||||
struct scsi_mode_parameter_header_6 *data, int len, int flags, int retries,
|
||||
int timeout)
|
||||
{
|
||||
struct scsipi_mode_select cmd;
|
||||
struct scsi_mode_select_6 cmd;
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
cmd.opcode = MODE_SELECT;
|
||||
cmd.opcode = SCSI_MODE_SELECT_6;
|
||||
cmd.byte2 = byte2;
|
||||
cmd.length = len & 0xff;
|
||||
|
||||
@ -1283,13 +1284,13 @@ scsipi_mode_select(struct scsipi_periph *periph, int byte2,
|
||||
|
||||
int
|
||||
scsipi_mode_select_big(struct scsipi_periph *periph, int byte2,
|
||||
struct scsipi_mode_header_big *data, int len, int flags, int retries,
|
||||
struct scsi_mode_parameter_header_10 *data, int len, int flags, int retries,
|
||||
int timeout)
|
||||
{
|
||||
struct scsipi_mode_select_big cmd;
|
||||
struct scsi_mode_select_10 cmd;
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
cmd.opcode = MODE_SELECT_BIG;
|
||||
cmd.opcode = SCSI_MODE_SELECT_10;
|
||||
cmd.byte2 = byte2;
|
||||
_lto2b(len, cmd.length);
|
||||
|
||||
@ -1658,7 +1659,7 @@ scsipi_request_sense(struct scsipi_xfer *xs)
|
||||
{
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
int flags, error;
|
||||
struct scsipi_sense cmd;
|
||||
struct scsi_request_sense cmd;
|
||||
|
||||
periph->periph_flags |= PERIPH_SENSE;
|
||||
|
||||
@ -1672,11 +1673,11 @@ scsipi_request_sense(struct scsipi_xfer *xs)
|
||||
XS_CTL_THAW_PERIPH | XS_CTL_FREEZE_PERIPH;
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
cmd.opcode = REQUEST_SENSE;
|
||||
cmd.length = sizeof(struct scsipi_sense_data);
|
||||
cmd.opcode = SCSI_REQUEST_SENSE;
|
||||
cmd.length = sizeof(struct scsi_sense_data);
|
||||
|
||||
error = scsipi_command(periph, (void *)&cmd, sizeof(cmd),
|
||||
(void *)&xs->sense.scsi_sense, sizeof(struct scsipi_sense_data),
|
||||
(void *)&xs->sense.scsi_sense, sizeof(struct scsi_sense_data),
|
||||
0, 1000, NULL, flags);
|
||||
periph->periph_flags &= ~PERIPH_SENSE;
|
||||
periph->periph_xscheck = NULL;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: scsipi_verbose.c,v 1.25 2005/02/01 00:19:34 reinoud Exp $ */
|
||||
/* $NetBSD: scsipi_verbose.c,v 1.26 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: scsipi_verbose.c,v 1.25 2005/02/01 00:19:34 reinoud Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: scsipi_verbose.c,v 1.26 2005/02/21 00:29:07 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
@ -627,7 +627,7 @@ asc2ascii(u_char asc, u_char ascq, char *result, size_t l)
|
||||
}
|
||||
|
||||
void
|
||||
scsipi_print_sense_data(struct scsipi_sense_data *sense, int verbosity)
|
||||
scsipi_print_sense_data(struct scsi_sense_data *sense, int verbosity)
|
||||
{
|
||||
int32_t info;
|
||||
int i, j, k;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: scsipiconf.h,v 1.95 2005/02/01 00:19:34 reinoud Exp $ */
|
||||
/* $NetBSD: scsipiconf.h,v 1.96 2005/02/21 00:29:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2000, 2004 The NetBSD Foundation, Inc.
|
||||
@ -61,6 +61,7 @@ typedef int boolean;
|
||||
|
||||
#include <sys/callout.h>
|
||||
#include <sys/queue.h>
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
#include <dev/scsipi/scsipi_debug.h>
|
||||
|
||||
struct buf;
|
||||
@ -513,7 +514,7 @@ struct scsipi_xfer {
|
||||
struct buf *bp; /* If we need to associate with */
|
||||
/* a buf */
|
||||
union {
|
||||
struct scsipi_sense_data scsi_sense; /* 32 bytes */
|
||||
struct scsi_sense_data scsi_sense; /* 32 bytes */
|
||||
u_int32_t atapi_sense;
|
||||
} sense;
|
||||
|
||||
@ -638,13 +639,13 @@ int scsipi_prevent(struct scsipi_periph *, int, int);
|
||||
int scsipi_inquire(struct scsipi_periph *,
|
||||
struct scsipi_inquiry_data *, int);
|
||||
int scsipi_mode_select(struct scsipi_periph *, int,
|
||||
struct scsipi_mode_header *, int, int, int, int);
|
||||
struct scsi_mode_parameter_header_6 *, int, int, int, int);
|
||||
int scsipi_mode_select_big(struct scsipi_periph *, int,
|
||||
struct scsipi_mode_header_big *, int, int, int, int);
|
||||
struct scsi_mode_parameter_header_10 *, int, int, int, int);
|
||||
int scsipi_mode_sense(struct scsipi_periph *, int, int,
|
||||
struct scsipi_mode_header *, int, int, int, int);
|
||||
struct scsi_mode_parameter_header_6 *, int, int, int, int);
|
||||
int scsipi_mode_sense_big(struct scsipi_periph *, int, int,
|
||||
struct scsipi_mode_header_big *, int, int, int, int);
|
||||
struct scsi_mode_parameter_header_10 *, int, int, int, int);
|
||||
int scsipi_start(struct scsipi_periph *, int, int);
|
||||
void scsipi_done(struct scsipi_xfer *);
|
||||
void scsipi_user_done(struct scsipi_xfer *);
|
||||
@ -654,7 +655,7 @@ void scsipi_kill_pending(struct scsipi_periph *);
|
||||
struct scsipi_periph *scsipi_alloc_periph(int);
|
||||
#ifdef SCSIVERBOSE
|
||||
void scsipi_print_sense(struct scsipi_xfer *, int);
|
||||
void scsipi_print_sense_data(struct scsipi_sense_data *, int);
|
||||
void scsipi_print_sense_data(struct scsi_sense_data *, int);
|
||||
char *scsipi_decode_sense(void *, int);
|
||||
#endif
|
||||
void scsipi_print_cdb(struct scsipi_generic *cmd);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sd.c,v 1.235 2005/02/01 00:19:34 reinoud Exp $ */
|
||||
/* $NetBSD: sd.c,v 1.236 2005/02/21 00:29:08 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
|
||||
@ -54,7 +54,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.235 2005/02/01 00:19:34 reinoud Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.236 2005/02/21 00:29:08 thorpej Exp $");
|
||||
|
||||
#include "opt_scsi.h"
|
||||
#include "rnd.h"
|
||||
@ -81,6 +81,7 @@ __KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.235 2005/02/01 00:19:34 reinoud Exp $");
|
||||
#include <sys/rnd.h>
|
||||
#endif
|
||||
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsipi_disk.h>
|
||||
@ -181,10 +182,10 @@ struct sd_mode_sense_data {
|
||||
* enough.
|
||||
*/
|
||||
union {
|
||||
struct scsipi_mode_header small;
|
||||
struct scsipi_mode_header_big big;
|
||||
struct scsi_mode_parameter_header_6 small;
|
||||
struct scsi_mode_parameter_header_10 big;
|
||||
} header;
|
||||
struct scsi_blk_desc blk_desc;
|
||||
struct scsi_general_block_descriptor blk_desc;
|
||||
union scsi_disk_pages pages;
|
||||
};
|
||||
|
||||
@ -502,7 +503,7 @@ sdopen(dev_t dev, int flag, int fmt, struct proc *p)
|
||||
|
||||
if (periph->periph_flags & PERIPH_REMOVABLE) {
|
||||
/* Lock the pack in. */
|
||||
error = scsipi_prevent(periph, PR_PREVENT,
|
||||
error = scsipi_prevent(periph, SPAMR_PREVENT_DT,
|
||||
XS_CTL_IGNORE_ILLEGAL_REQUEST |
|
||||
XS_CTL_IGNORE_MEDIA_CHANGE);
|
||||
if (error)
|
||||
@ -565,7 +566,7 @@ sdopen(dev_t dev, int flag, int fmt, struct proc *p)
|
||||
bad3:
|
||||
if (sd->sc_dk.dk_openmask == 0) {
|
||||
if (periph->periph_flags & PERIPH_REMOVABLE)
|
||||
scsipi_prevent(periph, PR_ALLOW,
|
||||
scsipi_prevent(periph, SPAMR_ALLOW,
|
||||
XS_CTL_IGNORE_ILLEGAL_REQUEST |
|
||||
XS_CTL_IGNORE_MEDIA_CHANGE);
|
||||
periph->periph_flags &= ~PERIPH_OPEN;
|
||||
@ -627,7 +628,7 @@ sdclose(dev_t dev, int flag, int fmt, struct proc *p)
|
||||
scsipi_wait_drain(periph);
|
||||
|
||||
if (periph->periph_flags & PERIPH_REMOVABLE)
|
||||
scsipi_prevent(periph, PR_ALLOW,
|
||||
scsipi_prevent(periph, SPAMR_ALLOW,
|
||||
XS_CTL_IGNORE_ILLEGAL_REQUEST |
|
||||
XS_CTL_IGNORE_NOT_READY);
|
||||
periph->periph_flags &= ~PERIPH_OPEN;
|
||||
@ -1135,7 +1136,7 @@ bad:
|
||||
|
||||
case DIOCLOCK:
|
||||
return (scsipi_prevent(periph,
|
||||
(*(int *)addr) ? PR_PREVENT : PR_ALLOW, 0));
|
||||
(*(int *)addr) ? SPAMR_PREVENT_DT : SPAMR_ALLOW, 0));
|
||||
|
||||
case DIOCEJECT:
|
||||
if ((periph->periph_flags & PERIPH_REMOVABLE) == 0)
|
||||
@ -1148,7 +1149,7 @@ bad:
|
||||
if ((sd->sc_dk.dk_openmask & ~(1 << part)) == 0 &&
|
||||
sd->sc_dk.dk_bopenmask + sd->sc_dk.dk_copenmask ==
|
||||
sd->sc_dk.dk_openmask) {
|
||||
error = scsipi_prevent(periph, PR_ALLOW,
|
||||
error = scsipi_prevent(periph, SPAMR_ALLOW,
|
||||
XS_CTL_IGNORE_NOT_READY);
|
||||
if (error)
|
||||
return (error);
|
||||
@ -1347,7 +1348,7 @@ static int
|
||||
sd_interpret_sense(struct scsipi_xfer *xs)
|
||||
{
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
struct scsipi_sense_data *sense = &xs->sense.scsi_sense;
|
||||
struct scsi_sense_data *sense = &xs->sense.scsi_sense;
|
||||
struct sd_softc *sd = (void *)periph->periph_dev;
|
||||
int s, error, retval = EJUSTRETURN;
|
||||
|
||||
@ -1368,13 +1369,14 @@ sd_interpret_sense(struct scsipi_xfer *xs)
|
||||
* If it isn't a extended or extended/deferred error, let
|
||||
* the generic code handle it.
|
||||
*/
|
||||
if ((sense->error_code & SSD_ERRCODE) != 0x70 &&
|
||||
(sense->error_code & SSD_ERRCODE) != 0x71)
|
||||
if ((sense->response_code & SSD_RCODE_VALID) == 0 ||
|
||||
(SSD_RCODE(sense->response_code) != SSD_RCODE_CURRENT &&
|
||||
SSD_RCODE(sense->response_code) != SSD_RCODE_DEFERRED))
|
||||
return (retval);
|
||||
|
||||
if ((sense->flags & SSD_KEY) == SKEY_NOT_READY &&
|
||||
sense->add_sense_code == 0x4) {
|
||||
if (sense->add_sense_code_qual == 0x01) {
|
||||
if (SSD_SENSE_KEY(sense->flags) == SKEY_NOT_READY &&
|
||||
sense->asc == 0x4) {
|
||||
if (sense->ascq == 0x01) {
|
||||
/*
|
||||
* Unit In The Process Of Becoming Ready.
|
||||
*/
|
||||
@ -1385,7 +1387,7 @@ sd_interpret_sense(struct scsipi_xfer *xs)
|
||||
callout_reset(&periph->periph_callout,
|
||||
5 * hz, scsipi_periph_timed_thaw, periph);
|
||||
retval = ERESTART;
|
||||
} else if (sense->add_sense_code_qual == 0x02) {
|
||||
} else if (sense->ascq == 0x02) {
|
||||
printf("%s: pack is stopped, restarting...\n",
|
||||
sd->sc_dev.dv_xname);
|
||||
s = splbio();
|
||||
@ -1405,9 +1407,9 @@ sd_interpret_sense(struct scsipi_xfer *xs)
|
||||
splx(s);
|
||||
}
|
||||
}
|
||||
if ((sense->flags & SSD_KEY) == SKEY_MEDIUM_ERROR &&
|
||||
sense->add_sense_code == 0x31 &&
|
||||
sense->add_sense_code_qual == 0x00) { /* maybe for any asq ? */
|
||||
if (SSD_SENSE_KEY(sense->flags) == SKEY_MEDIUM_ERROR &&
|
||||
sense->asc == 0x31 &&
|
||||
sense->ascq == 0x00) { /* maybe for any asq ? */
|
||||
/* Medium Format Corrupted */
|
||||
retval = EFTYPE;
|
||||
}
|
||||
@ -1579,12 +1581,12 @@ sd_mode_sense(struct sd_softc *sd, u_int8_t byte2, void *sense, size_t size,
|
||||
!(sd->sc_periph->periph_quirks & PQUIRK_NOBIGMODESENSE)) {
|
||||
*big = 1;
|
||||
return scsipi_mode_sense_big(sd->sc_periph, byte2, page, sense,
|
||||
size + sizeof(struct scsipi_mode_header_big),
|
||||
size + sizeof(struct scsi_mode_parameter_header_10),
|
||||
flags | XS_CTL_DATA_ONSTACK, SDRETRIES, 6000);
|
||||
} else {
|
||||
*big = 0;
|
||||
return scsipi_mode_sense(sd->sc_periph, byte2, page, sense,
|
||||
size + sizeof(struct scsipi_mode_header),
|
||||
size + sizeof(struct scsi_mode_parameter_header_6),
|
||||
flags | XS_CTL_DATA_ONSTACK, SDRETRIES, 6000);
|
||||
}
|
||||
}
|
||||
@ -1595,18 +1597,18 @@ sd_mode_select(struct sd_softc *sd, u_int8_t byte2, void *sense, size_t size,
|
||||
{
|
||||
|
||||
if (big) {
|
||||
struct scsipi_mode_header_big *header = sense;
|
||||
struct scsi_mode_parameter_header_10 *header = sense;
|
||||
|
||||
_lto2b(0, header->data_length);
|
||||
return scsipi_mode_select_big(sd->sc_periph, byte2, sense,
|
||||
size + sizeof(struct scsipi_mode_header_big),
|
||||
size + sizeof(struct scsi_mode_parameter_header_10),
|
||||
flags | XS_CTL_DATA_ONSTACK, SDRETRIES, 6000);
|
||||
} else {
|
||||
struct scsipi_mode_header *header = sense;
|
||||
struct scsi_mode_parameter_header_6 *header = sense;
|
||||
|
||||
header->data_length = 0;
|
||||
return scsipi_mode_select(sd->sc_periph, byte2, sense,
|
||||
size + sizeof(struct scsipi_mode_header),
|
||||
size + sizeof(struct scsi_mode_parameter_header_6),
|
||||
flags | XS_CTL_DATA_ONSTACK, SDRETRIES, 6000);
|
||||
}
|
||||
}
|
||||
@ -1615,7 +1617,7 @@ static int
|
||||
sd_get_simplifiedparms(struct sd_softc *sd, struct disk_parms *dp, int flags)
|
||||
{
|
||||
struct {
|
||||
struct scsipi_mode_header header;
|
||||
struct scsi_mode_parameter_header_6 header;
|
||||
/* no block descriptor */
|
||||
u_int8_t pg_code; /* page code (should be 6) */
|
||||
u_int8_t pg_length; /* page length (should be 11) */
|
||||
@ -1732,7 +1734,7 @@ printf("rfc result:"); for (i = sizeof(struct scsipi_capacity_list_header) + dat
|
||||
} else {
|
||||
struct sd_mode_sense_data scsipi_sense;
|
||||
int big, bsize;
|
||||
struct scsi_blk_desc *bdesc;
|
||||
struct scsi_general_block_descriptor *bdesc;
|
||||
|
||||
memset(&scsipi_sense, 0, sizeof(scsipi_sense));
|
||||
error = sd_mode_sense(sd, 0, &scsipi_sense,
|
||||
@ -2021,7 +2023,7 @@ sd_getcache(struct sd_softc *sd, int *bitsp)
|
||||
memset(&scsipi_sense, 0, sizeof(scsipi_sense));
|
||||
error = sd_mode_sense(sd, SMS_DBD, &scsipi_sense,
|
||||
sizeof(scsipi_sense.pages.caching_params),
|
||||
SMS_PAGE_CTRL_CHANGEABLE|8, 0, &big);
|
||||
SMS_PCTRL_CHANGEABLE|8, 0, &big);
|
||||
if (error == 0) {
|
||||
if (big)
|
||||
pages = (void *)(&scsipi_sense.header.big + 1);
|
||||
@ -2084,6 +2086,6 @@ sd_setcache(struct sd_softc *sd, int bits)
|
||||
byte2 |= SMS_SP;
|
||||
|
||||
return (sd_mode_select(sd, byte2|SMS_PF, &scsipi_sense,
|
||||
sizeof(struct scsipi_mode_page_header) +
|
||||
sizeof(struct scsi_mode_page_header) +
|
||||
pages->caching_params.pg_length, 0, big));
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: st.c,v 1.176 2005/02/01 00:19:34 reinoud Exp $ */
|
||||
/* $NetBSD: st.c,v 1.177 2005/02/21 00:29:08 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
|
||||
@ -57,7 +57,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.176 2005/02/01 00:19:34 reinoud Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.177 2005/02/21 00:29:08 thorpej Exp $");
|
||||
|
||||
#include "opt_scsi.h"
|
||||
|
||||
@ -77,6 +77,7 @@ __KERNEL_RCSID(0, "$NetBSD: st.c,v 1.176 2005/02/01 00:19:34 reinoud Exp $");
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/vnode.h>
|
||||
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsi_tape.h>
|
||||
@ -707,7 +708,7 @@ stopen(dev_t dev, int flags, int mode, struct proc *p)
|
||||
st->last_dsty = dsty;
|
||||
}
|
||||
if (!(st->quirks & ST_Q_NOPREVENT)) {
|
||||
scsipi_prevent(periph, PR_PREVENT,
|
||||
scsipi_prevent(periph, SPAMR_PREVENT_DT,
|
||||
XS_CTL_IGNORE_ILLEGAL_REQUEST | XS_CTL_IGNORE_NOT_READY);
|
||||
}
|
||||
|
||||
@ -760,7 +761,7 @@ stclose(dev_t dev, int flags, int mode, struct proc *p)
|
||||
/*
|
||||
* Allow robots to eject tape if needed.
|
||||
*/
|
||||
scsipi_prevent(periph, PR_ALLOW,
|
||||
scsipi_prevent(periph, SPAMR_ALLOW,
|
||||
XS_CTL_IGNORE_ILLEGAL_REQUEST | XS_CTL_IGNORE_NOT_READY);
|
||||
|
||||
switch (STMODE(dev)) {
|
||||
@ -950,7 +951,7 @@ st_unmount(struct st_softc *st, boolean eject)
|
||||
|
||||
if (eject) {
|
||||
if (!(st->quirks & ST_Q_NOPREVENT)) {
|
||||
scsipi_prevent(periph, PR_ALLOW,
|
||||
scsipi_prevent(periph, SPAMR_ALLOW,
|
||||
XS_CTL_IGNORE_ILLEGAL_REQUEST |
|
||||
XS_CTL_IGNORE_NOT_READY);
|
||||
}
|
||||
@ -2061,7 +2062,7 @@ static int
|
||||
st_interpret_sense(struct scsipi_xfer *xs)
|
||||
{
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
struct scsipi_sense_data *sense = &xs->sense.scsi_sense;
|
||||
struct scsi_sense_data *sense = &xs->sense.scsi_sense;
|
||||
struct buf *bp = xs->bp;
|
||||
struct st_softc *st = (void *)periph->periph_dev;
|
||||
int retval = EJUSTRETURN;
|
||||
@ -2073,20 +2074,20 @@ st_interpret_sense(struct scsipi_xfer *xs)
|
||||
* If it isn't a extended or extended/deferred error, let
|
||||
* the generic code handle it.
|
||||
*/
|
||||
if ((sense->error_code & SSD_ERRCODE) != 0x70 &&
|
||||
(sense->error_code & SSD_ERRCODE) != 0x71) { /* DEFFERRED */
|
||||
if ((sense->response_code & SSD_RCODE_VALID) == 0 ||
|
||||
(SSD_RCODE(sense->response_code) != SSD_RCODE_CURRENT &&
|
||||
SSD_RCODE(sense->response_code) != SSD_RCODE_DEFERRED))
|
||||
return (retval);
|
||||
}
|
||||
|
||||
if (sense->error_code & SSD_ERRCODE_VALID)
|
||||
if (sense->response_code & SSD_RCODE_VALID)
|
||||
info = _4btol(sense->info);
|
||||
else
|
||||
info = (st->flags & ST_FIXEDBLOCKS) ?
|
||||
xs->datalen / st->blksize : xs->datalen;
|
||||
key = sense->flags & SSD_KEY;
|
||||
key = SSD_SENSE_KEY(sense->flags);
|
||||
st->mt_erreg = key;
|
||||
st->asc = sense->add_sense_code;
|
||||
st->ascq = sense->add_sense_code_qual;
|
||||
st->asc = sense->asc;
|
||||
st->ascq = sense->ascq;
|
||||
st->mt_resid = (short) info;
|
||||
|
||||
if (key == SKEY_NOT_READY && st->asc == 0x4 && st->ascq == 0x1) {
|
||||
@ -2149,7 +2150,7 @@ st_interpret_sense(struct scsipi_xfer *xs)
|
||||
st->flags |= ST_EIO_PENDING;
|
||||
if (bp)
|
||||
bp->b_resid = xs->resid;
|
||||
if (sense->error_code & SSD_ERRCODE_VALID &&
|
||||
if (sense->response_code & SSD_RCODE_VALID &&
|
||||
(xs->xs_control & XS_CTL_SILENT) == 0)
|
||||
printf("%s: block wrong size, %d blocks "
|
||||
"residual\n", st->sc_dev.dv_xname, info);
|
||||
@ -2286,12 +2287,12 @@ st_interpret_sense(struct scsipi_xfer *xs)
|
||||
#else
|
||||
scsipi_printaddr(periph);
|
||||
printf("Sense Key 0x%02x", key);
|
||||
if ((sense->error_code & SSD_ERRCODE_VALID) != 0) {
|
||||
if ((sense->response_code & SSD_RCODE_VALID) != 0) {
|
||||
switch (key) {
|
||||
case SKEY_NOT_READY:
|
||||
case SKEY_ILLEGAL_REQUEST:
|
||||
case SKEY_UNIT_ATTENTION:
|
||||
case SKEY_WRITE_PROTECT:
|
||||
case SKEY_DATA_PROTECT:
|
||||
break;
|
||||
case SKEY_VOLUME_OVERFLOW:
|
||||
case SKEY_BLANK_CHECK:
|
||||
@ -2311,7 +2312,7 @@ st_interpret_sense(struct scsipi_xfer *xs)
|
||||
int n;
|
||||
printf(", data =");
|
||||
for (n = 0; n < sense->extra_len; n++)
|
||||
printf(" %02x", sense->cmd_spec_info[n]);
|
||||
printf(" %02x", sense->csi[n]);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: st_scsi.c,v 1.19 2005/02/01 00:19:34 reinoud Exp $ */
|
||||
/* $NetBSD: st_scsi.c,v 1.20 2005/02/21 00:29:08 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
|
||||
@ -57,7 +57,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: st_scsi.c,v 1.19 2005/02/01 00:19:34 reinoud Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: st_scsi.c,v 1.20 2005/02/21 00:29:08 thorpej Exp $");
|
||||
|
||||
#include "opt_scsi.h"
|
||||
#include "rnd.h"
|
||||
@ -187,8 +187,8 @@ st_scsibus_mode_sense(struct st_softc *st, int flags)
|
||||
u_int scsipi_sense_len;
|
||||
int error;
|
||||
struct scsipi_sense {
|
||||
struct scsipi_mode_header header;
|
||||
struct scsi_blk_desc blk_desc;
|
||||
struct scsi_mode_parameter_header_6 header;
|
||||
struct scsi_general_block_descriptor blk_desc;
|
||||
u_char sense_data[MAX_PAGE_0_SIZE];
|
||||
} scsipi_sense;
|
||||
struct scsipi_periph *periph = st->sc_periph;
|
||||
@ -201,7 +201,7 @@ st_scsibus_mode_sense(struct st_softc *st, int flags)
|
||||
* if asked, or if we need it as a template for the mode select store
|
||||
* it away.
|
||||
*/
|
||||
error = scsipi_mode_sense(st->sc_periph, 0, SMS_PAGE_CTRL_CURRENT,
|
||||
error = scsipi_mode_sense(st->sc_periph, 0, SMS_PCTRL_CURRENT,
|
||||
&scsipi_sense.header, scsipi_sense_len, flags | XS_CTL_DATA_ONSTACK,
|
||||
ST_RETRIES, ST_CTL_TIME);
|
||||
if (error)
|
||||
@ -237,8 +237,8 @@ st_scsibus_mode_select(struct st_softc *st, int flags)
|
||||
{
|
||||
u_int scsi_select_len;
|
||||
struct scsi_select {
|
||||
struct scsipi_mode_header header;
|
||||
struct scsi_blk_desc blk_desc;
|
||||
struct scsi_mode_parameter_header_6 header;
|
||||
struct scsi_general_block_descriptor blk_desc;
|
||||
u_char sense_data[MAX_PAGE_0_SIZE];
|
||||
} scsi_select;
|
||||
struct scsipi_periph *periph = st->sc_periph;
|
||||
@ -261,7 +261,7 @@ st_scsibus_mode_select(struct st_softc *st, int flags)
|
||||
* Set up for a mode select
|
||||
*/
|
||||
memset(&scsi_select, 0, scsi_select_len);
|
||||
scsi_select.header.blk_desc_len = sizeof(struct scsi_blk_desc);
|
||||
scsi_select.header.blk_desc_len = sizeof(struct scsi_general_block_descriptor);
|
||||
scsi_select.header.dev_spec &= ~SMH_DSP_BUFF_MODE;
|
||||
scsi_select.blk_desc.density = st->density;
|
||||
if (st->flags & ST_DONTBUFFER)
|
||||
@ -287,8 +287,8 @@ st_scsibus_cmprss(struct st_softc *st, int flags, int onoff)
|
||||
u_int scsi_dlen;
|
||||
int byte2, page;
|
||||
struct scsi_select {
|
||||
struct scsipi_mode_header header;
|
||||
struct scsi_blk_desc blk_desc;
|
||||
struct scsi_mode_parameter_header_6 header;
|
||||
struct scsi_general_block_descriptor blk_desc;
|
||||
u_char pdata[MAX(sizeof(struct scsi_tape_dev_conf_page),
|
||||
sizeof(struct scsi_tape_dev_compression_page))];
|
||||
} scsi_pdata;
|
||||
@ -301,7 +301,7 @@ st_scsibus_cmprss(struct st_softc *st, int flags, int onoff)
|
||||
/*
|
||||
* Do DATA COMPRESSION page first.
|
||||
*/
|
||||
page = SMS_PAGE_CTRL_CURRENT | 0xf;
|
||||
page = SMS_PCTRL_CURRENT | 0xf;
|
||||
byte2 = 0;
|
||||
|
||||
/*
|
||||
@ -321,8 +321,8 @@ again:
|
||||
/*
|
||||
* Try a different page?
|
||||
*/
|
||||
if (page == (SMS_PAGE_CTRL_CURRENT | 0xf)) {
|
||||
page = SMS_PAGE_CTRL_CURRENT | 0x10;
|
||||
if (page == (SMS_PCTRL_CURRENT | 0xf)) {
|
||||
page = SMS_PCTRL_CURRENT | 0x10;
|
||||
byte2 = 0;
|
||||
goto again;
|
||||
}
|
||||
@ -334,7 +334,7 @@ again:
|
||||
else
|
||||
ptr = (struct scsi_tape_dev_conf_page *) &scsi_pdata.blk_desc;
|
||||
|
||||
if ((page & SMS_PAGE_CODE) == 0xf) {
|
||||
if ((page & SMS_PAGE_MASK) == 0xf) {
|
||||
cptr = (struct scsi_tape_dev_compression_page *) ptr;
|
||||
ison = (cptr->dce_dcc & DCP_DCE) != 0;
|
||||
if (onoff)
|
||||
@ -392,11 +392,11 @@ again:
|
||||
error = scsipi_mode_select(periph, SMS_PF, &scsi_pdata.header,
|
||||
scsi_dlen, flags | XS_CTL_DATA_ONSTACK, ST_RETRIES, ST_CTL_TIME);
|
||||
|
||||
if (error && (page & SMS_PAGE_CODE) == 0xf) {
|
||||
if (error && (page & SMS_PAGE_MASK) == 0xf) {
|
||||
/*
|
||||
* Try DEVICE CONFIGURATION page.
|
||||
*/
|
||||
page = SMS_PAGE_CTRL_CURRENT | 0x10;
|
||||
page = SMS_PCTRL_CURRENT | 0x10;
|
||||
goto again;
|
||||
}
|
||||
return (error);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: umass_scsipi.c,v 1.23 2005/02/01 00:19:35 reinoud Exp $ */
|
||||
/* $NetBSD: umass_scsipi.c,v 1.24 2005/02/21 00:29:08 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, 2003 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.23 2005/02/01 00:19:35 reinoud Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.24 2005/02/21 00:29:08 thorpej Exp $");
|
||||
|
||||
#include "atapibus.h"
|
||||
#include "scsibus.h"
|
||||
@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.23 2005/02/01 00:19:35 reinoud Ex
|
||||
|
||||
/* SCSI & ATAPI */
|
||||
#include <sys/scsiio.h>
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsiconf.h>
|
||||
@ -84,7 +85,7 @@ struct umass_scsipi_softc {
|
||||
#define sc_adapter sc_atapi_adapter._generic
|
||||
struct scsipi_channel sc_channel;
|
||||
usbd_status sc_sync_status;
|
||||
struct scsipi_sense sc_sense_cmd;
|
||||
struct scsi_request_sense sc_sense_cmd;
|
||||
};
|
||||
|
||||
|
||||
@ -445,7 +446,7 @@ umass_scsipi_cb(struct umass_softc *sc, void *priv, int residue, int status)
|
||||
/* fetch sense data */
|
||||
sc->sc_sense = 1;
|
||||
memset(&scbus->sc_sense_cmd, 0, sizeof(scbus->sc_sense_cmd));
|
||||
scbus->sc_sense_cmd.opcode = REQUEST_SENSE;
|
||||
scbus->sc_sense_cmd.opcode = SCSI_REQUEST_SENSE;
|
||||
scbus->sc_sense_cmd.byte2 = periph->periph_lun <<
|
||||
SCSI_CMD_LUN_SHIFT;
|
||||
scbus->sc_sense_cmd.length = sizeof(xs->sense);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $OpenBSD: usb_port.h,v 1.18 2000/09/06 22:42:10 rahnds Exp $ */
|
||||
/* $NetBSD: usb_port.h,v 1.65 2004/10/23 13:38:26 augustss Exp $ */
|
||||
/* $NetBSD: usb_port.h,v 1.66 2005/02/21 00:29:08 thorpej Exp $ */
|
||||
/* $FreeBSD: src/sys/dev/usb/usb_port.h,v 1.21 1999/11/17 22:33:47 n_hibma Exp $ */
|
||||
|
||||
/*
|
||||
@ -102,8 +102,6 @@ MALLOC_DECLARE(M_USBHC);
|
||||
#define Static static
|
||||
#endif
|
||||
|
||||
#define SCSI_MODE_SENSE MODE_SENSE
|
||||
|
||||
typedef struct proc *usb_proc_ptr;
|
||||
|
||||
typedef struct device *device_ptr_t;
|
||||
@ -230,7 +228,6 @@ typedef struct proc *usb_proc_ptr;
|
||||
#define UCOMBUSCF_PORTNO -1
|
||||
#define UCOMBUSCF_PORTNO_DEFAULT -1
|
||||
|
||||
#define SCSI_MODE_SENSE MODE_SENSE
|
||||
#define XS_STS_DONE ITSDONE
|
||||
#define XS_CTL_POLL SCSI_POLL
|
||||
#define XS_CTL_DATA_IN SCSI_DATA_IN
|
||||
@ -241,7 +238,6 @@ typedef struct proc *usb_proc_ptr;
|
||||
#define scsipi_done scsi_done
|
||||
#define scsipi_link scsi_link
|
||||
#define scsipi_minphys scsi_minphys
|
||||
#define scsipi_sense scsi_sense
|
||||
#define scsipi_xfer scsi_xfer
|
||||
#define xs_control flags
|
||||
#define xs_status status
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: usscanner.c,v 1.14 2004/04/23 17:25:27 itojun Exp $ */
|
||||
/* $NetBSD: usscanner.c,v 1.15 2005/02/21 00:29:08 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -54,7 +54,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: usscanner.c,v 1.14 2004/04/23 17:25:27 itojun Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: usscanner.c,v 1.15 2005/02/21 00:29:08 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -71,6 +71,7 @@ __KERNEL_RCSID(0, "$NetBSD: usscanner.c,v 1.14 2004/04/23 17:25:27 itojun Exp $"
|
||||
#include <dev/usb/usbdevs.h>
|
||||
|
||||
#include <sys/scsiio.h>
|
||||
#include <dev/scsipi/scsi_spc.h>
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsiconf.h>
|
||||
@ -419,12 +420,12 @@ usscanner_sense(struct usscanner_softc *sc)
|
||||
{
|
||||
struct scsipi_xfer *xs = sc->sc_xs;
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
struct scsipi_sense sense_cmd;
|
||||
struct scsi_request_sense sense_cmd;
|
||||
usbd_status err;
|
||||
|
||||
/* fetch sense data */
|
||||
memset(&sense_cmd, 0, sizeof(sense_cmd));
|
||||
sense_cmd.opcode = REQUEST_SENSE;
|
||||
sense_cmd.opcode = SCSI_REQUEST_SENSE;
|
||||
sense_cmd.byte2 = periph->periph_lun << SCSI_CMD_LUN_SHIFT;
|
||||
sense_cmd.length = sizeof xs->sense;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user