hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/******************************************************************************
 *
 * Copyright(c) 2007 - 2020 Realtek Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 *****************************************************************************/
#if defined(CONFIG_MP_INCLUDED)
#ifndef __RTW_EFUSE_H__
#define __RTW_EFUSE_H__
#include <drv_types.h>
#include <rtw_mp.h>
 
#define RTW_MAX_EFUSE_MAP_LEN 2048
 
enum rtw_efuse_type {
   RTW_EFUSE_WIFI = 0,
   RTW_EFUSE_BT,
   RTW_EFUSE_NONE,
};
 
/* PHL efuse command */
enum rtw_efuse_phl_cmdid {
   RTW_EFUSE_CMD_WIFI_READ = 0,
   RTW_EFUSE_CMD_WIFI_WRITE = 1,
   RTW_EFUSE_CMD_WIFI_UPDATE = 2,
   RTW_EFUSE_CMD_WIFI_UPDATE_MAP = 3,
   RTW_EFUSE_CMD_WIFI_GET_OFFSET_MASK = 4,
   RTW_EFUSE_CMD_WIFI_GET_USAGE = 5,
   RTW_EFUSE_CMD_BT_READ = 6,
   RTW_EFUSE_CMD_BT_WRITE = 7,
   RTW_EFUSE_CMD_BT_UPDATE = 8,
   RTW_EFUSE_CMD_BT_UPDATE_MAP = 9,
   RTW_EFUSE_CMD_BT_GET_OFFSET_MASK = 10,
   RTW_EFUSE_CMD_BT_GET_USAGE = 11,
   RTW_EFUSE_CMD_WIFI_GET_LOG_SIZE = 12,
   RTW_EFUSE_CMD_WIFI_GET_SIZE = 13,
   RTW_EFUSE_CMD_WIFI_GET_AVL_SIZE = 14,
   RTW_EFUSE_CMD_AUTOLOAD_STATUS = 15,
   RTW_EFUSE_CMD_SHADOW_MAP2BUF = 16,
   RTW_EFUSE_CMD_FILE_MAP_LOAD = 17,
   RTW_EFUSE_CMD_FILE_MASK_LOAD = 18,
   RTW_MP_EFUSE_CMD_GET_INFO = 19,
   /* BT */
   RTW_EFUSE_CMD_BT_GET_LOG_SIZE = 20,
   RTW_EFUSE_CMD_BT_GET_SIZE = 21,
   RTW_EFUSE_CMD_BT_GET_AVL_SIZE = 22,
   RTW_EFUSE_CMD_BT_SHADOW_MAP2BUF = 23,
   RTW_EFUSE_CMD_BT_FILE_MAP_LOAD = 24,
   RTW_EFUSE_CMD_BT_FILE_MASK_LOAD = 25,
   RTW_EFUSE_CMD_BT_READ_HIDDEN = 26,
   RTW_EFUSE_CMD_BT_WRITE_HIDDEN = 27,
   RTW_MP_EFUSE_CMD_WIFI_GET_MAP_FROM =28,
   RTW_EFUSE_CMD_WIFI_GET_PHY_MAP = 29,
   RTW_EFUSE_CMD_BT_GET_PHY_MAP = 30,
   RTW_MP_EFUSE_CMD_WIFI_SET_RENEW = 31,
   RTW_EFUSE_CMD_WIFI_GET_MASK_BUF = 32,
   RTW_EFUSE_CMD_BT_GET_MASK_BUF = 33,
   RTW_EFUSE_CMD_MAX,
};
 
struct rtw_efuse_phl_arg {
   u8 mp_class;
   u8 cmd;
   u8 cmd_ok;
   u8 status;
   u8 io_type;
   u16 io_offset;
   u32 io_value;
   u8 autoload;
   u8 pfile_path[200];
   u16 buf_len;
   u8 poutbuf[1536];
};
 
enum RTW_EFUSE_MAP_STATUS {
   RTW_DEFAULT_MAP = 0,
   RTW_HW_LOG_MAP = 1,
   RTW_FILE_MAP = 2,
   RTW_EFUSE_UNKNOWN,
};
 
#define RTW_EFUSE_FROM2STR(status)\
(status == RTW_DEFAULT_MAP) ? "DEFAULT" :\
(status == RTW_HW_LOG_MAP) ? "HW_LOG_EFUSE" :\
(status == RTW_FILE_MAP) ? "FILE_EFUSE" :\
"UNknow"
 
s8 rtw_efuse_get_map_from(_adapter *padapter);
 
u32 rtw_efuse_get_map_size(_adapter *padapter , u16 *size , enum rtw_efuse_phl_cmdid cmdid);
 
u32 rtw_efuse_get_available_size(_adapter *padapter , u16 *size, u8 efuse_type);
 
u8 rtw_efuse_read_map2shadow(_adapter *padapter, u8 efuse_type);
 
u8 rtw_efuse_map_read(_adapter * adapter, u16 addr, u16 cnts, u8 *data, u8 efuse_type);
 
u8 rtw_efuse_map_write(_adapter * adapter, u16 addr, u16 cnts, u8 *data, u8 efuse_type, u8 bpg);
 
int rtw_ioctl_efuse_get(struct net_device *dev,
               struct iw_request_info *info,
               union iwreq_data *wrqu, char *extra);
 
int rtw_ioctl_efuse_set(struct net_device *dev,
               struct iw_request_info *info,
               union iwreq_data *wdata, char *extra);
 
int rtw_ioctl_efuse_file_map_load(struct net_device *dev,
               struct iw_request_info *info,
               union iwreq_data *wrqu, char *extra);
 
int rtw_ioctl_efuse_file_mask_load(struct net_device *dev,
               struct iw_request_info *info,
               union iwreq_data *wrqu, char *extra);
 
int rtw_ioctl_efuse_bt_file_map_load(struct net_device *dev,
               struct iw_request_info *info,
               union iwreq_data *wrqu, char *extra);
 
int rtw_ioctl_efuse_bt_file_mask_load(struct net_device *dev,
               struct iw_request_info *info,
               union iwreq_data *wrqu, char *extra);
 
u8 rtw_efuse_raw_map_read(_adapter * adapter, u16 addr,
               u16 cnts, u8 *data, u8 efuse_type);
 
u8 rtw_efuse_bt_write_raw_hidden(_adapter * adapter, u16 addr,
               u16 cnts, u8 *data);
#endif
 
#endif /*#if defined(CONFIG_MP_INCLUDED)*/