1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/pci_ops.h>
5 #include <cpu/x86/smm.h>
7 #include <southbridge/intel/common/pmutil.h>
9 void acpi_fill_fadt(acpi_fadt_t
*fadt
)
11 u16 pmbase
= pci_read_config16(pcidev_on_root(0x1f, 0), 0x40) & 0xfffe;
15 if (permanent_smi_handler()) {
16 fadt
->smi_cmd
= APM_CNT
;
17 fadt
->acpi_enable
= APM_CNT_ACPI_ENABLE
;
18 fadt
->acpi_disable
= APM_CNT_ACPI_DISABLE
;
21 fadt
->pm1a_evt_blk
= pmbase
;
22 fadt
->pm1a_cnt_blk
= pmbase
+ PM1_CNT
;
23 fadt
->pm2_cnt_blk
= pmbase
+ PM2_CNT
;
24 fadt
->pm_tmr_blk
= pmbase
+ PM1_TMR
;
25 fadt
->gpe0_blk
= pmbase
+ GPE0_STS
;
27 fadt
->pm1_evt_len
= 4;
28 fadt
->pm1_cnt_len
= 2; /* Upper word is reserved and
29 Linux complains about 32 bit. */
30 fadt
->pm2_cnt_len
= 1;
32 fadt
->gpe0_blk_len
= 16;
34 fadt
->p_lvl3_lat
= 0; /* FIXME: Is this correct? */
35 fadt
->duty_offset
= 1;
38 fadt
->mon_alrm
= 0x00;
39 fadt
->iapc_boot_arch
= ACPI_FADT_8042
| ACPI_FADT_LEGACY_DEVICES
;
40 fadt
->flags
|= (ACPI_FADT_WBINVD
| ACPI_FADT_C1_SUPPORTED
41 | ACPI_FADT_SLEEP_BUTTON
| ACPI_FADT_S4_RTC_WAKE
42 | ACPI_FADT_PLATFORM_CLOCK
| ACPI_FADT_C2_MP_SUPPORTED
);
44 fadt
->x_pm1a_evt_blk
.space_id
= ACPI_ADDRESS_SPACE_IO
;
45 fadt
->x_pm1a_evt_blk
.bit_width
= fadt
->pm1_evt_len
* 8;
46 fadt
->x_pm1a_evt_blk
.bit_offset
= 0;
47 fadt
->x_pm1a_evt_blk
.access_size
= ACPI_ACCESS_SIZE_WORD_ACCESS
;
48 fadt
->x_pm1a_evt_blk
.addrl
= fadt
->pm1a_evt_blk
;
49 fadt
->x_pm1a_evt_blk
.addrh
= 0x0;
51 fadt
->x_pm1a_cnt_blk
.space_id
= ACPI_ADDRESS_SPACE_IO
;
52 fadt
->x_pm1a_cnt_blk
.bit_width
= fadt
->pm1_cnt_len
* 8;
53 fadt
->x_pm1a_cnt_blk
.bit_offset
= 0;
54 fadt
->x_pm1a_cnt_blk
.access_size
= ACPI_ACCESS_SIZE_WORD_ACCESS
;
55 fadt
->x_pm1a_cnt_blk
.addrl
= fadt
->pm1a_cnt_blk
;
56 fadt
->x_pm1a_cnt_blk
.addrh
= 0x0;
58 fadt
->x_pm2_cnt_blk
.space_id
= ACPI_ADDRESS_SPACE_IO
;
59 fadt
->x_pm2_cnt_blk
.bit_width
= fadt
->pm2_cnt_len
* 8;
60 fadt
->x_pm2_cnt_blk
.bit_offset
= 0;
61 fadt
->x_pm2_cnt_blk
.access_size
= ACPI_ACCESS_SIZE_BYTE_ACCESS
;
62 fadt
->x_pm2_cnt_blk
.addrl
= fadt
->pm2_cnt_blk
;
63 fadt
->x_pm2_cnt_blk
.addrh
= 0x0;
65 fadt
->x_pm_tmr_blk
.space_id
= ACPI_ADDRESS_SPACE_IO
;
66 fadt
->x_pm_tmr_blk
.bit_width
= fadt
->pm_tmr_len
* 8;
67 fadt
->x_pm_tmr_blk
.bit_offset
= 0;
68 fadt
->x_pm_tmr_blk
.access_size
= ACPI_ACCESS_SIZE_DWORD_ACCESS
;
69 fadt
->x_pm_tmr_blk
.addrl
= fadt
->pm_tmr_blk
;
70 fadt
->x_pm_tmr_blk
.addrh
= 0x0;
72 fadt
->x_gpe0_blk
.space_id
= ACPI_ADDRESS_SPACE_IO
;
73 fadt
->x_gpe0_blk
.bit_width
= fadt
->gpe0_blk_len
* 8;
74 fadt
->x_gpe0_blk
.bit_offset
= 0;
75 fadt
->x_gpe0_blk
.access_size
= ACPI_ACCESS_SIZE_BYTE_ACCESS
;
76 fadt
->x_gpe0_blk
.addrl
= fadt
->gpe0_blk
;
77 fadt
->x_gpe0_blk
.addrh
= 0x0;