brcmfmac: show firmware error as string in debug message
authorArend van Spriel <arend@broadcom.com>
Tue, 28 Oct 2014 13:56:07 +0000 (14:56 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 30 Oct 2014 19:24:50 +0000 (15:24 -0400)
Showing the firmware error allows to quickly give a clue what
went wrong and directly look in the firmware code that gave us
back the error.

Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmfmac/fwil.c

index ded328f80cd1237454274ce53fd39433249b0e85..42da73e261421852adf86cd17e81475564446e2a 100644 (file)
 
 #define MAX_HEX_DUMP_LEN       64
 
+#ifdef DEBUG
+static const char * const brcmf_fil_errstr[] = {
+       "BCME_OK",
+       "BCME_ERROR",
+       "BCME_BADARG",
+       "BCME_BADOPTION",
+       "BCME_NOTUP",
+       "BCME_NOTDOWN",
+       "BCME_NOTAP",
+       "BCME_NOTSTA",
+       "BCME_BADKEYIDX",
+       "BCME_RADIOOFF",
+       "BCME_NOTBANDLOCKED",
+       "BCME_NOCLK",
+       "BCME_BADRATESET",
+       "BCME_BADBAND",
+       "BCME_BUFTOOSHORT",
+       "BCME_BUFTOOLONG",
+       "BCME_BUSY",
+       "BCME_NOTASSOCIATED",
+       "BCME_BADSSIDLEN",
+       "BCME_OUTOFRANGECHAN",
+       "BCME_BADCHAN",
+       "BCME_BADADDR",
+       "BCME_NORESOURCE",
+       "BCME_UNSUPPORTED",
+       "BCME_BADLEN",
+       "BCME_NOTREADY",
+       "BCME_EPERM",
+       "BCME_NOMEM",
+       "BCME_ASSOCIATED",
+       "BCME_RANGE",
+       "BCME_NOTFOUND",
+       "BCME_WME_NOT_ENABLED",
+       "BCME_TSPEC_NOTFOUND",
+       "BCME_ACM_NOTSUPPORTED",
+       "BCME_NOT_WME_ASSOCIATION",
+       "BCME_SDIO_ERROR",
+       "BCME_DONGLE_DOWN",
+       "BCME_VERSION",
+       "BCME_TXFAIL",
+       "BCME_RXFAIL",
+       "BCME_NODEVICE",
+       "BCME_NMODE_DISABLED",
+       "BCME_NONRESIDENT",
+       "BCME_SCANREJECT",
+       "BCME_USAGE_ERROR",
+       "BCME_IOCTL_ERROR",
+       "BCME_SERIAL_PORT_ERR",
+       "BCME_DISABLED",
+       "BCME_DECERR",
+       "BCME_ENCERR",
+       "BCME_MICERR",
+       "BCME_REPLAY",
+       "BCME_IE_NOTFOUND",
+};
+
+static const char *brcmf_fil_get_errstr(u32 err)
+{
+       if (err >= ARRAY_SIZE(brcmf_fil_errstr))
+               return "(unknown)";
+
+       return brcmf_fil_errstr[err];
+}
+#else
+static const char *brcmf_fil_get_errstr(u32 err)
+{
+       return "";
+}
+#endif /* DEBUG */
 
 static s32
 brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set)
@@ -54,7 +124,8 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set)
        if (err >= 0)
                err = 0;
        else
-               brcmf_dbg(FIL, "Failed err=%d\n", err);
+               brcmf_dbg(FIL, "Failed: %s (%d)\n",
+                         brcmf_fil_get_errstr((u32)(-err)), err);
 
        return err;
 }