From patchwork Thu Aug 23 16:07:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Huang X-Patchwork-Id: 144948 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp314192ljw; Thu, 23 Aug 2018 09:09:04 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxGF7GrZ+8ioDkADIoQnJ3zbDFoRHom1Xz4HgOP8iYXQYBEB0/nrNAEE81hNdhNJ3lgGMg4 X-Received: by 2002:a63:1a61:: with SMTP id a33-v6mr15959250pgm.9.1535040543880; Thu, 23 Aug 2018 09:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535040543; cv=none; d=google.com; s=arc-20160816; b=avvMEsNH4JoMf6EqAdiLzYdJCdKpwo/t700YmjbRFWtzdOKmQ0x/kVp7Knk5kMGBpf YtcdzKupJE4L1/yWM37X7Kbhfb7n0Fv/IVwtF8oE+LmmXLEaMJHM6TPFKvwAWfCJxmZI 9nLptrsfmaakt7t/pAu3D/OyzDEfDhpmuaoLy97L71224xZMEYK0muojhMKErUk9JRiI ZlFSNbaBX7wXkbEy/kV2RQq736sjT4iunsRFBm/wTMQV9X0m2D4YDKmdgaaXdBHVh2DX qvstTrU7C4RDLBQSHu9J12CXqb7Ou+EtVgWXqukVtwGFbLlNgWiq5h65oMT0UxShDcJu hLTg== 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=gs7FKXPP+gZD/5ty3eKmI2ZK8K4bSKHlgS5OPhBuMns=; b=Z3f257YPm136BT1pfJJVmF9mBHbsMcMe1+n+czt3WkgIIDfoWLvQ/cnbGb/ynq2zpr TouUP5IxINtfZObilOzbiatOaLxZ2ArGum0ZOGmhE3Rzy71rKQhxT+PejIIbxQkRgAPQ UcnvJL7k+dKukfCfMLONDUNS/MVI4HudgSXc/0Gq3wRDCM3wxF2QAdauBGx9eWQFgynK fAS5jajgWOSlHNsLtXMo/EAmGZDVawbo2uzEnPBt4JMtsXpZg1f6rSpcvQv4htAeaR0n t+xADSYPUnva+SjlrCiF6WYZsKsOp/CamJ35ewLVUJDdewcjzhY3uZL99+ml1gbAQhG1 5nWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VpnmFMfB; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id v23-v6si3427144pgk.650.2018.08.23.09.09.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Aug 2018 09:09:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VpnmFMfB; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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 7658821103DC7; Thu, 23 Aug 2018 09:09:03 -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::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-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 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: [edk2] [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: , 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" 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(+) -- 2.18.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 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.