HalGetBusData() locking up computer

I have a problem that makes no sense with HalGetBusData(). It is
actually
locking up the computer after finding two of the 4 PCI cards in the NT
4.0 computer.
It works fine on another computer. Following is an excerpt of the code.

Before finding the card that I am looking for, the system hangs on
HalGetBusData() after finding the second card(my PCI card is the last
card
in the system). It step to HalGetBusData() and it never returns.

What could possibly be the problem?

Thanks,
Ed

Note: Please see my code below…

int PCIFindDevice(struct packed_port_param *pcb,UI *DevBase,UI *DevIrq)
{
PCI_COMMON_CONFIG PCIInfo;
PCI_SLOT_NUMBER SlotNumber;
int BusNumber;
int DeviceNumber;
int FunctionNumber;
ULONG stat;
UI found=0;

for (BusNumber=0;;BusNumber++)
for (DeviceNumber=0;DeviceNumber<pci_max_devices> for (FunctionNumber=0; FunctionNumber<pci_max_function> FunctionNumber++)
{
SlotNumber.u.bits.Reserved = 0;
SlotNumber.u.bits.DeviceNumber = DeviceNumber;
SlotNumber.u.bits.FunctionNumber = FunctionNumber;
if ((stat=HalGetBusData(PCIConfiguration,
BusNumber,SlotNumber.u.AsULONG,&PCIInfo,
sizeof(PCI_COMMON_CONFIG))) == 0)
return(RS232ERR_PORT);
if (stat == 2)
continue;
if ((PCIInfo.VendorID == pcb->ser_rs232_base) &&
(PCIInfo.DeviceID == pcb->cardseg))
if (++found == pcb->dflag)
{
*DevBase
=(PCIInfo.u.type0.BaseAddresses[pcb->ddata]
& 0xfffe) + (pcb->aux_addr1 * 8);
*DevIrq =PCIInfo.u.type0.InterruptLine;
return(RS232ERR_NONE);
}
continue;
}
}

WCSC(Willies Computer Software Co)
http://www.wcscnet.com
Tel: (281)360-4232 Fax: (281)360-3231</pci_max_function></pci_max_devices>

Hi,
I observed the same problem sometime back. I think it is caused by some PCI
slots when there is no PCI Device on that (please correct me if I am wrong).
The way I solved is just reading first 8 bytes which will have just Vendor
Id and Device Id. By looking at that I will decide whether it is my device
or not.

Hope this helps you.

Syam.

-----Original Message-----
From: Berto [mailto:xxxxx@wcscnet.com]
Sent: Wednesday, July 26, 2000 6:57 PM
To: NT Developers Interest List
Subject: [ntdev] HalGetBusData() locking up computer

I have a problem that makes no sense with HalGetBusData(). It is
actually
locking up the computer after finding two of the 4 PCI cards in the NT
4.0 computer.
It works fine on another computer. Following is an excerpt of the code.

Before finding the card that I am looking for, the system hangs on
HalGetBusData() after finding the second card(my PCI card is the last
card
in the system). It step to HalGetBusData() and it never returns.

What could possibly be the problem?

Thanks,
Ed

Note: Please see my code below…

int PCIFindDevice(struct packed_port_param *pcb,UI *DevBase,UI *DevIrq)
{
PCI_COMMON_CONFIG PCIInfo;
PCI_SLOT_NUMBER SlotNumber;
int BusNumber;
int DeviceNumber;
int FunctionNumber;
ULONG stat;
UI found=0;

for (BusNumber=0;;BusNumber++)
for (DeviceNumber=0;DeviceNumber<pci_max_devices> for (FunctionNumber=0; FunctionNumber<pci_max_function> FunctionNumber++)
{
SlotNumber.u.bits.Reserved = 0;
SlotNumber.u.bits.DeviceNumber = DeviceNumber;
SlotNumber.u.bits.FunctionNumber = FunctionNumber;
if ((stat=HalGetBusData(PCIConfiguration,
BusNumber,SlotNumber.u.AsULONG,&PCIInfo,
sizeof(PCI_COMMON_CONFIG))) == 0)
return(RS232ERR_PORT);
if (stat == 2)
continue;
if ((PCIInfo.VendorID == pcb->ser_rs232_base) &&
(PCIInfo.DeviceID == pcb->cardseg))
if (++found == pcb->dflag)
{
*DevBase
=(PCIInfo.u.type0.BaseAddresses[pcb->ddata]
& 0xfffe) + (pcb->aux_addr1 * 8);
*DevIrq =PCIInfo.u.type0.InterruptLine;
return(RS232ERR_NONE);
}
continue;
}
}

WCSC(Willies Computer Software Co)
http://www.wcscnet.com
Tel: (281)360-4232 Fax: (281)360-3231


You are currently subscribed to ntdev as: xxxxx@ami.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)</pci_max_function></pci_max_devices>

> I have a problem that makes no sense with HalGetBusData(). It is

actually
locking up the computer after finding two of the 4 PCI cards in the NT
4.0 computer.
It works fine on another computer. Following is an excerpt of
the code.

I ran into this last year, and with the help of NTDEV
http://www.osr.com/listserver_main.htm (or was it DDK-L
http://www.chsw.com/DDK-L/), figured it out. I recommend that you search
the archives (for “HalGetBusData”) to see all the wonderous information.

As I recall, the problem was with one of the devices on the motherboard
getting upset if you asked it for a function number that was not 0. Someone
else reported a similar problem with a video card. I think I personally
solved it by not searching for function numbers (hack), but there was
probably a better way.

“You should only access functions 1-7 on a PCI device if the high bit is set
of the HeaderType field of the PCI Info.”

I have read this somewhere, (osr’s site ???). May be this will help.

chaitanya

----- Original Message -----
From: Berto
To: NT Developers Interest List
Sent: Thursday, July 27, 2000 4:26 AM
Subject: [ntdev] HalGetBusData() locking up computer

> I have a problem that makes no sense with HalGetBusData(). It is
> actually
> locking up the computer after finding two of the 4 PCI cards in the NT
> 4.0 computer.
> It works fine on another computer. Following is an excerpt of the code.
>
> Before finding the card that I am looking for, the system hangs on
> HalGetBusData() after finding the second card(my PCI card is the last
> card
> in the system). It step to HalGetBusData() and it never returns.
>
> What could possibly be the problem?
>
> Thanks,
> Ed
>
> Note: Please see my code below…
>
> int PCIFindDevice(struct packed_port_param *pcb,UI *DevBase,UI *DevIrq)
> {
> PCI_COMMON_CONFIG PCIInfo;
> PCI_SLOT_NUMBER SlotNumber;
> int BusNumber;
> int DeviceNumber;
> int FunctionNumber;
> ULONG stat;
> UI found=0;
>
>
> for (BusNumber=0;;BusNumber++)
> for (DeviceNumber=0;DeviceNumber<pci_max_devices>> for (FunctionNumber=0; FunctionNumber<pci_max_function>> FunctionNumber++)
> {
> SlotNumber.u.bits.Reserved = 0;
> SlotNumber.u.bits.DeviceNumber = DeviceNumber;
> SlotNumber.u.bits.FunctionNumber = FunctionNumber;
> if ((stat=HalGetBusData(PCIConfiguration,
> BusNumber,SlotNumber.u.AsULONG,&PCIInfo,
> sizeof(PCI_COMMON_CONFIG))) == 0)
> return(RS232ERR_PORT);
> if (stat == 2)
> continue;
> if ((PCIInfo.VendorID == pcb->ser_rs232_base) &&
> (PCIInfo.DeviceID == pcb->cardseg))
> if (++found == pcb->dflag)
> {
> *DevBase
> =(PCIInfo.u.type0.BaseAddresses[pcb->ddata]
> & 0xfffe) + (pcb->aux_addr1 * 8);
> *DevIrq =PCIInfo.u.type0.InterruptLine;
> return(RS232ERR_NONE);
> }
> continue;
> }
> }
>
>
>
>
>
>
>
> WCSC(Willies Computer Software Co)
> http://www.wcscnet.com
> Tel: (281)360-4232 Fax: (281)360-3231
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@cmcltd.com
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)</pci_max_function></pci_max_devices>

Thanks to you and to all that have answered. By just reading the first
eight bytes for the Device/Vendor IDs, I was able to proceed. I then
just reread the device with the sizeof(PCI…config structure).

Regards

-----Original Message-----
From: Neela Syam Kolli [mailto:xxxxx@ami.com]
Sent: Wednesday, July 26, 2000 6:09 PM
To: NT Developers Interest List
Subject: [ntdev] RE: HalGetBusData() locking up computer

Hi,
I observed the same problem sometime back. I think it is caused by some
PCI
slots when there is no PCI Device on that (please correct me if I am
wrong).
The way I solved is just reading first 8 bytes which will have just
Vendor
Id and Device Id. By looking at that I will decide whether it is my
device
or not.

Hope this helps you.

Syam.

-----Original Message-----
From: Berto [mailto:xxxxx@wcscnet.com]
Sent: Wednesday, July 26, 2000 6:57 PM
To: NT Developers Interest List
Subject: [ntdev] HalGetBusData() locking up computer

I have a problem that makes no sense with HalGetBusData(). It is
actually
locking up the computer after finding two of the 4 PCI cards in the NT
4.0 computer.
It works fine on another computer. Following is an excerpt of the code.

Before finding the card that I am looking for, the system hangs on
HalGetBusData() after finding the second card(my PCI card is the last
card
in the system). It step to HalGetBusData() and it never returns.

What could possibly be the problem?

Thanks,
Ed

Note: Please see my code below…

int PCIFindDevice(struct packed_port_param *pcb,UI *DevBase,UI *DevIrq)
{
PCI_COMMON_CONFIG PCIInfo;
PCI_SLOT_NUMBER SlotNumber;
int BusNumber;
int DeviceNumber;
int FunctionNumber;
ULONG stat;
UI found=0;

for (BusNumber=0;;BusNumber++)
for (DeviceNumber=0;DeviceNumber<pci_max_devices> for (FunctionNumber=0; FunctionNumber<pci_max_function> FunctionNumber++)
{
SlotNumber.u.bits.Reserved = 0;
SlotNumber.u.bits.DeviceNumber = DeviceNumber;
SlotNumber.u.bits.FunctionNumber = FunctionNumber;
if ((stat=HalGetBusData(PCIConfiguration,
BusNumber,SlotNumber.u.AsULONG,&PCIInfo,
sizeof(PCI_COMMON_CONFIG))) == 0)
return(RS232ERR_PORT);
if (stat == 2)
continue;
if ((PCIInfo.VendorID == pcb->ser_rs232_base) &&
(PCIInfo.DeviceID == pcb->cardseg))
if (++found == pcb->dflag)
{
*DevBase
=(PCIInfo.u.type0.BaseAddresses[pcb->ddata]
& 0xfffe) + (pcb->aux_addr1 * 8);
*DevIrq =PCIInfo.u.type0.InterruptLine;
return(RS232ERR_NONE);
}
continue;
}
}

WCSC(Willies Computer Software Co)
http://www.wcscnet.com
Tel: (281)360-4232 Fax: (281)360-3231


You are currently subscribed to ntdev as: xxxxx@ami.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)


You are currently subscribed to ntdev as: xxxxx@wcscnet.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)</pci_max_function></pci_max_devices>