Date: Wed, 29 Mar 2000 10:53:52 +0100 (BST) From: Nick Hibma <n_hibma@calcaphon.com> To: FreeBSD SCSI Mailing List <scsi@freebsd.org> Subject: Re: Bus rescan (second try) Message-ID: <Pine.BSF.4.20.0003291049080.1750-100000@localhost> In-Reply-To: <Pine.BSF.4.20.0003281838430.1890-100000@localhost>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.20.0003291049080.1750-100000>