From patchwork Fri Jun 21 08:05:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Harkin X-Patchwork-Id: 18042 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f200.google.com (mail-gh0-f200.google.com [209.85.160.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1E81525E5A for ; Fri, 21 Jun 2013 08:05:49 +0000 (UTC) Received: by mail-gh0-f200.google.com with SMTP id 10sf6935244ghy.3 for ; Fri, 21 Jun 2013 01:05:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=fjZS/1hElhM4v26sVxZD7s77TjnbzFd1UAXHhRRvkKY=; b=ZOIWKPsvaoFhKKJ6KU3JtP8ELgBDuzDRUfD22Lt+dMlBOaBle6MQUNYukWXKozw6At aJgZHT4Y2pzIOH88ydSPThowD0LEesqE+ZjamjZhwzvb1BCv5iaRxEcO7SQ1Neyh3SOW NGXh9Kw7UJXvYk3j6A0vW65b2J47K32nYRen8bQqgudfNS2N3nWfCl7K0d7jegqGexHg s87AbRvzKCBdiXZra5zsL7YYeL/chOZCgLUQmNub2MySsUMjwU5bcbA7IDVYOtzgAp6D GE7tCCFDSlBRi2MbCxFBOmCMdS3Bg3aXevb9xDL5XRHie76+eYpLoM8tiMn5l0lxvTE1 RanQ== X-Received: by 10.236.79.67 with SMTP id h43mr6279526yhe.46.1371801948831; Fri, 21 Jun 2013 01:05:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.60.163 with SMTP id i3ls1032017qer.49.gmail; Fri, 21 Jun 2013 01:05:48 -0700 (PDT) X-Received: by 10.58.144.105 with SMTP id sl9mr4909434veb.98.1371801948683; Fri, 21 Jun 2013 01:05:48 -0700 (PDT) Received: from mail-vb0-x236.google.com (mail-vb0-x236.google.com [2607:f8b0:400c:c02::236]) by mx.google.com with ESMTPS id ha3si1240134vdb.4.2013.06.21.01.05.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Jun 2013 01:05:48 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::236 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::236; Received: by mail-vb0-f54.google.com with SMTP id q12so5617737vbe.13 for ; Fri, 21 Jun 2013 01:05:48 -0700 (PDT) X-Received: by 10.220.110.78 with SMTP id m14mr4789844vcp.53.1371801948551; Fri, 21 Jun 2013 01:05:48 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.165.8 with SMTP id yu8csp51559veb; Fri, 21 Jun 2013 01:05:47 -0700 (PDT) X-Received: by 10.180.21.243 with SMTP id y19mr1931950wie.36.1371801947374; Fri, 21 Jun 2013 01:05:47 -0700 (PDT) Received: from mail-wi0-x234.google.com (mail-wi0-x234.google.com [2a00:1450:400c:c05::234]) by mx.google.com with ESMTPS id vf8si1517984wjc.146.2013.06.21.01.05.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Jun 2013 01:05:47 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::234 is neither permitted nor denied by best guess record for domain of ryan.harkin@linaro.org) client-ip=2a00:1450:400c:c05::234; Received: by mail-wi0-f180.google.com with SMTP id c10so334717wiw.7 for ; Fri, 21 Jun 2013 01:05:46 -0700 (PDT) X-Received: by 10.194.19.130 with SMTP id f2mr8059844wje.22.1371801946723; Fri, 21 Jun 2013 01:05:46 -0700 (PDT) Received: from qpc.lan (82-69-54-187.dsl.in-addr.zen.co.uk. [82.69.54.187]) by mx.google.com with ESMTPSA id ay7sm21069904wib.9.2013.06.21.01.05.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Jun 2013 01:05:46 -0700 (PDT) From: Ryan Harkin To: ryan.harkin@linaro.org, edk2-devel@lists.sourceforge.net, patches@linaro.org, boot-architecture@lists.linaro.org, olivier.martin@arm.com Subject: [PATCH 6/9] ArmPlatformPkg/Bds: use letters for hard coded boot menu options Date: Fri, 21 Jun 2013 09:05:19 +0100 Message-Id: <1371801922-15142-7-git-send-email-ryan.harkin@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1371801922-15142-1-git-send-email-ryan.harkin@linaro.org> References: <1371801922-15142-1-git-send-email-ryan.harkin@linaro.org> X-Gm-Message-State: ALoCoQmWOnICjFOs9/cIwpGoAjVKYuX0FjdKU0r+fv1JuMgEjlNbDENCS3yAc70hcNk/zZ7e99Tm X-Original-Sender: ryan.harkin@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::236 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The main menu in the Boot Manager numbers all the menu options. As you add a new boot device, the hard coded menu option numbers increment. This makes automated configuration of UEFI more complex. This patch changes the hard coded menu options to use letters instead of numbers. For backwards compatibility, I've left the numbering support in. However, I've re-ordered the Ebl and Boot Manager entries, so the default number for the Boot Manager option is now 2, not 3. Signed-off-by: Ryan Harkin --- ArmPlatformPkg/Bds/BootMenu.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c index 1b101d4..4094d41 100644 --- a/ArmPlatformPkg/Bds/BootMenu.c +++ b/ArmPlatformPkg/Bds/BootMenu.c @@ -618,8 +618,8 @@ struct BOOT_MAIN_ENTRY { CONST CHAR16* Description; EFI_STATUS (*Callback) (IN LIST_ENTRY *BootOptionsList); } BootMainEntries[] = { - { L"Shell", BootShell }, { L"Boot Manager", BootMenuManager }, + { L"Shell", BootShell }, }; @@ -630,6 +630,7 @@ BootMenuMain ( { LIST_ENTRY BootOptionsList; UINTN OptionCount; + UINTN HardCodedOptionCount; UINTN BootOptionCount; EFI_STATUS Status; LIST_ENTRY* Entry; @@ -637,6 +638,7 @@ BootMenuMain ( UINTN BootOptionSelected; UINTN Index; UINTN BootMainEntryCount; + CHAR8 BootOptionSelectedStr[32]; BootOption = NULL; BootMainEntryCount = sizeof(BootMainEntries) / sizeof(struct BOOT_MAIN_ENTRY); @@ -713,16 +715,25 @@ BootMenuMain ( BootOptionCount = OptionCount-1; // Display the hardcoded Boot entries + Print(L"-----------------------\n"); for (Index = 0; Index < BootMainEntryCount; Index++) { - Print(L"[%d] %s\n",OptionCount,BootMainEntries[Index]); + Print(L"[%c] %s\n", ('a'+Index), BootMainEntries[Index]); OptionCount++; } + HardCodedOptionCount=Index; // Request the boot entry from the user BootOptionSelected = 0; while (BootOptionSelected == 0) { Print(L"Start: "); - Status = GetHIInputInteger (&BootOptionSelected); + Status = GetHIInputAscii (BootOptionSelectedStr,8); + + if (BootOptionSelectedStr[0]-'0' <= OptionCount) { + BootOptionSelected = BootOptionSelectedStr[0] - '0'; + } else if (BootOptionSelectedStr[0]-'a' <= HardCodedOptionCount) { + BootOptionSelected = BootOptionCount + 1 + BootOptionSelectedStr[0] - 'a'; + } + if (EFI_ERROR(Status) || (BootOptionSelected == 0) || (BootOptionSelected > OptionCount)) { Print(L"Invalid input (max %d)\n",(OptionCount-1)); BootOptionSelected = 0;