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).
...@@ -566,6 +602,15 @@ struct s_AC { ...@@ -566,6 +602,15 @@ struct s_AC {
* 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.*/
...@@ -1132,13 +1143,16 @@ extern "C" { ...@@ -1132,13 +1143,16 @@ extern "C" {
/* 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 */
#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 */ /* 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 */
...@@ -1151,7 +1165,7 @@ extern "C" { ...@@ -1151,7 +1165,7 @@ 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 */
...@@ -1227,15 +1241,15 @@ extern "C" { ...@@ -1227,15 +1241,15 @@ extern "C" {
#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 */
...@@ -1441,10 +1455,10 @@ extern "C" { ...@@ -1441,10 +1455,10 @@ extern "C" {
/* 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 */
......
/****************************************************************************** /******************************************************************************
* *
* 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
...@@ -45,10 +48,6 @@ ...@@ -45,10 +48,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,31 +172,31 @@ ...@@ -166,31 +172,31 @@
*/ */
#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 */
...@@ -232,7 +238,6 @@ ...@@ -232,7 +238,6 @@
#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
*/ */
......
...@@ -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.
...@@ -577,6 +589,14 @@ ...@@ -577,6 +589,14 @@
#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.
* *
*
******************************************************************************/ ******************************************************************************/
/* /*
...@@ -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.
...@@ -75,8 +78,6 @@ ...@@ -75,8 +78,6 @@
* 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"
This diff is collapsed.
...@@ -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
......
This diff is collapsed.
/****************************************************************************** /******************************************************************************
* *
* 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.
* *
...@@ -70,18 +74,14 @@ ...@@ -70,18 +74,14 @@
* 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) ;
pAC->Hwt.TActive = SK_FALSE ; SK_OUT16(Ioc, B2_TI_CTRL, TIM_CLR_IRQ);
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;
...@@ -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),
......
This diff is collapsed.
...@@ -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:
if (pPrt->PState == SK_PRT_RESET) {
PortStat = SK_HW_PS_NONE;
}
else {
/* Check whether port came up */ /* Check whether port came up */
PortStat = SkGePortCheckUp(pAC, IoC, (int)Port); 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"
...@@ -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 */
...@@ -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,22 +721,23 @@ SK_U32 SkI2cRead( ...@@ -708,22 +721,23 @@ 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,7 +776,7 @@ SK_AC *pAC) /* Adapter Context */ ...@@ -761,7 +776,7 @@ 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;
...@@ -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;
...@@ -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++;
......
/****************************************************************************** /******************************************************************************
* *
* 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);
} }
This diff is collapsed.
/****************************************************************************** /******************************************************************************
* *
* 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.
...@@ -86,17 +90,15 @@ ...@@ -86,17 +90,15 @@
* 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 */
...@@ -128,7 +130,7 @@ int Level) /* Init level */ ...@@ -128,7 +130,7 @@ 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;
PRINTF("dispatch get %x put %x\n", pEv, pAC->Event.ev_put);
pEv = pAC->Event.EvGet ;
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.
* *
...@@ -69,18 +73,15 @@ ...@@ -69,18 +73,15 @@
* 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 */
...@@ -114,10 +115,10 @@ int Level) /* Init Level */ ...@@ -114,10 +115,10 @@ 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,7 +247,7 @@ void SkTimerDone( ...@@ -241,7 +247,7 @@ 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);
} }
...@@ -250,46 +256,47 @@ SK_AC *pAC, /* Adapters context */ ...@@ -250,46 +256,47 @@ 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);
} }
} }
......
This diff is collapsed.
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