4

Is there a mapping from the /dev major minor device number to the output of lspci (domain:bus:slot number)? I would like to determine the closest CPU to a specific hardware device.

3 Answers 3

1

I assume you're talking about a x86 platform with a BIOS. I don't think there is a direct correlation, it's just the way numbered it is detected, depending on a lot of factors, esp. the BIOS.

Maybe you can invent your own scheme by using udev-rules. Here is a tutorial. The KERNELS variable seems to be relevant indicator here.

0

What kind of device? Some (i.e. network interfaces) don't have a device node - but for things like block devices, you can grab bits out of sysfs:

$ readlink /sys/block/sda/device/scsi_device*/device 
../../../devices/pci0000:00/0000:00:09.0/0000:03:00.0/0000:04:00.0/0000:05:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0
0

It turns out that this character device actually had a device show capability with a command line switch in one of its control programs. The mapping turned out to follow the mapping of lspci (devices displayed in order of discovery) so I assume the PCI discovery method must walk forward in a similar manner.

You must log in to answer this question.