Simon Glass has uploaded this change for review. ( https://review.coreboot.org/25011
Change subject: kahlee: Add SKU support
......................................................................
kahlee: Add SKU support
We want to report the board SKU via the SMBIOS tables. Add support for
this, obtaining the ID itself from the EC.
I'm not quite sure of the correct code layout/naming, so please check.
BUG=b:74175244
BRANCH=none
TEST=manually on grunt with another CL:
mosys platform sku
0
Change-Id: I9e08d64df3f89d3703de047dd9ec8e1717e6b212
Signed-off-by: Simon Glass <sjg(a)chromium.org>
---
M src/mainboard/google/kahlee/mainboard.c
M src/mainboard/google/kahlee/variants/baseboard/include/baseboard/variants.h
M src/mainboard/google/kahlee/variants/grunt/Makefile.inc
A src/mainboard/google/kahlee/variants/grunt/mainboard.c
4 files changed, 48 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/25011/1
diff --git a/src/mainboard/google/kahlee/mainboard.c b/src/mainboard/google/kahlee/mainboard.c
index 753a83e..e82569e 100644
--- a/src/mainboard/google/kahlee/mainboard.c
+++ b/src/mainboard/google/kahlee/mainboard.c
@@ -13,6 +13,7 @@
* GNU General Public License for more details.
*/
+#include <string.h>
#include <console/console.h>
#include <device/device.h>
#include <arch/acpi.h>
@@ -21,6 +22,7 @@
#include <cbmem.h>
#include <baseboard/variants.h>
#include <boardid.h>
+#include <smbios.h>
#include <soc/nvs.h>
#include <soc/pci_devs.h>
#include <soc/smi.h>
@@ -221,3 +223,18 @@
.enable_dev = kahlee_enable,
.final = mainboard_final,
};
+
+/* Variants may override this function so see definitions in variants/ */
+uint8_t __attribute__((weak)) variant_board_sku(void)
+{
+ return 0;
+}
+
+const char *smbios_mainboard_sku(void)
+{
+ static char sku_str[7]; /* sku{0..255} */
+
+ snprintf(sku_str, sizeof(sku_str), "sku%d", variant_board_sku());
+
+ return sku_str;
+}
diff --git a/src/mainboard/google/kahlee/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/kahlee/variants/baseboard/include/baseboard/variants.h
index 83ee119..e5a348a 100644
--- a/src/mainboard/google/kahlee/variants/baseboard/include/baseboard/variants.h
+++ b/src/mainboard/google/kahlee/variants/baseboard/include/baseboard/variants.h
@@ -24,6 +24,8 @@
const struct sci_source *get_gpe_table(size_t *num);
uint8_t variant_memory_sku(void);
+/* Return board SKU. Limited to uint8_t, so it fits into 3 decimal digits */
+uint8_t variant_board_sku(void);
int variant_mainboard_read_spd(uint8_t spdAddress, char *buf, size_t len);
int variant_get_xhci_oc_map(uint16_t *usb_oc_map);
int variant_get_ehci_oc_map(uint16_t *usb_oc_map);
diff --git a/src/mainboard/google/kahlee/variants/grunt/Makefile.inc b/src/mainboard/google/kahlee/variants/grunt/Makefile.inc
index 319ff13..7a4b994 100644
--- a/src/mainboard/google/kahlee/variants/grunt/Makefile.inc
+++ b/src/mainboard/google/kahlee/variants/grunt/Makefile.inc
@@ -14,3 +14,5 @@
#
subdirs-y += spd
+
+ramstage-y += mainboard.c
diff --git a/src/mainboard/google/kahlee/variants/grunt/mainboard.c b/src/mainboard/google/kahlee/variants/grunt/mainboard.c
new file mode 100644
index 0000000..16a8ea9
--- /dev/null
+++ b/src/mainboard/google/kahlee/variants/grunt/mainboard.c
@@ -0,0 +1,27 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2018 Google Inc.
+ *
+ * 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 <ec/google/chromeec/ec.h>
+#include "baseboard/variants.h"
+
+uint8_t variant_board_sku(void)
+{
+ static int sku = -1;
+
+ if (sku == -1)
+ sku = google_chromeec_get_sku_id();
+
+ return sku;
+}
--
To view, visit https://review.coreboot.org/25011
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9e08d64df3f89d3703de047dd9ec8e1717e6b212
Gerrit-Change-Number: 25011
Gerrit-PatchSet: 1
Gerrit-Owner: Simon Glass <sjg(a)chromium.org>