blob: 3477e3ada771ebe6e68c28334fb02c799807ba28 [file] [log] [blame]
Elyes HAOUAS132384a2020-05-07 07:19:50 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
2
Tobias Diedriche87c38e2010-11-27 09:40:16 +00003/*
Tobias Diedriche87c38e2010-11-27 09:40:16 +00004 * Based on src/southbridge/via/vt8237r/vt8237_fadt.c
Tobias Diedriche87c38e2010-11-27 09:40:16 +00005 */
6
Furquan Shaikh76cedd22020-05-02 10:24:23 -07007#include <acpi/acpi.h>
Tobias Diedriche87c38e2010-11-27 09:40:16 +00008#include <device/device.h>
9#include <device/pci.h>
Elyes HAOUAS26071aa2019-02-15 08:21:33 +010010
Tobias Diedriche87c38e2010-11-27 09:40:16 +000011#include "i82371eb.h"
12
13/**
14 * Create the Fixed ACPI Description Tables (FADT) for any board with this SB.
15 * Reference: ACPIspec40a, 5.2.9, page 118
16 */
Kyösti Mälkki8ad52ff2020-05-30 14:50:50 +030017void acpi_fill_fadt(acpi_fadt_t *fadt)
Tobias Diedriche87c38e2010-11-27 09:40:16 +000018{
Tobias Diedriche87c38e2010-11-27 09:40:16 +000019 fadt->pm1a_evt_blk = DEFAULT_PMBASE;
Tobias Diedriche87c38e2010-11-27 09:40:16 +000020 fadt->pm1a_cnt_blk = DEFAULT_PMBASE + PMCNTRL;
Tobias Diedriche87c38e2010-11-27 09:40:16 +000021
Tobias Diedriche87c38e2010-11-27 09:40:16 +000022 fadt->pm_tmr_blk = DEFAULT_PMBASE + PMTMR;
23 fadt->gpe0_blk = DEFAULT_PMBASE + GPSTS;
Tobias Diedriche87c38e2010-11-27 09:40:16 +000024
25 /* *_len define register width in bytes */
26 fadt->pm1_evt_len = 4;
27 fadt->pm1_cnt_len = 2;
Tobias Diedriche87c38e2010-11-27 09:40:16 +000028 fadt->pm_tmr_len = 4;
29 fadt->gpe0_blk_len = 4;
30
Kyösti Mälkki88decca2023-04-28 07:04:34 +030031 fill_fadt_extended_pm_io(fadt);
32
Tobias Diedriche87c38e2010-11-27 09:40:16 +000033 /*
34 * bit meaning
35 * 0 1: We have user-visible legacy devices
36 * 1 1: 8042
37 * 2 0: VGA is ok to probe
38 * 3 1: MSI are not supported
39 */
Elyes HAOUAS653eb152020-08-17 12:15:12 +020040 fadt->iapc_boot_arch = ACPI_FADT_LEGACY_DEVICES | ACPI_FADT_8042 |
41 ACPI_FADT_MSI_NOT_SUPPORTED;
Tobias Diedriche87c38e2010-11-27 09:40:16 +000042 /*
43 * bit meaning
44 * 0 WBINVD
45 * Processors in new ACPI-compatible systems are required to
46 * support this function and indicate this to OSPM by setting
47 * this field.
48 * 1 WBINVD_FLUSH
49 * If set, indicates that the hardware flushes all caches on the
50 * WBINVD instruction and maintains memory coherency, but does
51 * not guarantee the caches are invalidated.
52 * 2 PROC_C1
53 * C1 power state (x86 hlt instruction) is supported on all cpus
54 * 3 P_LVL2_UP
55 * 0: C2 only on uniprocessor, 1: C2 on uni- and multiprocessor
56 * 4 PWR_BUTTON
57 * 0: pwr button is fixed feature
58 * 1: pwr button has control method device if present
59 * 5 SLP_BUTTON
60 * 0: sleep button is fixed feature
61 * 1: sleep button has control method device if present
62 * 6 FIX_RTC
63 * 0: RTC wake status supported in fixed register spce
64 * 7 RTC_S4
65 * 1: RTC can wake from S4
66 * 8 TMR_VAL_EXT
67 * 1: pmtimer is 32bit, 0: pmtimer is 24bit
68 * 9 DCK_CAP
69 * 1: system supports docking station
70 * 10 RESET_REG_SUPPORT
71 * 1: fadt describes reset register for system reset
72 * 11 SEALED_CASE
73 * 1: No expansion possible, sealed case
74 * 12 HEADLESS
75 * 1: Video output, keyboard and mouse are not connected
76 * 13 CPU_SW_SLP
77 * 1: Special processor instruction needs to be executed
78 * after writing SLP_TYP
79 * 14 PCI_EXP_WAK
80 * 1: PM1 regs support PCIEXP_WAKE_(STS|EN), must be set
81 * on platforms with pci express support
82 * 15 USE_PLATFORM_CLOCK
83 * 1: OS should prefer platform clock over processor internal
84 * clock.
85 * 16 S4_RTC_STS_VALID
86 * 17 REMOTE_POWER_ON_CAPABLE
87 * 1: platform correctly supports OSPM leaving GPE wake events
88 * armed prior to an S5 transition.
89 * 18 FORCE_APIC_CLUSTER_MODEL
90 * 19 FORCE_APIC_PHYSICAL_DESTINATION_MODE
91 */
Elyes HAOUAS37ac3682020-08-17 12:08:25 +020092 fadt->flags |= ACPI_FADT_WBINVD | ACPI_FADT_C1_SUPPORTED | ACPI_FADT_SLEEP_BUTTON |
93 ACPI_FADT_S4_RTC_WAKE;
Tobias Diedriche87c38e2010-11-27 09:40:16 +000094}