#include <stdint.h>
#include <libc.h>

struct rsdp_v1 {
  char sig[8];
  uint8_t checksum;
  char OEMID[6];
  uint8_t version;
  uint32_t rsdt_addr;

} __attribute__((packed));

struct rsdp_v2 {
  struct rsdp_v1 v1;
  uint32_t len;
  uint64_t xsdt_addr;
  uint8_t extended_checksum;
  uint8_t reserved[3]; 
} __attribute__((packed));


typedef union rsdp_t { 
  struct rsdp_v1 v1;
  struct rsdp_v2 v2;
} rsdp_t;

struct acpi_header {
  char sig[4];
  uint32_t length;
  uint8_t revision;
  uint8_t checksum;
  char OEMID[6];
  char OEMTableID[8];
  uint32_t OEMRevision;
  uint32_t creator_id;
  uint32_t creator_revision;
} __attribute__((packed));

rsdp_t *find_RSDP();
