mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Martin Mares <mj@ucw.cz>
To: "Richard B. Johnson" <root@chaos.analogic.com>
Cc: Chris Friesen <cfriesen@nortelnetworks.com>,
	linux-kernel@vger.kernel.org
Subject: Re: how to list pci devices from userpace?  anything better than /proc/bus/pci/devices?
Date: Wed, 27 Nov 2002 22:54:13 +0100	[thread overview]
Message-ID: <20021127215413.GA5277@ucw.cz> (raw)
In-Reply-To: <Pine.LNX.3.95.1021127163510.4690A-100000@chaos.analogic.com>

Hi!

> Red Hat distributions after 7.0 provide `lspci`. You still have
> to parse ASCII. FYI, it's not hard to write a 'C' program
> that directly accessed the PCI bus from its ports at 0xCF8 (index)
> and 0xCFC (data). You need to do 32-bit port accesses and you
> can set iopl(3) from user-space.

Please DON'T do that -- not all machines support this access mechanism
and even on them directly poking the I/O ports would lead to races with
other programs and as well with the kernel.

Either use lspci (which has a nice machine-parseable output mode) or
parse /proc/bus/pci/devices or use the libpci library (part of the
pciutils package).

				Have a nice fortnight
-- 
Martin `MJ' Mares   <mj@ucw.cz>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
A LISP programmer knows value of everything, but cost of nothing.

  parent reply	other threads:[~2002-11-27 21:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-27 21:24 Chris Friesen
2002-11-27 21:41 ` Richard B. Johnson
2002-11-27 21:49   ` Jan-Benedict Glaw
2002-11-27 21:54   ` Martin Mares [this message]
2002-11-28 16:37   ` Alan Cox
2002-11-27 21:47 ` Dave Jones
2002-11-28  9:18 ` Thierry Vignaud

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021127215413.GA5277@ucw.cz \
    --to=mj@ucw.cz \
    --cc=cfriesen@nortelnetworks.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=root@chaos.analogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®