RSDP: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
No edit summary
No edit summary
Line 1: Line 1:
RSDP (Root System Description Pointer) is a data structure used in the [[ACPI]] programming interface. It is set out like this (for ACPI Version 1.0):
'''RSDP''' (Root System Description Pointer) is a data structure used in the [[ACPI]] programming interface.


In ACPI Version 1.0 it has this structure:
struct RSDPDescriptor

{
struct RSDPDescriptor {
char signature[8];
char Signature[8];
BYTE checkSum;
char oemID[6];
BYTE Checksum;
BYTE revision;
char OEMID[6];
BYTE Revision;
DWORD rsdtAddress;
DWORD RsdtAddress;
}
}


since Version 2.0 it has been modified, and new fields have been added:
and for version 2.0:


struct RSDPDescriptor20
struct RSDPDescriptor20 {
char Signature[8];
{
BYTE Checksum;
char signature[8];
BYTE checkSum;
char OEMID[6];
char oemID[6];
BYTE Revision;
DWORD RsdtAddress;
BYTE revision;
DWORD rsdtAddress;
DWORD length;
DWORD Length;
QWORD xsdtAddress;
QWORD XsdtAddress;
BYTE extCheckSum;
BYTE ExtendedChecksum;
BYTE reserved[3];
BYTE reserved[3];
};
};
Line 28: Line 28:
==Detecting the RSDP==
==Detecting the RSDP==


The RSDP is either located within the first 1 KB of the [[EBDA]] (Extended BIOS Data Area) (a 2 byte real mode segment pointer to it is located at 0x040E), or in the memory region from 0x000E0000 to 0x000FFFFF (the main BIOS area below 1 MB). The signature (for both tables) should be "RSD PTR " (note: this ends with a space character that should not be overlooked), which is useful when scanning for the structure in memory. The step of the memory scan should be 16 (i.e. the RSDP always begins on a 16 byte boundary).
The RSDP is either located within the first 1 KB of the [[EBDA]] (Extended BIOS Data Area) (a 2 byte real mode segment pointer to it is located at 0x040E), or in the memory region from 0x000E0000 to 0x000FFFFF (the main [[BIOS]] area below 1 MB). To find the table, the Operating System has to find the "RSD PTR " string (notice the last space character) in one of the two areas. This signature is always on a 16 byte boundary.


==Validating the RSDP==
==Validating the RSDP==


Once you find the RSDP Table you have to see what version of ACPI is the BIOS using, then you have to check that the checksum is valid.
{{In Progress}}


===Detecting ACPI Version===
If the RSDP revision field is zero, it is ACPI version 1.0 and the first structure should be used, otherwise it is the second structure that should be used, as that has data about the [[XSDT]], an extended [[RSDT]].
The ACPI Version can be detected using the Revision field in the RSDP. If this field contains 0, then ACPI Version 1.0 is used. 1 stands for ACPI Version 2.0, 2 for ACPI Version 3.0, and so on...


<!--
Brendan... forgive me. Someone should write an article on RSDT an move this piece there...
The ACPI standards state that an OS that complies with ACPI version 2.0 or later should use the XSDT instead of the RSDT, however I personally doubt that there is a difference on 80x86 computers. AFAIK the XSDT itself was introduced for Itanium's (IA64) and other 64 bit computers where it's likely that the BIOS (and ACPI tables) are above 4 GB. On 80x86 it's likely that the RSDT and the XSDT both point to the same tables below 4 GB for compatibility reasons (it doesn't make sense to have 2 versions of the same tables) -- Brendan.
The ACPI standards state that an OS that complies with ACPI version 2.0 or later should use the XSDT instead of the RSDT, however I personally doubt that there is a difference on 80x86 computers. AFAIK the XSDT itself was introduced for Itanium's (IA64) and other 64 bit computers where it's likely that the BIOS (and ACPI tables) are above 4 GB. On 80x86 it's likely that the RSDT and the XSDT both point to the same tables below 4 GB for compatibility reasons (it doesn't make sense to have 2 versions of the same tables) -- Brendan.
-->
===Checksum validation===
Before the RSDP is relied upon you should check that the checksum is valid.
For ACPI 1.0 (the first structure) you add up every byte in the structure and make sure the lowest byte of the result is equal to zero. For ACPI 2.0 and later you'd do exactly the same thing for the original (ACPI 1.0) part of the second structure, and then do it again for the fields that are part of the ACPI 2.0 extension.


==Explaining the fields==
Before the RSDP is relied upon you should check that the checksum is valid. For ACPI 1.0 (the first structure) you add up every byte in the structure and make sure the lowest byte of the result is equal to zero. For ACPI 2.0 and later you'd do exactly the same thing for the original (ACPI 1.0) part of the second structure, and then do it again for the fields that are part of the ACPI 2.0 extension.
===Signature===

This 8-byte string (not null terminated!) must contain "RSD PTR ". It stands on a 16-byte boundary.
TODO: Needs more formatting and explaining
===Checksum===
The value to add to all the other bytes (of the Version 1.0 table) to calculate the Checksum of the table. If this value added to all the others and casted to byte isn't equal to 0, the table must be ignored.
===OEMID===
The specification says: "An OEM-supplied string that identifies the OEM"
===Revision===
The revision of the ACPI. Larger revision numbers are backward compatible to lower revision numbers. See [[#Detecting ACPI Version|Detecting ACPI Version]] for further information.
===Rsdt Address===
32-bit physical (I repeat: physical) address of the [[RSDT]] table.
===Length===
The size of the entire table since offset 0 to the end. This field has been added in Version 2.0
===Xsdt Address===
64-bit physical address of the [[XSDT]] table. If you detect ACPI Version 2.0 you should use this table instead of RSDT even on x86, casting the address to DWORD. This field has been added in Version 2.0
===Extended Checksum===
This field is used to calculate the checksum of the entire table, including both checksum fields
===Reserved===
3 bytes to be ignored in reading and that must not be written


[[Category:Power management]]
[[Category:Power management]]

Revision as of 15:55, 22 December 2008

RSDP (Root System Description Pointer) is a data structure used in the ACPI programming interface.

In ACPI Version 1.0 it has this structure:

struct RSDPDescriptor {
 char Signature[8];
 BYTE Checksum;
 char OEMID[6];
 BYTE Revision;
 DWORD RsdtAddress;
}

since Version 2.0 it has been modified, and new fields have been added:

struct RSDPDescriptor20 {
 char Signature[8];
 BYTE Checksum;
 char OEMID[6];
 BYTE Revision;
 DWORD RsdtAddress;

 DWORD Length;
 QWORD XsdtAddress;
 BYTE ExtendedChecksum;
 BYTE reserved[3];
};

Detecting the RSDP

The RSDP is either located within the first 1 KB of the EBDA (Extended BIOS Data Area) (a 2 byte real mode segment pointer to it is located at 0x040E), or in the memory region from 0x000E0000 to 0x000FFFFF (the main BIOS area below 1 MB). To find the table, the Operating System has to find the "RSD PTR " string (notice the last space character) in one of the two areas. This signature is always on a 16 byte boundary.

Validating the RSDP

Once you find the RSDP Table you have to see what version of ACPI is the BIOS using, then you have to check that the checksum is valid.

Detecting ACPI Version

The ACPI Version can be detected using the Revision field in the RSDP. If this field contains 0, then ACPI Version 1.0 is used. 1 stands for ACPI Version 2.0, 2 for ACPI Version 3.0, and so on...

Checksum validation

Before the RSDP is relied upon you should check that the checksum is valid. For ACPI 1.0 (the first structure) you add up every byte in the structure and make sure the lowest byte of the result is equal to zero. For ACPI 2.0 and later you'd do exactly the same thing for the original (ACPI 1.0) part of the second structure, and then do it again for the fields that are part of the ACPI 2.0 extension.

Explaining the fields

Signature

This 8-byte string (not null terminated!) must contain "RSD PTR ". It stands on a 16-byte boundary.

Checksum

The value to add to all the other bytes (of the Version 1.0 table) to calculate the Checksum of the table. If this value added to all the others and casted to byte isn't equal to 0, the table must be ignored.

OEMID

The specification says: "An OEM-supplied string that identifies the OEM"

Revision

The revision of the ACPI. Larger revision numbers are backward compatible to lower revision numbers. See Detecting ACPI Version for further information.

Rsdt Address

32-bit physical (I repeat: physical) address of the RSDT table.

Length

The size of the entire table since offset 0 to the end. This field has been added in Version 2.0

Xsdt Address

64-bit physical address of the XSDT table. If you detect ACPI Version 2.0 you should use this table instead of RSDT even on x86, casting the address to DWORD. This field has been added in Version 2.0

Extended Checksum

This field is used to calculate the checksum of the entire table, including both checksum fields

Reserved

3 bytes to be ignored in reading and that must not be written