Ricardo Ribalda Delgado (ricardo.ribalda(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17934
-gerrit
commit e88086435436c150781b5cf59a7a213e596fade9
Author: Ricardo Ribalda Delgado <ricardo.ribalda(a)gmail.com>
Date: Wed Dec 21 20:57:13 2016 +0100
amd/hudson/agesa: Fix position of hudson_fwm
AMDFWTOOL calculates the location of the amdfw based on the
CONFIG_ROM_SIZE. If HUDSON_FWM_POSITION does not match that location the
resulting rom does not boot.
This patch forces the position of HUDSON_FWM_POSITION to be the
position calculated by amdfwrom.
Tested on a Bettong derivative with a 16MiB flash.
Change-Id: I3ce69f77174327c18ff97e551c0665c9f633991e
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda(a)gmail.com>
---
src/southbridge/amd/agesa/hudson/Kconfig | 23 -----------------------
src/southbridge/amd/agesa/hudson/Makefile.inc | 3 +--
2 files changed, 1 insertion(+), 25 deletions(-)
diff --git a/src/southbridge/amd/agesa/hudson/Kconfig b/src/southbridge/amd/agesa/hudson/Kconfig
index eed83ae..91ebe03 100644
--- a/src/southbridge/amd/agesa/hudson/Kconfig
+++ b/src/southbridge/amd/agesa/hudson/Kconfig
@@ -101,29 +101,6 @@ config HUDSON_FWM
default y if HUDSON_XHCI_FWM || HUDSON_IMC_FWM || HUDSON_GEC_FWM
default n
-if HUDSON_FWM
-
-config HUDSON_FWM_POSITION
- hex "Hudson Firmware ROM Position"
- default 0xFFF20000 if BOARD_ROMSIZE_KB_1024
- default 0xFFE20000 if BOARD_ROMSIZE_KB_2048
- default 0xFFC20000 if BOARD_ROMSIZE_KB_4096
- default 0xFF820000 if BOARD_ROMSIZE_KB_8192
- default 0xFF020000 if BOARD_ROMSIZE_KB_16384
- help
- Hudson requires the firmware MUST be located at
- a specific address (ROM start address + 0x20000), otherwise
- xhci host Controller can not find or load the xhci firmware.
-
- The firmware start address is dependent on the ROM chip size.
- The default offset is 0x20000 from the ROM start address, namely
- 0xFFF20000 if flash chip size is 1M
- 0xFFE20000 if flash chip size is 2M
- 0xFFC20000 if flash chip size is 4M
- 0xFF820000 if flash chip size is 8M
- 0xFF020000 if flash chip size is 16M
-endif # HUDSON_FWM
-
config HUDSON_SATA_MODE
int "SATA Mode"
default 0
diff --git a/src/southbridge/amd/agesa/hudson/Makefile.inc b/src/southbridge/amd/agesa/hudson/Makefile.inc
index 2e8b13b..7595889 100644
--- a/src/southbridge/amd/agesa/hudson/Makefile.inc
+++ b/src/southbridge/amd/agesa/hudson/Makefile.inc
@@ -35,8 +35,7 @@ ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smi.c smi_util.c
# +-----------+---------------+----------------+------------+
# EC ROM should be 64K aligned.
-HUDSON_FWM_POS_CALC=$(call int-add, $(call int-subtract, 0xffffffff $(call int-multiply, $(CONFIG_COREBOOT_ROMSIZE_KB) 1024)) 0x20000 1)
-HUDSON_FWM_POSITION=$(shell printf %u $(CONFIG_HUDSON_FWM_POSITION))
+HUDSON_FWM_POSITION=$(call int-add, $(call int-subtract, 0xffffffff $(CONFIG_ROM_SIZE)) 0x20000 1)
ifdef CONFIG_HUDSON_AHCI_ROM
stripped_ahci_rom_id = $(call strip_quotes,$(CONFIG_AHCI_ROM_ID))
Ricardo Ribalda Delgado (ricardo.ribalda(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17925
-gerrit
commit b1d3e4f79a70a22c5144d360ef81341a004dbbe3
Author: Ricardo Ribalda Delgado <ricardo.ribalda(a)gmail.com>
Date: Tue Dec 20 10:51:08 2016 +0100
amd/hudson/pi: Fix position of hudson_fwm
AMDFWTOOL calculates the location of the amdfw based on the
CONFIG_ROM_SIZE. If HUDSON_FWM_POSITION does not match that location the
resulting rom does not boot.
This patch forces the position of HUDSON_FWM_POSITION to be the
position calculated by amdfwrom.
Tested on a Bettong derivative with a 16MiB flash.
Change-Id: Id2ee96ee076293d48ade84fd6e976ca994dcf491
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda(a)gmail.com>
---
src/southbridge/amd/pi/hudson/Kconfig | 23 -----------------------
src/southbridge/amd/pi/hudson/Makefile.inc | 3 +--
2 files changed, 1 insertion(+), 25 deletions(-)
diff --git a/src/southbridge/amd/pi/hudson/Kconfig b/src/southbridge/amd/pi/hudson/Kconfig
index afa03aa..f6e3355 100644
--- a/src/southbridge/amd/pi/hudson/Kconfig
+++ b/src/southbridge/amd/pi/hudson/Kconfig
@@ -103,29 +103,6 @@ config HUDSON_FWM
default y if HUDSON_XHCI_FWM || HUDSON_IMC_FWM || HUDSON_GEC_FWM || HUDSON_PSP
default n
-if HUDSON_FWM
-
-config HUDSON_FWM_POSITION
- hex "Hudson Firmware ROM Position"
- default 0xFFF20000 if BOARD_ROMSIZE_KB_1024
- default 0xFFE20000 if BOARD_ROMSIZE_KB_2048
- default 0xFFC20000 if BOARD_ROMSIZE_KB_4096
- default 0xFF820000 if BOARD_ROMSIZE_KB_8192
- default 0xFF020000 if BOARD_ROMSIZE_KB_16384
- help
- Hudson requires the firmware MUST be located at
- a specific address (ROM start address + 0x20000), otherwise
- xhci host Controller can not find or load the xhci firmware.
-
- The firmware start address is dependent on the ROM chip size.
- The default offset is 0x20000 from the ROM start address, namely
- 0xFFF20000 if flash chip size is 1M
- 0xFFE20000 if flash chip size is 2M
- 0xFFC20000 if flash chip size is 4M
- 0xFF820000 if flash chip size is 8M
- 0xFF020000 if flash chip size is 16M
-endif # HUDSON_FWM
-
config AMD_PUBKEY_FILE
depends on HUDSON_PSP
string "AMD public Key"
diff --git a/src/southbridge/amd/pi/hudson/Makefile.inc b/src/southbridge/amd/pi/hudson/Makefile.inc
index 292da76..24a757c 100644
--- a/src/southbridge/amd/pi/hudson/Makefile.inc
+++ b/src/southbridge/amd/pi/hudson/Makefile.inc
@@ -67,8 +67,7 @@ ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smi.c smi_util.c
#
# EC ROM should be 64K aligned.
-HUDSON_FWM_POS_CALC=$(call int-add, $(call int-subtract, 0xffffffff $(call int-multiply, $(CONFIG_COREBOOT_ROMSIZE_KB) 1024)) 0x20000 1)
-HUDSON_FWM_POSITION=$(shell printf %u $(CONFIG_HUDSON_FWM_POSITION))
+HUDSON_FWM_POSITION=$(call int-add, $(call int-subtract, 0xffffffff $(CONFIG_ROM_SIZE)) 0x20000 1)
##
ifeq ($(CONFIG_HUDSON_PSP), y)
Ricardo Ribalda Delgado (ricardo.ribalda(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17934
-gerrit
commit 730c423b31b85749fed76cd1dfb33d018cd7f15e
Author: Ricardo Ribalda Delgado <ricardo.ribalda(a)gmail.com>
Date: Wed Dec 21 20:57:13 2016 +0100
amd/hudson/agesa: Fix position of hudson_fwm
AMDFWTOOL calculates the location of the amdfw based on the
CONFIG_ROM_SIZE. If HUDSON_FWM_POSITION does not match that location the
resulting rom does not boot.
This patch forces the position of HUDSON_FWM_POSITION to be the
position calculated by amdfwrom.
Tested on a Bettong board with a 16MiB flash.
Change-Id: I3ce69f77174327c18ff97e551c0665c9f633991e
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda(a)gmail.com>
---
src/southbridge/amd/agesa/hudson/Kconfig | 23 -----------------------
src/southbridge/amd/agesa/hudson/Makefile.inc | 3 +--
2 files changed, 1 insertion(+), 25 deletions(-)
diff --git a/src/southbridge/amd/agesa/hudson/Kconfig b/src/southbridge/amd/agesa/hudson/Kconfig
index eed83ae..91ebe03 100644
--- a/src/southbridge/amd/agesa/hudson/Kconfig
+++ b/src/southbridge/amd/agesa/hudson/Kconfig
@@ -101,29 +101,6 @@ config HUDSON_FWM
default y if HUDSON_XHCI_FWM || HUDSON_IMC_FWM || HUDSON_GEC_FWM
default n
-if HUDSON_FWM
-
-config HUDSON_FWM_POSITION
- hex "Hudson Firmware ROM Position"
- default 0xFFF20000 if BOARD_ROMSIZE_KB_1024
- default 0xFFE20000 if BOARD_ROMSIZE_KB_2048
- default 0xFFC20000 if BOARD_ROMSIZE_KB_4096
- default 0xFF820000 if BOARD_ROMSIZE_KB_8192
- default 0xFF020000 if BOARD_ROMSIZE_KB_16384
- help
- Hudson requires the firmware MUST be located at
- a specific address (ROM start address + 0x20000), otherwise
- xhci host Controller can not find or load the xhci firmware.
-
- The firmware start address is dependent on the ROM chip size.
- The default offset is 0x20000 from the ROM start address, namely
- 0xFFF20000 if flash chip size is 1M
- 0xFFE20000 if flash chip size is 2M
- 0xFFC20000 if flash chip size is 4M
- 0xFF820000 if flash chip size is 8M
- 0xFF020000 if flash chip size is 16M
-endif # HUDSON_FWM
-
config HUDSON_SATA_MODE
int "SATA Mode"
default 0
diff --git a/src/southbridge/amd/agesa/hudson/Makefile.inc b/src/southbridge/amd/agesa/hudson/Makefile.inc
index 2e8b13b..7595889 100644
--- a/src/southbridge/amd/agesa/hudson/Makefile.inc
+++ b/src/southbridge/amd/agesa/hudson/Makefile.inc
@@ -35,8 +35,7 @@ ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smi.c smi_util.c
# +-----------+---------------+----------------+------------+
# EC ROM should be 64K aligned.
-HUDSON_FWM_POS_CALC=$(call int-add, $(call int-subtract, 0xffffffff $(call int-multiply, $(CONFIG_COREBOOT_ROMSIZE_KB) 1024)) 0x20000 1)
-HUDSON_FWM_POSITION=$(shell printf %u $(CONFIG_HUDSON_FWM_POSITION))
+HUDSON_FWM_POSITION=$(call int-add, $(call int-subtract, 0xffffffff $(CONFIG_ROM_SIZE)) 0x20000 1)
ifdef CONFIG_HUDSON_AHCI_ROM
stripped_ahci_rom_id = $(call strip_quotes,$(CONFIG_AHCI_ROM_ID))
Ricardo Ribalda Delgado (ricardo.ribalda(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17925
-gerrit
commit f02470f7d3238144a100a046a0bd2e0fee08e25b
Author: Ricardo Ribalda Delgado <ricardo.ribalda(a)gmail.com>
Date: Tue Dec 20 10:51:08 2016 +0100
amd/hudson/pi: Fix position of hudson_fwm
AMDFWTOOL calculates the location of the amdfw based on the
CONFIG_ROM_SIZE. If HUDSON_FWM_POSITION does not match that location the
resulting rom does not boot.
This patch forces the position of HUDSON_FWM_POSITION to be the
position calculated by amdfwrom.
Tested on a Bettong board with a 16MiB flash.
Change-Id: Id2ee96ee076293d48ade84fd6e976ca994dcf491
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda(a)gmail.com>
---
src/southbridge/amd/pi/hudson/Kconfig | 23 -----------------------
src/southbridge/amd/pi/hudson/Makefile.inc | 3 +--
2 files changed, 1 insertion(+), 25 deletions(-)
diff --git a/src/southbridge/amd/pi/hudson/Kconfig b/src/southbridge/amd/pi/hudson/Kconfig
index afa03aa..f6e3355 100644
--- a/src/southbridge/amd/pi/hudson/Kconfig
+++ b/src/southbridge/amd/pi/hudson/Kconfig
@@ -103,29 +103,6 @@ config HUDSON_FWM
default y if HUDSON_XHCI_FWM || HUDSON_IMC_FWM || HUDSON_GEC_FWM || HUDSON_PSP
default n
-if HUDSON_FWM
-
-config HUDSON_FWM_POSITION
- hex "Hudson Firmware ROM Position"
- default 0xFFF20000 if BOARD_ROMSIZE_KB_1024
- default 0xFFE20000 if BOARD_ROMSIZE_KB_2048
- default 0xFFC20000 if BOARD_ROMSIZE_KB_4096
- default 0xFF820000 if BOARD_ROMSIZE_KB_8192
- default 0xFF020000 if BOARD_ROMSIZE_KB_16384
- help
- Hudson requires the firmware MUST be located at
- a specific address (ROM start address + 0x20000), otherwise
- xhci host Controller can not find or load the xhci firmware.
-
- The firmware start address is dependent on the ROM chip size.
- The default offset is 0x20000 from the ROM start address, namely
- 0xFFF20000 if flash chip size is 1M
- 0xFFE20000 if flash chip size is 2M
- 0xFFC20000 if flash chip size is 4M
- 0xFF820000 if flash chip size is 8M
- 0xFF020000 if flash chip size is 16M
-endif # HUDSON_FWM
-
config AMD_PUBKEY_FILE
depends on HUDSON_PSP
string "AMD public Key"
diff --git a/src/southbridge/amd/pi/hudson/Makefile.inc b/src/southbridge/amd/pi/hudson/Makefile.inc
index 292da76..24a757c 100644
--- a/src/southbridge/amd/pi/hudson/Makefile.inc
+++ b/src/southbridge/amd/pi/hudson/Makefile.inc
@@ -67,8 +67,7 @@ ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smi.c smi_util.c
#
# EC ROM should be 64K aligned.
-HUDSON_FWM_POS_CALC=$(call int-add, $(call int-subtract, 0xffffffff $(call int-multiply, $(CONFIG_COREBOOT_ROMSIZE_KB) 1024)) 0x20000 1)
-HUDSON_FWM_POSITION=$(shell printf %u $(CONFIG_HUDSON_FWM_POSITION))
+HUDSON_FWM_POSITION=$(call int-add, $(call int-subtract, 0xffffffff $(CONFIG_ROM_SIZE)) 0x20000 1)
##
ifeq ($(CONFIG_HUDSON_PSP), y)
Robbie Zhang (robbie.zhang(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17958
-gerrit
commit b21977f614eaaf921664d187d0b3e84ce20ccb13
Author: Robbie Zhang <robbie.zhang(a)intel.com>
Date: Fri Dec 23 11:43:07 2016 -0800
chromeos: Implement locating and decoding wifi sar data from VPD
A VPD entry "wifi_sar" needs to be created which contains a heximal
encoded string in length of 40 bytes. get_wifi_sar_limits() function
retrieves and decodes the data from the VPD entry, which would later
be consumed by platform code.
BUG=chrome-os-partner:60821
TEST=Build and boot lars and reef
Change-Id: I923b58a63dc1f8a7fdd685cf1c618b2fdf4e7061
Signed-off-by: Robbie Zhang <robbie.zhang(a)intel.com>
---
src/include/sar.h | 38 ++++++++++++++++++
src/vendorcode/google/chromeos/Makefile.inc | 1 +
src/vendorcode/google/chromeos/cros_vpd.h | 1 +
src/vendorcode/google/chromeos/sar.c | 60 +++++++++++++++++++++++++++++
4 files changed, 100 insertions(+)
diff --git a/src/include/sar.h b/src/include/sar.h
new file mode 100644
index 0000000..4653dd3
--- /dev/null
+++ b/src/include/sar.h
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Intel Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#ifndef _SAR_H_
+#define _SAR_H_
+
+#include <stdint.h>
+
+#define NUM_SAR_LIMITS 4
+#define BYTES_PER_SAR_LIMIT 10
+
+/* Wifi SAR limit table structure */
+struct wifi_sar_limits {
+ /* Total 4 SAR limit sets, each has 10 bytes */
+ uint8_t sar_limit[NUM_SAR_LIMITS][BYTES_PER_SAR_LIMIT];
+};
+
+/*
+ * Retrieve the SAR limits data from VPD and decode it.
+ * sar_limits: Pointer to wifi_sar_limits where the resulted data is stored
+ *
+ * Returns: 0 on success, -1 on errors (The VPD entry doesn't exist, or the
+ * VPD entry contains non-heximal value.)
+ */
+int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits);
+
+#endif /* _SAR_H_ */
diff --git a/src/vendorcode/google/chromeos/Makefile.inc b/src/vendorcode/google/chromeos/Makefile.inc
index e84eb3d..878b068 100644
--- a/src/vendorcode/google/chromeos/Makefile.inc
+++ b/src/vendorcode/google/chromeos/Makefile.inc
@@ -25,6 +25,7 @@ ramstage-$(CONFIG_CHROMEOS_RAMOOPS) += ramoops.c
romstage-y += vpd_decode.c
ramstage-y += vpd_decode.c cros_vpd.c vpd_mac.c vpd_serialno.c vpd_calibration.c
ramstage-$(CONFIG_HAVE_REGULATORY_DOMAIN) += wrdd.c
+ramstage-$(CONFIG_USE_SAR) += sar.c
ifeq ($(CONFIG_ARCH_MIPS),)
bootblock-y += watchdog.c
ramstage-y += watchdog.c
diff --git a/src/vendorcode/google/chromeos/cros_vpd.h b/src/vendorcode/google/chromeos/cros_vpd.h
index 96ca8af..1fa56a4 100644
--- a/src/vendorcode/google/chromeos/cros_vpd.h
+++ b/src/vendorcode/google/chromeos/cros_vpd.h
@@ -8,6 +8,7 @@
#define __CROS_VPD_H__
#define CROS_VPD_REGION_NAME "region"
+#define CROS_VPD_WIFI_SAR_NAME "wifi_sar"
/*
* Reads VPD string value by key.
diff --git a/src/vendorcode/google/chromeos/sar.c b/src/vendorcode/google/chromeos/sar.c
new file mode 100644
index 0000000..2b61e22
--- /dev/null
+++ b/src/vendorcode/google/chromeos/sar.c
@@ -0,0 +1,60 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Intel Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#include <console/console.h>
+#include <types.h>
+#include <string.h>
+#include <sar.h>
+#include "cros_vpd.h"
+
+/* Retrieve the wifi SAR limits data from VPD and decode it */
+int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits)
+{
+ const char *wifi_sar_limit_key = CROS_VPD_WIFI_SAR_NAME;
+ /*
+ * cros_vpd_gets() reads in one less than size characters from the VPD
+ * with a terminating null byte ('\0') stored as the last character into
+ * the buffer, thus the increasing by 1 for buffer_size.
+ */
+ const size_t buffer_size = (sizeof(struct wifi_sar_limits) /
+ sizeof(uint8_t)) * 2 + 1;
+ char wifi_sar_limit_str[buffer_size];
+ uint8_t bin_buffer[sizeof(struct wifi_sar_limits)];
+
+ /* Try to read the SAR limit entry from VPD */
+ if (!cros_vpd_gets(wifi_sar_limit_key, wifi_sar_limit_str,
+ ARRAY_SIZE(wifi_sar_limit_str))) {
+ printk(BIOS_ERR,
+ "Error: Could not locate '%s' in VPD\n",
+ wifi_sar_limit_key);
+ return -1;
+ }
+ printk(BIOS_DEBUG, "VPD wifi_sar = %s\n", wifi_sar_limit_str);
+
+ /* Decode the heximal encoded string to binary values */
+ if (hexstrtobin(wifi_sar_limit_str, bin_buffer,
+ sizeof(struct wifi_sar_limits))
+ < sizeof(struct wifi_sar_limits)) {
+ printk(BIOS_ERR,
+ "Error: VPD wifi_sar contains non-heximal value!\n");
+ return -1;
+ }
+
+ /* Fill the sar_limits structure with the decoded data */
+ for (int i = 0; i < NUM_SAR_LIMITS; i++)
+ memcpy(sar_limits->sar_limit[i],
+ &bin_buffer[BYTES_PER_SAR_LIMIT * i],
+ BYTES_PER_SAR_LIMIT);
+ return 0;
+}
Robbie Zhang (robbie.zhang(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17958
-gerrit
commit 750d6b9ce9b9a027ecdf418e5b4957ba0a1db201
Author: Robbie Zhang <robbie.zhang(a)intel.com>
Date: Fri Dec 23 11:43:07 2016 -0800
chromeos: Implement locating and decoding wifi sar data from VPD
A VPD entry "wifi_sar" needs to be created which contains a heximal
encoded string in length of 40 bytes. get_wifi_sar_limits() function
retrieves and decodes the data from the VPD entry, which would later
be consumed by platform code.
BUG=chrome-os-partner:60821
TEST=Build and boot lars and reef
Change-Id: I923b58a63dc1f8a7fdd685cf1c618b2fdf4e7061
Signed-off-by: Robbie Zhang <robbie.zhang(a)intel.com>
---
src/include/sar.h | 38 +++++++++++++++++++
src/vendorcode/google/chromeos/Makefile.inc | 1 +
src/vendorcode/google/chromeos/cros_vpd.h | 1 +
src/vendorcode/google/chromeos/sar.c | 58 +++++++++++++++++++++++++++++
4 files changed, 98 insertions(+)
diff --git a/src/include/sar.h b/src/include/sar.h
new file mode 100644
index 0000000..4653dd3
--- /dev/null
+++ b/src/include/sar.h
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Intel Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#ifndef _SAR_H_
+#define _SAR_H_
+
+#include <stdint.h>
+
+#define NUM_SAR_LIMITS 4
+#define BYTES_PER_SAR_LIMIT 10
+
+/* Wifi SAR limit table structure */
+struct wifi_sar_limits {
+ /* Total 4 SAR limit sets, each has 10 bytes */
+ uint8_t sar_limit[NUM_SAR_LIMITS][BYTES_PER_SAR_LIMIT];
+};
+
+/*
+ * Retrieve the SAR limits data from VPD and decode it.
+ * sar_limits: Pointer to wifi_sar_limits where the resulted data is stored
+ *
+ * Returns: 0 on success, -1 on errors (The VPD entry doesn't exist, or the
+ * VPD entry contains non-heximal value.)
+ */
+int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits);
+
+#endif /* _SAR_H_ */
diff --git a/src/vendorcode/google/chromeos/Makefile.inc b/src/vendorcode/google/chromeos/Makefile.inc
index e84eb3d..878b068 100644
--- a/src/vendorcode/google/chromeos/Makefile.inc
+++ b/src/vendorcode/google/chromeos/Makefile.inc
@@ -25,6 +25,7 @@ ramstage-$(CONFIG_CHROMEOS_RAMOOPS) += ramoops.c
romstage-y += vpd_decode.c
ramstage-y += vpd_decode.c cros_vpd.c vpd_mac.c vpd_serialno.c vpd_calibration.c
ramstage-$(CONFIG_HAVE_REGULATORY_DOMAIN) += wrdd.c
+ramstage-$(CONFIG_USE_SAR) += sar.c
ifeq ($(CONFIG_ARCH_MIPS),)
bootblock-y += watchdog.c
ramstage-y += watchdog.c
diff --git a/src/vendorcode/google/chromeos/cros_vpd.h b/src/vendorcode/google/chromeos/cros_vpd.h
index 96ca8af..1fa56a4 100644
--- a/src/vendorcode/google/chromeos/cros_vpd.h
+++ b/src/vendorcode/google/chromeos/cros_vpd.h
@@ -8,6 +8,7 @@
#define __CROS_VPD_H__
#define CROS_VPD_REGION_NAME "region"
+#define CROS_VPD_WIFI_SAR_NAME "wifi_sar"
/*
* Reads VPD string value by key.
diff --git a/src/vendorcode/google/chromeos/sar.c b/src/vendorcode/google/chromeos/sar.c
new file mode 100644
index 0000000..8478e1a
--- /dev/null
+++ b/src/vendorcode/google/chromeos/sar.c
@@ -0,0 +1,58 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Intel Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#include <console/console.h>
+#include <types.h>
+#include <string.h>
+#include <sar.h>
+#include "cros_vpd.h"
+
+/* Retrieve the wifi SAR limits data from VPD and decode it */
+int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits)
+{
+ const char *wifi_sar_limit_key = CROS_VPD_WIFI_SAR_NAME;
+ /*
+ * cros_vpd_gets() reads in one less than size characters from the VPD
+ * with a terminating null byte ('\0') stored as the last character into
+ * the buffer, thus the increasing by 1 for buffer_size.
+ */
+ const size_t buffer_size = (sizeof(struct wifi_sar_limits) /
+ sizeof(uint8_t)) * 2 + 1;
+ char wifi_sar_limit_str[buffer_size];
+ uint8_t bin_buffer[sizeof(struct wifi_sar_limits)];
+
+ /* Try to read the SAR limit entry from VPD */
+ if (!cros_vpd_gets(wifi_sar_limit_key, wifi_sar_limit_str,
+ ARRAY_SIZE(wifi_sar_limit_str))) {
+ printk(BIOS_ERR,
+ "Error: Could not locate '%s' in VPD\n",
+ wifi_sar_limit_key);
+ return -1;
+ }
+ printk(BIOS_DEBUG, "VPD wifi_sar = %s\n", wifi_sar_limit_str);
+
+ /* Decode the heximal encoded string to binary values */
+ if (hexstrtobin(wifi_sar_limit_str, bin_buffer,
+ sizeof(struct wifi_sar_limits))
+ < sizeof(struct wifi_sar_limits)) {
+ printk(BIOS_ERR,
+ "Error: VPD wifi_sar contains non-heximal value!\n");
+ return -1;
+ }
+
+ /* Fill the sar_limits structure with the decoded data */
+ for (int i = 0; i < NUM_SAR_LIMITS; i++)
+ memcpy(sar_limits->sar_limit[i], &bin_buffer[BYTES_PER_SAR_LIMIT * i], BYTES_PER_SAR_LIMIT);
+ return 0;
+}
the following patch was just integrated into master:
commit f3e26796c43c597c651181bd37f9a673b2162746
Author: Martin Roth <martinroth(a)google.com>
Date: Thu Dec 22 10:21:11 2016 -0700
Kconfig: Remind users to delete .config when switching boards
Because Kconfig default values *ONLY* get set when they are first
configured, if you switch mainboards with an existing .config,
the values will not be set as expected for the new board.
This seems to confuse most users, so put a warning in a visible
location to let them know.
Change-Id: Ie6a9c2d139ecd841d654943f14c119ebafd632f2
Signed-off-by: Martin Roth <martinroth(a)google.com>
Reviewed-on: https://review.coreboot.org/17939
Tested-by: build bot (Jenkins)
Reviewed-by: Nico Huber <nico.h(a)gmx.de>
Reviewed-by: Patrick Georgi <pgeorgi(a)google.com>
See https://review.coreboot.org/17939 for details.
-gerrit
the following patch was just integrated into master:
commit 8f8d56dded9a9fcf5af64996fde946cf372755f2
Author: Arthur Heymans <arthur(a)aheymans.xyz>
Date: Fri Jan 6 20:01:57 2017 +0100
mb/asus/p5gc-mx: Use common/gpio.h
Should have been included in 62902ca45d "sb/ich7: Use common/gpio.h to
set up GPIOs", which was not rebased on addition of this board.
Change-Id: If4547ee43ce6a7a6e4af67e9364613e48f989401
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
Reviewed-on: https://review.coreboot.org/18047
Reviewed-by: Martin Roth <martinroth(a)google.com>
Tested-by: build bot (Jenkins)
See https://review.coreboot.org/18047 for details.
-gerrit
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17939
-gerrit
commit 14fffaafa21eaf10af43885e660e2904f4f94f29
Author: Martin Roth <martinroth(a)google.com>
Date: Thu Dec 22 10:21:11 2016 -0700
Kconfig: Remind users to delete .config when switching boards
Because Kconfig default values *ONLY* get set when they are first
configured, if you switch mainboards with an existing .config,
the values will not be set as expected for the new board.
This seems to confuse most users, so put a warning in a visible
location to let them know.
Change-Id: Ie6a9c2d139ecd841d654943f14c119ebafd632f2
Signed-off-by: Martin Roth <martinroth(a)google.com>
---
src/mainboard/Kconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/mainboard/Kconfig b/src/mainboard/Kconfig
index 24c1fe3..bdaa9e7 100644
--- a/src/mainboard/Kconfig
+++ b/src/mainboard/Kconfig
@@ -1,3 +1,5 @@
+comment "Important: Run 'make distclean' before switching boards"
+
choice
prompt "Mainboard vendor"
default VENDOR_EMULATION