aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-09-14 18:35:35 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-09-14 20:39:12 -0400
commite81995bb1c0077a312cb621abc406a36f65a986a (patch)
tree9a451882e0c1528b4fbd9781605e0850d7bcb693 /drivers/pci
parent11876e52e9148bf923795d6fcf8abed7f3662aaa (diff)
PCI hotplug: acpiphp: use generic pci_configure_slot()
Use the generic pci_configure_slot() rather than the acpiphp-specific decode_hpp() and program_hpp(). Unlike the previous acpiphp-specific code, pci_configure_slot() programs PCIe settings when an _HPX method provides them, so acpiphp-managed PCIe devices can now be configured. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/hotplug/acpi_pcihp.c9
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c81
2 files changed, 6 insertions, 84 deletions
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c
index 14d2d8a01f6..ee24de1c5fa 100644
--- a/drivers/pci/hotplug/acpi_pcihp.c
+++ b/drivers/pci/hotplug/acpi_pcihp.c
@@ -322,13 +322,12 @@ static acpi_status acpi_run_oshp(acpi_handle handle)
322 return status; 322 return status;
323} 323}
324 324
325/* acpi_get_hp_params_from_firmware 325/* pci_get_hp_params
326 * 326 *
327 * @dev - the pci_dev for which we want parameters 327 * @dev - the pci_dev for which we want parameters
328 * @hpp - allocated by the caller 328 * @hpp - allocated by the caller
329 */ 329 */
330int acpi_get_hp_params_from_firmware(struct pci_dev *dev, 330int pci_get_hp_params(struct pci_dev *dev, struct hotplug_params *hpp)
331 struct hotplug_params *hpp)
332{ 331{
333 acpi_status status; 332 acpi_status status;
334 acpi_handle handle, phandle; 333 acpi_handle handle, phandle;
@@ -345,7 +344,7 @@ int acpi_get_hp_params_from_firmware(struct pci_dev *dev,
345 * _HPP settings apply to all child buses, until another _HPP is 344 * _HPP settings apply to all child buses, until another _HPP is
346 * encountered. If we don't find an _HPP for the input pci dev, 345 * encountered. If we don't find an _HPP for the input pci dev,
347 * look for it in the parent device scope since that would apply to 346 * look for it in the parent device scope since that would apply to
348 * this pci dev. If we don't find any _HPP, use hardcoded defaults 347 * this pci dev.
349 */ 348 */
350 while (handle) { 349 while (handle) {
351 status = acpi_run_hpx(handle, hpp); 350 status = acpi_run_hpx(handle, hpp);
@@ -363,7 +362,7 @@ int acpi_get_hp_params_from_firmware(struct pci_dev *dev,
363 } 362 }
364 return -ENODEV; 363 return -ENODEV;
365} 364}
366EXPORT_SYMBOL_GPL(acpi_get_hp_params_from_firmware); 365EXPORT_SYMBOL_GPL(pci_get_hp_params);
367 366
368/** 367/**
369 * acpi_get_hp_hw_control_from_firmware 368 * acpi_get_hp_hw_control_from_firmware
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 14e6f1a17f2..58d25a163a8 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -271,29 +271,6 @@ static int detect_ejectable_slots(acpi_handle handle)
271 return found; 271 return found;
272} 272}
273 273
274
275/* decode ACPI 2.0 _HPP hot plug parameters */
276static void decode_hpp(struct pci_dev *dev, struct hotplug_params *hpp)
277{
278 int ret;
279
280 ret = acpi_get_hp_params_from_firmware(dev, hpp);
281 if (ret || !hpp->t0 || (hpp->t0->revision > 1)) {
282 /* use default numbers */
283 printk(KERN_WARNING
284 "%s: Could not get hotplug parameters. Use defaults\n",
285 __func__);
286 hpp->t0 = &hpp->type0_data;
287 hpp->t0->revision = 0;
288 hpp->t0->cache_line_size = 0x10;
289 hpp->t0->latency_timer = 0x40;
290 hpp->t0->enable_serr = 0;
291 hpp->t0->enable_perr = 0;
292 }
293}
294
295
296
297/* initialize miscellaneous stuff for both root and PCI-to-PCI bridge */ 274/* initialize miscellaneous stuff for both root and PCI-to-PCI bridge */
298static void init_bridge_misc(struct acpiphp_bridge *bridge) 275static void init_bridge_misc(struct acpiphp_bridge *bridge)
299{ 276{
@@ -1247,66 +1224,12 @@ static int acpiphp_check_bridge(struct acpiphp_bridge *bridge)
1247 return retval; 1224 return retval;
1248} 1225}
1249 1226
1250static void program_hpp(struct pci_dev *dev, struct hotplug_params *hpp)
1251{
1252 u16 pci_cmd, pci_bctl;
1253 struct pci_dev *cdev;
1254
1255 /* Program hpp values for this device */
1256 if (!(dev->hdr_type == PCI_HEADER_TYPE_NORMAL ||
1257 (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE &&
1258 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI)))
1259 return;
1260
1261 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_HOST)
1262 return;
1263
1264 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE,
1265 hpp->t0->cache_line_size);
1266 pci_write_config_byte(dev, PCI_LATENCY_TIMER,
1267 hpp->t0->latency_timer);
1268 pci_read_config_word(dev, PCI_COMMAND, &pci_cmd);
1269 if (hpp->t0->enable_serr)
1270 pci_cmd |= PCI_COMMAND_SERR;
1271 else
1272 pci_cmd &= ~PCI_COMMAND_SERR;
1273 if (hpp->t0->enable_perr)
1274 pci_cmd |= PCI_COMMAND_PARITY;
1275 else
1276 pci_cmd &= ~PCI_COMMAND_PARITY;
1277 pci_write_config_word(dev, PCI_COMMAND, pci_cmd);
1278
1279 /* Program bridge control value and child devices */
1280 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
1281 pci_write_config_byte(dev, PCI_SEC_LATENCY_TIMER,
1282 hpp->t0->latency_timer);
1283 pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &pci_bctl);
1284 if (hpp->t0->enable_serr)
1285 pci_bctl |= PCI_BRIDGE_CTL_SERR;
1286 else
1287 pci_bctl &= ~PCI_BRIDGE_CTL_SERR;
1288 if (hpp->t0->enable_perr)
1289 pci_bctl |= PCI_BRIDGE_CTL_PARITY;
1290 else
1291 pci_bctl &= ~PCI_BRIDGE_CTL_PARITY;
1292 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, pci_bctl);
1293 if (dev->subordinate) {
1294 list_for_each_entry(cdev, &dev->subordinate->devices,
1295 bus_list)
1296 program_hpp(cdev, hpp);
1297 }
1298 }
1299}
1300
1301static void acpiphp_set_hpp_values(struct pci_bus *bus) 1227static void acpiphp_set_hpp_values(struct pci_bus *bus)
1302{ 1228{
1303 struct pci_dev *dev; 1229 struct pci_dev *dev;
1304 struct hotplug_params hpp;
1305 1230
1306 list_for_each_entry(dev, &bus->devices, bus_list) { 1231 list_for_each_entry(dev, &bus->devices, bus_list)
1307 decode_hpp(dev, &hpp); 1232 pci_configure_slot(dev);
1308 program_hpp(dev, &hpp);
1309 }
1310} 1233}
1311 1234
1312/* 1235/*