From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-x22d.google.com (mail-it0-x22d.google.com [IPv6:2607:f8b0:4001:c0b::22d]) (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 B9F4721CE73EC for ; Thu, 6 Jul 2017 07:54:56 -0700 (PDT) Received: by mail-it0-x22d.google.com with SMTP id m68so4859665ith.1 for ; Thu, 06 Jul 2017 07:56:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=kQyEwfLpl+LZV1TlyQ2JWBWlK0fbeBD3Ib/8aWN0GII=; b=GZEDCLCbzNFMn5+asasQBr1BNNSeRzBka1R7TPaTqePU8d5C/PzgAREJ2/dRnVCaHo WkvGw9yIOYUqSCGnpNAxLnsDRXeTz/sZzmRQZsqzpR8IN/+5FL5rgcCvHst1xWGD+gUh LqT0VMcjo/vUJ2x9/fTcS9/10KQPd5MjszrJ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=kQyEwfLpl+LZV1TlyQ2JWBWlK0fbeBD3Ib/8aWN0GII=; b=CzzxEj2+PuPupbegGOdeomkcO7em/5kAc9VoYDll5QP93Ls4jHCnlEnqyUUs8pFuGZ B8OJ3pgranaWpLfmogl3/y/8v7fmPQnvUwEGqAgCxe8JLDRmxEWk+wvMrkmaDaSrF+jd m1wu/uVXKrByfOjJyXCI5IxmUaNTDacJeDKUXwOMBdaGx980tjOUZfGkkYynhMW81krX Sgi+Th3sFfxd2ZetDzuZ1Qyyax4XDGYUSBKr1MFvtvkIlfO1b4Oh9PhAT3U19kRz2kw1 wKxKc9wkaXeZUeTjfCzOhx1co6xBE7JpXrKbqIKk9qP9inOwbJQgdX1K3ZUkTFO597pR h2fQ== X-Gm-Message-State: AKS2vOxky2tg2DB0DGKfsbpd8DWsBRbpUzTqomHY6pDSa0XXGlyN7C4h nUaZLsYnAvmq+hfdfOqQHdgUoud2k3+q X-Received: by 10.107.59.84 with SMTP id i81mr45534201ioa.72.1499352996655; Thu, 06 Jul 2017 07:56:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.134.134 with HTTP; Thu, 6 Jul 2017 07:56:36 -0700 (PDT) In-Reply-To: References: <1499183018-16297-1-git-send-email-jun.nie@linaro.org> <20170705163625.GH26676@bivouac.eciton.net> From: Ard Biesheuvel Date: Thu, 6 Jul 2017 15:56:36 +0100 Message-ID: To: Jun Nie Cc: Leif Lindholm , "edk2-devel@lists.01.org" , Evan Lloyd , Alexei Fedorov , Shawn Guo , Jason Liu Subject: Re: [PATCH v2] ArmPlatformPkg: Support different PL011 reg offset X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jul 2017 14:54:57 -0000 Content-Type: text/plain; charset="UTF-8" On 6 July 2017 at 15:54, Jun Nie wrote: > 2017-07-06 0:36 GMT+08:00 Leif Lindholm : >> On Tue, Jul 04, 2017 at 11:43:38PM +0800, Jun Nie wrote: >>> ZTE/SanChip version pl011 has different reg offset and bit offset >>> for some registers. >>> >>> Contributed-under: TianoCore Contribution Agreement 1.0 >>> Signed-off-by: Jun Nie >>> --- >>> ArmPlatformPkg/ArmPlatformPkg.dec | 1 + >>> ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf | 1 + >>> ArmPlatformPkg/Include/Drivers/PL011Uart.h | 29 ++++++++++++++++++++++++++ >>> 3 files changed, 31 insertions(+) >>> >>> diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec >>> index d756fd2..3dd613c 100644 >>> --- a/ArmPlatformPkg/ArmPlatformPkg.dec >>> +++ b/ArmPlatformPkg/ArmPlatformPkg.dec >>> @@ -97,6 +97,7 @@ >>> gArmPlatformTokenSpaceGuid.PL011UartInteger|0|UINT32|0x00000020 >>> gArmPlatformTokenSpaceGuid.PL011UartFractional|0|UINT32|0x0000002D >>> gArmPlatformTokenSpaceGuid.PL011UartInterrupt|0x00000000|UINT32|0x0000002F >>> + gArmPlatformTokenSpaceGuid.PL011UartZxRegOffset|0|UINT8|0 >> >> I'm basically OK with this patch, but if we have multiple variants of >> this, as the Linux driver suggests, I think we're looking at something >> more like PL011UartRegOffsetVariant, with a numerical value for each >> special flavour. >> >>> >>> ## PL011 Serial Debug UART >>> gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase|0x00000000|UINT64|0x00000030 >>> diff --git a/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf b/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf >>> index 0154f3b..257fbc7 100644 >>> --- a/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf >>> +++ b/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf >>> @@ -39,3 +39,4 @@ >>> >>> gArmPlatformTokenSpaceGuid.PL011UartInteger >>> gArmPlatformTokenSpaceGuid.PL011UartFractional >>> + gArmPlatformTokenSpaceGuid.PL011UartZxRegOffset >>> diff --git a/ArmPlatformPkg/Include/Drivers/PL011Uart.h b/ArmPlatformPkg/Include/Drivers/PL011Uart.h >>> index d5e88e8..09d548b 100644 >>> --- a/ArmPlatformPkg/Include/Drivers/PL011Uart.h >>> +++ b/ArmPlatformPkg/Include/Drivers/PL011Uart.h >>> @@ -19,6 +19,7 @@ >>> #include >>> >>> // PL011 Registers >>> +#if !FixedPcdGet8 (PL011UartZxRegOffset) >> >> And as such, more a test like... >> #if FixedPcdGet8 (PL011UartRegOffsetVariant) == PL011_VARIANT_ZTE > > Yes, it is more generic. Which header is proper file to add value > definition of PL011_VARIANT_ZTE that can be included by platform.dsc? > Please look at gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType for an example. It is fine to have the C level #defines in PL011Uart.h