<p>Furquan Shaikh has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/27560">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">mb/google/octopus: Add support for smbios_mainboard_sku<br><br>This change provides implementation of smbios_mainboard_sku<br>that queries the EC for SKU ID using CBI. Currently,<br>get_board_sku() is implemented as a common function for all<br>variants since this is the only way used by all the octopus<br>variants to query SKU ID. If this changes in the future,<br>this function can be changed to a variant_* callback.<br><br>BUG=b:111671163<br>TEST=Verified following on phaser:<br>1. "mosys platform sku" returns the SKU ID programmed in CBI<br>2. "dmidecode -t 1" shows SKU information as "skuXYZ" where XYZ<br>is the SKU ID programmed in CBI.<br><br>Change-Id: Ic0d344b3c13632f2ca582adc36aa337b99959712<br>Signed-off-by: Furquan Shaikh <furquan@google.com><br>---<br>M src/mainboard/google/octopus/mainboard.c<br>1 file changed, 35 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/60/27560/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/mainboard/google/octopus/mainboard.c b/src/mainboard/google/octopus/mainboard.c</span><br><span>index fc533af..c31c03a 100644</span><br><span>--- a/src/mainboard/google/octopus/mainboard.c</span><br><span>+++ b/src/mainboard/google/octopus/mainboard.c</span><br><span>@@ -18,10 +18,13 @@</span><br><span> #include <boardid.h></span><br><span> #include <console/console.h></span><br><span> #include <device/device.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <ec/google/chromeec/ec.h></span><br><span> #include <ec/ec.h></span><br><span> #include <nhlt.h></span><br><span> #include <soc/gpio.h></span><br><span> #include <soc/nhlt.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <smbios.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <string.h></span><br><span> #include <vendorcode/google/chromeos/chromeos.h></span><br><span> #include <variant/ec.h></span><br><span> #include <variant/gpio.h></span><br><span>@@ -75,3 +78,35 @@</span><br><span>         .init = mainboard_init,</span><br><span>      .enable_dev = mainboard_enable,</span><br><span> };</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define SKU_UNKNOWN            0xFFFFFFFF</span><br><span style="color: hsl(120, 100%, 40%);">+#define SKU_MAX                     255</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static uint32_t get_board_sku(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ static uint32_t sku_id = SKU_UNKNOWN;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       if (sku_id != SKU_UNKNOWN)</span><br><span style="color: hsl(120, 100%, 40%);">+            return sku_id;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      if (google_chromeec_cbi_get_sku_id(&sku_id))</span><br><span style="color: hsl(120, 100%, 40%);">+              sku_id = SKU_UNKNOWN;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       return sku_id;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+const char *smbios_mainboard_sku(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        static char sku_str[7]; /* sku{0..255} */</span><br><span style="color: hsl(120, 100%, 40%);">+     uint32_t sku_id = get_board_sku();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  if ((sku_id == SKU_UNKNOWN) || (sku_id > SKU_MAX)) {</span><br><span style="color: hsl(120, 100%, 40%);">+               printk(BIOS_ERR, "%s: Unexpected SKU ID %u\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                      __func__, sku_id);</span><br><span style="color: hsl(120, 100%, 40%);">+            return "";</span><br><span style="color: hsl(120, 100%, 40%);">+  }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   snprintf(sku_str, sizeof(sku_str), "sku%u", sku_id);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      return sku_str;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/27560">change 27560</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/27560"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ic0d344b3c13632f2ca582adc36aa337b99959712 </div>
<div style="display:none"> Gerrit-Change-Number: 27560 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Furquan Shaikh <furquan@google.com> </div>