Chromeos: Modify wifi_regulatory_domain to use "region" key in VPD

In ChromeOS VPD spec the right name is "region".

Signed-off-by: Hannah Williams <hannah.williams@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/322851
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
(cherry picked from commit 21ea0663e7f3ffe3aaea6b6ce0e1216fcd9ca23e)

BUG=chrome-os-partner:50516
BRANCH=glados
TEST=build and boot on chell

Change-Id: I4ba9a9c65af3732fa263030640495ab5bea91d1f
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Original-Commit-Id: 848f18e731eb11dd3037d12607d7364f95e64e34
Original-Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Original-Change-Id: Ib96036f9cd76449f170af5c3dd6ef6e8e91ded94
Original-Reviewed-on: https://chromium-review.googlesource.com/329293
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/13837
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Huang, Huki 2016-01-21 10:17:06 +08:00 committed by Patrick Georgi
parent 7f761658a5
commit 339886cff4
2 changed files with 10 additions and 3 deletions

View File

@ -7,7 +7,7 @@
#ifndef __CROS_VPD_H__ #ifndef __CROS_VPD_H__
#define __CROS_VPD_H__ #define __CROS_VPD_H__
#define CROS_VPD_WIFI_DOMAINKEY "regions" #define CROS_VPD_REGION_NAME "region"
/* /*
* Reads VPD string value by key. * Reads VPD string value by key.

View File

@ -26,6 +26,7 @@
* The first part is the ISO 3166-1 alpha-2 code of the country; * The first part is the ISO 3166-1 alpha-2 code of the country;
* The second part is a string of up to three alphanumeric characters * The second part is a string of up to three alphanumeric characters
*/ */
#define VARIANT_SEPARATOR '.'
struct wrdd_code_value_pair { struct wrdd_code_value_pair {
const char *code; const char *code;
u16 value; u16 value;
@ -50,21 +51,27 @@ uint16_t wifi_regulatory_domain(void)
.value = WRDD_REGULATORY_DOMAIN_INDONESIA .value = WRDD_REGULATORY_DOMAIN_INDONESIA
} }
}; };
const char *wrdd_domain_key = CROS_VPD_WIFI_DOMAINKEY; const char *wrdd_domain_key = CROS_VPD_REGION_NAME;
int i; int i;
struct wrdd_code_value_pair *p; struct wrdd_code_value_pair *p;
/* wrdd_domain_value is ISO 3166-2 */ /* wrdd_domain_value is ISO 3166-2 */
char wrdd_domain_code[7]; char wrdd_domain_code[7];
char *separator;
/* If not found for any reason fall backto the default value */ /* If not found for any reason fall backto the default value */
if (!cros_vpd_gets(wrdd_domain_key, wrdd_domain_code, if (!cros_vpd_gets(wrdd_domain_key, wrdd_domain_code,
sizeof(wrdd_domain_code))) { ARRAY_SIZE(wrdd_domain_code))) {
printk(BIOS_DEBUG, printk(BIOS_DEBUG,
"Error: Could not locate '%s' in VPD\n", wrdd_domain_key); "Error: Could not locate '%s' in VPD\n", wrdd_domain_key);
return WRDD_DEFAULT_REGULATORY_DOMAIN; return WRDD_DEFAULT_REGULATORY_DOMAIN;
} }
printk(BIOS_DEBUG, "Found '%s'='%s' in VPD\n", printk(BIOS_DEBUG, "Found '%s'='%s' in VPD\n",
wrdd_domain_key, wrdd_domain_code); wrdd_domain_key, wrdd_domain_code);
separator = memchr(wrdd_domain_code, VARIANT_SEPARATOR,
ARRAY_SIZE(wrdd_domain_code));
if (separator) {
*separator = '\0';
}
for (i = 0; i < ARRAY_SIZE(wrdd_table); i++) { for (i = 0; i < ARRAY_SIZE(wrdd_table); i++) {
p = &wrdd_table[i]; p = &wrdd_table[i];