xref: /freebsd/sys/dev/rtwn/rtl8192e/r92e_rom_image.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1 /*-
2  * Copyright (c) 2017 Kevin Lo <kevlo@FreeBSD.org>
3  *
4  * Permission to use, copy, modify, and distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #ifndef R92E_ROM_IMAGE_H
18 #define R92E_ROM_IMAGE_H
19 
20 #include <dev/rtwn/rtl8192e/r92e_rom_defs.h>
21 
22 #define	R92E_DEF_TX_PWR_2G		0x2d
23 #define	R92E_DEF_TX_PWR_HT20_DIFF	0x02
24 #define	R92E_DEF_TX_PWR_DIFF		0xfe
25 
26 struct r92e_tx_pwr_2g {
27 	uint8_t		cck[R92E_GROUP_2G];
28 	uint8_t		ht40[R92E_GROUP_2G - 1];
29 } __packed;
30 
31 struct r92e_tx_pwr_diff_2g {
32 	uint8_t		ht20_ofdm;
33 	struct {
34 		uint8_t	ht40_ht20;
35 		uint8_t	ofdm_cck;
36 	} __packed	diff123[R92E_MAX_TX_COUNT - 1];
37 } __packed;
38 
39 struct r92e_tx_pwr {
40 	struct r92e_tx_pwr_2g		pwr_2g;
41 	struct r92e_tx_pwr_diff_2g	pwr_diff_2g;
42 	uint8_t				reserved[24];
43 } __packed;
44 
45 /*
46  * RTL8192EU ROM image.
47  */
48 struct r92e_rom {
49 	uint8_t			reserved1[16];
50 	struct r92e_tx_pwr	tx_pwr[R92E_MAX_RF_PATH];
51 	uint8_t			channel_plan;
52 	uint8_t			crystalcap;
53 #define R92E_ROM_CRYSTALCAP_DEF		0x20
54 
55 	uint8_t			thermal_meter;
56 	uint8_t			iqk_lck;
57 	uint8_t			pa_type;
58 	uint8_t			lna_type_2g;
59 	uint8_t			reserved2;
60 	uint8_t			lna_type_5g;
61 	uint8_t			reserved3;
62 	uint8_t			rf_board_opt;
63 	uint8_t			rf_feature_opt;
64 	uint8_t			rf_bt_opt;
65 	uint8_t			version;
66 	uint8_t			customer_id;
67 	uint8_t			tx_bbswing_2g;
68 	uint8_t			tx_bbswing_5g;
69 	uint8_t			tx_pwr_calib_rate;
70 	uint8_t			rf_ant_opt;
71 	uint8_t			rfe_option;
72 	uint8_t			reserved4[5];
73 	uint16_t		vid;
74 	uint16_t		pid;
75 	uint8_t			reserved5[3];
76 	uint8_t			macaddr[IEEE80211_ADDR_LEN];
77 	uint8_t			reserved6[2];
78 	uint8_t			string[7];	/* "Realtek" */
79 	uint8_t			reserved7[282];
80 } __packed;
81 
82 _Static_assert(sizeof(struct r92e_rom) == R92E_EFUSE_MAP_LEN,
83     "R92E_EFUSE_MAP_LEN must be equal to sizeof(struct r92e_rom)!");
84 
85 #endif	/* R92E_ROM_IMAGE_H */
86