processor_pdc.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #include <linux/dmi.h>
  2. #include <acpi/acpi_drivers.h>
  3. #include <acpi/processor.h>
  4. #include "internal.h"
  5. #define PREFIX "ACPI: "
  6. #define _COMPONENT ACPI_PROCESSOR_COMPONENT
  7. ACPI_MODULE_NAME("processor_pdc");
  8. static int set_no_mwait(const struct dmi_system_id *id)
  9. {
  10. printk(KERN_NOTICE PREFIX "%s detected - "
  11. "disabling mwait for CPU C-states\n", id->ident);
  12. idle_nomwait = 1;
  13. return 0;
  14. }
  15. static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = {
  16. {
  17. set_no_mwait, "IFL91 board", {
  18. DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"),
  19. DMI_MATCH(DMI_SYS_VENDOR, "ZEPTO"),
  20. DMI_MATCH(DMI_PRODUCT_VERSION, "3215W"),
  21. DMI_MATCH(DMI_BOARD_NAME, "IFL91") }, NULL},
  22. {
  23. set_no_mwait, "Extensa 5220", {
  24. DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
  25. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  26. DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
  27. DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
  28. {},
  29. };
  30. /*
  31. * _PDC is required for a BIOS-OS handshake for most of the newer
  32. * ACPI processor features.
  33. */
  34. static int acpi_processor_eval_pdc(struct acpi_processor *pr)
  35. {
  36. struct acpi_object_list *pdc_in = pr->pdc;
  37. acpi_status status = AE_OK;
  38. if (!pdc_in)
  39. return status;
  40. if (idle_nomwait) {
  41. /*
  42. * If mwait is disabled for CPU C-states, the C2C3_FFH access
  43. * mode will be disabled in the parameter of _PDC object.
  44. * Of course C1_FFH access mode will also be disabled.
  45. */
  46. union acpi_object *obj;
  47. u32 *buffer = NULL;
  48. obj = pdc_in->pointer;
  49. buffer = (u32 *)(obj->buffer.pointer);
  50. buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
  51. }
  52. status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL);
  53. if (ACPI_FAILURE(status))
  54. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  55. "Could not evaluate _PDC, using legacy perf. control.\n"));
  56. return status;
  57. }
  58. void acpi_processor_set_pdc(struct acpi_processor *pr)
  59. {
  60. if (arch_has_acpi_pdc() == false)
  61. return;
  62. arch_acpi_processor_init_pdc(pr);
  63. acpi_processor_eval_pdc(pr);
  64. arch_acpi_processor_cleanup_pdc(pr);
  65. }
  66. EXPORT_SYMBOL_GPL(acpi_processor_set_pdc);
  67. static acpi_status
  68. early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv)
  69. {
  70. struct acpi_processor pr;
  71. pr.handle = handle;
  72. /* x86 implementation looks at pr.id to determine some
  73. * CPU capabilites. We can just hard code to 0 since we're
  74. * assuming the CPUs in the system are homogenous and all
  75. * have the same capabilities.
  76. */
  77. pr.id = 0;
  78. acpi_processor_set_pdc(&pr);
  79. return AE_OK;
  80. }
  81. void acpi_early_processor_set_pdc(void)
  82. {
  83. /*
  84. * Check whether the system is DMI table. If yes, OSPM
  85. * should not use mwait for CPU-states.
  86. */
  87. dmi_check_system(processor_idle_dmi_table);
  88. acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
  89. ACPI_UINT32_MAX,
  90. early_init_pdc, NULL, NULL, NULL);
  91. }