/******************************************************************************/
/* */
/* Broadcom BCM5700 Linux Network Driver, Copyright (c) 2000 - 2005 Broadcom */
/* Corporation. */
/* All rights reserved. */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, located in the file LICENSE. */
/* */
/* History: */
/******************************************************************************/
#include "mm.h"
#include "typedefs.h"
#include "osl.h"
#include "bcmdefs.h"
#include "bcmdevs.h"
#include "sbutils.h"
#include "bcmrobo.h"
#include "proto/ethernet.h"
/******************************************************************************/
/* Local functions. */
/******************************************************************************/
LM_STATUS LM_Abort(PLM_DEVICE_BLOCK pDevice);
LM_STATUS LM_QueueRxPackets(PLM_DEVICE_BLOCK pDevice);
static LM_STATUS LM_InitBcm540xPhy(PLM_DEVICE_BLOCK pDevice);
static LM_VOID LM_PhyTapPowerMgmt(LM_DEVICE_BLOCK *pDevice);
LM_VOID LM_ServiceRxInterrupt(PLM_DEVICE_BLOCK pDevice);
LM_VOID LM_ServiceTxInterrupt(PLM_DEVICE_BLOCK pDevice);
static LM_STATUS LM_ForceAutoNeg(PLM_DEVICE_BLOCK pDevice);
static LM_UINT32 GetPhyAdFlowCntrlSettings(PLM_DEVICE_BLOCK pDevice);
STATIC LM_STATUS LM_SetFlowControl(PLM_DEVICE_BLOCK pDevice,
LM_UINT32 LocalPhyAd, LM_UINT32 RemotePhyAd);
#ifdef INCLUDE_TBI_SUPPORT
STATIC LM_STATUS LM_SetupFiberPhy(PLM_DEVICE_BLOCK pDevice);
STATIC LM_STATUS LM_InitBcm800xPhy(PLM_DEVICE_BLOCK pDevice);
#endif
STATIC LM_STATUS LM_SetupCopperPhy(PLM_DEVICE_BLOCK pDevice);
STATIC LM_VOID LM_SetEthWireSpeed(LM_DEVICE_BLOCK *pDevice);
STATIC LM_STATUS LM_PhyAdvertiseAll(LM_DEVICE_BLOCK *pDevice);
STATIC PLM_ADAPTER_INFO LM_GetAdapterInfoBySsid(LM_UINT16 Svid, LM_UINT16 Ssid);
LM_VOID LM_SwitchVaux(PLM_DEVICE_BLOCK pDevice, PLM_DEVICE_BLOCK pDevice2);
STATIC LM_STATUS LM_DmaTest(PLM_DEVICE_BLOCK pDevice, PLM_UINT8 pBufferVirt,
LM_PHYSICAL_ADDRESS BufferPhy, LM_UINT32 BufferSize);
STATIC LM_STATUS LM_DisableChip(PLM_DEVICE_BLOCK pDevice);
STATIC LM_STATUS LM_ResetChip(PLM_DEVICE_BLOCK pDevice);
STATIC LM_STATUS LM_DisableFW(PLM_DEVICE_BLOCK pDevice);
STATIC LM_STATUS LM_Test4GBoundary(PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket,
PT3_SND_BD pSendBd);
STATIC LM_VOID LM_WritePreResetSignatures(LM_DEVICE_BLOCK *pDevice,
LM_RESET_TYPE Mode);
STATIC LM_VOID LM_WritePostResetSignatures(LM_DEVICE_BLOCK *pDevice,
LM_RESET_TYPE Mode);
STATIC LM_VOID LM_WriteLegacySignatures(LM_DEVICE_BLOCK *pDevice,
LM_RESET_TYPE Mode);
STATIC void LM_GetPhyId(LM_DEVICE_BLOCK *pDevice);
/******************************************************************************/
/* External functions. */
/******************************************************************************/
LM_STATUS LM_LoadRlsFirmware(PLM_DEVICE_BLOCK pDevice);
#ifdef INCLUDE_TCP_SEG_SUPPORT
LM_STATUS LM_LoadStkOffLdFirmware(PLM_DEVICE_BLOCK pDevice);
LM_UINT32 LM_GetStkOffLdFirmwareSize(PLM_DEVICE_BLOCK pDevice);
#endif
LM_UINT32
LM_RegRd(PLM_DEVICE_BLOCK pDevice, LM_UINT32 Register)
{
#ifdef PCIX_TARGET_WORKAROUND
if (pDevice->Flags & UNDI_FIX_FLAG)
{
return (LM_RegRdInd(pDevice, Register));
}
else
#endif
{
return (REG_RD_OFFSET(pDevice, Register));
}
}
/* Mainly used to flush posted write before delaying */
LM_VOID
LM_RegRdBack(PLM_DEVICE_BLOCK pDevice, LM_UINT32 Register)
{
LM_UINT32 dummy;
#ifdef PCIX_TARGET_WORKAROUND
if (pDevice->Flags & ENABLE_PCIX_FIX_FLAG)
{
return;
}
else
#endif
{
if (pDevice->Flags & REG_RD_BACK_FLAG)
return;
dummy = REG_RD_OFFSET(pDevice, Register);
}
}
LM_VOID
LM_RegWr(PLM_DEVICE_BLOCK pDevice, LM_UINT32 Register, LM_UINT32 Value32,
LM_UINT32 ReadBack)
{
#ifdef PCIX_TARGET_WORKAROUND
if (pDevice->Flags & ENABLE_PCIX_FIX_FLAG)
{
LM_RegWrInd(pDevice, Register, Value32);
}
else
#endif
{
LM_UINT32 dummy;
REG_WR_OFFSET(pDevice, Register, Value32);
if (ReadBack && (pDevice->Flags & REG_RD_BACK_FLAG))
{
dummy = REG_RD_OFFSET(pDevice, Register);
}
}
}
/******************************************************************************/
/* Description: */
/* */
/* Return: */
/******************************************************************************/
LM_UINT32
LM_RegRdInd(
PLM_DEVICE_BLOCK pDevice,
LM_UINT32 Register) {
LM_UINT32 Value32;
MM_ACQUIRE_UNDI_LOCK(pDevice);
MM_WriteConfig32(pDevice, T3_PCI_REG_ADDR_REG, Register);
MM_ReadConfig32(pDevice, T3_PCI_REG_DATA_REG, &Value32);
MM_RELEASE_UNDI_LOCK(pDevice);
return MM_SWAP_LE32(Value32);
} /* LM_RegRdInd */
/******************************************************************************/
/* Description: */
/* */
/* Return: */
/******************************************************************************/
LM_VOID
LM_RegWrInd(
PLM_DEVICE_BLOCK pDevice,
LM_UINT32 Register,
LM_UINT32 Value32) {
MM_ACQUIRE_UNDI_LOCK(pDevice);
MM_WriteConfig32(pDevice, T3_PCI_REG_ADDR_REG, Register);
MM_WriteConfig32(pDevice, T3_PCI_REG_DATA_REG, MM_SWAP_LE32(Value32));
MM_RELEASE_UNDI_LOCK(pDevice);
} /* LM_RegWrInd */
/******************************************************************************/
/* Description: */
/* */
/* Return: */
/******************************************************************************/
LM_UINT32
LM_MemRdInd(
PLM_DEVICE_BLOCK pDevice,
LM_UINT32 MemAddr) {
LM_UINT32 Value32;
MM_ACQUIRE_UNDI_LOCK(pDevice);
MM_WriteConfig32(pDevice, T3_PCI_MEM_WIN_ADDR_REG, MemAddr);
MM_ReadConfig32(pDevice, T3_PCI_MEM_WIN_DATA_REG, &Value32);
MM_RELEASE_UNDI_LOCK(pDevice);
return MM_SWAP_LE32(Value32);
} /* LM_MemRdInd */
/******************************************************************************/
/* Description: */
/* */
/* Return: */
/******************************************************************************/
LM_VOID
LM_MemWrInd(
PLM_DEVICE_BLOCK pDevice,
LM_UINT32 MemAddr,
LM_UINT32 Value32) {
MM_ACQUIRE_UNDI_LOCK(pDevice);
MM_WriteConfig32(pDevice, T3_PCI_MEM_WIN_ADDR_REG, MemAddr);
MM_WriteConfig32(pDevice, T3_PCI_MEM_WIN_DATA_REG, MM_SWAP_LE32(Value32));
MM_RELEASE_UNDI_LOCK(pDevice);
} /* LM_MemWrInd */
/******************************************************************************/
/* Description: */
/* */
/* Return:
- 1
- 2
前往页