/******************************************************************************/
/*                                                                            */
/* Broadcom BCM5700 Linux Network Driver, Copyright (c) 2000 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 <common.h>
#include <asm/types.h>

#ifdef CONFIG_BMW
#include <mpc824x.h>
#endif
#include <malloc.h>
#include <linux/byteorder/big_endian.h>
#include "bcm570x_mm.h"

#define EMBEDDED 1
/******************************************************************************/
/* Local functions. */
/******************************************************************************/

LM_STATUS LM_Abort (PLM_DEVICE_BLOCK pDevice);
LM_STATUS LM_QueueRxPackets (PLM_DEVICE_BLOCK pDevice);

static LM_STATUS LM_TranslateRequestedMediaType (LM_REQUESTED_MEDIA_TYPE
						 RequestedMediaType,
						 PLM_MEDIA_TYPE pMediaType,
						 PLM_LINE_SPEED pLineSpeed,
						 PLM_DUPLEX_MODE pDuplexMode);

static LM_STATUS LM_InitBcm540xPhy (PLM_DEVICE_BLOCK pDevice);

__inline static LM_VOID LM_ServiceRxInterrupt (PLM_DEVICE_BLOCK pDevice);
__inline static LM_VOID LM_ServiceTxInterrupt (PLM_DEVICE_BLOCK pDevice);

static LM_STATUS LM_ForceAutoNegBcm540xPhy (PLM_DEVICE_BLOCK pDevice,
					    LM_REQUESTED_MEDIA_TYPE
					    RequestedMediaType);
static LM_STATUS LM_ForceAutoNeg (PLM_DEVICE_BLOCK pDevice,
				  LM_REQUESTED_MEDIA_TYPE RequestedMediaType);
static LM_UINT32 GetPhyAdFlowCntrlSettings (PLM_DEVICE_BLOCK pDevice);
STATIC LM_STATUS LM_SetFlowControl (PLM_DEVICE_BLOCK pDevice,
				    LM_UINT32 LocalPhyAd,
				    LM_UINT32 RemotePhyAd);
#if 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 PLM_ADAPTER_INFO LM_GetAdapterInfoBySsid (LM_UINT16 Svid,
						 LM_UINT16 Ssid);
STATIC LM_STATUS LM_DmaTest (PLM_DEVICE_BLOCK pDevice, PLM_UINT8 pBufferVirt,
			     LM_PHYSICAL_ADDRESS BufferPhy,
			     LM_UINT32 BufferSize);
STATIC LM_STATUS LM_HaltCpu (PLM_DEVICE_BLOCK pDevice, LM_UINT32 cpu_number);
STATIC LM_STATUS LM_ResetChip (PLM_DEVICE_BLOCK pDevice);
STATIC LM_STATUS LM_Test4GBoundary (PLM_DEVICE_BLOCK pDevice,
				    PLM_PACKET pPacket, PT3_SND_BD pSendBd);

/******************************************************************************/
/* External functions. */
/******************************************************************************/

LM_STATUS LM_LoadRlsFirmware (PLM_DEVICE_BLOCK pDevice);

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_UINT32 LM_RegRdInd (PLM_DEVICE_BLOCK pDevice, LM_UINT32 Register)
{
	LM_UINT32 Value32;

#if PCIX_TARGET_WORKAROUND
	MM_ACQUIRE_UNDI_LOCK (pDevice);
#endif
	MM_WriteConfig32 (pDevice, T3_PCI_REG_ADDR_REG, Register);
	MM_ReadConfig32 (pDevice, T3_PCI_REG_DATA_REG, &Value32);
#if PCIX_TARGET_WORKAROUND
	MM_RELEASE_UNDI_LOCK (pDevice);
#endif

	return Value32;
}				/* LM_RegRdInd */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_VOID
LM_RegWrInd (PLM_DEVICE_BLOCK pDevice, LM_UINT32 Register, LM_UINT32 Value32)
{

#if PCIX_TARGET_WORKAROUND
	MM_ACQUIRE_UNDI_LOCK (pDevice);
#endif
	MM_WriteConfig32 (pDevice, T3_PCI_REG_ADDR_REG, Register);
	MM_WriteConfig32 (pDevice, T3_PCI_REG_DATA_REG, Value32);
#if PCIX_TARGET_WORKAROUND
	MM_RELEASE_UNDI_LOCK (pDevice);
#endif
}				/* LM_RegWrInd */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_UINT32 LM_MemRdInd (PLM_DEVICE_BLOCK pDevice, LM_UINT32 MemAddr)
{
	LM_UINT32 Value32;

	MM_ACQUIRE_UNDI_LOCK (pDevice);
#ifdef BIG_ENDIAN_HOST
	MM_WriteConfig32 (pDevice, T3_PCI_MEM_WIN_ADDR_REG, MemAddr);
	Value32 = REG_RD (pDevice, PciCfg.MemWindowData);
	/*    Value32 = REG_RD(pDevice,uIntMem.Mbuf[(MemAddr & 0x7fff)/4]); */
#else
	MM_WriteConfig32 (pDevice, T3_PCI_MEM_WIN_ADDR_REG, MemAddr);
	MM_ReadConfig32 (pDevice, T3_PCI_MEM_WIN_DATA_REG, &Value32);
#endif
	MM_RELEASE_UNDI_LOCK (pDevice);

	return Value32;
}				/* LM_MemRdInd */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_VOID
LM_MemWrInd (PLM_DEVICE_BLOCK pDevice, LM_UINT32 MemAddr, LM_UINT32 Value32)
{
	MM_ACQUIRE_UNDI_LOCK (pDevice);
#ifdef BIG_ENDIAN_HOST
	REG_WR (pDevice, PciCfg.MemWindowBaseAddr, MemAddr);
	REG_WR (pDevice, uIntMem.Mbuf[(MemAddr & 0x7fff) / 4], Value32);
#else
	MM_WriteConfig32 (pDevice, T3_PCI_MEM_WIN_ADDR_REG, MemAddr);
	MM_WriteConfig32 (pDevice, T3_PCI_MEM_WIN_DATA_REG, Value32);
#endif
	MM_RELEASE_UNDI_LOCK (pDevice);
}				/* LM_MemWrInd */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_STATUS LM_QueueRxPackets (PLM_DEVICE_BLOCK pDevice)
{
	LM_STATUS Lmstatus;
	PLM_PACKET pPacket;
	PT3_RCV_BD pRcvBd;
	LM_UINT32 StdBdAdded = 0;
#if T3_JUMBO_RCV_RCB_ENTRY_COUNT
	LM_UINT32 JumboBdAdded = 0;
#endif				/* T3_JUMBO_RCV_RCB_ENTRY_COUNT */

	Lmstatus = LM_STATUS_SUCCESS;

	pPacket = (PLM_PACKET) QQ_PopHead (&pDevice->RxPacketFreeQ.Container);
	while (pPacket) {
		switch (pPacket->u.Rx.RcvProdRing) {
#if T3_JUMBO_RCV_RCB_ENTRY_COUNT
		case T3_JUMBO_RCV_PROD_RING:	/* Jumbo Receive Ring. */
			/* Initialize the buffer descriptor. */
			pRcvBd =
			    &pDevice->pRxJumboBdVirt[pDevice->RxJumboProdIdx];
			pRcvBd->Flags =
			    RCV_BD_FLAG_END | RCV_BD_FLAG_JUMBO_RING;
			pRcvBd->Len = (LM_UINT16) pDevice->RxJumboBufferSize;

			/* Initialize the receive buffer pointer */
#if 0				/* Jimmy, deleted in new */
			pRcvBd->HostAddr.Low = pPacket->u.Rx.RxBufferPhy.Low;
			pRcvBd->HostAddr.High = pPacket->u.Rx.RxBufferPhy.High;
#endif
			MM_MapRxDma (pDevice, pPacket, &pRcvBd->HostAddr);

			/* The opaque field may point to an offset from a fix addr. */
			pRcvBd->Opaque = (LM_UINT32) (MM_UINT_PTR (pPacket) -
						      MM_UINT_PTR (pDevice->
								   pPacketDescBase));

			/* Update the producer index. */
			pDevice->RxJumboProdIdx =
			    (pDevice->RxJumboProdIdx +
			     1) & T3_JUMBO_RCV_RCB_ENTRY_COUNT_MASK;

			JumboBdAdded++;
			break;
#endif				/* T3_JUMBO_RCV_RCB_ENTRY_COUNT */

		case T3_STD_RCV_PROD_RING:	/* Standard Receive Ring. */
			/* Initialize the buffer descriptor. */
			pRcvBd = &pDevice->pRxStdBdVirt[pDevice->RxStdProdIdx];
			pRcvBd->Flags = RCV_BD_FLAG_END;
			pRcvBd->Len = MAX_STD_RCV_BUFFER_SIZE;

			/* Initialize the receive buffer pointer */
#if 0				/* Jimmy, deleted in new replaced with MM_MapRxDma */
			pRcvBd->HostAddr.Low = pPacket->u.Rx.RxBufferPhy.Low;
			pRcvBd->HostAddr.High = pPacket->u.Rx.RxBufferPhy.High;
#endif
			MM_MapRxDma (pDevice, pPacket, &pRcvBd->HostAddr);

			/* The opaque field may point to an offset from a fix addr. */
			pRcvBd->Opaque = (LM_UINT32) (MM_UINT_PTR (pPacket) -
						      MM_UINT_PTR (pDevice->
								   pPacketDescBase));

			/* Update the producer index. */
			pDevice->RxStdProdIdx = (pDevice->RxStdProdIdx + 1) &
			    T3_STD_RCV_RCB_ENTRY_COUNT_MASK;

			StdBdAdded++;
			break;

		case T3_UNKNOWN_RCV_PROD_RING:
		default:
			Lmstatus = LM_STATUS_FAILURE;
			break;
		}		/* switch */

		/* Bail out if there is any error. */
		if (Lmstatus != LM_STATUS_SUCCESS) {
			break;
		}

		pPacket =
		    (PLM_PACKET) QQ_PopHead (&pDevice->RxPacketFreeQ.Container);
	}			/* while */

	wmb ();
	/* Update the procedure index. */
	if (StdBdAdded) {
		MB_REG_WR (pDevice, Mailbox.RcvStdProdIdx.Low,
			   pDevice->RxStdProdIdx);
	}
#if T3_JUMBO_RCV_RCB_ENTRY_COUNT
	if (JumboBdAdded) {
		MB_REG_WR (pDevice, Mailbox.RcvJumboProdIdx.Low,
			   pDevice->RxJumboProdIdx);
	}
#endif				/* T3_JUMBO_RCV_RCB_ENTRY_COUNT */

	return Lmstatus;
}				/* LM_QueueRxPackets */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
STATIC LM_VOID LM_NvramInit (PLM_DEVICE_BLOCK pDevice)
{
	LM_UINT32 Value32;
	LM_UINT32 j;

	/* Intialize clock period and state machine. */
	Value32 = SEEPROM_ADDR_CLK_PERD (SEEPROM_CLOCK_PERIOD) |
	    SEEPROM_ADDR_FSM_RESET;
	REG_WR (pDevice, Grc.EepromAddr, Value32);

	for (j = 0; j < 100; j++) {
		MM_Wait (10);
	}

	/* Serial eeprom access using the Grc.EepromAddr/EepromData registers. */
	Value32 = REG_RD (pDevice, Grc.LocalCtrl);
	REG_WR (pDevice, Grc.LocalCtrl,
		Value32 | GRC_MISC_LOCAL_CTRL_AUTO_SEEPROM);

	/* Set the 5701 compatibility mode if we are using EEPROM. */
	if (T3_ASIC_REV (pDevice->ChipRevId) != T3_ASIC_REV_5700 &&
	    T3_ASIC_REV (pDevice->ChipRevId) != T3_ASIC_REV_5701) {
		Value32 = REG_RD (pDevice, Nvram.Config1);
		if ((Value32 & FLASH_INTERFACE_ENABLE) == 0) {
			/* Use the new interface to read EEPROM. */
			Value32 &= ~FLASH_COMPAT_BYPASS;

			REG_WR (pDevice, Nvram.Config1, Value32);
		}
	}
}				/* LM_NvRamInit */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
STATIC LM_STATUS
LM_EepromRead (PLM_DEVICE_BLOCK pDevice, LM_UINT32 Offset, LM_UINT32 * pData)
{
	LM_UINT32 Value32;
	LM_UINT32 Addr;
	LM_UINT32 Dev;
	LM_UINT32 j;

	if (Offset > SEEPROM_CHIP_SIZE) {
		return LM_STATUS_FAILURE;
	}

	Dev = Offset / SEEPROM_CHIP_SIZE;
	Addr = Offset % SEEPROM_CHIP_SIZE;

	Value32 = REG_RD (pDevice, Grc.EepromAddr);
	Value32 &= ~(SEEPROM_ADDR_ADDRESS_MASK | SEEPROM_ADDR_DEV_ID_MASK |
		     SEEPROM_ADDR_RW_MASK);
	REG_WR (pDevice, Grc.EepromAddr, Value32 | SEEPROM_ADDR_DEV_ID (Dev) |
		SEEPROM_ADDR_ADDRESS (Addr) | SEEPROM_ADDR_START |
		SEEPROM_ADDR_READ);

	for (j = 0; j < 1000; j++) {
		Value32 = REG_RD (pDevice, Grc.EepromAddr);
		if (Value32 & SEEPROM_ADDR_COMPLETE) {
			break;
		}
		MM_Wait (10);
	}

	if (Value32 & SEEPROM_ADDR_COMPLETE) {
		Value32 = REG_RD (pDevice, Grc.EepromData);
		*pData = Value32;

		return LM_STATUS_SUCCESS;
	}

	return LM_STATUS_FAILURE;
}				/* LM_EepromRead */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
STATIC LM_STATUS
LM_NvramRead (PLM_DEVICE_BLOCK pDevice, LM_UINT32 Offset, LM_UINT32 * pData)
{
	LM_UINT32 Value32;
	LM_STATUS Status;
	LM_UINT32 j;

	if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700 ||
	    T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5701) {
		Status = LM_EepromRead (pDevice, Offset, pData);
	} else {
		/* Determine if we have flash or EEPROM. */
		Value32 = REG_RD (pDevice, Nvram.Config1);
		if (Value32 & FLASH_INTERFACE_ENABLE) {
			if (Value32 & FLASH_SSRAM_BUFFERRED_MODE) {
				Offset = ((Offset / BUFFERED_FLASH_PAGE_SIZE) <<
					  BUFFERED_FLASH_PAGE_POS) +
				    (Offset % BUFFERED_FLASH_PAGE_SIZE);
			}
		}

		REG_WR (pDevice, Nvram.SwArb, SW_ARB_REQ_SET1);
		for (j = 0; j < 1000; j++) {
			if (REG_RD (pDevice, Nvram.SwArb) & SW_ARB_GNT1) {
				break;
			}
			MM_Wait (20);
		}
		if (j == 1000) {
			return LM_STATUS_FAILURE;
		}

		/* Read from flash or EEPROM with the new 5703/02 interface. */
		REG_WR (pDevice, Nvram.Addr, Offset & NVRAM_ADDRESS_MASK);

		REG_WR (pDevice, Nvram.Cmd, NVRAM_CMD_RD | NVRAM_CMD_DO_IT |
			NVRAM_CMD_FIRST | NVRAM_CMD_LAST | NVRAM_CMD_DONE);

		/* Wait for the done bit to clear. */
		for (j = 0; j < 500; j++) {
			MM_Wait (10);

			Value32 = REG_RD (pDevice, Nvram.Cmd);
			if (!(Value32 & NVRAM_CMD_DONE)) {
				break;
			}
		}

		/* Wait for the done bit. */
		if (!(Value32 & NVRAM_CMD_DONE)) {
			for (j = 0; j < 500; j++) {
				MM_Wait (10);

				Value32 = REG_RD (pDevice, Nvram.Cmd);
				if (Value32 & NVRAM_CMD_DONE) {
					MM_Wait (10);

					*pData =
					    REG_RD (pDevice, Nvram.ReadData);

					/* Change the endianess. */
					*pData =
					    ((*pData & 0xff) << 24) |
					    ((*pData & 0xff00) << 8) |
					    ((*pData & 0xff0000) >> 8) |
					    ((*pData >> 24) & 0xff);

					break;
				}
			}
		}

		REG_WR (pDevice, Nvram.SwArb, SW_ARB_REQ_CLR1);
		if (Value32 & NVRAM_CMD_DONE) {
			Status = LM_STATUS_SUCCESS;
		} else {
			Status = LM_STATUS_FAILURE;
		}
	}

	return Status;
}				/* LM_NvramRead */

STATIC void LM_ReadVPD (PLM_DEVICE_BLOCK pDevice)
{
	LM_UINT32 Vpd_arr[256 / 4];
	LM_UINT8 *Vpd = (LM_UINT8 *) & Vpd_arr[0];
	LM_UINT32 *Vpd_dptr = &Vpd_arr[0];
	LM_UINT32 Value32;
	unsigned int j;

	/* Read PN from VPD */
	for (j = 0; j < 256; j += 4, Vpd_dptr++) {
		if (LM_NvramRead (pDevice, 0x100 + j, &Value32) !=
		    LM_STATUS_SUCCESS) {
			printf ("BCM570x: LM_ReadVPD: VPD read failed"
				" (no EEPROM onboard)\n");
			return;
		}
		*Vpd_dptr = cpu_to_le32 (Value32);
	}
	for (j = 0; j < 256;) {
		unsigned int Vpd_r_len;
		unsigned int Vpd_r_end;

		if ((Vpd[j] == 0x82) || (Vpd[j] == 0x91)) {
			j = j + 3 + Vpd[j + 1] + (Vpd[j + 2] << 8);
		} else if (Vpd[j] == 0x90) {
			Vpd_r_len = Vpd[j + 1] + (Vpd[j + 2] << 8);
			j += 3;
			Vpd_r_end = Vpd_r_len + j;
			while (j < Vpd_r_end) {
				if ((Vpd[j] == 'P') && (Vpd[j + 1] == 'N')) {
					unsigned int len = Vpd[j + 2];

					if (len <= 24) {
						memcpy (pDevice->PartNo,
							&Vpd[j + 3], len);
					}
					break;
				} else {
					if (Vpd[j + 2] == 0) {
						break;
					}
					j = j + Vpd[j + 2];
				}
			}
			break;
		} else {
			break;
		}
	}
}

STATIC void LM_ReadBootCodeVersion (PLM_DEVICE_BLOCK pDevice)
{
	LM_UINT32 Value32, offset, ver_offset;
	int i;

	if (LM_NvramRead (pDevice, 0x0, &Value32) != LM_STATUS_SUCCESS)
		return;
	if (Value32 != 0xaa559966)
		return;
	if (LM_NvramRead (pDevice, 0xc, &offset) != LM_STATUS_SUCCESS)
		return;

	offset = ((offset & 0xff) << 24) | ((offset & 0xff00) << 8) |
	    ((offset & 0xff0000) >> 8) | ((offset >> 24) & 0xff);
	if (LM_NvramRead (pDevice, offset, &Value32) != LM_STATUS_SUCCESS)
		return;
	if ((Value32 == 0x0300000e) &&
	    (LM_NvramRead (pDevice, offset + 4, &Value32) == LM_STATUS_SUCCESS)
	    && (Value32 == 0)) {

		if (LM_NvramRead (pDevice, offset + 8, &ver_offset) !=
		    LM_STATUS_SUCCESS)
			return;
		ver_offset = ((ver_offset & 0xff0000) >> 8) |
		    ((ver_offset >> 24) & 0xff);
		for (i = 0; i < 16; i += 4) {
			if (LM_NvramRead
			    (pDevice, offset + ver_offset + i,
			     &Value32) != LM_STATUS_SUCCESS) {
				return;
			}
			*((LM_UINT32 *) & pDevice->BootCodeVer[i]) =
			    cpu_to_le32 (Value32);
		}
	} else {
		char c;

		if (LM_NvramRead (pDevice, 0x94, &Value32) != LM_STATUS_SUCCESS)
			return;

		i = 0;
		c = ((Value32 & 0xff0000) >> 16);

		if (c < 10) {
			pDevice->BootCodeVer[i++] = c + '0';
		} else {
			pDevice->BootCodeVer[i++] = (c / 10) + '0';
			pDevice->BootCodeVer[i++] = (c % 10) + '0';
		}
		pDevice->BootCodeVer[i++] = '.';
		c = (Value32 & 0xff000000) >> 24;
		if (c < 10) {
			pDevice->BootCodeVer[i++] = c + '0';
		} else {
			pDevice->BootCodeVer[i++] = (c / 10) + '0';
			pDevice->BootCodeVer[i++] = (c % 10) + '0';
		}
		pDevice->BootCodeVer[i] = 0;
	}
}

STATIC void LM_GetBusSpeed (PLM_DEVICE_BLOCK pDevice)
{
	LM_UINT32 PciState = pDevice->PciState;
	LM_UINT32 ClockCtrl;
	char *SpeedStr = "";

	if (PciState & T3_PCI_STATE_32BIT_PCI_BUS) {
		strcpy (pDevice->BusSpeedStr, "32-bit ");
	} else {
		strcpy (pDevice->BusSpeedStr, "64-bit ");
	}
	if (PciState & T3_PCI_STATE_CONVENTIONAL_PCI_MODE) {
		strcat (pDevice->BusSpeedStr, "PCI ");
		if (PciState & T3_PCI_STATE_HIGH_BUS_SPEED) {
			SpeedStr = "66MHz";
		} else {
			SpeedStr = "33MHz";
		}
	} else {
		strcat (pDevice->BusSpeedStr, "PCIX ");
		if (pDevice->BondId == GRC_MISC_BD_ID_5704CIOBE) {
			SpeedStr = "133MHz";
		} else {
			ClockCtrl = REG_RD (pDevice, PciCfg.ClockCtrl) & 0x1f;
			switch (ClockCtrl) {
			case 0:
				SpeedStr = "33MHz";
				break;

			case 2:
				SpeedStr = "50MHz";
				break;

			case 4:
				SpeedStr = "66MHz";
				break;

			case 6:
				SpeedStr = "100MHz";
				break;

			case 7:
				SpeedStr = "133MHz";
				break;
			}
		}
	}
	strcat (pDevice->BusSpeedStr, SpeedStr);
}

/******************************************************************************/
/* Description:                                                               */
/*    This routine initializes default parameters and reads the PCI           */
/*    configurations.                                                         */
/*                                                                            */
/* Return:                                                                    */
/*    LM_STATUS_SUCCESS                                                       */
/******************************************************************************/
LM_STATUS LM_GetAdapterInfo (PLM_DEVICE_BLOCK pDevice)
{
	PLM_ADAPTER_INFO pAdapterInfo;
	LM_UINT32 Value32;
	LM_STATUS Status;
	LM_UINT32 j;
	LM_UINT32 EeSigFound;
	LM_UINT32 EePhyTypeSerdes = 0;
	LM_UINT32 EePhyLedMode = 0;
	LM_UINT32 EePhyId = 0;

	/* Get Device Id and Vendor Id */
	Status = MM_ReadConfig32 (pDevice, PCI_VENDOR_ID_REG, &Value32);
	if (Status != LM_STATUS_SUCCESS) {
		return Status;
	}
	pDevice->PciVendorId = (LM_UINT16) Value32;
	pDevice->PciDeviceId = (LM_UINT16) (Value32 >> 16);

	/* If we are not getting the write adapter, exit. */
	if ((Value32 != T3_PCI_ID_BCM5700) &&
	    (Value32 != T3_PCI_ID_BCM5701) &&
	    (Value32 != T3_PCI_ID_BCM5702) &&
	    (Value32 != T3_PCI_ID_BCM5702x) &&
	    (Value32 != T3_PCI_ID_BCM5702FE) &&
	    (Value32 != T3_PCI_ID_BCM5703) &&
	    (Value32 != T3_PCI_ID_BCM5703x) && (Value32 != T3_PCI_ID_BCM5704)) {
		return LM_STATUS_FAILURE;
	}

	Status = MM_ReadConfig32 (pDevice, PCI_REV_ID_REG, &Value32);
	if (Status != LM_STATUS_SUCCESS) {
		return Status;
	}
	pDevice->PciRevId = (LM_UINT8) Value32;

	/* Get IRQ. */
	Status = MM_ReadConfig32 (pDevice, PCI_INT_LINE_REG, &Value32);
	if (Status != LM_STATUS_SUCCESS) {
		return Status;
	}
	pDevice->Irq = (LM_UINT8) Value32;

	/* Get interrupt pin. */
	pDevice->IntPin = (LM_UINT8) (Value32 >> 8);

	/* Get chip revision id. */
	Status = MM_ReadConfig32 (pDevice, T3_PCI_MISC_HOST_CTRL_REG, &Value32);
	pDevice->ChipRevId = Value32 >> 16;

	/* Get subsystem vendor. */
	Status =
	    MM_ReadConfig32 (pDevice, PCI_SUBSYSTEM_VENDOR_ID_REG, &Value32);
	if (Status != LM_STATUS_SUCCESS) {
		return Status;
	}
	pDevice->SubsystemVendorId = (LM_UINT16) Value32;

	/* Get PCI subsystem id. */
	pDevice->SubsystemId = (LM_UINT16) (Value32 >> 16);

	/* Get the cache line size. */
	MM_ReadConfig32 (pDevice, PCI_CACHE_LINE_SIZE_REG, &Value32);
	pDevice->CacheLineSize = (LM_UINT8) Value32;
	pDevice->SavedCacheLineReg = Value32;

	if (pDevice->ChipRevId != T3_CHIP_ID_5703_A1 &&
	    pDevice->ChipRevId != T3_CHIP_ID_5703_A2 &&
	    pDevice->ChipRevId != T3_CHIP_ID_5704_A0) {
		pDevice->UndiFix = FALSE;
	}
#if !PCIX_TARGET_WORKAROUND
	pDevice->UndiFix = FALSE;
#endif
	/* Map the memory base to system address space. */
	if (!pDevice->UndiFix) {
		Status = MM_MapMemBase (pDevice);
		if (Status != LM_STATUS_SUCCESS) {
			return Status;
		}
		/* Initialize the memory view pointer. */
		pDevice->pMemView = (PT3_STD_MEM_MAP) pDevice->pMappedMemBase;
	}
#if PCIX_TARGET_WORKAROUND
	/* store whether we are in PCI are PCI-X mode */
	pDevice->EnablePciXFix = FALSE;

	MM_ReadConfig32 (pDevice, T3_PCI_STATE_REG, &Value32);
	if ((Value32 & T3_PCI_STATE_CONVENTIONAL_PCI_MODE) == 0) {
		/* Enable PCI-X workaround only if we are running on 5700 BX. */
		if (T3_CHIP_REV (pDevice->ChipRevId) == T3_CHIP_REV_5700_BX) {
			pDevice->EnablePciXFix = TRUE;
		}
	}
	if (pDevice->UndiFix) {
		pDevice->EnablePciXFix = TRUE;
	}
#endif
	/* Bx bug: due to the "byte_enable bug" in PCI-X mode, the power */
	/* management register may be clobbered which may cause the */
	/* BCM5700 to go into D3 state.  While in this state, we will */
	/* not have memory mapped register access.  As a workaround, we */
	/* need to restore the device to D0 state. */
	MM_ReadConfig32 (pDevice, T3_PCI_PM_STATUS_CTRL_REG, &Value32);
	Value32 |= T3_PM_PME_ASSERTED;
	Value32 &= ~T3_PM_POWER_STATE_MASK;
	Value32 |= T3_PM_POWER_STATE_D0;
	MM_WriteConfig32 (pDevice, T3_PCI_PM_STATUS_CTRL_REG, Value32);

	/* read the current PCI command word */
	MM_ReadConfig32 (pDevice, PCI_COMMAND_REG, &Value32);

	/* Make sure bus-mastering is enabled. */
	Value32 |= PCI_BUSMASTER_ENABLE;

#if PCIX_TARGET_WORKAROUND
	/* if we are in PCI-X mode, also make sure mem-mapping and SERR#/PERR#
	   are enabled */
	if (pDevice->EnablePciXFix == TRUE) {
		Value32 |= (PCI_MEM_SPACE_ENABLE | PCI_SYSTEM_ERROR_ENABLE |
			    PCI_PARITY_ERROR_ENABLE);
	}
	if (pDevice->UndiFix) {
		Value32 &= ~PCI_MEM_SPACE_ENABLE;
	}
#endif

	if (pDevice->EnableMWI) {
		Value32 |= PCI_MEMORY_WRITE_INVALIDATE;
	} else {
		Value32 &= (~PCI_MEMORY_WRITE_INVALIDATE);
	}

	/* Error out if mem-mapping is NOT enabled for PCI systems */
	if (!(Value32 | PCI_MEM_SPACE_ENABLE)) {
		return LM_STATUS_FAILURE;
	}

	/* save the value we are going to write into the PCI command word */
	pDevice->PciCommandStatusWords = Value32;

	Status = MM_WriteConfig32 (pDevice, PCI_COMMAND_REG, Value32);
	if (Status != LM_STATUS_SUCCESS) {
		return Status;
	}

	/* Set power state to D0. */
	LM_SetPowerState (pDevice, LM_POWER_STATE_D0);

#ifdef BIG_ENDIAN_PCI
	pDevice->MiscHostCtrl =
	    MISC_HOST_CTRL_MASK_PCI_INT |
	    MISC_HOST_CTRL_ENABLE_INDIRECT_ACCESS |
	    MISC_HOST_CTRL_ENABLE_ENDIAN_WORD_SWAP |
	    MISC_HOST_CTRL_ENABLE_PCI_STATE_REG_RW;
#else				/* No CPU Swap modes for PCI IO */

	/* Setup the mode registers. */
	pDevice->MiscHostCtrl =
	    MISC_HOST_CTRL_MASK_PCI_INT |
	    MISC_HOST_CTRL_ENABLE_ENDIAN_WORD_SWAP |
#ifdef BIG_ENDIAN_HOST
	    MISC_HOST_CTRL_ENABLE_ENDIAN_BYTE_SWAP |
#endif				/* BIG_ENDIAN_HOST */
	    MISC_HOST_CTRL_ENABLE_INDIRECT_ACCESS |
	    MISC_HOST_CTRL_ENABLE_PCI_STATE_REG_RW;
#endif				/* !BIG_ENDIAN_PCI */

	/* write to PCI misc host ctr first in order to enable indirect accesses */
	MM_WriteConfig32 (pDevice, T3_PCI_MISC_HOST_CTRL_REG,
			  pDevice->MiscHostCtrl);

	REG_WR (pDevice, PciCfg.MiscHostCtrl, pDevice->MiscHostCtrl);

#ifdef BIG_ENDIAN_PCI
	Value32 = GRC_MODE_WORD_SWAP_DATA | GRC_MODE_WORD_SWAP_NON_FRAME_DATA;
#else
/* No CPU Swap modes for PCI IO */
#ifdef BIG_ENDIAN_HOST
	Value32 = GRC_MODE_BYTE_SWAP_NON_FRAME_DATA |
	    GRC_MODE_WORD_SWAP_NON_FRAME_DATA;
#else
	Value32 = GRC_MODE_BYTE_SWAP_NON_FRAME_DATA | GRC_MODE_BYTE_SWAP_DATA;
#endif
#endif				/* !BIG_ENDIAN_PCI */

	REG_WR (pDevice, Grc.Mode, Value32);

	if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700) {
		REG_WR (pDevice, Grc.LocalCtrl,
			GRC_MISC_LOCAL_CTRL_GPIO_OUTPUT1 |
			GRC_MISC_LOCAL_CTRL_GPIO_OE1);
	}
	MM_Wait (40);

	/* Enable indirect memory access */
	REG_WR (pDevice, MemArbiter.Mode, T3_MEM_ARBITER_MODE_ENABLE);

	if (REG_RD (pDevice, PciCfg.ClockCtrl) & T3_PCI_44MHZ_CORE_CLOCK) {
		REG_WR (pDevice, PciCfg.ClockCtrl, T3_PCI_44MHZ_CORE_CLOCK |
			T3_PCI_SELECT_ALTERNATE_CLOCK);
		REG_WR (pDevice, PciCfg.ClockCtrl,
			T3_PCI_SELECT_ALTERNATE_CLOCK);
		MM_Wait (40);	/* required delay is 27usec */
	}
	REG_WR (pDevice, PciCfg.ClockCtrl, 0);
	REG_WR (pDevice, PciCfg.MemWindowBaseAddr, 0);

#if PCIX_TARGET_WORKAROUND
	MM_ReadConfig32 (pDevice, T3_PCI_STATE_REG, &Value32);
	if ((pDevice->EnablePciXFix == FALSE) &&
	    ((Value32 & T3_PCI_STATE_CONVENTIONAL_PCI_MODE) == 0)) {
		if (pDevice->ChipRevId == T3_CHIP_ID_5701_A0 ||
		    pDevice->ChipRevId == T3_CHIP_ID_5701_B0 ||
		    pDevice->ChipRevId == T3_CHIP_ID_5701_B2 ||
		    pDevice->ChipRevId == T3_CHIP_ID_5701_B5) {
			__raw_writel (0,
				      &(pDevice->pMemView->uIntMem.
					MemBlock32K[0x300]));
			__raw_writel (0,
				      &(pDevice->pMemView->uIntMem.
					MemBlock32K[0x301]));
			__raw_writel (0xffffffff,
				      &(pDevice->pMemView->uIntMem.
					MemBlock32K[0x301]));
			if (__raw_readl
			    (&(pDevice->pMemView->uIntMem.MemBlock32K[0x300])))
			{
				pDevice->EnablePciXFix = TRUE;
			}
		}
	}
#endif
#if 1
	/*
	 *  This code was at the beginning of else block below, but that's
	 *  a bug if node address in shared memory.
	 */
	MM_Wait (50);
	LM_NvramInit (pDevice);
#endif
	/* Get the node address.  First try to get in from the shared memory. */
	/* If the signature is not present, then get it from the NVRAM. */
	Value32 = MEM_RD_OFFSET (pDevice, T3_MAC_ADDR_HIGH_MAILBOX);
	if ((Value32 >> 16) == 0x484b) {

		pDevice->NodeAddress[0] = (LM_UINT8) (Value32 >> 8);
		pDevice->NodeAddress[1] = (LM_UINT8) Value32;

		Value32 = MEM_RD_OFFSET (pDevice, T3_MAC_ADDR_LOW_MAILBOX);

		pDevice->NodeAddress[2] = (LM_UINT8) (Value32 >> 24);
		pDevice->NodeAddress[3] = (LM_UINT8) (Value32 >> 16);
		pDevice->NodeAddress[4] = (LM_UINT8) (Value32 >> 8);
		pDevice->NodeAddress[5] = (LM_UINT8) Value32;

		Status = LM_STATUS_SUCCESS;
	} else {
		Status = LM_NvramRead (pDevice, 0x7c, &Value32);
		if (Status == LM_STATUS_SUCCESS) {
			pDevice->NodeAddress[0] = (LM_UINT8) (Value32 >> 16);
			pDevice->NodeAddress[1] = (LM_UINT8) (Value32 >> 24);

			Status = LM_NvramRead (pDevice, 0x80, &Value32);

			pDevice->NodeAddress[2] = (LM_UINT8) Value32;
			pDevice->NodeAddress[3] = (LM_UINT8) (Value32 >> 8);
			pDevice->NodeAddress[4] = (LM_UINT8) (Value32 >> 16);
			pDevice->NodeAddress[5] = (LM_UINT8) (Value32 >> 24);
		}
	}

	/* Assign a default address. */
	if (Status != LM_STATUS_SUCCESS) {
#ifndef EMBEDDED
		printk (KERN_ERR
			"Cannot get MAC addr from NVRAM. Using default.\n");
#endif
		pDevice->NodeAddress[0] = 0x00;
		pDevice->NodeAddress[1] = 0x10;
		pDevice->NodeAddress[2] = 0x18;
		pDevice->NodeAddress[3] = 0x68;
		pDevice->NodeAddress[4] = 0x61;
		pDevice->NodeAddress[5] = 0x76;
	}

	pDevice->PermanentNodeAddress[0] = pDevice->NodeAddress[0];
	pDevice->PermanentNodeAddress[1] = pDevice->NodeAddress[1];
	pDevice->PermanentNodeAddress[2] = pDevice->NodeAddress[2];
	pDevice->PermanentNodeAddress[3] = pDevice->NodeAddress[3];
	pDevice->PermanentNodeAddress[4] = pDevice->NodeAddress[4];
	pDevice->PermanentNodeAddress[5] = pDevice->NodeAddress[5];

	/* Initialize the default values. */
	pDevice->NoTxPseudoHdrChksum = FALSE;
	pDevice->NoRxPseudoHdrChksum = FALSE;
	pDevice->NicSendBd = FALSE;
	pDevice->TxPacketDescCnt = DEFAULT_TX_PACKET_DESC_COUNT;
	pDevice->RxStdDescCnt = DEFAULT_STD_RCV_DESC_COUNT;
	pDevice->RxCoalescingTicks = DEFAULT_RX_COALESCING_TICKS;
	pDevice->TxCoalescingTicks = DEFAULT_TX_COALESCING_TICKS;
	pDevice->RxMaxCoalescedFrames = DEFAULT_RX_MAX_COALESCED_FRAMES;
	pDevice->TxMaxCoalescedFrames = DEFAULT_TX_MAX_COALESCED_FRAMES;
	pDevice->RxCoalescingTicksDuringInt = BAD_DEFAULT_VALUE;
	pDevice->TxCoalescingTicksDuringInt = BAD_DEFAULT_VALUE;
	pDevice->RxMaxCoalescedFramesDuringInt = BAD_DEFAULT_VALUE;
	pDevice->TxMaxCoalescedFramesDuringInt = BAD_DEFAULT_VALUE;
	pDevice->StatsCoalescingTicks = DEFAULT_STATS_COALESCING_TICKS;
	pDevice->EnableMWI = FALSE;
	pDevice->TxMtu = MAX_ETHERNET_PACKET_SIZE_NO_CRC;
	pDevice->RxMtu = MAX_ETHERNET_PACKET_SIZE_NO_CRC;
	pDevice->DisableAutoNeg = FALSE;
	pDevice->PhyIntMode = T3_PHY_INT_MODE_AUTO;
	pDevice->LinkChngMode = T3_LINK_CHNG_MODE_AUTO;
	pDevice->LedMode = LED_MODE_AUTO;
	pDevice->ResetPhyOnInit = TRUE;
	pDevice->DelayPciGrant = TRUE;
	pDevice->UseTaggedStatus = FALSE;
	pDevice->OneDmaAtOnce = BAD_DEFAULT_VALUE;

	pDevice->DmaMbufLowMark = T3_DEF_DMA_MBUF_LOW_WMARK_JUMBO;
	pDevice->RxMacMbufLowMark = T3_DEF_RX_MAC_MBUF_LOW_WMARK_JUMBO;
	pDevice->MbufHighMark = T3_DEF_MBUF_HIGH_WMARK_JUMBO;

	pDevice->RequestedMediaType = LM_REQUESTED_MEDIA_TYPE_AUTO;
	pDevice->TaskOffloadCap = LM_TASK_OFFLOAD_NONE;
	pDevice->FlowControlCap = LM_FLOW_CONTROL_AUTO_PAUSE;
	pDevice->EnableTbi = FALSE;
#if INCLUDE_TBI_SUPPORT
	pDevice->PollTbiLink = BAD_DEFAULT_VALUE;
#endif

	switch (T3_ASIC_REV (pDevice->ChipRevId)) {
	case T3_ASIC_REV_5704:
		pDevice->MbufBase = T3_NIC_MBUF_POOL_ADDR;
		pDevice->MbufSize = T3_NIC_MBUF_POOL_SIZE64;
		break;
	default:
		pDevice->MbufBase = T3_NIC_MBUF_POOL_ADDR;
		pDevice->MbufSize = T3_NIC_MBUF_POOL_SIZE96;
		break;
	}

	pDevice->LinkStatus = LM_STATUS_LINK_DOWN;
	pDevice->QueueRxPackets = TRUE;

	pDevice->EnableWireSpeed = TRUE;

#if T3_JUMBO_RCV_RCB_ENTRY_COUNT
	pDevice->RxJumboDescCnt = DEFAULT_JUMBO_RCV_DESC_COUNT;
#endif				/* T3_JUMBO_RCV_RCB_ENTRY_COUNT */

	/* Make this is a known adapter. */
	pAdapterInfo = LM_GetAdapterInfoBySsid (pDevice->SubsystemVendorId,
						pDevice->SubsystemId);

	pDevice->BondId = REG_RD (pDevice, Grc.MiscCfg) & GRC_MISC_BD_ID_MASK;
	if (pDevice->BondId != GRC_MISC_BD_ID_5700 &&
	    pDevice->BondId != GRC_MISC_BD_ID_5701 &&
	    pDevice->BondId != GRC_MISC_BD_ID_5702FE &&
	    pDevice->BondId != GRC_MISC_BD_ID_5703 &&
	    pDevice->BondId != GRC_MISC_BD_ID_5703S &&
	    pDevice->BondId != GRC_MISC_BD_ID_5704 &&
	    pDevice->BondId != GRC_MISC_BD_ID_5704CIOBE) {
		return LM_STATUS_UNKNOWN_ADAPTER;
	}

	pDevice->SplitModeEnable = SPLIT_MODE_DISABLE;
	if ((pDevice->ChipRevId == T3_CHIP_ID_5704_A0) &&
	    (pDevice->BondId == GRC_MISC_BD_ID_5704CIOBE)) {
		pDevice->SplitModeEnable = SPLIT_MODE_ENABLE;
		pDevice->SplitModeMaxReq = SPLIT_MODE_5704_MAX_REQ;
	}

	/* Get Eeprom info. */
	Value32 = MEM_RD_OFFSET (pDevice, T3_NIC_DATA_SIG_ADDR);
	if (Value32 == T3_NIC_DATA_SIG) {
		EeSigFound = TRUE;
		Value32 = MEM_RD_OFFSET (pDevice, T3_NIC_DATA_NIC_CFG_ADDR);

		/* Determine PHY type. */
		switch (Value32 & T3_NIC_CFG_PHY_TYPE_MASK) {
		case T3_NIC_CFG_PHY_TYPE_COPPER:
			EePhyTypeSerdes = FALSE;
			break;

		case T3_NIC_CFG_PHY_TYPE_FIBER:
			EePhyTypeSerdes = TRUE;
			break;

		default:
			EePhyTypeSerdes = FALSE;
			break;
		}

		/* Determine PHY led mode. */
		if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700 ||
		    T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5701) {
			switch (Value32 & T3_NIC_CFG_LED_MODE_MASK) {
			case T3_NIC_CFG_LED_MODE_TRIPLE_SPEED:
				EePhyLedMode = LED_MODE_THREE_LINK;
				break;

			case T3_NIC_CFG_LED_MODE_LINK_SPEED:
				EePhyLedMode = LED_MODE_LINK10;
				break;

			default:
				EePhyLedMode = LED_MODE_AUTO;
				break;
			}
		} else {
			switch (Value32 & T3_NIC_CFG_LED_MODE_MASK) {
			case T3_NIC_CFG_LED_MODE_OPEN_DRAIN:
				EePhyLedMode = LED_MODE_OPEN_DRAIN;
				break;

			case T3_NIC_CFG_LED_MODE_OUTPUT:
				EePhyLedMode = LED_MODE_OUTPUT;
				break;

			default:
				EePhyLedMode = LED_MODE_AUTO;
				break;
			}
		}
		if (pDevice->ChipRevId == T3_CHIP_ID_5703_A1 ||
		    pDevice->ChipRevId == T3_CHIP_ID_5703_A2) {
			/* Enable EEPROM write protection. */
			if (Value32 & T3_NIC_EEPROM_WP) {
				pDevice->EepromWp = TRUE;
			}
		}

		/* Get the PHY Id. */
		Value32 = MEM_RD_OFFSET (pDevice, T3_NIC_DATA_PHY_ID_ADDR);
		if (Value32) {
			EePhyId = (((Value32 & T3_NIC_PHY_ID1_MASK) >> 16) &
				   PHY_ID1_OUI_MASK) << 10;

			Value32 = Value32 & T3_NIC_PHY_ID2_MASK;

			EePhyId |= ((Value32 & PHY_ID2_OUI_MASK) << 16) |
			    (Value32 & PHY_ID2_MODEL_MASK) | (Value32 &
							      PHY_ID2_REV_MASK);
		} else {
			EePhyId = 0;
		}
	} else {
		EeSigFound = FALSE;
	}

	/* Set the PHY address. */
	pDevice->PhyAddr = PHY_DEVICE_ID;

	/* Disable auto polling. */
	pDevice->MiMode = 0xc0000;
	REG_WR (pDevice, MacCtrl.MiMode, pDevice->MiMode);
	MM_Wait (40);

	/* Get the PHY id. */
	LM_ReadPhy (pDevice, PHY_ID1_REG, &Value32);
	pDevice->PhyId = (Value32 & PHY_ID1_OUI_MASK) << 10;

	LM_ReadPhy (pDevice, PHY_ID2_REG, &Value32);
	pDevice->PhyId |= ((Value32 & PHY_ID2_OUI_MASK) << 16) |
	    (Value32 & PHY_ID2_MODEL_MASK) | (Value32 & PHY_ID2_REV_MASK);

	/* Set the EnableTbi flag to false if we have a copper PHY. */
	switch (pDevice->PhyId & PHY_ID_MASK) {
	case PHY_BCM5400_PHY_ID:
		pDevice->EnableTbi = FALSE;
		break;

	case PHY_BCM5401_PHY_ID:
		pDevice->EnableTbi = FALSE;
		break;

	case PHY_BCM5411_PHY_ID:
		pDevice->EnableTbi = FALSE;
		break;

	case PHY_BCM5701_PHY_ID:
		pDevice->EnableTbi = FALSE;
		break;

	case PHY_BCM5703_PHY_ID:
		pDevice->EnableTbi = FALSE;
		break;

	case PHY_BCM5704_PHY_ID:
		pDevice->EnableTbi = FALSE;
		break;

	case PHY_BCM8002_PHY_ID:
		pDevice->EnableTbi = TRUE;
		break;

	default:

		if (pAdapterInfo) {
			pDevice->PhyId = pAdapterInfo->PhyId;
			pDevice->EnableTbi = pAdapterInfo->Serdes;
		} else if (EeSigFound) {
			pDevice->PhyId = EePhyId;
			pDevice->EnableTbi = EePhyTypeSerdes;
		}
		break;
	}

	/* Bail out if we don't know the copper PHY id. */
	if (UNKNOWN_PHY_ID (pDevice->PhyId) && !pDevice->EnableTbi) {
		return LM_STATUS_FAILURE;
	}

	if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5703) {
		if ((pDevice->SavedCacheLineReg & 0xff00) < 0x4000) {
			pDevice->SavedCacheLineReg &= 0xffff00ff;
			pDevice->SavedCacheLineReg |= 0x4000;
		}
	}
	/* Change driver parameters. */
	Status = MM_GetConfig (pDevice);
	if (Status != LM_STATUS_SUCCESS) {
		return Status;
	}
#if INCLUDE_5701_AX_FIX
	if (pDevice->ChipRevId == T3_CHIP_ID_5701_A0 ||
	    pDevice->ChipRevId == T3_CHIP_ID_5701_B0) {
		pDevice->ResetPhyOnInit = TRUE;
	}
#endif

	/* Save the current phy link status. */
	if (!pDevice->EnableTbi) {
		LM_ReadPhy (pDevice, PHY_STATUS_REG, &Value32);
		LM_ReadPhy (pDevice, PHY_STATUS_REG, &Value32);

		/* If we don't have link reset the PHY. */
		if (!(Value32 & PHY_STATUS_LINK_PASS)
		    || pDevice->ResetPhyOnInit) {

			LM_WritePhy (pDevice, PHY_CTRL_REG, PHY_CTRL_PHY_RESET);

			for (j = 0; j < 100; j++) {
				MM_Wait (10);

				LM_ReadPhy (pDevice, PHY_CTRL_REG, &Value32);
				if (Value32 && !(Value32 & PHY_CTRL_PHY_RESET)) {
					MM_Wait (40);
					break;
				}
			}

#if INCLUDE_5701_AX_FIX
			/* 5701_AX_BX bug:  only advertises 10mb speed. */
			if (pDevice->ChipRevId == T3_CHIP_ID_5701_A0 ||
			    pDevice->ChipRevId == T3_CHIP_ID_5701_B0) {

				Value32 = PHY_AN_AD_PROTOCOL_802_3_CSMA_CD |
				    PHY_AN_AD_10BASET_HALF |
				    PHY_AN_AD_10BASET_FULL |
				    PHY_AN_AD_100BASETX_FULL |
				    PHY_AN_AD_100BASETX_HALF;
				Value32 |= GetPhyAdFlowCntrlSettings (pDevice);
				LM_WritePhy (pDevice, PHY_AN_AD_REG, Value32);
				pDevice->advertising = Value32;

				Value32 = BCM540X_AN_AD_1000BASET_HALF |
				    BCM540X_AN_AD_1000BASET_FULL |
				    BCM540X_CONFIG_AS_MASTER |
				    BCM540X_ENABLE_CONFIG_AS_MASTER;
				LM_WritePhy (pDevice,
					     BCM540X_1000BASET_CTRL_REG,
					     Value32);
				pDevice->advertising1000 = Value32;

				LM_WritePhy (pDevice, PHY_CTRL_REG,
					     PHY_CTRL_AUTO_NEG_ENABLE |
					     PHY_CTRL_RESTART_AUTO_NEG);
			}
#endif
			if (T3_ASIC_REV (pDevice->ChipRevId) ==
			    T3_ASIC_REV_5703) {
				LM_WritePhy (pDevice, 0x18, 0x0c00);
				LM_WritePhy (pDevice, 0x17, 0x201f);
				LM_WritePhy (pDevice, 0x15, 0x2aaa);
			}
			if (pDevice->ChipRevId == T3_CHIP_ID_5704_A0) {
				LM_WritePhy (pDevice, 0x1c, 0x8d68);
				LM_WritePhy (pDevice, 0x1c, 0x8d68);
			}
			/* Enable Ethernet@WireSpeed. */
			if (pDevice->EnableWireSpeed) {
				LM_WritePhy (pDevice, 0x18, 0x7007);
				LM_ReadPhy (pDevice, 0x18, &Value32);
				LM_WritePhy (pDevice, 0x18,
					     Value32 | BIT_15 | BIT_4);
			}
		}
	}

	/* Turn off tap power management. */
	if ((pDevice->PhyId & PHY_ID_MASK) == PHY_BCM5401_PHY_ID) {
		LM_WritePhy (pDevice, BCM5401_AUX_CTRL, 0x0c20);
		LM_WritePhy (pDevice, BCM540X_DSP_ADDRESS_REG, 0x0012);
		LM_WritePhy (pDevice, BCM540X_DSP_RW_PORT, 0x1804);
		LM_WritePhy (pDevice, BCM540X_DSP_ADDRESS_REG, 0x0013);
		LM_WritePhy (pDevice, BCM540X_DSP_RW_PORT, 0x1204);
		LM_WritePhy (pDevice, BCM540X_DSP_ADDRESS_REG, 0x8006);
		LM_WritePhy (pDevice, BCM540X_DSP_RW_PORT, 0x0132);
		LM_WritePhy (pDevice, BCM540X_DSP_ADDRESS_REG, 0x8006);
		LM_WritePhy (pDevice, BCM540X_DSP_RW_PORT, 0x0232);
		LM_WritePhy (pDevice, BCM540X_DSP_ADDRESS_REG, 0x201f);
		LM_WritePhy (pDevice, BCM540X_DSP_RW_PORT, 0x0a20);

		MM_Wait (40);
	}
#if INCLUDE_TBI_SUPPORT
	pDevice->IgnoreTbiLinkChange = FALSE;

	if (pDevice->EnableTbi) {
		pDevice->WakeUpModeCap = LM_WAKE_UP_MODE_NONE;
		pDevice->PhyIntMode = T3_PHY_INT_MODE_LINK_READY;
		if ((pDevice->PollTbiLink == BAD_DEFAULT_VALUE) ||
		    pDevice->DisableAutoNeg) {
			pDevice->PollTbiLink = FALSE;
		}
	} else {
		pDevice->PollTbiLink = FALSE;
	}
#endif				/* INCLUDE_TBI_SUPPORT */

	/* UseTaggedStatus is only valid for 5701 and later. */
	if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700) {
		pDevice->UseTaggedStatus = FALSE;

		pDevice->CoalesceMode = 0;
	} else {
		pDevice->CoalesceMode =
		    HOST_COALESCE_CLEAR_TICKS_ON_RX_BD_EVENT |
		    HOST_COALESCE_CLEAR_TICKS_ON_TX_BD_EVENT;
	}

	/* Set the status block size. */
	if (T3_CHIP_REV (pDevice->ChipRevId) != T3_CHIP_REV_5700_AX &&
	    T3_CHIP_REV (pDevice->ChipRevId) != T3_CHIP_REV_5700_BX) {
		pDevice->CoalesceMode |= HOST_COALESCE_32_BYTE_STATUS_MODE;
	}

	/* Check the DURING_INT coalescing ticks parameters. */
	if (pDevice->UseTaggedStatus) {
		if (pDevice->RxCoalescingTicksDuringInt == BAD_DEFAULT_VALUE) {
			pDevice->RxCoalescingTicksDuringInt =
			    DEFAULT_RX_COALESCING_TICKS_DURING_INT;
		}

		if (pDevice->TxCoalescingTicksDuringInt == BAD_DEFAULT_VALUE) {
			pDevice->TxCoalescingTicksDuringInt =
			    DEFAULT_TX_COALESCING_TICKS_DURING_INT;
		}

		if (pDevice->RxMaxCoalescedFramesDuringInt == BAD_DEFAULT_VALUE) {
			pDevice->RxMaxCoalescedFramesDuringInt =
			    DEFAULT_RX_MAX_COALESCED_FRAMES_DURING_INT;
		}

		if (pDevice->TxMaxCoalescedFramesDuringInt == BAD_DEFAULT_VALUE) {
			pDevice->TxMaxCoalescedFramesDuringInt =
			    DEFAULT_TX_MAX_COALESCED_FRAMES_DURING_INT;
		}
	} else {
		if (pDevice->RxCoalescingTicksDuringInt == BAD_DEFAULT_VALUE) {
			pDevice->RxCoalescingTicksDuringInt = 0;
		}

		if (pDevice->TxCoalescingTicksDuringInt == BAD_DEFAULT_VALUE) {
			pDevice->TxCoalescingTicksDuringInt = 0;
		}

		if (pDevice->RxMaxCoalescedFramesDuringInt == BAD_DEFAULT_VALUE) {
			pDevice->RxMaxCoalescedFramesDuringInt = 0;
		}

		if (pDevice->TxMaxCoalescedFramesDuringInt == BAD_DEFAULT_VALUE) {
			pDevice->TxMaxCoalescedFramesDuringInt = 0;
		}
	}

#if T3_JUMBO_RCV_RCB_ENTRY_COUNT
	if (pDevice->RxMtu <= (MAX_STD_RCV_BUFFER_SIZE - 8 /* CRC */ )) {
		pDevice->RxJumboDescCnt = 0;
		if (pDevice->RxMtu <= MAX_ETHERNET_PACKET_SIZE_NO_CRC) {
			pDevice->RxMtu = MAX_ETHERNET_PACKET_SIZE_NO_CRC;
		}
	} else {
		pDevice->RxJumboBufferSize =
		    (pDevice->RxMtu + 8 /* CRC + VLAN */  +
		     COMMON_CACHE_LINE_SIZE - 1) & ~COMMON_CACHE_LINE_MASK;

		if (pDevice->RxJumboBufferSize > MAX_JUMBO_RCV_BUFFER_SIZE) {
			pDevice->RxJumboBufferSize =
			    DEFAULT_JUMBO_RCV_BUFFER_SIZE;
			pDevice->RxMtu =
			    pDevice->RxJumboBufferSize - 8 /* CRC + VLAN */ ;
		}
		pDevice->TxMtu = pDevice->RxMtu;

	}
#else
	pDevice->RxMtu = MAX_ETHERNET_PACKET_SIZE_NO_CRC;
#endif				/* T3_JUMBO_RCV_RCB_ENTRY_COUNT */

	pDevice->RxPacketDescCnt =
#if T3_JUMBO_RCV_RCB_ENTRY_COUNT
	    pDevice->RxJumboDescCnt +
#endif				/* T3_JUMBO_RCV_RCB_ENTRY_COUNT */
	    pDevice->RxStdDescCnt;

	if (pDevice->TxMtu < MAX_ETHERNET_PACKET_SIZE_NO_CRC) {
		pDevice->TxMtu = MAX_ETHERNET_PACKET_SIZE_NO_CRC;
	}

	if (pDevice->TxMtu > MAX_JUMBO_TX_BUFFER_SIZE) {
		pDevice->TxMtu = MAX_JUMBO_TX_BUFFER_SIZE;
	}

	/* Configure the proper ways to get link change interrupt. */
	if (pDevice->PhyIntMode == T3_PHY_INT_MODE_AUTO) {
		if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700) {
			pDevice->PhyIntMode = T3_PHY_INT_MODE_MI_INTERRUPT;
		} else {
			pDevice->PhyIntMode = T3_PHY_INT_MODE_LINK_READY;
		}
	} else if (pDevice->PhyIntMode == T3_PHY_INT_MODE_AUTO_POLLING) {
		/* Auto-polling does not work on 5700_AX and 5700_BX. */
		if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700) {
			pDevice->PhyIntMode = T3_PHY_INT_MODE_MI_INTERRUPT;
		}
	}

	/* Determine the method to get link change status. */
	if (pDevice->LinkChngMode == T3_LINK_CHNG_MODE_AUTO) {
		/* The link status bit in the status block does not work on 5700_AX */
		/* and 5700_BX chips. */
		if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700) {
			pDevice->LinkChngMode =
			    T3_LINK_CHNG_MODE_USE_STATUS_REG;
		} else {
			pDevice->LinkChngMode =
			    T3_LINK_CHNG_MODE_USE_STATUS_BLOCK;
		}
	}

	if (pDevice->PhyIntMode == T3_PHY_INT_MODE_MI_INTERRUPT ||
	    T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700) {
		pDevice->LinkChngMode = T3_LINK_CHNG_MODE_USE_STATUS_REG;
	}

	/* Configure PHY led mode. */
	if (pDevice->LedMode == LED_MODE_AUTO) {
		if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700 ||
		    T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5701) {
			if (pDevice->SubsystemVendorId == T3_SVID_DELL) {
				pDevice->LedMode = LED_MODE_LINK10;
			} else {
				pDevice->LedMode = LED_MODE_THREE_LINK;

				if (EeSigFound && EePhyLedMode != LED_MODE_AUTO) {
					pDevice->LedMode = EePhyLedMode;
				}
			}

			/* bug? 5701 in LINK10 mode does not seem to work when */
			/* PhyIntMode is LINK_READY. */
			if (T3_ASIC_REV (pDevice->ChipRevId) != T3_ASIC_REV_5700
			    &&
#if INCLUDE_TBI_SUPPORT
			    pDevice->EnableTbi == FALSE &&
#endif
			    pDevice->LedMode == LED_MODE_LINK10) {
				pDevice->PhyIntMode =
				    T3_PHY_INT_MODE_MI_INTERRUPT;
				pDevice->LinkChngMode =
				    T3_LINK_CHNG_MODE_USE_STATUS_REG;
			}

			if (pDevice->EnableTbi) {
				pDevice->LedMode = LED_MODE_THREE_LINK;
			}
		} else {
			if (EeSigFound && EePhyLedMode != LED_MODE_AUTO) {
				pDevice->LedMode = EePhyLedMode;
			} else {
				pDevice->LedMode = LED_MODE_OPEN_DRAIN;
			}
		}
	}

	/* Enable OneDmaAtOnce. */
	if (pDevice->OneDmaAtOnce == BAD_DEFAULT_VALUE) {
		pDevice->OneDmaAtOnce = FALSE;
	}

	if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700 ||
	    pDevice->ChipRevId == T3_CHIP_ID_5701_A0 ||
	    pDevice->ChipRevId == T3_CHIP_ID_5701_B0 ||
	    pDevice->ChipRevId == T3_CHIP_ID_5701_B2) {
		pDevice->WolSpeed = WOL_SPEED_10MB;
	} else {
		pDevice->WolSpeed = WOL_SPEED_100MB;
	}

	/* Offloadings. */
	pDevice->TaskToOffload = LM_TASK_OFFLOAD_NONE;

	/* Turn off task offloading on Ax. */
	if (pDevice->ChipRevId == T3_CHIP_ID_5700_B0) {
		pDevice->TaskOffloadCap &= ~(LM_TASK_OFFLOAD_TX_TCP_CHECKSUM |
					     LM_TASK_OFFLOAD_TX_UDP_CHECKSUM);
	}
	pDevice->PciState = REG_RD (pDevice, PciCfg.PciState);
	LM_ReadVPD (pDevice);
	LM_ReadBootCodeVersion (pDevice);
	LM_GetBusSpeed (pDevice);

	return LM_STATUS_SUCCESS;
}				/* LM_GetAdapterInfo */

STATIC PLM_ADAPTER_INFO LM_GetAdapterInfoBySsid (LM_UINT16 Svid, LM_UINT16 Ssid)
{
	static LM_ADAPTER_INFO AdapterArr[] = {
		{T3_SVID_BROADCOM, T3_SSID_BROADCOM_BCM95700A6,
		 PHY_BCM5401_PHY_ID, 0},
		{T3_SVID_BROADCOM, T3_SSID_BROADCOM_BCM95701A5,
		 PHY_BCM5701_PHY_ID, 0},
		{T3_SVID_BROADCOM, T3_SSID_BROADCOM_BCM95700T6,
		 PHY_BCM8002_PHY_ID, 1},
		{T3_SVID_BROADCOM, T3_SSID_BROADCOM_BCM95700A9, 0, 1},
		{T3_SVID_BROADCOM, T3_SSID_BROADCOM_BCM95701T1,
		 PHY_BCM5701_PHY_ID, 0},
		{T3_SVID_BROADCOM, T3_SSID_BROADCOM_BCM95701T8,
		 PHY_BCM5701_PHY_ID, 0},
		{T3_SVID_BROADCOM, T3_SSID_BROADCOM_BCM95701A7, 0, 1},
		{T3_SVID_BROADCOM, T3_SSID_BROADCOM_BCM95701A10,
		 PHY_BCM5701_PHY_ID, 0},
		{T3_SVID_BROADCOM, T3_SSID_BROADCOM_BCM95701A12,
		 PHY_BCM5701_PHY_ID, 0},
		{T3_SVID_BROADCOM, T3_SSID_BROADCOM_BCM95703Ax1,
		 PHY_BCM5701_PHY_ID, 0},
		{T3_SVID_BROADCOM, T3_SSID_BROADCOM_BCM95703Ax2,
		 PHY_BCM5701_PHY_ID, 0},

		{T3_SVID_3COM, T3_SSID_3COM_3C996T, PHY_BCM5401_PHY_ID, 0},
		{T3_SVID_3COM, T3_SSID_3COM_3C996BT, PHY_BCM5701_PHY_ID, 0},
		{T3_SVID_3COM, T3_SSID_3COM_3C996SX, 0, 1},
		{T3_SVID_3COM, T3_SSID_3COM_3C1000T, PHY_BCM5701_PHY_ID, 0},
		{T3_SVID_3COM, T3_SSID_3COM_3C940BR01, PHY_BCM5701_PHY_ID, 0},

		{T3_SVID_DELL, T3_SSID_DELL_VIPER, PHY_BCM5401_PHY_ID, 0},
		{T3_SVID_DELL, T3_SSID_DELL_JAGUAR, PHY_BCM5401_PHY_ID, 0},
		{T3_SVID_DELL, T3_SSID_DELL_MERLOT, PHY_BCM5411_PHY_ID, 0},
		{T3_SVID_DELL, T3_SSID_DELL_SLIM_MERLOT, PHY_BCM5411_PHY_ID, 0},

		{T3_SVID_COMPAQ, T3_SSID_COMPAQ_BANSHEE, PHY_BCM5701_PHY_ID, 0},
		{T3_SVID_COMPAQ, T3_SSID_COMPAQ_BANSHEE_2, PHY_BCM5701_PHY_ID,
		 0},
		{T3_SVID_COMPAQ, T3_SSID_COMPAQ_CHANGELING, 0, 1},
		{T3_SVID_COMPAQ, T3_SSID_COMPAQ_NC7780, PHY_BCM5701_PHY_ID, 0},
		{T3_SVID_COMPAQ, T3_SSID_COMPAQ_NC7780_2, PHY_BCM5701_PHY_ID,
		 0},

	};
	LM_UINT32 j;

	for (j = 0; j < sizeof (AdapterArr) / sizeof (LM_ADAPTER_INFO); j++) {
		if (AdapterArr[j].Svid == Svid && AdapterArr[j].Ssid == Ssid) {
			return &AdapterArr[j];
		}
	}

	return NULL;
}

/******************************************************************************/
/* Description:                                                               */
/*    This routine sets up receive/transmit buffer descriptions queues.       */
/*                                                                            */
/* Return:                                                                    */
/*    LM_STATUS_SUCCESS                                                       */
/******************************************************************************/
LM_STATUS LM_InitializeAdapter (PLM_DEVICE_BLOCK pDevice)
{
	LM_PHYSICAL_ADDRESS MemPhy;
	PLM_UINT8 pMemVirt;
	PLM_PACKET pPacket;
	LM_STATUS Status;
	LM_UINT32 Size;
	LM_UINT32 j;

	/* Set power state to D0. */
	LM_SetPowerState (pDevice, LM_POWER_STATE_D0);

	/* Intialize the queues. */
	QQ_InitQueue (&pDevice->RxPacketReceivedQ.Container,
		      MAX_RX_PACKET_DESC_COUNT);
	QQ_InitQueue (&pDevice->RxPacketFreeQ.Container,
		      MAX_RX_PACKET_DESC_COUNT);

	QQ_InitQueue (&pDevice->TxPacketFreeQ.Container,
		      MAX_TX_PACKET_DESC_COUNT);
	QQ_InitQueue (&pDevice->TxPacketActiveQ.Container,
		      MAX_TX_PACKET_DESC_COUNT);
	QQ_InitQueue (&pDevice->TxPacketXmittedQ.Container,
		      MAX_TX_PACKET_DESC_COUNT);

	/* Allocate shared memory for: status block, the buffers for receive */
	/* rings -- standard, mini, jumbo, and return rings. */
	Size = T3_STATUS_BLOCK_SIZE + sizeof (T3_STATS_BLOCK) +
	    T3_STD_RCV_RCB_ENTRY_COUNT * sizeof (T3_RCV_BD) +
#if T3_JUMBO_RCV_RCB_ENTRY_COUNT
	    T3_JUMBO_RCV_RCB_ENTRY_COUNT * sizeof (T3_RCV_BD) +
#endif				/* T3_JUMBO_RCV_RCB_ENTRY_COUNT */
	    T3_RCV_RETURN_RCB_ENTRY_COUNT * sizeof (T3_RCV_BD);

	/* Memory for host based Send BD. */
	if (pDevice->NicSendBd == FALSE) {
		Size += sizeof (T3_SND_BD) * T3_SEND_RCB_ENTRY_COUNT;
	}

	/* Allocate the memory block. */
	Status =
	    MM_AllocateSharedMemory (pDevice, Size, (PLM_VOID) & pMemVirt,
				     &MemPhy, FALSE);
	if (Status != LM_STATUS_SUCCESS) {
		return Status;
	}

	/* Program DMA Read/Write */
	if (pDevice->PciState & T3_PCI_STATE_NOT_PCI_X_BUS) {
		pDevice->DmaReadWriteCtrl = 0x763f000f;
	} else {
		if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5704) {
			pDevice->DmaReadWriteCtrl = 0x761f0000;
		} else {
			pDevice->DmaReadWriteCtrl = 0x761b000f;
		}
		if (pDevice->ChipRevId == T3_CHIP_ID_5703_A1 ||
		    pDevice->ChipRevId == T3_CHIP_ID_5703_A2) {
			pDevice->OneDmaAtOnce = TRUE;
		}
	}
	if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5703) {
		pDevice->DmaReadWriteCtrl &= 0xfffffff0;
	}

	if (pDevice->OneDmaAtOnce) {
		pDevice->DmaReadWriteCtrl |= DMA_CTRL_WRITE_ONE_DMA_AT_ONCE;
	}
	REG_WR (pDevice, PciCfg.DmaReadWriteCtrl, pDevice->DmaReadWriteCtrl);

	if (LM_DmaTest (pDevice, pMemVirt, MemPhy, 0x400) != LM_STATUS_SUCCESS) {
		return LM_STATUS_FAILURE;
	}

	/* Status block. */
	pDevice->pStatusBlkVirt = (PT3_STATUS_BLOCK) pMemVirt;
	pDevice->StatusBlkPhy = MemPhy;
	pMemVirt += T3_STATUS_BLOCK_SIZE;
	LM_INC_PHYSICAL_ADDRESS (&MemPhy, T3_STATUS_BLOCK_SIZE);

	/* Statistics block. */
	pDevice->pStatsBlkVirt = (PT3_STATS_BLOCK) pMemVirt;
	pDevice->StatsBlkPhy = MemPhy;
	pMemVirt += sizeof (T3_STATS_BLOCK);
	LM_INC_PHYSICAL_ADDRESS (&MemPhy, sizeof (T3_STATS_BLOCK));

	/* Receive standard BD buffer. */
	pDevice->pRxStdBdVirt = (PT3_RCV_BD) pMemVirt;
	pDevice->RxStdBdPhy = MemPhy;

	pMemVirt += T3_STD_RCV_RCB_ENTRY_COUNT * sizeof (T3_RCV_BD);
	LM_INC_PHYSICAL_ADDRESS (&MemPhy,
				 T3_STD_RCV_RCB_ENTRY_COUNT *
				 sizeof (T3_RCV_BD));

#if T3_JUMBO_RCV_RCB_ENTRY_COUNT
	/* Receive jumbo BD buffer. */
	pDevice->pRxJumboBdVirt = (PT3_RCV_BD) pMemVirt;
	pDevice->RxJumboBdPhy = MemPhy;

	pMemVirt += T3_JUMBO_RCV_RCB_ENTRY_COUNT * sizeof (T3_RCV_BD);
	LM_INC_PHYSICAL_ADDRESS (&MemPhy,
				 T3_JUMBO_RCV_RCB_ENTRY_COUNT *
				 sizeof (T3_RCV_BD));
#endif				/* T3_JUMBO_RCV_RCB_ENTRY_COUNT */

	/* Receive return BD buffer. */
	pDevice->pRcvRetBdVirt = (PT3_RCV_BD) pMemVirt;
	pDevice->RcvRetBdPhy = MemPhy;

	pMemVirt += T3_RCV_RETURN_RCB_ENTRY_COUNT * sizeof (T3_RCV_BD);
	LM_INC_PHYSICAL_ADDRESS (&MemPhy,
				 T3_RCV_RETURN_RCB_ENTRY_COUNT *
				 sizeof (T3_RCV_BD));

	/* Set up Send BD. */
	if (pDevice->NicSendBd == FALSE) {
		pDevice->pSendBdVirt = (PT3_SND_BD) pMemVirt;
		pDevice->SendBdPhy = MemPhy;

		pMemVirt += sizeof (T3_SND_BD) * T3_SEND_RCB_ENTRY_COUNT;
		LM_INC_PHYSICAL_ADDRESS (&MemPhy,
					 sizeof (T3_SND_BD) *
					 T3_SEND_RCB_ENTRY_COUNT);
	} else {
		pDevice->pSendBdVirt = (PT3_SND_BD)
		    pDevice->pMemView->uIntMem.First32k.BufferDesc;
		pDevice->SendBdPhy.High = 0;
		pDevice->SendBdPhy.Low = T3_NIC_SND_BUFFER_DESC_ADDR;
	}

	/* Allocate memory for packet descriptors. */
	Size = (pDevice->RxPacketDescCnt +
		pDevice->TxPacketDescCnt) * MM_PACKET_DESC_SIZE;
	Status = MM_AllocateMemory (pDevice, Size, (PLM_VOID *) & pPacket);
	if (Status != LM_STATUS_SUCCESS) {
		return Status;
	}
	pDevice->pPacketDescBase = (PLM_VOID) pPacket;

	/* Create transmit packet descriptors from the memory block and add them */
	/* to the TxPacketFreeQ for each send ring. */
	for (j = 0; j < pDevice->TxPacketDescCnt; j++) {
		/* Ring index. */
		pPacket->Flags = 0;

		/* Queue the descriptor in the TxPacketFreeQ of the 'k' ring. */
		QQ_PushTail (&pDevice->TxPacketFreeQ.Container, pPacket);

		/* Get the pointer to the next descriptor.  MM_PACKET_DESC_SIZE */
		/* is the total size of the packet descriptor including the */
		/* os-specific extensions in the UM_PACKET structure. */
		pPacket =
		    (PLM_PACKET) ((PLM_UINT8) pPacket + MM_PACKET_DESC_SIZE);
	}			/* for(j.. */

	/* Create receive packet descriptors from the memory block and add them */
	/* to the RxPacketFreeQ.  Create the Standard packet descriptors. */
	for (j = 0; j < pDevice->RxStdDescCnt; j++) {
		/* Receive producer ring. */
		pPacket->u.Rx.RcvProdRing = T3_STD_RCV_PROD_RING;

		/* Receive buffer size. */
		pPacket->u.Rx.RxBufferSize = MAX_STD_RCV_BUFFER_SIZE;

		/* Add the descriptor to RxPacketFreeQ. */
		QQ_PushTail (&pDevice->RxPacketFreeQ.Container, pPacket);

		/* Get the pointer to the next descriptor.  MM_PACKET_DESC_SIZE */
		/* is the total size of the packet descriptor including the */
		/* os-specific extensions in the UM_PACKET structure. */
		pPacket =
		    (PLM_PACKET) ((PLM_UINT8) pPacket + MM_PACKET_DESC_SIZE);
	}			/* for */

#if T3_JUMBO_RCV_RCB_ENTRY_COUNT
	/* Create the Jumbo packet descriptors. */
	for (j = 0; j < pDevice->RxJumboDescCnt; j++) {
		/* Receive producer ring. */
		pPacket->u.Rx.RcvProdRing = T3_JUMBO_RCV_PROD_RING;

		/* Receive buffer size. */
		pPacket->u.Rx.RxBufferSize = pDevice->RxJumboBufferSize;

		/* Add the descriptor to RxPacketFreeQ. */
		QQ_PushTail (&pDevice->RxPacketFreeQ.Container, pPacket);

		/* Get the pointer to the next descriptor.  MM_PACKET_DESC_SIZE */
		/* is the total size of the packet descriptor including the */
		/* os-specific extensions in the UM_PACKET structure. */
		pPacket =
		    (PLM_PACKET) ((PLM_UINT8) pPacket + MM_PACKET_DESC_SIZE);
	}			/* for */
#endif				/* T3_JUMBO_RCV_RCB_ENTRY_COUNT */

	/* Initialize the rest of the packet descriptors. */
	Status = MM_InitializeUmPackets (pDevice);
	if (Status != LM_STATUS_SUCCESS) {
		return Status;
	}

	/* if */
	/* Default receive mask. */
	pDevice->ReceiveMask = LM_ACCEPT_MULTICAST | LM_ACCEPT_BROADCAST |
	    LM_ACCEPT_UNICAST;

	/* Make sure we are in the first 32k memory window or NicSendBd. */
	REG_WR (pDevice, PciCfg.MemWindowBaseAddr, 0);

	/* Initialize the hardware. */
	Status = LM_ResetAdapter (pDevice);
	if (Status != LM_STATUS_SUCCESS) {
		return Status;
	}

	/* We are done with initialization. */
	pDevice->InitDone = TRUE;

	return LM_STATUS_SUCCESS;
}				/* LM_InitializeAdapter */

/******************************************************************************/
/* Description:                                                               */
/*    This function Enables/Disables a given block.                          */
/*                                                                            */
/* Return:                                                                    */
/*    LM_STATUS_SUCCESS                                                       */
/******************************************************************************/
LM_STATUS
LM_CntrlBlock (PLM_DEVICE_BLOCK pDevice, LM_UINT32 mask, LM_UINT32 cntrl)
{
	LM_UINT32 j, i, data;
	LM_UINT32 MaxWaitCnt;

	MaxWaitCnt = 2;
	j = 0;

	for (i = 0; i < 32; i++) {
		if (!(mask & (1 << i)))
			continue;

		switch (1 << i) {
		case T3_BLOCK_DMA_RD:
			data = REG_RD (pDevice, DmaRead.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~DMA_READ_MODE_ENABLE;
				REG_WR (pDevice, DmaRead.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, DmaRead.Mode) &
					     DMA_READ_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, DmaRead.Mode,
					data | DMA_READ_MODE_ENABLE);
			break;

		case T3_BLOCK_DMA_COMP:
			data = REG_RD (pDevice, DmaComp.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~DMA_COMP_MODE_ENABLE;
				REG_WR (pDevice, DmaComp.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, DmaComp.Mode) &
					     DMA_COMP_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, DmaComp.Mode,
					data | DMA_COMP_MODE_ENABLE);
			break;

		case T3_BLOCK_RX_BD_INITIATOR:
			data = REG_RD (pDevice, RcvBdIn.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~RCV_BD_IN_MODE_ENABLE;
				REG_WR (pDevice, RcvBdIn.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, RcvBdIn.Mode) &
					     RCV_BD_IN_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, RcvBdIn.Mode,
					data | RCV_BD_IN_MODE_ENABLE);
			break;

		case T3_BLOCK_RX_BD_COMP:
			data = REG_RD (pDevice, RcvBdComp.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~RCV_BD_COMP_MODE_ENABLE;
				REG_WR (pDevice, RcvBdComp.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, RcvBdComp.Mode) &
					     RCV_BD_COMP_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, RcvBdComp.Mode,
					data | RCV_BD_COMP_MODE_ENABLE);
			break;

		case T3_BLOCK_DMA_WR:
			data = REG_RD (pDevice, DmaWrite.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~DMA_WRITE_MODE_ENABLE;
				REG_WR (pDevice, DmaWrite.Mode, data);

				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, DmaWrite.Mode) &
					     DMA_WRITE_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, DmaWrite.Mode,
					data | DMA_WRITE_MODE_ENABLE);
			break;

		case T3_BLOCK_MSI_HANDLER:
			data = REG_RD (pDevice, Msi.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~MSI_MODE_ENABLE;
				REG_WR (pDevice, Msi.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, Msi.Mode) &
					     MSI_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, Msi.Mode,
					data | MSI_MODE_ENABLE);
			break;

		case T3_BLOCK_RX_LIST_PLMT:
			data = REG_RD (pDevice, RcvListPlmt.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~RCV_LIST_PLMT_MODE_ENABLE;
				REG_WR (pDevice, RcvListPlmt.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, RcvListPlmt.Mode)
					     & RCV_LIST_PLMT_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, RcvListPlmt.Mode,
					data | RCV_LIST_PLMT_MODE_ENABLE);
			break;

		case T3_BLOCK_RX_LIST_SELECTOR:
			data = REG_RD (pDevice, RcvListSel.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~RCV_LIST_SEL_MODE_ENABLE;
				REG_WR (pDevice, RcvListSel.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, RcvListSel.Mode) &
					     RCV_LIST_SEL_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, RcvListSel.Mode,
					data | RCV_LIST_SEL_MODE_ENABLE);
			break;

		case T3_BLOCK_RX_DATA_INITIATOR:
			data = REG_RD (pDevice, RcvDataBdIn.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~RCV_DATA_BD_IN_MODE_ENABLE;
				REG_WR (pDevice, RcvDataBdIn.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, RcvDataBdIn.Mode)
					     & RCV_DATA_BD_IN_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, RcvDataBdIn.Mode,
					data | RCV_DATA_BD_IN_MODE_ENABLE);
			break;

		case T3_BLOCK_RX_DATA_COMP:
			data = REG_RD (pDevice, RcvDataComp.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~RCV_DATA_COMP_MODE_ENABLE;
				REG_WR (pDevice, RcvDataComp.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, RcvDataBdIn.Mode)
					     & RCV_DATA_COMP_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, RcvDataComp.Mode,
					data | RCV_DATA_COMP_MODE_ENABLE);
			break;

		case T3_BLOCK_HOST_COALESING:
			data = REG_RD (pDevice, HostCoalesce.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~HOST_COALESCE_ENABLE;
				REG_WR (pDevice, HostCoalesce.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, SndBdIn.Mode) &
					     HOST_COALESCE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, HostCoalesce.Mode,
					data | HOST_COALESCE_ENABLE);
			break;

		case T3_BLOCK_MAC_RX_ENGINE:
			if (cntrl == LM_DISABLE) {
				pDevice->RxMode &= ~RX_MODE_ENABLE;
				REG_WR (pDevice, MacCtrl.RxMode,
					pDevice->RxMode);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, MacCtrl.RxMode) &
					     RX_MODE_ENABLE)) {
						break;
					}
					MM_Wait (10);
				}
			} else {
				pDevice->RxMode |= RX_MODE_ENABLE;
				REG_WR (pDevice, MacCtrl.RxMode,
					pDevice->RxMode);
			}
			break;

		case T3_BLOCK_MBUF_CLUSTER_FREE:
			data = REG_RD (pDevice, MbufClusterFree.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~MBUF_CLUSTER_FREE_MODE_ENABLE;
				REG_WR (pDevice, MbufClusterFree.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD
					     (pDevice,
					      MbufClusterFree.
					      Mode) &
					     MBUF_CLUSTER_FREE_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, MbufClusterFree.Mode,
					data | MBUF_CLUSTER_FREE_MODE_ENABLE);
			break;

		case T3_BLOCK_SEND_BD_INITIATOR:
			data = REG_RD (pDevice, SndBdIn.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~SND_BD_IN_MODE_ENABLE;
				REG_WR (pDevice, SndBdIn.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, SndBdIn.Mode) &
					     SND_BD_IN_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, SndBdIn.Mode,
					data | SND_BD_IN_MODE_ENABLE);
			break;

		case T3_BLOCK_SEND_BD_COMP:
			data = REG_RD (pDevice, SndBdComp.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~SND_BD_COMP_MODE_ENABLE;
				REG_WR (pDevice, SndBdComp.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, SndBdComp.Mode) &
					     SND_BD_COMP_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, SndBdComp.Mode,
					data | SND_BD_COMP_MODE_ENABLE);
			break;

		case T3_BLOCK_SEND_BD_SELECTOR:
			data = REG_RD (pDevice, SndBdSel.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~SND_BD_SEL_MODE_ENABLE;
				REG_WR (pDevice, SndBdSel.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, SndBdSel.Mode) &
					     SND_BD_SEL_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, SndBdSel.Mode,
					data | SND_BD_SEL_MODE_ENABLE);
			break;

		case T3_BLOCK_SEND_DATA_INITIATOR:
			data = REG_RD (pDevice, SndDataIn.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~T3_SND_DATA_IN_MODE_ENABLE;
				REG_WR (pDevice, SndDataIn.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, SndDataIn.Mode) &
					     T3_SND_DATA_IN_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, SndDataIn.Mode,
					data | T3_SND_DATA_IN_MODE_ENABLE);
			break;

		case T3_BLOCK_SEND_DATA_COMP:
			data = REG_RD (pDevice, SndDataComp.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~SND_DATA_COMP_MODE_ENABLE;
				REG_WR (pDevice, SndDataComp.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, SndDataComp.Mode)
					     & SND_DATA_COMP_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, SndDataComp.Mode,
					data | SND_DATA_COMP_MODE_ENABLE);
			break;

		case T3_BLOCK_MAC_TX_ENGINE:
			if (cntrl == LM_DISABLE) {
				pDevice->TxMode &= ~TX_MODE_ENABLE;
				REG_WR (pDevice, MacCtrl.TxMode,
					pDevice->TxMode);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, MacCtrl.TxMode) &
					     TX_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else {
				pDevice->TxMode |= TX_MODE_ENABLE;
				REG_WR (pDevice, MacCtrl.TxMode,
					pDevice->TxMode);
			}
			break;

		case T3_BLOCK_MEM_ARBITOR:
			data = REG_RD (pDevice, MemArbiter.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~T3_MEM_ARBITER_MODE_ENABLE;
				REG_WR (pDevice, MemArbiter.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, MemArbiter.Mode) &
					     T3_MEM_ARBITER_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, MemArbiter.Mode,
					data | T3_MEM_ARBITER_MODE_ENABLE);
			break;

		case T3_BLOCK_MBUF_MANAGER:
			data = REG_RD (pDevice, BufMgr.Mode);
			if (cntrl == LM_DISABLE) {
				data &= ~BUFMGR_MODE_ENABLE;
				REG_WR (pDevice, BufMgr.Mode, data);
				for (j = 0; j < MaxWaitCnt; j++) {
					if (!
					    (REG_RD (pDevice, BufMgr.Mode) &
					     BUFMGR_MODE_ENABLE))
						break;
					MM_Wait (10);
				}
			} else
				REG_WR (pDevice, BufMgr.Mode,
					data | BUFMGR_MODE_ENABLE);
			break;

		case T3_BLOCK_MAC_GLOBAL:
			if (cntrl == LM_DISABLE) {
				pDevice->MacMode &= ~(MAC_MODE_ENABLE_TDE |
						      MAC_MODE_ENABLE_RDE |
						      MAC_MODE_ENABLE_FHDE);
			} else {
				pDevice->MacMode |= (MAC_MODE_ENABLE_TDE |
						     MAC_MODE_ENABLE_RDE |
						     MAC_MODE_ENABLE_FHDE);
			}
			REG_WR (pDevice, MacCtrl.Mode, pDevice->MacMode);
			break;

		default:
			return LM_STATUS_FAILURE;
		}		/* switch */

		if (j >= MaxWaitCnt) {
			return LM_STATUS_FAILURE;
		}
	}

	return LM_STATUS_SUCCESS;
}

/******************************************************************************/
/* Description:                                                               */
/*    This function reinitializes the adapter.                                */
/*                                                                            */
/* Return:                                                                    */
/*    LM_STATUS_SUCCESS                                                       */
/******************************************************************************/
LM_STATUS LM_ResetAdapter (PLM_DEVICE_BLOCK pDevice)
{
	LM_UINT32 Value32;
	LM_UINT16 Value16;
	LM_UINT32 j, k;

	/* Disable interrupt. */
	LM_DisableInterrupt (pDevice);

	/* May get a spurious interrupt */
	pDevice->pStatusBlkVirt->Status = STATUS_BLOCK_UPDATED;

	/* Disable transmit and receive DMA engines.  Abort all pending requests. */
	if (pDevice->InitDone) {
		LM_Abort (pDevice);
	}

	pDevice->ShuttingDown = FALSE;

	LM_ResetChip (pDevice);

	/* Bug: Athlon fix for B3 silicon only.  This bit does not do anything */
	/* in other chip revisions. */
	if (pDevice->DelayPciGrant) {
		Value32 = REG_RD (pDevice, PciCfg.ClockCtrl);
		REG_WR (pDevice, PciCfg.ClockCtrl, Value32 | BIT_31);
	}

	if (pDevice->ChipRevId == T3_CHIP_ID_5704_A0) {
		if (!(pDevice->PciState & T3_PCI_STATE_CONVENTIONAL_PCI_MODE)) {
			Value32 = REG_RD (pDevice, PciCfg.PciState);
			Value32 |= T3_PCI_STATE_RETRY_SAME_DMA;
			REG_WR (pDevice, PciCfg.PciState, Value32);
		}
	}

	/* Enable TaggedStatus mode. */
	if (pDevice->UseTaggedStatus) {
		pDevice->MiscHostCtrl |=
		    MISC_HOST_CTRL_ENABLE_TAGGED_STATUS_MODE;
	}

	/* Restore PCI configuration registers. */
	MM_WriteConfig32 (pDevice, PCI_CACHE_LINE_SIZE_REG,
			  pDevice->SavedCacheLineReg);
	MM_WriteConfig32 (pDevice, PCI_SUBSYSTEM_VENDOR_ID_REG,
			  (pDevice->SubsystemId << 16) | pDevice->
			  SubsystemVendorId);

	/* Clear the statistics block. */
	for (j = 0x0300; j < 0x0b00; j++) {
		MEM_WR_OFFSET (pDevice, j, 0);
	}

	/* Initialize the statistis Block */
	pDevice->pStatusBlkVirt->Status = 0;
	pDevice->pStatusBlkVirt->RcvStdConIdx = 0;
	pDevice->pStatusBlkVirt->RcvJumboConIdx = 0;
	pDevice->pStatusBlkVirt->RcvMiniConIdx = 0;

	for (j = 0; j < 16; j++) {
		pDevice->pStatusBlkVirt->Idx[j].RcvProdIdx = 0;
		pDevice->pStatusBlkVirt->Idx[j].SendConIdx = 0;
	}

	for (k = 0; k < T3_STD_RCV_RCB_ENTRY_COUNT; k++) {
		pDevice->pRxStdBdVirt[k].HostAddr.High = 0;
		pDevice->pRxStdBdVirt[k].HostAddr.Low = 0;
	}

#if T3_JUMBO_RCV_RCB_ENTRY_COUNT
	/* Receive jumbo BD buffer. */
	for (k = 0; k < T3_JUMBO_RCV_RCB_ENTRY_COUNT; k++) {
		pDevice->pRxJumboBdVirt[k].HostAddr.High = 0;
		pDevice->pRxJumboBdVirt[k].HostAddr.Low = 0;
	}
#endif

	REG_WR (pDevice, PciCfg.DmaReadWriteCtrl, pDevice->DmaReadWriteCtrl);

	/* GRC mode control register. */
#ifdef BIG_ENDIAN_PCI		/* Jimmy, this ifdef block deleted in new code! */
	Value32 =
	    GRC_MODE_WORD_SWAP_DATA |
	    GRC_MODE_WORD_SWAP_NON_FRAME_DATA |
	    GRC_MODE_INT_ON_MAC_ATTN | GRC_MODE_HOST_STACK_UP;
#else
	/* No CPU Swap modes for PCI IO */
	Value32 =
#ifdef BIG_ENDIAN_HOST
	    GRC_MODE_BYTE_SWAP_NON_FRAME_DATA |
	    GRC_MODE_WORD_SWAP_NON_FRAME_DATA |
	    GRC_MODE_BYTE_SWAP_DATA | GRC_MODE_WORD_SWAP_DATA |
#else
	    GRC_MODE_WORD_SWAP_NON_FRAME_DATA |
	    GRC_MODE_BYTE_SWAP_DATA | GRC_MODE_WORD_SWAP_DATA |
#endif
	    GRC_MODE_INT_ON_MAC_ATTN | GRC_MODE_HOST_STACK_UP;
#endif				/* !BIG_ENDIAN_PCI */

	/* Configure send BD mode. */
	if (pDevice->NicSendBd == FALSE) {
		Value32 |= GRC_MODE_HOST_SEND_BDS;
	} else {
		Value32 |= GRC_MODE_4X_NIC_BASED_SEND_RINGS;
	}

	/* Configure pseudo checksum mode. */
	if (pDevice->NoTxPseudoHdrChksum) {
		Value32 |= GRC_MODE_TX_NO_PSEUDO_HEADER_CHKSUM;
	}

	if (pDevice->NoRxPseudoHdrChksum) {
		Value32 |= GRC_MODE_RX_NO_PSEUDO_HEADER_CHKSUM;
	}

	REG_WR (pDevice, Grc.Mode, Value32);

	/* Setup the timer prescalar register. */
	REG_WR (pDevice, Grc.MiscCfg, 65 << 1);	/* Clock is alwasy 66Mhz. */

	/* Set up the MBUF pool base address and size. */
	REG_WR (pDevice, BufMgr.MbufPoolAddr, pDevice->MbufBase);
	REG_WR (pDevice, BufMgr.MbufPoolSize, pDevice->MbufSize);

	/* Set up the DMA descriptor pool base address and size. */
	REG_WR (pDevice, BufMgr.DmaDescPoolAddr, T3_NIC_DMA_DESC_POOL_ADDR);
	REG_WR (pDevice, BufMgr.DmaDescPoolSize, T3_NIC_DMA_DESC_POOL_SIZE);

	/* Configure MBUF and Threshold watermarks */
	/* Configure the DMA read MBUF low water mark. */
	if (pDevice->DmaMbufLowMark) {
		REG_WR (pDevice, BufMgr.MbufReadDmaLowWaterMark,
			pDevice->DmaMbufLowMark);
	} else {
		if (pDevice->TxMtu < MAX_ETHERNET_PACKET_BUFFER_SIZE) {
			REG_WR (pDevice, BufMgr.MbufReadDmaLowWaterMark,
				T3_DEF_DMA_MBUF_LOW_WMARK);
		} else {
			REG_WR (pDevice, BufMgr.MbufReadDmaLowWaterMark,
				T3_DEF_DMA_MBUF_LOW_WMARK_JUMBO);
		}
	}

	/* Configure the MAC Rx MBUF low water mark. */
	if (pDevice->RxMacMbufLowMark) {
		REG_WR (pDevice, BufMgr.MbufMacRxLowWaterMark,
			pDevice->RxMacMbufLowMark);
	} else {
		if (pDevice->TxMtu < MAX_ETHERNET_PACKET_BUFFER_SIZE) {
			REG_WR (pDevice, BufMgr.MbufMacRxLowWaterMark,
				T3_DEF_RX_MAC_MBUF_LOW_WMARK);
		} else {
			REG_WR (pDevice, BufMgr.MbufMacRxLowWaterMark,
				T3_DEF_RX_MAC_MBUF_LOW_WMARK_JUMBO);
		}
	}

	/* Configure the MBUF high water mark. */
	if (pDevice->MbufHighMark) {
		REG_WR (pDevice, BufMgr.MbufHighWaterMark,
			pDevice->MbufHighMark);
	} else {
		if (pDevice->TxMtu < MAX_ETHERNET_PACKET_BUFFER_SIZE) {
			REG_WR (pDevice, BufMgr.MbufHighWaterMark,
				T3_DEF_MBUF_HIGH_WMARK);
		} else {
			REG_WR (pDevice, BufMgr.MbufHighWaterMark,
				T3_DEF_MBUF_HIGH_WMARK_JUMBO);
		}
	}

	REG_WR (pDevice, BufMgr.DmaLowWaterMark, T3_DEF_DMA_DESC_LOW_WMARK);
	REG_WR (pDevice, BufMgr.DmaHighWaterMark, T3_DEF_DMA_DESC_HIGH_WMARK);

	/* Enable buffer manager. */
	REG_WR (pDevice, BufMgr.Mode,
		BUFMGR_MODE_ENABLE | BUFMGR_MODE_ATTN_ENABLE);

	for (j = 0; j < 2000; j++) {
		if (REG_RD (pDevice, BufMgr.Mode) & BUFMGR_MODE_ENABLE)
			break;
		MM_Wait (10);
	}

	if (j >= 2000) {
		return LM_STATUS_FAILURE;
	}

	/* Enable the FTQs. */
	REG_WR (pDevice, Ftq.Reset, 0xffffffff);
	REG_WR (pDevice, Ftq.Reset, 0);

	/* Wait until FTQ is ready */
	for (j = 0; j < 2000; j++) {
		if (REG_RD (pDevice, Ftq.Reset) == 0)
			break;
		MM_Wait (10);
	}

	if (j >= 2000) {
		return LM_STATUS_FAILURE;
	}

	/* Initialize the Standard Receive RCB. */
	REG_WR (pDevice, RcvDataBdIn.StdRcvRcb.HostRingAddr.High,
		pDevice->RxStdBdPhy.High);
	REG_WR (pDevice, RcvDataBdIn.StdRcvRcb.HostRingAddr.Low,
		pDevice->RxStdBdPhy.Low);
	REG_WR (pDevice, RcvDataBdIn.StdRcvRcb.u.MaxLen_Flags,
		MAX_STD_RCV_BUFFER_SIZE << 16);

	/* Initialize the Jumbo Receive RCB. */
	REG_WR (pDevice, RcvDataBdIn.JumboRcvRcb.u.MaxLen_Flags,
		T3_RCB_FLAG_RING_DISABLED);
#if T3_JUMBO_RCV_RCB_ENTRY_COUNT
	REG_WR (pDevice, RcvDataBdIn.JumboRcvRcb.HostRingAddr.High,
		pDevice->RxJumboBdPhy.High);
	REG_WR (pDevice, RcvDataBdIn.JumboRcvRcb.HostRingAddr.Low,
		pDevice->RxJumboBdPhy.Low);

	REG_WR (pDevice, RcvDataBdIn.JumboRcvRcb.u.MaxLen_Flags, 0);

#endif				/* T3_JUMBO_RCV_RCB_ENTRY_COUNT */

	/* Initialize the Mini Receive RCB. */
	REG_WR (pDevice, RcvDataBdIn.MiniRcvRcb.u.MaxLen_Flags,
		T3_RCB_FLAG_RING_DISABLED);

	{
		REG_WR (pDevice, RcvDataBdIn.StdRcvRcb.NicRingAddr,
			(LM_UINT32) T3_NIC_STD_RCV_BUFFER_DESC_ADDR);
		REG_WR (pDevice, RcvDataBdIn.JumboRcvRcb.NicRingAddr,
			(LM_UINT32) T3_NIC_JUMBO_RCV_BUFFER_DESC_ADDR);
	}

	/* Receive BD Ring replenish threshold. */
	REG_WR (pDevice, RcvBdIn.StdRcvThreshold, pDevice->RxStdDescCnt / 8);
#if T3_JUMBO_RCV_RCB_ENTRY_COUNT
	REG_WR (pDevice, RcvBdIn.JumboRcvThreshold,
		pDevice->RxJumboDescCnt / 8);
#endif				/* T3_JUMBO_RCV_RCB_ENTRY_COUNT */

	/* Disable all the unused rings. */
	for (j = 0; j < T3_MAX_SEND_RCB_COUNT; j++) {
		MEM_WR (pDevice, SendRcb[j].u.MaxLen_Flags,
			T3_RCB_FLAG_RING_DISABLED);
	}			/* for */

	/* Initialize the indices. */
	pDevice->SendProdIdx = 0;
	pDevice->SendConIdx = 0;

	MB_REG_WR (pDevice, Mailbox.SendHostProdIdx[0].Low, 0);
	MB_REG_WR (pDevice, Mailbox.SendNicProdIdx[0].Low, 0);

	/* Set up host or NIC based send RCB. */
	if (pDevice->NicSendBd == FALSE) {
		MEM_WR (pDevice, SendRcb[0].HostRingAddr.High,
			pDevice->SendBdPhy.High);
		MEM_WR (pDevice, SendRcb[0].HostRingAddr.Low,
			pDevice->SendBdPhy.Low);

		/* Set up the NIC ring address in the RCB. */
		MEM_WR (pDevice, SendRcb[0].NicRingAddr,
			T3_NIC_SND_BUFFER_DESC_ADDR);

		/* Setup the RCB. */
		MEM_WR (pDevice, SendRcb[0].u.MaxLen_Flags,
			T3_SEND_RCB_ENTRY_COUNT << 16);

		for (k = 0; k < T3_SEND_RCB_ENTRY_COUNT; k++) {
			pDevice->pSendBdVirt[k].HostAddr.High = 0;
			pDevice->pSendBdVirt[k].HostAddr.Low = 0;
		}
	} else {
		MEM_WR (pDevice, SendRcb[0].HostRingAddr.High, 0);
		MEM_WR (pDevice, SendRcb[0].HostRingAddr.Low, 0);
		MEM_WR (pDevice, SendRcb[0].NicRingAddr,
			pDevice->SendBdPhy.Low);

		for (k = 0; k < T3_SEND_RCB_ENTRY_COUNT; k++) {
			__raw_writel (0,
				      &(pDevice->pSendBdVirt[k].HostAddr.High));
			__raw_writel (0,
				      &(pDevice->pSendBdVirt[k].HostAddr.Low));
			__raw_writel (0,
				      &(pDevice->pSendBdVirt[k].u1.Len_Flags));
			pDevice->ShadowSendBd[k].HostAddr.High = 0;
			pDevice->ShadowSendBd[k].u1.Len_Flags = 0;
		}
	}
	atomic_set (&pDevice->SendBdLeft, T3_SEND_RCB_ENTRY_COUNT - 1);

	/* Configure the receive return rings. */
	for (j = 0; j < T3_MAX_RCV_RETURN_RCB_COUNT; j++) {
		MEM_WR (pDevice, RcvRetRcb[j].u.MaxLen_Flags,
			T3_RCB_FLAG_RING_DISABLED);
	}

	pDevice->RcvRetConIdx = 0;

	MEM_WR (pDevice, RcvRetRcb[0].HostRingAddr.High,
		pDevice->RcvRetBdPhy.High);
	MEM_WR (pDevice, RcvRetRcb[0].HostRingAddr.Low,
		pDevice->RcvRetBdPhy.Low);

	/* Set up the NIC ring address in the RCB. */
	/* Not very clear from the spec.  I am guessing that for Receive */
	/* Return Ring, NicRingAddr is not used. */
	MEM_WR (pDevice, RcvRetRcb[0].NicRingAddr, 0);

	/* Setup the RCB. */
	MEM_WR (pDevice, RcvRetRcb[0].u.MaxLen_Flags,
		T3_RCV_RETURN_RCB_ENTRY_COUNT << 16);

	/* Reinitialize RX ring producer index */
	MB_REG_WR (pDevice, Mailbox.RcvStdProdIdx.Low, 0);
	MB_REG_WR (pDevice, Mailbox.RcvJumboProdIdx.Low, 0);
	MB_REG_WR (pDevice, Mailbox.RcvMiniProdIdx.Low, 0);

#if T3_JUMBO_RCV_RCB_ENTRY_COUNT
	pDevice->RxJumboProdIdx = 0;
	pDevice->RxJumboQueuedCnt = 0;
#endif

	/* Reinitialize our copy of the indices. */
	pDevice->RxStdProdIdx = 0;
	pDevice->RxStdQueuedCnt = 0;

#if T3_JUMBO_RCV_ENTRY_COUNT
	pDevice->RxJumboProdIdx = 0;
#endif				/* T3_JUMBO_RCV_ENTRY_COUNT */

	/* Configure the MAC address. */
	LM_SetMacAddress (pDevice, pDevice->NodeAddress);

	/* Initialize the transmit random backoff seed. */
	Value32 = (pDevice->NodeAddress[0] + pDevice->NodeAddress[1] +
		   pDevice->NodeAddress[2] + pDevice->NodeAddress[3] +
		   pDevice->NodeAddress[4] + pDevice->NodeAddress[5]) &
	    MAC_TX_BACKOFF_SEED_MASK;
	REG_WR (pDevice, MacCtrl.TxBackoffSeed, Value32);

	/* Receive MTU.  Frames larger than the MTU is marked as oversized. */
	REG_WR (pDevice, MacCtrl.MtuSize, pDevice->RxMtu + 8);	/* CRC + VLAN. */

	/* Configure Time slot/IPG per 802.3 */
	REG_WR (pDevice, MacCtrl.TxLengths, 0x2620);

	/*
	 * Configure Receive Rules so that packets don't match
	 * Programmble rule will be queued to Return Ring 1
	 */
	REG_WR (pDevice, MacCtrl.RcvRuleCfg, RX_RULE_DEFAULT_CLASS);

	/*
	 * Configure to have 16 Classes of Services (COS) and one
	 * queue per class.  Bad frames are queued to RRR#1.
	 * And frames don't match rules are also queued to COS#1.
	 */
	REG_WR (pDevice, RcvListPlmt.Config, 0x181);

	/* Enable Receive Placement Statistics */
	REG_WR (pDevice, RcvListPlmt.StatsEnableMask, 0xffffff);
	REG_WR (pDevice, RcvListPlmt.StatsCtrl, RCV_LIST_STATS_ENABLE);

	/* Enable Send Data Initator Statistics */
	REG_WR (pDevice, SndDataIn.StatsEnableMask, 0xffffff);
	REG_WR (pDevice, SndDataIn.StatsCtrl,
		T3_SND_DATA_IN_STATS_CTRL_ENABLE |
		T3_SND_DATA_IN_STATS_CTRL_FASTER_UPDATE);

	/* Disable the host coalescing state machine before configuring it's */
	/* parameters. */
	REG_WR (pDevice, HostCoalesce.Mode, 0);
	for (j = 0; j < 2000; j++) {
		Value32 = REG_RD (pDevice, HostCoalesce.Mode);
		if (!(Value32 & HOST_COALESCE_ENABLE)) {
			break;
		}
		MM_Wait (10);
	}

	/* Host coalescing configurations. */
	REG_WR (pDevice, HostCoalesce.RxCoalescingTicks,
		pDevice->RxCoalescingTicks);
	REG_WR (pDevice, HostCoalesce.TxCoalescingTicks,
		pDevice->TxCoalescingTicks);
	REG_WR (pDevice, HostCoalesce.RxMaxCoalescedFrames,
		pDevice->RxMaxCoalescedFrames);
	REG_WR (pDevice, HostCoalesce.TxMaxCoalescedFrames,
		pDevice->TxMaxCoalescedFrames);
	REG_WR (pDevice, HostCoalesce.RxCoalescedTickDuringInt,
		pDevice->RxCoalescingTicksDuringInt);
	REG_WR (pDevice, HostCoalesce.TxCoalescedTickDuringInt,
		pDevice->TxCoalescingTicksDuringInt);
	REG_WR (pDevice, HostCoalesce.RxMaxCoalescedFramesDuringInt,
		pDevice->RxMaxCoalescedFramesDuringInt);
	REG_WR (pDevice, HostCoalesce.TxMaxCoalescedFramesDuringInt,
		pDevice->TxMaxCoalescedFramesDuringInt);

	/* Initialize the address of the status block.  The NIC will DMA */
	/* the status block to this memory which resides on the host. */
	REG_WR (pDevice, HostCoalesce.StatusBlkHostAddr.High,
		pDevice->StatusBlkPhy.High);
	REG_WR (pDevice, HostCoalesce.StatusBlkHostAddr.Low,
		pDevice->StatusBlkPhy.Low);

	/* Initialize the address of the statistics block.  The NIC will DMA */
	/* the statistics to this block of memory. */
	REG_WR (pDevice, HostCoalesce.StatsBlkHostAddr.High,
		pDevice->StatsBlkPhy.High);
	REG_WR (pDevice, HostCoalesce.StatsBlkHostAddr.Low,
		pDevice->StatsBlkPhy.Low);

	REG_WR (pDevice, HostCoalesce.StatsCoalescingTicks,
		pDevice->StatsCoalescingTicks);

	REG_WR (pDevice, HostCoalesce.StatsBlkNicAddr, 0x300);
	REG_WR (pDevice, HostCoalesce.StatusBlkNicAddr, 0xb00);

	/* Enable Host Coalesing state machine */
	REG_WR (pDevice, HostCoalesce.Mode, HOST_COALESCE_ENABLE |
		pDevice->CoalesceMode);

	/* Enable the Receive BD Completion state machine. */
	REG_WR (pDevice, RcvBdComp.Mode, RCV_BD_COMP_MODE_ENABLE |
		RCV_BD_COMP_MODE_ATTN_ENABLE);

	/* Enable the Receive List Placement state machine. */
	REG_WR (pDevice, RcvListPlmt.Mode, RCV_LIST_PLMT_MODE_ENABLE);

	/* Enable the Receive List Selector state machine. */
	REG_WR (pDevice, RcvListSel.Mode, RCV_LIST_SEL_MODE_ENABLE |
		RCV_LIST_SEL_MODE_ATTN_ENABLE);

	/* Enable transmit DMA, clear statistics. */
	pDevice->MacMode = MAC_MODE_ENABLE_TX_STATISTICS |
	    MAC_MODE_ENABLE_RX_STATISTICS | MAC_MODE_ENABLE_TDE |
	    MAC_MODE_ENABLE_RDE | MAC_MODE_ENABLE_FHDE;
	REG_WR (pDevice, MacCtrl.Mode, pDevice->MacMode |
		MAC_MODE_CLEAR_RX_STATISTICS | MAC_MODE_CLEAR_TX_STATISTICS);

	/* GRC miscellaneous local control register. */
	pDevice->GrcLocalCtrl = GRC_MISC_LOCAL_CTRL_INT_ON_ATTN |
	    GRC_MISC_LOCAL_CTRL_AUTO_SEEPROM;

	if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700) {
		pDevice->GrcLocalCtrl |= GRC_MISC_LOCAL_CTRL_GPIO_OE1 |
		    GRC_MISC_LOCAL_CTRL_GPIO_OUTPUT1;
	}

	REG_WR (pDevice, Grc.LocalCtrl, pDevice->GrcLocalCtrl);
	MM_Wait (40);

	/* Reset RX counters. */
	for (j = 0; j < sizeof (LM_RX_COUNTERS); j++) {
		((PLM_UINT8) & pDevice->RxCounters)[j] = 0;
	}

	/* Reset TX counters. */
	for (j = 0; j < sizeof (LM_TX_COUNTERS); j++) {
		((PLM_UINT8) & pDevice->TxCounters)[j] = 0;
	}

	MB_REG_WR (pDevice, Mailbox.Interrupt[0].Low, 0);

	/* Enable the DMA Completion state machine. */
	REG_WR (pDevice, DmaComp.Mode, DMA_COMP_MODE_ENABLE);

	/* Enable the DMA Write state machine. */
	Value32 = DMA_WRITE_MODE_ENABLE |
	    DMA_WRITE_MODE_TARGET_ABORT_ATTN_ENABLE |
	    DMA_WRITE_MODE_MASTER_ABORT_ATTN_ENABLE |
	    DMA_WRITE_MODE_PARITY_ERROR_ATTN_ENABLE |
	    DMA_WRITE_MODE_ADDR_OVERFLOW_ATTN_ENABLE |
	    DMA_WRITE_MODE_FIFO_OVERRUN_ATTN_ENABLE |
	    DMA_WRITE_MODE_FIFO_UNDERRUN_ATTN_ENABLE |
	    DMA_WRITE_MODE_FIFO_OVERREAD_ATTN_ENABLE |
	    DMA_WRITE_MODE_LONG_READ_ATTN_ENABLE;
	REG_WR (pDevice, DmaWrite.Mode, Value32);

	if (!(pDevice->PciState & T3_PCI_STATE_CONVENTIONAL_PCI_MODE)) {
		if (pDevice->ChipRevId == T3_CHIP_ID_5704_A0) {
			Value16 = REG_RD (pDevice, PciCfg.PciXCommand);
			Value16 &=
			    ~(PCIX_CMD_MAX_SPLIT_MASK |
			      PCIX_CMD_MAX_BURST_MASK);
			Value16 |=
			    ((PCIX_CMD_MAX_BURST_CPIOB <<
			      PCIX_CMD_MAX_BURST_SHL) &
			     PCIX_CMD_MAX_BURST_MASK);
			if (pDevice->SplitModeEnable == SPLIT_MODE_ENABLE) {
				Value16 |=
				    (pDevice->
				     SplitModeMaxReq << PCIX_CMD_MAX_SPLIT_SHL)
				    & PCIX_CMD_MAX_SPLIT_MASK;
			}
			REG_WR (pDevice, PciCfg.PciXCommand, Value16);
		}
	}

	/* Enable the Read DMA state machine. */
	Value32 = DMA_READ_MODE_ENABLE |
	    DMA_READ_MODE_TARGET_ABORT_ATTN_ENABLE |
	    DMA_READ_MODE_MASTER_ABORT_ATTN_ENABLE |
	    DMA_READ_MODE_PARITY_ERROR_ATTN_ENABLE |
	    DMA_READ_MODE_ADDR_OVERFLOW_ATTN_ENABLE |
	    DMA_READ_MODE_FIFO_OVERRUN_ATTN_ENABLE |
	    DMA_READ_MODE_FIFO_UNDERRUN_ATTN_ENABLE |
	    DMA_READ_MODE_FIFO_OVERREAD_ATTN_ENABLE |
	    DMA_READ_MODE_LONG_READ_ATTN_ENABLE;

	if (pDevice->SplitModeEnable == SPLIT_MODE_ENABLE) {
		Value32 |= DMA_READ_MODE_SPLIT_ENABLE;
	}
	REG_WR (pDevice, DmaRead.Mode, Value32);

	/* Enable the Receive Data Completion state machine. */
	REG_WR (pDevice, RcvDataComp.Mode, RCV_DATA_COMP_MODE_ENABLE |
		RCV_DATA_COMP_MODE_ATTN_ENABLE);

	/* Enable the Mbuf Cluster Free state machine. */
	REG_WR (pDevice, MbufClusterFree.Mode, MBUF_CLUSTER_FREE_MODE_ENABLE);

	/* Enable the Send Data Completion state machine. */
	REG_WR (pDevice, SndDataComp.Mode, SND_DATA_COMP_MODE_ENABLE);

	/* Enable the Send BD Completion state machine. */
	REG_WR (pDevice, SndBdComp.Mode, SND_BD_COMP_MODE_ENABLE |
		SND_BD_COMP_MODE_ATTN_ENABLE);

	/* Enable the Receive BD Initiator state machine. */
	REG_WR (pDevice, RcvBdIn.Mode, RCV_BD_IN_MODE_ENABLE |
		RCV_BD_IN_MODE_BD_IN_DIABLED_RCB_ATTN_ENABLE);

	/* Enable the Receive Data and Receive BD Initiator state machine. */
	REG_WR (pDevice, RcvDataBdIn.Mode, RCV_DATA_BD_IN_MODE_ENABLE |
		RCV_DATA_BD_IN_MODE_INVALID_RING_SIZE);

	/* Enable the Send Data Initiator state machine. */
	REG_WR (pDevice, SndDataIn.Mode, T3_SND_DATA_IN_MODE_ENABLE);

	/* Enable the Send BD Initiator state machine. */
	REG_WR (pDevice, SndBdIn.Mode, SND_BD_IN_MODE_ENABLE |
		SND_BD_IN_MODE_ATTN_ENABLE);

	/* Enable the Send BD Selector state machine. */
	REG_WR (pDevice, SndBdSel.Mode, SND_BD_SEL_MODE_ENABLE |
		SND_BD_SEL_MODE_ATTN_ENABLE);

#if INCLUDE_5701_AX_FIX
	/* Load the firmware for the 5701_A0 workaround. */
	if (pDevice->ChipRevId == T3_CHIP_ID_5701_A0) {
		LM_LoadRlsFirmware (pDevice);
	}
#endif

	/* Enable the transmitter. */
	pDevice->TxMode = TX_MODE_ENABLE;
	REG_WR (pDevice, MacCtrl.TxMode, pDevice->TxMode);

	/* Enable the receiver. */
	pDevice->RxMode = RX_MODE_ENABLE;
	REG_WR (pDevice, MacCtrl.RxMode, pDevice->RxMode);

	if (pDevice->RestoreOnWakeUp) {
		pDevice->RestoreOnWakeUp = FALSE;
		pDevice->DisableAutoNeg = pDevice->WakeUpDisableAutoNeg;
		pDevice->RequestedMediaType = pDevice->WakeUpRequestedMediaType;
	}

	/* Disable auto polling. */
	pDevice->MiMode = 0xc0000;
	REG_WR (pDevice, MacCtrl.MiMode, pDevice->MiMode);

	if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700 ||
	    T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5701) {
		Value32 = LED_CTRL_PHY_MODE_1;
	} else {
		if (pDevice->LedMode == LED_MODE_OUTPUT) {
			Value32 = LED_CTRL_PHY_MODE_2;
		} else {
			Value32 = LED_CTRL_PHY_MODE_1;
		}
	}
	REG_WR (pDevice, MacCtrl.LedCtrl, Value32);

	/* Activate Link to enable MAC state machine */
	REG_WR (pDevice, MacCtrl.MiStatus, MI_STATUS_ENABLE_LINK_STATUS_ATTN);

	if (pDevice->EnableTbi) {
		REG_WR (pDevice, MacCtrl.RxMode, RX_MODE_RESET);
		MM_Wait (10);
		REG_WR (pDevice, MacCtrl.RxMode, pDevice->RxMode);
		if (pDevice->ChipRevId == T3_CHIP_ID_5703_A1) {
			REG_WR (pDevice, MacCtrl.SerdesCfg, 0x616000);
		}
	}
	/* Setup the phy chip. */
	LM_SetupPhy (pDevice);

	if (!pDevice->EnableTbi) {
		/* Clear CRC stats */
		LM_ReadPhy (pDevice, 0x1e, &Value32);
		LM_WritePhy (pDevice, 0x1e, Value32 | 0x8000);
		LM_ReadPhy (pDevice, 0x14, &Value32);
	}

	/* Set up the receive mask. */
	LM_SetReceiveMask (pDevice, pDevice->ReceiveMask);

	/* Queue Rx packet buffers. */
	if (pDevice->QueueRxPackets) {
		LM_QueueRxPackets (pDevice);
	}

	/* Enable interrupt to the host. */
	if (pDevice->InitDone) {
		LM_EnableInterrupt (pDevice);
	}

	return LM_STATUS_SUCCESS;
}				/* LM_ResetAdapter */

/******************************************************************************/
/* Description:                                                               */
/*    This routine disables the adapter from generating interrupts.           */
/*                                                                            */
/* Return:                                                                    */
/*    LM_STATUS_SUCCESS                                                       */
/******************************************************************************/
LM_STATUS LM_DisableInterrupt (PLM_DEVICE_BLOCK pDevice)
{
	REG_WR (pDevice, PciCfg.MiscHostCtrl, pDevice->MiscHostCtrl |
		MISC_HOST_CTRL_MASK_PCI_INT);
	MB_REG_WR (pDevice, Mailbox.Interrupt[0].Low, 1);

	return LM_STATUS_SUCCESS;
}

/******************************************************************************/
/* Description:                                                               */
/*    This routine enables the adapter to generate interrupts.                */
/*                                                                            */
/* Return:                                                                    */
/*    LM_STATUS_SUCCESS                                                       */
/******************************************************************************/
LM_STATUS LM_EnableInterrupt (PLM_DEVICE_BLOCK pDevice)
{
	REG_WR (pDevice, PciCfg.MiscHostCtrl, pDevice->MiscHostCtrl &
		~MISC_HOST_CTRL_MASK_PCI_INT);
	MB_REG_WR (pDevice, Mailbox.Interrupt[0].Low, 0);

	if (pDevice->pStatusBlkVirt->Status & STATUS_BLOCK_UPDATED) {
		REG_WR (pDevice, Grc.LocalCtrl, pDevice->GrcLocalCtrl |
			GRC_MISC_LOCAL_CTRL_SET_INT);
	}

	return LM_STATUS_SUCCESS;
}

/******************************************************************************/
/* Description:                                                               */
/*    This routine puts a packet on the wire if there is a transmit DMA       */
/*    descriptor available; otherwise the packet is queued for later          */
/*    transmission.  If the second argue is NULL, this routine will put       */
/*    the queued packet on the wire if possible.                              */
/*                                                                            */
/* Return:                                                                    */
/*    LM_STATUS_SUCCESS                                                       */
/******************************************************************************/
#if 0
LM_STATUS LM_SendPacket (PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket)
{
	LM_UINT32 FragCount;
	PT3_SND_BD pSendBd;
	PT3_SND_BD pShadowSendBd;
	LM_UINT32 Value32, Len;
	LM_UINT32 Idx;

	if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700) {
		return LM_5700SendPacket (pDevice, pPacket);
	}

	/* Update the SendBdLeft count. */
	atomic_sub (pPacket->u.Tx.FragCount, &pDevice->SendBdLeft);

	/* Initalize the send buffer descriptors. */
	Idx = pDevice->SendProdIdx;

	pSendBd = &pDevice->pSendBdVirt[Idx];

	/* Next producer index. */
	if (pDevice->NicSendBd == TRUE) {
		T3_64BIT_HOST_ADDR paddr;

		pShadowSendBd = &pDevice->ShadowSendBd[Idx];
		for (FragCount = 0;;) {
			MM_MapTxDma (pDevice, pPacket, &paddr, &Len, FragCount);
			/* Initialize the pointer to the send buffer fragment. */
			if (paddr.High != pShadowSendBd->HostAddr.High) {
				__raw_writel (paddr.High,
					      &(pSendBd->HostAddr.High));
				pShadowSendBd->HostAddr.High = paddr.High;
			}
			__raw_writel (paddr.Low, &(pSendBd->HostAddr.Low));

			/* Setup the control flags and send buffer size. */
			Value32 = (Len << 16) | pPacket->Flags;

			Idx = (Idx + 1) & T3_SEND_RCB_ENTRY_COUNT_MASK;

			FragCount++;
			if (FragCount >= pPacket->u.Tx.FragCount) {
				Value32 |= SND_BD_FLAG_END;
				if (Value32 != pShadowSendBd->u1.Len_Flags) {
					__raw_writel (Value32,
						      &(pSendBd->u1.Len_Flags));
					pShadowSendBd->u1.Len_Flags = Value32;
				}
				if (pPacket->Flags & SND_BD_FLAG_VLAN_TAG) {
					__raw_writel (pPacket->VlanTag,
						      &(pSendBd->u2.VlanTag));
				}
				break;
			} else {
				if (Value32 != pShadowSendBd->u1.Len_Flags) {
					__raw_writel (Value32,
						      &(pSendBd->u1.Len_Flags));
					pShadowSendBd->u1.Len_Flags = Value32;
				}
				if (pPacket->Flags & SND_BD_FLAG_VLAN_TAG) {
					__raw_writel (pPacket->VlanTag,
						      &(pSendBd->u2.VlanTag));
				}
			}

			pSendBd++;
			pShadowSendBd++;
			if (Idx == 0) {
				pSendBd = &pDevice->pSendBdVirt[0];
				pShadowSendBd = &pDevice->ShadowSendBd[0];
			}
		}		/* for */

		/* Put the packet descriptor in the ActiveQ. */
		QQ_PushTail (&pDevice->TxPacketActiveQ.Container, pPacket);

		wmb ();
		MB_REG_WR (pDevice, Mailbox.SendNicProdIdx[0].Low, Idx);

	} else {
		for (FragCount = 0;;) {
			/* Initialize the pointer to the send buffer fragment. */
			MM_MapTxDma (pDevice, pPacket, &pSendBd->HostAddr, &Len,
				     FragCount);

			pSendBd->u2.VlanTag = pPacket->VlanTag;

			/* Setup the control flags and send buffer size. */
			Value32 = (Len << 16) | pPacket->Flags;

			Idx = (Idx + 1) & T3_SEND_RCB_ENTRY_COUNT_MASK;

			FragCount++;
			if (FragCount >= pPacket->u.Tx.FragCount) {
				pSendBd->u1.Len_Flags =
				    Value32 | SND_BD_FLAG_END;
				break;
			} else {
				pSendBd->u1.Len_Flags = Value32;
			}
			pSendBd++;
			if (Idx == 0) {
				pSendBd = &pDevice->pSendBdVirt[0];
			}
		}		/* for */

		/* Put the packet descriptor in the ActiveQ. */
		QQ_PushTail (&pDevice->TxPacketActiveQ.Container, pPacket);

		wmb ();
		MB_REG_WR (pDevice, Mailbox.SendHostProdIdx[0].Low, Idx);

	}

	/* Update the producer index. */
	pDevice->SendProdIdx = Idx;

	return LM_STATUS_SUCCESS;
}
#endif

LM_STATUS LM_SendPacket (PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket)
{
	LM_UINT32 FragCount;
	PT3_SND_BD pSendBd, pTmpSendBd, pShadowSendBd;
	T3_SND_BD NicSendBdArr[MAX_FRAGMENT_COUNT];
	LM_UINT32 StartIdx, Idx;

	while (1) {
		/* Initalize the send buffer descriptors. */
		StartIdx = Idx = pDevice->SendProdIdx;

		if (pDevice->NicSendBd) {
			pTmpSendBd = pSendBd = &NicSendBdArr[0];
		} else {
			pTmpSendBd = pSendBd = &pDevice->pSendBdVirt[Idx];
		}

		/* Next producer index. */
		for (FragCount = 0;;) {
			LM_UINT32 Value32, Len;

			/* Initialize the pointer to the send buffer fragment. */
			MM_MapTxDma (pDevice, pPacket, &pSendBd->HostAddr, &Len,
				     FragCount);

			pSendBd->u2.VlanTag = pPacket->VlanTag;

			/* Setup the control flags and send buffer size. */
			Value32 = (Len << 16) | pPacket->Flags;

			Idx = (Idx + 1) & T3_SEND_RCB_ENTRY_COUNT_MASK;

			FragCount++;
			if (FragCount >= pPacket->u.Tx.FragCount) {
				pSendBd->u1.Len_Flags =
				    Value32 | SND_BD_FLAG_END;
				break;
			} else {
				pSendBd->u1.Len_Flags = Value32;
			}
			pSendBd++;
			if ((Idx == 0) && !pDevice->NicSendBd) {
				pSendBd = &pDevice->pSendBdVirt[0];
			}
		}		/* for */
		if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700) {
			if (LM_Test4GBoundary (pDevice, pPacket, pTmpSendBd) ==
			    LM_STATUS_SUCCESS) {
				if (MM_CoalesceTxBuffer (pDevice, pPacket) !=
				    LM_STATUS_SUCCESS) {
					QQ_PushHead (&pDevice->TxPacketFreeQ.
						     Container, pPacket);
					return LM_STATUS_FAILURE;
				}
				continue;
			}
		}
		break;
	}
	/* Put the packet descriptor in the ActiveQ. */
	QQ_PushTail (&pDevice->TxPacketActiveQ.Container, pPacket);

	if (pDevice->NicSendBd) {
		pSendBd = &pDevice->pSendBdVirt[StartIdx];
		pShadowSendBd = &pDevice->ShadowSendBd[StartIdx];

		while (StartIdx != Idx) {
			LM_UINT32 Value32;

			if ((Value32 = pTmpSendBd->HostAddr.High) !=
			    pShadowSendBd->HostAddr.High) {
				__raw_writel (Value32,
					      &(pSendBd->HostAddr.High));
				pShadowSendBd->HostAddr.High = Value32;
			}

			__raw_writel (pTmpSendBd->HostAddr.Low,
				      &(pSendBd->HostAddr.Low));

			if ((Value32 = pTmpSendBd->u1.Len_Flags) !=
			    pShadowSendBd->u1.Len_Flags) {
				__raw_writel (Value32,
					      &(pSendBd->u1.Len_Flags));
				pShadowSendBd->u1.Len_Flags = Value32;
			}

			if (pPacket->Flags & SND_BD_FLAG_VLAN_TAG) {
				__raw_writel (pTmpSendBd->u2.VlanTag,
					      &(pSendBd->u2.VlanTag));
			}

			StartIdx =
			    (StartIdx + 1) & T3_SEND_RCB_ENTRY_COUNT_MASK;
			if (StartIdx == 0)
				pSendBd = &pDevice->pSendBdVirt[0];
			else
				pSendBd++;
			pTmpSendBd++;
		}
		wmb ();
		MB_REG_WR (pDevice, Mailbox.SendNicProdIdx[0].Low, Idx);

		if (T3_CHIP_REV (pDevice->ChipRevId) == T3_CHIP_REV_5700_BX) {
			MB_REG_WR (pDevice, Mailbox.SendNicProdIdx[0].Low, Idx);
		}
	} else {
		wmb ();
		MB_REG_WR (pDevice, Mailbox.SendHostProdIdx[0].Low, Idx);

		if (T3_CHIP_REV (pDevice->ChipRevId) == T3_CHIP_REV_5700_BX) {
			MB_REG_WR (pDevice, Mailbox.SendHostProdIdx[0].Low,
				   Idx);
		}
	}

	/* Update the SendBdLeft count. */
	atomic_sub (pPacket->u.Tx.FragCount, &pDevice->SendBdLeft);

	/* Update the producer index. */
	pDevice->SendProdIdx = Idx;

	return LM_STATUS_SUCCESS;
}

STATIC LM_STATUS
LM_Test4GBoundary (PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket,
		   PT3_SND_BD pSendBd)
{
	int FragCount;
	LM_UINT32 Idx, Base, Len;

	Idx = pDevice->SendProdIdx;
	for (FragCount = 0;;) {
		Len = pSendBd->u1.Len_Flags >> 16;
		if (((Base = pSendBd->HostAddr.Low) > 0xffffdcc0) &&
		    (pSendBd->HostAddr.High == 0) &&
		    ((Base + 8 + Len) < Base)) {
			return LM_STATUS_SUCCESS;
		}
		FragCount++;
		if (FragCount >= pPacket->u.Tx.FragCount) {
			break;
		}
		pSendBd++;
		if (!pDevice->NicSendBd) {
			Idx = (Idx + 1) & T3_SEND_RCB_ENTRY_COUNT_MASK;
			if (Idx == 0) {
				pSendBd = &pDevice->pSendBdVirt[0];
			}
		}
	}
	return LM_STATUS_FAILURE;
}

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
__inline static unsigned long
ComputeCrc32 (unsigned char *pBuffer, unsigned long BufferSize)
{
	unsigned long Reg;
	unsigned long Tmp;
	unsigned long j, k;

	Reg = 0xffffffff;

	for (j = 0; j < BufferSize; j++) {
		Reg ^= pBuffer[j];

		for (k = 0; k < 8; k++) {
			Tmp = Reg & 0x01;

			Reg >>= 1;

			if (Tmp) {
				Reg ^= 0xedb88320;
			}
		}
	}

	return ~Reg;
}				/* ComputeCrc32 */

/******************************************************************************/
/* Description:                                                               */
/*    This routine sets the receive control register according to ReceiveMask */
/*                                                                            */
/* Return:                                                                    */
/*    LM_STATUS_SUCCESS                                                       */
/******************************************************************************/
LM_STATUS LM_SetReceiveMask (PLM_DEVICE_BLOCK pDevice, LM_UINT32 Mask)
{
	LM_UINT32 ReceiveMask;
	LM_UINT32 RxMode;
	LM_UINT32 j, k;

	ReceiveMask = Mask;

	RxMode = pDevice->RxMode;

	if (Mask & LM_ACCEPT_UNICAST) {
		Mask &= ~LM_ACCEPT_UNICAST;
	}

	if (Mask & LM_ACCEPT_MULTICAST) {
		Mask &= ~LM_ACCEPT_MULTICAST;
	}

	if (Mask & LM_ACCEPT_ALL_MULTICAST) {
		Mask &= ~LM_ACCEPT_ALL_MULTICAST;
	}

	if (Mask & LM_ACCEPT_BROADCAST) {
		Mask &= ~LM_ACCEPT_BROADCAST;
	}

	RxMode &= ~RX_MODE_PROMISCUOUS_MODE;
	if (Mask & LM_PROMISCUOUS_MODE) {
		RxMode |= RX_MODE_PROMISCUOUS_MODE;
		Mask &= ~LM_PROMISCUOUS_MODE;
	}

	RxMode &= ~(RX_MODE_ACCEPT_RUNTS | RX_MODE_ACCEPT_OVERSIZED);
	if (Mask & LM_ACCEPT_ERROR_PACKET) {
		RxMode |= RX_MODE_ACCEPT_RUNTS | RX_MODE_ACCEPT_OVERSIZED;
		Mask &= ~LM_ACCEPT_ERROR_PACKET;
	}

	/* Make sure all the bits are valid before committing changes. */
	if (Mask) {
		return LM_STATUS_FAILURE;
	}

	/* Commit the new filter. */
	pDevice->RxMode = RxMode;
	REG_WR (pDevice, MacCtrl.RxMode, RxMode);

	pDevice->ReceiveMask = ReceiveMask;

	/* Set up the MC hash table. */
	if (ReceiveMask & LM_ACCEPT_ALL_MULTICAST) {
		for (k = 0; k < 4; k++) {
			REG_WR (pDevice, MacCtrl.HashReg[k], 0xffffffff);
		}
	} else if (ReceiveMask & LM_ACCEPT_MULTICAST) {
		LM_UINT32 HashReg[4];

		HashReg[0] = 0;
		HashReg[1] = 0;
		HashReg[2] = 0;
		HashReg[3] = 0;
		for (j = 0; j < pDevice->McEntryCount; j++) {
			LM_UINT32 RegIndex;
			LM_UINT32 Bitpos;
			LM_UINT32 Crc32;

			Crc32 =
			    ComputeCrc32 (pDevice->McTable[j],
					  ETHERNET_ADDRESS_SIZE);

			/* The most significant 7 bits of the CRC32 (no inversion), */
			/* are used to index into one of the possible 128 bit positions. */
			Bitpos = ~Crc32 & 0x7f;

			/* Hash register index. */
			RegIndex = (Bitpos & 0x60) >> 5;

			/* Bit to turn on within a hash register. */
			Bitpos &= 0x1f;

			/* Enable the multicast bit. */
			HashReg[RegIndex] |= (1 << Bitpos);
		}

		/* REV_AX has problem with multicast filtering where it uses both */
		/* DA and SA to perform hashing. */
		for (k = 0; k < 4; k++) {
			REG_WR (pDevice, MacCtrl.HashReg[k], HashReg[k]);
		}
	} else {
		/* Reject all multicast frames. */
		for (j = 0; j < 4; j++) {
			REG_WR (pDevice, MacCtrl.HashReg[j], 0);
		}
	}

	/* By default, Tigon3 will accept broadcast frames.  We need to setup */
	if (ReceiveMask & LM_ACCEPT_BROADCAST) {
		REG_WR (pDevice,
			MacCtrl.RcvRules[RCV_RULE1_REJECT_BROADCAST_IDX].Rule,
			REJECT_BROADCAST_RULE1_RULE & RCV_DISABLE_RULE_MASK);
		REG_WR (pDevice,
			MacCtrl.RcvRules[RCV_RULE1_REJECT_BROADCAST_IDX].Value,
			REJECT_BROADCAST_RULE1_VALUE & RCV_DISABLE_RULE_MASK);
		REG_WR (pDevice,
			MacCtrl.RcvRules[RCV_RULE2_REJECT_BROADCAST_IDX].Rule,
			REJECT_BROADCAST_RULE1_RULE & RCV_DISABLE_RULE_MASK);
		REG_WR (pDevice,
			MacCtrl.RcvRules[RCV_RULE2_REJECT_BROADCAST_IDX].Value,
			REJECT_BROADCAST_RULE1_VALUE & RCV_DISABLE_RULE_MASK);
	} else {
		REG_WR (pDevice,
			MacCtrl.RcvRules[RCV_RULE1_REJECT_BROADCAST_IDX].Rule,
			REJECT_BROADCAST_RULE1_RULE);
		REG_WR (pDevice,
			MacCtrl.RcvRules[RCV_RULE1_REJECT_BROADCAST_IDX].Value,
			REJECT_BROADCAST_RULE1_VALUE);
		REG_WR (pDevice,
			MacCtrl.RcvRules[RCV_RULE2_REJECT_BROADCAST_IDX].Rule,
			REJECT_BROADCAST_RULE2_RULE);
		REG_WR (pDevice,
			MacCtrl.RcvRules[RCV_RULE2_REJECT_BROADCAST_IDX].Value,
			REJECT_BROADCAST_RULE2_VALUE);
	}

	/* disable the rest of the rules. */
	for (j = RCV_LAST_RULE_IDX; j < 16; j++) {
		REG_WR (pDevice, MacCtrl.RcvRules[j].Rule, 0);
		REG_WR (pDevice, MacCtrl.RcvRules[j].Value, 0);
	}

	return LM_STATUS_SUCCESS;
}				/* LM_SetReceiveMask */

/******************************************************************************/
/* Description:                                                               */
/*    Disable the interrupt and put the transmitter and receiver engines in   */
/*    an idle state.  Also aborts all pending send requests and receive       */
/*    buffers.                                                                */
/*                                                                            */
/* Return:                                                                    */
/*    LM_STATUS_SUCCESS                                                       */
/******************************************************************************/
LM_STATUS LM_Abort (PLM_DEVICE_BLOCK pDevice)
{
	PLM_PACKET pPacket;
	LM_UINT Idx;

	LM_DisableInterrupt (pDevice);

	/* Disable all the state machines. */
	LM_CntrlBlock (pDevice, T3_BLOCK_MAC_RX_ENGINE, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_RX_BD_INITIATOR, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_RX_LIST_PLMT, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_RX_LIST_SELECTOR, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_RX_DATA_INITIATOR, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_RX_DATA_COMP, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_RX_BD_COMP, LM_DISABLE);

	LM_CntrlBlock (pDevice, T3_BLOCK_SEND_BD_SELECTOR, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_SEND_BD_INITIATOR, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_SEND_DATA_INITIATOR, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_DMA_RD, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_SEND_DATA_COMP, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_DMA_COMP, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_SEND_BD_COMP, LM_DISABLE);

	/* Clear TDE bit */
	pDevice->MacMode &= ~MAC_MODE_ENABLE_TDE;
	REG_WR (pDevice, MacCtrl.Mode, pDevice->MacMode);

	LM_CntrlBlock (pDevice, T3_BLOCK_MAC_TX_ENGINE, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_HOST_COALESING, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_DMA_WR, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_MBUF_CLUSTER_FREE, LM_DISABLE);

	/* Reset all FTQs */
	REG_WR (pDevice, Ftq.Reset, 0xffffffff);
	REG_WR (pDevice, Ftq.Reset, 0x0);

	LM_CntrlBlock (pDevice, T3_BLOCK_MBUF_MANAGER, LM_DISABLE);
	LM_CntrlBlock (pDevice, T3_BLOCK_MEM_ARBITOR, LM_DISABLE);

	MM_ACQUIRE_INT_LOCK (pDevice);

	/* Abort packets that have already queued to go out. */
	pPacket = (PLM_PACKET) QQ_PopHead (&pDevice->TxPacketActiveQ.Container);
	while (pPacket) {

		pPacket->PacketStatus = LM_STATUS_TRANSMIT_ABORTED;
		pDevice->TxCounters.TxPacketAbortedCnt++;

		atomic_add (pPacket->u.Tx.FragCount, &pDevice->SendBdLeft);

		QQ_PushTail (&pDevice->TxPacketXmittedQ.Container, pPacket);

		pPacket = (PLM_PACKET)
		    QQ_PopHead (&pDevice->TxPacketActiveQ.Container);
	}

	/* Cleanup the receive return rings. */
	LM_ServiceRxInterrupt (pDevice);

	/* Don't want to indicate rx packets in Ndis miniport shutdown context. */
	/* Doing so may cause system crash. */
	if (!pDevice->ShuttingDown) {
		/* Indicate packets to the protocol. */
		MM_IndicateTxPackets (pDevice);

		/* Indicate received packets to the protocols. */
		MM_IndicateRxPackets (pDevice);
	} else {
		/* Move the receive packet descriptors in the ReceivedQ to the */
		/* free queue. */
		for (;;) {
			pPacket =
			    (PLM_PACKET) QQ_PopHead (&pDevice->
						     RxPacketReceivedQ.
						     Container);
			if (pPacket == NULL) {
				break;
			}
			QQ_PushTail (&pDevice->RxPacketFreeQ.Container,
				     pPacket);
		}
	}

	/* Clean up the Std Receive Producer ring. */
	Idx = pDevice->pStatusBlkVirt->RcvStdConIdx;

	while (Idx != pDevice->RxStdProdIdx) {
		pPacket = (PLM_PACKET) (MM_UINT_PTR (pDevice->pPacketDescBase) +
					MM_UINT_PTR (pDevice->pRxStdBdVirt[Idx].
						     Opaque));

		QQ_PushTail (&pDevice->RxPacketFreeQ.Container, pPacket);

		Idx = (Idx + 1) & T3_STD_RCV_RCB_ENTRY_COUNT_MASK;
	}			/* while */

	/* Reinitialize our copy of the indices. */
	pDevice->RxStdProdIdx = 0;

#if T3_JUMBO_RCV_RCB_ENTRY_COUNT
	/* Clean up the Jumbo Receive Producer ring. */
	Idx = pDevice->pStatusBlkVirt->RcvJumboConIdx;

	while (Idx != pDevice->RxJumboProdIdx) {
		pPacket = (PLM_PACKET) (MM_UINT_PTR (pDevice->pPacketDescBase) +
					MM_UINT_PTR (pDevice->
						     pRxJumboBdVirt[Idx].
						     Opaque));

		QQ_PushTail (&pDevice->RxPacketFreeQ.Container, pPacket);

		Idx = (Idx + 1) & T3_JUMBO_RCV_RCB_ENTRY_COUNT_MASK;
	}			/* while */

	/* Reinitialize our copy of the indices. */
	pDevice->RxJumboProdIdx = 0;
#endif				/* T3_JUMBO_RCV_RCB_ENTRY_COUNT */

	MM_RELEASE_INT_LOCK (pDevice);

	/* Initialize the statistis Block */
	pDevice->pStatusBlkVirt->Status = 0;
	pDevice->pStatusBlkVirt->RcvStdConIdx = 0;
	pDevice->pStatusBlkVirt->RcvJumboConIdx = 0;
	pDevice->pStatusBlkVirt->RcvMiniConIdx = 0;

	return LM_STATUS_SUCCESS;
}				/* LM_Abort */

/******************************************************************************/
/* Description:                                                               */
/*    Disable the interrupt and put the transmitter and receiver engines in   */
/*    an idle state.  Aborts all pending send requests and receive buffers.   */
/*    Also free all the receive buffers.                                      */
/*                                                                            */
/* Return:                                                                    */
/*    LM_STATUS_SUCCESS                                                       */
/******************************************************************************/
LM_STATUS LM_Halt (PLM_DEVICE_BLOCK pDevice)
{
	PLM_PACKET pPacket;
	LM_UINT32 EntryCnt;

	LM_Abort (pDevice);

	/* Get the number of entries in the queue. */
	EntryCnt = QQ_GetEntryCnt (&pDevice->RxPacketFreeQ.Container);

	/* Make sure all the packets have been accounted for. */
	for (EntryCnt = 0; EntryCnt < pDevice->RxPacketDescCnt; EntryCnt++) {
		pPacket =
		    (PLM_PACKET) QQ_PopHead (&pDevice->RxPacketFreeQ.Container);
		if (pPacket == 0)
			break;

		MM_FreeRxBuffer (pDevice, pPacket);

		QQ_PushTail (&pDevice->RxPacketFreeQ.Container, pPacket);
	}

	LM_ResetChip (pDevice);

	/* Restore PCI configuration registers. */
	MM_WriteConfig32 (pDevice, PCI_CACHE_LINE_SIZE_REG,
			  pDevice->SavedCacheLineReg);
	LM_RegWrInd (pDevice, PCI_SUBSYSTEM_VENDOR_ID_REG,
		     (pDevice->SubsystemId << 16) | pDevice->SubsystemVendorId);

	/* Reprogram the MAC address. */
	LM_SetMacAddress (pDevice, pDevice->NodeAddress);

	return LM_STATUS_SUCCESS;
}				/* LM_Halt */

STATIC LM_STATUS LM_ResetChip (PLM_DEVICE_BLOCK pDevice)
{
	LM_UINT32 Value32;
	LM_UINT32 j;

	/* Wait for access to the nvram interface before resetting.  This is */
	/* a workaround to prevent EEPROM corruption. */
	if (T3_ASIC_REV (pDevice->ChipRevId) != T3_ASIC_REV_5700 &&
	    T3_ASIC_REV (pDevice->ChipRevId) != T3_ASIC_REV_5701) {
		/* Request access to the flash interface. */
		REG_WR (pDevice, Nvram.SwArb, SW_ARB_REQ_SET1);

		for (j = 0; j < 100000; j++) {
			Value32 = REG_RD (pDevice, Nvram.SwArb);
			if (Value32 & SW_ARB_GNT1) {
				break;
			}
			MM_Wait (10);
		}
	}

	/* Global reset. */
	REG_WR (pDevice, Grc.MiscCfg, GRC_MISC_CFG_CORE_CLOCK_RESET);
	MM_Wait (40);
	MM_Wait (40);
	MM_Wait (40);

	/* make sure we re-enable indirect accesses */
	MM_WriteConfig32 (pDevice, T3_PCI_MISC_HOST_CTRL_REG,
			  pDevice->MiscHostCtrl);

	/* Set MAX PCI retry to zero. */
	Value32 =
	    T3_PCI_STATE_PCI_ROM_ENABLE | T3_PCI_STATE_PCI_ROM_RETRY_ENABLE;
	if (pDevice->ChipRevId == T3_CHIP_ID_5704_A0) {
		if (!(pDevice->PciState & T3_PCI_STATE_CONVENTIONAL_PCI_MODE)) {
			Value32 |= T3_PCI_STATE_RETRY_SAME_DMA;
		}
	}
	MM_WriteConfig32 (pDevice, T3_PCI_STATE_REG, Value32);

	/* Restore PCI command register. */
	MM_WriteConfig32 (pDevice, PCI_COMMAND_REG,
			  pDevice->PciCommandStatusWords);

	/* Disable PCI-X relaxed ordering bit. */
	MM_ReadConfig32 (pDevice, PCIX_CAP_REG, &Value32);
	Value32 &= ~PCIX_ENABLE_RELAXED_ORDERING;
	MM_WriteConfig32 (pDevice, PCIX_CAP_REG, Value32);

	/* Enable memory arbiter. */
	REG_WR (pDevice, MemArbiter.Mode, T3_MEM_ARBITER_MODE_ENABLE);

#ifdef BIG_ENDIAN_PCI		/* This from jfd */
	Value32 = GRC_MODE_WORD_SWAP_DATA | GRC_MODE_WORD_SWAP_NON_FRAME_DATA;
#else
#ifdef BIG_ENDIAN_HOST
	/* Reconfigure the mode register. */
	Value32 = GRC_MODE_BYTE_SWAP_NON_FRAME_DATA |
	    GRC_MODE_WORD_SWAP_NON_FRAME_DATA |
	    GRC_MODE_BYTE_SWAP_DATA | GRC_MODE_WORD_SWAP_DATA;
#else
	/* Reconfigure the mode register. */
	Value32 = GRC_MODE_BYTE_SWAP_NON_FRAME_DATA | GRC_MODE_BYTE_SWAP_DATA;
#endif
#endif
	REG_WR (pDevice, Grc.Mode, Value32);

	/* Prevent PXE from restarting. */
	MEM_WR_OFFSET (pDevice, 0x0b50, T3_MAGIC_NUM);

	if (pDevice->EnableTbi) {
		pDevice->MacMode = MAC_MODE_PORT_MODE_TBI;
		REG_WR (pDevice, MacCtrl.Mode, MAC_MODE_PORT_MODE_TBI);
	} else {
		REG_WR (pDevice, MacCtrl.Mode, 0);
	}

	/* Wait for the firmware to finish initialization. */
	for (j = 0; j < 100000; j++) {
		MM_Wait (10);

		Value32 = MEM_RD_OFFSET (pDevice, 0x0b50);
		if (Value32 == ~T3_MAGIC_NUM) {
			break;
		}
	}
	return LM_STATUS_SUCCESS;
}

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
__inline static void LM_ServiceTxInterrupt (PLM_DEVICE_BLOCK pDevice)
{
	PLM_PACKET pPacket;
	LM_UINT32 HwConIdx;
	LM_UINT32 SwConIdx;

	HwConIdx = pDevice->pStatusBlkVirt->Idx[0].SendConIdx;

	/* Get our copy of the consumer index.  The buffer descriptors */
	/* that are in between the consumer indices are freed. */
	SwConIdx = pDevice->SendConIdx;

	/* Move the packets from the TxPacketActiveQ that are sent out to */
	/* the TxPacketXmittedQ.  Packets that are sent use the */
	/* descriptors that are between SwConIdx and HwConIdx. */
	while (SwConIdx != HwConIdx) {
		/* Get the packet that was sent from the TxPacketActiveQ. */
		pPacket =
		    (PLM_PACKET) QQ_PopHead (&pDevice->TxPacketActiveQ.
					     Container);

		/* Set the return status. */
		pPacket->PacketStatus = LM_STATUS_SUCCESS;

		/* Put the packet in the TxPacketXmittedQ for indication later. */
		QQ_PushTail (&pDevice->TxPacketXmittedQ.Container, pPacket);

		/* Move to the next packet's BD. */
		SwConIdx = (SwConIdx + pPacket->u.Tx.FragCount) &
		    T3_SEND_RCB_ENTRY_COUNT_MASK;

		/* Update the number of unused BDs. */
		atomic_add (pPacket->u.Tx.FragCount, &pDevice->SendBdLeft);

		/* Get the new updated HwConIdx. */
		HwConIdx = pDevice->pStatusBlkVirt->Idx[0].SendConIdx;
	}			/* while */

	/* Save the new SwConIdx. */
	pDevice->SendConIdx = SwConIdx;

}				/* LM_ServiceTxInterrupt */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
__inline static void LM_ServiceRxInterrupt (PLM_DEVICE_BLOCK pDevice)
{
	PLM_PACKET pPacket;
	PT3_RCV_BD pRcvBd;
	LM_UINT32 HwRcvRetProdIdx;
	LM_UINT32 SwRcvRetConIdx;

	/* Loop thru the receive return rings for received packets. */
	HwRcvRetProdIdx = pDevice->pStatusBlkVirt->Idx[0].RcvProdIdx;

	SwRcvRetConIdx = pDevice->RcvRetConIdx;
	while (SwRcvRetConIdx != HwRcvRetProdIdx) {
		pRcvBd = &pDevice->pRcvRetBdVirt[SwRcvRetConIdx];

		/* Get the received packet descriptor. */
		pPacket = (PLM_PACKET) (MM_UINT_PTR (pDevice->pPacketDescBase) +
					MM_UINT_PTR (pRcvBd->Opaque));

		/* Check the error flag. */
		if (pRcvBd->ErrorFlag &&
		    pRcvBd->ErrorFlag != RCV_BD_ERR_ODD_NIBBLED_RCVD_MII) {
			pPacket->PacketStatus = LM_STATUS_FAILURE;

			pDevice->RxCounters.RxPacketErrCnt++;

			if (pRcvBd->ErrorFlag & RCV_BD_ERR_BAD_CRC) {
				pDevice->RxCounters.RxErrCrcCnt++;
			}

			if (pRcvBd->ErrorFlag & RCV_BD_ERR_COLL_DETECT) {
				pDevice->RxCounters.RxErrCollCnt++;
			}

			if (pRcvBd->ErrorFlag & RCV_BD_ERR_LINK_LOST_DURING_PKT) {
				pDevice->RxCounters.RxErrLinkLostCnt++;
			}

			if (pRcvBd->ErrorFlag & RCV_BD_ERR_PHY_DECODE_ERR) {
				pDevice->RxCounters.RxErrPhyDecodeCnt++;
			}

			if (pRcvBd->ErrorFlag & RCV_BD_ERR_ODD_NIBBLED_RCVD_MII) {
				pDevice->RxCounters.RxErrOddNibbleCnt++;
			}

			if (pRcvBd->ErrorFlag & RCV_BD_ERR_MAC_ABORT) {
				pDevice->RxCounters.RxErrMacAbortCnt++;
			}

			if (pRcvBd->ErrorFlag & RCV_BD_ERR_LEN_LT_64) {
				pDevice->RxCounters.RxErrShortPacketCnt++;
			}

			if (pRcvBd->ErrorFlag & RCV_BD_ERR_TRUNC_NO_RESOURCES) {
				pDevice->RxCounters.RxErrNoResourceCnt++;
			}

			if (pRcvBd->ErrorFlag & RCV_BD_ERR_GIANT_FRAME_RCVD) {
				pDevice->RxCounters.RxErrLargePacketCnt++;
			}
		} else {
			pPacket->PacketStatus = LM_STATUS_SUCCESS;
			pPacket->PacketSize = pRcvBd->Len - 4;

			pPacket->Flags = pRcvBd->Flags;
			if (pRcvBd->Flags & RCV_BD_FLAG_VLAN_TAG) {
				pPacket->VlanTag = pRcvBd->VlanTag;
			}

			pPacket->u.Rx.TcpUdpChecksum = pRcvBd->TcpUdpCksum;
		}

		/* Put the packet descriptor containing the received packet */
		/* buffer in the RxPacketReceivedQ for indication later. */
		QQ_PushTail (&pDevice->RxPacketReceivedQ.Container, pPacket);

		/* Go to the next buffer descriptor. */
		SwRcvRetConIdx = (SwRcvRetConIdx + 1) &
		    T3_RCV_RETURN_RCB_ENTRY_COUNT_MASK;

		/* Get the updated HwRcvRetProdIdx. */
		HwRcvRetProdIdx = pDevice->pStatusBlkVirt->Idx[0].RcvProdIdx;
	}			/* while */

	pDevice->RcvRetConIdx = SwRcvRetConIdx;

	/* Update the receive return ring consumer index. */
	MB_REG_WR (pDevice, Mailbox.RcvRetConIdx[0].Low, SwRcvRetConIdx);
}				/* LM_ServiceRxInterrupt */

/******************************************************************************/
/* Description:                                                               */
/*    This is the interrupt event handler routine. It acknowledges all        */
/*    pending interrupts and process all pending events.                      */
/*                                                                            */
/* Return:                                                                    */
/*    LM_STATUS_SUCCESS                                                       */
/******************************************************************************/
LM_STATUS LM_ServiceInterrupts (PLM_DEVICE_BLOCK pDevice)
{
	LM_UINT32 Value32;
	int ServicePhyInt = FALSE;

	/* Setup the phy chip whenever the link status changes. */
	if (pDevice->LinkChngMode == T3_LINK_CHNG_MODE_USE_STATUS_REG) {
		Value32 = REG_RD (pDevice, MacCtrl.Status);
		if (pDevice->PhyIntMode == T3_PHY_INT_MODE_MI_INTERRUPT) {
			if (Value32 & MAC_STATUS_MI_INTERRUPT) {
				ServicePhyInt = TRUE;
			}
		} else if (Value32 & MAC_STATUS_LINK_STATE_CHANGED) {
			ServicePhyInt = TRUE;
		}
	} else {
		if (pDevice->pStatusBlkVirt->
		    Status & STATUS_BLOCK_LINK_CHANGED_STATUS) {
			pDevice->pStatusBlkVirt->Status =
			    STATUS_BLOCK_UPDATED | (pDevice->pStatusBlkVirt->
						    Status &
						    ~STATUS_BLOCK_LINK_CHANGED_STATUS);
			ServicePhyInt = TRUE;
		}
	}
#if INCLUDE_TBI_SUPPORT
	if (pDevice->IgnoreTbiLinkChange == TRUE) {
		ServicePhyInt = FALSE;
	}
#endif
	if (ServicePhyInt == TRUE) {
		LM_SetupPhy (pDevice);
	}

	/* Service receive and transmit interrupts. */
	LM_ServiceRxInterrupt (pDevice);
	LM_ServiceTxInterrupt (pDevice);

	/* No spinlock for this queue since this routine is serialized. */
	if (!QQ_Empty (&pDevice->RxPacketReceivedQ.Container)) {
		/* Indicate receive packets. */
		MM_IndicateRxPackets (pDevice);
		/*       LM_QueueRxPackets(pDevice); */
	}

	/* No spinlock for this queue since this routine is serialized. */
	if (!QQ_Empty (&pDevice->TxPacketXmittedQ.Container)) {
		MM_IndicateTxPackets (pDevice);
	}

	return LM_STATUS_SUCCESS;
}				/* LM_ServiceInterrupts */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_STATUS LM_MulticastAdd (PLM_DEVICE_BLOCK pDevice, PLM_UINT8 pMcAddress)
{
	PLM_UINT8 pEntry;
	LM_UINT32 j;

	pEntry = pDevice->McTable[0];
	for (j = 0; j < pDevice->McEntryCount; j++) {
		if (IS_ETH_ADDRESS_EQUAL (pEntry, pMcAddress)) {
			/* Found a match, increment the instance count. */
			pEntry[LM_MC_INSTANCE_COUNT_INDEX] += 1;

			return LM_STATUS_SUCCESS;
		}

		pEntry += LM_MC_ENTRY_SIZE;
	}

	if (pDevice->McEntryCount >= LM_MAX_MC_TABLE_SIZE) {
		return LM_STATUS_FAILURE;
	}

	pEntry = pDevice->McTable[pDevice->McEntryCount];

	COPY_ETH_ADDRESS (pMcAddress, pEntry);
	pEntry[LM_MC_INSTANCE_COUNT_INDEX] = 1;

	pDevice->McEntryCount++;

	LM_SetReceiveMask (pDevice, pDevice->ReceiveMask | LM_ACCEPT_MULTICAST);

	return LM_STATUS_SUCCESS;
}				/* LM_MulticastAdd */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_STATUS LM_MulticastDel (PLM_DEVICE_BLOCK pDevice, PLM_UINT8 pMcAddress)
{
	PLM_UINT8 pEntry;
	LM_UINT32 j;

	pEntry = pDevice->McTable[0];
	for (j = 0; j < pDevice->McEntryCount; j++) {
		if (IS_ETH_ADDRESS_EQUAL (pEntry, pMcAddress)) {
			/* Found a match, decrement the instance count. */
			pEntry[LM_MC_INSTANCE_COUNT_INDEX] -= 1;

			/* No more instance left, remove the address from the table. */
			/* Move the last entry in the table to the delete slot. */
			if (pEntry[LM_MC_INSTANCE_COUNT_INDEX] == 0 &&
			    pDevice->McEntryCount > 1) {

				COPY_ETH_ADDRESS (pDevice->
						  McTable[pDevice->
							  McEntryCount - 1],
						  pEntry);
				pEntry[LM_MC_INSTANCE_COUNT_INDEX] =
				    pDevice->McTable[pDevice->McEntryCount - 1]
				    [LM_MC_INSTANCE_COUNT_INDEX];
			}
			pDevice->McEntryCount--;

			/* Update the receive mask if the table is empty. */
			if (pDevice->McEntryCount == 0) {
				LM_SetReceiveMask (pDevice,
						   pDevice->
						   ReceiveMask &
						   ~LM_ACCEPT_MULTICAST);
			}

			return LM_STATUS_SUCCESS;
		}

		pEntry += LM_MC_ENTRY_SIZE;
	}

	return LM_STATUS_FAILURE;
}				/* LM_MulticastDel */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_STATUS LM_MulticastClear (PLM_DEVICE_BLOCK pDevice)
{
	pDevice->McEntryCount = 0;

	LM_SetReceiveMask (pDevice,
			   pDevice->ReceiveMask & ~LM_ACCEPT_MULTICAST);

	return LM_STATUS_SUCCESS;
}				/* LM_MulticastClear */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_STATUS LM_SetMacAddress (PLM_DEVICE_BLOCK pDevice, PLM_UINT8 pMacAddress)
{
	LM_UINT32 j;

	for (j = 0; j < 4; j++) {
		REG_WR (pDevice, MacCtrl.MacAddr[j].High,
			(pMacAddress[0] << 8) | pMacAddress[1]);
		REG_WR (pDevice, MacCtrl.MacAddr[j].Low,
			(pMacAddress[2] << 24) | (pMacAddress[3] << 16) |
			(pMacAddress[4] << 8) | pMacAddress[5]);
	}

	return LM_STATUS_SUCCESS;
}

/******************************************************************************/
/* Description:                                                               */
/*    Sets up the default line speed, and duplex modes based on the requested */
/*    media type.                                                             */
/*                                                                            */
/* Return:                                                                    */
/*    None.                                                                   */
/******************************************************************************/
static LM_STATUS
LM_TranslateRequestedMediaType (LM_REQUESTED_MEDIA_TYPE RequestedMediaType,
				PLM_MEDIA_TYPE pMediaType,
				PLM_LINE_SPEED pLineSpeed,
				PLM_DUPLEX_MODE pDuplexMode)
{
	*pMediaType = LM_MEDIA_TYPE_AUTO;
	*pLineSpeed = LM_LINE_SPEED_UNKNOWN;
	*pDuplexMode = LM_DUPLEX_MODE_UNKNOWN;

	/* determine media type */
	switch (RequestedMediaType) {
	case LM_REQUESTED_MEDIA_TYPE_BNC:
		*pMediaType = LM_MEDIA_TYPE_BNC;
		*pLineSpeed = LM_LINE_SPEED_10MBPS;
		*pDuplexMode = LM_DUPLEX_MODE_HALF;
		break;

	case LM_REQUESTED_MEDIA_TYPE_UTP_AUTO:
		*pMediaType = LM_MEDIA_TYPE_UTP;
		break;

	case LM_REQUESTED_MEDIA_TYPE_UTP_10MBPS:
		*pMediaType = LM_MEDIA_TYPE_UTP;
		*pLineSpeed = LM_LINE_SPEED_10MBPS;
		*pDuplexMode = LM_DUPLEX_MODE_HALF;
		break;

	case LM_REQUESTED_MEDIA_TYPE_UTP_10MBPS_FULL_DUPLEX:
		*pMediaType = LM_MEDIA_TYPE_UTP;
		*pLineSpeed = LM_LINE_SPEED_10MBPS;
		*pDuplexMode = LM_DUPLEX_MODE_FULL;
		break;

	case LM_REQUESTED_MEDIA_TYPE_UTP_100MBPS:
		*pMediaType = LM_MEDIA_TYPE_UTP;
		*pLineSpeed = LM_LINE_SPEED_100MBPS;
		*pDuplexMode = LM_DUPLEX_MODE_HALF;
		break;

	case LM_REQUESTED_MEDIA_TYPE_UTP_100MBPS_FULL_DUPLEX:
		*pMediaType = LM_MEDIA_TYPE_UTP;
		*pLineSpeed = LM_LINE_SPEED_100MBPS;
		*pDuplexMode = LM_DUPLEX_MODE_FULL;
		break;

	case LM_REQUESTED_MEDIA_TYPE_UTP_1000MBPS:
		*pMediaType = LM_MEDIA_TYPE_UTP;
		*pLineSpeed = LM_LINE_SPEED_1000MBPS;
		*pDuplexMode = LM_DUPLEX_MODE_HALF;
		break;

	case LM_REQUESTED_MEDIA_TYPE_UTP_1000MBPS_FULL_DUPLEX:
		*pMediaType = LM_MEDIA_TYPE_UTP;
		*pLineSpeed = LM_LINE_SPEED_1000MBPS;
		*pDuplexMode = LM_DUPLEX_MODE_FULL;
		break;

	case LM_REQUESTED_MEDIA_TYPE_FIBER_100MBPS:
		*pMediaType = LM_MEDIA_TYPE_FIBER;
		*pLineSpeed = LM_LINE_SPEED_100MBPS;
		*pDuplexMode = LM_DUPLEX_MODE_HALF;
		break;

	case LM_REQUESTED_MEDIA_TYPE_FIBER_100MBPS_FULL_DUPLEX:
		*pMediaType = LM_MEDIA_TYPE_FIBER;
		*pLineSpeed = LM_LINE_SPEED_100MBPS;
		*pDuplexMode = LM_DUPLEX_MODE_FULL;
		break;

	case LM_REQUESTED_MEDIA_TYPE_FIBER_1000MBPS:
		*pMediaType = LM_MEDIA_TYPE_FIBER;
		*pLineSpeed = LM_LINE_SPEED_1000MBPS;
		*pDuplexMode = LM_DUPLEX_MODE_HALF;
		break;

	case LM_REQUESTED_MEDIA_TYPE_FIBER_1000MBPS_FULL_DUPLEX:
		*pMediaType = LM_MEDIA_TYPE_FIBER;
		*pLineSpeed = LM_LINE_SPEED_1000MBPS;
		*pDuplexMode = LM_DUPLEX_MODE_FULL;
		break;

	default:
		break;
	}			/* switch */

	return LM_STATUS_SUCCESS;
}				/* LM_TranslateRequestedMediaType */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/*    LM_STATUS_LINK_ACTIVE                                                   */
/*    LM_STATUS_LINK_DOWN                                                     */
/******************************************************************************/
static LM_STATUS LM_InitBcm540xPhy (PLM_DEVICE_BLOCK pDevice)
{
	LM_LINE_SPEED CurrentLineSpeed;
	LM_DUPLEX_MODE CurrentDuplexMode;
	LM_STATUS CurrentLinkStatus;
	LM_UINT32 Value32;
	LM_UINT32 j;

#if 1				/* jmb: bugfix -- moved here, out of code that sets initial pwr state */
	LM_WritePhy (pDevice, BCM5401_AUX_CTRL, 0x2);
#endif
	if ((pDevice->PhyId & PHY_ID_MASK) == PHY_BCM5401_PHY_ID) {
		LM_ReadPhy (pDevice, PHY_STATUS_REG, &Value32);
		LM_ReadPhy (pDevice, PHY_STATUS_REG, &Value32);

		if (!pDevice->InitDone) {
			Value32 = 0;
		}

		if (!(Value32 & PHY_STATUS_LINK_PASS)) {
			LM_WritePhy (pDevice, BCM5401_AUX_CTRL, 0x0c20);

			LM_WritePhy (pDevice, BCM540X_DSP_ADDRESS_REG, 0x0012);
			LM_WritePhy (pDevice, BCM540X_DSP_RW_PORT, 0x1804);

			LM_WritePhy (pDevice, BCM540X_DSP_ADDRESS_REG, 0x0013);
			LM_WritePhy (pDevice, BCM540X_DSP_RW_PORT, 0x1204);

			LM_WritePhy (pDevice, BCM540X_DSP_ADDRESS_REG, 0x8006);
			LM_WritePhy (pDevice, BCM540X_DSP_RW_PORT, 0x0132);

			LM_WritePhy (pDevice, BCM540X_DSP_ADDRESS_REG, 0x8006);
			LM_WritePhy (pDevice, BCM540X_DSP_RW_PORT, 0x0232);

			LM_WritePhy (pDevice, BCM540X_DSP_ADDRESS_REG, 0x201f);
			LM_WritePhy (pDevice, BCM540X_DSP_RW_PORT, 0x0a20);

			LM_ReadPhy (pDevice, PHY_STATUS_REG, &Value32);
			for (j = 0; j < 1000; j++) {
				MM_Wait (10);

				LM_ReadPhy (pDevice, PHY_STATUS_REG, &Value32);
				if (Value32 & PHY_STATUS_LINK_PASS) {
					MM_Wait (40);
					break;
				}
			}

			if ((pDevice->PhyId & PHY_ID_REV_MASK) ==
			    PHY_BCM5401_B0_REV) {
				if (!(Value32 & PHY_STATUS_LINK_PASS)
				    && (pDevice->OldLineSpeed ==
					LM_LINE_SPEED_1000MBPS)) {
					LM_WritePhy (pDevice, PHY_CTRL_REG,
						     PHY_CTRL_PHY_RESET);
					for (j = 0; j < 100; j++) {
						MM_Wait (10);

						LM_ReadPhy (pDevice,
							    PHY_CTRL_REG,
							    &Value32);
						if (!
						    (Value32 &
						     PHY_CTRL_PHY_RESET)) {
							MM_Wait (40);
							break;
						}
					}

					LM_WritePhy (pDevice, BCM5401_AUX_CTRL,
						     0x0c20);

					LM_WritePhy (pDevice,
						     BCM540X_DSP_ADDRESS_REG,
						     0x0012);
					LM_WritePhy (pDevice,
						     BCM540X_DSP_RW_PORT,
						     0x1804);

					LM_WritePhy (pDevice,
						     BCM540X_DSP_ADDRESS_REG,
						     0x0013);
					LM_WritePhy (pDevice,
						     BCM540X_DSP_RW_PORT,
						     0x1204);

					LM_WritePhy (pDevice,
						     BCM540X_DSP_ADDRESS_REG,
						     0x8006);
					LM_WritePhy (pDevice,
						     BCM540X_DSP_RW_PORT,
						     0x0132);

					LM_WritePhy (pDevice,
						     BCM540X_DSP_ADDRESS_REG,
						     0x8006);
					LM_WritePhy (pDevice,
						     BCM540X_DSP_RW_PORT,
						     0x0232);

					LM_WritePhy (pDevice,
						     BCM540X_DSP_ADDRESS_REG,
						     0x201f);
					LM_WritePhy (pDevice,
						     BCM540X_DSP_RW_PORT,
						     0x0a20);
				}
			}
		}
	} else if (pDevice->ChipRevId == T3_CHIP_ID_5701_A0 ||
		   pDevice->ChipRevId == T3_CHIP_ID_5701_B0) {
		/* Bug: 5701 A0, B0 TX CRC workaround. */
		LM_WritePhy (pDevice, 0x15, 0x0a75);
		LM_WritePhy (pDevice, 0x1c, 0x8c68);
		LM_WritePhy (pDevice, 0x1c, 0x8d68);
		LM_WritePhy (pDevice, 0x1c, 0x8c68);
	}

	/* Acknowledge interrupts. */
	LM_ReadPhy (pDevice, BCM540X_INT_STATUS_REG, &Value32);
	LM_ReadPhy (pDevice, BCM540X_INT_STATUS_REG, &Value32);

	/* Configure the interrupt mask. */
	if (pDevice->PhyIntMode == T3_PHY_INT_MODE_MI_INTERRUPT) {
		LM_WritePhy (pDevice, BCM540X_INT_MASK_REG,
			     ~BCM540X_INT_LINK_CHANGE);
	}

	/* Configure PHY led mode. */
	if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5701 ||
	    (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700)) {
		if (pDevice->LedMode == LED_MODE_THREE_LINK) {
			LM_WritePhy (pDevice, BCM540X_EXT_CTRL_REG,
				     BCM540X_EXT_CTRL_LINK3_LED_MODE);
		} else {
			LM_WritePhy (pDevice, BCM540X_EXT_CTRL_REG, 0);
		}
	}

	CurrentLinkStatus = LM_STATUS_LINK_DOWN;

	/* Get current link and duplex mode. */
	for (j = 0; j < 100; j++) {
		LM_ReadPhy (pDevice, PHY_STATUS_REG, &Value32);
		LM_ReadPhy (pDevice, PHY_STATUS_REG, &Value32);

		if (Value32 & PHY_STATUS_LINK_PASS) {
			break;
		}
		MM_Wait (40);
	}

	if (Value32 & PHY_STATUS_LINK_PASS) {

		/* Determine the current line and duplex settings. */
		LM_ReadPhy (pDevice, BCM540X_AUX_STATUS_REG, &Value32);
		for (j = 0; j < 2000; j++) {
			MM_Wait (10);

			LM_ReadPhy (pDevice, BCM540X_AUX_STATUS_REG, &Value32);
			if (Value32) {
				break;
			}
		}

		switch (Value32 & BCM540X_AUX_SPEED_MASK) {
		case BCM540X_AUX_10BASET_HD:
			CurrentLineSpeed = LM_LINE_SPEED_10MBPS;
			CurrentDuplexMode = LM_DUPLEX_MODE_HALF;
			break;

		case BCM540X_AUX_10BASET_FD:
			CurrentLineSpeed = LM_LINE_SPEED_10MBPS;
			CurrentDuplexMode = LM_DUPLEX_MODE_FULL;
			break;

		case BCM540X_AUX_100BASETX_HD:
			CurrentLineSpeed = LM_LINE_SPEED_100MBPS;
			CurrentDuplexMode = LM_DUPLEX_MODE_HALF;
			break;

		case BCM540X_AUX_100BASETX_FD:
			CurrentLineSpeed = LM_LINE_SPEED_100MBPS;
			CurrentDuplexMode = LM_DUPLEX_MODE_FULL;
			break;

		case BCM540X_AUX_100BASET_HD:
			CurrentLineSpeed = LM_LINE_SPEED_1000MBPS;
			CurrentDuplexMode = LM_DUPLEX_MODE_HALF;
			break;

		case BCM540X_AUX_100BASET_FD:
			CurrentLineSpeed = LM_LINE_SPEED_1000MBPS;
			CurrentDuplexMode = LM_DUPLEX_MODE_FULL;
			break;

		default:

			CurrentLineSpeed = LM_LINE_SPEED_UNKNOWN;
			CurrentDuplexMode = LM_DUPLEX_MODE_UNKNOWN;
			break;
		}

		/* Make sure we are in auto-neg mode. */
		for (j = 0; j < 200; j++) {
			LM_ReadPhy (pDevice, PHY_CTRL_REG, &Value32);
			if (Value32 && Value32 != 0x7fff) {
				break;
			}

			if (Value32 == 0 && pDevice->RequestedMediaType ==
			    LM_REQUESTED_MEDIA_TYPE_UTP_10MBPS) {
				break;
			}

			MM_Wait (10);
		}

		/* Use the current line settings for "auto" mode. */
		if (pDevice->RequestedMediaType == LM_REQUESTED_MEDIA_TYPE_AUTO
		    || pDevice->RequestedMediaType ==
		    LM_REQUESTED_MEDIA_TYPE_UTP_AUTO) {
			if (Value32 & PHY_CTRL_AUTO_NEG_ENABLE) {
				CurrentLinkStatus = LM_STATUS_LINK_ACTIVE;

				/* We may be exiting low power mode and the link is in */
				/* 10mb.  In this case, we need to restart autoneg. */
				LM_ReadPhy (pDevice, BCM540X_1000BASET_CTRL_REG,
					    &Value32);
				pDevice->advertising1000 = Value32;
				/* 5702FE supports 10/100Mb only. */
				if (T3_ASIC_REV (pDevice->ChipRevId) !=
				    T3_ASIC_REV_5703
				    || pDevice->BondId !=
				    GRC_MISC_BD_ID_5702FE) {
					if (!
					    (Value32 &
					     (BCM540X_AN_AD_1000BASET_HALF |
					      BCM540X_AN_AD_1000BASET_FULL))) {
						CurrentLinkStatus =
						    LM_STATUS_LINK_SETTING_MISMATCH;
					}
				}
			} else {
				CurrentLinkStatus =
				    LM_STATUS_LINK_SETTING_MISMATCH;
			}
		} else {
			/* Force line settings. */
			/* Use the current setting if it matches the user's requested */
			/* setting. */
			LM_ReadPhy (pDevice, PHY_CTRL_REG, &Value32);
			if ((pDevice->LineSpeed == CurrentLineSpeed) &&
			    (pDevice->DuplexMode == CurrentDuplexMode)) {
				if ((pDevice->DisableAutoNeg &&
				     !(Value32 & PHY_CTRL_AUTO_NEG_ENABLE)) ||
				    (!pDevice->DisableAutoNeg &&
				     (Value32 & PHY_CTRL_AUTO_NEG_ENABLE))) {
					CurrentLinkStatus =
					    LM_STATUS_LINK_ACTIVE;
				} else {
					CurrentLinkStatus =
					    LM_STATUS_LINK_SETTING_MISMATCH;
				}
			} else {
				CurrentLinkStatus =
				    LM_STATUS_LINK_SETTING_MISMATCH;
			}
		}

		/* Save line settings. */
		pDevice->LineSpeed = CurrentLineSpeed;
		pDevice->DuplexMode = CurrentDuplexMode;
		pDevice->MediaType = LM_MEDIA_TYPE_UTP;
	}

	return CurrentLinkStatus;
}				/* LM_InitBcm540xPhy */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_STATUS
LM_SetFlowControl (PLM_DEVICE_BLOCK pDevice,
		   LM_UINT32 LocalPhyAd, LM_UINT32 RemotePhyAd)
{
	LM_FLOW_CONTROL FlowCap;

	/* Resolve flow control. */
	FlowCap = LM_FLOW_CONTROL_NONE;

	/* See Table 28B-3 of 802.3ab-1999 spec. */
	if (pDevice->FlowControlCap & LM_FLOW_CONTROL_AUTO_PAUSE) {
		if (LocalPhyAd & PHY_AN_AD_PAUSE_CAPABLE) {
			if (LocalPhyAd & PHY_AN_AD_ASYM_PAUSE) {
				if (RemotePhyAd &
				    PHY_LINK_PARTNER_PAUSE_CAPABLE) {
					FlowCap =
					    LM_FLOW_CONTROL_TRANSMIT_PAUSE |
					    LM_FLOW_CONTROL_RECEIVE_PAUSE;
				} else if (RemotePhyAd &
					   PHY_LINK_PARTNER_ASYM_PAUSE) {
					FlowCap = LM_FLOW_CONTROL_RECEIVE_PAUSE;
				}
			} else {
				if (RemotePhyAd &
				    PHY_LINK_PARTNER_PAUSE_CAPABLE) {
					FlowCap =
					    LM_FLOW_CONTROL_TRANSMIT_PAUSE |
					    LM_FLOW_CONTROL_RECEIVE_PAUSE;
				}
			}
		} else if (LocalPhyAd & PHY_AN_AD_ASYM_PAUSE) {
			if ((RemotePhyAd & PHY_LINK_PARTNER_PAUSE_CAPABLE) &&
			    (RemotePhyAd & PHY_LINK_PARTNER_ASYM_PAUSE)) {
				FlowCap = LM_FLOW_CONTROL_TRANSMIT_PAUSE;
			}
		}
	} else {
		FlowCap = pDevice->FlowControlCap;
	}

	/* Enable/disable rx PAUSE. */
	pDevice->RxMode &= ~RX_MODE_ENABLE_FLOW_CONTROL;
	if (FlowCap & LM_FLOW_CONTROL_RECEIVE_PAUSE &&
	    (pDevice->FlowControlCap == LM_FLOW_CONTROL_AUTO_PAUSE ||
	     pDevice->FlowControlCap & LM_FLOW_CONTROL_RECEIVE_PAUSE)) {
		pDevice->FlowControl |= LM_FLOW_CONTROL_RECEIVE_PAUSE;
		pDevice->RxMode |= RX_MODE_ENABLE_FLOW_CONTROL;

	}
	REG_WR (pDevice, MacCtrl.RxMode, pDevice->RxMode);

	/* Enable/disable tx PAUSE. */
	pDevice->TxMode &= ~TX_MODE_ENABLE_FLOW_CONTROL;
	if (FlowCap & LM_FLOW_CONTROL_TRANSMIT_PAUSE &&
	    (pDevice->FlowControlCap == LM_FLOW_CONTROL_AUTO_PAUSE ||
	     pDevice->FlowControlCap & LM_FLOW_CONTROL_TRANSMIT_PAUSE)) {
		pDevice->FlowControl |= LM_FLOW_CONTROL_TRANSMIT_PAUSE;
		pDevice->TxMode |= TX_MODE_ENABLE_FLOW_CONTROL;

	}
	REG_WR (pDevice, MacCtrl.TxMode, pDevice->TxMode);

	return LM_STATUS_SUCCESS;
}

#if INCLUDE_TBI_SUPPORT
/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
STATIC LM_STATUS LM_InitBcm800xPhy (PLM_DEVICE_BLOCK pDevice)
{
	LM_UINT32 Value32;
	LM_UINT32 j;

	Value32 = REG_RD (pDevice, MacCtrl.Status);

	/* Reset the SERDES during init and when we have link. */
	if (!pDevice->InitDone || Value32 & MAC_STATUS_PCS_SYNCED) {
		/* Set PLL lock range. */
		LM_WritePhy (pDevice, 0x16, 0x8007);

		/* Software reset. */
		LM_WritePhy (pDevice, 0x00, 0x8000);

		/* Wait for reset to complete. */
		for (j = 0; j < 500; j++) {
			MM_Wait (10);
		}

		/* Config mode; seletct PMA/Ch 1 regs. */
		LM_WritePhy (pDevice, 0x10, 0x8411);

		/* Enable auto-lock and comdet, select txclk for tx. */
		LM_WritePhy (pDevice, 0x11, 0x0a10);

		LM_WritePhy (pDevice, 0x18, 0x00a0);
		LM_WritePhy (pDevice, 0x16, 0x41ff);

		/* Assert and deassert POR. */
		LM_WritePhy (pDevice, 0x13, 0x0400);
		MM_Wait (40);
		LM_WritePhy (pDevice, 0x13, 0x0000);

		LM_WritePhy (pDevice, 0x11, 0x0a50);
		MM_Wait (40);
		LM_WritePhy (pDevice, 0x11, 0x0a10);

		/* Delay for signal to stabilize. */
		for (j = 0; j < 15000; j++) {
			MM_Wait (10);
		}

		/* Deselect the channel register so we can read the PHY id later. */
		LM_WritePhy (pDevice, 0x10, 0x8011);
	}

	return LM_STATUS_SUCCESS;
}

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
STATIC LM_STATUS LM_SetupFiberPhy (PLM_DEVICE_BLOCK pDevice)
{
	LM_STATUS CurrentLinkStatus;
	AUTONEG_STATUS AnStatus = 0;
	LM_UINT32 Value32;
	LM_UINT32 Cnt;
	LM_UINT32 j, k;

	pDevice->MacMode &= ~(MAC_MODE_HALF_DUPLEX | MAC_MODE_PORT_MODE_MASK);

	/* Initialize the send_config register. */
	REG_WR (pDevice, MacCtrl.TxAutoNeg, 0);

	/* Enable TBI and full duplex mode. */
	pDevice->MacMode |= MAC_MODE_PORT_MODE_TBI;
	REG_WR (pDevice, MacCtrl.Mode, pDevice->MacMode);

	/* Initialize the BCM8002 SERDES PHY. */
	switch (pDevice->PhyId & PHY_ID_MASK) {
	case PHY_BCM8002_PHY_ID:
		LM_InitBcm800xPhy (pDevice);
		break;

	default:
		break;
	}

	/* Enable link change interrupt. */
	REG_WR (pDevice, MacCtrl.MacEvent,
		MAC_EVENT_ENABLE_LINK_STATE_CHANGED_ATTN);

	/* Default to link down. */
	CurrentLinkStatus = LM_STATUS_LINK_DOWN;

	/* Get the link status. */
	Value32 = REG_RD (pDevice, MacCtrl.Status);
	if (Value32 & MAC_STATUS_PCS_SYNCED) {
		if ((pDevice->RequestedMediaType ==
		     LM_REQUESTED_MEDIA_TYPE_AUTO)
		    || (pDevice->DisableAutoNeg == FALSE)) {
			/* auto-negotiation mode. */
			/* Initialize the autoneg default capaiblities. */
			AutonegInit (&pDevice->AnInfo);

			/* Set the context pointer to point to the main device structure. */
			pDevice->AnInfo.pContext = pDevice;

			/* Setup flow control advertisement register. */
			Value32 = GetPhyAdFlowCntrlSettings (pDevice);
			if (Value32 & PHY_AN_AD_PAUSE_CAPABLE) {
				pDevice->AnInfo.mr_adv_sym_pause = 1;
			} else {
				pDevice->AnInfo.mr_adv_sym_pause = 0;
			}

			if (Value32 & PHY_AN_AD_ASYM_PAUSE) {
				pDevice->AnInfo.mr_adv_asym_pause = 1;
			} else {
				pDevice->AnInfo.mr_adv_asym_pause = 0;
			}

			/* Try to autoneg up to six times. */
			if (pDevice->IgnoreTbiLinkChange) {
				Cnt = 1;
			} else {
				Cnt = 6;
			}
			for (j = 0; j < Cnt; j++) {
				REG_WR (pDevice, MacCtrl.TxAutoNeg, 0);

				Value32 =
				    pDevice->MacMode & ~MAC_MODE_PORT_MODE_MASK;
				REG_WR (pDevice, MacCtrl.Mode, Value32);
				MM_Wait (20);

				REG_WR (pDevice, MacCtrl.Mode,
					pDevice->
					MacMode | MAC_MODE_SEND_CONFIGS);

				MM_Wait (20);

				pDevice->AnInfo.State = AN_STATE_UNKNOWN;
				pDevice->AnInfo.CurrentTime_us = 0;

				REG_WR (pDevice, Grc.Timer, 0);
				for (k = 0;
				     (pDevice->AnInfo.CurrentTime_us < 75000)
				     && (k < 75000); k++) {
					AnStatus =
					    Autoneg8023z (&pDevice->AnInfo);

					if ((AnStatus == AUTONEG_STATUS_DONE) ||
					    (AnStatus == AUTONEG_STATUS_FAILED))
					{
						break;
					}

					pDevice->AnInfo.CurrentTime_us =
					    REG_RD (pDevice, Grc.Timer);

				}
				if ((AnStatus == AUTONEG_STATUS_DONE) ||
				    (AnStatus == AUTONEG_STATUS_FAILED)) {
					break;
				}
				if (j >= 1) {
					if (!(REG_RD (pDevice, MacCtrl.Status) &
					      MAC_STATUS_PCS_SYNCED)) {
						break;
					}
				}
			}

			/* Stop sending configs. */
			MM_AnTxIdle (&pDevice->AnInfo);

			/* Resolve flow control settings. */
			if ((AnStatus == AUTONEG_STATUS_DONE) &&
			    pDevice->AnInfo.mr_an_complete
			    && pDevice->AnInfo.mr_link_ok
			    && pDevice->AnInfo.mr_lp_adv_full_duplex) {
				LM_UINT32 RemotePhyAd;
				LM_UINT32 LocalPhyAd;

				LocalPhyAd = 0;
				if (pDevice->AnInfo.mr_adv_sym_pause) {
					LocalPhyAd |= PHY_AN_AD_PAUSE_CAPABLE;
				}

				if (pDevice->AnInfo.mr_adv_asym_pause) {
					LocalPhyAd |= PHY_AN_AD_ASYM_PAUSE;
				}

				RemotePhyAd = 0;
				if (pDevice->AnInfo.mr_lp_adv_sym_pause) {
					RemotePhyAd |=
					    PHY_LINK_PARTNER_PAUSE_CAPABLE;
				}

				if (pDevice->AnInfo.mr_lp_adv_asym_pause) {
					RemotePhyAd |=
					    PHY_LINK_PARTNER_ASYM_PAUSE;
				}

				LM_SetFlowControl (pDevice, LocalPhyAd,
						   RemotePhyAd);

				CurrentLinkStatus = LM_STATUS_LINK_ACTIVE;
			}
			for (j = 0; j < 30; j++) {
				MM_Wait (20);
				REG_WR (pDevice, MacCtrl.Status,
					MAC_STATUS_SYNC_CHANGED |
					MAC_STATUS_CFG_CHANGED);
				MM_Wait (20);
				if ((REG_RD (pDevice, MacCtrl.Status) &
				     (MAC_STATUS_SYNC_CHANGED |
				      MAC_STATUS_CFG_CHANGED)) == 0)
					break;
			}
			if (pDevice->PollTbiLink) {
				Value32 = REG_RD (pDevice, MacCtrl.Status);
				if (Value32 & MAC_STATUS_RECEIVING_CFG) {
					pDevice->IgnoreTbiLinkChange = TRUE;
				} else {
					pDevice->IgnoreTbiLinkChange = FALSE;
				}
			}
			Value32 = REG_RD (pDevice, MacCtrl.Status);
			if (CurrentLinkStatus == LM_STATUS_LINK_DOWN &&
			    (Value32 & MAC_STATUS_PCS_SYNCED) &&
			    ((Value32 & MAC_STATUS_RECEIVING_CFG) == 0)) {
				CurrentLinkStatus = LM_STATUS_LINK_ACTIVE;
			}
		} else {
			/* We are forcing line speed. */
			pDevice->FlowControlCap &= ~LM_FLOW_CONTROL_AUTO_PAUSE;
			LM_SetFlowControl (pDevice, 0, 0);

			CurrentLinkStatus = LM_STATUS_LINK_ACTIVE;
			REG_WR (pDevice, MacCtrl.Mode, pDevice->MacMode |
				MAC_MODE_SEND_CONFIGS);
		}
	}
	/* Set the link polarity bit. */
	pDevice->MacMode &= ~MAC_MODE_LINK_POLARITY;
	REG_WR (pDevice, MacCtrl.Mode, pDevice->MacMode);

	pDevice->pStatusBlkVirt->Status = STATUS_BLOCK_UPDATED |
	    (pDevice->pStatusBlkVirt->
	     Status & ~STATUS_BLOCK_LINK_CHANGED_STATUS);

	for (j = 0; j < 100; j++) {
		REG_WR (pDevice, MacCtrl.Status, MAC_STATUS_SYNC_CHANGED |
			MAC_STATUS_CFG_CHANGED);
		MM_Wait (5);
		if ((REG_RD (pDevice, MacCtrl.Status) &
		     (MAC_STATUS_SYNC_CHANGED | MAC_STATUS_CFG_CHANGED)) == 0)
			break;
	}

	Value32 = REG_RD (pDevice, MacCtrl.Status);
	if ((Value32 & MAC_STATUS_PCS_SYNCED) == 0) {
		CurrentLinkStatus = LM_STATUS_LINK_DOWN;
		if (pDevice->DisableAutoNeg == FALSE) {
			REG_WR (pDevice, MacCtrl.Mode, pDevice->MacMode |
				MAC_MODE_SEND_CONFIGS);
			MM_Wait (1);
			REG_WR (pDevice, MacCtrl.Mode, pDevice->MacMode);
		}
	}

	/* Initialize the current link status. */
	if (CurrentLinkStatus == LM_STATUS_LINK_ACTIVE) {
		pDevice->LineSpeed = LM_LINE_SPEED_1000MBPS;
		pDevice->DuplexMode = LM_DUPLEX_MODE_FULL;
		REG_WR (pDevice, MacCtrl.LedCtrl, LED_CTRL_OVERRIDE_LINK_LED |
			LED_CTRL_1000MBPS_LED_ON);
	} else {
		pDevice->LineSpeed = LM_LINE_SPEED_UNKNOWN;
		pDevice->DuplexMode = LM_DUPLEX_MODE_UNKNOWN;
		REG_WR (pDevice, MacCtrl.LedCtrl, LED_CTRL_OVERRIDE_LINK_LED |
			LED_CTRL_OVERRIDE_TRAFFIC_LED);
	}

	/* Indicate link status. */
	if (pDevice->LinkStatus != CurrentLinkStatus) {
		pDevice->LinkStatus = CurrentLinkStatus;
		MM_IndicateStatus (pDevice, CurrentLinkStatus);
	}

	return LM_STATUS_SUCCESS;
}
#endif				/* INCLUDE_TBI_SUPPORT */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_STATUS LM_SetupCopperPhy (PLM_DEVICE_BLOCK pDevice)
{
	LM_STATUS CurrentLinkStatus;
	LM_UINT32 Value32;

	/* Assume there is not link first. */
	CurrentLinkStatus = LM_STATUS_LINK_DOWN;

	/* Disable phy link change attention. */
	REG_WR (pDevice, MacCtrl.MacEvent, 0);

	/* Clear link change attention. */
	REG_WR (pDevice, MacCtrl.Status, MAC_STATUS_SYNC_CHANGED |
		MAC_STATUS_CFG_CHANGED);

	/* Disable auto-polling for the moment. */
	pDevice->MiMode = 0xc0000;
	REG_WR (pDevice, MacCtrl.MiMode, pDevice->MiMode);
	MM_Wait (40);

	/* Determine the requested line speed and duplex. */
	pDevice->OldLineSpeed = pDevice->LineSpeed;
	LM_TranslateRequestedMediaType (pDevice->RequestedMediaType,
					&pDevice->MediaType,
					&pDevice->LineSpeed,
					&pDevice->DuplexMode);

	/* Initialize the phy chip. */
	switch (pDevice->PhyId & PHY_ID_MASK) {
	case PHY_BCM5400_PHY_ID:
	case PHY_BCM5401_PHY_ID:
	case PHY_BCM5411_PHY_ID:
	case PHY_BCM5701_PHY_ID:
	case PHY_BCM5703_PHY_ID:
	case PHY_BCM5704_PHY_ID:
		CurrentLinkStatus = LM_InitBcm540xPhy (pDevice);
		break;

	default:
		break;
	}

	if (CurrentLinkStatus == LM_STATUS_LINK_SETTING_MISMATCH) {
		CurrentLinkStatus = LM_STATUS_LINK_DOWN;
	}

	/* Setup flow control. */
	pDevice->FlowControl = LM_FLOW_CONTROL_NONE;
	if (CurrentLinkStatus == LM_STATUS_LINK_ACTIVE) {
		LM_FLOW_CONTROL FlowCap;	/* Flow control capability. */

		FlowCap = LM_FLOW_CONTROL_NONE;

		if (pDevice->DuplexMode == LM_DUPLEX_MODE_FULL) {
			if (pDevice->DisableAutoNeg == FALSE ||
			    pDevice->RequestedMediaType ==
			    LM_REQUESTED_MEDIA_TYPE_AUTO
			    || pDevice->RequestedMediaType ==
			    LM_REQUESTED_MEDIA_TYPE_UTP_AUTO) {
				LM_UINT32 ExpectedPhyAd;
				LM_UINT32 LocalPhyAd;
				LM_UINT32 RemotePhyAd;

				LM_ReadPhy (pDevice, PHY_AN_AD_REG,
					    &LocalPhyAd);
				pDevice->advertising = LocalPhyAd;
				LocalPhyAd &=
				    (PHY_AN_AD_ASYM_PAUSE |
				     PHY_AN_AD_PAUSE_CAPABLE);

				ExpectedPhyAd =
				    GetPhyAdFlowCntrlSettings (pDevice);

				if (LocalPhyAd != ExpectedPhyAd) {
					CurrentLinkStatus = LM_STATUS_LINK_DOWN;
				} else {
					LM_ReadPhy (pDevice,
						    PHY_LINK_PARTNER_ABILITY_REG,
						    &RemotePhyAd);

					LM_SetFlowControl (pDevice, LocalPhyAd,
							   RemotePhyAd);
				}
			} else {
				pDevice->FlowControlCap &=
				    ~LM_FLOW_CONTROL_AUTO_PAUSE;
				LM_SetFlowControl (pDevice, 0, 0);
			}
		}
	}

	if (CurrentLinkStatus == LM_STATUS_LINK_DOWN) {
		LM_ForceAutoNeg (pDevice, pDevice->RequestedMediaType);

		/* If we force line speed, we make get link right away. */
		LM_ReadPhy (pDevice, PHY_STATUS_REG, &Value32);
		LM_ReadPhy (pDevice, PHY_STATUS_REG, &Value32);
		if (Value32 & PHY_STATUS_LINK_PASS) {
			CurrentLinkStatus = LM_STATUS_LINK_ACTIVE;
		}
	}

	/* GMII interface. */
	pDevice->MacMode &= ~MAC_MODE_PORT_MODE_MASK;
	if (CurrentLinkStatus == LM_STATUS_LINK_ACTIVE) {
		if (pDevice->LineSpeed == LM_LINE_SPEED_100MBPS ||
		    pDevice->LineSpeed == LM_LINE_SPEED_10MBPS) {
			pDevice->MacMode |= MAC_MODE_PORT_MODE_MII;
		} else {
			pDevice->MacMode |= MAC_MODE_PORT_MODE_GMII;
		}
	} else {
		pDevice->MacMode |= MAC_MODE_PORT_MODE_GMII;
	}

	/* Set the MAC to operate in the appropriate duplex mode. */
	pDevice->MacMode &= ~MAC_MODE_HALF_DUPLEX;
	if (pDevice->DuplexMode == LM_DUPLEX_MODE_HALF) {
		pDevice->MacMode |= MAC_MODE_HALF_DUPLEX;
	}

	/* Set the link polarity bit. */
	pDevice->MacMode &= ~MAC_MODE_LINK_POLARITY;
	if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700) {
		if ((pDevice->LedMode == LED_MODE_LINK10) ||
		    (CurrentLinkStatus == LM_STATUS_LINK_ACTIVE &&
		     pDevice->LineSpeed == LM_LINE_SPEED_10MBPS)) {
			pDevice->MacMode |= MAC_MODE_LINK_POLARITY;
		}
	} else {
		if (CurrentLinkStatus == LM_STATUS_LINK_ACTIVE) {
			pDevice->MacMode |= MAC_MODE_LINK_POLARITY;
		}

		/* Set LED mode. */
		if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700 ||
		    T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5701) {
			Value32 = LED_CTRL_PHY_MODE_1;
		} else {
			if (pDevice->LedMode == LED_MODE_OUTPUT) {
				Value32 = LED_CTRL_PHY_MODE_2;
			} else {
				Value32 = LED_CTRL_PHY_MODE_1;
			}
		}
		REG_WR (pDevice, MacCtrl.LedCtrl, Value32);
	}

	REG_WR (pDevice, MacCtrl.Mode, pDevice->MacMode);

	/* Enable auto polling. */
	if (pDevice->PhyIntMode == T3_PHY_INT_MODE_AUTO_POLLING) {
		pDevice->MiMode |= MI_MODE_AUTO_POLLING_ENABLE;
		REG_WR (pDevice, MacCtrl.MiMode, pDevice->MiMode);
	}

	/* Enable phy link change attention. */
	if (pDevice->PhyIntMode == T3_PHY_INT_MODE_MI_INTERRUPT) {
		REG_WR (pDevice, MacCtrl.MacEvent,
			MAC_EVENT_ENABLE_MI_INTERRUPT);
	} else {
		REG_WR (pDevice, MacCtrl.MacEvent,
			MAC_EVENT_ENABLE_LINK_STATE_CHANGED_ATTN);
	}
	if ((T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700) &&
	    (CurrentLinkStatus == LM_STATUS_LINK_ACTIVE) &&
	    (pDevice->LineSpeed == LM_LINE_SPEED_1000MBPS) &&
	    (((pDevice->PciState & T3_PCI_STATE_CONVENTIONAL_PCI_MODE) &&
	      (pDevice->PciState & T3_PCI_STATE_BUS_SPEED_HIGH)) ||
	     !(pDevice->PciState & T3_PCI_STATE_CONVENTIONAL_PCI_MODE))) {
		MM_Wait (120);
		REG_WR (pDevice, MacCtrl.Status, MAC_STATUS_SYNC_CHANGED |
			MAC_STATUS_CFG_CHANGED);
		MEM_WR_OFFSET (pDevice, T3_FIRMWARE_MAILBOX,
			       T3_MAGIC_NUM_DISABLE_DMAW_ON_LINK_CHANGE);
	}

	/* Indicate link status. */
	if (pDevice->LinkStatus != CurrentLinkStatus) {
		pDevice->LinkStatus = CurrentLinkStatus;
		MM_IndicateStatus (pDevice, CurrentLinkStatus);
	}

	return LM_STATUS_SUCCESS;
}				/* LM_SetupCopperPhy */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_STATUS LM_SetupPhy (PLM_DEVICE_BLOCK pDevice)
{
	LM_STATUS LmStatus;
	LM_UINT32 Value32;

#if INCLUDE_TBI_SUPPORT
	if (pDevice->EnableTbi) {
		LmStatus = LM_SetupFiberPhy (pDevice);
	} else
#endif				/* INCLUDE_TBI_SUPPORT */
	{
		LmStatus = LM_SetupCopperPhy (pDevice);
	}
	if (pDevice->ChipRevId == T3_CHIP_ID_5704_A0) {
		if (!(pDevice->PciState & T3_PCI_STATE_CONVENTIONAL_PCI_MODE)) {
			Value32 = REG_RD (pDevice, PciCfg.PciState);
			REG_WR (pDevice, PciCfg.PciState,
				Value32 | T3_PCI_STATE_RETRY_SAME_DMA);
		}
	}
	if ((pDevice->LineSpeed == LM_LINE_SPEED_1000MBPS) &&
	    (pDevice->DuplexMode == LM_DUPLEX_MODE_HALF)) {
		REG_WR (pDevice, MacCtrl.TxLengths, 0x26ff);
	} else {
		REG_WR (pDevice, MacCtrl.TxLengths, 0x2620);
	}

	return LmStatus;
}

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_VOID
LM_ReadPhy (PLM_DEVICE_BLOCK pDevice, LM_UINT32 PhyReg, PLM_UINT32 pData32)
{
	LM_UINT32 Value32;
	LM_UINT32 j;

	if (pDevice->PhyIntMode == T3_PHY_INT_MODE_AUTO_POLLING) {
		REG_WR (pDevice, MacCtrl.MiMode, pDevice->MiMode &
			~MI_MODE_AUTO_POLLING_ENABLE);
		MM_Wait (40);
	}

	Value32 = (pDevice->PhyAddr << MI_COM_FIRST_PHY_ADDR_BIT) |
	    ((PhyReg & MI_COM_PHY_REG_ADDR_MASK) <<
	     MI_COM_FIRST_PHY_REG_ADDR_BIT) | MI_COM_CMD_READ | MI_COM_START;

	REG_WR (pDevice, MacCtrl.MiCom, Value32);

	for (j = 0; j < 20; j++) {
		MM_Wait (25);

		Value32 = REG_RD (pDevice, MacCtrl.MiCom);

		if (!(Value32 & MI_COM_BUSY)) {
			MM_Wait (5);
			Value32 = REG_RD (pDevice, MacCtrl.MiCom);
			Value32 &= MI_COM_PHY_DATA_MASK;
			break;
		}
	}

	if (Value32 & MI_COM_BUSY) {
		Value32 = 0;
	}

	*pData32 = Value32;

	if (pDevice->PhyIntMode == T3_PHY_INT_MODE_AUTO_POLLING) {
		REG_WR (pDevice, MacCtrl.MiMode, pDevice->MiMode);
		MM_Wait (40);
	}
}				/* LM_ReadPhy */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_VOID
LM_WritePhy (PLM_DEVICE_BLOCK pDevice, LM_UINT32 PhyReg, LM_UINT32 Data32)
{
	LM_UINT32 Value32;
	LM_UINT32 j;

	if (pDevice->PhyIntMode == T3_PHY_INT_MODE_AUTO_POLLING) {
		REG_WR (pDevice, MacCtrl.MiMode, pDevice->MiMode &
			~MI_MODE_AUTO_POLLING_ENABLE);
		MM_Wait (40);
	}

	Value32 = (pDevice->PhyAddr << MI_COM_FIRST_PHY_ADDR_BIT) |
	    ((PhyReg & MI_COM_PHY_REG_ADDR_MASK) <<
	     MI_COM_FIRST_PHY_REG_ADDR_BIT) | (Data32 & MI_COM_PHY_DATA_MASK) |
	    MI_COM_CMD_WRITE | MI_COM_START;

	REG_WR (pDevice, MacCtrl.MiCom, Value32);

	for (j = 0; j < 20; j++) {
		MM_Wait (25);

		Value32 = REG_RD (pDevice, MacCtrl.MiCom);

		if (!(Value32 & MI_COM_BUSY)) {
			MM_Wait (5);
			break;
		}
	}

	if (pDevice->PhyIntMode == T3_PHY_INT_MODE_AUTO_POLLING) {
		REG_WR (pDevice, MacCtrl.MiMode, pDevice->MiMode);
		MM_Wait (40);
	}
}				/* LM_WritePhy */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_STATUS LM_SetPowerState (PLM_DEVICE_BLOCK pDevice, LM_POWER_STATE PowerLevel)
{
	LM_UINT32 PmeSupport;
	LM_UINT32 Value32;
	LM_UINT32 PmCtrl;

	/* make sureindirect accesses are enabled */
	MM_WriteConfig32 (pDevice, T3_PCI_MISC_HOST_CTRL_REG,
			  pDevice->MiscHostCtrl);

	/* Clear the PME_ASSERT bit and the power state bits.  Also enable */
	/* the PME bit. */
	MM_ReadConfig32 (pDevice, T3_PCI_PM_STATUS_CTRL_REG, &PmCtrl);

	PmCtrl |= T3_PM_PME_ASSERTED;
	PmCtrl &= ~T3_PM_POWER_STATE_MASK;

	/* Set the appropriate power state. */
	if (PowerLevel == LM_POWER_STATE_D0) {

		/* Bring the card out of low power mode. */
		PmCtrl |= T3_PM_POWER_STATE_D0;
		MM_WriteConfig32 (pDevice, T3_PCI_PM_STATUS_CTRL_REG, PmCtrl);

		REG_WR (pDevice, Grc.LocalCtrl, pDevice->GrcLocalCtrl);
		MM_Wait (40);
#if 0				/* Bugfix by jmb...can't call WritePhy here because pDevice not fully initialized */
		LM_WritePhy (pDevice, BCM5401_AUX_CTRL, 0x02);
#endif

		return LM_STATUS_SUCCESS;
	} else if (PowerLevel == LM_POWER_STATE_D1) {
		PmCtrl |= T3_PM_POWER_STATE_D1;
	} else if (PowerLevel == LM_POWER_STATE_D2) {
		PmCtrl |= T3_PM_POWER_STATE_D2;
	} else if (PowerLevel == LM_POWER_STATE_D3) {
		PmCtrl |= T3_PM_POWER_STATE_D3;
	} else {
		return LM_STATUS_FAILURE;
	}
	PmCtrl |= T3_PM_PME_ENABLE;

	/* Mask out all interrupts so LM_SetupPhy won't be called while we are */
	/* setting new line speed. */
	Value32 = REG_RD (pDevice, PciCfg.MiscHostCtrl);
	REG_WR (pDevice, PciCfg.MiscHostCtrl,
		Value32 | MISC_HOST_CTRL_MASK_PCI_INT);

	if (!pDevice->RestoreOnWakeUp) {
		pDevice->RestoreOnWakeUp = TRUE;
		pDevice->WakeUpDisableAutoNeg = pDevice->DisableAutoNeg;
		pDevice->WakeUpRequestedMediaType = pDevice->RequestedMediaType;
	}

	/* Force auto-negotiation to 10 line speed. */
	pDevice->DisableAutoNeg = FALSE;
	pDevice->RequestedMediaType = LM_REQUESTED_MEDIA_TYPE_UTP_10MBPS;
	LM_SetupPhy (pDevice);

	/* Put the driver in the initial state, and go through the power down */
	/* sequence. */
	LM_Halt (pDevice);

	MM_ReadConfig32 (pDevice, T3_PCI_PM_CAP_REG, &PmeSupport);

	if (pDevice->WakeUpModeCap != LM_WAKE_UP_MODE_NONE) {

		/* Enable WOL. */
		LM_WritePhy (pDevice, BCM5401_AUX_CTRL, 0x5a);
		MM_Wait (40);

		/* Set LED mode. */
		if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700 ||
		    T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5701) {
			Value32 = LED_CTRL_PHY_MODE_1;
		} else {
			if (pDevice->LedMode == LED_MODE_OUTPUT) {
				Value32 = LED_CTRL_PHY_MODE_2;
			} else {
				Value32 = LED_CTRL_PHY_MODE_1;
			}
		}

		Value32 = MAC_MODE_PORT_MODE_MII;
		if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700) {
			if (pDevice->LedMode == LED_MODE_LINK10 ||
			    pDevice->WolSpeed == WOL_SPEED_10MB) {
				Value32 |= MAC_MODE_LINK_POLARITY;
			}
		} else {
			Value32 |= MAC_MODE_LINK_POLARITY;
		}
		REG_WR (pDevice, MacCtrl.Mode, Value32);
		MM_Wait (40);
		MM_Wait (40);
		MM_Wait (40);

		/* Always enable magic packet wake-up if we have vaux. */
		if ((PmeSupport & T3_PCI_PM_CAP_PME_D3COLD) &&
		    (pDevice->WakeUpModeCap & LM_WAKE_UP_MODE_MAGIC_PACKET)) {
			Value32 |= MAC_MODE_DETECT_MAGIC_PACKET_ENABLE;
		}

		REG_WR (pDevice, MacCtrl.Mode, Value32);

		/* Enable the receiver. */
		REG_WR (pDevice, MacCtrl.RxMode, RX_MODE_ENABLE);
	}

	/* Disable tx/rx clocks, and seletect an alternate clock. */
	if (pDevice->WolSpeed == WOL_SPEED_100MB) {
		if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700 ||
		    T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5701) {
			Value32 =
			    T3_PCI_DISABLE_RX_CLOCK | T3_PCI_DISABLE_TX_CLOCK |
			    T3_PCI_SELECT_ALTERNATE_CLOCK;
		} else {
			Value32 = T3_PCI_SELECT_ALTERNATE_CLOCK;
		}
		REG_WR (pDevice, PciCfg.ClockCtrl, Value32);

		MM_Wait (40);

		if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700 ||
		    T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5701) {
			Value32 =
			    T3_PCI_DISABLE_RX_CLOCK | T3_PCI_DISABLE_TX_CLOCK |
			    T3_PCI_SELECT_ALTERNATE_CLOCK |
			    T3_PCI_44MHZ_CORE_CLOCK;
		} else {
			Value32 = T3_PCI_SELECT_ALTERNATE_CLOCK |
			    T3_PCI_44MHZ_CORE_CLOCK;
		}

		REG_WR (pDevice, PciCfg.ClockCtrl, Value32);

		MM_Wait (40);

		if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700 ||
		    T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5701) {
			Value32 =
			    T3_PCI_DISABLE_RX_CLOCK | T3_PCI_DISABLE_TX_CLOCK |
			    T3_PCI_44MHZ_CORE_CLOCK;
		} else {
			Value32 = T3_PCI_44MHZ_CORE_CLOCK;
		}

		REG_WR (pDevice, PciCfg.ClockCtrl, Value32);
	} else {
		if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700 ||
		    T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5701) {
			Value32 =
			    T3_PCI_DISABLE_RX_CLOCK | T3_PCI_DISABLE_TX_CLOCK |
			    T3_PCI_SELECT_ALTERNATE_CLOCK |
			    T3_PCI_POWER_DOWN_PCI_PLL133;
		} else {
			Value32 = T3_PCI_SELECT_ALTERNATE_CLOCK |
			    T3_PCI_POWER_DOWN_PCI_PLL133;
		}

		REG_WR (pDevice, PciCfg.ClockCtrl, Value32);
	}

	MM_Wait (40);

	if (!pDevice->EepromWp
	    && (pDevice->WakeUpModeCap != LM_WAKE_UP_MODE_NONE)) {
		/* Switch adapter to auxilliary power. */
		if (T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5700 ||
		    T3_ASIC_REV (pDevice->ChipRevId) == T3_ASIC_REV_5701) {
			/* GPIO0 = 1, GPIO1 = 1, GPIO2 = 0. */
			REG_WR (pDevice, Grc.LocalCtrl, pDevice->GrcLocalCtrl |
				GRC_MISC_LOCAL_CTRL_GPIO_OE0 |
				GRC_MISC_LOCAL_CTRL_GPIO_OE1 |
				GRC_MISC_LOCAL_CTRL_GPIO_OE2 |
				GRC_MISC_LOCAL_CTRL_GPIO_OUTPUT0 |
				GRC_MISC_LOCAL_CTRL_GPIO_OUTPUT1);
			MM_Wait (40);
		} else {
			/* GPIO0 = 0, GPIO1 = 1, GPIO2 = 1. */
			REG_WR (pDevice, Grc.LocalCtrl, pDevice->GrcLocalCtrl |
				GRC_MISC_LOCAL_CTRL_GPIO_OE0 |
				GRC_MISC_LOCAL_CTRL_GPIO_OE1 |
				GRC_MISC_LOCAL_CTRL_GPIO_OE2 |
				GRC_MISC_LOCAL_CTRL_GPIO_OUTPUT1 |
				GRC_MISC_LOCAL_CTRL_GPIO_OUTPUT2);
			MM_Wait (40);

			/* GPIO0 = 1, GPIO1 = 1, GPIO2 = 1. */
			REG_WR (pDevice, Grc.LocalCtrl, pDevice->GrcLocalCtrl |
				GRC_MISC_LOCAL_CTRL_GPIO_OE0 |
				GRC_MISC_LOCAL_CTRL_GPIO_OE1 |
				GRC_MISC_LOCAL_CTRL_GPIO_OE2 |
				GRC_MISC_LOCAL_CTRL_GPIO_OUTPUT0 |
				GRC_MISC_LOCAL_CTRL_GPIO_OUTPUT1 |
				GRC_MISC_LOCAL_CTRL_GPIO_OUTPUT2);
			MM_Wait (40);

			/* GPIO0 = 1, GPIO1 = 1, GPIO2 = 0. */
			REG_WR (pDevice, Grc.LocalCtrl, pDevice->GrcLocalCtrl |
				GRC_MISC_LOCAL_CTRL_GPIO_OE0 |
				GRC_MISC_LOCAL_CTRL_GPIO_OE1 |
				GRC_MISC_LOCAL_CTRL_GPIO_OE2 |
				GRC_MISC_LOCAL_CTRL_GPIO_OUTPUT0 |
				GRC_MISC_LOCAL_CTRL_GPIO_OUTPUT1);
			MM_Wait (40);
		}
	}

	/* Set the phy to low power mode. */
	/* Put the the hardware in low power mode. */
	MM_WriteConfig32 (pDevice, T3_PCI_PM_STATUS_CTRL_REG, PmCtrl);

	return LM_STATUS_SUCCESS;
}				/* LM_SetPowerState */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
static LM_UINT32 GetPhyAdFlowCntrlSettings (PLM_DEVICE_BLOCK pDevice)
{
	LM_UINT32 Value32;

	Value32 = 0;

	/* Auto negotiation flow control only when autonegotiation is enabled. */
	if (pDevice->DisableAutoNeg == FALSE ||
	    pDevice->RequestedMediaType == LM_REQUESTED_MEDIA_TYPE_AUTO ||
	    pDevice->RequestedMediaType == LM_REQUESTED_MEDIA_TYPE_UTP_AUTO) {
		/* Please refer to Table 28B-3 of the 802.3ab-1999 spec. */
		if ((pDevice->FlowControlCap == LM_FLOW_CONTROL_AUTO_PAUSE) ||
		    ((pDevice->FlowControlCap & LM_FLOW_CONTROL_RECEIVE_PAUSE)
		     && (pDevice->
			 FlowControlCap & LM_FLOW_CONTROL_TRANSMIT_PAUSE))) {
			Value32 |= PHY_AN_AD_PAUSE_CAPABLE;
		} else if (pDevice->
			   FlowControlCap & LM_FLOW_CONTROL_TRANSMIT_PAUSE) {
			Value32 |= PHY_AN_AD_ASYM_PAUSE;
		} else if (pDevice->
			   FlowControlCap & LM_FLOW_CONTROL_RECEIVE_PAUSE) {
			Value32 |=
			    PHY_AN_AD_PAUSE_CAPABLE | PHY_AN_AD_ASYM_PAUSE;
		}
	}

	return Value32;
}

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/*    LM_STATUS_FAILURE                                                       */
/*    LM_STATUS_SUCCESS                                                       */
/*                                                                            */
/******************************************************************************/
static LM_STATUS
LM_ForceAutoNegBcm540xPhy (PLM_DEVICE_BLOCK pDevice,
			   LM_REQUESTED_MEDIA_TYPE RequestedMediaType)
{
	LM_MEDIA_TYPE MediaType;
	LM_LINE_SPEED LineSpeed;
	LM_DUPLEX_MODE DuplexMode;
	LM_UINT32 NewPhyCtrl;
	LM_UINT32 Value32;
	LM_UINT32 Cnt;

	/* Get the interface type, line speed, and duplex mode. */
	LM_TranslateRequestedMediaType (RequestedMediaType, &MediaType,
					&LineSpeed, &DuplexMode);

	if (pDevice->RestoreOnWakeUp) {
		LM_WritePhy (pDevice, BCM540X_1000BASET_CTRL_REG, 0);
		pDevice->advertising1000 = 0;
		Value32 = PHY_AN_AD_10BASET_FULL | PHY_AN_AD_10BASET_HALF;
		if (pDevice->WolSpeed == WOL_SPEED_100MB) {
			Value32 |=
			    PHY_AN_AD_100BASETX_FULL | PHY_AN_AD_100BASETX_HALF;
		}
		Value32 |= PHY_AN_AD_PROTOCOL_802_3_CSMA_CD;
		Value32 |= GetPhyAdFlowCntrlSettings (pDevice);
		LM_WritePhy (pDevice, PHY_AN_AD_REG, Value32);
		pDevice->advertising = Value32;
	}
	/* Setup the auto-negotiation advertisement register. */
	else if (LineSpeed == LM_LINE_SPEED_UNKNOWN) {
		/* Setup the 10/100 Mbps auto-negotiation advertisement register. */
		Value32 = PHY_AN_AD_PROTOCOL_802_3_CSMA_CD |
		    PHY_AN_AD_10BASET_HALF | PHY_AN_AD_10BASET_FULL |
		    PHY_AN_AD_100BASETX_FULL | PHY_AN_AD_100BASETX_HALF;
		Value32 |= GetPhyAdFlowCntrlSettings (pDevice);

		LM_WritePhy (pDevice, PHY_AN_AD_REG, Value32);
		pDevice->advertising = Value32;

		/* Advertise 1000Mbps */
		Value32 =
		    BCM540X_AN_AD_1000BASET_HALF | BCM540X_AN_AD_1000BASET_FULL;

#if INCLUDE_5701_AX_FIX
		/* Bug: workaround for CRC error in gigabit mode when we are in */
		/* slave mode.  This will force the PHY to operate in */
		/* master mode. */
		if (pDevice->ChipRevId == T3_CHIP_ID_5701_A0 ||
		    pDevice->ChipRevId == T3_CHIP_ID_5701_B0) {
			Value32 |= BCM540X_CONFIG_AS_MASTER |
			    BCM540X_ENABLE_CONFIG_AS_MASTER;
		}
#endif

		LM_WritePhy (pDevice, BCM540X_1000BASET_CTRL_REG, Value32);
		pDevice->advertising1000 = Value32;
	} else {
		if (LineSpeed == LM_LINE_SPEED_1000MBPS) {
			Value32 = PHY_AN_AD_PROTOCOL_802_3_CSMA_CD;
			Value32 |= GetPhyAdFlowCntrlSettings (pDevice);

			LM_WritePhy (pDevice, PHY_AN_AD_REG, Value32);
			pDevice->advertising = Value32;

			if (DuplexMode != LM_DUPLEX_MODE_FULL) {
				Value32 = BCM540X_AN_AD_1000BASET_HALF;
			} else {
				Value32 = BCM540X_AN_AD_1000BASET_FULL;
			}

			LM_WritePhy (pDevice, BCM540X_1000BASET_CTRL_REG,
				     Value32);
			pDevice->advertising1000 = Value32;
		} else if (LineSpeed == LM_LINE_SPEED_100MBPS) {
			LM_WritePhy (pDevice, BCM540X_1000BASET_CTRL_REG, 0);
			pDevice->advertising1000 = 0;

			if (DuplexMode != LM_DUPLEX_MODE_FULL) {
				Value32 = PHY_AN_AD_100BASETX_HALF;
			} else {
				Value32 = PHY_AN_AD_100BASETX_FULL;
			}

			Value32 |= PHY_AN_AD_PROTOCOL_802_3_CSMA_CD;
			Value32 |= GetPhyAdFlowCntrlSettings (pDevice);

			LM_WritePhy (pDevice, PHY_AN_AD_REG, Value32);
			pDevice->advertising = Value32;
		} else if (LineSpeed == LM_LINE_SPEED_10MBPS) {
			LM_WritePhy (pDevice, BCM540X_1000BASET_CTRL_REG, 0);
			pDevice->advertising1000 = 0;

			if (DuplexMode != LM_DUPLEX_MODE_FULL) {
				Value32 = PHY_AN_AD_10BASET_HALF;
			} else {
				Value32 = PHY_AN_AD_10BASET_FULL;
			}

			Value32 |= PHY_AN_AD_PROTOCOL_802_3_CSMA_CD;
			Value32 |= GetPhyAdFlowCntrlSettings (pDevice);

			LM_WritePhy (pDevice, PHY_AN_AD_REG, Value32);
			pDevice->advertising = Value32;
		}
	}

	/* Force line speed if auto-negotiation is disabled. */
	if (pDevice->DisableAutoNeg && LineSpeed != LM_LINE_SPEED_UNKNOWN) {
		/* This code path is executed only when there is link. */
		pDevice->MediaType = MediaType;
		pDevice->LineSpeed = LineSpeed;
		pDevice->DuplexMode = DuplexMode;

		/* Force line seepd. */
		NewPhyCtrl = 0;
		switch (LineSpeed) {
		case LM_LINE_SPEED_10MBPS:
			NewPhyCtrl |= PHY_CTRL_SPEED_SELECT_10MBPS;
			break;
		case LM_LINE_SPEED_100MBPS:
			NewPhyCtrl |= PHY_CTRL_SPEED_SELECT_100MBPS;
			break;
		case LM_LINE_SPEED_1000MBPS:
			NewPhyCtrl |= PHY_CTRL_SPEED_SELECT_1000MBPS;
			break;
		default:
			NewPhyCtrl |= PHY_CTRL_SPEED_SELECT_1000MBPS;
			break;
		}

		if (DuplexMode == LM_DUPLEX_MODE_FULL) {
			NewPhyCtrl |= PHY_CTRL_FULL_DUPLEX_MODE;
		}

		/* Don't do anything if the PHY_CTRL is already what we wanted. */
		LM_ReadPhy (pDevice, PHY_CTRL_REG, &Value32);
		if (Value32 != NewPhyCtrl) {
			/* Temporary bring the link down before forcing line speed. */
			LM_WritePhy (pDevice, PHY_CTRL_REG,
				     PHY_CTRL_LOOPBACK_MODE);

			/* Wait for link to go down. */
			for (Cnt = 0; Cnt < 15000; Cnt++) {
				MM_Wait (10);

				LM_ReadPhy (pDevice, PHY_STATUS_REG, &Value32);
				LM_ReadPhy (pDevice, PHY_STATUS_REG, &Value32);

				if (!(Value32 & PHY_STATUS_LINK_PASS)) {
					MM_Wait (40);
					break;
				}
			}

			LM_WritePhy (pDevice, PHY_CTRL_REG, NewPhyCtrl);
			MM_Wait (40);
		}
	} else {
		LM_WritePhy (pDevice, PHY_CTRL_REG, PHY_CTRL_AUTO_NEG_ENABLE |
			     PHY_CTRL_RESTART_AUTO_NEG);
	}

	return LM_STATUS_SUCCESS;
}				/* LM_ForceAutoNegBcm540xPhy */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
static LM_STATUS
LM_ForceAutoNeg (PLM_DEVICE_BLOCK pDevice,
		 LM_REQUESTED_MEDIA_TYPE RequestedMediaType)
{
	LM_STATUS LmStatus;

	/* Initialize the phy chip. */
	switch (pDevice->PhyId & PHY_ID_MASK) {
	case PHY_BCM5400_PHY_ID:
	case PHY_BCM5401_PHY_ID:
	case PHY_BCM5411_PHY_ID:
	case PHY_BCM5701_PHY_ID:
	case PHY_BCM5703_PHY_ID:
	case PHY_BCM5704_PHY_ID:
		LmStatus =
		    LM_ForceAutoNegBcm540xPhy (pDevice, RequestedMediaType);
		break;

	default:
		LmStatus = LM_STATUS_FAILURE;
		break;
	}

	return LmStatus;
}				/* LM_ForceAutoNeg */

/******************************************************************************/
/* Description:                                                               */
/*                                                                            */
/* Return:                                                                    */
/******************************************************************************/
LM_STATUS LM_LoadFirmware (PLM_DEVICE_BLOCK pDevice,
			   PT3_FWIMG_INFO pFwImg,
			   LM_UINT32 LoadCpu, LM_UINT32 StartCpu)
{
	LM_UINT32 i;
	LM_UINT32 address;

	if (LoadCpu & T3_RX_CPU_ID) {
		if (LM_HaltCpu (pDevice, T3_RX_CPU_ID) != LM_STATUS_SUCCESS) {
			return LM_STATUS_FAILURE;
		}

		/* First of all clear scrach pad memory */
		for (i = 0; i < T3_RX_CPU_SPAD_SIZE; i += 4) {
			LM_RegWrInd (pDevice, T3_RX_CPU_SPAD_ADDR + i, 0);
		}

		/* Copy code first */
		address = T3_RX_CPU_SPAD_ADDR + (pFwImg->Text.Offset & 0xffff);
		for (i = 0; i <= pFwImg->Text.Length; i += 4) {
			LM_RegWrInd (pDevice, address + i,
				     ((LM_UINT32 *) pFwImg->Text.Buffer)[i /
									 4]);
		}

		address =
		    T3_RX_CPU_SPAD_ADDR + (pFwImg->ROnlyData.Offset & 0xffff);
		for (i = 0; i <= pFwImg->ROnlyData.Length; i += 4) {
			LM_RegWrInd (pDevice, address + i,
				     ((LM_UINT32 *) pFwImg->ROnlyData.
				      Buffer)[i / 4]);
		}

		address = T3_RX_CPU_SPAD_ADDR + (pFwImg->Data.Offset & 0xffff);
		for (i = 0; i <= pFwImg->Data.Length; i += 4) {
			LM_RegWrInd (pDevice, address + i,
				     ((LM_UINT32 *) pFwImg->Data.Buffer)[i /
									 4]);
		}
	}

	if (LoadCpu & T3_TX_CPU_ID) {
		if (LM_HaltCpu (pDevice, T3_TX_CPU_ID) != LM_STATUS_SUCCESS) {
			return LM_STATUS_FAILURE;
		}

		/* First of all clear scrach pad memory */
		for (i = 0; i < T3_TX_CPU_SPAD_SIZE; i += 4) {
			LM_RegWrInd (pDevice, T3_TX_CPU_SPAD_ADDR + i, 0);
		}

		/* Copy code first */
		address = T3_TX_CPU_SPAD_ADDR + (pFwImg->Text.Offset & 0xffff);
		for (i = 0; i <= pFwImg->Text.Length; i += 4) {
			LM_RegWrInd (pDevice, address + i,
				     ((LM_UINT32 *) pFwImg->Text.Buffer)[i /
									 4]);
		}

		address =
		    T3_TX_CPU_SPAD_ADDR + (pFwImg->ROnlyData.Offset & 0xffff);
		for (i = 0; i <= pFwImg->ROnlyData.Length; i += 4) {
			LM_RegWrInd (pDevice, address + i,
				     ((LM_UINT32 *) pFwImg->ROnlyData.
				      Buffer)[i / 4]);
		}

		address = T3_TX_CPU_SPAD_ADDR + (pFwImg->Data.Offset & 0xffff);
		for (i = 0; i <= pFwImg->Data.Length; i += 4) {
			LM_RegWrInd (pDevice, address + i,
				     ((LM_UINT32 *) pFwImg->Data.Buffer)[i /
									 4]);
		}
	}

	if (StartCpu & T3_RX_CPU_ID) {
		/* Start Rx CPU */
		REG_WR (pDevice, rxCpu.reg.state, 0xffffffff);
		REG_WR (pDevice, rxCpu.reg.PC, pFwImg->StartAddress);
		for (i = 0; i < 5; i++) {
			if (pFwImg->StartAddress ==
			    REG_RD (pDevice, rxCpu.reg.PC))
				break;

			REG_WR (pDevice, rxCpu.reg.state, 0xffffffff);
			REG_WR (pDevice, rxCpu.reg.mode, CPU_MODE_HALT);
			REG_WR (pDevice, rxCpu.reg.PC, pFwImg->StartAddress);
			MM_Wait (1000);
		}

		REG_WR (pDevice, rxCpu.reg.state, 0xffffffff);
		REG_WR (pDevice, rxCpu.reg.mode, 0);
	}

	if (StartCpu & T3_TX_CPU_ID) {
		/* Start Tx CPU */
		REG_WR (pDevice, txCpu.reg.state, 0xffffffff);
		REG_WR (pDevice, txCpu.reg.PC, pFwImg->StartAddress);
		for (i = 0; i < 5; i++) {
			if (pFwImg->StartAddress ==
			    REG_RD (pDevice, txCpu.reg.PC))
				break;

			REG_WR (pDevice, txCpu.reg.state, 0xffffffff);
			REG_WR (pDevice, txCpu.reg.mode, CPU_MODE_HALT);
			REG_WR (pDevice, txCpu.reg.PC, pFwImg->StartAddress);
			MM_Wait (1000);
		}

		REG_WR (pDevice, txCpu.reg.state, 0xffffffff);
		REG_WR (pDevice, txCpu.reg.mode, 0);
	}

	return LM_STATUS_SUCCESS;
}

STATIC LM_STATUS LM_HaltCpu (PLM_DEVICE_BLOCK pDevice, LM_UINT32 cpu_number)
{
	LM_UINT32 i;

	if (cpu_number == T3_RX_CPU_ID) {
		for (i = 0; i < 10000; i++) {
			REG_WR (pDevice, rxCpu.reg.state, 0xffffffff);
			REG_WR (pDevice, rxCpu.reg.mode, CPU_MODE_HALT);

			if (REG_RD (pDevice, rxCpu.reg.mode) & CPU_MODE_HALT)
				break;
		}

		REG_WR (pDevice, rxCpu.reg.state, 0xffffffff);
		REG_WR (pDevice, rxCpu.reg.mode, CPU_MODE_HALT);
		MM_Wait (10);
	} else {
		for (i = 0; i < 10000; i++) {
			REG_WR (pDevice, txCpu.reg.state, 0xffffffff);
			REG_WR (pDevice, txCpu.reg.mode, CPU_MODE_HALT);

			if (REG_RD (pDevice, txCpu.reg.mode) & CPU_MODE_HALT)
				break;
		}
	}

	return ((i == 10000) ? LM_STATUS_FAILURE : LM_STATUS_SUCCESS);
}

int LM_BlinkLED (PLM_DEVICE_BLOCK pDevice, LM_UINT32 BlinkDurationSec)
{
	LM_UINT32 Oldcfg;
	int j;
	int ret = 0;

	if (BlinkDurationSec == 0) {
		return 0;
	}
	if (BlinkDurationSec > 120) {
		BlinkDurationSec = 120;
	}

	Oldcfg = REG_RD (pDevice, MacCtrl.LedCtrl);
	for (j = 0; j < BlinkDurationSec * 2; j++) {
		if (j % 2) {
			/* Turn on the LEDs. */
			REG_WR (pDevice, MacCtrl.LedCtrl,
				LED_CTRL_OVERRIDE_LINK_LED |
				LED_CTRL_1000MBPS_LED_ON |
				LED_CTRL_100MBPS_LED_ON |
				LED_CTRL_10MBPS_LED_ON |
				LED_CTRL_OVERRIDE_TRAFFIC_LED |
				LED_CTRL_BLINK_TRAFFIC_LED |
				LED_CTRL_TRAFFIC_LED);
		} else {
			/* Turn off the LEDs. */
			REG_WR (pDevice, MacCtrl.LedCtrl,
				LED_CTRL_OVERRIDE_LINK_LED |
				LED_CTRL_OVERRIDE_TRAFFIC_LED);
		}

#ifndef EMBEDDED
		current->state = TASK_INTERRUPTIBLE;
		if (schedule_timeout (HZ / 2) != 0) {
			ret = -EINTR;
			break;
		}
#else
		udelay (100000);	/* 1s sleep */
#endif
	}
	REG_WR (pDevice, MacCtrl.LedCtrl, Oldcfg);
	return ret;
}

int t3_do_dma (PLM_DEVICE_BLOCK pDevice,
	       LM_PHYSICAL_ADDRESS host_addr_phy, int length, int dma_read)
{
	T3_DMA_DESC dma_desc;
	int i;
	LM_UINT32 dma_desc_addr;
	LM_UINT32 value32;

	REG_WR (pDevice, BufMgr.Mode, 0);
	REG_WR (pDevice, Ftq.Reset, 0);

	dma_desc.host_addr.High = host_addr_phy.High;
	dma_desc.host_addr.Low = host_addr_phy.Low;
	dma_desc.nic_mbuf = 0x2100;
	dma_desc.len = length;
	dma_desc.flags = 0x00000004;	/* Generate Rx-CPU event */

	if (dma_read) {
		dma_desc.cqid_sqid = (T3_QID_RX_BD_COMP << 8) |
		    T3_QID_DMA_HIGH_PRI_READ;
		REG_WR (pDevice, DmaRead.Mode, DMA_READ_MODE_ENABLE);
	} else {
		dma_desc.cqid_sqid = (T3_QID_RX_DATA_COMP << 8) |
		    T3_QID_DMA_HIGH_PRI_WRITE;
		REG_WR (pDevice, DmaWrite.Mode, DMA_WRITE_MODE_ENABLE);
	}

	dma_desc_addr = T3_NIC_DMA_DESC_POOL_ADDR;

	/* Writing this DMA descriptor to DMA memory */
	for (i = 0; i < sizeof (T3_DMA_DESC); i += 4) {
		value32 = *((PLM_UINT32) (((PLM_UINT8) & dma_desc) + i));
		MM_WriteConfig32 (pDevice, T3_PCI_MEM_WIN_ADDR_REG,
				  dma_desc_addr + i);
		MM_WriteConfig32 (pDevice, T3_PCI_MEM_WIN_DATA_REG,
				  cpu_to_le32 (value32));
	}
	MM_WriteConfig32 (pDevice, T3_PCI_MEM_WIN_ADDR_REG, 0);

	if (dma_read)
		REG_WR (pDevice, Ftq.DmaHighReadFtqFifoEnqueueDequeue,
			dma_desc_addr);
	else
		REG_WR (pDevice, Ftq.DmaHighWriteFtqFifoEnqueueDequeue,
			dma_desc_addr);

	for (i = 0; i < 40; i++) {
		if (dma_read)
			value32 =
			    REG_RD (pDevice,
				    Ftq.RcvBdCompFtqFifoEnqueueDequeue);
		else
			value32 =
			    REG_RD (pDevice,
				    Ftq.RcvDataCompFtqFifoEnqueueDequeue);

		if ((value32 & 0xffff) == dma_desc_addr)
			break;

		MM_Wait (10);
	}

	return LM_STATUS_SUCCESS;
}

STATIC LM_STATUS
LM_DmaTest (PLM_DEVICE_BLOCK pDevice, PLM_UINT8 pBufferVirt,
	    LM_PHYSICAL_ADDRESS BufferPhy, LM_UINT32 BufferSize)
{
	int j;
	LM_UINT32 *ptr;
	int dma_success = 0;

	if (T3_ASIC_REV (pDevice->ChipRevId) != T3_ASIC_REV_5700 &&
	    T3_ASIC_REV (pDevice->ChipRevId) != T3_ASIC_REV_5701) {
		return LM_STATUS_SUCCESS;
	}
	while (!dma_success) {
		/* Fill data with incremental patterns */
		ptr = (LM_UINT32 *) pBufferVirt;
		for (j = 0; j < BufferSize / 4; j++)
			*ptr++ = j;

		if (t3_do_dma (pDevice, BufferPhy, BufferSize, 1) ==
		    LM_STATUS_FAILURE) {
			return LM_STATUS_FAILURE;
		}

		MM_Wait (40);
		ptr = (LM_UINT32 *) pBufferVirt;
		/* Fill data with zero */
		for (j = 0; j < BufferSize / 4; j++)
			*ptr++ = 0;

		if (t3_do_dma (pDevice, BufferPhy, BufferSize, 0) ==
		    LM_STATUS_FAILURE) {
			return LM_STATUS_FAILURE;
		}

		MM_Wait (40);
		/* Check for data */
		ptr = (LM_UINT32 *) pBufferVirt;
		for (j = 0; j < BufferSize / 4; j++) {
			if (*ptr++ != j) {
				if ((pDevice->
				     DmaReadWriteCtrl &
				     DMA_CTRL_WRITE_BOUNDARY_MASK)
				    == DMA_CTRL_WRITE_BOUNDARY_DISABLE) {
					pDevice->DmaReadWriteCtrl =
					    (pDevice->
					     DmaReadWriteCtrl &
					     ~DMA_CTRL_WRITE_BOUNDARY_MASK) |
					    DMA_CTRL_WRITE_BOUNDARY_16;
					REG_WR (pDevice,
						PciCfg.DmaReadWriteCtrl,
						pDevice->DmaReadWriteCtrl);
					break;
				} else {
					return LM_STATUS_FAILURE;
				}
			}
		}
		if (j == (BufferSize / 4))
			dma_success = 1;
	}
	return LM_STATUS_SUCCESS;
}
