Index: sys/dev/aacraid/aacraid.c =================================================================== --- sys/dev/aacraid/aacraid.c +++ sys/dev/aacraid/aacraid.c @@ -228,6 +228,22 @@ SYSCTL_NODE(_hw, OID_AUTO, aacraid, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "AACRAID driver parameters"); +static void +aacraid_setup_sysctl(struct aac_softc *sc) +{ + struct sysctl_ctx_list *sysctl_ctx; + struct sysctl_oid *sysctl_tree; + + sysctl_ctx = device_get_sysctl_ctx(sc->aac_dev); + sysctl_tree = device_get_sysctl_tree(sc->aac_dev); + if (sysctl_ctx == NULL || sysctl_tree == NULL) + return; + + SYSCTL_ADD_ULONG(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "dma_load_fail", CTLFLAG_RD, + &sc->dma_load_fail, "DMA load buffer failures"); +} + /* * Device Interface */ @@ -339,6 +355,8 @@ /* poke the bus to actually attach the child devices */ bus_generic_attach(sc->aac_dev); + aacraid_setup_sysctl(sc); + /* mark the controller up */ sc->aac_state &= ~AAC_STATE_SUSPEND; @@ -1298,6 +1316,18 @@ fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "nseg %d", nseg); mtx_assert(&sc->aac_io_lock, MA_OWNED); + if (error != 0) { + if (sc->dma_load_fail == 0) + device_printf(sc->aac_dev, + "ERROR: failed to load buffer to DMA area, error %d\n", + error); + sc->dma_load_fail++; + /* + * Let the command run (and fail) to be able to clean up and + * wake up waiters in the interrupt handler. + */ + } + if ((sc->flags & AAC_FLAGS_SYNC_MODE) && sc->aac_sync_cm) return; Index: sys/dev/aacraid/aacraid_var.h =================================================================== --- sys/dev/aacraid/aacraid_var.h +++ sys/dev/aacraid/aacraid_var.h @@ -468,6 +468,8 @@ u_int32_t DebugHeaderSize; /* Size of debug header */ u_int32_t FwDebugFlags; /* FW Debug Flags */ u_int32_t FwDebugBufferSize; /* FW Debug Buffer size */ + + unsigned long dma_load_fail; /* DMA load failure counter */ }; /*