finix/kernel/include/arch/i686/acpi.h
2023-07-17 19:34:52 -04:00

106 lines
2.7 KiB
C

#pragma once
#include <stdint.h>
struct RootSystemDescriptionPointer {
char signature[8];
uint8_t checksum;
char oemid[6];
uint8_t revision;
uint32_t rsdt_address;
};
struct SystemDescriptionTableHeader {
char signature[4];
uint32_t length;
uint8_t revision;
uint8_t checksum;
char oem_id[6];
char oem_table_id[8];
uint32_t oem_revision;
uint32_t creator_id;
uint32_t creator_revision;
};
struct RootSystemDescriptionTable {
struct SystemDescriptionTableHeader header;
uint32_t sdt_table[];
};
struct GenericAddressStructure {
uint8_t address_space;
uint8_t bit_width;
uint8_t bit_offset;
uint8_t access_size;
uint64_t address;
};
struct FixedACPIDescriptionTable {
struct SystemDescriptionTableHeader header;
uint32_t firmware_ctrl;
uint32_t dsdt;
// field used in ACPI 1.0; no longer in use, for compatibility only
uint8_t reserved;
uint8_t preferred_power_management_profile;
uint16_t sci_interrupt;
uint32_t smi_command_port;
uint8_t acpi_enable;
uint8_t acpi_disable;
uint8_t s4bios_req;
uint8_t pstate_control;
uint32_t pm1_a_event_block;
uint32_t pm1_b_event_block;
uint32_t pm1_a_control_block;
uint32_t pm1_b_control_block;
uint32_t pm2_control_block;
uint32_t pm_timer_block;
uint32_t gpe0_block;
uint32_t gpe1_block;
uint8_t pm1_event_length;
uint8_t pm1_control_length;
uint8_t pm2_control_length;
uint8_t pm_timer_length;
uint8_t gpe0_length;
uint8_t gpe1_length;
uint8_t gpe1_base;
uint8_t cstate_control;
uint16_t worst_c2_latency;
uint16_t worst_c3_latency;
uint16_t flush_size;
uint16_t flush_stride;
uint8_t duty_offset;
uint8_t duty_width;
uint8_t day_alarm;
uint8_t month_alarm;
uint8_t century;
// reserved in ACPI 1.0; used since ACPI 2.0+
uint16_t boot_architecture_flags;
uint8_t reserved_2;
uint32_t flags;
// 12 byte structure; see below for details
struct GenericAddressStructure reset_reg;
uint8_t reset_value;
uint8_t reserved_3[3];
// 64bit pointers - Available on ACPI 2.0+
uint64_t x_firmware_control;
uint64_t x_dsdt;
struct GenericAddressStructure x_pm1_a_event_block;
struct GenericAddressStructure x_pm1_b_event_block;
struct GenericAddressStructure x_pm1_a_control_block;
struct GenericAddressStructure x_pm1_b_control_block;
struct GenericAddressStructure x_pm2_control_block;
struct GenericAddressStructure x_pm_timer_block;
struct GenericAddressStructure x_gpe0_block;
struct GenericAddressStructure x_gpe1_block;
};
void acpi_init(void *rsdp);
void acpi_poweroff(void);