blob: 2dec7c7284fe7bbe3e67e2598ddac88fad7c3828 [file] [log] [blame]
Duncan Laurieafad0562013-01-14 08:50:03 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2009 coresystems GmbH
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Duncan Laurieafad0562013-01-14 08:50:03 -080014 */
15
16#include <string.h>
Julius Werner4ee4bd52014-10-20 13:46:39 -070017#include <soc/acpi.h>
Elyes HAOUAS26071aa2019-02-15 08:21:33 +010018#include <version.h>
Duncan Laurieafad0562013-01-14 08:50:03 -080019
20void acpi_create_fadt(acpi_fadt_t * fadt, acpi_facs_t * facs, void *dsdt)
21{
22 acpi_header_t *header = &(fadt->header);
Duncan Laurieafad0562013-01-14 08:50:03 -080023
24 memset((void *) fadt, 0, sizeof(acpi_fadt_t));
25 memcpy(header->signature, "FACP", 4);
26 header->length = sizeof(acpi_fadt_t);
Duncan Laurie0aa06cb2014-05-14 17:03:15 -070027 header->revision = 5;
Duncan Laurieafad0562013-01-14 08:50:03 -080028 memcpy(header->oem_id, OEM_ID, 6);
29 memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
30 memcpy(header->asl_compiler_id, ASLC, 4);
Elyes HAOUAS26071aa2019-02-15 08:21:33 +010031 header->asl_compiler_revision = asl_revision;
Duncan Laurieafad0562013-01-14 08:50:03 -080032
33 fadt->firmware_ctrl = (unsigned long) facs;
34 fadt->dsdt = (unsigned long) dsdt;
35 fadt->model = 1;
36 fadt->preferred_pm_profile = PM_MOBILE;
37
Duncan Laurieafad0562013-01-14 08:50:03 -080038 fadt->x_firmware_ctl_l = (unsigned long)facs;
39 fadt->x_firmware_ctl_h = 0;
40 fadt->x_dsdt_l = (unsigned long)dsdt;
41 fadt->x_dsdt_h = 0;
42
Duncan Laurie0aa06cb2014-05-14 17:03:15 -070043 acpi_fill_in_fadt(fadt);
Duncan Laurieafad0562013-01-14 08:50:03 -080044
Jonathan Neuschäfere1de6482018-10-10 14:22:48 +020045 header->checksum = acpi_checksum((void *) fadt, header->length);
Duncan Laurieafad0562013-01-14 08:50:03 -080046}