From owner-freebsd-scsi Fri Jun 22 12: 9:52 2001 Delivered-To: freebsd-scsi@freebsd.org Received: from beppo.feral.com (beppo.feral.com [192.67.166.79]) by hub.freebsd.org (Postfix) with ESMTP id 00C8937B403 for ; Fri, 22 Jun 2001 12:09:49 -0700 (PDT) (envelope-from mjacob@feral.com) Received: from wonky.feral.com (wonky.feral.com [192.67.166.7]) by beppo.feral.com (8.11.3/8.11.3) with ESMTP id f5MJ7Fg75013; Fri, 22 Jun 2001 12:07:15 -0700 (PDT) (envelope-from mjacob@feral.com) Date: Fri, 22 Jun 2001 12:07:09 -0700 (PDT) From: Matthew Jacob Reply-To: To: j mckitrick Cc: Subject: Re: how to invalidate scsi connection to driver module In-Reply-To: <20010622183909.A60256@dogma.freebsd-uk.eu.org> Message-ID: <20010622120232.B20923-100000@wonky.feral.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Fri, 22 Jun 2001, j mckitrick wrote: > > Here is the code for a scsi removable media drive. If this is to become a > module, the cam/scsi attachment must be removed. I have tried calling > cam_sim_free() and xpt_bus_deregister() but when the module is reloaded, the > cam system assigns the next higher minor device number, and then crashes > when accessed. Any ideas here how to reset cam to a state where it knows > nothing about the device? The xpt_bus_deregister is supposed to do an AC_LOST_DEVICE on all attached devices. I don't remember what is supposed to happen to recycle unit numbers.... Take a look at camperiphunit- it really should recycle unit numbers if the old ones have truly gone away. > > > > /* > ** Now tell the generic SCSI layer > ** about our bus. > */ > devq = cam_simq_alloc(/*maxopenings*/1); > /* XXX What about low-level detach on error? */ > if (devq == NULL) > return (ENXIO); > > vpo->sim = cam_sim_alloc(vpo_action, vpo_poll, "vpo", vpo, > device_get_unit(dev), > /*untagged*/1, /*tagged*/0, devq); > if (vpo->sim == NULL) { > cam_simq_free(devq); > return (ENXIO); > } > > if (xpt_bus_register(vpo->sim, /*bus*/0) != CAM_SUCCESS) { > cam_sim_free(vpo->sim, /*free_devq*/TRUE); > return (ENXIO); > } > > /* all went ok */ > > vpo_cam_rescan(vpo); /* have CAM rescan the bus */ > > return (0); > > Jonathon > -- > Microsoft complaining about the source license used by > Linux is like the event horizon calling the kettle black. > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message