8-3
Sample Driver
Basic Register Initialization and Reset Sequence
The first step in the initialization process is NIC recognition. The most straightforward
method of finding the card is through PCI configuration space. Operating system-specific
calls may be used to locate the device with the AIC-6915 Device ID (6915) and Vendor ID
(9004).
Example:
// Windows NT driver example
// Find the AIC-6915 card in PCI space
// This assumes that the card has been installed and the slot number is stored
// in the registry
// Read the Device and Vendor ID
NdisImmediateReadPciSlotInformation(
ConfigurationHandle,
Adapter->SlotNumber,
// obtained from the registry
PCI_CONF_VENDOR_ID,
// offset 0 in PCI
// configuration space
(PVOID)&Cfid,
// returned device/vendor ID
sizeof (ULONG)
// return 4 bytes
);
if ( (Cfid != AIC6915_CFID) )
// 0x69159004
{
DbgPrint("CFID doesn't match expected\n");
return (NDIS_STATUS_FAILURE);
}
Part of the initialization process is the allocation and initialization of memory structures,
such as transmit and receive descriptors. These structures all reside in host memory.
Memory allocation is unique to each operating system and will not be covered here in
detail. For an example under Windows NT, refer to the DDK AllocateAdapterMemory
function.
During driver operation, some atypical events may occur which will require that the
controller be reset. For example the operating system may force a reset of the AIC-6915.
The reset sequence is slightly different from the initialization sequence listed below.
During a reset operation, the first two steps outlined below are not required. All other
steps should be followed as described here.
There are several general registers that must be initialized before the chip functionality is
available. These are summarized in the sections below. With the exception of the first
seven steps, these registers may be set in any order. PCI registers located in the PCI
configuration header (offsets 0-3fh) must be accessed through PCI configuration cycles.
All other register access in the driver contained in the DDK is memory-mapped. The
AIC-6915 does offer the ability to perform an I/O register access, but this is not shown in
these examples.