Skip to contentSkip to conversation

PCI/ACPI: move _OSC code to pci_root.c (v.2)

PATCH In review Kenji Kaneshige 3 participants 9 messages Feb 5, 2009 – Feb 9, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover PCI/ACPI: move _OSC code to pci_root.c (v.2)

Hi,

Here are updated version (v.2) of "PCI/ACPI: move _OSC code to pci_root.c" patches. Patches are

- [PATCH 1/2] PCI/ACPI: move _OSC code to pci_root.c
- [PATCH 2/2] PCI/ACPI: rename pci_osc_control_set()

ChangeLog
---------
[v.1 -> v.2]
- Change the debug message.
[old]: "_OSC FW not grant req. control."
[new]: "Firmware did not grant requested _OSC control" (Based on the feedback from Andrew Patterson and Alex Chiang)

- Rename pci_osc_control_set() to acpi_pci_osc_control_set() and move _OSC related definitions from include/linux/pci-acpi.h to include/linux/acpi.h.
(Based on the feedback from Andrew Patterson)

Thanks,
Kenji Kaneshige

#1 lore raw

PATCH 1/2 PCI/ACPI: move _OSC code to pci_root.c

Move PCI _OSC management code from drivers/pci/pci-acpi.c to drivers/acpi/pci_root.c. The benefits are

- We no longer need struct osc_data and its management code (contents are moved to struct acpi_pci_root). This simplify the code, and we no longer care about kmalloc() failure.

- We can make pci_acpi_osc_support() be a static function, which is called only from drivers/acpi/pci_root.c.

---
 drivers/acpi/pci_root.c  |  180 ++++++++++++++++++++++++++++++++++++++-
 drivers/pci/pci-acpi.c   |  215 -----------------------------------------------
 include/linux/pci-acpi.h |    1 
 3 files changed, 178 insertions(+), 218 deletions(-)
drivers/acpi/pci_root.c +178 -2
Index: 20090205/drivers/acpi/pci_root.c
===================================================================
@@ -66,11 +66,18 @@ struct acpi_pci_root {
 	struct acpi_device * device;
 	struct acpi_pci_id id;
 	struct pci_bus *bus;
+
+	u32 osc_support_set;	/* _OSC state of support bits */
+	u32 osc_control_set;	/* _OSC state of control bits */
+	u32 osc_control_qry;	/* the latest _OSC query result */
+
+	u32 osc_queried:1;	/* has _OSC control been queried? */
 };
 
 static LIST_HEAD(acpi_pci_roots);
 
 static struct acpi_pci_driver *sub_driver;
+static DEFINE_MUTEX(osc_lock);
 
 int acpi_pci_register_driver(struct acpi_pci_driver *driver)
 {
@@ -185,6 +192,175 @@ static void acpi_pci_bridge_scan(struct 
 		}
 }
 
+static u8 OSC_UUID[16] = {0x5B, 0x4D, 0xDB, 0x33, 0xF7, 0x1F, 0x1C, 0x40,
+			  0x96, 0x57, 0x74, 0x41, 0xC0, 0x3D, 0xD7, 0x66};
+
+static acpi_status acpi_pci_run_osc(acpi_handle handle,
+				    const u32 *capbuf, u32 *retval)
+{
+	acpi_status status;
+	struct acpi_object_list input;
+	union acpi_object in_params[4];
+	struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
+	union acpi_object *out_obj;
+	u32 errors;
+
+	/* Setting up input parameters */
+	input.count = 4;
+	input.pointer = in_params;
+	in_params[0].type 		= ACPI_TYPE_BUFFER;
+	in_params[0].buffer.length 	= 16;
+	in_params[0].buffer.pointer	= OSC_UUID;
+	in_params[1].type 		= ACPI_TYPE_INTEGER;
+	in_params[1].integer.value 	= 1;
+	in_params[2].type 		= ACPI_TYPE_INTEGER;
+	in_params[2].integer.value	= 3;
+	in_params[3].type		= ACPI_TYPE_BUFFER;
+	in_params[3].buffer.length 	= 12;
+	in_params[3].buffer.pointer 	= (u8 *)capbuf;
+
+	status = acpi_evaluate_object(handle, "_OSC", &input, &output);
+	if (ACPI_FAILURE(status))
+		return status;
+
+	if (!output.length)
+		return AE_NULL_OBJECT;
+
+	out_obj = output.pointer;
+	if (out_obj->type != ACPI_TYPE_BUFFER) {
+		printk(KERN_DEBUG "Evaluate _OSC returns wrong type\n");
+		status = AE_TYPE;
+		goto out_kfree;
+	}
+	/* Need to ignore the bit0 in result code */
+	errors = *((u32 *)out_obj->buffer.pointer) & ~(1 << 0);
+	if (errors) {
+		if (errors & OSC_REQUEST_ERROR)
+			printk(KERN_DEBUG "_OSC request fails\n");
+		if (errors & OSC_INVALID_UUID_ERROR)
+			printk(KERN_DEBUG "_OSC invalid UUID\n");
+		if (errors & OSC_INVALID_REVISION_ERROR)
+			printk(KERN_DEBUG "_OSC invalid revision\n");
+		if (errors & OSC_CAPABILITIES_MASK_ERROR) {
+			if (capbuf[OSC_QUERY_TYPE] & OSC_QUERY_ENABLE)
+				goto out_success;
+			printk(KERN_DEBUG "Firmware did not grant requested "
+			       "_OSC control\n");
+			status = AE_SUPPORT;
+			goto out_kfree;
+		}
+		status = AE_ERROR;
+		goto out_kfree;
+	}
+out_success:
+	*retval = *((u32 *)(out_obj->buffer.pointer + 8));
+	status = AE_OK;
+
+out_kfree:
+	kfree(output.pointer);
+	return status;
+}
+
+static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root, u32 flags)
+{
+	acpi_status status;
+	u32 support_set, result, capbuf[3];
+
+	/* do _OSC query for all possible controls */
+	support_set = root->osc_support_set | (flags & OSC_SUPPORT_MASKS);
+	capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE;
+	capbuf[OSC_SUPPORT_TYPE] = support_set;
+	capbuf[OSC_CONTROL_TYPE] = OSC_CONTROL_MASKS;
+
+	status = acpi_pci_run_osc(root->device->handle, capbuf, &result);
+	if (ACPI_SUCCESS(status)) {
+		root->osc_support_set = support_set;
+		root->osc_control_qry = result;
+		root->osc_queried = 1;
+	}
+	return status;
+}
+
+static acpi_status acpi_pci_osc_support(struct acpi_pci_root *root, u32 flags)
+{
+	acpi_status status;
+	acpi_handle tmp;
+
+	status = acpi_get_handle(root->device->handle, "_OSC", &tmp);
+	if (ACPI_FAILURE(status))
+		return status;
+	mutex_lock(&osc_lock);
+	status = acpi_pci_query_osc(root, flags);
+	mutex_unlock(&osc_lock);
+	return status;
+}
+
+static struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle)
+{
+	struct acpi_pci_root *root;
+	list_for_each_entry(root, &acpi_pci_roots, node) {
+		if (root->device->handle == handle)
+			return root;
+	}
+	return NULL;
+}
+
+/**
+ * pci_osc_control_set - commit requested control to Firmware
+ * @handle: acpi_handle for the target ACPI object
+ * @flags: driver's requested control bits
+ *
+ * Attempt to take control from Firmware on requested control bits.
+ **/
+acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
+{
+	acpi_status status;
+	u32 control_req, result, capbuf[3];
+	acpi_handle tmp;
+	struct acpi_pci_root *root;
+
+	status = acpi_get_handle(handle, "_OSC", &tmp);
+	if (ACPI_FAILURE(status))
+		return status;
+
+	control_req = (flags & OSC_CONTROL_MASKS);
+	if (!control_req)
+		return AE_TYPE;
+
+	root = acpi_pci_find_root(handle);
+	if (!root)
+		return AE_NOT_EXIST;
+
+	mutex_lock(&osc_lock);
+	/* No need to evaluate _OSC if the control was already granted. */
+	if ((root->osc_control_set & control_req) == control_req)
+		goto out;
+
+	/* Need to query controls first before requesting them */
+	if (!root->osc_queried) {
+		status = acpi_pci_query_osc(root, root->osc_support_set);
+		if (ACPI_FAILURE(status))
+			goto out;
+	}
+	if ((root->osc_control_qry & control_req) != control_req) {
+		printk(KERN_DEBUG
+		       "Firmware did not grant requested _OSC control\n");
+		status = AE_SUPPORT;
+		goto out;
+	}
+
+	capbuf[OSC_QUERY_TYPE] = 0;
+	capbuf[OSC_SUPPORT_TYPE] = root->osc_support_set;
+	capbuf[OSC_CONTROL_TYPE] = root->osc_control_set | control_req;
+	status = acpi_pci_run_osc(handle, capbuf, &result);
+	if (ACPI_SUCCESS(status))
+		root->osc_control_set = result;
+out:
+	mutex_unlock(&osc_lock);
+	return status;
+}
+EXPORT_SYMBOL(pci_osc_control_set);
+
 static int __devinit acpi_pci_root_add(struct acpi_device *device)
 {
 	int result = 0;
@@ -217,7 +393,7 @@ static int __devinit acpi_pci_root_add(s
 	 * PCI domains, so we indicate this in _OSC support capabilities.
 	 */
 	flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT;
-	pci_acpi_osc_support(device->handle, flags);
+	acpi_pci_osc_support(root, flags);
 
 	/* 
 	 * Segment
@@ -353,7 +529,7 @@ static int __devinit acpi_pci_root_add(s
 	if (pci_msi_enabled())
 		flags |= OSC_MSI_SUPPORT;
 	if (flags != base_flags)
-		pci_acpi_osc_support(device->handle, flags);
+		acpi_pci_osc_support(root, flags);
 
       end:
 	if (result) {
drivers/pci/pci-acpi.c +0 -215

221 lines not on this page · raw message

include/linux/pci-acpi.h +0 -1
Index: 20090205/include/linux/pci-acpi.h
===================================================================
@@ -50,7 +50,6 @@
 
 #ifdef CONFIG_ACPI
 extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
-int pci_acpi_osc_support(acpi_handle handle, u32 flags);
 static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
 {
 	/* Find root host bridge */
#2 lore raw

Re: [PATCH 1/2] PCI/ACPI: move _OSC code to pci_root.c

Hi Kenji-san,

Sorry, I didn't read your patch in detail last time, and only saw the one wording change that Andrew suggested.

Reading through now, I have a few more suggestions.

drivers/acpi/pci_root.c static void acpi_pci_bridge_scan(struct · line 231

Quoted 10 lines
drivers/acpi/pci_root.c +10 -0
+	status = acpi_evaluate_object(handle, "_OSC", &input, &output);
+	if (ACPI_FAILURE(status))
+		return status;
+
+	if (!output.length)
+		return AE_NULL_OBJECT;
+
+	out_obj = output.pointer;
+	if (out_obj->type != ACPI_TYPE_BUFFER) {
+		printk(KERN_DEBUG "Evaluate _OSC returns wrong type\n");

"_OSC evaluation returned wrong type\n"

drivers/acpi/pci_root.c static void acpi_pci_bridge_scan(struct · line 239

Quoted 3 lines
drivers/acpi/pci_root.c +3 -0
+	if (errors) {
+		if (errors & OSC_REQUEST_ERROR)
+			printk(KERN_DEBUG "_OSC request fails\n");

"_OSC request failed\n"

drivers/acpi/pci_root.c static void acpi_pci_bridge_scan(struct · line 248

Quoted 9 lines
drivers/acpi/pci_root.c +9 -0
+		if (errors & OSC_INVALID_UUID_ERROR)
+			printk(KERN_DEBUG "_OSC invalid UUID\n");
+		if (errors & OSC_INVALID_REVISION_ERROR)
+			printk(KERN_DEBUG "_OSC invalid revision\n");
+		if (errors & OSC_CAPABILITIES_MASK_ERROR) {
+			if (capbuf[OSC_QUERY_TYPE] & OSC_QUERY_ENABLE)
+				goto out_success;
+			printk(KERN_DEBUG"Firmware did not grant requested "
+			       "_OSC control\n");

I prefer to see this message on one line (and break the 80 column rule) to make grepping easier. But this is a judgement call, and I'll let you decide.

Thanks.

/ac

#3 lore raw

RE: [PATCH 1/2] PCI/ACPI: move _OSC code to pci_root.c

The acpi_evaluate_object_typed interface automatically handles the two error cases you check for:

1) Checks for the case where no object is returned
2) Checks for the correct return object type (buffer in this case)

Use of this interface would simplify and shrink the code.

Bob

Quoted 56 lines

-----Original Message-----
From: [email protected] [mailto:linux-acpi- [email protected]] On Behalf Of Alex Chiang
Sent: Thursday, February 05, 2009 7:50 AM
To: Kenji Kaneshige
Cc: Jesse Barnes; [email protected]; linux acpi; Andrew Patterson
Subject: Re: [PATCH 1/2] PCI/ACPI: move _OSC code to pci_root.c

Hi Kenji-san,

Sorry, I didn't read your patch in detail last time, and only saw the one wording change that Andrew suggested.

Reading through now, I have a few more suggestions.

drivers/acpi/pci_root.c static void acpi_pci_bridge_scan(struct · line 231

Quoted 10 lines
drivers/acpi/pci_root.c +10 -0
+    status = acpi_evaluate_object(handle, "_OSC", &input, &output);
+    if (ACPI_FAILURE(status))
+            return status;
+
+    if (!output.length)
+            return AE_NULL_OBJECT;
+
+    out_obj = output.pointer;
+    if (out_obj->type != ACPI_TYPE_BUFFER) {
+            printk(KERN_DEBUG "Evaluate _OSC returns wrong type\n");

"_OSC evaluation returned wrong type\n"

drivers/acpi/pci_root.c static void acpi_pci_bridge_scan(struct · line 239

Quoted 3 lines
drivers/acpi/pci_root.c +3 -0
+    if (errors) {
+            if (errors & OSC_REQUEST_ERROR)
+                    printk(KERN_DEBUG "_OSC request fails\n");

"_OSC request failed\n"

drivers/acpi/pci_root.c static void acpi_pci_bridge_scan(struct · line 248

Quoted 9 lines
drivers/acpi/pci_root.c +9 -0
+            if (errors & OSC_INVALID_UUID_ERROR)
+                    printk(KERN_DEBUG "_OSC invalid UUID\n");
+            if (errors & OSC_INVALID_REVISION_ERROR)
+                    printk(KERN_DEBUG "_OSC invalid revision\n");
+            if (errors & OSC_CAPABILITIES_MASK_ERROR) {
+                    if (capbuf[OSC_QUERY_TYPE] & OSC_QUERY_ENABLE)
+                            goto out_success;
+                    printk(KERN_DEBUG"Firmware did not grant requested "
+                           "_OSC control\n");

I prefer to see this message on one line (and break the 80 column rule) to make grepping easier. But this is a judgement call, and I'll let you decide.

Thanks.

/ac

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [PATCH 1/2] PCI/ACPI: move _OSC code to pci_root.c

Quoted 7 lines · Robert

The acpi_evaluate_object_typed interface automatically handles the two error cases you check for:

1) Checks for the case where no object is returned
2) Checks for the correct return object type (buffer in this case)

Use of this interface would simplify and shrink the code.

Sounds good to me, but I have a question.

The acpi_evaluate_object_typed() function seems to be compiled only when ACPI_FUTURE_USAGE is defined. And it seems that there is no prototype declaration. I don't know about ACPI_FUTURE_USAGE at all. Could you please tell me what I should do to use acpi_evaluate_object_typed()?

Thanks,
Kenji Kaneshige

#5 lore raw

RE: [PATCH 1/2] PCI/ACPI: move _OSC code to pci_root.c

I guess this means that Linux does not currently use this interface.

I think I remember that Linux implements a utility module with an interface something like "acpi_evaluate_integer", and a couple more. Perhaps acpi_evaluate_buffer already exists, you could use that.

Quoted 35 lines

-----Original Message-----
From: [email protected] [mailto:linux-acpi- [email protected]] On Behalf Of Kenji Kaneshige
Sent: Thursday, February 05, 2009 9:43 PM
To: Moore, Robert
Cc: Alex Chiang; Jesse Barnes; [email protected]; linux acpi; Andrew Patterson
Subject: Re: [PATCH 1/2] PCI/ACPI: move _OSC code to pci_root.c

Quoted 1 line · Robert

The acpi_evaluate_object_typed interface automatically handles the two

error cases you check for:

Quoted 6 lines

1) Checks for the case where no object is returned
2) Checks for the correct return object type (buffer in this case)

Use of this interface would simplify and shrink the code.

Sounds good to me, but I have a question.

The acpi_evaluate_object_typed() function seems to be compiled only when ACPI_FUTURE_USAGE is defined. And it seems that there is no prototype declaration. I don't know about ACPI_FUTURE_USAGE at all. Could you please tell me what I should do to use acpi_evaluate_object_typed()?

Thanks,
Kenji Kaneshige

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw

Re: [PATCH 1/2] PCI/ACPI: move _OSC code to pci_root.c

Quoted 4 lines · Robert

I guess this means that Linux does not currently use this interface.

I think I remember that Linux implements a utility module with an interface something like "acpi_evaluate_integer", and a couple more. Perhaps acpi_evaluate_buffer already exists, you could use that.

Thank you for suggestion.

Unfortunately, I could not find acpi_evaluate_buffer() and something like this. So I'd like to leave the code as it is, and wait for acpi_evaluate_object_typed().

Thanks,
Kenji Kaneshige

Quoted 40 lines
Quoted 26 lines

-----Original Message-----
From: [email protected] [mailto:linux-acpi- [email protected]] On Behalf Of Kenji Kaneshige
Sent: Thursday, February 05, 2009 9:43 PM
To: Moore, Robert
Cc: Alex Chiang; Jesse Barnes; [email protected]; linux acpi; Andrew Patterson
Subject: Re: [PATCH 1/2] PCI/ACPI: move _OSC code to pci_root.c

Quoted 1 line · Robert

The acpi_evaluate_object_typed interface automatically handles the two

error cases you check for:

Quoted 5 lines

1) Checks for the case where no object is returned
2) Checks for the correct return object type (buffer in this case)

Use of this interface would simplify and shrink the code.

Sounds good to me, but I have a question.

The acpi_evaluate_object_typed() function seems to be compiled only when ACPI_FUTURE_USAGE is defined. And it seems that there is no prototype declaration. I don't know about ACPI_FUTURE_USAGE at all. Could you please tell me what I should do to use acpi_evaluate_object_typed()?

Quoted 8 lines

Thanks,
Kenji Kaneshige

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

Re: [PATCH 1/2] PCI/ACPI: move _OSC code to pci_root.c

In reply to Alex Chiang
Quoted 7 lines · Alex Chiang

Hi Kenji-san,

Sorry, I didn't read your patch in detail last time, and only saw the one wording change that Andrew suggested.

Reading through now, I have a few more suggestions.

Thank you for suggestions.

Quoted 4 lines
Quoted 4 lines
drivers/acpi/pci_root.c +4 -0
+	status = acpi_evaluate_object(handle, "_OSC", &input, &output);
+	if (ACPI_FAILURE(status))
+		return status;
+
Quoted 9 lines

drivers/acpi/pci_root.c static void acpi_pci_bridge_scan(struct · line 231

Quoted 6 lines
drivers/acpi/pci_root.c +6 -0
+	if (!output.length)
+		return AE_NULL_OBJECT;
+
+	out_obj = output.pointer;
+	if (out_obj->type != ACPI_TYPE_BUFFER) {
+		printk(KERN_DEBUG "Evaluate _OSC returns wrong type\n");

"_OSC evaluation returned wrong type\n"

I'll fix it. But this debug message would be removed if we use acpi_evaluate_object_typed() instead of acpi_evaluate_object() as Robert suggested.

Quoted 6 lines

drivers/acpi/pci_root.c static void acpi_pci_bridge_scan(struct · line 239

Quoted 3 lines
drivers/acpi/pci_root.c +3 -0
+	if (errors) {
+		if (errors & OSC_REQUEST_ERROR)
+			printk(KERN_DEBUG "_OSC request fails\n");

"_OSC request failed\n"

I'll fix it.

Quoted 5 lines
Quoted 5 lines
drivers/acpi/pci_root.c +5 -0
+		if (errors & OSC_INVALID_UUID_ERROR)
+			printk(KERN_DEBUG "_OSC invalid UUID\n");
+		if (errors & OSC_INVALID_REVISION_ERROR)
+			printk(KERN_DEBUG "_OSC invalid revision\n");
+		if (errors & OSC_CAPABILITIES_MASK_ERROR) {
Quoted 9 lines

drivers/acpi/pci_root.c static void acpi_pci_bridge_scan(struct · line 248

Quoted 4 lines
drivers/acpi/pci_root.c +4 -0
+			if (capbuf[OSC_QUERY_TYPE] & OSC_QUERY_ENABLE)
+				goto out_success;
+			printk(KERN_DEBUG"Firmware did not grant requested "
+			       "_OSC control\n");

I prefer to see this message on one line (and break the 80 column rule) to make grepping easier. But this is a judgement call, and I'll let you decide.

Ok, I think one line is better. So I'll bread the 80 column rule:)

Thanks,
Kenji Kaneshige

#8 lore raw

PATCH 2/2 PCI/ACPI: rename pci_osc_control_set()

In reply to Kenji Kaneshige

- Rename pci_osc_control_set() to acpi_pci_osc_control_set() according to the other API names in drivers/acpi/pci_root.c.

- Move _OSC related definitions to include/linux/acpi.h because _OSC related API is implemented in drivers/acpi/pci_root.c now.

---
 drivers/acpi/pci_root.c            |    6 ++--
 drivers/pci/hotplug/acpi_pcihp.c   |    5 +---
 drivers/pci/pcie/aer/aerdrv_acpi.c |    2 -
 include/linux/acpi.h               |   34 +++++++++++++++++++++++++++
 include/linux/pci-acpi.h           |   45 -------------------------------------
 5 files changed, 40 insertions(+), 52 deletions(-)
drivers/acpi/pci_root.c +3 -3
Index: 20090205/drivers/acpi/pci_root.c
===================================================================
@@ -306,13 +306,13 @@ static struct acpi_pci_root *acpi_pci_fi
 }
 
 /**
- * pci_osc_control_set - commit requested control to Firmware
+ * acpi_pci_osc_control_set - commit requested control to Firmware
  * @handle: acpi_handle for the target ACPI object
  * @flags: driver's requested control bits
  *
  * Attempt to take control from Firmware on requested control bits.
  **/
-acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
+acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags)
 {
 	acpi_status status;
 	u32 control_req, result, capbuf[3];
@@ -359,7 +359,7 @@ out:
 	mutex_unlock(&osc_lock);
 	return status;
 }
-EXPORT_SYMBOL(pci_osc_control_set);
+EXPORT_SYMBOL(acpi_pci_osc_control_set);
 
 static int __devinit acpi_pci_root_add(struct acpi_device *device)
 {
include/linux/pci-acpi.h +0 -45

58 lines not on this page · raw message

include/linux/acpi.h +34 -0
Index: 20090205/include/linux/acpi.h
===================================================================
@@ -256,6 +256,40 @@ void __init acpi_no_s4_hw_signature(void
 void __init acpi_old_suspend_ordering(void);
 void __init acpi_s4_no_nvs(void);
 #endif /* CONFIG_PM_SLEEP */
+
+#define OSC_QUERY_TYPE			0
+#define OSC_SUPPORT_TYPE 		1
+#define OSC_CONTROL_TYPE		2
+#define OSC_SUPPORT_MASKS		0x1f
+
+/* _OSC DW0 Definition */
+#define OSC_QUERY_ENABLE		1
+#define OSC_REQUEST_ERROR		2
+#define OSC_INVALID_UUID_ERROR		4
+#define OSC_INVALID_REVISION_ERROR	8
+#define OSC_CAPABILITIES_MASK_ERROR	16
+
+/* _OSC DW1 Definition (OS Support Fields) */
+#define OSC_EXT_PCI_CONFIG_SUPPORT		1
+#define OSC_ACTIVE_STATE_PWR_SUPPORT 		2
+#define OSC_CLOCK_PWR_CAPABILITY_SUPPORT	4
+#define OSC_PCI_SEGMENT_GROUPS_SUPPORT		8
+#define OSC_MSI_SUPPORT				16
+
+/* _OSC DW1 Definition (OS Control Fields) */
+#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL	1
+#define OSC_SHPC_NATIVE_HP_CONTROL 		2
+#define OSC_PCI_EXPRESS_PME_CONTROL		4
+#define OSC_PCI_EXPRESS_AER_CONTROL		8
+#define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL	16
+
+#define OSC_CONTROL_MASKS 	(OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | 	\
+				OSC_SHPC_NATIVE_HP_CONTROL | 		\
+				OSC_PCI_EXPRESS_PME_CONTROL |		\
+				OSC_PCI_EXPRESS_AER_CONTROL |		\
+				OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)
+
+extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags);
 #else	/* CONFIG_ACPI */
 
 static inline int early_acpi_boot_init(void)
drivers/pci/hotplug/acpi_pcihp.c +2 -3
Index: 20090205/drivers/pci/hotplug/acpi_pcihp.c
===================================================================
@@ -30,9 +30,8 @@
 #include <linux/types.h>
 #include <linux/pci.h>
 #include <linux/pci_hotplug.h>
+#include <linux/acpi.h>
 #include <linux/pci-acpi.h>
-#include <acpi/acpi.h>
-#include <acpi/acpi_bus.h>
 
 #define MY_NAME	"acpi_pcihp"
 
@@ -408,7 +407,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 = pci_osc_control_set(handle, flags);
+		status = acpi_pci_osc_control_set(handle, flags);
 		if (ACPI_SUCCESS(status))
 			goto got_one;
 		kfree(string.pointer);
drivers/pci/pcie/aer/aerdrv_acpi.c +1 -1
Index: 20090205/drivers/pci/pcie/aer/aerdrv_acpi.c
===================================================================
@@ -38,7 +38,7 @@ int aer_osc_setup(struct pcie_device *pc
 
 	handle = acpi_find_root_bridge_handle(pdev);
 	if (handle) {
-		status = pci_osc_control_set(handle,
+		status = acpi_pci_osc_control_set(handle,
 					OSC_PCI_EXPRESS_AER_CONTROL |
 					OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
 	}