<p>Marshall Dawson has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/21883">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">amd/stoneyridge: Add conversion of PmControl to SLP_TYP_Sx<br><br>Convert a value, which may be read from the PmControl register, into<br>an intended sleep state.  This mimics the Intel function in arch/x86<br>but uses values specific to the AMD FCH.<br><br>Change-Id: Ib804f4544d04fe08fefa493d75e0375de7cf9348<br>Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com><br>---<br>M src/soc/amd/stoneyridge/include/soc/southbridge.h<br>M src/soc/amd/stoneyridge/sb_util.c<br>2 files changed, 22 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/83/21883/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/soc/amd/stoneyridge/include/soc/southbridge.h b/src/soc/amd/stoneyridge/include/soc/southbridge.h<br>index d506af9..917bd60 100644<br>--- a/src/soc/amd/stoneyridge/include/soc/southbridge.h<br>+++ b/src/soc/amd/stoneyridge/include/soc/southbridge.h<br>@@ -66,6 +66,14 @@<br> #define STONEYRIDGE_ACPI_IO_BASE       CONFIG_STONEYRIDGE_ACPI_IO_BASE<br> #define ACPI_PM_EVT_BLK               (STONEYRIDGE_ACPI_IO_BASE + 0x00) /* 4 bytes */<br> #define ACPI_PM1_CNT_BLK      (STONEYRIDGE_ACPI_IO_BASE + 0x04) /* 2 bytes */<br>+#define   SLP_EN                      (1 << 13)<br>+#define   SLP_TYP_SHIFT                       10<br>+#define   SLP_TYP                  (7 << SLP_TYP_SHIFT)<br>+#define     SLP_TYP_S0                     0<br>+#define     SLP_TYP_S1                      1<br>+#define     SLP_TYP_S3                      3<br>+#define     SLP_TYP_S4                      4<br>+#define     SLP_TYP_S5                      5<br> #define ACPI_PM_TMR_BLK             (STONEYRIDGE_ACPI_IO_BASE + 0x18) /* 4 bytes */<br> #define ACPI_GPE0_BLK         (STONEYRIDGE_ACPI_IO_BASE + 0x10) /* 8 bytes */<br> #define ACPI_CPU_CONTROL      (STONEYRIDGE_ACPI_IO_BASE + 0x08) /* 6 bytes */<br>@@ -203,6 +211,7 @@<br> void smi_write16(u8 reg, u16 value);<br> void smi_write32(u8 reg, u32 value);<br> uint16_t pm_acpi_pm_cnt_blk(void);<br>+int acpi_sleep_from_pm1(uint32_t pm1_cnt);<br> int s3_load_nvram_early(int size, u32 *old_dword, int nvram_pos);<br> void s3_resume_init_data(void *FchParams);<br> int s3_save_nvram_early(u32 dword, int size, int  nvram_pos);<br>diff --git a/src/soc/amd/stoneyridge/sb_util.c b/src/soc/amd/stoneyridge/sb_util.c<br>index bdb199a..acfa41c 100644<br>--- a/src/soc/amd/stoneyridge/sb_util.c<br>+++ b/src/soc/amd/stoneyridge/sb_util.c<br>@@ -13,6 +13,7 @@<br>  * GNU General Public License for more details.<br>  */<br> <br>+#include <arch/acpi.h><br> #include <soc/southbridge.h><br> <br> void pm_write8(u8 reg, u8 value)<br>@@ -69,3 +70,15 @@<br> {<br>    return pm_read16(PM1_CNT_BLK);<br> }<br>+<br>+int acpi_sleep_from_pm1(uint32_t pm1_cnt)<br>+{<br>+        switch (((pm1_cnt) & SLP_TYP) >> SLP_TYP_SHIFT) {<br>+  case SLP_TYP_S0: return ACPI_S0;<br>+     case SLP_TYP_S1: return ACPI_S1;<br>+     case SLP_TYP_S3: return ACPI_S3;<br>+     case SLP_TYP_S4: return ACPI_S4;<br>+     case SLP_TYP_S5: return ACPI_S5;<br>+     }<br>+    return -1;<br>+}<br></pre><p>To view, visit <a href="https://review.coreboot.org/21883">change 21883</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/21883"/><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: Ib804f4544d04fe08fefa493d75e0375de7cf9348 </div>
<div style="display:none"> Gerrit-Change-Number: 21883 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Marshall Dawson <marshalldawson3rd@gmail.com> </div>