diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2009-09-14 18:35:35 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-09-14 20:39:12 -0400 |
commit | e81995bb1c0077a312cb621abc406a36f65a986a (patch) | |
tree | 9a451882e0c1528b4fbd9781605e0850d7bcb693 /drivers/pci/hotplug/acpiphp_glue.c | |
parent | 11876e52e9148bf923795d6fcf8abed7f3662aaa (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/hotplug/acpiphp_glue.c')
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 81 |
1 files changed, 2 insertions, 79 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 14e6f1a17f28..58d25a163a8b 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 */ | ||
276 | static 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 */ |
298 | static void init_bridge_misc(struct acpiphp_bridge *bridge) | 275 | static 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 | ||
1250 | static 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 | |||
1301 | static void acpiphp_set_hpp_values(struct pci_bus *bus) | 1227 | static 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 | /* |