From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::42d; helo=mail-pf1-x42d.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) (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 EAE042110BD67 for ; Fri, 31 Aug 2018 06:27:53 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id s13-v6so5532805pfi.7 for ; Fri, 31 Aug 2018 06:27:53 -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=0teEMbCzhLMAr1wou3iQL2OjMuc+L8AAOt1C3OWdtkM=; b=cLyuETeiOPPT4x77KnQuqGx7n8bLNi3ccbu69GJMBjpLfAWXZU7+J5SxwFVoZpIqcZ iihZwfasYNSEWNcAWrqlI6PKK4FUqeSApFYG/6Cbld9fRuPwmxIO1e2Y+Dx51M3eExLj fLLxm3GF7R3w5j8yqP+dqtdTTT7G12ZvSbj+k= 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=0teEMbCzhLMAr1wou3iQL2OjMuc+L8AAOt1C3OWdtkM=; b=ZYqlXWE8FtHb8LooIDS2JWnzR1eVgX0N0k+yfTWG1F/ejkcAMUBvaPLgMh0N/Ow1ON US6GFYFIVWXHx0dX/Kan2BtGWZ7zaD9rAqS52uvRepyitBvT39N+IjodXoSXBEoqAkgo JvLcSn4rqlmLI+rpl8oUK2O7AfSyNe5zT0Kpc30wnRyRWXMevp9EMo14vBpp3AVE5ReX b2/JhONdlBp7O/9uc4ZEXlL158JejznyorS9sHfkNjfvbm8HRGWuqKBBoqem33++uXZQ nx6/fEHXb3MB6dPDsPBMR1ii4KxO6Oyw0KlwCu3AW5Ax+KnVP6HjryS3OWVmEogXpj1k hIHw== X-Gm-Message-State: APzg51Czk2IWHw/VwLA5+xxsbHIsSSJNgmehfTvGCOW0lCK7Obxok8A6 zMnAV5tlgLNrVVeddgCDgGDKWvzhwhU= X-Google-Smtp-Source: ANB0VdaRszde3CKvJyvPBaO6dYX0cjdt26iuRaTojh/DOUfHpApSeEt03UIDCUveKaq6qMh2E8xi5g== X-Received: by 2002:a63:1823:: with SMTP id y35-v6mr14468923pgl.438.1535722073546; Fri, 31 Aug 2018 06:27:53 -0700 (PDT) Received: from localhost.localdomain ([120.31.149.194]) by smtp.gmail.com with ESMTPSA id l185-v6sm19081936pga.5.2018.08.31.06.27.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 31 Aug 2018 06:27:52 -0700 (PDT) From: Ming Huang To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, graeme.gregory@linaro.org Cc: 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, zhangfeng56@huawei.com, Ming Huang Date: Fri, 31 Aug 2018 21:26:51 +0800 Message-Id: <20180831132710.23055-10-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: [PATCH edk2-platforms v5 09/28] Silicon/Hisilicon/D06: Wait for all disk ready 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: Fri, 31 Aug 2018 13:27:54 -0000 This patch is relative to D06 SasDxe driver. The SasDxe set a variable to notice this libray. Here Wait for all disk ready for 15S at most. D06: For using straight-through hard disk backboard, some disk need 15 seconds to ready. Actually, wait less 15 seconds here(minus the time from end of SAS driver to here). For using expander backboard, wait less 6 seconds here(minus the time from end of SAS driver to here). D03/D05: As Sas driver don't install PLATFORM_SAS_NOTIFY Protocol, D03/D05 will skip waiting here. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ming Huang --- Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 3 ++ Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c | 37 ++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index 7a53befc44..e9d649b0eb 100644 --- a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -36,6 +36,7 @@ [Packages] MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec + Silicon/Hisilicon/HisiliconNonOsi.dec Silicon/Hisilicon/HisiPkg.dec [LibraryClasses] @@ -49,6 +50,7 @@ MemoryAllocationLib PcdLib PrintLib + TimerLib UefiBootManagerLib UefiBootServicesTableLib UefiLib @@ -72,3 +74,4 @@ gEfiGenericMemTestProtocolGuid gEfiLoadedImageProtocolGuid gEsrtManagementProtocolGuid + gPlatformSasNotifyProtocolGuid diff --git a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c index aa6db929ca..77295d0111 100644 --- a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c +++ b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -29,6 +30,7 @@ #include #include #include +#include #include #include @@ -554,6 +556,40 @@ PlatformBootManagerBeforeConsole ( PlatformRegisterOptionsAndKeys (); } +STATIC +VOID +WaitForDiskReady ( + VOID + ) +{ + EFI_STATUS Status; + UINT32 Index; + PLATFORM_SAS_NOTIFY *SasNotify; + + Status = gBS->LocateProtocol ( + &gPlatformSasNotifyProtocolGuid, + NULL, + (VOID **)&SasNotify); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "Locate SasPlatformNotify:%r\n", Status)); + return; + } + + // Wait for 30 seconds at most. + for (Index = 0; Index < 30; Index++) { + Status = gBS->CheckEvent (SasNotify->WaitDiskEvent); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "WaitDiskEvent is signaled.\n")); + EfiBootManagerConnectAll (); + break; + } + DEBUG ((DEBUG_ERROR, "%a", Index == 0 ? "Wait for disk." : ".")); + MicroSecondDelay (1000 * 1000); + } + + return; +} + /** Do the platform specific action after the console is ready Possible things that can be done in PlatformBootManagerAfterConsole: @@ -583,6 +619,7 @@ PlatformBootManagerAfterConsole ( // Connect the rest of the devices. // EfiBootManagerConnectAll (); + WaitForDiskReady (); // // Enumerate all possible boot options. -- 2.18.0