From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::442; helo=mail-pf1-x442.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (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 DBC4B210DC1BB for ; Wed, 8 Aug 2018 00:37:43 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id p12-v6so721110pfh.2 for ; Wed, 08 Aug 2018 00:37:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=7Ct7SeY2qK/MQJW4Zcydhpb1QcBh4kEbA7fzGuYpn1o=; b=CS4mU6rNv3/G+Q65BX9g+yYnaeUjTrGvS1Yf52ipHMPt1nxDyveaKBSwj/3YX8Re/j OX+xzphCNj+hGmFzwZOm4qIaa1FANdSqSUk9bYJ5Wqo60a7yOVoE2DgeSyM1FxGIj2ha chONqWVFGnjeqqNcaFpOwA8jzWAw1tRNgCHoo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=7Ct7SeY2qK/MQJW4Zcydhpb1QcBh4kEbA7fzGuYpn1o=; b=tvCAsSNK5eUVFaG0hmuQF/O+TgdD99gI61dvA9DYnviIG1TQNiMb6zQsARRQwgmQPG n/RMvsVW+Tlzrqod0igxMxJnVCqt69+Z90vEuAhKVkrnZxhBIni4RXztHiAvTZ3aCyFa pgA7hn1q4b1f9TgdWrCjMrmJErqYdpC/e87SNhRIrBdKhp7BxhJ6wm2ND9HjS27Kk8/8 EINActutL0uMEbnrRkr/i36sCe1GUm0KEQ98BNKuv5M9+S2THForsdmpWRzHLb2DG/Xt /TLE2tfB5HBBCvc4FgvaswA+JyVmT20MY5fat0D7EfdH+7zv6tqCLtfawEV9VzV2kwrH oB9g== X-Gm-Message-State: AOUpUlH9lurvBAj/Va6RNMwjM1KVHMHqhnEdLSXq8QW4nPUaNJ/8CVXR eAgqrDPsTFe6kgL+tII92fgusw== X-Google-Smtp-Source: AA+uWPwopJhxznljRkByEhU/XH+Ea6MB+lCo9mToHnyxDLSeSvh5K+q2y7W/d17bXft4sWMT1XzvBA== X-Received: by 2002:a63:2013:: with SMTP id g19-v6mr1471561pgg.68.1533713863410; Wed, 08 Aug 2018 00:37:43 -0700 (PDT) Received: from [10.199.0.182] ([64.64.108.224]) by smtp.gmail.com with ESMTPSA id l71-v6sm5373260pgd.70.2018.08.08.00.37.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 00:37:42 -0700 (PDT) To: Leif Lindholm Cc: linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, graeme.gregory@linaro.org, ard.biesheuvel@linaro.org, guoheyi@huawei.com, wanghuiqiang@huawei.com, huangming23@huawei.com, zhangjinsong2@huawei.com, huangdaode@hisilicon.com, john.garry@huawei.com, xinliang.liu@linaro.org, Yan Zhang , Heyi Guo References: <20180724070922.63362-1-ming.huang@linaro.org> <20180724070922.63362-10-ming.huang@linaro.org> <20180802181003.3lxlcbb6kya2vppa@bivouac.eciton.net> From: Ming Message-ID: Date: Wed, 8 Aug 2018 15:37:23 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180802181003.3lxlcbb6kya2vppa@bivouac.eciton.net> Subject: Re: [PATCH edk2-platforms v1 09/38] Hisilicon/D06: Add Debug Serial Port Init Driver X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Aug 2018 07:37:44 -0000 Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 8bit ÔÚ 8/3/2018 2:10 AM, Leif Lindholm дµÀ: > On Tue, Jul 24, 2018 at 03:08:53PM +0800, Ming Huang wrote: >> From: Yan Zhang >> >> Debug serial port init driver is added to initilize debug >> serial port. > > What is special about this platform that makes it require a separate > initialization function for the PL011? > We 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. Ming > / > Leif > >> Contributed-under: TianoCore Contribution Agreement 1.1 >> Signed-off-by: Yan Zhang >> Signed-off-by: Ming Huang >> Signed-off-by: Heyi Guo >> --- >> Platform/Hisilicon/D06/D06.dsc | 1 + >> Platform/Hisilicon/D06/D06.fdf | 1 + >> Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.c | 64 ++++++++++++++++++++ >> Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.inf | 48 +++++++++++++++ >> 4 files changed, 114 insertions(+) >> >> diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc >> index f4dfef1087..3f6f1ff20d 100644 >> --- a/Platform/Hisilicon/D06/D06.dsc >> +++ b/Platform/Hisilicon/D06/D06.dsc >> @@ -426,6 +426,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 2730eb42a9..bc016a32ae 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.c b/Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.c >> new file mode 100644 >> index 0000000000..b7233eed21 >> --- /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; >> +} >> + >> 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 >> + >> -- >> 2.17.0 >>