From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (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 0A33E210FBF01 for ; Wed, 22 Aug 2018 04:01:22 -0700 (PDT) Received: by mail-wm0-x241.google.com with SMTP id j192-v6so1419297wmj.1 for ; Wed, 22 Aug 2018 04:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=nQtCCqifIwMflxTYwp0HN/ycRXJhMQ9wOquGlMb/ll4=; b=Iu1EtYH4Scy76JcUm3ZsxfQ6WwS2uFu5s4cn9RXW+h1pKykIU8vPg1jy+xjNJBc16Z S9ZMBADBFyeJe61prDxo1qLOa5Ab37FOgmPYvvsForbxYVLGpgpx49wyHA8E1q4bJn0A Up+cLT3dWER0rS7fR3y/HaD4KD1xcczkr1V94= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=nQtCCqifIwMflxTYwp0HN/ycRXJhMQ9wOquGlMb/ll4=; b=VwxWx/2dDymArSSCnf4TRQc+dST0kygi8HoOI1rhPhpKWcSZExMT5p9e3j6uf3DvEx /caZlrOsnzR22UHAWAkBBdip/4kNcY91jyQM8J4RStivA4jihHFUoPjsnpIOkFmLxf6g EkaV4WQqPr0zgAu4j/e9GWT651+gz7CPLoX1QWCDWq23obnlRgOtj+2rlunsTkqDWgE+ gvXSOj6Tx51Uk7ybHRQ4Zt1aUV5/KVbgwL5qy3UzfPOOshLjkhNrbXSXt0FxVIurgkCA 9akf1Opc7Pg0LjOaumrxWe1IoXBALUfFJMmMpcFUEWS2ffHtCtvHOw6ARaTxEUo9lQqi O4Wg== X-Gm-Message-State: APzg51BsMt31ErjKKaqCWSVj3LhlXPxsyHVJr0BRKqS/cnesZ4Z1aoQQ AgMXgP2CIgI8LegQIZP/7nWLRw== X-Google-Smtp-Source: ANB0VdZUj1mpBFCJCf3mCS0d3+DklOTxK/+DVKdMZ7dzlZ0SG/jPPOaoAWGhQxdYCxy1Pex84pidMA== X-Received: by 2002:a1c:a78c:: with SMTP id q134-v6mr1980998wme.42.1534935680865; Wed, 22 Aug 2018 04:01:20 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id t6-v6sm1658193wmf.8.2018.08.22.04.01.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 22 Aug 2018 04:01:19 -0700 (PDT) Date: Wed, 22 Aug 2018 12:01:18 +0100 From: Leif Lindholm To: Ming Huang Cc: linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, graeme.gregory@linaro.org, ard.biesheuvel@linaro.org, michael.d.kinney@intel.com, lersek@redhat.com, guoheyi@huawei.com, wanghuiqiang@huawei.com, huangming23@huawei.com, zhangjinsong2@huawei.com, huangdaode@hisilicon.com, john.garry@huawei.com, xinliang.liu@linaro.org, Heyi Guo Message-ID: <20180822110118.5de3gw2ddh5mrxrs@bivouac.eciton.net> References: <20180814080903.50466-1-ming.huang@linaro.org> <20180814080903.50466-17-ming.huang@linaro.org> MIME-Version: 1.0 In-Reply-To: <20180814080903.50466-17-ming.huang@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH edk2-platforms v2 16/43] Hisilicon/D06: Add Debug Serial Port Init Driver X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Aug 2018 11:01:23 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Aug 14, 2018 at 04:08:36PM +0800, Ming Huang wrote: > From: Heyi Guo > > Hi1620 have two physical PL011 serial ports on the board, > one for serial port console (described by ACPI SPCR) and > the other for standard debug port (described by ACPI DBG2). > This driver is to initialize the debug UART, not the serial > console. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Heyi Guo Reviewed-by: Leif Lindholm > --- > Platform/Hisilicon/D06/D06.dsc | 1 + > Platform/Hisilicon/D06/D06.fdf | 1 + > Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.inf | 48 +++++++++++++++ > Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.c | 64 ++++++++++++++++++++ > 4 files changed, 114 insertions(+) > > diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc > index 9ca7160dad..20d2d2a1b4 100644 > --- a/Platform/Hisilicon/D06/D06.dsc > +++ b/Platform/Hisilicon/D06/D06.dsc > @@ -422,6 +422,7 @@ > # Memory test > # > MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf > + Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.inf > MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf > MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf > MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > diff --git a/Platform/Hisilicon/D06/D06.fdf b/Platform/Hisilicon/D06/D06.fdf > index 07fe096f61..8cac126ccf 100644 > --- a/Platform/Hisilicon/D06/D06.fdf > +++ b/Platform/Hisilicon/D06/D06.fdf > @@ -303,6 +303,7 @@ READ_LOCK_STATUS = TRUE > INF MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf > INF MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf > > + INF Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.inf > INF MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf > # > # Build Shell from latest source code instead of prebuilt binary > diff --git a/Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.inf b/Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.inf > new file mode 100644 > index 0000000000..8c91bdf0f4 > --- /dev/null > +++ b/Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.inf > @@ -0,0 +1,48 @@ > +#/** @file > +# > +# Copyright (c) 2016 - 2018, Hisilicon Limited. All rights reserved. > +# Copyright (c) 2016 - 2018, Linaro Limited. 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 = 0x0001001A > + BASE_NAME = Pl011DebugSerialPortInitDxe > + FILE_GUID = 16D53E86-7EA4-47bd-861F-511EA9B8ABE0 > + MODULE_TYPE = DXE_DRIVER > + VERSION_STRING = 1.0 > + ENTRY_POINT = SerialPortEntry > + > +[Sources.common] > + Pl011DebugSerialPortInitDxe.c > + > + > +[Packages] > + ArmPlatformPkg/ArmPlatformPkg.dec > + MdeModulePkg/MdeModulePkg.dec > + MdePkg/MdePkg.dec > + Silicon/Hisilicon/HisiPkg.dec > + > +[LibraryClasses] > + BaseLib > + UefiDriverEntryPoint > + > +[Pcd] > + gArmPlatformTokenSpaceGuid.PL011UartClkInHz > + gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase > + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate > + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits > + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity > + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits > + > +[Depex] > + TRUE > + > diff --git a/Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.c b/Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.c > new file mode 100644 > index 0000000000..8f83737327 > --- /dev/null > +++ b/Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.c > @@ -0,0 +1,64 @@ > +/** @file > + > + Copyright (c) 2016 - 2018, Hisilicon Limited. All rights reserved. > + Copyright (c) 2016 - 2018, Linaro Limited. 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 > +DebugSerialPortInitialize ( > + VOID > + ) > +{ > + UINT64 BaudRate; > + UINT32 ReceiveFifoDepth; > + EFI_PARITY_TYPE Parity; > + UINT8 DataBits; > + EFI_STOP_BITS_TYPE StopBits; > + > + BaudRate = FixedPcdGet64 (PcdUartDefaultBaudRate); > + ReceiveFifoDepth = 0; // Use default FIFO depth > + Parity = (EFI_PARITY_TYPE)FixedPcdGet8 (PcdUartDefaultParity); > + DataBits = FixedPcdGet8 (PcdUartDefaultDataBits); > + StopBits = (EFI_STOP_BITS_TYPE) FixedPcdGet8 (PcdUartDefaultStopBits); > + return PL011UartInitializePort ( > + (UINTN)FixedPcdGet64 (PcdSerialDbgRegisterBase), > + FixedPcdGet32 (PL011UartClkInHz), > + &BaudRate, > + &ReceiveFifoDepth, > + &Parity, > + &DataBits, > + &StopBits > + ); > +} > + > +EFI_STATUS > +SerialPortEntry ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + Status = DebugSerialPortInitialize (); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "CPU1 TB serial port init ERROR: %r\n", Status)); > + } > + return EFI_SUCCESS; > +} > + > -- > 2.17.0 >