summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/cam
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-08-26 09:07:22 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2019-08-26 09:39:40 +0200
commit3411e3d738723cfb777f01c99bb9243843b3c9f8 (patch)
treeef6040b8334a364bbd81491b51c4a71daec60af9 /freebsd/sys/cam
parentSLEEPQUEUE(9): Optimize sleepq_set_timeout_sbt() (diff)
downloadrtems-libbsd-3411e3d738723cfb777f01c99bb9243843b3c9f8.tar.bz2
Update to FreeBSD stable/12 2019-08-26
Git mirror commit 621e7bafbf6857451f23ba11b0495c7ac69aff89.
Diffstat (limited to 'freebsd/sys/cam')
-rw-r--r--freebsd/sys/cam/ata/ata_all.h1
-rw-r--r--freebsd/sys/cam/cam.c10
-rw-r--r--freebsd/sys/cam/nvme/nvme_all.h4
-rw-r--r--freebsd/sys/cam/scsi/scsi_all.c45
-rw-r--r--freebsd/sys/cam/scsi/scsi_all.h57
5 files changed, 103 insertions, 14 deletions
diff --git a/freebsd/sys/cam/ata/ata_all.h b/freebsd/sys/cam/ata/ata_all.h
index 087d6820..ca635253 100644
--- a/freebsd/sys/cam/ata/ata_all.h
+++ b/freebsd/sys/cam/ata/ata_all.h
@@ -135,6 +135,7 @@ void ata_read_log(struct ccb_ataio *ataio, uint32_t retries,
uint16_t block_count, uint32_t protocol,
uint8_t *data_ptr, uint32_t dxfer_len, uint32_t timeout);
+void ata_param_fixup(struct ata_params *ident_buf);
void ata_bswap(int8_t *buf, int len);
void ata_btrim(int8_t *buf, int len);
void ata_bpack(int8_t *src, int8_t *dst, int len);
diff --git a/freebsd/sys/cam/cam.c b/freebsd/sys/cam/cam.c
index 5d07bebf..25f99ae7 100644
--- a/freebsd/sys/cam/cam.c
+++ b/freebsd/sys/cam/cam.c
@@ -418,7 +418,6 @@ cam_error_string(struct cam_device *device, union ccb *ccb, char *str,
switch (ccb->ccb_h.func_code) {
case XPT_ATA_IO:
ata_command_sbuf(&ccb->ataio, &sb);
- sbuf_printf(&sb, "\n");
break;
case XPT_SCSI_IO:
#ifdef _KERNEL
@@ -426,17 +425,22 @@ cam_error_string(struct cam_device *device, union ccb *ccb, char *str,
#else /* !_KERNEL */
scsi_command_string(device, &ccb->csio, &sb);
#endif /* _KERNEL/!_KERNEL */
- sbuf_printf(&sb, "\n");
break;
case XPT_SMP_IO:
smp_command_sbuf(&ccb->smpio, &sb, path_str, 79 -
strlen(path_str), (proto_flags &
CAM_ESMF_PRINT_FULL_CMD) ? 79 : 0);
- sbuf_printf(&sb, "\n");
+ break;
+ case XPT_NVME_IO:
+ case XPT_NVME_ADMIN:
+ nvme_command_sbuf(&ccb->nvmeio, &sb);
break;
default:
+ sbuf_printf(&sb, "CAM func %#x",
+ ccb->ccb_h.func_code);
break;
}
+ sbuf_printf(&sb, "\n");
}
if (flags & CAM_ESF_CAM_STATUS) {
diff --git a/freebsd/sys/cam/nvme/nvme_all.h b/freebsd/sys/cam/nvme/nvme_all.h
index e31c1e5e..8ebbfff3 100644
--- a/freebsd/sys/cam/nvme/nvme_all.h
+++ b/freebsd/sys/cam/nvme/nvme_all.h
@@ -42,8 +42,10 @@ int nvme_identify_match(caddr_t identbuffer, caddr_t table_entry);
struct sbuf;
void nvme_print_ident(const struct nvme_controller_data *, const struct nvme_namespace_data *, struct sbuf *);
-const char *nvme_op_string(const struct nvme_command *);
+const char *nvme_op_string(const struct nvme_command *, int admin);
const char *nvme_cmd_string(const struct nvme_command *, char *, size_t);
+void nvme_cmd_sbuf(const struct nvme_command *, struct sbuf *sb);
+int nvme_command_sbuf(struct ccb_nvmeio *nvmeio, struct sbuf *sb);
const void *nvme_get_identify_cntrl(struct cam_periph *);
const void *nvme_get_identify_ns(struct cam_periph *);
diff --git a/freebsd/sys/cam/scsi/scsi_all.c b/freebsd/sys/cam/scsi/scsi_all.c
index 36757230..3aab5aab 100644
--- a/freebsd/sys/cam/scsi/scsi_all.c
+++ b/freebsd/sys/cam/scsi/scsi_all.c
@@ -382,7 +382,7 @@ static struct op_table_entry scsi_op_codes[] = {
{ 0x40, D | T | L | P | W | R | O | M | S | C, "CHANGE DEFINITION" },
/* 41 O WRITE SAME(10) */
{ 0x41, D, "WRITE SAME(10)" },
- /* 42 O UNMAP */
+ /* 42 O UNMAP */
{ 0x42, D, "UNMAP" },
/* 42 O READ SUB-CHANNEL */
{ 0x42, R, "READ SUB-CHANNEL" },
@@ -397,7 +397,8 @@ static struct op_table_entry scsi_op_codes[] = {
{ 0x46, R, "GET CONFIGURATION" },
/* 47 O PLAY AUDIO MSF */
{ 0x47, R, "PLAY AUDIO MSF" },
- /* 48 */
+ /* 48 O SANITIZE */
+ { 0x48, D, "SANITIZE" },
/* 49 */
/* 4A M GET EVENT STATUS NOTIFICATION */
{ 0x4A, R, "GET EVENT STATUS NOTIFICATION" },
@@ -1165,10 +1166,10 @@ static struct asc_table_entry asc_table[] = {
{ SST(0x04, 0x1A, SS_RDEF, /* XXX TBD */
"Logical unit not ready, START/STOP UNIT command in progress") },
/* D B */
- { SST(0x04, 0x1B, SS_RDEF, /* XXX TBD */
+ { SST(0x04, 0x1B, SS_WAIT | EBUSY,
"Logical unit not ready, sanitize in progress") },
/* DT MAEB */
- { SST(0x04, 0x1C, SS_RDEF, /* XXX TBD */
+ { SST(0x04, 0x1C, SS_START | SSQ_DECREMENT_COUNT | ENXIO,
"Logical unit not ready, additional power use not yet granted") },
/* D */
{ SST(0x04, 0x1D, SS_RDEF, /* XXX TBD */
@@ -1456,7 +1457,7 @@ static struct asc_table_entry asc_table[] = {
{ SST(0x11, 0x14, SS_RDEF, /* XXX TBD */
"Read error - LBA marked bad by application client") },
/* D */
- { SST(0x11, 0x15, SS_RDEF, /* XXX TBD */
+ { SST(0x11, 0x15, SS_FATAL | EIO,
"Write after sanitize required") },
/* D W O BK */
{ SST(0x12, 0x00, SS_RDEF,
@@ -2067,7 +2068,7 @@ static struct asc_table_entry asc_table[] = {
{ SST(0x31, 0x02, SS_RDEF, /* XXX TBD */
"Zoned formatting failed due to spare linking") },
/* D B */
- { SST(0x31, 0x03, SS_RDEF, /* XXX TBD */
+ { SST(0x31, 0x03, SS_FATAL | EIO,
"SANITIZE command failed") },
/* D W O BK */
{ SST(0x32, 0x00, SS_RDEF,
@@ -8400,6 +8401,38 @@ scsi_ata_read_log(struct ccb_scsiio *csio, uint32_t retries,
return (retval);
}
+int scsi_ata_setfeatures(struct ccb_scsiio *csio, uint32_t retries,
+ void (*cbfcnp)(struct cam_periph *, union ccb *),
+ uint8_t tag_action, uint8_t feature,
+ uint64_t lba, uint32_t count,
+ uint8_t sense_len, uint32_t timeout)
+{
+ return (scsi_ata_pass(csio,
+ retries,
+ cbfcnp,
+ /*flags*/CAM_DIR_NONE,
+ tag_action,
+ /*protocol*/AP_PROTO_PIO_IN,
+ /*ata_flags*/AP_FLAG_TDIR_FROM_DEV |
+ AP_FLAG_BYT_BLOK_BYTES |
+ AP_FLAG_TLEN_SECT_CNT,
+ /*features*/feature,
+ /*sector_count*/count,
+ /*lba*/lba,
+ /*command*/ATA_SETFEATURES,
+ /*device*/ 0,
+ /*icc*/ 0,
+ /*auxiliary*/0,
+ /*control*/0,
+ /*data_ptr*/NULL,
+ /*dxfer_len*/0,
+ /*cdb_storage*/NULL,
+ /*cdb_storage_len*/0,
+ /*minimum_cmd_size*/0,
+ sense_len,
+ timeout));
+}
+
/*
* Note! This is an unusual CDB building function because it can return
* an error in the event that the command in question requires a variable
diff --git a/freebsd/sys/cam/scsi/scsi_all.h b/freebsd/sys/cam/scsi/scsi_all.h
index 735d0685..467b955c 100644
--- a/freebsd/sys/cam/scsi/scsi_all.h
+++ b/freebsd/sys/cam/scsi/scsi_all.h
@@ -264,7 +264,9 @@ struct scsi_mode_hdr_10
u_int8_t datalen[2];
u_int8_t medium_type;
u_int8_t dev_specific;
- u_int8_t reserved[2];
+ u_int8_t flags;
+#define SMH_LONGLBA 0x01
+ u_int8_t reserved;
u_int8_t block_descr_len[2];
};
@@ -276,6 +278,20 @@ struct scsi_mode_block_descr
u_int8_t block_len[3];
};
+struct scsi_mode_block_descr_dshort
+{
+ u_int8_t num_blocks[4];
+ u_int8_t reserved;
+ u_int8_t block_len[3];
+};
+
+struct scsi_mode_block_descr_dlong
+{
+ u_int8_t num_blocks[8];
+ u_int8_t reserved[4];
+ u_int8_t block_len[4];
+};
+
struct scsi_per_res_in
{
u_int8_t opcode;
@@ -568,6 +584,7 @@ struct scsi_log_sense
#define SLS_ERROR_NONMEDIUM_PAGE 0x06
#define SLS_ERROR_LASTN_PAGE 0x07
#define SLS_LOGICAL_BLOCK_PROVISIONING 0x0c
+#define SLS_TEMPERATURE 0x0d
#define SLS_SELF_TEST_PAGE 0x10
#define SLS_SOLID_STATE_MEDIA 0x11
#define SLS_STAT_AND_PERF 0x19
@@ -683,6 +700,14 @@ struct scsi_log_informational_exceptions {
uint8_t temperature;
};
+struct scsi_log_temperature {
+ struct scsi_log_param_header hdr;
+#define SLP_TEMPERATURE 0x0000
+#define SLP_REFTEMPERATURE 0x0001
+ uint8_t reserved;
+ uint8_t temperature;
+};
+
struct scsi_control_page {
u_int8_t page_code;
u_int8_t page_length;
@@ -2763,6 +2788,19 @@ struct scsi_vpd_tpc
};
/*
+ * SCSI Feature Sets VPD Page
+ */
+struct scsi_vpd_sfs
+{
+ uint8_t device;
+ uint8_t page_code;
+#define SVPD_SCSI_SFS 0x92
+ uint8_t page_length[2];
+ uint8_t reserved[4];
+ uint8_t codes[];
+};
+
+/*
* Block Device Characteristics VPD Page based on
* T10/1799-D Revision 31
*/
@@ -2803,11 +2841,15 @@ struct scsi_vpd_block_device_characteristics
uint8_t flags;
#define SVPD_VBULS 0x01
#define SVPD_FUAB 0x02
+#define SVPD_BOCS 0x04
+#define SVPD_RBWZ 0x08
#define SVPD_ZBC_NR 0x00 /* Not Reported */
#define SVPD_HAW_ZBC 0x10 /* Host Aware */
#define SVPD_DM_ZBC 0x20 /* Drive Managed */
#define SVPD_ZBC_MASK 0x30 /* Zoned mask */
- uint8_t reserved[55];
+ uint8_t reserved[3];
+ uint8_t depopulation_time[4];
+ uint8_t reserved2[48];
};
#define SBDC_IS_PRESENT(bdc, length, field) \
@@ -2844,7 +2886,7 @@ struct scsi_vpd_logical_block_prov
};
/*
- * Block Limits VDP Page based on SBC-4 Revision 2
+ * Block Limits VDP Page based on SBC-4 Revision 17
*/
struct scsi_vpd_block_limits
{
@@ -2854,7 +2896,8 @@ struct scsi_vpd_block_limits
u_int8_t page_length[2];
#define SVPD_BL_PL_BASIC 0x10
#define SVPD_BL_PL_TP 0x3C
- u_int8_t reserved1;
+ u_int8_t flags;
+#define SVPD_BL_WSNZ 0x01
u_int8_t max_cmp_write_len;
u_int8_t opt_txfer_len_grain[2];
u_int8_t max_txfer_len[4];
@@ -4177,6 +4220,12 @@ int scsi_ata_read_log(struct ccb_scsiio *csio, uint32_t retries,
uint8_t protocol, uint8_t *data_ptr, uint32_t dxfer_len,
uint8_t sense_len, uint32_t timeout);
+int scsi_ata_setfeatures(struct ccb_scsiio *csio, uint32_t retries,
+ void (*cbfcnp)(struct cam_periph *, union ccb *),
+ uint8_t tag_action, uint8_t feature,
+ uint64_t lba, uint32_t count,
+ uint8_t sense_len, uint32_t timeout);
+
int scsi_ata_pass(struct ccb_scsiio *csio, uint32_t retries,
void (*cbfcnp)(struct cam_periph *, union ccb *),
uint32_t flags, uint8_t tag_action,