<p>Shaunak Saha has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/21851">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">soc/intel/common/block: Manage power state variable from common PMC block<br><br>This patch helps managing power state variables from within<br>the library. Adds migrate_power_state which migrates the chipset<br>power state variable,reads global power variable and adds it in cbmem<br>for future use. This also adds get_soc_power_state_values<br>function which returns the power state variable from<br>cbmem or global power state variable if cbmem is not<br>populated yet.<br><br>Change-Id: If65341c1492e3a35a1a927100e0d893f923b9e68<br>Signed-off-by: Shaunak Saha <shaunak.saha@intel.com><br>---<br>M src/soc/intel/common/block/include/intelblocks/pmclib.h<br>M src/soc/intel/common/block/pmc/pmclib.c<br>2 files changed, 40 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/51/21851/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/soc/intel/common/block/include/intelblocks/pmclib.h b/src/soc/intel/common/block/include/intelblocks/pmclib.h<br>index fe0a765..69b0a09 100644<br>--- a/src/soc/intel/common/block/include/intelblocks/pmclib.h<br>+++ b/src/soc/intel/common/block/include/intelblocks/pmclib.h<br>@@ -22,6 +22,13 @@<br> struct chipset_power_state;<br> <br> /*<br>+ * This function checks if cbmem is possibly online at the stage when<br>+ * its called. If variable is present in cbmem then fetch it from cbmem<br>+ * and return or else returns the global power state variable.<br>+ */<br>+struct chipset_power_state *get_soc_power_state_values(void);<br>+<br>+/*<br>  * This is implemented as weak function in common pmc lib.<br>  * Clears all power management related registers as the boot<br>  * flow is past the point of needing to maintain the values.<br>diff --git a/src/soc/intel/common/block/pmc/pmclib.c b/src/soc/intel/common/block/pmc/pmclib.c<br>index 78b43e4..ae26696 100644<br>--- a/src/soc/intel/common/block/pmc/pmclib.c<br>+++ b/src/soc/intel/common/block/pmc/pmclib.c<br>@@ -13,6 +13,7 @@<br>  * GNU General Public License for more details.<br>  */<br> <br>+#include <arch/early_variables.h><br> #include <arch/io.h><br> #include <cbmem.h><br> #include <console/console.h><br>@@ -20,9 +21,41 @@<br> #include <intelblocks/pmclib.h><br> #include <intelblocks/gpio.h><br> #include <soc/pm.h><br>+#include <string.h><br> #include <timer.h><br> #include <vboot/vboot_common.h><br> <br>+static struct chipset_power_state power_state CAR_GLOBAL;<br>+<br>+struct chipset_power_state *get_soc_power_state_values(void)<br>+{<br>+  struct chipset_power_state *ptr;<br>+<br>+  if (cbmem_possibly_online()) {<br>+               ptr = cbmem_find(CBMEM_ID_POWER_STATE);<br>+              if (ptr)<br>+                     return ptr;<br>+  }<br>+<br>+ return car_get_var_ptr(&power_state);<br>+}<br>+<br>+static void migrate_power_state(int is_recovery)<br>+{<br>+      struct chipset_power_state *ps_cbmem;<br>+        struct chipset_power_state *ps_car;<br>+<br>+       ps_car = car_get_var_ptr(&power_state);<br>+  ps_cbmem = cbmem_add(CBMEM_ID_POWER_STATE, sizeof(*ps_cbmem));<br>+<br>+    if (ps_cbmem == NULL) {<br>+              printk(BIOS_DEBUG, "Not adding power state to cbmem!\n");<br>+          return;<br>+      }<br>+    memcpy(ps_cbmem, ps_car, sizeof(*ps_cbmem));<br>+}<br>+ROMSTAGE_CBMEM_INIT_HOOK(migrate_power_state)<br>+<br> static void print_num_status_bits(int num_bits, uint32_t status,<br>                                  const char *const bit_names[])<br> {<br></pre><p>To view, visit <a href="https://review.coreboot.org/21851">change 21851</a>. To unsubscribe, 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/21851"/><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: If65341c1492e3a35a1a927100e0d893f923b9e68 </div>
<div style="display:none"> Gerrit-Change-Number: 21851 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Shaunak Saha <shaunak.saha@intel.com> </div>