mpt.c (227001) | mpt.c (231228) |
---|---|
1/*- 2 * Generic routines for LSI Fusion 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 --- 82 unchanged lines hidden (view full) --- 91 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 92 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 93 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 94 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT 95 * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 96 */ 97 98#include <sys/cdefs.h> | 1/*- 2 * Generic routines for LSI Fusion 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 --- 82 unchanged lines hidden (view full) --- 91 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 92 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 93 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 94 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT 95 * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 96 */ 97 98#include <sys/cdefs.h> |
99__FBSDID("$FreeBSD: head/sys/dev/mpt/mpt.c 227001 2011-11-01 18:28:33Z marius $"); | 99__FBSDID("$FreeBSD: head/sys/dev/mpt/mpt.c 231228 2012-02-08 21:40:54Z marius $"); |
100 101#include <dev/mpt/mpt.h> 102#include <dev/mpt/mpt_cam.h> /* XXX For static handler registration */ 103#include <dev/mpt/mpt_raid.h> /* XXX For static handler registration */ 104 105#include <dev/mpt/mpilib/mpi.h> 106#include <dev/mpt/mpilib/mpi_ioc.h> 107#include <dev/mpt/mpilib/mpi_fc.h> --- 35 unchanged lines hidden (view full) --- 143 mpt_pers_find(struct mpt_softc *, u_int); 144static __inline struct mpt_personality* 145 mpt_pers_find_reverse(struct mpt_softc *, u_int); 146 147static __inline struct mpt_personality * 148mpt_pers_find(struct mpt_softc *mpt, u_int start_at) 149{ 150 KASSERT(start_at <= MPT_MAX_PERSONALITIES, | 100 101#include <dev/mpt/mpt.h> 102#include <dev/mpt/mpt_cam.h> /* XXX For static handler registration */ 103#include <dev/mpt/mpt_raid.h> /* XXX For static handler registration */ 104 105#include <dev/mpt/mpilib/mpi.h> 106#include <dev/mpt/mpilib/mpi_ioc.h> 107#include <dev/mpt/mpilib/mpi_fc.h> --- 35 unchanged lines hidden (view full) --- 143 mpt_pers_find(struct mpt_softc *, u_int); 144static __inline struct mpt_personality* 145 mpt_pers_find_reverse(struct mpt_softc *, u_int); 146 147static __inline struct mpt_personality * 148mpt_pers_find(struct mpt_softc *mpt, u_int start_at) 149{ 150 KASSERT(start_at <= MPT_MAX_PERSONALITIES, |
151 ("mpt_pers_find: starting position out of range\n")); | 151 ("mpt_pers_find: starting position out of range")); |
152 153 while (start_at < MPT_MAX_PERSONALITIES 154 && (mpt->mpt_pers_mask & (0x1 << start_at)) == 0) { 155 start_at++; 156 } 157 return (mpt_personalities[start_at]); 158} 159 --- 1032 unchanged lines hidden (view full) --- 1192void 1193mpt_free_request(struct mpt_softc *mpt, request_t *req) 1194{ 1195 request_t *nxt; 1196 struct mpt_evtf_record *record; 1197 uint32_t offset, reply_baddr; 1198 1199 if (req == NULL || req != &mpt->request_pool[req->index]) { | 152 153 while (start_at < MPT_MAX_PERSONALITIES 154 && (mpt->mpt_pers_mask & (0x1 << start_at)) == 0) { 155 start_at++; 156 } 157 return (mpt_personalities[start_at]); 158} 159 --- 1032 unchanged lines hidden (view full) --- 1192void 1193mpt_free_request(struct mpt_softc *mpt, request_t *req) 1194{ 1195 request_t *nxt; 1196 struct mpt_evtf_record *record; 1197 uint32_t offset, reply_baddr; 1198 1199 if (req == NULL || req != &mpt->request_pool[req->index]) { |
1200 panic("mpt_free_request bad req ptr\n"); 1201 return; | 1200 panic("mpt_free_request: bad req ptr"); |
1202 } 1203 if ((nxt = req->chain) != NULL) { 1204 req->chain = NULL; 1205 mpt_free_request(mpt, nxt); /* NB: recursion */ 1206 } 1207 KASSERT(req->state != REQ_STATE_FREE, ("freeing free request")); 1208 KASSERT(!(req->state & REQ_STATE_LOCKED), ("freeing locked request")); 1209 MPT_LOCK_ASSERT(mpt); --- 46 unchanged lines hidden (view full) --- 1256{ 1257 request_t *req; 1258 1259retry: 1260 MPT_LOCK_ASSERT(mpt); 1261 req = TAILQ_FIRST(&mpt->request_free_list); 1262 if (req != NULL) { 1263 KASSERT(req == &mpt->request_pool[req->index], | 1201 } 1202 if ((nxt = req->chain) != NULL) { 1203 req->chain = NULL; 1204 mpt_free_request(mpt, nxt); /* NB: recursion */ 1205 } 1206 KASSERT(req->state != REQ_STATE_FREE, ("freeing free request")); 1207 KASSERT(!(req->state & REQ_STATE_LOCKED), ("freeing locked request")); 1208 MPT_LOCK_ASSERT(mpt); --- 46 unchanged lines hidden (view full) --- 1255{ 1256 request_t *req; 1257 1258retry: 1259 MPT_LOCK_ASSERT(mpt); 1260 req = TAILQ_FIRST(&mpt->request_free_list); 1261 if (req != NULL) { 1262 KASSERT(req == &mpt->request_pool[req->index], |
1264 ("mpt_get_request: corrupted request free list\n")); | 1263 ("mpt_get_request: corrupted request free list")); |
1265 KASSERT(req->state == REQ_STATE_FREE, 1266 ("req %p:%u not free on free list %x index %d function %x", 1267 req, req->serno, req->state, req->index, 1268 ((MSG_REQUEST_HEADER *)req->req_vbuf)->Function)); 1269 TAILQ_REMOVE(&mpt->request_free_list, req, links); 1270 req->state = REQ_STATE_ALLOCATED; 1271 req->chain = NULL; 1272 mpt_assign_serno(mpt, req); --- 1876 unchanged lines hidden --- | 1264 KASSERT(req->state == REQ_STATE_FREE, 1265 ("req %p:%u not free on free list %x index %d function %x", 1266 req, req->serno, req->state, req->index, 1267 ((MSG_REQUEST_HEADER *)req->req_vbuf)->Function)); 1268 TAILQ_REMOVE(&mpt->request_free_list, req, links); 1269 req->state = REQ_STATE_ALLOCATED; 1270 req->chain = NULL; 1271 mpt_assign_serno(mpt, req); --- 1876 unchanged lines hidden --- |