From owner-p4-projects@FreeBSD.ORG Sun Oct 11 12:50:21 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B0DF1106568D; Sun, 11 Oct 2009 12:50:21 +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 7406D1065679 for ; Sun, 11 Oct 2009 12:50:21 +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 6303C8FC0C for ; Sun, 11 Oct 2009 12:50:21 +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 n9BCoLVU025248 for ; Sun, 11 Oct 2009 12:50:21 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n9BCoLUt025246 for perforce@freebsd.org; Sun, 11 Oct 2009 12:50:21 GMT (envelope-from mav@freebsd.org) Date: Sun, 11 Oct 2009 12:50:21 GMT Message-Id: <200910111250.n9BCoLUt025246@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 169389 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: Sun, 11 Oct 2009 12:50:21 -0000 http://perforce.freebsd.org/chv.cgi?CH=169389 Change 169389 by mav@mav_mavtest on 2009/10/11 12:49:46 Add ATA-specific done handler, resetting bus on heavy errors. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#39 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#39 (text+ko) ==== @@ -179,11 +179,12 @@ struct cam_ed *device, void *async_arg); static void ata_action(union ccb *start_ccb); +static void ata_done(union ccb *done_ccb); static struct xpt_xport ata_xport = { .alloc_device = ata_alloc_device, .action = ata_action, - .done = xpt_done_default, + .done = ata_done, .async = ata_dev_async, }; @@ -1244,6 +1245,36 @@ } static void +ata_done(union ccb *done_ccb) +{ + struct cam_path *path; + union ccb *work_ccb; + + switch (done_ccb->ccb_h.status & CAM_STATUS_MASK) { + case CAM_CMD_TIMEOUT: + case CAM_UNCOR_PARITY: + work_ccb = xpt_alloc_ccb_nowait(); + if (work_ccb == NULL) + break; + if (xpt_create_path(&path, xpt_periph, done_ccb->ccb_h.path_id, + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + xpt_free_ccb(work_ccb); + break; + } + xpt_setup_ccb(&work_ccb->ccb_h, path, CAM_PRIORITY_NORMAL); + work_ccb->ccb_h.func_code = XPT_RESET_BUS; + work_ccb->ccb_h.cbfcnp = NULL; + CAM_DEBUG(path, CAM_DEBUG_SUBTRACE, ("Resetting Bus\n")); + xpt_action(work_ccb); + xpt_free_ccb(work_ccb); + break; + } + + /* Call default done handler. */ + xpt_done_default(done_ccb); +} + +static void scsi_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_ed *device, int async_update) {