Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/mps/mps.c
Show First 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | |||||
static int mps_get_iocfacts(struct mps_softc *sc, MPI2_IOC_FACTS_REPLY *facts); | static int mps_get_iocfacts(struct mps_softc *sc, MPI2_IOC_FACTS_REPLY *facts); | ||||
static int mps_wait_db_ack(struct mps_softc *sc, int timeout, int sleep_flag); | static int mps_wait_db_ack(struct mps_softc *sc, int timeout, int sleep_flag); | ||||
static int mps_debug_sysctl(SYSCTL_HANDLER_ARGS); | static int mps_debug_sysctl(SYSCTL_HANDLER_ARGS); | ||||
static void mps_parse_debug(struct mps_softc *sc, char *list); | static void mps_parse_debug(struct mps_softc *sc, char *list); | ||||
SYSCTL_NODE(_hw, OID_AUTO, mps, CTLFLAG_RD, 0, "MPS Driver Parameters"); | SYSCTL_NODE(_hw, OID_AUTO, mps, CTLFLAG_RD, 0, "MPS Driver Parameters"); | ||||
MALLOC_DEFINE(M_MPT2, "mps", "mpt2 driver memory"); | MALLOC_DEFINE(M_MPT2, "mps", "mpt2 driver memory"); | ||||
MALLOC_DECLARE(M_MPSUSER); | |||||
/* | /* | ||||
* Do a "Diagnostic Reset" aka a hard reset. This should get the chip out of | * Do a "Diagnostic Reset" aka a hard reset. This should get the chip out of | ||||
* any state and back to its initialization state machine. | * any state and back to its initialization state machine. | ||||
*/ | */ | ||||
static char mpt2_reset_magic[] = { 0x00, 0x0f, 0x04, 0x0b, 0x02, 0x07, 0x0d }; | static char mpt2_reset_magic[] = { 0x00, 0x0f, 0x04, 0x0b, 0x02, 0x07, 0x0d }; | ||||
/* Added this union to smoothly convert le64toh cm->cm_desc.Words. | /* Added this union to smoothly convert le64toh cm->cm_desc.Words. | ||||
▲ Show 20 Lines • Show All 1,031 Lines • ▼ Show 20 Lines | |||||
void | void | ||||
mps_memaddr_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) | mps_memaddr_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) | ||||
{ | { | ||||
bus_addr_t *addr; | bus_addr_t *addr; | ||||
addr = arg; | addr = arg; | ||||
*addr = segs[0].ds_addr; | *addr = segs[0].ds_addr; | ||||
} | |||||
void | |||||
mps_memaddr_wait_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) | |||||
{ | |||||
struct mps_busdma_context *ctx; | |||||
int need_unload, need_free; | |||||
ctx = (struct mps_busdma_context *)arg; | |||||
need_unload = 0; | |||||
need_free = 0; | |||||
mps_lock(ctx->softc); | |||||
ctx->error = error; | |||||
ctx->completed = 1; | |||||
if ((error == 0) && (ctx->abandoned == 0)) { | |||||
*ctx->addr = segs[0].ds_addr; | |||||
} else { | |||||
if (nsegs != 0) | |||||
need_unload = 1; | |||||
if (ctx->abandoned != 0) | |||||
need_free = 1; | |||||
} | |||||
if (need_free == 0) | |||||
wakeup(ctx); | |||||
mps_unlock(ctx->softc); | |||||
if (need_unload != 0) { | |||||
bus_dmamap_unload(ctx->buffer_dmat, | |||||
ctx->buffer_dmamap); | |||||
*ctx->addr = 0; | |||||
} | |||||
if (need_free != 0) | |||||
free(ctx, M_MPSUSER); | |||||
} | } | ||||
static int | static int | ||||
mps_alloc_queues(struct mps_softc *sc) | mps_alloc_queues(struct mps_softc *sc) | ||||
{ | { | ||||
struct mps_queue *q; | struct mps_queue *q; | ||||
u_int nq, i; | u_int nq, i; | ||||
▲ Show 20 Lines • Show All 1,887 Lines • Show Last 20 Lines |