This is the code I've been using to test the cur/max bus speed changes. It creates a pci_slot for every PCIe bridge in the system that claims to have a slot. Unfortunately, my motherboard manufacturer (Asus) didn't bother to set the Slot bits correctly, so it looks like this: ls /sys/bus/pci/slots/ 0 0-1 0-2 0-3 0-4 1 1-1 2 2-1 3 5 6 I should have slots labelled 1 to 6, but several of the links which are to onboard devices still have the Slot bits set, and a lot of the Slot numbers are programmed incorrectly (eg they're the logical slot of that downstream port, not the physical slot number). I suspect this is fairly common, so I'm not asking for this code to be merged. It's interesting for testing purposes though. #include <linux/init.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/pci_regs.h> static void pcie_slot_create(struct pci_dev *dev) { u32 sltcap; char name[8]; pci_read_config_dword(dev, pci_pcie_cap(dev) + PCI_EXP_SLTCAP, &sltcap); sprintf(name, "%d", sltcap >> 19); pci_create_slot(dev->subordinate, 0, name, NULL); } static int has_slot(struct pci_dev *dev) { u16 flags; unsigned cap = pci_pcie_cap(dev); if (!cap) return 0; pci_read_config_word(dev, cap + PCI_EXP_FLAGS, &flags); return flags & PCI_EXP_FLAGS_SLOT; } static void pcie_slot_destroy(struct pci_dev *dev) { pci_destroy_slot(list_first_entry(&dev->subordinate->slots, struct pci_slot, list)); } static void pcie_slot_exit(void) { struct pci_dev *dev = NULL; for_each_pci_dev(dev) { if (has_slot(dev)) pcie_slot_destroy(dev); } } static int pcie_slot_init(void) { struct pci_dev *dev = NULL; for_each_pci_dev(dev) { if (has_slot(dev)) pcie_slot_create(dev); } return 0; } module_init(pcie_slot_init); module_exit(pcie_slot_exit); MODULE_LICENSE("GPL"); -- Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step." -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html