linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PCI sysfs resource handling
@ 2003-04-22 13:01 Matthew Wilcox
  0 siblings, 0 replies; only message in thread
From: Matthew Wilcox @ 2003-04-22 13:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Patrick Mochel, Greg KH


As part of my PCI sysfs changes I posted on April 7th
(http://www.ussg.iu.edu/hypermail/linux/kernel/0304.0/1724.html),
I noted a TODO, to convert the `resource' file into directories.

Currently, we have:

willy@daiml:~$ cat /sys/bus/pci/devices/0000:02:00.1/resource 
        0x0000000000001080      0x0000000000001087      0x0000000000000101
        0x0000000010801000      0x00000000108017ff      0x0000000000000200
        0x0000000010801800      0x0000000010801fff      0x0000000000000200
        0x0000000000000000      0x0000000000000000      0x0000000000000000
        0x0000000000000000      0x0000000000000000      0x0000000000000000
        0x0000000000000000      0x0000000000000000      0x0000000000000000
        0x0000000010404000      0x0000000010407fff      0x0000000000007200

The suggested plan was to make it look
like this:

/sys/bus/pci/devices/0000:02:00.1/resource0/start
/sys/bus/pci/devices/0000:02:00.1/resource0/end
/sys/bus/pci/devices/0000:02:00.1/resource0/flags
/sys/bus/pci/devices/0000:02:00.1/resource1/start
/sys/bus/pci/devices/0000:02:00.1/resource1/end
/sys/bus/pci/devices/0000:02:00.1/resource1/flags
/sys/bus/pci/devices/0000:02:00.1/resource2/start
/sys/bus/pci/devices/0000:02:00.1/resource2/end
/sys/bus/pci/devices/0000:02:00.1/resource2/flags
/sys/bus/pci/devices/0000:02:00.1/resource6/start
/sys/bus/pci/devices/0000:02:00.1/resource6/end
/sys/bus/pci/devices/0000:02:00.1/resource6/flags

with one value per file.  I wasn't entirely convinced then and I'm
not convinced now.  I don't think embedding a kobject in every struct
resource is really a good idea.  However, I can see a good argument for
replacing the `resource' file with these files:

/sys/bus/pci/devices/0000:02:00.1/resource0
/sys/bus/pci/devices/0000:02:00.1/resource1
/sys/bus/pci/devices/0000:02:00.1/resource2
/sys/bus/pci/devices/0000:02:00.1/resource6

Here's the fruity bit though.  If you cat resource1, you'd get

        0x0000000010801000      0x00000000108017ff      0x0000000000000200

But if you mmaped it, you'd get the iomem from 0x10801000 to 0x108017ff
mapped into your address space.  I'm a little uneasy about having a file
which has different contents based on whether you mmap it or read/write it,
but everyone expects procfs/sysfs files to be a little bit special.  And
it's nothing compared to some of the crap we were doing in procfs ;-)

Comments?

-- 
"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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-04-22 12:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-22 13:01 PCI sysfs resource handling Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).