Skip to content

Hiidb access from userspace not working #8

Open
@HarishCoder-Linux

Description

@HarishCoder-Linux

Hi all,

I'm working on accessing and modifying BIOS/UEFI settings (such as toggling hardware ports) from Linux userspace on an ARM-based system using the uefisettings tool. The goal is to interact with the HII (Human Interface Infrastructure) database that stores BIOS configuration menus.
Current Setup:

I'm using EDK2, and have customized the HiiDatabaseDxe driver to manually create an EFI variable named HiiDb-1b838190-4625-4ead-abc9-cd5e6af18fe0, following the format expected by uefisettings.

This variable contains:

    UEFI variable flags for boot/runtime access.

    The size of the HII database.

    The physical memory address where the HII database is located in /dev/mem.

Example:

$ hexdump -C /sys/firmware/efi/efivars/HiiDb-1b838190-4625-4ead-abc9-cd5e6af18fe0
00000000 06 00 00 00 18 0d 00 00 00 00 c9 ed |............|

I verified that /dev/mem at 0xEDC90000 (as pointed to in the variable) contains valid-looking IFR data and string content.

I also see other EFI variable files under /sys/firmware/efi/efivars/ for specific formsets, holding BIOS option values.

Problems I'm Facing:

uefisettings fails to parse the HII database, and commands like show-ifr, list-questions, list-strings, or even hii extract-db fail with:

Can't parse more package lists

I added debug logging inside uefisettings, and noticed:

    The seek operation on /dev/mem works correctly.

    But the subsequent read_exact fails to copy data into the expected buffer (it seems like a zero-length or incomplete read).

I'm not familiar with Rust, and I suspect this might be a memory allocation issue—possibly stack vs heap or incorrect buffer sizing.

What Works:

The HII database is clearly published and accessible in memory.

The format of the manually created HiiDb-* variable matches expectations.

I can read specific efivars corresponding to BIOS option values for particular formsets.

What I Need Help With:

Why is uefisettings unable to read the data correctly from /dev/mem despite a valid memory region and variable?

    Could this be due to Rust’s read_exact requiring specific buffer alignment or size?

    How can I debug or modify this behavior?

Are there any known limitations or required conditions (e.g., memory page alignment, permissions, architecture-specific quirks) for uefisettings ?

Is there a way to feed the extracted HII binary data into uefisettings directly, bypassing the need for /dev/mem access?

Any Rust-side fix or workaround suggestions to make the tool read the HII data correctly?

Any documentation or working examples  where others have successfully parsed and modified BIOS settings via uefisettings? 

I wanted to understand what I need to do exactly to make uefisettings work to modify options of Bios from userspace. Any documentation or guidence can really help me . I am breaking my head from last month to figure out why it fails .

Any guidance or suggestions would be deeply appreciated—especially on resolving the read_exact issue and getting uefisettings to recognize and work with the HII database correctly.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions