2 * Copyright (C) 2005 Intel Corporation
3 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
4 * - Added _PDC for platforms with Intel CPUs
7 #include <linux/kernel.h>
8 #include <linux/module.h>
9 #include <linux/init.h>
10 #include <linux/acpi.h>
12 #include <acpi/processor.h>
15 static void init_intel_pdc(struct acpi_processor
*pr
, struct cpuinfo_x86
*c
)
17 struct acpi_object_list
*obj_list
;
18 union acpi_object
*obj
;
21 /* allocate and initialize pdc. It will be used later. */
22 obj_list
= kmalloc(sizeof(struct acpi_object_list
), GFP_KERNEL
);
24 printk(KERN_ERR
"Memory allocation error\n");
28 obj
= kmalloc(sizeof(union acpi_object
), GFP_KERNEL
);
30 printk(KERN_ERR
"Memory allocation error\n");
35 buf
= kmalloc(12, GFP_KERNEL
);
37 printk(KERN_ERR
"Memory allocation error\n");
43 buf
[0] = ACPI_PDC_REVISION_ID
;
45 buf
[2] = ACPI_PDC_C_CAPABILITY_SMP
;
48 * The default of PDC_SMP_T_SWCOORD bit is set for intel x86 cpu so
49 * that OSPM is capable of native ACPI throttling software
50 * coordination using BIOS supplied _TSD info.
52 buf
[2] |= ACPI_PDC_SMP_T_SWCOORD
;
53 if (cpu_has(c
, X86_FEATURE_EST
))
54 buf
[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP
;
56 if (cpu_has(c
, X86_FEATURE_ACPI
))
57 buf
[2] |= ACPI_PDC_T_FFH
;
60 * If mwait/monitor is unsupported, C2/C3_FFH will be disabled
62 if (!cpu_has(c
, X86_FEATURE_MWAIT
))
63 buf
[2] &= ~(ACPI_PDC_C_C2C3_FFH
);
65 obj
->type
= ACPI_TYPE_BUFFER
;
66 obj
->buffer
.length
= 12;
67 obj
->buffer
.pointer
= (u8
*) buf
;
69 obj_list
->pointer
= obj
;
76 /* Initialize _PDC data based on the CPU vendor */
77 void arch_acpi_processor_init_pdc(struct acpi_processor
*pr
)
79 struct cpuinfo_x86
*c
= &cpu_data(pr
->id
);
82 if (c
->x86_vendor
== X86_VENDOR_INTEL
)
83 init_intel_pdc(pr
, c
);
88 EXPORT_SYMBOL(arch_acpi_processor_init_pdc
);
90 void arch_acpi_processor_cleanup_pdc(struct acpi_processor
*pr
)
93 kfree(pr
->pdc
->pointer
->buffer
.pointer
);
94 kfree(pr
->pdc
->pointer
);
100 EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc
);