From patchwork Tue Jul 24 07:08:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Huang X-Patchwork-Id: 142713 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp6931746ljj; Tue, 24 Jul 2018 00:13:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc2xkHPqVugpcvqVQji7m9vcFBcUwabxW3aCn0+uV1n4Fr1/Pbn0UI53vBK+51uSlrcFUJj X-Received: by 2002:a65:5304:: with SMTP id m4-v6mr14978634pgq.250.1532416406454; Tue, 24 Jul 2018 00:13:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532416406; cv=none; d=google.com; s=arc-20160816; b=obbqypc5qYhDFiEvDyZUfkxmc2IAONZPtrmaeCncdcL08prDx/Bg0RLENYazGDjp5J zc7PNXkORI+ZFIHvztcLaH7HQcxi7OM7XBUzK8VZ8bODMO/hoznHonUTiujMnwP3BgSd +VispzRTnqQlxcf19HgvgX/slW8gWxKEnHg8DB9uQoTjSYAzyXAvPDuzgr8FEr4gn2ZJ PzuoeQKDeqz+dzDjQmKaPwQwvd+UkJGkdQt96kPTCRCctXFalbJV30hnLnqrZCZKGaSj 1Qe7Nj0PF+Zeth9o11aAuvD6B4RYhdVznIxj7eXl2niQS0+GqPhAIdH8IyMdWBFdzfpB EZ0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=l4LmbfqIVo/Lcfsbz2l48yuMl57vOkz1oSCMlRqCN0w=; b=BT/rQJp6aH/3UiHZiGF7MTDaYJHKftrm4KKWfcghBa2MeHKHWGdSN/lnQyiXTHIoQg 4446hIAXj7VFSmaiBk2wQ/+P7YgjdSaXF4wx1BZ0kD9lLKF4WwQhcru0lhA7Fr51HhuU PdQdmBJtk2hZjtig5sxUAoBQGGxv6rznjWnpyN1CacNbiFa+RZ7W4defzqtQsavossvS Qdn2Zg3YCfotmyHZtWLBiyIJmpUmFGABRYMMw8ofLxHzBt7eqPobZlgev4GsiuvOmtNN RLWBQ/hFtpOo1OFBZz2dg7E5xStyza2uojt/li/rb1JZ4SBgQfMXthk88/ChU9LUrnn2 wfVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IJm3XHMy; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id e93-v6si10097086plb.135.2018.07.24.00.13.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jul 2018 00:13:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IJm3XHMy; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0BF9E210C1239; Tue, 24 Jul 2018 00:13:26 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c01::243; helo=mail-pl0-x243.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) (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 83922210C1234 for ; Tue, 24 Jul 2018 00:13:25 -0700 (PDT) Received: by mail-pl0-x243.google.com with SMTP id w8-v6so1343167ply.8 for ; Tue, 24 Jul 2018 00:13:25 -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:in-reply-to:references; bh=WlQo9a+DEwUwSBAaSScikRerhuqySp2nDAnZXNROVWA=; b=IJm3XHMyI//hXfei8NlAj7RfGg1lSA/I7CBDSSBPD4gryNhmRTsH3yGvHiCK7DkZoe 1LlD1ZszAiCGq1UduiWzjeHdPgycxB+Q2j0CgU3qRJetXcHNIEDCejmZsCdVhzX/p17m en/kyO5aE5n6mgdgcKbhrKxZ7UPYl292cspjE= 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:in-reply-to :references; bh=WlQo9a+DEwUwSBAaSScikRerhuqySp2nDAnZXNROVWA=; b=SS3F2Wdu9gaX/+s0eIe0t8UOQLjFc2fJoxDOrm1soyfhepSiXfwGL1sOLFRZfn3nr+ QgDCYw0/igMn0iaYKDJAWbw46XrRCXi0JY5DrAGe5ShkHlxRjbXTSajZQ1cZZLsNQPIR lEuuOVrbxaiDQdvGwTbUgpbFyCwAPFZpyxVtGz8wehyGF/UJLvzAAINvRMVTSIf7TCEs cDb2U+h3+nKA0rhYmP+0wyyGUDcRu71IdvrloYAI0C+NgrWtURNWWxpqzRfcK6+u9hW+ Typ9pDcLthOJUSmzfDM2HTzPqzHZNfcbrZcAInXKn40SwK6Lc99mr5G6QFvMapHue3Uv LmZg== X-Gm-Message-State: AOUpUlFmnlEST2dS7LNfxu+67vDPl0RndhFv1C+yVugS2Ee5vXsmH044 m5ABkFrWMzJcvthioTBhT2822w== X-Received: by 2002:a17:902:5381:: with SMTP id c1-v6mr15612417pli.137.1532416405148; Tue, 24 Jul 2018 00:13:25 -0700 (PDT) Received: from localhost.localdomain ([120.31.149.194]) by smtp.gmail.com with ESMTPSA id t14-v6sm11449788pgu.0.2018.07.24.00.13.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jul 2018 00:13:24 -0700 (PDT) From: Ming Huang To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, graeme.gregory@linaro.org Date: Tue, 24 Jul 2018 15:08:53 +0800 Message-Id: <20180724070922.63362-10-ming.huang@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180724070922.63362-1-ming.huang@linaro.org> References: <20180724070922.63362-1-ming.huang@linaro.org> Subject: [edk2] [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: , Cc: huangming23@huawei.com, xinliang.liu@linaro.org, john.garry@huawei.com, zhangjinsong2@huawei.com, Yan Zhang , huangdaode@hisilicon.com, guoheyi@huawei.com, wanghuiqiang@huawei.com MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" From: Yan Zhang Debug serial port init driver is added to initilize debug serial port. 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(+) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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 +