From patchwork Thu Aug 16 12:12:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Huang X-Patchwork-Id: 144362 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2000104ljj; Thu, 16 Aug 2018 05:13:56 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyasyl1H52Q4ahzvylwMxZDDieE11/Qt/M0ZBMAQExyJwdwZHn8j3yPUj0/kMY5JgV4mKtP X-Received: by 2002:a62:98d6:: with SMTP id d83-v6mr32240690pfk.186.1534421636597; Thu, 16 Aug 2018 05:13:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534421636; cv=none; d=google.com; s=arc-20160816; b=eBF+Hny/zkGioEVw3DGScF+5CTotronSXqQzVvHOeDNpv5wxRcNg7CWOk8sr+OztXC Qg7euwknPPl5b+pDIn4zxJH/H16HTfys0YJ3iEGqUihqGF+1Wy0uVSpXv/h2DikPlyMY C2+9l0rCsGisqa139rNEcv3jijcx2E4uuIP37TrK4rLI1dDOsYR/Gqog2knCNi1ZUbTT LEodGCJeedLswYlX0acr+gqAlal04ukKHOkj2iAAzUnP6NNibImguMxBDEzZfv9fkKd+ n7f+87Dq3YYCIEdXbRO+bVzFI2F3A+hWBHqKhYHcEzmEPCLV7ystslJgcnbVDQBC7RXq STfw== 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=HnBcqR5sp3jTnbrfbJCE2AlIuzrptervwrWjd0eNawo=; b=p/JLwxwTtQgW//laACwixx+L4cOmqVi4kqT1N6pu9rHjbfGwNwFybU4YMnFg4zi4Za xOIINIpJORAAQCbO2o+d+z82RbGfEMmS3hTYC6zGqZq5TT4sAPjVvwbqnGVtiyVjnLdx CouICuL1sUvt2GF7brm3fUenPQb0KImmmPyQVnQHSYdnGg7ADrbKnP/xECU2ksgOvz7e N9yNzVU6vmuny+BlrRFbT90VF2drNXiX9bfh6IQMpQBKbtLeup1a8olm4zUOWwRucyvQ SX5ts/huqzPB0eGzXGmEIzDH8d6kEsNylnL3FFEq9cBgAPSqCdgp8KuhIgda7cYW2kic eEFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hZKczzn1; 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 m86-v6si26243032pfj.48.2018.08.16.05.13.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Aug 2018 05:13:56 -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=hZKczzn1; 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 057D5210F3768; Thu, 16 Aug 2018 05:13:48 -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:400e:c01::242; helo=mail-pl0-x242.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pl0-x242.google.com (mail-pl0-x242.google.com [IPv6:2607:f8b0:400e:c01::242]) (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 59ECB210F3767 for ; Thu, 16 Aug 2018 05:13:46 -0700 (PDT) Received: by mail-pl0-x242.google.com with SMTP id t17-v6so2009158ply.13 for ; Thu, 16 Aug 2018 05:13:46 -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=NFy3iG1g+EjWgmHTCtYwenj0R5WL8hKad1+W0g3b+jc=; b=hZKczzn1AY0QeSWg1ChU71W+2rNWiowhQccMBZ0j6MwI+M5yM+LKQ4caue+5ANezh5 lgihiY42+FvVJwYm2fkQz6xidPFzA/NaexFX/DKhSIzwVsBNAjUk91zeuB2ZA4iZ2bl+ s24p0yOWtUDpy/RaBiSeMT5Mlnj3GDYuHxpJ4= 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=NFy3iG1g+EjWgmHTCtYwenj0R5WL8hKad1+W0g3b+jc=; b=iYOmvrBMmmm9sul8PtEWZ8wVBA1pc8aCvD8Z2af9xgn67nOrR+SdIonrTTA5kRGcl1 O2w/J/tzCKFtpiaVup34Nm96YPvN/cg7hkksn3VAc/VT99w21H94dWPmbkPYrfcispLS 4lTbymkVFYUdKNbYnuAa3d8L9MRVv7xrUVKfyVC+8SNIVifd2Im45MVtRt4kbFrea2k4 tO2lcUep+6jcdTMkvpiOLeBxv0I0ZsN175ngW/dFGQJbK0AMxjrn5HRj2D/sBliBEhvi C4oEzhzrzVOO2NNu1RnMpap0JVMyVvnHpJud5M/d8FSSGjaGt+UGZfqpUiLOWO5yLGBE ZEWg== X-Gm-Message-State: AOUpUlEPtrowiPfjpPilNyRR5XErgf9SKNDZKDSRgqBXt+QgiSUIbXzr 3JTbaMDOx7NcwSl4X0f0HXnVvQ== X-Received: by 2002:a17:902:8bc4:: with SMTP id r4-v6mr28152926plo.257.1534421626111; Thu, 16 Aug 2018 05:13:46 -0700 (PDT) Received: from localhost.localdomain ([120.31.149.194]) by smtp.gmail.com with ESMTPSA id j27-v6sm46736311pfj.91.2018.08.16.05.13.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Aug 2018 05:13:45 -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: Thu, 16 Aug 2018 20:12:15 +0800 Message-Id: <20180816121239.44129-13-ming.huang@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180816121239.44129-1-ming.huang@linaro.org> References: <20180816121239.44129-1-ming.huang@linaro.org> Subject: [edk2] [PATCH edk2-platforms v3 12/36] 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 | 1 + Silicon/Hisilicon/Include/Library/IpmiCmdLib.h | 16 ++++++++++++++ Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c | 22 ++++++++++++++++++++ 3 files changed, 39 insertions(+) -- 2.17.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 96a46da8c5..ecbe724dfe 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 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 eaa6ce78d0..56ca8d63b0 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)); + } + } + } } /**