From owner-p4-projects@FreeBSD.ORG Wed May 27 06:09:35 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 544C6106566C; Wed, 27 May 2009 06:09:35 +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 106A1106564A for ; Wed, 27 May 2009 06:09:35 +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 F31D78FC17 for ; Wed, 27 May 2009 06:09:34 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R69Yg4020126 for ; Wed, 27 May 2009 06:09:34 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n4R69YWs020124 for perforce@freebsd.org; Wed, 27 May 2009 06:09:34 GMT (envelope-from mav@freebsd.org) Date: Wed, 27 May 2009 06:09:34 GMT Message-Id: <200905270609.n4R69YWs020124@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 Cc: Subject: PERFORCE change 162838 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: Wed, 27 May 2009 06:09:36 -0000 http://perforce.freebsd.org/chv.cgi?CH=162838 Change 162838 by mav@mav_mavbook on 2009/05/27 06:08:55 For ATAPI return errors more suitable for SCSI. Affected files ... .. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#4 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#4 (text+ko) ==== @@ -854,20 +854,22 @@ device_t dev = slot->dev; struct ahci_channel *ch = device_get_softc(dev); struct ahci_cmd_list *clp; -// u_int32_t tf_data; + u_int32_t tf_data; //device_printf(dev, "%s slot %d\n", __func__, slot->slot); /* kill the timeout */ // callout_stop(&request->callout); /* get status */ -// tf_data = ATA_INL(ch->r_mem, AHCI_P_TFD); -// slot->ccb->ccb_h.status = tf_data; - - /* if error status get details */ -// if (request->status & ATA_S_ERROR) -// request->error = tf_data >> 8; - + tf_data = ATA_INL(ch->r_mem, AHCI_P_TFD); +#if 0 + if (err && slot->ccb->ccb_h.func_code == XPT_ATA_IO) { + slot->ccb->ataio.status = tf_data; + /* if error status get details */ + if (tf_data & ATA_S_ERROR) + request->error = tf_data >> 8; + } +#endif /* on control commands read back registers to the request struct */ /* if (request->flags & ATA_R_CONTROL) { struct ata_device *atadev = device_get_softc(request->dev); @@ -899,10 +901,19 @@ bus_dmamap_unload(ch->dma.data_tag, slot->dma.data_map); } - if (err == 0) + if (err == 0) { slot->ccb->ccb_h.status = CAM_REQ_CMP; - else - slot->ccb->ccb_h.status = CAM_REQ_CMP_ERR; + if (slot->ccb->ccb_h.func_code == XPT_SCSI_IO) + slot->ccb->csio.scsi_status = SCSI_STATUS_OK; + } else { + if (slot->ccb->ccb_h.func_code == XPT_SCSI_IO) { + slot->ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR; + slot->ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; + } else { + slot->ccb->ccb_h.status = CAM_REQ_CMP_ERR; + slot->ccb->ataio.status = tf_data; + } + } xpt_done(slot->ccb); ch->rslots &= ~(1 << slot->slot);