NdisMSetAttributes

VOID
    NdisMSetAttributes(
        IN NDIS_HANDLE
MiniportAdapterHandle,
        IN NDIS_HANDLE MiniportAdapterContext,
        IN BOOLEAN BusMaster,
        IN NDIS_INTERFACE_TYPE AdapterType
        );

NdisMSetAttributes informs the NDIS library about significant features of the caller’s NIC during initialization.

Parameters

MiniportAdapterHandle
Specifies the handle input to MiniportInitialize.
MiniportAdapterContext
Specifies a handle for a resident context area allocated by MiniportInitialize.
BusMaster
Specifies TRUE if the caller’s NIC is a busmaster DMA device.
AdapterType
Specifies the I/O bus interface type of the caller’s NIC, which usually is the type of I/O bus on which the NIC is connected, as one of the following:
NdisInterfaceInternal
Specifies a host-specific internal interface.
NdisInterfaceIsa
Specifies the ISA interface.
NdisInterfaceEisa
Specifies the extended ISA (EISA) interface.
NdisInterfaceMca
Specifies the MicroChannel architecture interface.
NdisInterfaceTurboChannel
Specifies the Turbo Channel interface.
NdisInterfacePci
Specifies the Peripheral Component Interconnect (PCI) interface.
NdisInterfacePcMcia
Specifies the Personal Computer Memory Card International Association (PCMCIA) interface.

Comments

A MiniportInitialize function must call NdisMSetAttributes or NdisMSetAttributesEx before calling any other NdisMRegisterXxx or NdisXxx function that depends on the information supplied to NdisMSetAttributes(Ex). For example, a call to NdisMAllocateMapRegisters will fail if MiniportInitialize has not yet called NdisMSetAttributes with BusMaster set to TRUE or NdisMSetAttributesEx with NDIS_ATTRIBUTE_BUS_MASTER set in the AttributeFlags.

In general, a NIC driver must call NdisMSetAttributes(Ex) before it calls any NdisXxx function that claims hardware resources in the registry for its NIC, because NDIS must have the BusMaster or AttributeFlags value, respectively, before such a call is made and because the driver usually needs the memory at MiniportAdapterContext to store information for these calls. This restriction implies that a NIC driver’s MiniportInitialize function cannot call the following NdisXxx before it calls NdisMSetAttributes(Ex):

However, before calling NdisMSetAttributes(Ex), a NIC driver can call the Ndis..Configuration functions to retrieve configuration information installed in the registry and the NdisImmediateXxx, such as NdisImmediateReadPciSlotInformation or NdisImmediateReadSharedMemory, as well as the NdisImmediate..PortXxx functions. MiniportInitialize also can call the bus-type-specific NdisReadXxx functions, such as NdisReadPciSlotInformation, as long as the installed registry entry for the driver’s interface type matches the bus-type-specific NdisReadXxx MiniportInitialize calls.

The MiniportAdapterContext handle supplied to NdisMSetAttributes(Ex) becomes an input parameter to all MiniportXxx functions that were registered, along with MiniportInitialize, in the call to NdisMRegisterMiniport. Usually, this handle is a pointer to resident memory, allocated by MiniportInitialize, in which the driver maintains NIC-specific runtime state.

Intermediate drivers must call NdisMSetAttributesEx, rather than NdisMSetAttributes. NIC drivers can call either of these functions, but NdisMSetAttributesEx allows a miniport to adjust the intervals at which its MiniportCheckForHang and MiniportReset functions are called.

Callers of NdisMSetAttributes run at IRQL PASSIVE_LEVEL.

See Also

MiniportCheckForHang, MiniportInitialize, MiniportReset, NdisAllocateMemory, NdisImmediateReadPciSlotInformation, NdisImmediateReadPortUchar, NdisImmediateReadPortUlong, NdisImmediateReadPortUshort, NdisImmediateReadSharedMemory, NdisIMRegisterLayeredMiniport, NdisMAllocateMapRegisters, NdisMAllocateSharedMemory, NdisMMapIoSpace, NdisMPciAssignResources, NdisMRegisterDmaChannel, NdisMRegisterInterrupt, NdisMRegisterIoPortRange, NdisMRegisterMiniport, NdisMSetAttributesEx, NdisOpenConfiguration, NdisReadEisaSlotInformation, NdisReadEisaSlotInformationEx, NdisReadMcaPosInformation, NdisReadPciSlotInformation, NdisWritePciSlotInformation