Hi Pedro,

I think this size is the CPU IO or PCI IO space width, like you saied, LoongArch doesn't mapped the IO ports, but it has IO area.

For example, it can map the LPC IO or PCI IO ports onto the physical addres space and register the CPU IO or PCI IO protocols to access them.

The Loongson.dsc of edk2-platforms sets this value to 32. I think this value is too wide since most IO device only use 16-bit width, so I changed this value from 32 to 16 at this point.


Thanks,
Chao
On 2023/11/16 16:15, Pedro Falcato wrote:
On Wed, Nov 15, 2023 at 6:55 PM Leif Lindholm <quic_llindhol@quicinc.com> wrote:
On 2023-11-06 03:29, Chao Li wrote:
Added LoongArch64 architecture CPU IO width.

https://bugzilla.tianocore.org/show_bug.cgi?id=4584

Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Signed-off-by: Chao Li <lichao@loongson.cn>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>

I note that as a result of this we are now definining this token
individually for 5 different architectures, in order to provide two
different default values. We should probably look at consolidating
those, but that responsibility doesn't have to land on this set.

/
     Leif

---
  EmbeddedPkg/EmbeddedPkg.dec | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
index 341ef5e6a6..241d4f3acc 100644
--- a/EmbeddedPkg/EmbeddedPkg.dec
+++ b/EmbeddedPkg/EmbeddedPkg.dec
@@ -165,6 +165,9 @@
  [PcdsFixedAtBuild.X64]
    gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|16|UINT8|0x00000011

+[PcdsFixedAtBuild.LOONGARCH64]
+  gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|16|UINT8|0x00000011
+
Leif,

Can you clarify the meaning of PcdPrePiCpuIoSize? 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)
3) Platform/Loongson/LoongArchQemuPkg/Loongson.dec:
gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|0|UINT8|0x00010001 <-- ??

and FWIW, LoongArch does not seem to have port-mapped IO at all.

_._,_._,_

Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#111306) | | Mute This Topic | New Topic
Your Subscription | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_