A.3.2 Registering Network Interface Cards

After driver registration, the NDIS interface library must register network interface cards to each NIC driver on the network. As Figure A.3.2 shows, the library calls MacAddAdapter for each network interface card. The NIC driver reads the Configuration Registry database to determine parameters for the network card, using calls to NdisOpenConfiguration, NdisReadConfiguration, and NdisCloseConfiguration. For additional configuration information about specialized network interface cards, EISA-based drivers can call NdisReadEisaSlotInformation, MCA-based drivers can call NdisReadMcaPosInformation, and PCI-based drivers can call NdisReadPciSlotInformation.

When the NIC driver has the appropriate configuration data, it makes a call to NdisRegisterAdapter for the associated network interface card and its logical adapter. This allows the NDIS interface library wrapper to recognize the network card name when a transport driver opens the card later. For more information about this task, see Section A.3.3. Upon entry to NdisRegisterAdapter, the wrapper calls IoCreateDevice to create a device object representing the network interface card, with an object name that matches the network card name.

Figure A.3.2 Registering a network interface card

The device object includes a NIC driver-specific extension that contains a pointer to the NIC driver descriptor block; a list entry that links the network interface card into the NIC driver list of registered network interface cards (anchored in the NIC driver descriptor block); a list head for the list of open bindings to the network interface card; and the context passed to NdisRegisterAdapter. The function gives the NIC driver the address of the device object extension in an NDIS NIC handle.

After NdisRegisterAdapter returns, the NIC driver can further initialize the network interface card in calls to other NDIS interface library functions, such as NdisAllocateMemory, NdisMapIoSpace, and NdisAllocateDmaChannel. When it has completely initialized the network interface card, the NIC driver must initialize interrupts by calling NdisInitializeInterrupt.

When registration for one network interface card is complete, the NDIS interface library completes the preceding procedure for the remainder of the network interface cards on the network. Then each bound transport driver can communicate with its remote node peers using the network interface card to which it is bound, and the associated NIC driver. The first action the transport driver must take is to open its network interface card. For more information about opening a network interface card, see SectionA.3.3.