• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 /*
4  * ACPI - create the Fixed ACPI Description Tables (FADT)
5  */
6 
7 #include <console/console.h>
8 #include <acpi/acpi.h>
9 #include <acpi/acpigen.h>
10 #include <device/pci_ops.h>
11 #include <arch/ioapic.h>
12 #include <arch/smp/mpspec.h>
13 #include <device/device.h>
14 #include <device/pci.h>
15 #include <gpio.h>
16 #include <amdblocks/acpimmio.h>
17 #include <amdblocks/acpi.h>
18 #include <amdblocks/cpu.h>
19 #include <amdblocks/ioapic.h>
20 #include <soc/acpi.h>
21 #include <soc/pci_devs.h>
22 #include <soc/southbridge.h>
23 #include <soc/northbridge.h>
24 
25 /*
26  * Reference section 5.2.9 Fixed ACPI Description Table (FADT)
27  * in the ACPI 3.0b specification.
28  */
acpi_fill_fadt(acpi_fadt_t * fadt)29 void acpi_fill_fadt(acpi_fadt_t *fadt)
30 {
31 	printk(BIOS_DEBUG, "pm_base: 0x%04x\n", ACPI_IO_BASE);
32 
33 
34 	fadt->pm1a_evt_blk = ACPI_PM_EVT_BLK;
35 	fadt->pm1a_cnt_blk = ACPI_PM1_CNT_BLK;
36 	fadt->pm_tmr_blk = ACPI_PM_TMR_BLK;
37 	fadt->gpe0_blk = ACPI_GPE0_BLK;
38 
39 	fadt->pm1_evt_len = 4;	/* 32 bits */
40 	fadt->pm1_cnt_len = 2;	/* 16 bits */
41 	fadt->pm_tmr_len = 4;	/* 32 bits */
42 	fadt->gpe0_blk_len = 8;	/* 64 bits */
43 
44 	fill_fadt_extended_pm_io(fadt);
45 
46 	fadt->duty_offset = 1;	/* CLK_VAL bits 3:1 */
47 	fadt->duty_width = 3;	/* CLK_VAL bits 3:1 */
48 	fadt->iapc_boot_arch = FADT_BOOT_ARCH;	/* See table 5-10 */
49 	fadt->flags |= ACPI_FADT_WBINVD | /* See table 5-10 ACPI 3.0a spec */
50 				ACPI_FADT_C1_SUPPORTED |
51 				ACPI_FADT_SLEEP_BUTTON |
52 				ACPI_FADT_S4_RTC_WAKE |
53 				ACPI_FADT_32BIT_TIMER |
54 				ACPI_FADT_PCI_EXPRESS_WAKE |
55 				ACPI_FADT_PLATFORM_CLOCK |
56 				ACPI_FADT_S4_RTC_VALID |
57 				ACPI_FADT_REMOTE_POWER_ON;
58 }
59 
60 const acpi_cstate_t cstate_cfg_table[] = {
61 	[0] = {
62 		.ctype = 1,
63 		.latency = 1,
64 		.power = 0,
65 	},
66 	[1] = {
67 		.ctype = 2,
68 		.latency = 400,
69 		.power = 0,
70 	},
71 };
72 
get_cstate_config_data(size_t * size)73 const acpi_cstate_t *get_cstate_config_data(size_t *size)
74 {
75 	*size = ARRAY_SIZE(cstate_cfg_table);
76 	return cstate_cfg_table;
77 }
78