From patchwork Thu Aug 23 16:07:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Huang X-Patchwork-Id: 144954 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp314816ljw; Thu, 23 Aug 2018 09:09:40 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz1lANs267J9GU/mWWCwDpNxuNH0y0uNY8rz+hQZgIw/pYubl8s2jJ53ERGMAForh4qYSb6 X-Received: by 2002:a17:902:1a9:: with SMTP id b38-v6mr58738915plb.89.1535040580250; Thu, 23 Aug 2018 09:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535040580; cv=none; d=google.com; s=arc-20160816; b=GcJowZwwW+MfvgjIdQ0bDNWxdu4yfvdAnpXZ3PNv+hJTG8vwaTkyarLNTIF6TkBKtm c7x7zKbpz+kQ4RBzyIjFUNXkCbBRb4rTtkZkFnPGMPdy2z8NUupOi+fV4/bZju4LOCwQ y/VJRR/yiNkAJKLC2HhoypLso9/GxFcHqcIUMP84ApSp9pCBJDfM/DJw4tICtaSP6x73 eiy1FU5sl1KBayaQMNmGRiRBmSPzKvAVAITE7bSIrKyC2qnsIlOJcLJ+2PPVhVBYVr0i RTMwLMurxt5JLXOROMa8Bjk+J3LFZytHmST28NTKdq4qKCEgCg3sg071HTVD0jWe5YmU A1dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=HYkQ0Cduz4O2EUwP1k+YG/YXp0EUY2FBvFV9t+vnb1w=; b=pR91lQnWZ7/alY6t3kTf7/GtfB4zNGwlqKuRLaF7DdxythbOOrzSjAYtoFPqBKtbYg sYVyGD9H14UosLw0BuulgM5072l2ncTsaxGuIKYZO0uqlO/LbBl4BUtxRv0DLzx+JibR uiEg1W8KUQF2v/tLxRr9Joyp30lzSusOiQiNiqiyvPUl099q8RCCXlGVWJ7P9vb9z1Kv A3bk9CGBxbsOSluIpYjuFRW/P19N0kcCMJVSgMP8/p00LTUzgd4oOG4vqmuzv5lMny+e TY/j1ZM9+tOMZcryZHxrtH6zKOsmOISeADu0s/QcpGOUhGuth207IAaHtPHWYH+JdYQk zBdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fRML7Y0I; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id e9-v6si4528763pls.132.2018.08.23.09.09.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Aug 2018 09:09:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fRML7Y0I; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A606D211069F0; Thu, 23 Aug 2018 09:09:33 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::529; helo=mail-pg1-x529.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BB0D621103DD7 for ; Thu, 23 Aug 2018 09:09:32 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id y4-v6so2813552pgp.9 for ; Thu, 23 Aug 2018 09:09:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PSeHKw213Jw583pijXxIWd6a3rSEYp5VeFSlewNMMU8=; b=fRML7Y0IPRnOVtDJMqqh9oNb0S+dYJSjPuZaLqwTfzdqXldUnuvTWE1DXJppRjIqZH hG90o38mQAyMpFXL6YpobMORUageQElUngkl0LdAaHYcmsbjdktxitO9pOMCNkjprp1k S0+feCat9bm8zGKBZt95NCidx9py9KkhBxITI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PSeHKw213Jw583pijXxIWd6a3rSEYp5VeFSlewNMMU8=; b=dAkHRqZpckAKH2o9L87EI2OwnjTLpNVSwngzvJPohh/bPGNvCa/eqNRyTzZjIgtZpU hAjvqD2p7Ehy8EX/hp/krlGtdBdIxn26F98DRyMTaHodJYrVRiYqX+wf1udR2nD24LyK qJo/7kCBxVPmLMrnaq0kz8stpd+3C4kLMs3h4tGcGy+piwoYKlFQsydA3sd+QxYipC91 t0HmZJwNi2JOgXJHDEWF/+VPKkNMdC8Dk/TXPEGfE3iomMIpxy9h0UIS4OoiZUIDQaKj ycUyq9ghoy2BWJkib/+E0IMjqv2IstLKpzTEfyiRNvoKXl+EDB1yWUicbzBbD30hb8Ca fBNw== X-Gm-Message-State: AOUpUlFRQ7aZ4yYGOSrBwdLl62XLY52sTmq+przpLpTorFeR32k+/CCw ax2A0j6QZPY3qM9u2DzsiCJO9g== X-Received: by 2002:a62:51c6:: with SMTP id f189-v6mr63713926pfb.7.1535040572418; Thu, 23 Aug 2018 09:09:32 -0700 (PDT) Received: from localhost.localdomain ([120.31.149.194]) by smtp.gmail.com with ESMTPSA id d19-v6sm5788083pgv.61.2018.08.23.09.09.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Aug 2018 09:09:31 -0700 (PDT) From: Ming Huang To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, graeme.gregory@linaro.org Date: Fri, 24 Aug 2018 00:07:27 +0800 Message-Id: <20180823160743.45638-16-ming.huang@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180823160743.45638-1-ming.huang@linaro.org> References: <20180823160743.45638-1-ming.huang@linaro.org> Subject: [edk2] [PATCH edk2-platforms v4 15/31] Silicon/Hisilicon/D06: Stop watchdog X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huangming23@huawei.com, xinliang.liu@linaro.org, john.garry@huawei.com, zhangjinsong2@huawei.com, guoheyi@huawei.com, huangdaode@hisilicon.com, michael.d.kinney@intel.com, lersek@redhat.com, wanghuiqiang@huawei.com MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" according as watchdog design on D06, watchdog should be stopped before boot a option. This is an out of band watchdog timer in BMC; it is used to monitor the whole BIOS boot process and reset the system in case BIOS hangs somewhere, i.e. it is armed when system is power on, and disabled before handling system control to OS, while UEFI boot services watchdog is only armed before invoking a boot option. So they are two different watchdogs. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ming Huang Reviewed-by: Leif Lindholm --- Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 + Silicon/Hisilicon/Include/Library/IpmiCmdLib.h | 16 ++++++++++++++ Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c | 22 ++++++++++++++++++++ 3 files changed, 39 insertions(+) -- 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index 415f8ee36e..31aede26fc 100644 --- a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -47,6 +47,7 @@ DebugLib DevicePathLib DxeServicesLib + IpmiCmdLib MemoryAllocationLib PcdLib PrintLib diff --git a/Silicon/Hisilicon/Include/Library/IpmiCmdLib.h b/Silicon/Hisilicon/Include/Library/IpmiCmdLib.h index 8868b76135..b956ee6d07 100644 --- a/Silicon/Hisilicon/Include/Library/IpmiCmdLib.h +++ b/Silicon/Hisilicon/Include/Library/IpmiCmdLib.h @@ -19,6 +19,17 @@ #define BOOT_OPTION_BOOT_FLAG_VALID 1 #define BOOT_OPTION_BOOT_FLAG_INVALID 0 +typedef enum { + EfiReserved, + EfiBiosFrb2, + EfiBiosPost, + EfiOsLoad, + EfiSmsOs, + EfiOem, + EfiFrbReserved1, + EfiFrbReserved2 +} EFI_WDT_USER_TYPE; + typedef enum { NoOverride = 0x0, ForcePxe, @@ -91,4 +102,9 @@ IpmiCmdGetSysBootOptions ( IN IPMI_GET_BOOT_OPTION *BootOption ); +EFI_STATUS +IpmiCmdStopWatchdogTimer ( + IN EFI_WDT_USER_TYPE UserType + ); + #endif diff --git a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c index 77295d0111..aa8ddd45a5 100644 --- a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c +++ b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include #include #include @@ -609,6 +611,8 @@ PlatformBootManagerAfterConsole ( { EFI_STATUS Status; ESRT_MANAGEMENT_PROTOCOL *EsrtManagement = NULL; + OEM_CONFIG_DATA SetupData; + UINTN DataSize = sizeof (OEM_CONFIG_DATA); // // Show the splash screen. @@ -645,6 +649,24 @@ PlatformBootManagerAfterConsole ( ); HandleBmcBootType (); + + //Disable POST Watch Dog before attempting boot + Status = gRT->GetVariable ( + OEM_CONFIG_NAME, + &gOemConfigGuid, + NULL, + &DataSize, + &SetupData + ); + + if (!EFI_ERROR (Status)) { + if (SetupData.BmcWdtEnable) { + Status = IpmiCmdStopWatchdogTimer (EfiBiosPost); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%r\n", __FUNCTION__, Status)); + } + } + } } /**