Skip to content

hii: support 64-bit HiiDB addresses#12

Open
dishendradeshmukh1986 wants to merge 1 commit into
linuxboot:mainfrom
dishendradeshmukh1986:hii-64bit-address
Open

hii: support 64-bit HiiDB addresses#12
dishendradeshmukh1986 wants to merge 1 commit into
linuxboot:mainfrom
dishendradeshmukh1986:hii-64bit-address

Conversation

@dishendradeshmukh1986

Copy link
Copy Markdown

Some platforms export the HiiDB buffer above 4GB, so the physical address in the efivarfs payload does not always fit in 32 bits.

Parse both the existing 32-bit payload and a 64-bit address payload so the tool can consume either firmware format.

Read the exported buffer with page-sized /dev/mem mmap mappings instead of seek/read. This works for high reserved DRAM ranges where read from /dev/mem may fail.

Copy the mapped data byte-by-byte to avoid faults from wider unaligned loads on memory with strict access requirements.

Add parser coverage for both 32-bit and 64-bit HiiDB payloads.

Some platforms export the HiiDB buffer above 4GB, so the physical
address in the efivarfs payload does not always fit in 32 bits.

Parse both the existing 32-bit payload and a 64-bit address payload so
the tool can consume either firmware format.

Read the exported buffer with page-sized /dev/mem mmap mappings instead
of seek/read. This works for high reserved DRAM ranges where read from
/dev/mem may fail.

Copy the mapped data byte-by-byte to avoid faults from wider unaligned
loads on memory with strict access requirements.

Add parser coverage for both 32-bit and 64-bit HiiDB payloads.

Signed-off-by: Dishendra Deshmukh <dishendra.deshmukh@arm.com>
@dishendradeshmukh1986

Copy link
Copy Markdown
Author

Validated on board with HiiDB exported above 4GB:

  • cargo test --lib
  • cargo build --release
  • uefisettings hii show-ifr
  • uefisettings hii list-strings
  • uefisettings hii list-questions

@xaionaro

Copy link
Copy Markdown
Member

Did you have an opportunity to verify it haven't regressed for 32-bit HiiDB?

@dishendradeshmukh1986

Copy link
Copy Markdown
Author

The change is backward-compatible by design. It dispatches based on
the efivarfs HiiDB record size:

  • 12 bytes: legacy format, attrs:u32 + length:u32 + address:u32
  • 16 bytes: extended format, attrs:u32 + length:u32 + address:u64

I verified this with a standalone parser test using synthetic HiiDB records. The
legacy 12-byte record parsed correctly as length=0x1234 and address=0x80000000.
The 16-byte record parsed correctly as length=0x1234 and
address=0x2107ffa0018. Invalid record sizes are rejected.

I also checked stock AArch64 AAVMF and x86_64 OVMF under QEMU. Both booted in
UEFI mode, but neither firmware exposed the HiiDB efivar, so they cannot be used
for an end-to-end HiiDB regression test without adding a HiiDB export driver or
using platform firmware that already publishes legacy 12-byte HiiDB.

Based on the parser-level validation, the 64-bit support does not regress the
legacy 32-bit HiiDB parsing path.

@xaionaro

Copy link
Copy Markdown
Member

The change is backward-compatible by design.

I get the intention. I just want to be extra safe.

I also checked stock AArch64 AAVMF and x86_64 OVMF under QEMU. Both booted in
UEFI mode, but neither firmware exposed the HiiDB efivar, so they cannot be used
for an end-to-end HiiDB regression test without adding a HiiDB export driver or
using platform firmware that already publishes legacy 12-byte HiiDB.

I see. Thanks. I'll recheck on another computer where it should work.

@xaionaro

Copy link
Copy Markdown
Member

OK, I confirmed on a real server with 32bit HiiDB: list-questions and set work exactly as before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants