From patchwork Wed Sep 3 11:18:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36584 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 07DFF202E4 for ; Wed, 3 Sep 2014 11:19:17 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id eu11sf82711249pac.11 for ; Wed, 03 Sep 2014 04:19:15 -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=Denorrsy+cxT2aONKeINO61OSP89D2N6ChUBDdncGLI=; b=C9gqNKYSLjtEqD1Pase7ZUMefkL4wBR7dGqiKqlCl+9mYcansQDJD8gcR0tJc7fSiL F4QMAPQZSoPZTv6yMJI5cKV0J436VP1nQl3iABZeQAGcpl6g4nx6qCtTzXJFAiIGdSZC 4AbENLJKb5H+gVtsdy3jm2MRsfjfjZI7ZGcv0sDiL5e7+kxodMa5usfP8ev0lVs742ZW EQanyINEYP/GH6mg3qkBsH+nK1e/k3oTI4QISvTxvAIXUutWo313Tby+vKNB3Un0mCtW jgfXu5YeVsA3FpenyltRNRY2fltVjUlmB79meKqPHNcIGUfQnx759W2OI2H9xPZL5hGq wlWQ== X-Gm-Message-State: ALoCoQlb6Ybu9LFbXBDd3+X3l4Of11/IurmbYCeH3A8SEYVX09BqLXr24iSUoaENH/RdisbQUSUY X-Received: by 10.66.196.193 with SMTP id io1mr21011972pac.28.1409743154710; Wed, 03 Sep 2014 04:19:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.106.136 with SMTP id e8ls2700209qgf.36.gmail; Wed, 03 Sep 2014 04:19:14 -0700 (PDT) X-Received: by 10.220.95.132 with SMTP id d4mr5382101vcn.33.1409743154547; Wed, 03 Sep 2014 04:19:14 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id p4si3458657vcn.54.2014.09.03.04.19.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:19:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so8614165vcb.30 for ; Wed, 03 Sep 2014 04:19:14 -0700 (PDT) X-Received: by 10.52.119.229 with SMTP id kx5mr4336716vdb.40.1409743154443; Wed, 03 Sep 2014 04:19:14 -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 uj3csp663996vcb; Wed, 3 Sep 2014 04:19:13 -0700 (PDT) X-Received: by 10.42.83.81 with SMTP id g17mr37967148icl.45.1409743153669; Wed, 03 Sep 2014 04:19:13 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id ik1si1694287igb.17.2014.09.03.04.19.13 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:19:13 -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 1XP8ab-0003bZ-RG; Wed, 03 Sep 2014 11:19:01 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XP8aa-0003bC-09 for edk2-devel@lists.sourceforge.net; Wed, 03 Sep 2014 11:19:00 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.182 as permitted sender) client-ip=74.125.82.182; envelope-from=ard.biesheuvel@linaro.org; helo=mail-we0-f182.google.com; Received: from mail-we0-f182.google.com ([74.125.82.182]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XP8aY-0001Tc-1s for edk2-devel@lists.sourceforge.net; Wed, 03 Sep 2014 11:18:59 +0000 Received: by mail-we0-f182.google.com with SMTP id w62so8383902wes.13 for ; Wed, 03 Sep 2014 04:18:51 -0700 (PDT) X-Received: by 10.180.87.161 with SMTP id az1mr34881243wib.13.1409743131776; Wed, 03 Sep 2014 04:18:51 -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.49 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:18:50 -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:10 +0200 Message-Id: <1409743096-14919-18-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: 1XP8aY-0001Tc-1s Cc: peter.maydell@linaro.org, ilias.biris@linaro.org, christoffer.dall@linaro.org Subject: [edk2] [PATCH v6 17/23] ArmVirtualizationPkg: add device tree based PL011 SerialPortLib 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.171 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 This adds 2 implementations of SerialPortLib for device tree based platforms using a PL011 UART: - an 'early' one which is completely stateless and uses only fixed PCDs - a normal one which takes its base address from a potentially dynamic PcdPL011BaseAddress PCD A NULL SerialPortExtLib instance is also provided. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- .../ArmVirtualizationPkg/ArmVirtualizationPkg.dec | 1 + .../EarlyFdtPL011SerialPortLib.c | 186 +++++++++++++++++++++ .../EarlyFdtPL011SerialPortLib.inf | 45 +++++ .../FdtPL011SerialPortLib/FdtPL011SerialPortLib.c | 145 ++++++++++++++++ .../FdtPL011SerialPortLib.inf | 50 ++++++ .../FdtPL011SerialPortLib/NullSerialPortExtLib.c | 47 ++++++ .../FdtPL011SerialPortLib/NullSerialPortExtLib.inf | 30 ++++ 7 files changed, 504 insertions(+) create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.inf create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/NullSerialPortExtLib.c create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/NullSerialPortExtLib.inf diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec index 8d51182d716b..37f00a29bf1e 100644 --- a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec +++ b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec @@ -44,3 +44,4 @@ [PcdsDynamic,PcdsFixedAtBuild] gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeBaseAddress|0x0|UINT64|0x00000002 + gArmVirtualizationTokenSpaceGuid.PcdPL011BaseAddress|0x0|UINT64|0x00000003 diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c new file mode 100644 index 000000000000..67c80003bde5 --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c @@ -0,0 +1,186 @@ +/** @file + Serial I/O Port library functions with base address discovered from FDT + + Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
+ Copyright (c) 2012 - 2013, ARM Ltd. All rights reserved.
+ Copyright (c) 2014, Linaro Ltd. 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 +#include +#include +#include + +#include + +RETURN_STATUS +EFIAPI +SerialPortInitialize ( + VOID + ) +{ + // + // This SerialPortInitialize() function is completely empty, for a number of + // reasons: + // - if we are executing from flash, it is hard to keep state (i.e., store the + // discovered base address in a global), and the most robust way to deal + // with this is to discover the base address at every Write (); + // - calls to the Write() function in this module may be issued before this + // initialization function is called: this is not a problem when the base + // address of the UART is hardcoded, and only the baud rate may be wrong, + // but if we don't know the base address yet, we may be poking into memory + // that does not tolerate being poked into; + // - SEC and PEI phases produce debug output only, so with debug disabled, no + // initialization (or device tree parsing) is performed at all. + // + // Note that this means that on *every* Write () call, the device tree will be + // parsed and the UART re-initialized. However, this is a small price to pay + // for having serial debug output on a UART with no fixed base address. + // + return RETURN_SUCCESS; +} + +STATIC +UINT64 +SerialPortGetBaseAddress ( + VOID + ) +{ + UINT64 BaudRate; + UINT32 ReceiveFifoDepth; + EFI_PARITY_TYPE Parity; + UINT8 DataBits; + EFI_STOP_BITS_TYPE StopBits; + VOID *DeviceTreeBase; + INT32 Node, Prev; + + DeviceTreeBase = (VOID *)(UINTN)FixedPcdGet64 (PcdDeviceTreeInitialBaseAddress); + + if (DeviceTreeBase == NULL || fdt_check_header (DeviceTreeBase) != 0) { + return 0; + } + + // + // Enumerate all FDT nodes looking for a PL011 and capture its base address + // + for (Prev = 0;; Prev = Node) { + INT32 Len; + CONST CHAR8 *Compatible; + CONST CHAR8 *CompItem; + + Node = fdt_next_node (DeviceTreeBase, Prev, NULL); + if (Node < 0) { + break; + } + + Compatible = fdt_getprop (DeviceTreeBase, Node, "compatible", &Len); + if (Compatible == NULL) { + continue; + } + + // + // Iterate over the NULL-separated items in the compatible string + // + for (CompItem = Compatible; CompItem < Compatible + Len; + CompItem += 1 + AsciiStrLen (CompItem)) { + + if (AsciiStrCmp (CompItem, "arm,pl011") == 0) { + CONST UINT64 *RegProp; + UINTN UartBase; + RETURN_STATUS Status; + + RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len); + if (Len != 16) { + return 0; + } + UartBase = (UINTN)fdt64_to_cpu(RegProp[0]); + + BaudRate = (UINTN)FixedPcdGet64 (PcdUartDefaultBaudRate); + ReceiveFifoDepth = 0; // Use the default value for Fifo depth + Parity = (EFI_PARITY_TYPE)FixedPcdGet8 (PcdUartDefaultParity); + DataBits = FixedPcdGet8 (PcdUartDefaultDataBits); + StopBits = (EFI_STOP_BITS_TYPE) FixedPcdGet8 (PcdUartDefaultStopBits); + + Status = PL011UartInitializePort ( + UartBase, + &BaudRate, &ReceiveFifoDepth, &Parity, &DataBits, &StopBits); + if (Status == RETURN_SUCCESS) { + return UartBase; + } + } + } + } + return 0; +} + +/** + Write data to serial device. + + @param Buffer Point of data buffer which need to be written. + @param NumberOfBytes Number of output bytes which are cached in Buffer. + + @retval 0 Write data failed. + @retval !0 Actual number of bytes written to serial device. + +**/ +UINTN +EFIAPI +SerialPortWrite ( + IN UINT8 *Buffer, + IN UINTN NumberOfBytes + ) +{ + UINT64 SerialRegisterBase; + + SerialRegisterBase = SerialPortGetBaseAddress (); + if (SerialRegisterBase != 0); + return PL011UartWrite ((UINTN)SerialRegisterBase, Buffer, NumberOfBytes); + return 0; +} + +/** + Read data from serial device and save the data in buffer. + + @param Buffer Point of data buffer which need to be written. + @param NumberOfBytes Size of Buffer[]. + + @retval 0 Read data failed. + @retval !0 Actual number of bytes read from serial device. + +**/ +UINTN +EFIAPI +SerialPortRead ( + OUT UINT8 *Buffer, + IN UINTN NumberOfBytes +) +{ + return 0; +} + +/** + Check to see if any data is available to be read from the debug device. + + @retval TRUE At least one byte of data is available to be read + @retval FALSE No data is available to be read + +**/ +BOOLEAN +EFIAPI +SerialPortPoll ( + VOID + ) +{ + return FALSE; +} diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.inf b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.inf new file mode 100644 index 000000000000..4db051327105 --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.inf @@ -0,0 +1,45 @@ +#/** @file +# +# Component description file for EarlyFdtPL011SerialPortLib module +# +# Copyright (c) 2011-2012, ARM Ltd. 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 = EarlyFdtPL011SerialPortLib + FILE_GUID = 0983616A-49BC-4732-B531-4AF98D2056F0 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = SerialPortLib + +[Sources.common] + EarlyFdtPL011SerialPortLib.c + +[LibraryClasses] + PL011UartLib + PcdLib + FdtLib + +[Packages] + MdePkg/MdePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec + +[FixedPcd] + gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress + + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c new file mode 100644 index 000000000000..39c1ab043437 --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c @@ -0,0 +1,145 @@ +/** @file + Serial I/O Port library functions with base address discovered from FDT + + Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
+ Copyright (c) 2012 - 2013, ARM Ltd. All rights reserved.
+ Copyright (c) 2014, Linaro Ltd. 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 +#include +#include +#include +#include + +// +// This is an artifical dependency on UefiBootServicesTableLib.h, which is +// needed to make sure PcdGet64 () is callable once we get to our constructor +// +#include +#include + +#include + +UINTN mSerialBaseAddress; + +/** + + Program hardware of Serial port + + @return RETURN_NOT_FOUND if no PL011 base address could be found + Otherwise, result of PL011UartInitializePort () is returned + +**/ +RETURN_STATUS +EFIAPI +SerialPortInitialize ( + VOID + ) +{ + return RETURN_SUCCESS; +} + +RETURN_STATUS +EFIAPI +FdtPL011SerialPortLibInitialize ( + VOID + ) +{ + UINT64 BaudRate; + UINT32 ReceiveFifoDepth; + EFI_PARITY_TYPE Parity; + UINT8 DataBits; + EFI_STOP_BITS_TYPE StopBits; + + mSerialBaseAddress = (UINTN)PcdGet64 (PcdPL011BaseAddress); + if (mSerialBaseAddress == 0) { + return RETURN_NOT_FOUND; + } + + BaudRate = (UINTN)PcdGet64 (PcdUartDefaultBaudRate); + ReceiveFifoDepth = 0; // Use the default value for Fifo depth + Parity = (EFI_PARITY_TYPE)PcdGet8 (PcdUartDefaultParity); + DataBits = PcdGet8 (PcdUartDefaultDataBits); + StopBits = (EFI_STOP_BITS_TYPE) PcdGet8 (PcdUartDefaultStopBits); + + return PL011UartInitializePort ( + mSerialBaseAddress, &BaudRate, &ReceiveFifoDepth, + &Parity, &DataBits, &StopBits); +} + +/** + Write data to serial device. + + @param Buffer Point of data buffer which need to be written. + @param NumberOfBytes Number of output bytes which are cached in Buffer. + + @retval 0 Write data failed. + @retval !0 Actual number of bytes written to serial device. + +**/ +UINTN +EFIAPI +SerialPortWrite ( + IN UINT8 *Buffer, + IN UINTN NumberOfBytes + ) +{ + if (mSerialBaseAddress != 0) { + return PL011UartWrite (mSerialBaseAddress, Buffer, NumberOfBytes); + } + return 0; +} + +/** + Read data from serial device and save the data in buffer. + + @param Buffer Point of data buffer which need to be written. + @param NumberOfBytes Number of output bytes which are cached in Buffer. + + @retval 0 Read data failed. + @retval !0 Actual number of bytes read from serial device. + +**/ +UINTN +EFIAPI +SerialPortRead ( + OUT UINT8 *Buffer, + IN UINTN NumberOfBytes +) +{ + if (mSerialBaseAddress != 0) { + return PL011UartRead (mSerialBaseAddress, Buffer, NumberOfBytes); + } + return 0; +} + +/** + Check to see if any data is available to be read from the debug device. + + @retval TRUE At least one byte of data is available to be read + @retval FALSE No data is available to be read + +**/ +BOOLEAN +EFIAPI +SerialPortPoll ( + VOID + ) +{ + if (mSerialBaseAddress != 0) { + return PL011UartPoll (mSerialBaseAddress); + } + return FALSE; +} diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf new file mode 100644 index 000000000000..b4fc7122c3f6 --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf @@ -0,0 +1,50 @@ +#/** @file +# +# Component description file for PL011SerialPortLib module +# +# Copyright (c) 2011-2012, ARM Ltd. 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 = FdtPL011SerialPortLib + FILE_GUID = 0983616A-49BC-4732-B531-4AF98D2056F0 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = SerialPortLib + CONSTRUCTOR = FdtPL011SerialPortLibInitialize + +[Sources.common] + FdtPL011SerialPortLib.c + +[LibraryClasses] + PL011UartLib + PcdLib + UefiBootServicesTableLib + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec + ArmPkg/ArmPkg.dec + +[FixedPcd] + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits + +[Pcd] + gArmVirtualizationTokenSpaceGuid.PcdPL011BaseAddress + gArmTokenSpaceGuid.PcdSystemMemorySize diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/NullSerialPortExtLib.c b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/NullSerialPortExtLib.c new file mode 100644 index 000000000000..5e0f06852584 --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/NullSerialPortExtLib.c @@ -0,0 +1,47 @@ +/** @file + + Copyright (c) 2014, Linaro Ltd. 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 + +RETURN_STATUS +EFIAPI +SerialPortSetAttributes ( + IN OUT UINT64 *BaudRate, + IN OUT UINT32 *ReceiveFifoDepth, + IN OUT UINT32 *Timeout, + IN OUT EFI_PARITY_TYPE *Parity, + IN OUT UINT8 *DataBits, + IN OUT EFI_STOP_BITS_TYPE *StopBits + ) +{ + return RETURN_SUCCESS; +} + +RETURN_STATUS +EFIAPI +SerialPortSetControl ( + IN UINT32 Control + ) +{ + return RETURN_SUCCESS; +} + +RETURN_STATUS +EFIAPI +SerialPortGetControl ( + OUT UINT32 *Control + ) +{ + return RETURN_SUCCESS; +} diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/NullSerialPortExtLib.inf b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/NullSerialPortExtLib.inf new file mode 100644 index 000000000000..6985c15c66e6 --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/NullSerialPortExtLib.inf @@ -0,0 +1,30 @@ +#/** @file +# +# Component description file for PL011SerialPortLib module +# +# Copyright (c) 2011-2012, ARM Ltd. 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 = NullSerialPortExtLib + FILE_GUID = BD396D28-085E-477A-A5DE-A8D91DD1F752 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = SerialPortExtLib + +[Sources.common] + NullSerialPortExtLib.c + +[Packages] + MdePkg/MdePkg.dec + EmbeddedPkg/EmbeddedPkg.dec