1 /* ----------------------------------------------------------------------- *
3 * Copyright 2009 Erwan Velu - All Rights Reserved
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without
8 * restriction, including without limitation the rights to use,
9 * copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom
11 * the Software is furnished to do so, subject to the following
14 * The above copyright notice and this permission notice shall
15 * be included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
26 * -----------------------------------------------------------------------
32 #include "acpi/acpi.h"
34 void dbg_printf(const char *fmt
, ...)
38 vfprintf(stderr
, fmt
, args
);
42 void init_acpi(s_acpi
* acpi
)
44 memset(acpi
, 0, sizeof(s_acpi
));
47 int parse_acpi(s_acpi
* acpi
)
52 /* Let's seach for RSDP table */
53 if ((ret_val
= search_rsdp(acpi
)) != RSDP_TABLE_FOUND
)
56 /* Let's seach for RSDT table
57 * That's not a big deal not having it, XSDT is far more relevant */
58 parse_rsdt(&acpi
->rsdt
);
59 if ((ret_val
= parse_xsdt(acpi
)) != XSDT_TABLE_FOUND
)
65 void get_acpi_description_header(uint8_t * q
, s_acpi_description_header
* adh
)
67 cp_str_struct(adh
->signature
);
68 cp_struct(&adh
->length
);
69 cp_struct(&adh
->revision
);
70 cp_struct(&adh
->checksum
);
71 cp_str_struct(adh
->oem_id
);
72 cp_str_struct(adh
->oem_table_id
);
73 cp_struct(&adh
->oem_revision
);
74 cp_str_struct(adh
->creator_id
);
75 cp_struct(&adh
->creator_revision
);
76 DEBUG_PRINT(("acpi_header at %p = %s | %s | %s\n", q
, adh
->signature
,adh
->oem_id
, adh
->creator_id
));