Juggernaut,
Вот функция которая поможет тебе сделать то что надо! (Примерно)
Благодарности слать по адресу
nkovach@itt.net.ru//+++++++++++++++++++++++++++++++++++++++++++++++++++
//FIND PCI ADAPTER
//+++++++++++++++++++++++++++++++++++++++++++++++++++
BOOLEAN
FindPciAdapters(PALTERA_ADAPTER lpAda, int DoMap, ULONG safe, ULONG bp)
{
PCI_SLOT_NUMBER SlotNumber;
ULONG i, f, j, bus, adr;
BOOLEAN flag;
UCHAR vendorString[5] = {0};
UCHAR deviceString[5] = {0};
PPCI_COMMON_CONFIG PciData=(PPCI_COMMON_CONFIG)lpAda->ConfigurationTable;
BOOLEAN Result=FALSE;
if(safe==0) AsmInitChips();
SlotNumber.u.bits.Reserved = 0;
flag = TRUE;
for (bus = 0; flag; bus++)
{
for (i = 0; (i < PCI_MAX_DEVICES) && flag; i++)
{
SlotNumber.u.bits.DeviceNumber = i;
for (f = 0; f < PCI_MAX_FUNCTION; f++)
{
SlotNumber.u.bits.FunctionNumber = f;
j = HalGetBusData (
PCIConfiguration,
bus,
SlotNumber.u.AsULONG,
PciData,
sizeof(PCI_COMMON_CONFIG) //PCI_COMMON_HDR_LENGTH
);
if (j == 0)
{
// out of buses
flag = FALSE;
break;
}
if (PciData->VendorID == PCI_INVALID_VENDORID)
{
// skip to next slot
break;
}
if (
(PciData->VendorID == 0xAA55) &&
(PciData->BaseClass == 4) &&
(PciData->SubClass == 0))
{
lpAda->DeviceID=PciData->DeviceID;
if(
(PciData->DeviceID == 1) || //old card
(PciData->DeviceID == 3) || //new card
(PciData->DeviceID == 5) || //new card 100 Acex
(PciData->DeviceID == 9) || //ID=9
(PciData->DeviceID == 7) || //ID=9
(PciData->DeviceID == 0xF) || //ID=0xf
(PciData->DeviceID == 0x11) || //ID=0x11
(PciData->DeviceID == 0x13) || //ID=0x13
(PciData->DeviceID == 0x15) || //ID=0x15
(PciData->DeviceID == 0x17) //ID=0x17
)
{
//
// Arrr, Here's a nasty boy.
//
if(safe!=0)
InitAlteraChip(bus,SlotNumber.u.AsULONG,PciData->DeviceID,safe);
adr=(PciData->u.type0.BaseAddresses[0] & 0xFFFFFF00)|3;
HalSetBusDataByOffset(
PCIConfiguration,
bus,SlotNumber.u.AsULONG,&adr,0x8C,4);
HalGetBusData(
PCIConfiguration,
bus,
SlotNumber.u.AsULONG,
PciData,
sizeof(PCI_COMMON_CONFIG) //PCI_COMMON_HDR_LENGTH
);
lpAda->DeviceID=PciData->DeviceID | 0x80000000;
lpAda->BusNumber=bus;
lpAda->SlotNumber=SlotNumber.u.AsULONG,
lpAda->BusAddress.LowPart=PciData->u.type0.BaseAddresses[0] & 0xFFFFFF00;
lpAda->BusAddress.HighPart=0;
if(DoMap) MapIoSpace(lpAda);
if(lpAda->lp16Mb)
{
DoDelay(500);
DrawLogo(lpAda->DeviceID & 0xFFFF,lpAda->lp16Mb,0);
DrawLogo(lpAda->DeviceID & 0xFFFF,lpAda->lp16Mb,1);
DrawLogo(lpAda->DeviceID & 0xFFFF,lpAda->lp16Mb,2);
if(bp) beep(0x5000);
Result=TRUE;
}
}
lpAda++;
}
}
}
}
return Result;
}