processor.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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[2] |= ACPI_PDC_C_CAPABILITY_SMP;
  16. if (cpu_has(c, X86_FEATURE_EST))
  17. buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
  18. if (cpu_has(c, X86_FEATURE_ACPI))
  19. buf[2] |= ACPI_PDC_T_FFH;
  20. /*
  21. * If mwait/monitor is unsupported, C2/C3_FFH will be disabled
  22. */
  23. if (!cpu_has(c, X86_FEATURE_MWAIT))
  24. buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
  25. return;
  26. }
  27. /* Initialize _PDC data based on the CPU vendor */
  28. void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
  29. {
  30. struct cpuinfo_x86 *c = &cpu_data(pr->id);
  31. init_intel_pdc(pr, c);
  32. return;
  33. }
  34. EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
  35. void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr)
  36. {
  37. if (pr->pdc) {
  38. kfree(pr->pdc->pointer->buffer.pointer);
  39. kfree(pr->pdc->pointer);
  40. kfree(pr->pdc);
  41. pr->pdc = NULL;
  42. }
  43. }
  44. EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc);