From patchwork Tue Apr 11 09:14:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 97229 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1718033qgd; Tue, 11 Apr 2017 02:14:46 -0700 (PDT) X-Received: by 10.84.134.36 with SMTP id 33mr75677846plg.34.1491902086715; Tue, 11 Apr 2017 02:14:46 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id z5si16248944pgb.250.2017.04.11.02.14.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Apr 2017 02:14:46 -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; 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 A0CB521939304; Tue, 11 Apr 2017 02:14:45 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::235]) (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 6190721939304 for ; Tue, 11 Apr 2017 02:14:43 -0700 (PDT) Received: by mail-wm0-x235.google.com with SMTP id o81so57981192wmb.1 for ; Tue, 11 Apr 2017 02:14:43 -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; bh=PHG57UkWVoGxXhk7QCGYG2KyNnRgzYOrXhuF3MJO2/s=; b=MRzL5fxg126D8Tij4sFy9+W/vu4F6Z0xiGvlzf/Mq8RahgdZTpkeSId4cz326RDTTQ pCZi51LksG9zDxQwPkoG9/ruzM18Nh5x2yMuSn6YpXfC2mIkT9TD7cg4ZMqS+PfYH+Fq Q7zR0iz/ozTNNBWpMq5sQ+0NPPQJa/ROH2ZlQ= 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=PHG57UkWVoGxXhk7QCGYG2KyNnRgzYOrXhuF3MJO2/s=; b=t8eG/0cPwPwbEN8VjquV/e4xR+pWLD9fBYne7iwp8v9i7NpreO6Cxlm47Os4kFrUGG ZZzTZsZGArHmfV0Xl8aPy5kQyRSRlSZqluctFHXoIAUF1Npw6yL0WSeiX3+uGtpjhvXm huCHrFqiycmkocfiSG0mO4zRUC68GpxHAavf6Uqkla33qCMkALwgX04J25zcE1Le4LFG UdOdz3fZARIhT8j+RZQXozRz6aHa9V/faSTT43dHKp9bKpKYJQdPXiM7ppl5oTBL/FVG 6DhzNv56omB3H/pVy8JQ/o1zoiBF/24pjxuOcvqAro7oRngS9CdNDXhBRW8S2ExAb7Gh gMgA== X-Gm-Message-State: AN3rC/5IRbW7firvjjTZeg9Oq1xfSVbtmV7b1ohWwR6CoGV0BRNJ1N8x RyDCLLHjesw9wslm X-Received: by 10.28.234.205 with SMTP id g74mr14363098wmi.13.1491902081727; Tue, 11 Apr 2017 02:14:41 -0700 (PDT) Received: from localhost.localdomain ([196.85.182.219]) by smtp.gmail.com with ESMTPSA id h16sm892044wrc.22.2017.04.11.02.14.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Apr 2017 02:14:40 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Tue, 11 Apr 2017 10:14:34 +0100 Message-Id: <20170411091434.22967-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 Subject: [edk2] [PATCH] ArmPlatformPkg/EblCmdLib: remove dependency on deprecared ARM BdsLib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ryan.harkin@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" The EBL alternative shell depends indirectly on the deprecated ARM BdsLib via EblCmdLib, which only uses a single helper function that can easily be cloned. So clone it, and remove the dependency. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c | 49 +++++++++++++++++++- ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf | 1 - 2 files changed, 48 insertions(+), 2 deletions(-) -- 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm Signed-off-by: Ard Biesheuvel diff --git a/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c b/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c index 4a5f2be3947e..5bcd750bf9f8 100644 --- a/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c +++ b/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c @@ -50,6 +50,53 @@ EblDumpFdt ( ); /** + Connect all DXE drivers + + @retval EFI_SUCCESS All drivers have been connected + @retval EFI_NOT_FOUND No handles match the search. + @retval EFI_OUT_OF_RESOURCES There is not resource pool memory to store the matching results. + +**/ +STATIC +EFI_STATUS +ConnectAllDrivers ( + VOID + ) +{ + UINTN HandleCount, Index; + EFI_HANDLE *HandleBuffer; + EFI_STATUS Status; + + do { + // Locate all the driver handles + Status = gBS->LocateHandleBuffer ( + AllHandles, + NULL, + NULL, + &HandleCount, + &HandleBuffer + ); + if (EFI_ERROR (Status)) { + break; + } + + // Connect every handles + for (Index = 0; Index < HandleCount; Index++) { + gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE); + } + + if (HandleBuffer != NULL) { + FreePool (HandleBuffer); + } + + // Check if new handles have been created after the start of the previous handles + Status = gDS->Dispatch (); + } while (!EFI_ERROR(Status)); + + return EFI_SUCCESS; +} + +/** Simple arm disassembler via a library Argv[0] - symboltable @@ -393,7 +440,7 @@ EblDevicePaths ( EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol; EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol; - BdsConnectAllDrivers(); + ConnectAllDrivers(); Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol); if (EFI_ERROR (Status)) { diff --git a/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf b/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf index c4b2ae1f6473..f33456abf3c2 100644 --- a/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf +++ b/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf @@ -51,7 +51,6 @@ [LibraryClasses] ArmDisassemblerLib PerformanceLib TimerLib - BdsLib FdtLib [Protocols]