aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/acpiphp_glue.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-09-14 18:35:10 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-09-14 20:38:22 -0400
commitfca6825ad7382ae9df8ecda9068ac13ee9e343f4 (patch)
tree2a1c1f852b049bb9f834f5cb443be39851022cc7 /drivers/pci/hotplug/acpiphp_glue.c
parentdffb4bb560ed73937a52c68c304b232c743b49f7 (diff)
PCI hotplug: acpiphp: don't cache hotplug_params in acpiphp_bridge
We always look up hotplug_params with decode_hpp() immediately before using them, so we don't need to save them in the acpiphp_bridge struct. This patch follows the example of program_fw_provided_values() in pciehp_pci.c and shpchp_pci.c by just keeping the params on the stack while we need them. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Reviewed-by: Alex Chiang <achiang@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/hotplug/acpiphp_glue.c')
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c58
1 files changed, 27 insertions, 31 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index e0623373615f..db81c08de8d5 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -59,7 +59,7 @@ static DEFINE_SPINLOCK(ioapic_list_lock);
59 59
60static void handle_hotplug_event_bridge (acpi_handle, u32, void *); 60static void handle_hotplug_event_bridge (acpi_handle, u32, void *);
61static void acpiphp_sanitize_bus(struct pci_bus *bus); 61static void acpiphp_sanitize_bus(struct pci_bus *bus);
62static void acpiphp_set_hpp_values(acpi_handle handle, struct pci_bus *bus); 62static void acpiphp_set_hpp_values(struct pci_bus *bus);
63static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context); 63static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context);
64 64
65/* callback routine to check for the existence of a pci dock device */ 65/* callback routine to check for the existence of a pci dock device */
@@ -273,23 +273,23 @@ static int detect_ejectable_slots(acpi_handle handle)
273 273
274 274
275/* decode ACPI 2.0 _HPP hot plug parameters */ 275/* decode ACPI 2.0 _HPP hot plug parameters */
276static void decode_hpp(struct acpiphp_bridge *bridge) 276static void decode_hpp(struct pci_dev *dev, struct hotplug_params *hpp)
277{ 277{
278 acpi_status status; 278 acpi_status status;
279 279
280 status = acpi_get_hp_params_from_firmware(bridge->pci_bus, &bridge->hpp); 280 status = acpi_get_hp_params_from_firmware(dev->bus, hpp);
281 if (ACPI_FAILURE(status) || 281 if (ACPI_FAILURE(status) ||
282 !bridge->hpp.t0 || (bridge->hpp.t0->revision > 1)) { 282 !hpp->t0 || (hpp->t0->revision > 1)) {
283 /* use default numbers */ 283 /* use default numbers */
284 printk(KERN_WARNING 284 printk(KERN_WARNING
285 "%s: Could not get hotplug parameters. Use defaults\n", 285 "%s: Could not get hotplug parameters. Use defaults\n",
286 __func__); 286 __func__);
287 bridge->hpp.t0 = &bridge->hpp.type0_data; 287 hpp->t0 = &hpp->type0_data;
288 bridge->hpp.t0->revision = 0; 288 hpp->t0->revision = 0;
289 bridge->hpp.t0->cache_line_size = 0x10; 289 hpp->t0->cache_line_size = 0x10;
290 bridge->hpp.t0->latency_timer = 0x40; 290 hpp->t0->latency_timer = 0x40;
291 bridge->hpp.t0->enable_serr = 0; 291 hpp->t0->enable_serr = 0;
292 bridge->hpp.t0->enable_perr = 0; 292 hpp->t0->enable_perr = 0;
293 } 293 }
294} 294}
295 295
@@ -1037,7 +1037,7 @@ static int __ref enable_device(struct acpiphp_slot *slot)
1037 1037
1038 pci_bus_assign_resources(bus); 1038 pci_bus_assign_resources(bus);
1039 acpiphp_sanitize_bus(bus); 1039 acpiphp_sanitize_bus(bus);
1040 acpiphp_set_hpp_values(slot->bridge->handle, bus); 1040 acpiphp_set_hpp_values(bus);
1041 list_for_each_entry(func, &slot->funcs, sibling) 1041 list_for_each_entry(func, &slot->funcs, sibling)
1042 acpiphp_configure_ioapics(func->handle); 1042 acpiphp_configure_ioapics(func->handle);
1043 pci_enable_bridges(bus); 1043 pci_enable_bridges(bus);
@@ -1248,7 +1248,7 @@ static int acpiphp_check_bridge(struct acpiphp_bridge *bridge)
1248 return retval; 1248 return retval;
1249} 1249}
1250 1250
1251static void program_hpp(struct pci_dev *dev, struct acpiphp_bridge *bridge) 1251static void program_hpp(struct pci_dev *dev, struct hotplug_params *hpp)
1252{ 1252{
1253 u16 pci_cmd, pci_bctl; 1253 u16 pci_cmd, pci_bctl;
1254 struct pci_dev *cdev; 1254 struct pci_dev *cdev;
@@ -1263,15 +1263,15 @@ static void program_hpp(struct pci_dev *dev, struct acpiphp_bridge *bridge)
1263 return; 1263 return;
1264 1264
1265 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 1265 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE,
1266 bridge->hpp.t0->cache_line_size); 1266 hpp->t0->cache_line_size);
1267 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 1267 pci_write_config_byte(dev, PCI_LATENCY_TIMER,
1268 bridge->hpp.t0->latency_timer); 1268 hpp->t0->latency_timer);
1269 pci_read_config_word(dev, PCI_COMMAND, &pci_cmd); 1269 pci_read_config_word(dev, PCI_COMMAND, &pci_cmd);
1270 if (bridge->hpp.t0->enable_serr) 1270 if (hpp->t0->enable_serr)
1271 pci_cmd |= PCI_COMMAND_SERR; 1271 pci_cmd |= PCI_COMMAND_SERR;
1272 else 1272 else
1273 pci_cmd &= ~PCI_COMMAND_SERR; 1273 pci_cmd &= ~PCI_COMMAND_SERR;
1274 if (bridge->hpp.t0->enable_perr) 1274 if (hpp->t0->enable_perr)
1275 pci_cmd |= PCI_COMMAND_PARITY; 1275 pci_cmd |= PCI_COMMAND_PARITY;
1276 else 1276 else
1277 pci_cmd &= ~PCI_COMMAND_PARITY; 1277 pci_cmd &= ~PCI_COMMAND_PARITY;
@@ -1280,13 +1280,13 @@ static void program_hpp(struct pci_dev *dev, struct acpiphp_bridge *bridge)
1280 /* Program bridge control value and child devices */ 1280 /* Program bridge control value and child devices */
1281 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { 1281 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
1282 pci_write_config_byte(dev, PCI_SEC_LATENCY_TIMER, 1282 pci_write_config_byte(dev, PCI_SEC_LATENCY_TIMER,
1283 bridge->hpp.t0->latency_timer); 1283 hpp->t0->latency_timer);
1284 pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &pci_bctl); 1284 pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &pci_bctl);
1285 if (bridge->hpp.t0->enable_serr) 1285 if (hpp->t0->enable_serr)
1286 pci_bctl |= PCI_BRIDGE_CTL_SERR; 1286 pci_bctl |= PCI_BRIDGE_CTL_SERR;
1287 else 1287 else
1288 pci_bctl &= ~PCI_BRIDGE_CTL_SERR; 1288 pci_bctl &= ~PCI_BRIDGE_CTL_SERR;
1289 if (bridge->hpp.t0->enable_perr) 1289 if (hpp->t0->enable_perr)
1290 pci_bctl |= PCI_BRIDGE_CTL_PARITY; 1290 pci_bctl |= PCI_BRIDGE_CTL_PARITY;
1291 else 1291 else
1292 pci_bctl &= ~PCI_BRIDGE_CTL_PARITY; 1292 pci_bctl &= ~PCI_BRIDGE_CTL_PARITY;
@@ -1294,24 +1294,20 @@ static void program_hpp(struct pci_dev *dev, struct acpiphp_bridge *bridge)
1294 if (dev->subordinate) { 1294 if (dev->subordinate) {
1295 list_for_each_entry(cdev, &dev->subordinate->devices, 1295 list_for_each_entry(cdev, &dev->subordinate->devices,
1296 bus_list) 1296 bus_list)
1297 program_hpp(cdev, bridge); 1297 program_hpp(cdev, hpp);
1298 } 1298 }
1299 } 1299 }
1300} 1300}
1301 1301
1302static void acpiphp_set_hpp_values(acpi_handle handle, struct pci_bus *bus) 1302static void acpiphp_set_hpp_values(struct pci_bus *bus)
1303{ 1303{
1304 struct acpiphp_bridge bridge;
1305 struct pci_dev *dev; 1304 struct pci_dev *dev;
1305 struct hotplug_params hpp;
1306 1306
1307 memset(&bridge, 0, sizeof(bridge)); 1307 list_for_each_entry(dev, &bus->devices, bus_list) {
1308 bridge.handle = handle; 1308 decode_hpp(dev, &hpp);
1309 bridge.pci_bus = bus; 1309 program_hpp(dev, &hpp);
1310 bridge.pci_dev = bus->self; 1310 }
1311 decode_hpp(&bridge);
1312 list_for_each_entry(dev, &bus->devices, bus_list)
1313 program_hpp(dev, &bridge);
1314
1315} 1311}
1316 1312
1317/* 1313/*
@@ -1355,7 +1351,7 @@ static int acpiphp_configure_bridge (acpi_handle handle)
1355 pci_bus_size_bridges(bus); 1351 pci_bus_size_bridges(bus);
1356 pci_bus_assign_resources(bus); 1352 pci_bus_assign_resources(bus);
1357 acpiphp_sanitize_bus(bus); 1353 acpiphp_sanitize_bus(bus);
1358 acpiphp_set_hpp_values(handle, bus); 1354 acpiphp_set_hpp_values(bus);
1359 pci_enable_bridges(bus); 1355 pci_enable_bridges(bus);
1360 acpiphp_configure_ioapics(handle); 1356 acpiphp_configure_ioapics(handle);
1361 return 0; 1357 return 0;