Deleted Added
sdiff udiff text old ( 168864 ) new ( 186185 )
full compact
1/*-
2 * Common functions for SCSI Interface Modules (SIMs).
3 *
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 13 unchanged lines hidden (view full) ---

22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/cam/cam_sim.c 168864 2007-04-19 14:28:43Z scottl $");
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/malloc.h>
35#include <sys/kernel.h>
36#include <sys/lock.h>
37#include <sys/mutex.h>
38

--- 40 unchanged lines hidden (view full) ---

79 sim->sim_name = sim_name;
80 sim->softc = softc;
81 sim->path_id = CAM_PATH_ANY;
82 sim->unit_number = unit;
83 sim->bus_id = 0; /* set in xpt_bus_register */
84 sim->max_tagged_dev_openings = max_tagged_dev_transactions;
85 sim->max_dev_openings = max_dev_transactions;
86 sim->flags = 0;
87 sim->devq = queue;
88 sim->mtx = mtx;
89 if (mtx == &Giant) {
90 sim->flags |= 0;
91 callout_init(&sim->callout, 0);
92 } else {
93 sim->flags |= CAM_SIM_MPSAFE;
94 callout_init(&sim->callout, 1);
95 }
96
97 SLIST_INIT(&sim->ccb_freeq);
98 TAILQ_INIT(&sim->sim_doneq);
99
100 return (sim);
101}
102
103void
104cam_sim_free(struct cam_sim *sim, int free_devq)
105{
106 if (free_devq)
107 cam_simq_free(sim->devq);
108 free(sim, M_CAMSIM);
109}
110
111void
112cam_sim_set_path(struct cam_sim *sim, u_int32_t path_id)
113{
114 sim->path_id = path_id;
115}