Change from using underbar function names to normal function names for

the informational print functions.  Collapse the debug API a bit to be
more generic and not require as much code duplication.  While here, fix
a bug in MPS that was already fixed in MPR.
This commit is contained in:
Scott Long 2017-07-30 22:34:24 +00:00
parent a08e9300f3
commit 055e2653d4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=321733
8 changed files with 57 additions and 135 deletions

View File

@ -381,7 +381,7 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t attaching)
}
}
mpr_print_iocfacts(sc, sc->facts);
MPR_DPRINT_PAGE(sc, MPR_XINFO, iocfacts, sc->facts);
snprintf(sc->fw_version, sizeof(sc->fw_version),
"%02d.%02d.%02d.%02d",
@ -1772,7 +1772,7 @@ mpr_log_evt_handler(struct mpr_softc *sc, uintptr_t data,
{
MPI2_EVENT_DATA_LOG_ENTRY_ADDED *entry;
mpr_print_event(sc, event);
MPR_DPRINT_EVENT(sc, generic, event);
switch (event->Event) {
case MPI2_EVENT_LOG_DATA:
@ -2187,7 +2187,7 @@ mpr_reregister_events_complete(struct mpr_softc *sc, struct mpr_command *cm)
mpr_dprint(sc, MPR_TRACE, "%s\n", __func__);
if (cm->cm_reply)
mpr_print_event(sc,
MPR_DPRINT_EVENT(sc, generic,
(MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply);
mpr_free_command(sc, cm);
@ -2270,7 +2270,7 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_event_handle *handle,
error = ENXIO;
if (reply)
mpr_print_event(sc, reply);
MPR_DPRINT_EVENT(sc, generic, reply);
mpr_dprint(sc, MPR_TRACE, "%s finished error %d\n", __func__, error);

View File

@ -139,7 +139,7 @@ mprsas_evt_handler(struct mpr_softc *sc, uintptr_t data,
u16 sz;
mpr_dprint(sc, MPR_TRACE, "%s\n", __func__);
mpr_print_evt_sas(sc, event);
MPR_DPRINT_EVENT(sc, sas, event);
mprsas_record_event(sc, event);
fw_event = malloc(sizeof(struct mpr_fw_event_work), M_MPR,

View File

@ -219,7 +219,7 @@ mpr_describe_devinfo(uint32_t devinfo, char *string, int len)
}
void
_mpr_print_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_REPLY *facts)
mpr_print_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_REPLY *facts)
{
MPR_PRINTFIELD_START(sc, "IOCFacts");
MPR_PRINTFIELD(sc, facts, MsgVersion, 0x%x);
@ -259,7 +259,7 @@ _mpr_print_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_REPLY *facts)
}
void
_mpr_print_portfacts(struct mpr_softc *sc, MPI2_PORT_FACTS_REPLY *facts)
mpr_print_portfacts(struct mpr_softc *sc, MPI2_PORT_FACTS_REPLY *facts)
{
MPR_PRINTFIELD_START(sc, "PortFacts");
@ -269,7 +269,7 @@ _mpr_print_portfacts(struct mpr_softc *sc, MPI2_PORT_FACTS_REPLY *facts)
}
void
_mpr_print_event(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
mpr_print_evt_generic(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
{
MPR_PRINTFIELD_START(sc, "EventReply");
@ -281,7 +281,7 @@ _mpr_print_event(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
}
void
_mpr_print_sasdev0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_DEV_0 *buf)
mpr_print_sasdev0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_DEV_0 *buf)
{
MPR_PRINTFIELD_START(sc, "SAS Device Page 0");
MPR_PRINTFIELD(sc, buf, Slot, %d);
@ -310,10 +310,10 @@ _mpr_print_sasdev0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_DEV_0 *buf)
}
void
_mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
{
_mpr_print_event(sc, event);
mpr_print_evt_generic(sc, event);
switch(event->Event) {
case MPI2_EVENT_SAS_DISCOVERY:
@ -407,7 +407,7 @@ _mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
}
void
_mpr_print_expander1(struct mpr_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf)
mpr_print_expander1(struct mpr_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf)
{
MPR_PRINTFIELD_START(sc, "SAS Expander Page 1 #%d", buf->Phy);
MPR_PRINTFIELD(sc, buf, PhysicalPort, %d);
@ -447,7 +447,7 @@ _mpr_print_expander1(struct mpr_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf)
}
void
_mpr_print_sasphy0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_PHY_0 *buf)
mpr_print_sasphy0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_PHY_0 *buf)
{
MPR_PRINTFIELD_START(sc, "SAS PHY Page 0");
MPR_PRINTFIELD(sc, buf, OwnerDevHandle, 0x%04x);

View File

@ -42,63 +42,22 @@ extern struct mpr_table_lookup mpr_phystatus_names[];
extern struct mpr_table_lookup mpr_linkrate_names[];
extern struct mpr_table_lookup mpr_pcie_linkrate_names[];
void _mpr_print_iocfacts(struct mpr_softc *, MPI2_IOC_FACTS_REPLY *);
void _mpr_print_portfacts(struct mpr_softc *, MPI2_PORT_FACTS_REPLY *);
void _mpr_print_event(struct mpr_softc *, MPI2_EVENT_NOTIFICATION_REPLY *);
void _mpr_print_sasdev0(struct mpr_softc *, MPI2_CONFIG_PAGE_SAS_DEV_0 *);
void _mpr_print_evt_sas(struct mpr_softc *, MPI2_EVENT_NOTIFICATION_REPLY *);
void _mpr_print_expander1(struct mpr_softc *, MPI2_CONFIG_PAGE_EXPANDER_1 *);
void _mpr_print_sasphy0(struct mpr_softc *, MPI2_CONFIG_PAGE_SAS_PHY_0 *);
void mpr_print_iocfacts(struct mpr_softc *, MPI2_IOC_FACTS_REPLY *);
void mpr_print_portfacts(struct mpr_softc *, MPI2_PORT_FACTS_REPLY *);
void mpr_print_evt_generic(struct mpr_softc *, MPI2_EVENT_NOTIFICATION_REPLY *);
void mpr_print_sasdev0(struct mpr_softc *, MPI2_CONFIG_PAGE_SAS_DEV_0 *);
void mpr_print_evt_sas(struct mpr_softc *, MPI2_EVENT_NOTIFICATION_REPLY *);
void mpr_print_expander1(struct mpr_softc *, MPI2_CONFIG_PAGE_EXPANDER_1 *);
void mpr_print_sasphy0(struct mpr_softc *, MPI2_CONFIG_PAGE_SAS_PHY_0 *);
void mpr_print_sgl(struct mpr_softc *, struct mpr_command *, int);
void mpr_print_scsiio_cmd(struct mpr_softc *, struct mpr_command *);
static __inline void
mpr_print_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_REPLY *facts)
{
if (sc->mpr_debug & MPR_XINFO)
_mpr_print_iocfacts(sc, facts);
}
static __inline void
mpr_print_portfacts(struct mpr_softc *sc, MPI2_PORT_FACTS_REPLY *facts)
{
if (sc->mpr_debug & MPR_XINFO)
_mpr_print_portfacts(sc, facts);
}
static __inline void
mpr_print_event(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
{
if (sc->mpr_debug & MPR_EVENT)
_mpr_print_event(sc, event);
}
static __inline void
mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
{
if (sc->mpr_debug & MPR_EVENT)
_mpr_print_evt_sas(sc, event);
}
static __inline void
mpr_print_sasdev0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_DEV_0 *buf)
{
if (sc->mpr_debug & MPR_XINFO)
_mpr_print_sasdev0(sc, buf);
}
static __inline void
mpr_print_expander1(struct mpr_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf)
{
if (sc->mpr_debug & MPR_XINFO)
_mpr_print_expander1(sc, buf);
}
static __inline void
mpr_print_sasphy0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_PHY_0 *buf)
{
if (sc->mpr_debug & MPR_XINFO)
_mpr_print_sasphy0(sc, buf);
}
#define MPR_DPRINT_PAGE(sc, level, func, buf) \
do { \
if ((sc)->mpr_debug & level) \
mpr_print_##func((sc), buf); \
} while (0)
#define MPR_DPRINT_EVENT(sc, func, buf) \
MPR_DPRINT_PAGE(sc, MPR_EVENT, evt_##func, buf)
#endif

View File

@ -373,7 +373,7 @@ mps_iocfacts_allocate(struct mps_softc *sc, uint8_t attaching)
}
}
mps_print_iocfacts(sc, sc->facts);
MPS_DPRINT_PAGE(sc, MPS_XINFO, iocfacts, sc->facts);
snprintf(sc->fw_version, sizeof(sc->fw_version),
"%02d.%02d.%02d.%02d",
@ -1623,7 +1623,7 @@ mps_log_evt_handler(struct mps_softc *sc, uintptr_t data,
{
MPI2_EVENT_DATA_LOG_ENTRY_ADDED *entry;
mps_print_event(sc, event);
MPS_DPRINT_EVENT(sc, generic, event);
switch (event->Event) {
case MPI2_EVENT_LOG_DATA:
@ -2033,7 +2033,7 @@ mps_reregister_events_complete(struct mps_softc *sc, struct mps_command *cm)
mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
if (cm->cm_reply)
mps_print_event(sc,
MPS_DPRINT_EVENT(sc, generic,
(MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply);
mps_free_command(sc, cm);
@ -2118,7 +2118,10 @@ mps_update_events(struct mps_softc *sc, struct mps_event_handle *handle,
if ((reply == NULL) ||
(reply->IOCStatus & MPI2_IOCSTATUS_MASK) != MPI2_IOCSTATUS_SUCCESS)
error = ENXIO;
mps_print_event(sc, reply);
if (reply)
MPS_DPRINT_EVENT(sc, generic, reply);
mps_dprint(sc, MPS_TRACE, "%s finished error %d\n", __func__, error);
mps_free_command(sc, cm);

View File

@ -136,7 +136,7 @@ mpssas_evt_handler(struct mps_softc *sc, uintptr_t data,
u16 sz;
mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
mps_print_evt_sas(sc, event);
MPS_DPRINT_EVENT(sc, sas, event);
mpssas_record_event(sc, event);
fw_event = malloc(sizeof(struct mps_fw_event_work), M_MPT2,

View File

@ -196,7 +196,7 @@ mps_describe_devinfo(uint32_t devinfo, char *string, int len)
}
void
_mps_print_iocfacts(struct mps_softc *sc, MPI2_IOC_FACTS_REPLY *facts)
mps_print_iocfacts(struct mps_softc *sc, MPI2_IOC_FACTS_REPLY *facts)
{
MPS_PRINTFIELD_START(sc, "IOCFacts");
@ -237,7 +237,7 @@ _mps_print_iocfacts(struct mps_softc *sc, MPI2_IOC_FACTS_REPLY *facts)
}
void
_mps_print_portfacts(struct mps_softc *sc, MPI2_PORT_FACTS_REPLY *facts)
mps_print_portfacts(struct mps_softc *sc, MPI2_PORT_FACTS_REPLY *facts)
{
MPS_PRINTFIELD_START(sc, "PortFacts");
@ -247,7 +247,7 @@ _mps_print_portfacts(struct mps_softc *sc, MPI2_PORT_FACTS_REPLY *facts)
}
void
_mps_print_event(struct mps_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
mps_print_evt_generic(struct mps_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
{
MPS_PRINTFIELD_START(sc, "EventReply");
@ -259,7 +259,7 @@ _mps_print_event(struct mps_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
}
void
_mps_print_sasdev0(struct mps_softc *sc, MPI2_CONFIG_PAGE_SAS_DEV_0 *buf)
mps_print_sasdev0(struct mps_softc *sc, MPI2_CONFIG_PAGE_SAS_DEV_0 *buf)
{
MPS_PRINTFIELD_START(sc, "SAS Device Page 0");
MPS_PRINTFIELD(sc, buf, Slot, %d);
@ -288,10 +288,10 @@ _mps_print_sasdev0(struct mps_softc *sc, MPI2_CONFIG_PAGE_SAS_DEV_0 *buf)
}
void
_mps_print_evt_sas(struct mps_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
mps_print_evt_sas(struct mps_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
{
_mps_print_event(sc, event);
mps_print_evt_generic(sc, event);
switch(event->Event) {
case MPI2_EVENT_SAS_DISCOVERY:
@ -384,7 +384,7 @@ _mps_print_evt_sas(struct mps_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
}
void
_mps_print_expander1(struct mps_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf)
mps_print_expander1(struct mps_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf)
{
MPS_PRINTFIELD_START(sc, "SAS Expander Page 1 #%d", buf->Phy);
MPS_PRINTFIELD(sc, buf, PhysicalPort, %d);
@ -424,7 +424,7 @@ _mps_print_expander1(struct mps_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf)
}
void
_mps_print_sasphy0(struct mps_softc *sc, MPI2_CONFIG_PAGE_SAS_PHY_0 *buf)
mps_print_sasphy0(struct mps_softc *sc, MPI2_CONFIG_PAGE_SAS_PHY_0 *buf)
{
MPS_PRINTFIELD_START(sc, "SAS PHY Page 0");
MPS_PRINTFIELD(sc, buf, OwnerDevHandle, 0x%04x);

View File

@ -41,63 +41,23 @@ extern struct mps_table_lookup mps_event_names[];
extern struct mps_table_lookup mps_phystatus_names[];
extern struct mps_table_lookup mps_linkrate_names[];
void _mps_print_iocfacts(struct mps_softc *, MPI2_IOC_FACTS_REPLY *);
void _mps_print_portfacts(struct mps_softc *, MPI2_PORT_FACTS_REPLY *);
void _mps_print_event(struct mps_softc *, MPI2_EVENT_NOTIFICATION_REPLY *);
void _mps_print_sasdev0(struct mps_softc *, MPI2_CONFIG_PAGE_SAS_DEV_0 *);
void _mps_print_evt_sas(struct mps_softc *, MPI2_EVENT_NOTIFICATION_REPLY *);
void _mps_print_expander1(struct mps_softc *, MPI2_CONFIG_PAGE_EXPANDER_1 *);
void _mps_print_sasphy0(struct mps_softc *, MPI2_CONFIG_PAGE_SAS_PHY_0 *);
void mps_print_iocfacts(struct mps_softc *, MPI2_IOC_FACTS_REPLY *);
void mps_print_portfacts(struct mps_softc *, MPI2_PORT_FACTS_REPLY *);
void mps_print_evt_generic(struct mps_softc *, MPI2_EVENT_NOTIFICATION_REPLY *);
void mps_print_sasdev0(struct mps_softc *, MPI2_CONFIG_PAGE_SAS_DEV_0 *);
void mps_print_evt_sas(struct mps_softc *, MPI2_EVENT_NOTIFICATION_REPLY *);
void mps_print_expander1(struct mps_softc *, MPI2_CONFIG_PAGE_EXPANDER_1 *);
void mps_print_sasphy0(struct mps_softc *, MPI2_CONFIG_PAGE_SAS_PHY_0 *);
void mps_print_sgl(struct mps_softc *, struct mps_command *, int);
void mps_print_scsiio_cmd(struct mps_softc *, struct mps_command *);
static __inline void
mps_print_iocfacts(struct mps_softc *sc, MPI2_IOC_FACTS_REPLY *facts)
{
if (sc->mps_debug & MPS_XINFO)
_mps_print_iocfacts(sc, facts);
}
#define MPS_DPRINT_PAGE(sc, level, func, buf) \
do { \
if ((sc)->mps_debug & level) \
mps_print_##func((sc), buf); \
} while (0)
static __inline void
mps_print_portfacts(struct mps_softc *sc, MPI2_PORT_FACTS_REPLY *facts)
{
if (sc->mps_debug & MPS_XINFO)
_mps_print_portfacts(sc, facts);
}
static __inline void
mps_print_event(struct mps_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
{
if (sc->mps_debug & MPS_EVENT)
_mps_print_event(sc, event);
}
static __inline void
mps_print_sasdev0(struct mps_softc *sc, MPI2_CONFIG_PAGE_SAS_DEV_0 *buf)
{
if (sc->mps_debug & MPS_XINFO)
_mps_print_sasdev0(sc, buf);
}
static __inline void
mps_print_evt_sas(struct mps_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event)
{
if (sc->mps_debug & MPS_EVENT)
_mps_print_evt_sas(sc, event);
}
static __inline void
mps_print_expander1(struct mps_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf)
{
if (sc->mps_debug & MPS_XINFO)
_mps_print_expander1(sc, buf);
}
static __inline void
mps_print_sasphy0(struct mps_softc *sc, MPI2_CONFIG_PAGE_SAS_PHY_0 *buf)
{
if (sc->mps_debug & MPS_XINFO)
_mps_print_sasphy0(sc, buf);
}
#define MPS_DPRINT_EVENT(sc, func, buf) \
MPS_DPRINT_PAGE(sc, MPS_EVENT, evt_##func, buf)
#endif