On 2023-11-16 08:15, Pedro Falcato wrote:
Leif,
Can you clarify the meaning of PcdPrePiCpuIoSize?
Not out of memory, so let's go exploring.
> I was thinking it's
> supposed to be the size of the port-mapped IO for the
> architecture/platform (as hinted by in X64 = IA32 = 16, and ARM=0),
> but from a quick git grep I can tell that
> 1) most platforms define it to something else (ArmVirt defines it to
> 16, real platforms have a plethora of other values)
> 2) gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize has no internal consumer
> in EmbeddedPkg, but only in ArmPlatformPkg and LoongArchQemuPkg (and
> BeagleBoardPkg's PrePi)
ArmVirtPkg reads this Pcd in
https://github.com/tianocore/edk2/blob/master/ArmVirtPkg/PrePi/PrePi.c#L87
which is in a call to BuildCpuHob, in
https://github.com/tianocore/edk2/blob/master/EmbeddedPkg/Library/PrePiHobLib/Hob.c#L644
which uses the argument to initialize the SizeOfIoSpace in EFI_HOB_CPU
(defined in PI spec).
This eventually gets dug up in
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Gcd/Gcd.c#L2559
where it is used to set up the GCD I/O Space Map.
This is also the only way to find out it describes a power of 2. Neither
the spec nor any of the comment headers in the codebase describe what
the size means. Tsk, tsk.
Ultimately, this ends up being used in
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c#L175
during InitializePciHostBridge ().
So I'm guessing, and I think it rings a bell, that this is needed to
enable PCIe I/O resources to be assigned, which *can* be supported on
Arm and probably Loongson systems through magic memory regions trapping
accesses in the PCIe IP.
3) Platform/Loongson/LoongArchQemuPkg/Loongson.dec:
gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|0|UINT8|0x00010001 <-- ??
Yeah, it's not great that we don't seem to have a way to trap when Pcd's
get redefined outside of their own namespace. That happens way too
frequently. That's certainly a bug.
and FWIW, LoongArch does not seem to have port-mapped IO at all.
So I guess the setting comes down to whether that is considered to be
the expected behaviour on Loongson platforms or not. About which I have
no idea and am happy to trust the author on :)
/
Leif
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111307): https://edk2.groups.io/g/devel/message/111307
Mute This Topic: https://groups.io/mt/102413876/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe:
https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-