Commit e06cf18f authored by Mirko Lindner's avatar Mirko Lindner Committed by Stephen Hemminger

[PATCH] sk98lin-2.6: Kernel Update to Driver Version v6.21

Patch 1/4 (Update to version 6.21)
* Add: Common module update
* Add: New function for PCI initialization (SkGeInitPCI)
* Add: Yukon Plus changes (ChipID, PCI...)
* Add: Code for DIAG tool
* Fix: Problems while unloading the linux driver
* Fix: PrefPort=B not allowed on single NICs
* Fix: Fixed Linux System crash when using vlans
* Fix: Remove useless register_netdev
* Fix: Initalize Board before network configuration
* Fix: Modifications regarding try_module_get() and capable()
parent 4576b4fa
...@@ -76,7 +76,7 @@ endif ...@@ -76,7 +76,7 @@ endif
# SK_DBGCAT_DRV_INT_SRC 0x04000000 interrupts sources # SK_DBGCAT_DRV_INT_SRC 0x04000000 interrupts sources
# SK_DBGCAT_DRV_EVENT 0x08000000 driver events # SK_DBGCAT_DRV_EVENT 0x08000000 driver events
EXTRA_CFLAGS += -Idrivers/net/sk98lin -DSK_USE_CSUM -DGENESIS -DYUKON $(DBGDEF) $(SKPARAM) EXTRA_CFLAGS += -Idrivers/net/sk98lin -DSK_DIAG_SUPPORT -DSK_USE_CSUM -DGENESIS -DYUKON $(DBGDEF) $(SKPARAM)
clean: clean:
rm -f core *.o *.a *.s rm -f core *.o *.a *.s
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* *
* Name: skcsum.h * Name: skcsum.h
* Project: GEnesis - SysKonnect SK-NET Gigabit Ethernet (SK-98xx) * Project: GEnesis - SysKonnect SK-NET Gigabit Ethernet (SK-98xx)
* Version: $Revision: 1.9 $ * Version: $Revision: 1.10 $
* Date: $Date: 2001/02/06 11:21:39 $ * Date: $Date: 2003/08/20 13:59:57 $
* Purpose: Store/verify Internet checksum in send/receive packets. * Purpose: Store/verify Internet checksum in send/receive packets.
* *
******************************************************************************/ ******************************************************************************/
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
* History: * History:
* *
* $Log: skcsum.h,v $ * $Log: skcsum.h,v $
* Revision 1.10 2003/08/20 13:59:57 mschmid
* Changed notation of #ifndef SkCsCalculateChecksum to
* #ifndef SK_CS_CALCULATE_CHECKSUM
*
* Revision 1.9 2001/02/06 11:21:39 rassmann * Revision 1.9 2001/02/06 11:21:39 rassmann
* Editorial changes. * Editorial changes.
* *
...@@ -226,11 +230,11 @@ typedef struct s_CsPacketInfo { ...@@ -226,11 +230,11 @@ typedef struct s_CsPacketInfo {
/* function prototypes ********************************************************/ /* function prototypes ********************************************************/
#ifndef SkCsCalculateChecksum #ifndef SK_CS_CALCULATE_CHECKSUM
extern unsigned SkCsCalculateChecksum( extern unsigned SkCsCalculateChecksum(
void *pData, void *pData,
unsigned Length); unsigned Length);
#endif #endif /* SK_CS_CALCULATE_CHECKSUM */
extern int SkCsEvent( extern int SkCsEvent(
SK_AC *pAc, SK_AC *pAc,
......
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
* *
* Name: skdrv1st.h * Name: skdrv1st.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter * Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.1 $ * Version: $Revision: 1.4 $
* Date: $Date: 2003/07/21 07:22:43 $ * Date: $Date: 2003/11/12 14:28:14 $
* Purpose: First header file for driver and all other modules * Purpose: First header file for driver and all other modules
* *
******************************************************************************/ ******************************************************************************/
/****************************************************************************** /******************************************************************************
* *
* (C)Copyright 1998-2003 SysKonnect GmbH. * (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -26,6 +27,15 @@ ...@@ -26,6 +27,15 @@
* History: * History:
* *
* $Log: skdrv1st.h,v $ * $Log: skdrv1st.h,v $
* Revision 1.4 2003/11/12 14:28:14 rroesler
* Fix: use dedicated ip_fast_csum() on X86_64 systems
*
* Revision 1.3 2003/10/07 08:16:52 mlindner
* Fix: Copyright changes
*
* Revision 1.2 2003/09/29 12:05:59 mlindner
* Fix: Added define SK_CS_CALCULSTE_CHECKSUM
*
* Revision 1.1 2003/07/21 07:22:43 rroesler * Revision 1.1 2003/07/21 07:22:43 rroesler
* Fix: Re-Enter after CVS crash * Fix: Re-Enter after CVS crash
* *
...@@ -110,6 +120,9 @@ ...@@ -110,6 +120,9 @@
#ifndef __INC_SKDRV1ST_H #ifndef __INC_SKDRV1ST_H
#define __INC_SKDRV1ST_H #define __INC_SKDRV1ST_H
/* Check kernel version */
#include <linux/version.h>
typedef struct s_AC SK_AC; typedef struct s_AC SK_AC;
/* Set card versions */ /* Set card versions */
...@@ -124,17 +137,15 @@ typedef struct s_AC SK_AC; ...@@ -124,17 +137,15 @@ typedef struct s_AC SK_AC;
#define SK_PNMI_READ_U32(p,v) memcpy((char*)&(v),(char*)(p),4) #define SK_PNMI_READ_U32(p,v) memcpy((char*)&(v),(char*)(p),4)
#define SK_PNMI_READ_U64(p,v) memcpy((char*)&(v),(char*)(p),8) #define SK_PNMI_READ_U64(p,v) memcpy((char*)&(v),(char*)(p),8)
#define SkCsCalculateChecksum(p,l) ((~ip_compute_csum(p, l)) & 0xffff)
#define SK_ADDR_EQUAL(a1,a2) (!memcmp(a1,a2,6)) #define SK_ADDR_EQUAL(a1,a2) (!memcmp(a1,a2,6))
#if !defined(__OPTIMIZE__) || !defined(__KERNEL__) #if !defined(__OPTIMIZE__) || !defined(__KERNEL__)
#warning You must compile this file with the correct options! #warning You must compile this file with the correct options!
#warning See the last lines of the source file. #warning See the last lines of the source file.
#error You must compile this driver with "-O". #error You must compile this driver with "-O".
#endif #endif
#include <linux/version.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
...@@ -154,6 +165,13 @@ typedef struct s_AC SK_AC; ...@@ -154,6 +165,13 @@ typedef struct s_AC SK_AC;
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <net/checksum.h> #include <net/checksum.h>
#define SK_CS_CALCULATE_CHECKSUM
#ifndef CONFIG_X86_64
#define SkCsCalculateChecksum(p,l) ((~ip_compute_csum(p, l)) & 0xffff)
#else
#define SkCsCalculateChecksum(p,l) ((~ip_fast_csum(p, l)) & 0xffff)
#endif
#include "h/sktypes.h" #include "h/sktypes.h"
#include "h/skerror.h" #include "h/skerror.h"
#include "h/skdebug.h" #include "h/skdebug.h"
......
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
* *
* Name: skdrv2nd.h * Name: skdrv2nd.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter * Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.3 $ * Version: $Revision: 1.10 $
* Date: $Date: 2003/08/12 16:51:18 $ * Date: $Date: 2003/12/11 16:04:45 $
* Purpose: Second header file for driver and all other modules * Purpose: Second header file for driver and all other modules
* *
******************************************************************************/ ******************************************************************************/
/****************************************************************************** /******************************************************************************
* *
* (C)Copyright 1998-2003 SysKonnect GmbH. * (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -26,6 +27,27 @@ ...@@ -26,6 +27,27 @@
* History: * History:
* *
* $Log: skdrv2nd.h,v $ * $Log: skdrv2nd.h,v $
* Revision 1.10 2003/12/11 16:04:45 mlindner
* Add: New pnmi data backup structure
*
* Revision 1.9 2003/11/10 09:31:37 rroesler
* Add: pnmiBackup structure for DIAG backup restore
*
* Revision 1.8 2003/10/22 14:18:32 rroesler
* Fix: DIAG handling for DualNet cards
*
* Revision 1.7 2003/10/07 09:34:59 mlindner
* Add: New defines for lower and upper range values (interrupt moderation)
*
* Revision 1.6 2003/10/07 08:16:51 mlindner
* Fix: Copyright changes
*
* Revision 1.5 2003/09/01 13:10:39 rroesler
* Add: Prototypes for DIAG Attach/Detach functions
*
* Revision 1.4 2003/09/01 12:33:38 rroesler
* Add: Defines for optimized DIAG interaction
*
* Revision 1.3 2003/08/12 16:51:18 mlindner * Revision 1.3 2003/08/12 16:51:18 mlindner
* Fix: UDP and TCP Proto checks * Fix: UDP and TCP Proto checks
* Fix: UDP header offset * Fix: UDP header offset
...@@ -206,6 +228,11 @@ extern int SkPciWriteCfgWord(SK_AC*, int, SK_U16); ...@@ -206,6 +228,11 @@ extern int SkPciWriteCfgWord(SK_AC*, int, SK_U16);
extern int SkPciWriteCfgByte(SK_AC*, int, SK_U8); extern int SkPciWriteCfgByte(SK_AC*, int, SK_U8);
extern int SkDrvEvent(SK_AC*, SK_IOC IoC, SK_U32, SK_EVPARA); extern int SkDrvEvent(SK_AC*, SK_IOC IoC, SK_U32, SK_EVPARA);
#ifdef SK_DIAG_SUPPORT
extern int SkDrvEnterDiagMode(SK_AC *pAc);
extern int SkDrvLeaveDiagMode(SK_AC *pAc);
#endif
struct s_DrvRlmtMbuf { struct s_DrvRlmtMbuf {
SK_MBUF *pNext; /* Pointer to next RLMT Mbuf. */ SK_MBUF *pNext; /* Pointer to next RLMT Mbuf. */
SK_U8 *pData; /* Data buffer (virtually contig.). */ SK_U8 *pData; /* Data buffer (virtually contig.). */
...@@ -247,6 +274,7 @@ struct s_DrvRlmtMbuf { ...@@ -247,6 +274,7 @@ struct s_DrvRlmtMbuf {
#define SK_IOCTL_SETMIB (SK_IOCTL_BASE + 1) #define SK_IOCTL_SETMIB (SK_IOCTL_BASE + 1)
#define SK_IOCTL_PRESETMIB (SK_IOCTL_BASE + 2) #define SK_IOCTL_PRESETMIB (SK_IOCTL_BASE + 2)
#define SK_IOCTL_GEN (SK_IOCTL_BASE + 3) #define SK_IOCTL_GEN (SK_IOCTL_BASE + 3)
#define SK_IOCTL_DIAG (SK_IOCTL_BASE + 4)
typedef struct s_IOCTL SK_GE_IOCTL; typedef struct s_IOCTL SK_GE_IOCTL;
...@@ -462,6 +490,9 @@ struct s_RxPort { ...@@ -462,6 +490,9 @@ struct s_RxPort {
#define C_INTS_PER_SEC_DEFAULT 2000 #define C_INTS_PER_SEC_DEFAULT 2000
#define C_INT_MOD_ENABLE_PERCENTAGE 50 /* if higher 50% enable */ #define C_INT_MOD_ENABLE_PERCENTAGE 50 /* if higher 50% enable */
#define C_INT_MOD_DISABLE_PERCENTAGE 50 /* if lower 50% disable */ #define C_INT_MOD_DISABLE_PERCENTAGE 50 /* if lower 50% disable */
#define C_INT_MOD_IPS_LOWER_RANGE 30
#define C_INT_MOD_IPS_UPPER_RANGE 40000
typedef struct s_DynIrqModInfo DIM_INFO; typedef struct s_DynIrqModInfo DIM_INFO;
struct s_DynIrqModInfo { struct s_DynIrqModInfo {
...@@ -493,6 +524,11 @@ typedef struct s_PerStrm PER_STRM; ...@@ -493,6 +524,11 @@ typedef struct s_PerStrm PER_STRM;
#define SK_ALLOC_IRQ 0x00000001 #define SK_ALLOC_IRQ 0x00000001
#ifdef SK_DIAG_SUPPORT
#define DIAG_ACTIVE 1
#define DIAG_NOTACTIVE 0
#endif
/**************************************************************************** /****************************************************************************
* Per board structure / Adapter Context structure: * Per board structure / Adapter Context structure:
* Allocated within attach(9e) and freed within detach(9e). * Allocated within attach(9e) and freed within detach(9e).
...@@ -563,9 +599,18 @@ struct s_AC { ...@@ -563,9 +599,18 @@ struct s_AC {
int PortUp; int PortUp;
int PortDown; int PortDown;
int ChipsetType; /* Chipset family type int ChipsetType; /* Chipset family type
* 0 == Genesis family support * 0 == Genesis family support
* 1 == Yukon family support * 1 == Yukon family support
*/ */
#ifdef SK_DIAG_SUPPORT
SK_U32 DiagModeActive; /* is diag active? */
SK_BOOL DiagFlowCtrl; /* for control purposes */
SK_PNMI_STRUCT_DATA PnmiBackup; /* backup structure for all Pnmi-Data */
SK_BOOL WasIfUp[SK_MAX_MACS]; /* for OpenClose while
* DIAG is busy with NIC
*/
#endif
}; };
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* *
* Name: skgehw.h * Name: skgehw.h
* Project: Gigabit Ethernet Adapters, Common Modules * Project: Gigabit Ethernet Adapters, Common Modules
* Version: $Revision: 1.53 $ * Version: $Revision: 1.56 $
* Date: $Date: 2003/07/04 12:39:01 $ * Date: $Date: 2003/09/23 09:01:00 $
* Purpose: Defines and Macros for the Gigabit Ethernet Adapter Product Family * Purpose: Defines and Macros for the Gigabit Ethernet Adapter Product Family
* *
******************************************************************************/ ******************************************************************************/
...@@ -26,6 +26,17 @@ ...@@ -26,6 +26,17 @@
* *
* History: * History:
* $Log: skgehw.h,v $ * $Log: skgehw.h,v $
* Revision 1.56 2003/09/23 09:01:00 malthoff
* Minor change: Define I2C device size constants as long.
*
* Revision 1.55 2003/09/16 14:03:34 rschmidt
* Added define for YUKON-Lite Rev. A1,A2 Chip Revision
* Moved defines for PHY power down modes to skgeinit.h
* Editorial changes
*
* Revision 1.54 2003/09/16 07:37:58 mschmid
* Added defines for Marvell PHY low power modes
*
* Revision 1.53 2003/07/04 12:39:01 rschmidt * Revision 1.53 2003/07/04 12:39:01 rschmidt
* Added SK_FAR to pointers in XM_IN32() and GM_IN32() macros (for PXE) * Added SK_FAR to pointers in XM_IN32() and GM_IN32() macros (for PXE)
* Editorial changes * Editorial changes
...@@ -84,7 +95,7 @@ ...@@ -84,7 +95,7 @@
* Editorial changes * Editorial changes
* *
* Revision 1.39 2002/06/10 09:37:07 rschmidt * Revision 1.39 2002/06/10 09:37:07 rschmidt
* Added macros for the ADDR-Modul * Added macros for the ADDR-Module
* *
* Revision 1.38 2002/06/05 08:15:19 rschmidt * Revision 1.38 2002/06/05 08:15:19 rschmidt
* Added defines for WOL Registers * Added defines for WOL Registers
...@@ -628,12 +639,12 @@ extern "C" { ...@@ -628,12 +639,12 @@ extern "C" {
#define B2_FAR 0x0120 /* 32 bit Flash-Prom Addr Reg/Cnt */ #define B2_FAR 0x0120 /* 32 bit Flash-Prom Addr Reg/Cnt */
#define B2_FDP 0x0124 /* 8 bit Flash-Prom Data Port */ #define B2_FDP 0x0124 /* 8 bit Flash-Prom Data Port */
/* 0x0125 - 0x0127: reserved */ /* 0x0125 - 0x0127: reserved */
#define B2_LD_CRTL 0x0128 /* 8 bit EPROM loader control register */ #define B2_LD_CTRL 0x0128 /* 8 bit EPROM loader control register */
#define B2_LD_TEST 0x0129 /* 8 bit EPROM loader test register */ #define B2_LD_TEST 0x0129 /* 8 bit EPROM loader test register */
/* 0x012a - 0x012f: reserved */ /* 0x012a - 0x012f: reserved */
#define B2_TI_INI 0x0130 /* 32 bit Timer Init Value */ #define B2_TI_INI 0x0130 /* 32 bit Timer Init Value */
#define B2_TI_VAL 0x0134 /* 32 bit Timer Value */ #define B2_TI_VAL 0x0134 /* 32 bit Timer Value */
#define B2_TI_CRTL 0x0138 /* 8 bit Timer Control */ #define B2_TI_CTRL 0x0138 /* 8 bit Timer Control */
#define B2_TI_TEST 0x0139 /* 8 Bit Timer Test */ #define B2_TI_TEST 0x0139 /* 8 Bit Timer Test */
/* 0x013a - 0x013f: reserved */ /* 0x013a - 0x013f: reserved */
#define B2_IRQM_INI 0x0140 /* 32 bit IRQ Moderation Timer Init Reg.*/ #define B2_IRQM_INI 0x0140 /* 32 bit IRQ Moderation Timer Init Reg.*/
...@@ -1021,7 +1032,7 @@ extern "C" { ...@@ -1021,7 +1032,7 @@ extern "C" {
/* Bit 7: reserved */ /* Bit 7: reserved */
#define RAP_RAP 0x3f /* Bit 6..0: 0 = block 0,..,6f = block 6f */ #define RAP_RAP 0x3f /* Bit 6..0: 0 = block 0,..,6f = block 6f */
/* B0_CTST 16 bit Control/Status register */ /* B0_CTST 16 bit Control/Status register */
/* Bit 15..14: reserved */ /* Bit 15..14: reserved */
#define CS_CLK_RUN_HOT BIT_13S /* CLK_RUN hot m. (YUKON-Lite only) */ #define CS_CLK_RUN_HOT BIT_13S /* CLK_RUN hot m. (YUKON-Lite only) */
#define CS_CLK_RUN_RST BIT_12S /* CLK_RUN reset (YUKON-Lite only) */ #define CS_CLK_RUN_RST BIT_12S /* CLK_RUN reset (YUKON-Lite only) */
...@@ -1038,7 +1049,7 @@ extern "C" { ...@@ -1038,7 +1049,7 @@ extern "C" {
#define CS_RST_CLR BIT_1S /* Clear Software reset */ #define CS_RST_CLR BIT_1S /* Clear Software reset */
#define CS_RST_SET BIT_0S /* Set Software reset */ #define CS_RST_SET BIT_0S /* Set Software reset */
/* B0_LED 8 Bit LED register */ /* B0_LED 8 Bit LED register */
/* Bit 7.. 2: reserved */ /* Bit 7.. 2: reserved */
#define LED_STAT_ON BIT_1S /* Status LED on */ #define LED_STAT_ON BIT_1S /* Status LED on */
#define LED_STAT_OFF BIT_0S /* Status LED off */ #define LED_STAT_OFF BIT_0S /* Status LED off */
...@@ -1053,9 +1064,9 @@ extern "C" { ...@@ -1053,9 +1064,9 @@ extern "C" {
#define PC_VCC_ON BIT_1 /* Switch VCC On */ #define PC_VCC_ON BIT_1 /* Switch VCC On */
#define PC_VCC_OFF BIT_0 /* Switch VCC Off */ #define PC_VCC_OFF BIT_0 /* Switch VCC Off */
/* B0_ISRC 32 bit Interrupt Source Register */ /* B0_ISRC 32 bit Interrupt Source Register */
/* B0_IMSK 32 bit Interrupt Mask Register */ /* B0_IMSK 32 bit Interrupt Mask Register */
/* B0_SP_ISRC 32 bit Special Interrupt Source Reg */ /* B0_SP_ISRC 32 bit Special Interrupt Source Reg */
/* B2_IRQM_MSK 32 bit IRQ Moderation Mask */ /* B2_IRQM_MSK 32 bit IRQ Moderation Mask */
#define IS_ALL_MSK 0xbfffffffUL /* All Interrupt bits */ #define IS_ALL_MSK 0xbfffffffUL /* All Interrupt bits */
#define IS_HW_ERR BIT_31 /* Interrupt HW Error */ #define IS_HW_ERR BIT_31 /* Interrupt HW Error */
...@@ -1099,9 +1110,9 @@ extern "C" { ...@@ -1099,9 +1110,9 @@ extern "C" {
#define IS_XA2_C BIT_0 /* Q_XA2 Encoding Error */ #define IS_XA2_C BIT_0 /* Q_XA2 Encoding Error */
/* B0_HWE_ISRC 32 bit HW Error Interrupt Src Reg */ /* B0_HWE_ISRC 32 bit HW Error Interrupt Src Reg */
/* B0_HWE_IMSK 32 bit HW Error Interrupt Mask Reg */ /* B0_HWE_IMSK 32 bit HW Error Interrupt Mask Reg */
/* B2_IRQM_HWE_MSK 32 bit IRQ Moderation HW Error Mask */ /* B2_IRQM_HWE_MSK 32 bit IRQ Moderation HW Error Mask */
#define IS_ERR_MSK 0x00000fffL /* All Error bits */ #define IS_ERR_MSK 0x00000fffL /* All Error bits */
/* Bit 31..14: reserved */ /* Bit 31..14: reserved */
#define IS_IRQ_TIST_OV BIT_13 /* Time Stamp Timer Overflow (YUKON only) */ #define IS_IRQ_TIST_OV BIT_13 /* Time Stamp Timer Overflow (YUKON only) */
...@@ -1119,29 +1130,32 @@ extern "C" { ...@@ -1119,29 +1130,32 @@ extern "C" {
#define IS_R1_PAR_ERR BIT_1 /* Queue R1 Parity Error */ #define IS_R1_PAR_ERR BIT_1 /* Queue R1 Parity Error */
#define IS_R2_PAR_ERR BIT_0 /* Queue R2 Parity Error */ #define IS_R2_PAR_ERR BIT_0 /* Queue R2 Parity Error */
/* B2_CONN_TYP 8 bit Connector type */ /* B2_CONN_TYP 8 bit Connector type */
/* B2_PMD_TYP 8 bit PMD type */ /* B2_PMD_TYP 8 bit PMD type */
/* Values of connector and PMD type comply to SysKonnect internal std */ /* Values of connector and PMD type comply to SysKonnect internal std */
/* B2_MAC_CFG 8 bit MAC Configuration / Chip Revision */ /* B2_MAC_CFG 8 bit MAC Configuration / Chip Revision */
#define CFG_CHIP_R_MSK (0xf<<4) /* Bit 7.. 4: Chip Revision */ #define CFG_CHIP_R_MSK (0xf<<4) /* Bit 7.. 4: Chip Revision */
/* Bit 3.. 2: reserved */ /* Bit 3.. 2: reserved */
#define CFG_DIS_M2_CLK BIT_1S /* Disable Clock for 2nd MAC */ #define CFG_DIS_M2_CLK BIT_1S /* Disable Clock for 2nd MAC */
#define CFG_SNG_MAC BIT_0S /* MAC Config: 0=2 MACs / 1=1 MAC*/ #define CFG_SNG_MAC BIT_0S /* MAC Config: 0=2 MACs / 1=1 MAC*/
/* B2_CHIP_ID 8 bit Chip Identification Number */ /* B2_CHIP_ID 8 bit Chip Identification Number */
#define CHIP_ID_GENESIS 0x0a /* Chip ID for GENESIS */ #define CHIP_ID_GENESIS 0x0a /* Chip ID for GENESIS */
#define CHIP_ID_YUKON 0xb0 /* Chip ID for YUKON */ #define CHIP_ID_YUKON 0xb0 /* Chip ID for YUKON */
#define CHIP_ID_YUKON_LITE 0xb1 /* Chip ID for YUKON-Lite (Rev. A1) */ #define CHIP_ID_YUKON_LITE 0xb1 /* Chip ID for YUKON-Lite (Rev. A1-A3) */
#define CHIP_ID_YUKON_LP 0xb2 /* Chip ID for YUKON-LP */ #define CHIP_ID_YUKON_LP 0xb2 /* Chip ID for YUKON-LP */
/* B2_FAR 32 bit Flash-Prom Addr Reg/Cnt */ #define CHIP_REV_YU_LITE_A1 3 /* Chip Rev. for YUKON-Lite A1,A2 */
#define CHIP_REV_YU_LITE_A3 7 /* Chip Rev. for YUKON-Lite A3 */
/* B2_FAR 32 bit Flash-Prom Addr Reg/Cnt */
#define FAR_ADDR 0x1ffffL /* Bit 16.. 0: FPROM Address mask */ #define FAR_ADDR 0x1ffffL /* Bit 16.. 0: FPROM Address mask */
/* B2_LD_CRTL 8 bit EPROM loader control register */ /* B2_LD_CTRL 8 bit EPROM loader control register */
/* Bits are currently reserved */ /* Bits are currently reserved */
/* B2_LD_TEST 8 bit EPROM loader test register */ /* B2_LD_TEST 8 bit EPROM loader test register */
/* Bit 7.. 4: reserved */ /* Bit 7.. 4: reserved */
#define LD_T_ON BIT_3S /* Loader Test mode on */ #define LD_T_ON BIT_3S /* Loader Test mode on */
#define LD_T_OFF BIT_2S /* Loader Test mode off */ #define LD_T_OFF BIT_2S /* Loader Test mode off */
...@@ -1151,16 +1165,16 @@ extern "C" { ...@@ -1151,16 +1165,16 @@ extern "C" {
/* /*
* Timer Section * Timer Section
*/ */
/* B2_TI_CRTL 8 bit Timer control */ /* B2_TI_CTRL 8 bit Timer control */
/* B2_IRQM_CTRL 8 bit IRQ Moderation Timer Control */ /* B2_IRQM_CTRL 8 bit IRQ Moderation Timer Control */
/* Bit 7.. 3: reserved */ /* Bit 7.. 3: reserved */
#define TIM_START BIT_2S /* Start Timer */ #define TIM_START BIT_2S /* Start Timer */
#define TIM_STOP BIT_1S /* Stop Timer */ #define TIM_STOP BIT_1S /* Stop Timer */
#define TIM_CLR_IRQ BIT_0S /* Clear Timer IRQ (!IRQM) */ #define TIM_CLR_IRQ BIT_0S /* Clear Timer IRQ (!IRQM) */
/* B2_TI_TEST 8 Bit Timer Test */ /* B2_TI_TEST 8 Bit Timer Test */
/* B2_IRQM_TEST 8 bit IRQ Moderation Timer Test */ /* B2_IRQM_TEST 8 bit IRQ Moderation Timer Test */
/* B28_DPT_TST 8 bit Descriptor Poll Timer Test Reg */ /* B28_DPT_TST 8 bit Descriptor Poll Timer Test Reg */
/* Bit 7.. 3: reserved */ /* Bit 7.. 3: reserved */
#define TIM_T_ON BIT_2S /* Test mode on */ #define TIM_T_ON BIT_2S /* Test mode on */
#define TIM_T_OFF BIT_1S /* Test mode off */ #define TIM_T_OFF BIT_1S /* Test mode off */
...@@ -1197,7 +1211,7 @@ extern "C" { ...@@ -1197,7 +1211,7 @@ extern "C" {
#define TST_FRC_APERR_1M64 BIT_1S /* AddrPERR on 1. phase */ #define TST_FRC_APERR_1M64 BIT_1S /* AddrPERR on 1. phase */
#define TST_FRC_APERR_2M64 BIT_0S /* AddrPERR on 2. phase */ #define TST_FRC_APERR_2M64 BIT_0S /* AddrPERR on 2. phase */
/* B2_GP_IO 32 bit General Purpose I/O Register */ /* B2_GP_IO 32 bit General Purpose I/O Register */
/* Bit 31..26: reserved */ /* Bit 31..26: reserved */
#define GP_DIR_9 BIT_25 /* IO_9 direct, 0=In/1=Out */ #define GP_DIR_9 BIT_25 /* IO_9 direct, 0=In/1=Out */
#define GP_DIR_8 BIT_24 /* IO_8 direct, 0=In/1=Out */ #define GP_DIR_8 BIT_24 /* IO_8 direct, 0=In/1=Out */
...@@ -1221,28 +1235,28 @@ extern "C" { ...@@ -1221,28 +1235,28 @@ extern "C" {
#define GP_IO_1 BIT_1 /* IO_1 pin */ #define GP_IO_1 BIT_1 /* IO_1 pin */
#define GP_IO_0 BIT_0 /* IO_0 pin */ #define GP_IO_0 BIT_0 /* IO_0 pin */
/* B2_I2C_CTRL 32 bit I2C HW Control Register */ /* B2_I2C_CTRL 32 bit I2C HW Control Register */
#define I2C_FLAG BIT_31 /* Start read/write if WR */ #define I2C_FLAG BIT_31 /* Start read/write if WR */
#define I2C_ADDR (0x7fffL<<16) /* Bit 30..16: Addr to be RD/WR */ #define I2C_ADDR (0x7fffL<<16) /* Bit 30..16: Addr to be RD/WR */
#define I2C_DEV_SEL (0x7fL<<9) /* Bit 15.. 9: I2C Device Select */ #define I2C_DEV_SEL (0x7fL<<9) /* Bit 15.. 9: I2C Device Select */
/* Bit 8.. 5: reserved */ /* Bit 8.. 5: reserved */
#define I2C_BURST_LEN BIT_4 /* Burst Len, 1/4 bytes */ #define I2C_BURST_LEN BIT_4 /* Burst Len, 1/4 bytes */
#define I2C_DEV_SIZE (7L<<1) /* Bit 3.. 1: I2C Device Size */ #define I2C_DEV_SIZE (7<<1) /* Bit 3.. 1: I2C Device Size */
#define I2C_025K_DEV (0L<<1) /* 0: 256 Bytes or smal. */ #define I2C_025K_DEV (0<<1) /* 0: 256 Bytes or smal. */
#define I2C_05K_DEV (1L<<1) /* 1: 512 Bytes */ #define I2C_05K_DEV (1<<1) /* 1: 512 Bytes */
#define I2C_1K_DEV (2L<<1) /* 2: 1024 Bytes */ #define I2C_1K_DEV (2<<1) /* 2: 1024 Bytes */
#define I2C_2K_DEV (3L<<1) /* 3: 2048 Bytes */ #define I2C_2K_DEV (3<<1) /* 3: 2048 Bytes */
#define I2C_4K_DEV (4L<<1) /* 4: 4096 Bytes */ #define I2C_4K_DEV (4<<1) /* 4: 4096 Bytes */
#define I2C_8K_DEV (5L<<1) /* 5: 8192 Bytes */ #define I2C_8K_DEV (5<<1) /* 5: 8192 Bytes */
#define I2C_16K_DEV (6L<<1) /* 6: 16384 Bytes */ #define I2C_16K_DEV (6<<1) /* 6: 16384 Bytes */
#define I2C_32K_DEV (7L<<1) /* 7: 32768 Bytes */ #define I2C_32K_DEV (7<<1) /* 7: 32768 Bytes */
#define I2C_STOP BIT_0 /* Interrupt I2C transfer */ #define I2C_STOP BIT_0 /* Interrupt I2C transfer */
/* B2_I2C_IRQ 32 bit I2C HW IRQ Register */ /* B2_I2C_IRQ 32 bit I2C HW IRQ Register */
/* Bit 31.. 1 reserved */ /* Bit 31.. 1 reserved */
#define I2C_CLR_IRQ BIT_0 /* Clear I2C IRQ */ #define I2C_CLR_IRQ BIT_0 /* Clear I2C IRQ */
/* B2_I2C_SW 32 bit (8 bit access) I2C HW SW Port Register */ /* B2_I2C_SW 32 bit (8 bit access) I2C HW SW Port Register */
/* Bit 7.. 3: reserved */ /* Bit 7.. 3: reserved */
#define I2C_DATA_DIR BIT_2S /* direction of I2C_DATA */ #define I2C_DATA_DIR BIT_2S /* direction of I2C_DATA */
#define I2C_DATA BIT_1S /* I2C Data Port */ #define I2C_DATA BIT_1S /* I2C Data Port */
...@@ -1254,27 +1268,27 @@ extern "C" { ...@@ -1254,27 +1268,27 @@ extern "C" {
#define I2C_SENS_ADDR LM80_ADDR /* I2C Sensor Address, (Volt and Temp)*/ #define I2C_SENS_ADDR LM80_ADDR /* I2C Sensor Address, (Volt and Temp)*/
/* B2_BSC_CTRL 8 bit Blink Source Counter Control */ /* B2_BSC_CTRL 8 bit Blink Source Counter Control */
/* Bit 7.. 2: reserved */ /* Bit 7.. 2: reserved */
#define BSC_START BIT_1S /* Start Blink Source Counter */ #define BSC_START BIT_1S /* Start Blink Source Counter */
#define BSC_STOP BIT_0S /* Stop Blink Source Counter */ #define BSC_STOP BIT_0S /* Stop Blink Source Counter */
/* B2_BSC_STAT 8 bit Blink Source Counter Status */ /* B2_BSC_STAT 8 bit Blink Source Counter Status */
/* Bit 7.. 1: reserved */ /* Bit 7.. 1: reserved */
#define BSC_SRC BIT_0S /* Blink Source, 0=Off / 1=On */ #define BSC_SRC BIT_0S /* Blink Source, 0=Off / 1=On */
/* B2_BSC_TST 16 bit Blink Source Counter Test Reg */ /* B2_BSC_TST 16 bit Blink Source Counter Test Reg */
#define BSC_T_ON BIT_2S /* Test mode on */ #define BSC_T_ON BIT_2S /* Test mode on */
#define BSC_T_OFF BIT_1S /* Test mode off */ #define BSC_T_OFF BIT_1S /* Test mode off */
#define BSC_T_STEP BIT_0S /* Test step */ #define BSC_T_STEP BIT_0S /* Test step */
/* B3_RAM_ADDR 32 bit RAM Address, to read or write */ /* B3_RAM_ADDR 32 bit RAM Address, to read or write */
/* Bit 31..19: reserved */ /* Bit 31..19: reserved */
#define RAM_ADR_RAN 0x0007ffffL /* Bit 18.. 0: RAM Address Range */ #define RAM_ADR_RAN 0x0007ffffL /* Bit 18.. 0: RAM Address Range */
/* RAM Interface Registers */ /* RAM Interface Registers */
/* B3_RI_CTRL 16 bit RAM Iface Control Register */ /* B3_RI_CTRL 16 bit RAM Iface Control Register */
/* Bit 15..10: reserved */ /* Bit 15..10: reserved */
#define RI_CLR_RD_PERR BIT_9S /* Clear IRQ RAM Read Parity Err */ #define RI_CLR_RD_PERR BIT_9S /* Clear IRQ RAM Read Parity Err */
#define RI_CLR_WR_PERR BIT_8S /* Clear IRQ RAM Write Parity Err*/ #define RI_CLR_WR_PERR BIT_8S /* Clear IRQ RAM Write Parity Err*/
...@@ -1282,7 +1296,7 @@ extern "C" { ...@@ -1282,7 +1296,7 @@ extern "C" {
#define RI_RST_CLR BIT_1S /* Clear RAM Interface Reset */ #define RI_RST_CLR BIT_1S /* Clear RAM Interface Reset */
#define RI_RST_SET BIT_0S /* Set RAM Interface Reset */ #define RI_RST_SET BIT_0S /* Set RAM Interface Reset */
/* B3_RI_TEST 8 bit RAM Iface Test Register */ /* B3_RI_TEST 8 bit RAM Iface Test Register */
/* Bit 15.. 4: reserved */ /* Bit 15.. 4: reserved */
#define RI_T_EV BIT_3S /* Timeout Event occured */ #define RI_T_EV BIT_3S /* Timeout Event occured */
#define RI_T_ON BIT_2S /* Timeout Timer Test On */ #define RI_T_ON BIT_2S /* Timeout Timer Test On */
...@@ -1309,7 +1323,7 @@ extern "C" { ...@@ -1309,7 +1323,7 @@ extern "C" {
#define MA_DIS_REC_RX1 BIT_0S /* Disable Recovery Timer RX1 */ #define MA_DIS_REC_RX1 BIT_0S /* Disable Recovery Timer RX1 */
/* Packet Arbiter Registers */ /* Packet Arbiter Registers */
/* B3_PA_CTRL 16 bit Packet Arbiter Ctrl Register */ /* B3_PA_CTRL 16 bit Packet Arbiter Ctrl Register */
/* Bit 15..14: reserved */ /* Bit 15..14: reserved */
#define PA_CLR_TO_TX2 BIT_13S /* Clear IRQ Packet Timeout TX2 */ #define PA_CLR_TO_TX2 BIT_13S /* Clear IRQ Packet Timeout TX2 */
#define PA_CLR_TO_TX1 BIT_12S /* Clear IRQ Packet Timeout TX1 */ #define PA_CLR_TO_TX1 BIT_12S /* Clear IRQ Packet Timeout TX1 */
...@@ -1332,7 +1346,7 @@ extern "C" { ...@@ -1332,7 +1346,7 @@ extern "C" {
/* Rx/Tx Path related Arbiter Test Registers */ /* Rx/Tx Path related Arbiter Test Registers */
/* B3_MA_TO_TEST 16 bit MAC Arbiter Timeout Test Reg */ /* B3_MA_TO_TEST 16 bit MAC Arbiter Timeout Test Reg */
/* B3_MA_RC_TEST 16 bit MAC Arbiter Recovery Test Reg */ /* B3_MA_RC_TEST 16 bit MAC Arbiter Recovery Test Reg */
/* B3_PA_TEST 16 bit Packet Arbiter Test Register */ /* B3_PA_TEST 16 bit Packet Arbiter Test Register */
/* Bit 15, 11, 7, and 3 are reserved in B3_PA_TEST */ /* Bit 15, 11, 7, and 3 are reserved in B3_PA_TEST */
#define TX2_T_EV BIT_15S /* TX2 Timeout/Recv Event occured */ #define TX2_T_EV BIT_15S /* TX2 Timeout/Recv Event occured */
#define TX2_T_ON BIT_14S /* TX2 Timeout/Recv Timer Test On */ #define TX2_T_ON BIT_14S /* TX2 Timeout/Recv Timer Test On */
...@@ -1353,14 +1367,14 @@ extern "C" { ...@@ -1353,14 +1367,14 @@ extern "C" {
/* Transmit Arbiter Registers MAC 1 and 2, use MR_ADDR() to access */ /* Transmit Arbiter Registers MAC 1 and 2, use MR_ADDR() to access */
/* TXA_ITI_INI 32 bit Tx Arb Interval Timer Init Val */ /* TXA_ITI_INI 32 bit Tx Arb Interval Timer Init Val */
/* TXA_ITI_VAL 32 bit Tx Arb Interval Timer Value */ /* TXA_ITI_VAL 32 bit Tx Arb Interval Timer Value */
/* TXA_LIM_INI 32 bit Tx Arb Limit Counter Init Val */ /* TXA_LIM_INI 32 bit Tx Arb Limit Counter Init Val */
/* TXA_LIM_VAL 32 bit Tx Arb Limit Counter Value */ /* TXA_LIM_VAL 32 bit Tx Arb Limit Counter Value */
/* Bit 31..24: reserved */ /* Bit 31..24: reserved */
#define TXA_MAX_VAL 0x00ffffffUL/* Bit 23.. 0: Max TXA Timer/Cnt Val */ #define TXA_MAX_VAL 0x00ffffffUL/* Bit 23.. 0: Max TXA Timer/Cnt Val */
/* TXA_CTRL 8 bit Tx Arbiter Control Register */ /* TXA_CTRL 8 bit Tx Arbiter Control Register */
#define TXA_ENA_FSYNC BIT_7S /* Enable force of sync Tx queue */ #define TXA_ENA_FSYNC BIT_7S /* Enable force of sync Tx queue */
#define TXA_DIS_FSYNC BIT_6S /* Disable force of sync Tx queue */ #define TXA_DIS_FSYNC BIT_6S /* Disable force of sync Tx queue */
#define TXA_ENA_ALLOC BIT_5S /* Enable alloc of free bandwidth */ #define TXA_ENA_ALLOC BIT_5S /* Enable alloc of free bandwidth */
...@@ -1370,7 +1384,7 @@ extern "C" { ...@@ -1370,7 +1384,7 @@ extern "C" {
#define TXA_ENA_ARB BIT_1S /* Enable Tx Arbiter */ #define TXA_ENA_ARB BIT_1S /* Enable Tx Arbiter */
#define TXA_DIS_ARB BIT_0S /* Disable Tx Arbiter */ #define TXA_DIS_ARB BIT_0S /* Disable Tx Arbiter */
/* TXA_TEST 8 bit Tx Arbiter Test Register */ /* TXA_TEST 8 bit Tx Arbiter Test Register */
/* Bit 7.. 6: reserved */ /* Bit 7.. 6: reserved */
#define TXA_INT_T_ON BIT_5S /* Tx Arb Interval Timer Test On */ #define TXA_INT_T_ON BIT_5S /* Tx Arb Interval Timer Test On */
#define TXA_INT_T_OFF BIT_4S /* Tx Arb Interval Timer Test Off */ #define TXA_INT_T_OFF BIT_4S /* Tx Arb Interval Timer Test Off */
...@@ -1379,22 +1393,22 @@ extern "C" { ...@@ -1379,22 +1393,22 @@ extern "C" {
#define TXA_LIM_T_OFF BIT_1S /* Tx Arb Limit Timer Test Off */ #define TXA_LIM_T_OFF BIT_1S /* Tx Arb Limit Timer Test Off */
#define TXA_LIM_T_STEP BIT_0S /* Tx Arb Limit Timer Step */ #define TXA_LIM_T_STEP BIT_0S /* Tx Arb Limit Timer Step */
/* TXA_STAT 8 bit Tx Arbiter Status Register */ /* TXA_STAT 8 bit Tx Arbiter Status Register */
/* Bit 7.. 1: reserved */ /* Bit 7.. 1: reserved */
#define TXA_PRIO_XS BIT_0S /* sync queue has prio to send */ #define TXA_PRIO_XS BIT_0S /* sync queue has prio to send */
/* Q_BC 32 bit Current Byte Counter */ /* Q_BC 32 bit Current Byte Counter */
/* Bit 31..16: reserved */ /* Bit 31..16: reserved */
#define BC_MAX 0xffff /* Bit 15.. 0: Byte counter */ #define BC_MAX 0xffff /* Bit 15.. 0: Byte counter */
/* BMU Control Status Registers */ /* BMU Control Status Registers */
/* B0_R1_CSR 32 bit BMU Ctrl/Stat Rx Queue 1 */ /* B0_R1_CSR 32 bit BMU Ctrl/Stat Rx Queue 1 */
/* B0_R2_CSR 32 bit BMU Ctrl/Stat Rx Queue 2 */ /* B0_R2_CSR 32 bit BMU Ctrl/Stat Rx Queue 2 */
/* B0_XA1_CSR 32 bit BMU Ctrl/Stat Sync Tx Queue 1 */ /* B0_XA1_CSR 32 bit BMU Ctrl/Stat Sync Tx Queue 1 */
/* B0_XS1_CSR 32 bit BMU Ctrl/Stat Async Tx Queue 1 */ /* B0_XS1_CSR 32 bit BMU Ctrl/Stat Async Tx Queue 1 */
/* B0_XA2_CSR 32 bit BMU Ctrl/Stat Sync Tx Queue 2 */ /* B0_XA2_CSR 32 bit BMU Ctrl/Stat Sync Tx Queue 2 */
/* B0_XS2_CSR 32 bit BMU Ctrl/Stat Async Tx Queue 2 */ /* B0_XS2_CSR 32 bit BMU Ctrl/Stat Async Tx Queue 2 */
/* Q_CSR 32 bit BMU Control/Status Register */ /* Q_CSR 32 bit BMU Control/Status Register */
/* Bit 31..25: reserved */ /* Bit 31..25: reserved */
#define CSR_SV_IDLE BIT_24 /* BMU SM Idle */ #define CSR_SV_IDLE BIT_24 /* BMU SM Idle */
/* Bit 23..22: reserved */ /* Bit 23..22: reserved */
...@@ -1428,7 +1442,7 @@ extern "C" { ...@@ -1428,7 +1442,7 @@ extern "C" {
CSR_SV_RUN | CSR_DREAD_RUN | CSR_DWRITE_RUN |\ CSR_SV_RUN | CSR_DREAD_RUN | CSR_DWRITE_RUN |\
CSR_TRANS_RUN) CSR_TRANS_RUN)
/* Q_F 32 bit Flag Register */ /* Q_F 32 bit Flag Register */
/* Bit 31..28: reserved */ /* Bit 31..28: reserved */
#define F_ALM_FULL BIT_27 /* Rx FIFO: almost full */ #define F_ALM_FULL BIT_27 /* Rx FIFO: almost full */
#define F_EMPTY BIT_27 /* Tx FIFO: empty flag */ #define F_EMPTY BIT_27 /* Tx FIFO: empty flag */
...@@ -1439,17 +1453,17 @@ extern "C" { ...@@ -1439,17 +1453,17 @@ extern "C" {
/* Bit 15..11: reserved */ /* Bit 15..11: reserved */
#define F_WATER_MARK 0x0007ffL /* Bit 10.. 0: Watermark */ #define F_WATER_MARK 0x0007ffL /* Bit 10.. 0: Watermark */
/* Q_T1 32 bit Test Register 1 */ /* Q_T1 32 bit Test Register 1 */
/* Holds four State Machine control Bytes */ /* Holds four State Machine control Bytes */
#define SM_CRTL_SV_MSK (0xffL<<24) /* Bit 31..24: Control Supervisor SM */ #define SM_CTRL_SV_MSK (0xffL<<24) /* Bit 31..24: Control Supervisor SM */
#define SM_CRTL_RD_MSK (0xffL<<16) /* Bit 23..16: Control Read Desc SM */ #define SM_CTRL_RD_MSK (0xffL<<16) /* Bit 23..16: Control Read Desc SM */
#define SM_CRTL_WR_MSK (0xffL<<8) /* Bit 15.. 8: Control Write Desc SM */ #define SM_CTRL_WR_MSK (0xffL<<8) /* Bit 15.. 8: Control Write Desc SM */
#define SM_CRTL_TR_MSK 0xffL /* Bit 7.. 0: Control Transfer SM */ #define SM_CTRL_TR_MSK 0xffL /* Bit 7.. 0: Control Transfer SM */
/* Q_T1_TR 8 bit Test Register 1 Transfer SM */ /* Q_T1_TR 8 bit Test Register 1 Transfer SM */
/* Q_T1_WR 8 bit Test Register 1 Write Descriptor SM */ /* Q_T1_WR 8 bit Test Register 1 Write Descriptor SM */
/* Q_T1_RD 8 bit Test Register 1 Read Descriptor SM */ /* Q_T1_RD 8 bit Test Register 1 Read Descriptor SM */
/* Q_T1_SV 8 bit Test Register 1 Supervisor SM */ /* Q_T1_SV 8 bit Test Register 1 Supervisor SM */
/* The control status byte of each machine looks like ... */ /* The control status byte of each machine looks like ... */
#define SM_STATE 0xf0 /* Bit 7.. 4: State which shall be loaded */ #define SM_STATE 0xf0 /* Bit 7.. 4: State which shall be loaded */
...@@ -1459,7 +1473,7 @@ extern "C" { ...@@ -1459,7 +1473,7 @@ extern "C" {
#define SM_STEP BIT_0S /* Step the State Machine */ #define SM_STEP BIT_0S /* Step the State Machine */
/* The encoding of the states is not supported by the Diagnostics Tool */ /* The encoding of the states is not supported by the Diagnostics Tool */
/* Q_T2 32 bit Test Register 2 */ /* Q_T2 32 bit Test Register 2 */
/* Bit 31.. 8: reserved */ /* Bit 31.. 8: reserved */
#define T2_AC_T_ON BIT_7 /* Address Counter Test Mode on */ #define T2_AC_T_ON BIT_7 /* Address Counter Test Mode on */
#define T2_AC_T_OFF BIT_6 /* Address Counter Test Mode off */ #define T2_AC_T_OFF BIT_6 /* Address Counter Test Mode off */
...@@ -1470,23 +1484,23 @@ extern "C" { ...@@ -1470,23 +1484,23 @@ extern "C" {
#define T2_STEP02 BIT_1 /* Inc AC/Dec BC by 2 */ #define T2_STEP02 BIT_1 /* Inc AC/Dec BC by 2 */
#define T2_STEP01 BIT_0 /* Inc AC/Dec BC by 1 */ #define T2_STEP01 BIT_0 /* Inc AC/Dec BC by 1 */
/* Q_T3 32 bit Test Register 3 */ /* Q_T3 32 bit Test Register 3 */
/* Bit 31.. 7: reserved */ /* Bit 31.. 7: reserved */
#define T3_MUX_MSK (7<<4) /* Bit 6.. 4: Mux Position */ #define T3_MUX_MSK (7<<4) /* Bit 6.. 4: Mux Position */
/* Bit 3: reserved */ /* Bit 3: reserved */
#define T3_VRAM_MSK 7 /* Bit 2.. 0: Virtual RAM Buffer Address */ #define T3_VRAM_MSK 7 /* Bit 2.. 0: Virtual RAM Buffer Address */
/* RAM Buffer Register Offsets, use RB_ADDR(Queue, Offs) to access */ /* RAM Buffer Register Offsets, use RB_ADDR(Queue, Offs) to access */
/* RB_START 32 bit RAM Buffer Start Address */ /* RB_START 32 bit RAM Buffer Start Address */
/* RB_END 32 bit RAM Buffer End Address */ /* RB_END 32 bit RAM Buffer End Address */
/* RB_WP 32 bit RAM Buffer Write Pointer */ /* RB_WP 32 bit RAM Buffer Write Pointer */
/* RB_RP 32 bit RAM Buffer Read Pointer */ /* RB_RP 32 bit RAM Buffer Read Pointer */
/* RB_RX_UTPP 32 bit Rx Upper Threshold, Pause Pack */ /* RB_RX_UTPP 32 bit Rx Upper Threshold, Pause Pack */
/* RB_RX_LTPP 32 bit Rx Lower Threshold, Pause Pack */ /* RB_RX_LTPP 32 bit Rx Lower Threshold, Pause Pack */
/* RB_RX_UTHP 32 bit Rx Upper Threshold, High Prio */ /* RB_RX_UTHP 32 bit Rx Upper Threshold, High Prio */
/* RB_RX_LTHP 32 bit Rx Lower Threshold, High Prio */ /* RB_RX_LTHP 32 bit Rx Lower Threshold, High Prio */
/* RB_PC 32 bit RAM Buffer Packet Counter */ /* RB_PC 32 bit RAM Buffer Packet Counter */
/* RB_LEV 32 bit RAM Buffer Level Register */ /* RB_LEV 32 bit RAM Buffer Level Register */
/* Bit 31..19: reserved */ /* Bit 31..19: reserved */
#define RB_MSK 0x0007ffff /* Bit 18.. 0: RAM Buffer Pointer Bits */ #define RB_MSK 0x0007ffff /* Bit 18.. 0: RAM Buffer Pointer Bits */
...@@ -1519,17 +1533,17 @@ extern "C" { ...@@ -1519,17 +1533,17 @@ extern "C" {
/* Receive and Transmit MAC FIFO Registers (GENESIS only) */ /* Receive and Transmit MAC FIFO Registers (GENESIS only) */
/* RX_MFF_EA 32 bit Receive MAC FIFO End Address */ /* RX_MFF_EA 32 bit Receive MAC FIFO End Address */
/* RX_MFF_WP 32 bit Receive MAC FIFO Write Pointer */ /* RX_MFF_WP 32 bit Receive MAC FIFO Write Pointer */
/* RX_MFF_RP 32 bit Receive MAC FIFO Read Pointer */ /* RX_MFF_RP 32 bit Receive MAC FIFO Read Pointer */
/* RX_MFF_PC 32 bit Receive MAC FIFO Packet Counter */ /* RX_MFF_PC 32 bit Receive MAC FIFO Packet Counter */
/* RX_MFF_LEV 32 bit Receive MAC FIFO Level */ /* RX_MFF_LEV 32 bit Receive MAC FIFO Level */
/* TX_MFF_EA 32 bit Transmit MAC FIFO End Address */ /* TX_MFF_EA 32 bit Transmit MAC FIFO End Address */
/* TX_MFF_WP 32 bit Transmit MAC FIFO Write Pointer */ /* TX_MFF_WP 32 bit Transmit MAC FIFO Write Pointer */
/* TX_MFF_WSP 32 bit Transmit MAC FIFO WR Shadow Pointer */ /* TX_MFF_WSP 32 bit Transmit MAC FIFO WR Shadow Pointer */
/* TX_MFF_RP 32 bit Transmit MAC FIFO Read Pointer */ /* TX_MFF_RP 32 bit Transmit MAC FIFO Read Pointer */
/* TX_MFF_PC 32 bit Transmit MAC FIFO Packet Cnt */ /* TX_MFF_PC 32 bit Transmit MAC FIFO Packet Cnt */
/* TX_MFF_LEV 32 bit Transmit MAC FIFO Level */ /* TX_MFF_LEV 32 bit Transmit MAC FIFO Level */
/* Bit 31.. 6: reserved */ /* Bit 31.. 6: reserved */
#define MFF_MSK 0x007fL /* Bit 5.. 0: MAC FIFO Address/Ptr Bits */ #define MFF_MSK 0x007fL /* Bit 5.. 0: MAC FIFO Address/Ptr Bits */
...@@ -1682,7 +1696,7 @@ extern "C" { ...@@ -1682,7 +1696,7 @@ extern "C" {
#define RX_GMF_FL_THR_DEF 0x0a /* Rx GMAC FIFO Flush Threshold default */ #define RX_GMF_FL_THR_DEF 0x0a /* Rx GMAC FIFO Flush Threshold default */
/* GMAC_TI_ST_CTRL 8 bit Time Stamp Timer Ctrl Reg (YUKON only) */ /* GMAC_TI_ST_CTRL 8 bit Time Stamp Timer Ctrl Reg (YUKON only) */
/* Bit 7.. 3: reserved */ /* Bit 7.. 3: reserved */
#define GMT_ST_START BIT_2S /* Start Time Stamp Timer */ #define GMT_ST_START BIT_2S /* Start Time Stamp Timer */
#define GMT_ST_STOP BIT_1S /* Stop Time Stamp Timer */ #define GMT_ST_STOP BIT_1S /* Stop Time Stamp Timer */
...@@ -1766,13 +1780,13 @@ extern "C" { ...@@ -1766,13 +1780,13 @@ extern "C" {
#define GMAC_DEF_MSK (GM_IS_TX_CO_OV | GM_IS_RX_CO_OV | \ #define GMAC_DEF_MSK (GM_IS_TX_CO_OV | GM_IS_RX_CO_OV | \
GM_IS_TX_FF_UR) GM_IS_TX_FF_UR)
/* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */ /* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */
/* Bits 15.. 2: reserved */ /* Bits 15.. 2: reserved */
#define GMLC_RST_CLR BIT_1S /* Clear GMAC Link Reset */ #define GMLC_RST_CLR BIT_1S /* Clear GMAC Link Reset */
#define GMLC_RST_SET BIT_0S /* Set GMAC Link Reset */ #define GMLC_RST_SET BIT_0S /* Set GMAC Link Reset */
/* WOL_CTRL_STAT 16 bit WOL Control/Status Reg */ /* WOL_CTRL_STAT 16 bit WOL Control/Status Reg */
#define WOL_CTL_LINK_CHG_OCC BIT_15S #define WOL_CTL_LINK_CHG_OCC BIT_15S
#define WOL_CTL_MAGIC_PKT_OCC BIT_14S #define WOL_CTL_MAGIC_PKT_OCC BIT_14S
#define WOL_CTL_PATTERN_OCC BIT_13S #define WOL_CTL_PATTERN_OCC BIT_13S
...@@ -1801,7 +1815,7 @@ extern "C" { ...@@ -1801,7 +1815,7 @@ extern "C" {
WOL_CTL_DIS_PATTERN_UNIT | \ WOL_CTL_DIS_PATTERN_UNIT | \
WOL_CTL_DIS_MAGIC_PKT_UNIT) WOL_CTL_DIS_MAGIC_PKT_UNIT)
/* WOL_MATCH_CTL 8 bit WOL Match Control Reg */ /* WOL_MATCH_CTL 8 bit WOL Match Control Reg */
#define WOL_CTL_PATT_ENA(x) (BIT_0 << (x)) #define WOL_CTL_PATT_ENA(x) (BIT_0 << (x))
#define SK_NUM_WOL_PATTERN 7 #define SK_NUM_WOL_PATTERN 7
......
/****************************************************************************** /******************************************************************************
* *
* Name: skhwt.h * Name: skhwt.h
* Project: Gigabit Ethernet Adapters, Schedule-Modul * Project: Gigabit Ethernet Adapters, Event Scheduler Module
* Version: $Revision: 1.6 $ * Version: $Revision: 1.7 $
* Date: $Date: 2003/05/13 17:57:48 $ * Date: $Date: 2003/09/16 12:55:08 $
* Purpose: Defines for the hardware timer functions * Purpose: Defines for the hardware timer functions
* *
******************************************************************************/ ******************************************************************************/
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
* History: * History:
* *
* $Log: skgehwt.h,v $ * $Log: skgehwt.h,v $
* Revision 1.7 2003/09/16 12:55:08 rschmidt
* Editorial changes
*
* Revision 1.6 2003/05/13 17:57:48 mkarl * Revision 1.6 2003/05/13 17:57:48 mkarl
* Editorial changes. * Editorial changes.
* *
...@@ -34,7 +37,7 @@ ...@@ -34,7 +37,7 @@
* Changed license header to GPL. * Changed license header to GPL.
* *
* Revision 1.4 1998/08/19 09:50:58 gklug * Revision 1.4 1998/08/19 09:50:58 gklug
* fix: remove struct keyword from c-code (see CCC) add typedefs * fix: remove struct keyword from C-code (see CCC) add typedefs
* *
* Revision 1.3 1998/08/14 07:09:29 gklug * Revision 1.3 1998/08/14 07:09:29 gklug
* fix: chg pAc -> pAC * fix: chg pAc -> pAC
...@@ -44,10 +47,6 @@ ...@@ -44,10 +47,6 @@
* *
* Revision 1.1 1998/08/07 09:32:58 gklug * Revision 1.1 1998/08/07 09:32:58 gklug
* first version * first version
*
*
*
*
* *
******************************************************************************/ ******************************************************************************/
...@@ -64,14 +63,14 @@ ...@@ -64,14 +63,14 @@
* - use in Adapters context name pAC->Hwt * - use in Adapters context name pAC->Hwt
*/ */
typedef struct s_Hwt { typedef struct s_Hwt {
SK_U32 TStart ; /* HWT start */ SK_U32 TStart; /* HWT start */
SK_U32 TStop ; /* HWT stop */ SK_U32 TStop; /* HWT stop */
int TActive ; /* HWT: flag : active/inactive */ int TActive; /* HWT: flag : active/inactive */
} SK_HWT; } SK_HWT;
extern void SkHwtInit(SK_AC *pAC, SK_IOC Ioc); extern void SkHwtInit(SK_AC *pAC, SK_IOC Ioc);
extern void SkHwtStart(SK_AC *pAC, SK_IOC Ioc, SK_U32 Time); extern void SkHwtStart(SK_AC *pAC, SK_IOC Ioc, SK_U32 Time);
extern void SkHwtStop(SK_AC *pAC, SK_IOC Ioc); extern void SkHwtStop(SK_AC *pAC, SK_IOC Ioc);
extern SK_U32 SkHwtRead(SK_AC *pAC,SK_IOC Ioc); extern SK_U32 SkHwtRead(SK_AC *pAC, SK_IOC Ioc);
extern void SkHwtIsr(SK_AC *pAC, SK_IOC Ioc); extern void SkHwtIsr(SK_AC *pAC, SK_IOC Ioc);
#endif /* _SKGEHWT_H_ */ #endif /* _SKGEHWT_H_ */
/****************************************************************************** /******************************************************************************
* *
* Name: skgei2c.h * Name: skgei2c.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter * Project: Gigabit Ethernet Adapters, TWSI-Module
* Version: $Revision: 1.23 $ * Version: $Revision: 1.25 $
* Date: $Date: 2002/12/19 14:34:27 $ * Date: $Date: 2003/10/20 09:06:05 $
* Purpose: Special GEnesis defines for TWSI * Purpose: Special defines for TWSI
* *
******************************************************************************/ ******************************************************************************/
/****************************************************************************** /******************************************************************************
* *
* (C)Copyright 1998-2002 SysKonnect GmbH. * (C)Copyright 1998-2002 SysKonnect.
* (C)Copyright 2002-2003 Marvell.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -26,6 +27,12 @@ ...@@ -26,6 +27,12 @@
* History: * History:
* *
* $Log: skgei2c.h,v $ * $Log: skgei2c.h,v $
* Revision 1.25 2003/10/20 09:06:05 rschmidt
* Editorial changes.
*
* Revision 1.24 2003/09/23 09:31:15 malthoff
* Parameter dev_size added to macro definition of SK_I2C_CTL.
*
* Revision 1.23 2002/12/19 14:34:27 rschmidt * Revision 1.23 2002/12/19 14:34:27 rschmidt
* Added cast in macros SK_I2C_SET_BIT() and SK_I2C_CLR_BIT() * Added cast in macros SK_I2C_SET_BIT() and SK_I2C_CLR_BIT()
* Editorial changes (TWSI) * Editorial changes (TWSI)
...@@ -107,8 +114,6 @@ ...@@ -107,8 +114,6 @@
* Revision 1.1 1998/07/17 11:27:56 gklug * Revision 1.1 1998/07/17 11:27:56 gklug
* Created. * Created.
* *
*
*
******************************************************************************/ ******************************************************************************/
/* /*
...@@ -121,12 +126,13 @@ ...@@ -121,12 +126,13 @@
/* /*
* Macros to access the B2_I2C_CTRL * Macros to access the B2_I2C_CTRL
*/ */
#define SK_I2C_CTL(IoC, flag, dev, reg, burst) \ #define SK_I2C_CTL(IoC, flag, dev, dev_size, reg, burst) \
SK_OUT32(IoC, B2_I2C_CTRL,\ SK_OUT32(IoC, B2_I2C_CTRL,\
(flag ? 0x80000000UL : 0x0L) | \ (flag ? 0x80000000UL : 0x0L) | \
(((SK_U32) reg << 16) & I2C_ADDR) | \ (((SK_U32)reg << 16) & I2C_ADDR) | \
(((SK_U32) dev << 9) & I2C_DEV_SEL) | \ (((SK_U32)dev << 9) & I2C_DEV_SEL) | \
(( burst << 4) & I2C_BURST_LEN)) (dev_size & I2C_DEV_SIZE) | \
((burst << 4) & I2C_BURST_LEN))
#define SK_I2C_STOP(IoC) { \ #define SK_I2C_STOP(IoC) { \
SK_U32 I2cCtrl; \ SK_U32 I2cCtrl; \
...@@ -166,42 +172,42 @@ ...@@ -166,42 +172,42 @@
*/ */
#define SK_LM80_VT_LSB 22 /* 22mV LSB resolution */ #define SK_LM80_VT_LSB 22 /* 22mV LSB resolution */
#define SK_LM80_TEMP_LSB 10 /* 1 degree LSB resolution */ #define SK_LM80_TEMP_LSB 10 /* 1 degree LSB resolution */
#define SK_LM80_TEMPEXT_LSB 5 /* 0.5 degree LSB resolution for the #define SK_LM80_TEMPEXT_LSB 5 /* 0.5 degree LSB resolution for ext. val. */
* extension value
*/ /*
#define SK_LM80_FAN_FAKTOR ((22500L*60)/(1*2)) * formula: counter = (22500*60)/(rpm * divisor * pulses/2)
/* formula: counter = (22500*60)/(rpm * divisor * pulses/2)
* assuming: 6500rpm, 4 pulses, divisor 1 * assuming: 6500rpm, 4 pulses, divisor 1
*/ */
#define SK_LM80_FAN_FAKTOR ((22500L*60)/(1*2))
/* /*
* Define sensor management data * Define sensor management data
* Maximum is reached on copperfield with dual Broadcom. * Maximum is reached on Genesis copper dual port and Yukon-64
* Board specific maximum is in pAC->I2c.MaxSens * Board specific maximum is in pAC->I2c.MaxSens
*/ */
#define SK_MAX_SENSORS 8 /* maximal no. of installed sensors */ #define SK_MAX_SENSORS 8 /* maximal no. of installed sensors */
#define SK_MIN_SENSORS 5 /* minimal no. of installed sensors */ #define SK_MIN_SENSORS 5 /* minimal no. of installed sensors */
/* /*
* To watch the statemachine (JS) use the timer in two ways instead of one as hitherto * To watch the state machine (SM) use the timer in two ways
* instead of one as hitherto
*/ */
#define SK_TIMER_WATCH_STATEMACHINE 0 /* Watch the statemachine to finish in a specific time */ #define SK_TIMER_WATCH_SM 0 /* Watch the SM to finish in a spec. time */
#define SK_TIMER_NEW_GAUGING 1 /* Start a new gauging when timer expires */ #define SK_TIMER_NEW_GAUGING 1 /* Start a new gauging when timer expires */
/* /*
* Defines for the individual Thresholds * Defines for the individual thresholds
*/ */
/* Temperature sensor */ /* Temperature sensor */
#define SK_SEN_TEMP_HIGH_ERR 800 /* Temperature High Err Threshold */ #define SK_SEN_TEMP_HIGH_ERR 800 /* Temperature High Err Threshold */
#define SK_SEN_TEMP_HIGH_WARN 700 /* Temperature High Warn Threshold */ #define SK_SEN_TEMP_HIGH_WARN 700 /* Temperature High Warn Threshold */
#define SK_SEN_TEMP_LOW_WARN 100 /* Temperature Low Warn Threshold */ #define SK_SEN_TEMP_LOW_WARN 100 /* Temperature Low Warn Threshold */
#define SK_SEN_TEMP_LOW_ERR 0 /* Temperature Low Err Threshold */ #define SK_SEN_TEMP_LOW_ERR 0 /* Temperature Low Err Threshold */
/* VCC which should be 5 V */ /* VCC which should be 5 V */
#define SK_SEN_PCI_5V_HIGH_ERR 5588 /* Voltage PCI High Err Threshold */ #define SK_SEN_PCI_5V_HIGH_ERR 5588 /* Voltage PCI High Err Threshold */
#define SK_SEN_PCI_5V_HIGH_WARN 5346 /* Voltage PCI High Warn Threshold */ #define SK_SEN_PCI_5V_HIGH_WARN 5346 /* Voltage PCI High Warn Threshold */
#define SK_SEN_PCI_5V_LOW_WARN 4664 /* Voltage PCI Low Warn Threshold */ #define SK_SEN_PCI_5V_LOW_WARN 4664 /* Voltage PCI Low Warn Threshold */
#define SK_SEN_PCI_5V_LOW_ERR 4422 /* Voltage PCI Low Err Threshold */ #define SK_SEN_PCI_5V_LOW_ERR 4422 /* Voltage PCI Low Err Threshold */
...@@ -229,17 +235,16 @@ ...@@ -229,17 +235,16 @@
#define SK_SEN_PCI_IO_3V3_HIGH_ERR 3850 /* + 15% V PCI-IO High Err Threshold */ #define SK_SEN_PCI_IO_3V3_HIGH_ERR 3850 /* + 15% V PCI-IO High Err Threshold */
#define SK_SEN_PCI_IO_3V3_HIGH_WARN 3674 /* + 10% V PCI-IO High Warn Threshold */ #define SK_SEN_PCI_IO_3V3_HIGH_WARN 3674 /* + 10% V PCI-IO High Warn Threshold */
/* 3300 mVolt */ /* 3300 mVolt */
#define SK_SEN_PCI_IO_3V3_LOW_WARN 2926 /* - 10% V PCI-IO Low Warn Threshold */ #define SK_SEN_PCI_IO_3V3_LOW_WARN 2926 /* - 10% V PCI-IO Low Warn Threshold */
#define SK_SEN_PCI_IO_3V3_LOW_ERR 2772 /* - 15% V PCI-IO Low Err Threshold */ #define SK_SEN_PCI_IO_3V3_LOW_ERR 2772 /* - 15% V PCI-IO Low Err Threshold */
/* /*
* VDD voltage * VDD voltage
*/ */
#define SK_SEN_VDD_HIGH_ERR 3630 /* Voltage ASIC High Err Threshold */ #define SK_SEN_VDD_HIGH_ERR 3630 /* Voltage ASIC High Err Threshold */
#define SK_SEN_VDD_HIGH_WARN 3476 /* Voltage ASIC High Warn Threshold */ #define SK_SEN_VDD_HIGH_WARN 3476 /* Voltage ASIC High Warn Threshold */
#define SK_SEN_VDD_LOW_WARN 3146 /* Voltage ASIC Low Warn Threshold */ #define SK_SEN_VDD_LOW_WARN 3146 /* Voltage ASIC Low Warn Threshold */
#define SK_SEN_VDD_LOW_ERR 2970 /* Voltage ASIC Low Err Threshold */ #define SK_SEN_VDD_LOW_ERR 2970 /* Voltage ASIC Low Err Threshold */
/* /*
* PHY PLL 3V3 voltage * PHY PLL 3V3 voltage
...@@ -255,8 +260,8 @@ ...@@ -255,8 +260,8 @@
#define SK_SEN_VAUX_3V3_HIGH_ERR 3630 /* Voltage VAUX High Err Threshold */ #define SK_SEN_VAUX_3V3_HIGH_ERR 3630 /* Voltage VAUX High Err Threshold */
#define SK_SEN_VAUX_3V3_HIGH_WARN 3476 /* Voltage VAUX High Warn Threshold */ #define SK_SEN_VAUX_3V3_HIGH_WARN 3476 /* Voltage VAUX High Warn Threshold */
#define SK_SEN_VAUX_3V3_LOW_WARN 3146 /* Voltage VAUX Low Warn Threshold */ #define SK_SEN_VAUX_3V3_LOW_WARN 3146 /* Voltage VAUX Low Warn Threshold */
#define SK_SEN_VAUX_3V3_LOW_ERR 2970 /* Voltage VAUX Low Err Threshold */ #define SK_SEN_VAUX_3V3_LOW_ERR 2970 /* Voltage VAUX Low Err Threshold */
#define SK_SEN_VAUX_0V_WARN_ERR 0 /* if VAUX not present */ #define SK_SEN_VAUX_0V_WARN_ERR 0 /* if VAUX not present */
#define SK_SEN_VAUX_RANGE_LIMITER 1000 /* 1000 mV range delimiter */ #define SK_SEN_VAUX_RANGE_LIMITER 1000 /* 1000 mV range delimiter */
/* /*
...@@ -270,7 +275,7 @@ ...@@ -270,7 +275,7 @@
/* /*
* ASIC Core 1V5 voltage (YUKON only) * ASIC Core 1V5 voltage (YUKON only)
*/ */
#define SK_SEN_CORE_1V5_HIGH_ERR 1650 /* Voltage ASIC Core High Err Threshold */ #define SK_SEN_CORE_1V5_HIGH_ERR 1650 /* Voltage ASIC Core High Err Threshold */
#define SK_SEN_CORE_1V5_HIGH_WARN 1575 /* Voltage ASIC Core High Warn Threshold */ #define SK_SEN_CORE_1V5_HIGH_WARN 1575 /* Voltage ASIC Core High Warn Threshold */
#define SK_SEN_CORE_1V5_LOW_WARN 1425 /* Voltage ASIC Core Low Warn Threshold */ #define SK_SEN_CORE_1V5_LOW_WARN 1425 /* Voltage ASIC Core Low Warn Threshold */
#define SK_SEN_CORE_1V5_LOW_ERR 1350 /* Voltage ASIC Core Low Err Threshold */ #define SK_SEN_CORE_1V5_LOW_ERR 1350 /* Voltage ASIC Core Low Err Threshold */
...@@ -285,8 +290,8 @@ ...@@ -285,8 +290,8 @@
*/ */
#define SK_SEN_FAN_HIGH_ERR 20000 /* FAN Speed High Err Threshold */ #define SK_SEN_FAN_HIGH_ERR 20000 /* FAN Speed High Err Threshold */
#define SK_SEN_FAN_HIGH_WARN 20000 /* FAN Speed High Warn Threshold */ #define SK_SEN_FAN_HIGH_WARN 20000 /* FAN Speed High Warn Threshold */
#define SK_SEN_FAN_LOW_WARN 5200 /* FAN Speed Low Warn Threshold */ #define SK_SEN_FAN_LOW_WARN 5200 /* FAN Speed Low Warn Threshold */
#define SK_SEN_FAN_LOW_ERR 4550 /* FAN Speed Low Err Threshold */ #define SK_SEN_FAN_LOW_ERR 4550 /* FAN Speed Low Err Threshold */
/* /*
* Some Voltages need dynamic thresholds * Some Voltages need dynamic thresholds
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* *
* Name: skgeinit.h * Name: skgeinit.h
* Project: Gigabit Ethernet Adapters, Common Modules * Project: Gigabit Ethernet Adapters, Common Modules
* Version: $Revision: 1.81 $ * Version: $Revision: 1.83 $
* Date: $Date: 2003/07/04 12:30:38 $ * Date: $Date: 2003/09/16 14:07:37 $
* Purpose: Structures and prototypes for the GE Init Module * Purpose: Structures and prototypes for the GE Init Module
* *
******************************************************************************/ ******************************************************************************/
...@@ -27,6 +27,23 @@ ...@@ -27,6 +27,23 @@
* History: * History:
* *
* $Log: skgeinit.h,v $ * $Log: skgeinit.h,v $
* Revision 1.83 2003/09/16 14:07:37 rschmidt
* Moved defines for PHY power down modes from skgehw.h
* Added prototypes for SkMacClearRst()
* Editorial changes
*
* Revision 1.82 2003/09/16 07:18:36 mschmid
* Added members to port structure for MAC control
* - PMacColThres
* - PMacJamLen
* - PMacJamIpgVal
* - PMacJamIpgData
* - PMacIpgData
* - PMacLimit4
* Added PHY power state to port structure
* - PPhyPowerState
* Added function prototypes to enter and leave low power modes
*
* Revision 1.81 2003/07/04 12:30:38 rschmidt * Revision 1.81 2003/07/04 12:30:38 rschmidt
* Added SK_FAR to pointers in MAC statistic functions (for PXE) * Added SK_FAR to pointers in MAC statistic functions (for PXE)
* Editorial changes * Editorial changes
...@@ -594,6 +611,13 @@ extern "C" { ...@@ -594,6 +611,13 @@ extern "C" {
#define SK_PRT_INIT 2 /* the port is initialized */ #define SK_PRT_INIT 2 /* the port is initialized */
#define SK_PRT_RUN 3 /* the port has an active link */ #define SK_PRT_RUN 3 /* the port has an active link */
/* PHY power down modes */
#define PHY_PM_OPERATIONAL_MODE 0 /* PHY operational mode */
#define PHY_PM_DEEP_SLEEP 1 /* coma mode --> minimal power */
#define PHY_PM_IEEE_POWER_DOWN 2 /* IEEE 22.2.4.1.5 compl. power down */
#define PHY_PM_ENERGY_DETECT 3 /* energy detect */
#define PHY_PM_ENERGY_DETECT_PLUS 4 /* energy detect plus */
/* Default receive frame limit for Workaround of XMAC Errata */ /* Default receive frame limit for Workaround of XMAC Errata */
#define SK_DEF_RX_WA_LIM SK_CONSTU64(100) #define SK_DEF_RX_WA_LIM SK_CONSTU64(100)
...@@ -685,6 +709,13 @@ typedef struct s_GePort { ...@@ -685,6 +709,13 @@ typedef struct s_GePort {
SK_U8 PCableLen; /* Cable Length */ SK_U8 PCableLen; /* Cable Length */
SK_U8 PMdiPairLen[4]; /* MDI[0..3] Pair Length */ SK_U8 PMdiPairLen[4]; /* MDI[0..3] Pair Length */
SK_U8 PMdiPairSts[4]; /* MDI[0..3] Pair Diagnostic Status */ SK_U8 PMdiPairSts[4]; /* MDI[0..3] Pair Diagnostic Status */
SK_U8 PPhyPowerState; /* PHY current power state */
int PMacColThres; /* MAC Collision Threshold */
int PMacJamLen; /* MAC Jam length */
int PMacJamIpgVal; /* MAC Jam IPG */
int PMacJamIpgData; /* MAC IPG Jam to Data */
int PMacIpgData; /* MAC Data IPG */
SK_BOOL PMacLimit4; /* reset collision counter and backoff algorithm */
} SK_GEPORT; } SK_GEPORT;
/* /*
...@@ -865,6 +896,11 @@ extern void SkMacHardRst( ...@@ -865,6 +896,11 @@ extern void SkMacHardRst(
SK_IOC IoC, SK_IOC IoC,
int Port); int Port);
extern void SkMacClearRst(
SK_AC *pAC,
SK_IOC IoC,
int Port);
extern void SkXmInitMac( extern void SkXmInitMac(
SK_AC *pAC, SK_AC *pAC,
SK_IOC IoC, SK_IOC IoC,
...@@ -1040,6 +1076,17 @@ extern int SkGmCableDiagStatus( ...@@ -1040,6 +1076,17 @@ extern int SkGmCableDiagStatus(
int Port, int Port,
SK_BOOL StartTest); SK_BOOL StartTest);
extern int SkGmEnterLowPowerMode(
SK_AC *pAC,
SK_IOC IoC,
int Port,
SK_U8 Mode);
extern int SkGmLeaveLowPowerMode(
SK_AC *pAC,
SK_IOC IoC,
int Port);
#ifdef SK_DIAG #ifdef SK_DIAG
extern void SkGePhyRead( extern void SkGePhyRead(
SK_AC *pAC, SK_AC *pAC,
...@@ -1101,6 +1148,7 @@ extern int SkGeInitAssignRamToQueues(); ...@@ -1101,6 +1148,7 @@ extern int SkGeInitAssignRamToQueues();
extern void SkMacRxTxDisable(); extern void SkMacRxTxDisable();
extern void SkMacSoftRst(); extern void SkMacSoftRst();
extern void SkMacHardRst(); extern void SkMacHardRst();
extern void SkMacClearRst();
extern void SkMacInitPhy(); extern void SkMacInitPhy();
extern int SkMacRxTxEnable(); extern int SkMacRxTxEnable();
extern void SkMacPromiscMode(); extern void SkMacPromiscMode();
...@@ -1131,6 +1179,8 @@ extern int SkGmResetCounter(); ...@@ -1131,6 +1179,8 @@ extern int SkGmResetCounter();
extern int SkXmOverflowStatus(); extern int SkXmOverflowStatus();
extern int SkGmOverflowStatus(); extern int SkGmOverflowStatus();
extern int SkGmCableDiagStatus(); extern int SkGmCableDiagStatus();
extern int SkGmEnterLowPowerMode();
extern int SkGmLeaveLowPowerMode();
#ifdef SK_DIAG #ifdef SK_DIAG
extern void SkGePhyRead(); extern void SkGePhyRead();
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* *
* Name: skgepnmi.h * Name: skgepnmi.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter * Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.61 $ * Version: $Revision: 1.62 $
* Date: $Date: 2003/05/23 12:53:52 $ * Date: $Date: 2003/08/15 12:31:52 $
* Purpose: Defines for Private Network Management Interface * Purpose: Defines for Private Network Management Interface
* *
****************************************************************************/ ****************************************************************************/
...@@ -27,6 +27,18 @@ ...@@ -27,6 +27,18 @@
* History: * History:
* *
* $Log: skgepnmi.h,v $ * $Log: skgepnmi.h,v $
* Revision 1.62 2003/08/15 12:31:52 tschilli
* Added new OIDs:
* OID_SKGE_DRIVER_RELDATE
* OID_SKGE_DRIVER_FILENAME
* OID_SKGE_CHIPID
* OID_SKGE_RAMSIZE
* OID_SKGE_VAUXAVAIL
* OID_SKGE_PHY_TYPE
* OID_SKGE_PHY_LP_MODE
*
* Added new define SK_DIAG_ATTACHED for OID_SKGE_DIAG_MODE handling.
*
* Revision 1.61 2003/05/23 12:53:52 tschilli * Revision 1.61 2003/05/23 12:53:52 tschilli
* Generic PNMI IOCTL subcommands added. * Generic PNMI IOCTL subcommands added.
* Function prototype SkPnmiGenIoctl() added. * Function prototype SkPnmiGenIoctl() added.
...@@ -568,15 +580,23 @@ ...@@ -568,15 +580,23 @@
#define OID_SKGE_ALL_DATA 0xFF020190 #define OID_SKGE_ALL_DATA 0xFF020190
/* Defines for VCT. */ /* Defines for VCT. */
#define OID_SKGE_VCT_GET 0xFF020200 #define OID_SKGE_VCT_GET 0xFF020200
#define OID_SKGE_VCT_SET 0xFF020201 #define OID_SKGE_VCT_SET 0xFF020201
#define OID_SKGE_VCT_STATUS 0xFF020202 #define OID_SKGE_VCT_STATUS 0xFF020202
#ifdef SK_DIAG_SUPPORT #ifdef SK_DIAG_SUPPORT
/* Defines for driver DIAG mode. */ /* Defines for driver DIAG mode. */
#define OID_SKGE_DIAG_MODE 0xFF020204 #define OID_SKGE_DIAG_MODE 0xFF020204
#endif /* SK_DIAG_SUPPORT */ #endif /* SK_DIAG_SUPPORT */
/* New OIDs */
#define OID_SKGE_DRIVER_RELDATE 0xFF020210
#define OID_SKGE_DRIVER_FILENAME 0xFF020211
#define OID_SKGE_CHIPID 0xFF020212
#define OID_SKGE_RAMSIZE 0xFF020213
#define OID_SKGE_VAUXAVAIL 0xFF020214
#define OID_SKGE_PHY_TYPE 0xFF020215
#define OID_SKGE_PHY_LP_MODE 0xFF020216
/* VCT struct to store a backup copy of VCT data after a port reset. */ /* VCT struct to store a backup copy of VCT data after a port reset. */
typedef struct s_PnmiVct { typedef struct s_PnmiVct {
...@@ -613,6 +633,12 @@ typedef struct s_PnmiVct { ...@@ -613,6 +633,12 @@ typedef struct s_PnmiVct {
#define OID_SKGE_TRAP_RLMT_PORT_UP 523 #define OID_SKGE_TRAP_RLMT_PORT_UP 523
#define OID_SKGE_TRAP_RLMT_SEGMENTATION 524 #define OID_SKGE_TRAP_RLMT_SEGMENTATION 524
#ifdef SK_DIAG_SUPPORT
/* Defines for driver DIAG mode. */
#define SK_DIAG_ATTACHED 2
#define SK_DIAG_RUNNING 1
#define SK_DIAG_IDLE 0
#endif /* SK_DIAG_SUPPORT */
/* /*
* Generic PNMI IOCTL subcommand definitions. * Generic PNMI IOCTL subcommand definitions.
...@@ -730,6 +756,14 @@ typedef struct s_PnmiVct { ...@@ -730,6 +756,14 @@ typedef struct s_PnmiVct {
#define SK_PNMI_ERR051MSG "SkPnmiEvent: Port switch suspicious" #define SK_PNMI_ERR051MSG "SkPnmiEvent: Port switch suspicious"
#define SK_PNMI_ERR052 (SK_ERRBASE_PNMI + 52) #define SK_PNMI_ERR052 (SK_ERRBASE_PNMI + 52)
#define SK_PNMI_ERR052MSG "" #define SK_PNMI_ERR052MSG ""
#define SK_PNMI_ERR053 (SK_ERRBASE_PNMI + 53)
#define SK_PNMI_ERR053MSG "General: Driver release date not initialized"
#define SK_PNMI_ERR054 (SK_ERRBASE_PNMI + 54)
#define SK_PNMI_ERR054MSG "General: Driver release date string too long"
#define SK_PNMI_ERR055 (SK_ERRBASE_PNMI + 55)
#define SK_PNMI_ERR055MSG "General: Driver file name not initialized"
#define SK_PNMI_ERR056 (SK_ERRBASE_PNMI + 56)
#define SK_PNMI_ERR056MSG "General: Driver file name string too long"
/* /*
* Management counter macros called by the driver * Management counter macros called by the driver
...@@ -740,6 +774,11 @@ typedef struct s_PnmiVct { ...@@ -740,6 +774,11 @@ typedef struct s_PnmiVct {
#define SK_PNMI_SET_DRIVER_VER(pAC,v) ((pAC)->Pnmi.pDriverVersion = \ #define SK_PNMI_SET_DRIVER_VER(pAC,v) ((pAC)->Pnmi.pDriverVersion = \
(char *)(v)) (char *)(v))
#define SK_PNMI_SET_DRIVER_RELDATE(pAC,v) ((pAC)->Pnmi.pDriverReleaseDate = \
(char *)(v))
#define SK_PNMI_SET_DRIVER_FILENAME(pAC,v) ((pAC)->Pnmi.pDriverFileName = \
(char *)(v))
#define SK_PNMI_CNT_TX_QUEUE_LEN(pAC,v,p) \ #define SK_PNMI_CNT_TX_QUEUE_LEN(pAC,v,p) \
{ \ { \
...@@ -916,6 +955,8 @@ typedef struct s_PnmiConf { ...@@ -916,6 +955,8 @@ typedef struct s_PnmiConf {
char ConfMacFactoryAddr[6]; char ConfMacFactoryAddr[6];
SK_U8 ConfPMD; SK_U8 ConfPMD;
SK_U8 ConfConnector; SK_U8 ConfConnector;
SK_U32 ConfPhyType;
SK_U32 ConfPhyMode;
SK_U8 ConfLinkCapability; SK_U8 ConfLinkCapability;
SK_U8 ConfLinkMode; SK_U8 ConfLinkMode;
SK_U8 ConfLinkModeStatus; SK_U8 ConfLinkModeStatus;
...@@ -964,9 +1005,14 @@ typedef struct s_PnmiStrucData { ...@@ -964,9 +1005,14 @@ typedef struct s_PnmiStrucData {
SK_U32 DeviceType; SK_U32 DeviceType;
char DriverDescr[SK_PNMI_STRINGLEN1]; char DriverDescr[SK_PNMI_STRINGLEN1];
char DriverVersion[SK_PNMI_STRINGLEN2]; char DriverVersion[SK_PNMI_STRINGLEN2];
char DriverReleaseDate[SK_PNMI_STRINGLEN1];
char DriverFileName[SK_PNMI_STRINGLEN1];
char HwDescr[SK_PNMI_STRINGLEN1]; char HwDescr[SK_PNMI_STRINGLEN1];
char HwVersion[SK_PNMI_STRINGLEN2]; char HwVersion[SK_PNMI_STRINGLEN2];
SK_U16 Chipset; SK_U16 Chipset;
SK_U32 ChipId;
SK_U8 VauxAvail;
SK_U32 RamSize;
SK_U32 MtuSize; SK_U32 MtuSize;
SK_U32 Action; SK_U32 Action;
SK_U32 TestResult; SK_U32 TestResult;
...@@ -1090,6 +1136,8 @@ typedef struct s_PnmiData { ...@@ -1090,6 +1136,8 @@ typedef struct s_PnmiData {
char *pDriverDescription; char *pDriverDescription;
char *pDriverVersion; char *pDriverVersion;
char *pDriverReleaseDate;
char *pDriverFileName;
int MacUpdatedFlag; int MacUpdatedFlag;
int RlmtUpdatedFlag; int RlmtUpdatedFlag;
...@@ -1119,6 +1167,9 @@ typedef struct s_PnmiData { ...@@ -1119,6 +1167,9 @@ typedef struct s_PnmiData {
SK_U8 VctStatus[SK_MAX_MACS]; SK_U8 VctStatus[SK_MAX_MACS];
SK_PNMI_VCT VctBackup[SK_MAX_MACS]; SK_PNMI_VCT VctBackup[SK_MAX_MACS];
SK_PNMI_VCT_TIMER VctTimeout[SK_MAX_MACS]; SK_PNMI_VCT_TIMER VctTimeout[SK_MAX_MACS];
#ifdef SK_DIAG_SUPPORT
SK_U32 DiagAttached;
#endif /* SK_DIAG_SUPPORT */
} SK_PNMI; } SK_PNMI;
......
/****************************************************************************** /******************************************************************************
* *
* Name: ski2c.h * Name: ski2c.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter * Project: Gigabit Ethernet Adapters, TWSI-Module
* Version: $Revision: 1.34 $ * Version: $Revision: 1.35 $
* Date: $Date: 2003/01/28 09:11:21 $ * Date: $Date: 2003/10/20 09:06:30 $
* Purpose: Defines to access Voltage and Temperature Sensor * Purpose: Defines to access Voltage and Temperature Sensor
* *
******************************************************************************/ ******************************************************************************/
/****************************************************************************** /******************************************************************************
* *
* (C)Copyright 1998-2003 SysKonnect GmbH. * (C)Copyright 1998-2002 SysKonnect.
* (C)Copyright 2002-2003 Marvell.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -26,6 +27,10 @@ ...@@ -26,6 +27,10 @@
* History: * History:
* *
* $Log: ski2c.h,v $ * $Log: ski2c.h,v $
* Revision 1.35 2003/10/20 09:06:30 rschmidt
* Added prototypes for SkI2cRead() and SkI2cWrite().
* Editorial changes.
*
* Revision 1.34 2003/01/28 09:11:21 rschmidt * Revision 1.34 2003/01/28 09:11:21 rschmidt
* Editorial changes * Editorial changes
* *
...@@ -137,7 +142,6 @@ ...@@ -137,7 +142,6 @@
* Revision 1.1 1998/06/19 14:30:10 malthoff * Revision 1.1 1998/06/19 14:30:10 malthoff
* Created. Sources taken from ML Project. * Created. Sources taken from ML Project.
* *
*
******************************************************************************/ ******************************************************************************/
/* /*
...@@ -252,7 +256,7 @@ struct s_Sensor { ...@@ -252,7 +256,7 @@ struct s_Sensor {
SK_I32 SenThreWarnLow; /* Lower warning Threshold of the sensor */ SK_I32 SenThreWarnLow; /* Lower warning Threshold of the sensor */
int SenErrFlag; /* Sensor indicated an error */ int SenErrFlag; /* Sensor indicated an error */
SK_BOOL SenInit; /* Is sensor initialized ? */ SK_BOOL SenInit; /* Is sensor initialized ? */
SK_U64 SenErrCts; /* Error trap counter */ SK_U64 SenErrCts; /* Error trap counter */
SK_U64 SenWarnCts; /* Warning trap counter */ SK_U64 SenWarnCts; /* Warning trap counter */
SK_U64 SenBegErrTS; /* Begin error timestamp */ SK_U64 SenBegErrTS; /* Begin error timestamp */
SK_U64 SenBegWarnTS; /* Begin warning timestamp */ SK_U64 SenBegWarnTS; /* Begin warning timestamp */
...@@ -279,13 +283,17 @@ typedef struct s_I2c { ...@@ -279,13 +283,17 @@ typedef struct s_I2c {
#endif /* !SK_DIAG */ #endif /* !SK_DIAG */
} SK_I2C; } SK_I2C;
extern int SkI2cInit(SK_AC *pAC, SK_IOC IoC, int Level);
extern int SkI2cWrite(SK_AC *pAC, SK_IOC IoC, SK_U32 Data, int Dev, int Size,
int Reg, int Burst);
extern int SkI2cReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen); extern int SkI2cReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen);
#ifndef SK_DIAG #ifdef SK_DIAG
extern SK_U32 SkI2cRead(SK_AC *pAC, SK_IOC IoC, int Dev, int Size, int Reg,
int Burst);
#else /* !SK_DIAG */
extern int SkI2cEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Para); extern int SkI2cEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Para);
extern int SkI2cInit(SK_AC *pAC, SK_IOC IoC, int Level);
extern void SkI2cWaitIrq(SK_AC *pAC, SK_IOC IoC); extern void SkI2cWaitIrq(SK_AC *pAC, SK_IOC IoC);
extern void SkI2cIsr(SK_AC *pAC, SK_IOC IoC); extern void SkI2cIsr(SK_AC *pAC, SK_IOC IoC);
#endif /* !SK_DIAG */
#endif
#endif /* n_SKI2C_H */ #endif /* n_SKI2C_H */
/****************************************************************************** /******************************************************************************
* *
* Name: skqueue.h * Name: skqueue.h
* Project: Gigabit Ethernet Adapters, Schedule-Modul * Project: Gigabit Ethernet Adapters, Event Scheduler Module
* Version: $Revision: 1.15 $ * Version: $Revision: 1.16 $
* Date: $Date: 2003/05/13 17:54:57 $ * Date: $Date: 2003/09/16 12:50:32 $
* Purpose: Defines for the Event queue * Purpose: Defines for the Event queue
* *
******************************************************************************/ ******************************************************************************/
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
* History: * History:
* *
* $Log: skqueue.h,v $ * $Log: skqueue.h,v $
* Revision 1.16 2003/09/16 12:50:32 rschmidt
* Editorial changes
*
* Revision 1.15 2003/05/13 17:54:57 mkarl * Revision 1.15 2003/05/13 17:54:57 mkarl
* Editorial changes. * Editorial changes.
* *
...@@ -47,7 +50,7 @@ ...@@ -47,7 +50,7 @@
* add: typedef SK_QUEUE * add: typedef SK_QUEUE
* *
* Revision 1.9 1998/08/19 09:50:59 gklug * Revision 1.9 1998/08/19 09:50:59 gklug
* fix: remove struct keyword from c-code (see CCC) add typedefs * fix: remove struct keyword from C-code (see CCC) add typedefs
* *
* Revision 1.8 1998/08/18 07:00:01 gklug * Revision 1.8 1998/08/18 07:00:01 gklug
* fix: SK_PTR not defined use void * instead. * fix: SK_PTR not defined use void * instead.
...@@ -74,8 +77,6 @@ ...@@ -74,8 +77,6 @@
* Revision 1.1 1998/07/30 14:52:12 gklug * Revision 1.1 1998/07/30 14:52:12 gklug
* Initial version. * Initial version.
* Defines Event Classes, Event structs and queue management variables. * Defines Event Classes, Event structs and queue management variables.
*
*
* *
******************************************************************************/ ******************************************************************************/
...@@ -92,7 +93,7 @@ ...@@ -92,7 +93,7 @@
*/ */
#define SKGE_DRV 1 /* Driver Event Class */ #define SKGE_DRV 1 /* Driver Event Class */
#define SKGE_RLMT 2 /* RLMT Event Class */ #define SKGE_RLMT 2 /* RLMT Event Class */
#define SKGE_I2C 3 /* i2C Event Class */ #define SKGE_I2C 3 /* I2C Event Class */
#define SKGE_PNMI 4 /* PNMI Event Class */ #define SKGE_PNMI 4 /* PNMI Event Class */
#define SKGE_CSUM 5 /* Checksum Event Class */ #define SKGE_CSUM 5 /* Checksum Event Class */
#define SKGE_HWAC 6 /* Hardware Access Event Class */ #define SKGE_HWAC 6 /* Hardware Access Event Class */
...@@ -121,25 +122,25 @@ typedef union u_EvPara { ...@@ -121,25 +122,25 @@ typedef union u_EvPara {
* Event Queue * Event Queue
* skqueue.c * skqueue.c
* events are class/value pairs * events are class/value pairs
* class is addressee, e.g. RMT, PCM etc. * class is addressee, e.g. RLMT, PNMI etc.
* value is command, e.g. line state change, ring op change etc. * value is command, e.g. line state change, ring op change etc.
*/ */
typedef struct s_EventElem { typedef struct s_EventElem {
SK_U32 Class ; /* Event class */ SK_U32 Class; /* Event class */
SK_U32 Event ; /* Event value */ SK_U32 Event; /* Event value */
SK_EVPARA Para ; /* Event parameter */ SK_EVPARA Para; /* Event parameter */
} SK_EVENTELEM; } SK_EVENTELEM;
typedef struct s_Queue { typedef struct s_Queue {
SK_EVENTELEM EvQueue[SK_MAX_EVENT]; SK_EVENTELEM EvQueue[SK_MAX_EVENT];
SK_EVENTELEM *EvPut ; SK_EVENTELEM *EvPut;
SK_EVENTELEM *EvGet ; SK_EVENTELEM *EvGet;
} SK_QUEUE; } SK_QUEUE;
extern void SkEventInit(SK_AC *pAC, SK_IOC Ioc, int Level); extern void SkEventInit(SK_AC *pAC, SK_IOC Ioc, int Level);
extern void SkEventQueue(SK_AC *pAC, SK_U32 Class, SK_U32 Event, extern void SkEventQueue(SK_AC *pAC, SK_U32 Class, SK_U32 Event,
SK_EVPARA Para); SK_EVPARA Para);
extern int SkEventDispatcher(SK_AC *pAC,SK_IOC Ioc); extern int SkEventDispatcher(SK_AC *pAC, SK_IOC Ioc);
/* Define Error Numbers and messages */ /* Define Error Numbers and messages */
......
/****************************************************************************** /******************************************************************************
* *
* Name: sktimer.h * Name: sktimer.h
* Project: Gigabit Ethernet Adapters, Schedule-Modul * Project: Gigabit Ethernet Adapters, Event Scheduler Module
* Version: $Revision: 1.10 $ * Version: $Revision: 1.11 $
* Date: $Date: 2003/05/13 17:56:44 $ * Date: $Date: 2003/09/16 12:58:18 $
* Purpose: Defines for the timer functions * Purpose: Defines for the timer functions
* *
******************************************************************************/ ******************************************************************************/
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
* History: * History:
* *
* $Log: sktimer.h,v $ * $Log: sktimer.h,v $
* Revision 1.11 2003/09/16 12:58:18 rschmidt
* Editorial changes
*
* Revision 1.10 2003/05/13 17:56:44 mkarl * Revision 1.10 2003/05/13 17:56:44 mkarl
* Editorial changes. * Editorial changes.
* *
...@@ -40,7 +43,7 @@ ...@@ -40,7 +43,7 @@
* fix: SK_TIMCTRL needs to be defined * fix: SK_TIMCTRL needs to be defined
* *
* Revision 1.6 1998/08/19 09:51:00 gklug * Revision 1.6 1998/08/19 09:51:00 gklug
* fix: remove struct keyword from c-code (see CCC) add typedefs * fix: remove struct keyword from C-code (see CCC) add typedefs
* *
* Revision 1.5 1998/08/17 13:43:21 gklug * Revision 1.5 1998/08/17 13:43:21 gklug
* chg: Parameter will be union of 64bit para, 2 times SK_U32 or SK_PTR * chg: Parameter will be union of 64bit para, 2 times SK_U32 or SK_PTR
...@@ -78,25 +81,25 @@ ...@@ -78,25 +81,25 @@
typedef struct s_Timer SK_TIMER; typedef struct s_Timer SK_TIMER;
struct s_Timer { struct s_Timer {
SK_TIMER *TmNext ; /* linked list */ SK_TIMER *TmNext; /* linked list */
SK_U32 TmClass ; /* Timer Event class */ SK_U32 TmClass; /* Timer Event class */
SK_U32 TmEvent ; /* Timer Event value */ SK_U32 TmEvent; /* Timer Event value */
SK_EVPARA TmPara ; /* Timer Event parameter */ SK_EVPARA TmPara; /* Timer Event parameter */
SK_U32 TmDelta ; /* delta time */ SK_U32 TmDelta; /* delta time */
int TmActive ; /* flag : active/inactive */ int TmActive; /* flag: active/inactive */
} ; };
/* /*
* Timer control struct. * Timer control struct.
* - use in Adapters context name pAC->Tim * - use in Adapters context name pAC->Tim
*/ */
typedef struct s_TimCtrl { typedef struct s_TimCtrl {
SK_TIMER *StQueue ; /* Head of Timer queue */ SK_TIMER *StQueue; /* Head of Timer queue */
} SK_TIMCTRL ; } SK_TIMCTRL;
extern void SkTimerInit(SK_AC *pAC,SK_IOC Ioc, int Level); extern void SkTimerInit(SK_AC *pAC, SK_IOC Ioc, int Level);
extern void SkTimerStop(SK_AC *pAC,SK_IOC Ioc,SK_TIMER *pTimer); extern void SkTimerStop(SK_AC *pAC, SK_IOC Ioc, SK_TIMER *pTimer);
extern void SkTimerStart(SK_AC *pAC,SK_IOC Ioc,SK_TIMER *pTimer, extern void SkTimerStart(SK_AC *pAC, SK_IOC Ioc, SK_TIMER *pTimer,
SK_U32 Time,SK_U32 Class,SK_U32 Event,SK_EVPARA Para); SK_U32 Time, SK_U32 Class, SK_U32 Event, SK_EVPARA Para);
extern void SkTimerDone(SK_AC *pAC,SK_IOC Ioc); extern void SkTimerDone(SK_AC *pAC, SK_IOC Ioc);
#endif /* _SKTIMER_H_ */ #endif /* _SKTIMER_H_ */
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
* *
* Name: sktypes.h * Name: sktypes.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter * Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.1 $ * Version: $Revision: 1.2 $
* Date: $Date: 2003/07/21 07:26:01 $ * Date: $Date: 2003/10/07 08:16:51 $
* Purpose: Define data types for Linux * Purpose: Define data types for Linux
* *
******************************************************************************/ ******************************************************************************/
/****************************************************************************** /******************************************************************************
* *
* (C)Copyright 1998-2003 SysKonnect GmbH. * (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -26,6 +27,9 @@ ...@@ -26,6 +27,9 @@
* History: * History:
* *
* $Log: sktypes.h,v $ * $Log: sktypes.h,v $
* Revision 1.2 2003/10/07 08:16:51 mlindner
* Fix: Copyright changes
*
* Revision 1.1 2003/07/21 07:26:01 rroesler * Revision 1.1 2003/07/21 07:26:01 rroesler
* Fix: Re-Enter after CVS crash * Fix: Re-Enter after CVS crash
* *
......
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
* *
* Name: version.h * Name: version.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter * Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.3 $ * Version: $Revision: 1.5 $
* Date: $Date: 2003/08/25 13:34:48 $ * Date: $Date: 2003/10/07 08:16:51 $
* Purpose: SK specific Error log support * Purpose: SK specific Error log support
* *
******************************************************************************/ ******************************************************************************/
/****************************************************************************** /******************************************************************************
* *
* (C)Copyright 1998-2003 SysKonnect GmbH. * (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -25,6 +26,12 @@ ...@@ -25,6 +26,12 @@
* *
* History: * History:
* $Log: skversion.h,v $ * $Log: skversion.h,v $
* Revision 1.5 2003/10/07 08:16:51 mlindner
* Fix: Copyright changes
*
* Revision 1.4 2003/09/22 08:40:10 mlindner
* Add: Added DRIVER_FILE_NAME and DRIVER_REL_DATE
*
* Revision 1.3 2003/08/25 13:34:48 mlindner * Revision 1.3 2003/08/25 13:34:48 mlindner
* Fix: Lint changes * Fix: Lint changes
* *
...@@ -54,12 +61,14 @@ ...@@ -54,12 +61,14 @@
#ifdef lint #ifdef lint
static const char SysKonnectFileId[] = "@(#) (C) SysKonnect GmbH."; static const char SysKonnectFileId[] = "@(#) (C) SysKonnect GmbH.";
static const char SysKonnectBuildNumber[] = static const char SysKonnectBuildNumber[] =
"@(#)SK-BUILD: 6.18 PL: 01"; "@(#)SK-BUILD: 6.21 PL: 01";
#endif /* !defined(lint) */ #endif /* !defined(lint) */
#define BOOT_STRING "sk98lin: Network Device Driver v6.18\n" \ #define BOOT_STRING "sk98lin: Network Device Driver v6.21\n" \
"(C)Copyright 1999-2003 Marvell(R)." "(C)Copyright 1999-2003 Marvell(R)."
#define VER_STRING "6.18" #define VER_STRING "6.21"
#define DRIVER_FILE_NAME "sk98lin"
#define DRIVER_REL_DATE "Dec-15-2003"
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* *
* Name: xmac_ii.h * Name: xmac_ii.h
* Project: Gigabit Ethernet Adapters, Common Modules * Project: Gigabit Ethernet Adapters, Common Modules
* Version: $Revision: 1.48 $ * Version: $Revision: 1.52 $
* Date: $Date: 2003/05/13 17:17:55 $ * Date: $Date: 2003/10/02 16:35:50 $
* Purpose: Defines and Macros for Gigabit Ethernet Controller * Purpose: Defines and Macros for Gigabit Ethernet Controller
* *
******************************************************************************/ ******************************************************************************/
...@@ -27,6 +27,22 @@ ...@@ -27,6 +27,22 @@
* History: * History:
* *
* $Log: xmac_ii.h,v $ * $Log: xmac_ii.h,v $
* Revision 1.52 2003/10/02 16:35:50 rschmidt
* Added defines for default values of GMAC parameters
* Changed defines for setting GMAC parameters
* Editorial changes
*
* Revision 1.51 2003/09/23 09:04:27 malthoff
* Add bit definitions for PHY_MARV_EXT_P_STAT.
*
* Revision 1.50 2003/09/16 14:15:07 rschmidt
* Added defines for Extended PHY Specific Control
* Editorial changes
*
* Revision 1.49 2003/09/16 07:22:46 mschmid
* Added defines for Marvell PHY energy detect modes
* Added macros for MAC parameter setting in port structure
*
* Revision 1.48 2003/05/13 17:17:55 mkarl * Revision 1.48 2003/05/13 17:17:55 mkarl
* Editorial changes. * Editorial changes.
* *
...@@ -676,7 +692,7 @@ extern "C" { ...@@ -676,7 +692,7 @@ extern "C" {
#define PHY_XMAC_AUNE_LP 0x05 /* 16 bit r/o Link Partner Abi Reg */ #define PHY_XMAC_AUNE_LP 0x05 /* 16 bit r/o Link Partner Abi Reg */
#define PHY_XMAC_AUNE_EXP 0x06 /* 16 bit r/o Auto-Neg. Expansion Reg */ #define PHY_XMAC_AUNE_EXP 0x06 /* 16 bit r/o Auto-Neg. Expansion Reg */
#define PHY_XMAC_NEPG 0x07 /* 16 bit r/w Next Page Register */ #define PHY_XMAC_NEPG 0x07 /* 16 bit r/w Next Page Register */
#define PHY_XMAC_NEPG_LP 0x08 /* 16 bit r/o Next Page Link P Reg */ #define PHY_XMAC_NEPG_LP 0x08 /* 16 bit r/o Next Page Link Partner */
/* 0x09 - 0x0e: reserved */ /* 0x09 - 0x0e: reserved */
#define PHY_XMAC_EXT_STAT 0x0f /* 16 bit r/o Ext Status Register */ #define PHY_XMAC_EXT_STAT 0x0f /* 16 bit r/o Ext Status Register */
#define PHY_XMAC_RES_ABI 0x10 /* 16 bit r/o PHY Resolved Ability */ #define PHY_XMAC_RES_ABI 0x10 /* 16 bit r/o PHY Resolved Ability */
...@@ -693,7 +709,7 @@ extern "C" { ...@@ -693,7 +709,7 @@ extern "C" {
#define PHY_BCOM_AUNE_LP 0x05 /* 16 bit r/o Link Part Ability Reg */ #define PHY_BCOM_AUNE_LP 0x05 /* 16 bit r/o Link Part Ability Reg */
#define PHY_BCOM_AUNE_EXP 0x06 /* 16 bit r/o Auto-Neg. Expansion Reg */ #define PHY_BCOM_AUNE_EXP 0x06 /* 16 bit r/o Auto-Neg. Expansion Reg */
#define PHY_BCOM_NEPG 0x07 /* 16 bit r/w Next Page Register */ #define PHY_BCOM_NEPG 0x07 /* 16 bit r/w Next Page Register */
#define PHY_BCOM_NEPG_LP 0x08 /* 16 bit r/o Next Page Link P Reg */ #define PHY_BCOM_NEPG_LP 0x08 /* 16 bit r/o Next Page Link Partner */
/* Broadcom-specific registers */ /* Broadcom-specific registers */
#define PHY_BCOM_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Ctrl Reg */ #define PHY_BCOM_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Ctrl Reg */
#define PHY_BCOM_1000T_STAT 0x0a /* 16 bit r/o 1000Base-T Status Reg */ #define PHY_BCOM_1000T_STAT 0x0a /* 16 bit r/o 1000Base-T Status Reg */
...@@ -702,7 +718,7 @@ extern "C" { ...@@ -702,7 +718,7 @@ extern "C" {
#define PHY_BCOM_P_EXT_CTRL 0x10 /* 16 bit r/w PHY Extended Ctrl Reg */ #define PHY_BCOM_P_EXT_CTRL 0x10 /* 16 bit r/w PHY Extended Ctrl Reg */
#define PHY_BCOM_P_EXT_STAT 0x11 /* 16 bit r/o PHY Extended Stat Reg */ #define PHY_BCOM_P_EXT_STAT 0x11 /* 16 bit r/o PHY Extended Stat Reg */
#define PHY_BCOM_RE_CTR 0x12 /* 16 bit r/w Receive Error Counter */ #define PHY_BCOM_RE_CTR 0x12 /* 16 bit r/w Receive Error Counter */
#define PHY_BCOM_FC_CTR 0x13 /* 16 bit r/w False Carr Sense Cnt */ #define PHY_BCOM_FC_CTR 0x13 /* 16 bit r/w False Carrier Sense Cnt */
#define PHY_BCOM_RNO_CTR 0x14 /* 16 bit r/w Receiver NOT_OK Cnt */ #define PHY_BCOM_RNO_CTR 0x14 /* 16 bit r/w Receiver NOT_OK Cnt */
/* 0x15 - 0x17: reserved */ /* 0x15 - 0x17: reserved */
#define PHY_BCOM_AUX_CTRL 0x18 /* 16 bit r/w Auxiliary Control Reg */ #define PHY_BCOM_AUX_CTRL 0x18 /* 16 bit r/w Auxiliary Control Reg */
...@@ -724,7 +740,7 @@ extern "C" { ...@@ -724,7 +740,7 @@ extern "C" {
#define PHY_MARV_AUNE_LP 0x05 /* 16 bit r/o Link Part Ability Reg */ #define PHY_MARV_AUNE_LP 0x05 /* 16 bit r/o Link Part Ability Reg */
#define PHY_MARV_AUNE_EXP 0x06 /* 16 bit r/o Auto-Neg. Expansion Reg */ #define PHY_MARV_AUNE_EXP 0x06 /* 16 bit r/o Auto-Neg. Expansion Reg */
#define PHY_MARV_NEPG 0x07 /* 16 bit r/w Next Page Register */ #define PHY_MARV_NEPG 0x07 /* 16 bit r/w Next Page Register */
#define PHY_MARV_NEPG_LP 0x08 /* 16 bit r/o Next Page Link P Reg */ #define PHY_MARV_NEPG_LP 0x08 /* 16 bit r/o Next Page Link Partner */
/* Marvel-specific registers */ /* Marvel-specific registers */
#define PHY_MARV_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Ctrl Reg */ #define PHY_MARV_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Ctrl Reg */
#define PHY_MARV_1000T_STAT 0x0a /* 16 bit r/o 1000Base-T Status Reg */ #define PHY_MARV_1000T_STAT 0x0a /* 16 bit r/o 1000Base-T Status Reg */
...@@ -757,7 +773,7 @@ extern "C" { ...@@ -757,7 +773,7 @@ extern "C" {
#define PHY_LONE_AUNE_LP 0x05 /* 16 bit r/o Link Part Ability Reg */ #define PHY_LONE_AUNE_LP 0x05 /* 16 bit r/o Link Part Ability Reg */
#define PHY_LONE_AUNE_EXP 0x06 /* 16 bit r/o Auto-Neg. Expansion Reg */ #define PHY_LONE_AUNE_EXP 0x06 /* 16 bit r/o Auto-Neg. Expansion Reg */
#define PHY_LONE_NEPG 0x07 /* 16 bit r/w Next Page Register */ #define PHY_LONE_NEPG 0x07 /* 16 bit r/w Next Page Register */
#define PHY_LONE_NEPG_LP 0x08 /* 16 bit r/o Next Page Link Partner*/ #define PHY_LONE_NEPG_LP 0x08 /* 16 bit r/o Next Page Link Partner */
/* Level One-specific registers */ /* Level One-specific registers */
#define PHY_LONE_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Control Reg*/ #define PHY_LONE_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Control Reg*/
#define PHY_LONE_1000T_STAT 0x0a /* 16 bit r/o 1000Base-T Status Reg */ #define PHY_LONE_1000T_STAT 0x0a /* 16 bit r/o 1000Base-T Status Reg */
...@@ -804,12 +820,13 @@ extern "C" { ...@@ -804,12 +820,13 @@ extern "C" {
/* /*
* PHY bit definitions * PHY bit definitions
* Bits defined as PHY_X_..., PHY_B_..., PHY_L_... or PHY_N_... are * Bits defined as PHY_X_..., PHY_B_..., PHY_L_... or PHY_N_... are
* Xmac/Broadcom/LevelOne/National-specific. * XMAC/Broadcom/LevelOne/National/Marvell-specific.
* All other are general. * All other are general.
*/ */
/***** PHY_XMAC_CTRL 16 bit r/w PHY Control Register *****/ /***** PHY_XMAC_CTRL 16 bit r/w PHY Control Register *****/
/***** PHY_BCOM_CTRL 16 bit r/w PHY Control Register *****/ /***** PHY_BCOM_CTRL 16 bit r/w PHY Control Register *****/
/***** PHY_MARV_CTRL 16 bit r/w PHY Status Register *****/
/***** PHY_LONE_CTRL 16 bit r/w PHY Control Register *****/ /***** PHY_LONE_CTRL 16 bit r/w PHY Control Register *****/
#define PHY_CT_RESET (1<<15) /* Bit 15: (sc) clear all PHY related regs */ #define PHY_CT_RESET (1<<15) /* Bit 15: (sc) clear all PHY related regs */
#define PHY_CT_LOOP (1<<14) /* Bit 14: enable Loopback over PHY */ #define PHY_CT_LOOP (1<<14) /* Bit 14: enable Loopback over PHY */
...@@ -909,27 +926,20 @@ extern "C" { ...@@ -909,27 +926,20 @@ extern "C" {
/***** PHY_XMAC_AUNE_EXP 16 bit r/o Auto-Negotiation Expansion Reg *****/ /***** PHY_XMAC_AUNE_EXP 16 bit r/o Auto-Negotiation Expansion Reg *****/
/* Bit 15..4: reserved */ /* Bit 15..4: reserved */
#define PHY_AN_LP_NP (1<<3) /* Bit 3: Link Partner can Next Page */ #define PHY_ANE_LP_NP (1<<3) /* Bit 3: Link Partner can Next Page */
#define PHY_AN_LOC_NP (1<<2) /* Bit 2: Local PHY can Next Page */ #define PHY_ANE_LOC_NP (1<<2) /* Bit 2: Local PHY can Next Page */
#define PHY_AN_RX_PG (1<<1) /* Bit 1: Page Received */ #define PHY_ANE_RX_PG (1<<1) /* Bit 1: Page Received */
/* Bit 0: reserved */ /* Bit 0: reserved */
/***** PHY_BCOM_AUNE_EXP 16 bit r/o Auto-Negotiation Expansion Reg *****/ /***** PHY_BCOM_AUNE_EXP 16 bit r/o Auto-Negotiation Expansion Reg *****/
/* Bit 15..5: reserved */
#define PHY_B_AN_PDF (1<<4) /* Bit 4: Parallel Detection Fault */
/* PHY_AN_LP_NP (see XMAC) Bit 3: Link Partner can Next Page */
/* PHY_AN_LOC_NP (see XMAC) Bit 2: Local PHY can Next Page */
/* PHY_AN_RX_PG (see XMAC) Bit 1: Page Received */
#define PHY_B_AN_LP_CAP (1<<0) /* Bit 0: Link Partner Auto-Neg. Cap. */
/***** PHY_LONE_AUNE_EXP 16 bit r/o Auto-Negotiation Expansion Reg *****/ /***** PHY_LONE_AUNE_EXP 16 bit r/o Auto-Negotiation Expansion Reg *****/
#define PHY_L_AN_BP (1<<5) /* Bit 5: Base Page Indication */ /***** PHY_MARV_AUNE_EXP 16 bit r/o Auto-Negotiation Expansion Reg *****/
#define PHY_L_AN_PDF (1<<4) /* Bit 4: Parallel Detection Fault */ /* Bit 15..5: reserved */
/* PHY_AN_LP_NP (see XMAC) Bit 3: Link Partner can Next Page */ #define PHY_ANE_PAR_DF (1<<4) /* Bit 4: Parallel Detection Fault */
/* PHY_AN_LOC_NP (see XMAC) Bit 2: Local PHY can Next Page */ /* PHY_ANE_LP_NP (see XMAC) Bit 3: Link Partner can Next Page */
/* PHY_AN_RX_PG (see XMAC) Bit 1: Page Received */ /* PHY_ANE_LOC_NP (see XMAC) Bit 2: Local PHY can Next Page */
#define PHY_B_AN_LP_CAP (1<<0) /* Bit 0: Link Partner Auto-Neg. Cap. */ /* PHY_ANE_RX_PG (see XMAC) Bit 1: Page Received */
#define PHY_ANE_LP_CAP (1<<0) /* Bit 0: Link Partner Auto-Neg. Cap. */
/***** PHY_XMAC_NEPG 16 bit r/w Next Page Register *****/ /***** PHY_XMAC_NEPG 16 bit r/w Next Page Register *****/
/***** PHY_BCOM_NEPG 16 bit r/w Next Page Register *****/ /***** PHY_BCOM_NEPG 16 bit r/w Next Page Register *****/
...@@ -958,7 +968,7 @@ extern "C" { ...@@ -958,7 +968,7 @@ extern "C" {
#define PHY_X_RS_HD (1<<6) /* Bit 6: Half Duplex Mode selected */ #define PHY_X_RS_HD (1<<6) /* Bit 6: Half Duplex Mode selected */
#define PHY_X_RS_FD (1<<5) /* Bit 5: Full Duplex Mode selected */ #define PHY_X_RS_FD (1<<5) /* Bit 5: Full Duplex Mode selected */
#define PHY_X_RS_ABLMIS (1<<4) /* Bit 4: duplex or pause cap mismatch */ #define PHY_X_RS_ABLMIS (1<<4) /* Bit 4: duplex or pause cap mismatch */
#define PHY_X_RS_PAUMIS (1<<3) /* Bit 3: pause capability missmatch */ #define PHY_X_RS_PAUMIS (1<<3) /* Bit 3: pause capability mismatch */
/* Bit 2..0: reserved */ /* Bit 2..0: reserved */
/* /*
* Remote Fault Bits (PHY_X_AN_RFB) encoding * Remote Fault Bits (PHY_X_AN_RFB) encoding
...@@ -990,6 +1000,7 @@ extern "C" { ...@@ -990,6 +1000,7 @@ extern "C" {
/* Bit 7..0: reserved */ /* Bit 7..0: reserved */
/***** PHY_BCOM_1000T_STAT 16 bit r/o 1000Base-T Status Reg *****/ /***** PHY_BCOM_1000T_STAT 16 bit r/o 1000Base-T Status Reg *****/
/***** PHY_MARV_1000T_STAT 16 bit r/o 1000Base-T Status Reg *****/
#define PHY_B_1000S_MSF (1<<15) /* Bit 15: Master/Slave Fault */ #define PHY_B_1000S_MSF (1<<15) /* Bit 15: Master/Slave Fault */
#define PHY_B_1000S_MSR (1<<14) /* Bit 14: Master/Slave Result */ #define PHY_B_1000S_MSR (1<<14) /* Bit 14: Master/Slave Result */
#define PHY_B_1000S_LRS (1<<13) /* Bit 13: Local Receiver Status */ #define PHY_B_1000S_LRS (1<<13) /* Bit 13: Local Receiver Status */
...@@ -1309,7 +1320,6 @@ extern "C" { ...@@ -1309,7 +1320,6 @@ extern "C" {
/* Bit 7..0: reserved */ /* Bit 7..0: reserved */
/***** PHY_MARV_PHY_CTRL 16 bit r/w PHY Specific Ctrl Reg *****/ /***** PHY_MARV_PHY_CTRL 16 bit r/w PHY Specific Ctrl Reg *****/
#define PHY_M_PC_TX_FFD_MSK (3<<14) /* Bit 15..14: Tx FIFO Depth Mask */ #define PHY_M_PC_TX_FFD_MSK (3<<14) /* Bit 15..14: Tx FIFO Depth Mask */
#define PHY_M_PC_RX_FFD_MSK (3<<12) /* Bit 13..12: Rx FIFO Depth Mask */ #define PHY_M_PC_RX_FFD_MSK (3<<12) /* Bit 13..12: Rx FIFO Depth Mask */
#define PHY_M_PC_ASS_CRS_TX (1<<11) /* Bit 11: Assert CRS on Transmit */ #define PHY_M_PC_ASS_CRS_TX (1<<11) /* Bit 11: Assert CRS on Transmit */
...@@ -1323,6 +1333,9 @@ extern "C" { ...@@ -1323,6 +1333,9 @@ extern "C" {
#define PHY_M_PC_POL_R_DIS (1<<1) /* Bit 1: Polarity Reversal Disabled */ #define PHY_M_PC_POL_R_DIS (1<<1) /* Bit 1: Polarity Reversal Disabled */
#define PHY_M_PC_DIS_JABBER (1<<0) /* Bit 0: Disable Jabber */ #define PHY_M_PC_DIS_JABBER (1<<0) /* Bit 0: Disable Jabber */
#define PHY_M_PC_EN_DET SHIFT8(2) /* Energy Detect (Mode 1) */
#define PHY_M_PC_EN_DET_PLUS SHIFT8(3) /* Energy Detect Plus (Mode 2) */
#define PHY_M_PC_MDI_XMODE(x) SHIFT5(x) #define PHY_M_PC_MDI_XMODE(x) SHIFT5(x)
#define PHY_M_PC_MAN_MDI 0 /* 00 = Manual MDI configuration */ #define PHY_M_PC_MAN_MDI 0 /* 00 = Manual MDI configuration */
#define PHY_M_PC_MAN_MDIX 1 /* 01 = Manual MDIX configuration */ #define PHY_M_PC_MAN_MDIX 1 /* 01 = Manual MDIX configuration */
...@@ -1373,6 +1386,7 @@ extern "C" { ...@@ -1373,6 +1386,7 @@ extern "C" {
#define PHY_M_EC_M_DSC_MSK (3<<10) /* Bit 11..10: Master downshift counter */ #define PHY_M_EC_M_DSC_MSK (3<<10) /* Bit 11..10: Master downshift counter */
#define PHY_M_EC_S_DSC_MSK (3<<8) /* Bit 9.. 8: Slave downshift counter */ #define PHY_M_EC_S_DSC_MSK (3<<8) /* Bit 9.. 8: Slave downshift counter */
#define PHY_M_EC_MAC_S_MSK (7<<4) /* Bit 6.. 4: Def. MAC interface speed */ #define PHY_M_EC_MAC_S_MSK (7<<4) /* Bit 6.. 4: Def. MAC interface speed */
#define PHY_M_EC_FIB_AN_ENA (1<<3) /* Bit 3: Fiber Auto-Neg. Enable */
#define PHY_M_EC_M_DSC(x) SHIFT10(x) /* 00=1x; 01=2x; 10=3x; 11=4x */ #define PHY_M_EC_M_DSC(x) SHIFT10(x) /* 00=1x; 01=2x; 10=3x; 11=4x */
#define PHY_M_EC_S_DSC(x) SHIFT8(x) /* 00=dis; 01=1x; 10=2x; 11=3x */ #define PHY_M_EC_S_DSC(x) SHIFT8(x) /* 00=dis; 01=1x; 10=2x; 11=3x */
...@@ -1434,6 +1448,18 @@ extern "C" { ...@@ -1434,6 +1448,18 @@ extern "C" {
#define PHY_M_EC2_FO_BOOST (1<<3) /* Bit 3: Fiber Output Boost */ #define PHY_M_EC2_FO_BOOST (1<<3) /* Bit 3: Fiber Output Boost */
#define PHY_M_EC2_FO_AM_MSK 7 /* Bit 2.. 0: Fiber Output Amplitude */ #define PHY_M_EC2_FO_AM_MSK 7 /* Bit 2.. 0: Fiber Output Amplitude */
/***** PHY_MARV_EXT_P_STAT 16 bit r/w Ext. PHY Specific Status *****/
#define PHY_M_FC_AUTO_SEL (1<<15) /* Bit 15: Fiber/Copper Auto Sel. dis. */
#define PHY_M_FC_AN_REG_ACC (1<<14) /* Bit 14: Fiber/Copper Autoneg. reg acc */
#define PHY_M_FC_RESULUTION (1<<13) /* Bit 13: Fiber/Copper Resulution */
#define PHY_M_SER_IF_AN_BP (1<<12) /* Bit 12: Ser IF autoneg. bypass enable */
#define PHY_M_SER_IF_BP_ST (1<<11) /* Bit 11: Ser IF autoneg. bypass status */
#define PHY_M_IRQ_POLARITY (1<<10) /* Bit 10: IRQ polarity */
/* Bit 9..4: reserved */
#define PHY_M_UNDOC1 (1<< 7) /* undocumented bit !! */
#define PHY_M_MODE_MASK (0xf<<0)/* Bit 3..0: copy of HWCFG MODE[3:0] */
/***** PHY_MARV_CABLE_DIAG 16 bit r/o Cable Diagnostic Reg *****/ /***** PHY_MARV_CABLE_DIAG 16 bit r/o Cable Diagnostic Reg *****/
#define PHY_M_CABD_ENA_TEST (1<<15) /* Bit 15: Enable Test */ #define PHY_M_CABD_ENA_TEST (1<<15) /* Bit 15: Enable Test */
#define PHY_M_CABD_STAT_MSK (3<<13) /* Bit 14..13: Status */ #define PHY_M_CABD_STAT_MSK (3<<13) /* Bit 14..13: Status */
...@@ -1531,7 +1557,7 @@ extern "C" { ...@@ -1531,7 +1557,7 @@ extern "C" {
#define GM_RXF_SHT \ #define GM_RXF_SHT \
(GM_MIB_CNT_BASE + 80) /* Frames <64 Byte Received OK */ (GM_MIB_CNT_BASE + 80) /* Frames <64 Byte Received OK */
#define GM_RXE_FRAG \ #define GM_RXE_FRAG \
(GM_MIB_CNT_BASE + 88) /* Frames <64 Byte Receeived with FCS Err */ (GM_MIB_CNT_BASE + 88) /* Frames <64 Byte Received with FCS Err */
#define GM_RXF_64B \ #define GM_RXF_64B \
(GM_MIB_CNT_BASE + 96) /* 64 Byte Rx Frame */ (GM_MIB_CNT_BASE + 96) /* 64 Byte Rx Frame */
#define GM_RXF_127B \ #define GM_RXF_127B \
...@@ -1606,7 +1632,6 @@ extern "C" { ...@@ -1606,7 +1632,6 @@ extern "C" {
*/ */
/* GM_GP_STAT 16 bit r/o General Purpose Status Register */ /* GM_GP_STAT 16 bit r/o General Purpose Status Register */
#define GM_GPSR_SPEED (1<<15) /* Bit 15: Port Speed (1 = 100 Mbps) */ #define GM_GPSR_SPEED (1<<15) /* Bit 15: Port Speed (1 = 100 Mbps) */
#define GM_GPSR_DUPLEX (1<<14) /* Bit 14: Duplex Mode (1 = Full) */ #define GM_GPSR_DUPLEX (1<<14) /* Bit 14: Duplex Mode (1 = Full) */
#define GM_GPSR_FC_TX_DIS (1<<13) /* Bit 13: Tx Flow-Control Mode Disabled */ #define GM_GPSR_FC_TX_DIS (1<<13) /* Bit 13: Tx Flow-Control Mode Disabled */
...@@ -1646,11 +1671,14 @@ extern "C" { ...@@ -1646,11 +1671,14 @@ extern "C" {
GM_GPCR_AU_SPD_DIS) GM_GPCR_AU_SPD_DIS)
/* GM_TX_CTRL 16 bit r/w Transmit Control Register */ /* GM_TX_CTRL 16 bit r/w Transmit Control Register */
#define GM_TXCR_FORCE_JAM (1<<15) /* Bit 15: Force Jam / Flow-Control */ #define GM_TXCR_FORCE_JAM (1<<15) /* Bit 15: Force Jam / Flow-Control */
#define GM_TXCR_CRC_DIS (1<<14) /* Bit 14: Disable insertion of CRC */ #define GM_TXCR_CRC_DIS (1<<14) /* Bit 14: Disable insertion of CRC */
#define GM_TXCR_PAD_DIS (1<<13) /* Bit 13: Disable padding of packets */ #define GM_TXCR_PAD_DIS (1<<13) /* Bit 13: Disable padding of packets */
#define GM_TXCR_COL_THR (4<<10) /* Bit 12..10: Collision Threshold */ #define GM_TXCR_COL_THR_MSK (1<<10) /* Bit 12..10: Collision Threshold */
#define TX_COL_THR(x) (SHIFT10(x) & GM_TXCR_COL_THR_MSK)
#define TX_COL_DEF 0x04
/* GM_RX_CTRL 16 bit r/w Receive Control Register */ /* GM_RX_CTRL 16 bit r/w Receive Control Register */
#define GM_RXCR_UCF_ENA (1<<15) /* Bit 15: Enable Unicast filtering */ #define GM_RXCR_UCF_ENA (1<<15) /* Bit 15: Enable Unicast filtering */
...@@ -1663,35 +1691,41 @@ extern "C" { ...@@ -1663,35 +1691,41 @@ extern "C" {
#define GM_TXPA_JAMIPG_MSK (0x1f<<9) /* Bit 13..9: Jam IPG */ #define GM_TXPA_JAMIPG_MSK (0x1f<<9) /* Bit 13..9: Jam IPG */
#define GM_TXPA_JAMDAT_MSK (0x1f<<4) /* Bit 8..4: IPG Jam to Data */ #define GM_TXPA_JAMDAT_MSK (0x1f<<4) /* Bit 8..4: IPG Jam to Data */
/* Bit 3..0: reserved */ /* Bit 3..0: reserved */
#define JAM_LEN_VAL(x) SHIFT14(x)
#define JAM_IPG_VAL(x) SHIFT9(x) #define TX_JAM_LEN_VAL(x) (SHIFT14(x) & GM_TXPA_JAMLEN_MSK)
#define IPG_JAM_DATA(x) SHIFT4(x) #define TX_JAM_IPG_VAL(x) (SHIFT9(x) & GM_TXPA_JAMIPG_MSK)
#define TX_IPG_JAM_DATA(x) (SHIFT4(x) & GM_TXPA_JAMDAT_MSK)
#define TX_JAM_LEN_DEF 0x03
#define TX_JAM_IPG_DEF 0x0b
#define TX_IPG_JAM_DEF 0x1c
/* GM_SERIAL_MODE 16 bit r/w Serial Mode Register */ /* GM_SERIAL_MODE 16 bit r/w Serial Mode Register */
#define GM_SMOD_DATABL_MSK (0x1f<<11) /* Bit 15..11: Data Blinder */ #define GM_SMOD_DATABL_MSK (0x1f<<11) /* Bit 15..11: Data Blinder (r/o) */
#define GM_SMOD_LIMIT_4 (1<<10) /* Bit 10: 4 consecutive Tx trials */ #define GM_SMOD_LIMIT_4 (1<<10) /* Bit 10: 4 consecutive Tx trials */
#define GM_SMOD_VLAN_ENA (1<<9) /* Bit 9: Enable VLAN (Max. Frame Len) */ #define GM_SMOD_VLAN_ENA (1<<9) /* Bit 9: Enable VLAN (Max. Frame Len) */
#define GM_SMOD_JUMBO_ENA (1<<8) /* Bit 8: Enable Jumbo (Max. Frame Len) */ #define GM_SMOD_JUMBO_ENA (1<<8) /* Bit 8: Enable Jumbo (Max. Frame Len) */
/* Bit 7..5: reserved */ /* Bit 7..5: reserved */
#define GM_SMOD_IPG_MSK 0x1f /* Bit 4..0: Inter-Packet Gap (IPG) */ #define GM_SMOD_IPG_MSK 0x1f /* Bit 4..0: Inter-Packet Gap (IPG) */
#define DATA_BLIND_VAL(x) SHIFT11(x) #define DATA_BLIND_VAL(x) (SHIFT11(x) & GM_SMOD_DATABL_MSK)
#define DATA_BLIND_FAST_ETH 0x1c #define DATA_BLIND_DEF 0x04
#define DATA_BLIND_GIGABIT 4
#define IPG_VAL_FAST_ETH 0x1e #define IPG_DATA_VAL(x) (x & GM_SMOD_IPG_MSK)
#define IPG_VAL_GIGABIT 6 #define IPG_DATA_DEF 0x1e
/* GM_SMI_CTRL 16 bit r/w SMI Control Register */ /* GM_SMI_CTRL 16 bit r/w SMI Control Register */
#define GM_SMI_CT_PHY_A_MSK (0x1f<<11) /* Bit 15..11: PHY Device Address */
#define GM_SMI_CT_PHY_AD(x) SHIFT11(x) #define GM_SMI_CT_REG_A_MSK (0x1f<<6) /* Bit 10.. 6: PHY Register Address */
#define GM_SMI_CT_REG_AD(x) SHIFT6(x)
#define GM_SMI_CT_OP_RD (1<<5) /* Bit 5: OpCode Read (0=Write)*/ #define GM_SMI_CT_OP_RD (1<<5) /* Bit 5: OpCode Read (0=Write)*/
#define GM_SMI_CT_RD_VAL (1<<4) /* Bit 4: Read Valid (Read completed) */ #define GM_SMI_CT_RD_VAL (1<<4) /* Bit 4: Read Valid (Read completed) */
#define GM_SMI_CT_BUSY (1<<3) /* Bit 3: Busy (Operation in progress) */ #define GM_SMI_CT_BUSY (1<<3) /* Bit 3: Busy (Operation in progress) */
/* Bit 2..0: reserved */ /* Bit 2..0: reserved */
/* GM_PHY_ADDR 16 bit r/w GPHY Address Register */ #define GM_SMI_CT_PHY_AD(x) (SHIFT11(x) & GM_SMI_CT_PHY_A_MSK)
#define GM_SMI_CT_REG_AD(x) (SHIFT6(x) & GM_SMI_CT_REG_A_MSK)
/* GM_PHY_ADDR 16 bit r/w GPHY Address Register */
/* Bit 15..6: reserved */ /* Bit 15..6: reserved */
#define GM_PAR_MIB_CLR (1<<5) /* Bit 5: Set MIB Clear Counter Mode */ #define GM_PAR_MIB_CLR (1<<5) /* Bit 5: Set MIB Clear Counter Mode */
#define GM_PAR_MIB_TST (1<<4) /* Bit 4: MIB Load Counter (Test Mode) */ #define GM_PAR_MIB_TST (1<<4) /* Bit 4: MIB Load Counter (Test Mode) */
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* *
* Name: skcsum.c * Name: skcsum.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter * Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.11 $ * Version: $Revision: 1.12 $
* Date: $Date: 2003/03/11 14:05:55 $ * Date: $Date: 2003/08/20 13:55:53 $
* Purpose: Store/verify Internet checksum in send/receive packets. * Purpose: Store/verify Internet checksum in send/receive packets.
* *
******************************************************************************/ ******************************************************************************/
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
* History: * History:
* *
* $Log: skcsum.c,v $ * $Log: skcsum.c,v $
* Revision 1.12 2003/08/20 13:55:53 mschmid
* Changed notation of #ifndef SkCsCalculateChecksum to
* #ifndef SK_CS_CALCULATE_CHECKSUM
*
* Revision 1.11 2003/03/11 14:05:55 rschmidt * Revision 1.11 2003/03/11 14:05:55 rschmidt
* Replaced memset() by macro SK_MEMSET() * Replaced memset() by macro SK_MEMSET()
* Editorial changes * Editorial changes
...@@ -78,7 +82,7 @@ ...@@ -78,7 +82,7 @@
#ifndef lint #ifndef lint
static const char SysKonnectFileId[] = static const char SysKonnectFileId[] =
"@(#) $Id: skcsum.c,v 1.11 2003/03/11 14:05:55 rschmidt Exp $ (C) SysKonnect."; "@(#) $Id: skcsum.c,v 1.12 2003/08/20 13:55:53 mschmid Exp $ (C) SysKonnect.";
#endif /* !lint */ #endif /* !lint */
/****************************************************************************** /******************************************************************************
...@@ -791,7 +795,7 @@ int NetNumber) ...@@ -791,7 +795,7 @@ int NetNumber)
*pChecksum2Offset = SKCS_MAC_HEADER_SIZE + SKCS_IP_HEADER_SIZE; *pChecksum2Offset = SKCS_MAC_HEADER_SIZE + SKCS_IP_HEADER_SIZE;
} /* SkCsSetReceiveFlags */ } /* SkCsSetReceiveFlags */
#ifndef SkCsCalculateChecksum #ifndef SK_CS_CALCULATE_CHECKSUM
/****************************************************************************** /******************************************************************************
* *
...@@ -856,7 +860,7 @@ unsigned Length) /* Length of data. */ ...@@ -856,7 +860,7 @@ unsigned Length) /* Length of data. */
return ((unsigned) Checksum); return ((unsigned) Checksum);
} /* SkCsCalculateChecksum */ } /* SkCsCalculateChecksum */
#endif /* SkCsCalculateChecksum */ #endif /* SK_CS_CALCULATE_CHECKSUM */
/****************************************************************************** /******************************************************************************
* *
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* *
* Name: skdim.c * Name: skdim.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter * Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.2 $ * Version: $Revision: 1.5 $
* Date: $Date: 2003/08/21 12:35:05 $ * Date: $Date: 2003/11/28 12:55:40 $
* Purpose: All functions to maintain interrupt moderation * Purpose: All functions to maintain interrupt moderation
* *
******************************************************************************/ ******************************************************************************/
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
/****************************************************************************** /******************************************************************************
* *
* (C)Copyright 1998-2002 SysKonnect GmbH. * (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -26,6 +27,15 @@ ...@@ -26,6 +27,15 @@
* History: * History:
* *
* $Log: skdim.c,v $ * $Log: skdim.c,v $
* Revision 1.5 2003/11/28 12:55:40 rroesler
* Fix: support for new process timing interface added
*
* Revision 1.4 2003/10/10 10:58:56 mlindner
* Fix: CPU detection under the kernel 2.6
*
* Revision 1.3 2003/10/07 08:17:08 mlindner
* Fix: Copyright changes
*
* Revision 1.2 2003/08/21 12:35:05 mlindner * Revision 1.2 2003/08/21 12:35:05 mlindner
* Fix: Corrected CPU detection and compile errors on single CPU machines * Fix: Corrected CPU detection and compile errors on single CPU machines
* *
...@@ -62,7 +72,7 @@ ...@@ -62,7 +72,7 @@
#ifndef lint #ifndef lint
static const char SysKonnectFileId[] = static const char SysKonnectFileId[] =
"@(#) $Id: skdim.c,v 1.2 2003/08/21 12:35:05 mlindner Exp $ (C) SysKonnect."; "@(#) $Id: skdim.c,v 1.5 2003/11/28 12:55:40 rroesler Exp $ (C) SysKonnect.";
#endif #endif
#define __SKADDR_C #define __SKADDR_C
...@@ -327,7 +337,9 @@ GetCurrentSystemLoad(SK_AC *pAC) { ...@@ -327,7 +337,9 @@ GetCurrentSystemLoad(SK_AC *pAC) {
** **
** struct kernel_stat kstat ** struct kernel_stat kstat
** **
** is not marked as an exported symbol ** is not marked as an exported symbol in the file
**
** kernel/ksyms.c
** **
** As a consequence, using this driver as KLM is not possible ** As a consequence, using this driver as KLM is not possible
** and any access of the structure kernel_stat via the ** and any access of the structure kernel_stat via the
......
/****************************************************************************** /******************************************************************************
* *
* Name: skge.c * Name: skge.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter * Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.11 $ * Version: $Revision: 1.42 $
* Date: $Date: 2003/08/26 16:05:19 $ * Date: $Date: 2003/12/12 10:05:43 $
* Purpose: The main driver source module * Purpose: The main driver source module
* *
******************************************************************************/ ******************************************************************************/
/****************************************************************************** /******************************************************************************
* *
* (C)Copyright 1998-2003 SysKonnect GmbH. * (C)Copyright 1998-2002 SysKonnect GmbH.
* * (C)Copyright 2002-2003 Marvell.
* Driver for SysKonnect Gigabit Ethernet Server Adapters: *
* * Driver for Marvell Yukon chipset and SysKonnect Gigabit Ethernet
* SK-9871 (single link 1000Base-ZX) * Server Adapters.
* SK-9872 (dual link 1000Base-ZX)
* SK-9861 (single link 1000Base-SX, VF45 Volition Plug)
* SK-9862 (dual link 1000Base-SX, VF45 Volition Plug)
* SK-9841 (single link 1000Base-LX)
* SK-9842 (dual link 1000Base-LX)
* SK-9843 (single link 1000Base-SX)
* SK-9844 (dual link 1000Base-SX)
* SK-9821 (single link 1000Base-T)
* SK-9822 (dual link 1000Base-T)
* SK-9881 (single link 1000Base-SX V2 LC)
* SK-9871 (single link 1000Base-ZX V2)
* SK-9861 (single link 1000Base-SX V2, VF45 Volition Plug)
* SK-9841 (single link 1000Base-LX V2)
* SK-9843 (single link 1000Base-SX V2)
* SK-9821 (single link 1000Base-T V2)
* *
* Created 10-Feb-1999, based on Linux' acenic.c, 3c59x.c and * Created 10-Feb-1999, based on Linux' acenic.c, 3c59x.c and
* SysKonnects GEnesis Solaris driver * SysKonnects GEnesis Solaris driver
...@@ -56,6 +41,87 @@ ...@@ -56,6 +41,87 @@
* History: * History:
* *
* $Log: skge.c,v $ * $Log: skge.c,v $
* Revision 1.42 2003/12/12 10:05:43 mlindner
* Fix: Format of error message corrected
*
* Revision 1.41 2003/12/11 16:03:57 mlindner
* Fix: Create backup from pnmi data structure
*
* Revision 1.40 2003/12/11 12:14:48 mlindner
* Fix: Initalize Board before network configuration
* Fix: Change device names to driver name
*
* Revision 1.39 2003/12/10 08:57:38 rroesler
* Fix: Modifications regarding try_module_get() and capable()
*
* Revision 1.38 2003/12/01 17:16:50 mlindner
* Fix: Remove useless register_netdev
*
* Revision 1.37 2003/12/01 17:11:30 mlindner
* Fix: Register net device before SkGeBoardInit
*
* Revision 1.36 2003/11/28 13:04:27 rroesler
* Fix: do not print interface status in case DIAG is used
*
* Revision 1.35 2003/11/17 14:41:06 mlindner
* Fix: Endif command
*
* Revision 1.34 2003/11/17 13:29:05 mlindner
* Fix: Editorial changes
*
* Revision 1.33 2003/11/14 14:56:54 rroesler
* Fix: corrected compilation warnings kernel 2.2
*
* Revision 1.32 2003/11/13 14:18:47 rroesler
* Fix: added latest changes regarding the use of the proc system
*
* Revision 1.31 2003/11/13 09:28:35 rroesler
* Fix: removed kernel warning 'driver changed get_stats after register'
*
* Revision 1.30 2003/11/11 13:15:27 rroesler
* Fix: use suitables kernel usage count macros when using the diag
*
* Revision 1.29 2003/11/10 09:38:26 rroesler
* Fix: restore PNMI structure backup for DIAG actions
*
* Revision 1.28 2003/11/07 17:28:45 rroesler
* Fix: Additions for the LeaveDiagMode
*
* Revision 1.27 2003/11/03 13:21:14 mlindner
* Add: SkGeBuffPad function for padding to ensure the trailing bytes exist
*
* Revision 1.26 2003/10/30 09:20:40 mlindner
* Fix: Control bit check
*
* Revision 1.25 2003/10/29 07:43:37 rroesler
* Fix: Implemented full None values handling for parameter Moderation
*
* Revision 1.24 2003/10/22 14:18:12 rroesler
* Fix: DIAG handling for DualNet cards
*
* Revision 1.23 2003/10/17 10:05:13 mlindner
* Add: New blinkmode for Morvell cards
*
* Revision 1.22 2003/10/15 12:31:25 rroesler
* Fix: Corrected bugreport #10954 (Linux System crash when using vlans)
*
* Revision 1.21 2003/10/07 12:32:28 mlindner
* Fix: Editorial changes
*
* Revision 1.20 2003/10/07 12:22:40 mlindner
* Fix: Compiler warnings
*
* Revision 1.19 2003/10/07 09:33:40 mlindner
* Fix: No warnings for illegal values of Mod and IntsPerSec
* Fix: Speed 100 in Half Duplex not allowed for Yukon
* Fix: PrefPort=B not allowed on single NICs
*
* Revision 1.18 2003/10/07 08:17:08 mlindner
* Fix: Copyright changes
*
* Revision 1.17 2003/09/29 12:06:59 mlindner
* *** empty log message ***
*
* Revision 1.16 2003/09/23 11:07:35 mlindner * Revision 1.16 2003/09/23 11:07:35 mlindner
* Fix: IO-control return race condition * Fix: IO-control return race condition
* Fix: Interrupt moderation value check * Fix: Interrupt moderation value check
...@@ -68,6 +134,12 @@ ...@@ -68,6 +134,12 @@
* Add: Yukon Plus changes (ChipID, PCI...) * Add: Yukon Plus changes (ChipID, PCI...)
* Fix: TCP and UDP Checksum calculation * Fix: TCP and UDP Checksum calculation
* *
* Revision 1.13 2003/09/01 13:30:08 rroesler
* Fix: Corrected missing defines
*
* Revision 1.12 2003/09/01 13:12:02 rroesler
* Add: Code for improved DIAG Attach/Detach interface
*
* Revision 1.11 2003/08/26 16:05:19 mlindner * Revision 1.11 2003/08/26 16:05:19 mlindner
* Fix: Compiler warnings (void *) * Fix: Compiler warnings (void *)
* *
...@@ -406,7 +478,6 @@ ...@@ -406,7 +478,6 @@
* <linux/module.h> * <linux/module.h>
* *
* "h/skdrv1st.h" * "h/skdrv1st.h"
* <linux/version.h>
* <linux/types.h> * <linux/types.h>
* <linux/kernel.h> * <linux/kernel.h>
* <linux/string.h> * <linux/string.h>
...@@ -568,6 +639,12 @@ static void StartDrvCleanupTimer(SK_AC *pAC); ...@@ -568,6 +639,12 @@ static void StartDrvCleanupTimer(SK_AC *pAC);
static void StopDrvCleanupTimer(SK_AC *pAC); static void StopDrvCleanupTimer(SK_AC *pAC);
static int XmitFrameSG(SK_AC*, TX_PORT*, struct sk_buff*); static int XmitFrameSG(SK_AC*, TX_PORT*, struct sk_buff*);
#ifdef SK_DIAG_SUPPORT
static SK_U32 ParseDeviceNbrFromSlotName(const char *SlotName);
static int SkDrvInitAdapter(SK_AC *pAC, int devNbr);
static int SkDrvDeInitAdapter(SK_AC *pAC, int devNbr);
#endif
/******************************************************************************* /*******************************************************************************
* *
* Extern Function Prototypes * Extern Function Prototypes
...@@ -576,8 +653,8 @@ static int XmitFrameSG(SK_AC*, TX_PORT*, struct sk_buff*); ...@@ -576,8 +653,8 @@ static int XmitFrameSG(SK_AC*, TX_PORT*, struct sk_buff*);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static const char SK_Root_Dir_entry[] = "sk98lin"; static const char SK_Root_Dir_entry[] = "sk98lin";
static struct proc_dir_entry *pSkRootDir; static struct proc_dir_entry *pSkRootDir = NULL;
extern struct file_operations sk_proc_fops; extern struct file_operations sk_proc_fops;
#endif #endif
extern void SkDimEnableModerationIfNeeded(SK_AC *pAC); extern void SkDimEnableModerationIfNeeded(SK_AC *pAC);
...@@ -595,12 +672,19 @@ static void DumpLong(char*, int); ...@@ -595,12 +672,19 @@ static void DumpLong(char*, int);
static const char *BootString = BOOT_STRING; static const char *BootString = BOOT_STRING;
struct SK_NET_DEVICE *SkGeRootDev = NULL; struct SK_NET_DEVICE *SkGeRootDev = NULL;
static int probed __initdata = 0; static int probed __initdata = 0;
static SK_BOOL DoPrintInterfaceChange = SK_TRUE;
/* local variables **********************************************************/ /* local variables **********************************************************/
static uintptr_t TxQueueAddr[SK_MAX_MACS][2] = {{0x680, 0x600},{0x780, 0x700}}; static uintptr_t TxQueueAddr[SK_MAX_MACS][2] = {{0x680, 0x600},{0x780, 0x700}};
static uintptr_t RxQueueAddr[SK_MAX_MACS] = {0x400, 0x480}; static uintptr_t RxQueueAddr[SK_MAX_MACS] = {0x400, 0x480};
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry *pSkRootDir;
#endif
/***************************************************************************** /*****************************************************************************
* *
* skge_probe - find all SK-98xx adapters * skge_probe - find all SK-98xx adapters
...@@ -626,6 +710,7 @@ static int __init skge_probe (void) ...@@ -626,6 +710,7 @@ static int __init skge_probe (void)
SK_BOOL BootStringCount = SK_FALSE; SK_BOOL BootStringCount = SK_FALSE;
int retval; int retval;
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
int proc_root_initialized = 0;
struct proc_dir_entry *pProcFile; struct proc_dir_entry *pProcFile;
#endif #endif
...@@ -700,6 +785,7 @@ static int __init skge_probe (void) ...@@ -700,6 +785,7 @@ static int __init skge_probe (void)
dev->stop = &SkGeClose; dev->stop = &SkGeClose;
dev->hard_start_xmit = &SkGeXmit; dev->hard_start_xmit = &SkGeXmit;
dev->get_stats = &SkGeStats; dev->get_stats = &SkGeStats;
dev->last_stats = &SkGeStats;
dev->set_multicast_list = &SkGeSetRxMode; dev->set_multicast_list = &SkGeSetRxMode;
dev->set_mac_address = &SkGeSetMacAddr; dev->set_mac_address = &SkGeSetMacAddr;
dev->do_ioctl = &SkGeIoctl; dev->do_ioctl = &SkGeIoctl;
...@@ -718,15 +804,13 @@ static int __init skge_probe (void) ...@@ -718,15 +804,13 @@ static int __init skge_probe (void)
#endif #endif
pAC->Index = boards_found; pAC->Index = boards_found;
if (SkGeBoardInit(dev, pAC)) { if (SkGeBoardInit(dev, pAC)) {
FreeResources(dev);
free_netdev(dev); free_netdev(dev);
continue; continue;
} }
memcpy((caddr_t) &dev->dev_addr, /* Register net device */
(caddr_t) &pAC->Addr.Net[0].CurrentMacAddress, 6);
if (register_netdev(dev)) { if (register_netdev(dev)) {
printk(KERN_ERR "SKGE: Could not register device.\n"); printk(KERN_ERR "SKGE: Could not register device.\n");
FreeResources(dev); FreeResources(dev);
...@@ -734,6 +818,25 @@ static int __init skge_probe (void) ...@@ -734,6 +818,25 @@ static int __init skge_probe (void)
continue; continue;
} }
/* Print adapter specific string from vpd */
ProductStr(pAC);
printk("%s: %s\n", dev->name, pAC->DeviceStr);
/* Print configuration settings */
printk(" PrefPort:%c RlmtMode:%s\n",
'A' + pAC->Rlmt.Net[0].Port[pAC->Rlmt.Net[0].PrefPort]->PortNumber,
(pAC->RlmtMode==0) ? "Check Link State" :
((pAC->RlmtMode==1) ? "Check Link State" :
((pAC->RlmtMode==3) ? "Check Local Port" :
((pAC->RlmtMode==7) ? "Check Segmentation" :
((pAC->RlmtMode==17) ? "Dual Check Link State" :"Error")))));
SkGeYellowLED(pAC, pAC->IoBase, 1);
memcpy((caddr_t) &dev->dev_addr,
(caddr_t) &pAC->Addr.Net[0].CurrentMacAddress, 6);
/* First adapter... Create proc and print message */ /* First adapter... Create proc and print message */
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
if (!DeviceFound) { if (!DeviceFound) {
...@@ -744,25 +847,27 @@ static int __init skge_probe (void) ...@@ -744,25 +847,27 @@ static int __init skge_probe (void)
/*Create proc (directory)*/ /*Create proc (directory)*/
if(!pSkRootDir) { if(!pSkRootDir) {
pSkRootDir = proc_mkdir(SK_Root_Dir_entry, proc_net); pSkRootDir = proc_mkdir(SK_Root_Dir_entry, proc_net);
if (!pSkRootDir) if (!pSkRootDir) {
printk(KERN_WARNING "%s: Unable to create /proc/net/%s", printk(KERN_WARNING "%s: Unable to create /proc/net/%s",
dev->name, SK_Root_Dir_entry); dev->name, SK_Root_Dir_entry);
else } else {
pSkRootDir->owner = THIS_MODULE; pSkRootDir->owner = THIS_MODULE;
}
} }
} }
/* Create proc file */ /* Create proc file */
if (pSkRootDir if (pSkRootDir &&
&& (pProcFile = create_proc_entry(dev->name, S_IRUGO, (pProcFile = create_proc_entry(dev->name, S_IRUGO,
pSkRootDir))) { pSkRootDir))) {
pProcFile->proc_fops = &sk_proc_fops; pProcFile->proc_fops = &sk_proc_fops;
pProcFile->data = dev; pProcFile->data = dev;
} }
#endif #endif
pNet->PortNr = 0; pNet->PortNr = 0;
pNet->NetNr = 0; pNet->NetNr = 0;
boards_found++; boards_found++;
...@@ -774,23 +879,24 @@ static int __init skge_probe (void) ...@@ -774,23 +879,24 @@ static int __init skge_probe (void)
break; break;
} }
pAC->dev[1] = dev; pAC->dev[1] = dev;
pNet = dev->priv; pNet = dev->priv;
pNet->PortNr = 1; pNet->PortNr = 1;
pNet->NetNr = 1; pNet->NetNr = 1;
pNet->pAC = pAC; pNet->pAC = pAC;
pNet->Mtu = 1500; pNet->Mtu = 1500;
pNet->Up = 0; pNet->Up = 0;
dev->open = &SkGeOpen; dev->open = &SkGeOpen;
dev->stop = &SkGeClose; dev->stop = &SkGeClose;
dev->hard_start_xmit = &SkGeXmit; dev->hard_start_xmit = &SkGeXmit;
dev->get_stats = &SkGeStats; dev->get_stats = &SkGeStats;
dev->last_stats = &SkGeStats;
dev->set_multicast_list = &SkGeSetRxMode; dev->set_multicast_list = &SkGeSetRxMode;
dev->set_mac_address = &SkGeSetMacAddr; dev->set_mac_address = &SkGeSetMacAddr;
dev->do_ioctl = &SkGeIoctl; dev->do_ioctl = &SkGeIoctl;
dev->change_mtu = &SkGeChangeMtu; dev->change_mtu = &SkGeChangeMtu;
dev->flags &= ~IFF_RUNNING; dev->flags &= ~IFF_RUNNING;
#ifdef SK_ZEROCOPY #ifdef SK_ZEROCOPY
#ifdef USE_SK_TX_CHECKSUM #ifdef USE_SK_TX_CHECKSUM
...@@ -802,34 +908,39 @@ static int __init skge_probe (void) ...@@ -802,34 +908,39 @@ static int __init skge_probe (void)
#endif #endif
if (register_netdev(dev)) { if (register_netdev(dev)) {
printk(KERN_ERR "SKGE: Could not register " printk(KERN_ERR "SKGE: Could not register device.\n");
"second port.\n");
free_netdev(dev); free_netdev(dev);
pAC->dev[1] = pAC->dev[0]; pAC->dev[1] = pAC->dev[0];
} else { } else {
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
if (pSkRootDir if (pSkRootDir
&& (pProcFile = create_proc_entry(dev->name, && (pProcFile = create_proc_entry(dev->name,
S_IRUGO, S_IRUGO, pSkRootDir))) {
pSkRootDir))) {
pProcFile->proc_fops = &sk_proc_fops; pProcFile->proc_fops = &sk_proc_fops;
pProcFile->data = dev; pProcFile->data = dev;
} }
#endif #endif
memcpy((caddr_t) &dev->dev_addr, memcpy((caddr_t) &dev->dev_addr,
(caddr_t) &pAC->Addr.Net[1].CurrentMacAddress, 6); (caddr_t) &pAC->Addr.Net[1].CurrentMacAddress, 6);
printk("%s: %s\n", dev->name, pAC->DeviceStr); printk("%s: %s\n", dev->name, pAC->DeviceStr);
printk(" PrefPort:B RlmtMode:Dual Check Link State\n"); printk(" PrefPort:B RlmtMode:Dual Check Link State\n");
} }
} }
/* Save the hardware revision */ /* Save the hardware revision */
pAC->HWRevision = (((pAC->GIni.GIPciHwRev >> 4) & 0x0F)*10) + pAC->HWRevision = (((pAC->GIni.GIPciHwRev >> 4) & 0x0F)*10) +
(pAC->GIni.GIPciHwRev & 0x0F); (pAC->GIni.GIPciHwRev & 0x0F);
/* Set driver globals */
pAC->Pnmi.pDriverFileName = DRIVER_FILE_NAME;
pAC->Pnmi.pDriverReleaseDate = DRIVER_REL_DATE;
SK_MEMSET(&(pAC->PnmiBackup), 0, sizeof(SK_PNMI_STRUCT_DATA));
SK_MEMCPY(&(pAC->PnmiBackup), &(pAC->PnmiStruct),
sizeof(SK_PNMI_STRUCT_DATA));
/* /*
* This is bollocks, but we need to tell the net-init * This is bollocks, but we need to tell the net-init
* code that it shall go for the next device. * code that it shall go for the next device.
...@@ -849,7 +960,6 @@ static int __init skge_probe (void) ...@@ -849,7 +960,6 @@ static int __init skge_probe (void)
} /* skge_probe */ } /* skge_probe */
/***************************************************************************** /*****************************************************************************
* *
* SkGeInitPCI - Init the PCI resources * SkGeInitPCI - Init the PCI resources
...@@ -1161,8 +1271,7 @@ SK_EVPARA EvPara; ...@@ -1161,8 +1271,7 @@ SK_EVPARA EvPara;
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
/* clear proc-dir */ /* clear proc-dir */
if (pSkRootDir) remove_proc_entry(pSkRootDir->name, proc_net);
remove_proc_entry(pSkRootDir->name, proc_net);
#endif #endif
} /* skge_cleanup_module */ } /* skge_cleanup_module */
...@@ -1224,7 +1333,7 @@ SK_BOOL DualNet; ...@@ -1224,7 +1333,7 @@ SK_BOOL DualNet;
SkAddrInit( pAC, pAC->IoBase, SK_INIT_DATA); SkAddrInit( pAC, pAC->IoBase, SK_INIT_DATA);
SkRlmtInit( pAC, pAC->IoBase, SK_INIT_DATA); SkRlmtInit( pAC, pAC->IoBase, SK_INIT_DATA);
SkTimerInit(pAC, pAC->IoBase, SK_INIT_DATA); SkTimerInit(pAC, pAC->IoBase, SK_INIT_DATA);
pAC->BoardLevel = SK_INIT_DATA; pAC->BoardLevel = SK_INIT_DATA;
pAC->RxBufSize = ETH_BUF_SIZE; pAC->RxBufSize = ETH_BUF_SIZE;
...@@ -1236,7 +1345,7 @@ SK_BOOL DualNet; ...@@ -1236,7 +1345,7 @@ SK_BOOL DualNet;
/* level 1 init common modules here (HW init) */ /* level 1 init common modules here (HW init) */
spin_lock_irqsave(&pAC->SlowPathLock, Flags); spin_lock_irqsave(&pAC->SlowPathLock, Flags);
if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) { if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) {
printk("HWInit (1) failed.\n"); printk("sk98lin: HWInit (1) failed.\n");
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
return(-EAGAIN); return(-EAGAIN);
} }
...@@ -1268,14 +1377,14 @@ SK_BOOL DualNet; ...@@ -1268,14 +1377,14 @@ SK_BOOL DualNet;
Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ,
pAC->Name, dev); pAC->Name, dev);
} else { } else {
printk(KERN_WARNING "%s: Illegal number of ports: %d\n", printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n",
dev->name, pAC->GIni.GIMacsFound); pAC->GIni.GIMacsFound);
return -EAGAIN; return -EAGAIN;
} }
if (Ret) { if (Ret) {
printk(KERN_WARNING "%s: Requested IRQ %d is busy.\n", printk(KERN_WARNING "sk98lin: Requested IRQ %d is busy.\n",
dev->name, dev->irq); dev->irq);
return -EAGAIN; return -EAGAIN;
} }
pAC->AllocFlag |= SK_ALLOC_IRQ; pAC->AllocFlag |= SK_ALLOC_IRQ;
...@@ -1303,25 +1412,10 @@ SK_BOOL DualNet; ...@@ -1303,25 +1412,10 @@ SK_BOOL DualNet;
pAC->ActivePort, pAC->ActivePort,
DualNet)) { DualNet)) {
BoardFreeMem(pAC); BoardFreeMem(pAC);
printk("SkGeInitAssignRamToQueues failed.\n"); printk("sk98lin: SkGeInitAssignRamToQueues failed.\n");
return(-EAGAIN); return(-EAGAIN);
} }
/* Print adapter specific string from vpd */
ProductStr(pAC);
printk("%s: %s\n", dev->name, pAC->DeviceStr);
/* Print configuration settings */
printk(" PrefPort:%c RlmtMode:%s\n",
'A' + pAC->Rlmt.Net[0].Port[pAC->Rlmt.Net[0].PrefPort]->PortNumber,
(pAC->RlmtMode==0) ? "Check Link State" :
((pAC->RlmtMode==1) ? "Check Link State" :
((pAC->RlmtMode==3) ? "Check Local Port" :
((pAC->RlmtMode==7) ? "Check Segmentation" :
((pAC->RlmtMode==17) ? "Dual Check Link State" :"Error")))));
SkGeYellowLED(pAC, pAC->IoBase, 1);
/* /*
* Register the device here * Register the device here
*/ */
...@@ -1879,14 +1973,26 @@ struct SK_NET_DEVICE *dev) ...@@ -1879,14 +1973,26 @@ struct SK_NET_DEVICE *dev)
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
("SkGeOpen: pAC=0x%lX:\n", (unsigned long)pAC)); ("SkGeOpen: pAC=0x%lX:\n", (unsigned long)pAC));
#ifdef SK_DIAG_SUPPORT
if (pAC->DiagModeActive == DIAG_ACTIVE) {
if (pAC->Pnmi.DiagAttached == SK_DIAG_RUNNING) {
return (-1); /* still in use by diag; deny actions */
}
}
#endif
if (!try_module_get(THIS_MODULE)) {
return (-1); /* increase of usage count not possible */
}
/* Set blink mode */ /* Set blink mode */
if (pAC->PciDev->vendor == 0x1186) if ((pAC->PciDev->vendor == 0x1186) || (pAC->PciDev->vendor == 0x11ab ))
pAC->GIni.GILedBlinkCtrl = OEM_CONFIG_VALUE; pAC->GIni.GILedBlinkCtrl = OEM_CONFIG_VALUE;
if (pAC->BoardLevel == SK_INIT_DATA) { if (pAC->BoardLevel == SK_INIT_DATA) {
/* level 1 init common modules here */ /* level 1 init common modules here */
if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) { if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) {
module_put(THIS_MODULE); /* decrease usage count */
printk("%s: HWInit (1) failed.\n", pAC->dev[pNet->PortNr]->name); printk("%s: HWInit (1) failed.\n", pAC->dev[pNet->PortNr]->name);
return (-1); return (-1);
} }
...@@ -1902,6 +2008,7 @@ struct SK_NET_DEVICE *dev) ...@@ -1902,6 +2008,7 @@ struct SK_NET_DEVICE *dev)
if (pAC->BoardLevel != SK_INIT_RUN) { if (pAC->BoardLevel != SK_INIT_RUN) {
/* tschilling: Level 2 init modules here, check return value. */ /* tschilling: Level 2 init modules here, check return value. */
if (SkGeInit(pAC, pAC->IoBase, SK_INIT_RUN) != 0) { if (SkGeInit(pAC, pAC->IoBase, SK_INIT_RUN) != 0) {
module_put(THIS_MODULE); /* decrease usage count */
printk("%s: HWInit (2) failed.\n", pAC->dev[pNet->PortNr]->name); printk("%s: HWInit (2) failed.\n", pAC->dev[pNet->PortNr]->name);
return (-1); return (-1);
} }
...@@ -1953,7 +2060,6 @@ struct SK_NET_DEVICE *dev) ...@@ -1953,7 +2060,6 @@ struct SK_NET_DEVICE *dev)
pAC->MaxPorts++; pAC->MaxPorts++;
pNet->Up = 1; pNet->Up = 1;
try_module_get(THIS_MODULE);
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
("SkGeOpen suceeded\n")); ("SkGeOpen suceeded\n"));
...@@ -1976,26 +2082,50 @@ struct SK_NET_DEVICE *dev) ...@@ -1976,26 +2082,50 @@ struct SK_NET_DEVICE *dev)
static int SkGeClose( static int SkGeClose(
struct SK_NET_DEVICE *dev) struct SK_NET_DEVICE *dev)
{ {
DEV_NET *pNet; DEV_NET *pNet;
SK_AC *pAC; DEV_NET *newPtrNet;
SK_AC *pAC;
unsigned long Flags; /* for spin lock */ unsigned long Flags; /* for spin lock */
int i; int i;
int PortIdx; int PortIdx;
SK_EVPARA EvPara; SK_EVPARA EvPara;
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
("SkGeClose: pAC=0x%lX ", (unsigned long)pAC));
netif_stop_queue(dev);
pNet = (DEV_NET*) dev->priv; pNet = (DEV_NET*) dev->priv;
pAC = pNet->pAC; pAC = pNet->pAC;
#ifdef SK_DIAG_SUPPORT
if (pAC->DiagModeActive == DIAG_ACTIVE) {
if (pAC->DiagFlowCtrl == SK_FALSE) {
module_put(THIS_MODULE);
/*
** notify that the interface which has been closed
** by operator interaction must not be started up
** again when the DIAG has finished.
*/
newPtrNet = (DEV_NET *) pAC->dev[0]->priv;
if (newPtrNet == pNet) {
pAC->WasIfUp[0] = SK_FALSE;
} else {
pAC->WasIfUp[1] = SK_FALSE;
}
return 0; /* return to system everything is fine... */
} else {
pAC->DiagFlowCtrl = SK_FALSE;
}
}
#endif
netif_stop_queue(dev);
if (pAC->RlmtNets == 1) if (pAC->RlmtNets == 1)
PortIdx = pAC->ActivePort; PortIdx = pAC->ActivePort;
else else
PortIdx = pNet->NetNr; PortIdx = pNet->NetNr;
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
("SkGeClose: pAC=0x%lX ", (unsigned long)pAC));
StopDrvCleanupTimer(pAC); StopDrvCleanupTimer(pAC);
/* /*
...@@ -2053,6 +2183,10 @@ struct SK_NET_DEVICE *dev) ...@@ -2053,6 +2183,10 @@ struct SK_NET_DEVICE *dev)
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
("SkGeClose: done ")); ("SkGeClose: done "));
SK_MEMSET(&(pAC->PnmiBackup), 0, sizeof(SK_PNMI_STRUCT_DATA));
SK_MEMCPY(&(pAC->PnmiBackup), &(pAC->PnmiStruct),
sizeof(SK_PNMI_STRUCT_DATA));
pAC->MaxPorts--; pAC->MaxPorts--;
pNet->Up = 0; pNet->Up = 0;
...@@ -2199,9 +2333,10 @@ struct sk_buff *pMessage) /* pointer to send-message */ ...@@ -2199,9 +2333,10 @@ struct sk_buff *pMessage) /* pointer to send-message */
** This is to resolve faulty padding by the HW with 0xaa bytes. ** This is to resolve faulty padding by the HW with 0xaa bytes.
*/ */
if (BytesSend < C_LEN_ETHERNET_MINSIZE) { if (BytesSend < C_LEN_ETHERNET_MINSIZE) {
skb_put(pMessage, (C_LEN_ETHERNET_MINSIZE-BytesSend)); if ((pMessage = skb_padto(pMessage, C_LEN_ETHERNET_MINSIZE)) == NULL) {
SK_MEMSET( ((char *)(pMessage->data))+BytesSend, return 0;
0, C_LEN_ETHERNET_MINSIZE-BytesSend); }
pMessage->len = C_LEN_ETHERNET_MINSIZE;
} }
/* /*
...@@ -3318,6 +3453,16 @@ SK_EVPARA EvPara; ...@@ -3318,6 +3453,16 @@ SK_EVPARA EvPara;
return -EINVAL; return -EINVAL;
} }
#ifdef SK_DIAG_SUPPORT
if (pAC->DiagModeActive == DIAG_ACTIVE) {
if (pAC->DiagFlowCtrl == SK_FALSE) {
return -1; /* still in use, deny any actions of MTU */
} else {
pAC->DiagFlowCtrl = SK_FALSE;
}
}
#endif
pNet->Mtu = NewMtu; pNet->Mtu = NewMtu;
pOtherNet = (DEV_NET*)pAC->dev[1 - pNet->NetNr]->priv; pOtherNet = (DEV_NET*)pAC->dev[1 - pNet->NetNr]->priv;
if ((pOtherNet->Mtu>1500) && (NewMtu<=1500) && (pOtherNet->Up==1)) { if ((pOtherNet->Mtu>1500) && (NewMtu<=1500) && (pOtherNet->Up==1)) {
...@@ -3537,11 +3682,20 @@ unsigned long Flags; /* for spin lock */ ...@@ -3537,11 +3682,20 @@ unsigned long Flags; /* for spin lock */
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
("SkGeStats starts now...\n")); ("SkGeStats starts now...\n"));
pPnmiStruct = &pAC->PnmiStruct; pPnmiStruct = &pAC->PnmiStruct;
memset(pPnmiStruct, 0, sizeof(SK_PNMI_STRUCT_DATA));
#ifdef SK_DIAG_SUPPORT
if ((pAC->DiagModeActive == DIAG_NOTACTIVE) &&
(pAC->BoardLevel == SK_INIT_RUN)) {
#endif
SK_MEMSET(pPnmiStruct, 0, sizeof(SK_PNMI_STRUCT_DATA));
spin_lock_irqsave(&pAC->SlowPathLock, Flags); spin_lock_irqsave(&pAC->SlowPathLock, Flags);
Size = SK_PNMI_STRUCT_SIZE; Size = SK_PNMI_STRUCT_SIZE;
SkPnmiGetStruct(pAC, pAC->IoBase, pPnmiStruct, &Size, pNet->NetNr); SkPnmiGetStruct(pAC, pAC->IoBase, pPnmiStruct, &Size, pNet->NetNr);
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
#ifdef SK_DIAG_SUPPORT
}
#endif
pPnmiStat = &pPnmiStruct->Stat[0]; pPnmiStat = &pPnmiStruct->Stat[0];
pPnmiConf = &pPnmiStruct->Conf[0]; pPnmiConf = &pPnmiStruct->Conf[0];
...@@ -3604,7 +3758,7 @@ static int SkGeIoctl(struct SK_NET_DEVICE *dev, struct ifreq *rq, int cmd) ...@@ -3604,7 +3758,7 @@ static int SkGeIoctl(struct SK_NET_DEVICE *dev, struct ifreq *rq, int cmd)
DEV_NET *pNet; DEV_NET *pNet;
SK_AC *pAC; SK_AC *pAC;
void *pMemBuf; void *pMemBuf;
struct pci_dev *pdev = NULL;
SK_GE_IOCTL Ioctl; SK_GE_IOCTL Ioctl;
unsigned int Err = 0; unsigned int Err = 0;
int Size = 0; int Size = 0;
...@@ -3671,6 +3825,45 @@ int HeaderLength = sizeof(SK_U32) + sizeof(SK_U32); ...@@ -3671,6 +3825,45 @@ int HeaderLength = sizeof(SK_U32) + sizeof(SK_U32);
fault_gen: fault_gen:
kfree(pMemBuf); /* cleanup everything */ kfree(pMemBuf); /* cleanup everything */
break; break;
#ifdef SK_DIAG_SUPPORT
case SK_IOCTL_DIAG:
if (!capable(CAP_NET_ADMIN)) return -EPERM;
if (Ioctl.Len < (sizeof(pAC->PnmiStruct) + HeaderLength)) {
Length = Ioctl.Len;
} else {
Length = sizeof(pAC->PnmiStruct) + HeaderLength;
}
if (NULL == (pMemBuf = kmalloc(Length, GFP_KERNEL))) {
return -ENOMEM;
}
if(copy_from_user(pMemBuf, Ioctl.pData, Length)) {
Err = -EFAULT;
goto fault_diag;
}
pdev = pAC->PciDev;
Length = 3 * sizeof(SK_U32); /* Error, Bus and Device */
/*
** While coding this new IOCTL interface, only a few lines of code
** are to to be added. Therefore no dedicated function has been
** added. If more functionality is added, a separate function
** should be used...
*/
* ((SK_U32 *)pMemBuf) = 0;
* ((SK_U32 *)pMemBuf + 1) = pdev->bus->number;
* ((SK_U32 *)pMemBuf + 2) = ParseDeviceNbrFromSlotName(pdev->slot_name);
if(copy_to_user(Ioctl.pData, pMemBuf, Length) ) {
Err = -EFAULT;
goto fault_diag;
}
Ioctl.Len = Length;
if(copy_to_user(rq->ifr_data, &Ioctl, sizeof(SK_GE_IOCTL))) {
Err = -EFAULT;
goto fault_diag;
}
fault_diag:
kfree(pMemBuf); /* cleanup everything */
break;
#endif
default: default:
Err = -EOPNOTSUPP; Err = -EOPNOTSUPP;
} }
...@@ -3826,10 +4019,9 @@ int Capabilities[3][3] = ...@@ -3826,10 +4019,9 @@ int Capabilities[3][3] =
(strcmp(ConType[pAC->Index],"Auto")!=0) && (strcmp(ConType[pAC->Index],"Auto")!=0) &&
(strcmp(ConType[pAC->Index],"")!=0)) { (strcmp(ConType[pAC->Index],"")!=0)) {
/* Set the speed parameter back */ /* Set the speed parameter back */
printk("%s: Illegal value \"%s\" " printk("sk98lin: Illegal value \"%s\" "
"for ConType." "for ConType."
" Using Auto.\n", " Using Auto.\n",
pAC->dev[0]->name,
ConType[pAC->Index]); ConType[pAC->Index]);
sprintf(ConType[pAC->Index], "Auto"); sprintf(ConType[pAC->Index], "Auto");
...@@ -3873,8 +4065,8 @@ int Capabilities[3][3] = ...@@ -3873,8 +4065,8 @@ int Capabilities[3][3] =
M_CurrPort.PLinkSpeed = SK_LSPEED_10MBPS; M_CurrPort.PLinkSpeed = SK_LSPEED_10MBPS;
} }
} else { } else {
printk("%s: Illegal value \"%s\" for ConType\n", printk("sk98lin: Illegal value \"%s\" for ConType\n",
pAC->dev[0]->name, ConType[pAC->Index]); ConType[pAC->Index]);
IsConTypeDefined = SK_FALSE; /* Wrong ConType defined */ IsConTypeDefined = SK_FALSE; /* Wrong ConType defined */
} }
} else { } else {
...@@ -3898,8 +4090,8 @@ int Capabilities[3][3] = ...@@ -3898,8 +4090,8 @@ int Capabilities[3][3] =
} else if (strcmp(Speed_A[pAC->Index],"1000")==0) { } else if (strcmp(Speed_A[pAC->Index],"1000")==0) {
LinkSpeed = SK_LSPEED_1000MBPS; LinkSpeed = SK_LSPEED_1000MBPS;
} else { } else {
printk("%s: Illegal value \"%s\" for Speed_A\n", printk("sk98lin: Illegal value \"%s\" for Speed_A\n",
pAC->dev[0]->name, Speed_A[pAC->Index]); Speed_A[pAC->Index]);
IsLinkSpeedDefined = SK_FALSE; IsLinkSpeedDefined = SK_FALSE;
} }
} else { } else {
...@@ -3913,9 +4105,9 @@ int Capabilities[3][3] = ...@@ -3913,9 +4105,9 @@ int Capabilities[3][3] =
if (((!pAC->ChipsetType) || (pAC->GIni.GICopperType != SK_TRUE)) && if (((!pAC->ChipsetType) || (pAC->GIni.GICopperType != SK_TRUE)) &&
((LinkSpeed != SK_LSPEED_AUTO) && ((LinkSpeed != SK_LSPEED_AUTO) &&
(LinkSpeed != SK_LSPEED_1000MBPS))) { (LinkSpeed != SK_LSPEED_1000MBPS))) {
printk("%s: Illegal value for Speed_A. " printk("sk98lin: Illegal value for Speed_A. "
"Not a copper card or GE V2 card\n Using " "Not a copper card or GE V2 card\n Using "
"speed 1000\n", pAC->dev[0]->name); "speed 1000\n");
LinkSpeed = SK_LSPEED_1000MBPS; LinkSpeed = SK_LSPEED_1000MBPS;
} }
...@@ -3945,8 +4137,8 @@ int Capabilities[3][3] = ...@@ -3945,8 +4137,8 @@ int Capabilities[3][3] =
} else if (strcmp(AutoNeg_A[pAC->Index],"Sense")==0) { } else if (strcmp(AutoNeg_A[pAC->Index],"Sense")==0) {
AutoNeg = AN_SENS; AutoNeg = AN_SENS;
} else { } else {
printk("%s: Illegal value \"%s\" for AutoNeg_A\n", printk("sk98lin: Illegal value \"%s\" for AutoNeg_A\n",
pAC->dev[0]->name, AutoNeg_A[pAC->Index]); AutoNeg_A[pAC->Index]);
} }
} }
...@@ -3964,33 +4156,32 @@ int Capabilities[3][3] = ...@@ -3964,33 +4156,32 @@ int Capabilities[3][3] =
} else if (strcmp(DupCap_A[pAC->Index],"Half")==0) { } else if (strcmp(DupCap_A[pAC->Index],"Half")==0) {
DuplexCap = DC_HALF; DuplexCap = DC_HALF;
} else { } else {
printk("%s: Illegal value \"%s\" for DupCap_A\n", printk("sk98lin: Illegal value \"%s\" for DupCap_A\n",
pAC->dev[0]->name, DupCap_A[pAC->Index]); DupCap_A[pAC->Index]);
} }
} }
/* /*
** Check for illegal combinations ** Check for illegal combinations
*/ */
if ((LinkSpeed = SK_LSPEED_1000MBPS) && if ((LinkSpeed == SK_LSPEED_1000MBPS) &&
((DuplexCap == SK_LMODE_STAT_AUTOHALF) || ((DuplexCap == SK_LMODE_STAT_AUTOHALF) ||
(DuplexCap == SK_LMODE_STAT_HALF)) && (DuplexCap == SK_LMODE_STAT_HALF)) &&
(pAC->ChipsetType)) { (pAC->ChipsetType)) {
printk("%s: Half Duplex not possible with Gigabit speed!\n" printk("sk98lin: Half Duplex not possible with Gigabit speed!\n"
" Using Full Duplex.\n", " Using Full Duplex.\n");
pAC->dev[0]->name);
DuplexCap = DC_FULL; DuplexCap = DC_FULL;
} }
if ( AutoSet && AutoNeg==AN_SENS && DupSet) { if ( AutoSet && AutoNeg==AN_SENS && DupSet) {
printk("%s, Port A: DuplexCapabilities" printk("sk98lin, Port A: DuplexCapabilities"
" ignored using Sense mode\n", pAC->dev[0]->name); " ignored using Sense mode\n");
} }
if (AutoSet && AutoNeg==AN_OFF && DupSet && DuplexCap==DC_BOTH){ if (AutoSet && AutoNeg==AN_OFF && DupSet && DuplexCap==DC_BOTH){
printk("%s, Port A: Illegal combination" printk("sk98lin: Port A: Illegal combination"
" of values AutoNeg. and DuplexCap.\n Using " " of values AutoNeg. and DuplexCap.\n Using "
"Full Duplex\n", pAC->dev[0]->name); "Full Duplex\n");
DuplexCap = DC_FULL; DuplexCap = DC_FULL;
} }
...@@ -3999,10 +4190,9 @@ int Capabilities[3][3] = ...@@ -3999,10 +4190,9 @@ int Capabilities[3][3] =
} }
if (!AutoSet && DupSet) { if (!AutoSet && DupSet) {
printk("%s, Port A: Duplex setting not" printk("sk98lin: Port A: Duplex setting not"
" possible in\n default AutoNegotiation mode" " possible in\n default AutoNegotiation mode"
" (Sense).\n Using AutoNegotiation On\n", " (Sense).\n Using AutoNegotiation On\n");
pAC->dev[0]->name);
AutoNeg = AN_ON; AutoNeg = AN_ON;
} }
...@@ -4029,8 +4219,8 @@ int Capabilities[3][3] = ...@@ -4029,8 +4219,8 @@ int Capabilities[3][3] =
} else if (strcmp(FlowCtrl_A[pAC->Index],"None")==0) { } else if (strcmp(FlowCtrl_A[pAC->Index],"None")==0) {
FlowCtrl = SK_FLOW_MODE_NONE; FlowCtrl = SK_FLOW_MODE_NONE;
} else { } else {
printk("%s: Illegal value \"%s\" for FlowCtrl_A\n", printk("sk98lin: Illegal value \"%s\" for FlowCtrl_A\n",
pAC->dev[0]->name, FlowCtrl_A[pAC->Index]); FlowCtrl_A[pAC->Index]);
IsFlowCtrlDefined = SK_FALSE; IsFlowCtrlDefined = SK_FALSE;
} }
} else { } else {
...@@ -4039,9 +4229,9 @@ int Capabilities[3][3] = ...@@ -4039,9 +4229,9 @@ int Capabilities[3][3] =
if (IsFlowCtrlDefined) { if (IsFlowCtrlDefined) {
if ((AutoNeg == AN_OFF) && (FlowCtrl != SK_FLOW_MODE_NONE)) { if ((AutoNeg == AN_OFF) && (FlowCtrl != SK_FLOW_MODE_NONE)) {
printk("%s, Port A: FlowControl" printk("sk98lin: Port A: FlowControl"
" impossible without AutoNegotiation," " impossible without AutoNegotiation,"
" disabled\n", pAC->dev[0]->name); " disabled\n");
FlowCtrl = SK_FLOW_MODE_NONE; FlowCtrl = SK_FLOW_MODE_NONE;
} }
pAC->GIni.GP[0].PFlowCtrlMode = FlowCtrl; pAC->GIni.GP[0].PFlowCtrlMode = FlowCtrl;
...@@ -4061,8 +4251,8 @@ int Capabilities[3][3] = ...@@ -4061,8 +4251,8 @@ int Capabilities[3][3] =
} else if (strcmp(Role_A[pAC->Index],"Slave")==0) { } else if (strcmp(Role_A[pAC->Index],"Slave")==0) {
MSMode = SK_MS_MODE_SLAVE; MSMode = SK_MS_MODE_SLAVE;
} else { } else {
printk("%s: Illegal value \"%s\" for Role_A\n", printk("sk98lin: Illegal value \"%s\" for Role_A\n",
pAC->dev[0]->name, Role_A[pAC->Index]); Role_A[pAC->Index]);
IsRoleDefined = SK_FALSE; IsRoleDefined = SK_FALSE;
} }
} else { } else {
...@@ -4097,8 +4287,8 @@ int Capabilities[3][3] = ...@@ -4097,8 +4287,8 @@ int Capabilities[3][3] =
} else if (strcmp(Speed_B[pAC->Index],"1000")==0) { } else if (strcmp(Speed_B[pAC->Index],"1000")==0) {
LinkSpeed = SK_LSPEED_1000MBPS; LinkSpeed = SK_LSPEED_1000MBPS;
} else { } else {
printk("%s: Illegal value \"%s\" for Speed_B\n", printk("sk98lin: Illegal value \"%s\" for Speed_B\n",
pAC->dev[1]->name, Speed_B[pAC->Index]); Speed_B[pAC->Index]);
IsLinkSpeedDefined = SK_FALSE; IsLinkSpeedDefined = SK_FALSE;
} }
} else { } else {
...@@ -4112,9 +4302,9 @@ int Capabilities[3][3] = ...@@ -4112,9 +4302,9 @@ int Capabilities[3][3] =
if (((!pAC->ChipsetType) || (pAC->GIni.GICopperType != SK_TRUE)) && if (((!pAC->ChipsetType) || (pAC->GIni.GICopperType != SK_TRUE)) &&
((LinkSpeed != SK_LSPEED_AUTO) && ((LinkSpeed != SK_LSPEED_AUTO) &&
(LinkSpeed != SK_LSPEED_1000MBPS))) { (LinkSpeed != SK_LSPEED_1000MBPS))) {
printk("%s: Illegal value for Speed_B. " printk("sk98lin: Illegal value for Speed_B. "
"Not a copper card or GE V2 card\n Using " "Not a copper card or GE V2 card\n Using "
"speed 1000\n", pAC->dev[1]->name); "speed 1000\n");
LinkSpeed = SK_LSPEED_1000MBPS; LinkSpeed = SK_LSPEED_1000MBPS;
} }
...@@ -4144,8 +4334,8 @@ int Capabilities[3][3] = ...@@ -4144,8 +4334,8 @@ int Capabilities[3][3] =
} else if (strcmp(AutoNeg_B[pAC->Index],"Sense")==0) { } else if (strcmp(AutoNeg_B[pAC->Index],"Sense")==0) {
AutoNeg = AN_SENS; AutoNeg = AN_SENS;
} else { } else {
printk("%s: Illegal value \"%s\" for AutoNeg_B\n", printk("sk98lin: Illegal value \"%s\" for AutoNeg_B\n",
pAC->dev[0]->name, AutoNeg_B[pAC->Index]); AutoNeg_B[pAC->Index]);
} }
} }
...@@ -4163,8 +4353,8 @@ int Capabilities[3][3] = ...@@ -4163,8 +4353,8 @@ int Capabilities[3][3] =
} else if (strcmp(DupCap_B[pAC->Index],"Half")==0) { } else if (strcmp(DupCap_B[pAC->Index],"Half")==0) {
DuplexCap = DC_HALF; DuplexCap = DC_HALF;
} else { } else {
printk("%s: Illegal value \"%s\" for DupCap_B\n", printk("sk98lin: Illegal value \"%s\" for DupCap_B\n",
pAC->dev[0]->name, DupCap_B[pAC->Index]); DupCap_B[pAC->Index]);
} }
} }
...@@ -4172,25 +4362,24 @@ int Capabilities[3][3] = ...@@ -4172,25 +4362,24 @@ int Capabilities[3][3] =
/* /*
** Check for illegal combinations ** Check for illegal combinations
*/ */
if ((LinkSpeed = SK_LSPEED_1000MBPS) && if ((LinkSpeed == SK_LSPEED_1000MBPS) &&
((DuplexCap == SK_LMODE_STAT_AUTOHALF) || ((DuplexCap == SK_LMODE_STAT_AUTOHALF) ||
(DuplexCap == SK_LMODE_STAT_HALF)) && (DuplexCap == SK_LMODE_STAT_HALF)) &&
(pAC->ChipsetType)) { (pAC->ChipsetType)) {
printk("%s: Half Duplex not possible with Gigabit speed!\n" printk("sk98lin: Half Duplex not possible with Gigabit speed!\n"
" Using Full Duplex.\n", " Using Full Duplex.\n");
pAC->dev[1]->name);
DuplexCap = DC_FULL; DuplexCap = DC_FULL;
} }
if (AutoSet && AutoNeg==AN_SENS && DupSet) { if (AutoSet && AutoNeg==AN_SENS && DupSet) {
printk("%s, Port B: DuplexCapabilities" printk("sk98lin, Port B: DuplexCapabilities"
" ignored using Sense mode\n", pAC->dev[1]->name); " ignored using Sense mode\n");
} }
if (AutoSet && AutoNeg==AN_OFF && DupSet && DuplexCap==DC_BOTH){ if (AutoSet && AutoNeg==AN_OFF && DupSet && DuplexCap==DC_BOTH){
printk("%s, Port B: Illegal combination" printk("sk98lin: Port B: Illegal combination"
" of values AutoNeg. and DuplexCap.\n Using " " of values AutoNeg. and DuplexCap.\n Using "
"Full Duplex\n", pAC->dev[1]->name); "Full Duplex\n");
DuplexCap = DC_FULL; DuplexCap = DC_FULL;
} }
...@@ -4199,10 +4388,9 @@ int Capabilities[3][3] = ...@@ -4199,10 +4388,9 @@ int Capabilities[3][3] =
} }
if (!AutoSet && DupSet) { if (!AutoSet && DupSet) {
printk("%s, Port B: Duplex setting not" printk("sk98lin: Port B: Duplex setting not"
" possible in\n default AutoNegotiation mode" " possible in\n default AutoNegotiation mode"
" (Sense).\n Using AutoNegotiation On\n", " (Sense).\n Using AutoNegotiation On\n");
pAC->dev[1]->name);
AutoNeg = AN_ON; AutoNeg = AN_ON;
} }
...@@ -4229,8 +4417,8 @@ int Capabilities[3][3] = ...@@ -4229,8 +4417,8 @@ int Capabilities[3][3] =
} else if (strcmp(FlowCtrl_B[pAC->Index],"None")==0) { } else if (strcmp(FlowCtrl_B[pAC->Index],"None")==0) {
FlowCtrl = SK_FLOW_MODE_NONE; FlowCtrl = SK_FLOW_MODE_NONE;
} else { } else {
printk("%s: Illegal value \"%s\" for FlowCtrl_B\n", printk("sk98lin: Illegal value \"%s\" for FlowCtrl_B\n",
pAC->dev[0]->name, FlowCtrl_B[pAC->Index]); FlowCtrl_B[pAC->Index]);
IsFlowCtrlDefined = SK_FALSE; IsFlowCtrlDefined = SK_FALSE;
} }
} else { } else {
...@@ -4239,9 +4427,9 @@ int Capabilities[3][3] = ...@@ -4239,9 +4427,9 @@ int Capabilities[3][3] =
if (IsFlowCtrlDefined) { if (IsFlowCtrlDefined) {
if ((AutoNeg == AN_OFF) && (FlowCtrl != SK_FLOW_MODE_NONE)) { if ((AutoNeg == AN_OFF) && (FlowCtrl != SK_FLOW_MODE_NONE)) {
printk("%s, Port B: FlowControl" printk("sk98lin: Port B: FlowControl"
" impossible without AutoNegotiation," " impossible without AutoNegotiation,"
" disabled\n", pAC->dev[1]->name); " disabled\n");
FlowCtrl = SK_FLOW_MODE_NONE; FlowCtrl = SK_FLOW_MODE_NONE;
} }
pAC->GIni.GP[1].PFlowCtrlMode = FlowCtrl; pAC->GIni.GP[1].PFlowCtrlMode = FlowCtrl;
...@@ -4261,8 +4449,8 @@ int Capabilities[3][3] = ...@@ -4261,8 +4449,8 @@ int Capabilities[3][3] =
} else if (strcmp(Role_B[pAC->Index],"Slave")==0) { } else if (strcmp(Role_B[pAC->Index],"Slave")==0) {
MSMode = SK_MS_MODE_SLAVE; MSMode = SK_MS_MODE_SLAVE;
} else { } else {
printk("%s: Illegal value \"%s\" for Role_B\n", printk("sk98lin: Illegal value \"%s\" for Role_B\n",
pAC->dev[1]->name, Role_B[pAC->Index]); Role_B[pAC->Index]);
IsRoleDefined = SK_FALSE; IsRoleDefined = SK_FALSE;
} }
} else { } else {
...@@ -4280,28 +4468,37 @@ int Capabilities[3][3] = ...@@ -4280,28 +4468,37 @@ int Capabilities[3][3] =
if (PrefPort != NULL && pAC->Index<SK_MAX_CARD_PARAM && if (PrefPort != NULL && pAC->Index<SK_MAX_CARD_PARAM &&
PrefPort[pAC->Index] != NULL) { PrefPort[pAC->Index] != NULL) {
if (strcmp(PrefPort[pAC->Index],"") == 0) { /* Auto */ if (strcmp(PrefPort[pAC->Index],"") == 0) { /* Auto */
pAC->ActivePort = 0; pAC->ActivePort = 0;
pAC->Rlmt.Net[0].Preference = -1; /* auto */ pAC->Rlmt.Net[0].Preference = -1; /* auto */
pAC->Rlmt.Net[0].PrefPort = 0; pAC->Rlmt.Net[0].PrefPort = 0;
} else if (strcmp(PrefPort[pAC->Index],"A") == 0) { } else if (strcmp(PrefPort[pAC->Index],"A") == 0) {
/* /*
** do not set ActivePort here, thus a port ** do not set ActivePort here, thus a port
** switch is issued after net up. ** switch is issued after net up.
*/ */
Port = 0; Port = 0;
pAC->Rlmt.Net[0].Preference = Port; pAC->Rlmt.Net[0].Preference = Port;
pAC->Rlmt.Net[0].PrefPort = Port; pAC->Rlmt.Net[0].PrefPort = Port;
} else if (strcmp(PrefPort[pAC->Index],"B") == 0) { } else if (strcmp(PrefPort[pAC->Index],"B") == 0) {
/* /*
** do not set ActivePort here, thus a port ** do not set ActivePort here, thus a port
** switch is issued after net up. ** switch is issued after net up.
*/ */
Port = 1; if (pAC->GIni.GIMacsFound == 1) {
pAC->Rlmt.Net[0].Preference = Port; printk("sk98lin: Illegal value \"B\" for PrefPort.\n"
pAC->Rlmt.Net[0].PrefPort = Port; " Port B not available on single port adapters.\n");
pAC->ActivePort = 0;
pAC->Rlmt.Net[0].Preference = -1; /* auto */
pAC->Rlmt.Net[0].PrefPort = 0;
} else {
Port = 1;
pAC->Rlmt.Net[0].Preference = Port;
pAC->Rlmt.Net[0].PrefPort = Port;
}
} else { } else {
printk("%s: Illegal value \"%s\" for PrefPort\n", printk("sk98lin: Illegal value \"%s\" for PrefPort\n",
pAC->dev[0]->name, PrefPort[pAC->Index]); PrefPort[pAC->Index]);
} }
} }
...@@ -4325,9 +4522,9 @@ int Capabilities[3][3] = ...@@ -4325,9 +4522,9 @@ int Capabilities[3][3] =
pAC->RlmtMode = SK_RLMT_CHECK_LINK; pAC->RlmtMode = SK_RLMT_CHECK_LINK;
pAC->RlmtNets = 2; pAC->RlmtNets = 2;
} else { } else {
printk("%s: Illegal value \"%s\" for" printk("sk98lin: Illegal value \"%s\" for"
" RlmtMode, using default\n", " RlmtMode, using default\n",
pAC->dev[0]->name, RlmtMode[pAC->Index]); RlmtMode[pAC->Index]);
pAC->RlmtMode = 0; pAC->RlmtMode = 0;
} }
} else { } else {
...@@ -4338,97 +4535,111 @@ int Capabilities[3][3] = ...@@ -4338,97 +4535,111 @@ int Capabilities[3][3] =
** Check the interrupt moderation parameters ** Check the interrupt moderation parameters
*/ */
if (Moderation[pAC->Index] != NULL) { if (Moderation[pAC->Index] != NULL) {
if (strcmp(Moderation[pAC->Index], "Static") == 0) { if (strcmp(Moderation[pAC->Index], "") == 0) {
pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_STATIC; pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_NONE;
} else if (strcmp(Moderation[pAC->Index], "Dynamic") == 0) { } else if (strcmp(Moderation[pAC->Index], "Static") == 0) {
pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_DYNAMIC; pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_STATIC;
} else { } else if (strcmp(Moderation[pAC->Index], "Dynamic") == 0) {
pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_NONE; pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_DYNAMIC;
} } else if (strcmp(Moderation[pAC->Index], "None") == 0) {
pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_NONE;
} else {
printk("sk98lin: Illegal value \"%s\" for Moderation.\n"
" Disable interrupt moderation.\n",
Moderation[pAC->Index]);
pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_NONE;
}
} else { } else {
pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_NONE; pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_NONE;
} }
if (Stats[pAC->Index] != NULL) { if (Stats[pAC->Index] != NULL) {
if (strcmp(Stats[pAC->Index], "Yes") == 0) { if (strcmp(Stats[pAC->Index], "Yes") == 0) {
pAC->DynIrqModInfo.DisplayStats = SK_TRUE; pAC->DynIrqModInfo.DisplayStats = SK_TRUE;
} else { } else {
pAC->DynIrqModInfo.DisplayStats = SK_FALSE; pAC->DynIrqModInfo.DisplayStats = SK_FALSE;
} }
} else { } else {
pAC->DynIrqModInfo.DisplayStats = SK_FALSE; pAC->DynIrqModInfo.DisplayStats = SK_FALSE;
} }
if (ModerationMask[pAC->Index] != NULL) { if (ModerationMask[pAC->Index] != NULL) {
if (strcmp(ModerationMask[pAC->Index], "Rx") == 0) { if (strcmp(ModerationMask[pAC->Index], "Rx") == 0) {
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_ONLY; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_ONLY;
} else if (strcmp(ModerationMask[pAC->Index], "Tx") == 0) { } else if (strcmp(ModerationMask[pAC->Index], "Tx") == 0) {
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_ONLY; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_ONLY;
} else if (strcmp(ModerationMask[pAC->Index], "Sp") == 0) { } else if (strcmp(ModerationMask[pAC->Index], "Sp") == 0) {
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_ONLY; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_ONLY;
} else if (strcmp(ModerationMask[pAC->Index], "RxSp") == 0) { } else if (strcmp(ModerationMask[pAC->Index], "RxSp") == 0) {
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_RX; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_RX;
} else if (strcmp(ModerationMask[pAC->Index], "SpRx") == 0) { } else if (strcmp(ModerationMask[pAC->Index], "SpRx") == 0) {
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_RX; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_RX;
} else if (strcmp(ModerationMask[pAC->Index], "RxTx") == 0) { } else if (strcmp(ModerationMask[pAC->Index], "RxTx") == 0) {
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_RX; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_RX;
} else if (strcmp(ModerationMask[pAC->Index], "TxRx") == 0) { } else if (strcmp(ModerationMask[pAC->Index], "TxRx") == 0) {
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_RX; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_RX;
} else if (strcmp(ModerationMask[pAC->Index], "TxSp") == 0) { } else if (strcmp(ModerationMask[pAC->Index], "TxSp") == 0) {
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_TX; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_TX;
} else if (strcmp(ModerationMask[pAC->Index], "SpTx") == 0) { } else if (strcmp(ModerationMask[pAC->Index], "SpTx") == 0) {
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_TX; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_TX;
} else if (strcmp(ModerationMask[pAC->Index], "RxTxSp") == 0) { } else if (strcmp(ModerationMask[pAC->Index], "RxTxSp") == 0) {
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP;
} else if (strcmp(ModerationMask[pAC->Index], "RxSpTx") == 0) { } else if (strcmp(ModerationMask[pAC->Index], "RxSpTx") == 0) {
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP;
} else if (strcmp(ModerationMask[pAC->Index], "TxRxSp") == 0) { } else if (strcmp(ModerationMask[pAC->Index], "TxRxSp") == 0) {
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP;
} else if (strcmp(ModerationMask[pAC->Index], "TxSpRx") == 0) { } else if (strcmp(ModerationMask[pAC->Index], "TxSpRx") == 0) {
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP;
} else if (strcmp(ModerationMask[pAC->Index], "SpTxRx") == 0) { } else if (strcmp(ModerationMask[pAC->Index], "SpTxRx") == 0) {
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP;
} else if (strcmp(ModerationMask[pAC->Index], "SpRxTx") == 0) { } else if (strcmp(ModerationMask[pAC->Index], "SpRxTx") == 0) {
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP;
} else { /* some rubbish */ } else { /* some rubbish */
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_ONLY; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_ONLY;
} }
} else { /* operator has stated nothing */ } else { /* operator has stated nothing */
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_RX; pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_RX;
} }
if (AutoSizing[pAC->Index] != NULL) { if (AutoSizing[pAC->Index] != NULL) {
if (strcmp(AutoSizing[pAC->Index], "On") == 0) { if (strcmp(AutoSizing[pAC->Index], "On") == 0) {
pAC->DynIrqModInfo.AutoSizing = SK_FALSE; pAC->DynIrqModInfo.AutoSizing = SK_FALSE;
} else { } else {
pAC->DynIrqModInfo.AutoSizing = SK_FALSE; pAC->DynIrqModInfo.AutoSizing = SK_FALSE;
} }
} else { /* operator has stated nothing */ } else { /* operator has stated nothing */
pAC->DynIrqModInfo.AutoSizing = SK_FALSE; pAC->DynIrqModInfo.AutoSizing = SK_FALSE;
} }
if (IntsPerSec[pAC->Index] != 0) { if (IntsPerSec[pAC->Index] != 0) {
if ((IntsPerSec[pAC->Index]< 30) || (IntsPerSec[pAC->Index]> 40000)) { if ((IntsPerSec[pAC->Index]< C_INT_MOD_IPS_LOWER_RANGE) ||
pAC->DynIrqModInfo.MaxModIntsPerSec = C_INTS_PER_SEC_DEFAULT; (IntsPerSec[pAC->Index] > C_INT_MOD_IPS_UPPER_RANGE)) {
} else { printk("sk98lin: Illegal value \"%d\" for IntsPerSec. (Range: %d - %d)\n"
pAC->DynIrqModInfo.MaxModIntsPerSec = IntsPerSec[pAC->Index]; " Using default value of %i.\n",
} IntsPerSec[pAC->Index],
} else { C_INT_MOD_IPS_LOWER_RANGE,
pAC->DynIrqModInfo.MaxModIntsPerSec = C_INTS_PER_SEC_DEFAULT; C_INT_MOD_IPS_UPPER_RANGE,
} C_INTS_PER_SEC_DEFAULT);
pAC->DynIrqModInfo.MaxModIntsPerSec = C_INTS_PER_SEC_DEFAULT;
} else {
pAC->DynIrqModInfo.MaxModIntsPerSec = IntsPerSec[pAC->Index];
}
} else {
pAC->DynIrqModInfo.MaxModIntsPerSec = C_INTS_PER_SEC_DEFAULT;
}
/* /*
** Evaluate upper and lower moderation threshold ** Evaluate upper and lower moderation threshold
*/ */
pAC->DynIrqModInfo.MaxModIntsPerSecUpperLimit = pAC->DynIrqModInfo.MaxModIntsPerSecUpperLimit =
pAC->DynIrqModInfo.MaxModIntsPerSec + pAC->DynIrqModInfo.MaxModIntsPerSec +
(pAC->DynIrqModInfo.MaxModIntsPerSec / 2); (pAC->DynIrqModInfo.MaxModIntsPerSec / 2);
pAC->DynIrqModInfo.MaxModIntsPerSecLowerLimit = pAC->DynIrqModInfo.MaxModIntsPerSecLowerLimit =
pAC->DynIrqModInfo.MaxModIntsPerSec - pAC->DynIrqModInfo.MaxModIntsPerSec -
(pAC->DynIrqModInfo.MaxModIntsPerSec / 2); (pAC->DynIrqModInfo.MaxModIntsPerSec / 2);
pAC->DynIrqModInfo.PrevTimeVal = jiffies; /* initial value */ pAC->DynIrqModInfo.PrevTimeVal = jiffies; /* initial value */
} /* GetConfiguration */ } /* GetConfiguration */
...@@ -4826,6 +5037,10 @@ SK_BOOL DualNet; ...@@ -4826,6 +5037,10 @@ SK_BOOL DualNet;
FromPort = Param.Para32[0]; FromPort = Param.Para32[0];
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
("NET UP EVENT, Port: %d ", Param.Para32[0])); ("NET UP EVENT, Port: %d ", Param.Para32[0]));
/* Mac update */
SkAddrMcUpdate(pAC,IoC, FromPort);
if (DoPrintInterfaceChange) {
printk("%s: network connection up using" printk("%s: network connection up using"
" port %c\n", pAC->dev[Param.Para32[0]]->name, 'A'+Param.Para32[0]); " port %c\n", pAC->dev[Param.Para32[0]]->name, 'A'+Param.Para32[0]);
...@@ -4841,8 +5056,6 @@ SK_BOOL DualNet; ...@@ -4841,8 +5056,6 @@ SK_BOOL DualNet;
printk(" speed: unknown\n"); printk(" speed: unknown\n");
} }
/* Mac update */
SkAddrMcUpdate(pAC,IoC, FromPort);
Stat = pAC->GIni.GP[FromPort].PLinkModeStatus; Stat = pAC->GIni.GP[FromPort].PLinkModeStatus;
if (Stat == SK_LMODE_STAT_AUTOHALF || if (Stat == SK_LMODE_STAT_AUTOHALF ||
...@@ -4920,6 +5133,9 @@ SK_BOOL DualNet; ...@@ -4920,6 +5133,9 @@ SK_BOOL DualNet;
printk(" rx-checksum: disabled\n"); printk(" rx-checksum: disabled\n");
#endif #endif
} else {
DoPrintInterfaceChange = SK_TRUE;
}
if ((Param.Para32[0] != pAC->ActivePort) && if ((Param.Para32[0] != pAC->ActivePort) &&
(pAC->RlmtNets == 1)) { (pAC->RlmtNets == 1)) {
...@@ -4937,7 +5153,12 @@ SK_BOOL DualNet; ...@@ -4937,7 +5153,12 @@ SK_BOOL DualNet;
/* action list 7 */ /* action list 7 */
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
("NET DOWN EVENT ")); ("NET DOWN EVENT "));
printk("%s: network connection down\n", pAC->dev[Param.Para32[1]]->name); if (DoPrintInterfaceChange) {
printk("%s: network connection down\n",
pAC->dev[Param.Para32[1]]->name);
} else {
DoPrintInterfaceChange = SK_TRUE;
}
pAC->dev[Param.Para32[1]]->flags &= ~IFF_RUNNING; pAC->dev[Param.Para32[1]]->flags &= ~IFF_RUNNING;
break; break;
case SK_DRV_SWITCH_HARD: /* SK_U32 FromPortIdx SK_U32 ToPortIdx */ case SK_DRV_SWITCH_HARD: /* SK_U32 FromPortIdx SK_U32 ToPortIdx */
...@@ -5122,6 +5343,231 @@ char ClassStr[80]; ...@@ -5122,6 +5343,231 @@ char ClassStr[80];
} /* SkErrorLog */ } /* SkErrorLog */
#ifdef SK_DIAG_SUPPORT
/*****************************************************************************
*
* SkDrvEnterDiagMode - handles DIAG attach request
*
* Description:
* Notify the kernel to NOT access the card any longer due to DIAG
* Deinitialize the Card
*
* Returns:
* int
*/
int SkDrvEnterDiagMode(
SK_AC *pAc) /* pointer to adapter context */
{
SK_AC *pAC = NULL;
DEV_NET *pNet = NULL;
pNet = (DEV_NET *) pAc->dev[0]->priv;
pAC = pNet->pAC;
SK_MEMCPY(&(pAc->PnmiBackup), &(pAc->PnmiStruct),
sizeof(SK_PNMI_STRUCT_DATA));
pAC->DiagModeActive = DIAG_ACTIVE;
if (pAC->BoardLevel > SK_INIT_DATA) {
if (pNet->Up) {
pAC->WasIfUp[0] = SK_TRUE;
pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
DoPrintInterfaceChange = SK_FALSE;
SkDrvDeInitAdapter(pAC, 0); /* performs SkGeClose */
} else {
pAC->WasIfUp[0] = SK_FALSE;
}
if (pNet != (DEV_NET *) pAc->dev[1]->priv) {
pNet = (DEV_NET *) pAc->dev[1]->priv;
if (pNet->Up) {
pAC->WasIfUp[1] = SK_TRUE;
pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
DoPrintInterfaceChange = SK_FALSE;
SkDrvDeInitAdapter(pAC, 1); /* do SkGeClose */
} else {
pAC->WasIfUp[1] = SK_FALSE;
}
}
pAC->BoardLevel = SK_INIT_DATA;
}
return(0);
}
/*****************************************************************************
*
* SkDrvLeaveDiagMode - handles DIAG detach request
*
* Description:
* Notify the kernel to may access the card again after use by DIAG
* Initialize the Card
*
* Returns:
* int
*/
int SkDrvLeaveDiagMode(
SK_AC *pAc) /* pointer to adapter control context */
{
SK_MEMCPY(&(pAc->PnmiStruct), &(pAc->PnmiBackup),
sizeof(SK_PNMI_STRUCT_DATA));
pAc->DiagModeActive = DIAG_NOTACTIVE;
pAc->Pnmi.DiagAttached = SK_DIAG_IDLE;
if (pAc->WasIfUp[0] == SK_TRUE) {
pAc->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
DoPrintInterfaceChange = SK_FALSE;
SkDrvInitAdapter(pAc, 0); /* first device */
}
if (pAc->WasIfUp[1] == SK_TRUE) {
pAc->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
DoPrintInterfaceChange = SK_FALSE;
SkDrvInitAdapter(pAc, 1); /* second device */
}
return(0);
}
/*****************************************************************************
*
* ParseDeviceNbrFromSlotName - Evaluate PCI device number
*
* Description:
* This function parses the PCI slot name information string and will
* retrieve the devcie number out of it. The slot_name maintianed by
* linux is in the form of '02:0a.0', whereas the first two characters
* represent the bus number in hex (in the sample above this is
* pci bus 0x02) and the next two characters the device number (0x0a).
*
* Returns:
* SK_U32: The device number from the PCI slot name
*/
static SK_U32 ParseDeviceNbrFromSlotName(
const char *SlotName) /* pointer to pci slot name eg. '02:0a.0' */
{
char *CurrCharPos = (char *) SlotName;
int FirstNibble = -1;
int SecondNibble = -1;
SK_U32 Result = 0;
while (*CurrCharPos != '\0') {
if (*CurrCharPos == ':') {
while (*CurrCharPos != '.') {
CurrCharPos++;
if ( (*CurrCharPos >= '0') &&
(*CurrCharPos <= '9')) {
if (FirstNibble == -1) {
/* dec. value for '0' */
FirstNibble = *CurrCharPos - 48;
} else {
SecondNibble = *CurrCharPos - 48;
}
} else if ( (*CurrCharPos >= 'a') &&
(*CurrCharPos <= 'f') ) {
if (FirstNibble == -1) {
FirstNibble = *CurrCharPos - 87;
} else {
SecondNibble = *CurrCharPos - 87;
}
} else {
Result = 0;
}
}
Result = FirstNibble;
Result = Result << 4; /* first nibble is higher one */
Result = Result | SecondNibble;
}
CurrCharPos++; /* next character */
}
return (Result);
}
/****************************************************************************
*
* SkDrvDeInitAdapter - deinitialize adapter (this function is only
* called if Diag attaches to that card)
*
* Description:
* Close initialized adapter.
*
* Returns:
* 0 - on success
* error code - on error
*/
static int SkDrvDeInitAdapter(
SK_AC *pAC, /* pointer to adapter context */
int devNbr) /* what device is to be handled */
{
struct SK_NET_DEVICE *dev;
dev = pAC->dev[devNbr];
/*
** Function SkGeClose() uses MOD_DEC_USE_COUNT (2.2/2.4)
** or module_put() (2.6) to decrease the number of users for
** a device, but if a device is to be put under control of
** the DIAG, that count is OK already and does not need to
** be adapted! Hence the opposite MOD_INC_USE_COUNT or
** try_module_get() needs to be used again to correct that.
*/
if (!try_module_get(THIS_MODULE)) {
return (-1);
}
if (SkGeClose(dev) != 0) {
module_put(THIS_MODULE);
return (-1);
}
return (0);
} /* SkDrvDeInitAdapter() */
/****************************************************************************
*
* SkDrvInitAdapter - Initialize adapter (this function is only
* called if Diag deattaches from that card)
*
* Description:
* Close initialized adapter.
*
* Returns:
* 0 - on success
* error code - on error
*/
static int SkDrvInitAdapter(
SK_AC *pAC, /* pointer to adapter context */
int devNbr) /* what device is to be handled */
{
struct SK_NET_DEVICE *dev;
dev = pAC->dev[devNbr];
if (SkGeOpen(dev) != 0) {
return (-1);
} else {
/*
** Function SkGeOpen() uses MOD_INC_USE_COUNT (2.2/2.4)
** or try_module_get() (2.6) to increase the number of
** users for a device, but if a device was just under
** control of the DIAG, that count is OK already and
** does not need to be adapted! Hence the opposite
** MOD_DEC_USE_COUNT or module_put() needs to be used
** again to correct that.
*/
module_put(THIS_MODULE);
}
/*
** Use correct MTU size and indicate to kernel TX queue can be started
*/
if (SkGeChangeMtu(dev, dev->mtu) != 0) {
return (-1);
}
return (0);
} /* SkDrvInitAdapter */
#endif
#ifdef DEBUG #ifdef DEBUG
/****************************************************************************/ /****************************************************************************/
/* "debug only" section *****************************************************/ /* "debug only" section *****************************************************/
......
/****************************************************************************** /******************************************************************************
* *
* Name: skgehwt.c * Name: skgehwt.c
* Project: Gigabit Ethernet Adapters, Common Modules * Project: Gigabit Ethernet Adapters, Event Scheduler Module
* Version: $Revision: 1.14 $ * Version: $Revision: 1.15 $
* Date: $Date: 2003/05/13 18:01:58 $ * Date: $Date: 2003/09/16 13:41:23 $
* Purpose: Hardware Timer. * Purpose: Hardware Timer
* *
******************************************************************************/ ******************************************************************************/
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
* History: * History:
* *
* $Log: skgehwt.c,v $ * $Log: skgehwt.c,v $
* Revision 1.15 2003/09/16 13:41:23 rschmidt
* Added (C) Marvell to SysKonnectFileId
* Editorial changes
*
* Revision 1.14 2003/05/13 18:01:58 mkarl * Revision 1.14 2003/05/13 18:01:58 mkarl
* Editorial changes. * Editorial changes.
* *
...@@ -69,19 +73,15 @@ ...@@ -69,19 +73,15 @@
* *
* Revision 1.1 1998/08/05 11:28:36 gklug * Revision 1.1 1998/08/05 11:28:36 gklug
* first version: adapted from SMT/FDDI * first version: adapted from SMT/FDDI
*
*
*
* *
******************************************************************************/ ******************************************************************************/
/* /*
Event queue and dispatcher * Event queue and dispatcher
*/ */
#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM)))) #if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
static const char SysKonnectFileId[] = static const char SysKonnectFileId[] =
"$Header: /usr56/projects/ge/schedule/skgehwt.c,v 1.14 2003/05/13 18:01:58 mkarl Exp $" ; "@(#) $Id: skgehwt.c,v 1.15 2003/09/16 13:41:23 rschmidt Exp $ (C) Marvell.";
#endif #endif
#include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/skdrv1st.h" /* Driver Specific Definitions */
...@@ -89,10 +89,7 @@ static const char SysKonnectFileId[] = ...@@ -89,10 +89,7 @@ static const char SysKonnectFileId[] =
#ifdef __C2MAN__ #ifdef __C2MAN__
/* /*
Hardware Timer function queue management. * Hardware Timer function queue management.
General Description:
*/ */
intro() intro()
{} {}
...@@ -117,9 +114,9 @@ SK_IOC Ioc) /* IoContext */ ...@@ -117,9 +114,9 @@ SK_IOC Ioc) /* IoContext */
{ {
pAC->Hwt.TStart = 0 ; pAC->Hwt.TStart = 0 ;
pAC->Hwt.TStop = 0 ; pAC->Hwt.TStop = 0 ;
pAC->Hwt.TActive = SK_FALSE ; pAC->Hwt.TActive = SK_FALSE;
SkHwtStop(pAC,Ioc) ; SkHwtStop(pAC, Ioc);
} }
/* /*
...@@ -132,28 +129,29 @@ SK_AC *pAC, /* Adapters context */ ...@@ -132,28 +129,29 @@ SK_AC *pAC, /* Adapters context */
SK_IOC Ioc, /* IoContext */ SK_IOC Ioc, /* IoContext */
SK_U32 Time) /* Time in units of 16us to load the timer with. */ SK_U32 Time) /* Time in units of 16us to load the timer with. */
{ {
SK_U32 Cnt ; SK_U32 Cnt;
if (Time > SK_HWT_MAX) if (Time > SK_HWT_MAX)
Time = SK_HWT_MAX ; Time = SK_HWT_MAX;
pAC->Hwt.TStart = Time ; pAC->Hwt.TStart = Time;
pAC->Hwt.TStop = 0L ; pAC->Hwt.TStop = 0L;
Cnt = Time ; Cnt = Time;
/* /*
* if time < 16 us * if time < 16 us
* time = 16 us * time = 16 us
*/ */
if (!Cnt) { if (!Cnt) {
Cnt++ ; Cnt++;
} }
SK_OUT32(Ioc, B2_TI_INI, Cnt * SK_HWT_FAC) ; SK_OUT32(Ioc, B2_TI_INI, Cnt * SK_HWT_FAC);
SK_OUT16(Ioc, B2_TI_CRTL, TIM_START) ; /* Start timer. */
SK_OUT16(Ioc, B2_TI_CTRL, TIM_START); /* Start timer. */
pAC->Hwt.TActive = SK_TRUE ; pAC->Hwt.TActive = SK_TRUE;
} }
/* /*
...@@ -164,10 +162,11 @@ void SkHwtStop( ...@@ -164,10 +162,11 @@ void SkHwtStop(
SK_AC *pAC, /* Adapters context */ SK_AC *pAC, /* Adapters context */
SK_IOC Ioc) /* IoContext */ SK_IOC Ioc) /* IoContext */
{ {
SK_OUT16(Ioc, B2_TI_CRTL, TIM_STOP) ; SK_OUT16(Ioc, B2_TI_CTRL, TIM_STOP);
SK_OUT16(Ioc, B2_TI_CRTL, TIM_CLR_IRQ) ;
SK_OUT16(Ioc, B2_TI_CTRL, TIM_CLR_IRQ);
pAC->Hwt.TActive = SK_FALSE ; pAC->Hwt.TActive = SK_FALSE;
} }
...@@ -182,26 +181,31 @@ SK_U32 SkHwtRead( ...@@ -182,26 +181,31 @@ SK_U32 SkHwtRead(
SK_AC *pAC, /* Adapters context */ SK_AC *pAC, /* Adapters context */
SK_IOC Ioc) /* IoContext */ SK_IOC Ioc) /* IoContext */
{ {
SK_U32 TRead ; SK_U32 TRead;
SK_U32 IStatus ; SK_U32 IStatus;
if (pAC->Hwt.TActive) { if (pAC->Hwt.TActive) {
SkHwtStop(pAC,Ioc) ;
SkHwtStop(pAC, Ioc);
SK_IN32(Ioc, B2_TI_VAL, &TRead); SK_IN32(Ioc, B2_TI_VAL, &TRead);
TRead /= SK_HWT_FAC; TRead /= SK_HWT_FAC;
SK_IN32(Ioc, B0_ISRC, &IStatus); SK_IN32(Ioc, B0_ISRC, &IStatus);
/* Check if timer expired (or wraparound). */ /* Check if timer expired (or wraped around) */
if ((TRead > pAC->Hwt.TStart) || (IStatus & IS_TIMINT)) { if ((TRead > pAC->Hwt.TStart) || (IStatus & IS_TIMINT)) {
SkHwtStop(pAC,Ioc) ;
pAC->Hwt.TStop = pAC->Hwt.TStart ; SkHwtStop(pAC, Ioc);
} else {
pAC->Hwt.TStop = pAC->Hwt.TStart - TRead ; pAC->Hwt.TStop = pAC->Hwt.TStart;
}
else {
pAC->Hwt.TStop = pAC->Hwt.TStart - TRead;
} }
} }
return (pAC->Hwt.TStop) ; return(pAC->Hwt.TStop);
} }
/* /*
...@@ -211,9 +215,11 @@ void SkHwtIsr( ...@@ -211,9 +215,11 @@ void SkHwtIsr(
SK_AC *pAC, /* Adapters context */ SK_AC *pAC, /* Adapters context */
SK_IOC Ioc) /* IoContext */ SK_IOC Ioc) /* IoContext */
{ {
SkHwtStop(pAC,Ioc); SkHwtStop(pAC, Ioc);
pAC->Hwt.TStop = pAC->Hwt.TStart; pAC->Hwt.TStop = pAC->Hwt.TStart;
SkTimerDone(pAC,Ioc) ;
SkTimerDone(pAC, Ioc);
} }
/* End of file */ /* End of file */
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* *
* Name: skgeinit.c * Name: skgeinit.c
* Project: Gigabit Ethernet Adapters, Common Modules * Project: Gigabit Ethernet Adapters, Common Modules
* Version: $Revision: 1.93 $ * Version: $Revision: 1.97 $
* Date: $Date: 2003/05/28 15:44:43 $ * Date: $Date: 2003/10/02 16:45:31 $
* Purpose: Contains functions to initialize the adapter * Purpose: Contains functions to initialize the adapter
* *
******************************************************************************/ ******************************************************************************/
...@@ -27,6 +27,32 @@ ...@@ -27,6 +27,32 @@
* History: * History:
* *
* $Log: skgeinit.c,v $ * $Log: skgeinit.c,v $
* Revision 1.97 2003/10/02 16:45:31 rschmidt
* Replaced default values of GMAC parameters with defines.
* Removed hard reset of MACs in SkGeDeInit().
* Added define SK_PHY_LP_MODE around power saving mode in SkGeDeInit().
* Added check for VAUX available before switch power to VAUX.
*
* Revision 1.96 2003/09/18 14:02:41 rroesler
* Add: Perform a hardreset of MACs in GeDeInit()
*
* Revision 1.95 2003/09/16 14:26:59 rschmidt
* Added switch power to VCC (WA for VAUX problem) in SkGeInit1().
* Fixed setting PHY to coma mode and D3 power state in SkGeDeInit().
* Editorial changes.
*
* Revision 1.94 2003/09/16 07:17:10 mschmid
* Added init for new members in port structure for MAC control
* - PMacColThres
* - PMacJamLen
* - PMacJamIpgVal
* - PMacJamIpgData
* - PMacIpgData
* - PMacLimit4
* Added init for PHY power state in port structure
* - PPhyPowerState
* Added shutdown handling for Yukon Plus in SkGeDeInit()
*
* Revision 1.93 2003/05/28 15:44:43 rschmidt * Revision 1.93 2003/05/28 15:44:43 rschmidt
* Added check for chip Id on WOL WA for chip Rev. A. * Added check for chip Id on WOL WA for chip Rev. A.
* Added setting of GILevel in SkGeDeInit(). * Added setting of GILevel in SkGeDeInit().
...@@ -446,7 +472,7 @@ ...@@ -446,7 +472,7 @@
#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM)))) #if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
static const char SysKonnectFileId[] = static const char SysKonnectFileId[] =
"@(#) $Id: skgeinit.c,v 1.93 2003/05/28 15:44:43 rschmidt Exp $ (C) Marvell."; "@(#) $Id: skgeinit.c,v 1.97 2003/10/02 16:45:31 rschmidt Exp $ (C) Marvell.";
#endif #endif
struct s_QOffTab { struct s_QOffTab {
...@@ -1013,8 +1039,6 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -1013,8 +1039,6 @@ int Port) /* Port Index (MAC_1 + n) */
* - enable the FIFO * - enable the FIFO
*/ */
Word = (SK_U16)GMF_RX_CTRL_DEF;
#ifdef GENESIS #ifdef GENESIS
if (pAC->GIni.GIGenesis) { if (pAC->GIni.GIGenesis) {
/* Configure Rx MAC FIFO */ /* Configure Rx MAC FIFO */
...@@ -1039,6 +1063,8 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -1039,6 +1063,8 @@ int Port) /* Port Index (MAC_1 + n) */
/* set Rx GMAC FIFO Flush Mask */ /* set Rx GMAC FIFO Flush Mask */
SK_OUT16(IoC, MR_ADDR(Port, RX_GMF_FL_MSK), (SK_U16)RX_FF_FL_DEF_MSK); SK_OUT16(IoC, MR_ADDR(Port, RX_GMF_FL_MSK), (SK_U16)RX_FF_FL_DEF_MSK);
Word = (SK_U16)GMF_RX_CTRL_DEF;
/* disable Rx GMAC FIFO Flush for YUKON-Lite Rev. A0 only */ /* disable Rx GMAC FIFO Flush for YUKON-Lite Rev. A0 only */
if (pAC->GIni.GIYukonLite && pAC->GIni.GIChipId == CHIP_ID_YUKON) { if (pAC->GIni.GIYukonLite && pAC->GIni.GIChipId == CHIP_ID_YUKON) {
...@@ -1809,6 +1835,13 @@ SK_IOC IoC) /* IO context */ ...@@ -1809,6 +1835,13 @@ SK_IOC IoC) /* IO context */
pPrt->PAutoNegFail = SK_FALSE; pPrt->PAutoNegFail = SK_FALSE;
pPrt->PHWLinkUp = SK_FALSE; pPrt->PHWLinkUp = SK_FALSE;
pPrt->PLinkBroken = SK_TRUE; /* See WA code */ pPrt->PLinkBroken = SK_TRUE; /* See WA code */
pPrt->PPhyPowerState = PHY_PM_OPERATIONAL_MODE;
pPrt->PMacColThres = TX_COL_DEF;
pPrt->PMacJamLen = TX_JAM_LEN_DEF;
pPrt->PMacJamIpgVal = TX_JAM_IPG_DEF;
pPrt->PMacJamIpgData = TX_IPG_JAM_DEF;
pPrt->PMacIpgData = IPG_DATA_DEF;
pPrt->PMacLimit4 = SK_FALSE;
} }
pAC->GIni.GIPortUsage = SK_RED_LINK; pAC->GIni.GIPortUsage = SK_RED_LINK;
...@@ -1963,7 +1996,7 @@ SK_IOC IoC) /* IO context */ ...@@ -1963,7 +1996,7 @@ SK_IOC IoC) /* IO context */
/* restore CLK_RUN bits */ /* restore CLK_RUN bits */
SK_OUT16(IoC, B0_CTST, (SK_U16)(CtrlStat & SK_OUT16(IoC, B0_CTST, (SK_U16)(CtrlStat &
(CS_CLK_RUN_HOT | CS_CLK_RUN_RST | CS_CLK_RUN_ENA))); (CS_CLK_RUN_HOT | CS_CLK_RUN_RST | CS_CLK_RUN_ENA)));
/* read Chip Identification Number */ /* read Chip Identification Number */
SK_IN8(IoC, B2_CHIP_ID, &Byte); SK_IN8(IoC, B2_CHIP_ID, &Byte);
pAC->GIni.GIChipId = Byte; pAC->GIni.GIChipId = Byte;
...@@ -2053,6 +2086,10 @@ SK_IOC IoC) /* IO context */ ...@@ -2053,6 +2086,10 @@ SK_IOC IoC) /* IO context */
} }
} }
/* switch power to VCC (WA for VAUX problem) */
SK_OUT8(IoC, B0_POWER_CTRL, (SK_U8)(PC_VAUX_ENA | PC_VCC_ENA |
PC_VAUX_OFF | PC_VCC_ON));
/* read the Interrupt source */ /* read the Interrupt source */
SK_IN32(IoC, B0_ISRC, &DWord); SK_IN32(IoC, B0_ISRC, &DWord);
...@@ -2395,6 +2432,11 @@ SK_IOC IoC) /* IO context */ ...@@ -2395,6 +2432,11 @@ SK_IOC IoC) /* IO context */
int i; int i;
SK_U16 Word; SK_U16 Word;
#ifdef SK_PHY_LP_MODE
SK_U8 Byte;
SK_U16 PmCtlSts;
#endif /* SK_PHY_LP_MODE */
#if (!defined(SK_SLIM) && !defined(VCPU)) #if (!defined(SK_SLIM) && !defined(VCPU))
/* ensure I2C is ready */ /* ensure I2C is ready */
SkI2cWaitIrq(pAC, IoC); SkI2cWaitIrq(pAC, IoC);
...@@ -2409,6 +2451,38 @@ SK_IOC IoC) /* IO context */ ...@@ -2409,6 +2451,38 @@ SK_IOC IoC) /* IO context */
} }
} }
#ifdef SK_PHY_LP_MODE
/*
* for power saving purposes within mobile environments
* we set the PHY to coma mode and switch to D3 power state.
*/
if (pAC->GIni.GIYukonLite &&
pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) {
/* for all ports switch PHY to coma mode */
for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
SkGmEnterLowPowerMode(pAC, IoC, i, PHY_PM_DEEP_SLEEP);
}
if (pAC->GIni.GIVauxAvail) {
/* switch power to VAUX */
Byte = PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_ON | PC_VCC_OFF;
SK_OUT8(IoC, B0_POWER_CTRL, Byte);
}
/* switch to D3 state */
SK_IN16(IoC, PCI_C(PCI_PM_CTL_STS), &PmCtlSts);
PmCtlSts |= PCI_PM_STATE_D3;
SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON);
SK_OUT16(IoC, PCI_C(PCI_PM_CTL_STS), PmCtlSts);
}
#endif /* SK_PHY_LP_MODE */
/* Reset all bits in the PCI STATUS register */ /* Reset all bits in the PCI STATUS register */
/* /*
* Note: PCI Cfg cycles cannot be used, because they are not * Note: PCI Cfg cycles cannot be used, because they are not
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* *
* Name: skgemib.c * Name: skgemib.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter * Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.9 $ * Version: $Revision: 1.11 $
* Date: $Date: 2003/05/23 12:55:20 $ * Date: $Date: 2003/09/15 13:38:12 $
* Purpose: Private Network Management Interface Management Database * Purpose: Private Network Management Interface Management Database
* *
****************************************************************************/ ****************************************************************************/
...@@ -27,6 +27,19 @@ ...@@ -27,6 +27,19 @@
* History: * History:
* *
* $Log: skgemib.c,v $ * $Log: skgemib.c,v $
* Revision 1.11 2003/09/15 13:38:12 tschilli
* OID_SKGE_PHY_LP_MODE included only after using #define SK_PHY_LP_MODE.
*
* Revision 1.10 2003/08/15 12:28:59 tschilli
* Added new OIDs:
* OID_SKGE_DRIVER_RELDATE
* OID_SKGE_DRIVER_FILENAME
* OID_SKGE_CHIPID
* OID_SKGE_RAMSIZE
* OID_SKGE_VAUXAVAIL
* OID_SKGE_PHY_TYPE
* OID_SKGE_PHY_LP_MODE
*
* Revision 1.9 2003/05/23 12:55:20 tschilli * Revision 1.9 2003/05/23 12:55:20 tschilli
* OID_SKGE_BOARDLEVEL added. * OID_SKGE_BOARDLEVEL added.
* *
...@@ -356,6 +369,16 @@ PNMI_STATIC const SK_PNMI_TAB_ENTRY IdTable[] = { ...@@ -356,6 +369,16 @@ PNMI_STATIC const SK_PNMI_TAB_ENTRY IdTable[] = {
0, 0,
SK_PNMI_MAI_OFF(DriverVersion), SK_PNMI_MAI_OFF(DriverVersion),
SK_PNMI_RO, General, 0}, SK_PNMI_RO, General, 0},
{OID_SKGE_DRIVER_RELDATE,
1,
0,
SK_PNMI_MAI_OFF(DriverReleaseDate),
SK_PNMI_RO, General, 0},
{OID_SKGE_DRIVER_FILENAME,
1,
0,
SK_PNMI_MAI_OFF(DriverFileName),
SK_PNMI_RO, General, 0},
{OID_SKGE_HW_DESCR, {OID_SKGE_HW_DESCR,
1, 1,
0, 0,
...@@ -371,6 +394,21 @@ PNMI_STATIC const SK_PNMI_TAB_ENTRY IdTable[] = { ...@@ -371,6 +394,21 @@ PNMI_STATIC const SK_PNMI_TAB_ENTRY IdTable[] = {
0, 0,
SK_PNMI_MAI_OFF(Chipset), SK_PNMI_MAI_OFF(Chipset),
SK_PNMI_RO, General, 0}, SK_PNMI_RO, General, 0},
{OID_SKGE_CHIPID,
1,
0,
SK_PNMI_MAI_OFF(ChipId),
SK_PNMI_RO, General, 0},
{OID_SKGE_RAMSIZE,
1,
0,
SK_PNMI_MAI_OFF(RamSize),
SK_PNMI_RO, General, 0},
{OID_SKGE_VAUXAVAIL,
1,
0,
SK_PNMI_MAI_OFF(VauxAvail),
SK_PNMI_RO, General, 0},
{OID_SKGE_ACTION, {OID_SKGE_ACTION,
1, 1,
0, 0,
...@@ -876,6 +914,18 @@ PNMI_STATIC const SK_PNMI_TAB_ENTRY IdTable[] = { ...@@ -876,6 +914,18 @@ PNMI_STATIC const SK_PNMI_TAB_ENTRY IdTable[] = {
sizeof(SK_PNMI_CONF), sizeof(SK_PNMI_CONF),
SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfConnector), SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfConnector),
SK_PNMI_RO, MacPrivateConf, 0}, SK_PNMI_RO, MacPrivateConf, 0},
{OID_SKGE_PHY_TYPE,
SK_PNMI_MAC_ENTRIES,
sizeof(SK_PNMI_CONF),
SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfPhyType),
SK_PNMI_RO, MacPrivateConf, 0},
#ifdef SK_PHY_LP_MODE
{OID_SKGE_PHY_LP_MODE,
SK_PNMI_MAC_ENTRIES,
sizeof(SK_PNMI_CONF),
SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfPhyMode),
SK_PNMI_RW, MacPrivateConf, 0},
#endif
{OID_SKGE_LINK_CAP, {OID_SKGE_LINK_CAP,
SK_PNMI_MAC_ENTRIES, SK_PNMI_MAC_ENTRIES,
sizeof(SK_PNMI_CONF), sizeof(SK_PNMI_CONF),
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* *
* Name: skgepnmi.c * Name: skgepnmi.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter * Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.109 $ * Version: $Revision: 1.111 $
* Date: $Date: 2003/07/17 14:15:24 $ * Date: $Date: 2003/09/15 13:35:35 $
* Purpose: Private Network Management Interface * Purpose: Private Network Management Interface
* *
****************************************************************************/ ****************************************************************************/
...@@ -27,6 +27,22 @@ ...@@ -27,6 +27,22 @@
* History: * History:
* *
* $Log: skgepnmi.c,v $ * $Log: skgepnmi.c,v $
* Revision 1.111 2003/09/15 13:35:35 tschilli
* Code for OID_SKGE_PHY_LP_MODE completed (using #define SK_PHY_LP_MODE).
* SK_DIAG_ATTACHED handling for OID_SKGE_DIAG_MODE in DiagActions() changed.
*
* Revision 1.110 2003/08/15 12:28:04 tschilli
* Added new OIDs:
* OID_SKGE_DRIVER_RELDATE
* OID_SKGE_DRIVER_FILENAME
* OID_SKGE_CHIPID
* OID_SKGE_RAMSIZE
* OID_SKGE_VAUXAVAIL
* OID_SKGE_PHY_TYPE
* OID_SKGE_PHY_LP_MODE
*
* Added SK_DIAG_ATTACHED handling for OID_SKGE_DIAG_MODE in DiagActions().
*
* Revision 1.109 2003/07/17 14:15:24 tschilli * Revision 1.109 2003/07/17 14:15:24 tschilli
* Bug in SkPnmiGenIoctl() fixed. * Bug in SkPnmiGenIoctl() fixed.
* *
...@@ -471,7 +487,7 @@ ...@@ -471,7 +487,7 @@
#ifndef _lint #ifndef _lint
static const char SysKonnectFileId[] = static const char SysKonnectFileId[] =
"@(#) $Id: skgepnmi.c,v 1.109 2003/07/17 14:15:24 tschilli Exp $ (C) Marvell."; "@(#) $Id: skgepnmi.c,v 1.111 2003/09/15 13:35:35 tschilli Exp $ (C) Marvell.";
#endif /* !_lint */ #endif /* !_lint */
#include "h/skdrv1st.h" #include "h/skdrv1st.h"
...@@ -4008,14 +4024,6 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ ...@@ -4008,14 +4024,6 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
#endif /* SK_NDIS_64BIT_CTR */ #endif /* SK_NDIS_64BIT_CTR */
break; break;
case OID_SKGE_BOARDLEVEL:
if (*pLen < sizeof(SK_U32)) {
*pLen = sizeof(SK_U32);
return (SK_PNMI_ERR_TOO_SHORT);
}
break;
case OID_SKGE_PORT_NUMBER: case OID_SKGE_PORT_NUMBER:
case OID_SKGE_DEVICE_TYPE: case OID_SKGE_DEVICE_TYPE:
case OID_SKGE_RESULT: case OID_SKGE_RESULT:
...@@ -4023,6 +4031,9 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ ...@@ -4023,6 +4031,9 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
case OID_GEN_TRANSMIT_QUEUE_LENGTH: case OID_GEN_TRANSMIT_QUEUE_LENGTH:
case OID_SKGE_TRAP_NUMBER: case OID_SKGE_TRAP_NUMBER:
case OID_SKGE_MDB_VERSION: case OID_SKGE_MDB_VERSION:
case OID_SKGE_BOARDLEVEL:
case OID_SKGE_CHIPID:
case OID_SKGE_RAMSIZE:
if (*pLen < sizeof(SK_U32)) { if (*pLen < sizeof(SK_U32)) {
*pLen = sizeof(SK_U32); *pLen = sizeof(SK_U32);
...@@ -4043,6 +4054,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ ...@@ -4043,6 +4054,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
case OID_SKGE_BUS_WIDTH: case OID_SKGE_BUS_WIDTH:
case OID_SKGE_SENSOR_NUMBER: case OID_SKGE_SENSOR_NUMBER:
case OID_SKGE_CHKSM_NUMBER: case OID_SKGE_CHKSM_NUMBER:
case OID_SKGE_VAUXAVAIL:
if (*pLen < sizeof(SK_U8)) { if (*pLen < sizeof(SK_U8)) {
*pLen = sizeof(SK_U8); *pLen = sizeof(SK_U8);
...@@ -4234,6 +4246,66 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ ...@@ -4234,6 +4246,66 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
*pLen = Len; *pLen = Len;
break; break;
case OID_SKGE_DRIVER_RELDATE:
if (pAC->Pnmi.pDriverReleaseDate == NULL) {
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR030,
SK_PNMI_ERR053MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
Len = SK_STRLEN(pAC->Pnmi.pDriverReleaseDate) + 1;
if (Len > SK_PNMI_STRINGLEN1) {
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR031,
SK_PNMI_ERR054MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
if (*pLen < Len) {
*pLen = Len;
return (SK_PNMI_ERR_TOO_SHORT);
}
*pBuf = (char)(Len - 1);
SK_MEMCPY(pBuf + 1, pAC->Pnmi.pDriverReleaseDate, Len - 1);
*pLen = Len;
break;
case OID_SKGE_DRIVER_FILENAME:
if (pAC->Pnmi.pDriverFileName == NULL) {
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR030,
SK_PNMI_ERR055MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
Len = SK_STRLEN(pAC->Pnmi.pDriverFileName) + 1;
if (Len > SK_PNMI_STRINGLEN1) {
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR031,
SK_PNMI_ERR056MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
if (*pLen < Len) {
*pLen = Len;
return (SK_PNMI_ERR_TOO_SHORT);
}
*pBuf = (char)(Len - 1);
SK_MEMCPY(pBuf + 1, pAC->Pnmi.pDriverFileName, Len - 1);
*pLen = Len;
break;
case OID_SKGE_HW_DESCR: case OID_SKGE_HW_DESCR:
/* /*
* The hardware description is located in the VPD. This * The hardware description is located in the VPD. This
...@@ -4291,8 +4363,25 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ ...@@ -4291,8 +4363,25 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
*pLen = sizeof(SK_U16); *pLen = sizeof(SK_U16);
break; break;
case OID_SKGE_CHIPID:
Val32 = pAC->GIni.GIChipId;
SK_PNMI_STORE_U32(pBuf, Val32);
*pLen = sizeof(SK_U32);
break;
case OID_SKGE_RAMSIZE:
Val32 = pAC->GIni.GIRamSize;
SK_PNMI_STORE_U32(pBuf, Val32);
*pLen = sizeof(SK_U32);
break;
case OID_SKGE_VAUXAVAIL:
*pBuf = (char) pAC->GIni.GIVauxAvail;
*pLen = sizeof(char);
break;
case OID_SKGE_BUS_TYPE: case OID_SKGE_BUS_TYPE:
*pBuf = (char)SK_PNMI_BUS_PCI; *pBuf = (char) SK_PNMI_BUS_PCI;
*pLen = sizeof(char); *pLen = sizeof(char);
break; break;
...@@ -5435,6 +5524,9 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ ...@@ -5435,6 +5524,9 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
case OID_SKGE_SPEED_CAP: case OID_SKGE_SPEED_CAP:
case OID_SKGE_SPEED_MODE: case OID_SKGE_SPEED_MODE:
case OID_SKGE_SPEED_STATUS: case OID_SKGE_SPEED_STATUS:
#ifdef SK_PHY_LP_MODE
case OID_SKGE_PHY_LP_MODE:
#endif
if (*pLen < (Limit - LogPortIndex) * sizeof(SK_U8)) { if (*pLen < (Limit - LogPortIndex) * sizeof(SK_U8)) {
*pLen = (Limit - LogPortIndex) * sizeof(SK_U8); *pLen = (Limit - LogPortIndex) * sizeof(SK_U8);
...@@ -5443,6 +5535,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ ...@@ -5443,6 +5535,7 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
break; break;
case OID_SKGE_MTU: case OID_SKGE_MTU:
case OID_SKGE_PHY_TYPE:
if (*pLen < (Limit - LogPortIndex) * sizeof(SK_U32)) { if (*pLen < (Limit - LogPortIndex) * sizeof(SK_U32)) {
*pLen = (Limit - LogPortIndex) * sizeof(SK_U32); *pLen = (Limit - LogPortIndex) * sizeof(SK_U32);
...@@ -5488,6 +5581,49 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ ...@@ -5488,6 +5581,49 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
Offset += sizeof(char); Offset += sizeof(char);
break; break;
case OID_SKGE_PHY_TYPE:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
continue;
}
else {
/* Get value for physical ports */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
Val32 = pAC->GIni.GP[PhysPortIndex].PhyType;
SK_PNMI_STORE_U32(pBufPtr, Val32);
}
}
else { /* DualNetMode */
Val32 = pAC->GIni.GP[NetIndex].PhyType;
SK_PNMI_STORE_U32(pBufPtr, Val32);
}
Offset += sizeof(SK_U32);
break;
#ifdef SK_PHY_LP_MODE
case OID_SKGE_PHY_LP_MODE:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
continue;
}
else {
/* Get value for physical ports */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, LogPortIndex);
Val8 = (SK_U8) pAC->GIni.GP[PhysPortIndex].PPhyPowerState;
*pBufPtr = Val8;
}
}
else { /* DualNetMode */
Val8 = (SK_U8) pAC->GIni.GP[PhysPortIndex].PPhyPowerState;
*pBufPtr = Val8;
}
Offset += sizeof(SK_U8);
break;
#endif
case OID_SKGE_LINK_CAP: case OID_SKGE_LINK_CAP:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */ if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) { if (LogPortIndex == 0) {
...@@ -5804,6 +5940,16 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ ...@@ -5804,6 +5940,16 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
} }
break; break;
#ifdef SK_PHY_LP_MODE
case OID_SKGE_PHY_LP_MODE:
if (*pLen < Limit - LogPortIndex) {
*pLen = Limit - LogPortIndex;
return (SK_PNMI_ERR_TOO_SHORT);
}
break;
#endif
case OID_SKGE_MTU: case OID_SKGE_MTU:
if (*pLen < sizeof(SK_U32)) { if (*pLen < sizeof(SK_U32)) {
...@@ -6160,6 +6306,116 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ ...@@ -6160,6 +6306,116 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
Offset += sizeof(SK_U32); Offset += sizeof(SK_U32);
break; break;
#ifdef SK_PHY_LP_MODE
case OID_SKGE_PHY_LP_MODE:
/* The preset ends here */
if (Action == SK_PNMI_PRESET) {
return (SK_PNMI_ERR_OK);
}
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
Offset = 0;
continue;
}
else {
/* Set value for physical ports */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, LogPortIndex);
switch (*(pBuf + Offset)) {
case 0:
/* If LowPowerMode is active, we can leave it. */
if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState) {
Val32 = SkGmLeaveLowPowerMode(pAC, IoC, PhysPortIndex);
if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState < 3) {
SkDrvInitAdapter(pAC);
}
break;
}
else {
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
case 1:
case 2:
case 3:
case 4:
/* If no LowPowerMode is active, we can enter it. */
if (!pAC->GIni.GP[PhysPortIndex].PPhyPowerState) {
if ((*(pBuf + Offset)) < 3) {
SkDrvDeInitAdapter(pAC);
}
Val32 = SkGmEnterLowPowerMode(pAC, IoC, PhysPortIndex, *pBuf);
break;
}
else {
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
default:
*pLen = 0;
return (SK_PNMI_ERR_BAD_VALUE);
}
}
}
else { /* DualNetMode */
switch (*(pBuf + Offset)) {
case 0:
/* If we are in a LowPowerMode, we can leave it. */
if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState) {
Val32 = SkGmLeaveLowPowerMode(pAC, IoC, PhysPortIndex);
if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState < 3) {
SkDrvInitAdapter(pAC);
}
break;
}
else {
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
case 1:
case 2:
case 3:
case 4:
/* If we are not already in LowPowerMode, we can enter it. */
if (!pAC->GIni.GP[PhysPortIndex].PPhyPowerState) {
if ((*(pBuf + Offset)) < 3) {
SkDrvDeInitAdapter(pAC);
}
else {
Val32 = SkGmEnterLowPowerMode(pAC, IoC, PhysPortIndex, *pBuf);
}
break;
}
else {
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
default:
*pLen = 0;
return (SK_PNMI_ERR_BAD_VALUE);
}
}
Offset += sizeof(SK_U8);
break;
#endif
default: default:
SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_ERR, SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_ERR,
...@@ -6318,6 +6574,7 @@ char *pBuf) /* Buffer used for the management data transfer */ ...@@ -6318,6 +6574,7 @@ char *pBuf) /* Buffer used for the management data transfer */
unsigned int PhysPortMax; unsigned int PhysPortMax;
unsigned int PhysPortIndex; unsigned int PhysPortIndex;
SK_U8 Val8; SK_U8 Val8;
SK_U32 Val32;
SK_BOOL PortActiveFlag; SK_BOOL PortActiveFlag;
SK_GEPORT *pPrt; SK_GEPORT *pPrt;
...@@ -6340,6 +6597,14 @@ char *pBuf) /* Buffer used for the management data transfer */ ...@@ -6340,6 +6597,14 @@ char *pBuf) /* Buffer used for the management data transfer */
switch (Id) { switch (Id) {
case OID_SKGE_PHY_TYPE:
/* Check if it is the first active port */
if (*pBuf == 0) {
Val32 = pPrt->PhyType;
SK_PNMI_STORE_U32(pBuf, Val32);
continue;
}
case OID_SKGE_LINK_CAP: case OID_SKGE_LINK_CAP:
/* /*
...@@ -7974,6 +8239,7 @@ unsigned int TableIndex, /* Index to the Id table */ ...@@ -7974,6 +8239,7 @@ unsigned int TableIndex, /* Index to the Id table */
SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
{ {
SK_U32 DiagStatus;
SK_U32 RetCode = SK_PNMI_ERR_GENERAL; SK_U32 RetCode = SK_PNMI_ERR_GENERAL;
/* /*
...@@ -8012,7 +8278,8 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ ...@@ -8012,7 +8278,8 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
switch (Id) { switch (Id) {
case OID_SKGE_DIAG_MODE: case OID_SKGE_DIAG_MODE:
SK_PNMI_STORE_U32(pBuf, pAC->DiagModeActive); DiagStatus = pAC->Pnmi.DiagAttached;
SK_PNMI_STORE_U32(pBuf, DiagStatus);
*pLen = sizeof(SK_U32); *pLen = sizeof(SK_U32);
RetCode = SK_PNMI_ERR_OK; RetCode = SK_PNMI_ERR_OK;
break; break;
...@@ -8022,7 +8289,6 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ ...@@ -8022,7 +8289,6 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
RetCode = SK_PNMI_ERR_GENERAL; RetCode = SK_PNMI_ERR_GENERAL;
break; break;
} }
return (RetCode); return (RetCode);
} }
...@@ -8039,23 +8305,84 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */ ...@@ -8039,23 +8305,84 @@ SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
/* Handle the SET. */ /* Handle the SET. */
switch (*pBuf) { switch (*pBuf) {
/* Attach the DIAG to this adapter. */
case SK_DIAG_ATTACHED:
/* Check if we come from running */
if (pAC->Pnmi.DiagAttached == SK_DIAG_RUNNING) {
RetCode = SkDrvLeaveDiagMode(pAC);
}
else if (pAC->Pnmi.DiagAttached == SK_DIAG_IDLE) {
RetCode = SK_PNMI_ERR_OK;
}
else {
RetCode = SK_PNMI_ERR_GENERAL;
}
if (RetCode == SK_PNMI_ERR_OK) {
pAC->Pnmi.DiagAttached = SK_DIAG_ATTACHED;
}
break;
/* Enter the DIAG mode in the driver. */ /* Enter the DIAG mode in the driver. */
case 1: case SK_DIAG_RUNNING:
/* If DiagMode is not active, we can enter it. */ RetCode = SK_PNMI_ERR_OK;
if (!pAC->DiagModeActive) {
/*
* If DiagAttached is set, we can tell the driver
* to enter the DIAG mode.
*/
if (pAC->Pnmi.DiagAttached == SK_DIAG_ATTACHED) {
/* If DiagMode is not active, we can enter it. */
if (!pAC->DiagModeActive) {
RetCode = SkDrvEnterDiagMode(pAC); RetCode = SkDrvEnterDiagMode(pAC);
}
else {
RetCode = SK_PNMI_ERR_GENERAL;
}
} }
else { else {
RetCode = SK_PNMI_ERR_GENERAL; RetCode = SK_PNMI_ERR_GENERAL;
} }
if (RetCode == SK_PNMI_ERR_OK) {
pAC->Pnmi.DiagAttached = SK_DIAG_RUNNING;
}
break; break;
/* Leave the DIAG mode in the driver. */ case SK_DIAG_IDLE:
case 0: /* Check if we come from running */
RetCode = SkDrvLeaveDiagMode(pAC); if (pAC->Pnmi.DiagAttached == SK_DIAG_RUNNING) {
RetCode = SkDrvLeaveDiagMode(pAC);
}
else if (pAC->Pnmi.DiagAttached == SK_DIAG_ATTACHED) {
RetCode = SK_PNMI_ERR_OK;
}
else {
RetCode = SK_PNMI_ERR_GENERAL;
}
if (RetCode == SK_PNMI_ERR_OK) {
pAC->Pnmi.DiagAttached = SK_DIAG_IDLE;
}
break; break;
default: default:
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* *
* Name: skgesirq.c * Name: skgesirq.c
* Project: Gigabit Ethernet Adapters, Common Modules * Project: Gigabit Ethernet Adapters, Common Modules
* Version: $Revision: 1.91 $ * Version: $Revision: 1.92 $
* Date: $Date: 2003/07/04 12:46:22 $ * Date: $Date: 2003/09/16 14:37:07 $
* Purpose: Special IRQ module * Purpose: Special IRQ module
* *
******************************************************************************/ ******************************************************************************/
...@@ -27,6 +27,12 @@ ...@@ -27,6 +27,12 @@
* History: * History:
* *
* $Log: skgesirq.c,v $ * $Log: skgesirq.c,v $
* Revision 1.92 2003/09/16 14:37:07 rschmidt
* Added debug messages in some SkGePortCheckUp...() routines.
* Fixed compiler warnings for different types.
* Avoided port check up in reset state (eg. coma mode).
* Editorial changes.
*
* Revision 1.91 2003/07/04 12:46:22 rschmidt * Revision 1.91 2003/07/04 12:46:22 rschmidt
* Added debug messages in SkGePortCheckUpGmac(). * Added debug messages in SkGePortCheckUpGmac().
* Added error log message and new driver event SK_DRV_DOWNSHIFT_DET * Added error log message and new driver event SK_DRV_DOWNSHIFT_DET
...@@ -410,7 +416,7 @@ ...@@ -410,7 +416,7 @@
#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM)))) #if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
static const char SysKonnectFileId[] = static const char SysKonnectFileId[] =
"@(#) $Id: skgesirq.c,v 1.91 2003/07/04 12:46:22 rschmidt Exp $ (C) Marvell."; "@(#) $Id: skgesirq.c,v 1.92 2003/09/16 14:37:07 rschmidt Exp $ (C) Marvell.";
#endif #endif
#include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/skdrv1st.h" /* Driver Specific Definitions */
...@@ -490,7 +496,7 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -490,7 +496,7 @@ int Port) /* Port Index (MAC_1 + n) */
("AutoSensing: First mode %d on Port %d\n", ("AutoSensing: First mode %d on Port %d\n",
(int)SK_LMODE_AUTOFULL, Port)); (int)SK_LMODE_AUTOFULL, Port));
pPrt->PLinkMode = SK_LMODE_AUTOFULL; pPrt->PLinkMode = (SK_U8)SK_LMODE_AUTOFULL;
return; return;
} /* SkHWInitDefSense */ } /* SkHWInitDefSense */
...@@ -606,7 +612,7 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -606,7 +612,7 @@ int Port) /* Port Index (MAC_1 + n) */
/* Reset Port stati */ /* Reset Port stati */
pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_UNKNOWN; pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_UNKNOWN;
pPrt->PFlowCtrlStatus = (SK_U8)SK_FLOW_STAT_NONE; pPrt->PFlowCtrlStatus = (SK_U8)SK_FLOW_STAT_NONE;
pPrt->PLinkSpeedUsed = SK_LSPEED_STAT_INDETERMINATED; pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_INDETERMINATED;
/* Re-init Phy especially when the AutoSense default is set now */ /* Re-init Phy especially when the AutoSense default is set now */
SkMacInitPhy(pAC, IoC, Port, SK_FALSE); SkMacInitPhy(pAC, IoC, Port, SK_FALSE);
...@@ -655,19 +661,19 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -655,19 +661,19 @@ int Port) /* Port Index (MAC_1 + n) */
case SK_LSPEED_AUTO: case SK_LSPEED_AUTO:
/* default is 1000 Mbps */ /* default is 1000 Mbps */
case SK_LSPEED_1000MBPS: case SK_LSPEED_1000MBPS:
pPrt->PLinkSpeedUsed = SK_LSPEED_STAT_1000MBPS; pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_1000MBPS;
break; break;
case SK_LSPEED_100MBPS: case SK_LSPEED_100MBPS:
pPrt->PLinkSpeedUsed = SK_LSPEED_STAT_100MBPS; pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_100MBPS;
break; break;
case SK_LSPEED_10MBPS: case SK_LSPEED_10MBPS:
pPrt->PLinkSpeedUsed = SK_LSPEED_STAT_10MBPS; pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_10MBPS;
break; break;
} }
/* Set Link Mode Status */ /* Set Link Mode Status */
if (pPrt->PLinkMode == SK_LMODE_FULL) { if (pPrt->PLinkMode == SK_LMODE_FULL) {
pPrt->PLinkModeStatus = SK_LMODE_STAT_FULL; pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_FULL;
} }
else { else {
pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_HALF; pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_HALF;
...@@ -1598,8 +1604,7 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */ ...@@ -1598,8 +1604,7 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */
* (clear Page Received bit if set) * (clear Page Received bit if set)
*/ */
SkXmPhyRead(pAC, IoC, Port, PHY_XMAC_AUNE_EXP, &ExtStat); SkXmPhyRead(pAC, IoC, Port, PHY_XMAC_AUNE_EXP, &ExtStat);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("AutoNeg done Port %d\n", Port));
return(SK_HW_PS_LINK); return(SK_HW_PS_LINK);
} }
...@@ -1870,7 +1875,7 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */ ...@@ -1870,7 +1875,7 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */
SkMacAutoNegLipaPhy(pAC, IoC, Port, PhyStat); SkMacAutoNegLipaPhy(pAC, IoC, Port, PhyStat);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("AutoNeg: %d, PhyStat: 0x%04X\n", AutoNeg, PhyStat)); ("CheckUp Port %d, PhyStat: 0x%04X\n", Port, PhyStat));
SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_1000T_STAT, &ResAb); SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_1000T_STAT, &ResAb);
...@@ -1897,8 +1902,11 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */ ...@@ -1897,8 +1902,11 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */
if (AutoNeg) { if (AutoNeg) {
if ((PhyStat & PHY_ST_AN_OVER) != 0) { if ((PhyStat & PHY_ST_AN_OVER) != 0) {
SkHWLinkUp(pAC, IoC, Port); SkHWLinkUp(pAC, IoC, Port);
Done = SkMacAutoNegDone(pAC, IoC, Port); Done = SkMacAutoNegDone(pAC, IoC, Port);
if (Done != SK_AND_OK) { if (Done != SK_AND_OK) {
#ifdef DEBUG #ifdef DEBUG
/* Get PHY parameters, for debugging only */ /* Get PHY parameters, for debugging only */
...@@ -1924,9 +1932,6 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */ ...@@ -1924,9 +1932,6 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */
(void *)NULL); (void *)NULL);
} }
#endif /* DEBUG */ #endif /* DEBUG */
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("AutoNeg done Port %d\n", Port));
return(SK_HW_PS_LINK); return(SK_HW_PS_LINK);
} }
} }
...@@ -1989,9 +1994,22 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */ ...@@ -1989,9 +1994,22 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */
SK_U16 PhySpecStat;/* PHY Specific Status */ SK_U16 PhySpecStat;/* PHY Specific Status */
SK_U16 ResAb; /* Master/Slave resolution */ SK_U16 ResAb; /* Master/Slave resolution */
SK_EVPARA Para; SK_EVPARA Para;
#ifdef DEBUG
SK_U16 Word; /* I/O helper */
#endif /* DEBUG */
pPrt = &pAC->GIni.GP[Port]; pPrt = &pAC->GIni.GP[Port];
if (pPrt->PHWLinkUp) {
return(SK_HW_PS_NONE);
}
/* Read PHY Status */
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_STAT, &PhyStat);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("CheckUp Port %d, PhyStat: 0x%04X\n", Port, PhyStat));
/* Read PHY Interrupt Status */ /* Read PHY Interrupt Status */
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_INT_STAT, &PhyIsrc); SkGmPhyRead(pAC, IoC, Port, PHY_MARV_INT_STAT, &PhyIsrc);
...@@ -2005,16 +2023,6 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */ ...@@ -2005,16 +2023,6 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */
("Link Speed Changed, PhyIsrc: 0x%04X\n", PhyIsrc)); ("Link Speed Changed, PhyIsrc: 0x%04X\n", PhyIsrc));
} }
if (pPrt->PHWLinkUp) {
return(SK_HW_PS_NONE);
}
/* Read PHY Status */
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_STAT, &PhyStat);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("AutoNeg: %d, PhyStat: 0x%04X\n", AutoNeg, PhyStat));
SkMacAutoNegLipaPhy(pAC, IoC, Port, PhyStat); SkMacAutoNegLipaPhy(pAC, IoC, Port, PhyStat);
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_1000T_STAT, &ResAb); SkGmPhyRead(pAC, IoC, Port, PHY_MARV_1000T_STAT, &ResAb);
...@@ -2034,7 +2042,20 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */ ...@@ -2034,7 +2042,20 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_STAT, &PhySpecStat); SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_STAT, &PhySpecStat);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("AutoNeg: %d, PhySpecStat: 0x%04X\n", AutoNeg, PhySpecStat)); ("Phy1000BT: 0x%04X, PhySpecStat: 0x%04X\n", ResAb, PhySpecStat));
#ifdef DEBUG
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_AUNE_EXP, &Word);
if ((PhyIsrc & PHY_M_IS_AN_PR) != 0 || (Word & PHY_ANE_RX_PG) != 0 ||
(PhySpecStat & PHY_M_PS_PAGE_REC) != 0) {
/* Read PHY Next Page Link Partner */
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_NEPG_LP, &Word);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("Page Received, NextPage: 0x%04X\n", Word));
}
#endif /* DEBUG */
if ((PhySpecStat & PHY_M_PS_LINK_UP) == 0) { if ((PhySpecStat & PHY_M_PS_LINK_UP) == 0) {
return(SK_HW_PS_NONE); return(SK_HW_PS_NONE);
...@@ -2069,8 +2090,6 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */ ...@@ -2069,8 +2090,6 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */
return(SK_HW_PS_RESTART); return(SK_HW_PS_RESTART);
} }
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("AutoNeg done Port %d\n", Port));
return(SK_HW_PS_LINK); return(SK_HW_PS_LINK);
} }
} }
...@@ -2179,8 +2198,6 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */ ...@@ -2179,8 +2198,6 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */
* extra link down/ups * extra link down/ups
*/ */
SkXmPhyRead(pAC, IoC, Port, PHY_LONE_INT_STAT, &ExtStat); SkXmPhyRead(pAC, IoC, Port, PHY_LONE_INT_STAT, &ExtStat);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("AutoNeg done Port %d\n", Port));
return(SK_HW_PS_LINK); return(SK_HW_PS_LINK);
} }
} }
...@@ -2278,8 +2295,14 @@ SK_EVPARA Para) /* Event specific Parameter */ ...@@ -2278,8 +2295,14 @@ SK_EVPARA Para) /* Event specific Parameter */
switch (Event) { switch (Event) {
case SK_HWEV_WATIM: case SK_HWEV_WATIM:
/* Check whether port came up */ if (pPrt->PState == SK_PRT_RESET) {
PortStat = SkGePortCheckUp(pAC, IoC, (int)Port);
PortStat = SK_HW_PS_NONE;
}
else {
/* Check whether port came up */
PortStat = SkGePortCheckUp(pAC, IoC, (int)Port);
}
switch (PortStat) { switch (PortStat) {
case SK_HW_PS_RESTART: case SK_HW_PS_RESTART:
......
/****************************************************************************** /******************************************************************************
* *
* Name: ski2c.c * Name: ski2c.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter * Project: Gigabit Ethernet Adapters, TWSI-Module
* Version: $Revision: 1.57 $ * Version: $Revision: 1.59 $
* Date: $Date: 2003/01/28 09:17:38 $ * Date: $Date: 2003/10/20 09:07:25 $
* Purpose: Functions to access Voltage and Temperature Sensor * Purpose: Functions to access Voltage and Temperature Sensor
* *
******************************************************************************/ ******************************************************************************/
/****************************************************************************** /******************************************************************************
* *
* (C)Copyright 1998-2003 SysKonnect GmbH. * (C)Copyright 1998-2002 SysKonnect.
* (C)Copyright 2002-2003 Marvell.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -26,6 +27,14 @@ ...@@ -26,6 +27,14 @@
* History: * History:
* *
* $Log: ski2c.c,v $ * $Log: ski2c.c,v $
* Revision 1.59 2003/10/20 09:07:25 rschmidt
* Added cast SK_U32 in SkI2cWrite() to avoid compiler warning.
* Editorial changes.
*
* Revision 1.58 2003/09/23 09:22:53 malthoff
* Parameter I2cDevSize added in SkI2cRead and SkI2cWrite to
* support larger devices on the TWSI bus.
*
* Revision 1.57 2003/01/28 09:17:38 rschmidt * Revision 1.57 2003/01/28 09:17:38 rschmidt
* Fixed handling for sensors on YUKON Fiber. * Fixed handling for sensors on YUKON Fiber.
* Editorial changes. * Editorial changes.
...@@ -224,15 +233,15 @@ ...@@ -224,15 +233,15 @@
* Created. Sources taken from ML Projekt. * Created. Sources taken from ML Projekt.
* Sources have to be reworked for GE. * Sources have to be reworked for GE.
* *
*
******************************************************************************/ ******************************************************************************/
/* /*
* I2C Protocol * I2C Protocol
*/ */
#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
static const char SysKonnectFileId[] = static const char SysKonnectFileId[] =
"$Id: ski2c.c,v 1.57 2003/01/28 09:17:38 rschmidt Exp $"; "@(#) $Id: ski2c.c,v 1.59 2003/10/20 09:07:25 rschmidt Exp $ (C) Marvell. ";
#endif
#include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/skdrv1st.h" /* Driver Specific Definitions */
#include "h/lm80.h" #include "h/lm80.h"
...@@ -312,7 +321,7 @@ intro() ...@@ -312,7 +321,7 @@ intro()
{} {}
#endif #endif
#ifdef SK_DIAG #ifdef SK_DIAG
/* /*
* I2C Fast Mode timing values used by the LM80. * I2C Fast Mode timing values used by the LM80.
* If new devices are added to the I2C bus the timing values have to be checked. * If new devices are added to the I2C bus the timing values have to be checked.
...@@ -516,7 +525,6 @@ SK_IOC IoC) /* I/O Context */ ...@@ -516,7 +525,6 @@ SK_IOC IoC) /* I/O Context */
{ {
/* /*
* Received bit must be zero. * Received bit must be zero.
*
*/ */
SkI2cSndBit(IoC, 0); SkI2cSndBit(IoC, 0);
} /* SkI2cSndAck */ } /* SkI2cSndAck */
...@@ -590,7 +598,7 @@ int Rw) /* Read / Write Flag */ ...@@ -590,7 +598,7 @@ int Rw) /* Read / Write Flag */
return(SkI2cSndByte(IoC, (Addr<<1) | Rw)); return(SkI2cSndByte(IoC, (Addr<<1) | Rw));
} /* SkI2cSndDev */ } /* SkI2cSndDev */
#endif /* SK_DIAG */ #endif /* SK_DIAG */
/*----------------- I2C CTRL Register Functions ----------*/ /*----------------- I2C CTRL Register Functions ----------*/
...@@ -620,7 +628,7 @@ int Event) /* complete event to wait for (I2C_READ or I2C_WRITE) */ ...@@ -620,7 +628,7 @@ int Event) /* complete event to wait for (I2C_READ or I2C_WRITE) */
SK_I2C_STOP(IoC); SK_I2C_STOP(IoC);
#ifndef SK_DIAG #ifndef SK_DIAG
SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E002, SKERR_I2C_E002MSG); SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E002, SKERR_I2C_E002MSG);
#endif /* !SK_DIAG */ #endif /* !SK_DIAG */
return(1); return(1);
} }
...@@ -661,15 +669,19 @@ SK_IOC IoC) /* I/O Context */ ...@@ -661,15 +669,19 @@ SK_IOC IoC) /* I/O Context */
} }
StartTime = SkOsGetTime(pAC); StartTime = SkOsGetTime(pAC);
do { do {
if (SkOsGetTime(pAC) - StartTime > SK_TICKS_PER_SEC / 8) { if (SkOsGetTime(pAC) - StartTime > SK_TICKS_PER_SEC / 8) {
SK_I2C_STOP(IoC); SK_I2C_STOP(IoC);
#ifndef SK_DIAG #ifndef SK_DIAG
SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E016, SKERR_I2C_E016MSG); SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E016, SKERR_I2C_E016MSG);
#endif /* !SK_DIAG */ #endif /* !SK_DIAG */
return; return;
} }
SK_IN32(IoC, B0_ISRC, &IrqSrc); SK_IN32(IoC, B0_ISRC, &IrqSrc);
} while ((IrqSrc & IS_I2C_READY) == 0); } while ((IrqSrc & IS_I2C_READY) == 0);
pSen->SenState = SK_SEN_IDLE; pSen->SenState = SK_SEN_IDLE;
...@@ -687,18 +699,19 @@ SK_AC *pAC, /* Adapter Context */ ...@@ -687,18 +699,19 @@ SK_AC *pAC, /* Adapter Context */
SK_IOC IoC, /* I/O Context */ SK_IOC IoC, /* I/O Context */
SK_U32 I2cData, /* I2C Data to write */ SK_U32 I2cData, /* I2C Data to write */
int I2cDev, /* I2C Device Address */ int I2cDev, /* I2C Device Address */
int I2cDevSize, /* I2C Device Size (e.g. I2C_025K_DEV or I2C_2K_DEV) */
int I2cReg, /* I2C Device Register Address */ int I2cReg, /* I2C Device Register Address */
int I2cBurst) /* I2C Burst Flag */ int I2cBurst) /* I2C Burst Flag */
{ {
SK_OUT32(IoC, B2_I2C_DATA, I2cData); SK_OUT32(IoC, B2_I2C_DATA, I2cData);
SK_I2C_CTL(IoC, I2C_WRITE, I2cDev, I2cReg, I2cBurst);
SK_I2C_CTL(IoC, I2C_WRITE, I2cDev, I2cDevSize, I2cReg, I2cBurst);
return(SkI2cWait(pAC, IoC, I2C_WRITE)); return(SkI2cWait(pAC, IoC, I2C_WRITE));
} /* SkI2cWrite*/ } /* SkI2cWrite*/
#ifdef SK_DIAG #ifdef SK_DIAG
/* /*
* reads a single byte or 4 bytes from the I2C device * reads a single byte or 4 bytes from the I2C device
* *
...@@ -708,23 +721,24 @@ SK_U32 SkI2cRead( ...@@ -708,23 +721,24 @@ SK_U32 SkI2cRead(
SK_AC *pAC, /* Adapter Context */ SK_AC *pAC, /* Adapter Context */
SK_IOC IoC, /* I/O Context */ SK_IOC IoC, /* I/O Context */
int I2cDev, /* I2C Device Address */ int I2cDev, /* I2C Device Address */
int I2cDevSize, /* I2C Device Size (e.g. I2C_025K_DEV or I2C_2K_DEV) */
int I2cReg, /* I2C Device Register Address */ int I2cReg, /* I2C Device Register Address */
int I2cBurst) /* I2C Burst Flag */ int I2cBurst) /* I2C Burst Flag */
{ {
SK_U32 Data; SK_U32 Data;
SK_OUT32(IoC, B2_I2C_DATA, 0); SK_OUT32(IoC, B2_I2C_DATA, 0);
SK_I2C_CTL(IoC, I2C_READ, I2cDev, I2cReg, I2cBurst); SK_I2C_CTL(IoC, I2C_READ, I2cDev, I2cDevSize, I2cReg, I2cBurst);
if (SkI2cWait(pAC, IoC, I2C_READ) != 0) { if (SkI2cWait(pAC, IoC, I2C_READ) != 0) {
w_print("%s\n", SKERR_I2C_E002MSG); w_print("%s\n", SKERR_I2C_E002MSG);
} }
SK_IN32(IoC, B2_I2C_DATA, &Data); SK_IN32(IoC, B2_I2C_DATA, &Data);
return(Data); return(Data);
} /* SkI2cRead */ } /* SkI2cRead */
#endif /* SK_DIAG */
#endif /* SK_DIAG */
/* /*
...@@ -745,9 +759,10 @@ SK_SENSOR *pSen) /* Sensor to be read */ ...@@ -745,9 +759,10 @@ SK_SENSOR *pSen) /* Sensor to be read */
if (pSen->SenRead != NULL) { if (pSen->SenRead != NULL) {
return((*pSen->SenRead)(pAC, IoC, pSen)); return((*pSen->SenRead)(pAC, IoC, pSen));
} }
else else {
return(0); /* no success */ return(0); /* no success */
} /* SkI2cReadSensor*/ }
} /* SkI2cReadSensor */
/* /*
* Do the Init state 0 initialization * Do the Init state 0 initialization
...@@ -761,12 +776,12 @@ SK_AC *pAC) /* Adapter Context */ ...@@ -761,12 +776,12 @@ SK_AC *pAC) /* Adapter Context */
pAC->I2c.CurrSens = 0; pAC->I2c.CurrSens = 0;
/* Begin with timeout control for state machine */ /* Begin with timeout control for state machine */
pAC->I2c.TimerMode = SK_TIMER_WATCH_STATEMACHINE; pAC->I2c.TimerMode = SK_TIMER_WATCH_SM;
/* Set sensor number to zero */ /* Set sensor number to zero */
pAC->I2c.MaxSens = 0; pAC->I2c.MaxSens = 0;
#ifndef SK_DIAG #ifndef SK_DIAG
/* Initialize Number of Dummy Reads */ /* Initialize Number of Dummy Reads */
pAC->I2c.DummyReads = SK_MAX_SENSORS; pAC->I2c.DummyReads = SK_MAX_SENSORS;
#endif #endif
...@@ -840,19 +855,20 @@ SK_IOC IoC) /* I/O Context */ ...@@ -840,19 +855,20 @@ SK_IOC IoC) /* I/O Context */
} }
/* Check for 64 Bit Yukon without sensors */ /* Check for 64 Bit Yukon without sensors */
if (SkI2cWrite(pAC, IoC, 0, LM80_ADDR, LM80_CFG, 0) != 0) { if (SkI2cWrite(pAC, IoC, 0, LM80_ADDR, I2C_025K_DEV, LM80_CFG, 0) != 0) {
return(0); return(0);
} }
(void)SkI2cWrite(pAC, IoC, 0xff, LM80_ADDR, LM80_IMSK_1, 0); (void)SkI2cWrite(pAC, IoC, 0xffUL, LM80_ADDR, I2C_025K_DEV, LM80_IMSK_1, 0);
(void)SkI2cWrite(pAC, IoC, 0xff, LM80_ADDR, LM80_IMSK_2, 0); (void)SkI2cWrite(pAC, IoC, 0xffUL, LM80_ADDR, I2C_025K_DEV, LM80_IMSK_2, 0);
(void)SkI2cWrite(pAC, IoC, 0, LM80_ADDR, LM80_FAN_CTRL, 0); (void)SkI2cWrite(pAC, IoC, 0, LM80_ADDR, I2C_025K_DEV, LM80_FAN_CTRL, 0);
(void)SkI2cWrite(pAC, IoC, 0, LM80_ADDR, LM80_TEMP_CTRL, 0); (void)SkI2cWrite(pAC, IoC, 0, LM80_ADDR, I2C_025K_DEV, LM80_TEMP_CTRL, 0);
(void)SkI2cWrite(pAC, IoC, LM80_CFG_START, LM80_ADDR, LM80_CFG, 0); (void)SkI2cWrite(pAC, IoC, (SK_U32)LM80_CFG_START, LM80_ADDR, I2C_025K_DEV,
LM80_CFG, 0);
/* /*
* MaxSens has to be updated here, because PhyType is not * MaxSens has to be updated here, because PhyType is not
...@@ -957,7 +973,7 @@ SK_IOC IoC) /* I/O Context */ ...@@ -957,7 +973,7 @@ SK_IOC IoC) /* I/O Context */
pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_PHY_2V5_LOW_ERR; pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_PHY_2V5_LOW_ERR;
} }
else { else {
pAC->I2c.SenTable[i].SenDesc = "Voltage ASIC-Co 1V5"; pAC->I2c.SenTable[i].SenDesc = "Voltage Core 1V5";
pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_CORE_1V5_HIGH_ERR; pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_CORE_1V5_HIGH_ERR;
pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_CORE_1V5_HIGH_WARN; pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_CORE_1V5_HIGH_WARN;
pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_CORE_1V5_LOW_WARN; pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_CORE_1V5_LOW_WARN;
...@@ -1015,9 +1031,9 @@ SK_IOC IoC) /* I/O Context */ ...@@ -1015,9 +1031,9 @@ SK_IOC IoC) /* I/O Context */
pAC->I2c.SenTable[i].SenDev = LM80_ADDR; pAC->I2c.SenTable[i].SenDev = LM80_ADDR;
} }
#ifndef SK_DIAG #ifndef SK_DIAG
pAC->I2c.DummyReads = pAC->I2c.MaxSens; pAC->I2c.DummyReads = pAC->I2c.MaxSens;
#endif /* !SK_DIAG */ #endif /* !SK_DIAG */
/* Clear I2C IRQ */ /* Clear I2C IRQ */
SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ); SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ);
...@@ -1208,15 +1224,13 @@ SK_SENSOR *pSen) ...@@ -1208,15 +1224,13 @@ SK_SENSOR *pSen)
pSen->SenLastErrLogTS = CurrTime; pSen->SenLastErrLogTS = CurrTime;
if (pSen->SenType == SK_SEN_TEMP) { if (pSen->SenType == SK_SEN_TEMP) {
SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E011, SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E011, SKERR_I2C_E011MSG);
SKERR_I2C_E011MSG); }
} else if (pSen->SenType == SK_SEN_VOLT) { else if (pSen->SenType == SK_SEN_VOLT) {
SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E012, SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E012, SKERR_I2C_E012MSG);
SKERR_I2C_E012MSG); }
} else else {
{ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E015, SKERR_I2C_E015MSG);
SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E015,
SKERR_I2C_E015MSG);
} }
} }
} }
...@@ -1235,8 +1249,7 @@ SK_SENSOR *pSen) ...@@ -1235,8 +1249,7 @@ SK_SENSOR *pSen)
/* This state is the former one */ /* This state is the former one */
/* So check first whether we have to send a trap */ /* So check first whether we have to send a trap */
if (pSen->SenLastWarnTrapTS + SK_SEN_WARN_TR_HOLD > if (pSen->SenLastWarnTrapTS + SK_SEN_WARN_TR_HOLD > CurrTime) {
CurrTime) {
/* /*
* Do NOT send the Trap. The hold back time * Do NOT send the Trap. The hold back time
* has to run out first. * has to run out first.
...@@ -1245,8 +1258,7 @@ SK_SENSOR *pSen) ...@@ -1245,8 +1258,7 @@ SK_SENSOR *pSen)
} }
/* Check now whether we have to log an Error */ /* Check now whether we have to log an Error */
if (pSen->SenLastWarnLogTS + SK_SEN_WARN_LOG_HOLD > if (pSen->SenLastWarnLogTS + SK_SEN_WARN_LOG_HOLD > CurrTime) {
CurrTime) {
/* /*
* Do NOT log the error. The hold back time * Do NOT log the error. The hold back time
* has to run out first. * has to run out first.
...@@ -1277,15 +1289,13 @@ SK_SENSOR *pSen) ...@@ -1277,15 +1289,13 @@ SK_SENSOR *pSen)
pSen->SenLastWarnLogTS = CurrTime; pSen->SenLastWarnLogTS = CurrTime;
if (pSen->SenType == SK_SEN_TEMP) { if (pSen->SenType == SK_SEN_TEMP) {
SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E009, SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E009, SKERR_I2C_E009MSG);
SKERR_I2C_E009MSG); }
} else if (pSen->SenType == SK_SEN_VOLT) { else if (pSen->SenType == SK_SEN_VOLT) {
SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E010, SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E010, SKERR_I2C_E010MSG);
SKERR_I2C_E010MSG); }
} else else {
{ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E014, SKERR_I2C_E014MSG);
SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E014,
SKERR_I2C_E014MSG);
} }
} }
} }
...@@ -1317,7 +1327,7 @@ SK_SENSOR *pSen) ...@@ -1317,7 +1327,7 @@ SK_SENSOR *pSen)
} }
} }
#if 0 #ifdef TEST_ONLY
/* Dynamic thresholds also for VAUX of LM80 sensor */ /* Dynamic thresholds also for VAUX of LM80 sensor */
if (pSen->SenInit == SK_SEN_DYN_INIT_VAUX) { if (pSen->SenInit == SK_SEN_DYN_INIT_VAUX) {
...@@ -1359,7 +1369,7 @@ SK_SENSOR *pSen) ...@@ -1359,7 +1369,7 @@ SK_SENSOR *pSen)
if (pSen->SenInit != SK_SEN_DYN_INIT_NONE) { if (pSen->SenInit != SK_SEN_DYN_INIT_NONE) {
SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E013, SKERR_I2C_E013MSG); SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E013, SKERR_I2C_E013MSG);
} }
} /* SkI2cCheckSensor*/ } /* SkI2cCheckSensor */
/* /*
...@@ -1390,7 +1400,7 @@ SK_EVPARA Para) /* Event specific Parameter */ ...@@ -1390,7 +1400,7 @@ SK_EVPARA Para) /* Event specific Parameter */
if (ReadComplete) { if (ReadComplete) {
/* Check sensor against defined thresholds */ /* Check sensor against defined thresholds */
SkI2cCheckSensor (pAC, pSen); SkI2cCheckSensor(pAC, pSen);
/* Increment Current sensor and set appropriate Timeout */ /* Increment Current sensor and set appropriate Timeout */
pAC->I2c.CurrSens++; pAC->I2c.CurrSens++;
...@@ -1414,7 +1424,7 @@ SK_EVPARA Para) /* Event specific Parameter */ ...@@ -1414,7 +1424,7 @@ SK_EVPARA Para) /* Event specific Parameter */
/* Start Timer */ /* Start Timer */
ParaLocal.Para64 = (SK_U64)0; ParaLocal.Para64 = (SK_U64)0;
pAC->I2c.TimerMode = SK_TIMER_WATCH_STATEMACHINE; pAC->I2c.TimerMode = SK_TIMER_WATCH_SM;
SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, SK_I2C_TIM_WATCH, SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, SK_I2C_TIM_WATCH,
SKGE_I2C, SK_I2CEV_TIM, ParaLocal); SKGE_I2C, SK_I2CEV_TIM, ParaLocal);
...@@ -1431,7 +1441,7 @@ SK_EVPARA Para) /* Event specific Parameter */ ...@@ -1431,7 +1441,7 @@ SK_EVPARA Para) /* Event specific Parameter */
if (ReadComplete) { if (ReadComplete) {
/* Check sensor against defined thresholds */ /* Check sensor against defined thresholds */
SkI2cCheckSensor (pAC, pSen); SkI2cCheckSensor(pAC, pSen);
/* Increment Current sensor and set appropriate Timeout */ /* Increment Current sensor and set appropriate Timeout */
pAC->I2c.CurrSens++; pAC->I2c.CurrSens++;
...@@ -1496,4 +1506,4 @@ SK_EVPARA Para) /* Event specific Parameter */ ...@@ -1496,4 +1506,4 @@ SK_EVPARA Para) /* Event specific Parameter */
return(0); return(0);
} /* SkI2cEvent*/ } /* SkI2cEvent*/
#endif /* !SK_DIAG */ #endif /* !SK_DIAG */
/****************************************************************************** /******************************************************************************
* *
* Name: sklm80.c * Name: sklm80.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter * Project: Gigabit Ethernet Adapters, TWSI-Module
* Version: $Revision: 1.20 $ * Version: $Revision: 1.22 $
* Date: $Date: 2002/08/13 09:16:27 $ * Date: $Date: 2003/10/20 09:08:21 $
* Purpose: Funktions to access Voltage and Temperature Sensor (LM80) * Purpose: Functions to access Voltage and Temperature Sensor (LM80)
* *
******************************************************************************/ ******************************************************************************/
/****************************************************************************** /******************************************************************************
* *
* (C)Copyright 1998-2002 SysKonnect GmbH. * (C)Copyright 1998-2002 SysKonnect.
* (C)Copyright 2002-2003 Marvell.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -26,15 +27,21 @@ ...@@ -26,15 +27,21 @@
* History: * History:
* *
* $Log: sklm80.c,v $ * $Log: sklm80.c,v $
* Revision 1.22 2003/10/20 09:08:21 rschmidt
* Editorial changes.
*
* Revision 1.21 2003/09/23 09:29:04 malthoff
* Parameter Dev_Size added to macro SK_I2C_CTL.
*
* Revision 1.20 2002/08/13 09:16:27 rschmidt * Revision 1.20 2002/08/13 09:16:27 rschmidt
* Changed return value for SkLm80ReadSensor() back to 'int' * Changed return value for SkLm80ReadSensor() back to 'int'
* Editorial changes * Editorial changes.
* *
* Revision 1.19 2002/08/06 09:43:31 jschmalz * Revision 1.19 2002/08/06 09:43:31 jschmalz
* Extensions and changes for Yukon * Extensions and changes for Yukon.
* *
* Revision 1.18 2002/08/02 12:26:57 rschmidt * Revision 1.18 2002/08/02 12:26:57 rschmidt
* Editorial changes * Editorial changes.
* *
* Revision 1.17 1999/11/22 13:35:51 cgoos * Revision 1.17 1999/11/22 13:35:51 cgoos
* Changed license header to GPL. * Changed license header to GPL.
...@@ -93,16 +100,15 @@ ...@@ -93,16 +100,15 @@
* Revision 1.1 1998/07/17 09:57:12 gklug * Revision 1.1 1998/07/17 09:57:12 gklug
* initial version * initial version
* *
*
*
******************************************************************************/ ******************************************************************************/
/* /*
LM80 functions LM80 functions
*/ */
#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
static const char SysKonnectFileId[] = static const char SysKonnectFileId[] =
"$Id: sklm80.c,v 1.20 2002/08/13 09:16:27 rschmidt Exp $" ; "@(#) $Id: sklm80.c,v 1.22 2003/10/20 09:08:21 rschmidt Exp $ (C) Marvell. ";
#endif
#include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/skdrv1st.h" /* Driver Specific Definitions */
#include "h/lm80.h" #include "h/lm80.h"
...@@ -202,7 +208,7 @@ SK_SENSOR *pSen) /* Sensor to be read */ ...@@ -202,7 +208,7 @@ SK_SENSOR *pSen) /* Sensor to be read */
switch (pSen->SenState) { switch (pSen->SenState) {
case SK_SEN_IDLE: case SK_SEN_IDLE:
/* Send address to ADDR register */ /* Send address to ADDR register */
SK_I2C_CTL(IoC, I2C_READ, pSen->SenDev, pSen->SenReg, 0); SK_I2C_CTL(IoC, I2C_READ, pSen->SenDev, I2C_025K_DEV, pSen->SenReg, 0);
pSen->SenState = SK_SEN_VALUE ; pSen->SenState = SK_SEN_VALUE ;
BREAK_OR_WAIT(pAC, IoC, I2C_READ); BREAK_OR_WAIT(pAC, IoC, I2C_READ);
...@@ -250,7 +256,7 @@ SK_SENSOR *pSen) /* Sensor to be read */ ...@@ -250,7 +256,7 @@ SK_SENSOR *pSen) /* Sensor to be read */
(pSen->SenValue % SK_LM80_TEMP_LSB); (pSen->SenValue % SK_LM80_TEMP_LSB);
/* Send address to ADDR register */ /* Send address to ADDR register */
SK_I2C_CTL(IoC, I2C_READ, pSen->SenDev, LM80_TEMP_CTRL, 0); SK_I2C_CTL(IoC, I2C_READ, pSen->SenDev, I2C_025K_DEV, LM80_TEMP_CTRL, 0);
pSen->SenState = SK_SEN_VALEXT ; pSen->SenState = SK_SEN_VALEXT ;
BREAK_OR_WAIT(pAC, IoC, I2C_READ); BREAK_OR_WAIT(pAC, IoC, I2C_READ);
...@@ -284,3 +290,4 @@ SK_SENSOR *pSen) /* Sensor to be read */ ...@@ -284,3 +290,4 @@ SK_SENSOR *pSen) /* Sensor to be read */
/* Not completed */ /* Not completed */
return(0); return(0);
} }
/****************************************************************************** /******************************************************************************
* *
* Name: skproc.c * Name: skproc.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter * Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.2 $ * Version: $Revision: 1.11 $
* Date: $Date: 2003/08/12 16:45:29 $ * Date: $Date: 2003/12/11 16:03:57 $
* Purpose: Funktions to display statictic data * Purpose: Funktions to display statictic data
* *
******************************************************************************/ ******************************************************************************/
/****************************************************************************** /******************************************************************************
* *
* (C)Copyright 1998-2003 SysKonnect GmbH. * (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -28,6 +29,33 @@ ...@@ -28,6 +29,33 @@
* History: * History:
* *
* $Log: skproc.c,v $ * $Log: skproc.c,v $
* Revision 1.11 2003/12/11 16:03:57 mlindner
* Fix: Create backup from pnmi data structure
*
* Revision 1.10 2003/11/19 16:25:36 mlindner
* Fix: Print output as 64-bit digit
*
* Revision 1.9 2003/11/17 13:29:05 mlindner
* Fix: Editorial changes
*
* Revision 1.8 2003/11/13 14:18:48 rroesler
* Fix: added latest changes regarding the use of the proc system
*
* Revision 1.7 2003/11/10 09:35:07 rroesler
* Fix: diag backup restore of PNMI structure
*
* Revision 1.6 2003/11/07 17:31:39 rroesler
* Add: security counter for the proc file system
*
* Revision 1.5 2003/10/07 08:17:08 mlindner
* Fix: Copyright changes
*
* Revision 1.4 2003/09/01 15:29:24 mlindner
* Fix: Editorial changes
*
* Revision 1.3 2003/08/29 12:30:58 mlindner
* Add: Version entry in the proc file system
*
* Revision 1.2 2003/08/12 16:45:29 mlindner * Revision 1.2 2003/08/12 16:45:29 mlindner
* Add: Removed SkNumber and SkDoDiv * Add: Removed SkNumber and SkDoDiv
* Add: Counter output as (unsigned long long) * Add: Counter output as (unsigned long long)
...@@ -94,223 +122,350 @@ ...@@ -94,223 +122,350 @@
#include "h/skdrv1st.h" #include "h/skdrv1st.h"
#include "h/skdrv2nd.h" #include "h/skdrv2nd.h"
#include "h/skversion.h"
#ifdef CONFIG_PROC_FS extern struct SK_NET_DEVICE *SkGeRootDev;
static int sk_proc_print(void *writePtr, char *format, ...);
static void sk_gen_browse(void *buffer);
int len;
extern struct net_device *SkGeRootDev; static int sk_seq_show(struct seq_file *seq, void *v);
static int sk_proc_open(struct inode *inode, struct file *file);
struct file_operations sk_proc_fops = {
.owner = THIS_MODULE,
.open = sk_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
struct net_device *currDev = NULL;
static int sk_seq_show(struct seq_file *seq, void *v) /*****************************************************************************
*
* sk_gen_browse -generic print "summaries" entry
*
* Description:
* This function fills the proc entry with statistic data about
* the ethernet device.
*
* Returns: -
*
*/
static void sk_gen_browse(void *buffer)
{ {
struct net_device *dev = seq->private; struct SK_NET_DEVICE *SkgeProcDev = SkGeRootDev;
DEV_NET *pNet = dev->priv; struct SK_NET_DEVICE *next;
SK_AC *pAC = pNet->pAC; SK_PNMI_STRUCT_DATA *pPnmiStruct;
SK_PNMI_STRUCT_DATA *pPnmiStruct = &pAC->PnmiStruct; SK_PNMI_STAT *pPnmiStat;
SK_PNMI_STAT *pPnmiStat = &pPnmiStruct->Stat[0]; unsigned long Flags;
int unit = !(pAC->dev[0] == dev); unsigned int Size;
int i; DEV_NET *pNet;
char sens_msg[50]; SK_AC *pAC;
char sens_msg[50];
int MaxSecurityCount = 0;
int t;
int i;
while (SkgeProcDev) {
MaxSecurityCount++;
if (MaxSecurityCount > 100) {
printk("Max limit for sk_proc_read security counter!\n");
return;
}
pNet = (DEV_NET*) SkgeProcDev->priv;
pAC = pNet->pAC;
next = pAC->Next;
pPnmiStruct = &pAC->PnmiStruct;
/* NetIndex in GetStruct is now required, zero is only dummy */
for (t=pAC->GIni.GIMacsFound; t > 0; t--) {
if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 1)
t--;
seq_printf(seq, spin_lock_irqsave(&pAC->SlowPathLock, Flags);
"\nDetailed statistic for device %s\n", Size = SK_PNMI_STRUCT_SIZE;
dev->name); #ifdef SK_DIAG_SUPPORT
seq_printf(seq, if (pAC->BoardLevel == SK_INIT_DATA) {
"=======================================\n"); SK_MEMCPY(&(pAC->PnmiStruct), &(pAC->PnmiBackup), sizeof(SK_PNMI_STRUCT_DATA));
if (pAC->DiagModeActive == DIAG_NOTACTIVE) {
pAC->Pnmi.DiagAttached = SK_DIAG_IDLE;
}
} else {
SkPnmiGetStruct(pAC, pAC->IoBase, pPnmiStruct, &Size, t-1);
}
#else
SkPnmiGetStruct(pAC, pAC->IoBase,
pPnmiStruct, &Size, t-1);
#endif
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
/* Board statistics */ if (strcmp(pAC->dev[t-1]->name, currDev->name) == 0) {
seq_printf(seq, pPnmiStat = &pPnmiStruct->Stat[0];
"\nBoard statistics\n\n"); len = sk_proc_print(buffer,
seq_printf(seq, "\nDetailed statistic for device %s\n",
"Active Port %c\n", pAC->dev[t-1]->name);
'A' + pAC->Rlmt.Net[unit].Port[pAC->Rlmt. len += sk_proc_print(buffer,
Net[unit].PrefPort]->PortNumber); "=======================================\n");
seq_printf(seq,
"Preferred Port %c\n", /* Board statistics */
'A' + pAC->Rlmt.Net[unit].Port[pAC->Rlmt. len += sk_proc_print(buffer,
Net[unit].PrefPort]->PortNumber); "\nBoard statistics\n\n");
len += sk_proc_print(buffer,
"Active Port %c\n",
'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
Net[t-1].PrefPort]->PortNumber);
len += sk_proc_print(buffer,
"Preferred Port %c\n",
'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
Net[t-1].PrefPort]->PortNumber);
seq_printf(seq, len += sk_proc_print(buffer,
"Bus speed (MHz) %d\n", "Bus speed (MHz) %d\n",
pPnmiStruct->BusSpeed); pPnmiStruct->BusSpeed);
seq_printf(seq, len += sk_proc_print(buffer,
"Bus width (Bit) %d\n", "Bus width (Bit) %d\n",
pPnmiStruct->BusWidth); pPnmiStruct->BusWidth);
seq_printf(seq, len += sk_proc_print(buffer,
"Hardware revision v%d.%d\n", "Driver version %s\n",
(pAC->GIni.GIPciHwRev >> 4) & 0x0F, VER_STRING);
pAC->GIni.GIPciHwRev & 0x0F); len += sk_proc_print(buffer,
"Hardware revision v%d.%d\n",
(pAC->GIni.GIPciHwRev >> 4) & 0x0F,
pAC->GIni.GIPciHwRev & 0x0F);
/* Print sensor informations */ /* Print sensor informations */
for (i=0; i < pAC->I2c.MaxSens; i ++) { for (i=0; i < pAC->I2c.MaxSens; i ++) {
/* Check type */ /* Check type */
switch (pAC->I2c.SenTable[i].SenType) { switch (pAC->I2c.SenTable[i].SenType) {
case 1: case 1:
strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
strcat(sens_msg, " (C)"); strcat(sens_msg, " (C)");
seq_printf(seq, len += sk_proc_print(buffer,
"%-25s %d.%02d\n", "%-25s %d.%02d\n",
sens_msg, sens_msg,
pAC->I2c.SenTable[i].SenValue / 10, pAC->I2c.SenTable[i].SenValue / 10,
pAC->I2c.SenTable[i].SenValue % 10); pAC->I2c.SenTable[i].SenValue % 10);
strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
strcat(sens_msg, " (F)"); strcat(sens_msg, " (F)");
seq_printf(seq, len += sk_proc_print(buffer,
"%-25s %d.%02d\n", "%-25s %d.%02d\n",
sens_msg, sens_msg,
((((pAC->I2c.SenTable[i].SenValue) ((((pAC->I2c.SenTable[i].SenValue)
*10)*9)/5 + 3200)/100, *10)*9)/5 + 3200)/100,
((((pAC->I2c.SenTable[i].SenValue) ((((pAC->I2c.SenTable[i].SenValue)
*10)*9)/5 + 3200) % 10); *10)*9)/5 + 3200) % 10);
break; break;
case 2: case 2:
strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
strcat(sens_msg, " (V)"); strcat(sens_msg, " (V)");
seq_printf(seq, len += sk_proc_print(buffer,
"%-25s %d.%03d\n", "%-25s %d.%03d\n",
sens_msg, sens_msg,
pAC->I2c.SenTable[i].SenValue / 1000, pAC->I2c.SenTable[i].SenValue / 1000,
pAC->I2c.SenTable[i].SenValue % 1000); pAC->I2c.SenTable[i].SenValue % 1000);
break; break;
case 3: case 3:
strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
strcat(sens_msg, " (rpm)"); strcat(sens_msg, " (rpm)");
seq_printf(seq, len += sk_proc_print(buffer,
"%-25s %d\n", "%-25s %d\n",
sens_msg, sens_msg,
pAC->I2c.SenTable[i].SenValue); pAC->I2c.SenTable[i].SenValue);
break; break;
default: default:
break; break;
} }
} }
/*Receive statistics */ /*Receive statistics */
seq_printf(seq, len += sk_proc_print(buffer,
"\nReceive statistics\n\n"); "\nReceive statistics\n\n");
seq_printf(seq, len += sk_proc_print(buffer,
"Received bytes %Ld\n", "Received bytes %Lu\n",
(unsigned long long) pPnmiStat->StatRxOctetsOkCts); (unsigned long long) pPnmiStat->StatRxOctetsOkCts);
seq_printf(seq, len += sk_proc_print(buffer,
"Received packets %Ld\n", "Received packets %Lu\n",
(unsigned long long) pPnmiStat->StatRxOkCts); (unsigned long long) pPnmiStat->StatRxOkCts);
#if 0 #if 0
if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC && if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC &&
pAC->HWRevision < 12) { pAC->HWRevision < 12) {
pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts - pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
pPnmiStat->StatRxShortsCts; pPnmiStat->StatRxShortsCts;
pPnmiStat->StatRxShortsCts = 0; pPnmiStat->StatRxShortsCts = 0;
} }
#endif #endif
if (pNet->Mtu > 1500) if (pNet->Mtu > 1500)
pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts - pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
pPnmiStat->StatRxTooLongCts; pPnmiStat->StatRxTooLongCts;
seq_printf(seq, len += sk_proc_print(buffer,
"Receive errors %Ld\n", "Receive errors %Lu\n",
(unsigned long long) pPnmiStruct->InErrorsCts); (unsigned long long) pPnmiStruct->InErrorsCts);
seq_printf(seq, len += sk_proc_print(buffer,
"Receive dropped %Ld\n", "Receive dropped %Lu\n",
(unsigned long long) pPnmiStruct->RxNoBufCts); (unsigned long long) pPnmiStruct->RxNoBufCts);
seq_printf(seq, len += sk_proc_print(buffer,
"Received multicast %Ld\n", "Received multicast %Lu\n",
(unsigned long long) pPnmiStat->StatRxMulticastOkCts); (unsigned long long) pPnmiStat->StatRxMulticastOkCts);
seq_printf(seq, len += sk_proc_print(buffer,
"Receive error types\n"); "Receive error types\n");
seq_printf(seq, len += sk_proc_print(buffer,
" length %Ld\n", " length %Lu\n",
(unsigned long long) pPnmiStat->StatRxRuntCts); (unsigned long long) pPnmiStat->StatRxRuntCts);
seq_printf(seq, len += sk_proc_print(buffer,
" buffer overflow %Ld\n", " buffer overflow %Lu\n",
(unsigned long long) pPnmiStat->StatRxFifoOverflowCts); (unsigned long long) pPnmiStat->StatRxFifoOverflowCts);
seq_printf(seq, len += sk_proc_print(buffer,
" bad crc %Ld\n", " bad crc %Lu\n",
(unsigned long long) pPnmiStat->StatRxFcsCts); (unsigned long long) pPnmiStat->StatRxFcsCts);
seq_printf(seq, len += sk_proc_print(buffer,
" framing %Ld\n", " framing %Lu\n",
(unsigned long long) pPnmiStat->StatRxFramingCts); (unsigned long long) pPnmiStat->StatRxFramingCts);
seq_printf(seq, len += sk_proc_print(buffer,
" missed frames %Ld\n", " missed frames %Lu\n",
(unsigned long long) pPnmiStat->StatRxMissedCts); (unsigned long long) pPnmiStat->StatRxMissedCts);
if (pNet->Mtu > 1500) if (pNet->Mtu > 1500)
pPnmiStat->StatRxTooLongCts = 0; pPnmiStat->StatRxTooLongCts = 0;
seq_printf(seq, len += sk_proc_print(buffer,
" too long %Ld\n", " too long %Lu\n",
(unsigned long long) pPnmiStat->StatRxTooLongCts); (unsigned long long) pPnmiStat->StatRxTooLongCts);
seq_printf(seq, len += sk_proc_print(buffer,
" carrier extension %Ld\n", " carrier extension %Lu\n",
(unsigned long long) pPnmiStat->StatRxCextCts); (unsigned long long) pPnmiStat->StatRxCextCts);
seq_printf(seq, len += sk_proc_print(buffer,
" too short %Ld\n", " too short %Lu\n",
(unsigned long long) pPnmiStat->StatRxShortsCts); (unsigned long long) pPnmiStat->StatRxShortsCts);
seq_printf(seq, len += sk_proc_print(buffer,
" symbol %Ld\n", " symbol %Lu\n",
(unsigned long long) pPnmiStat->StatRxSymbolCts); (unsigned long long) pPnmiStat->StatRxSymbolCts);
seq_printf(seq, len += sk_proc_print(buffer,
" LLC MAC size %Ld\n", " LLC MAC size %Lu\n",
(unsigned long long) pPnmiStat->StatRxIRLengthCts); (unsigned long long) pPnmiStat->StatRxIRLengthCts);
seq_printf(seq, len += sk_proc_print(buffer,
" carrier event %Ld\n", " carrier event %Lu\n",
(unsigned long long) pPnmiStat->StatRxCarrierCts); (unsigned long long) pPnmiStat->StatRxCarrierCts);
seq_printf(seq, len += sk_proc_print(buffer,
" jabber %Ld\n", " jabber %Lu\n",
(unsigned long long) pPnmiStat->StatRxJabberCts); (unsigned long long) pPnmiStat->StatRxJabberCts);
/*Transmit statistics */ /*Transmit statistics */
seq_printf(seq, len += sk_proc_print(buffer,
"\nTransmit statistics\n\n"); "\nTransmit statistics\n\n");
seq_printf(seq, len += sk_proc_print(buffer,
"Transmited bytes %Ld\n", "Transmited bytes %Lu\n",
(unsigned long long) pPnmiStat->StatTxOctetsOkCts); (unsigned long long) pPnmiStat->StatTxOctetsOkCts);
seq_printf(seq, len += sk_proc_print(buffer,
"Transmited packets %Ld\n", "Transmited packets %Lu\n",
(unsigned long long) pPnmiStat->StatTxOkCts); (unsigned long long) pPnmiStat->StatTxOkCts);
seq_printf(seq, len += sk_proc_print(buffer,
"Transmit errors %Ld\n", "Transmit errors %Lu\n",
(unsigned long long) pPnmiStat->StatTxSingleCollisionCts); (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
seq_printf(seq, len += sk_proc_print(buffer,
"Transmit dropped %Ld\n", "Transmit dropped %Lu\n",
(unsigned long long) pPnmiStruct->TxNoBufCts); (unsigned long long) pPnmiStruct->TxNoBufCts);
seq_printf(seq, len += sk_proc_print(buffer,
"Transmit collisions %Ld\n", "Transmit collisions %Lu\n",
(unsigned long long) pPnmiStat->StatTxSingleCollisionCts); (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
seq_printf(seq, len += sk_proc_print(buffer,
"Transmit error types\n"); "Transmit error types\n");
seq_printf(seq, len += sk_proc_print(buffer,
" excessive collision %ld\n", " excessive collision %ld\n",
pAC->stats.tx_aborted_errors); pAC->stats.tx_aborted_errors);
seq_printf(seq, len += sk_proc_print(buffer,
" carrier %Ld\n", " carrier %Lu\n",
(unsigned long long) pPnmiStat->StatTxCarrierCts); (unsigned long long) pPnmiStat->StatTxCarrierCts);
seq_printf(seq, len += sk_proc_print(buffer,
" fifo underrun %Ld\n", " fifo underrun %Lu\n",
(unsigned long long) pPnmiStat->StatTxFifoUnderrunCts); (unsigned long long) pPnmiStat->StatTxFifoUnderrunCts);
seq_printf(seq, len += sk_proc_print(buffer,
" heartbeat %Ld\n", " heartbeat %Lu\n",
(unsigned long long) pPnmiStat->StatTxCarrierCts); (unsigned long long) pPnmiStat->StatTxCarrierCts);
seq_printf(seq, len += sk_proc_print(buffer,
" window %ld\n", " window %ld\n",
pAC->stats.tx_window_errors); pAC->stats.tx_window_errors);
return 0; } /* if (strcmp(pACname, currDeviceName) == 0) */
}
SkgeProcDev = next;
}
}
/*****************************************************************************
*
* sk_proc_print -generic line print
*
* Description:
* This function fills the proc entry with statistic data about
* the ethernet device.
*
* Returns: number of bytes written
*
*/
static int sk_proc_print(void *writePtr, char *format, ...)
{
#define MAX_LEN_SINGLE_LINE 256
char str[MAX_LEN_SINGLE_LINE];
va_list a_start;
int lenght = 0;
struct seq_file *seq = (struct seq_file *) writePtr;
SK_MEMSET(str, 0, MAX_LEN_SINGLE_LINE);
va_start(a_start, format);
vsprintf(str, format, a_start);
va_end(a_start);
lenght = strlen(str);
seq_printf(seq, str);
return lenght;
} }
/*****************************************************************************
*
* sk_seq_show - show proc information of a particular adapter
*
* Description:
* This function fills the proc entry with statistic data about
* the ethernet device. It invokes the generic sk_gen_browse() to
* print out all items one per one.
*
* Returns: number of bytes written
*
*/
static int sk_seq_show(struct seq_file *seq, void *v)
{
void *castedBuffer = (void *) seq;
currDev = seq->private;
sk_gen_browse(castedBuffer);
return 0;
}
/*****************************************************************************
*
* sk_proc_open - register the show function when proc is open'ed
*
* Description:
* This function is called whenever a sk98lin proc file is queried.
*
* Returns: the return value of single_open()
*
*/
static int sk_proc_open(struct inode *inode, struct file *file) static int sk_proc_open(struct inode *inode, struct file *file)
{ {
return single_open(file, sk_seq_show, PDE(inode)->data); return single_open(file, sk_seq_show, PDE(inode)->data);
} }
struct file_operations sk_proc_fops = { /*******************************************************************************
.owner = THIS_MODULE, *
.open = sk_proc_open, * End of file
.read = seq_read, *
.llseek = seq_lseek, ******************************************************************************/
.release = single_release,
};
#endif
/****************************************************************************** /******************************************************************************
* *
* Name: skqueue.c * Name: skqueue.c
* Project: Gigabit Ethernet Adapters, Schedule-Modul * Project: Gigabit Ethernet Adapters, Event Scheduler Module
* Version: $Revision: 1.19 $ * Version: $Revision: 1.20 $
* Date: $Date: 2003/05/13 18:00:07 $ * Date: $Date: 2003/09/16 13:44:00 $
* Purpose: Management of an event queue. * Purpose: Management of an event queue.
* *
******************************************************************************/ ******************************************************************************/
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
* History: * History:
* *
* $Log: skqueue.c,v $ * $Log: skqueue.c,v $
* Revision 1.20 2003/09/16 13:44:00 rschmidt
* Added (C) Marvell to SysKonnectFileId
* Editorial changes
*
* Revision 1.19 2003/05/13 18:00:07 mkarl * Revision 1.19 2003/05/13 18:00:07 mkarl
* Removed calls to RLMT, TWSI, and PNMI for SLIM driver (SK_SLIM). * Removed calls to RLMT, TWSI, and PNMI for SLIM driver (SK_SLIM).
* Editorial changes. * Editorial changes.
...@@ -85,18 +89,16 @@ ...@@ -85,18 +89,16 @@
* *
* Revision 1.1 1998/07/30 15:14:01 gklug * Revision 1.1 1998/07/30 15:14:01 gklug
* Initial version. Adapted from SMT * Initial version. Adapted from SMT
*
*
* *
******************************************************************************/ ******************************************************************************/
/* /*
Event queue and dispatcher * Event queue and dispatcher
*/ */
#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM)))) #if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
static const char SysKonnectFileId[] = static const char SysKonnectFileId[] =
"$Header: /usr56/projects/ge/schedule/skqueue.c,v 1.19 2003/05/13 18:00:07 mkarl Exp $" ; "@(#) $Id: skqueue.c,v 1.20 2003/09/16 13:44:00 rschmidt Exp $ (C) Marvell.";
#endif #endif
#include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/skdrv1st.h" /* Driver Specific Definitions */
...@@ -124,11 +126,11 @@ intro() ...@@ -124,11 +126,11 @@ intro()
void SkEventInit( void SkEventInit(
SK_AC *pAC, /* Adapter context */ SK_AC *pAC, /* Adapter context */
SK_IOC Ioc, /* IO context */ SK_IOC Ioc, /* IO context */
int Level) /* Init level */ int Level) /* Init level */
{ {
switch (Level) { switch (Level) {
case SK_INIT_DATA: case SK_INIT_DATA:
pAC->Event.EvPut = pAC->Event.EvGet = pAC->Event.EvQueue ; pAC->Event.EvPut = pAC->Event.EvGet = pAC->Event.EvQueue;
break; break;
default: default:
break; break;
...@@ -144,14 +146,15 @@ SK_U32 Class, /* Event Class */ ...@@ -144,14 +146,15 @@ SK_U32 Class, /* Event Class */
SK_U32 Event, /* Event to be queued */ SK_U32 Event, /* Event to be queued */
SK_EVPARA Para) /* Event parameter */ SK_EVPARA Para) /* Event parameter */
{ {
pAC->Event.EvPut->Class = Class ; pAC->Event.EvPut->Class = Class;
pAC->Event.EvPut->Event = Event ; pAC->Event.EvPut->Event = Event;
pAC->Event.EvPut->Para = Para ; pAC->Event.EvPut->Para = Para;
if (++pAC->Event.EvPut == &pAC->Event.EvQueue[SK_MAX_EVENT]) if (++pAC->Event.EvPut == &pAC->Event.EvQueue[SK_MAX_EVENT])
pAC->Event.EvPut = pAC->Event.EvQueue ; pAC->Event.EvPut = pAC->Event.EvQueue;
if (pAC->Event.EvPut == pAC->Event.EvGet) { if (pAC->Event.EvPut == pAC->Event.EvGet) {
SK_ERR_LOG(pAC, SK_ERRCL_NORES, SKERR_Q_E001, SKERR_Q_E001MSG) ; SK_ERR_LOG(pAC, SK_ERRCL_NORES, SKERR_Q_E001, SKERR_Q_E001MSG);
} }
} }
...@@ -168,77 +171,79 @@ int SkEventDispatcher( ...@@ -168,77 +171,79 @@ int SkEventDispatcher(
SK_AC *pAC, /* Adapters Context */ SK_AC *pAC, /* Adapters Context */
SK_IOC Ioc) /* Io context */ SK_IOC Ioc) /* Io context */
{ {
SK_EVENTELEM *pEv ; /* pointer into queue */ SK_EVENTELEM *pEv; /* pointer into queue */
SK_U32 Class ; SK_U32 Class;
int Rtv ; int Rtv;
pEv = pAC->Event.EvGet ; pEv = pAC->Event.EvGet;
PRINTF("dispatch get %x put %x\n",pEv,pAC->Event.ev_put) ;
PRINTF("dispatch get %x put %x\n", pEv, pAC->Event.ev_put);
while (pEv != pAC->Event.EvPut) { while (pEv != pAC->Event.EvPut) {
PRINTF("dispatch Class %d Event %d\n",pEv->Class,pEv->Event) ; PRINTF("dispatch Class %d Event %d\n", pEv->Class, pEv->Event);
switch(Class = pEv->Class) {
switch (Class = pEv->Class) {
#ifndef SK_USE_LAC_EV #ifndef SK_USE_LAC_EV
#ifndef SK_SLIM #ifndef SK_SLIM
case SKGE_RLMT : /* RLMT Event */ case SKGE_RLMT: /* RLMT Event */
Rtv = SkRlmtEvent(pAC,Ioc,pEv->Event,pEv->Para); Rtv = SkRlmtEvent(pAC, Ioc, pEv->Event, pEv->Para);
break ; break;
case SKGE_I2C : /* I2C Event */ case SKGE_I2C: /* I2C Event */
Rtv = SkI2cEvent(pAC,Ioc,pEv->Event,pEv->Para); Rtv = SkI2cEvent(pAC, Ioc, pEv->Event, pEv->Para);
break ; break;
case SKGE_PNMI : case SKGE_PNMI: /* PNMI Event */
Rtv = SkPnmiEvent(pAC,Ioc,pEv->Event,pEv->Para); Rtv = SkPnmiEvent(pAC, Ioc, pEv->Event, pEv->Para);
break ; break;
#endif /* not SK_SLIM */ #endif /* not SK_SLIM */
#endif /* not SK_USE_LAC_EV */ #endif /* not SK_USE_LAC_EV */
case SKGE_DRV : /* Driver Event */ case SKGE_DRV: /* Driver Event */
Rtv = SkDrvEvent(pAC,Ioc,pEv->Event,pEv->Para); Rtv = SkDrvEvent(pAC, Ioc, pEv->Event, pEv->Para);
break ; break;
#ifndef SK_USE_SW_TIMER #ifndef SK_USE_SW_TIMER
case SKGE_HWAC : case SKGE_HWAC:
Rtv = SkGeSirqEvent(pAC,Ioc,pEv->Event,pEv->Para); Rtv = SkGeSirqEvent(pAC, Ioc, pEv->Event, pEv->Para);
break ; break;
#else /* !SK_USE_SW_TIMER */ #else /* !SK_USE_SW_TIMER */
case SKGE_SWT : case SKGE_SWT :
Rtv = SkSwtEvent(pAC,Ioc,pEv->Event,pEv->Para); Rtv = SkSwtEvent(pAC, Ioc, pEv->Event, pEv->Para);
break ; break;
#endif /* !SK_USE_SW_TIMER */ #endif /* !SK_USE_SW_TIMER */
#ifdef SK_USE_LAC_EV #ifdef SK_USE_LAC_EV
case SKGE_LACP : case SKGE_LACP :
Rtv = SkLacpEvent(pAC,Ioc,pEv->Event,pEv->Para); Rtv = SkLacpEvent(pAC, Ioc, pEv->Event, pEv->Para);
break ; break;
case SKGE_RSF : case SKGE_RSF :
Rtv = SkRsfEvent(pAC,Ioc,pEv->Event,pEv->Para); Rtv = SkRsfEvent(pAC, Ioc, pEv->Event, pEv->Para);
break ; break;
case SKGE_MARKER : case SKGE_MARKER :
Rtv = SkMarkerEvent(pAC,Ioc,pEv->Event,pEv->Para); Rtv = SkMarkerEvent(pAC, Ioc, pEv->Event, pEv->Para);
break ; break;
case SKGE_FD : case SKGE_FD :
Rtv = SkFdEvent(pAC,Ioc,pEv->Event,pEv->Para); Rtv = SkFdEvent(pAC, Ioc, pEv->Event, pEv->Para);
break ; break;
#endif /* SK_USE_LAC_EV */ #endif /* SK_USE_LAC_EV */
#ifdef SK_USE_CSUM #ifdef SK_USE_CSUM
case SKGE_CSUM : case SKGE_CSUM :
Rtv = SkCsEvent(pAC,Ioc,pEv->Event,pEv->Para); Rtv = SkCsEvent(pAC, Ioc, pEv->Event, pEv->Para);
break ; break;
#endif /* SK_USE_CSUM */ #endif /* SK_USE_CSUM */
default : default :
SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_Q_E002, SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_Q_E002, SKERR_Q_E002MSG);
SKERR_Q_E002MSG) ;
Rtv = 0; Rtv = 0;
} }
if (Rtv != 0) { if (Rtv != 0) {
return(Rtv) ; return(Rtv);
} }
if (++pEv == &pAC->Event.EvQueue[SK_MAX_EVENT]) if (++pEv == &pAC->Event.EvQueue[SK_MAX_EVENT])
pEv = pAC->Event.EvQueue ; pEv = pAC->Event.EvQueue;
/* Renew get: it is used in queue_events to detect overruns */ /* Renew get: it is used in queue_events to detect overruns */
pAC->Event.EvGet = pEv; pAC->Event.EvGet = pEv;
} }
return(0) ; return(0);
} }
/* End of file */ /* End of file */
/****************************************************************************** /******************************************************************************
* *
* Name: sktimer.c * Name: sktimer.c
* Project: Gigabit Ethernet Adapters, Schedule-Modul * Project: Gigabit Ethernet Adapters, Event Scheduler Module
* Version: $Revision: 1.13 $ * Version: $Revision: 1.14 $
* Date: $Date: 2003/05/13 18:01:01 $ * Date: $Date: 2003/09/16 13:46:51 $
* Purpose: High level timer functions. * Purpose: High level timer functions.
* *
******************************************************************************/ ******************************************************************************/
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
* History: * History:
* *
* $Log: sktimer.c,v $ * $Log: sktimer.c,v $
* Revision 1.14 2003/09/16 13:46:51 rschmidt
* Added (C) Marvell to SysKonnectFileId
* Editorial changes
*
* Revision 1.13 2003/05/13 18:01:01 mkarl * Revision 1.13 2003/05/13 18:01:01 mkarl
* Editorial changes. * Editorial changes.
* *
...@@ -68,19 +72,16 @@ ...@@ -68,19 +72,16 @@
* *
* Revision 1.1 1998/08/05 11:27:55 gklug * Revision 1.1 1998/08/05 11:27:55 gklug
* first version: adapted from SMT * first version: adapted from SMT
*
*
*
* *
******************************************************************************/ ******************************************************************************/
/* /*
Event queue and dispatcher * Event queue and dispatcher
*/ */
#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM)))) #if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
static const char SysKonnectFileId[] = static const char SysKonnectFileId[] =
"$Header: /usr56/projects/ge/schedule/sktimer.c,v 1.13 2003/05/13 18:01:01 mkarl Exp $" ; "@(#) $Id: sktimer.c,v 1.14 2003/09/16 13:46:51 rschmidt Exp $ (C) Marvell.";
#endif #endif
#include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/skdrv1st.h" /* Driver Specific Definitions */
...@@ -110,14 +111,14 @@ static void timer_done(SK_AC *pAC,SK_IOC Ioc,int Restart); ...@@ -110,14 +111,14 @@ static void timer_done(SK_AC *pAC,SK_IOC Ioc,int Restart);
void SkTimerInit( void SkTimerInit(
SK_AC *pAC, /* Adapters context */ SK_AC *pAC, /* Adapters context */
SK_IOC Ioc, /* IoContext */ SK_IOC Ioc, /* IoContext */
int Level) /* Init Level */ int Level) /* Init Level */
{ {
switch (Level) { switch (Level) {
case SK_INIT_DATA: case SK_INIT_DATA:
pAC->Tim.StQueue = 0 ; pAC->Tim.StQueue = 0;
break; break;
case SK_INIT_IO: case SK_INIT_IO:
SkHwtInit(pAC,Ioc) ; SkHwtInit(pAC, Ioc);
SkTimerDone(pAC, Ioc); SkTimerDone(pAC, Ioc);
break; break;
default: default:
...@@ -134,31 +135,34 @@ SK_AC *pAC, /* Adapters context */ ...@@ -134,31 +135,34 @@ SK_AC *pAC, /* Adapters context */
SK_IOC Ioc, /* IoContext */ SK_IOC Ioc, /* IoContext */
SK_TIMER *pTimer) /* Timer Pointer to be started */ SK_TIMER *pTimer) /* Timer Pointer to be started */
{ {
SK_TIMER **ppTimPrev ; SK_TIMER **ppTimPrev;
SK_TIMER *pTm ; SK_TIMER *pTm;
/* /*
* remove timer from queue * remove timer from queue
*/ */
pTimer->TmActive = SK_FALSE ; pTimer->TmActive = SK_FALSE;
if (pAC->Tim.StQueue == pTimer && !pTimer->TmNext) { if (pAC->Tim.StQueue == pTimer && !pTimer->TmNext) {
SkHwtStop(pAC,Ioc) ; SkHwtStop(pAC, Ioc);
} }
for (ppTimPrev = &pAC->Tim.StQueue ; (pTm = *ppTimPrev) ;
for (ppTimPrev = &pAC->Tim.StQueue; (pTm = *ppTimPrev);
ppTimPrev = &pTm->TmNext ) { ppTimPrev = &pTm->TmNext ) {
if (pTm == pTimer) { if (pTm == pTimer) {
/* /*
* Timer found in queue * Timer found in queue
* - dequeue it and * - dequeue it and
* - correct delta of the next timer * - correct delta of the next timer
*/ */
*ppTimPrev = pTm->TmNext ; *ppTimPrev = pTm->TmNext;
if (pTm->TmNext) { if (pTm->TmNext) {
/* correct delta of next timer in queue */ /* correct delta of next timer in queue */
pTm->TmNext->TmDelta += pTm->TmDelta ; pTm->TmNext->TmDelta += pTm->TmDelta;
} }
return ; return;
} }
} }
} }
...@@ -175,65 +179,67 @@ SK_U32 Class, /* Event Class for this timer */ ...@@ -175,65 +179,67 @@ SK_U32 Class, /* Event Class for this timer */
SK_U32 Event, /* Event Value for this timer */ SK_U32 Event, /* Event Value for this timer */
SK_EVPARA Para) /* Event Parameter for this timer */ SK_EVPARA Para) /* Event Parameter for this timer */
{ {
SK_TIMER **ppTimPrev ; SK_TIMER **ppTimPrev;
SK_TIMER *pTm ; SK_TIMER *pTm;
SK_U32 Delta ; SK_U32 Delta;
Time /= 16 ; /* input is uS, clock ticks are 16uS */ Time /= 16; /* input is uS, clock ticks are 16uS */
if (!Time) if (!Time)
Time = 1 ; Time = 1;
SkTimerStop(pAC,Ioc,pTimer) ; SkTimerStop(pAC, Ioc, pTimer);
pTimer->TmClass = Class ; pTimer->TmClass = Class;
pTimer->TmEvent = Event ; pTimer->TmEvent = Event;
pTimer->TmPara = Para ; pTimer->TmPara = Para;
pTimer->TmActive = SK_TRUE ; pTimer->TmActive = SK_TRUE;
if (!pAC->Tim.StQueue) { if (!pAC->Tim.StQueue) {
/* First Timer to be started */ /* First Timer to be started */
pAC->Tim.StQueue = pTimer ; pAC->Tim.StQueue = pTimer;
pTimer->TmNext = 0 ; pTimer->TmNext = 0;
pTimer->TmDelta = Time ; pTimer->TmDelta = Time;
SkHwtStart(pAC,Ioc,Time) ;
return ; SkHwtStart(pAC, Ioc, Time);
return;
} }
/* /*
* timer correction * timer correction
*/ */
timer_done(pAC,Ioc,0) ; timer_done(pAC, Ioc, 0);
/* /*
* find position in queue * find position in queue
*/ */
Delta = 0 ; Delta = 0;
for (ppTimPrev = &pAC->Tim.StQueue ; (pTm = *ppTimPrev) ; for (ppTimPrev = &pAC->Tim.StQueue; (pTm = *ppTimPrev);
ppTimPrev = &pTm->TmNext ) { ppTimPrev = &pTm->TmNext ) {
if (Delta + pTm->TmDelta > Time) { if (Delta + pTm->TmDelta > Time) {
/* Position found */ /* Position found */
/* Here the timer needs to be inserted. */ /* Here the timer needs to be inserted. */
break ; break;
} }
Delta += pTm->TmDelta ; Delta += pTm->TmDelta;
} }
/* insert in queue */ /* insert in queue */
*ppTimPrev = pTimer ; *ppTimPrev = pTimer;
pTimer->TmNext = pTm ; pTimer->TmNext = pTm;
pTimer->TmDelta = Time - Delta ; pTimer->TmDelta = Time - Delta;
if (pTm) { if (pTm) {
/* There is a next timer /* There is a next timer
* -> correct its Delta value. * -> correct its Delta value.
*/ */
pTm->TmDelta -= pTimer->TmDelta ; pTm->TmDelta -= pTimer->TmDelta;
} }
/* /* restart with first */
* start new with first SkHwtStart(pAC, Ioc, pAC->Tim.StQueue->TmDelta);
*/
SkHwtStart(pAC,Ioc,pAC->Tim.StQueue->TmDelta) ;
} }
...@@ -241,55 +247,56 @@ void SkTimerDone( ...@@ -241,55 +247,56 @@ void SkTimerDone(
SK_AC *pAC, /* Adapters context */ SK_AC *pAC, /* Adapters context */
SK_IOC Ioc) /* IoContext */ SK_IOC Ioc) /* IoContext */
{ {
timer_done(pAC,Ioc,1) ; timer_done(pAC, Ioc, 1);
} }
static void timer_done( static void timer_done(
SK_AC *pAC, /* Adapters context */ SK_AC *pAC, /* Adapters context */
SK_IOC Ioc, /* IoContext */ SK_IOC Ioc, /* IoContext */
int Restart) /* Do we need to restart the Hardware timer ? */ int Restart) /* Do we need to restart the Hardware timer ? */
{ {
SK_U32 Delta ; SK_U32 Delta;
SK_TIMER *pTm ; SK_TIMER *pTm;
SK_TIMER *pTComp ; /* Timer completed now now */ SK_TIMER *pTComp; /* Timer completed now now */
SK_TIMER **ppLast ; /* Next field of Last timer to be deq */ SK_TIMER **ppLast; /* Next field of Last timer to be deq */
int Done = 0 ; int Done = 0;
Delta = SkHwtRead(pAC,Ioc) ; Delta = SkHwtRead(pAC, Ioc);
ppLast = &pAC->Tim.StQueue ;
pTm = pAC->Tim.StQueue ; ppLast = &pAC->Tim.StQueue;
pTm = pAC->Tim.StQueue;
while (pTm && !Done) { while (pTm && !Done) {
if (Delta >= pTm->TmDelta) { if (Delta >= pTm->TmDelta) {
/* Timer ran out */ /* Timer ran out */
pTm->TmActive = SK_FALSE ; pTm->TmActive = SK_FALSE;
Delta -= pTm->TmDelta ; Delta -= pTm->TmDelta;
ppLast = &pTm->TmNext ; ppLast = &pTm->TmNext;
pTm = pTm->TmNext ; pTm = pTm->TmNext;
} else { }
else {
/* We found the first timer that did not run out */ /* We found the first timer that did not run out */
pTm->TmDelta -= Delta ; pTm->TmDelta -= Delta;
Delta = 0 ; Delta = 0;
Done = 1 ; Done = 1;
} }
} }
*ppLast = 0 ; *ppLast = 0;
/* /*
* pTm points to the first Timer that did not run out. * pTm points to the first Timer that did not run out.
* StQueue points to the first Timer that run out. * StQueue points to the first Timer that run out.
*/ */
for ( pTComp = pAC->Tim.StQueue ; pTComp ; pTComp = pTComp->TmNext) { for ( pTComp = pAC->Tim.StQueue; pTComp; pTComp = pTComp->TmNext) {
SkEventQueue(pAC,pTComp->TmClass, pTComp->TmEvent, SkEventQueue(pAC,pTComp->TmClass, pTComp->TmEvent, pTComp->TmPara);
pTComp->TmPara) ;
} }
/* Set head of timer queue to the first timer that did not run out */ /* Set head of timer queue to the first timer that did not run out */
pAC->Tim.StQueue = pTm ; pAC->Tim.StQueue = pTm;
if (Restart && pAC->Tim.StQueue) { if (Restart && pAC->Tim.StQueue) {
/* Restart HW timer */ /* Restart HW timer */
SkHwtStart(pAC,Ioc,pAC->Tim.StQueue->TmDelta) ; SkHwtStart(pAC, Ioc, pAC->Tim.StQueue->TmDelta);
} }
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* *
* Name: skxmac2.c * Name: skxmac2.c
* Project: Gigabit Ethernet Adapters, Common Modules * Project: Gigabit Ethernet Adapters, Common Modules
* Version: $Revision: 1.99 $ * Version: $Revision: 1.102 $
* Date: $Date: 2003/07/11 12:19:33 $ * Date: $Date: 2003/10/02 16:53:58 $
* Purpose: Contains functions to initialize the MACs and PHYs * Purpose: Contains functions to initialize the MACs and PHYs
* *
******************************************************************************/ ******************************************************************************/
...@@ -27,6 +27,23 @@ ...@@ -27,6 +27,23 @@
* History: * History:
* *
* $Log: skxmac2.c,v $ * $Log: skxmac2.c,v $
* Revision 1.102 2003/10/02 16:53:58 rschmidt
* Changed setting of GMAC parameters with new macros.
* Added define SLIM around SkGm...LowPowerMode().
* Editorial changes.
*
* Revision 1.101 2003/09/16 14:49:07 rschmidt
* Added routines SkGmClearRst(), SkXmClearRst, SkMacClearRst().
* Added WA code for Yukon-Lite's COMA mode in SkGmHardRst().
* Replaced PCI-Config R/W through internal access.
* Fixed return from coma mode in SkGmLeaveLowPowerMode().
* Fixed compiler warnings for different types.
* Editorial changes.
*
* Revision 1.100 2003/09/16 07:09:11 mschmid
* Added functions SkGmEnterLowPowerMode() and
* SkGmLeaveLowPowerMode()
*
* Revision 1.99 2003/07/11 12:19:33 rschmidt * Revision 1.99 2003/07/11 12:19:33 rschmidt
* Reduced init values for Master & Slave downshift counters to * Reduced init values for Master & Slave downshift counters to
* minimum values. * minimum values.
...@@ -164,7 +181,7 @@ ...@@ -164,7 +181,7 @@
* Revision 1.74 2002/08/12 14:00:17 rschmidt * Revision 1.74 2002/08/12 14:00:17 rschmidt
* Replaced usage of Broadcom PHY Ids with defines. * Replaced usage of Broadcom PHY Ids with defines.
* Corrected error messages in SkGmMacStatistic(). * Corrected error messages in SkGmMacStatistic().
* Made SkMacPromiscMode() public for ADDR-Modul. * Made SkMacPromiscMode() public for ADDR-Module.
* Editorial changes. * Editorial changes.
* *
* Revision 1.73 2002/08/08 16:26:24 rschmidt * Revision 1.73 2002/08/08 16:26:24 rschmidt
...@@ -475,7 +492,7 @@ typedef struct s_PhyHack { ...@@ -475,7 +492,7 @@ typedef struct s_PhyHack {
#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM)))) #if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
static const char SysKonnectFileId[] = static const char SysKonnectFileId[] =
"@(#) $Id: skxmac2.c,v 1.99 2003/07/11 12:19:33 rschmidt Exp $ (C) Marvell."; "@(#) $Id: skxmac2.c,v 1.102 2003/10/02 16:53:58 rschmidt Exp $ (C) Marvell.";
#endif #endif
#ifdef GENESIS #ifdef GENESIS
...@@ -1343,7 +1360,7 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -1343,7 +1360,7 @@ int Port) /* Port Index (MAC_1 + n) */
* Description: * Description:
* The XMAC of the specified 'Port' and all connected devices * The XMAC of the specified 'Port' and all connected devices
* (PHY and SERDES) will receive a reset signal on its *Reset pins. * (PHY and SERDES) will receive a reset signal on its *Reset pins.
* External PHYs must be reset be clearing a bit in the GPIO register * External PHYs must be reset by clearing a bit in the GPIO register
* (Timing requirements: Broadcom: 400ns, Level One: none, National: 80ns). * (Timing requirements: Broadcom: 400ns, Level One: none, National: 80ns).
* *
* ATTENTION: * ATTENTION:
...@@ -1386,23 +1403,62 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -1386,23 +1403,62 @@ int Port) /* Port Index (MAC_1 + n) */
/* For external PHYs there must be special handling */ /* For external PHYs there must be special handling */
if (pAC->GIni.GP[Port].PhyType != SK_PHY_XMAC) { if (pAC->GIni.GP[Port].PhyType != SK_PHY_XMAC) {
/* reset external PHY */
SK_IN32(IoC, B2_GP_IO, &Reg); SK_IN32(IoC, B2_GP_IO, &Reg);
if (Port == 0) { if (Port == 0) {
Reg |= GP_DIR_0; /* set to output */ Reg |= GP_DIR_0; /* set to output */
Reg &= ~GP_IO_0; Reg &= ~GP_IO_0; /* set PHY reset (active low) */
} }
else { else {
Reg |= GP_DIR_2; /* set to output */ Reg |= GP_DIR_2; /* set to output */
Reg &= ~GP_IO_2; Reg &= ~GP_IO_2; /* set PHY reset (active low) */
} }
/* reset external PHY */
SK_OUT32(IoC, B2_GP_IO, Reg); SK_OUT32(IoC, B2_GP_IO, Reg);
/* short delay */ /* short delay */
SK_IN32(IoC, B2_GP_IO, &Reg); SK_IN32(IoC, B2_GP_IO, &Reg);
} }
} /* SkXmHardRst */ } /* SkXmHardRst */
/******************************************************************************
*
* SkXmClearRst() - Release the PHY & XMAC reset
*
* Description:
*
* Returns:
* nothing
*/
static void SkXmClearRst(
SK_AC *pAC, /* adapter context */
SK_IOC IoC, /* IO context */
int Port) /* Port Index (MAC_1 + n) */
{
SK_U32 DWord;
/* clear HW reset */
SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), MFF_CLR_MAC_RST);
if (pAC->GIni.GP[Port].PhyType != SK_PHY_XMAC) {
SK_IN32(IoC, B2_GP_IO, &DWord);
if (Port == 0) {
DWord |= (GP_DIR_0 | GP_IO_0); /* set to output */
}
else {
DWord |= (GP_DIR_2 | GP_IO_2); /* set to output */
}
/* Clear PHY reset */
SK_OUT32(IoC, B2_GP_IO, DWord);
/* Enable GMII interface */
XM_OUT16(IoC, Port, XM_HW_CFG, XM_HW_GMII_MD);
}
} /* SkXmClearRst */
#endif /* GENESIS */ #endif /* GENESIS */
...@@ -1452,10 +1508,6 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -1452,10 +1508,6 @@ int Port) /* Port Index (MAC_1 + n) */
* *
* Description: * Description:
* *
* ATTENTION:
* It is absolutely necessary to reset the SW_RST Bit first
* before calling this function.
*
* Returns: * Returns:
* nothing * nothing
*/ */
...@@ -1464,6 +1516,20 @@ SK_AC *pAC, /* adapter context */ ...@@ -1464,6 +1516,20 @@ SK_AC *pAC, /* adapter context */
SK_IOC IoC, /* IO context */ SK_IOC IoC, /* IO context */
int Port) /* Port Index (MAC_1 + n) */ int Port) /* Port Index (MAC_1 + n) */
{ {
SK_U32 DWord;
/* WA code for COMA mode */
if (pAC->GIni.GIYukonLite &&
pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) {
SK_IN32(IoC, B2_GP_IO, &DWord);
DWord |= (GP_DIR_9 | GP_IO_9);
/* set PHY reset */
SK_OUT32(IoC, B2_GP_IO, DWord);
}
/* set GPHY Control reset */ /* set GPHY Control reset */
SK_OUT32(IoC, MR_ADDR(Port, GPHY_CTRL), GPC_RST_SET); SK_OUT32(IoC, MR_ADDR(Port, GPHY_CTRL), GPC_RST_SET);
...@@ -1471,6 +1537,73 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -1471,6 +1537,73 @@ int Port) /* Port Index (MAC_1 + n) */
SK_OUT32(IoC, MR_ADDR(Port, GMAC_CTRL), GMC_RST_SET); SK_OUT32(IoC, MR_ADDR(Port, GMAC_CTRL), GMC_RST_SET);
} /* SkGmHardRst */ } /* SkGmHardRst */
/******************************************************************************
*
* SkGmClearRst() - Release the GPHY & GMAC reset
*
* Description:
*
* Returns:
* nothing
*/
static void SkGmClearRst(
SK_AC *pAC, /* adapter context */
SK_IOC IoC, /* IO context */
int Port) /* Port Index (MAC_1 + n) */
{
SK_U32 DWord;
#ifdef XXX
/* clear GMAC Control reset */
SK_OUT32(IoC, MR_ADDR(Port, GMAC_CTRL), GMC_RST_CLR);
/* set GMAC Control reset */
SK_OUT32(IoC, MR_ADDR(Port, GMAC_CTRL), GMC_RST_SET);
#endif /* XXX */
/* WA code for COMA mode */
if (pAC->GIni.GIYukonLite &&
pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) {
SK_IN32(IoC, B2_GP_IO, &DWord);
DWord |= GP_DIR_9; /* set to output */
DWord &= ~GP_IO_9; /* clear PHY reset (active high) */
/* clear PHY reset */
SK_OUT32(IoC, B2_GP_IO, DWord);
}
/* set HWCFG_MODE */
DWord = GPC_INT_POL_HI | GPC_DIS_FC | GPC_DIS_SLEEP |
GPC_ENA_XC | GPC_ANEG_ADV_ALL_M | GPC_ENA_PAUSE |
(pAC->GIni.GICopperType ? GPC_HWCFG_GMII_COP :
GPC_HWCFG_GMII_FIB);
/* set GPHY Control reset */
SK_OUT32(IoC, MR_ADDR(Port, GPHY_CTRL), DWord | GPC_RST_SET);
/* release GPHY Control reset */
SK_OUT32(IoC, MR_ADDR(Port, GPHY_CTRL), DWord | GPC_RST_CLR);
#ifdef VCPU
VCpuWait(9000);
#endif /* VCPU */
/* clear GMAC Control reset */
SK_OUT32(IoC, MR_ADDR(Port, GMAC_CTRL), GMC_PAUSE_ON | GMC_RST_CLR);
#ifdef VCPU
VCpuWait(2000);
SK_IN32(IoC, MR_ADDR(Port, GPHY_CTRL), &DWord);
SK_IN32(IoC, B0_ISRC, &DWord);
#endif /* VCPU */
} /* SkGmClearRst */
#endif /* YUKON */ #endif /* YUKON */
...@@ -1553,6 +1686,38 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -1553,6 +1686,38 @@ int Port) /* Port Index (MAC_1 + n) */
} /* SkMacHardRst */ } /* SkMacHardRst */
/******************************************************************************
*
* SkMacClearRst() - Clear the MAC reset
*
* Description: calls a clear MAC reset routine dep. on board type
*
* Returns:
* nothing
*/
void SkMacClearRst(
SK_AC *pAC, /* adapter context */
SK_IOC IoC, /* IO context */
int Port) /* Port Index (MAC_1 + n) */
{
#ifdef GENESIS
if (pAC->GIni.GIGenesis) {
SkXmClearRst(pAC, IoC, Port);
}
#endif /* GENESIS */
#ifdef YUKON
if (pAC->GIni.GIYukon) {
SkGmClearRst(pAC, IoC, Port);
}
#endif /* YUKON */
} /* SkMacClearRst */
#ifdef GENESIS #ifdef GENESIS
/****************************************************************************** /******************************************************************************
* *
...@@ -1574,7 +1739,6 @@ SK_IOC IoC, /* IO context */ ...@@ -1574,7 +1739,6 @@ SK_IOC IoC, /* IO context */
int Port) /* Port Index (MAC_1 + n) */ int Port) /* Port Index (MAC_1 + n) */
{ {
SK_GEPORT *pPrt; SK_GEPORT *pPrt;
SK_U32 Reg;
int i; int i;
SK_U16 SWord; SK_U16 SWord;
...@@ -1594,32 +1758,10 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -1594,32 +1758,10 @@ int Port) /* Port Index (MAC_1 + n) */
} }
if (pPrt->PState == SK_PRT_RESET) { if (pPrt->PState == SK_PRT_RESET) {
/*
* clear HW reset
* Note: The SW reset is self clearing, therefore there is
* nothing to do here.
*/
SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), MFF_CLR_MAC_RST);
/* Ensure that XMAC reset release is done (errata from LReinbold?) */ SkXmClearRst(pAC, IoC, Port);
SK_IN16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), &SWord);
/* Clear PHY reset */
if (pPrt->PhyType != SK_PHY_XMAC) { if (pPrt->PhyType != SK_PHY_XMAC) {
SK_IN32(IoC, B2_GP_IO, &Reg);
if (Port == 0) {
Reg |= (GP_DIR_0 | GP_IO_0); /* set to output */
}
else {
Reg |= (GP_DIR_2 | GP_IO_2); /* set to output */
}
SK_OUT32(IoC, B2_GP_IO, Reg);
/* Enable GMII interface */
XM_OUT16(IoC, Port, XM_HW_CFG, XM_HW_GMII_MD);
/* read Id from external PHY (all have the same address) */ /* read Id from external PHY (all have the same address) */
SkXmPhyRead(pAC, IoC, Port, PHY_XMAC_ID1, &pPrt->PhyId1); SkXmPhyRead(pAC, IoC, Port, PHY_XMAC_ID1, &pPrt->PhyId1);
...@@ -1831,43 +1973,11 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -1831,43 +1973,11 @@ int Port) /* Port Index (MAC_1 + n) */
} }
if (pPrt->PState == SK_PRT_RESET) { if (pPrt->PState == SK_PRT_RESET) {
/* set GPHY Control reset */
SK_OUT32(IoC, MR_ADDR(Port, GPHY_CTRL), GPC_RST_SET); SkGmHardRst(pAC, IoC, Port);
/* set GMAC Control reset */
SK_OUT32(IoC, MR_ADDR(Port, GMAC_CTRL), GMC_RST_SET);
#ifdef XXX
/* clear GMAC Control reset */
SK_OUT32(IoC, MR_ADDR(Port, GMAC_CTRL), GMC_RST_CLR);
/* set GMAC Control reset */
SK_OUT32(IoC, MR_ADDR(Port, GMAC_CTRL), GMC_RST_SET);
#endif /* XXX */
/* set HWCFG_MODE */
DWord = GPC_INT_POL_HI | GPC_DIS_FC | GPC_DIS_SLEEP |
GPC_ENA_XC | GPC_ANEG_ADV_ALL_M | GPC_ENA_PAUSE |
(pAC->GIni.GICopperType ? GPC_HWCFG_GMII_COP :
GPC_HWCFG_GMII_FIB);
/* set GPHY Control reset */
SK_OUT32(IoC, MR_ADDR(Port, GPHY_CTRL), DWord | GPC_RST_SET);
/* release GPHY Control reset */
SK_OUT32(IoC, MR_ADDR(Port, GPHY_CTRL), DWord | GPC_RST_CLR);
#ifdef VCPU
VCpuWait(9000);
#endif /* VCPU */
/* clear GMAC Control reset */
SK_OUT32(IoC, MR_ADDR(Port, GMAC_CTRL), GMC_PAUSE_ON | GMC_RST_CLR);
#ifdef VCPU
VCpuWait(2000);
#endif /* VCPU */
SkGmClearRst(pAC, IoC, Port);
/* Auto-negotiation ? */ /* Auto-negotiation ? */
if (pPrt->PLinkMode == SK_LMODE_HALF || pPrt->PLinkMode == SK_LMODE_FULL) { if (pPrt->PLinkMode == SK_LMODE_HALF || pPrt->PLinkMode == SK_LMODE_FULL) {
/* Auto-negotiation disabled */ /* Auto-negotiation disabled */
...@@ -1906,6 +2016,7 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -1906,6 +2016,7 @@ int Port) /* Port Index (MAC_1 + n) */
SWord |= GM_GPCR_DUP_FULL; SWord |= GM_GPCR_DUP_FULL;
} }
/* flow-control settings */
switch (pPrt->PFlowCtrlMode) { switch (pPrt->PFlowCtrlMode) {
case SK_FLOW_MODE_NONE: case SK_FLOW_MODE_NONE:
/* set Pause Off */ /* set Pause Off */
...@@ -1940,7 +2051,7 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -1940,7 +2051,7 @@ int Port) /* Port Index (MAC_1 + n) */
(void)SkGmResetCounter(pAC, IoC, Port); (void)SkGmResetCounter(pAC, IoC, Port);
/* setup Transmit Control Register */ /* setup Transmit Control Register */
GM_OUT16(IoC, Port, GM_TX_CTRL, GM_TXCR_COL_THR); GM_OUT16(IoC, Port, GM_TX_CTRL, TX_COL_THR(pPrt->PMacColThres));
/* setup Receive Control Register */ /* setup Receive Control Register */
GM_OUT16(IoC, Port, GM_RX_CTRL, GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA | GM_OUT16(IoC, Port, GM_RX_CTRL, GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA |
...@@ -1954,7 +2065,9 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -1954,7 +2065,9 @@ int Port) /* Port Index (MAC_1 + n) */
GM_IN16(IoC, Port, GM_TX_PARAM, &SWord); GM_IN16(IoC, Port, GM_TX_PARAM, &SWord);
#endif /* VCPU */ #endif /* VCPU */
SWord = (SK_U16)(JAM_LEN_VAL(3) | JAM_IPG_VAL(11) | IPG_JAM_DATA(26)); SWord = TX_JAM_LEN_VAL(pPrt->PMacJamLen) |
TX_JAM_IPG_VAL(pPrt->PMacJamIpgVal) |
TX_IPG_JAM_DATA(pPrt->PMacJamIpgData);
GM_OUT16(IoC, Port, GM_TX_PARAM, SWord); GM_OUT16(IoC, Port, GM_TX_PARAM, SWord);
...@@ -1963,7 +2076,12 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -1963,7 +2076,12 @@ int Port) /* Port Index (MAC_1 + n) */
GM_IN16(IoC, Port, GM_SERIAL_MODE, &SWord); GM_IN16(IoC, Port, GM_SERIAL_MODE, &SWord);
#endif /* VCPU */ #endif /* VCPU */
SWord = GM_SMOD_VLAN_ENA | IPG_VAL_FAST_ETH; SWord = GM_SMOD_VLAN_ENA | IPG_DATA_VAL(pPrt->PMacIpgData);
if (pPrt->PMacLimit4) {
/* reset of collision counter after 4 consecutive collisions */
SWord |= GM_SMOD_LIMIT_4;
}
if (pAC->GIni.GIPortUsage == SK_JUMBO_LINK) { if (pAC->GIni.GIPortUsage == SK_JUMBO_LINK) {
/* enable jumbo mode (Max. Frame Length = 9018) */ /* enable jumbo mode (Max. Frame Length = 9018) */
...@@ -2021,11 +2139,13 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -2021,11 +2139,13 @@ int Port) /* Port Index (MAC_1 + n) */
GM_OUT16(IoC, Port, GM_RX_IRQ_MSK, 0); GM_OUT16(IoC, Port, GM_RX_IRQ_MSK, 0);
GM_OUT16(IoC, Port, GM_TR_IRQ_MSK, 0); GM_OUT16(IoC, Port, GM_TR_IRQ_MSK, 0);
#if defined(SK_DIAG) || defined(DEBUG)
/* read General Purpose Status */ /* read General Purpose Status */
GM_IN16(IoC, Port, GM_GP_STAT, &SWord); GM_IN16(IoC, Port, GM_GP_STAT, &SWord);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("MAC Stat Reg=0x%04X\n", SWord)); ("MAC Stat Reg.=0x%04X\n", SWord));
#endif /* SK_DIAG || DEBUG */
#ifdef SK_DIAG #ifdef SK_DIAG
c_print("MAC Stat Reg=0x%04X\n", SWord); c_print("MAC Stat Reg=0x%04X\n", SWord);
...@@ -2226,6 +2346,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2226,6 +2346,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
SKERR_HWI_E015MSG); SKERR_HWI_E015MSG);
} }
/* Set Flow-control capabilities */
switch (pPrt->PFlowCtrlMode) { switch (pPrt->PFlowCtrlMode) {
case SK_FLOW_MODE_NONE: case SK_FLOW_MODE_NONE:
Ctrl |= PHY_X_P_NO_PAUSE; Ctrl |= PHY_X_P_NO_PAUSE;
...@@ -2306,7 +2427,9 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2306,7 +2427,9 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("InitPhyBcom: no auto-negotiation Port %d\n", Port)); ("InitPhyBcom: no auto-negotiation Port %d\n", Port));
/* Set DuplexMode in Config register */ /* Set DuplexMode in Config register */
Ctrl1 |= (pPrt->PLinkMode == SK_LMODE_FULL ? PHY_CT_DUP_MD : 0); if (pPrt->PLinkMode == SK_LMODE_FULL) {
Ctrl1 |= PHY_CT_DUP_MD;
}
/* Determine Master/Slave manually if not already done */ /* Determine Master/Slave manually if not already done */
if (pPrt->PMSMode == SK_MS_MODE_AUTO) { if (pPrt->PMSMode == SK_MS_MODE_AUTO) {
...@@ -2346,6 +2469,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2346,6 +2469,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
SKERR_HWI_E015MSG); SKERR_HWI_E015MSG);
} }
/* Set Flow-control capabilities */
switch (pPrt->PFlowCtrlMode) { switch (pPrt->PFlowCtrlMode) {
case SK_FLOW_MODE_NONE: case SK_FLOW_MODE_NONE:
Ctrl3 |= PHY_B_P_NO_PAUSE; Ctrl3 |= PHY_B_P_NO_PAUSE;
...@@ -2375,12 +2499,12 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2375,12 +2499,12 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
/* Write 1000Base-T Control Register */ /* Write 1000Base-T Control Register */
SkXmPhyWrite(pAC, IoC, Port, PHY_BCOM_1000T_CTRL, Ctrl2); SkXmPhyWrite(pAC, IoC, Port, PHY_BCOM_1000T_CTRL, Ctrl2);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("1000B-T Ctrl Reg=0x%04X\n", Ctrl2)); ("Set 1000B-T Ctrl Reg=0x%04X\n", Ctrl2));
/* Write AutoNeg Advertisement Register */ /* Write AutoNeg Advertisement Register */
SkXmPhyWrite(pAC, IoC, Port, PHY_BCOM_AUNE_ADV, Ctrl3); SkXmPhyWrite(pAC, IoC, Port, PHY_BCOM_AUNE_ADV, Ctrl3);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("Auto-Neg.Adv.Reg=0x%04X\n", Ctrl3)); ("Set Auto-Neg.Adv.Reg=0x%04X\n", Ctrl3));
if (DoLoop) { if (DoLoop) {
/* Set the Phy Loopback bit, too */ /* Set the Phy Loopback bit, too */
...@@ -2409,6 +2533,281 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2409,6 +2533,281 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
#ifdef YUKON #ifdef YUKON
#ifndef SK_SLIM
/******************************************************************************
*
* SkGmEnterLowPowerMode()
*
* Description:
* This function sets the Marvell Alaska PHY to the low power mode
* given by parameter mode.
* The following low power modes are available:
*
* - Coma Mode (Deep Sleep):
* Power consumption: ~15 - 30 mW
* The PHY cannot wake up on its own.
*
* - IEEE 22.2.4.1.5 compatible power down mode
* Power consumption: ~240 mW
* The PHY cannot wake up on its own.
*
* - energy detect mode
* Power consumption: ~160 mW
* The PHY can wake up on its own by detecting activity
* on the CAT 5 cable.
*
* - energy detect plus mode
* Power consumption: ~150 mW
* The PHY can wake up on its own by detecting activity
* on the CAT 5 cable.
* Connected devices can be woken up by sending normal link
* pulses every one second.
*
* Note:
*
* Returns:
* 0: ok
* 1: error
*/
int SkGmEnterLowPowerMode(
SK_AC *pAC, /* adapter context */
SK_IOC IoC, /* IO context */
int Port, /* Port Index (e.g. MAC_1) */
SK_U8 Mode) /* low power mode */
{
SK_U16 Word;
SK_U32 DWord;
SK_U8 LastMode;
int Ret = 0;
if (pAC->GIni.GIYukonLite &&
pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) {
/* save current power mode */
LastMode = pAC->GIni.GP[Port].PPhyPowerState;
pAC->GIni.GP[Port].PPhyPowerState = Mode;
switch (Mode) {
/* coma mode (deep sleep) */
case PHY_PM_DEEP_SLEEP:
/* setup General Purpose Control Register */
GM_OUT16(IoC, 0, GM_GP_CTRL, GM_GPCR_FL_PASS |
GM_GPCR_SPEED_100 | GM_GPCR_AU_ALL_DIS);
/* apply COMA mode workaround */
SkGmPhyWrite(pAC, IoC, Port, 29, 0x001f);
SkGmPhyWrite(pAC, IoC, Port, 30, 0xfff3);
SK_IN32(IoC, PCI_C(PCI_OUR_REG_1), &DWord);
SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON);
/* Set PHY to Coma Mode */
SK_OUT32(IoC, PCI_C(PCI_OUR_REG_1), DWord | PCI_PHY_COMA);
SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
break;
/* IEEE 22.2.4.1.5 compatible power down mode */
case PHY_PM_IEEE_POWER_DOWN:
/*
* - disable MAC 125 MHz clock
* - allow MAC power down
*/
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
Word |= PHY_M_PC_DIS_125CLK;
Word &= ~PHY_M_PC_MAC_POW_UP;
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
/*
* register changes must be followed by a software
* reset to take effect
*/
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word);
Word |= PHY_CT_RESET;
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word);
/* switch IEEE compatible power down mode on */
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word);
Word |= PHY_CT_PDOWN;
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word);
break;
/* energy detect and energy detect plus mode */
case PHY_PM_ENERGY_DETECT:
case PHY_PM_ENERGY_DETECT_PLUS:
/*
* - disable MAC 125 MHz clock
*/
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
Word |= PHY_M_PC_DIS_125CLK;
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
/* activate energy detect mode 1 */
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
/* energy detect mode */
if (Mode == PHY_PM_ENERGY_DETECT) {
Word |= PHY_M_PC_EN_DET;
}
/* energy detect plus mode */
else {
Word |= PHY_M_PC_EN_DET_PLUS;
}
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
/*
* reinitialize the PHY to force a software reset
* which is necessary after the register settings
* for the energy detect modes.
* Furthermore reinitialisation prevents that the
* PHY is running out of a stable state.
*/
SkGmInitPhyMarv(pAC, IoC, Port, SK_FALSE);
break;
/* don't change current power mode */
default:
pAC->GIni.GP[Port].PPhyPowerState = LastMode;
Ret = 1;
break;
}
}
/* low power modes are not supported by this chip */
else {
Ret = 1;
}
return(Ret);
} /* SkGmEnterLowPowerMode */
/******************************************************************************
*
* SkGmLeaveLowPowerMode()
*
* Description:
* Leave the current low power mode and switch to normal mode
*
* Note:
*
* Returns:
* 0: ok
* 1: error
*/
int SkGmLeaveLowPowerMode(
SK_AC *pAC, /* adapter context */
SK_IOC IoC, /* IO context */
int Port) /* Port Index (e.g. MAC_1) */
{
SK_U32 DWord;
SK_U16 Word;
SK_U8 LastMode;
int Ret = 0;
if (pAC->GIni.GIYukonLite &&
pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) {
/* save current power mode */
LastMode = pAC->GIni.GP[Port].PPhyPowerState;
pAC->GIni.GP[Port].PPhyPowerState = PHY_PM_OPERATIONAL_MODE;
switch (LastMode) {
/* coma mode (deep sleep) */
case PHY_PM_DEEP_SLEEP:
SK_IN32(IoC, PCI_C(PCI_OUR_REG_1), &DWord);
SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON);
/* Release PHY from Coma Mode */
SK_OUT32(IoC, PCI_C(PCI_OUR_REG_1), DWord & ~PCI_PHY_COMA);
SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
SK_IN32(IoC, B2_GP_IO, &DWord);
/* set to output */
DWord |= (GP_DIR_9 | GP_IO_9);
/* set PHY reset */
SK_OUT32(IoC, B2_GP_IO, DWord);
DWord &= ~GP_IO_9; /* clear PHY reset (active high) */
/* clear PHY reset */
SK_OUT32(IoC, B2_GP_IO, DWord);
break;
/* IEEE 22.2.4.1.5 compatible power down mode */
case PHY_PM_IEEE_POWER_DOWN:
/*
* - enable MAC 125 MHz clock
* - set MAC power up
*/
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
Word &= ~PHY_M_PC_DIS_125CLK;
Word |= PHY_M_PC_MAC_POW_UP;
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
/*
* register changes must be followed by a software
* reset to take effect
*/
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word);
Word |= PHY_CT_RESET;
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word);
/* switch IEEE compatible power down mode off */
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &Word);
Word &= ~PHY_CT_PDOWN;
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, Word);
break;
/* energy detect and energy detect plus mode */
case PHY_PM_ENERGY_DETECT:
case PHY_PM_ENERGY_DETECT_PLUS:
/*
* - enable MAC 125 MHz clock
*/
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
Word &= ~PHY_M_PC_DIS_125CLK;
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
/* disable energy detect mode */
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_PHY_CTRL, &Word);
Word &= ~PHY_M_PC_EN_DET_MSK;
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, Word);
/*
* reinitialize the PHY to force a software reset
* which is necessary after the register settings
* for the energy detect modes.
* Furthermore reinitialisation prevents that the
* PHY is running out of a stable state.
*/
SkGmInitPhyMarv(pAC, IoC, Port, SK_FALSE);
break;
/* don't change current power mode */
default:
pAC->GIni.GP[Port].PPhyPowerState = LastMode;
Ret = 1;
break;
}
}
/* low power modes are not supported by this chip */
else {
Ret = 1;
}
return(Ret);
} /* SkGmLeaveLowPowerMode */
#endif /* !SK_SLIM */
/****************************************************************************** /******************************************************************************
* *
* SkGmInitPhyMarv() - Initialize the Marvell Phy registers * SkGmInitPhyMarv() - Initialize the Marvell Phy registers
...@@ -2457,7 +2856,6 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2457,7 +2856,6 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
VCPUprintf(0, "SkGmInitPhyMarv(), Port=%u, DoLoop=%u\n", VCPUprintf(0, "SkGmInitPhyMarv(), Port=%u, DoLoop=%u\n",
Port, DoLoop); Port, DoLoop);
#else /* VCPU */ #else /* VCPU */
if (DoLoop) { if (DoLoop) {
/* Set 'MAC Power up'-bit, set Manual MDI configuration */ /* Set 'MAC Power up'-bit, set Manual MDI configuration */
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL,
...@@ -2475,16 +2873,20 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2475,16 +2873,20 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_CTRL, ExtPhyCtrl); SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_CTRL, ExtPhyCtrl);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("Ext. PHY Ctrl=0x%04X\n", ExtPhyCtrl)); ("Set Ext. PHY Ctrl=0x%04X\n", ExtPhyCtrl));
} }
/* Read PHY Control */ /* Read PHY Control */
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &PhyCtrl); SkGmPhyRead(pAC, IoC, Port, PHY_MARV_CTRL, &PhyCtrl);
if (!AutoNeg) {
/* Disable Auto-negotiation */
PhyCtrl &= ~PHY_CT_ANE;
}
PhyCtrl |= PHY_CT_RESET; PhyCtrl |= PHY_CT_RESET;
/* Assert software reset */ /* Assert software reset */
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, PhyCtrl); SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, PhyCtrl);
#endif /* VCPU */ #endif /* VCPU */
PhyCtrl = 0 /* PHY_CT_COL_TST */; PhyCtrl = 0 /* PHY_CT_COL_TST */;
...@@ -2533,13 +2935,9 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2533,13 +2935,9 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
if (!DoLoop) { if (!DoLoop) {
PhyCtrl |= PHY_CT_RESET; PhyCtrl |= PHY_CT_RESET;
} }
/*
* Do NOT enable Auto-negotiation here. This would hold
* the link down because no IDLES are transmitted
*/
} }
else { else {
PhyCtrl |= PHY_CT_ANE; /* Set Auto-negotiation advertisement */
if (pAC->GIni.GICopperType) { if (pAC->GIni.GICopperType) {
/* Set Speed capabilities */ /* Set Speed capabilities */
...@@ -2554,6 +2952,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2554,6 +2952,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
break; break;
case SK_LSPEED_100MBPS: case SK_LSPEED_100MBPS:
AutoNegAdv |= PHY_M_AN_100_FD | PHY_M_AN_100_HD | AutoNegAdv |= PHY_M_AN_100_FD | PHY_M_AN_100_HD |
/* advertise 10Base-T also */
PHY_M_AN_10_FD | PHY_M_AN_10_HD; PHY_M_AN_10_FD | PHY_M_AN_10_HD;
break; break;
case SK_LSPEED_10MBPS: case SK_LSPEED_10MBPS:
...@@ -2581,7 +2980,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2581,7 +2980,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
SKERR_HWI_E015MSG); SKERR_HWI_E015MSG);
} }
/* Set Auto-negotiation advertisement */ /* Set Flow-control capabilities */
switch (pPrt->PFlowCtrlMode) { switch (pPrt->PFlowCtrlMode) {
case SK_FLOW_MODE_NONE: case SK_FLOW_MODE_NONE:
AutoNegAdv |= PHY_B_P_NO_PAUSE; AutoNegAdv |= PHY_B_P_NO_PAUSE;
...@@ -2618,7 +3017,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2618,7 +3017,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
SKERR_HWI_E015MSG); SKERR_HWI_E015MSG);
} }
/* Set Auto-negotiation advertisement */ /* Set Flow-control capabilities */
switch (pPrt->PFlowCtrlMode) { switch (pPrt->PFlowCtrlMode) {
case SK_FLOW_MODE_NONE: case SK_FLOW_MODE_NONE:
AutoNegAdv |= PHY_M_P_NO_PAUSE_X; AutoNegAdv |= PHY_M_P_NO_PAUSE_X;
...@@ -2640,7 +3039,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2640,7 +3039,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
if (!DoLoop) { if (!DoLoop) {
/* Restart Auto-negotiation */ /* Restart Auto-negotiation */
PhyCtrl |= PHY_CT_RE_CFG; PhyCtrl |= PHY_CT_ANE | PHY_CT_RE_CFG;
} }
} }
...@@ -2659,12 +3058,12 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2659,12 +3058,12 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
/* Write 1000Base-T Control Register */ /* Write 1000Base-T Control Register */
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_1000T_CTRL, C1000BaseT); SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_1000T_CTRL, C1000BaseT);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("1000B-T Ctrl=0x%04X\n", C1000BaseT)); ("Set 1000B-T Ctrl =0x%04X\n", C1000BaseT));
/* Write AutoNeg Advertisement Register */ /* Write AutoNeg Advertisement Register */
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_AUNE_ADV, AutoNegAdv); SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_AUNE_ADV, AutoNegAdv);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("Auto-Neg.Ad.=0x%04X\n", AutoNegAdv)); ("Set Auto-Neg.Adv.=0x%04X\n", AutoNegAdv));
#endif /* VCPU */ #endif /* VCPU */
if (DoLoop) { if (DoLoop) {
...@@ -2694,6 +3093,8 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2694,6 +3093,8 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
/* Write to the PHY Control register */ /* Write to the PHY Control register */
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, PhyCtrl); SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_CTRL, PhyCtrl);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("Set PHY Ctrl Reg.=0x%04X\n", PhyCtrl));
#ifdef VCPU #ifdef VCPU
VCpuWait(2000); VCpuWait(2000);
...@@ -2712,7 +3113,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2712,7 +3113,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_LED_CTRL, LedCtrl); SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_LED_CTRL, LedCtrl);
if ((pAC->GIni.GILedBlinkCtrl & SK_LED_LINK100_ON) != 0) { if ((pAC->GIni.GILedBlinkCtrl & SK_LED_LINK100_ON) != 0) {
/* only in forced 100Mbps mode */ /* only in forced 100 Mbps mode */
if (!AutoNeg && pPrt->PLinkSpeed == SK_LSPEED_100MBPS) { if (!AutoNeg && pPrt->PLinkSpeed == SK_LSPEED_100MBPS) {
SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_LED_OVER, SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_LED_OVER,
...@@ -2741,7 +3142,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2741,7 +3142,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
/* Read AutoNeg Advertisement Register */ /* Read AutoNeg Advertisement Register */
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_AUNE_ADV, &AutoNegAdv); SkGmPhyRead(pAC, IoC, Port, PHY_MARV_AUNE_ADV, &AutoNegAdv);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("Auto-Neg. Ad.=0x%04X\n", AutoNegAdv)); ("Auto-Neg.Adv.=0x%04X\n", AutoNegAdv));
/* Read Ext. PHY Specific Control */ /* Read Ext. PHY Specific Control */
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_EXT_CTRL, &ExtPhyCtrl); SkGmPhyRead(pAC, IoC, Port, PHY_MARV_EXT_CTRL, &ExtPhyCtrl);
...@@ -2818,13 +3219,15 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2818,13 +3219,15 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
/* Auto-negotiation ? */ /* Auto-negotiation ? */
if (pPrt->PLinkMode == SK_LMODE_HALF || pPrt->PLinkMode == SK_LMODE_FULL) { if (pPrt->PLinkMode == SK_LMODE_HALF || pPrt->PLinkMode == SK_LMODE_FULL) {
/* /*
* level one spec say: "1000Mbps: manual mode not allowed" * level one spec say: "1000 Mbps: manual mode not allowed"
* but lets see what happens... * but lets see what happens...
*/ */
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("InitPhyLone: no auto-negotiation Port %d\n", Port)); ("InitPhyLone: no auto-negotiation Port %d\n", Port));
/* Set DuplexMode in Config register */ /* Set DuplexMode in Config register */
Ctrl1 = (pPrt->PLinkMode == SK_LMODE_FULL ? PHY_CT_DUP_MD : 0); if (pPrt->PLinkMode == SK_LMODE_FULL) {
Ctrl1 |= PHY_CT_DUP_MD;
}
/* Determine Master/Slave manually if not already done */ /* Determine Master/Slave manually if not already done */
if (pPrt->PMSMode == SK_MS_MODE_AUTO) { if (pPrt->PMSMode == SK_MS_MODE_AUTO) {
...@@ -2857,6 +3260,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2857,6 +3260,7 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
SKERR_HWI_E015MSG); SKERR_HWI_E015MSG);
} }
/* Set Flow-control capabilities */
switch (pPrt->PFlowCtrlMode) { switch (pPrt->PFlowCtrlMode) {
case SK_FLOW_MODE_NONE: case SK_FLOW_MODE_NONE:
Ctrl3 |= PHY_L_P_NO_PAUSE; Ctrl3 |= PHY_L_P_NO_PAUSE;
...@@ -2877,7 +3281,6 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ ...@@ -2877,7 +3281,6 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */
/* Restart Auto-negotiation */ /* Restart Auto-negotiation */
Ctrl1 = PHY_CT_ANE | PHY_CT_RE_CFG; Ctrl1 = PHY_CT_ANE | PHY_CT_RE_CFG;
} }
/* Write 1000Base-T Control Register */ /* Write 1000Base-T Control Register */
...@@ -3019,10 +3422,10 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -3019,10 +3422,10 @@ int Port) /* Port Index (MAC_1 + n) */
/* Check Duplex mismatch */ /* Check Duplex mismatch */
if ((ResAb & (PHY_X_RS_HD | PHY_X_RS_FD)) == PHY_X_RS_FD) { if ((ResAb & (PHY_X_RS_HD | PHY_X_RS_FD)) == PHY_X_RS_FD) {
pPrt->PLinkModeStatus = SK_LMODE_STAT_AUTOFULL; pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_AUTOFULL;
} }
else if ((ResAb & (PHY_X_RS_HD | PHY_X_RS_FD)) == PHY_X_RS_HD) { else if ((ResAb & (PHY_X_RS_HD | PHY_X_RS_FD)) == PHY_X_RS_HD) {
pPrt->PLinkModeStatus = SK_LMODE_STAT_AUTOHALF; pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_AUTOHALF;
} }
else { else {
/* Error */ /* Error */
...@@ -3055,7 +3458,7 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -3055,7 +3458,7 @@ int Port) /* Port Index (MAC_1 + n) */
/* PAUSE mismatch -> no PAUSE */ /* PAUSE mismatch -> no PAUSE */
pPrt->PFlowCtrlStatus = SK_FLOW_STAT_NONE; pPrt->PFlowCtrlStatus = SK_FLOW_STAT_NONE;
} }
pPrt->PLinkSpeedUsed = SK_LSPEED_STAT_1000MBPS; pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_1000MBPS;
return(SK_AND_OK); return(SK_AND_OK);
} /* SkXmAutoNegDoneXmac */ } /* SkXmAutoNegDoneXmac */
...@@ -3110,10 +3513,10 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -3110,10 +3513,10 @@ int Port) /* Port Index (MAC_1 + n) */
/* Check Duplex mismatch */ /* Check Duplex mismatch */
if ((AuxStat & PHY_B_AS_AN_RES_MSK) == PHY_B_RES_1000FD) { if ((AuxStat & PHY_B_AS_AN_RES_MSK) == PHY_B_RES_1000FD) {
pPrt->PLinkModeStatus = SK_LMODE_STAT_AUTOFULL; pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_AUTOFULL;
} }
else if ((AuxStat & PHY_B_AS_AN_RES_MSK) == PHY_B_RES_1000HD) { else if ((AuxStat & PHY_B_AS_AN_RES_MSK) == PHY_B_RES_1000HD) {
pPrt->PLinkModeStatus = SK_LMODE_STAT_AUTOHALF; pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_AUTOHALF;
} }
else { else {
/* Error */ /* Error */
...@@ -3156,7 +3559,7 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -3156,7 +3559,7 @@ int Port) /* Port Index (MAC_1 + n) */
/* PAUSE mismatch -> no PAUSE */ /* PAUSE mismatch -> no PAUSE */
pPrt->PFlowCtrlStatus = SK_FLOW_STAT_NONE; pPrt->PFlowCtrlStatus = SK_FLOW_STAT_NONE;
} }
pPrt->PLinkSpeedUsed = SK_LSPEED_STAT_1000MBPS; pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_1000MBPS;
return(SK_AND_OK); return(SK_AND_OK);
} /* SkXmAutoNegDoneBcom */ } /* SkXmAutoNegDoneBcom */
...@@ -3192,6 +3595,8 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -3192,6 +3595,8 @@ int Port) /* Port Index (MAC_1 + n) */
/* Get PHY parameters */ /* Get PHY parameters */
SkGmPhyRead(pAC, IoC, Port, PHY_MARV_AUNE_LP, &LPAb); SkGmPhyRead(pAC, IoC, Port, PHY_MARV_AUNE_LP, &LPAb);
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("Link P.Abil.=0x%04X\n", LPAb));
if ((LPAb & PHY_M_AN_RF) != 0) { if ((LPAb & PHY_M_AN_RF) != 0) {
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
...@@ -3222,15 +3627,15 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -3222,15 +3627,15 @@ int Port) /* Port Index (MAC_1 + n) */
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("AutoNegFail: Speed & Duplex not resolved, Port %d\n", Port)); ("AutoNegFail: Speed & Duplex not resolved, Port %d\n", Port));
pPrt->PAutoNegFail = SK_TRUE; pPrt->PAutoNegFail = SK_TRUE;
pPrt->PLinkModeStatus = SK_LMODE_STAT_UNKNOWN; pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_UNKNOWN;
return(SK_AND_DUP_CAP); return(SK_AND_DUP_CAP);
} }
if ((AuxStat & PHY_M_PS_FULL_DUP) != 0) { if ((AuxStat & PHY_M_PS_FULL_DUP) != 0) {
pPrt->PLinkModeStatus = SK_LMODE_STAT_AUTOFULL; pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_AUTOFULL;
} }
else { else {
pPrt->PLinkModeStatus = SK_LMODE_STAT_AUTOHALF; pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_AUTOHALF;
} }
/* Check PAUSE mismatch ??? */ /* Check PAUSE mismatch ??? */
...@@ -3255,13 +3660,13 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -3255,13 +3660,13 @@ int Port) /* Port Index (MAC_1 + n) */
/* set used link speed */ /* set used link speed */
switch ((unsigned)(AuxStat & PHY_M_PS_SPEED_MSK)) { switch ((unsigned)(AuxStat & PHY_M_PS_SPEED_MSK)) {
case (unsigned)PHY_M_PS_SPEED_1000: case (unsigned)PHY_M_PS_SPEED_1000:
pPrt->PLinkSpeedUsed = SK_LSPEED_STAT_1000MBPS; pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_1000MBPS;
break; break;
case PHY_M_PS_SPEED_100: case PHY_M_PS_SPEED_100:
pPrt->PLinkSpeedUsed = SK_LSPEED_STAT_100MBPS; pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_100MBPS;
break; break;
default: default:
pPrt->PLinkSpeedUsed = SK_LSPEED_STAT_10MBPS; pPrt->PLinkSpeedUsed = (SK_U8)SK_LSPEED_STAT_10MBPS;
} }
return(SK_AND_OK); return(SK_AND_OK);
...@@ -3312,10 +3717,10 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -3312,10 +3717,10 @@ int Port) /* Port Index (MAC_1 + n) */
/* Check Duplex mismatch */ /* Check Duplex mismatch */
if ((QuickStat & PHY_L_QS_DUP_MOD) != 0) { if ((QuickStat & PHY_L_QS_DUP_MOD) != 0) {
pPrt->PLinkModeStatus = SK_LMODE_STAT_AUTOFULL; pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_AUTOFULL;
} }
else { else {
pPrt->PLinkModeStatus = SK_LMODE_STAT_AUTOHALF; pPrt->PLinkModeStatus = (SK_U8)SK_LMODE_STAT_AUTOHALF;
} }
/* Check Master/Slave resolution */ /* Check Master/Slave resolution */
...@@ -3338,6 +3743,7 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -3338,6 +3743,7 @@ int Port) /* Port Index (MAC_1 + n) */
/* We are using IEEE 802.3z/D5.0 Table 37-4 */ /* We are using IEEE 802.3z/D5.0 Table 37-4 */
/* we must manually resolve the abilities here */ /* we must manually resolve the abilities here */
pPrt->PFlowCtrlStatus = SK_FLOW_STAT_NONE; pPrt->PFlowCtrlStatus = SK_FLOW_STAT_NONE;
switch (pPrt->PFlowCtrlMode) { switch (pPrt->PFlowCtrlMode) {
case SK_FLOW_MODE_NONE: case SK_FLOW_MODE_NONE:
/* default */ /* default */
...@@ -3457,6 +3863,9 @@ int Port) /* Port Index (MAC_1 + n) */ ...@@ -3457,6 +3863,9 @@ int Port) /* Port Index (MAC_1 + n) */
return(Rtv); return(Rtv);
} }
SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL,
("AutoNeg done Port %d\n", Port));
/* We checked everything and may now enable the link */ /* We checked everything and may now enable the link */
pPrt->PAutoNegFail = SK_FALSE; pPrt->PAutoNegFail = SK_FALSE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment