Skip to contentSkip to conversation

finding which pci device works as ide controller for root fs

DISCUSSION Arkadiusz Miskiewicz 3 participants 4 messages Aug 14, 2003 – Aug 15, 2003

lore
Share & tools
lore
#0 lore raw

Hi,

I need /dev/hdX -> pci id mapping for geninitrd script - with modular IDE I need to load some IDE controller driver from initrd to mount root fs.

Now I'm loading all modules for IDE devices found from:
awk ' { print $2 } ' /proc/bus/pci/devices
+ simple file which maps PCI ID to module name like 808684cb piix

How to find controller which is used for root fs (and do not load other modules)? I suppose that on 2.4 this is impossible from userspace but on 2.6 maybe sysfs will be useful.

[arekm@mobarm arekm]$ ls -l /sys/block/hda/device
lrwxrwxrwx 1 root root 46 2003-08-14 00:49
/sys/block/hda/device -> ../../devices/pci0000:00/0000:00:11.1/ide0/0.0

Is it possible to get PCI ID from sysfs for specified device?

Signature · 2 lines
Arkadiusz Miśkiewicz    CS at FoE, Wroclaw University of Technology
[email protected]   AM2-6BONE, 1024/3DB19BBD, arekm(at)ircnet, PLD/Linux
#1 lore raw
Quoted 6 lines · Arkadiusz Miskiewicz

[arekm@mobarm arekm]$ ls -l /sys/block/hda/device
lrwxrwxrwx 1 root root 46 2003-08-14 00:49
/sys/block/hda/device -> ../../devices/pci0000:00/0000:00:11.1/ide0/0.0

Is it possible to get PCI ID from sysfs for specified device?

It's right there in the path to the ide device "0000:00:11.1"

greg k-h

#2 lore raw
Quoted 8 lines · Greg KH
Quoted 5 lines · Arkadiusz Miskiewicz

[arekm@mobarm arekm]$ ls -l /sys/block/hda/device
lrwxrwxrwx 1 root root 46 2003-08-14 00:49
/sys/block/hda/device -> ../../devices/pci0000:00/0000:00:11.1/ide0/0.0

Is it possible to get PCI ID from sysfs for specified device?

It's right there in the path to the ide device "0000:00:11.1"

How's that related to awk ' { print $2 } ' /proc/bus/pci/devices?

Quoted 1 line

greg k-h

Signature · 2 lines
Arkadiusz Miśkiewicz    CS at FoE, Wroclaw University of Technology
[email protected]   AM2-6BONE, 1024/3DB19BBD, arekm(at)ircnet, PLD/Linux
#3 lore raw
Quoted 8 lines · Arkadiusz Miskiewicz
Quoted 6 lines · Greg KH
Quoted 4 lines · Arkadiusz Miskiewicz

[arekm@mobarm arekm]$ ls -l /sys/block/hda/device
lrwxrwxrwx 1 root root 46 2003-08-14 00:49
/sys/block/hda/device -> ../../devices/pci0000:00/0000:00:11.1/ide0/0.0

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Is it possible to get PCI ID from sysfs for specified device?

It's right there in the path to the ide device "0000:00:11.1"

How's that related to awk ' { print $2 } ' /proc/bus/pci/devices?

If you're looking for the vendor and product IDs, they're in /sys/devices/pci..../..../{vendor,device}

Signature · 1 line
Charles Lepple <ghz.cc!clepple>