2006-07-31 00:21:33 -07:00
|
|
|
/*
|
|
|
|
* Access ACPI _OSC method
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Intel Corp.
|
|
|
|
* Tom Long Nguyen (tom.l.nguyen@intel.com)
|
|
|
|
* Zhang Yanmin (yanmin.zhang@intel.com)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/pm.h>
|
|
|
|
#include <linux/suspend.h>
|
|
|
|
#include <linux/acpi.h>
|
|
|
|
#include <linux/pci-acpi.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include "aerdrv.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* aer_osc_setup - run ACPI _OSC method
|
2007-06-05 20:44:16 -07:00
|
|
|
* @pciedev: pcie_device which AER is being enabled on
|
2006-07-31 00:21:33 -07:00
|
|
|
*
|
2007-06-05 20:44:16 -07:00
|
|
|
* @return: Zero on success. Nonzero otherwise.
|
2006-07-31 00:21:33 -07:00
|
|
|
*
|
|
|
|
* Invoked when PCIE bus loads AER service driver. To avoid conflict with
|
|
|
|
* BIOS AER support requires BIOS to yield AER control to OS native driver.
|
|
|
|
**/
|
2007-06-05 20:44:16 -07:00
|
|
|
int aer_osc_setup(struct pcie_device *pciedev)
|
2006-07-31 00:21:33 -07:00
|
|
|
{
|
2007-06-05 20:44:16 -07:00
|
|
|
acpi_status status = AE_NOT_FOUND;
|
|
|
|
struct pci_dev *pdev = pciedev->port;
|
2008-04-28 16:50:04 -07:00
|
|
|
acpi_handle handle = NULL;
|
2006-07-31 00:21:33 -07:00
|
|
|
|
2008-02-02 23:24:47 -07:00
|
|
|
if (acpi_pci_disabled)
|
|
|
|
return -1;
|
|
|
|
|
2008-01-22 17:18:27 -07:00
|
|
|
/* Find root host bridge */
|
2008-03-30 15:41:01 -07:00
|
|
|
while (pdev->bus->self)
|
2008-01-22 17:18:27 -07:00
|
|
|
pdev = pdev->bus->self;
|
|
|
|
handle = acpi_get_pci_rootbridge_handle(
|
|
|
|
pci_domain_nr(pdev->bus), pdev->bus->number);
|
2006-07-31 00:21:33 -07:00
|
|
|
|
2007-06-05 20:44:16 -07:00
|
|
|
if (handle) {
|
2008-01-22 17:18:17 -07:00
|
|
|
pcie_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT);
|
2007-06-05 20:44:16 -07:00
|
|
|
status = pci_osc_control_set(handle,
|
|
|
|
OSC_PCI_EXPRESS_AER_CONTROL |
|
|
|
|
OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
|
|
|
|
}
|
2006-07-31 00:21:33 -07:00
|
|
|
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2008-06-13 09:52:12 -07:00
|
|
|
dev_printk(KERN_DEBUG, &pciedev->device, "AER service couldn't "
|
|
|
|
"init device: %s\n",
|
|
|
|
(status == AE_SUPPORT || status == AE_NOT_FOUND) ?
|
|
|
|
"no _OSC support" : "_OSC failed");
|
2007-06-05 20:44:16 -07:00
|
|
|
return -1;
|
2006-07-31 00:21:33 -07:00
|
|
|
}
|
|
|
|
|
2007-06-05 20:44:16 -07:00
|
|
|
return 0;
|
2006-07-31 00:21:33 -07:00
|
|
|
}
|