Lee Leahy | 5cb9dda | 2015-05-01 10:34:54 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007-2009 coresystems GmbH |
| 5 | * Copyright (C) 2015 Intel Corp. |
| 6 | * |
| 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. |
| 10 | * |
| 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. |
Lee Leahy | 5cb9dda | 2015-05-01 10:34:54 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <soc/acpi.h> |
| 18 | #include <string.h> |
Elyes HAOUAS | 26071aa | 2019-02-15 08:21:33 +0100 | [diff] [blame] | 19 | #include <version.h> |
Lee Leahy | 5cb9dda | 2015-05-01 10:34:54 -0700 | [diff] [blame] | 20 | |
| 21 | void acpi_create_fadt(acpi_fadt_t *fadt, acpi_facs_t *facs, void *dsdt) |
| 22 | { |
| 23 | acpi_header_t *header = &(fadt->header); |
| 24 | |
| 25 | memset((void *) fadt, 0, sizeof(acpi_fadt_t)); |
| 26 | memcpy(header->signature, "FACP", 4); |
| 27 | header->length = sizeof(acpi_fadt_t); |
| 28 | header->revision = 3; |
| 29 | memcpy(header->oem_id, OEM_ID, 6); |
| 30 | memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8); |
| 31 | memcpy(header->asl_compiler_id, ASLC, 4); |
Elyes HAOUAS | 26071aa | 2019-02-15 08:21:33 +0100 | [diff] [blame] | 32 | header->asl_compiler_revision = asl_revision; |
Lee Leahy | 5cb9dda | 2015-05-01 10:34:54 -0700 | [diff] [blame] | 33 | |
| 34 | fadt->firmware_ctrl = (unsigned long) facs; |
| 35 | fadt->dsdt = (unsigned long) dsdt; |
| 36 | fadt->model = 1; |
| 37 | fadt->preferred_pm_profile = PM_MOBILE; |
| 38 | |
| 39 | fadt->x_firmware_ctl_l = (unsigned long)facs; |
| 40 | fadt->x_firmware_ctl_h = 0; |
| 41 | fadt->x_dsdt_l = (unsigned long)dsdt; |
| 42 | fadt->x_dsdt_h = 0; |
| 43 | |
| 44 | acpi_fill_in_fadt(fadt); |
| 45 | |
Jonathan Neuschäfer | e1de648 | 2018-10-10 14:22:48 +0200 | [diff] [blame] | 46 | header->checksum = acpi_checksum((void *) fadt, header->length); |
Lee Leahy | 5cb9dda | 2015-05-01 10:34:54 -0700 | [diff] [blame] | 47 | } |