On Fri, 20 Dec 2002 19:27:14 +0100 (CET), Daniela Engert wrote:
>>HWDEVICE MyDevice;
>>USHORT MyIRQ;
>>
>>if (MyDevice = PCI_FindDevice(0x1073, -1, PDD_FIND_STRAIGHT, 0)) {
>> MyIRQ = PDD_GetDeviceIRQ(MyDevice,0);
>> PrintF ("Yamaha found on %lx using %d!", &MyDevice, MyIRQ);
>> PCI_WriteConfigDWord (MyDevice, 64, 0x1000);
>> }
>>That's all the code needed to find the first PCI-device of vendor 0x1073 and
>Interesting. I have no idea (yet) how rich your API is, but in
>DaniS506.ADD I have a quite elaborate code to find supported PCI
>devices (for details see attachment):
>enumerate *all* PCI functions on *all* PCI type buses. Take into
already doing that. I'm also assigning bus numbers after I enumerated all buses and
scanning them as well.
And if those contain another bridge, it's enumerated again, etc. pp.
>account that some old PCI bridges have badly broken PCI config spaces!
i would like to get more information on that. Anyway as soon as gconfig is uploaded to
netlabs, you may look
by yourself and implement work-arounds for such bridges. Bridges will get a separate
HWDeviceID Group, so
it's easy to check them later.
>For each PCI function found do
>{
> if (PCI class == PCI_MASS_STORAGE) {
> read PCI vendor and device id;
> match ids against a list of known devices to map functionally
>identical chips to a single member;
> set compatible_device_id = remapped_device_id;
> match vendor id and compatible_device_id against a list of known
>devices to map chips from the same "family" to a single representant;
> match family vendor and device id against a list of supported chip
>families returning an index into this list;
> if (no match in list) {
> if ((PCI subclass == PCI_IDE_CONTROLLER) &&
> (PCI programming interface == LEGACY))
> if (PCI programming interface == PCI IDE busmaster)
> index = generic legacy SFF8038 compliant IDE busmaster
>device;
> else
> index = generic legacy IDE device;
> else
> unknown/unsupported chip found;
> }
> if (supported chip found) {
> construct a IDE PCI device object instance from index into object
>factory;
> call "accept" method;
> if (instance acceptable)
> keep object instance;
> else
> destroy object instance;
> }
> }
>}
>In which way could GCONFIG help in this process ?
Hmm for such complex enumeration, I would propose that you use GCONFIG Detection area
directly.
This means that you will get access to all base-blocks. Each contains the basic
information for a piece of
hardware like e.g.:
Revision : BYTE - Minor version number
Version : BYTE - Major version number
Class.BaseClass : BYTE - Base-Class
Class.Subclass : BYTE - Sub-Class
Class.Interface : BYTE - Programming interface class
Class.Unused : BYTE - Reserved
VendorID : WORD - VendorID of Device
DeviceID : WORD - DeviceID of Device
CardVendorID : WORD - VendorID of actual card
CardDeviceID : WORD - DeviceID of actual card
CompatVendorID : WORD - Compatible VendorID
CompatDeviceID : WORD - Compatible DeviceID
...and some more. So you should be able to get your checking done by just using the
base-blocks w/o any
real PCI space interaction. And if you do, then you may use the
PCI_Read/WriteConfigSpace functions.
Note: This base-block is available for all sorts of devices including PnP, PCI, USB,
etc. pp.
You will have to check, if the HWDeviceID is of type PCI, so you get all PCI devices
(not bridges, nor
cardbus). If you also support cardbus, you should check for type Cardbus as well.
cu, Kiewitz
-----------
To unsubscribe yourself from this list, send the following message
to [EMAIL PROTECTED]
unsubscribe acpi-os2
end