aboutsummaryrefslogtreecommitdiffstats
path: root/com32/gplinclude/acpi/acpi.h
blob: 94589f35b8e03b7ed19080fba6d7c938f39f0706 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/* ----------------------------------------------------------------------- *
 *
 *   Copyright 2009-2011 Erwan Velu - All Rights Reserved
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
 *   Boston MA 02111-1307, USA; either version 2 of the License, or
 *   (at your option) any later version; incorporated herein by reference.
 *
 * ----------------------------------------------------------------------- */

#ifndef ACPI_H
#define ACPI_H

#define DEBUG_ACPI 0

void dbg_printf(const char *fmt, ...);
#define DEBUG_PRINT(x) do { if (DEBUG_ACPI) dbg_printf x; } while (0)

#include <inttypes.h>
#include <stdbool.h>
#include <acpi/structs.h>
#include <acpi/rsdp.h>
#include <acpi/rsdt.h>
#include <acpi/xsdt.h>
#include <acpi/fadt.h>
#include <acpi/madt.h>
#include <acpi/dsdt.h>
#include <acpi/ssdt.h>
#include <acpi/sbst.h>
#include <acpi/ecdt.h>
#include <acpi/facs.h>
#include <acpi/hpet.h>
#include <acpi/tcpa.h>
#include <acpi/mcfg.h>
#include <acpi/slic.h>
#include <acpi/boot.h>

enum { ACPI_FOUND = 1, ENO_ACPI = 2 , MADT_FOUND = 3 , ENO_MADT = 4 };

#define MAX_SSDT 128

/* Some other description HEADERS : ACPI doc: 5.2.6*/
#define OEMX "OEMx"
#define SRAR "SRAT"
#define BERT "BERT"
#define BOOT "BOOT"
#define CPEP "CPEP"
#define DBGP "DGBP"
#define DMAR "DMAR"
#define ERST "ERST"
#define ETDT "ETDT"
#define HEST "HEST"
#define HPET "HPET"
#define IBFT "IBFT"
#define MCFG "MCFG"
#define SPCR "SPCR"
#define SPMI "SPMI"
#define TCPA "TCPA"
#define UEFI "UEFI"
#define WAET "WAET"
#define WDAT "WDAT"
#define WDRT "WDRT"
#define WSPT "WSPT"
#define SLIC "SLIC"

/* This macro are used to extract ACPI structures 
 * please be careful about the q (interator) naming */
#define cp_struct(dest) memcpy(dest,q,sizeof(*dest)); q+=sizeof(*dest)
#define cp_str_struct(dest) memcpy(dest,q,sizeof(dest)-1); dest[sizeof(dest)-1]=0;q+=sizeof(dest)-1

typedef struct {
    s_rsdp rsdp;
    s_rsdt rsdt;
    s_xsdt xsdt;
    s_fadt fadt;
    s_madt madt;
    s_dsdt dsdt;
    s_ssdt *ssdt[MAX_SSDT];
    uint8_t ssdt_count;
    s_sbst sbst;
    s_ecdt ecdt;
    s_facs facs;
    s_hpet hpet;
    s_tcpa tcpa;
    s_mcfg mcfg;
    s_slic slic;
    s_boot boot;
} s_acpi;

int parse_acpi(s_acpi * acpi);
int parse_xsdt(s_acpi * acpi);
void parse_madt(s_acpi * acpi);
int search_rsdp(s_acpi *acpi);
void get_acpi_description_header(uint8_t *q, s_acpi_description_header * adh);
bool parse_header(uint64_t *address, s_acpi *acpi);
#endif