Skip to contentSkip to conversation

enumerating devices from user space

parisc-linux Lyonel Vincent 4 participants 7 messages Mar 12, 2003 – Mar 13, 2003

lore
Share & tools
lore
#0 lore raw

Hi there,

I'm currently implementing a small tool called lshw (you can find it on Freshmeat) that enumerates installed devices on a machine and reports them as a device tree (text, HTML and XML).
For now it knows about DMI, PCI busses, SCSI, IDE and PCMCIA and I would like to port it to PA-RISC Linux. I already get some very basic info from /proc/cpuinfo.
Does anyone know how I can access the device tree as seen by the kernel? (much like HP-UX's ioscan does and what is shown in dmesg) I've tried digging in /proc without much success... is there a way to get this information from user space? PPC Linux exposes the device tree in /proc for example. A mechanism similar to /proc/bus/pci/devices (machine- parseable text) would be great, too.

thanks for your help,
Lyonel.

PS: I noticed that /proc/iomem lists 00000000-000009ff as "PDC data (Page Zero)", is there a chance I can find what I need there? (I dd-ed it from /dev/mem but I can't say if it contains useful data...)

Signature · 1 line
The software said it requires Windows 2000 or better, so I installed Linux.
#1 lore raw
Quoted 3 lines · Lyonel Vincent

I'm currently implementing a small tool called lshw (you can find it on Freshmeat) that enumerates installed devices on a machine and reports them as a device tree (text, HTML and XML).

That's cool.

Quoted 5 lines

For now it knows about DMI, PCI busses, SCSI, IDE and PCMCIA and I would like to port it to PA-RISC Linux. I already get some very basic info from /proc/cpuinfo.
Does anyone know how I can access the device tree as seen by the kernel? (much like HP-UX's ioscan does and what is shown in dmesg)

You can look in /var/log/dmesg. For example...

Found devices:
1. U2-IOA BC Runway Port (12) at 0xfff88000 [8], versions 0x580, 0xf, 0xb
2. Dino PCI Bridge (13) at 0xf2000000 [8/0], versions 0x680, 0x0, 0xa, additional addresses: 0xf2800000
3. Raven U/L2 Dino PS/2 Port (10) at 0xf2001000 [8/1], versions 0x6, 0x0, 0x96
4. Raven U/L2 Dino RS-232 (10) at 0xf2003000 [8/3], versions 0x6, 0x0, 0x8c
5. Raven U/L2 Core FW-SCSI (4) at 0xf200c000 [8/12], versions 0x3b, 0x0, 0x89
6. Raven U/L2 Core BA (11) at 0xffd00000 [8/16], versions 0x3b, 0x0, 0x81, additional addresses: 0xffd0c000 0xffc00000
7. Raven U/L2 Core Centronics (10) at 0xffd02000 [8/16/0], versions 0x3b, 0x0, 0x74, additional addresses: 0xffd01000 0xffd03000
8. Raven U/L2 Core Audio (10) at 0xffd04000 [8/16/1], versions 0x3b, 0x4, 0x7b
9. Raven U/L2 Core RS-232 (10) at 0xffd05000 [8/16/4], versions 0x3b, 0x0, 0x8c
10. Raven U/L2 Core SCSI (10) at 0xffd06000 [8/16/5], versions 0x3b, 0x0, 0x82
11. Raven U/L2 Core LAN (802.3) (10) at 0xffd07000 [8/16/6], versions 0x3b, 0x0, 0x8a
12. Raven U/L2 Core PS/2 Port (10) at 0xffd08000 [8/16/7], versions 0x3b, 0x0, 0x84
13. Raven U/L2 Core PS/2 Port (10) at 0xffd08100 [8/16/8], versions 0x3b, 0x0, 0x84
14. Raven Backplane Wax BA (11) at 0xffe00000 [8/20], versions 0x17, 0x0, 0x8e
15. Raven Backplane Wax HIL (10) at 0xffe01000 [8/20/1], versions 0x17, 0x0, 0x73
16. Raven Backplane RS-232 (10) at 0xffe02000 [8/20/2], versions 0x17, 0x0, 0x8c
17. Raven Backplane Wax EISA BA (11) at 0xfc000000 [8/20/5], versions 0x17, 0x0, 0x90, additional addresses: 0xffc88000 0xfc00000b
18. Gecko GSC Core Graphics (10) at 0xfa000000 [8/24], versions 0x16, 0x0, 0x85, additional addresses: 0xf0026000
19. U2-IOA BC GSC+ Port (7) at 0xf203f000 [8/63], versions 0x501, 0x1, 0xc
20. U2-IOA BC Runway Port (12) at 0xfff8a000 [10], versions 0x580, 0xf, 0xb
21. U2-IOA BC GSC+ Port (7) at 0xf103f000 [10/63], versions 0x501, 0x1, 0xc
22. Raven U 240 (9000/780/C240) (0) at 0xfffa0000 [32], versions 0x599, 0x0, 0x4
23. Memory (1) at 0xfffb1000 [49], versions 0x6f, 0x0, 0x9

The numbers in [] tell you what the tree looks like. In this example, we have 4 top-level devices: #1, #20, #22 & #23.

Quoted 4 lines

I've tried digging in /proc without much success... is there a way to get this information from user space? PPC Linux exposes the device tree in /proc for example. A mechanism similar to /proc/bus/pci/devices (machine- parseable text) would be great, too.

In 2.5, this information's available via sysfs. I don't think we'll expose it in /proc.

Quoted 3 lines

PS: I noticed that /proc/iomem lists 00000000-000009ff as "PDC data (Page Zero)", is there a chance I can find what I need there? (I dd-ed it from /dev/mem but I can't say if it contains useful data...)

No, you need to actually make firmware calls and you can't do that from user mode.

Signature · 3 lines
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
#2 lore raw

many thanks for the prompt answer

well... that's exactly the answer I didn't want to ear ;o) lshw can't reasonably assume that /var/log/dmesg exists and is correct (or even dmesg) and dig into the trash.

My kernel programming skills are extremely limited (not to say inexistent) but how difficult would it be to expose this information to user space through /proc? (AFAICT, we already have PA-RISC specific files like /proc/bus/runway) A simplistic format like <hwpath>\t<type> <instance> <hversion> <sversion> etc. would do.
Do you think it'd be useful to make that kind of information available to user- space? (besides lshw of course ;op) If it's the case I'll try to do my best...

cheers,
lv.

Quoted 62 lines · Matthew Wilcox
Quoted 3 lines · Lyonel Vincent

I'm currently implementing a small tool called lshw (you can find it on Freshmeat) that enumerates installed devices on a machine and reports them as a device tree (text, HTML and XML).

That's cool.

Quoted 5 lines

For now it knows about DMI, PCI busses, SCSI, IDE and PCMCIA and I would like to port it to PA-RISC Linux. I already get some very basic info from /proc/cpuinfo.
Does anyone know how I can access the device tree as seen by the kernel? (much like HP-UX's ioscan does and what is shown in dmesg)

You can look in /var/log/dmesg. For example...

Found devices:
1. U2-IOA BC Runway Port (12) at 0xfff88000 [8], versions 0x580, 0xf, 0xb
2. Dino PCI Bridge (13) at 0xf2000000 [8/0], versions 0x680, 0x0, 0xa, additional addresses: 0xf2800000
3. Raven U/L2 Dino PS/2 Port (10) at 0xf2001000 [8/1], versions 0x6, 0x0, 0x96
4. Raven U/L2 Dino RS-232 (10) at 0xf2003000 [8/3], versions 0x6, 0x0, 0x8c
5. Raven U/L2 Core FW-SCSI (4) at 0xf200c000 [8/12], versions 0x3b, 0x0, 0x89
6. Raven U/L2 Core BA (11) at 0xffd00000 [8/16], versions 0x3b, 0x0, 0x81, additional addresses: 0xffd0c000 0xffc00000
7. Raven U/L2 Core Centronics (10) at 0xffd02000 [8/16/0], versions 0x3b, 0x0, 0x74, additional addresses: 0xffd01000 0xffd03000
8. Raven U/L2 Core Audio (10) at 0xffd04000 [8/16/1], versions 0x3b, 0x4, 0x7b
9. Raven U/L2 Core RS-232 (10) at 0xffd05000 [8/16/4], versions 0x3b, 0x0, 0x8c
10. Raven U/L2 Core SCSI (10) at 0xffd06000 [8/16/5], versions 0x3b, 0x0, 0x82
11. Raven U/L2 Core LAN (802.3) (10) at 0xffd07000 [8/16/6], versions 0x3b, 0x0, 0x8a
12. Raven U/L2 Core PS/2 Port (10) at 0xffd08000 [8/16/7], versions 0x3b, 0x0, 0x84
13. Raven U/L2 Core PS/2 Port (10) at 0xffd08100 [8/16/8], versions 0x3b, 0x0, 0x84
14. Raven Backplane Wax BA (11) at 0xffe00000 [8/20], versions 0x17, 0x0, 0x8e
15. Raven Backplane Wax HIL (10) at 0xffe01000 [8/20/1], versions 0x17, 0x0, 0x73
16. Raven Backplane RS-232 (10) at 0xffe02000 [8/20/2], versions 0x17, 0x0, 0x8c
17. Raven Backplane Wax EISA BA (11) at 0xfc000000 [8/20/5], versions 0x17, 0x0, 0x90, additional addresses: 0xffc88000 0xfc00000b
18. Gecko GSC Core Graphics (10) at 0xfa000000 [8/24], versions 0x16, 0x0, 0x85, additional addresses: 0xf0026000
19. U2-IOA BC GSC+ Port (7) at 0xf203f000 [8/63], versions 0x501, 0x1, 0xc
20. U2-IOA BC Runway Port (12) at 0xfff8a000 [10], versions 0x580, 0xf, 0xb
21. U2-IOA BC GSC+ Port (7) at 0xf103f000 [10/63], versions 0x501, 0x1, 0xc
22. Raven U 240 (9000/780/C240) (0) at 0xfffa0000 [32], versions 0x599, 0x0, 0x4
23. Memory (1) at 0xfffb1000 [49], versions 0x6f, 0x0, 0x9

The numbers in [] tell you what the tree looks like. In this example, we have 4 top-level devices: #1, #20, #22 & #23.

Quoted 4 lines

I've tried digging in /proc without much success... is there a way to get this information from user space? PPC Linux exposes the device tree in /proc for example. A mechanism similar to /proc/bus/pci/devices (machine- parseable text) would be great, too.

In 2.5, this information's available via sysfs. I don't think we'll expose it in /proc.

Quoted 3 lines

PS: I noticed that /proc/iomem lists 00000000-000009ff as "PDC data (Page Zero)", is there a chance I can find what I need there? (I dd-ed it from /dev/mem but I can't say if it contains useful data...)

No, you need to actually make firmware calls and you can't do that from user mode.

Signature · 3 lines
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
Signature · 1 line
The software said it requires Windows 2000 or better, so I installed Linux.
#3 lore raw

Hi,

I think the most intesting thing is the name of the system, which is (untested!) in /proc/cpuinfo (should give you "Raven U 240 (9000/780/C240)").

The rest is mostly and often standard serial, parallel, SCSI, pci (pci-utils!), and some strange GSC cards (which often give you some of the above devices).

Regards,
Helge

Quoted 88 lines · Lyonel Vincent

many thanks for the prompt answer

well... that's exactly the answer I didn't want to ear ;o) lshw can't reasonably assume that /var/log/dmesg exists and is correct (or even dmesg) and dig into the trash.

My kernel programming skills are extremely limited (not to say inexistent) but how difficult would it be to expose this information to user space through /proc? (AFAICT, we already have PA-RISC specific files like /proc/bus/runway) A simplistic format like <hwpath>\t<type> <instance> <hversion> <sversion> etc. would do.
Do you think it'd be useful to make that kind of information available to user- space? (besides lshw of course ;op) If it's the case I'll try to do my best...

cheers,
lv.

Quoted 69 lines · Matthew Wilcox
Quoted 3 lines · Lyonel Vincent

I'm currently implementing a small tool called lshw (you can find it on Freshmeat) that enumerates installed devices on a machine and reports them as a device tree (text, HTML and XML).

That's cool.

Quoted 5 lines

For now it knows about DMI, PCI busses, SCSI, IDE and PCMCIA and I would like to port it to PA-RISC Linux. I already get some very basic info from /proc/cpuinfo.
Does anyone know how I can access the device tree as seen by the kernel? (much like HP-UX's ioscan does and what is shown in dmesg)

You can look in /var/log/dmesg. For example...

Found devices:
1. U2-IOA BC Runway Port (12) at 0xfff88000 [8], versions 0x580, 0xf, 0xb
2. Dino PCI Bridge (13) at 0xf2000000 [8/0], versions 0x680, 0x0, 0xa, additional addresses: 0xf2800000 3. Raven U/L2 Dino PS/2 Port (10) at 0xf2001000 [8/1], versions 0x6, 0x0, 0x96 4. Raven U/L2 Dino RS-232 (10) at 0xf2003000 [8/3], versions 0x6, 0x0, 0x8c 5. Raven U/L2 Core FW-SCSI
(4) at 0xf200c000 [8/12], versions 0x3b, 0x0, 0x89 6. Raven U/L2 Core BA
(11) at 0xffd00000 [8/16], versions 0x3b, 0x0, 0x81, additional
addresses: 0xffd0c000 0xffc00000 7. Raven U/L2 Core Centronics (10) at 0xffd02000 [8/16/0], versions 0x3b, 0x0, 0x74, additional addresses:
0xffd01000 0xffd03000 8. Raven U/L2 Core Audio (10) at 0xffd04000 [8/16/1], versions 0x3b, 0x4, 0x7b 9. Raven U/L2 Core RS-232 (10) at 0xffd05000 [8/16/4], versions 0x3b, 0x0, 0x8c 10. Raven U/L2 Core SCSI
(10) at 0xffd06000 [8/16/5], versions 0x3b, 0x0, 0x82 11. Raven U/L2 Core LAN (802.3) (10) at 0xffd07000 [8/16/6], versions 0x3b, 0x0, 0x8a 12. Raven U/L2 Core PS/2 Port (10) at 0xffd08000 [8/16/7], versions 0x3b, 0x0, 0x84 13. Raven U/L2 Core PS/2 Port (10) at 0xffd08100 [8/16/8], versions 0x3b, 0x0, 0x84 14. Raven Backplane Wax BA (11) at 0xffe00000 [8/20], versions 0x17, 0x0, 0x8e 15. Raven Backplane Wax HIL (10) at 0xffe01000 [8/20/1], versions 0x17, 0x0, 0x73 16. Raven Backplane RS-232
(10) at 0xffe02000 [8/20/2], versions 0x17, 0x0, 0x8c 17. Raven Backplane Wax EISA BA (11) at 0xfc000000 [8/20/5], versions 0x17, 0x0, 0x90, additional addresses: 0xffc88000 0xfc00000b 18. Gecko GSC Core Graphics
(10) at 0xfa000000 [8/24], versions 0x16, 0x0, 0x85, additional
addresses: 0xf0026000 19. U2-IOA BC GSC+ Port (7) at 0xf203f000 [8/63], versions 0x501, 0x1, 0xc 20. U2-IOA BC Runway Port (12) at 0xfff8a000 [10], versions 0x580, 0xf, 0xb 21. U2-IOA BC GSC+ Port (7) at 0xf103f000 [10/63], versions 0x501, 0x1, 0xc 22. Raven U 240 (9000/780/C240) (0) at 0xfffa0000 [32], versions 0x599, 0x0, 0x4 23. Memory (1) at 0xfffb1000 [49], versions 0x6f, 0x0, 0x9

The numbers in [] tell you what the tree looks like. In this example, we have 4 top-level devices: #1, #20, #22 & #23.

Quoted 4 lines

I've tried digging in /proc without much success... is there a way to get this information from user space? PPC Linux exposes the device tree in /proc for example. A mechanism similar to /proc/bus/pci/devices (machine- parseable text) would be great, too.

In 2.5, this information's available via sysfs. I don't think we'll expose it in /proc.

Quoted 3 lines

PS: I noticed that /proc/iomem lists 00000000-000009ff as "PDC data (Page Zero)", is there a chance I can find what I need there? (I dd-ed it from /dev/mem but I can't say if it contains useful data...)

No, you need to actually make firmware calls and you can't do that from user mode.

--
"It's not Hollywood. War is real, war is primarily not about defeat or victory, it is about death. I've seen thousands and thousands of dead bodies. Do you think I want to have an academic debate on this subject?" -- Robert Fisk

#4 lore raw

Hello Helge,

The goal is precisely that: *accurately* report installed hardware (including the "standard" stuff) and how it's connected in a *unified* way, without having to use dozens of inconsistent tools (pci-utils, lsusb, sg-utils, cat, grep, black magic, etc.).
A good example of this being HP-UX's ioscan. DMI-aware PCs also have a similar feature.

SCSI, PCI etc. are already enumerated platform-independently (without needing pci-utils nor sg-utils, only pci.ids) but they currently seem to come "out of the void" as the underlying hardware (LASI, various GSC bridges, etc) is not enumerated.
Concerning the obvious /proc/cpuinfo, its info is reported too (on PA-RISC, x86, IA-64, PowerPC and Alpha).

In short, that's why I'd like to access ioscan-like data under PA-RISC Linux from user space.

cheers,
lv.

Quoted 109 lines · On Wed, 12 Mar 2003 21:50:50 +0100 Helge Deller <[email protected]> wrote:

Hi,

I think the most intesting thing is the name of the system, which is (untested!) in /proc/cpuinfo (should give you "Raven U 240 (9000/780/C240)").

The rest is mostly and often standard serial, parallel, SCSI, pci (pci-utils!), and some strange GSC cards (which often give you some of the above devices).

Regards,
Helge

Quoted 94 lines · Lyonel Vincent

many thanks for the prompt answer

well... that's exactly the answer I didn't want to ear ;o) lshw can't reasonably assume that /var/log/dmesg exists and is correct (or even dmesg) and dig into the trash.

My kernel programming skills are extremely limited (not to say inexistent) but how difficult would it be to expose this information to user space through /proc? (AFAICT, we already have PA-RISC specific files like/proc/bus/runway) A simplistic format like <hwpath>\t<type> <instance><hversion> <sversion> etc. would do. Do you think it'd be useful to make that kind of information available to user- space? (besides lshw of course ;op) If it's the case I'll try to do my best...

cheers,
lv.

Quoted 75 lines · Matthew Wilcox
Quoted 3 lines · Lyonel Vincent

I'm currently implementing a small tool called lshw (you can find it on Freshmeat) that enumerates installed devices on a machine and reports them as a device tree (text, HTML and XML).

That's cool.

Quoted 6 lines

For now it knows about DMI, PCI busses, SCSI, IDE and PCMCIA and I would like to port it to PA-RISC Linux. I already get some very basic info from /proc/cpuinfo.
Does anyone know how I can access the device tree as seen by the kernel? (much like HP-UX's ioscan does and what is shown in dmesg)

You can look in /var/log/dmesg. For example...

Found devices:
1. U2-IOA BC Runway Port (12) at 0xfff88000 [8], versions 0x580, 0xf, 0xb 2. Dino PCI Bridge (13) at 0xf2000000 [8/0], versions 0x680, 0x0, 0xa, additional addresses: 0xf2800000 3. Raven U/L2 Dino PS/2 Port (10) at 0xf2001000 [8/1], versions 0x6, 0x0, 0x96
4. Raven U/L2 Dino RS-232 (10) at 0xf2003000 [8/3], versions 0x6, 0x0, 0x8c 5. Raven U/L2 Core FW-SCSI(4) at 0xf200c000 [8/12], versions 0x3b, 0x0, 0x89 6. Raven U/L2 Core BA(11) at 0xffd00000 [8/16], versions 0x3b, 0x0, 0x81, additional addresses:
0xffd0c000 0xffc00000 7. Raven U/L2 Core Centronics (10) at 0xffd02000 [8/16/0], versions 0x3b, 0x0, 0x74, additional
addresses: 0xffd01000 0xffd03000 8. Raven U/L2 Core Audio (10) at 0xffd04000[8/16/1], versions 0x3b, 0x4, 0x7b 9. Raven U/L2 Core RS-232 (10) at 0xffd05000 [8/16/4], versions 0x3b, 0x0, 0x8c 10. Raven U/L2 Core SCSI(10) at 0xffd06000 [8/16/5], versions 0x3b, 0x0, 0x82 11. Raven U/L2 Core LAN (802.3) (10) at 0xffd07000 [8/16/6], versions 0x3b, 0x0, 0x8a 12. Raven U/L2 Core PS/2 Port
(10) at 0xffd08000 [8/16/7], versions 0x3b, 0x0, 0x84 13. Raven U/L2 Core PS/2 Port (10) at 0xffd08100 [8/16/8], versions 0x3b, 0x0, 0x84 14. Raven Backplane Wax BA (11) at 0xffe00000[8/20], versions 0x17, 0x0, 0x8e 15. Raven Backplane Wax HIL (10) at 0xffe01000 [8/20/1], versions 0x17, 0x0, 0x73 16. Raven Backplane RS-232(10) at 0xffe02000 [8/20/2], versions 0x17, 0x0, 0x8c 17. Raven Backplane Wax EISA BA (11) at 0xfc000000 [8/20/5], versions 0x17, 0x0, 0x90, additional addresses: 0xffc88000 0xfc00000b 18. Gecko GSC Core Graphics(10) at 0xfa000000 [8/24], versions 0x16, 0x0, 0x85, additional addresses: 0xf0026000 19. U2-IOA BC GSC+ Port (7) at 0xf203f000 [8/63], versions 0x501, 0x1, 0xc 20. U2-IOA BC Runway Port (12) at 0xfff8a000[10], versions 0x580, 0xf, 0xb
21. U2-IOA BC GSC+ Port (7) at 0xf103f000[10/63], versions 0x501, 0x1, 0xc 22. Raven U 240 (9000/780/C240) (0) at 0xfffa0000 [32], versions 0x599, 0x0, 0x4 23. Memory (1) at 0xfffb1000[49], versions 0x6f, 0x0, 0x9

The numbers in [] tell you what the tree looks like. In this example, we have 4 top-level devices: #1, #20, #22 & #23.

Quoted 5 lines

I've tried digging in /proc without much success... is there a way to get this information from user space? PPC Linux exposes the device tree in /proc for example. A mechanism similar to /proc/bus/pci/devices(machine- parseable text) would be great, too.

In 2.5, this information's available via sysfs. I don't think we'll expose it in /proc.

Quoted 4 lines

PS: I noticed that /proc/iomem lists 00000000-000009ff as "PDC data(Page Zero)", is there a chance I can find what I need there? (I dd-ed it from /dev/mem but I can't say if it contains useful data...)

No, you need to actually make firmware calls and you can't do that from user mode.

--
"It's not Hollywood. War is real, war is primarily not about defeat or victory, it is about death. I've seen thousands and thousands of dead bodies. Do you think I want to have an academic debate on this subject?"-- Robert Fisk

#5 lore raw
Quoted 4 lines · Lyonel Vincent

SCSI, PCI etc. are already enumerated platform-independently (without needing pci-utils nor sg-utils, only pci.ids) but they currently seem to come "out of the void" as the underlying hardware (LASI, various GSC bridges, etc) is not enumerated.

Right -- and you'll get this in 2.5 from sysfs. Given this, I'm reluctant to introduce a new file in /proc.

Signature · 3 lines
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
#6 lore raw
In reply to Lyonel Vincent

Being as I just got done with a class from HP Education on Linux, this very issue was brought up by all of us HP-UX guys. We love our IOSCAN. The instructor told us that someone within HP actually wrote an "ioscan" for Red Hat. I'm thinking that getting a copy of that source code would be a good place to start. I'm going to do a search for the guy tomorrow or get his name from our instructor to see if I can get a hold of his code. derek
Lyonel Vincent <[email protected]> wrote:Hello Helge,

The goal is precisely that: *accurately* report installed hardware (including the "standard" stuff) and how it's connected in a *unified* way, without having to use dozens of inconsistent tools (pci-utils, lsusb, sg-utils, cat, grep, black magic, etc.).
A good example of this being HP-UX's ioscan. DMI-aware PCs also have a similar feature.

SCSI, PCI etc. are already enumerated platform-independently (without needing pci-utils nor sg-utils, only pci.ids) but they currently seem to come "out of the void" as the underlying hardware (LASI, various GSC bridges, etc) is not enumerated.
Concerning the obvious /proc/cpuinfo, its info is reported too (on PA-RISC, x86, IA-64, PowerPC and Alpha).

In short, that's why I'd like to access ioscan-like data under PA-RISC Linux from user space.

cheers,
lv.

Quoted 6 lines · On Wed, 12 Mar 2003 21:50:50 +0100 Helge Deller wrote:

Hi,

I think the most intesting thing is the name of the system, which is (untested!) in /proc/cpuinfo (should give you "Raven U 240 (9000/780/C240)").

Quoted 103 lines

The rest is mostly and often standard serial, parallel, SCSI, pci (pci-utils!), and some strange GSC cards (which often give you some of the above devices).

Regards,
Helge

Quoted 94 lines · Lyonel Vincent

many thanks for the prompt answer

well... that's exactly the answer I didn't want to ear ;o) lshw can't reasonably assume that /var/log/dmesg exists and is correct (or even dmesg) and dig into the trash.

My kernel programming skills are extremely limited (not to say inexistent) but how difficult would it be to expose this information to user space through /proc? (AFAICT, we already have PA-RISC specific files like/proc/bus/runway) A simplistic format like \t etc. would do.
Do you think it'd be useful to make that kind of information available to user- space? (besides lshw of course ;op) If it's the case I'll try to do my best...

cheers,
lv.

Quoted 75 lines · Matthew Wilcox
Quoted 3 lines · Lyonel Vincent

I'm currently implementing a small tool called lshw (you can find it on Freshmeat) that enumerates installed devices on a machine and reports them as a device tree (text, HTML and XML).

That's cool.

Quoted 6 lines

For now it knows about DMI, PCI busses, SCSI, IDE and PCMCIA and I would like to port it to PA-RISC Linux. I already get some very basic info from /proc/cpuinfo.
Does anyone know how I can access the device tree as seen by the kernel? (much like HP-UX's ioscan does and what is shown in dmesg)

You can look in /var/log/dmesg. For example...

Found devices:
1. U2-IOA BC Runway Port (12) at 0xfff88000 [8], versions 0x580, 0xf, 0xb 2. Dino PCI Bridge (13) at 0xf2000000 [8/0], versions 0x680, 0x0, 0xa, additional addresses: 0xf2800000 3. Raven U/L2 Dino PS/2 Port (10) at 0xf2001000 [8/1], versions 0x6, 0x0, 0x96
4. Raven U/L2 Dino RS-232 (10) at 0xf2003000 [8/3], versions 0x6, 0x0, 0x8c 5. Raven U/L2 Core FW-SCSI(4) at 0xf200c000 [8/12], versions 0x3b, 0x0, 0x89 6. Raven U/L2 Core BA(11) at 0xffd00000 [8/16], versions 0x3b, 0x0, 0x81, additional addresses:
0xffd0c000 0xffc00000 7. Raven U/L2 Core Centronics (10) at 0xffd02000 [8/16/0], versions 0x3b, 0x0, 0x74, additional
addresses: 0xffd01000 0xffd03000 8. Raven U/L2 Core Audio (10) at 0xffd04000[8/16/1], versions 0x3b, 0x4, 0x7b 9. Raven U/L2 Core RS-232 (10) at 0xffd05000 [8/16/4], versions 0x3b, 0x0, 0x8c 10. Raven U/L2 Core SCSI(10) at 0xffd06000 [8/16/5], versions 0x3b, 0x0, 0x82 11. Raven U/L2 Core LAN (802.3) (10) at 0xffd07000 [8/16/6], versions 0x3b, 0x0, 0x8a 12. Raven U/L2 Core PS/2 Port
(10) at 0xffd08000 [8/16/7], versions 0x3b, 0x0, 0x84 13. Raven U/L2 Core PS/2 Port (10) at 0xffd08100 [8/16/8], versions 0x3b, 0x0, 0x84 14. Raven Backplane Wax BA (11) at 0xffe00000[8/20], versions 0x17, 0x0, 0x8e 15. Raven Backplane Wax HIL (10) at 0xffe01000 [8/20/1], versions 0x17, 0x0, 0x73 16. Raven Backplane RS-232(10) at 0xffe02000 [8/20/2], versions 0x17, 0x0, 0x8c 17. Raven Backplane Wax EISA BA (11) at 0xfc000000 [8/20/5], versions 0x17, 0x0, 0x90, additional addresses: 0xffc88000 0xfc00000b 18. Gecko GSC Core Graphics(10) at 0xfa000000 [8/24], versions 0x16, 0x0, 0x85, additional addresses: 0xf0026000 19. U2-IOA BC GSC+ Port (7) at 0xf203f000 [8/63], versions 0x501, 0x1, 0xc 20. U2-IOA BC Runway Port (12) at 0xfff8a000[10], versions 0x580, 0xf, 0xb
21. U2-IOA BC GSC+ Port (7) at 0xf103f000[10/63], versions 0x501, 0x1, 0xc 22. Raven U 240 (9000/780/C240) (0) at 0xfffa0000 [32], versions 0x599, 0x0, 0x4 23. Memory (1) at 0xfffb1000[49], versions 0x6f, 0x0, 0x9

The numbers in [] tell you what the tree looks like. In this example, we have 4 top-level devices: #1, #20, #22 & #23.

Quoted 5 lines

I've tried digging in /proc without much success... is there a way to get this information from user space? PPC Linux exposes the device tree in /proc for example. A mechanism similar to /proc/bus/pci/devices(machine- parseable text) would be great, too.

In 2.5, this information's available via sysfs. I don't think we'll expose it in /proc.

Quoted 4 lines

PS: I noticed that /proc/iomem lists 00000000-000009ff as "PDC data(Page Zero)", is there a chance I can find what I need there? (I dd-ed it from /dev/mem but I can't say if it contains useful data...)

No, you need to actually make firmware calls and you can't do that from user mode.

--
"It's not Hollywood. War is real, war is primarily not about defeat or victory, it is about death. I've seen thousands and thousands of dead bodies. Do you think I want to have an academic debate on this subject?"-- Robert Fisk

_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

---------------------------------
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online