1 // SPDX-License-Identifier: GPL-2.0-only
3 * acpi_processor.c - ACPI processor enumeration support
5 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
6 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
7 * Copyright (C) 2004 Dominik Brodowski <linux@brodo.de>
8 * Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
9 * Copyright (C) 2013, Intel Corporation
10 * Rafael J. Wysocki <rafael.j.wysocki@intel.com>
12 #define pr_fmt(fmt) "ACPI: " fmt
14 #include <linux/acpi.h>
15 #include <linux/device.h>
16 #include <linux/dmi.h>
17 #include <linux/kernel.h>
18 #include <linux/module.h>
19 #include <linux/pci.h>
20 #include <linux/platform_device.h>
22 #include <acpi/processor.h>
30 DEFINE_PER_CPU(struct acpi_processor *, processors);
31 EXPORT_PER_CPU_SYMBOL(processors);
34 struct acpi_processor_errata errata __read_mostly;
35 EXPORT_SYMBOL_GPL(errata);
37 static int acpi_processor_errata_piix4(struct pci_dev *dev)
47 * Note that 'dev' references the PIIX4 ACPI Controller.
50 switch (dev->revision) {
52 dev_dbg(&dev->dev, "Found PIIX4 A-step\n");
55 dev_dbg(&dev->dev, "Found PIIX4 B-step\n");
58 dev_dbg(&dev->dev, "Found PIIX4E\n");
61 dev_dbg(&dev->dev, "Found PIIX4M\n");
64 dev_dbg(&dev->dev, "Found unknown PIIX4\n");
68 switch (dev->revision) {
70 case 0: /* PIIX4 A-step */
71 case 1: /* PIIX4 B-step */
73 * See specification changes #13 ("Manual Throttle Duty Cycle")
74 * and #14 ("Enabling and Disabling Manual Throttle"), plus
75 * erratum #5 ("STPCLK# Deassertion Time") from the January
76 * 2002 PIIX4 specification update. Applies to only older
79 errata.piix4.throttle = 1;
85 * See erratum #18 ("C3 Power State/BMIDE and Type-F DMA
86 * Livelock") from the January 2002 PIIX4 specification update.
87 * Applies to all PIIX4 models.
93 * Find the PIIX4 IDE Controller and get the Bus Master IDE
94 * Status register address. We'll use this later to read
95 * each IDE controller's DMA status to make sure we catch all
98 dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
99 PCI_DEVICE_ID_INTEL_82371AB,
100 PCI_ANY_ID, PCI_ANY_ID, NULL);
102 errata.piix4.bmisx = pci_resource_start(dev, 4);
109 * Find the PIIX4 ISA Controller and read the Motherboard
110 * DMA controller's status to see if Type-F (Fast) DMA mode
111 * is enabled (bit 7) on either channel. Note that we'll
112 * disable C3 support if this is enabled, as some legacy
113 * devices won't operate well if fast DMA is disabled.
115 dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
116 PCI_DEVICE_ID_INTEL_82371AB_0,
117 PCI_ANY_ID, PCI_ANY_ID, NULL);
119 pci_read_config_byte(dev, 0x76, &value1);
120 pci_read_config_byte(dev, 0x77, &value2);
121 if ((value1 & 0x80) || (value2 & 0x80))
122 errata.piix4.fdma = 1;
129 if (errata.piix4.bmisx)
130 dev_dbg(&dev->dev, "Bus master activity detection (BM-IDE) erratum enabled\n");
131 if (errata.piix4.fdma)
132 dev_dbg(&dev->dev, "Type-F DMA livelock erratum (C3 disabled)\n");
137 static int acpi_processor_errata(void)
140 struct pci_dev *dev = NULL;
145 dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
146 PCI_DEVICE_ID_INTEL_82371AB_3, PCI_ANY_ID,
149 result = acpi_processor_errata_piix4(dev);
156 /* Create a platform device to represent a CPU frequency control mechanism. */
157 static void cpufreq_add_device(const char *name)
159 struct platform_device *pdev;
161 pdev = platform_device_register_simple(name, PLATFORM_DEVID_NONE, NULL, 0);
163 pr_info("%s device creation failed: %ld\n", name, PTR_ERR(pdev));
167 /* Check presence of Processor Clocking Control by searching for \_SB.PCCH. */
168 static void __init acpi_pcc_cpufreq_init(void)
173 status = acpi_get_handle(NULL, "\\_SB", &handle);
174 if (ACPI_FAILURE(status))
177 if (acpi_has_method(handle, "PCCH"))
178 cpufreq_add_device("pcc-cpufreq");
181 static void __init acpi_pcc_cpufreq_init(void) {}
182 #endif /* CONFIG_X86 */
185 #ifdef CONFIG_ACPI_HOTPLUG_CPU
186 int __weak acpi_map_cpu(acpi_handle handle,
187 phys_cpuid_t physid, u32 acpi_id, int *pcpu)
192 int __weak acpi_unmap_cpu(int cpu)
197 int __weak arch_register_cpu(int cpu)
202 void __weak arch_unregister_cpu(int cpu) {}
204 static int acpi_processor_hotadd_init(struct acpi_processor *pr)
206 unsigned long long sta;
210 if (invalid_phys_cpuid(pr->phys_id))
213 status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta);
214 if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
217 cpu_maps_update_begin();
220 ret = acpi_map_cpu(pr->handle, pr->phys_id, pr->acpi_id, &pr->id);
224 ret = arch_register_cpu(pr->id);
226 acpi_unmap_cpu(pr->id);
231 * CPU got hot-added, but cpu_data is not initialized yet. Set a flag
232 * to delay cpu_idle/throttling initialization and do it when the CPU
233 * gets online for the first time.
235 pr_info("CPU%d has been hot-added\n", pr->id);
236 pr->flags.need_hotplug_init = 1;
240 cpu_maps_update_done();
244 static inline int acpi_processor_hotadd_init(struct acpi_processor *pr)
248 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
250 static int acpi_processor_get_info(struct acpi_device *device)
252 union acpi_object object = { 0 };
253 struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
254 struct acpi_processor *pr = acpi_driver_data(device);
255 int device_declaration = 0;
256 acpi_status status = AE_OK;
257 static int cpu0_initialized;
258 unsigned long long value;
260 acpi_processor_errata();
263 * Check to see if we have bus mastering arbitration control. This
264 * is required for proper C3 usage (to maintain cache coherency).
266 if (acpi_gbl_FADT.pm2_control_block && acpi_gbl_FADT.pm2_control_length) {
267 pr->flags.bm_control = 1;
268 dev_dbg(&device->dev, "Bus mastering arbitration control present\n");
270 dev_dbg(&device->dev, "No bus mastering arbitration control\n");
272 if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) {
273 /* Declared with "Processor" statement; match ProcessorID */
274 status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
275 if (ACPI_FAILURE(status)) {
276 dev_err(&device->dev,
277 "Failed to evaluate processor object (0x%x)\n",
282 pr->acpi_id = object.processor.proc_id;
285 * Declared with "Device" statement; match _UID.
287 status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID,
289 if (ACPI_FAILURE(status)) {
290 dev_err(&device->dev,
291 "Failed to evaluate processor _UID (0x%x)\n",
295 device_declaration = 1;
299 if (acpi_duplicate_processor_id(pr->acpi_id)) {
300 if (pr->acpi_id == 0xff)
301 dev_info_once(&device->dev,
302 "Entry not well-defined, consider updating BIOS\n");
304 dev_err(&device->dev,
305 "Failed to get unique processor _UID (0x%x)\n",
310 pr->phys_id = acpi_get_phys_id(pr->handle, device_declaration,
312 if (invalid_phys_cpuid(pr->phys_id))
313 dev_dbg(&device->dev, "Failed to get CPU physical ID.\n");
315 pr->id = acpi_map_cpuid(pr->phys_id, pr->acpi_id);
316 if (!cpu0_initialized) {
317 cpu0_initialized = 1;
319 * Handle UP system running SMP kernel, with no CPU
322 if (!acpi_has_cpu_in_madt() && invalid_logical_cpuid(pr->id) &&
323 (num_online_cpus() == 1))
326 * Check availability of Processor Performance Control by
327 * looking at the presence of the _PCT object under the first
328 * processor definition.
330 if (acpi_has_method(pr->handle, "_PCT"))
331 cpufreq_add_device("acpi-cpufreq");
335 * Extra Processor objects may be enumerated on MP systems with
336 * less than the max # of CPUs. They should be ignored _iff
337 * they are physically not present.
339 * NOTE: Even if the processor has a cpuid, it may not be present
340 * because cpuid <-> apicid mapping is persistent now.
342 if (invalid_logical_cpuid(pr->id) || !cpu_present(pr->id)) {
343 int ret = acpi_processor_hotadd_init(pr);
350 * On some boxes several processors use the same processor bus id.
351 * But they are located in different scope. For example:
354 * Rename the processor device bus id. And the new bus id will be
355 * generated as the following format:
358 sprintf(acpi_device_bid(device), "CPU%X", pr->id);
359 dev_dbg(&device->dev, "Processor [%d:%d]\n", pr->id, pr->acpi_id);
361 if (!object.processor.pblk_address)
362 dev_dbg(&device->dev, "No PBLK (NULL address)\n");
363 else if (object.processor.pblk_length != 6)
364 dev_err(&device->dev, "Invalid PBLK length [%d]\n",
365 object.processor.pblk_length);
367 pr->throttling.address = object.processor.pblk_address;
368 pr->throttling.duty_offset = acpi_gbl_FADT.duty_offset;
369 pr->throttling.duty_width = acpi_gbl_FADT.duty_width;
371 pr->pblk = object.processor.pblk_address;
375 * If ACPI describes a slot number for this CPU, we can use it to
376 * ensure we get the right value in the "physical id" field
379 status = acpi_evaluate_integer(pr->handle, "_SUN", NULL, &value);
380 if (ACPI_SUCCESS(status))
381 arch_fix_phys_package_id(pr->id, value);
387 * Do not put anything in here which needs the core to be online.
388 * For example MSR access or setting up things which check for cpuinfo_x86
389 * (cpu_data(cpu)) values, like CPU feature flags, family, model, etc.
390 * Such things have to be put in and set up by the processor driver's .probe().
392 static DEFINE_PER_CPU(void *, processor_device_array);
394 static int acpi_processor_add(struct acpi_device *device,
395 const struct acpi_device_id *id)
397 struct acpi_processor *pr;
401 pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
405 if (!zalloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) {
410 pr->handle = device->handle;
411 strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME);
412 strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS);
413 device->driver_data = pr;
415 result = acpi_processor_get_info(device);
416 if (result) /* Processor is not physically present or unavailable */
419 BUG_ON(pr->id >= nr_cpu_ids);
423 * ACPI id of processors can be reported wrongly by the BIOS.
424 * Don't trust it blindly
426 if (per_cpu(processor_device_array, pr->id) != NULL &&
427 per_cpu(processor_device_array, pr->id) != device) {
428 dev_warn(&device->dev,
429 "BIOS reported wrong ACPI id %d for the processor\n",
431 /* Give up, but do not abort the namespace scan. */
435 * processor_device_array is not cleared on errors to allow buggy BIOS
438 per_cpu(processor_device_array, pr->id) = device;
439 per_cpu(processors, pr->id) = pr;
441 dev = get_cpu_device(pr->id);
447 result = acpi_bind_one(dev, device);
453 /* Trigger the processor driver's .probe() if present. */
454 if (device_attach(dev) >= 0)
457 dev_err(dev, "Processor driver could not be attached\n");
458 acpi_unbind_one(dev);
461 free_cpumask_var(pr->throttling.shared_cpu_map);
462 device->driver_data = NULL;
463 per_cpu(processors, pr->id) = NULL;
469 #ifdef CONFIG_ACPI_HOTPLUG_CPU
471 static void acpi_processor_remove(struct acpi_device *device)
473 struct acpi_processor *pr;
475 if (!device || !acpi_driver_data(device))
478 pr = acpi_driver_data(device);
479 if (pr->id >= nr_cpu_ids)
483 * The only reason why we ever get here is CPU hot-removal. The CPU is
484 * already offline and the ACPI device removal locking prevents it from
485 * being put back online at this point.
487 * Unbind the driver from the processor device and detach it from the
488 * ACPI companion object.
490 device_release_driver(pr->dev);
491 acpi_unbind_one(pr->dev);
494 per_cpu(processor_device_array, pr->id) = NULL;
495 per_cpu(processors, pr->id) = NULL;
497 cpu_maps_update_begin();
500 /* Remove the CPU. */
501 arch_unregister_cpu(pr->id);
502 acpi_unmap_cpu(pr->id);
505 cpu_maps_update_done();
507 try_offline_node(cpu_to_node(pr->id));
510 free_cpumask_var(pr->throttling.shared_cpu_map);
513 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
515 #ifdef CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC
516 bool __init processor_physically_present(acpi_handle handle)
521 acpi_object_type acpi_type;
522 unsigned long long tmp;
523 union acpi_object object = {};
524 struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
526 status = acpi_get_type(handle, &acpi_type);
527 if (ACPI_FAILURE(status))
531 case ACPI_TYPE_PROCESSOR:
532 status = acpi_evaluate_object(handle, NULL, NULL, &buffer);
533 if (ACPI_FAILURE(status))
535 acpi_id = object.processor.proc_id;
537 case ACPI_TYPE_DEVICE:
538 status = acpi_evaluate_integer(handle, METHOD_NAME__UID,
540 if (ACPI_FAILURE(status))
548 if (xen_initial_domain())
550 * When running as a Xen dom0 the number of processors Linux
551 * sees can be different from the real number of processors on
552 * the system, and we still need to execute _PDC or _OSC for
555 return xen_processor_present(acpi_id);
557 type = (acpi_type == ACPI_TYPE_DEVICE) ? 1 : 0;
558 cpuid = acpi_get_cpuid(handle, type, acpi_id);
560 return !invalid_logical_cpuid(cpuid);
563 /* vendor specific UUID indicating an Intel platform */
564 static u8 sb_uuid_str[] = "4077A616-290C-47BE-9EBD-D87058713953";
566 static acpi_status __init acpi_processor_osc(acpi_handle handle, u32 lvl,
567 void *context, void **rv)
570 struct acpi_osc_context osc_context = {
571 .uuid_str = sb_uuid_str,
574 .cap.pointer = capbuf,
578 if (!processor_physically_present(handle))
581 arch_acpi_set_proc_cap_bits(&capbuf[OSC_SUPPORT_DWORD]);
583 status = acpi_run_osc(handle, &osc_context);
584 if (ACPI_FAILURE(status))
587 kfree(osc_context.ret.pointer);
592 static bool __init acpi_early_processor_osc(void)
596 acpi_proc_quirk_mwait_check();
598 status = acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
599 ACPI_UINT32_MAX, acpi_processor_osc, NULL,
601 if (ACPI_FAILURE(status))
604 status = acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, acpi_processor_osc,
606 if (ACPI_FAILURE(status))
612 void __init acpi_early_processor_control_setup(void)
614 if (acpi_early_processor_osc()) {
615 pr_info("_OSC evaluated successfully for all CPUs\n");
617 pr_info("_OSC evaluation for CPUs failed, trying _PDC\n");
618 acpi_early_processor_set_pdc();
624 * The following ACPI IDs are known to be suitable for representing as
627 static const struct acpi_device_id processor_device_ids[] = {
629 { ACPI_PROCESSOR_OBJECT_HID, },
630 { ACPI_PROCESSOR_DEVICE_HID, },
635 static struct acpi_scan_handler processor_handler = {
636 .ids = processor_device_ids,
637 .attach = acpi_processor_add,
638 #ifdef CONFIG_ACPI_HOTPLUG_CPU
639 .detach = acpi_processor_remove,
646 static int acpi_processor_container_attach(struct acpi_device *dev,
647 const struct acpi_device_id *id)
652 static const struct acpi_device_id processor_container_ids[] = {
653 { ACPI_PROCESSOR_CONTAINER_HID, },
657 static struct acpi_scan_handler processor_container_handler = {
658 .ids = processor_container_ids,
659 .attach = acpi_processor_container_attach,
662 /* The number of the unique processor IDs */
663 static int nr_unique_ids __initdata;
665 /* The number of the duplicate processor IDs */
666 static int nr_duplicate_ids;
668 /* Used to store the unique processor IDs */
669 static int unique_processor_ids[] __initdata = {
670 [0 ... NR_CPUS - 1] = -1,
673 /* Used to store the duplicate processor IDs */
674 static int duplicate_processor_ids[] = {
675 [0 ... NR_CPUS - 1] = -1,
678 static void __init processor_validated_ids_update(int proc_id)
682 if (nr_unique_ids == NR_CPUS||nr_duplicate_ids == NR_CPUS)
686 * Firstly, compare the proc_id with duplicate IDs, if the proc_id is
687 * already in the IDs, do nothing.
689 for (i = 0; i < nr_duplicate_ids; i++) {
690 if (duplicate_processor_ids[i] == proc_id)
695 * Secondly, compare the proc_id with unique IDs, if the proc_id is in
696 * the IDs, put it in the duplicate IDs.
698 for (i = 0; i < nr_unique_ids; i++) {
699 if (unique_processor_ids[i] == proc_id) {
700 duplicate_processor_ids[nr_duplicate_ids] = proc_id;
707 * Lastly, the proc_id is a unique ID, put it in the unique IDs.
709 unique_processor_ids[nr_unique_ids] = proc_id;
713 static acpi_status __init acpi_processor_ids_walk(acpi_handle handle,
719 acpi_object_type acpi_type;
720 unsigned long long uid;
721 union acpi_object object = { 0 };
722 struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
724 status = acpi_get_type(handle, &acpi_type);
725 if (ACPI_FAILURE(status))
729 case ACPI_TYPE_PROCESSOR:
730 status = acpi_evaluate_object(handle, NULL, NULL, &buffer);
731 if (ACPI_FAILURE(status))
733 uid = object.processor.proc_id;
736 case ACPI_TYPE_DEVICE:
737 status = acpi_evaluate_integer(handle, "_UID", NULL, &uid);
738 if (ACPI_FAILURE(status))
745 processor_validated_ids_update(uid);
749 /* Exit on error, but don't abort the namespace walk */
750 acpi_handle_info(handle, "Invalid processor object\n");
755 static void __init acpi_processor_check_duplicates(void)
757 /* check the correctness for all processors in ACPI namespace */
758 acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
760 acpi_processor_ids_walk,
762 acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, acpi_processor_ids_walk,
766 bool acpi_duplicate_processor_id(int proc_id)
771 * compare the proc_id with duplicate IDs, if the proc_id is already
772 * in the duplicate IDs, return true, otherwise, return false.
774 for (i = 0; i < nr_duplicate_ids; i++) {
775 if (duplicate_processor_ids[i] == proc_id)
781 void __init acpi_processor_init(void)
783 acpi_processor_check_duplicates();
784 acpi_scan_add_handler_with_hotplug(&processor_handler, "processor");
785 acpi_scan_add_handler(&processor_container_handler);
786 acpi_pcc_cpufreq_init();
789 #ifdef CONFIG_ACPI_PROCESSOR_CSTATE
791 * acpi_processor_claim_cst_control - Request _CST control from the platform.
793 bool acpi_processor_claim_cst_control(void)
795 static bool cst_control_claimed;
798 if (!acpi_gbl_FADT.cst_control || cst_control_claimed)
801 status = acpi_os_write_port(acpi_gbl_FADT.smi_command,
802 acpi_gbl_FADT.cst_control, 8);
803 if (ACPI_FAILURE(status)) {
804 pr_warn("ACPI: Failed to claim processor _CST control\n");
808 cst_control_claimed = true;
811 EXPORT_SYMBOL_GPL(acpi_processor_claim_cst_control);
814 * acpi_processor_evaluate_cst - Evaluate the processor _CST control method.
815 * @handle: ACPI handle of the processor object containing the _CST.
816 * @cpu: The numeric ID of the target CPU.
817 * @info: Object write the C-states information into.
819 * Extract the C-state information for the given CPU from the output of the _CST
820 * control method under the corresponding ACPI processor object (or processor
821 * device object) and populate @info with it.
823 * If any ACPI_ADR_SPACE_FIXED_HARDWARE C-states are found, invoke
824 * acpi_processor_ffh_cstate_probe() to verify them and update the
825 * cpu_cstate_entry data for @cpu.
827 int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu,
828 struct acpi_processor_power *info)
830 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
831 union acpi_object *cst;
837 status = acpi_evaluate_object(handle, "_CST", NULL, &buffer);
838 if (ACPI_FAILURE(status)) {
839 acpi_handle_debug(handle, "No _CST\n");
843 cst = buffer.pointer;
845 /* There must be at least 2 elements. */
846 if (!cst || cst->type != ACPI_TYPE_PACKAGE || cst->package.count < 2) {
847 acpi_handle_warn(handle, "Invalid _CST output\n");
852 count = cst->package.elements[0].integer.value;
854 /* Validate the number of C-states. */
855 if (count < 1 || count != cst->package.count - 1) {
856 acpi_handle_warn(handle, "Inconsistent _CST data\n");
861 for (i = 1; i <= count; i++) {
862 union acpi_object *element;
863 union acpi_object *obj;
864 struct acpi_power_register *reg;
865 struct acpi_processor_cx cx;
868 * If there is not enough space for all C-states, skip the
869 * excess ones and log a warning.
871 if (last_index >= ACPI_PROCESSOR_MAX_POWER - 1) {
872 acpi_handle_warn(handle,
873 "No room for more idle states (limit: %d)\n",
874 ACPI_PROCESSOR_MAX_POWER - 1);
878 memset(&cx, 0, sizeof(cx));
880 element = &cst->package.elements[i];
881 if (element->type != ACPI_TYPE_PACKAGE) {
882 acpi_handle_info(handle, "_CST C%d type(%x) is not package, skip...\n",
887 if (element->package.count != 4) {
888 acpi_handle_info(handle, "_CST C%d package count(%d) is not 4, skip...\n",
889 i, element->package.count);
893 obj = &element->package.elements[0];
895 if (obj->type != ACPI_TYPE_BUFFER) {
896 acpi_handle_info(handle, "_CST C%d package element[0] type(%x) is not buffer, skip...\n",
901 reg = (struct acpi_power_register *)obj->buffer.pointer;
903 obj = &element->package.elements[1];
904 if (obj->type != ACPI_TYPE_INTEGER) {
905 acpi_handle_info(handle, "_CST C[%d] package element[1] type(%x) is not integer, skip...\n",
910 cx.type = obj->integer.value;
912 * There are known cases in which the _CST output does not
913 * contain C1, so if the type of the first state found is not
914 * C1, leave an empty slot for C1 to be filled in later.
916 if (i == 1 && cx.type != ACPI_STATE_C1)
919 cx.address = reg->address;
920 cx.index = last_index + 1;
922 if (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) {
923 if (!acpi_processor_ffh_cstate_probe(cpu, &cx, reg)) {
925 * In the majority of cases _CST describes C1 as
926 * a FIXED_HARDWARE C-state, but if the command
927 * line forbids using MWAIT, use CSTATE_HALT for
930 if (cx.type == ACPI_STATE_C1 &&
931 boot_option_idle_override == IDLE_NOMWAIT) {
932 cx.entry_method = ACPI_CSTATE_HALT;
933 snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI HLT");
935 cx.entry_method = ACPI_CSTATE_FFH;
937 } else if (cx.type == ACPI_STATE_C1) {
939 * In the special case of C1, FIXED_HARDWARE can
940 * be handled by executing the HLT instruction.
942 cx.entry_method = ACPI_CSTATE_HALT;
943 snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI HLT");
945 acpi_handle_info(handle, "_CST C%d declares FIXED_HARDWARE C-state but not supported in hardware, skip...\n",
949 } else if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
950 cx.entry_method = ACPI_CSTATE_SYSTEMIO;
951 snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI IOPORT 0x%x",
954 acpi_handle_info(handle, "_CST C%d space_id(%x) neither FIXED_HARDWARE nor SYSTEM_IO, skip...\n",
959 if (cx.type == ACPI_STATE_C1)
962 obj = &element->package.elements[2];
963 if (obj->type != ACPI_TYPE_INTEGER) {
964 acpi_handle_info(handle, "_CST C%d package element[2] type(%x) not integer, skip...\n",
969 cx.latency = obj->integer.value;
971 obj = &element->package.elements[3];
972 if (obj->type != ACPI_TYPE_INTEGER) {
973 acpi_handle_info(handle, "_CST C%d package element[3] type(%x) not integer, skip...\n",
978 memcpy(&info->states[++last_index], &cx, sizeof(cx));
981 acpi_handle_info(handle, "Found %d idle states\n", last_index);
983 info->count = last_index;
986 kfree(buffer.pointer);
990 EXPORT_SYMBOL_GPL(acpi_processor_evaluate_cst);
991 #endif /* CONFIG_ACPI_PROCESSOR_CSTATE */