1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(DATA61_BSD)
11 */
12
13#pragma once
14
15/*
16 * Table signitures
17 */
18#define ACPI_SIG_RSDP           "RSD PTR "  /* Root System Descriptor table Pointer */
19
20#define ACPI_SIG_RSDT           "RSDT"      /* Root System Descriptor Table */
21#define ACPI_SIG_XSDT           "XSDT"      /* eXtended System Descriptor Table */
22#define ACPI_SIG_BERT           "BERT"      /* Boot Error Record Table */
23#define ACPI_SIG_CPEP           "CPEP"      /* Corrected Platform Error Polling table */
24#define ACPI_SIG_ECDT           "ECDT"      /* Embedded Controller Boot Resources Table */
25#define ACPI_SIG_EINJ           "EINJ"      /* Error Injection table */
26#define ACPI_SIG_ERST           "ERST"      /* Error Record Serialization Table */
27#define ACPI_SIG_MADT           "APIC"      /* Multiple APIC Description Table */
28#define ACPI_SIG_MSCT           "MSCT"      /* Maximum System Characteristics Table */
29#define ACPI_SIG_SBST           "SBST"      /* Smart Battery Specification Table */
30#define ACPI_SIG_SLIT           "SLIT"      /* System Locality Distance Information Table */
31#define ACPI_SIG_SRAT           "SRAT"      /* System Resource Affinity Table */
32#define ACPI_SIG_FADT           "FACP"      /* Fixed ACPI Description Table */
33#define ACPI_SIG_FACS           "FACS"      /* Firmware ACPI Control Structure */
34#define ACPI_SIG_DSDT           "DSDT"      /* Differentiated System Description Table */
35#define ACPI_SIG_SSDT           "SSDT"      /* Secondary System Description Table */
36#define ACPI_SIG_SPMI           "SPMI"      /* Server Platform Management Interface table */
37#define ACPI_SIG_HPET           "HPET"      /* High Precision Event Timer */
38#define ACPI_SIG_BOOT           "BOOT"      /* BOOT flags table structure */
39#define ACPI_SIG_SPCR           "SPCR"      /* Serial Port Console Redirection */
40#define ACPI_SIG_DMAR           "DMAR"      /* DMA remapping table */
41#define ACPI_SIG_ASF            "ASF!"      /* Alert Standard Format table */
42#define ACPI_SIG_HEST           "HEST"      /* Hardware Error Source Table */
43#define ACPI_SIG_MCFG           "MCFG"      /* PCI Memory mapped ConFiGuration */
44
45#define ACPI_SIG_ASPT           "ASPT"      /* Unknown table? */
46
47#define ACPI_TABLE_TEST(addr, TABLE) \
48        (strncmp(addr, ACPI_SIG_##TABLE, 4)==0)
49
50typedef enum {
51    ACPI_RSDP,
52    ACPI_RSDT,
53    ACPI_XSDT,
54    ACPI_BERT,
55    ACPI_CPEP,
56    ACPI_ECDT,
57    ACPI_EINJ,
58    ACPI_ERST,
59    ACPI_MADT,
60    ACPI_MSCT,
61    ACPI_SBST,
62    ACPI_SLIT,
63    ACPI_SRAT,
64    ACPI_FADT,
65    ACPI_FACS,
66    ACPI_DSDT,
67    ACPI_SSDT,
68    ACPI_SPMI,
69    ACPI_HPET,
70    ACPI_BOOT,
71    ACPI_SPCR,
72    ACPI_DMAR,
73    ACPI_ASF ,
74    ACPI_HEST,
75    ACPI_MCFG,
76    ACPI_ASPT,
77    /* This must come directly after valid types */
78    ACPI_NTYPES,
79    /* These are special and must come last */
80    ACPI_UNKNOWN_TYPE, /* the region type is unknown */
81    ACPI_CONSOLIDATED, /* multiple tables exist here */
82    ACPI_AVAILABLE,    /* Memory range available for writing */
83    ACPI_AVAILABLE_PTR /* ACPI_AVAILABLE and suitable for pointers */
84} region_type_t;
85
86/*
87 * type ID <-> signiture conversions
88 */
89const char*
90acpi_sig_str(region_type_t);
91
92region_type_t
93acpi_sig_id(const char* sig);
94
95