blob: c3fa8391a9eaab4671bd9c377baeee63f4e91aba [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
2 * Copyright (c) 2015 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/**
29 * DOC : wlan_hdd_memdump.h
30 *
31 * WLAN Host Device Driver file for dumping firmware memory
32 *
33 */
34
35#if !defined(WLAN_HDD_MEMDUMP_H)
36#define WLAN_HDD_MEMDUMP_H
37
38#include "wlan_hdd_main.h"
39
40#ifdef WLAN_FEATURE_MEMDUMP
41/**
42 * enum qca_wlan_vendor_attr_memory_dump - values for memory dump attributes
43 * @QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_INVALID - Invalid
44 * @QCA_WLAN_VENDOR_ATTR_REQUEST_ID - Indicate request ID
45 * @QCA_WLAN_VENDOR_ATTR_MEMDUMP_SIZE - Indicate size of the memory dump
46 * @QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_AFTER_LAST - To keep track of the last enum
47 * @QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_MAX - max value possible for this type
48 *
49 * enum values are used for NL attributes for data used by
50 * QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP sub command.
51 */
52enum qca_wlan_vendor_attr_memory_dump {
53 QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_INVALID = 0,
54 QCA_WLAN_VENDOR_ATTR_REQUEST_ID = 1,
55 QCA_WLAN_VENDOR_ATTR_MEMDUMP_SIZE = 2,
56
57 QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_AFTER_LAST,
58 QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_MAX =
59 QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_AFTER_LAST - 1,
60};
61
62/* Size of fw memory dump is estimated to be 327680 bytes */
63#define FW_MEM_DUMP_SIZE 327680
64#define FW_DRAM_LOCATION 0x00400000
65#define FW_MEM_DUMP_REQ_ID 1
66#define FW_MEM_DUMP_NUM_SEG 1
67#define MEMDUMP_COMPLETION_TIME_MS 5000
68
69int memdump_init(void);
70void memdump_deinit(void);
71int wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
72 struct wireless_dev *wdev,
73 const void *data, int data_len);
74#else
75static inline int memdump_init(void)
76{
77 return -ENOTSUPP;
78}
79
80static inline void memdump_deinit(void)
81{
82}
83
84static inline int wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
85 struct wireless_dev *wdev,
86 const void *data, int data_len)
87{
88 return -ENOTSUPP;
89}
90#endif
91
92#endif /* if !defined(WLAN_HDD_MEMDUMP_H)*/