Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UEFI] Unable to get RSDP for ACPI v2 in some cases #172

Closed
gifnksm opened this issue May 22, 2021 · 7 comments · Fixed by #174
Closed

[UEFI] Unable to get RSDP for ACPI v2 in some cases #172

gifnksm opened this issue May 22, 2021 · 7 comments · Fixed by #174

Comments

@gifnksm
Copy link

gifnksm commented May 22, 2021

The value stored in BootInfo::rsdp_addr is the first one found in the RSDP of ACPI v1 and ACPI v2 (source code).

In my environment (QEMU), the RSDP for ACPI v1 is always stored.
Is it possible to implement a way to specify the ACPI version in the RSDP passed to the kernel?

Alternatively, there may be a way to pass the system_table to the kernel so that the kernel can use the UEFI runtime features.

@gifnksm gifnksm changed the title ]Unable to get RSDP for ACPI v2 in some cases [UEFI] Unable to get RSDP for ACPI v2 in some cases May 22, 2021
@bjorn3
Copy link
Contributor

bjorn3 commented May 22, 2021

According to https://stackoverflow.com/questions/60137506/qemu-support-for-acpi-2-0 the SeaBIOS version used by qemu may be too old.

@gifnksm
Copy link
Author

gifnksm commented May 22, 2021

I don't think it's a QEMU problem, because I was able to correctly access ACPI2 RSDP with the patched bootloder.

https://github.com/gifnksm/bootloader/commit/45b01fdefee9698ec412291904e19abe91d11c04

@phil-opp
Copy link
Member

phil-opp commented May 22, 2021

On UEFI systems we could search for the ACPI v2 RSDP first and only look for a v1 RSDP if no v2 RSDP is found. The question is what we want to do on BIOS systems. Right now, we do an RSDP search in common memoy regions that returns the first RSDP tag found. Maybe it makes sense to make the search function an Iterator instead or at least accept a start offset. Then we could prioritize the v2 RSDP there too.

Edit: I opened rust-osdev/acpi#92 to discuss the BIOS RSDP search changes.

@IsaacWoods
Copy link
Member

Aside from the discussion in rust-osdev/acpi#92, I had another look at the ACPI spec and it does offer some guidance on the correct thing for us to do on UEFI:

The OS loader for an ACPI-compatible OS will search for an RSDP structure pointer (RSDP Structure) using the current revision GUID first and if it finds one, will use the corresponding RSDP structure pointer. If the GUID is not found then the OS loader will search for the RSDP structure pointer using the ACPI 1.0 version GUID.
The OS loader must retrieve the pointer to the RSDP structure from the EFI System Table before assuming platform control via the EFI ExitBootServices interface. See the UEFI Specification for more information.

There's nothing similar in the BIOS section, so I think the current approach, which only expects there to be a single RSDP in the relevant areas, is correct.

@phil-opp
Copy link
Member

phil-opp commented May 24, 2021

Thanks a lot for looking into this! Seems like updating the UEFI code is a good starting point. I'll look into it. Edit: I opened #174 for this.

@gifnksm Could you try whether the BIOS implementation already gives you the right RSDP?

@gifnksm
Copy link
Author

gifnksm commented May 24, 2021

@phil-opp The BIOS implementation gives RSDP for ACPI v1.
I think this is the intended behavior because QEMU's SeaBIOS is too old to support ACPI v2 (according to @bjorn3).

@phil-opp
Copy link
Member

Thanks for checking! Looks like we need to try it on real hardware then. I'm also fine with leaving the BIOS implementation as it is for now until someone encounters an issue with it.

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 a pull request may close this issue.

4 participants