diff options
author | simokawa <simokawa@FreeBSD.org> | 2003-09-30 08:03:52 +0000 |
---|---|---|
committer | simokawa <simokawa@FreeBSD.org> | 2003-09-30 08:03:52 +0000 |
commit | fae05dc90805e820f9bc199fede99201428d8e5f (patch) | |
tree | 2fd267e15fa714c861f29d59b782903e0f58fdc2 /sys/cam | |
parent | 182afdad39407a88aff67e978da64be68450891c (diff) | |
download | FreeBSD-src-fae05dc90805e820f9bc199fede99201428d8e5f.zip FreeBSD-src-fae05dc90805e820f9bc199fede99201428d8e5f.tar.gz |
- Pick up a correct path_id for the bus on AC_PATH_REGISTERED.
- Call cam_periph_invalidate() only if the periph is found.
Diffstat (limited to 'sys/cam')
-rw-r--r-- | sys/cam/scsi/scsi_targ_bh.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/cam/scsi/scsi_targ_bh.c b/sys/cam/scsi/scsi_targ_bh.c index 858c1ff..9f5fc1b 100644 --- a/sys/cam/scsi/scsi_targ_bh.c +++ b/sys/cam/scsi/scsi_targ_bh.c @@ -186,14 +186,21 @@ targbhasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg) { struct cam_path *new_path; + struct ccb_pathinq *cpi; + path_id_t bus_path_id; cam_status status; + cpi = (struct ccb_pathinq *)arg; + if (code == AC_PATH_REGISTERED) + bus_path_id = cpi->ccb_h.path_id; + else + bus_path_id = xpt_path_path_id(path); /* * Allocate a peripheral instance for * this target instance. */ status = xpt_create_path(&new_path, NULL, - xpt_path_path_id(path), + bus_path_id, CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); if (status != CAM_REQ_CMP) { printf("targbhasync: Unable to create path " @@ -204,10 +211,6 @@ targbhasync(void *callback_arg, u_int32_t code, switch (code) { case AC_PATH_REGISTERED: { - struct ccb_pathinq *cpi; - - cpi = (struct ccb_pathinq *)arg; - /* Only attach to controllers that support target mode */ if ((cpi->target_sprt & PIT_PROCESSOR) == 0) break; @@ -222,7 +225,10 @@ targbhasync(void *callback_arg, u_int32_t code, } case AC_PATH_DEREGISTERED: { - cam_periph_invalidate(cam_periph_find(new_path, "targbh")); + struct cam_periph *periph; + + if ((periph = cam_periph_find(new_path, "targbh")) != NULL) + cam_periph_invalidate(periph); break; } default: |