aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/pciehp_hpc.c
diff options
context:
space:
mode:
authorKristen Accardi <kristen.c.accardi@intel.com>2006-03-03 13:16:05 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 17:35:17 -0500
commit783c49fc506d9afe4784390b556fa25ede5d6d1f (patch)
tree8090c2251193211129816254f16f10cbb33ed20c /drivers/pci/hotplug/pciehp_hpc.c
parentf5afe8064f3087bead8fea7e32547c2a3ada5fd0 (diff)
[PATCH] PCI Hotplug: add common acpi functions to core
shpchprm_acpi.c and pciehprm_acpi.c are nearly identical. In addition, there are functions in both these files that are also in acpiphp_glue.c. This patch will remove duplicate functions from shpchp, pciehp, and acpiphp and move this functionality to pci_hotplug, as it is not hardware specific. Get rid of shpchprm* and pciehprm* files since they are no longer needed. shpchprm_nonacpi.c and pciehprm_nonacpi.c are identical, as well as shpchprm_legacy.c and can be replaced with a macro. This patch also changes acpiphp to use the common hpp code. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/hotplug/pciehp_hpc.c')
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c74
1 files changed, 73 insertions, 1 deletions
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 2427b0862cbf..22dcd12e4c1c 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -38,7 +38,10 @@
38 38
39#include "../pci.h" 39#include "../pci.h"
40#include "pciehp.h" 40#include "pciehp.h"
41 41#include <acpi/acpi.h>
42#include <acpi/acpi_bus.h>
43#include <acpi/actypes.h>
44#include <linux/pci-acpi.h>
42#ifdef DEBUG 45#ifdef DEBUG
43#define DBG_K_TRACE_ENTRY ((unsigned int)0x00000001) /* On function entry */ 46#define DBG_K_TRACE_ENTRY ((unsigned int)0x00000001) /* On function entry */
44#define DBG_K_TRACE_EXIT ((unsigned int)0x00000002) /* On function exit */ 47#define DBG_K_TRACE_EXIT ((unsigned int)0x00000002) /* On function exit */
@@ -1236,6 +1239,75 @@ static struct hpc_ops pciehp_hpc_ops = {
1236 .check_lnk_status = hpc_check_lnk_status, 1239 .check_lnk_status = hpc_check_lnk_status,
1237}; 1240};
1238 1241
1242#ifdef CONFIG_ACPI
1243int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev)
1244{
1245 acpi_status status;
1246 acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev));
1247 struct pci_dev *pdev = dev;
1248 struct pci_bus *parent;
1249 u8 *path_name = NULL;
1250
1251 /*
1252 * Per PCI firmware specification, we should run the ACPI _OSC
1253 * method to get control of hotplug hardware before using it.
1254 * If an _OSC is missing, we look for an OSHP to do the same thing.
1255 * To handle different BIOS behavior, we look for _OSC and OSHP
1256 * within the scope of the hotplug controller and its parents, upto
1257 * the host bridge under which this controller exists.
1258 */
1259 while (!handle) {
1260 /*
1261 * This hotplug controller was not listed in the ACPI name
1262 * space at all. Try to get acpi handle of parent pci bus.
1263 */
1264 if (!pdev || !pdev->bus->parent)
1265 break;
1266 parent = pdev->bus->parent;
1267 dbg("Could not find %s in acpi namespace, trying parent\n",
1268 pci_name(pdev));
1269 if (!parent->self)
1270 /* Parent must be a host bridge */
1271 handle = acpi_get_pci_rootbridge_handle(
1272 pci_domain_nr(parent),
1273 parent->number);
1274 else
1275 handle = DEVICE_ACPI_HANDLE(
1276 &(parent->self->dev));
1277 pdev = parent->self;
1278 }
1279
1280 while (handle) {
1281 path_name = acpi_path_name(handle);
1282 dbg("Trying to get hotplug control for %s \n", path_name);
1283 status = pci_osc_control_set(handle,
1284 OSC_PCI_EXPRESS_NATIVE_HP_CONTROL);
1285 if (status == AE_NOT_FOUND)
1286 status = acpi_run_oshp(handle);
1287 if (ACPI_SUCCESS(status)) {
1288 dbg("Gained control for hotplug HW for pci %s (%s)\n",
1289 pci_name(dev), path_name);
1290 acpi_os_free(path_name);
1291 return 0;
1292 }
1293 if (acpi_root_bridge(handle))
1294 break;
1295 chandle = handle;
1296 status = acpi_get_parent(chandle, &handle);
1297 if (ACPI_FAILURE(status))
1298 break;
1299 }
1300
1301 err("Cannot get control of hotplug hardware for pci %s\n",
1302 pci_name(dev));
1303 if (path_name)
1304 acpi_os_free(path_name);
1305 return -1;
1306}
1307#endif
1308
1309
1310
1239int pcie_init(struct controller * ctrl, struct pcie_device *dev) 1311int pcie_init(struct controller * ctrl, struct pcie_device *dev)
1240{ 1312{
1241 struct php_ctlr_state_s *php_ctlr, *p; 1313 struct php_ctlr_state_s *php_ctlr, *p;