FADT

From OSDev Wiki
Revision as of 18:06, 10 March 2011 by Alfaomega08 (talk | contribs) (Fixed the "table")
Jump to navigation Jump to search

FADT (Fixed ACPI Description Table) is a data structure used in the ACPI programming interface. This table contains information about fixed register blocks pertaining to power management.

Finding the FADT

The FADT is pointed to by an entry in the RSDT. The signature is 'FACP'. Even if the pointer was found in another ACPI valid structure, you should anyway do the checksum to check that the table is valid.

Structure

The FADT is a complex structure and contains a lot of data. Here it is:

structFADT{
structACPISDTHeaderh;
uint32_tFirmwareCtrl;
uint32_tDsdt;
uint8_tReserved;// Was used in ACPI 1.0. Today is not used anymore. Some bioses still use it for compatibility with old os. for more info see the ACPI specification 1.0
uint8_tPreferredPowerManagementProfile;
uint16_tSCI_Interrupt;
uint32_tSMI_CommandPort;
uint8_tAcpiEnable;
uint8_tAcpiDisable;
uint8_tS4BIOS_REQ;
uint8_tPSTATE_Control;
uint32_tPM1aEventBlock;
uint32_tPM1bEventBlock;
uint32_tPM1aControlBlock;
uint32_tPM1bControlBlock;
uint32_tPM2ControlBlock;
uint32_tPMTimerBlock;
uint32_tGPE0Block;
uint32_tGPE1Block;
uint8_tPM1EventLength;
uint8_tPM1ControlLength;
uint8_tPM2ControlLength;
uint8_tPMTimerLength;
uint8_tGPE0Length;
uint8_tGPE1Length;
uint8_tGPE1Base;
uint8_tCStateControl;
uint16_tWorstC2Latency;
uint16_tWorstC3Latency;
uint16_tFlushSize;
uint16_tFlushStride;
uint8_tDutyOffset;
uint8_tDutyWidth;
uint8_tDayAlarm;
uint8_tMonthAlarm;
uint8_tCentury;
uint16_tBootArchitectureFlags;// Since ACPI 2.0+. Reserved on ACPI 1.0
uint8_tReserved2;
uint32_tFlags;
GenericAddressStructureResetReg;// For details see below. Just know that GenericAddressStructure is made of 12 bytes
uint8_tResetValue;
uint8_tReserved3[3];

// 64bit pointers - Available on ACPI 2.0+
uint64_tX_FirmwareControl;
uint64_tX_Dsdt;
GenericAddressStructureX_PM1aEventBlock;
GenericAddressStructureX_PM1bEventBlock;
GenericAddressStructureX_PM1aControlBlock;
GenericAddressStructureX_PM1bControlBlock;
GenericAddressStructureX_PM2ControlBlock;
GenericAddressStructureX_PMTimerBlock;
GenericAddressStructureX_GPE0Block;
GenericAddressStructureX_GPE1Block;
};

GenericAddressStructure

Before going to far, keep in mind that the GAS is a structure used by ACPI to describe the position of registers. Its structure is:

structGenericAddressStructure
{
uint8_tAddressSpace;
uint8_tBitWidth;
uint8_tBitOffset;
uint8_tAccessSize;
uint64_tAddress;
};

AddressSpace can be one of the following:

  • 0 System Memory
  • 1 System I/O
  • 2 PCI Configuration Space
  • 3 Embedded Controller
  • 4 SMBus
  • 5 to 0x7E Reserved
  • 0x7F Functional Fixed Hardware
  • 0x80 to 0xBF Reserved
  • 0xC0 to 0xFF OEM Defined

BitWidth and BitOffset are required only when accessing a bit field.

AccessSize defines how many bytes at once you can read/write and it must be one of the following:

  • 0 Undefined (legacy reasons)
  • 1 Byte access
  • 2 16-bit Word access
  • 3 32-bit Doubleword access
  • 4 64-bit Quadword access

Address is a 64bit pointer in the defined address space to the data structure.

Fields

FirmwareCtrl

This is a 32-bit pointer to the FACS. Since ACPI 2.0 a new field has been added to the table, X_FirmwareControl of type GAS, which is 64-bit wide. Only one of the two fields is used, the other contains 0. According to the Specs, the X_ field is used only when the FACS is placed above the 4th Gb.

Dsdt

A 32-bit pointer to the DSDT. This has a X_Dsdt brother too.

PreferredPowerManagementProfile

This field contains a value which should address you to a power management profile. For example if it contains 2, the computer is a laptop and you should configure power management in power saving mode. The possible values are:

  • 0 Unspecified
  • 1 Desktop
  • 2 Mobile
  • 3 Workstation
  • 4 Enterprise Server
  • 5 SOHO Server
  • 6 Appliance PC
  • 7 Performance Server
  • >7 Reserved

SCI_Interrupt

The SCI IRQ number when working using the 8259 PIC. The System Control Interrupt is used from the ACPI hardware to notify the OS of particular events, such as the user pressing of the power button.

SMI_CommandPort

This is an I/O Port. This is where the OS writes AcpiEnable or AcpiDisable to get or release the ownership over the ACPI registers. This is 0 on systems where the System Management Mode is not supported.

What's next?

You should preserve the pointer to the FACS (in FirmwareControl (if < 4gb) or in X_FirmwareControl (if >= 4gb)). Then you should parse the DSDT.

Retrieved from "https://wiki.osdev.org/index.php?title=FADT&oldid=11246"