PERFORCE change 173269 for review
Alexander Motin
mav at FreeBSD.org
Sun Jan 17 14:44:18 UTC 2010
http://p4web.freebsd.org/chv.cgi?CH=173269
Change 173269 by mav at mav_mavtest on 2010/01/17 14:43:23
Remove unneeded now bus scans and unify the reset.
Affected files ...
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.h#21 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt_periph.h#13 edit
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_low.c#19 edit
.. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#93 edit
.. //depot/projects/scottl-camlock/src/sys/dev/asr/asr.c#16 edit
.. //depot/projects/scottl-camlock/src/sys/dev/ata/atapi-cam.c#22 edit
.. //depot/projects/scottl-camlock/src/sys/dev/ciss/ciss.c#25 edit
.. //depot/projects/scottl-camlock/src/sys/dev/hptiop/hptiop.c#6 edit
.. //depot/projects/scottl-camlock/src/sys/dev/hptrr/hptrr_osm_bsd.c#4 edit
.. //depot/projects/scottl-camlock/src/sys/dev/hptrr/os_bsd.h#2 edit
.. //depot/projects/scottl-camlock/src/sys/dev/isp/isp_freebsd.h#22 edit
.. //depot/projects/scottl-camlock/src/sys/dev/mly/mly.c#15 edit
.. //depot/projects/scottl-camlock/src/sys/dev/mpt/mpt_cam.h#7 edit
.. //depot/projects/scottl-camlock/src/sys/dev/mpt/mpt_raid.c#19 edit
.. //depot/projects/scottl-camlock/src/sys/dev/siis/siis.c#33 edit
.. //depot/projects/scottl-camlock/src/sys/dev/trm/trm.c#15 edit
.. //depot/projects/scottl-camlock/src/sys/dev/twa/tw_osl_cam.c#11 edit
Differences ...
==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.h#21 (text+ko) ====
@@ -87,6 +87,9 @@
void xpt_action(union ccb *new_ccb);
void xpt_action_default(union ccb *new_ccb);
+union ccb *xpt_alloc_ccb(void);
+union ccb *xpt_alloc_ccb_nowait(void);
+void xpt_free_ccb(union ccb *free_ccb);
void xpt_setup_ccb(struct ccb_hdr *ccb_h,
struct cam_path *path,
u_int32_t priority);
==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt_periph.h#13 (text+ko) ====
@@ -39,9 +39,6 @@
/* Functions accessed by the peripheral drivers */
#ifdef _KERNEL
void xpt_polled_action(union ccb *ccb);
-union ccb *xpt_alloc_ccb(void);
-union ccb *xpt_alloc_ccb_nowait(void);
-void xpt_free_ccb(union ccb *free_ccb);
void xpt_release_ccb(union ccb *released_ccb);
void xpt_schedule(struct cam_periph *perph, u_int32_t new_priority);
int32_t xpt_add_periph(struct cam_periph *periph);
==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_low.c#19 (text+ko) ====
@@ -895,8 +895,6 @@
#define SCSI_LOW_ALLOC_CCB(flags) scsi_low_get_ccb()
static void scsi_low_poll_cam(struct cam_sim *);
-static void scsi_low_cam_rescan_callback(struct cam_periph *, union ccb *);
-static void scsi_low_rescan_bus_cam(struct scsi_low_softc *);
void scsi_low_scsi_action_cam(struct cam_sim *, union ccb *);
static int scsi_low_attach_cam(struct scsi_low_softc *);
@@ -954,38 +952,6 @@
}
}
-static void
-scsi_low_cam_rescan_callback(periph, ccb)
- struct cam_periph *periph;
- union ccb *ccb;
-{
-
- xpt_free_path(ccb->ccb_h.path);
- xpt_free_ccb(ccb);
-}
-
-static void
-scsi_low_rescan_bus_cam(slp)
- struct scsi_low_softc *slp;
-{
- struct cam_path *path;
- union ccb *ccb;
- cam_status status;
-
- status = xpt_create_path(&path, xpt_periph,
- cam_sim_path(slp->sl_si.sim), -1, 0);
- if (status != CAM_REQ_CMP)
- return;
-
- ccb = xpt_alloc_ccb();
- bzero(ccb, sizeof(union ccb));
- xpt_setup_ccb(&ccb->ccb_h, path, CAM_PRIORITY_XPT);
- ccb->ccb_h.func_code = XPT_SCAN_BUS;
- ccb->ccb_h.cbfcnp = scsi_low_cam_rescan_callback;
- ccb->crcn.flags = CAM_FLAG_NONE;
- xpt_action(ccb);
-}
-
void
scsi_low_scsi_action_cam(sim, ccb)
struct cam_sim *sim;
@@ -1376,8 +1342,6 @@
struct scsi_low_softc *slp;
{
- if (!cold)
- scsi_low_rescan_bus_cam(slp);
return 0;
}
==== //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#93 (text+ko) ====
@@ -52,7 +52,6 @@
#include <cam/cam_ccb.h>
#include <cam/cam_sim.h>
#include <cam/cam_xpt_sim.h>
-#include <cam/cam_xpt_periph.h>
#include <cam/cam_debug.h>
/* local prototypes */
==== //depot/projects/scottl-camlock/src/sys/dev/asr/asr.c#16 (text+ko) ====
@@ -130,7 +130,6 @@
#include <cam/cam_ccb.h>
#include <cam/cam_sim.h>
#include <cam/cam_xpt_sim.h>
-#include <cam/cam_xpt_periph.h>
#include <cam/scsi/scsi_all.h>
#include <cam/scsi/scsi_message.h>
==== //depot/projects/scottl-camlock/src/sys/dev/ata/atapi-cam.c#22 (text+ko) ====
@@ -48,7 +48,6 @@
#include <cam/cam_periph.h>
#include <cam/cam_sim.h>
#include <cam/cam_xpt_sim.h>
-#include <cam/cam_xpt_periph.h>
#include <cam/cam_debug.h>
#include <cam/scsi/scsi_all.h>
@@ -109,7 +108,6 @@
/* internal functions */
static void reinit_bus(struct atapi_xpt_softc *scp, enum reinit_reason reason);
static void setup_async_cb(struct atapi_xpt_softc *, uint32_t);
-static void cam_rescan_callback(struct cam_periph *, union ccb *);
static void cam_rescan(struct cam_sim *);
static void free_hcb_and_ccb_done(struct atapi_hcb *, u_int32_t);
static struct atapi_hcb *allocate_hcb(struct atapi_xpt_softc *, int, int, union ccb *);
@@ -821,41 +819,20 @@
}
static void
-cam_rescan_callback(struct cam_periph *periph, union ccb *ccb)
-{
- if (ccb->ccb_h.status != CAM_REQ_CMP) {
- CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE,
- ("Rescan failed, 0x%04x\n", ccb->ccb_h.status));
- } else {
- CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE,
- ("Rescan succeeded\n"));
- }
- xpt_free_path(ccb->ccb_h.path);
- xpt_free_ccb(ccb);
-}
-
-static void
cam_rescan(struct cam_sim *sim)
{
- struct cam_path *path;
union ccb *ccb;
ccb = xpt_alloc_ccb_nowait();
if (ccb == NULL)
return;
-
- if (xpt_create_path(&path, xpt_periph, cam_sim_path(sim),
+ if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sim),
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
xpt_free_ccb(ccb);
return;
}
-
- CAM_DEBUG(path, CAM_DEBUG_TRACE, ("Rescanning ATAPI bus.\n"));
- xpt_setup_ccb(&ccb->ccb_h, path, 5/*priority (low)*/);
- ccb->ccb_h.func_code = XPT_SCAN_BUS;
- ccb->ccb_h.cbfcnp = cam_rescan_callback;
- ccb->crcn.flags = CAM_FLAG_NONE;
- xpt_action(ccb);
+ CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("Rescanning ATAPI bus.\n"));
+ xpt_rescan(ccb);
/* scan is in progress now */
}
==== //depot/projects/scottl-camlock/src/sys/dev/ciss/ciss.c#25 (text+ko) ====
@@ -173,8 +173,6 @@
static int ciss_cam_init(struct ciss_softc *sc);
static void ciss_cam_rescan_target(struct ciss_softc *sc,
int bus, int target);
-static void ciss_cam_rescan_all(struct ciss_softc *sc);
-static void ciss_cam_rescan_callback(struct cam_periph *periph, union ccb *ccb);
static void ciss_cam_action(struct cam_sim *sim, union ccb *ccb);
static int ciss_cam_action_io(struct cam_sim *sim, struct ccb_scsiio *csio);
static int ciss_cam_emulate(struct ciss_softc *sc, struct ccb_scsiio *csio);
@@ -2863,13 +2861,6 @@
mtx_unlock(&sc->ciss_mtx);
}
- /*
- * Initiate a rescan of the bus.
- */
- mtx_lock(&sc->ciss_mtx);
- ciss_cam_rescan_all(sc);
- mtx_unlock(&sc->ciss_mtx);
-
return(0);
}
@@ -2879,53 +2870,26 @@
static void
ciss_cam_rescan_target(struct ciss_softc *sc, int bus, int target)
{
- struct cam_path *path;
union ccb *ccb;
debug_called(1);
- if ((ccb = malloc(sizeof(union ccb), CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO)) == NULL) {
+ if ((ccb = xpt_alloc_ccb_nowait()) == NULL) {
ciss_printf(sc, "rescan failed (can't allocate CCB)\n");
return;
}
- if (xpt_create_path(&path, xpt_periph, cam_sim_path(sc->ciss_cam_sim[bus]),
- target, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
+ if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
+ cam_sim_path(sc->ciss_cam_sim[bus]),
+ target, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
ciss_printf(sc, "rescan failed (can't create path)\n");
- free(ccb, CISS_MALLOC_CLASS);
+ xpt_free_ccb(ccb);
return;
}
-
- xpt_setup_ccb(&ccb->ccb_h, path, 5/*priority (low)*/);
- ccb->ccb_h.func_code = XPT_SCAN_BUS;
- ccb->ccb_h.cbfcnp = ciss_cam_rescan_callback;
- ccb->crcn.flags = CAM_FLAG_NONE;
- xpt_action(ccb);
-
+ xpt_rescan(ccb);
/* scan is now in progress */
}
-static void
-ciss_cam_rescan_all(struct ciss_softc *sc)
-{
- int i;
-
- /* Rescan the logical buses */
- for (i = 0; i < sc->ciss_max_logical_bus; i++)
- ciss_cam_rescan_target(sc, i, CAM_TARGET_WILDCARD);
- /* Rescan the physical buses */
- for (i = CISS_PHYSICAL_BASE; i < sc->ciss_max_physical_bus +
- CISS_PHYSICAL_BASE; i++)
- ciss_cam_rescan_target(sc, i, CAM_TARGET_WILDCARD);
-}
-
-static void
-ciss_cam_rescan_callback(struct cam_periph *periph, union ccb *ccb)
-{
- xpt_free_path(ccb->ccb_h.path);
- free(ccb, CISS_MALLOC_CLASS);
-}
-
/************************************************************************
* Handle requests coming from CAM
*/
==== //depot/projects/scottl-camlock/src/sys/dev/hptiop/hptiop.c#6 (text+ko) ====
@@ -79,7 +79,6 @@
#include <cam/cam_sim.h>
#include <cam/cam_xpt_sim.h>
#include <cam/cam_debug.h>
-#include <cam/cam_xpt_periph.h>
#include <cam/cam_periph.h>
#include <cam/scsi/scsi_all.h>
#include <cam/scsi/scsi_message.h>
@@ -105,7 +104,6 @@
struct hpt_iop_ioctl_param *pParams);
static int hptiop_do_ioctl_mv(struct hpt_iop_hba *hba,
struct hpt_iop_ioctl_param *pParams);
-static void hptiop_bus_scan_cb(struct cam_periph *periph, union ccb *ccb);
static int hptiop_rescan_bus(struct hpt_iop_hba *hba);
static int hptiop_alloc_pci_res_itl(struct hpt_iop_hba *hba);
static int hptiop_alloc_pci_res_mv(struct hpt_iop_hba *hba);
@@ -1035,28 +1033,19 @@
static int hptiop_rescan_bus(struct hpt_iop_hba * hba)
{
- struct cam_path *path;
union ccb *ccb;
- if (xpt_create_path(&path, xpt_periph, cam_sim_path(hba->sim),
- CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP)
+
+ if ((ccb = xpt_alloc_ccb()) == NULL)
+ return(ENOMEM);
+ if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(hba->sim),
+ CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
+ xpt_free_ccb(ccb);
return(EIO);
- if ((ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK)) == NULL)
- return(ENOMEM);
- bzero(ccb, sizeof(union ccb));
- xpt_setup_ccb(&ccb->ccb_h, path, 5);
- ccb->ccb_h.func_code = XPT_SCAN_BUS;
- ccb->ccb_h.cbfcnp = hptiop_bus_scan_cb;
- ccb->crcn.flags = CAM_FLAG_NONE;
- xpt_action(ccb);
+ }
+ xpt_rescan(ccb);
return(0);
}
-static void hptiop_bus_scan_cb(struct cam_periph *periph, union ccb *ccb)
-{
- xpt_free_path(ccb->ccb_h.path);
- free(ccb, M_TEMP);
-}
-
static bus_dmamap_callback_t hptiop_map_srb;
static bus_dmamap_callback_t hptiop_post_scsi_command;
static bus_dmamap_callback_t hptiop_mv_map_ctlcfg;
==== //depot/projects/scottl-camlock/src/sys/dev/hptrr/hptrr_osm_bsd.c#4 (text+ko) ====
@@ -989,7 +989,6 @@
static d_open_t hpt_open;
static d_close_t hpt_close;
static d_ioctl_t hpt_ioctl;
-static void hpt_bus_scan_cb(struct cam_periph *periph, union ccb *ccb);
static int hpt_rescan_bus(void);
static struct cdevsw hpt_cdevsw = {
@@ -1381,7 +1380,6 @@
static int hpt_rescan_bus(void)
{
- struct cam_path *path;
union ccb *ccb;
PVBUS vbus;
PVBUS_EXT vbus_ext;
@@ -1391,17 +1389,15 @@
#endif
ldm_for_each_vbus(vbus, vbus_ext) {
- if (xpt_create_path(&path, xpt_periph, cam_sim_path(vbus_ext->sim),
- CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP)
+ if ((ccb = xpt_alloc_ccb()) == NULL)
+ return(ENOMEM);
+ if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
+ cam_sim_path(vbus_ext->sim),
+ CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
+ xpt_free_ccb(ccb);
return(EIO);
- if ((ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK)) == NULL)
- return(ENOMEM);
- bzero(ccb, sizeof(union ccb));
- xpt_setup_ccb(&ccb->ccb_h, path, 5);
- ccb->ccb_h.func_code = XPT_SCAN_BUS;
- ccb->ccb_h.cbfcnp = hpt_bus_scan_cb;
- ccb->crcn.flags = CAM_FLAG_NONE;
- xpt_action(ccb);
+ }
+ xpt_rescan(ccb);
}
#if (__FreeBSD_version >= 500000)
@@ -1410,15 +1406,3 @@
return(0);
}
-
-static void hpt_bus_scan_cb(struct cam_periph *periph, union ccb *ccb)
-{
- if (ccb->ccb_h.status != CAM_REQ_CMP)
- KdPrint(("cam_scan_callback: failure status = %x",ccb->ccb_h.status));
- else
- KdPrint(("Scan bus successfully!"));
-
- xpt_free_path(ccb->ccb_h.path);
- free(ccb, M_TEMP);
- return;
-}
==== //depot/projects/scottl-camlock/src/sys/dev/hptrr/os_bsd.h#2 (text+ko) ====
@@ -91,7 +91,6 @@
#include <cam/cam_sim.h>
#include <cam/cam_xpt_sim.h>
#include <cam/cam_debug.h>
-#include <cam/cam_xpt_periph.h>
#include <cam/cam_periph.h>
#include <cam/scsi/scsi_all.h>
#include <cam/scsi/scsi_message.h>
==== //depot/projects/scottl-camlock/src/sys/dev/isp/isp_freebsd.h#22 (text+ko) ====
==== //depot/projects/scottl-camlock/src/sys/dev/mly/mly.c#15 (text+ko) ====
@@ -101,7 +101,6 @@
static int mly_cam_attach(struct mly_softc *sc);
static void mly_cam_detach(struct mly_softc *sc);
static void mly_cam_rescan_btl(struct mly_softc *sc, int bus, int target);
-static void mly_cam_rescan_callback(struct cam_periph *periph, union ccb *ccb);
static void mly_cam_action(struct cam_sim *sim, union ccb *ccb);
static int mly_cam_action_io(struct cam_sim *sim, struct ccb_scsiio *csio);
static void mly_cam_poll(struct cam_sim *sim);
@@ -2017,29 +2016,18 @@
debug_called(1);
- if ((ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK | M_ZERO)) == NULL) {
+ if ((ccb = xpt_alloc_ccb()) == NULL) {
mly_printf(sc, "rescan failed (can't allocate CCB)\n");
return;
}
-
- if (xpt_create_path(&sc->mly_cam_path, xpt_periph,
- cam_sim_path(sc->mly_cam_sim[bus]), target, 0) != CAM_REQ_CMP) {
+ if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
+ cam_sim_path(sc->mly_cam_sim[bus]), target, 0) != CAM_REQ_CMP) {
mly_printf(sc, "rescan failed (can't create path)\n");
- free(ccb, M_TEMP);
+ xpt_free_ccb(ccb);
return;
}
- xpt_setup_ccb(&ccb->ccb_h, sc->mly_cam_path, 5/*priority (low)*/);
- ccb->ccb_h.func_code = XPT_SCAN_LUN;
- ccb->ccb_h.cbfcnp = mly_cam_rescan_callback;
- ccb->crcn.flags = CAM_FLAG_NONE;
debug(1, "rescan target %d:%d", bus, target);
- xpt_action(ccb);
-}
-
-static void
-mly_cam_rescan_callback(struct cam_periph *periph, union ccb *ccb)
-{
- free(ccb, M_TEMP);
+ xpt_rescan(ccb);
}
/********************************************************************************
==== //depot/projects/scottl-camlock/src/sys/dev/mpt/mpt_cam.h#7 (text+ko) ====
@@ -102,7 +102,6 @@
#include <cam/cam_sim.h>
#include <cam/cam_xpt.h>
#include <cam/cam_periph.h>
-#include <cam/cam_xpt_periph.h>
#include <cam/cam_xpt_sim.h>
#include <cam/cam_debug.h>
#include <cam/scsi/scsi_all.h>
==== //depot/projects/scottl-camlock/src/sys/dev/mpt/mpt_raid.c#19 (text+ko) ====
@@ -52,7 +52,6 @@
#include <cam/cam.h>
#include <cam/cam_ccb.h>
#include <cam/cam_sim.h>
-#include <cam/cam_xpt_periph.h>
#include <cam/cam_xpt_sim.h>
#if __FreeBSD_version < 500000
@@ -656,14 +655,6 @@
}
static void
-mpt_cam_rescan_callback(struct cam_periph *periph, union ccb *ccb)
-{
-
- xpt_free_path(ccb->ccb_h.path);
- xpt_free_ccb(ccb);
-}
-
-static void
mpt_raid_thread(void *arg)
{
struct mpt_softc *mpt;
@@ -715,13 +706,7 @@
xpt_free_ccb(ccb);
mpt_prt(mpt, "Unable to rescan RAID Bus!\n");
} else {
- xpt_setup_ccb(&ccb->ccb_h, path, 5);
- ccb->ccb_h.func_code = XPT_SCAN_BUS;
- ccb->ccb_h.cbfcnp = mpt_cam_rescan_callback;
- ccb->crcn.flags = CAM_FLAG_NONE;
- MPTLOCK_2_CAMLOCK(mpt);
- xpt_action(ccb);
- CAMLOCK_2_MPTLOCK(mpt);
+ xpt_rescan(ccb);
}
}
}
==== //depot/projects/scottl-camlock/src/sys/dev/siis/siis.c#33 (text+ko) ====
@@ -52,7 +52,6 @@
#include <cam/cam_ccb.h>
#include <cam/cam_sim.h>
#include <cam/cam_xpt_sim.h>
-#include <cam/cam_xpt_periph.h>
#include <cam/cam_debug.h>
/* local prototypes */
==== //depot/projects/scottl-camlock/src/sys/dev/trm/trm.c#15 (text+ko) ====
@@ -810,15 +810,6 @@
xpt_done(pccb);
break;
/*
- * Scan Logical Unit
- */
- case XPT_SCAN_LUN:
- TRM_DPRINTF(" XPT_SCAN_LUN \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
-
- /*
* Get/Set transfer rate/width/disconnection/tag queueing
* settings
* (GET) default/user transfer settings for the target
==== //depot/projects/scottl-camlock/src/sys/dev/twa/tw_osl_cam.c#11 (text+ko) ====
@@ -56,7 +56,6 @@
static TW_VOID twa_action(struct cam_sim *sim, union ccb *ccb);
static TW_VOID twa_poll(struct cam_sim *sim);
static TW_VOID twa_timeout(TW_VOID *arg);
-static TW_VOID twa_bus_scan_cb(struct cam_periph *periph, union ccb *ccb);
static TW_INT32 tw_osli_execute_scsi(struct tw_osli_req_context *req,
union ccb *ccb);
@@ -76,7 +75,6 @@
tw_osli_cam_attach(struct twa_softc *sc)
{
struct cam_devq *devq;
- TW_INT32 error;
tw_osli_dbg_dprintf(3, sc, "entered");
@@ -149,23 +147,8 @@
mtx_unlock(sc->sim_lock);
return(ENXIO);
}
-
- tw_osli_dbg_dprintf(3, sc, "Calling xpt_setup_ccb");
mtx_unlock(sc->sim_lock);
- tw_osli_dbg_dprintf(3, sc, "Calling tw_osli_request_bus_scan");
- /*
- * Request a bus scan, so that CAM gets to know of
- * the logical units that we control.
- */
- if ((error = tw_osli_request_bus_scan(sc)))
- tw_osli_printf(sc, "error = %d",
- TW_CL_SEVERITY_ERROR_STRING,
- TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER,
- 0x2104,
- "Bus scan request to CAM failed",
- error);
-
tw_osli_dbg_dprintf(3, sc, "exiting");
return(0);
}
@@ -561,7 +544,6 @@
TW_INT32
tw_osli_request_bus_scan(struct twa_softc *sc)
{
- struct cam_path *path;
union ccb *ccb;
tw_osli_dbg_dprintf(3, sc, "entering");
@@ -569,13 +551,12 @@
/* If we get here before sc->sim is initialized, return an error. */
if (!(sc->sim))
return(ENXIO);
- if ((ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK)) == NULL)
+ if ((ccb = xpt_alloc_ccb()) == NULL)
return(ENOMEM);
- bzero(ccb, sizeof(union ccb));
mtx_lock(sc->sim_lock);
- if (xpt_create_path(&path, xpt_periph, cam_sim_path(sc->sim),
- CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
- free(ccb, M_TEMP);
+ if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sc->sim),
+ CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
+ xpt_free_ccb(ccb);
mtx_unlock(sc->sim_lock);
return(EIO);
}
@@ -586,11 +567,7 @@
sc->state &= ~TW_OSLI_CTLR_STATE_SIMQ_FROZEN;
}
- xpt_setup_ccb(&ccb->ccb_h, path, 5);
- ccb->ccb_h.func_code = XPT_SCAN_BUS;
- ccb->ccb_h.cbfcnp = twa_bus_scan_cb;
- ccb->crcn.flags = CAM_FLAG_NONE;
- xpt_action(ccb);
+ xpt_rescan(ccb);
mtx_unlock(sc->sim_lock);
return(0);
}
@@ -598,32 +575,6 @@
/*
- * Function name: twa_bus_scan_cb
- * Description: Callback from CAM on a bus scan request.
- *
- * Input: periph -- we don't use this
- * ccb -- bus scan request ccb that we sent to CAM
- * Output: None
- * Return value: None
- */
-static TW_VOID
-twa_bus_scan_cb(struct cam_periph *periph, union ccb *ccb)
-{
- tw_osli_dbg_printf(3, "entering");
-
- if (ccb->ccb_h.status != CAM_REQ_CMP)
- printf("cam_scan_callback: failure status = %x\n",
- ccb->ccb_h.status);
- else
- tw_osli_dbg_printf(3, "success");
-
- xpt_free_path(ccb->ccb_h.path);
- free(ccb, M_TEMP);
-}
-
-
-
-/*
* Function name: tw_osli_allow_new_requests
* Description: Sets the appropriate status bits in a ccb such that,
* when the ccb is completed by a call to xpt_done,
More information about the p4-projects
mailing list