processor.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (C) 2005 Intel Corporation
  3. * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
  4. * - Added _PDC for platforms with Intel CPUs
  5. */
  6. #include <linux/kernel.h>
  7. #include <linux/module.h>
  8. #include <linux/init.h>
  9. #include <linux/acpi.h>
  10. #include <acpi/processor.h>
  11. #include <asm/acpi.h>
  12. static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
  13. {
  14. u32 *buf = (u32 *)pr->pdc->pointer->buffer.pointer;
  15. buf[0] = ACPI_PDC_REVISION_ID;
  16. buf[1] = 1;
  17. buf[2] = ACPI_PDC_C_CAPABILITY_SMP;
  18. /*
  19. * The default of PDC_SMP_T_SWCOORD bit is set for intel x86 cpu so
  20. * that OSPM is capable of native ACPI throttling software
  21. * coordination using BIOS supplied _TSD info.
  22. */
  23. buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
  24. if (cpu_has(c, X86_FEATURE_EST))
  25. buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
  26. if (cpu_has(c, X86_FEATURE_ACPI))
  27. buf[2] |= ACPI_PDC_T_FFH;
  28. /*
  29. * If mwait/monitor is unsupported, C2/C3_FFH will be disabled
  30. */
  31. if (!cpu_has(c, X86_FEATURE_MWAIT))
  32. buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
  33. return;
  34. }
  35. /* Initialize _PDC data based on the CPU vendor */
  36. void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
  37. {
  38. struct cpuinfo_x86 *c = &cpu_data(pr->id);
  39. init_intel_pdc(pr, c);
  40. return;
  41. }
  42. EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
  43. void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr)
  44. {
  45. if (pr->pdc) {
  46. kfree(pr->pdc->pointer->buffer.pointer);
  47. kfree(pr->pdc->pointer);
  48. kfree(pr->pdc);
  49. pr->pdc = NULL;
  50. }
  51. }
  52. EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc);