From owner-freebsd-scsi Wed Mar 29 1:56:32 2000 Delivered-To: freebsd-scsi@freebsd.org Received: from bluebottle.calcaphon.com (calcaphon.demon.co.uk [193.237.19.5]) by hub.freebsd.org (Postfix) with ESMTP id 0BBA737BC3C for ; Wed, 29 Mar 2000 01:56:26 -0800 (PST) (envelope-from n_hibma@calcaphon.com) Received: from henny.calcaphon.com (henny.calcaphon.com [10.0.0.36]) by bluebottle.calcaphon.com (8.9.3/8.9.1) with ESMTP id LAA53999 for ; Wed, 29 Mar 2000 11:01:16 +0100 (BST) (envelope-from n_hibma@calcaphon.com) Date: Wed, 29 Mar 2000 10:53:52 +0100 (BST) From: Nick Hibma X-Sender: n_hibma@localhost Reply-To: Nick Hibma To: FreeBSD SCSI Mailing List Subject: Re: Bus rescan (second try) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Ken, Justin, Sorry for the rerun. After checking the archives again, I don't expect anyone to have a better answer this time round, so I'll just propose a patch. It makes xpt_periph a kernel global variable. Let me know whether this is acceptable, and if not, how else to get a pointer to the peripheral for the bus to be scanned. xpt_done (and subroutines after that, require periph to be set in the path). Nick Index: cam_periph.h =================================================================== RCS file: /home/ncvs/src/sys/cam/cam_periph.h,v retrieving revision 1.7 diff -u -r1.7 cam_periph.h --- cam_periph.h 2000/03/15 21:55:46 1.7 +++ cam_periph.h 2000/03/29 09:48:11 @@ -35,6 +35,8 @@ #ifdef _KERNEL +struct cam_periph *xpt_periph; + extern struct linker_set periphdriver_set; typedef void (periph_init_t)(void); /* Index: cam_xpt.c =================================================================== RCS file: /home/ncvs/src/sys/cam/cam_xpt.c,v retrieving revision 1.81 diff -u -r1.81 cam_xpt.c --- cam_xpt.c 2000/03/15 21:55:46 1.81 +++ cam_xpt.c 2000/03/29 09:46:22 @@ -528,7 +528,7 @@ */ static u_int xpt_ccb_count; /* Current count of allocated ccbs */ -static struct cam_periph *xpt_periph; +struct cam_periph *xpt_periph; static periph_init_t xpt_periph_init; On Tue, 28 Mar 2000, Nick Hibma wrote: > > The fragment below is intended to rescan the bus on connection of a > device. The problem is that cam_periph_find always returns NULL, because > a SIM does not seem to have a periph. > > An option would be to make xpt_periph available in cam_periph.h. Or > someone telling me how to do the rescan on connection of a drive. > > I think I've tried everything imaginable. > > Nick > > > /* Create a path and lookup the peripheral for the SIM */ > if (xpt_create_path(&path, NULL, cam_sim_path(umass_sim), > UMASS_SCSIID_HOST, 0) > != CAM_REQ_CMP) > return; > periph = cam_periph_find(path, DEVNAME); > if (periph == NULL) { > DPRINTF(UDMASS_SCSI, ("%s:%d:%d:%d: no periph\n", > USBDEVNAME(sc->sc_dev), cam_sim_path(umass_sim), > device_get_unit(sc->sc_dev), 0)); > xpt_free_path(path); > return; > } > xpt_free_path(path); > > /* Lookup the path again, but now include the periph in the path*/ > if (xpt_create_path(&path, periph, cam_sim_path(umass_sim), > UMASS_SCSIID_HOST, 0) > != CAM_REQ_CMP) > return; > > xpt_setup_ccb(&ccb->ccb_h, path, 5/*priority (low)*/); > ccb->ccb_h.func_code = XPT_SCAN_BUS; > ccb->ccb_h.cbfcnp = umass_cam_rescan_callback; > ccb->crcn.flags = CAM_FLAG_NONE; > xpt_action(ccb); > > > -- > n_hibma@webweaving.org > n_hibma@freebsd.org USB project > http://www.etla.net/~n_hibma/ > > > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-scsi" in the body of the message > -- n_hibma@webweaving.org n_hibma@freebsd.org USB project http://www.etla.net/~n_hibma/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message