1/* ----------------------------------------------------------------------- *
2 *
3 *   Copyright 2009-2011 Erwan Velu - All Rights Reserved
4 *
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:
13 *
14 *   The above copyright notice and this permission notice shall
15 *   be included in all copies or substantial portions of the Software.
16 *
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.
25 *
26 * -----------------------------------------------------------------------
27*/
28
29#include <stdio.h>
30#include <string.h>
31#include <memory.h>
32#include <dprintf.h>
33#include "acpi/acpi.h"
34
35void parse_fadt(s_fadt * f)
36{
37    /* Let's seach for FADT table */
38    uint8_t *q;
39
40    /* Fixing table name */
41    memcpy(f->header.signature,FADT,sizeof(FADT));
42
43    /* Copying remaining structs */
44    q = (uint8_t *)f->address;
45    q += ACPI_HEADER_SIZE;
46    DEBUG_PRINT(("- Parsing FADT at %p\n",q));
47
48    cp_struct(&f->firmware_ctrl);
49    cp_struct(&f->dsdt_address);
50    cp_struct(&f->reserved);
51    cp_struct(&f->prefered_pm_profile);
52    cp_struct(&f->sci_int);
53    cp_struct(&f->smi_cmd);
54    cp_struct(&f->acpi_enable);
55    cp_struct(&f->acpi_disable);
56    cp_struct(&f->s4bios_req);
57    cp_struct(&f->pstate_cnt);
58    cp_struct(&f->pm1a_evt_blk);
59    cp_struct(&f->pm1b_evt_blk);
60    cp_struct(&f->pm1a_cnt_blk);
61    cp_struct(&f->pm1b_cnt_blk);
62    cp_struct(&f->pm2_cnt_blk);
63    cp_struct(&f->pm_tmr_blk);
64    cp_struct(&f->gpe0_blk);
65    cp_struct(&f->gpe1_blk);
66    cp_struct(&f->pm1_evt_len);
67    cp_struct(&f->pm1_cnt_len);
68    cp_struct(&f->pm2_cnt_len);
69    cp_struct(&f->pm_tmr_len);
70    cp_struct(&f->gpe0_blk_len);
71    cp_struct(&f->gpe1_blk_len);
72    cp_struct(&f->gpe1_base);
73    cp_struct(&f->cst_cnt);
74    cp_struct(&f->p_lvl2_lat);
75    cp_struct(&f->p_lvl3_lat);
76    cp_struct(&f->flush_size);
77    cp_struct(&f->flush_stride);
78    cp_struct(&f->duty_offset);
79    cp_struct(&f->duty_width);
80    cp_struct(&f->day_alarm);
81    cp_struct(&f->mon_alarm);
82    cp_struct(&f->century);
83    cp_struct(&f->iapc_boot_arch);
84    cp_struct(&f->reserved_2);
85    cp_struct(&f->flags);
86    cp_struct(&f->reset_reg);
87    cp_struct(&f->reset_value);
88    cp_struct(f->reserved_3);
89    cp_struct(&f->x_firmware_ctrl);
90    cp_struct(&f->x_dsdt);
91    cp_struct(&f->x_pm1a_evt_blk);
92    cp_struct(&f->x_pm1b_evt_blk);
93    cp_struct(&f->x_pm1a_cnt_blk);
94    cp_struct(&f->x_pm1b_cnt_blk);
95    cp_struct(&f->x_pm2_cnt_blk);
96    cp_struct(&f->x_pm_tmr_blk);
97    cp_struct(&f->x_gpe0_blk);
98    cp_struct(&f->x_gpe1_blk);
99}
100