From owner-p4-projects@FreeBSD.ORG Sat Oct 10 20:35:34 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3914B1065672; Sat, 10 Oct 2009 20:35:34 +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 D70F0106566B for ; Sat, 10 Oct 2009 20:35:33 +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 BB7488FC13 for ; Sat, 10 Oct 2009 20:35:33 +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 n9AKZXWq087650 for ; Sat, 10 Oct 2009 20:35:33 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n9AKZXah087648 for perforce@freebsd.org; Sat, 10 Oct 2009 20:35:33 GMT (envelope-from mav@freebsd.org) Date: Sat, 10 Oct 2009 20:35:33 GMT Message-Id: <200910102035.n9AKZXah087648@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 169364 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: Sat, 10 Oct 2009 20:35:34 -0000 http://perforce.freebsd.org/chv.cgi?CH=169364 Change 169364 by mav@mav_mavbook on 2009/10/10 20:34:54 Add done method for port-specific XPT. It will allow XPT to recover bus from heavy error conditions. Fix SATA scanning, broken by recent ahci/siis change. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#38 edit .. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#104 edit .. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.h#18 edit .. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt_internal.h#8 edit .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_xpt.c#17 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#38 (text+ko) ==== @@ -183,6 +183,7 @@ static struct xpt_xport ata_xport = { .alloc_device = ata_alloc_device, .action = ata_action, + .done = xpt_done_default, .async = ata_dev_async, }; @@ -986,7 +987,8 @@ 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+1) { + if (scan_info->counter > scan_info->cpi->max_target - + ((scan_info->cpi->hba_inquiry & PI_SATAPM) ? 1 : 0)) { xpt_free_ccb(work_ccb); xpt_free_ccb((union ccb *)scan_info->cpi); request_ccb = scan_info->request_ccb; ==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#104 (text+ko) ==== @@ -2989,6 +2989,13 @@ } void +xpt_done_default(union ccb *done_ccb) +{ + /* Call the peripheral driver's callback */ + (*done_ccb->ccb_h.cbfcnp)(done_ccb->ccb_h.path->periph, done_ccb); +} + +void xpt_polled_action(union ccb *start_ccb) { u_int32_t timeout; @@ -3729,6 +3736,7 @@ static struct xpt_xport xport_default = { .alloc_device = xpt_alloc_device_default, .action = xpt_action_default, + .done = xpt_done_default, .async = xpt_dev_async_default, }; @@ -4999,8 +5007,8 @@ xpt_run_dev_sendq(ccb_h->path->bus); } - /* Call the peripheral driver's callback */ - (*ccb_h->cbfcnp)(ccb_h->path->periph, (union ccb *)ccb_h); + /* Call the XPT's callback */ + (*(ccb_h->path->bus->xport->done))((union ccb *)ccb_h); } } ==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.h#18 (text+ko) ==== @@ -87,6 +87,7 @@ void xpt_action(union ccb *new_ccb); void xpt_action_default(union ccb *new_ccb); +void xpt_done_default(union ccb *new_ccb); void xpt_setup_ccb(struct ccb_hdr *ccb_h, struct cam_path *path, u_int32_t priority); ==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt_internal.h#8 (text+ko) ==== @@ -41,6 +41,7 @@ struct cam_et *target, struct cam_ed *device); typedef void (*xpt_action_func)(union ccb *start_ccb); +typedef void (*xpt_done_func)(union ccb *done_ccb); typedef void (*xpt_dev_async_func)(u_int32_t async_code, struct cam_eb *bus, struct cam_et *target, @@ -53,6 +54,7 @@ xpt_alloc_device_func alloc_device; xpt_release_device_func reldev; xpt_action_func action; + xpt_done_func done; xpt_dev_async_func async; xpt_announce_periph_func announce; }; ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_xpt.c#17 (text+ko) ==== @@ -555,6 +555,7 @@ static struct xpt_xport scsi_xport = { .alloc_device = scsi_alloc_device, .action = scsi_action, + .done = xpt_done_default, .async = scsi_dev_async, };