From owner-svn-src-all@FreeBSD.ORG Tue Jan 19 13:00:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CD2D106568F; Tue, 19 Jan 2010 13:00:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B7FA8FC14; Tue, 19 Jan 2010 13:00:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0JD0XOr095496; Tue, 19 Jan 2010 13:00:33 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0JD0X0q095493; Tue, 19 Jan 2010 13:00:33 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201001191300.o0JD0X0q095493@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Jan 2010 13:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202616 - in stable/8/sys: cam/ata dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2010 13:00:33 -0000 Author: mav Date: Tue Jan 19 13:00:33 2010 New Revision: 202616 URL: http://svn.freebsd.org/changeset/base/202616 Log: MFC r201990: - Report SATA in legacy emulation mode still as SATA. - Make ATA XPT able to handle such case. Modified: stable/8/sys/cam/ata/ata_xpt.c stable/8/sys/dev/ata/ata-all.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/8/sys/cam/ata/ata_xpt.c Tue Jan 19 12:58:29 2010 (r202615) +++ stable/8/sys/cam/ata/ata_xpt.c Tue Jan 19 13:00:33 2010 (r202616) @@ -1001,7 +1001,6 @@ typedef struct { union ccb *request_ccb; struct ccb_pathinq *cpi; int counter; - int found; } ata_scan_bus_info; /* @@ -1049,14 +1048,11 @@ ata_scan_bus(struct cam_periph *periph, } scan_info->request_ccb = request_ccb; scan_info->cpi = &work_ccb->cpi; - if (scan_info->cpi->transport == XPORT_ATA) - scan_info->found = 0x0003; - else - scan_info->found = 0x8001; - scan_info->counter = 0; /* If PM supported, probe it first. */ if (scan_info->cpi->hba_inquiry & PI_SATAPM) - scan_info->counter = 15; + scan_info->counter = scan_info->cpi->max_target; + else + scan_info->counter = 0; work_ccb = xpt_alloc_ccb_nowait(); if (work_ccb == NULL) { @@ -1073,10 +1069,11 @@ ata_scan_bus(struct cam_periph *periph, /* Free the current request path- we're done with it. */ xpt_free_path(work_ccb->ccb_h.path); /* If there is PMP... */ - if (scan_info->counter == 15) { + if ((scan_info->cpi->hba_inquiry & PI_SATAPM) && + (scan_info->counter == scan_info->cpi->max_target)) { if (work_ccb->ccb_h.ppriv_field1 != 0) { /* everything else willbe probed by it */ - scan_info->found = 0x8000; + goto done; } else { struct ccb_trans_settings cts; @@ -1091,11 +1088,10 @@ ata_scan_bus(struct cam_periph *periph, xpt_action((union ccb *)&cts); } } -take_next: - /* Take next device. Wrap from 15 (PM) to 0. */ - scan_info->counter = (scan_info->counter + 1 ) & 0x0f; - if (scan_info->counter > scan_info->cpi->max_target - - ((scan_info->cpi->hba_inquiry & PI_SATAPM) ? 1 : 0)) { + if (scan_info->counter == + ((scan_info->cpi->hba_inquiry & PI_SATAPM) ? + 0 : scan_info->cpi->max_target)) { +done: xpt_free_ccb(work_ccb); xpt_free_ccb((union ccb *)scan_info->cpi); request_ccb = scan_info->request_ccb; @@ -1104,9 +1100,10 @@ take_next: xpt_done(request_ccb); break; } + /* Take next device. Wrap from max (PMP) to 0. */ + scan_info->counter = (scan_info->counter + 1 ) % + (scan_info->cpi->max_target + 1); scan_next: - if ((scan_info->found & (1 << scan_info->counter)) == 0) - goto take_next; status = xpt_create_path(&path, xpt_periph, scan_info->request_ccb->ccb_h.path_id, scan_info->counter, 0); Modified: stable/8/sys/dev/ata/ata-all.c ============================================================================== --- stable/8/sys/dev/ata/ata-all.c Tue Jan 19 12:58:29 2010 (r202615) +++ stable/8/sys/dev/ata/ata-all.c Tue Jan 19 13:00:33 2010 (r202616) @@ -1473,7 +1473,7 @@ ataaction(struct cam_sim *sim, union ccb d = &ch->curr[ccb->ccb_h.target_id]; else d = &ch->user[ccb->ccb_h.target_id]; - if ((ch->flags & ATA_SATA) && (ch->flags & ATA_NO_SLAVE)) { + if (ch->flags & ATA_SATA) { if (cts->xport_specific.sata.valid & CTS_SATA_VALID_REVISION) d->revision = cts->xport_specific.sata.revision; if (cts->xport_specific.ata.valid & CTS_SATA_VALID_MODE) { @@ -1497,8 +1497,6 @@ ataaction(struct cam_sim *sim, union ccb } if (cts->xport_specific.ata.valid & CTS_ATA_VALID_BYTECOUNT) d->bytecount = cts->xport_specific.ata.bytecount; - if (ch->flags & ATA_SATA) - d->bytecount = min(8192, d->bytecount); } ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); @@ -1515,7 +1513,7 @@ ataaction(struct cam_sim *sim, union ccb d = &ch->user[ccb->ccb_h.target_id]; cts->protocol = PROTO_ATA; cts->protocol_version = PROTO_VERSION_UNSPECIFIED; - if ((ch->flags & ATA_SATA) && (ch->flags & ATA_NO_SLAVE)) { + if (ch->flags & ATA_SATA) { cts->transport = XPORT_SATA; cts->transport_version = XPORT_VERSION_UNSPECIFIED; cts->xport_specific.sata.mode = d->mode; @@ -1604,7 +1602,7 @@ ataaction(struct cam_sim *sim, union ccb strncpy(cpi->hba_vid, "ATA", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); - if ((ch->flags & ATA_SATA) && (ch->flags & ATA_NO_SLAVE)) + if (ch->flags & ATA_SATA) cpi->transport = XPORT_SATA; else cpi->transport = XPORT_ATA;