View | Details | Raw Unified | Return to bug 198557 | Differences between
and this patch

Collapse All | Expand All

(-)a/drivers/pci/hotplug/acpiphp_glue.c (-6 / +39 lines)
Lines 459-471 static void enable_slot(struct acpiphp_slot *slot) Link Here
459
	int max, pass;
459
	int max, pass;
460
	LIST_HEAD(add_list);
460
	LIST_HEAD(add_list);
461
461
462
	dev_info(&bus->dev, "enable slot start\n");
463
462
	acpiphp_rescan_slot(slot);
464
	acpiphp_rescan_slot(slot);
463
	max = acpiphp_max_busnr(bus);
465
	max = acpiphp_max_busnr(bus);
464
	for (pass = 0; pass < 2; pass++) {
466
	for (pass = 0; pass < 2; pass++) {
465
		for_each_pci_bridge(dev, bus) {
467
		for_each_pci_bridge(dev, bus) {
468
			dev_info(&dev->dev, "each bridge, pass %d\n", pass);
466
			if (PCI_SLOT(dev->devfn) != slot->device)
469
			if (PCI_SLOT(dev->devfn) != slot->device)
467
				continue;
470
				continue;
468
471
472
			dev_info(&dev->dev, "scanning bridge, pass %d\n", pass);
469
			max = pci_scan_bridge(bus, dev, max, pass);
473
			max = pci_scan_bridge(bus, dev, max, pass);
470
			if (pass && dev->subordinate) {
474
			if (pass && dev->subordinate) {
471
				check_hotplug_bridge(slot, dev);
475
				check_hotplug_bridge(slot, dev);
Lines 499-504 static void enable_slot(struct acpiphp_slot *slot) Link Here
499
			continue;
503
			continue;
500
		}
504
		}
501
	}
505
	}
506
507
	dev_info(&bus->dev, "enable slot finished\n");
502
}
508
}
503
509
504
/**
510
/**
Lines 558-569 static unsigned int get_slot_status(struct acpiphp_slot *slot) Link Here
558
564
559
	list_for_each_entry(func, &slot->funcs, sibling) {
565
	list_for_each_entry(func, &slot->funcs, sibling) {
560
		if (func->flags & FUNC_HAS_STA) {
566
		if (func->flags & FUNC_HAS_STA) {
567
			acpi_handle handle = func_to_handle(func);
561
			acpi_status status;
568
			acpi_status status;
562
569
563
			status = acpi_evaluate_integer(func_to_handle(func),
570
			status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
564
						       "_STA", NULL, &sta);
571
565
			if (ACPI_SUCCESS(status) && sta)
572
573
			if (ACPI_SUCCESS(status) && sta) {
574
				acpi_handle_info(handle, "_STA returned %llx\n", sta);
566
				break;
575
				break;
576
			}
577
			acpi_handle_info(handle, "_STA failed\n");
567
		} else {
578
		} else {
568
			u32 dvid;
579
			u32 dvid;
569
580
Lines 571-576 static unsigned int get_slot_status(struct acpiphp_slot *slot) Link Here
571
						  PCI_DEVFN(slot->device,
582
						  PCI_DEVFN(slot->device,
572
							    func->function),
583
							    func->function),
573
						  PCI_VENDOR_ID, &dvid);
584
						  PCI_VENDOR_ID, &dvid);
585
			dev_info(&slot->bus->dev, "%#x dvid %#x\n", PCI_DEVFN(slot->device, func->function), dvid);
574
			if (dvid != 0xffffffff) {
586
			if (dvid != 0xffffffff) {
575
				sta = ACPI_STA_ALL;
587
				sta = ACPI_STA_ALL;
576
				break;
588
				break;
Lines 578-583 static unsigned int get_slot_status(struct acpiphp_slot *slot) Link Here
578
		}
590
		}
579
	}
591
	}
580
592
593
	if (!sta) {
594
		u32 dvid;
595
596
		pr_info("get_slot_status() reading function 0 dvid\n");
597
598
		pci_bus_read_config_dword(slot->bus, PCI_DEVFN(slot->device, 0),
599
					  PCI_VENDOR_ID, &dvid);
600
		dev_info(&slot->bus->dev, "got %#x dvid %#x\n",
601
			PCI_DEVFN(slot->device, func->function), dvid);
602
		if (dvid != 0xffffffff)
603
			sta = ACPI_STA_ALL;
604
	}
605
606
	pr_info("get_slot_status() returns: %#llx\n", sta);
607
581
	return (unsigned int)sta;
608
	return (unsigned int)sta;
582
}
609
}
583
610
Lines 643-656 static void acpiphp_check_bridge(struct acpiphp_bridge *bridge) Link Here
643
	if (bridge->is_going_away)
670
	if (bridge->is_going_away)
644
		return;
671
		return;
645
672
646
	if (bridge->pci_dev)
673
	if (bridge->pci_dev) {
647
		pm_runtime_get_sync(&bridge->pci_dev->dev);
674
		pm_runtime_get_sync(&bridge->pci_dev->dev);
675
		dev_info(&bridge->pci_dev->dev, "ACPIphp scanning bridge\n");
676
	}
648
677
649
	list_for_each_entry(slot, &bridge->slots, node) {
678
	list_for_each_entry(slot, &bridge->slots, node) {
650
		struct pci_bus *bus = slot->bus;
679
		struct pci_bus *bus = slot->bus;
651
		struct pci_dev *dev, *tmp;
680
		struct pci_dev *dev, *tmp;
652
681
653
		if (slot_no_hotplug(slot)) {
682
		if (slot_no_hotplug(slot)) {
683
			pr_info("ACPIphp no hotplug for slot\n");
654
			; /* do nothing */
684
			; /* do nothing */
655
		} else if (device_status_valid(get_slot_status(slot))) {
685
		} else if (device_status_valid(get_slot_status(slot))) {
656
			/* remove stale devices if any */
686
			/* remove stale devices if any */
Lines 660-673 static void acpiphp_check_bridge(struct acpiphp_bridge *bridge) Link Here
660
					trim_stale_devices(dev);
690
					trim_stale_devices(dev);
661
691
662
			/* configure all functions */
692
			/* configure all functions */
693
			pr_info("ACPIphp enabling slot\n");
663
			enable_slot(slot);
694
			enable_slot(slot);
664
		} else {
695
		} else {
696
			pr_info("ACPIphp disabling slot\n");
665
			disable_slot(slot);
697
			disable_slot(slot);
666
		}
698
		}
667
	}
699
	}
668
700
669
	if (bridge->pci_dev)
701
	if (bridge->pci_dev) {
702
		dev_info(&bridge->pci_dev->dev, "ACPIphp bridge scanned\n");
670
		pm_runtime_put(&bridge->pci_dev->dev);
703
		pm_runtime_put(&bridge->pci_dev->dev);
704
	}
671
}
705
}
672
706
673
/*
707
/*
674
- 

Return to bug 198557