From patchwork Fri Aug 31 13:26:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Huang X-Patchwork-Id: 145618 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp783647ljw; Fri, 31 Aug 2018 06:27:56 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZiq1myqLeNPEtatG0uUdq+aSo6go2s1VbyYamjhfUJ1aX4Jn9zOqN5R3aZ5BZ3xTYhHggP X-Received: by 2002:a17:902:9b92:: with SMTP id y18-v6mr15382887plp.239.1535722076452; Fri, 31 Aug 2018 06:27:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535722076; cv=none; d=google.com; s=arc-20160816; b=E6NRgrQ0+j2vNISCeUvdZFjSPI0xUk8fd+CRIpAeqLGD3v8iZjVHWQFp+EJYmSgNGo WBMRQXflO3Z7jnUD3fQMzWC3/e/4YwfbxzEVllLz5yWnIfnlxfn8L7YPwi5bdvsTbHSN jOlEaoYpg4gecRY9chvUvb+SPqLXwZ/q0oUqf2ALInmVw7MT7F2lXE+vepQZ+DDIhiEt amovuRwH9F1UoIPga+LhPYVK8v8+WI9U1SzsE2Od3g14niWyB4XQtfhpvBa/OMRGc9Ar fwwXJg2puqTDJHG1zezYLSaGi8+0qbp/ZiHC7vNbIm9Urn3hB7+vJ19/ghBy/6vZKDmF XdIQ== 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=zgSWjU+sa580WqZgaUtLU6m7aZN6jiqKKrE+VScoBik=; b=ch4eq8MGM3qSd4ZBvEbhz6AE8RzwYkttzey6M+j9Fts1SqyTvjQVBpg4qOwhS+m4Fx etRaF884vhTiKgk6PICg3FHe7BpIvgzMztvfEt0MhnRiMUrWVYIvTVuAm25wXD+5Uqqe udju1J7BtejfIyVDD2V92AbAueNjUUyux2uMsegGHrJwsBa5QsSN5rQVu4GiK8+Hu3Nm VKIUJZq5e7EBSyJIVXQHkkSNHAFor+GhsVKhwJmep1EZgUSVIaRHTj3hiqGCUqskepXV xwVA75rYk3jzrkjfhFlkyULe/ISCbaG4Mzi2gu3rEG4nv3JjPyKrRU0W1bLbmh3Ga8Yl b7FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cLyuETei; 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 b28-v6si9703981pfe.265.2018.08.31.06.27.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Aug 2018 06:27:56 -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=cLyuETei; 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 D84812110BD76; Fri, 31 Aug 2018 06:27:55 -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::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-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 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: [edk2] [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: , Cc: huangming23@huawei.com, xinliang.liu@linaro.org, john.garry@huawei.com, zhangjinsong2@huawei.com, guoheyi@huawei.com, huangdaode@hisilicon.com, zhangfeng56@huawei.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 | 3 ++ Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c | 37 ++++++++++++++++++++ 2 files changed, 40 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..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.