summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/cam
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-02-02 14:27:13 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-02-13 10:34:19 +0100
commit7eeb079d84bc4abe9897be0047fc28a754e46ecd (patch)
tree9b47ac7055ce0cb1e2d86c684a2a7a1cd20c0c4d /freebsd/sys/cam
parentfreebsd-to-rtems.py: Fix revert includes (diff)
downloadrtems-libbsd-7eeb079d84bc4abe9897be0047fc28a754e46ecd.tar.bz2
Update to FreeBSD 9.3
Diffstat (limited to 'freebsd/sys/cam')
-rw-r--r--freebsd/sys/cam/ata/ata_all.h2
-rw-r--r--freebsd/sys/cam/cam.h4
-rw-r--r--freebsd/sys/cam/cam_ccb.h17
-rw-r--r--freebsd/sys/cam/cam_debug.h17
-rw-r--r--freebsd/sys/cam/cam_periph.h3
-rw-r--r--freebsd/sys/cam/cam_xpt.h4
-rw-r--r--freebsd/sys/cam/cam_xpt_sim.h4
-rw-r--r--freebsd/sys/cam/scsi/scsi_all.c32
-rw-r--r--freebsd/sys/cam/scsi/scsi_all.h4
-rw-r--r--freebsd/sys/cam/scsi/scsi_da.h32
10 files changed, 101 insertions, 18 deletions
diff --git a/freebsd/sys/cam/ata/ata_all.h b/freebsd/sys/cam/ata/ata_all.h
index 25732b60..91e941c8 100644
--- a/freebsd/sys/cam/ata/ata_all.h
+++ b/freebsd/sys/cam/ata/ata_all.h
@@ -109,6 +109,7 @@ int ata_status_sbuf(struct ccb_ataio *ataio, struct sbuf *sb);
int ata_res_sbuf(struct ccb_ataio *ataio, struct sbuf *sb);
void ata_print_ident(struct ata_params *ident_data);
+void ata_print_ident_short(struct ata_params *ident_data);
uint32_t ata_logical_sector_size(struct ata_params *ident_data);
uint64_t ata_physical_sector_size(struct ata_params *ident_data);
@@ -143,6 +144,7 @@ int ata_identify_match(caddr_t identbuffer, caddr_t table_entry);
int ata_static_identify_match(caddr_t identbuffer, caddr_t table_entry);
void semb_print_ident(struct sep_identify_data *ident_data);
+void semb_print_ident_short(struct sep_identify_data *ident_data);
void semb_receive_diagnostic_results(struct ccb_ataio *ataio,
u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*),
diff --git a/freebsd/sys/cam/cam.h b/freebsd/sys/cam/cam.h
index af57f1a6..499fffa3 100644
--- a/freebsd/sys/cam/cam.h
+++ b/freebsd/sys/cam/cam.h
@@ -84,15 +84,15 @@ typedef struct {
#define CAM_PRIORITY_BUS ((CAM_RL_BUS << 8) + 0x80)
#define CAM_PRIORITY_XPT ((CAM_RL_XPT << 8) + 0x80)
#define CAM_PRIORITY_DEV ((CAM_RL_DEV << 8) + 0x80)
+#define CAM_PRIORITY_OOB (CAM_RL_DEV << 8)
#define CAM_PRIORITY_NORMAL ((CAM_RL_NORMAL << 8) + 0x80)
#define CAM_PRIORITY_NONE (u_int32_t)-1
-#define CAM_PRIORITY_TO_RL(x) ((x) >> 8)
-#define CAM_RL_TO_PRIORITY(x) ((x) << 8)
u_int32_t generation;
int index;
#define CAM_UNQUEUED_INDEX -1
#define CAM_ACTIVE_INDEX -2
#define CAM_DONEQ_INDEX -3
+#define CAM_EXTRAQ_INDEX INT_MAX
} cam_pinfo;
/*
diff --git a/freebsd/sys/cam/cam_ccb.h b/freebsd/sys/cam/cam_ccb.h
index 893c6469..4222de9d 100644
--- a/freebsd/sys/cam/cam_ccb.h
+++ b/freebsd/sys/cam/cam_ccb.h
@@ -154,8 +154,6 @@ typedef enum {
/* Path statistics (error counts, etc.) */
XPT_GDEV_STATS = 0x0c,
/* Device statistics (error counts, etc.) */
- XPT_FREEZE_QUEUE = 0x0d,
- /* Freeze device queue */
XPT_DEV_ADVINFO = 0x0e,
/* Get/Set Device advanced information */
/* SCSI Control Functions: 0x10->0x1F */
@@ -592,6 +590,7 @@ typedef enum {
PIM_NO_6_BYTE = 0x08, /* Do not send 6-byte commands */
PIM_SEQSCAN = 0x04, /* Do bus scans sequentially, not in parallel */
PIM_UNMAPPED = 0x02,
+ PIM_NOSCAN = 0x01 /* SIM does its own scanning */
} pi_miscflag;
/* Path Inquiry CCB */
@@ -774,7 +773,6 @@ struct ccb_relsim {
#define RELSIM_RELEASE_AFTER_TIMEOUT 0x02
#define RELSIM_RELEASE_AFTER_CMDCMPLT 0x04
#define RELSIM_RELEASE_AFTER_QEMPTY 0x08
-#define RELSIM_RELEASE_RUNLEVEL 0x10
u_int32_t openings;
u_int32_t release_timeout; /* Abstract argument. */
u_int32_t qfrozen_cnt;
@@ -1328,6 +1326,19 @@ cam_fill_smpio(struct ccb_smpio *smpio, uint32_t retries,
smpio->smp_response_len = smp_response_len;
}
+static __inline void
+cam_set_ccbstatus(union ccb *ccb, cam_status status)
+{
+ ccb->ccb_h.status &= ~CAM_STATUS_MASK;
+ ccb->ccb_h.status |= status;
+}
+
+static __inline cam_status
+cam_ccb_status(union ccb *ccb)
+{
+ return ((cam_status)(ccb->ccb_h.status & CAM_STATUS_MASK));
+}
+
void cam_calc_geometry(struct ccb_calc_geometry *ccg, int extended);
__END_DECLS
diff --git a/freebsd/sys/cam/cam_debug.h b/freebsd/sys/cam/cam_debug.h
index 37acd7dc..7b619a29 100644
--- a/freebsd/sys/cam/cam_debug.h
+++ b/freebsd/sys/cam/cam_debug.h
@@ -61,13 +61,13 @@ typedef enum {
#endif
#ifndef CAM_DEBUG_BUS
-#define CAM_DEBUG_BUS (-1)
+#define CAM_DEBUG_BUS CAM_BUS_WILDCARD
#endif
#ifndef CAM_DEBUG_TARGET
-#define CAM_DEBUG_TARGET (-1)
+#define CAM_DEBUG_TARGET CAM_TARGET_WILDCARD
#endif
#ifndef CAM_DEBUG_LUN
-#define CAM_DEBUG_LUN (-1)
+#define CAM_DEBUG_LUN CAM_LUN_WILDCARD
#endif
#ifndef CAM_DEBUG_DELAY
@@ -99,6 +99,17 @@ extern u_int32_t cam_debug_delay;
DELAY(cam_debug_delay); \
}
+#define CAM_DEBUG_DEV(dev, flag, printfargs) \
+ if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags) \
+ && (cam_dpath != NULL) \
+ && (xpt_path_comp_dev(cam_dpath, dev) >= 0) \
+ && (xpt_path_comp_dev(cam_dpath, dev) < 2)) { \
+ xpt_print_device(dev); \
+ printf printfargs; \
+ if (cam_debug_delay != 0) \
+ DELAY(cam_debug_delay); \
+ }
+
#define CAM_DEBUG_PRINT(flag, printfargs) \
if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)) { \
printf("cam_debug: "); \
diff --git a/freebsd/sys/cam/cam_periph.h b/freebsd/sys/cam/cam_periph.h
index 102dc3c3..a58ec947 100644
--- a/freebsd/sys/cam/cam_periph.h
+++ b/freebsd/sys/cam/cam_periph.h
@@ -121,6 +121,7 @@ struct cam_periph {
#define CAM_PERIPH_NEW_DEV_FOUND 0x10
#define CAM_PERIPH_RECOVERY_INPROG 0x20
#define CAM_PERIPH_FREE 0x80
+#define CAM_PERIPH_ANNOUNCED 0x100
u_int32_t immediate_priority;
u_int32_t refcount;
SLIST_HEAD(, ccb_hdr) ccb_list; /* For "immediate" requests */
@@ -171,8 +172,6 @@ int cam_periph_ioctl(struct cam_periph *periph, u_long cmd,
cam_flags camflags,
u_int32_t sense_flags));
void cam_freeze_devq(struct cam_path *path);
-void cam_freeze_devq_arg(struct cam_path *path, u_int32_t flags,
- uint32_t arg);
u_int32_t cam_release_devq(struct cam_path *path, u_int32_t relsim_flags,
u_int32_t opening_reduction, u_int32_t arg,
int getcount_only);
diff --git a/freebsd/sys/cam/cam_xpt.h b/freebsd/sys/cam/cam_xpt.h
index 492fa3a4..97933b98 100644
--- a/freebsd/sys/cam/cam_xpt.h
+++ b/freebsd/sys/cam/cam_xpt.h
@@ -35,6 +35,7 @@
/* Forward Declarations */
union ccb;
struct cam_periph;
+struct cam_ed;
struct cam_sim;
/*
@@ -89,7 +90,10 @@ void xpt_path_counts(struct cam_path *path, uint32_t *bus_ref,
uint32_t *device_ref);
int xpt_path_comp(struct cam_path *path1,
struct cam_path *path2);
+int xpt_path_comp_dev(struct cam_path *path,
+ struct cam_ed *dev);
void xpt_print_path(struct cam_path *path);
+void xpt_print_device(struct cam_ed *device);
void xpt_print(struct cam_path *path, const char *fmt, ...);
int xpt_path_string(struct cam_path *path, char *str,
size_t str_len);
diff --git a/freebsd/sys/cam/cam_xpt_sim.h b/freebsd/sys/cam/cam_xpt_sim.h
index d32eea71..62ded090 100644
--- a/freebsd/sys/cam/cam_xpt_sim.h
+++ b/freebsd/sys/cam/cam_xpt_sim.h
@@ -47,12 +47,8 @@ u_int32_t xpt_freeze_devq(struct cam_path *path, u_int count);
#else /* __rtems__ */
#define xpt_freeze_devq(path, count) do { } while (0)
#endif /* __rtems__ */
-u_int32_t xpt_freeze_devq_rl(struct cam_path *path, cam_rl rl,
- u_int count);
void xpt_release_devq(struct cam_path *path,
u_int count, int run_queue);
-void xpt_release_devq_rl(struct cam_path *path, cam_rl rl,
- u_int count, int run_queue);
int xpt_sim_opened(struct cam_sim *sim);
void xpt_done(union ccb *done_ccb);
void xpt_batch_start(struct cam_sim *sim);
diff --git a/freebsd/sys/cam/scsi/scsi_all.c b/freebsd/sys/cam/scsi/scsi_all.c
index 5b504010..4cad972d 100644
--- a/freebsd/sys/cam/scsi/scsi_all.c
+++ b/freebsd/sys/cam/scsi/scsi_all.c
@@ -672,6 +672,10 @@ scsi_op_desc(u_int16_t opcode, struct scsi_inquiry_data *inq_data)
if (pd_type == T_RBC)
pd_type = T_DIRECT;
+ /* Map NODEVICE to Direct Access Device to handle REPORT LUNS, etc. */
+ if (pd_type == T_NODEVICE)
+ pd_type = T_DIRECT;
+
opmask = 1 << pd_type;
for (j = 0; j < num_tables; j++) {
@@ -1121,7 +1125,7 @@ static struct asc_table_entry asc_table[] = {
{ SST(0x04, 0x10, SS_RDEF, /* XXX TBD */
"Logical unit not ready, auxiliary memory not accessible") },
/* DT WRO AEB VF */
- { SST(0x04, 0x11, SS_RDEF, /* XXX TBD */
+ { SST(0x04, 0x11, SS_TUR | SSQ_MANY | SSQ_DECREMENT_COUNT | EBUSY,
"Logical unit not ready, notify (enable spinup) required") },
/* M V */
{ SST(0x04, 0x12, SS_RDEF, /* XXX TBD */
@@ -1652,7 +1656,7 @@ static struct asc_table_entry asc_table[] = {
{ SST(0x24, 0x08, SS_RDEF, /* XXX TBD */
"Invalid XCDB") },
/* DTLPWROMAEBKVF */
- { SST(0x25, 0x00, SS_FATAL | ENXIO,
+ { SST(0x25, 0x00, SS_FATAL | ENXIO | SSQ_LOST,
"Logical unit not supported") },
/* DTLPWROMAEBKVF */
{ SST(0x26, 0x00, SS_FATAL | EINVAL,
@@ -2170,7 +2174,7 @@ static struct asc_table_entry asc_table[] = {
{ SST(0x3F, 0x0D, SS_RDEF,
"Volume set reassigned") },
/* DTLPWROMAE */
- { SST(0x3F, 0x0E, SS_RDEF, /* XXX TBD */
+ { SST(0x3F, 0x0E, SS_RDEF | SSQ_RESCAN ,
"Reported LUNs data has changed") },
/* DTLPWROMAEBKVF */
{ SST(0x3F, 0x0F, SS_RDEF, /* XXX TBD */
@@ -3270,6 +3274,7 @@ scsi_error_action(struct ccb_scsiio *csio, struct scsi_inquiry_data *inq_data,
action |= SS_RETRY|SSQ_DECREMENT_COUNT|
SSQ_PRINT_SENSE;
}
+ action |= SSQ_UA;
}
}
if ((action & SS_MASK) >= SS_START &&
@@ -5256,6 +5261,21 @@ scsi_print_inquiry(struct scsi_inquiry_data *inq_data)
dtype, rstr, qtype);
}
+void
+scsi_print_inquiry_short(struct scsi_inquiry_data *inq_data)
+{
+ char vendor[16], product[48], revision[16];
+
+ cam_strvis(vendor, inq_data->vendor, sizeof(inq_data->vendor),
+ sizeof(vendor));
+ cam_strvis(product, inq_data->product, sizeof(inq_data->product),
+ sizeof(product));
+ cam_strvis(revision, inq_data->revision, sizeof(inq_data->revision),
+ sizeof(revision));
+
+ printf("<%s %s %s>", vendor, product, revision);
+}
+
#ifndef __rtems__
/*
* Table of syncrates that don't follow the "divisible by 4"
@@ -6510,7 +6530,11 @@ scsi_devid_match(uint8_t *lhs, size_t lhs_len, uint8_t *rhs, size_t rhs_len)
while (rhs_id <= rhs_last
&& (rhs_id->identifier + rhs_id->length) <= rhs_end) {
- if (rhs_id->length == lhs_id->length
+ if ((rhs_id->id_type &
+ (SVPD_ID_ASSOC_MASK | SVPD_ID_TYPE_MASK)) ==
+ (lhs_id->id_type &
+ (SVPD_ID_ASSOC_MASK | SVPD_ID_TYPE_MASK))
+ && rhs_id->length == lhs_id->length
&& memcmp(rhs_id->identifier, lhs_id->identifier,
rhs_id->length) == 0)
return (0);
diff --git a/freebsd/sys/cam/scsi/scsi_all.h b/freebsd/sys/cam/scsi/scsi_all.h
index 4fe0b1dd..cf84d396 100644
--- a/freebsd/sys/cam/scsi/scsi_all.h
+++ b/freebsd/sys/cam/scsi/scsi_all.h
@@ -88,6 +88,9 @@ typedef enum {
* and text.
*/
SSQ_PRINT_SENSE = 0x0800,
+ SSQ_UA = 0x1000, /* Broadcast UA. */
+ SSQ_RESCAN = 0x2000, /* Rescan target for LUNs. */
+ SSQ_LOST = 0x4000, /* Destroy the LUNs. */
SSQ_MASK = 0xff00
} scsi_sense_action_qualifier;
@@ -2309,6 +2312,7 @@ char * scsi_cdb_string(u_int8_t *cdb_ptr, char *cdb_string,
size_t len);
void scsi_print_inquiry(struct scsi_inquiry_data *inq_data);
+void scsi_print_inquiry_short(struct scsi_inquiry_data *inq_data);
u_int scsi_calc_syncsrate(u_int period_factor);
u_int scsi_calc_syncparam(u_int period);
diff --git a/freebsd/sys/cam/scsi/scsi_da.h b/freebsd/sys/cam/scsi/scsi_da.h
index 57992381..4fbd7256 100644
--- a/freebsd/sys/cam/scsi/scsi_da.h
+++ b/freebsd/sys/cam/scsi/scsi_da.h
@@ -116,6 +116,31 @@ struct scsi_read_defect_data_10
u_int8_t control;
};
+struct scsi_sanitize
+{
+ u_int8_t opcode;
+ u_int8_t byte2;
+#define SSZ_SERVICE_ACTION_OVERWRITE 0x01
+#define SSZ_SERVICE_ACTION_BLOCK_ERASE 0x02
+#define SSZ_SERVICE_ACTION_CRYPTO_ERASE 0x03
+#define SSZ_SERVICE_ACTION_EXIT_MODE_FAILURE 0x1F
+#define SSZ_UNRESTRICTED_EXIT 0x20
+#define SSZ_IMMED 0x80
+ u_int8_t reserved[5];
+ u_int8_t length[2];
+ u_int8_t control;
+};
+
+struct scsi_sanitize_parameter_list
+{
+ u_int8_t byte1;
+#define SSZPL_INVERT 0x80
+ u_int8_t reserved;
+ u_int8_t length[2];
+ /* Variable length initialization pattern. */
+#define SSZPL_MAX_PATTERN_LENGTH 65535
+};
+
struct scsi_read_defect_data_12
{
u_int8_t opcode;
@@ -156,6 +181,7 @@ struct scsi_read_defect_data_12
#define WRITE_AND_VERIFY 0x2e
#define VERIFY 0x2f
#define READ_DEFECT_DATA_10 0x37
+#define SANITIZE 0x48
#define READ_DEFECT_DATA_12 0xb7
struct format_defect_list_header
@@ -508,6 +534,12 @@ void scsi_format_unit(struct ccb_scsiio *csio, u_int32_t retries,
u_int8_t *data_ptr, u_int32_t dxfer_len,
u_int8_t sense_len, u_int32_t timeout);
+void scsi_sanitize(struct ccb_scsiio *csio, u_int32_t retries,
+ void (*cbfcnp)(struct cam_periph *, union ccb *),
+ u_int8_t tag_action, u_int8_t byte2, u_int16_t control,
+ u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len,
+ u_int32_t timeout);
+
#endif /* !_KERNEL */
__END_DECLS