Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 3 | #include <device/pci_ops.h> |
| 4 | #include <acpi/acpi.h> |
| 5 | #include <cpu/x86/smm.h> |
| 6 | #include <version.h> |
| 7 | #include <southbridge/intel/common/pmbase.h> |
| 8 | #include "i82801gx.h" |
| 9 | #include "chip.h" |
| 10 | |
| 11 | void acpi_fill_fadt(acpi_fadt_t *fadt) |
| 12 | { |
| 13 | struct device *dev = pcidev_on_root(0x1f, 0); |
| 14 | struct southbridge_intel_i82801gx_config *chip = dev->chip_info; |
| 15 | u16 pmbase = lpc_get_pmbase(); |
| 16 | |
Angel Pons | 741508b | 2020-06-21 15:56:13 +0200 | [diff] [blame] | 17 | fadt->sci_int = 0x9; |
| 18 | |
| 19 | if (permanent_smi_handler()) { |
| 20 | fadt->smi_cmd = APM_CNT; |
| 21 | fadt->acpi_enable = APM_CNT_ACPI_ENABLE; |
| 22 | fadt->acpi_disable = APM_CNT_ACPI_DISABLE; |
Angel Pons | 741508b | 2020-06-21 15:56:13 +0200 | [diff] [blame] | 23 | } |
| 24 | |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 25 | fadt->pm1a_evt_blk = pmbase; |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 26 | fadt->pm1a_cnt_blk = pmbase + PM1_CNT; |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 27 | fadt->pm2_cnt_blk = pmbase + PM2_CNT; |
| 28 | fadt->pm_tmr_blk = pmbase + PM1_TMR; |
| 29 | fadt->gpe0_blk = pmbase + GPE0_STS; |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 30 | |
| 31 | fadt->pm1_evt_len = 4; |
Angel Pons | f4bbea0 | 2020-06-21 15:57:15 +0200 | [diff] [blame] | 32 | fadt->pm1_cnt_len = 2; /* Upper word is reserved and |
| 33 | Linux complains about 32 bit. */ |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 34 | fadt->pm2_cnt_len = 1; |
| 35 | fadt->pm_tmr_len = 4; |
| 36 | fadt->gpe0_blk_len = 8; |
Angel Pons | 741508b | 2020-06-21 15:56:13 +0200 | [diff] [blame] | 37 | fadt->p_lvl2_lat = 1; |
| 38 | fadt->p_lvl3_lat = chip->c3_latency; |
Angel Pons | 741508b | 2020-06-21 15:56:13 +0200 | [diff] [blame] | 39 | fadt->duty_offset = 1; |
| 40 | if (chip->p_cnt_throttling_supported) |
| 41 | fadt->duty_width = 3; |
| 42 | else |
| 43 | fadt->duty_width = 0; |
| 44 | fadt->day_alrm = 0xd; |
| 45 | fadt->mon_alrm = 0x00; |
Angel Pons | f4bbea0 | 2020-06-21 15:57:15 +0200 | [diff] [blame] | 46 | fadt->iapc_boot_arch = ACPI_FADT_8042 | ACPI_FADT_LEGACY_DEVICES; |
Angel Pons | a208c6c | 2020-07-13 00:02:34 +0200 | [diff] [blame] | 47 | fadt->flags |= (ACPI_FADT_WBINVD | ACPI_FADT_C1_SUPPORTED |
Angel Pons | 741508b | 2020-06-21 15:56:13 +0200 | [diff] [blame] | 48 | | ACPI_FADT_SLEEP_BUTTON | ACPI_FADT_S4_RTC_WAKE |
Angel Pons | 79572e4 | 2020-07-13 00:17:43 +0200 | [diff] [blame] | 49 | | ACPI_FADT_PLATFORM_CLOCK | ACPI_FADT_C2_MP_SUPPORTED); |
Angel Pons | 741508b | 2020-06-21 15:56:13 +0200 | [diff] [blame] | 50 | if (chip->docking_supported) |
| 51 | fadt->flags |= ACPI_FADT_DOCKING_SUPPORTED; |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 52 | |
Angel Pons | f4bbea0 | 2020-06-21 15:57:15 +0200 | [diff] [blame] | 53 | fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO; |
Elyes Haouas | a6e05382 | 2022-10-11 12:55:36 +0200 | [diff] [blame] | 54 | fadt->x_pm1a_evt_blk.bit_width = fadt->pm1_evt_len * 8; |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 55 | fadt->x_pm1a_evt_blk.bit_offset = 0; |
Angel Pons | 12a4d05 | 2020-07-14 01:31:27 +0200 | [diff] [blame] | 56 | fadt->x_pm1a_evt_blk.access_size = ACPI_ACCESS_SIZE_WORD_ACCESS; |
Felix Held | 769b657 | 2022-10-14 18:32:52 +0200 | [diff] [blame] | 57 | fadt->x_pm1a_evt_blk.addrl = fadt->pm1a_evt_blk; |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 58 | fadt->x_pm1a_evt_blk.addrh = 0x0; |
| 59 | |
Angel Pons | f4bbea0 | 2020-06-21 15:57:15 +0200 | [diff] [blame] | 60 | fadt->x_pm1a_cnt_blk.space_id = ACPI_ADDRESS_SPACE_IO; |
Elyes Haouas | 7008085 | 2022-10-11 13:09:35 +0200 | [diff] [blame] | 61 | fadt->x_pm1a_cnt_blk.bit_width = fadt->pm1_cnt_len * 8; |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 62 | fadt->x_pm1a_cnt_blk.bit_offset = 0; |
| 63 | fadt->x_pm1a_cnt_blk.access_size = ACPI_ACCESS_SIZE_WORD_ACCESS; |
Elyes Haouas | c60f3b2 | 2022-10-11 14:02:27 +0200 | [diff] [blame] | 64 | fadt->x_pm1a_cnt_blk.addrl = fadt->pm1a_cnt_blk; |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 65 | fadt->x_pm1a_cnt_blk.addrh = 0x0; |
| 66 | |
Angel Pons | f4bbea0 | 2020-06-21 15:57:15 +0200 | [diff] [blame] | 67 | fadt->x_pm2_cnt_blk.space_id = ACPI_ADDRESS_SPACE_IO; |
Elyes Haouas | 85f87e8 | 2022-10-11 13:45:44 +0200 | [diff] [blame] | 68 | fadt->x_pm2_cnt_blk.bit_width = fadt->pm2_cnt_len * 8; |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 69 | fadt->x_pm2_cnt_blk.bit_offset = 0; |
| 70 | fadt->x_pm2_cnt_blk.access_size = ACPI_ACCESS_SIZE_BYTE_ACCESS; |
Felix Held | 96fa237 | 2022-10-14 18:41:03 +0200 | [diff] [blame] | 71 | fadt->x_pm2_cnt_blk.addrl = fadt->pm2_cnt_blk; |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 72 | fadt->x_pm2_cnt_blk.addrh = 0x0; |
| 73 | |
Angel Pons | f4bbea0 | 2020-06-21 15:57:15 +0200 | [diff] [blame] | 74 | fadt->x_pm_tmr_blk.space_id = ACPI_ADDRESS_SPACE_IO; |
Elyes Haouas | 501b71e | 2022-10-11 13:15:37 +0200 | [diff] [blame] | 75 | fadt->x_pm_tmr_blk.bit_width = fadt->pm_tmr_len * 8; |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 76 | fadt->x_pm_tmr_blk.bit_offset = 0; |
| 77 | fadt->x_pm_tmr_blk.access_size = ACPI_ACCESS_SIZE_DWORD_ACCESS; |
Elyes Haouas | 987f1f4 | 2022-10-11 13:56:30 +0200 | [diff] [blame] | 78 | fadt->x_pm_tmr_blk.addrl = fadt->pm_tmr_blk; |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 79 | fadt->x_pm_tmr_blk.addrh = 0x0; |
| 80 | |
Angel Pons | f4bbea0 | 2020-06-21 15:57:15 +0200 | [diff] [blame] | 81 | fadt->x_gpe0_blk.space_id = ACPI_ADDRESS_SPACE_IO; |
Elyes Haouas | baec560 | 2022-10-11 13:20:43 +0200 | [diff] [blame] | 82 | fadt->x_gpe0_blk.bit_width = fadt->gpe0_blk_len * 8; |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 83 | fadt->x_gpe0_blk.bit_offset = 0; |
| 84 | fadt->x_gpe0_blk.access_size = ACPI_ACCESS_SIZE_BYTE_ACCESS; |
Elyes Haouas | c929f09 | 2022-10-11 13:40:51 +0200 | [diff] [blame] | 85 | fadt->x_gpe0_blk.addrl = fadt->gpe0_blk; |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 86 | fadt->x_gpe0_blk.addrh = 0x0; |
Angel Pons | 3fc2dc4 | 2020-06-21 15:53:03 +0200 | [diff] [blame] | 87 | } |