Author: scottl
Date: Sun Jul 30 22:34:24 2017
New Revision: 321733
URL: https://svnweb.freebsd.org/changeset/base/321733

Log:
  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.

Modified:
  head/sys/dev/mpr/mpr.c
  head/sys/dev/mpr/mpr_sas_lsi.c
  head/sys/dev/mpr/mpr_table.c
  head/sys/dev/mpr/mpr_table.h
  head/sys/dev/mps/mps.c
  head/sys/dev/mps/mps_sas_lsi.c
  head/sys/dev/mps/mps_table.c
  head/sys/dev/mps/mps_table.h

Modified: head/sys/dev/mpr/mpr.c
==============================================================================
--- head/sys/dev/mpr/mpr.c      Sun Jul 30 22:17:08 2017        (r321732)
+++ head/sys/dev/mpr/mpr.c      Sun Jul 30 22:34:24 2017        (r321733)
@@ -381,7 +381,7 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at
                }
        }
 
-       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 da
 {
        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, s
        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_eve
                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);
 

Modified: head/sys/dev/mpr/mpr_sas_lsi.c
==============================================================================
--- head/sys/dev/mpr/mpr_sas_lsi.c      Sun Jul 30 22:17:08 2017        
(r321732)
+++ head/sys/dev/mpr/mpr_sas_lsi.c      Sun Jul 30 22:34:24 2017        
(r321733)
@@ -139,7 +139,7 @@ mprsas_evt_handler(struct mpr_softc *sc, uintptr_t dat
        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,

Modified: head/sys/dev/mpr/mpr_table.c
==============================================================================
--- head/sys/dev/mpr/mpr_table.c        Sun Jul 30 22:17:08 2017        
(r321732)
+++ head/sys/dev/mpr/mpr_table.c        Sun Jul 30 22:34:24 2017        
(r321733)
@@ -219,7 +219,7 @@ mpr_describe_devinfo(uint32_t devinfo, char *string, i
 }
 
 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_FAC
 }
 
 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_F
 }
 
 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_NOTI
 }
 
 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_P
 }
 
 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_NO
 }
 
 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
 }
 
 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);

Modified: head/sys/dev/mpr/mpr_table.h
==============================================================================
--- head/sys/dev/mpr/mpr_table.h        Sun Jul 30 22:17:08 2017        
(r321732)
+++ head/sys/dev/mpr/mpr_table.h        Sun Jul 30 22:34:24 2017        
(r321733)
@@ -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);
-}
+#define MPR_DPRINT_PAGE(sc, level, func, buf)                  \
+do {                                                           \
+       if ((sc)->mpr_debug & level)                            \
+               mpr_print_##func((sc), buf);                    \
+} while (0)
 
-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_EVENT(sc, func, buf)                                \
+       MPR_DPRINT_PAGE(sc, MPR_EVENT, evt_##func, buf)
 #endif

Modified: head/sys/dev/mps/mps.c
==============================================================================
--- head/sys/dev/mps/mps.c      Sun Jul 30 22:17:08 2017        (r321732)
+++ head/sys/dev/mps/mps.c      Sun Jul 30 22:34:24 2017        (r321733)
@@ -373,7 +373,7 @@ mps_iocfacts_allocate(struct mps_softc *sc, uint8_t at
                }
        }
 
-       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 da
 {
        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, s
        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_eve
        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);

Modified: head/sys/dev/mps/mps_sas_lsi.c
==============================================================================
--- head/sys/dev/mps/mps_sas_lsi.c      Sun Jul 30 22:17:08 2017        
(r321732)
+++ head/sys/dev/mps/mps_sas_lsi.c      Sun Jul 30 22:34:24 2017        
(r321733)
@@ -136,7 +136,7 @@ mpssas_evt_handler(struct mps_softc *sc, uintptr_t dat
        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,

Modified: head/sys/dev/mps/mps_table.c
==============================================================================
--- head/sys/dev/mps/mps_table.c        Sun Jul 30 22:17:08 2017        
(r321732)
+++ head/sys/dev/mps/mps_table.c        Sun Jul 30 22:34:24 2017        
(r321733)
@@ -196,7 +196,7 @@ mps_describe_devinfo(uint32_t devinfo, char *string, i
 }
 
 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_FAC
 }
 
 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_F
 }
 
 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_NOTI
 }
 
 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_P
 }
 
 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_NO
 }
 
 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
 }
 
 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);

Modified: head/sys/dev/mps/mps_table.h
==============================================================================
--- head/sys/dev/mps/mps_table.h        Sun Jul 30 22:17:08 2017        
(r321732)
+++ head/sys/dev/mps/mps_table.h        Sun Jul 30 22:34:24 2017        
(r321733)
@@ -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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to