blob: e1e0fcb2d76f9d1e92ffc469873587acc3d96f54 [file] [log] [blame]
Robbie Zhanged840022016-12-23 11:43:07 -08001/*
2 * This file is part of the coreboot project.
3 *
Pratik Prajapati7fd1e4b2017-08-11 14:06:57 -07004 * Copyright (C) 2017-2018 Intel Corp.
Robbie Zhanged840022016-12-23 11:43:07 -08005 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15#ifndef _SAR_H_
16#define _SAR_H_
17
Pratik Prajapati7fd1e4b2017-08-11 14:06:57 -070018#include <compiler.h>
Robbie Zhanged840022016-12-23 11:43:07 -080019#include <stdint.h>
20
21#define NUM_SAR_LIMITS 4
22#define BYTES_PER_SAR_LIMIT 10
Pratik Prajapati7fd1e4b2017-08-11 14:06:57 -070023enum {
24 SAR_FCC,
25 SAR_EUROPE_JAPAN,
26 SAR_REST_OF_WORLD,
27 SAR_NUM_WGDS_GROUPS
28};
29
30struct wifi_sar_delta_table {
31 uint8_t version;
32 struct {
33 uint8_t power_max_2400mhz;
34 uint8_t power_chain_a_2400mhz;
35 uint8_t power_chain_b_2400mhz;
36 uint8_t power_max_5200mhz;
37 uint8_t power_chain_a_5200mhz;
38 uint8_t power_chain_b_5200mhz;
39 } __packed group[SAR_NUM_WGDS_GROUPS];
40} __packed;
Robbie Zhanged840022016-12-23 11:43:07 -080041
42/* Wifi SAR limit table structure */
43struct wifi_sar_limits {
44 /* Total 4 SAR limit sets, each has 10 bytes */
45 uint8_t sar_limit[NUM_SAR_LIMITS][BYTES_PER_SAR_LIMIT];
Pratik Prajapati7fd1e4b2017-08-11 14:06:57 -070046 struct wifi_sar_delta_table wgds;
47} __packed;
Robbie Zhanged840022016-12-23 11:43:07 -080048
49/*
50 * Retrieve the SAR limits data from VPD and decode it.
51 * sar_limits: Pointer to wifi_sar_limits where the resulted data is stored
52 *
Pratik Prajapati7fd1e4b2017-08-11 14:06:57 -070053 * Returns: 0 on success, -1 on errors (The VPD entry doesn't exist, or the
Robbie Zhanged840022016-12-23 11:43:07 -080054 * VPD entry contains non-heximal value.)
55 */
56int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits);
57
58#endif /* _SAR_H_ */