I could have sworn I saw a patch being sent for review that made this a Pcd?
A
--
You received this message because you are subscribed to the Google Groups "RISC-V Firmware Exchange" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
fw-exchange...@riscv.org.
To view this discussion on the web visit
https://groups.google.com/a/riscv.org/d/msgid/fw-exchange/CAAxYnhQUtHBOR2%2BUp%3DHxe17HkufbvVqz0aWew5gdYdoP2nvtmA%40mail.gmail.com.
The frequency was a PCD variable from the start. There was a fix required to use it in few additional places since SBI expected in ticks.
The input to TimerDriverSetTimerPeriod
is in 100ns units (you can see comments in the function header)
and hence you see this conversion. So, it is not hard coded and
should work for any frequency.
Since now libfdt is added in
MdePkg, we can get rid of this PCD variable usage and fetch it
from the DT.
To view this discussion on the web visit https://groups.google.com/a/riscv.org/d/msgid/fw-exchange/PH8PR11MB6856181B160F459F35ACA6D6831DA%40PH8PR11MB6856.namprd11.prod.outlook.com.
Hi Dhaval,
Have you changed the PCD in your platform's FDF? For ex: For RiscVVirtQemu, it is set here to 10MHz.
RiscVVirt.fdf.inc:SET gUefiCpuPkgTokenSpaceGuid.PcdCpuCoreCrystalClockFrequency = 10000000
You can see the PCD usage in the same TimerDriverSetTimerPeriod
and other places.
Not really. That is the default time period set during
initialization similar to the timer implementation in other
architectures. Later, any value can be set using
EFI_TIMER_ARCH_PROTOCOL.
Hi Dhaval,
I don't see an issue introducing the PCD if it adds value. But the PCD Arm uses is from EmbeddedPkg and we can't use it in CpuPkg. IMO, it is better to get rid of the PCD/constant default period and just use the timer frequency value from DT. Andrei and Tuan may have some opinion or better suggestion. If it is acceptable, would you mind sending the patch?
Thanks,Hi Dhaval,
Like I mentioned earlier, with libfdt added in MdePkg, UefiCpuPkg can make use it without creating circular dependencies. So, let us use DT itself and keep HOB to only data to as minimum as possible when there is no other easy way.
The advantage of getting info from FDT is, every platform doesn't
need to define PCD variable.
Hi Dhaval,
My understanding is, Andrei is going to update the PI spec to add
extension bitmap under the CPU HOB which is required for CMO to
discover the extension in Pre-Dxe phase. Once that is done, SSTC
series will just discover the extension from the CPU HOB and
enable SSTC.
However, for your work, getting timer frequency from FDT should
not have any dependency on SSTC. It should work with SBI timer
also, right?
I think it is better we have single way/API to check whether
extension is supported or not. Since CMO library is same for SEC
and DXE, I was thinking HOB is required anyway to discover the
extensions and SSTC/MMU can use the same mechanism. Other option
is, we can have different CMO library for SEC and DXE phases with
duplicated code. In that case, SEC phase library can traverse the
FDT every time to check the extension but DXE instance can cache
it. Since there is only one time CMO is used in SEC, it is
probably ok. This way we don't need to define any thing in PI
spec. Andrei, Tuan - thoughts?
Or we can have a protocol that contain all information that can retrieved from DT. Any modules that need to discover SSTC, etc… can add DEPEX on this protocol. And user written DXE driver can use that protocol without linking library.
To view this discussion on the web visit https://groups.google.com/a/riscv.org/d/msgid/fw-exchange/de61e195-3dec-9101-860d-3338004f6729%40ventanamicro.com.
Very few use the info in pre-DXE so creating protocol make no sense, access DT directly instead. If we use this approach, no need to pass it in HOB, just retrieve from DT at initialization function when creating protocol in DXE phase.