⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 skgesirq.c

📁 F:worksip2440a board可启动u-boot-like.tar.gz F:worksip2440a board可启动u-boot-like.tar.gz
💻 C
📖 第 1 页 / 共 5 页
字号:
/****************************************************************************** * * Name:	skgesirq.c * Project:	GEnesis, PCI Gigabit Ethernet Adapter * Version:	$Revision: 1.1.1.1 $ * Date:	$Date: 2005/06/27 17:05:01 $ * Purpose:	Special IRQ module * ******************************************************************************//****************************************************************************** * *	(C)Copyright 1998-2003 SysKonnect GmbH. * *	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; either version 2 of the License, or *	(at your option) any later version. * *	The information in this file is provided "AS IS" without warranty. * ******************************************************************************//****************************************************************************** * * History: * *	$Log: skgesirq.c,v $ *	Revision 1.1.1.1  2005/06/27 17:05:01  linuxpark *	Initial import. *	 *	Revision 1.83  2003/02/05 15:10:59  rschmidt *	Fixed setting of PLinkSpeedUsed in SkHWLinkUp() when *	auto-negotiation is disabled. *	Editorial changes. * *	Revision 1.82  2003/01/29 13:34:33  rschmidt *	Added some typecasts to avoid compiler warnings. * *	Revision 1.81  2002/12/05 10:49:51  rschmidt *	Fixed missing Link Down Event for fiber (Bug Id #10768) *	Added reading of cable length when link is up *	Removed testing of unused error bits in PHY ISR *	Editorial changes. * *	Revision 1.80  2002/11/12 17:15:21  rschmidt *	Replaced SkPnmiGetVar() by ...MacStatistic() in SkMacParity(). *	Editorial changes. * *	Revision 1.79  2002/10/14 15:14:51  rschmidt *	Changed clearing of IS_M1_PAR_ERR (MAC 1 Parity Error) in *	SkMacParity() depending on GIChipRev (HW-Bug #8). *	Added error messages for GPHY Auto-Negotiation Error and *	FIFO Overflow/Underrun in SkPhyIsrGmac(). *	Editorial changes. * *	Revision 1.78  2002/10/10 15:54:29  mkarl *	changes for PLinkSpeedUsed * *	Revision 1.77  2002/09/12 08:58:51  rwahl *	Retrieve counters needed for XMAC errata workarounds directly because *	PNMI returns corrected counter values (e.g. #10620). * *	Revision 1.76  2002/08/16 15:21:54  rschmidt *	Replaced all if(GIChipId == CHIP_ID_GENESIS) with new entry GIGenesis. *	Replaced wrong 1st para pAC with IoC in SK_IN/OUT macros. *	Editorial changes. * *	Revision 1.75  2002/08/12 13:50:47  rschmidt *	Changed clearing of IS_M1_PAR_ERR (MAC 1 Parity Error) in *	SkMacParity() by GMF_CLI_TX_FC instead of GMF_CLI_TX_PE (HW-Bug #8). *	Added clearing of IS_IRQ_TIST_OV and IS_IRQ_SENSOR in SkGeHwErr(). *	Corrected handling of Link Up and Auto-Negotiation Over for GPHY. *	in SkGePortCheckUpGmac(). *	Editorial changes. * *	Revision 1.74  2002/08/08 16:17:04  rschmidt *	Added PhyType check for SK_HWEV_SET_ROLE event (copper only) *	Changed Link Up check reading PHY Specific Status (YUKON) *	Editorial changes * *	Revision 1.73  2002/07/15 18:36:53  rwahl *	Editorial changes. * *	Revision 1.72  2002/07/15 15:46:26  rschmidt *	Added new event: SK_HWEV_SET_SPEED *	Editorial changes * *	Revision 1.71  2002/06/10 09:34:19  rschmidt *	Editorial changes * *	Revision 1.70  2002/06/05 08:29:18  rschmidt *	SkXmRxTxEnable() replaced by SkMacRxTxEnable(). *	Editorial changes. * *	Revision 1.69  2002/04/25 13:03:49  rschmidt *	Changes for handling YUKON. *	Use of #ifdef OTHER_PHY to eliminate code for unused Phy types. *	Replaced all XMAC-access macros by functions: SkMacRxTxDisable(), *	SkMacIrqDisable(). *	Added handling for GMAC FIFO in SkMacParity(). *	Replaced all SkXm...() functions with SkMac...() to handle also *	YUKON's GMAC. *	Macros for XMAC PHY access PHY_READ(), PHY_WRITE() replaced *	by functions SkXmPhyRead(), SkXmPhyWrite(). *	Disabling all PHY interrupts moved to SkMacIrqDisable(). *	Added handling for GPHY IRQ in SkGeSirqIsr(). *	Removed status parameter from MAC IRQ handler SkMacIrq(). *	Added SkGePortCheckUpGmac(), SkPhyIsrGmac() for GMAC. *	Editorial changes * *	Revision 1.68  2002/02/26 15:24:53  rwahl *	Fix: no link with manual configuration (#10673). The previous fix for *	#10639 was removed. So for RLMT mode = CLS the RLMT may switch to *	misconfigured port. It should not occur for the other RLMT modes. * *	Revision 1.67  2001/11/20 09:19:58  rwahl *	Reworked bugfix #10639 (no dependency to RLMT mode). * *	Revision 1.66  2001/10/26 07:52:53  afischer *	Port switching bug in `check local link` mode * *	Revision 1.65  2001/02/23 13:41:51  gklug *	fix: PHYS2INST should be used correctly for Dual Net operation *	chg: do no longer work with older PNMI * *	Revision 1.64  2001/02/15 11:27:04  rassmann *	Working with RLMT v1 if SK_MAX_NETS undefined. * *	Revision 1.63  2001/02/06 10:44:23  mkunz *	- NetIndex added to interface functions of pnmi V4 with dual net support * *	Revision 1.62  2001/01/31 15:31:41  gklug *	fix: problem with autosensing an SR8800 switch * *	Revision 1.61  2000/11/09 11:30:09  rassmann *	WA: Waiting after releasing reset until BCom chip is accessible. * *	Revision 1.60  2000/10/18 12:37:48  cgoos *	Reinserted the comment for version 1.56. * *	Revision 1.59  2000/10/18 12:22:20  cgoos *	Added workaround for half duplex hangup. * *	Revision 1.58  2000/09/28 13:06:04  gklug *	fix: BCom may NOT be touched if XMAC is in RESET state * *	Revision 1.57  2000/09/08 12:38:39  cgoos *	Added forgotten variable declaration. * *	Revision 1.56  2000/09/08 08:12:13  cgoos *	Changed handling of parity errors in SkGeHwErr (correct reset of error). * *	Revision 1.55  2000/06/19 08:36:25  cgoos *	Changed comment. * *	Revision 1.54  2000/05/22 08:45:57  malthoff *	Fix: #10523 is valid for all BCom PHYs. * *	Revision 1.53  2000/05/19 10:20:30  cgoos *	Removed Solaris debug output code. * *	Revision 1.52  2000/05/19 10:19:37  cgoos *	Added PHY state check in HWLinkDown. *	Move PHY interrupt code to IS_EXT_REG case in SkGeSirqIsr. * *	Revision 1.51  2000/05/18 05:56:20  cgoos *	Fixed typo. * *	Revision 1.50  2000/05/17 12:49:49  malthoff *	Fixes BCom link bugs (#10523). * *	Revision 1.49  1999/12/17 11:02:50  gklug *	fix: read PHY_STAT of Broadcom chip more often to assure good status * *	Revision 1.48  1999/12/06 10:01:17  cgoos *	Added SET function for Role. * *	Revision 1.47  1999/11/22 13:34:24  cgoos *	Changed license header to GPL. * *	Revision 1.46  1999/09/16 10:30:07  cgoos *	Removed debugging output statement from Linux. * *	Revision 1.45  1999/09/16 07:32:55  cgoos *	Fixed dual-port copperfield bug (PHY_READ from resetted port). *	Removed some unused variables. * *	Revision 1.44  1999/08/03 15:25:04  cgoos *	Removed workaround for disabled interrupts in half duplex mode. * *	Revision 1.43  1999/08/03 14:27:58  cgoos *	Removed SENSE mode code from SkGePortCheckUpBcom. * *	Revision 1.42  1999/07/26 09:16:54  cgoos *	Added some typecasts to avoid compiler warnings. * *	Revision 1.41  1999/05/19 07:28:59  cgoos *	Changes for 1000Base-T. * *	Revision 1.40  1999/04/08 13:59:39  gklug *	fix: problem with 3Com switches endless RESTARTs * *	Revision 1.39  1999/03/08 10:10:52  gklug *	fix: AutoSensing did switch to next mode even if LiPa indicated offline * *	Revision 1.38  1999/03/08 09:49:03  gklug *	fix: Bug using pAC instead of IoC, causing AIX problems *	fix: change compare for Linux compiler bug workaround * *	Revision 1.37  1999/01/28 14:51:33  gklug *	fix: monitor for autosensing and extra RESETS the RX on wire counters * *	Revision 1.36  1999/01/22 09:19:55  gklug *	fix: Init DupMode and InitPauseMd are now called in RxTxEnable * *	Revision 1.35  1998/12/11 15:22:59  gklug *	chg: autosensing: check for receive if manual mode was guessed *	chg: simplified workaround for XMAC errata *	chg: wait additional 100 ms before link goes up. *	chg: autoneg timeout to 600 ms *	chg: restart autoneg even if configured to autonegotiation * *	Revision 1.34  1998/12/10 10:33:14  gklug *	add: more debug messages *	fix: do a new InitPhy if link went down (AutoSensing problem) *	chg: Check for zero shorts if link is NOT up *	chg: reset Port if link goes down *	chg: wait additional 100 ms when link comes up to check shorts *	fix: dummy read extended autoneg status to prevent link going down immediately * *	Revision 1.33  1998/12/07 12:18:29  gklug *	add: refinement of autosense mode: take into account the autoneg cap of LiPa * *	Revision 1.32  1998/12/07 07:11:21  gklug *	fix: compiler warning * *	Revision 1.31  1998/12/02 09:29:05  gklug *	fix: WA XMAC Errata: FCSCt check was not correct. *	fix: WA XMAC Errata: Prec Counter were NOT updated in case of short checks. *	fix: Clear Stat : now clears the Prev counters of all known Ports * *	Revision 1.30  1998/12/01 10:54:15  gklug *	dd: workaround for XMAC errata changed. Check RX count and CRC err Count, too. * *	Revision 1.29  1998/12/01 10:01:53  gklug *	fix: if MAC IRQ occurs during port down, this will be handled correctly * *	Revision 1.28  1998/11/26 16:22:11  gklug *	fix: bug in autosense if manual modes are used * *	Revision 1.27  1998/11/26 15:50:06  gklug *	fix: PNMI needs to set PLinkModeConf * *	Revision 1.26  1998/11/26 14:51:58  gklug *	add: AutoSensing functionalty * *	Revision 1.25  1998/11/26 07:34:37  gklug *	fix: Init PrevShorts when restarting port due to Link connection * *	Revision 1.24  1998/11/25 10:57:32  gklug *	fix: remove unreferenced local vars * *	Revision 1.23  1998/11/25 08:26:40  gklug *	fix: don't do a RESET on a starting or stopping port * *	Revision 1.22  1998/11/24 13:29:44  gklug *	add: Workaround for MAC parity errata * *	Revision 1.21  1998/11/18 15:31:06  gklug *	fix: lint bugs * *	Revision 1.20  1998/11/18 12:58:54  gklug *	fix: use PNMI query instead of hardware access * *	Revision 1.19  1998/11/18 12:54:55  gklug *	chg: add new workaround for XMAC Errata *	add: short event counter monitoring on active link too * *	Revision 1.18  1998/11/13 14:27:41  malthoff *	Bug Fix: Packet Arbiter Timeout was not cleared correctly *	for timeout on TX1 and TX2. * *	Revision 1.17  1998/11/04 07:01:59  cgoos *	Moved HW link poll sequence. *	Added call to SkXmRxTxEnable. * *	Revision 1.16  1998/11/03 13:46:03  gklug *	add: functionality of SET_LMODE and SET_FLOW_MODE *	fix: send RLMT LinkDown event when Port stop is given with LinkUp * *	Revision 1.15  1998/11/03 12:56:47  gklug *	fix: Needs more events * *	Revision 1.14  1998/10/30 07:36:35  gklug *	rmv: unnecessary code * *	Revision 1.13  1998/10/29 15:21:57  gklug *	add: Poll link feature for activating HW link *	fix: Deactivate HWLink when Port STOP is given * *	Revision 1.12  1998/10/28 07:38:57  cgoos *	Checking link status at begin of SkHWLinkUp. * *	Revision 1.11  1998/10/22 09:46:50  gklug *	fix SysKonnectFileId typo * *	Revision 1.10  1998/10/14 13:57:47  gklug *	add: Port start/stop event * *	Revision 1.9  1998/10/14 05:48:29  cgoos *	Added definition for Para. * *	Revision 1.8  1998/10/14 05:40:09  gklug *	add: Hardware Linkup signal used * *	Revision 1.7  1998/10/09 06:50:20  malthoff *	Remove ID_sccs by SysKonnectFileId. * *	Revision 1.6  1998/10/08 09:11:49  gklug *	add: clear IRQ commands * *	Revision 1.5  1998/10/02 14:27:35  cgoos *	Fixed some typos and wrong event names. * *	Revision 1.4  1998/10/02 06:24:17  gklug *	add: HW error function *	fix: OUT macros * *	Revision 1.3  1998/10/01 07:03:00  gklug *	add: ISR for the usual interrupt source register * *	Revision 1.2  1998/09/03 13:50:33  gklug *	add: function prototypes * *	Revision 1.1  1998/08/27 11:50:21  gklug *	initial revision * * * ******************************************************************************/#include <config.h>#ifdef CONFIG_SK98/* *	Special Interrupt handler * *	The following abstract should show how this module is included *	in the driver path: * *	In the ISR of the driver the bits for frame transmission complete and *	for receive complete are checked and handled by the driver itself. *	The bits of the slow path mask are checked after that and then the *	entry into the so-called "slow path" is prepared. It is an implementors *	decision whether this is executed directly or just scheduled by *	disabling the mask. In the interrupt service routine some events may be *	generated, so it would be a good idea to call the EventDispatcher *	right after this ISR. * *	The Interrupt source register of the adapter is NOT read by this module. *  SO if the drivers implementor needs a while loop around the *	slow data paths interrupt bits, he needs to call the SkGeSirqIsr() for *	each loop entered. * *	However, the MAC Interrupt status registers are read in a while loop. * */static const char SysKonnectFileId[] =	"$Id: skgesirq.c,v 1.1.1.1 2005/06/27 17:05:01 linuxpark Exp $" ;#include "h/skdrv1st.h"		/* Driver Specific Definitions */#include "h/skgepnmi.h"		/* PNMI Definitions */#include "h/skrlmt.h"		/* RLMT Definitions */#include "h/skdrv2nd.h"		/* Adapter Control and Driver specific Def. *//* local function prototypes */static int	SkGePortCheckUpXmac(SK_AC*, SK_IOC, int);static int	SkGePortCheckUpBcom(SK_AC*, SK_IOC, int);static int	SkGePortCheckUpGmac(SK_AC*, SK_IOC, int);static void	SkPhyIsrBcom(SK_AC*, SK_IOC, int, SK_U16);static void	SkPhyIsrGmac(SK_AC*, SK_IOC, int, SK_U16);#ifdef OTHER_PHYstatic int	SkGePortCheckUpLone(SK_AC*, SK_IOC, int);static int	SkGePortCheckUpNat(SK_AC*, SK_IOC, int);static void	SkPhyIsrLone(SK_AC*, SK_IOC, int, SK_U16);#endif /* OTHER_PHY *//* * array of Rx counter from XMAC which are checked * in AutoSense mode to check whether a link is not able to auto-negotiate. */static const SK_U16 SkGeRxRegs[]= {	XM_RXF_64B,	XM_RXF_127B,	XM_RXF_255B,	XM_RXF_511B,	XM_RXF_1023B,	XM_RXF_MAX_SZ} ;#ifdef __C2MAN__/* *	Special IRQ function * *	General Description: * */intro(){}#endif/* Define return codes of SkGePortCheckUp and CheckShort */#define	SK_HW_PS_NONE		0	/* No action needed */#define	SK_HW_PS_RESTART	1	/* Restart needed */#define	SK_HW_PS_LINK		2	/* Link Up actions needed *//****************************************************************************** * *	SkHWInitDefSense() - Default Autosensing mode initialization * * Description: sets the PLinkMode for HWInit * * Returns: N/A */static void SkHWInitDefSense(SK_AC	*pAC,	/* adapter context */SK_IOC	IoC,	/* IO context */int		Port)	/* Port Index (MAC_1 + n) */{	SK_GEPORT	*pPrt;		/* GIni Port struct pointer */	pPrt = &pAC->GIni.GP[Port];	pPrt->PAutoNegTimeOut = 0;	if (pPrt->PLinkModeConf != SK_LMODE_AUTOSENSE) {		pPrt->PLinkMode = pPrt->PLinkModeConf;		return;	}	SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ,		("AutoSensing: First mode %d on Port %d\n",		(int)SK_LMODE_AUTOFULL, Port));	pPrt->PLinkMode = SK_LMODE_AUTOFULL;	return;}	/* SkHWInitDefSense *//****************************************************************************** * *	SkHWSenseGetNext() - Get Next Autosensing Mode * * Description: gets the appropriate next mode * * Note: * */SK_U8 SkHWSenseGetNext(SK_AC	*pAC,	/* adapter context */SK_IOC	IoC,	/* IO context */int		Port)	/* Port Index (MAC_1 + n) */{	SK_GEPORT	*pPrt;		/* GIni Port struct pointer */	pPrt = &pAC->GIni.GP[Port];	pPrt->PAutoNegTimeOut = 0;	if (pPrt->PLinkModeConf != SK_LMODE_AUTOSENSE) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -