#pragma once

#include "common.h"

#define RSDP_SIGNATURE "RSDT PTR "

pstruct acpi_rsdp_header {
  u8 signature[8];
  u8 checksum;
  u8 OEMID[6];
  u8 revision;
  /*
  union {
    struct acpi_rsdt* rsdt :32;
    struct acpi_xsdt* xsdt :32;
  } ptr;
  */
  u32 ptr32;
  // v2
  u32 len;
  u64 ptr64;
  u8 extended_checksum;
  u8 resv[3];
};

struct acpi_rsdt {
  u8 signature[4];
  u32 len;
  u8 revision;
  u8 checksum;
  u8 OEMID[6];
  u8 OEM_table_id[8];
  u32 OEM_revision;
  u32 creator_id;
  u32 creator_revision;
  union {
    u32 addrs32[];
    u64 addrs64[];
  };
};

extern struct acpi_rsdp_header *rsdp;
