From owner-svn-src-stable@FreeBSD.ORG Sat Jul 6 23:05:00 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3796B835; Sat, 6 Jul 2013 23:05:00 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2972E191E; Sat, 6 Jul 2013 23:05:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r66N50k4043913; Sat, 6 Jul 2013 23:05:00 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r66N4xek043897; Sat, 6 Jul 2013 23:04:59 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201307062304.r66N4xek043897@svn.freebsd.org> From: Xin LI Date: Sat, 6 Jul 2013 23:04:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252902 - stable/9/sys/dev/hpt27xx X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Jul 2013 23:05:00 -0000 Author: delphij Date: Sat Jul 6 23:04:59 2013 New Revision: 252902 URL: http://svnweb.freebsd.org/changeset/base/252902 Log: MFC r252852: Update hpt27xx(4) driver to address a problem reported by FreeNAS user, where when more than one hpt27xx adapters are being used, the "unit number" stays at 0. Many thanks to HighPoint for providing this driver update. (This changeset have not included change found in 249468) Modified: stable/9/sys/dev/hpt27xx/hpt27xx_config.c stable/9/sys/dev/hpt27xx/osm_bsd.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/hpt27xx/hpt27xx_config.c ============================================================================== --- stable/9/sys/dev/hpt27xx/hpt27xx_config.c Sat Jul 6 22:51:56 2013 (r252901) +++ stable/9/sys/dev/hpt27xx/hpt27xx_config.c Sat Jul 6 23:04:59 2013 (r252902) @@ -60,7 +60,7 @@ int init_config(void) const char driver_name[] = "hpt27xx"; const char driver_name_long[] = "RocketRAID 27xx controller driver"; -const char driver_ver[] = "v1.0"; +const char driver_ver[] = "v1.1"; int osm_max_targets = 0xff; Modified: stable/9/sys/dev/hpt27xx/osm_bsd.c ============================================================================== --- stable/9/sys/dev/hpt27xx/osm_bsd.c Sat Jul 6 22:51:56 2013 (r252901) +++ stable/9/sys/dev/hpt27xx/osm_bsd.c Sat Jul 6 23:04:59 2013 (r252902) @@ -944,7 +944,6 @@ static void hpt_stop_tasks(PVBUS_EXT vbu static d_open_t hpt_open; static d_close_t hpt_close; static d_ioctl_t hpt_ioctl; -static void hpt_bus_scan_cb(struct cam_periph *periph, union ccb *ccb); static int hpt_rescan_bus(void); static struct cdevsw hpt_cdevsw = { @@ -974,7 +973,7 @@ static struct intr_config_hook hpt_ich; */ static void hpt_final_init(void *dummy) { - int i; + int i,unit_number=0; PVBUS_EXT vbus_ext; PVBUS vbus; PHBA hba; @@ -1058,12 +1057,12 @@ static void hpt_final_init(void *dummy) #if __FreeBSD_version > 700025 vbus_ext->sim = cam_sim_alloc(hpt_action, hpt_poll, driver_name, - vbus_ext, 0, &Giant, os_max_queue_comm, /*tagged*/8, devq); + vbus_ext, unit_number, &Giant, os_max_queue_comm, /*tagged*/8, devq); #else vbus_ext->sim = cam_sim_alloc(hpt_action, hpt_poll, driver_name, - vbus_ext, 0, os_max_queue_comm, /*tagged*/8, devq); + vbus_ext, unit_number, os_max_queue_comm, /*tagged*/8, devq); #endif - + unit_number++; if (!vbus_ext->sim) { os_printk("cam_sim_alloc failed"); cam_simq_free(devq); @@ -1337,44 +1336,26 @@ invalid: static int hpt_rescan_bus(void) { - struct cam_path *path; union ccb *ccb; PVBUS vbus; PVBUS_EXT vbus_ext; -#if (__FreeBSD_version >= 500000) mtx_lock(&Giant); -#endif ldm_for_each_vbus(vbus, vbus_ext) { - if (xpt_create_path(&path, xpt_periph, cam_sim_path(vbus_ext->sim), + if ((ccb = xpt_alloc_ccb()) == NULL) + { + return(ENOMEM); + } + if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(vbus_ext->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) + { + xpt_free_ccb(ccb); return(EIO); - if ((ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK)) == NULL) - return(ENOMEM); - bzero(ccb, sizeof(union ccb)); - xpt_setup_ccb(&ccb->ccb_h, path, 5); - ccb->ccb_h.func_code = XPT_SCAN_BUS; - ccb->ccb_h.cbfcnp = hpt_bus_scan_cb; - ccb->crcn.flags = CAM_FLAG_NONE; - xpt_action(ccb); + } + xpt_rescan(ccb); } - -#if (__FreeBSD_version >= 500000) mtx_unlock(&Giant); -#endif - return(0); } -static void hpt_bus_scan_cb(struct cam_periph *periph, union ccb *ccb) -{ - if (ccb->ccb_h.status != CAM_REQ_CMP) - KdPrint(("cam_scan_callback: failure status = %x",ccb->ccb_h.status)); - else - KdPrint(("Scan bus successfully!")); - - xpt_free_path(ccb->ccb_h.path); - free(ccb, M_TEMP); - return; -}