From patchwork Wed Sep 3 11:18:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36579 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4119B202E4 for ; Wed, 3 Sep 2014 11:19:13 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id et14sf82557305pad.10 for ; Wed, 03 Sep 2014 04:19:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=v63AXLbNR6KX/07ZBtgulTE45gZQA2Xdx5UTouhBgc0=; b=JdsCrRtOrRJRrn4Hn+aRs2SIcI86FShzBQsnwOJieEdYvktVh35NsBKpMk6rV6WIZc BYhHnJWhx4vzBE/4buoudfBo58URbkR4YpUZu9gxyQpP1Nmj6MAYTmB+uG/0ctDyhogn bH9weZ4HEDgGCefcHk9OsIvnGaH3LZUPbmdbPG+Cmw8DQl7daQL40/Q9UPLOj8KM2k/G n9UJazEBb/nm1vnttCsu/piNOSYSKdzIS6Q5J6dzfnn0fZbQgZuTQcQh9aL+/ABCn2ra w5O1Da3fzNlCvQd2O9em1Eh8YBuZBmqtZvAkialTD8izqYZUd2Ohhz5uY6XzFEHfkSC7 ii/Q== X-Gm-Message-State: ALoCoQnmwEts2uKelXl4pnVJ+RCB512twT1gxWpQq8RemqlPAhLGzvtnpNLDSrroqMKFgq19lNT8 X-Received: by 10.66.161.7 with SMTP id xo7mr12189987pab.14.1409743147807; Wed, 03 Sep 2014 04:19:07 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.82.228 with SMTP id h91ls2937817qgd.77.gmail; Wed, 03 Sep 2014 04:19:07 -0700 (PDT) X-Received: by 10.52.28.198 with SMTP id d6mr32506vdh.68.1409743147654; Wed, 03 Sep 2014 04:19:07 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id ts3si3450842vcb.70.2014.09.03.04.19.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:19:07 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id la4so8748373vcb.9 for ; Wed, 03 Sep 2014 04:19:07 -0700 (PDT) X-Received: by 10.220.77.65 with SMTP id f1mr39081vck.48.1409743147573; Wed, 03 Sep 2014 04:19:07 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp663981vcb; Wed, 3 Sep 2014 04:19:07 -0700 (PDT) X-Received: by 10.50.41.104 with SMTP id e8mr35401824igl.35.1409743145738; Wed, 03 Sep 2014 04:19:05 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id o1si1689422igw.22.2014.09.03.04.19.05 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:19:05 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XP8aY-0003ak-B0; Wed, 03 Sep 2014 11:18:58 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XP8aX-0003aU-2i for edk2-devel@lists.sourceforge.net; Wed, 03 Sep 2014 11:18:57 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.212.177 as permitted sender) client-ip=209.85.212.177; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wi0-f177.google.com; Received: from mail-wi0-f177.google.com ([209.85.212.177]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XP8aV-0005FQ-Pg for edk2-devel@lists.sourceforge.net; Wed, 03 Sep 2014 11:18:57 +0000 Received: by mail-wi0-f177.google.com with SMTP id cc10so9572891wib.16 for ; Wed, 03 Sep 2014 04:18:49 -0700 (PDT) X-Received: by 10.180.75.144 with SMTP id c16mr35409239wiw.9.1409743129523; Wed, 03 Sep 2014 04:18:49 -0700 (PDT) Received: from ards-macbook-pro.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id p1sm15258661wjy.22.2014.09.03.04.18.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:18:48 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, lersek@redhat.com, olivier.martin@arm.com Date: Wed, 3 Sep 2014 13:18:09 +0200 Message-Id: <1409743096-14919-17-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409743096-14919-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409743096-14919-1-git-send-email-ard.biesheuvel@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1XP8aV-0005FQ-Pg Cc: peter.maydell@linaro.org, ilias.biris@linaro.org, christoffer.dall@linaro.org Subject: [edk2] [PATCH v6 16/23] ArmVirtualizationPkg: add private UefiBootServicesTableLib implementation X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 In order to support a dynamically discovered base address for the serial port, we need to break the dependency cycle between DebugLib depending on SerialPortLib depending on PcdLib depending on UefiBootServicesTableLib, which completes the cycle by depending on DebugLib. Instead, supply a private implementation whose ASSERTs have been defused, so that we can drop the dependency on DebugLib. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- .../ArmVirtualizationUefiBootServicesTableLib.c | 65 ++++++++++++++++++++++ .../ArmVirtualizationUefiBootServicesTableLib.inf | 34 +++++++++++ 2 files changed, 99 insertions(+) create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.c create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.inf diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.c b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.c new file mode 100644 index 000000000000..bbe171e4544d --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.c @@ -0,0 +1,65 @@ +/** @file + This library retrieves the EFI_BOOT_SERVICES pointer from EFI system table in + library's constructor. This version has no dependency on DebugLib + + Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + + +#include + +#include + +EFI_HANDLE gImageHandle = NULL; +EFI_SYSTEM_TABLE *gST = NULL; +EFI_BOOT_SERVICES *gBS = NULL; + +#define ASSERT(x) + +/** + The constructor function caches the pointer of Boot Services Table. + + The constructor function caches the pointer of Boot Services Table through System Table. + It will always return EFI_SUCCESS. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. + +**/ +EFI_STATUS +EFIAPI +UefiBootServicesTableLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + // + // Cache the Image Handle + // + gImageHandle = ImageHandle; + ASSERT (gImageHandle != NULL); + + // + // Cache pointer to the EFI System Table + // + gST = SystemTable; + ASSERT (gST != NULL); + + // + // Cache pointer to the EFI Boot Services Table + // + gBS = SystemTable->BootServices; + ASSERT (gBS != NULL); + + return EFI_SUCCESS; +} diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.inf b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.inf new file mode 100644 index 000000000000..53923bac4962 --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.inf @@ -0,0 +1,34 @@ +## @file +# UEFI Boot Services Table Library implementation for ArmVirtualizationPkg +# +# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php. +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ArmVirtualizationUefiBootServicesTableLib + FILE_GUID = C32831C9-E611-43ED-B812-FC3EBC8DCE99 + MODULE_TYPE = UEFI_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = UefiBootServicesTableLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE + + CONSTRUCTOR = UefiBootServicesTableLibConstructor + +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + ArmVirtualizationUefiBootServicesTableLib.c + +[Packages] + MdePkg/MdePkg.dec