blob: 5040e14fce5144e3d4450f6f6c69267bcb5a14bc [file] [log] [blame]
Angel Pons32859fc2020-04-02 23:48:27 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Robbie Zhanged840022016-12-23 11:43:07 -08003#ifndef _SAR_H_
4#define _SAR_H_
5
6#include <stdint.h>
7
8#define NUM_SAR_LIMITS 4
9#define BYTES_PER_SAR_LIMIT 10
Pratik Prajapati7fd1e4b2017-08-11 14:06:57 -070010enum {
11 SAR_FCC,
12 SAR_EUROPE_JAPAN,
13 SAR_REST_OF_WORLD,
14 SAR_NUM_WGDS_GROUPS
15};
16
17struct wifi_sar_delta_table {
18 uint8_t version;
19 struct {
20 uint8_t power_max_2400mhz;
21 uint8_t power_chain_a_2400mhz;
22 uint8_t power_chain_b_2400mhz;
23 uint8_t power_max_5200mhz;
24 uint8_t power_chain_a_5200mhz;
25 uint8_t power_chain_b_5200mhz;
26 } __packed group[SAR_NUM_WGDS_GROUPS];
27} __packed;
Robbie Zhanged840022016-12-23 11:43:07 -080028
29/* Wifi SAR limit table structure */
30struct wifi_sar_limits {
31 /* Total 4 SAR limit sets, each has 10 bytes */
32 uint8_t sar_limit[NUM_SAR_LIMITS][BYTES_PER_SAR_LIMIT];
Pratik Prajapati7fd1e4b2017-08-11 14:06:57 -070033 struct wifi_sar_delta_table wgds;
34} __packed;
Robbie Zhanged840022016-12-23 11:43:07 -080035
36/*
37 * Retrieve the SAR limits data from VPD and decode it.
38 * sar_limits: Pointer to wifi_sar_limits where the resulted data is stored
39 *
Pratik Prajapati7fd1e4b2017-08-11 14:06:57 -070040 * Returns: 0 on success, -1 on errors (The VPD entry doesn't exist, or the
Robbie Zhanged840022016-12-23 11:43:07 -080041 * VPD entry contains non-heximal value.)
42 */
43int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits);
44
Justin TerAvestc650d6c2018-12-14 11:05:03 -070045const char *get_wifi_sar_cbfs_filename(void);
46
Robbie Zhanged840022016-12-23 11:43:07 -080047#endif /* _SAR_H_ */