Multiple cards/devices. How does user know which is which?

I apologize if this has been covered, but I couldn’t find any material on it.

The case is where identical multiple PCI cards are plugged into the same
machine. In this case, they are SDLC cards. How does the user know which
one is “0” and which is “1”? For that matter, is there any way for the
driver to tell? Like a slot location? Is that how this is normally handled?

Just to give some background, I am trying to handle the case where I have
one card simulating an Inertial Navigation System (INS) and another
simulating the backup. But the user needs to know which is which, as they
get plugged into different things in the outside world. The only thing I
can think of is slot location, but I am not sure that a driver is supposed
to know/care.

Does anyone have any insight on this problem, or know where I can get some
more information?

Thanks,
Michael

> Just to give some background, I am trying to handle the case where I have

one card simulating an Inertial Navigation System (INS) and another
simulating the backup.

How can 2 identical cards emulate different devices?
If they are not really identical - can you make them different in terms of PCI config space?

Max

Michael

I had the same problem (2 high speed serial PCI cards) on NT 4.0. The user
has to know which card is device 0 or 1 to do the correct cabling.
I have a registry entry for each card, indicating the PCI-slot the card
resides. At driver initialisation I can see what card is in the appropriate
slot and do the correct assoziation.
That works fine for some machines, but as far as I can see, the slot
numbering is not the same on all machines.
Any ideas for a better solution are welcome.

Best regards

F.X.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Michael Wade
Sent: Thursday, April 04, 2002 3:50 AM
To: NT Developers Interest List
Subject: [ntdev] Multiple cards/devices. How does user know which is
which?

I apologize if this has been covered, but I couldn’t find any
material on it.

The case is where identical multiple PCI cards are plugged into the same
machine. In this case, they are SDLC cards. How does the user
know which
one is “0” and which is “1”? For that matter, is there any way for the
driver to tell? Like a slot location? Is that how this is
normally handled?

Just to give some background, I am trying to handle the case where I have
one card simulating an Inertial Navigation System (INS) and another
simulating the backup. But the user needs to know which is
which, as they
get plugged into different things in the outside world. The only thing I
can think of is slot location, but I am not sure that a driver is
supposed
to know/care.

Does anyone have any insight on this problem, or know where I can
get some
more information?

Thanks,
Michael


You are currently subscribed to ntdev as: xxxxx@fxm.de
To unsubscribe send a blank email to %%email.unsub%%

Slot location is the best you can do with the tools you’ve got. As F.X.
pointed out, what exactly you get from a query for slot location is not
completely useful. If you know the physical architecture of your
platform you can decode bus/slot into a physical location, but if you
are deployed on J-random pc box, this is difficult. Quite a few network
card vendors simply rely on Mr. Blinky: their diagnostics will blink an
led on the back of a card in order to clue in the user which card is the
right one.

=====================
Mark Roddy
Windows XP/2000/NT Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com
xxxxx@hollistech.com
For Windows Device Driver Training: see www.azius.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of F.X. Mayer
Sent: Thursday, April 04, 2002 2:40 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Multiple cards/devices. How does user
know which is which?

Michael

I had the same problem (2 high speed serial PCI cards) on NT
4.0. The user has to know which card is device 0 or 1 to do
the correct cabling. I have a registry entry for each card,
indicating the PCI-slot the card resides. At driver
initialisation I can see what card is in the appropriate slot
and do the correct assoziation. That works fine for some
machines, but as far as I can see, the slot numbering is not
the same on all machines. Any ideas for a better solution are welcome.

Best regards

F.X.

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Michael Wade
> Sent: Thursday, April 04, 2002 3:50 AM
> To: NT Developers Interest List
> Subject: [ntdev] Multiple cards/devices. How does user know
which is
> which?
>
>
> I apologize if this has been covered, but I couldn’t find
any material
> on it.
>
> The case is where identical multiple PCI cards are plugged into the
> same machine. In this case, they are SDLC cards. How does
the user
> know which one is “0” and which is “1”? For that matter,
is there any
> way for the driver to tell? Like a slot location? Is that
how this
> is normally handled?
>
> Just to give some background, I am trying to handle the
case where I
> have one card simulating an Inertial Navigation System (INS) and
> another simulating the backup. But the user needs to know which is
> which, as they get plugged into different things in the
outside world.
> The only thing I can think of is slot location, but I am
not sure that
> a driver is supposed
> to know/care.
>
> Does anyone have any insight on this problem, or know where
I can get
> some more information?
>
> Thanks,
> Michael
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@fxm.de
> To unsubscribe send a blank email to %%email.unsub%%
>


You are currently subscribed to ntdev as:
xxxxx@hollistech.com To unsubscribe send a blank email to
%%email.unsub%%

>> Just to give some background, I am trying to handle the case where I have
>> one card simulating an Inertial Navigation System (INS) and another
> simulating the backup.
>How can 2 identical cards emulate different devices?
>If they are not really identical - can you make them different in terms
of PCI config space?
>Max

They are identical cards, but output different data. For example, each
unit outputs it’s flight address, one is 0x0a and the other 0x0b. PnP
gives them different resources, but I don’t know which is which. The only
way I can think of to do it is by slot. But how does one get slot
information? Or is that a no no?

Thanks again,
Michael

Michael

below you will find a code fragment that I use to find the slot number of a
PCI card. I developed it using a sample from the MSDN library.

Best regards

F.X:

//
//============ PciFindDevice

/*

Routine Description:
Find a device on the PCI-Bus with given device and vendor ID

Arguments:

VendorId - Vendor Identifikation
DeviceId - Device Identifikation
PCISlot - Slot of PCI bus, where card is expected
BusNumber - returns bus number
SlotNumber - returns slot number
InterruptLine - returns Interrupt line
Base_0 - returns base address (HSSL Receive RAM)
Base_1 - returns base address (HSSL Transmitter)
Base_2 - returns base address (HSSL Receiver)

Return Value:

TRUE if card was found or FALSE otherwise
*/
BOOLEAN PciFindDevice(IN USHORT VendorId, IN USHORT DeviceId, IN ULONG
PCISlot, OUT PULONG BusNumber, OUT PULONG SlotNumber,
OUT PULONG InterruptLine, OUT PULONG Base_0, OUT PULONG Base_1, OUT
PULONG Base_2)
{
PCI_SLOT_NUMBER PciSlotNumberData;
PPCI_SLOT_NUMBER PciSlotNumber = &PciSlotNumberData;
PCI_COMMON_CONFIG PciCommonConfigData;
PPCI_COMMON_CONFIG PciCommonConfig = &PciCommonConfigData;
long i;

BOOLEAN bFound;
BOOLEAN FoundWrongSlot = FALSE;
ULONG ulReturn;
// initialize parameters
*BusNumber = 0;
PciSlotNumber->u.AsULONG = 0;

bFound = FALSE;
while( FALSE == bFound) // assume there are at most 4 buses
{
// get bus data
//KdPrint((“looking for Bus %d\n”,*BusNumber ));
ulReturn =
GetBusData(
PCIConfiguration,
*BusNumber,
PciSlotNumber->u.AsULONG,
PciCommonConfig,
sizeof (PCI_COMMON_CONFIG) );
// pci bus does not exist (assume that these start at
// 0 and go up with no gaps)
if( 0 == ulReturn )
{
break;
}
else if( sizeof (PCI_COMMON_CONFIG) == ulReturn )
{
// found a card… see if it is ours
if( VendorId == PciCommonConfig->VendorID &&
DeviceId == PciCommonConfig->DeviceID)
{
KdPrint((“VendorID %X DeviceID%X\n”, PciCommonConfig->VendorID, PciCommonConfig->DeviceID));
KdPrint((“Subsystem Vendor ID: %X Subsystem ID %X\n”, PciCommonConfig->u.type0.BaseAddresses[7] & 0xFFFF,
(PciCommonConfig->u.type0.BaseAddresses[7] >> 16) & 0xFFFF));
KdPrint((“PciSlotNumber->u.AsULONG %d\n”,PciSlotNumber->u.AsULONG));
if (PCISlot == PciSlotNumber->u.AsULONG)
{
// found our card… get its information
KdPrint((“VendorID %X DeviceID%X\n”, PciCommonConfig->VendorID, PciCommonConfig->DeviceID));
KdPrint((“Subsystem Vendor ID: %X Subsystem ID %X\n”, PciCommonConfig->u.type0.BaseAddresses[7] & 0xFFFF,
(PciCommonConfig->u.type0.BaseAddresses[7] >> 16) & 0xFFFF));
bFound = TRUE;
break;

}
else
{
*SlotNumber = PciSlotNumber->u.AsULONG;
FoundWrongSlot = TRUE;
}
}
}

//@@@ it appears that only the DeviceNumber of the SlotNumber is used…
//@@@ maybe if you have two or more of the same card it is used
//@@@ if it is never used or if it should be stepped first we could
//@@@ simplify the code

// step our BusNumber and/or SlotNumber
if( 31 == PciSlotNumber->u.bits.DeviceNumber &&
7 == PciSlotNumber->u.bits.FunctionNumber )
{
// try the next bus
(*BusNumber)++;
PciSlotNumber->u.AsULONG = 0;
}
else if( 7 == PciSlotNumber->u.bits.FunctionNumber )
{
// try the next device number
PciSlotNumber->u.bits.DeviceNumber++;
PciSlotNumber->u.bits.FunctionNumber = 0;
}
else
{
// try the next function number
PciSlotNumber->u.bits.FunctionNumber++;
}
}
if (bFound)
{
*SlotNumber = PciSlotNumber->u.AsULONG;
*InterruptLine = PciCommonConfig->u.type0.InterruptLine;
*Base_0 = PciCommonConfig->u.type0.BaseAddresses[0];
*Base_1 = PciCommonConfig->u.type0.BaseAddresses[1];
*Base_2 = PciCommonConfig->u.type0.BaseAddresses[2];
for (i = 0; i < 7; i++)
KdPrint((
“Base %d : %X\n”, i, PciCommonConfig->u.type0.BaseAddresses[i] - 1));
KdPrint((“Subsystem Vendor ID: %X Subsystem ID %X\n”,
PciCommonConfig->u.type0.BaseAddresses[7] & 0xFFFF,
(PciCommonConfig->u.type0.BaseAddresses[7] >> 16) &
0xFFFF));
}
return bFound || FoundWrongSlot;
}

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Michael Wade
Sent: Thursday, April 04, 2002 7:04 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Multiple cards/devices. How does user know which is
which?

>> Just to give some background, I am trying to handle the case
where I have
>> one card simulating an Inertial Navigation System (INS) and another
> simulating the backup.
>How can 2 identical cards emulate different devices?
>If they are not really identical - can you make them different in terms
of PCI config space?
>Max

They are identical cards, but output different data. For example, each
unit outputs it’s flight address, one is 0x0a and the other 0x0b. PnP
gives them different resources, but I don’t know which is which.
The only
way I can think of to do it is by slot. But how does one get slot
information? Or is that a no no?

Thanks again,
Michael


You are currently subscribed to ntdev as: xxxxx@fxm.de
To unsubscribe send a blank email to %%email.unsub%%