2 * This file is part of the coreboot project.
4 * Copyright (C) 2007-2009 coresystems GmbH
5 * Copyright (C) 2014 Google Inc.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
18 #include <device/pci.h>
20 #include <cpu/x86/smm.h>
22 #include <soc/iomap.h>
24 void acpi_create_fadt(acpi_fadt_t
*fadt
, acpi_facs_t
*facs
, void *dsdt
)
26 acpi_header_t
*header
= &(fadt
->header
);
27 u16 pmbase
= ACPI_BASE_ADDRESS
;
29 memset((void *) fadt
, 0, sizeof(acpi_fadt_t
));
30 memcpy(header
->signature
, "FACP", 4);
31 header
->length
= sizeof(acpi_fadt_t
);
33 memcpy(header
->oem_id
, OEM_ID
, 6);
34 memcpy(header
->oem_table_id
, ACPI_TABLE_CREATOR
, 8);
35 memcpy(header
->asl_compiler_id
, ASLC
, 4);
36 header
->asl_compiler_revision
= 1;
38 fadt
->firmware_ctrl
= (unsigned long) facs
;
39 fadt
->dsdt
= (unsigned long) dsdt
;
41 fadt
->preferred_pm_profile
= PM_MOBILE
;
44 fadt
->smi_cmd
= APM_CNT
;
45 fadt
->acpi_enable
= APM_CNT_ACPI_ENABLE
;
46 fadt
->acpi_disable
= APM_CNT_ACPI_DISABLE
;
47 fadt
->s4bios_req
= 0x0;
50 fadt
->pm1a_evt_blk
= pmbase
;
51 fadt
->pm1b_evt_blk
= 0x0;
52 fadt
->pm1a_cnt_blk
= pmbase
+ 0x4;
53 fadt
->pm1b_cnt_blk
= 0x0;
54 fadt
->pm2_cnt_blk
= pmbase
+ 0x50;
55 fadt
->pm_tmr_blk
= pmbase
+ 0x8;
56 fadt
->gpe0_blk
= pmbase
+ 0x80;
59 fadt
->pm1_evt_len
= 4;
60 fadt
->pm1_cnt_len
= 2;
61 fadt
->pm2_cnt_len
= 1;
63 fadt
->gpe0_blk_len
= 32;
64 fadt
->gpe1_blk_len
= 0;
68 fadt
->p_lvl3_lat
= 87;
69 fadt
->flush_size
= 1024;
70 fadt
->flush_stride
= 16;
71 fadt
->duty_offset
= 1;
74 fadt
->mon_alrm
= 0x00;
76 fadt
->iapc_boot_arch
= ACPI_FADT_LEGACY_DEVICES
| ACPI_FADT_8042
;
78 fadt
->flags
= ACPI_FADT_WBINVD
| ACPI_FADT_C1_SUPPORTED
|
79 ACPI_FADT_C2_MP_SUPPORTED
| ACPI_FADT_SLEEP_BUTTON
|
80 ACPI_FADT_RESET_REGISTER
| ACPI_FADT_SEALED_CASE
|
81 ACPI_FADT_S4_RTC_WAKE
| ACPI_FADT_PLATFORM_CLOCK
;
83 fadt
->reset_reg
.space_id
= 1;
84 fadt
->reset_reg
.bit_width
= 8;
85 fadt
->reset_reg
.bit_offset
= 0;
86 fadt
->reset_reg
.resv
= 0;
87 fadt
->reset_reg
.addrl
= 0xcf9;
88 fadt
->reset_reg
.addrh
= 0;
90 fadt
->reset_value
= 6;
91 fadt
->x_firmware_ctl_l
= (unsigned long)facs
;
92 fadt
->x_firmware_ctl_h
= 0;
93 fadt
->x_dsdt_l
= (unsigned long)dsdt
;
96 fadt
->x_pm1a_evt_blk
.space_id
= 1;
97 fadt
->x_pm1a_evt_blk
.bit_width
= 32;
98 fadt
->x_pm1a_evt_blk
.bit_offset
= 0;
99 fadt
->x_pm1a_evt_blk
.resv
= 0;
100 fadt
->x_pm1a_evt_blk
.addrl
= pmbase
;
101 fadt
->x_pm1a_evt_blk
.addrh
= 0x0;
103 fadt
->x_pm1b_evt_blk
.space_id
= 1;
104 fadt
->x_pm1b_evt_blk
.bit_width
= 0;
105 fadt
->x_pm1b_evt_blk
.bit_offset
= 0;
106 fadt
->x_pm1b_evt_blk
.resv
= 0;
107 fadt
->x_pm1b_evt_blk
.addrl
= 0x0;
108 fadt
->x_pm1b_evt_blk
.addrh
= 0x0;
110 fadt
->x_pm1a_cnt_blk
.space_id
= 1;
111 fadt
->x_pm1a_cnt_blk
.bit_width
= 16;
112 fadt
->x_pm1a_cnt_blk
.bit_offset
= 0;
113 fadt
->x_pm1a_cnt_blk
.resv
= 0;
114 fadt
->x_pm1a_cnt_blk
.addrl
= pmbase
+ 0x4;
115 fadt
->x_pm1a_cnt_blk
.addrh
= 0x0;
117 fadt
->x_pm1b_cnt_blk
.space_id
= 1;
118 fadt
->x_pm1b_cnt_blk
.bit_width
= 0;
119 fadt
->x_pm1b_cnt_blk
.bit_offset
= 0;
120 fadt
->x_pm1b_cnt_blk
.resv
= 0;
121 fadt
->x_pm1b_cnt_blk
.addrl
= 0x0;
122 fadt
->x_pm1b_cnt_blk
.addrh
= 0x0;
124 fadt
->x_pm2_cnt_blk
.space_id
= 1;
125 fadt
->x_pm2_cnt_blk
.bit_width
= 8;
126 fadt
->x_pm2_cnt_blk
.bit_offset
= 0;
127 fadt
->x_pm2_cnt_blk
.resv
= 0;
128 fadt
->x_pm2_cnt_blk
.addrl
= pmbase
+ 0x50;
129 fadt
->x_pm2_cnt_blk
.addrh
= 0x0;
131 fadt
->x_pm_tmr_blk
.space_id
= 1;
132 fadt
->x_pm_tmr_blk
.bit_width
= 32;
133 fadt
->x_pm_tmr_blk
.bit_offset
= 0;
134 fadt
->x_pm_tmr_blk
.resv
= 0;
135 fadt
->x_pm_tmr_blk
.addrl
= pmbase
+ 0x8;
136 fadt
->x_pm_tmr_blk
.addrh
= 0x0;
138 fadt
->x_gpe0_blk
.space_id
= 0;
139 fadt
->x_gpe0_blk
.bit_width
= 0;
140 fadt
->x_gpe0_blk
.bit_offset
= 0;
141 fadt
->x_gpe0_blk
.resv
= 0;
142 fadt
->x_gpe0_blk
.addrl
= 0;
143 fadt
->x_gpe0_blk
.addrh
= 0x0;
145 fadt
->x_gpe1_blk
.space_id
= 1;
146 fadt
->x_gpe1_blk
.bit_width
= 0;
147 fadt
->x_gpe1_blk
.bit_offset
= 0;
148 fadt
->x_gpe1_blk
.resv
= 0;
149 fadt
->x_gpe1_blk
.addrl
= 0x0;
150 fadt
->x_gpe1_blk
.addrh
= 0x0;
153 acpi_checksum((void *) fadt
, header
->length
);