Unify periph invalidation and destruction reporting.
Print message containing device model and serial number on invalidation. Requested by: glebius MFC after: 1 week
This commit is contained in:
parent
dc755adf84
commit
8d36a71b76
@ -296,6 +296,18 @@ ata_print_ident(struct ata_params *ident_data)
|
||||
printf(" device\n");
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
|
@ -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*),
|
||||
|
@ -915,7 +915,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
|
||||
@ -925,7 +924,6 @@ adacleanup(struct cam_periph *periph)
|
||||
|
||||
softc = (struct ada_softc *)periph->softc;
|
||||
|
||||
xpt_print(periph->path, "removing device entry\n");
|
||||
cam_periph_unlock(periph);
|
||||
|
||||
/*
|
||||
|
@ -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);
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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 */
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -1569,9 +1569,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
|
||||
@ -1581,7 +1578,6 @@ dacleanup(struct cam_periph *periph)
|
||||
|
||||
softc = (struct da_softc *)periph->softc;
|
||||
|
||||
xpt_print(periph->path, "removing device entry\n");
|
||||
cam_periph_unlock(periph);
|
||||
|
||||
/*
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user