Duncan Laurie | afad056 | 2013-01-14 08:50:03 -0800 | [diff] [blame] | 1 | /* |
| 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 Laurie | afad056 | 2013-01-14 08:50:03 -0800 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <string.h> |
Julius Werner | 4ee4bd5 | 2014-10-20 13:46:39 -0700 | [diff] [blame] | 17 | #include <soc/acpi.h> |
Duncan Laurie | afad056 | 2013-01-14 08:50:03 -0800 | [diff] [blame] | 18 | |
| 19 | void acpi_create_fadt(acpi_fadt_t * fadt, acpi_facs_t * facs, void *dsdt) |
| 20 | { |
| 21 | acpi_header_t *header = &(fadt->header); |
Duncan Laurie | afad056 | 2013-01-14 08:50:03 -0800 | [diff] [blame] | 22 | |
| 23 | memset((void *) fadt, 0, sizeof(acpi_fadt_t)); |
| 24 | memcpy(header->signature, "FACP", 4); |
| 25 | header->length = sizeof(acpi_fadt_t); |
Duncan Laurie | 0aa06cb | 2014-05-14 17:03:15 -0700 | [diff] [blame] | 26 | header->revision = 5; |
Duncan Laurie | afad056 | 2013-01-14 08:50:03 -0800 | [diff] [blame] | 27 | memcpy(header->oem_id, OEM_ID, 6); |
| 28 | memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8); |
| 29 | memcpy(header->asl_compiler_id, ASLC, 4); |
| 30 | header->asl_compiler_revision = 1; |
| 31 | |
| 32 | fadt->firmware_ctrl = (unsigned long) facs; |
| 33 | fadt->dsdt = (unsigned long) dsdt; |
| 34 | fadt->model = 1; |
| 35 | fadt->preferred_pm_profile = PM_MOBILE; |
| 36 | |
Duncan Laurie | afad056 | 2013-01-14 08:50:03 -0800 | [diff] [blame] | 37 | fadt->x_firmware_ctl_l = (unsigned long)facs; |
| 38 | fadt->x_firmware_ctl_h = 0; |
| 39 | fadt->x_dsdt_l = (unsigned long)dsdt; |
| 40 | fadt->x_dsdt_h = 0; |
| 41 | |
Duncan Laurie | 0aa06cb | 2014-05-14 17:03:15 -0700 | [diff] [blame] | 42 | acpi_fill_in_fadt(fadt); |
Duncan Laurie | afad056 | 2013-01-14 08:50:03 -0800 | [diff] [blame] | 43 | |
| 44 | header->checksum = |
| 45 | acpi_checksum((void *) fadt, header->length); |
| 46 | } |