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 | |
Pratik Prajapati | 7fd1e4b | 2017-08-11 14:06:57 -0700 | [diff] [blame^] | 18 | #include <compiler.h> |
Robbie Zhang | ed84002 | 2016-12-23 11:43:07 -0800 | [diff] [blame] | 19 | #include <stdint.h> |
| 20 | |
| 21 | #define NUM_SAR_LIMITS 4 |
| 22 | #define BYTES_PER_SAR_LIMIT 10 |
Pratik Prajapati | 7fd1e4b | 2017-08-11 14:06:57 -0700 | [diff] [blame^] | 23 | enum { |
| 24 | SAR_FCC, |
| 25 | SAR_EUROPE_JAPAN, |
| 26 | SAR_REST_OF_WORLD, |
| 27 | SAR_NUM_WGDS_GROUPS |
| 28 | }; |
| 29 | |
| 30 | struct 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 Zhang | ed84002 | 2016-12-23 11:43:07 -0800 | [diff] [blame] | 41 | |
| 42 | /* Wifi SAR limit table structure */ |
| 43 | struct 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 Prajapati | 7fd1e4b | 2017-08-11 14:06:57 -0700 | [diff] [blame^] | 46 | struct wifi_sar_delta_table wgds; |
| 47 | } __packed; |
Robbie Zhang | ed84002 | 2016-12-23 11:43:07 -0800 | [diff] [blame] | 48 | |
| 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 Prajapati | 7fd1e4b | 2017-08-11 14:06:57 -0700 | [diff] [blame^] | 53 | * 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] | 54 | * VPD entry contains non-heximal value.) |
| 55 | */ |
| 56 | int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits); |
| 57 | |
| 58 | #endif /* _SAR_H_ */ |