/**********************************************************
NDIS6-related final initialization:
    Uninstalling interrupt handler
    Dellocate buffer list pool
Parameters:
    context
***********************************************************/
VOID ParaNdis_FinalizeCleanup(PARANDIS_ADAPTER *pContext)
{
    // we zero context members to be able examine them in the debugger/dump
    if (pContext->InterruptHandle)
    {
        NdisMDeregisterInterruptEx(pContext->InterruptHandle);
        pContext->InterruptHandle = NULL;
    }
    if (pContext->BufferListsPool)
    {
        NdisFreeNetBufferListPool(pContext->BufferListsPool);
        pContext->BufferListsPool = NULL;
    }
    if (pContext->DmaHandle)
    {
        NdisMDeregisterScatterGatherDma(pContext->DmaHandle);
        pContext->DmaHandle = NULL;
    }
}
Beispiel #2
0
VOID
Hw11Terminate(
    __in  PHW                     Hw
    )
{
    //
    // Deregister the DMA from NDIS
    //
    if (Hw->MiniportDmaHandle != NULL)
    {
        NdisMDeregisterScatterGatherDma(Hw->MiniportDmaHandle);
    }

    //
    // Cancel all other timers (these are all stopped already)
    //
    MPASSERT(NdisCancelTimerObject(Hw->ScanContext.Timer_Scan) == FALSE);
    MPASSERT(NdisCancelTimerObject(Hw->PhyState.Timer_Doze) == FALSE);
    MPASSERT(NdisCancelTimerObject(Hw->PhyState.Timer_Awake) == FALSE);

}
VOID
VenetHalt(NDIS_HANDLE handle, NDIS_HALT_ACTION action)
{
    PADAPTER	a = (PADAPTER) handle;

    UNREFERENCED_PARAMETER(action);

    vlog("halt called");

    VENET_SET_SYNC_FLAG(a, VNET_ADAPTER_HALT_IN_PROGRESS);

    VenetDetach(a);
    VenetFreeQueuedSend(a, NDIS_STATUS_FAILURE);

    /* Now dec and wait for the remove event */
    VENET_ADAPTER_PUT(a);
    NdisWaitEvent(&a->removeEvent, 5000);

    /* Free resources */
    NdisFreeSpinLock(&a->Lock);
    if (a->resetTimer)
        NdisFreeTimerObject(a->resetTimer);
    if (a->recvTimer)
        NdisFreeTimerObject(a->recvTimer);

    if (a->dmaHandle)
        NdisMDeregisterScatterGatherDma(a->dmaHandle);

    VenetFreeRx(a);
    VenetFreeTx(a);

    if (a->vif.close)
        a->vif.close(a->bus_handle);

    NdisFreeSpinLock(&a->sendLock);
    NdisFreeSpinLock(&a->recvLock);
    VenetFree(a, sizeof(ADAPTER));
}
Beispiel #4
0
NDIS_STATUS
Hw11Initialize(
    __in  PHW                     Hw,
    __in  PHVL                    Hvl,
    __out NDIS_ERROR_CODE*        ErrorCode,
    __out PULONG                  ErrorValue
    )
{
    NDIS_STATUS                 ndisStatus = NDIS_STATUS_SUCCESS;
    Hw->Hvl = Hvl;

    do
    {
        //
        // Initialize the HAL layer
        //
        ndisStatus = HalInitialize(Hw->Hal);
        if (ndisStatus != NDIS_STATUS_SUCCESS) 
        {
            MpTrace(COMP_INIT_PNP, DBG_SERIOUS, ("HalInitialize failed. Status = 0x%08x\n", ndisStatus));
            break;
        }
        
        //
        // Read the HW capabilities
        //
        HalGetPowerSaveCapabilities(Hw->Hal, &Hw->MacState.HalPowerSaveCapability);

        //
        // Reset our state to its initial value
        //        
        HwResetSoftwareMacState(Hw);     // Resets the software data
        HwResetSoftwarePhyState(Hw);     // Resets the software data
        NdisZeroMemory(&Hw->Stats, sizeof(NIC_STATISTICS));

        //
        // Clear any stale state from the hardware
        //
        ndisStatus = HwClearNicState(Hw);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            MpTrace(COMP_INIT_PNP, DBG_SERIOUS, ("HwClearNicState failed. Status = 0x%08x\n", ndisStatus));
            break;
        }

        //
        // Program our new state on the hardware
        //
        ndisStatus = HwSetNicState(Hw);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            MpTrace(COMP_INIT_PNP, DBG_SERIOUS, ("HwSetNicState failed. Status = 0x%08x\n", ndisStatus));
            break;
        }

        //
        // Initialize the scatter gather DMA with NDIS for send. This also allocates stuff
        // for receive shared memory allocation
        //
        ndisStatus = HwInitializeScatterGatherDma(Hw, ErrorCode, ErrorValue);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            break;
        }


    } while (FALSE);


    if (ndisStatus != NDIS_STATUS_SUCCESS)
    {       
        //
        // Deregister the DMA from NDIS
        //
        if (Hw->MiniportDmaHandle != NULL)
        {
            NdisMDeregisterScatterGatherDma(Hw->MiniportDmaHandle);
        }
    }
    
    return ndisStatus;
}