Angel Pons | 182dbde | 2020-04-02 23:49:05 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 2 | |
| 3 | #include <console/console.h> |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 4 | #include <acpi/acpi.h> |
| 5 | #include <acpi/acpigen.h> |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 6 | #include <device/device.h> |
Tobias Diedrich | b672d94 | 2010-12-08 21:40:12 +0000 | [diff] [blame] | 7 | #include "i82371eb.h" |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 8 | |
Kyösti Mälkki | d48982a | 2023-04-12 20:01:46 +0300 | [diff] [blame] | 9 | static void generate_cpu_entry(int cpu) |
| 10 | { |
Kyösti Mälkki | 5fc0afb | 2023-04-14 01:06:22 +0300 | [diff] [blame] | 11 | acpigen_write_processor_device(cpu); |
Kyösti Mälkki | d48982a | 2023-04-12 20:01:46 +0300 | [diff] [blame] | 12 | |
Kyösti Mälkki | 5fc0afb | 2023-04-14 01:06:22 +0300 | [diff] [blame] | 13 | /* bit 1:3 in PCNTRL reg (pmbase+0x10) */ |
| 14 | acpigen_write_PTC(3, 1, DEFAULT_PMBASE + PCNTRL); |
| 15 | |
| 16 | acpigen_write_processor_device_end(); |
Kyösti Mälkki | d48982a | 2023-04-12 20:01:46 +0300 | [diff] [blame] | 17 | } |
| 18 | |
Furquan Shaikh | 7536a39 | 2020-04-24 21:59:21 -0700 | [diff] [blame] | 19 | void generate_cpu_entries(const struct device *device) |
Tobias Diedrich | b672d94 | 2010-12-08 21:40:12 +0000 | [diff] [blame] | 20 | { |
Kyösti Mälkki | d48982a | 2023-04-12 20:01:46 +0300 | [diff] [blame] | 21 | int cpu; |
Kyösti Mälkki | 8e61460 | 2023-04-12 21:25:16 +0300 | [diff] [blame] | 22 | int numcpus = dev_count_cpu(); |
Kyösti Mälkki | d48982a | 2023-04-12 20:01:46 +0300 | [diff] [blame] | 23 | |
Tobias Diedrich | b672d94 | 2010-12-08 21:40:12 +0000 | [diff] [blame] | 24 | printk(BIOS_DEBUG, "Found %d CPU(s).\n", numcpus); |
| 25 | |
Martin Roth | 26f97f9 | 2021-10-01 14:53:22 -0600 | [diff] [blame] | 26 | /* without the outer scope, further ssdt addition will end up |
Tobias Diedrich | b672d94 | 2010-12-08 21:40:12 +0000 | [diff] [blame] | 27 | * within the processor statement */ |
Christian Walter | be3979c | 2019-12-18 15:07:59 +0100 | [diff] [blame] | 28 | acpigen_write_scope("\\_SB"); |
Kyösti Mälkki | d48982a | 2023-04-12 20:01:46 +0300 | [diff] [blame] | 29 | |
| 30 | for (cpu = 0; cpu < numcpus; cpu++) |
| 31 | generate_cpu_entry(cpu); |
| 32 | |
Vladimir Serbinenko | 41877d8 | 2014-09-01 22:18:01 +0200 | [diff] [blame] | 33 | acpigen_pop_len(); |
Tobias Diedrich | b672d94 | 2010-12-08 21:40:12 +0000 | [diff] [blame] | 34 | } |