aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mps
diff options
context:
space:
mode:
authorScott Long <scottl@FreeBSD.org>2017-07-30 22:34:24 +0000
committerScott Long <scottl@FreeBSD.org>2017-07-30 22:34:24 +0000
commit055e2653d4ae358dd8b639ddf2c40fd9358e9ff8 (patch)
tree735a285c57354bd7007aa70c5042b26198518802 /sys/dev/mps
parenta08e9300f367d7ebd1e777c17d12957cd24b2ce9 (diff)
Notes
Diffstat (limited to 'sys/dev/mps')
-rw-r--r--sys/dev/mps/mps.c11
-rw-r--r--sys/dev/mps/mps_sas_lsi.c2
-rw-r--r--sys/dev/mps/mps_table.c16
-rw-r--r--sys/dev/mps/mps_table.h68
4 files changed, 30 insertions, 67 deletions
diff --git a/sys/dev/mps/mps.c b/sys/dev/mps/mps.c
index 3969d3e27673..378cb044e66a 100644
--- a/sys/dev/mps/mps.c
+++ b/sys/dev/mps/mps.c
@@ -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);
diff --git a/sys/dev/mps/mps_sas_lsi.c b/sys/dev/mps/mps_sas_lsi.c
index a110bd8f43b4..618d193bfedf 100644
--- a/sys/dev/mps/mps_sas_lsi.c
+++ b/sys/dev/mps/mps_sas_lsi.c
@@ -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,
diff --git a/sys/dev/mps/mps_table.c b/sys/dev/mps/mps_table.c
index b6c96edf2f02..3abcc6010faa 100644
--- a/sys/dev/mps/mps_table.c
+++ b/sys/dev/mps/mps_table.c
@@ -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);
diff --git a/sys/dev/mps/mps_table.h b/sys/dev/mps/mps_table.h
index 1fe6b1eedda4..77e060a89415 100644
--- a/sys/dev/mps/mps_table.h
+++ b/sys/dev/mps/mps_table.h
@@ -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