mpt_cam.c (168470) | mpt_cam.c (168752) |
---|---|
1/*- 2 * FreeBSD/CAM specific routines for LSI '909 FC adapters. 3 * FreeBSD Version. 4 * 5 * Copyright (c) 2000, 2001 by Greg Ansley 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 80 unchanged lines hidden (view full) --- 89 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 90 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 91 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 92 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 93 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT 94 * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 95 */ 96#include <sys/cdefs.h> | 1/*- 2 * FreeBSD/CAM specific routines for LSI '909 FC adapters. 3 * FreeBSD Version. 4 * 5 * Copyright (c) 2000, 2001 by Greg Ansley 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 80 unchanged lines hidden (view full) --- 89 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 90 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 91 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 92 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 93 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT 94 * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 95 */ 96#include <sys/cdefs.h> |
97__FBSDID("$FreeBSD: head/sys/dev/mpt/mpt_cam.c 168470 2007-04-07 18:15:52Z mjacob $"); | 97__FBSDID("$FreeBSD: head/sys/dev/mpt/mpt_cam.c 168752 2007-04-15 08:49:19Z scottl $"); |
98 99#include <dev/mpt/mpt.h> 100#include <dev/mpt/mpt_cam.h> 101#include <dev/mpt/mpt_raid.h> 102 103#include "dev/mpt/mpilib/mpi_ioc.h" /* XXX Fix Event Handling!!! */ 104#include "dev/mpt/mpilib/mpi_init.h" 105#include "dev/mpt/mpilib/mpi_targ.h" --- 200 unchanged lines hidden (view full) --- 306 error = ENOMEM; 307 goto cleanup; 308 } 309 310 /* 311 * Construct our SIM entry. 312 */ 313 mpt->sim = cam_sim_alloc(mpt_action, mpt_poll, "mpt", mpt, | 98 99#include <dev/mpt/mpt.h> 100#include <dev/mpt/mpt_cam.h> 101#include <dev/mpt/mpt_raid.h> 102 103#include "dev/mpt/mpilib/mpi_ioc.h" /* XXX Fix Event Handling!!! */ 104#include "dev/mpt/mpilib/mpi_init.h" 105#include "dev/mpt/mpilib/mpi_targ.h" --- 200 unchanged lines hidden (view full) --- 306 error = ENOMEM; 307 goto cleanup; 308 } 309 310 /* 311 * Construct our SIM entry. 312 */ 313 mpt->sim = cam_sim_alloc(mpt_action, mpt_poll, "mpt", mpt, |
314 mpt->unit, 1, maxq, devq); | 314 mpt->unit, &Giant, 1, maxq, devq); |
315 if (mpt->sim == NULL) { 316 mpt_prt(mpt, "Unable to allocate CAM SIM!\n"); 317 cam_simq_free(devq); 318 error = ENOMEM; 319 goto cleanup; 320 } 321 322 /* --- 20 unchanged lines hidden (view full) --- 343 CAMLOCK_2_MPTLOCK(mpt); 344 return (0); 345 } 346 347 /* 348 * Create a "bus" to export all hidden disks to CAM. 349 */ 350 mpt->phydisk_sim = cam_sim_alloc(mpt_action, mpt_poll, "mpt", mpt, | 315 if (mpt->sim == NULL) { 316 mpt_prt(mpt, "Unable to allocate CAM SIM!\n"); 317 cam_simq_free(devq); 318 error = ENOMEM; 319 goto cleanup; 320 } 321 322 /* --- 20 unchanged lines hidden (view full) --- 343 CAMLOCK_2_MPTLOCK(mpt); 344 return (0); 345 } 346 347 /* 348 * Create a "bus" to export all hidden disks to CAM. 349 */ 350 mpt->phydisk_sim = cam_sim_alloc(mpt_action, mpt_poll, "mpt", mpt, |
351 mpt->unit, 1, maxq, devq); | 351 mpt->unit, &Giant, 1, maxq, devq); |
352 if (mpt->phydisk_sim == NULL) { 353 mpt_prt(mpt, "Unable to allocate Physical Disk CAM SIM!\n"); 354 error = ENOMEM; 355 goto cleanup; 356 } 357 358 /* 359 * Register this bus. --- 1722 unchanged lines hidden (view full) --- 2082 xpt_async(AC_BUS_RESET, mpt->path, NULL); 2083 break; 2084 2085 case MPI_EVENT_RESCAN: 2086#if __FreeBSD_version >= 600000 2087 { 2088 union ccb *ccb; 2089 uint32_t pathid; | 352 if (mpt->phydisk_sim == NULL) { 353 mpt_prt(mpt, "Unable to allocate Physical Disk CAM SIM!\n"); 354 error = ENOMEM; 355 goto cleanup; 356 } 357 358 /* 359 * Register this bus. --- 1722 unchanged lines hidden (view full) --- 2082 xpt_async(AC_BUS_RESET, mpt->path, NULL); 2083 break; 2084 2085 case MPI_EVENT_RESCAN: 2086#if __FreeBSD_version >= 600000 2087 { 2088 union ccb *ccb; 2089 uint32_t pathid; |
2090 struct cam_sim *sim; |
|
2090 /* 2091 * In general this means a device has been added to the loop. 2092 */ 2093 mpt_prt(mpt, "Rescan Port: %d\n", (data0 >> 8) & 0xff); 2094 if (mpt->ready == 0) { 2095 break; 2096 } 2097 if (mpt->phydisk_sim) { | 2091 /* 2092 * In general this means a device has been added to the loop. 2093 */ 2094 mpt_prt(mpt, "Rescan Port: %d\n", (data0 >> 8) & 0xff); 2095 if (mpt->ready == 0) { 2096 break; 2097 } 2098 if (mpt->phydisk_sim) { |
2098 pathid = cam_sim_path(mpt->phydisk_sim);; | 2099 sim = mpt->phydisk_sim; |
2099 } else { | 2100 } else { |
2100 pathid = cam_sim_path(mpt->sim); | 2101 sim = mpt->sim; |
2101 } | 2102 } |
2103 pathid = cam_sim_path(sim); |
|
2102 MPTLOCK_2_CAMLOCK(mpt); 2103 /* 2104 * Allocate a CCB, create a wildcard path for this bus, 2105 * and schedule a rescan. 2106 */ | 2104 MPTLOCK_2_CAMLOCK(mpt); 2105 /* 2106 * Allocate a CCB, create a wildcard path for this bus, 2107 * and schedule a rescan. 2108 */ |
2107 ccb = xpt_alloc_ccb_nowait(); | 2109 ccb = xpt_alloc_ccb_nowait(sim); |
2108 if (ccb == NULL) { 2109 mpt_prt(mpt, "unable to alloc CCB for rescan\n"); 2110 CAMLOCK_2_MPTLOCK(mpt); 2111 break; 2112 } 2113 2114 if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, pathid, 2115 CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { --- 3117 unchanged lines hidden --- | 2110 if (ccb == NULL) { 2111 mpt_prt(mpt, "unable to alloc CCB for rescan\n"); 2112 CAMLOCK_2_MPTLOCK(mpt); 2113 break; 2114 } 2115 2116 if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, pathid, 2117 CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { --- 3117 unchanged lines hidden --- |