From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 24 10:34:17 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C3993FB6; Thu, 24 Oct 2013 10:34:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B09E9211E; Thu, 24 Oct 2013 10:34:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9OAYHKE022778; Thu, 24 Oct 2013 10:34:17 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9OAYEvr022755; Thu, 24 Oct 2013 10:34:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310241034.r9OAYEvr022755@svn.freebsd.org> From: Alexander Motin Date: Thu, 24 Oct 2013 10:34:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257050 - in stable/9/sys/cam: . ata scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 10:34:18 -0000 Author: mav Date: Thu Oct 24 10:34:13 2013 New Revision: 257050 URL: http://svnweb.freebsd.org/changeset/base/257050 Log: MFC r256552: Unify periph invalidation and destruction reporting. Print message containing device model and serial number on invalidation. Modified: stable/9/sys/cam/ata/ata_all.c stable/9/sys/cam/ata/ata_all.h stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/ata/ata_pmp.c stable/9/sys/cam/cam_periph.c stable/9/sys/cam/cam_periph.h stable/9/sys/cam/cam_xpt.c stable/9/sys/cam/cam_xpt_periph.h stable/9/sys/cam/scsi/scsi_all.c stable/9/sys/cam/scsi/scsi_all.h stable/9/sys/cam/scsi/scsi_cd.c stable/9/sys/cam/scsi/scsi_ch.c stable/9/sys/cam/scsi/scsi_da.c stable/9/sys/cam/scsi/scsi_enc.c stable/9/sys/cam/scsi/scsi_pass.c stable/9/sys/cam/scsi/scsi_pt.c stable/9/sys/cam/scsi/scsi_sa.c stable/9/sys/cam/scsi/scsi_sg.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_all.c ============================================================================== --- stable/9/sys/cam/ata/ata_all.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/ata/ata_all.c Thu Oct 24 10:34:13 2013 (r257050) @@ -297,6 +297,18 @@ ata_print_ident(struct ata_params *ident } 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_dat 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) { Modified: stable/9/sys/cam/ata/ata_all.h ============================================================================== --- stable/9/sys/cam/ata/ata_all.h Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/ata/ata_all.h Thu Oct 24 10:34:13 2013 (r257050) @@ -109,6 +109,7 @@ int ata_status_sbuf(struct ccb_ataio *at 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 identbuff 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*), Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/ata/ata_da.c Thu Oct 24 10:34:13 2013 (r257050) @@ -912,7 +912,6 @@ adaoninvalidate(struct cam_periph *perip bioq_flush(&softc->trim_queue, NULL, ENXIO); disk_gone(softc->disk); - xpt_print(periph->path, "lost device\n"); } static void @@ -922,7 +921,6 @@ adacleanup(struct cam_periph *periph) softc = (struct ada_softc *)periph->softc; - xpt_print(periph->path, "removing device entry\n"); cam_periph_unlock(periph); /* Modified: stable/9/sys/cam/ata/ata_pmp.c ============================================================================== --- stable/9/sys/cam/ata/ata_pmp.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/ata/ata_pmp.c Thu Oct 24 10:34:13 2013 (r257050) @@ -241,7 +241,6 @@ pmponinvalidate(struct cam_periph *perip } } 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); /* Modified: stable/9/sys/cam/cam_periph.c ============================================================================== --- stable/9/sys/cam/cam_periph.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/cam_periph.c Thu Oct 24 10:34:13 2013 (r257050) @@ -586,6 +586,8 @@ cam_periph_invalidate(struct cam_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; Modified: stable/9/sys/cam/cam_periph.h ============================================================================== --- stable/9/sys/cam/cam_periph.h Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/cam_periph.h Thu Oct 24 10:34:13 2013 (r257050) @@ -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 */ Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/cam_xpt.c Thu Oct 24 10:34:13 2013 (r257050) @@ -1025,6 +1025,7 @@ xpt_announce_periph(struct cam_periph *p 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, @@ -1073,6 +1074,37 @@ xpt_announce_quirks(struct cam_periph *p } } +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) { Modified: stable/9/sys/cam/cam_xpt_periph.h ============================================================================== --- stable/9/sys/cam/cam_xpt_periph.h Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/cam_xpt_periph.h Thu Oct 24 10:34:13 2013 (r257050) @@ -47,6 +47,7 @@ void xpt_announce_periph(struct cam_per 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 */ Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_all.c Thu Oct 24 10:34:13 2013 (r257050) @@ -5249,6 +5249,21 @@ scsi_print_inquiry(struct scsi_inquiry_d 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. Modified: stable/9/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.h Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_all.h Thu Oct 24 10:34:13 2013 (r257050) @@ -2312,6 +2312,7 @@ char * scsi_cdb_string(u_int8_t *cdb_pt 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); Modified: stable/9/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_cd.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_cd.c Thu Oct 24 10:34:13 2013 (r257050) @@ -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 Modified: stable/9/sys/cam/scsi/scsi_ch.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_ch.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_ch.c Thu Oct 24 10:34:13 2013 (r257050) @@ -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); Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_da.c Thu Oct 24 10:34:13 2013 (r257050) @@ -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); /* Modified: stable/9/sys/cam/scsi/scsi_enc.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_enc.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_enc.c Thu Oct 24 10:34:13 2013 (r257050) @@ -178,8 +178,6 @@ enc_oninvalidate(struct cam_periph *peri 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); Modified: stable/9/sys/cam/scsi/scsi_pass.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_pass.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_pass.c Thu Oct 24 10:34:13 2013 (r257050) @@ -207,11 +207,6 @@ passoninvalidate(struct cam_periph *peri * 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); Modified: stable/9/sys/cam/scsi/scsi_pt.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_pt.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_pt.c Thu Oct 24 10:34:13 2013 (r257050) @@ -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); Modified: stable/9/sys/cam/scsi/scsi_sa.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_sa.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_sa.c Thu Oct 24 10:34:13 2013 (r257050) @@ -1377,9 +1377,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 @@ -1390,7 +1387,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); Modified: stable/9/sys/cam/scsi/scsi_sg.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_sg.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_sg.c Thu Oct 24 10:34:13 2013 (r257050) @@ -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);