// This file is part of noxos and licensed under the MIT open source license

#ifndef NOX_ACPI_H
#define NOX_ACPI_H

#include "boot/boot_info.h"
#include "utils/string.h"

typedef struct {
    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;
} __attribute__((packed)) acpi_sdt_header_T;

typedef struct {
    uint8_t     address_space;
    uint8_t     bit_width;
    uint8_t     bit_offset;
    uint8_t     access_size;
    uint64_t    address;
} __attribute__((packed)) acpi_gas_T;

void                acpi_init          (boot_info_T* boot_info);
acpi_sdt_header_T*  acpi_find_table    (acpi_sdt_header_T* xsdt, string_t table_id);

#endif //NOX_ACPI_H