------------------------------
Message: 10
Date: Wed, 9 May 2007 14:51:48 -0400 (EDT)
From: Andrew Gallatin <email@hidden>
Subject: Re: pci config space
To: Alexander von Below <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden">email@hidden>
Content-Type: text/plain; charset=us-ascii
Alexander von Below writes:
If I may ask: Why do you need only the PCI configuration space?
A variety of reasons. Mainly to check for things like PCI parity
errors in large clusters, where running a gui app like Reggie is
extraordinarily cubmersome, and a command-line tool (like lspci) scales
much better. Also to provide a way to upgrade firmware in our NICs in
the field w/o forcing people to boot into some OS where config space
access is trivial (linux, solaris, windows, *bsd, basically anything
but OSX) or to move the NIC into a box already running such an OS.
Perhaps your OS X driver could provide a userclient for this functionality?
My suggestion would be to write a simple driver and communicate with
it. That will free you from the availability of the CHUD API.
The problem with this is that the only thing I can visualize will work
only on x86 (io port access). I can't seem to figure out a way to get
"random access" to the PCI bus. Eg, I don't see a way specify a
bus/slot/function and access its PCI config space, even in the kernel
From /System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/pci/IOPCIDevice.h:
/* Config space accessors */
virtual UInt32 configRead32( IOPCIAddressSpace space, UInt8 offset );
virtual void configWrite32( IOPCIAddressSpace space,
UInt8 offset, UInt32 data );
virtual UInt16 configRead16( IOPCIAddressSpace space, UInt8 offset );
virtual void configWrite16( IOPCIAddressSpace space,
UInt8 offset, UInt16 data );
virtual UInt8 configRead8( IOPCIAddressSpace space, UInt8 offset );
virtual void configWrite8( IOPCIAddressSpace space,
UInt8 offset, UInt8 data );
You can use IOPCIAddressSpace to specify bus/device/function, etc.
.
Hence, leaching from Chud seemed appealing.. :)
After installing the CHUD Tools package from developer.apple.com, CHUD.framework is documented here:
/Developer/ADC\ Reference\ Library/documentation/CHUD/CHUDFramework/CHUDreferenceTOC.html
However then your tool is dependent on the presence of CHUD on the users system.
I would lean towards a userclient for reading config space, update FW, etc.