?
Solved

PCI slot number (NDIS)

Posted on 1998-09-27
1
Medium Priority
?
294 Views
Last Modified: 2013-12-03
How can I determine in the Miniport NIC driver the slot number of my card ??? Please give me a sample code.
0
Comment
Question by:kaccup
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
agreen earned 1400 total points
ID: 1414850
You can do that by walking through the possible PCI slot numbers and examining the Vendor ID, Device ID and Revision Number of the card. Here is the sample:

#define MAX_PCI_SLOTS 25

#define VENDOR_ID  <your vendor id>
#define DEVICE_ID  <your device id>
#define REV_NUM    <revision number>

typedef struct _CMDD_PCI_CONFIG {
    USHORT VendorID;       
    USHORT DeviceID;
    USHORT Command;
    USHORT Status;
    UCHAR RevisionID;
    UCHAR ProgIf;
    UCHAR SubClass;
    UCHAR BaseClass;      
    UCHAR CacheLineSize;      
    UCHAR LatencyTimer;      
    UCHAR HeaderType;
    UCHAR BIST;      

    union {
         struct _PCI_HEADER_TYPE_0 {
             ULONG BaseAddresses[6];
             ULONG Reserved1[2];
             ULONG ROMBaseAddress;
             ULONG Reserved2[2];
             UCHAR InterruptLine;
             UCHAR InterruptPin;
             UCHAR MinimumGrant;
             UCHAR MaximumLatency;
         } type0;
     } u;
     UCHAR DeviceSpecific[192];
} PCI_CONFIG, *PPCI_CONFIG;

LONG
SlotNumber(
      PMY_ADAPTER Adapter
      )
{
    PCI_CONFIG PciConfig;
    UINT i;

    for(i=0; i<MAX_PCI_SLOTS; i++) {

        NdisReadPciSlotInformation(
          (NDIS_HANDLE)Adapter,
          i, 0, &PciConfig, sizeof(PCI_CONFIG));

        if(PciConfig.VendorID == VENDOR_ID && 
         PciConfig.DeviceID == DEVICE_ID &&
           PciConfig.RevisionID & 0x0f == REV_NUM) {

            // Place your code here

            return i;

        }

    return -1;
}
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question