umass: enhance debugging
Investigating a hang I found having some more error information available would be helpful, so be more verbose and also tell cam/xpt status in case of error/panic. Reviewed by: hselasky MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26287
This commit is contained in:
parent
ed75ef34d4
commit
a16e001bd9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=365335
@ -2063,6 +2063,7 @@ static int
|
||||
umass_cam_attach_sim(struct umass_softc *sc)
|
||||
{
|
||||
struct cam_devq *devq; /* Per device Queue */
|
||||
cam_status status;
|
||||
|
||||
/*
|
||||
* A HBA is attached to the CAM layer.
|
||||
@ -2091,11 +2092,12 @@ umass_cam_attach_sim(struct umass_softc *sc)
|
||||
}
|
||||
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
|
||||
if (xpt_bus_register(sc->sc_sim, sc->sc_dev,
|
||||
sc->sc_unit) != CAM_SUCCESS) {
|
||||
status = xpt_bus_register(sc->sc_sim, sc->sc_dev, sc->sc_unit);
|
||||
if (status != CAM_SUCCESS) {
|
||||
cam_sim_free(sc->sc_sim, /* free_devq */ TRUE);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
printf("%s: xpt_bus_register failed with status %#x\n",
|
||||
__func__, status);
|
||||
return (ENOMEM);
|
||||
}
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
@ -2121,14 +2123,22 @@ umass_cam_attach(struct umass_softc *sc)
|
||||
static void
|
||||
umass_cam_detach_sim(struct umass_softc *sc)
|
||||
{
|
||||
cam_status status;
|
||||
|
||||
if (sc->sc_sim != NULL) {
|
||||
if (xpt_bus_deregister(cam_sim_path(sc->sc_sim))) {
|
||||
status = xpt_bus_deregister(cam_sim_path(sc->sc_sim));
|
||||
if (status == CAM_REQ_CMP) {
|
||||
/* accessing the softc is not possible after this */
|
||||
sc->sc_sim->softc = NULL;
|
||||
DPRINTF(sc, UDMASS_SCSI, "%s: %s:%d:%d caling "
|
||||
"cam_sim_free sim %p refc %u mtx %p\n",
|
||||
__func__, sc->sc_name, cam_sim_path(sc->sc_sim),
|
||||
sc->sc_unit, sc->sc_sim,
|
||||
sc->sc_sim->refcount, sc->sc_sim->mtx);
|
||||
cam_sim_free(sc->sc_sim, /* free_devq */ TRUE);
|
||||
} else {
|
||||
panic("%s: CAM layer is busy\n",
|
||||
sc->sc_name);
|
||||
panic("%s: %s: CAM layer is busy: %#x\n",
|
||||
__func__, sc->sc_name, status);
|
||||
}
|
||||
sc->sc_sim = NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user