Elyes HAOUAS | 132384a | 2020-05-07 07:19:50 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 3 | /* |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 4 | * Based on src/southbridge/via/vt8237r/vt8237_fadt.c |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 7 | #include <acpi/acpi.h> |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 8 | #include <device/device.h> |
| 9 | #include <device/pci.h> |
Elyes HAOUAS | 26071aa | 2019-02-15 08:21:33 +0100 | [diff] [blame] | 10 | |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 11 | #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älkki | 8ad52ff | 2020-05-30 14:50:50 +0300 | [diff] [blame] | 17 | void acpi_fill_fadt(acpi_fadt_t *fadt) |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 18 | { |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 19 | |
| 20 | fadt->pm1a_evt_blk = DEFAULT_PMBASE; |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 21 | fadt->pm1a_cnt_blk = DEFAULT_PMBASE + PMCNTRL; |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 22 | |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 23 | fadt->pm_tmr_blk = DEFAULT_PMBASE + PMTMR; |
| 24 | fadt->gpe0_blk = DEFAULT_PMBASE + GPSTS; |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 25 | |
| 26 | /* *_len define register width in bytes */ |
| 27 | fadt->pm1_evt_len = 4; |
| 28 | fadt->pm1_cnt_len = 2; |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 29 | fadt->pm_tmr_len = 4; |
| 30 | fadt->gpe0_blk_len = 4; |
| 31 | |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 32 | /* |
| 33 | * bit meaning |
| 34 | * 0 1: We have user-visible legacy devices |
| 35 | * 1 1: 8042 |
| 36 | * 2 0: VGA is ok to probe |
| 37 | * 3 1: MSI are not supported |
| 38 | */ |
Elyes HAOUAS | 653eb15 | 2020-08-17 12:15:12 +0200 | [diff] [blame] | 39 | fadt->iapc_boot_arch = ACPI_FADT_LEGACY_DEVICES | ACPI_FADT_8042 | |
| 40 | ACPI_FADT_MSI_NOT_SUPPORTED; |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 41 | /* |
| 42 | * bit meaning |
| 43 | * 0 WBINVD |
| 44 | * Processors in new ACPI-compatible systems are required to |
| 45 | * support this function and indicate this to OSPM by setting |
| 46 | * this field. |
| 47 | * 1 WBINVD_FLUSH |
| 48 | * If set, indicates that the hardware flushes all caches on the |
| 49 | * WBINVD instruction and maintains memory coherency, but does |
| 50 | * not guarantee the caches are invalidated. |
| 51 | * 2 PROC_C1 |
| 52 | * C1 power state (x86 hlt instruction) is supported on all cpus |
| 53 | * 3 P_LVL2_UP |
| 54 | * 0: C2 only on uniprocessor, 1: C2 on uni- and multiprocessor |
| 55 | * 4 PWR_BUTTON |
| 56 | * 0: pwr button is fixed feature |
| 57 | * 1: pwr button has control method device if present |
| 58 | * 5 SLP_BUTTON |
| 59 | * 0: sleep button is fixed feature |
| 60 | * 1: sleep button has control method device if present |
| 61 | * 6 FIX_RTC |
| 62 | * 0: RTC wake status supported in fixed register spce |
| 63 | * 7 RTC_S4 |
| 64 | * 1: RTC can wake from S4 |
| 65 | * 8 TMR_VAL_EXT |
| 66 | * 1: pmtimer is 32bit, 0: pmtimer is 24bit |
| 67 | * 9 DCK_CAP |
| 68 | * 1: system supports docking station |
| 69 | * 10 RESET_REG_SUPPORT |
| 70 | * 1: fadt describes reset register for system reset |
| 71 | * 11 SEALED_CASE |
| 72 | * 1: No expansion possible, sealed case |
| 73 | * 12 HEADLESS |
| 74 | * 1: Video output, keyboard and mouse are not connected |
| 75 | * 13 CPU_SW_SLP |
| 76 | * 1: Special processor instruction needs to be executed |
| 77 | * after writing SLP_TYP |
| 78 | * 14 PCI_EXP_WAK |
| 79 | * 1: PM1 regs support PCIEXP_WAKE_(STS|EN), must be set |
| 80 | * on platforms with pci express support |
| 81 | * 15 USE_PLATFORM_CLOCK |
| 82 | * 1: OS should prefer platform clock over processor internal |
| 83 | * clock. |
| 84 | * 16 S4_RTC_STS_VALID |
| 85 | * 17 REMOTE_POWER_ON_CAPABLE |
| 86 | * 1: platform correctly supports OSPM leaving GPE wake events |
| 87 | * armed prior to an S5 transition. |
| 88 | * 18 FORCE_APIC_CLUSTER_MODEL |
| 89 | * 19 FORCE_APIC_PHYSICAL_DESTINATION_MODE |
| 90 | */ |
Elyes HAOUAS | 37ac368 | 2020-08-17 12:08:25 +0200 | [diff] [blame] | 91 | fadt->flags |= ACPI_FADT_WBINVD | ACPI_FADT_C1_SUPPORTED | ACPI_FADT_SLEEP_BUTTON | |
| 92 | ACPI_FADT_S4_RTC_WAKE; |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 93 | |
Elyes HAOUAS | 04071f4 | 2020-07-20 17:05:24 +0200 | [diff] [blame] | 94 | fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO; |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 95 | fadt->x_pm1a_evt_blk.bit_width = fadt->pm1_evt_len * 8; |
| 96 | fadt->x_pm1a_evt_blk.bit_offset = 0; |
Angel Pons | 12a4d05 | 2020-07-14 01:31:27 +0200 | [diff] [blame] | 97 | fadt->x_pm1a_evt_blk.access_size = ACPI_ACCESS_SIZE_WORD_ACCESS; |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 98 | fadt->x_pm1a_evt_blk.addrl = fadt->pm1a_evt_blk; |
| 99 | fadt->x_pm1a_evt_blk.addrh = 0x0; |
| 100 | |
Elyes HAOUAS | 04071f4 | 2020-07-20 17:05:24 +0200 | [diff] [blame] | 101 | fadt->x_pm1a_cnt_blk.space_id = ACPI_ADDRESS_SPACE_IO; |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 102 | fadt->x_pm1a_cnt_blk.bit_width = fadt->pm1_cnt_len * 8; |
| 103 | fadt->x_pm1a_cnt_blk.bit_offset = 0; |
Patrick Rudolph | c02bda0 | 2020-02-28 10:19:41 +0100 | [diff] [blame] | 104 | fadt->x_pm1a_cnt_blk.access_size = ACPI_ACCESS_SIZE_WORD_ACCESS; |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 105 | fadt->x_pm1a_cnt_blk.addrl = fadt->pm1a_cnt_blk; |
| 106 | fadt->x_pm1a_cnt_blk.addrh = 0x0; |
| 107 | |
Elyes HAOUAS | 04071f4 | 2020-07-20 17:05:24 +0200 | [diff] [blame] | 108 | fadt->x_pm_tmr_blk.space_id = ACPI_ADDRESS_SPACE_IO; |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 109 | fadt->x_pm_tmr_blk.bit_width = fadt->pm_tmr_len * 8; |
| 110 | fadt->x_pm_tmr_blk.bit_offset = 0; |
Patrick Rudolph | c02bda0 | 2020-02-28 10:19:41 +0100 | [diff] [blame] | 111 | fadt->x_pm_tmr_blk.access_size = ACPI_ACCESS_SIZE_DWORD_ACCESS; |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 112 | fadt->x_pm_tmr_blk.addrl = fadt->pm_tmr_blk; |
| 113 | fadt->x_pm_tmr_blk.addrh = 0x0; |
| 114 | |
Elyes HAOUAS | 04071f4 | 2020-07-20 17:05:24 +0200 | [diff] [blame] | 115 | fadt->x_gpe0_blk.space_id = ACPI_ADDRESS_SPACE_IO; |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 116 | fadt->x_gpe0_blk.bit_width = fadt->gpe0_blk_len * 8; |
| 117 | fadt->x_gpe0_blk.bit_offset = 0; |
Patrick Rudolph | c02bda0 | 2020-02-28 10:19:41 +0100 | [diff] [blame] | 118 | fadt->x_gpe0_blk.access_size = ACPI_ACCESS_SIZE_BYTE_ACCESS; |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 119 | fadt->x_gpe0_blk.addrl = fadt->gpe0_blk; |
| 120 | fadt->x_gpe0_blk.addrh = 0x0; |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 121 | } |