From owner-p4-projects@FreeBSD.ORG Mon Mar 31 07:32:30 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D96CC1065676; Mon, 31 Mar 2008 07:32:29 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9980E1065673 for ; Mon, 31 Mar 2008 07:32:29 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 9A1238FC25 for ; Mon, 31 Mar 2008 07:32:29 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m2V7WT7c077752 for ; Mon, 31 Mar 2008 07:32:29 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m2V7WTnT077750 for perforce@freebsd.org; Mon, 31 Mar 2008 07:32:29 GMT (envelope-from scottl@freebsd.org) Date: Mon, 31 Mar 2008 07:32:29 GMT Message-Id: <200803310732.m2V7WTnT077750@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to scottl@freebsd.org using -f From: Scott Long To: Perforce Change Reviews Cc: Subject: PERFORCE change 139045 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Mar 2008 07:32:30 -0000 http://perforce.freebsd.org/chv.cgi?CH=139045 Change 139045 by scottl@scottl-deimos on 2008/03/31 07:32:04 Merge cam_xpt.c#82 (rev 1.197) into scsi_probe.c and scsi_xpt.c Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#77 integrate .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_probe.c#7 edit .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_xpt.c#5 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#77 (text+ko) ==== ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_probe.c#7 (text+ko) ==== @@ -75,7 +75,8 @@ PROBE_INQUIRY, /* this counts as DV0 for Basic Domain Validation */ PROBE_FULL_INQUIRY, PROBE_MODE_SENSE, - PROBE_SERIAL_NUM, + PROBE_SERIAL_NUM_0, + PROBE_SERIAL_NUM_1, PROBE_TUR_FOR_NEGOTIATION, PROBE_INQUIRY_BASIC_DV1, PROBE_INQUIRY_BASIC_DV2, @@ -340,10 +341,42 @@ } xpt_print(periph->path, "Unable to mode sense control page - " "malloc failure\n"); - softc->action = PROBE_SERIAL_NUM; + softc->action = PROBE_SERIAL_NUM_0; } /* FALLTHROUGH */ - case PROBE_SERIAL_NUM: + case PROBE_SERIAL_NUM_0: + { + struct scsi_vpd_supported_page_list *vpd_list = NULL; + struct cam_ed *device; + + device = periph->path->device; + if ((device->quirk->quirks & CAM_QUIRK_NOSERIAL) == 0) { + vpd_list = malloc(sizeof(*vpd_list), M_CAMXPT, + M_NOWAIT | M_ZERO); + } + + if (vpd_list != NULL) { + scsi_inquiry(csio, + /*retries*/4, + probedone, + MSG_SIMPLE_Q_TAG, + (u_int8_t *)vpd_list, + sizeof(*vpd_list), + /*evpd*/TRUE, + SVPD_SUPPORTED_PAGE_LIST, + SSD_MIN_SIZE, + /*timeout*/60 * 1000); + break; + } + /* + * We'll have to do without, let our probedone + * routine finish up for us. + */ + start_ccb->csio.data_ptr = NULL; + probedone(periph, start_ccb); + return; + } + case PROBE_SERIAL_NUM_1: { struct scsi_vpd_unit_serial_number *serial_buf; struct cam_ed* device; @@ -353,10 +386,8 @@ device->serial_num = NULL; device->serial_num_len = 0; - if ((device->quirk->quirks & CAM_QUIRK_NOSERIAL) == 0) - serial_buf = (struct scsi_vpd_unit_serial_number *) - malloc(sizeof(*serial_buf), M_TEMP, - M_NOWAIT | M_ZERO); + serial_buf = (struct scsi_vpd_unit_serial_number *) + malloc(sizeof(*serial_buf), M_TEMP, M_NOWAIT | M_ZERO); if (serial_buf != NULL) { scsi_inquiry(csio, @@ -581,7 +612,7 @@ if (INQ_DATA_TQ_ENABLED(inq_buf)) softc->action = PROBE_MODE_SENSE; else - softc->action = PROBE_SERIAL_NUM; + softc->action = PROBE_SERIAL_NUM_0; path->device->flags &= ~CAM_DEV_UNCONFIGURED; @@ -646,11 +677,62 @@ } xpt_release_ccb(done_ccb); free(mode_hdr, M_TEMP); - softc->action = PROBE_SERIAL_NUM; + softc->action = PROBE_SERIAL_NUM_0; xpt_schedule(periph, priority); return; } - case PROBE_SERIAL_NUM: + case PROBE_SERIAL_NUM_0: + { + struct ccb_scsiio *csio; + struct scsi_vpd_supported_page_list *page_list; + int length, serialnum_supported, i; + + serialnum_supported = 0; + csio = &done_ccb->csio; + page_list = + (struct scsi_vpd_supported_page_list *)csio->data_ptr; + + if (page_list == NULL) { + /* + * Don't process the command as it was never sent + */ + } else if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP + && (page_list->length > 0)) { + length = min(page_list->length, + SVPD_SUPPORTED_PAGES_SIZE); + for (i = 0; i < length; i++) { + if (page_list->list[i] == + SVPD_UNIT_SERIAL_NUMBER) { + serialnum_supported = 1; + break; + } + } + } else if (cam_periph_error(done_ccb, 0, + SF_RETRY_UA|SF_NO_PRINT, + &softc->saved_ccb) == ERESTART) { + return; + } else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { + /* Don't wedge the queue */ + xpt_release_devq(done_ccb->ccb_h.path, /*count*/1, + /*run_queue*/TRUE); + } + + if (page_list != NULL) + free(page_list, M_DEVBUF); + + if (serialnum_supported) { + xpt_release_ccb(done_ccb); + softc->action = PROBE_SERIAL_NUM_1; + xpt_schedule(periph, priority); + return; + } + xpt_release_ccb(done_ccb); + softc->action = PROBE_TUR_FOR_NEGOTIATION; + xpt_schedule(periph, done_ccb->ccb_h.pinfo.priority); + return; + } + + case PROBE_SERIAL_NUM_1: { struct ccb_scsiio *csio; struct scsi_vpd_unit_serial_number *serial_buf; ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_xpt.c#5 (text+ko) ==== @@ -264,7 +264,7 @@ { /* I can't believe we need a quirk for DPT volumes. */ { T_ANY, SIP_MEDIA_FIXED|SIP_MEDIA_REMOVABLE, "DPT", "*", "*" }, - CAM_QUIRK_NOSERIAL|CAM_QUIRK_NOLUNS, + CAM_QUIRK_NOLUNS, /*mintags*/0, /*maxtags*/255 }, { @@ -295,7 +295,7 @@ T_SEQUENTIAL, SIP_MEDIA_REMOVABLE, "EXABYTE", "EXB-8200*", "*" }, - CAM_QUIRK_NOSERIAL|CAM_QUIRK_NOLUNS, /*mintags*/0, /*maxtags*/0 + CAM_QUIRK_NOLUNS, /*mintags*/0, /*maxtags*/0 }, { /* @@ -306,7 +306,7 @@ T_SEQUENTIAL, SIP_MEDIA_REMOVABLE, "EXABYTE", "IPL-6860*", "*" }, - CAM_QUIRK_NOSERIAL|CAM_QUIRK_NOLUNS, /*mintags*/0, /*maxtags*/0 + CAM_QUIRK_NOLUNS, /*mintags*/0, /*maxtags*/0 }, { /* @@ -351,17 +351,6 @@ }, { /* - * Maxtor Personal Storage 3000XT (Firewire) - * hangs upon serial number probing. - */ - { - T_DIRECT, SIP_MEDIA_FIXED, "Maxtor", - "1394 storage", "*" - }, - CAM_QUIRK_NOSERIAL, /*mintags*/0, /*maxtags*/0 - }, - { - /* * Would repond to all LUNs if asked for. */ { @@ -420,18 +409,6 @@ CAM_QUIRK_NOLUNS, /*mintags*/0, /*maxtags*/0 }, { - /* - * Western Digital My Book 250GB (USB) - * hangs upon serial number probing. - * PR: 107495 - */ - { - T_DIRECT, SIP_MEDIA_FIXED, "WD", - "2500JB External", "*" - }, - CAM_QUIRK_NOSERIAL, /*mintags*/0, /*maxtags*/0 - }, - { /* Default tagged queuing parameters for all devices */ { T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED,