===================================================================
@@ -472,6 +472,30 @@ out:
}
EXPORT_SYMBOL(acpi_pci_osc_control_set);
+/**
+ * acpi_pci_osc_control_set_safe - Query and set _OSC control bit mask.
+ * @handle: ACPI handle of a PCI root bridge (or PCIe Root Complex).
+ * @flags: Mask of _OSC bits to query and set.
+ *
+ * Check if the BIOS is willing to grant control of the features represented
+ * by @flags and request control of these features from it.
+ **/
+acpi_status acpi_pci_osc_control_set_safe(acpi_handle handle, u32 flags)
+{
+ acpi_status status;
+ u32 ctrl = flags;
+
+ status = acpi_pci_osc_control_query(handle, &flags);
+ if (ACPI_FAILURE(status))
+ return status;
+ if ((ctrl & flags) != ctrl)
+ return AE_SUPPORT;
+
+ status = acpi_pci_osc_control_set(handle, flags);
+ return status;
+}
+EXPORT_SYMBOL(acpi_pci_osc_control_set_safe);
+
static int __devinit acpi_pci_root_add(struct acpi_device *device)
{
unsigned long long segment, bus;
===================================================================
@@ -358,7 +358,7 @@ int acpi_get_hp_hw_control_from_firmware
acpi_get_name(handle, ACPI_FULL_PATHNAME, &string);
dbg("Trying to get hotplug control for %s\n",
(char *)string.pointer);
- status = acpi_pci_osc_control_set(handle, flags);
+ status = acpi_pci_osc_control_set_safe(handle, flags);
if (ACPI_SUCCESS(status))
goto got_one;
if (status == AE_SUPPORT)
===================================================================
@@ -307,6 +307,7 @@ acpi_status acpi_run_osc(acpi_handle han
extern acpi_status acpi_pci_osc_control_query(acpi_handle handle, u32 *mask);
extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags);
+extern acpi_status acpi_pci_osc_control_set_safe(acpi_handle handle, u32 flags);
extern void acpi_early_init(void);
#else /* !CONFIG_ACPI */