Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

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.

share|improve this answer

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
share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.