Ronald G. Minnich (rminnich(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18080
-gerrit
commit 94a09342ea7e5f955693f0ff45cef80d51df0fc8
Author: Ronald G. Minnich <rminnich(a)google.com>
Date: Mon Jan 9 16:37:07 2017 -0800
fixamdspi: checkout bytesout is > 0 before decrementing
The variable bytesout was being decremented without
seeing if it was zero, resulting in it being kind of
large, leading to an error.
This fixes the problem introduced in c2973d19.
Thanks Kyosti!
Change-Id: Ica4d2423cbccfd7cb55fe572b140de50b836dd14
Signed-off-by: Ronald G. Minnich <rminnich(a)google.com>
---
src/southbridge/amd/agesa/hudson/spi.c | 3 ++-
src/southbridge/amd/cimx/sb800/spi.c | 3 ++-
src/southbridge/amd/sb700/spi.c | 3 ++-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/southbridge/amd/agesa/hudson/spi.c b/src/southbridge/amd/agesa/hudson/spi.c
index 00f6b29..42176c3 100644
--- a/src/southbridge/amd/agesa/hudson/spi.c
+++ b/src/southbridge/amd/agesa/hudson/spi.c
@@ -98,7 +98,8 @@ static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
u8 readoffby1;
size_t count;
- bytesout--;
+ if (bytesout)
+ bytesout--;
/*
* Check if this is a write command attempting to transfer more bytes
diff --git a/src/southbridge/amd/cimx/sb800/spi.c b/src/southbridge/amd/cimx/sb800/spi.c
index 1e84743..7acb5ae 100644
--- a/src/southbridge/amd/cimx/sb800/spi.c
+++ b/src/southbridge/amd/cimx/sb800/spi.c
@@ -68,7 +68,8 @@ static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
u8 readwrite;
size_t count;
- bytesout--;
+ if (bytesout)
+ bytesout--;
/*
* Check if this is a write command attempting to transfer more bytes
diff --git a/src/southbridge/amd/sb700/spi.c b/src/southbridge/amd/sb700/spi.c
index 5d56415..3ff5a5c 100644
--- a/src/southbridge/amd/sb700/spi.c
+++ b/src/southbridge/amd/sb700/spi.c
@@ -76,7 +76,8 @@ static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
uint32_t spibar = get_spi_bar();
- bytesout--;
+ if (bytesout)
+ bytesout--;
/*
* Check if this is a write command attempting to transfer more bytes
Robbie Zhang (robbie.zhang(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17959
-gerrit
commit 40c5140b8fc846815ca8e790ba20fed1fcf94bdf
Author: Robbie Zhang <robbie.zhang(a)intel.com>
Date: Fri Dec 23 12:20:47 2016 -0800
intel/wifi: Create ACPI objects for wifi SAR configuration
To support intel wifi SAR configuration, it is required coreboot
to publish two ACPI objects (WRDS and EWRD) to supply SAR limit
data sets. VPD entry "wifi_sar" is required to supply the raw SAR
limit data.
BUG=chrome-os-partner:60821
TEST=Build and boot lars and reef
Change-Id: I6be345735292d0ca46f2f7e7ea61924990d338a8
Signed-off-by: Robbie Zhang <robbie.zhang(a)intel.com>
---
src/drivers/intel/wifi/Kconfig | 24 +++++++++++++++
src/drivers/intel/wifi/chip.h | 32 +++++++++++++++++++
src/drivers/intel/wifi/wifi.c | 70 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 126 insertions(+)
diff --git a/src/drivers/intel/wifi/Kconfig b/src/drivers/intel/wifi/Kconfig
index 330de6c..1e6be6d 100644
--- a/src/drivers/intel/wifi/Kconfig
+++ b/src/drivers/intel/wifi/Kconfig
@@ -5,3 +5,27 @@ config DRIVERS_INTEL_WIFI
help
When enabled, add identifiers in ACPI and SMBIOS tables to
make OS drivers work with certain Intel PCI-e WiFi chipsets.
+
+config USE_SAR
+ bool
+ default n
+ help
+ Enable it when wifi driver uses SAR configuration feature.
+ VPD entry "wifi_sar" is required to support it.
+
+config SAR_ENABLE
+ bool
+ default n
+ depends on USE_SAR
+
+config DSAR_ENABLE
+ bool
+ default n
+ depends on USE_SAR
+
+config DSAR_SET_NUM
+ hex "Number of SAR sets when D-SAR is enabled"
+ default 0x3
+ depends on USE_SAR
+ help
+ There can be up to 3 optional SAR table sets.
diff --git a/src/drivers/intel/wifi/chip.h b/src/drivers/intel/wifi/chip.h
index 117d39c..0871874 100644
--- a/src/drivers/intel/wifi/chip.h
+++ b/src/drivers/intel/wifi/chip.h
@@ -1,3 +1,35 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2016-2017 Intel Corporation
+ *
+ * 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 _WIFI_CHIP_H_
+#define _WIFI_CHIP_H_
+
+/* WRDS Spec Revision */
+#define WRDS_REVISION 0x0
+
+/* EWRD Spec Revision */
+#define EWRD_REVISION 0x0
+
+/* WRDS Domain type */
+#define WRDS_DOMAIN_TYPE_WIFI 0x7
+
+/* EWRD Domain type */
+#define EWRD_DOMAIN_TYPE_WIFI 0x7
+
struct drivers_intel_wifi_config {
unsigned wake; /* Wake pin for ACPI _PRW */
};
+
+#endif /* _WIFI_CHIP_H_ */
diff --git a/src/drivers/intel/wifi/wifi.c b/src/drivers/intel/wifi/wifi.c
index 789d0d5..4f5dac9 100644
--- a/src/drivers/intel/wifi/wifi.c
+++ b/src/drivers/intel/wifi/wifi.c
@@ -20,6 +20,7 @@
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
+#include <sar.h>
#include <smbios.h>
#include <string.h>
#include <wrdd.h>
@@ -59,6 +60,71 @@ static int smbios_write_wifi(struct device *dev, int *handle,
#endif
#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
+static void emit_sar_acpi_structures(void)
+{
+ int i, j;
+ struct wifi_sar_limits *sar_limits;
+
+ sar_limits = malloc(sizeof(struct wifi_sar_limits));
+ if (!sar_limits) {
+ printk(BIOS_ERR, "Wifi SAR: Could not allocate memory\n");
+ return;
+ }
+
+ /* Retrieve the sar limits data */
+ if (get_wifi_sar_limits(sar_limits) < 0) {
+ printk(BIOS_ERR, "Error: failed from getting SAR limits!\n");
+ return;
+ }
+
+ /*
+ * Name ("WRDS", Package () {
+ * Revision,
+ * Package () {
+ * Domain Type, // 0x7:WiFi
+ * WiFi SAR BIOS, // BIOS SAR Enable/disable
+ * SAR Table Set // Set#1 of SAR Table (10 bytes)
+ * }
+ * })
+ */
+ acpigen_write_name("WRDS");
+ acpigen_write_package(2);
+ acpigen_write_dword(WRDS_REVISION);
+ acpigen_write_package(12);
+ acpigen_write_dword(WRDS_DOMAIN_TYPE_WIFI);
+ acpigen_write_dword(CONFIG_SAR_ENABLE);
+ for (i = 0; i < BYTES_PER_SAR_LIMIT; i++)
+ acpigen_write_byte(sar_limits->sar_limit[0][i]);
+ acpigen_pop_len();
+ acpigen_pop_len();
+
+ /*
+ * Name ("EWRD", Package () {
+ * Revision,
+ * Package () {
+ * Domain Type, // 0x7:WiFi
+ * Dynamic SAR Enable, // Dynamic SAR Enable/disable
+ * Extended SAR sets, // Number of optional SAR table sets
+ * SAR Table Set, // Set#2 of SAR Table (10 bytes)
+ * SAR Table Set, // Set#3 of SAR Table (10 bytes)
+ * SAR Table Set // Set#4 of SAR Table (10 bytes)
+ * }
+ * })
+ */
+ acpigen_write_name("EWRD");
+ acpigen_write_package(2);
+ acpigen_write_dword(EWRD_REVISION);
+ acpigen_write_package(33);
+ acpigen_write_dword(EWRD_DOMAIN_TYPE_WIFI);
+ acpigen_write_dword(CONFIG_DSAR_ENABLE);
+ acpigen_write_dword(CONFIG_DSAR_SET_NUM);
+ for (i = 1; i < NUM_SAR_LIMITS; i++)
+ for (j = 0; j < BYTES_PER_SAR_LIMIT; j++)
+ acpigen_write_byte(sar_limits->sar_limit[i][j]);
+ acpigen_pop_len();
+ acpigen_pop_len();
+}
+
static void intel_wifi_fill_ssdt(struct device *dev)
{
struct drivers_intel_wifi_config *config = dev->chip_info;
@@ -105,6 +171,10 @@ static void intel_wifi_fill_ssdt(struct device *dev)
acpigen_pop_len();
}
+ /* Fill Wifi sar related ACPI structures */
+ if (IS_ENABLED(CONFIG_USE_SAR))
+ emit_sar_acpi_structures();
+
acpigen_pop_len(); /* Device */
acpigen_pop_len(); /* Scope */
Robbie Zhang (robbie.zhang(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18076
-gerrit
commit 5528a1e89ca34a24b48039e267cef6edbc0d10ca
Author: Robbie Zhang <robbie.zhang(a)intel.com>
Date: Mon Jan 9 15:28:24 2017 -0800
chromeos: fix a build issue within sar.c
A build issue was somehow overlooked in commit
ed840023a84915ece4bc63edffef979926107d55, this is to fix that.
BUG=chrome-os-partner:60821
TEST=Build and boot lars and reef
Change-Id: Ie52c1f93eee7d739b8aaf59604875f179dff60d0
Signed-off-by: Robbie Zhang <robbie.zhang(a)intel.com>
---
src/vendorcode/google/chromeos/sar.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/vendorcode/google/chromeos/sar.c b/src/vendorcode/google/chromeos/sar.c
index 2b61e22..954492b 100644
--- a/src/vendorcode/google/chromeos/sar.c
+++ b/src/vendorcode/google/chromeos/sar.c
@@ -13,6 +13,7 @@
* GNU General Public License for more details.
*/
#include <console/console.h>
+#include <lib.h>
#include <types.h>
#include <string.h>
#include <sar.h>
@@ -31,6 +32,7 @@ int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits)
sizeof(uint8_t)) * 2 + 1;
char wifi_sar_limit_str[buffer_size];
uint8_t bin_buffer[sizeof(struct wifi_sar_limits)];
+ int i;
/* Try to read the SAR limit entry from VPD */
if (!cros_vpd_gets(wifi_sar_limit_key, wifi_sar_limit_str,
@@ -52,7 +54,7 @@ int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits)
}
/* Fill the sar_limits structure with the decoded data */
- for (int i = 0; i < NUM_SAR_LIMITS; i++)
+ for (i = 0; i < NUM_SAR_LIMITS; i++)
memcpy(sar_limits->sar_limit[i],
&bin_buffer[BYTES_PER_SAR_LIMIT * i],
BYTES_PER_SAR_LIMIT);