ACPI: Fixing pointer arithmetic
[hdt-cyring.git] / com32 / gpllib / acpi / acpi.c
blobd6b16906f7297c7023b83df50a3650a36fe735a2
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
12 * conditions:
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 * -----------------------------------------------------------------------
29 #include <stdio.h>
30 #include <string.h>
31 #include <memory.h>
32 #include "acpi/acpi.h"
34 void dbg_printf(const char *fmt, ...)
36 va_list args;
37 va_start(args, fmt);
38 vfprintf(stderr, fmt, args);
39 va_end(args);
42 void init_acpi(s_acpi * acpi)
44 memset(acpi, 0, sizeof(s_acpi));
47 int parse_acpi(s_acpi * acpi)
49 int ret_val;
50 init_acpi(acpi);
52 /* Let's seach for RSDP table */
53 if ((ret_val = search_rsdp(acpi)) != RSDP_TABLE_FOUND)
54 return ret_val;
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)
60 return ret_val;
62 return ACPI_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 ));