summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-10-24 10:33:31 +0000
committermav <mav@FreeBSD.org>2013-10-24 10:33:31 +0000
commitc896ef2cccb7601faf5c79451228435a0717d08b (patch)
treef73b38176bc5e7759b1a1696805cc8037324e111
parent5411f6951ede72a782138783542ebb0cff454b91 (diff)
downloadFreeBSD-src-c896ef2cccb7601faf5c79451228435a0717d08b.zip
FreeBSD-src-c896ef2cccb7601faf5c79451228435a0717d08b.tar.gz
MFC r256552:
Unify periph invalidation and destruction reporting. Print message containing device model and serial number on invalidation. Approved by: re (hrs)
-rw-r--r--sys/cam/ata/ata_all.c24
-rw-r--r--sys/cam/ata/ata_all.h2
-rw-r--r--sys/cam/ata/ata_da.c2
-rw-r--r--sys/cam/ata/ata_pmp.c2
-rw-r--r--sys/cam/cam_periph.c7
-rw-r--r--sys/cam/cam_periph.h1
-rw-r--r--sys/cam/cam_xpt.c32
-rw-r--r--sys/cam/cam_xpt_periph.h1
-rw-r--r--sys/cam/scsi/scsi_all.c15
-rw-r--r--sys/cam/scsi/scsi_all.h1
-rw-r--r--sys/cam/scsi/scsi_cd.c3
-rw-r--r--sys/cam/scsi/scsi_ch.c5
-rw-r--r--sys/cam/scsi/scsi_da.c4
-rw-r--r--sys/cam/scsi/scsi_enc.c5
-rw-r--r--sys/cam/scsi/scsi_pass.c7
-rw-r--r--sys/cam/scsi/scsi_pt.c3
-rw-r--r--sys/cam/scsi/scsi_sa.c4
-rw-r--r--sys/cam/scsi/scsi_sg.c5
18 files changed, 82 insertions, 41 deletions
diff --git a/sys/cam/ata/ata_all.c b/sys/cam/ata/ata_all.c
index 940b572..b88fcd1 100644
--- a/sys/cam/ata/ata_all.c
+++ b/sys/cam/ata/ata_all.c
@@ -297,6 +297,18 @@ ata_print_ident(struct ata_params *ident_data)
}
void
+ata_print_ident_short(struct ata_params *ident_data)
+{
+ char product[48], revision[16];
+
+ cam_strvis(product, ident_data->model, sizeof(ident_data->model),
+ sizeof(product));
+ cam_strvis(revision, ident_data->revision, sizeof(ident_data->revision),
+ sizeof(revision));
+ printf("<%s %s>", product, revision);
+}
+
+void
semb_print_ident(struct sep_identify_data *ident_data)
{
char vendor[9], product[17], revision[5], fw[5], in[7], ins[5];
@@ -311,6 +323,18 @@ semb_print_ident(struct sep_identify_data *ident_data)
vendor, product, revision, fw, in, ins);
}
+void
+semb_print_ident_short(struct sep_identify_data *ident_data)
+{
+ char vendor[9], product[17], revision[5], fw[5];
+
+ cam_strvis(vendor, ident_data->vendor_id, 8, sizeof(vendor));
+ cam_strvis(product, ident_data->product_id, 16, sizeof(product));
+ cam_strvis(revision, ident_data->product_rev, 4, sizeof(revision));
+ cam_strvis(fw, ident_data->firmware_rev, 4, sizeof(fw));
+ printf("<%s %s %s %s>", vendor, product, revision, fw);
+}
+
uint32_t
ata_logical_sector_size(struct ata_params *ident_data)
{
diff --git a/sys/cam/ata/ata_all.h b/sys/cam/ata/ata_all.h
index 25732b6..91e941c 100644
--- a/sys/cam/ata/ata_all.h
+++ b/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/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c
index c8ed689..062e805 100644
--- a/sys/cam/ata/ata_da.c
+++ b/sys/cam/ata/ata_da.c
@@ -907,7 +907,6 @@ adaoninvalidate(struct cam_periph *periph)
bioq_flush(&softc->trim_queue, NULL, ENXIO);
disk_gone(softc->disk);
- xpt_print(periph->path, "lost device\n");
}
static void
@@ -917,7 +916,6 @@ adacleanup(struct cam_periph *periph)
softc = (struct ada_softc *)periph->softc;
- xpt_print(periph->path, "removing device entry\n");
cam_periph_unlock(periph);
/*
diff --git a/sys/cam/ata/ata_pmp.c b/sys/cam/ata/ata_pmp.c
index 8d4e185..d220591 100644
--- a/sys/cam/ata/ata_pmp.c
+++ b/sys/cam/ata/ata_pmp.c
@@ -241,7 +241,6 @@ pmponinvalidate(struct cam_periph *periph)
}
}
pmprelease(periph, -1);
- xpt_print(periph->path, "lost device\n");
}
static void
@@ -251,7 +250,6 @@ pmpcleanup(struct cam_periph *periph)
softc = (struct pmp_softc *)periph->softc;
- xpt_print(periph->path, "removing device entry\n");
cam_periph_unlock(periph);
/*
diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c
index b230c6c..4e9138f 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -586,6 +586,8 @@ cam_periph_invalidate(struct cam_periph *periph)
return;
CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n"));
+ if (periph->flags & CAM_PERIPH_ANNOUNCED)
+ xpt_denounce_periph(periph);
periph->flags |= CAM_PERIPH_INVALID;
periph->flags &= ~CAM_PERIPH_NEW_DEV_FOUND;
if (periph->periph_oninval != NULL)
@@ -648,7 +650,10 @@ camperiphfree(struct cam_periph *periph)
xpt_remove_periph(periph);
xpt_unlock_buses();
- CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n"));
+ if (periph->flags & CAM_PERIPH_ANNOUNCED) {
+ xpt_print(periph->path, "Periph destroyed\n");
+ } else
+ CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n"));
if (periph->flags & CAM_PERIPH_NEW_DEV_FOUND) {
union ccb ccb;
diff --git a/sys/cam/cam_periph.h b/sys/cam/cam_periph.h
index 274537e..66b9d91 100644
--- a/sys/cam/cam_periph.h
+++ b/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 */
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index c14041f..76ccb62 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -1023,6 +1023,7 @@ xpt_announce_periph(struct cam_periph *periph, char *announce_string)
struct cam_path *path = periph->path;
mtx_assert(periph->sim->mtx, MA_OWNED);
+ periph->flags |= CAM_PERIPH_ANNOUNCED;
printf("%s%d at %s%d bus %d scbus%d target %d lun %d\n",
periph->periph_name, periph->unit_number,
@@ -1071,6 +1072,37 @@ xpt_announce_quirks(struct cam_periph *periph, int quirks, char *bit_string)
}
}
+void
+xpt_denounce_periph(struct cam_periph *periph)
+{
+ struct cam_path *path = periph->path;
+
+ mtx_assert(periph->sim->mtx, MA_OWNED);
+ printf("%s%d at %s%d bus %d scbus%d target %d lun %d\n",
+ periph->periph_name, periph->unit_number,
+ path->bus->sim->sim_name,
+ path->bus->sim->unit_number,
+ path->bus->sim->bus_id,
+ path->bus->path_id,
+ path->target->target_id,
+ path->device->lun_id);
+ printf("%s%d: ", periph->periph_name, periph->unit_number);
+ if (path->device->protocol == PROTO_SCSI)
+ scsi_print_inquiry_short(&path->device->inq_data);
+ else if (path->device->protocol == PROTO_ATA ||
+ path->device->protocol == PROTO_SATAPM)
+ ata_print_ident_short(&path->device->ident_data);
+ else if (path->device->protocol == PROTO_SEMB)
+ semb_print_ident_short(
+ (struct sep_identify_data *)&path->device->ident_data);
+ else
+ printf("Unknown protocol device");
+ if (path->device->serial_num_len > 0)
+ printf(" s/n %.60s", path->device->serial_num);
+ printf(" detached\n");
+}
+
+
int
xpt_getattr(char *buf, size_t len, const char *attr, struct cam_path *path)
{
diff --git a/sys/cam/cam_xpt_periph.h b/sys/cam/cam_xpt_periph.h
index da31c83..9245aee 100644
--- a/sys/cam/cam_xpt_periph.h
+++ b/sys/cam/cam_xpt_periph.h
@@ -47,6 +47,7 @@ void xpt_announce_periph(struct cam_periph *periph,
char *announce_string);
void xpt_announce_quirks(struct cam_periph *periph,
int quirks, char *bit_string);
+void xpt_denounce_periph(struct cam_periph *periph);
#endif
#endif /* _CAM_CAM_XPT_PERIPH_H */
diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c
index 6530266..1d4d77e 100644
--- a/sys/cam/scsi/scsi_all.c
+++ b/sys/cam/scsi/scsi_all.c
@@ -5249,6 +5249,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);
+}
+
/*
* Table of syncrates that don't follow the "divisible by 4"
* rule. This table will be expanded in future SCSI specs.
diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h
index 3e24ae1..83b7041 100644
--- a/sys/cam/scsi/scsi_all.h
+++ b/sys/cam/scsi/scsi_all.h
@@ -2313,6 +2313,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/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index 4bfbc41..1b59eca 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -428,7 +428,6 @@ cdoninvalidate(struct cam_periph *periph)
camq_remove(&softc->changer->devq, softc->pinfo.index);
disk_gone(softc->disk);
- xpt_print(periph->path, "lost device, %d refs\n", periph->refcount);
}
static void
@@ -438,8 +437,6 @@ cdcleanup(struct cam_periph *periph)
softc = (struct cd_softc *)periph->softc;
- xpt_print(periph->path, "removing device entry\n");
-
/*
* In the queued, non-active case, the device in question
* has already been removed from the changer run queue. Since this
diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c
index fdfb97f..fb208ed 100644
--- a/sys/cam/scsi/scsi_ch.c
+++ b/sys/cam/scsi/scsi_ch.c
@@ -306,9 +306,6 @@ choninvalidate(struct cam_periph *periph)
* when it has cleaned up its state.
*/
destroy_dev_sched_cb(softc->dev, chdevgonecb, periph);
-
- xpt_print(periph->path, "lost device\n");
-
}
static void
@@ -318,8 +315,6 @@ chcleanup(struct cam_periph *periph)
softc = (struct ch_softc *)periph->softc;
- xpt_print(periph->path, "removing device entry\n");
-
devstat_remove_entry(softc->device_stats);
free(softc, M_DEVBUF);
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 913951e..1ba7382 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -1561,9 +1561,6 @@ daoninvalidate(struct cam_periph *periph)
* done cleaning up its resources.
*/
disk_gone(softc->disk);
-
- xpt_print(periph->path, "lost device - %d outstanding, %d refs\n",
- softc->outstanding_cmds, periph->refcount);
}
static void
@@ -1573,7 +1570,6 @@ dacleanup(struct cam_periph *periph)
softc = (struct da_softc *)periph->softc;
- xpt_print(periph->path, "removing device entry\n");
cam_periph_unlock(periph);
/*
diff --git a/sys/cam/scsi/scsi_enc.c b/sys/cam/scsi/scsi_enc.c
index 775d8f6..c39061f 100644
--- a/sys/cam/scsi/scsi_enc.c
+++ b/sys/cam/scsi/scsi_enc.c
@@ -178,8 +178,6 @@ enc_oninvalidate(struct cam_periph *periph)
callout_drain(&enc->status_updater);
destroy_dev_sched_cb(enc->enc_dev, enc_devgonecb, periph);
-
- xpt_print(periph->path, "lost device\n");
}
static void
@@ -189,9 +187,6 @@ enc_dtor(struct cam_periph *periph)
enc = periph->softc;
- xpt_print(periph->path, "removing device entry\n");
-
-
/* If the sub-driver has a cleanup routine, call it */
if (enc->enc_vec.softc_cleanup != NULL)
enc->enc_vec.softc_cleanup(enc);
diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c
index 6ce9bb0..c135e68 100644
--- a/sys/cam/scsi/scsi_pass.c
+++ b/sys/cam/scsi/scsi_pass.c
@@ -207,11 +207,6 @@ passoninvalidate(struct cam_periph *periph)
* XXX Handle any transactions queued to the card
* with XPT_ABORT_CCB.
*/
-
- if (bootverbose) {
- xpt_print(periph->path, "lost device\n");
- }
-
}
static void
@@ -221,8 +216,6 @@ passcleanup(struct cam_periph *periph)
softc = (struct pass_softc *)periph->softc;
- if (bootverbose)
- xpt_print(periph->path, "removing device entry\n");
devstat_remove_entry(softc->device_stats);
cam_periph_unlock(periph);
diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c
index b30fbbf..8d8feb2 100644
--- a/sys/cam/scsi/scsi_pt.c
+++ b/sys/cam/scsi/scsi_pt.c
@@ -333,8 +333,6 @@ ptoninvalidate(struct cam_periph *periph)
* with XPT_ABORT_CCB.
*/
bioq_flush(&softc->bio_queue, NULL, ENXIO);
-
- xpt_print(periph->path, "lost device\n");
}
static void
@@ -344,7 +342,6 @@ ptdtor(struct cam_periph *periph)
softc = (struct pt_softc *)periph->softc;
- xpt_print(periph->path, "removing device entry\n");
devstat_remove_entry(softc->device_stats);
cam_periph_unlock(periph);
destroy_dev(softc->dev);
diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c
index 6b941e0..d91246b 100644
--- a/sys/cam/scsi/scsi_sa.c
+++ b/sys/cam/scsi/scsi_sa.c
@@ -1401,9 +1401,6 @@ saoninvalidate(struct cam_periph *periph)
*/
bioq_flush(&softc->bio_queue, NULL, ENXIO);
softc->queue_count = 0;
-
- xpt_print(periph->path, "lost device\n");
-
}
static void
@@ -1414,7 +1411,6 @@ sacleanup(struct cam_periph *periph)
softc = (struct sa_softc *)periph->softc;
- xpt_print(periph->path, "removing device entry\n");
devstat_remove_entry(softc->device_stats);
cam_periph_unlock(periph);
destroy_dev(softc->devs.ctl_dev);
diff --git a/sys/cam/scsi/scsi_sg.c b/sys/cam/scsi/scsi_sg.c
index 1ad78ad..b597b64 100644
--- a/sys/cam/scsi/scsi_sg.c
+++ b/sys/cam/scsi/scsi_sg.c
@@ -238,9 +238,6 @@ sgoninvalidate(struct cam_periph *periph)
* with XPT_ABORT_CCB.
*/
- if (bootverbose) {
- xpt_print(periph->path, "lost device\n");
- }
}
static void
@@ -249,8 +246,6 @@ sgcleanup(struct cam_periph *periph)
struct sg_softc *softc;
softc = (struct sg_softc *)periph->softc;
- if (bootverbose)
- xpt_print(periph->path, "removing device entry\n");
devstat_remove_entry(softc->device_stats);
OpenPOWER on IntegriCloud