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