From patchwork Fri Apr 21 14:24:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 753433 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3w8dLT1g6Zz9s2x for ; Sat, 22 Apr 2017 00:25:20 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jbByVbVo"; dkim-atps=neutral Received: by lists.denx.de (Postfix, from userid 105) id 970D3C21C47; Fri, 21 Apr 2017 14:22:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B6984C21CC7; Fri, 21 Apr 2017 14:21:29 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 67AFBC21C51; Fri, 21 Apr 2017 14:21:09 +0000 (UTC) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by lists.denx.de (Postfix) with ESMTPS id 28E5AC21CA9 for ; Fri, 21 Apr 2017 14:21:06 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id z129so5184980wmb.1 for ; Fri, 21 Apr 2017 07:21:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=X0WGSCM36MnSKI41Om3UK7ZduqgeN2A9oYS9JdqDOcU=; b=jbByVbVooBIhHi5meFRjduc5FsKcui3RNVb5pZZCbrXrHYR1Z0YfTrrC8KU4cEqb6K ByzrXVOUEesaU7ldsKkP6EmFV8ijvMwVfCUPRPqm5QR4o2Owb7/KEzHroMFP4oz+Rgz9 BQSc17nXwch2pp1U22ZFveRdFVXgUYDUQlueY35URiC+547sIZqXOjDUSXUbH06oxpju ua4LLojnhkMs63mOdXFOqZfQTupQ0No5DuP7DFyZMSHQTBw0vqbUx3iQJzU1CFCpxVxN 9KMY/LCisyBG+apQx/7SmOKo6JxAOn7G5pwHZwu/UUCgwH4gYX3FPH47EFesoVGzpYyH juvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=X0WGSCM36MnSKI41Om3UK7ZduqgeN2A9oYS9JdqDOcU=; b=Sy/fgC2krXkVPWuTePHbUPU84h239740vlc3lOeEkWaxA//CPEEM7DGNKcFsxWjMxv Y2lkAnCeZ/7pZxOBkSBVotApbZT2F16iW3l8dVwB7YbU1ZJtQ9ZSmPCUCei//Zk11ZDk 1baad4diGDfYI31qv7ssgJx1nvGcneIqbwShX0Wj8c8XqNDi7/NlUFiHsmNDLyakjG5t ySaYLkyxF0SpcQ4Zt8iy6LvSZYDKjFur+ecxQPljjqYrLloKRhVVH0BhGs0BCRqjUVEK UMTUZJ/7VyzJ4qeRZS5twVvLoKZxLthsJ5uy2Jkhlbwxwvo07Y5c497THX+pDqktxG2v BPBg== X-Gm-Message-State: AN3rC/6+W3eZrV+xQJs38N+VaC95XWqWXiNGMjiyoFOD6gtspRPSpRCf OBnqE/x/RiJohg== X-Received: by 10.80.147.89 with SMTP id n25mr58563eda.69.1492784465840; Fri, 21 Apr 2017 07:21:05 -0700 (PDT) Received: from ala-d2121-lx1.wrs.com (unknown-157-139.windriver.com. [147.11.157.139]) by smtp.gmail.com with ESMTPSA id 4sm464843edt.64.2017.04.21.07.21.03 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Apr 2017 07:21:04 -0700 (PDT) From: Bin Meng To: Simon Glass , Stefan Roese , U-Boot Mailing List Date: Fri, 21 Apr 2017 07:24:32 -0700 Message-Id: <1492784689-15701-6-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1492784689-15701-1-git-send-email-bmeng.cn@gmail.com> References: <1492784689-15701-1-git-send-email-bmeng.cn@gmail.com> Subject: [U-Boot] [PATCH v2 05/22] x86: Store and display previous sleep state X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add one member in the global data to store previous sleep state, and display the state during boot in print_cpuinfo(). Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- Changes in v2: - add a function comment block for acpi_ss_string() - use a string array for sleep state string - add a description for gd->arch.prev_sleep_state - change to use debug() in default_print_cpuinfo() arch/x86/cpu/cpu.c | 6 ++++++ arch/x86/include/asm/acpi_s3.h | 13 +++++++++++++ arch/x86/include/asm/global_data.h | 3 +++ arch/x86/lib/fsp/fsp_common.c | 1 + 4 files changed, 23 insertions(+) diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index 8fa6953..7222ec8 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -179,6 +180,11 @@ int default_print_cpuinfo(void) cpu_has_64bit() ? "x86_64" : "x86", cpu_vendor_name(gd->arch.x86_vendor), gd->arch.x86_device); +#ifdef CONFIG_HAVE_ACPI_RESUME + debug("ACPI previous sleep state: %s\n", + acpi_ss_string(gd->arch.prev_sleep_state)); +#endif + return 0; } diff --git a/arch/x86/include/asm/acpi_s3.h b/arch/x86/include/asm/acpi_s3.h index ec05211..10cedde 100644 --- a/arch/x86/include/asm/acpi_s3.h +++ b/arch/x86/include/asm/acpi_s3.h @@ -37,6 +37,19 @@ enum acpi_sleep_state { }; /** + * acpi_ss_string() - get ACPI-defined sleep state string + * + * @pm1_cnt: ACPI-defined sleep state + * @return: a pointer to the sleep state string. + */ +static inline char *acpi_ss_string(enum acpi_sleep_state state) +{ + char *ss_string[] = { "S0", "S1", "S2", "S3", "S4", "S5"}; + + return ss_string[state]; +} + +/** * acpi_sleep_from_pm1() - get ACPI-defined sleep state from PM1_CNT register * * @pm1_cnt: PM1_CNT register value diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h index 4570bc7..7d5efea 100644 --- a/arch/x86/include/asm/global_data.h +++ b/arch/x86/include/asm/global_data.h @@ -99,6 +99,9 @@ struct arch_global_data { u32 high_table_ptr; u32 high_table_limit; #endif +#ifdef CONFIG_HAVE_ACPI_RESUME + int prev_sleep_state; /* Previous sleep state */ +#endif }; #endif diff --git a/arch/x86/lib/fsp/fsp_common.c b/arch/x86/lib/fsp/fsp_common.c index cc42cad..f2d50ac 100644 --- a/arch/x86/lib/fsp/fsp_common.c +++ b/arch/x86/lib/fsp/fsp_common.c @@ -82,6 +82,7 @@ int arch_fsp_init(void) int boot_mode = BOOT_FULL_CONFIG; #ifdef CONFIG_HAVE_ACPI_RESUME int prev_sleep_state = chipset_prev_sleep_state(); + gd->arch.prev_sleep_state = prev_sleep_state; #endif if (!gd->arch.hob_list) {