blob: 5220f235638f232831ce3227457caa2de33fb3c7 [file] [log] [blame]
Uwe Hermann20a98c92009-06-05 23:02:43 +00001/*
2 * ACPI - create the Fixed ACPI Description Tables (FADT)
3 *
4 * Copyright (C) 2004 Nick Barker <nick.barker9@btinternet.com>
5 * Copyright (C) 2009 One Laptop per Child, Association, Inc.
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, MA 02110-1301 USA
20 */
21
22#include <string.h>
23#include <arch/acpi.h>
24#include <../../../northbridge/via/vx800/vx800.h>
25
26void acpi_create_fadt(acpi_fadt_t *fadt,acpi_facs_t *facs,void *dsdt){
27 acpi_header_t *header =& (fadt->header);
28
29 memset((void *)fadt, 0, sizeof(acpi_fadt_t));
30 memcpy(header->signature, "FACP", 4);
31 header->length = 244;
32 header->revision = 1;
33 memcpy(header->oem_id, "VX800 ", 6);
34 memcpy(header->oem_table_id, "LNXBACPI", 8);
35 memcpy(header->asl_compiler_id, "LXB", 8);
36 header->asl_compiler_revision = 0;
37
38 fadt->firmware_ctrl = facs;
39 fadt->dsdt = dsdt;
40 fadt->preferred_pm_profile = 0;
41 fadt->sci_int = 0x9;
42
43 fadt->smi_cmd = VX800_ACPI_IO_BASE+0x2F;
44 fadt->acpi_enable = 0xA1;
45 fadt->acpi_disable = 0xA0;
46
47 /* value 42F,A1,A0, if we dont want SMI, then set them to zero.
48 fadt->smi_cmd = 0x0;
49 fadt->acpi_enable = 0x0;
50 fadt->acpi_disable = 0x0;
51 */
52
53 fadt->s4bios_req = 0x0;
54 fadt->pstate_cnt = 0x0;
55
56 fadt->pm1a_evt_blk = VX800_ACPI_IO_BASE;
57 fadt->pm1b_evt_blk = 0x0;
58 fadt->pm1a_cnt_blk = VX800_ACPI_IO_BASE+0x4;
59 fadt->pm1b_cnt_blk = 0x0;
60 fadt->pm2_cnt_blk = 0x22;//to support cpu-c3
61// fadt->pm2_cnt_blk = 0x0;
62 fadt->pm_tmr_blk = VX800_ACPI_IO_BASE+0x8;
63 fadt->gpe0_blk = VX800_ACPI_IO_BASE+0x20;
64 fadt->gpe1_blk = VX800_ACPI_IO_BASE+0x50;
65
66 fadt->pm1_evt_len = 4;
67 fadt->pm1_cnt_len = 2;
68 fadt->pm2_cnt_len = 1;//to support cpu-c3
69// fadt->pm2_cnt_len = 0;
70
71 fadt->pm_tmr_len = 4;
72 fadt->gpe0_blk_len = 4;
73 fadt->gpe1_blk_len = 4;
74 fadt->gpe1_base = 0x10;
75 fadt->cst_cnt = 0;
76
77 fadt->p_lvl2_lat = 0x50; //this is the coreboot source
78 fadt->p_lvl3_lat = 0x320;//
79// fadt->p_lvl2_lat = 0x80; //
80// fadt->p_lvl3_lat = 0x800;//
81// fadt->p_lvl2_lat = 0x1; //
82// fadt->p_lvl3_lat = 0x23;
83
84// fadt->p_lvl2_lat = 0x200; //disable
85// fadt->p_lvl3_lat = 0x2000;
86
87 fadt->flush_size = 0;
88 fadt->flush_stride = 0;
89 fadt->duty_offset = 0;
90// fadt->duty_width = 1;
91 fadt->duty_width = 4;
92 fadt->day_alrm = 0x7d;
93 fadt->mon_alrm = 0x7e;
94 fadt->century = 0x32;
95 fadt->iapc_boot_arch = 0x0;
96 fadt->flags = 0xa5;
97
98 fadt->reset_reg.space_id = 0;
99 fadt->reset_reg.bit_width = 0;
100 fadt->reset_reg.bit_offset = 0;
101 fadt->reset_reg.resv = 0;
102 fadt->reset_reg.addrl = 0x0;
103 fadt->reset_reg.addrh = 0x0;
104
105 fadt->reset_value = 0;
106 fadt->x_firmware_ctl_l = facs;
107 fadt->x_firmware_ctl_h = 0;
108 fadt->x_dsdt_l = dsdt;
109 fadt->x_dsdt_h = 0;
110
111 fadt->x_pm1a_evt_blk.space_id = 1;
112 fadt->x_pm1a_evt_blk.bit_width = 4;
113 fadt->x_pm1a_evt_blk.bit_offset = 0;
114 fadt->x_pm1a_evt_blk.resv = 0;
115 fadt->x_pm1a_evt_blk.addrl = VX800_ACPI_IO_BASE;
116 fadt->x_pm1a_evt_blk.addrh = 0x0;
117
118 fadt->x_pm1b_evt_blk.space_id = 1;
119 fadt->x_pm1b_evt_blk.bit_width = 4;
120 fadt->x_pm1b_evt_blk.bit_offset = 0;
121 fadt->x_pm1b_evt_blk.resv = 0;
122 fadt->x_pm1b_evt_blk.addrl = 0x0;
123 fadt->x_pm1b_evt_blk.addrh = 0x0;
124
125 fadt->x_pm1a_cnt_blk.space_id = 1;
126 fadt->x_pm1a_cnt_blk.bit_width = 2;
127 fadt->x_pm1a_cnt_blk.bit_offset = 0;
128 fadt->x_pm1a_cnt_blk.resv = 0;
129 fadt->x_pm1a_cnt_blk.addrl = VX800_ACPI_IO_BASE+0x4;
130 fadt->x_pm1a_cnt_blk.addrh = 0x0;
131
132 fadt->x_pm1b_cnt_blk.space_id = 1;
133 fadt->x_pm1b_cnt_blk.bit_width = 2;
134 fadt->x_pm1b_cnt_blk.bit_offset = 0;
135 fadt->x_pm1b_cnt_blk.resv = 0;
136 fadt->x_pm1b_cnt_blk.addrl = 0x0;
137 fadt->x_pm1b_cnt_blk.addrh = 0x0;
138
139
140// fadt->x_pm2_cnt_blk.space_id = 1;
141 fadt->x_pm2_cnt_blk.space_id = 0;
142 fadt->x_pm2_cnt_blk.bit_width = 0;
143 fadt->x_pm2_cnt_blk.bit_offset = 0;
144 fadt->x_pm2_cnt_blk.resv = 0;
145 fadt->x_pm2_cnt_blk.addrl = 0x0;
146 fadt->x_pm2_cnt_blk.addrh = 0x0;
147
148 fadt->x_pm_tmr_blk.space_id = 1;
149 fadt->x_pm_tmr_blk.bit_width = 4;
150 fadt->x_pm_tmr_blk.bit_offset = 0;
151 fadt->x_pm_tmr_blk.resv = 0;
152 fadt->x_pm_tmr_blk.addrl = VX800_ACPI_IO_BASE+0x8;
153 fadt->x_pm_tmr_blk.addrh = 0x0;
154
155 fadt->x_gpe0_blk.space_id = 1;
156 fadt->x_gpe0_blk.bit_width = 0;
157 fadt->x_gpe0_blk.bit_offset = 0;
158 fadt->x_gpe0_blk.resv = 0;
159 fadt->x_gpe0_blk.addrl = VX800_ACPI_IO_BASE+0x20;
160 fadt->x_gpe0_blk.addrh = 0x0;
161
162 fadt->x_gpe1_blk.space_id = 1;
163 fadt->x_gpe1_blk.bit_width = 0;
164 fadt->x_gpe1_blk.bit_offset = 0;
165 fadt->x_gpe1_blk.resv = 0;
166 fadt->x_gpe1_blk.addrl = 0x0;
167 fadt->x_gpe1_blk.addrh = 0x0;
168
169 header->checksum = acpi_checksum((void *)fadt, sizeof(acpi_fadt_t));
170}