From owner-p4-projects@FreeBSD.ORG Tue Feb 2 13:43:42 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D98651065764; Tue, 2 Feb 2010 13:43: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 6EE28106571E for ; Tue, 2 Feb 2010 13:00:46 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 5C09D8FC16 for ; Tue, 2 Feb 2010 13:00:46 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o12D0kJs056782 for ; Tue, 2 Feb 2010 13:00:46 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o12D0kAf056780 for perforce@freebsd.org; Tue, 2 Feb 2010 13:00:46 GMT (envelope-from mav@freebsd.org) Date: Tue, 2 Feb 2010 13:00:46 GMT Message-Id: <201002021300.o12D0kAf056780@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mav@freebsd.org using -f From: Alexander Motin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 174143 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 13:43:42 -0000 http://p4web.freebsd.org/chv.cgi?CH=174143 Change 174143 by mav@mav_mavtest on 2010/02/02 13:00:25 - Use separate buffer for identify data fetching. We can't use main buffer, as data need to be formatted before use. - Remove some saved_ccb variables. They are unused now. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_da.c#49 edit .. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#32 edit .. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#78 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_da.c#49 (text+ko) ==== @@ -123,7 +123,6 @@ int trim_running; struct disk_params params; struct disk *disk; - union ccb saved_ccb; struct task sysctl_task; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; @@ -1098,8 +1097,7 @@ periph = xpt_path_periph(ccb->ccb_h.path); softc = (struct ada_softc *)periph->softc; - return(cam_periph_error(ccb, cam_flags, sense_flags, - &softc->saved_ccb)); + return(cam_periph_error(ccb, cam_flags, sense_flags, NULL)); } static void ==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#32 (text+ko) ==== @@ -101,7 +101,6 @@ int events; #define PMP_EV_RESET 1 #define PMP_EV_RESCAN 2 - union ccb saved_ccb; struct task sysctl_task; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; @@ -552,8 +551,7 @@ priority = done_ccb->ccb_h.pinfo.priority; if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if (cam_periph_error(done_ccb, 0, 0, - &softc->saved_ccb) == ERESTART) { + if (cam_periph_error(done_ccb, 0, 0, NULL) == ERESTART) { return; } else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { cam_release_devq(done_ccb->ccb_h.path, ==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#78 (text+ko) ==== @@ -37,7 +37,6 @@ #include #include #include -#include #include #include @@ -124,10 +123,9 @@ typedef struct { TAILQ_HEAD(, ccb_hdr) request_ccbs; + struct ata_params ident_data; probe_action action; - union ccb saved_ccb; probe_flags flags; - u_int8_t digest[16]; uint32_t pm_pid; uint32_t pm_prv; int restart; @@ -303,29 +301,13 @@ ata_reset_cmd(ataio); break; case PROBE_IDENTIFY: - if ((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) { - /* Prepare check that it is the same device. */ - MD5_CTX context; - - MD5Init(&context); - MD5Update(&context, - (unsigned char *)ident_buf->model, - sizeof(ident_buf->model)); - MD5Update(&context, - (unsigned char *)ident_buf->revision, - sizeof(ident_buf->revision)); - MD5Update(&context, - (unsigned char *)ident_buf->serial, - sizeof(ident_buf->serial)); - MD5Final(softc->digest, &context); - } cam_fill_ataio(ataio, 1, probedone, /*flags*/CAM_DIR_IN, 0, - /*data_ptr*/(u_int8_t *)ident_buf, - /*dxfer_len*/sizeof(struct ata_params), + /*data_ptr*/(u_int8_t *)&softc->ident_data, + /*dxfer_len*/sizeof(softc->ident_data), 30 * 1000); if (periph->path->device->protocol == PROTO_ATA) ata_28bit_cmd(ataio, ATA_ATA_IDENTIFY, 0, 0, 0); @@ -695,8 +677,7 @@ ident_buf = &path->device->ident_data; if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { -device_fail: if (cam_periph_error(done_ccb, 0, 0, - &softc->saved_ccb) == ERESTART) { +device_fail: if (cam_periph_error(done_ccb, 0, 0, NULL) == ERESTART) { return; } else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { /* Don't wedge the queue */ @@ -724,6 +705,8 @@ goto done; } noerror: + if (softc->restart) + goto done; switch (softc->action) { case PROBE_RESET: { @@ -766,6 +749,7 @@ { int16_t *ptr; + ident_buf = &softc->ident_data; for (ptr = (int16_t *)ident_buf; ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) { *ptr = le16toh(*ptr); @@ -784,28 +768,22 @@ ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision)); ata_btrim(ident_buf->serial, sizeof(ident_buf->serial)); ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial)); + ident_buf = &path->device->ident_data; if ((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) { /* Check that it is the same device. */ - MD5_CTX context; - u_int8_t digest[16]; - - MD5Init(&context); - MD5Update(&context, - (unsigned char *)ident_buf->model, - sizeof(ident_buf->model)); - MD5Update(&context, - (unsigned char *)ident_buf->revision, - sizeof(ident_buf->revision)); - MD5Update(&context, - (unsigned char *)ident_buf->serial, - sizeof(ident_buf->serial)); - MD5Final(digest, &context); - if (bcmp(digest, softc->digest, sizeof(digest))) { + if (bcmp(softc->ident_data.model, ident_buf->model, + sizeof(ident_buf->model)) || + bcmp(softc->ident_data.revision, ident_buf->revision, + sizeof(ident_buf->revision)) || + bcmp(softc->ident_data.serial, ident_buf->serial, + sizeof(ident_buf->serial))) { /* Device changed. */ xpt_async(AC_LOST_DEVICE, path, NULL); - } + } else + bcopy(&softc->ident_data, ident_buf, sizeof(struct ata_params)); } else { + bcopy(&softc->ident_data, ident_buf, sizeof(struct ata_params)); /* Clean up from previous instance of this device */ if (path->device->serial_num != NULL) { free(path->device->serial_num, M_CAMXPT);