|
@@ -465,11 +465,33 @@ int acpi_processor_get_performance_info(struct acpi_processor *pr)
|
|
|
return result;
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(acpi_processor_get_performance_info);
|
|
|
-int acpi_processor_notify_smm(struct module *calling_module)
|
|
|
+
|
|
|
+int acpi_processor_pstate_control(void)
|
|
|
{
|
|
|
acpi_status status;
|
|
|
- static int is_done = 0;
|
|
|
|
|
|
+ if (!acpi_gbl_FADT.smi_command || !acpi_gbl_FADT.pstate_control)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
|
|
+ "Writing pstate_control [0x%x] to smi_command [0x%x]\n",
|
|
|
+ acpi_gbl_FADT.pstate_control, acpi_gbl_FADT.smi_command));
|
|
|
+
|
|
|
+ status = acpi_os_write_port(acpi_gbl_FADT.smi_command,
|
|
|
+ (u32)acpi_gbl_FADT.pstate_control, 8);
|
|
|
+ if (ACPI_SUCCESS(status))
|
|
|
+ return 1;
|
|
|
+
|
|
|
+ ACPI_EXCEPTION((AE_INFO, status,
|
|
|
+ "Failed to write pstate_control [0x%x] to smi_command [0x%x]",
|
|
|
+ acpi_gbl_FADT.pstate_control, acpi_gbl_FADT.smi_command));
|
|
|
+ return -EIO;
|
|
|
+}
|
|
|
+
|
|
|
+int acpi_processor_notify_smm(struct module *calling_module)
|
|
|
+{
|
|
|
+ static int is_done = 0;
|
|
|
+ int result;
|
|
|
|
|
|
if (!(acpi_processor_ppc_status & PPC_REGISTERED))
|
|
|
return -EBUSY;
|
|
@@ -492,26 +514,15 @@ int acpi_processor_notify_smm(struct module *calling_module)
|
|
|
|
|
|
is_done = -EIO;
|
|
|
|
|
|
- /* Can't write pstate_control to smi_command if either value is zero */
|
|
|
- if ((!acpi_gbl_FADT.smi_command) || (!acpi_gbl_FADT.pstate_control)) {
|
|
|
+ result = acpi_processor_pstate_control();
|
|
|
+ if (!result) {
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No SMI port or pstate_control\n"));
|
|
|
module_put(calling_module);
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
|
|
- "Writing pstate_control [0x%x] to smi_command [0x%x]\n",
|
|
|
- acpi_gbl_FADT.pstate_control, acpi_gbl_FADT.smi_command));
|
|
|
-
|
|
|
- status = acpi_os_write_port(acpi_gbl_FADT.smi_command,
|
|
|
- (u32) acpi_gbl_FADT.pstate_control, 8);
|
|
|
- if (ACPI_FAILURE(status)) {
|
|
|
- ACPI_EXCEPTION((AE_INFO, status,
|
|
|
- "Failed to write pstate_control [0x%x] to "
|
|
|
- "smi_command [0x%x]", acpi_gbl_FADT.pstate_control,
|
|
|
- acpi_gbl_FADT.smi_command));
|
|
|
+ if (result < 0) {
|
|
|
module_put(calling_module);
|
|
|
- return status;
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
/* Success. If there's no _PPC, we need to fear nothing, so
|