processor.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * arch/x86_64/kernel/acpi/processor.c
  3. *
  4. * Copyright (C) 2005 Intel Corporation
  5. * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
  6. * - Added _PDC for platforms with Intel CPUs
  7. */
  8. #include <linux/kernel.h>
  9. #include <linux/module.h>
  10. #include <linux/init.h>
  11. #include <linux/acpi.h>
  12. #include <acpi/processor.h>
  13. #include <asm/acpi.h>
  14. static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
  15. {
  16. struct acpi_object_list *obj_list;
  17. union acpi_object *obj;
  18. u32 *buf;
  19. /* allocate and initialize pdc. It will be used later. */
  20. obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
  21. if (!obj_list) {
  22. printk(KERN_ERR "Memory allocation error\n");
  23. return;
  24. }
  25. obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
  26. if (!obj) {
  27. printk(KERN_ERR "Memory allocation error\n");
  28. kfree(obj_list);
  29. return;
  30. }
  31. buf = kmalloc(12, GFP_KERNEL);
  32. if (!buf) {
  33. printk(KERN_ERR "Memory allocation error\n");
  34. kfree(obj);
  35. kfree(obj_list);
  36. return;
  37. }
  38. buf[0] = ACPI_PDC_REVISION_ID;
  39. buf[1] = 1;
  40. buf[2] = ACPI_PDC_EST_CAPABILITY_SMP;
  41. obj->type = ACPI_TYPE_BUFFER;
  42. obj->buffer.length = 12;
  43. obj->buffer.pointer = (u8 *) buf;
  44. obj_list->count = 1;
  45. obj_list->pointer = obj;
  46. pr->pdc = obj_list;
  47. return;
  48. }
  49. /* Initialize _PDC data based on the CPU vendor */
  50. void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
  51. {
  52. unsigned int cpu = pr->id;
  53. struct cpuinfo_x86 *c = cpu_data + cpu;
  54. pr->pdc = NULL;
  55. if (c->x86_vendor == X86_VENDOR_INTEL && cpu_has(c, X86_FEATURE_EST))
  56. init_intel_pdc(pr, c);
  57. return;
  58. }
  59. EXPORT_SYMBOL(arch_acpi_processor_init_pdc);