From patchwork Tue Mar 21 12:26:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenhui Sun X-Patchwork-Id: 95625 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1413462qgd; Tue, 21 Mar 2017 05:30:00 -0700 (PDT) X-Received: by 10.107.38.16 with SMTP id m16mr29188825iom.106.1490099400065; Tue, 21 Mar 2017 05:30:00 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id g17si13942094ita.82.2017.03.21.05.29.59; Tue, 21 Mar 2017 05:30:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 774AE64021; Tue, 21 Mar 2017 12:29:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id D860C6401A; Tue, 21 Mar 2017 12:29:54 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 4EF026401D; Tue, 21 Mar 2017 12:29:52 +0000 (UTC) Received: from mail-pf0-f173.google.com (mail-pf0-f173.google.com [209.85.192.173]) by lists.linaro.org (Postfix) with ESMTPS id 8900864019 for ; Tue, 21 Mar 2017 12:29:50 +0000 (UTC) Received: by mail-pf0-f173.google.com with SMTP id 20so31678029pfk.2 for ; Tue, 21 Mar 2017 05:29:50 -0700 (PDT) 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; bh=iEmKPjWHKu04xI2RhgSBZqy0S5sdMjLC7R/vPQHz7TM=; b=fS8RjP1MQPdMKzYciOI7G6B1D6BZrFALg20IfxQdwa+psN4xHcfWr0vHPR1IKlkPlK ym93v1LdQ4aWBzDp9tRDoZ865hKLLsZFOB75fypLNn5EXnm50YpDHTIHsisswgLH2nag EAt1+XfUjdi+jxaTA9K/8P10ni2zjsylogbU3hRsFIMuPsJjBWJwAb1iWKOWs1rAlmlR tce+GlPhMLzb+iIEaf4imNiQ4B8JlBjDnRjRyoP79KT7EB7bZ6c6Ymkt7jJ/Js+Y3jYq iGBc4RtE2pcPyX9sUmE4Mq1P9l83m8zcwFdAUvTir73+RmLSzFm3RFGqN3aA5wGZRc9/ Re0Q== X-Gm-Message-State: AFeK/H1buJfWULQNEr5OCPZ6cmqfET3/DFaBvOcM0teYwpy7EHZDdHE7Zd3h6ZaC67fmif5d9Fg= X-Received: by 10.84.217.2 with SMTP id o2mr47343369pli.51.1490099389796; Tue, 21 Mar 2017 05:29:49 -0700 (PDT) Received: from localhost.localdomain ([119.145.15.121]) by smtp.gmail.com with ESMTPSA id r17sm10772674pfa.13.2017.03.21.05.29.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Mar 2017 05:29:49 -0700 (PDT) From: Chenhui Sun To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org Date: Tue, 21 Mar 2017 20:26:27 +0800 Message-Id: <1490099187-54849-1-git-send-email-chenhui.sun@linaro.org> X-Mailer: git-send-email 1.9.1 Cc: Chenhui Sun , Huang ming , sunchenhui@huawei.com, wanghuiqiang@huawei.com Subject: [Linaro-uefi] [PATCH] IntelFrameworkModulePkg/BdsEntry: support BMC boot option X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" Support the feature that BIOS get boot option from BMC and set it to the first boot order. The feature works dependding on this patch and the OPP patch "Hisilicon/D03/D05: get boot option from BMC" both be added. And it have a limitation, only set the boot order by type, can't by the specfic devices. example: there have 4 ethernet ports at D05 board, it can only be booted from the ethernet port, but which port can not be defined. so it try from the first port to the end. so is there any solution? expect your comments. Signed-off-by: Huang ming Signed-off-by: Chenhui Sun --- .../Universal/BdsDxe/BdsEntry.c | 44 ++++++++++++---------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c index bf81de4..ee51055 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c @@ -36,7 +36,6 @@ EFI_BDS_ARCH_PROTOCOL gBds = { BdsEntry }; -UINT16 *mBootNext = NULL; /// /// The read-only variables defined in UEFI Spec. @@ -123,6 +122,9 @@ BdsBootDeviceSelect ( BOOLEAN BootNextExist; LIST_ENTRY *LinkBootNext; EFI_EVENT ConnectConInEvent; + UINTN BootNextSize; + UINT16 *BootNext = NULL; + UINT16 Index; // // Got the latest boot option @@ -154,7 +156,16 @@ BdsBootDeviceSelect ( } } - if (mBootNext != NULL) { + // + // Check if we have the boot next option + // + BootNext = BdsLibGetVariableAndSize ( + L"BootNext", + &gEfiGlobalVariableGuid, + &BootNextSize + ); + + if (BootNext != NULL) { // // Indicate we have the boot next variable, so this time // boot will always have this boot option @@ -179,17 +190,19 @@ BdsBootDeviceSelect ( // // Add the boot next boot option // - UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *mBootNext); - BootOption = BdsLibVariableToOption (&BootLists, Buffer); + for (Index = 0; Index < (BootNextSize/sizeof(UINT16)); Index++) { + UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", BootNext[Index]); + BootOption = BdsLibVariableToOption (&BootLists, Buffer); - // - // If fail to get boot option from variable, just return and do nothing. - // - if (BootOption == NULL) { - return; - } + // + // If fail to get boot option from variable, just return and do nothing. + // + if (BootOption == NULL) { + return; + } - BootOption->BootCurrent = *mBootNext; + BootOption->BootCurrent = BootNext[Index]; + } } // // Parse the boot order to get boot option @@ -528,7 +541,6 @@ BdsEntry ( { LIST_ENTRY DriverOptionList; LIST_ENTRY BootOptionList; - UINTN BootNextSize; CHAR16 *FirmwareVendor; EFI_STATUS Status; UINT16 BootTimeOut; @@ -638,14 +650,6 @@ BdsEntry ( if (!IsListEmpty (&DriverOptionList)) { BdsLibLoadDrivers (&DriverOptionList); } - // - // Check if we have the boot next option - // - mBootNext = BdsLibGetVariableAndSize ( - L"BootNext", - &gEfiGlobalVariableGuid, - &BootNextSize - ); // // Setup some platform policy here