mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-12 16:15:05 -04:00
PCI: Log device type during enumeration
Log the device type when enumeration a device. Sample output changes: - pci 0000:00:00.0: [8086:1237] type 00 class 0x060000 + pci 0000:00:00.0: [8086:1237] type 00 class 0x060000 conventional PCI endpoint - pci 0000:00:1c.0: [8086:a110] type 01 class 0x060400 + pci 0000:00:1c.0: [8086:a110] type 01 class 0x060400 PCIe Root Port Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
@@ -1817,6 +1817,43 @@ static void early_dump_pci_device(struct pci_dev *pdev)
|
||||
value, 256, false);
|
||||
}
|
||||
|
||||
static const char *pci_type_str(struct pci_dev *dev)
|
||||
{
|
||||
static const char * const str[] = {
|
||||
"PCIe Endpoint",
|
||||
"PCIe Legacy Endpoint",
|
||||
"PCIe unknown",
|
||||
"PCIe unknown",
|
||||
"PCIe Root Port",
|
||||
"PCIe Switch Upstream Port",
|
||||
"PCIe Switch Downstream Port",
|
||||
"PCIe to PCI/PCI-X bridge",
|
||||
"PCI/PCI-X to PCIe bridge",
|
||||
"PCIe Root Complex Integrated Endpoint",
|
||||
"PCIe Root Complex Event Collector",
|
||||
};
|
||||
int type;
|
||||
|
||||
if (pci_is_pcie(dev)) {
|
||||
type = pci_pcie_type(dev);
|
||||
if (type < ARRAY_SIZE(str))
|
||||
return str[type];
|
||||
|
||||
return "PCIe unknown";
|
||||
}
|
||||
|
||||
switch (dev->hdr_type) {
|
||||
case PCI_HEADER_TYPE_NORMAL:
|
||||
return "conventional PCI endpoint";
|
||||
case PCI_HEADER_TYPE_BRIDGE:
|
||||
return "conventional PCI bridge";
|
||||
case PCI_HEADER_TYPE_CARDBUS:
|
||||
return "CardBus bridge";
|
||||
default:
|
||||
return "conventional PCI";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* pci_setup_device - Fill in class and map information of a device
|
||||
* @dev: the device structure to fill
|
||||
@@ -1887,8 +1924,9 @@ int pci_setup_device(struct pci_dev *dev)
|
||||
|
||||
pci_set_removable(dev);
|
||||
|
||||
pci_info(dev, "[%04x:%04x] type %02x class %#08x\n",
|
||||
dev->vendor, dev->device, dev->hdr_type, dev->class);
|
||||
pci_info(dev, "[%04x:%04x] type %02x class %#08x %s\n",
|
||||
dev->vendor, dev->device, dev->hdr_type, dev->class,
|
||||
pci_type_str(dev));
|
||||
|
||||
/* Device class may be changed after fixup */
|
||||
class = dev->class >> 8;
|
||||
|
||||
Reference in New Issue
Block a user