Commit 86c01843 authored by Franky Lin's avatar Franky Lin Committed by Greg Kroah-Hartman

staging: brcm80211: absorb msgtrace.h in fullmac

Absorb msgtrace.h into dhd_common.c
Signed-off-by: default avatarFranky Lin <frankyl@broadcom.com>
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b49b14d2
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <dhd_bus.h> #include <dhd_bus.h>
#include <dhd_proto.h> #include <dhd_proto.h>
#include <dhd_dbg.h> #include <dhd_dbg.h>
#include <msgtrace.h>
#define BRCM_OUI "\x00\x10\x18" #define BRCM_OUI "\x00\x10\x18"
#define DOT11_OUI_LEN 3 #define DOT11_OUI_LEN 3
...@@ -57,6 +56,8 @@ void dhd_iscan_unlock(void); ...@@ -57,6 +56,8 @@ void dhd_iscan_unlock(void);
#endif #endif
#define EPI_VERSION_STR "4.218.248.5" #define EPI_VERSION_STR "4.218.248.5"
#define MSGTRACE_VERSION 1
#ifdef DHD_DEBUG #ifdef DHD_DEBUG
const char dhd_version[] = const char dhd_version[] =
"Dongle Host Driver, version " EPI_VERSION_STR "\nCompiled on " __DATE__ "Dongle Host Driver, version " EPI_VERSION_STR "\nCompiled on " __DATE__
...@@ -118,6 +119,22 @@ const bcm_iovar_t dhd_iovars[] = { ...@@ -118,6 +119,22 @@ const bcm_iovar_t dhd_iovars[] = {
{NULL, 0, 0, 0, 0} {NULL, 0, 0, 0, 0}
}; };
/* Message trace header */
struct msgtrace_hdr {
u8 version;
u8 spare;
u16 len; /* Len of the trace */
u32 seqnum; /* Sequence number of message. Useful
* if the messsage has been lost
* because of DMA error or a bus reset
* (ex: SDIO Func2)
*/
u32 discarded_bytes; /* Number of discarded bytes because of
trace overflow */
u32 discarded_printf; /* Number of discarded printf
because of trace overflow */
} __packed;
void dhd_common_init(void) void dhd_common_init(void)
{ {
/* Init global variables at run-time, not as part of the declaration. /* Init global variables at run-time, not as part of the declaration.
...@@ -732,12 +749,12 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) ...@@ -732,12 +749,12 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
case WLC_E_TRACE: case WLC_E_TRACE:
{ {
static u32 seqnum_prev; static u32 seqnum_prev;
msgtrace_hdr_t hdr; struct msgtrace_hdr hdr;
u32 nblost; u32 nblost;
char *s, *p; char *s, *p;
buf = (unsigned char *) event_data; buf = (unsigned char *) event_data;
memcpy(&hdr, buf, MSGTRACE_HDRLEN); memcpy(&hdr, buf, sizeof(struct msgtrace_hdr));
if (hdr.version != MSGTRACE_VERSION) { if (hdr.version != MSGTRACE_VERSION) {
DHD_ERROR( DHD_ERROR(
...@@ -751,7 +768,8 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) ...@@ -751,7 +768,8 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
} }
/* There are 2 bytes available at the end of data */ /* There are 2 bytes available at the end of data */
buf[MSGTRACE_HDRLEN + be16_to_cpu(hdr.len)] = '\0'; *(buf + sizeof(struct msgtrace_hdr)
+ be16_to_cpu(hdr.len)) = '\0';
if (be32_to_cpu(hdr.discarded_bytes) if (be32_to_cpu(hdr.discarded_bytes)
|| be32_to_cpu(hdr.discarded_printf)) { || be32_to_cpu(hdr.discarded_printf)) {
...@@ -774,7 +792,7 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) ...@@ -774,7 +792,7 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
* avoid display big * avoid display big
* printf (issue with Linux printk ) * printf (issue with Linux printk )
*/ */
p = (char *)&buf[MSGTRACE_HDRLEN]; p = (char *)&buf[sizeof(struct msgtrace_hdr)];
while ((s = strstr(p, "\n")) != NULL) { while ((s = strstr(p, "\n")) != NULL) {
*s = '\0'; *s = '\0';
printk(KERN_DEBUG"%s\n", p); printk(KERN_DEBUG"%s\n", p);
......
/*
* Copyright (c) 2010 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _MSGTRACE_H
#define _MSGTRACE_H
#define MSGTRACE_VERSION 1
/* Message trace header */
typedef struct msgtrace_hdr {
u8 version;
u8 spare;
u16 len; /* Len of the trace */
u32 seqnum; /* Sequence number of message. Useful
* if the messsage has been lost
* because of DMA error or a bus reset
* (ex: SDIO Func2)
*/
u32 discarded_bytes; /* Number of discarded bytes because of
trace overflow */
u32 discarded_printf; /* Number of discarded printf
because of trace overflow */
} __attribute__((packed)) msgtrace_hdr_t;
#define MSGTRACE_HDRLEN sizeof(msgtrace_hdr_t)
/* The hbus driver generates traces when sending a trace message.
* This causes endless traces.
* This flag must be set to true in any hbus traces.
* The flag is reset in the function msgtrace_put.
* This prevents endless traces but generates hasardous
* lost of traces only in bus device code.
* It is recommendat to set this flag in macro SD_TRACE
* but not in SD_ERROR for avoiding missing
* hbus error traces. hbus error trace should not generates endless traces.
*/
extern bool msgtrace_hbus_trace;
typedef void (*msgtrace_func_send_t) (void *hdl1, void *hdl2, u8 *hdr,
u16 hdrlen, u8 *buf,
u16 buflen);
extern void msgtrace_sent(void);
extern void msgtrace_put(char *buf, int count);
extern void msgtrace_init(void *hdl1, void *hdl2,
msgtrace_func_send_t func_send);
#endif /* _MSGTRACE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment