acpi-processor.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * arch/ia64/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)
  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. /*
  42. * The default of PDC_SMP_T_SWCOORD bit is set for IA64 cpu so
  43. * that OSPM is capable of native ACPI throttling software
  44. * coordination using BIOS supplied _TSD info.
  45. */
  46. buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
  47. obj->type = ACPI_TYPE_BUFFER;
  48. obj->buffer.length = 12;
  49. obj->buffer.pointer = (u8 *) buf;
  50. obj_list->count = 1;
  51. obj_list->pointer = obj;
  52. pr->pdc = obj_list;
  53. return;
  54. }
  55. /* Initialize _PDC data based on the CPU vendor */
  56. void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
  57. {
  58. pr->pdc = NULL;
  59. init_intel_pdc(pr);
  60. return;
  61. }
  62. EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
  63. void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr)
  64. {
  65. if (pr->pdc) {
  66. kfree(pr->pdc->pointer->buffer.pointer);
  67. kfree(pr->pdc->pointer);
  68. kfree(pr->pdc);
  69. pr->pdc = NULL;
  70. }
  71. }
  72. EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc);