Robbie Zhang | ed84002 | 2016-12-23 11:43:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Pratik Prajapati | 7fd1e4b | 2017-08-11 14:06:57 -0700 | [diff] [blame] | 4 | * Copyright (C) 2017-2018 Intel Corp. |
Robbie Zhang | ed84002 | 2016-12-23 11:43:07 -0800 | [diff] [blame] | 5 | * |
| 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 | |
| 18 | #include <stdint.h> |
| 19 | |
| 20 | #define NUM_SAR_LIMITS 4 |
| 21 | #define BYTES_PER_SAR_LIMIT 10 |
Pratik Prajapati | 7fd1e4b | 2017-08-11 14:06:57 -0700 | [diff] [blame] | 22 | enum { |
| 23 | SAR_FCC, |
| 24 | SAR_EUROPE_JAPAN, |
| 25 | SAR_REST_OF_WORLD, |
| 26 | SAR_NUM_WGDS_GROUPS |
| 27 | }; |
| 28 | |
| 29 | struct wifi_sar_delta_table { |
| 30 | uint8_t version; |
| 31 | struct { |
| 32 | uint8_t power_max_2400mhz; |
| 33 | uint8_t power_chain_a_2400mhz; |
| 34 | uint8_t power_chain_b_2400mhz; |
| 35 | uint8_t power_max_5200mhz; |
| 36 | uint8_t power_chain_a_5200mhz; |
| 37 | uint8_t power_chain_b_5200mhz; |
| 38 | } __packed group[SAR_NUM_WGDS_GROUPS]; |
| 39 | } __packed; |
Robbie Zhang | ed84002 | 2016-12-23 11:43:07 -0800 | [diff] [blame] | 40 | |
| 41 | /* Wifi SAR limit table structure */ |
| 42 | struct wifi_sar_limits { |
| 43 | /* Total 4 SAR limit sets, each has 10 bytes */ |
| 44 | uint8_t sar_limit[NUM_SAR_LIMITS][BYTES_PER_SAR_LIMIT]; |
Pratik Prajapati | 7fd1e4b | 2017-08-11 14:06:57 -0700 | [diff] [blame] | 45 | struct wifi_sar_delta_table wgds; |
| 46 | } __packed; |
Robbie Zhang | ed84002 | 2016-12-23 11:43:07 -0800 | [diff] [blame] | 47 | |
| 48 | /* |
| 49 | * Retrieve the SAR limits data from VPD and decode it. |
| 50 | * sar_limits: Pointer to wifi_sar_limits where the resulted data is stored |
| 51 | * |
Pratik Prajapati | 7fd1e4b | 2017-08-11 14:06:57 -0700 | [diff] [blame] | 52 | * Returns: 0 on success, -1 on errors (The VPD entry doesn't exist, or the |
Robbie Zhang | ed84002 | 2016-12-23 11:43:07 -0800 | [diff] [blame] | 53 | * VPD entry contains non-heximal value.) |
| 54 | */ |
| 55 | int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits); |
| 56 | |
Justin TerAvest | c650d6c | 2018-12-14 11:05:03 -0700 | [diff] [blame] | 57 | const char *get_wifi_sar_cbfs_filename(void); |
| 58 | |
Robbie Zhang | ed84002 | 2016-12-23 11:43:07 -0800 | [diff] [blame] | 59 | #endif /* _SAR_H_ */ |