diff options
author | emaste <emaste@FreeBSD.org> | 2008-03-24 19:23:33 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2008-03-24 19:23:33 +0000 |
commit | 86c0a7d5de867437e79253da55689f2d4e3e2f06 (patch) | |
tree | c597de9c0d1710c8270349632fa2ab8235395969 /sys/dev | |
parent | f95a1f76b1b528cc8ad1df53a75dae768c897a80 (diff) | |
download | FreeBSD-src-86c0a7d5de867437e79253da55689f2d4e3e2f06.zip FreeBSD-src-86c0a7d5de867437e79253da55689f2d4e3e2f06.tar.gz |
Diff reduction to Adaptec's driver (around build 15317): catch up with a
change in debugging routines.
The fwprintf macro in the AAC_DEBUG case (mapping to printf) isn't from the
Adaptec driver.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/aac/aac.c | 210 | ||||
-rw-r--r-- | sys/dev/aac/aac_cam.c | 12 | ||||
-rw-r--r-- | sys/dev/aac/aac_debug.c | 1 | ||||
-rw-r--r-- | sys/dev/aac/aac_disk.c | 18 | ||||
-rw-r--r-- | sys/dev/aac/aac_pci.c | 12 | ||||
-rw-r--r-- | sys/dev/aac/aacvar.h | 28 |
6 files changed, 128 insertions, 153 deletions
diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 57f523d..095b322 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -258,7 +258,7 @@ aac_attach(struct aac_softc *sc) { int error, unit; - debug_called(1); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* * Initialize per-controller queues. @@ -401,9 +401,8 @@ aac_startup(void *arg) struct aac_mntinforesp *mir; int count = 0, i = 0; - debug_called(1); - sc = (struct aac_softc *)arg; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* disconnect ourselves from the intrhook chain */ config_intrhook_disestablish(&sc->aac_ich); @@ -453,7 +452,7 @@ aac_add_container(struct aac_softc *sc, struct aac_mntinforesp *mir, int f) M_NOWAIT | M_ZERO); if (co == NULL) panic("Out of memory?!\n"); - debug(1, "id %x name '%.16s' size %u type %d", + fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "id %x name '%.16s' size %u type %d", mir->MntTable[0].ObjectId, mir->MntTable[0].FileSystemName, mir->MntTable[0].Capacity, mir->MntTable[0].VolType); @@ -480,6 +479,9 @@ aac_add_container(struct aac_softc *sc, struct aac_mntinforesp *mir, int f) static int aac_alloc(struct aac_softc *sc) { + + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); + /* * Create DMA tag for mapping buffers into controller-addressable space. */ @@ -589,7 +591,7 @@ void aac_free(struct aac_softc *sc) { - debug_called(1); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* remove the control device */ if (sc->aac_dev_t != NULL) @@ -643,9 +645,8 @@ aac_detach(device_t dev) struct aac_sim *sim; int error; - debug_called(1); - sc = device_get_softc(dev); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); if (sc->aac_state & AAC_STATE_OPEN) return(EBUSY); @@ -706,9 +707,8 @@ aac_shutdown(device_t dev) struct aac_fib *fib; struct aac_close_command *cc; - debug_called(1); - sc = device_get_softc(dev); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); sc->aac_state |= AAC_STATE_SUSPEND; @@ -764,10 +764,9 @@ aac_suspend(device_t dev) { struct aac_softc *sc; - debug_called(1); - sc = device_get_softc(dev); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); sc->aac_state |= AAC_STATE_SUSPEND; AAC_MASK_INTERRUPTS(sc); @@ -782,10 +781,9 @@ aac_resume(device_t dev) { struct aac_softc *sc; - debug_called(1); - sc = device_get_softc(dev); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); sc->aac_state &= ~AAC_STATE_SUSPEND; AAC_UNMASK_INTERRUPTS(sc); return(0); @@ -803,10 +801,9 @@ aac_new_intr(void *arg) struct aac_fib *fib; int i; - debug_called(2); - sc = (struct aac_softc *)arg; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); mtx_lock(&sc->aac_io_lock); while (1) { index = AAC_GET_OUTB_QUEUE(sc); @@ -881,10 +878,9 @@ aac_fast_intr(void *arg) struct aac_softc *sc; u_int16_t reason; - debug_called(2); - sc = (struct aac_softc *)arg; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* * Read the status register directly. This is faster than taking the * driver lock and reading the queues directly. It also saves having @@ -933,7 +929,7 @@ aac_startio(struct aac_softc *sc) struct aac_command *cm; int error; - debug_called(2); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); for (;;) { /* @@ -975,7 +971,7 @@ aac_startio(struct aac_softc *sc) cm->cm_datalen, aac_map_command_sg, cm, 0); if (error == EINPROGRESS) { - debug(1, "freezing queue\n"); + fwprintf(sc, HBA_FLAGS_DBG_COMM_B, "freezing queue\n"); sc->flags |= AAC_QUEUE_FRZN; error = 0; } else if (error != 0) @@ -996,7 +992,7 @@ aac_command_thread(struct aac_softc *sc) u_int32_t fib_size; int size, retval; - debug_called(2); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); mtx_lock(&sc->aac_io_lock); sc->aifflags = AAC_AIFFLAGS_RUNNING; @@ -1098,9 +1094,8 @@ aac_complete(void *context, int pending) struct aac_fib *fib; u_int32_t fib_size; - debug_called(2); - sc = (struct aac_softc *)context; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); mtx_lock(&sc->aac_io_lock); @@ -1147,10 +1142,9 @@ aac_submit_bio(struct bio *bp) struct aac_disk *ad; struct aac_softc *sc; - debug_called(2); - ad = (struct aac_disk *)bp->bio_disk->d_drv1; sc = ad->ad_controller; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* queue the BIO and try to get some work done */ aac_enqueue_bio(sc, bp); @@ -1168,7 +1162,7 @@ aac_bio_command(struct aac_softc *sc, struct aac_command **cmp) struct aac_disk *ad; struct bio *bp; - debug_called(2); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* get the resources we will need */ cm = NULL; @@ -1335,9 +1329,8 @@ aac_wait_command(struct aac_command *cm) struct aac_softc *sc; int error; - debug_called(2); - sc = cm->cm_sc; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* Put the command on the ready queue and get things going */ cm->cm_queue = AAC_ADAP_NORM_CMD_QUEUE; @@ -1359,7 +1352,7 @@ aac_alloc_command(struct aac_softc *sc, struct aac_command **cmp) { struct aac_command *cm; - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); if ((cm = aac_dequeue_free(sc)) == NULL) { if (sc->total_fibs < sc->aac_max_fibs) { @@ -1382,7 +1375,8 @@ aac_release_command(struct aac_command *cm) struct aac_event *event; struct aac_softc *sc; - debug_called(3); + sc = cm->cm_sc; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* (re)initialize the command/FIB */ cm->cm_sgtable = NULL; @@ -1408,7 +1402,6 @@ aac_release_command(struct aac_command *cm) * Dequeue all events so that there's no risk of events getting * stranded. */ - sc = cm->cm_sc; while ((event = TAILQ_FIRST(&sc->aac_ev_cmfree)) != NULL) { TAILQ_REMOVE(&sc->aac_ev_cmfree, event, ev_links); event->ev_callback(sc, event, event->ev_arg); @@ -1425,8 +1418,6 @@ aac_map_command_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error) fibphys = (uint64_t *)arg; - debug_called(3); - *fibphys = segs[0].ds_addr; } @@ -1441,7 +1432,7 @@ aac_alloc_commands(struct aac_softc *sc) uint64_t fibphys; int i, error; - debug_called(2); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); if (sc->total_fibs + sc->aac_max_fibs_alloc > sc->aac_max_fibs) return (ENOMEM); @@ -1487,7 +1478,7 @@ aac_alloc_commands(struct aac_softc *sc) if (i > 0) { mtx_lock(&sc->aac_io_lock); TAILQ_INSERT_TAIL(&sc->aac_fibmap_tqh, fm, fm_link); - debug(1, "total_fibs= %d\n", sc->total_fibs); + fwprintf(sc, HBA_FLAGS_DBG_COMM_B, "total_fibs= %d\n", sc->total_fibs); mtx_unlock(&sc->aac_io_lock); return (0); } @@ -1508,7 +1499,7 @@ aac_free_commands(struct aac_softc *sc) struct aac_command *cm; int i; - debug_called(1); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); while ((fm = TAILQ_FIRST(&sc->aac_fibmap_tqh)) != NULL) { @@ -1538,11 +1529,10 @@ aac_map_command_sg(void *arg, bus_dma_segment_t *segs, int nseg, int error) struct aac_fib *fib; int i; - debug_called(3); - cm = (struct aac_command *)arg; sc = cm->cm_sc; fib = cm->cm_fib; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* copy into the FIB */ if (cm->cm_sgtable != NULL) { @@ -1631,9 +1621,8 @@ aac_unmap_command(struct aac_command *cm) { struct aac_softc *sc; - debug_called(2); - sc = cm->cm_sc; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); if (!(cm->cm_flags & AAC_CMD_MAPPED)) return; @@ -1663,9 +1652,8 @@ aac_common_map(void *arg, bus_dma_segment_t *segs, int nseg, int error) { struct aac_softc *sc; - debug_called(1); - sc = (struct aac_softc *)arg; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); sc->aac_common_busaddr = segs[0].ds_addr; } @@ -1677,7 +1665,7 @@ aac_check_firmware(struct aac_softc *sc) int status; time_t then; - debug_called(1); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* * Wait for the adapter to come ready. */ @@ -1825,8 +1813,7 @@ aac_init(struct aac_softc *sc) u_int32_t qoffset; int error; - debug_called(1); - + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* * Fill in the init structure. This tells the adapter about the @@ -2025,7 +2012,7 @@ aac_sync_command(struct aac_softc *sc, u_int32_t command, time_t then; u_int32_t status; - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* populate the mailbox */ AAC_SET_MAILBOX(sc, command, arg0, arg1, arg2, arg3); @@ -2040,7 +2027,7 @@ aac_sync_command(struct aac_softc *sc, u_int32_t command, then = time_uptime; do { if (time_uptime > (then + AAC_IMMEDIATE_TIMEOUT)) { - debug(1, "timed out"); + fwprintf(sc, HBA_FLAGS_DBG_ERROR_B, "timed out"); return(EIO); } } while (!(AAC_GET_ISTATUS(sc) & AAC_DB_SYNC_COMMAND)); @@ -2062,7 +2049,7 @@ int aac_sync_fib(struct aac_softc *sc, u_int32_t command, u_int32_t xferstate, struct aac_fib *fib, u_int16_t datasize) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); mtx_assert(&sc->aac_io_lock, MA_OWNED); if (datasize > AAC_FIB_DATASIZE) @@ -2089,7 +2076,7 @@ aac_sync_fib(struct aac_softc *sc, u_int32_t command, u_int32_t xferstate, */ if (aac_sync_command(sc, AAC_MONKER_SYNCFIB, fib->Header.ReceiverFibAddress, 0, 0, 0, NULL)) { - debug(2, "IO error"); + fwprintf(sc, HBA_FLAGS_DBG_ERROR_B, "IO error"); return(EIO); } @@ -2133,7 +2120,7 @@ aac_enqueue_fib(struct aac_softc *sc, int queue, struct aac_command *cm) u_int32_t fib_size; u_int32_t fib_addr; - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); fib_size = cm->cm_fib->Header.Size; fib_addr = cm->cm_fib->Header.ReceiverFibAddress; @@ -2188,7 +2175,7 @@ aac_dequeue_fib(struct aac_softc *sc, int queue, u_int32_t *fib_size, int error; int notify; - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* get the producer/consumer indices */ pi = sc->aac_queues->qt_qindex[queue][AAC_PRODUCER_INDEX]; @@ -2283,7 +2270,7 @@ aac_enqueue_response(struct aac_softc *sc, int queue, struct aac_fib *fib) u_int32_t fib_size; u_int32_t fib_addr; - debug_called(1); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* Tell the adapter where the FIB is */ fib_size = fib->Header.Size; @@ -2370,7 +2357,7 @@ aac_timeout(struct aac_softc *sc) static int aac_sa_get_fwstatus(struct aac_softc *sc) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); return(AAC_GETREG4(sc, AAC_SA_FWSTATUS)); } @@ -2378,7 +2365,7 @@ aac_sa_get_fwstatus(struct aac_softc *sc) static int aac_rx_get_fwstatus(struct aac_softc *sc) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); return(AAC_GETREG4(sc, AAC_RX_FWSTATUS)); } @@ -2388,7 +2375,7 @@ aac_fa_get_fwstatus(struct aac_softc *sc) { int val; - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); val = AAC_GETREG4(sc, AAC_FA_FWSTATUS); return (val); @@ -2397,7 +2384,7 @@ aac_fa_get_fwstatus(struct aac_softc *sc) static int aac_rkt_get_fwstatus(struct aac_softc *sc) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); return(AAC_GETREG4(sc, AAC_RKT_FWSTATUS)); } @@ -2409,7 +2396,7 @@ aac_rkt_get_fwstatus(struct aac_softc *sc) static void aac_sa_qnotify(struct aac_softc *sc, int qbit) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); AAC_SETREG2(sc, AAC_SA_DOORBELL1_SET, qbit); } @@ -2417,7 +2404,7 @@ aac_sa_qnotify(struct aac_softc *sc, int qbit) static void aac_rx_qnotify(struct aac_softc *sc, int qbit) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); AAC_SETREG4(sc, AAC_RX_IDBR, qbit); } @@ -2425,7 +2412,7 @@ aac_rx_qnotify(struct aac_softc *sc, int qbit) static void aac_fa_qnotify(struct aac_softc *sc, int qbit) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); AAC_SETREG2(sc, AAC_FA_DOORBELL1, qbit); AAC_FA_HACK(sc); @@ -2434,7 +2421,7 @@ aac_fa_qnotify(struct aac_softc *sc, int qbit) static void aac_rkt_qnotify(struct aac_softc *sc, int qbit) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); AAC_SETREG4(sc, AAC_RKT_IDBR, qbit); } @@ -2445,7 +2432,7 @@ aac_rkt_qnotify(struct aac_softc *sc, int qbit) static int aac_sa_get_istatus(struct aac_softc *sc) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); return(AAC_GETREG2(sc, AAC_SA_DOORBELL0)); } @@ -2453,7 +2440,7 @@ aac_sa_get_istatus(struct aac_softc *sc) static int aac_rx_get_istatus(struct aac_softc *sc) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); return(AAC_GETREG4(sc, AAC_RX_ODBR)); } @@ -2463,7 +2450,7 @@ aac_fa_get_istatus(struct aac_softc *sc) { int val; - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); val = AAC_GETREG2(sc, AAC_FA_DOORBELL0); return (val); @@ -2472,7 +2459,7 @@ aac_fa_get_istatus(struct aac_softc *sc) static int aac_rkt_get_istatus(struct aac_softc *sc) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); return(AAC_GETREG4(sc, AAC_RKT_ODBR)); } @@ -2483,7 +2470,7 @@ aac_rkt_get_istatus(struct aac_softc *sc) static void aac_sa_clear_istatus(struct aac_softc *sc, int mask) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); AAC_SETREG2(sc, AAC_SA_DOORBELL0_CLEAR, mask); } @@ -2491,7 +2478,7 @@ aac_sa_clear_istatus(struct aac_softc *sc, int mask) static void aac_rx_clear_istatus(struct aac_softc *sc, int mask) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); AAC_SETREG4(sc, AAC_RX_ODBR, mask); } @@ -2499,7 +2486,7 @@ aac_rx_clear_istatus(struct aac_softc *sc, int mask) static void aac_fa_clear_istatus(struct aac_softc *sc, int mask) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); AAC_SETREG2(sc, AAC_FA_DOORBELL0_CLEAR, mask); AAC_FA_HACK(sc); @@ -2508,7 +2495,7 @@ aac_fa_clear_istatus(struct aac_softc *sc, int mask) static void aac_rkt_clear_istatus(struct aac_softc *sc, int mask) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); AAC_SETREG4(sc, AAC_RKT_ODBR, mask); } @@ -2520,7 +2507,7 @@ static void aac_sa_set_mailbox(struct aac_softc *sc, u_int32_t command, u_int32_t arg0, u_int32_t arg1, u_int32_t arg2, u_int32_t arg3) { - debug_called(4); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); AAC_SETREG4(sc, AAC_SA_MAILBOX, command); AAC_SETREG4(sc, AAC_SA_MAILBOX + 4, arg0); @@ -2533,7 +2520,7 @@ static void aac_rx_set_mailbox(struct aac_softc *sc, u_int32_t command, u_int32_t arg0, u_int32_t arg1, u_int32_t arg2, u_int32_t arg3) { - debug_called(4); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); AAC_SETREG4(sc, AAC_RX_MAILBOX, command); AAC_SETREG4(sc, AAC_RX_MAILBOX + 4, arg0); @@ -2546,7 +2533,7 @@ static void aac_fa_set_mailbox(struct aac_softc *sc, u_int32_t command, u_int32_t arg0, u_int32_t arg1, u_int32_t arg2, u_int32_t arg3) { - debug_called(4); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); AAC_SETREG4(sc, AAC_FA_MAILBOX, command); AAC_FA_HACK(sc); @@ -2564,7 +2551,7 @@ static void aac_rkt_set_mailbox(struct aac_softc *sc, u_int32_t command, u_int32_t arg0, u_int32_t arg1, u_int32_t arg2, u_int32_t arg3) { - debug_called(4); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); AAC_SETREG4(sc, AAC_RKT_MAILBOX, command); AAC_SETREG4(sc, AAC_RKT_MAILBOX + 4, arg0); @@ -2579,7 +2566,7 @@ aac_rkt_set_mailbox(struct aac_softc *sc, u_int32_t command, u_int32_t arg0, static int aac_sa_get_mailbox(struct aac_softc *sc, int mb) { - debug_called(4); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); return(AAC_GETREG4(sc, AAC_SA_MAILBOX + (mb * 4))); } @@ -2587,7 +2574,7 @@ aac_sa_get_mailbox(struct aac_softc *sc, int mb) static int aac_rx_get_mailbox(struct aac_softc *sc, int mb) { - debug_called(4); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); return(AAC_GETREG4(sc, AAC_RX_MAILBOX + (mb * 4))); } @@ -2597,7 +2584,7 @@ aac_fa_get_mailbox(struct aac_softc *sc, int mb) { int val; - debug_called(4); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); val = AAC_GETREG4(sc, AAC_FA_MAILBOX + (mb * 4)); return (val); @@ -2606,7 +2593,7 @@ aac_fa_get_mailbox(struct aac_softc *sc, int mb) static int aac_rkt_get_mailbox(struct aac_softc *sc, int mb) { - debug_called(4); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); return(AAC_GETREG4(sc, AAC_RKT_MAILBOX + (mb * 4))); } @@ -2617,7 +2604,7 @@ aac_rkt_get_mailbox(struct aac_softc *sc, int mb) static void aac_sa_set_interrupts(struct aac_softc *sc, int enable) { - debug(2, "%sable interrupts", enable ? "en" : "dis"); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "%sable interrupts", enable ? "en" : "dis"); if (enable) { AAC_SETREG2((sc), AAC_SA_MASK0_CLEAR, AAC_DB_INTERRUPTS); @@ -2629,7 +2616,7 @@ aac_sa_set_interrupts(struct aac_softc *sc, int enable) static void aac_rx_set_interrupts(struct aac_softc *sc, int enable) { - debug(2, "%sable interrupts", enable ? "en" : "dis"); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "%sable interrupts", enable ? "en" : "dis"); if (enable) { if (sc->flags & AAC_FLAGS_NEW_COMM) @@ -2644,7 +2631,7 @@ aac_rx_set_interrupts(struct aac_softc *sc, int enable) static void aac_fa_set_interrupts(struct aac_softc *sc, int enable) { - debug(2, "%sable interrupts", enable ? "en" : "dis"); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "%sable interrupts", enable ? "en" : "dis"); if (enable) { AAC_SETREG2((sc), AAC_FA_MASK0_CLEAR, AAC_DB_INTERRUPTS); @@ -2658,7 +2645,7 @@ aac_fa_set_interrupts(struct aac_softc *sc, int enable) static void aac_rkt_set_interrupts(struct aac_softc *sc, int enable) { - debug(2, "%sable interrupts", enable ? "en" : "dis"); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "%sable interrupts", enable ? "en" : "dis"); if (enable) { if (sc->flags & AAC_FLAGS_NEW_COMM) @@ -2678,7 +2665,7 @@ aac_rx_send_command(struct aac_softc *sc, struct aac_command *cm) { u_int32_t index, device; - debug(2, "send command (new comm.)"); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "send command (new comm.)"); index = AAC_GETREG4(sc, AAC_RX_IQUE); if (index == 0xffffffffL) @@ -2701,7 +2688,7 @@ aac_rkt_send_command(struct aac_softc *sc, struct aac_command *cm) { u_int32_t index, device; - debug(2, "send command (new comm.)"); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "send command (new comm.)"); index = AAC_GETREG4(sc, AAC_RKT_IQUE); if (index == 0xffffffffL) @@ -2725,7 +2712,7 @@ aac_rkt_send_command(struct aac_softc *sc, struct aac_command *cm) static int aac_rx_get_outb_queue(struct aac_softc *sc) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); return(AAC_GETREG4(sc, AAC_RX_OQUE)); } @@ -2733,7 +2720,7 @@ aac_rx_get_outb_queue(struct aac_softc *sc) static int aac_rkt_get_outb_queue(struct aac_softc *sc) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); return(AAC_GETREG4(sc, AAC_RKT_OQUE)); } @@ -2741,7 +2728,7 @@ aac_rkt_get_outb_queue(struct aac_softc *sc) static void aac_rx_set_outb_queue(struct aac_softc *sc, int index) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); AAC_SETREG4(sc, AAC_RX_OQUE, index); } @@ -2749,7 +2736,7 @@ aac_rx_set_outb_queue(struct aac_softc *sc, int index) static void aac_rkt_set_outb_queue(struct aac_softc *sc, int index) { - debug_called(3); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); AAC_SETREG4(sc, AAC_RKT_OQUE, index); } @@ -2768,7 +2755,7 @@ aac_describe_controller(struct aac_softc *sc) struct aac_adapter_info *info; char *adapter_type = "Adaptec RAID controller"; - debug_called(2); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); mtx_lock(&sc->aac_io_lock); aac_alloc_sync_fib(sc, &fib); @@ -2871,9 +2858,8 @@ aac_open(struct cdev *dev, int flags, int fmt, d_thread_t *td) { struct aac_softc *sc; - debug_called(2); - sc = dev->si_drv1; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); sc->aac_open_cnt++; sc->aac_state |= AAC_STATE_OPEN; @@ -2885,9 +2871,8 @@ aac_close(struct cdev *dev, int flags, int fmt, d_thread_t *td) { struct aac_softc *sc; - debug_called(2); - sc = dev->si_drv1; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); sc->aac_open_cnt--; /* Mark this unit as no longer open */ if (sc->aac_open_cnt == 0) @@ -2903,10 +2888,9 @@ aac_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, d_thread_t *td) struct aac_softc *sc; int error = 0; - debug_called(2); - as = (union aac_statrequest *)arg; sc = dev->si_drv1; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); switch (cmd) { case AACIO_STATS: @@ -2929,48 +2913,48 @@ aac_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, d_thread_t *td) arg = *(caddr_t*)arg; case FSACTL_LNX_SENDFIB: case FSACTL_LNX_SEND_LARGE_FIB: - debug(1, "FSACTL_SENDFIB"); + fwprintf(sc, HBA_FLAGS_DBG_IOCTL_COMMANDS_B, "FSACTL_SENDFIB"); error = aac_ioctl_sendfib(sc, arg); break; case FSACTL_SEND_RAW_SRB: arg = *(caddr_t*)arg; case FSACTL_LNX_SEND_RAW_SRB: - debug(1, "FSACTL_SEND_RAW_SRB"); + fwprintf(sc, HBA_FLAGS_DBG_IOCTL_COMMANDS_B, "FSACTL_SEND_RAW_SRB"); error = aac_ioctl_send_raw_srb(sc, arg); break; case FSACTL_AIF_THREAD: case FSACTL_LNX_AIF_THREAD: - debug(1, "FSACTL_AIF_THREAD"); + fwprintf(sc, HBA_FLAGS_DBG_IOCTL_COMMANDS_B, "FSACTL_AIF_THREAD"); error = EINVAL; break; case FSACTL_OPEN_GET_ADAPTER_FIB: arg = *(caddr_t*)arg; case FSACTL_LNX_OPEN_GET_ADAPTER_FIB: - debug(1, "FSACTL_OPEN_GET_ADAPTER_FIB"); + fwprintf(sc, HBA_FLAGS_DBG_IOCTL_COMMANDS_B, "FSACTL_OPEN_GET_ADAPTER_FIB"); error = aac_open_aif(sc, arg); break; case FSACTL_GET_NEXT_ADAPTER_FIB: arg = *(caddr_t*)arg; case FSACTL_LNX_GET_NEXT_ADAPTER_FIB: - debug(1, "FSACTL_GET_NEXT_ADAPTER_FIB"); + fwprintf(sc, HBA_FLAGS_DBG_IOCTL_COMMANDS_B, "FSACTL_GET_NEXT_ADAPTER_FIB"); error = aac_getnext_aif(sc, arg); break; case FSACTL_CLOSE_GET_ADAPTER_FIB: arg = *(caddr_t*)arg; case FSACTL_LNX_CLOSE_GET_ADAPTER_FIB: - debug(1, "FSACTL_CLOSE_GET_ADAPTER_FIB"); + fwprintf(sc, HBA_FLAGS_DBG_IOCTL_COMMANDS_B, "FSACTL_CLOSE_GET_ADAPTER_FIB"); error = aac_close_aif(sc, arg); break; case FSACTL_MINIPORT_REV_CHECK: arg = *(caddr_t*)arg; case FSACTL_LNX_MINIPORT_REV_CHECK: - debug(1, "FSACTL_MINIPORT_REV_CHECK"); + fwprintf(sc, HBA_FLAGS_DBG_IOCTL_COMMANDS_B, "FSACTL_MINIPORT_REV_CHECK"); error = aac_rev_check(sc, arg); break; case FSACTL_QUERY_DISK: arg = *(caddr_t*)arg; case FSACTL_LNX_QUERY_DISK: - debug(1, "FSACTL_QUERY_DISK"); + fwprintf(sc, HBA_FLAGS_DBG_IOCTL_COMMANDS_B, "FSACTL_QUERY_DISK"); error = aac_query_disk(sc, arg); break; case FSACTL_DELETE_DISK: @@ -2985,11 +2969,11 @@ aac_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, d_thread_t *td) case FSACTL_GET_PCI_INFO: arg = *(caddr_t*)arg; case FSACTL_LNX_GET_PCI_INFO: - debug(1, "FSACTL_GET_PCI_INFO"); + fwprintf(sc, HBA_FLAGS_DBG_IOCTL_COMMANDS_B, "FSACTL_GET_PCI_INFO"); error = aac_get_pci_info(sc, arg); break; default: - debug(1, "unsupported cmd 0x%lx\n", cmd); + fwprintf(sc, HBA_FLAGS_DBG_IOCTL_COMMANDS_B, "unsupported cmd 0x%lx\n", cmd); error = EINVAL; break; } @@ -3048,7 +3032,7 @@ aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib) struct aac_command *cm; int size, error; - debug_called(2); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); cm = NULL; @@ -3146,7 +3130,7 @@ aac_handle_aif(struct aac_softc *sc, struct aac_fib *fib) int next, current, found; int count = 0, added = 0, i = 0; - debug_called(2); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); aif = (struct aac_aif_command*)&fib->data[0]; aac_print_aif(sc, aif); @@ -3301,7 +3285,7 @@ aac_rev_check(struct aac_softc *sc, caddr_t udata) struct aac_rev_check_resp rev_check_resp; int error = 0; - debug_called(2); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* * Copyin the revision struct from userspace @@ -3311,7 +3295,7 @@ aac_rev_check(struct aac_softc *sc, caddr_t udata) return error; } - debug(2, "Userland revision= %d\n", + fwprintf(sc, HBA_FLAGS_DBG_IOCTL_COMMANDS_B, "Userland revision= %d\n", rev_check.callingRevision.buildNumber); /* @@ -3336,7 +3320,7 @@ aac_open_aif(struct aac_softc *sc, caddr_t arg) struct aac_fib_context *fibctx, *ctx; int error = 0; - debug_called(2); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); fibctx = malloc(sizeof(struct aac_fib_context), M_AACBUF, M_NOWAIT|M_ZERO); if (fibctx == NULL) @@ -3380,7 +3364,7 @@ aac_close_aif(struct aac_softc *sc, caddr_t arg) { struct aac_fib_context *ctx; - debug_called(2); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); mtx_lock(&sc->aac_aifq_lock); for (ctx = sc->fibctx; ctx; ctx = ctx->next) { @@ -3412,7 +3396,7 @@ aac_getnext_aif(struct aac_softc *sc, caddr_t arg) struct aac_fib_context *ctx; int error; - debug_called(2); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); if ((error = copyin(arg, &agf, sizeof(agf))) == 0) { for (ctx = sc->fibctx; ctx; ctx = ctx->next) { @@ -3424,7 +3408,7 @@ aac_getnext_aif(struct aac_softc *sc, caddr_t arg) error = aac_return_aif(sc, ctx, agf.AifFib); if (error == EAGAIN && agf.Wait) { - debug(2, "aac_getnext_aif(): waiting for AIF"); + fwprintf(sc, HBA_FLAGS_DBG_AIF_B, "aac_getnext_aif(): waiting for AIF"); sc->aac_state |= AAC_STATE_AIF_SLEEPER; while (error == EAGAIN) { error = tsleep(sc->aac_aifq, PRIBIO | @@ -3446,7 +3430,7 @@ aac_return_aif(struct aac_softc *sc, struct aac_fib_context *ctx, caddr_t uptr) { int current, error; - debug_called(2); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); mtx_lock(&sc->aac_aifq_lock); current = ctx->ctx_idx; @@ -3477,7 +3461,7 @@ aac_get_pci_info(struct aac_softc *sc, caddr_t uptr) } pciinf; int error; - debug_called(2); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); pciinf.bus = pci_get_bus(sc->aac_dev); pciinf.slot = pci_get_slot(sc->aac_dev); @@ -3501,7 +3485,7 @@ aac_query_disk(struct aac_softc *sc, caddr_t uptr) struct aac_disk *disk; int error, id; - debug_called(2); + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); disk = NULL; diff --git a/sys/dev/aac/aac_cam.c b/sys/dev/aac/aac_cam.c index a21517e..e38b0ab 100644 --- a/sys/dev/aac/aac_cam.c +++ b/sys/dev/aac/aac_cam.c @@ -127,7 +127,7 @@ aac_cam_event(struct aac_softc *sc, struct aac_event *event, void *arg) static int aac_cam_probe(device_t dev) { - debug_called(2); + fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); return (0); } @@ -137,7 +137,7 @@ aac_cam_detach(device_t dev) { struct aac_softc *sc; struct aac_cam *camsc; - debug_called(2); + fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); camsc = (struct aac_cam *)device_get_softc(dev); sc = camsc->inf->aac_sc; @@ -166,7 +166,7 @@ aac_cam_attach(device_t dev) struct aac_cam *camsc; struct aac_sim *inf; - debug_called(1); + fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); camsc = (struct aac_cam *)device_get_softc(dev); inf = (struct aac_sim *)device_get_ivars(dev); @@ -215,10 +215,9 @@ aac_cam_action(struct cam_sim *sim, union ccb *ccb) struct aac_fib *fib; struct aac_command *cm; - debug_called(2); - camsc = (struct aac_cam *)cam_sim_softc(sim); sc = camsc->inf->aac_sc; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* Synchronous ops, and ops that don't require communication with the * controller */ @@ -484,9 +483,8 @@ aac_cam_complete(struct aac_command *cm) struct aac_srb_response *srbr; struct aac_softc *sc; - debug_called(2); - sc = cm->cm_sc; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); ccb = cm->cm_private; srbr = (struct aac_srb_response *)&cm->cm_fib->data[0]; diff --git a/sys/dev/aac/aac_debug.c b/sys/dev/aac/aac_debug.c index 8afcee5..10b7b5a 100644 --- a/sys/dev/aac/aac_debug.c +++ b/sys/dev/aac/aac_debug.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include <dev/aac/aacvar.h> #ifdef AAC_DEBUG +int aac_debug_enable = 0; void aac_printstate0(void); /* diff --git a/sys/dev/aac/aac_disk.c b/sys/dev/aac/aac_disk.c index 12c5515..24b0771 100644 --- a/sys/dev/aac/aac_disk.c +++ b/sys/dev/aac/aac_disk.c @@ -106,7 +106,7 @@ aac_disk_open(struct disk *dp) { struct aac_disk *sc; - debug_called(4); + fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); sc = (struct aac_disk *)dp->d_drv1; @@ -134,7 +134,7 @@ aac_disk_close(struct disk *dp) { struct aac_disk *sc; - debug_called(4); + fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); sc = (struct aac_disk *)dp->d_drv1; @@ -153,9 +153,8 @@ aac_disk_strategy(struct bio *bp) { struct aac_disk *sc; - debug_called(4); - sc = (struct aac_disk *)bp->bio_disk->d_drv1; + fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* bogus disk? */ if (sc == NULL) { @@ -301,9 +300,8 @@ aac_biodone(struct bio *bp) { struct aac_disk *sc; - debug_called(4); - sc = (struct aac_disk *)bp->bio_disk->d_drv1; + fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); if (bp->bio_flags & BIO_ERROR) disk_err(bp, "hard error", -1, 1); @@ -318,7 +316,7 @@ static int aac_disk_probe(device_t dev) { - debug_called(2); + fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); return (0); } @@ -331,9 +329,8 @@ aac_disk_attach(device_t dev) { struct aac_disk *sc; - debug_called(1); - sc = (struct aac_disk *)device_get_softc(dev); + fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* initialise our softc */ sc->ad_controller = @@ -390,9 +387,8 @@ aac_disk_detach(device_t dev) { struct aac_disk *sc; - debug_called(2); - sc = (struct aac_disk *)device_get_softc(dev); + fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); if (sc->ad_flags & AAC_DISK_OPEN) return(EBUSY); diff --git a/sys/dev/aac/aac_pci.c b/sys/dev/aac/aac_pci.c index 9fdad54..50afdc5 100644 --- a/sys/dev/aac/aac_pci.c +++ b/sys/dev/aac/aac_pci.c @@ -315,7 +315,7 @@ aac_pci_probe(device_t dev) { struct aac_ident *id; - debug_called(1); + fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); if ((id = aac_find_ident(dev)) != NULL) { device_set_desc(dev, id->desc); @@ -335,7 +335,7 @@ aac_pci_attach(device_t dev) int error; u_int32_t command; - debug_called(1); + fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* * Initialise softc. @@ -410,19 +410,19 @@ aac_pci_attach(device_t dev) sc->aac_hwif = id->hwif; switch(sc->aac_hwif) { case AAC_HWIF_I960RX: - debug(2, "set hardware up for i960Rx"); + fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for i960Rx"); sc->aac_if = aac_rx_interface; break; case AAC_HWIF_STRONGARM: - debug(2, "set hardware up for StrongARM"); + fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for StrongARM"); sc->aac_if = aac_sa_interface; break; case AAC_HWIF_FALCON: - debug(2, "set hardware up for Falcon/PPC"); + fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for Falcon/PPC"); sc->aac_if = aac_fa_interface; break; case AAC_HWIF_RKT: - debug(2, "set hardware up for Rocket/MIPS"); + fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for Rocket/MIPS"); sc->aac_if = aac_rkt_interface; break; default: diff --git a/sys/dev/aac/aacvar.h b/sys/dev/aac/aacvar.h index cce57de..c39d7c9 100644 --- a/sys/dev/aac/aacvar.h +++ b/sys/dev/aac/aacvar.h @@ -444,21 +444,18 @@ extern int aac_sync_fib(struct aac_softc *sc, u_int32_t command, extern void aac_add_event(struct aac_softc *sc, struct aac_event *event); -/* - * Debugging levels: - * 0 - quiet, only emit warnings - * 1 - noisy, emit major function points and things done - * 2 - extremely noisy, emit trace items in loops, etc. - */ #ifdef AAC_DEBUG -# define debug(level, fmt, args...) \ - do { \ - if (level <=AAC_DEBUG) printf("%s: " fmt "\n", __func__ , ##args); \ - } while (0) -# define debug_called(level) \ - do { \ - if (level <= AAC_DEBUG) printf("%s: called\n", __func__); \ - } while (0) +extern int aac_debug_enable; +# define fwprintf(sc, flags, fmt, args...) \ +do { \ + if (!aac_debug_enable) \ + break; \ + if (sc != NULL) \ + device_printf(((struct aac_softc *)sc)->aac_dev, \ + "%s: " fmt "\n", __func__, ##args); \ + else \ + printf("%s: " fmt "\n", __func__, ##args); \ +} while(0) extern void aac_print_queues(struct aac_softc *sc); extern void aac_panic(struct aac_softc *sc, char *reason); @@ -470,8 +467,7 @@ extern void aac_print_aif(struct aac_softc *sc, #define AAC_PRINT_FIB(sc, fib) aac_print_fib(sc, fib, __func__) #else -# define debug(level, fmt, args...) -# define debug_called(level) +# define fwprintf(sc, flags, fmt, args...) # define aac_print_queues(sc) # define aac_panic(sc, reason) |