Furquan Shaikh has uploaded this change for review. ( https://review.coreboot.org/27560
Change subject: mb/google/octopus: Add support for smbios_mainboard_sku
......................................................................
mb/google/octopus: Add support for smbios_mainboard_sku
This change provides implementation of smbios_mainboard_sku
that queries the EC for SKU ID using CBI. Currently,
get_board_sku() is implemented as a common function for all
variants since this is the only way used by all the octopus
variants to query SKU ID. If this changes in the future,
this function can be changed to a variant_* callback.
BUG=b:111671163
TEST=Verified following on phaser:
1. "mosys platform sku" returns the SKU ID programmed in CBI
2. "dmidecode -t 1" shows SKU information as "skuXYZ" where XYZ
is the SKU ID programmed in CBI.
Change-Id: Ic0d344b3c13632f2ca582adc36aa337b99959712
Signed-off-by: Furquan Shaikh <furquan(a)google.com>
---
M src/mainboard/google/octopus/mainboard.c
1 file changed, 35 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/60/27560/1
diff --git a/src/mainboard/google/octopus/mainboard.c b/src/mainboard/google/octopus/mainboard.c
index fc533af..c31c03a 100644
--- a/src/mainboard/google/octopus/mainboard.c
+++ b/src/mainboard/google/octopus/mainboard.c
@@ -18,10 +18,13 @@
#include <boardid.h>
#include <console/console.h>
#include <device/device.h>
+#include <ec/google/chromeec/ec.h>
#include <ec/ec.h>
#include <nhlt.h>
#include <soc/gpio.h>
#include <soc/nhlt.h>
+#include <smbios.h>
+#include <string.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include <variant/ec.h>
#include <variant/gpio.h>
@@ -75,3 +78,35 @@
.init = mainboard_init,
.enable_dev = mainboard_enable,
};
+
+#define SKU_UNKNOWN 0xFFFFFFFF
+#define SKU_MAX 255
+
+static uint32_t get_board_sku(void)
+{
+ static uint32_t sku_id = SKU_UNKNOWN;
+
+ if (sku_id != SKU_UNKNOWN)
+ return sku_id;
+
+ if (google_chromeec_cbi_get_sku_id(&sku_id))
+ sku_id = SKU_UNKNOWN;
+
+ return sku_id;
+}
+
+const char *smbios_mainboard_sku(void)
+{
+ static char sku_str[7]; /* sku{0..255} */
+ uint32_t sku_id = get_board_sku();
+
+ if ((sku_id == SKU_UNKNOWN) || (sku_id > SKU_MAX)) {
+ printk(BIOS_ERR, "%s: Unexpected SKU ID %u\n",
+ __func__, sku_id);
+ return "";
+ }
+
+ snprintf(sku_str, sizeof(sku_str), "sku%u", sku_id);
+
+ return sku_str;
+}
--
To view, visit https://review.coreboot.org/27560
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: Ic0d344b3c13632f2ca582adc36aa337b99959712
Gerrit-Change-Number: 27560
Gerrit-PatchSet: 1
Gerrit-Owner: Furquan Shaikh <furquan(a)google.com>
Martin Roth has posted comments on this change. ( https://review.coreboot.org/27122 )
Change subject: mb/*/*: Harmonise FD and devicetree on boards featuring ICH7
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://review.coreboot.org/27122
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I1692ca5f490ea84e2fc520d3f66044ad7514f76e
Gerrit-Change-Number: 27122
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Fri, 20 Jul 2018 15:15:20 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: Yes