From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.3267.1588702309881614446 for ; Tue, 05 May 2020 11:11:50 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7657A1FB; Tue, 5 May 2020 11:11:49 -0700 (PDT) Received: from [192.168.1.81] (unknown [10.37.8.179]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 38FAD3F305; Tue, 5 May 2020 11:11:48 -0700 (PDT) Subject: Re: [PATCH edk2-platforms 4/5] Platform/RaspberryPi3: query firmware for 16550 input clock at boot To: devel@edk2.groups.io Cc: leif@nuviainc.com, pete@akeo.ie, andrey.warkentin@gmail.com References: <20200505145029.29826-1-ard.biesheuvel@arm.com> <20200505145029.29826-5-ard.biesheuvel@arm.com> From: "Ard Biesheuvel" Message-ID: <02940c75-5a92-9fca-449a-7a90ccfc8362@arm.com> Date: Tue, 5 May 2020 20:11:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200505145029.29826-5-ard.biesheuvel@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 5/5/20 4:50 PM, Ard Biesheuvel wrote: > Query the firmware for the clock rate that is used to drive the > 16550 baud clock, so that we can program the correct baud rate. > > Co-authored-by: Pete Batard > Co-authored-by: Andrei Warkentin > Co-authored-by: Ard Biesheuvel > Signed-off-by: Pete Batard > Signed-off-by: Ard Biesheuvel > --- > Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S | 25 +++++++++++++++++++- > 1 file changed, 24 insertions(+), 1 deletion(-) > > diff --git a/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S b/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S > index 91dfe1bb981e..35580e4ed73a 100644 > --- a/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S > +++ b/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S > @@ -3,7 +3,7 @@ > * Copyright (c) 2020, Andrei Warkentin > * Copyright (c) 2019-2020, Pete Batard > * Copyright (c) 2016, Linaro Limited. All rights reserved. > - * Copyright (c) 2011-2013, ARM Limited. All rights reserved. > + * Copyright (c) 2011-2020, ARM Limited. All rights reserved. > * > * SPDX-License-Identifier: BSD-2-Clause-Patent > * > @@ -85,6 +85,14 @@ ASM_FUNC (ArmPlatformPeiBootAction) > adr x2, mBoardRevision > str w0, [x2] > > +#if (RPI_MODEL == 3) As noted by Pete off-list, doing this doesn't work unless we add something like GCC:*_*_*_PP_FLAGS = -DRPI_MODEL=3 to the [BuildOptions] in RPi3.dsc > + run .Lclkinfo_buffer > + > + ldr w0, .Lfrequency > + adrp x2, _gPcd_BinaryPatch_PcdSerialClockRate > + str w0, [x2, :lo12:_gPcd_BinaryPatch_PcdSerialClockRate] > +#endif > + > ret > > .align 4 > @@ -127,6 +135,21 @@ ASM_FUNC (ArmPlatformPeiBootAction) > .long 0 // end tag > .set .Lrevinfo_size, . - .Lrevinfo_buffer > > +#if (RPI_MODEL == 3) > + .align 4 > +.Lclkinfo_buffer: > + .long .Lclkinfo_size > + .long 0x0 > + .long RPI_MBOX_GET_CLOCK_RATE > + .long 8 // buf size > + .long 4 // input len > + .long 4 // clock id: 0x04 = Core/VPU > +.Lfrequency: > + .long 0 // frequency > + .long 0 // end tag > + .set .Lclkinfo_size, . - .Lclkinfo_buffer > +#endif > + > //UINTN > //ArmPlatformGetPrimaryCoreMpId ( > // VOID >