From patchwork Fri Aug 31 13:26:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Huang X-Patchwork-Id: 145623 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp784068ljw; Fri, 31 Aug 2018 06:28:20 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbwZyU+CD1AM/a4mbg1IC3KbLF/NalRlkHHWiqAYGuUjw1g1uf3yP91XwFO7jkt7pA/9xm3 X-Received: by 2002:a63:a06:: with SMTP id 6-v6mr14738315pgk.318.1535722100749; Fri, 31 Aug 2018 06:28:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535722100; cv=none; d=google.com; s=arc-20160816; b=KA6sclsh6EXBZTw5sSs1QONjgRvGWP847Dyb922c175pg0+Kj3NIaQaeBQco6C/m5s +VIcoWBXgT8e6uYtBb+o/99GRNbm7WE3ivbC5Zd54+m88KmWBK9azh3Tpv7sJZhpaZAg 7eePM4lBsH+dfGPxOteDMzCDF207SJ53cPmmLF8hMwFgYxCWMBML9+0NGWdaOG1aEpoY 86FJL3ZOAr2QPmsuYMEpjJHiXHKWyksaI8RNQNBImvBbNGB94cnSPt8j6DEZWTK2gZAJ brEnqxjyQJ8MWG6Ctu3IuOnMjCUf/a8szxlttJe+csJXNgg3rKjhuLCRWxcyst6RwJXM c72A== 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=SVl7SYPXyhjiMQlYyxRl3cZBXHAHOUhJZNW8GwW3R4g=; b=fWuKk2NNB0TKiIEvaPEl+xHqzK7Sz1NfbiOumOXEvPEFE6I0eF/C77qAtyxmwMqyks ZY7UkT0teLjwu3TgPLTtms7FnLifTbQLAFFiohTOh+5BoRUdiuOcVQOff9fm/AA54zoc 0yYOAefgZkixJWT0CzHCUMz/jQeKTK2DZqMA2TtyTlXVoN6KB/ZPys0/4PnA6NG2AS4g 5mUj2XSqKSWFrB+ubY0TCxi4CwhciPqdogUs9ak0trhepM+3OPYQ/8MDOlmPP4ONbtXh GFoHrKAFfsAfkOP/LmbTepOMwbxTummBFmUdp9ISR8k3/4ogdG9McFH4kNhP1cld4ioz Ta3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=QRMv1HNT; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id o21-v6si9390949pgc.658.2018.08.31.06.28.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Aug 2018 06:28:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=QRMv1HNT; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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 CF83A2110BFAA; Fri, 31 Aug 2018 06:28:11 -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::433; helo=mail-pf1-x433.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) (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 B5A362110BD4F for ; Fri, 31 Aug 2018 06:28:10 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id j26-v6so5522330pfi.10 for ; Fri, 31 Aug 2018 06:28:10 -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=OYn1ULjcR6HXKkuAXur/9OtBoJzvz0PGv1YxMjnJEXA=; b=QRMv1HNTd5dkYyQhaGKqHf96eCZ4ahLf231mrdXQfInS1TaWUTSKodHn+9my0mtOzL F5hRM6BQ7Zs62fRmcg1fzYXhJuG4gRji0GyKiFB594rooRL+/vgt8513T6ZjVoL8SUFB QGpWpKkZa4f38seUiASNRxHV6uhADemby9yys= 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=OYn1ULjcR6HXKkuAXur/9OtBoJzvz0PGv1YxMjnJEXA=; b=F7r+VkZzb9jZHOctQDtMoWr5dI1UeXP4NW6OGPd3DNJwjM10vSn82hw92shINasMf4 3UhT6KGAtrEmomBTg8DjMgaS6r/9ybyyKA3pRC5fKFW1+ckGr+p7mxzfiNMUWizoRVdB 1VqhFZ49YimDP1WtH7NDP6gwhf2FJdidnHwvwCHNKIV+iJhOpP76q4HOE7sz/03+Ixgb WKvpMNg0LYK3sm4XjR4kL5FjECOv45HWOoTQHB5ScTyPtwQdzqLzXvS1/AODCAwxnACy XPK+mfsUT6KhA1kXxhRB8Rv9dvWwbo17zSwaeowMJHIt0dEa80PIyNWoVYX18Ttet/ED 4RGg== X-Gm-Message-State: APzg51DfKlj7XDZ0VPp1mq0FeB/ZR2PiPD9pl+58gXqKYw+5XVroHxxi xtlp/9H9OHBI1ne54mZmnalQcA== X-Received: by 2002:a65:608b:: with SMTP id t11-v6mr14673138pgu.259.1535722090377; Fri, 31 Aug 2018 06:28:10 -0700 (PDT) Received: from localhost.localdomain ([120.31.149.194]) by smtp.gmail.com with ESMTPSA id l185-v6sm19081936pga.5.2018.08.31.06.28.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 31 Aug 2018 06:28:09 -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, 31 Aug 2018 21:26:55 +0800 Message-Id: <20180831132710.23055-14-ming.huang@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180831132710.23055-1-ming.huang@linaro.org> References: <20180831132710.23055-1-ming.huang@linaro.org> Subject: [edk2] [PATCH edk2-platforms v5 13/28] 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, zhangfeng56@huawei.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 | 2 ++ Silicon/Hisilicon/Include/Library/IpmiCmdLib.h | 16 ++++++++++++++ Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c | 22 ++++++++++++++++++++ 3 files changed, 40 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 e9d649b0eb..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 @@ -69,6 +70,7 @@ [Guids] gEfiEndOfDxeEventGroupGuid gEfiTtyTermGuid + gOemConfigGuid [Protocols] gEfiGenericMemTestProtocolGuid 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)); + } + } + } } /**