1 /*
2  * Copyright (c) 2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  *  DOC: wlan_hdd_bootup_marker.c
21  *
22  *  WLAN Host Device Driver bootup marker implementation
23  *
24  */
25 
26 #include "wlan_hdd_bootup_marker.h"
27 #include <soc/qcom/boot_stats.h>
28 #include <qdf_trace.h>
29 
30 #ifdef DYNAMIC_SINGLE_CHIP
31 #define PREFIX_MARKER DYNAMIC_SINGLE_CHIP
32 #else
33 #ifdef MULTI_IF_NAME
34 #define PREFIX_MARKER MULTI_IF_NAME
35 #else
36 #define PREFIX_MARKER ""
37 #endif
38 #endif
39 
40 #ifndef WLAN_PLACEMARKER_PREFIX
41 #define WLAN_PLACEMARKER_PREFIX ""
42 #define WLAN_MARKER WLAN_PLACEMARKER_PREFIX PREFIX_MARKER " "
43 #else
44 #define WLAN_MARKER WLAN_PLACEMARKER_PREFIX " " PREFIX_MARKER " "
45 #endif
46 
hdd_place_marker(struct hdd_adapter * adapter,const char * format,uint8_t * mac)47 void hdd_place_marker(struct hdd_adapter *adapter,
48 		      const char *format,
49 		      uint8_t *mac)
50 {
51 	char marker[100];
52 
53 	if (adapter) {
54 		if (mac)
55 			qdf_snprintf(marker, sizeof(marker),
56 				     (WLAN_MARKER "%s:%s %s:" QDF_MAC_ADDR_FMT),
57 				     (adapter->dev->name),
58 				     qdf_opmode_str(adapter->device_mode),
59 				     format, QDF_MAC_ADDR_REF(mac));
60 		else
61 			qdf_snprintf(marker, sizeof(marker),
62 				     (WLAN_MARKER "%s:%s %s"),
63 				     (adapter->dev->name),
64 				     qdf_opmode_str(adapter->device_mode),
65 				     format);
66 	} else {
67 		qdf_snprintf(marker, sizeof(marker),
68 			     (WLAN_MARKER "%s"),
69 			     format);
70 	}
71 
72 	place_marker(marker);
73 }
74 
75