blob: a9b9949fdfc0d55c161e7657bc85752b84fb3368 [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Tobias Diedriche87c38e2010-11-27 09:40:16 +00002
3#include <console/console.h>
Furquan Shaikh76cedd22020-05-02 10:24:23 -07004#include <acpi/acpi.h>
5#include <acpi/acpigen.h>
Tobias Diedriche87c38e2010-11-27 09:40:16 +00006#include <device/device.h>
Tobias Diedrichb672d942010-12-08 21:40:12 +00007#include "i82371eb.h"
Tobias Diedriche87c38e2010-11-27 09:40:16 +00008
Kyösti Mälkkid48982a2023-04-12 20:01:46 +03009static void generate_cpu_entry(int cpu)
10{
Kyösti Mälkki5fc0afb2023-04-14 01:06:22 +030011 acpigen_write_processor_device(cpu);
Kyösti Mälkkid48982a2023-04-12 20:01:46 +030012
Kyösti Mälkki5fc0afb2023-04-14 01:06:22 +030013 /* 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älkkid48982a2023-04-12 20:01:46 +030017}
18
Furquan Shaikh7536a392020-04-24 21:59:21 -070019void generate_cpu_entries(const struct device *device)
Tobias Diedrichb672d942010-12-08 21:40:12 +000020{
Kyösti Mälkkid48982a2023-04-12 20:01:46 +030021 int cpu;
Kyösti Mälkki8e614602023-04-12 21:25:16 +030022 int numcpus = dev_count_cpu();
Kyösti Mälkkid48982a2023-04-12 20:01:46 +030023
Tobias Diedrichb672d942010-12-08 21:40:12 +000024 printk(BIOS_DEBUG, "Found %d CPU(s).\n", numcpus);
25
Martin Roth26f97f92021-10-01 14:53:22 -060026 /* without the outer scope, further ssdt addition will end up
Tobias Diedrichb672d942010-12-08 21:40:12 +000027 * within the processor statement */
Christian Walterbe3979c2019-12-18 15:07:59 +010028 acpigen_write_scope("\\_SB");
Kyösti Mälkkid48982a2023-04-12 20:01:46 +030029
30 for (cpu = 0; cpu < numcpus; cpu++)
31 generate_cpu_entry(cpu);
32
Vladimir Serbinenko41877d82014-09-01 22:18:01 +020033 acpigen_pop_len();
Tobias Diedrichb672d942010-12-08 21:40:12 +000034}