123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- #pragma once
- #include <common/glib.h>
- #include <mm/mm.h>
- #define ACPI_ICS_TYPE_PROCESSOR_LOCAL_APIC 0
- #define ACPI_ICS_TYPE_IO_APIC 1
- #define ACPI_ICS_TYPE_INTERRUPT_SOURCE_OVERRIDE 2
- #define ACPI_ICS_TYPE_NMI_SOURCE 3
- #define ACPI_ICS_TYPE_LOCAL_APIC_NMI 4
- #define ACPI_ICS_TYPE_LOCAL_APIC_ADDRESS_OVERRIDE 5
- #define ACPI_ICS_TYPE_IO_SAPIC 6
- #define ACPI_ICS_TYPE_LOCAL_SAPIC 7
- #define ACPI_ICS_TYPE_PLATFORM_INTERRUPT_SOURCES 8
- #define ACPI_ICS_TYPE_PROCESSOR_LOCAL_x2APIC 9
- #define ACPI_ICS_TYPE_PROCESSOR_LOCAL_x2APIC_NMI 0xA
- #define ACPI_ICS_TYPE_PROCESSOR_GICC 0xB
- #define ACPI_ICS_TYPE_PROCESSOR_GICD 0xC
- #define ACPI_ICS_TYPE_PROCESSOR_GIC_MSI_Frame 0xD
- #define ACPI_ICS_TYPE_PROCESSOR_GICR 0xE
- #define ACPI_ICS_TYPE_PROCESSOR_GIC_ITS 0xF
- #define ACPI_RSDT_VIRT_ADDR_BASE SPECIAL_MEMOEY_MAPPING_VIRT_ADDR_BASE + ACPI_RSDT_MAPPING_OFFSET
- #define ACPI_XSDT_VIRT_ADDR_BASE SPECIAL_MEMOEY_MAPPING_VIRT_ADDR_BASE + ACPI_XSDT_MAPPING_OFFSET
- #define ACPI_DESCRIPTION_HEDERS_BASE ACPI_RSDT_VIRT_ADDR_BASE + (PAGE_2M_SIZE)
- #define ACPI_XSDT_DESCRIPTION_HEDERS_BASE ACPI_XSDT_VIRT_ADDR_BASE + (PAGE_2M_SIZE)
- bool acpi_use_xsdt = false;
- struct acpi_RSDP_t
- {
- unsigned char Signature[8];
- unsigned char Checksum;
- unsigned char OEMID[6];
- unsigned char Revision;
-
- uint RsdtAddress;
- } __attribute__((packed));
- struct acpi_RSDP_2_t
- {
- struct acpi_RSDP_t rsdp1;
-
-
- uint Length;
-
- ul XsdtAddress;
- unsigned char ExtendedChecksum;
- unsigned char Reserved[3];
- } __attribute__((packed));
- struct acpi_system_description_table_header_t
- {
-
- unsigned char Signature[4];
-
- uint Length;
-
- unsigned char Revision;
-
- char Checksum;
- unsigned char OEMID[6];
- unsigned char OEM_Table_ID[8];
- uint OEMRevision;
- uint CreatorID;
- uint CreatorRevision;
- } __attribute__((packed));
- struct acpi_HPET_description_table_t
- {
- struct acpi_system_description_table_header_t header;
- uint8_t hardware_rev_id;
- uint8_t comparator_count : 5;
- uint8_t counter_size : 1;
- uint8_t reserved0 : 1;
- uint8_t legacy_replacement : 1;
- uint16_t pci_vendor_id;
- uint8_t address_space_id;
- uint8_t register_bit_width;
- uint8_t register_bit_offset;
- uint8_t reserved1;
- uint64_t address;
- uint8_t hpet_number;
- uint16_t minimum_tick;
- uint8_t page_protection;
- } __attribute__((packed));
- struct acpi_Multiple_APIC_Description_Table_t
- {
- struct acpi_system_description_table_header_t header;
-
- uint Local_Interrupt_Controller_Address;
-
- uint flags;
-
- };
- struct apic_Interrupt_Controller_Structure_header_t
- {
- unsigned char type;
- unsigned char length;
- };
- struct acpi_Processor_Local_APIC_Structure_t
- {
-
- struct apic_Interrupt_Controller_Structure_header_t header;
- unsigned char ACPI_Processor_UID;
-
- unsigned char local_apic_id;
-
- uint flags;
- };
- struct acpi_IO_APIC_Structure_t
- {
-
- struct apic_Interrupt_Controller_Structure_header_t header;
- unsigned char IO_APIC_ID;
- unsigned char Reserved;
-
- uint IO_APIC_Address;
-
-
- uint Global_System_Interrupt_Base;
- };
- struct acpi_RSDT_Structure_t
- {
-
-
- struct acpi_system_description_table_header_t header;
-
- uint Entry;
- };
- struct acpi_XSDT_Structure_t
- {
-
-
- struct acpi_system_description_table_header_t header;
-
- ul Entry;
- };
- void acpi_iter_SDT(bool (*_fun)(const struct acpi_system_description_table_header_t *, void *),
- void *_data);
- bool acpi_get_MADT(const struct acpi_system_description_table_header_t *_iter_data, void *_data);
- bool acpi_get_HPET(const struct acpi_system_description_table_header_t *_iter_data, void *_data);
- void acpi_init();
|