summaryrefslogtreecommitdiff
path: root/src/mainboard/google/brya/variants
diff options
context:
space:
mode:
authorFranklin Lin <franklin_lin@wistron.corp-partner.google.com>2022-07-01 18:07:52 +0800
committerFelix Held <felix-coreboot@felixheld.de>2022-07-14 12:46:44 +0000
commitfd52e66e77c36de1827fd969edb6b6ba39abb6fe (patch)
treefb371242162ab30a49943cd35c696386569e0fde /src/mainboard/google/brya/variants
parent61f3f333116e70a63b68a6caee5e5b89f85e505c (diff)
mb/google/brya/crota: Enable MAC address passthru support
Enable the support for providing a MAC address for a dock to use based on the VPD values set in the platform. BUG=b:235045188 TEST=tested on Brya by setting VPD values and observing the string returned by the AMAC() method: > vpd -i RO_VPD -s "dock_mac"="BB:BB:BB:BB:BB:BB" > echo 1 > /sys/module/acpi/parameters/aml_debug_output [acpi.aml_debug_output=1] ACPI Debug: "Found VPD KEY dock_mac = BB:BB:BB:BB:BB:BB" ACPI Debug: "MAC address returned from VPD: BB:BB:BB:BB:BB:BB" ACPI Debug: "AMAC = _AUXMAC_#BBBBBBBBBBBB#" Signed-off-by: Franklin Lin <franklin_lin@wistron.corp-partner.google.com> Change-Id: I61b2a5e18bc17abeea0846f17e9be343e852c2b3 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65603 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard/google/brya/variants')
-rw-r--r--src/mainboard/google/brya/variants/crota/variant.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/mainboard/google/brya/variants/crota/variant.c b/src/mainboard/google/brya/variants/crota/variant.c
index e8c62ebdc2..cb4935b1df 100644
--- a/src/mainboard/google/brya/variants/crota/variant.c
+++ b/src/mainboard/google/brya/variants/crota/variant.c
@@ -4,12 +4,23 @@
#include <chip.h>
#include <fw_config.h>
#include <baseboard/variants.h>
+#include <acpi/acpi.h>
+#include <acpi/acpigen.h>
+#include <drivers/vpd/vpd.h>
+#include <stdio.h>
const char *get_wifi_sar_cbfs_filename(void)
{
return "wifi_sar_0.hex";
}
+static const char *get_dock_mac_from_vpd(char *buf, int size)
+{
+ /* Support MAC address pass-through */
+ /* Read value of 'dock_mac' from RO VPD */
+ return vpd_gets("dock_mac", buf, size, VPD_RO);
+}
+
void variant_update_soc_chip_config(struct soc_intel_alderlake_config *config)
{
if (fw_config_probe(FW_CONFIG(DB_LTE, LTE_USB))) {
@@ -26,3 +37,49 @@ void variant_update_soc_chip_config(struct soc_intel_alderlake_config *config)
config->ext_fivr_settings.vnn_sx_voltage_mv = 1250;
}
}
+
+void variant_fill_ssdt(const struct device *unused)
+{
+ /* Write MAC address to SSDT for Linux kernel r8152 driver */
+ /* enable pass-through support */
+ /* and read ACPI object name: "\_SB.AMAC" */
+
+ /* ASL code like this */
+ // Scope (\_SB)
+ // {
+ // Method (AMAC, 0, Serialized)
+ // {
+ // Return (ToBuffer (STRING))
+ // }
+ // }
+
+ char buf[32], acpi_buf[32];
+ if (get_dock_mac_from_vpd(buf, sizeof(buf)) != NULL) {
+ printk(BIOS_INFO, "RO_VPD, dock_mac=%s\n", buf);
+
+ /* remove ':' from mac address string */
+ size_t len = strlen(buf);
+ int i, j;
+ for (i = 0; i < len; i++) {
+ if (buf[i] == ':') {
+ for (j = i; j < len; j++)
+ buf[j] = buf[j+1];
+ len--;
+ i--;
+ }
+ }
+ buf[len] = '\0';
+
+ /* Format expected by the Linux kernel r8152 driver */
+ /* "_AUXMAC_#XXXXXXXXXXXX#" */
+ int acpi_buf_len = snprintf(acpi_buf, sizeof(acpi_buf), "_AUXMAC_#%s#", buf);
+
+ acpigen_write_scope("\\_SB");
+ acpigen_write_method_serialized("AMAC", 0);
+
+ acpigen_write_return_byte_buffer((uint8_t *)acpi_buf, acpi_buf_len);
+
+ acpigen_write_method_end();
+ acpigen_write_scope_end();
+ }
+}