f9e2871d804a06efc35213fff833f2a7fe342023
[coreboot.git] / src / mainboard / via / epia-n / fadt.c
1 /*
2  * ACPI - create the Fixed ACPI Description Tables (FADT)
3  * (C) Copyright 2004 Nick Barker <nick.barker9@btinternet.com>
4  * (C) Copyright 2009 Jon Harrison <bothlyn@blueyonder.co.uk>
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
20  * MA 02110-1301 USA
21  */
22
23
24 #include <string.h>
25 #include <arch/acpi.h>
26 #include "../../../southbridge/via/vt8237r/vt8237r.h"
27
28 void acpi_create_fadt(acpi_fadt_t *fadt,acpi_facs_t *facs,void *dsdt){
29         acpi_header_t *header=&(fadt->header);
30
31         memset((void *)fadt,0,sizeof(acpi_fadt_t));
32         memcpy(header->signature,"FACP",4);
33         header->length = 244;
34         header->revision = 1;
35         memcpy(header->oem_id,OEM_ID,6);
36         memcpy(header->oem_table_id,"COREBOOT",8);
37         memcpy(header->asl_compiler_id,ASLC,4);
38         header->asl_compiler_revision=0;
39
40         fadt->firmware_ctrl=facs;
41         fadt->dsdt= dsdt;
42         fadt->preferred_pm_profile=0;
43         fadt->sci_int=VT8237R_ACPI_IRQ;
44         fadt->smi_cmd = 0;
45         fadt->acpi_enable = 0;
46         fadt->acpi_disable = 0;
47         fadt->s4bios_req = 0x0;
48         fadt->pstate_cnt = 0x0;
49
50         fadt->pm1a_evt_blk = 0x400;
51         fadt->pm1b_evt_blk = 0x0;
52         fadt->pm1a_cnt_blk = 0x404;
53         fadt->pm1b_cnt_blk = 0x0;
54         fadt->pm2_cnt_blk = 0x0;
55         fadt->pm_tmr_blk = 0x408;
56         fadt->gpe0_blk = 0x420;
57         fadt->gpe1_blk = 0x0;
58
59         fadt->pm1_evt_len = 4;
60         fadt->pm1_cnt_len = 2;
61         fadt->pm2_cnt_len = 0;
62         fadt->pm_tmr_len = 4;
63         fadt->gpe0_blk_len = 4;
64         fadt->gpe1_blk_len = 0;
65         fadt->gpe1_base = 0;
66         fadt->cst_cnt = 0;
67         fadt->p_lvl2_lat = 90;
68         fadt->p_lvl3_lat = 900;
69         fadt->flush_size = 0;
70         fadt->flush_stride = 0;
71         fadt->duty_offset = 0;
72         fadt->duty_width = 1;
73         fadt->day_alrm = 125;
74         fadt->mon_alrm = 126;
75         fadt->century = 50;
76         fadt->iapc_boot_arch = 0x1;
77         fadt->flags = 0x4a5;
78
79         fadt->reset_reg.space_id = 0;
80         fadt->reset_reg.bit_width = 0;
81         fadt->reset_reg.bit_offset = 0;
82         fadt->reset_reg.resv = 0;
83         fadt->reset_reg.addrl = 0x0;
84         fadt->reset_reg.addrh = 0x0;
85
86         fadt->reset_value = 0;
87         fadt->x_firmware_ctl_l = facs;
88         fadt->x_firmware_ctl_h = 0;
89         fadt->x_dsdt_l = dsdt;
90         fadt->x_dsdt_h = 0;
91
92         fadt->x_pm1a_evt_blk.space_id = 1;
93         fadt->x_pm1a_evt_blk.bit_width = 4;
94         fadt->x_pm1a_evt_blk.bit_offset = 0;
95         fadt->x_pm1a_evt_blk.resv = 0;
96         fadt->x_pm1a_evt_blk.addrl = 0x400;
97         fadt->x_pm1a_evt_blk.addrh = 0x0;
98
99
100         fadt->x_pm1b_evt_blk.space_id = 1;
101         fadt->x_pm1b_evt_blk.bit_width = 4;
102         fadt->x_pm1b_evt_blk.bit_offset = 0;
103         fadt->x_pm1b_evt_blk.resv = 0;
104         fadt->x_pm1b_evt_blk.addrl = 0x0;
105         fadt->x_pm1b_evt_blk.addrh = 0x0;
106
107
108         fadt->x_pm1a_cnt_blk.space_id = 1;
109         fadt->x_pm1a_cnt_blk.bit_width = 2;
110         fadt->x_pm1a_cnt_blk.bit_offset = 0;
111         fadt->x_pm1a_cnt_blk.resv = 0;
112         fadt->x_pm1a_cnt_blk.addrl = 0x404;
113         fadt->x_pm1a_cnt_blk.addrh = 0x0;
114
115
116         fadt->x_pm1b_cnt_blk.space_id = 1;
117         fadt->x_pm1b_cnt_blk.bit_width = 2;
118         fadt->x_pm1b_cnt_blk.bit_offset = 0;
119         fadt->x_pm1b_cnt_blk.resv = 0;
120         fadt->x_pm1b_cnt_blk.addrl = 0x0;
121         fadt->x_pm1b_cnt_blk.addrh = 0x0;
122
123
124         fadt->x_pm2_cnt_blk.space_id = 1;
125         fadt->x_pm2_cnt_blk.bit_width = 0;
126         fadt->x_pm2_cnt_blk.bit_offset = 0;
127         fadt->x_pm2_cnt_blk.resv = 0;
128         fadt->x_pm2_cnt_blk.addrl = 0x0;
129         fadt->x_pm2_cnt_blk.addrh = 0x0;
130
131
132         fadt->x_pm_tmr_blk.space_id = 1;
133         fadt->x_pm_tmr_blk.bit_width = 4;
134         fadt->x_pm_tmr_blk.bit_offset = 0;
135         fadt->x_pm_tmr_blk.resv = 0;
136         fadt->x_pm_tmr_blk.addrl = 0x408;
137         fadt->x_pm_tmr_blk.addrh = 0x0;
138
139
140         fadt->x_gpe0_blk.space_id = 1;
141         fadt->x_gpe0_blk.bit_width = 0;
142         fadt->x_gpe0_blk.bit_offset = 0;
143         fadt->x_gpe0_blk.resv = 0;
144         fadt->x_gpe0_blk.addrl = 0x420;
145         fadt->x_gpe0_blk.addrh = 0x0;
146
147
148         fadt->x_gpe1_blk.space_id = 1;
149         fadt->x_gpe1_blk.bit_width = 0;
150         fadt->x_gpe1_blk.bit_offset = 0;
151         fadt->x_gpe1_blk.resv = 0;
152         fadt->x_gpe1_blk.addrl = 0x0;
153         fadt->x_gpe1_blk.addrh = 0x0;
154
155         header->checksum = acpi_checksum((void *)fadt, sizeof(acpi_fadt_t));
156
157 }