From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Cc: ryan.harkin@linaro.org, Ard Biesheuvel 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: [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: , X-List-Received-Date: Tue, 11 Apr 2017 09:14:43 -0000 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(-) 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] -- 2.9.3