From patchwork Tue Aug 14 08:08:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Huang X-Patchwork-Id: 144127 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4049475ljj; Tue, 14 Aug 2018 01:11:08 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyoP6Tiprzcc1YFcP6FfrVpkNmZUD494FDfPu8WTeR+golt2cf3G7RNonr0sxc/Qzxb3eD/ X-Received: by 2002:a62:5a01:: with SMTP id o1-v6mr22565349pfb.0.1534234268863; Tue, 14 Aug 2018 01:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534234268; cv=none; d=google.com; s=arc-20160816; b=d9reArowaEUEKAUoQ5AMAll+LMD/W0ETsuMD0wUdlCV2CFuMNmihhE0tfyTa5Yakml ys4tgJT7OYrr/oosOoiUlne5EGYh4Sb4/iBccIpRNqFfjegBn5QaS7NX6FlxHfhL13vr Lu6Il/R7sliSmt3C5TIshNawSOBQxbnEeW11TNvWkjjPThOTwTbgjL7N5Hl16W3EGawD HdBmQ+5w/ILBL+BDbX+azGtlWeqYtle8m6FEjSPsdx+v+5K7KaEcMK4bSXrv4Zo1z8Zn f4DuKL7h7jV9lRURPyOgnuYcN49A1mJ397dL8z9R+OkX1uTqWb7BB1Nl38hrc7DlK8cD HzRA== 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=1ecmddHzyt9Vu86RI68Np1asO2omoGZXczH3ItN3a+s=; b=WQapLqSSl9pesTz1O7AHGuFCDxFWfWob+U/qdmcOwAXFoQpo5S951xn3ElnlTjbteB do4WXZ/R1yXC9o4WM3pE2kfSVjtHXI3HIVmJtbK8rAJUMNM+xNVKWD6KIwWEtWYEqHH0 Ru8ihBS866X9/zGUt67ye5vzBoi7+/Wxqw9rolzsYpOhDEsa5pG+lS0L+mB9zivL5PXs r9bzFqs/TWD8h+B2QFQ73/ZVGad6as5Ib5iijTEeUiI+bAwEoMBMIw68FNHX3c1vOLDs bh0mOCn8Q0Gw4FPC83Gmv6ViEBu2cxIiWPp7DhxjgbBIaPJ1XDx5rHdiHx5SxHwxzf/j NqAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=EpDoUfIO; 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 a15-v6si20780833pgg.611.2018.08.14.01.11.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Aug 2018 01:11:08 -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=EpDoUfIO; 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 18D0C210F16C0; Tue, 14 Aug 2018 01:10: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::543; helo=mail-pg1-x543.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (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 22FC7210F154F for ; Tue, 14 Aug 2018 01:10:32 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id w10-v6so8792008pgv.2 for ; Tue, 14 Aug 2018 01:10: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=bizw6HCjJMeh86ye8jLsQbr9Rf8dBvs/mNxVQvOCm3E=; b=EpDoUfIODlggny6HA4D498VO7/jUAmyvXmdheC2HhYyhUuW5zXWxqJ3oLTpeApu+l0 BBtYE7nHrBG4sP4RDAXpPZKUCHJqs3+OGUPTxSWqm5onjXSpFeIt9MkMJCgYckKWXZfH V/IbewcUN+rx8xvRbKD0FoG+AszK+YTTisfV0= 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=bizw6HCjJMeh86ye8jLsQbr9Rf8dBvs/mNxVQvOCm3E=; b=sSQaL6yMwy9fUqIzJwC34AG+fTmmOZAIwvBoDbfrLbdutTOmkX3UhrQGgBvxhHZLKH DcR9GLsrfPnMroRgxmz4ienbxFg6FvrXZ0L3fvGmfvE195y1AneRh6wg7XEemCAjSgIJ Ra7wquxIz8nGbG1XqOMOGymf1VxHkcR9KERc922+j1PtCrjeuNblUuQwatEwdARsLk+z LliMkUkgqojZGvg2KaQ2bCqKwN7LVYzk8Hnb+pwNVpJaBed5lv4nYR+5qpprLCcxGSqZ 91eJ+su8l5eHSzA0lk/xZS+fErmL9ZWx99PFQs3SDjE3alhJWFP8S7rGkT5bg6iSBx3X Jk6g== X-Gm-Message-State: AOUpUlHgVyxJ3RHanGKAbfTOIueJeL84lCpUqyB5umOVpTPe0fSBWsIm V0iQm4p/C4cXKZzpSk2E6/sFsQ== X-Received: by 2002:a63:416:: with SMTP id 22-v6mr20179537pge.229.1534234231867; Tue, 14 Aug 2018 01:10:31 -0700 (PDT) Received: from localhost.localdomain ([120.31.149.194]) by smtp.gmail.com with ESMTPSA id h130-v6sm72905670pgc.88.2018.08.14.01.10.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Aug 2018 01:10: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: Tue, 14 Aug 2018 16:08:39 +0800 Message-Id: <20180814080903.50466-20-ming.huang@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180814080903.50466-1-ming.huang@linaro.org> References: <20180814080903.50466-1-ming.huang@linaro.org> Subject: [edk2] [PATCH edk2-platforms v2 19/43] Silicon/Hisilicon/D06: Stop watchdog X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 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 --- 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.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm diff --git a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index a093f13fb0..b9458b0ade 100644 --- a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -46,6 +46,7 @@ DebugLib DevicePathLib DxeServicesLib + IpmiCmdLib MemoryAllocationLib PcdLib PrintLib @@ -69,6 +70,7 @@ gEfiEndOfDxeEventGroupGuid gEfiTtyTermGuid gHisiOemVariableGuid + 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 d5f6d78fa4..b63818cbe4 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 @@ -615,6 +617,8 @@ PlatformBootManagerAfterConsole ( { EFI_STATUS Status; ESRT_MANAGEMENT_PROTOCOL *EsrtManagement = NULL; + OEM_CONFIG_DATA SetupData; + UINTN DataSize = sizeof (OEM_CONFIG_DATA); // // Show the splash screen. @@ -651,6 +655,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)); + } + } + } } /**