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::533; helo=mail-pg1-x533.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) (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 50FDA21103DB6 for ; Thu, 23 Aug 2018 09:09:02 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id t14-v6so2835384pgf.0 for ; Thu, 23 Aug 2018 09:09:02 -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=0a6ogM7k1fg4PuaCFuM92ul3FAqGfEpD2M1IFrBool8=; b=VpnmFMfBs+ZxpJ59k4MqQZsz9EA15zM00L80nveIk8y4K8McKixGbsRgsXHilEVTxj hnE0jCIrcr6SWKTwK+9V0JoXCt7z+kzfqZc7qd7DEfojKOctduxxFQymrBVVQzcoMZJf iw2qfYk9W41xTJRnJxT3ARKgt3KWAKBx8Zhso= 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=0a6ogM7k1fg4PuaCFuM92ul3FAqGfEpD2M1IFrBool8=; b=K9m/aiEOnSXRCnw7Pw+tdLpxxdCg6IoruLoskB//MnLAErmfdluy51X8wULMLK4gcr N7RETLRaVsIndtw1TzVZNqsYzL9Dk0dRTFenYriqW9WgeMGKcDH/Bdq3yhg/e70xf5Hi MSJOOCWxnaT6yAI6QSf/G+BgDclmzFnREaDMd8i0cB4vlXqrEFXeSbu5hy0DqVW7sNSV Amks4JqgiROCz0q2hL4PgtFBVp7JlGUnAJFW52icwcVsWMSn7/fq5gfOniIsLAMMjrVE If5hBRomrW2J+JKLxOE5RJSwVbnTo2oSoHYrThxXmxIm1nMGTbaiSsoXH5K8Haq7m7an 3dmg== X-Gm-Message-State: AOUpUlGdV0SSHI67otsjyHOTo5uxwyAQ6QGPdDeaT4pDpaCRKT3+3zg6 p8Ro2NavaIFR9X9RcMpReKDgNw== X-Google-Smtp-Source: AA+uWPy+FGUgnkYK0VDAF7EYghJ0KexbpdcBJBCttsSworTNY11H1Gou3XT81hH1ccsUEHBLGmPIwQ== X-Received: by 2002:a17:902:be0a:: with SMTP id r10-v6mr22082192pls.275.1535040542014; Thu, 23 Aug 2018 09:09:02 -0700 (PDT) Received: from localhost.localdomain ([120.31.149.194]) by smtp.gmail.com with ESMTPSA id d19-v6sm5788083pgv.61.2018.08.23.09.08.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Aug 2018 09:09:01 -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, Ming Huang Date: Fri, 24 Aug 2018 00:07:22 +0800 Message-Id: <20180823160743.45638-11-ming.huang@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180823160743.45638-1-ming.huang@linaro.org> References: <20180823160743.45638-1-ming.huang@linaro.org> Subject: [PATCH edk2-platforms v4 10/31] 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: Thu, 23 Aug 2018 16:09:02 -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 | 4 +++ Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c | 37 ++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index 7a53befc44..415f8ee36e 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 @@ -67,8 +69,10 @@ [Guids] gEfiEndOfDxeEventGroupGuid gEfiTtyTermGuid + gOemConfigGuid [Protocols] 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