OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 1:24 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Why can't I find the RSDP if I boot on my real UEFI-PC?
PostPosted: Mon Jan 21, 2019 11:24 am 
Offline

Joined: Wed Jul 27, 2016 5:37 am
Posts: 9
Hi, after startup in real mode, I search the memory area between 0x9FC00 and 0xFFFFF for the string "RSD PTR " to find the RSDP. On Qemu, this works perfectly. On my real UEFI PC, however, this does not work and my OS prints the message that the RSDP could not be found. This happens even if I turn on "legacy mode" instead of "UEFI mode" in my UEFI menu. (for completeness: the OS would also print this if it had found more than one "RSD PTR " in that memory area on a 16 bytes boundary)

The article https://wiki.osdev.org/RSDP says that the RSDP must be looked for differently on UEFI systems and I must look into the EFI_SYSTEM_TABLE. I read the article about the UEFI, but I am still very new to this thing. :? It seems that the system table is a parameter to my main function which comes from a PE file on my boot partition. But I have no boot partition, I have just normal bootstrap code on my MBR and a few sectors behind without a proper filesystem, and although it is an UEFI PC, the MBR code is loaded as if I had a normal BIOS.

Maybe you can tell me what I missed and where to start reading about this stuff to get into it properly? A direct explanation would also be very great. Thank you for your help!


Top
 Profile  
 
 Post subject: Re: Why can't I find the RSDP if I boot on my real UEFI-PC?
PostPosted: Mon Jan 21, 2019 11:52 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
Kolodez wrote:
0x9FC00

How did you come up with this value? The EBDA does not start at a fixed address. If the start address is lower, you might be completely missing the RSDP.

Kolodez wrote:
(for completeness: the OS would also print this if it had found more than one "RSD PTR " in that memory area on a 16 bytes boundary)

Are you also validating the checksum? It's possible there is more than one "RSD PTR " in memory, but only one has a valid checksum.

Kolodez wrote:
although it is an UEFI PC, the MBR code is loaded as if I had a normal BIOS.

This means you're using the legacy CSM and you can ignore most UEFI-specific information.


Top
 Profile  
 
 Post subject: Re: Why can't I find the RSDP if I boot on my real UEFI-PC?
PostPosted: Mon Jan 21, 2019 12:25 pm 
Offline

Joined: Wed Jul 27, 2016 5:37 am
Posts: 9
Quote:
How did you come up with this value?


https://wiki.osdev.org/Memory_Map_(x86)#Overview says that the area until 0x9FBFF is "free for use". So I deduced that the EBDA starts at this address or even later.

Quote:
Are you also validating the checksum?


Yes, sorry, I forgot to mention that my function checks whether the signature and the checksum (or both checksums, for version 2+) are valid. Only if this is true, it is reported that an RSDP is found. The function returns success only if it "found" exactly one RSDP in that area.


Top
 Profile  
 
 Post subject: Re: Why can't I find the RSDP if I boot on my real UEFI-PC?
PostPosted: Mon Jan 21, 2019 12:44 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
Kolodez wrote:
https://wiki.osdev.org/Memory_Map_(x86)#Overview says that the area until 0x9FBFF is "free for use". So I deduced that the EBDA starts at this address or even later.

It also says "typical location". The EBDA can start at a lower address, and I've seen a few computers where it does.


Top
 Profile  
 
 Post subject: Re: Why can't I find the RSDP if I boot on my real UEFI-PC?
PostPosted: Mon Jan 21, 2019 1:42 pm 
Offline

Joined: Wed Jul 27, 2016 5:37 am
Posts: 9
You are right, sorry. Since it says

Quote:
the EBDA is a variable-sized memory area (on different BIOSes). If it exists, it is always immediately below 0xA0000 in memory. It is absolutely guaranteed to be less than 128 KiB in size


I thought that the address 0x9FC00 is already the lowest possible address because the area before it is marked as "free for use". But now I calculated it and the result is that the EBDA starts at address 0x80000 or later.

Now I found the RSDP, so thank you for your help. 8)


Top
 Profile  
 
 Post subject: Re: Why can't I find the RSDP if I boot on my real UEFI-PC?
PostPosted: Mon Jan 21, 2019 8:03 pm 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
Hi,

I don't think searching for EBDA on an UEFI machine is a good idea.

Maybe it works on your computer, but there's no guarantee at all. You should use the EFI_ACPI_TABLE_PROTOCOL.
Read https://www.uefi.org/sites/default/files/resources/UEFI%20Spec%202_6.pdf (appendix O).
See also: https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h

With GNU EFI, you can do:
Code:
LibGetSystemConfigurationTable(&AcpiTableGuid, (void *)&acpi_ptr);

Cheers,
bzt


Top
 Profile  
 
 Post subject: Re: Why can't I find the RSDP if I boot on my real UEFI-PC?
PostPosted: Tue Jan 22, 2019 12:48 am 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
He's not using UEFI, he is using the CSM which is the BIOS compatibility module.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: Why can't I find the RSDP if I boot on my real UEFI-PC?
PostPosted: Tue Jan 22, 2019 11:49 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
kzinti wrote:
He's not using UEFI, he is using the CSM which is the BIOS compatibility module.
Yes, you're correct, but I think he should. I've answered the OP's original question, which was "Why can't I find the RSDP if I boot on my real UEFI-PC?" The proper answer to that question is, on a real UEFI-PC, the RSDP should be queried using UEFI, and not looked up in the EBDA ;-)

Cheers,
bzt

ps: I'm not sure for how long CSM will be supported, imho we should not rely on it. Maybe it would take years to disappear, but it will be gone eventually, sooner than later. Now considering that OS developement can take years easily, chances are good that by the time his OS reaches a somewhat usable state, those legacy machines will be long gone. I know many forum users here are collecting old machines and use them as testbeds, but that's not so common, therefore I don't think it worth relying on old hardware.


Top
 Profile  
 
 Post subject: Re: Why can't I find the RSDP if I boot on my real UEFI-PC?
PostPosted: Tue Jan 22, 2019 1:16 pm 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 1593
bzt wrote:
ps: I'm not sure for how long CSM will be supported, imho we should not rely on it. Maybe it would take years to disappear, but it will be gone eventually, sooner than later.


FWIW, my 2015 gaming PC still had CSM support. My 2019 gaming PC doesn't anymore.

_________________
Carpe diem!


Top
 Profile  
 
 Post subject: Re: Why can't I find the RSDP if I boot on my real UEFI-PC?
PostPosted: Sat Jan 26, 2019 8:39 am 
Offline
Member
Member

Joined: Thu Feb 09, 2012 6:53 am
Posts: 67
Location: Czechoslovakia
Finding RSDP is well documented in ACPI specification
http://www.uefi.org/specifications
download the ACPI specification Version 6.2 (Errata A) or newer when available in the feature
5.2.5.1 Finding the RSDP on IA-PC Systems
5.2.5.2 Finding the RSDP on UEFI Enabled Systems

_________________
hypervisor-based solutions developer (Intel, AMD)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: 8infy, Google [Bot] and 73 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group