Angel Pons | 182dbde | 2020-04-02 23:49:05 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 2 | |
| 3 | /* |
| 4 | * ACPI - create the Fixed ACPI Description Tables (FADT) |
| 5 | */ |
| 6 | |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 7 | #include <console/console.h> |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 8 | #include <acpi/acpi.h> |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 9 | #include <device/device.h> |
Elyes HAOUAS | 26071aa | 2019-02-15 08:21:33 +0100 | [diff] [blame] | 10 | |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 11 | #include "hudson.h" |
| 12 | #include "smi.h" |
| 13 | |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 14 | /* |
| 15 | * Reference section 5.2.9 Fixed ACPI Description Table (FADT) |
| 16 | * in the ACPI 3.0b specification. |
| 17 | */ |
Kyösti Mälkki | ab51629 | 2020-05-30 19:38:04 +0300 | [diff] [blame] | 18 | void acpi_fill_fadt(acpi_fadt_t *fadt) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 19 | { |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 20 | printk(BIOS_DEBUG, "pm_base: 0x%04x\n", HUDSON_ACPI_IO_BASE); |
| 21 | |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 22 | |
| 23 | fadt->pm1a_evt_blk = ACPI_PM_EVT_BLK; |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 24 | fadt->pm1a_cnt_blk = ACPI_PM1_CNT_BLK; |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 25 | fadt->pm_tmr_blk = ACPI_PM_TMR_BLK; |
| 26 | fadt->gpe0_blk = ACPI_GPE0_BLK; |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 27 | |
| 28 | fadt->pm1_evt_len = 4; /* 32 bits */ |
| 29 | fadt->pm1_cnt_len = 2; /* 16 bits */ |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 30 | fadt->pm_tmr_len = 4; /* 32 bits */ |
| 31 | fadt->gpe0_blk_len = 8; /* 64 bits */ |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 32 | |
Kyösti Mälkki | 88decca | 2023-04-28 07:04:34 +0300 | [diff] [blame] | 33 | fill_fadt_extended_pm_io(fadt); |
| 34 | |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 35 | fadt->duty_offset = 1; /* CLK_VAL bits 3:1 */ |
| 36 | fadt->duty_width = 3; /* CLK_VAL bits 3:1 */ |
Felix Held | 02d2412 | 2024-01-10 21:54:22 +0100 | [diff] [blame] | 37 | |
| 38 | fadt->iapc_boot_arch = ACPI_FADT_LEGACY_FREE; /* See table 5-10 */ |
| 39 | if (CONFIG(HUDSON_FADT_LEGACY_DEVICES)) |
| 40 | fadt->iapc_boot_arch |= ACPI_FADT_LEGACY_DEVICES; |
| 41 | if (CONFIG(HUDSON_FADT_8042)) |
| 42 | fadt->iapc_boot_arch |= ACPI_FADT_8042; |
| 43 | |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 44 | fadt->res2 = 0; /* reserved, MUST be 0 ACPI 3.0 */ |
Angel Pons | a208c6c | 2020-07-13 00:02:34 +0200 | [diff] [blame] | 45 | fadt->flags |= ACPI_FADT_WBINVD | /* See table 5-10 ACPI 3.0a spec */ |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 46 | ACPI_FADT_C1_SUPPORTED | |
| 47 | ACPI_FADT_SLEEP_BUTTON | |
| 48 | ACPI_FADT_S4_RTC_WAKE | |
| 49 | ACPI_FADT_32BIT_TIMER | |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 50 | ACPI_FADT_PCI_EXPRESS_WAKE | |
| 51 | ACPI_FADT_PLATFORM_CLOCK | |
| 52 | ACPI_FADT_S4_RTC_VALID | |
| 53 | ACPI_FADT_REMOTE_POWER_ON; |
| 54 | |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 55 | fadt->x_firmware_ctl_l = 0; /* set to 0 if firmware_ctrl is used */ |
| 56 | fadt->x_firmware_ctl_h = 0; |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 57 | } |