From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::442; helo=mail-wr1-x442.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (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 2BD8E210FBF1E for ; Wed, 22 Aug 2018 07:17:43 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id z96-v6so1753309wrb.8 for ; Wed, 22 Aug 2018 07:17:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Boq/pM1YSt2+NC+FciClNdaUGWXvYsX/tUK55IQyPyQ=; b=d5pK864V997n0hZU/8yJFUtOfUpiUxJQO/xorKLWD8kGLqzUT6uw5Eeydqz33sdw0H IyMVGqJazL+nSBFpoYXky7KfCzTJfnxM61d/6Rzj/JgfihJ537NmqMis0tIhtYUiePDn o11unE8uDK5WuDmaAZlMZNYcFwY4mLGGz1sWY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Boq/pM1YSt2+NC+FciClNdaUGWXvYsX/tUK55IQyPyQ=; b=CeETyZWqhqYaANozE4p6/PfJOqNxD8Zi7WsQRrAFddMeqGcvBB50LwgQAZDeR01bPz ifC/uv5alVTzMHgjdhaPkoxoPNIlTydGGDRUXFx3MMZR+FGSEbI4nMnSdfe9moKdxQQW KI5XGPl6gy3ZCqvP7YWaANx1DC35LF1jf3kxOeClOXdUmzyHrT78a1aOmr7XxwTXSEjb nmzlv9QQATZSBrKd2plh+ZgeWc0bFwDQEqwTckkWPk+e6J+vD8w9/FFNAEfDE3vPa7Kv bzEP/oXVpJquhvQOrr3idSRZn/jM9I31V9nmosDICh0ea40B56w9UVI1z9yaPCt8d1xS pGOg== X-Gm-Message-State: AOUpUlEfNfdsSjcyLtdZzWBy60yHUjreLhMvrSQ20WIHX+0FxFQz6ZM6 e4DuxWlr2ZN5++cKk+VyPJ6pZUdt2iY= X-Google-Smtp-Source: AA+uWPyt2fglmGDzl97P2EUrs0zLQv//69rZ0YIPUnEaIQPDqrK4VDm+b8tj9puJXkBJsQdG0/sgTA== X-Received: by 2002:a5d:67c6:: with SMTP id n6-v6mr36238853wrw.39.1534947461699; Wed, 22 Aug 2018 07:17:41 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id w18-v6sm4441395wrc.38.2018.08.22.07.17.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 22 Aug 2018 07:17:40 -0700 (PDT) Date: Wed, 22 Aug 2018 15:17:38 +0100 From: Leif Lindholm To: Ming Huang Cc: linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, graeme.gregory@linaro.org, ard.biesheuvel@linaro.org, michael.d.kinney@intel.com, lersek@redhat.com, guoheyi@huawei.com, wanghuiqiang@huawei.com, huangming23@huawei.com, zhangjinsong2@huawei.com, huangdaode@hisilicon.com, john.garry@huawei.com, xinliang.liu@linaro.org Message-ID: <20180822141738.45yclm76qb24a3bk@bivouac.eciton.net> References: <20180814080903.50466-1-ming.huang@linaro.org> <20180814080903.50466-20-ming.huang@linaro.org> MIME-Version: 1.0 In-Reply-To: <20180814080903.50466-20-ming.huang@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH edk2-platforms v2 19/43] 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: , X-List-Received-Date: Wed, 22 Aug 2018 14:17:43 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Aug 14, 2018 at 04:08:39PM +0800, Ming Huang wrote: > 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(+) > > 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)); > + } > + } > + } > } > > /** > -- > 2.17.0 >