* Add support for SK98xx driver

* Add PCI support for SL8245 board

* Support IceCube board configurations with 1 x AMD AM29LV065 (8 MB)
  or 1 x AM29LV652 (two LV065 in one chip = 16 MB);
  Run IPB at 133 Mhz; adjust the MII clock frequency accordingly

* Set BRG_CLK on PM825/826 to 64MHz (VCO_OUT / 4, instead of 16  MHz)
  to allow for more accurate baudrate settings
  (error now 0.7% at 115 kbps, instead of 3.5% before)

* Patch by Andreas Mohr, 4 Sep 2003:
  Fix a lot of spelling errors
master
wdenk 22 years ago
parent 4d816774f1
commit 7152b1d0b3
  1. 15
      CHANGELOG
  2. 4
      Makefile
  3. 58
      README
  4. 27
      board/icecube/flash.c
  5. 10
      board/icecube/icecube.c
  6. 1
      board/sl8245/config.mk
  7. 9
      board/sl8245/sl8245.c
  8. 6
      common/cmd_doc.c
  9. 16
      cpu/mpc5xxx/cpu_init.c
  10. 5
      cpu/mpc5xxx/fec.c
  11. 6
      doc/README.POST
  12. 102
      drivers/sk98lin/Makefile
  13. 197
      drivers/sk98lin/h/lm80.h
  14. 425
      drivers/sk98lin/h/skaddr.h
  15. 261
      drivers/sk98lin/h/skcsum.h
  16. 119
      drivers/sk98lin/h/skdebug.h
  17. 265
      drivers/sk98lin/h/skdrv1st.h
  18. 565
      drivers/sk98lin/h/skdrv2nd.h
  19. 80
      drivers/sk98lin/h/skerror.h
  20. 72
      drivers/sk98lin/h/skgedrv.h
  21. 2336
      drivers/sk98lin/h/skgehw.h
  22. 74
      drivers/sk98lin/h/skgehwt.h
  23. 299
      drivers/sk98lin/h/skgei2c.h
  24. 1113
      drivers/sk98lin/h/skgeinit.h
  25. 462
      drivers/sk98lin/h/skgepnm2.h
  26. 1114
      drivers/sk98lin/h/skgepnmi.h
  27. 194
      drivers/sk98lin/h/skgesirq.h
  28. 291
      drivers/sk98lin/h/ski2c.h
  29. 148
      drivers/sk98lin/h/skqueue.h
  30. 563
      drivers/sk98lin/h/skrlmt.h
  31. 99
      drivers/sk98lin/h/sktimer.h
  32. 87
      drivers/sk98lin/h/sktypes.h
  33. 54
      drivers/sk98lin/h/skversion.h
  34. 335
      drivers/sk98lin/h/skvpd.h
  35. 1738
      drivers/sk98lin/h/xmac_ii.h
  36. 1874
      drivers/sk98lin/skaddr.c
  37. 923
      drivers/sk98lin/skcsum.c
  38. 4870
      drivers/sk98lin/skge.c
  39. 214
      drivers/sk98lin/skgehwt.c
  40. 2366
      drivers/sk98lin/skgeinit.c
  41. 1056
      drivers/sk98lin/skgemib.c
  42. 8305
      drivers/sk98lin/skgepnmi.c
  43. 2411
      drivers/sk98lin/skgesirq.c
  44. 1499
      drivers/sk98lin/ski2c.c
  45. 286
      drivers/sk98lin/sklm80.c
  46. 515
      drivers/sk98lin/skproc.c
  47. 236
      drivers/sk98lin/skqueue.c
  48. 3502
      drivers/sk98lin/skrlmt.c
  49. 291
      drivers/sk98lin/sktimer.c
  50. 1325
      drivers/sk98lin/skvpd.c
  51. 4392
      drivers/sk98lin/skxmac2.c
  52. 98
      drivers/sk98lin/u-boot_compat.h
  53. 143
      drivers/sk98lin/uboot_drv.c
  54. 116
      drivers/sk98lin/uboot_skb.c
  55. 16
      include/configs/IceCube.h
  56. 4
      include/configs/P3G4.h
  57. 2
      include/configs/PM826.h
  58. 15
      include/configs/SL8245.h
  59. 9
      include/mpc5xxx.h
  60. 1
      include/pci_ids.h
  61. 4
      net/eth.c

@ -2,6 +2,21 @@
Changes for U-Boot 0.4.7:
======================================================================
* Add support for SK98xx driver
* Add PCI support for SL8245 board
* Support IceCube board configurations with 1 x AMD AM29LV065 (8 MB)
or 1 x AM29LV652 (two LV065 in one chip = 16 MB);
Run IPB at 133 Mhz; adjust the MII clock frequency accordingly
* Set BRG_CLK on PM825/826 to 64MHz (VCO_OUT / 4, instead of 16 MHz)
to allow for more accurate baudrate settings
(error now 0.7% at 115 kbps, instead of 3.5% before)
* Patch by Andreas Mohr, 4 Sep 2003:
Fix a lot of spelling errors
* Add support for PPChameleon Eval Board
* Add support for P3G4 board

@ -87,6 +87,7 @@ SUBDIRS = tools \
rtc \
dtt \
drivers \
drivers/sk98lin \
post \
post/cpu \
examples
@ -112,6 +113,7 @@ LIBS += disk/libdisk.a
LIBS += rtc/librtc.a
LIBS += dtt/libdtt.a
LIBS += drivers/libdrivers.a
LIBS += drivers/sk98lin/libsk98lin.a
LIBS += post/libpost.a post/cpu/libcpu.a
LIBS += common/libcommon.a
LIBS += lib_generic/libgeneric.a
@ -142,7 +144,7 @@ u-boot.dis: u-boot
u-boot: depend subdirs $(OBJS) $(LIBS) $(LDSCRIPT)
UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
$(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \
--start-group $(LIBS) --end-group \
--start-group $(LIBS) $(PLATFORM_LIBS) --end-group \
-Map u-boot.map -o u-boot
subdirs:

@ -119,12 +119,12 @@ U-Boot will always have a patchlevel of "0".
Directory Hierarchy:
====================
- board Board dependend files
- common Misc architecture independend functions
- board Board dependent files
- common Misc architecture independent functions
- cpu CPU specific files
- disk Code for disk drive partition handling
- doc Documentation (don't expect too much)
- drivers Common used device drivers
- drivers Commonly used device drivers
- dtt Digital Thermometer and Thermostat drivers
- examples Example code for standalone applications, etc.
- include Header Files
@ -644,7 +644,7 @@ The following options need to be configured:
- Watchdog:
CONFIG_WATCHDOG
If this variable is defined, it enables watchdog
support. There must support in the platform specific
support. There must be support in the platform specific
code for a watchdog. For the 8xx and 8260 CPUs, the
SIU Watchdog feature is enabled in the SYPCR
register.
@ -852,7 +852,7 @@ The following options need to be configured:
Normally display is black on white background; define
CFG_WHITE_ON_BLACK to get it inverted.
- Spash Screen Support: CONFIG_SPLASH_SCREEN
- Splash Screen Support: CONFIG_SPLASH_SCREEN
If this option is set, the environment is checked for
a variable "splashimage". If found, the usual display
@ -1203,7 +1203,7 @@ The following options need to be configured:
U-Boot considers the values of the environment
variables "serial#" (Board Serial Number) and
"ethaddr" (Ethernet Address) to bb parameters that
"ethaddr" (Ethernet Address) to be parameters that
are set once by the board vendor / manufacturer, and
protects these variables from casual modification by
the user. Once set, these variables are read-only,
@ -1318,7 +1318,7 @@ The following options need to be configured:
Define this to contain any number of null terminated
strings (variable = value pairs) that will be part of
the default enviroment compiled into the boot image.
the default environment compiled into the boot image.
For example, place something like this in your
board's config file:
@ -1331,7 +1331,7 @@ The following options need to be configured:
internal format how the environment is stored by the
U-Boot code. This is NOT an official, exported
interface! Although it is unlikely that this format
will change soon, but there is no guarantee either.
will change soon, there is no guarantee either.
You better know what you are doing here.
Note: overly (ab)use of the default environment is
@ -1769,7 +1769,7 @@ Low Level (hardware related) configuration options:
- CFG_INIT_RAM_ADDR:
Start address of memory area tha can be used for
Start address of memory area that can be used for
initial data and stack; please note that this must be
writable memory that is working WITHOUT special
initialization, i. e. you CANNOT use normal RAM which
@ -1941,7 +1941,7 @@ Note: for some board special configuration names may exist; check if
Finally, type "make all", and you should get some working U-Boot
images ready for downlod to / installation on your system:
images ready for download to / installation on your system:
- "u-boot.bin" is a raw binary image
- "u-boot" is an image in ELF binary format
@ -1960,7 +1960,7 @@ steps:
1. Add a new configuration option for your board to the toplevel
"Makefile" and to the "MAKEALL" script, using the existing
entries as examples. Note that here and at many other places
boards and other names are listed alphabetically sorted. Please
boards and other names are listed in alphabetical sort order. Please
keep this order.
2. Create a new directory to hold your board specific code. Add any
files you need. In your board directory, you will need at least
@ -1990,7 +1990,7 @@ cation did not break existing code. At least make sure that *ALL* of
the supported boards compile WITHOUT ANY compiler warnings. To do so,
just run the "MAKEALL" script, which will configure and build U-Boot
for ALL supported system. Be warned, this will take a while. You can
select which (cross) compiler to use py passing a `CROSS_COMPILE'
select which (cross) compiler to use by passing a `CROSS_COMPILE'
environment variable to the script, i. e. to use the cross tools from
MontaVista's Hard Hat Linux you can type
@ -2117,10 +2117,10 @@ Some configuration options can be set using Environment Variables:
does not overwrite the U-Boot stack and data).
For instance, when you have a system with 16 MB
RAM, and want to reseve 4 MB from use by Linux,
RAM, and want to reserve 4 MB from use by Linux,
you can do this by adding "mem=12M" to the value of
the "bootargs" variable. However, now you must make
sure, that the initrd image is placed in the first
sure that the initrd image is placed in the first
12 MB as well - this can be done with
setenv initrd_high 00c00000
@ -2189,8 +2189,8 @@ only effect after the next boot (yes, that's just like Windoze :-).
Command Line Parsing:
=====================
There are two different command line parsers available with U-Boot:
the old "simple" one, and the much more pwerful "hush" shell:
There are two different command line parsers available with U-Boot:
the old "simple" one, and the much more powerful "hush" shell:
Old, simple command line parser:
--------------------------------
@ -2231,9 +2231,9 @@ General rules:
Note for Redundant Ethernet Interfaces:
=======================================
Some boards come with redundand ethernet interfaces; U-Boot supports
Some boards come with redundant ethernet interfaces; U-Boot supports
such configurations and is capable of automatic selection of a
"working" interface when needed. MAC assignemnt works as follows:
"working" interface when needed. MAC assignment works as follows:
Network interfaces are numbered eth0, eth1, eth2, ... Corresponding
MAC addresses can be stored in the environment as "ethaddr" (=>eth0),
@ -2292,21 +2292,21 @@ Linux Support:
==============
Although U-Boot should support any OS or standalone application
easily, Linux has always been in the focus during the design of
easily, the main focus has always been on Linux during the design of
U-Boot.
U-Boot includes many features that so far have been part of some
special "boot loader" code within the Linux kernel. Also, any
"initrd" images to be used are no longer part of one big Linux image;
instead, kernel and "initrd" are separate images. This implementation
serves serveral purposes:
serves several purposes:
- the same features can be used for other OS or standalone
applications (for instance: using compressed images to reduce the
Flash memory footprint)
- it becomes much easier to port new Linux kernel versions because
lots of low-level, hardware dependend stuff are done by U-Boot
lots of low-level, hardware dependent stuff are done by U-Boot
- the same Linux kernel image can now be used with different "initrd"
images; of course this also means that different kernel images can
@ -2558,7 +2558,7 @@ parameters. You can check and modify this variable using the
...
If you want to boot a Linux kernel with initial ram disk, you pass
the memory addreses of both the kernel and the initrd image (PPBCOOT
the memory addresses of both the kernel and the initrd image (PPBCOOT
format!) to the "bootm" command:
=> imi 40100000 40200000
@ -2738,7 +2738,7 @@ Hit 'q':
Minicom warning:
================
Over time, many people have reported problems when trying to used the
Over time, many people have reported problems when trying to use the
"minicom" terminal emulation program for serial download. I (wd)
consider minicom to be broken, and recommend not to use it. Under
Unix, I recommend to use C-Kermit for general purpose use (and
@ -2806,7 +2806,7 @@ models provide on-chip memory (like the IMMR area on MPC8xx and
MPC826x processors), on others (parts of) the data cache can be
locked as (mis-) used as memory, etc.
Chris Hallinan posted a good summy of these issues to the
Chris Hallinan posted a good summary of these issues to the
u-boot-users mailing list:
Subject: RE: [U-Boot-Users] RE: More On Memory Bank x (nothingness)?
@ -2852,9 +2852,9 @@ code for the initialization procedures:
* Do not use any unitialized global data (or implicitely initialized
as zero data - BSS segment) at all - this is undefined, initiali-
zation is performed later (when relocationg to RAM).
zation is performed later (when relocating to RAM).
* Stack space is very limited. Avoid big data buffers or things like
* Stack space is very limited. Avoid big data buffers or things like
that.
Having only the stack as writable memory limits means we cannot use
@ -2867,7 +2867,7 @@ the GCC compiler (Global Register Variables) to share the data: we
place a pointer (gd) to the global data into a register which we
reserve for this purpose.
When chosing a register for such a purpose we are restricted by the
When choosing a register for such a purpose we are restricted by the
relevant (E)ABI specifications for the current architecture, and by
GCC's implementation.
@ -2957,7 +2957,7 @@ System Initialization:
In the reset configuration, U-Boot starts at the reset entry point
(on most PowerPC systens at address 0x00000100). Because of the reset
configuration for CS0# this is a mirror of the onboard Flash memory.
To be able to re-map memory U-Boot then jumps to it's link address.
To be able to re-map memory U-Boot then jumps to its link address.
To be able to implement the initialization code in C, a (small!)
initial stack is set up in the internal Dual Ported RAM (in case CPUs
which provide such a feature like MPC8xx or MPC8260), or in a locked
@ -2973,7 +2973,7 @@ simple memory test is run that determines the size of the SDRAM
banks.
When there is more than one SDRAM bank, and the banks are of
different size, the larger is mapped first. For equal size, the first
different size, the largest is mapped first. For equal size, the first
bank (CS2#) is mapped first. The first mapping is always for address
0x00000000, with any additional banks following immediately to create
contiguous memory starting from 0.

@ -64,24 +64,20 @@ unsigned long flash_init (void)
unsigned long size = 0;
int i;
extern void flash_preinit(void);
extern void flash_afterinit(ulong);
ulong flashbase = CFG_FLASH_BASE;
flash_preinit();
/* Init: no FLASHes known */
for (i=0; i < CFG_MAX_FLASH_BANKS; ++i) {
ulong flashbase = CFG_FLASH_BASE;
memset(&flash_info[i], 0, sizeof(flash_info_t));
flash_info[i].size =
flash_get_size((FPW *)flashbase, &flash_info[i]);
if (flash_info[i].flash_id == FLASH_UNKNOWN) {
printf ("## Unknown FLASH on Bank %d - Size = 0x%08lx\n",
i, flash_info[i].size);
}
size += flash_info[i].size;
flashbase += 0x800000;
}
#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
/* monitor protection ON by default */
@ -100,6 +96,7 @@ unsigned long flash_init (void)
#endif
flash_afterinit(size);
return size ? size : 1;
}
@ -126,7 +123,8 @@ static flash_info_t *flash_get_info(ulong base)
for (i = 0; i < CFG_MAX_FLASH_BANKS; i ++) {
info = & flash_info[i];
if (info->start[0] <= base && base <= info->start[0] + info->size - 1)
if (info->size &&
info->start[0] <= base && base <= info->start[0] + info->size - 1)
break;
}
@ -211,6 +209,8 @@ void flash_print_info (flash_info_t *info)
ulong flash_get_size (FPWV *addr, flash_info_t *info)
{
int i;
FPWV* addr2;
/* Write auto select command: read Manufacturer ID */
/* Write auto select command sequence and test FLASH answer */
addr[FLASH_CYCLE1] = (FPW)0x00AA00AA; /* for AMD, Intel ignores this */
@ -256,6 +256,17 @@ ulong flash_get_size (FPWV *addr, flash_info_t *info)
return (0); /* => no or unknown flash */
}
/* test for real flash at bank 1 */
addr2 = (FPW *)((ulong)addr | 0x800000);
if (addr2 != addr &&
((addr2[0] & 0xff) == (addr[0] & 0xff)) && ((FPW)addr2[1] == (FPW)addr[1])) {
/* Seems 2 banks are the same space (8Mb chip is installed,
* J24 in default position (CS0)). Disable this (first) bank.
*/
info->flash_id = FLASH_UNKNOWN;
info->sector_count = 0;
info->size = 0;
}
/* Put FLASH back in read mode */
flash_reset(info);

@ -171,6 +171,16 @@ void flash_preinit(void)
*(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
}
void flash_afterinit(ulong size)
{
if (size == 0x800000) { /* adjust mapping */
*(vu_long *)MPC5XXX_BOOTCS_START = *(vu_long *)MPC5XXX_CS0_START =
START_REG(CFG_BOOTCS_START | size);
*(vu_long *)MPC5XXX_BOOTCS_STOP = *(vu_long *)MPC5XXX_CS0_STOP =
STOP_REG(CFG_BOOTCS_START | size, size);
}
}
#ifdef CONFIG_PCI
static struct pci_controller hose;

@ -28,3 +28,4 @@
TEXT_BASE = 0xFFF00000
PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
PLATFORM_LIBS += $(shell $(CC) -print-libgcc-file-name)

@ -23,6 +23,7 @@
#include <common.h>
#include <mpc824x.h>
#include <pci.h>
int checkboard (void)
{
@ -84,3 +85,11 @@ Done:
return CFG_MAX_RAM_SIZE;
#endif
}
static struct pci_controller hose;
void pci_init_board(void)
{
pci_mpc824x_init(&hose);
}

@ -525,7 +525,7 @@ static int DoC_Address(struct DiskOnChip *doc, int numbytes, unsigned long ofs,
return DoC_WaitReady(doc);
}
/* Read a buffer from DoC, taking care of Millennium odditys */
/* Read a buffer from DoC, taking care of Millennium oddities */
static void DoC_ReadBuf(struct DiskOnChip *doc, u_char * buf, int len)
{
volatile int dummy;
@ -558,7 +558,7 @@ static void DoC_ReadBuf(struct DiskOnChip *doc, u_char * buf, int len)
}
}
/* Write a buffer to DoC, taking care of Millennium odditys */
/* Write a buffer to DoC, taking care of Millennium oddities */
static void DoC_WriteBuf(struct DiskOnChip *doc, const u_char * buf, int len)
{
unsigned long docptr;
@ -992,7 +992,7 @@ int doc_read_ecc(struct DiskOnChip* this, loff_t from, size_t len,
printf("ECC needs a full sector read (adr: %lx size %lx)\n",
(long) from, (long) len);
#ifdef PHYCH_DEBUG
#ifdef PSYCHO_DEBUG
printf("DoC_Read (adr: %lx size %lx)\n", (long) from, (long) len);
#endif

@ -24,14 +24,6 @@
#include <common.h>
#include <mpc5xxx.h>
#if defined(CONFIG_MGT5100)
#define START_REG(start) ((start) >> 15)
#define STOP_REG(start, size) (((start) + (size) - 1) >> 15)
#elif defined(CONFIG_MPC5200)
#define START_REG(start) ((start) >> 16)
#define STOP_REG(start, size) (((start) + (size) - 1) >> 16)
#endif
/*
* Breath some life into the CPU...
*
@ -159,6 +151,14 @@ void cpu_init_f (void)
#if defined(CONFIG_MPC5200)
/* enable timebase */
*(vu_long *)(MPC5XXX_XLBARB + 0x40) |= (1 << 13);
/* Motorola reports IPB should better run at 133 MHz. */
*(vu_long *)MPC5XXX_ADDECR |= 1;
/* pci_clk_sel = 0x02, ipb_clk_sel = 0x00; */
addecr = *(vu_long *)MPC5XXX_CDM_CFG;
addecr &= ~0x103;
addecr |= 0x02;
*(vu_long *)MPC5XXX_CDM_CFG = addecr;
#endif
}

@ -208,6 +208,7 @@ static void mpc5xxx_fec_set_hwaddr(mpc5xxx_fec_priv *fec, char *mac)
/********************************************************************/
static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
{
DECLARE_GLOBAL_DATA_PTR;
mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA;
const uint8 phyAddr = 0; /* Only one PHY */
@ -269,10 +270,10 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
fec->eth->x_cntrl = 0x00000004; /* full-duplex, heartbeat disabled */
/*
* Set MII_SPEED = (1/(mii_speed * 2)) * System Clock(25Mhz)
* Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
* and do not drop the Preamble.
*/
fec->eth->mii_speed = (0x5 << 1); /* No MII for 7-wire mode */
fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
}
/*

@ -5,7 +5,7 @@ This project is to support Power-On-Self-Test (POST) in U-Boot.
1. High-level requirements
The key rquirements for this project are as follows:
The key requirements for this project are as follows:
1) The project shall develop a flexible framework for implementing
and running Power-On-Self-Test in U-Boot. This framework shall
@ -72,7 +72,7 @@ tests. All POST tests will be divided into the following groups:
This group will contain those tests that do not take much
time and can be run on the regular basis (e.g. CPU test)
3) Tests running on in special "slow test more" only
3) Tests running in special "slow test mode" only
This group will contain POST tests that consume much time
and cannot be run regularly (e.g. strong memory test, I2C test)
@ -92,7 +92,7 @@ Specifically, the following groups will be singled out:
1) Tests running before relocating to RAM
These tests will run immediatelly after initializing RAM
These tests will run immediately after initializing RAM
as to enable modifying it without taking care of its
contents. Basically, this group will contain memory tests
only.

@ -0,0 +1,102 @@
#
# (C) Copyright 2003
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
# See file CREDITS for list of people who contributed to this
# project.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
# File: drivers/sk98lin/Makefile
#
# Makefile for the SysKonnect SK-98xx device driver.
#
LIB := libsk98lin.a
OBJS := skge.o skaddr.o skgehwt.o skgeinit.o skgepnmi.o skgesirq.o \
ski2c.o sklm80.o skqueue.o skrlmt.o sktimer.o skvpd.o \
skxmac2.o skcsum.o #skproc.o
OBJS += uboot_skb.o uboot_drv.o
# DBGDEF = \
# -DDEBUG
ifdef DEBUG
DBGDEF += \
-DSK_DEBUG_CHKMOD=0x00000000L \
-DSK_DEBUG_CHKCAT=0x00000000L
endif
# **** possible debug modules for SK_DEBUG_CHKMOD *****************
# SK_DBGMOD_MERR 0x00000001L /* general module error indication */
# SK_DBGMOD_HWM 0x00000002L /* Hardware init module */
# SK_DBGMOD_RLMT 0x00000004L /* RLMT module */
# SK_DBGMOD_VPD 0x00000008L /* VPD module */
# SK_DBGMOD_I2C 0x00000010L /* I2C module */
# SK_DBGMOD_PNMI 0x00000020L /* PNMI module */
# SK_DBGMOD_CSUM 0x00000040L /* CSUM module */
# SK_DBGMOD_ADDR 0x00000080L /* ADDR module */
# SK_DBGMOD_DRV 0x00010000L /* DRV module */
# **** possible debug categories for SK_DEBUG_CHKCAT **************
# *** common modules ***
# SK_DBGCAT_INIT 0x00000001L module/driver initialization
# SK_DBGCAT_CTRL 0x00000002L controlling: add/rmv MCA/MAC and other controls (IOCTL)
# SK_DBGCAT_ERR 0x00000004L error handling paths
# SK_DBGCAT_TX 0x00000008L transmit path
# SK_DBGCAT_RX 0x00000010L receive path
# SK_DBGCAT_IRQ 0x00000020L general IRQ handling
# SK_DBGCAT_QUEUE 0x00000040L any queue management
# SK_DBGCAT_DUMP 0x00000080L large data output e.g. hex dump
# SK_DBGCAT_FATAL 0x00000100L large data output e.g. hex dump
# *** driver (file skge.c) ***
# SK_DBGCAT_DRV_ENTRY 0x00010000 entry points
# SK_DBGCAT_DRV_??? 0x00020000 not used
# SK_DBGCAT_DRV_MCA 0x00040000 multicast
# SK_DBGCAT_DRV_TX_PROGRESS 0x00080000 tx path
# SK_DBGCAT_DRV_RX_PROGRESS 0x00100000 rx path
# SK_DBGCAT_DRV_PROGRESS 0x00200000 general runtime
# SK_DBGCAT_DRV_??? 0x00400000 not used
# SK_DBGCAT_DRV_PROM 0x00800000 promiscuous mode
# SK_DBGCAT_DRV_TX_FRAME 0x01000000 display tx frames
# SK_DBGCAT_DRV_ERROR 0x02000000 error conditions
# SK_DBGCAT_DRV_INT_SRC 0x04000000 interrupts sources
# SK_DBGCAT_DRV_EVENT 0x08000000 driver events
EXTRA_CFLAGS += -I. -DSK_USE_CSUM $(DBGDEF)
CFLAGS += $(EXTRA_CFLAGS)
all: $(LIB)
$(LIB): $(OBJS)
$(AR) crv $@ $(OBJS)
#########################################################################
.depend: Makefile $(OBJS:.o=.c)
$(CC) -M $(CFLAGS) $(OBJS:.o=.c) > $@
sinclude .depend
#########################################################################

@ -0,0 +1,197 @@
/******************************************************************************
*
* Name: lm80.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.4 $
* Date: $Date: 2002/04/25 11:04:10 $
* Purpose: Contains all defines for the LM80 Chip
* (National Semiconductor).
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
* $Log: lm80.h,v $
* Revision 1.4 2002/04/25 11:04:10 rschmidt
* Editorial changes
*
* Revision 1.3 1999/11/22 13:41:19 cgoos
* Changed license header to GPL.
*
* Revision 1.2 1999/03/12 13:26:51 malthoff
* remove __STDC__.
*
* Revision 1.1 1998/06/19 09:28:31 malthoff
* created.
*
*
******************************************************************************/
#ifndef __INC_LM80_H
#define __INC_LM80_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* defines ********************************************************************/
/*
* LM80 register definition
*
* All registers are 8 bit wide
*/
#define LM80_CFG 0x00 /* Configuration Register */
#define LM80_ISRC_1 0x01 /* Interrupt Status Register 1 */
#define LM80_ISRC_2 0x02 /* Interrupt Status Register 2 */
#define LM80_IMSK_1 0x03 /* Interrupt Mask Register 1 */
#define LM80_IMSK_2 0x04 /* Interrupt Mask Register 2 */
#define LM80_FAN_CTRL 0x05 /* Fan Devisor/RST#/OS# Register */
#define LM80_TEMP_CTRL 0x06 /* OS# Config, Temp Res. Reg */
/* 0x07 - 0x1f reserved */
/* current values */
#define LM80_VT0_IN 0x20 /* current Voltage 0 value */
#define LM80_VT1_IN 0x21 /* current Voltage 1 value */
#define LM80_VT2_IN 0x22 /* current Voltage 2 value */
#define LM80_VT3_IN 0x23 /* current Voltage 3 value */
#define LM80_VT4_IN 0x24 /* current Voltage 4 value */
#define LM80_VT5_IN 0x25 /* current Voltage 5 value */
#define LM80_VT6_IN 0x26 /* current Voltage 6 value */
#define LM80_TEMP_IN 0x27 /* current Temperature value */
#define LM80_FAN1_IN 0x28 /* current Fan 1 count */
#define LM80_FAN2_IN 0x29 /* current Fan 2 count */
/* limit values */
#define LM80_VT0_HIGH_LIM 0x2a /* high limit val for Voltage 0 */
#define LM80_VT0_LOW_LIM 0x2b /* low limit val for Voltage 0 */
#define LM80_VT1_HIGH_LIM 0x2c /* high limit val for Voltage 1 */
#define LM80_VT1_LOW_LIM 0x2d /* low limit val for Voltage 1 */
#define LM80_VT2_HIGH_LIM 0x2e /* high limit val for Voltage 2 */
#define LM80_VT2_LOW_LIM 0x2f /* low limit val for Voltage 2 */
#define LM80_VT3_HIGH_LIM 0x30 /* high limit val for Voltage 3 */
#define LM80_VT3_LOW_LIM 0x31 /* low limit val for Voltage 3 */
#define LM80_VT4_HIGH_LIM 0x32 /* high limit val for Voltage 4 */
#define LM80_VT4_LOW_LIM 0x33 /* low limit val for Voltage 4 */
#define LM80_VT5_HIGH_LIM 0x34 /* high limit val for Voltage 5 */
#define LM80_VT5_LOW_LIM 0x35 /* low limit val for Voltage 5 */
#define LM80_VT6_HIGH_LIM 0x36 /* high limit val for Voltage 6 */
#define LM80_VT6_LOW_LIM 0x37 /* low limit val for Voltage 6 */
#define LM80_THOT_LIM_UP 0x38 /* hot temperature limit (high) */
#define LM80_THOT_LIM_LO 0x39 /* hot temperature limit (low) */
#define LM80_TOS_LIM_UP 0x3a /* OS temperature limit (high) */
#define LM80_TOS_LIM_LO 0x3b /* OS temperature limit (low) */
#define LM80_FAN1_COUNT_LIM 0x3c /* Fan 1 count limit (high) */
#define LM80_FAN2_COUNT_LIM 0x3d /* Fan 2 count limit (low) */
/* 0x3e - 0x3f reserved */
/*
* LM80 bit definitions
*/
/* LM80_CFG Configuration Register */
#define LM80_CFG_START (1<<0) /* start monitoring operation */
#define LM80_CFG_INT_ENA (1<<1) /* enables the INT# Interrupt output */
#define LM80_CFG_INT_POL (1<<2) /* INT# pol: 0 act low, 1 act high */
#define LM80_CFG_INT_CLR (1<<3) /* disables INT#/RST_OUT#/OS# outputs */
#define LM80_CFG_RESET (1<<4) /* signals a reset */
#define LM80_CFG_CHASS_CLR (1<<5) /* clears Chassis Intrusion (CI) pin */
#define LM80_CFG_GPO (1<<6) /* drives the GPO# pin */
#define LM80_CFG_INIT (1<<7) /* restore power on defaults */
/* LM80_ISRC_1 Interrupt Status Register 1 */
/* LM80_IMSK_1 Interrupt Mask Register 1 */
#define LM80_IS_VT0 (1<<0) /* limit exceeded for Voltage 0 */
#define LM80_IS_VT1 (1<<1) /* limit exceeded for Voltage 1 */
#define LM80_IS_VT2 (1<<2) /* limit exceeded for Voltage 2 */
#define LM80_IS_VT3 (1<<3) /* limit exceeded for Voltage 3 */
#define LM80_IS_VT4 (1<<4) /* limit exceeded for Voltage 4 */
#define LM80_IS_VT5 (1<<5) /* limit exceeded for Voltage 5 */
#define LM80_IS_VT6 (1<<6) /* limit exceeded for Voltage 6 */
#define LM80_IS_INT_IN (1<<7) /* state of INT_IN# */
/* LM80_ISRC_2 Interrupt Status Register 2 */
/* LM80_IMSK_2 Interrupt Mask Register 2 */
#define LM80_IS_TEMP (1<<0) /* HOT temperature limit exceeded */
#define LM80_IS_BTI (1<<1) /* state of BTI# pin */
#define LM80_IS_FAN1 (1<<2) /* count limit exceeded for Fan 1 */
#define LM80_IS_FAN2 (1<<3) /* count limit exceeded for Fan 2 */
#define LM80_IS_CI (1<<4) /* Chassis Intrusion occured */
#define LM80_IS_OS (1<<5) /* OS temperature limit exceeded */
/* bit 6 and 7 are reserved in LM80_ISRC_2 */
#define LM80_IS_HT_IRQ_MD (1<<6) /* Hot temperature interrupt mode */
#define LM80_IS_OT_IRQ_MD (1<<7) /* OS temperature interrupt mode */
/* LM80_FAN_CTRL Fan Devisor/RST#/OS# Register */
#define LM80_FAN1_MD_SEL (1<<0) /* Fan 1 mode select */
#define LM80_FAN2_MD_SEL (1<<1) /* Fan 2 mode select */
#define LM80_FAN1_PRM_CTL (3<<2) /* Fan 1 speed control */
#define LM80_FAN2_PRM_CTL (3<<4) /* Fan 2 speed control */
#define LM80_FAN_OS_ENA (1<<6) /* enable OS mode on RST_OUT#/OS# pins*/
#define LM80_FAN_RST_ENA (1<<7) /* sets RST_OUT#/OS# pins in RST mode */
/* LM80_TEMP_CTRL OS# Config, Temp Res. Reg */
#define LM80_TEMP_OS_STAT (1<<0) /* mirrors the state of RST_OUT#/OS# */
#define LM80_TEMP_OS_POL (1<<1) /* select OS# polarity */
#define LM80_TEMP_OS_MODE (1<<2) /* selects Interrupt mode */
#define LM80_TEMP_RES (1<<3) /* selects 9 or 11 bit temp resulution*/
#define LM80_TEMP_LSB (0xf<<4)/* 4 LSBs of 11 bit temp data */
#define LM80_TEMP_LSB_9 (1<<7) /* LSB of 9 bit temperature data */
/* 0x07 - 0x1f reserved */
/* LM80_VT0_IN current Voltage 0 value */
/* LM80_VT1_IN current Voltage 1 value */
/* LM80_VT2_IN current Voltage 2 value */
/* LM80_VT3_IN current Voltage 3 value */
/* LM80_VT4_IN current Voltage 4 value */
/* LM80_VT5_IN current Voltage 5 value */
/* LM80_VT6_IN current Voltage 6 value */
/* LM80_TEMP_IN current temperature value */
/* LM80_FAN1_IN current Fan 1 count */
/* LM80_FAN2_IN current Fan 2 count */
/* LM80_VT0_HIGH_LIM high limit val for Voltage 0 */
/* LM80_VT0_LOW_LIM low limit val for Voltage 0 */
/* LM80_VT1_HIGH_LIM high limit val for Voltage 1 */
/* LM80_VT1_LOW_LIM low limit val for Voltage 1 */
/* LM80_VT2_HIGH_LIM high limit val for Voltage 2 */
/* LM80_VT2_LOW_LIM low limit val for Voltage 2 */
/* LM80_VT3_HIGH_LIM high limit val for Voltage 3 */
/* LM80_VT3_LOW_LIM low limit val for Voltage 3 */
/* LM80_VT4_HIGH_LIM high limit val for Voltage 4 */
/* LM80_VT4_LOW_LIM low limit val for Voltage 4 */
/* LM80_VT5_HIGH_LIM high limit val for Voltage 5 */
/* LM80_VT5_LOW_LIM low limit val for Voltage 5 */
/* LM80_VT6_HIGH_LIM high limit val for Voltage 6 */
/* LM80_VT6_LOW_LIM low limit val for Voltage 6 */
/* LM80_THOT_LIM_UP hot temperature limit (high) */
/* LM80_THOT_LIM_LO hot temperature limit (low) */
/* LM80_TOS_LIM_UP OS temperature limit (high) */
/* LM80_TOS_LIM_LO OS temperature limit (low) */
/* LM80_FAN1_COUNT_LIM Fan 1 count limit (high) */
/* LM80_FAN2_COUNT_LIM Fan 2 count limit (low) */
/* 0x3e - 0x3f reserved */
#define LM80_ADDR 0x28 /* LM80 default addr */
/* typedefs *******************************************************************/
/* function prototypes ********************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __INC_LM80_H */

@ -0,0 +1,425 @@
/******************************************************************************
*
* Name: skaddr.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.26 $
* Date: $Date: 2002/11/15 07:24:42 $
* Purpose: Header file for Address Management (MC, UC, Prom).
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2001 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: skaddr.h,v $
* Revision 1.26 2002/11/15 07:24:42 tschilli
* SK_ADDR_EQUAL macro fixed.
*
* Revision 1.25 2002/06/10 13:55:18 tschilli
* Changes for handling YUKON.
* All changes are internally and not visible to the programmer
* using this module.
*
* Revision 1.24 2001/01/22 13:41:34 rassmann
* Supporting two nets on dual-port adapters.
*
* Revision 1.23 2000/08/10 11:27:50 rassmann
* Editorial changes.
* Preserving 32-bit alignment in structs for the adapter context.
*
* Revision 1.22 2000/08/07 11:10:40 rassmann
* Editorial changes.
*
* Revision 1.21 2000/05/04 09:39:59 rassmann
* Editorial changes.
* Corrected multicast address hashing.
*
* Revision 1.20 1999/11/22 13:46:14 cgoos
* Changed license header to GPL.
* Allowing overwrite for SK_ADDR_EQUAL.
*
* Revision 1.19 1999/05/28 10:56:07 rassmann
* Editorial changes.
*
* Revision 1.18 1999/04/06 17:22:04 rassmann
* Added private "ActivePort".
*
* Revision 1.17 1999/01/14 16:18:19 rassmann
* Corrected multicast initialization.
*
* Revision 1.16 1999/01/04 10:30:36 rassmann
* SkAddrOverride only possible after SK_INIT_IO phase.
*
* Revision 1.15 1998/12/29 13:13:11 rassmann
* An address override is now preserved in the SK_INIT_IO phase.
* All functions return an int now.
* Extended parameter checking.
*
* Revision 1.14 1998/11/24 12:39:45 rassmann
* Reserved multicast entry for BPDU address.
* 13 multicast entries left for protocol.
*
* Revision 1.13 1998/11/13 17:24:32 rassmann
* Changed return value of SkAddrOverride to int.
*
* Revision 1.12 1998/11/13 16:56:19 rassmann
* Added macro SK_ADDR_COMPARE.
* Changed return type of SkAddrOverride to SK_BOOL.
*
* Revision 1.11 1998/10/28 18:16:35 rassmann
* Avoiding I/Os before SK_INIT_RUN level.
* Aligning InexactFilter.
*
* Revision 1.10 1998/10/22 11:39:10 rassmann
* Corrected signed/unsigned mismatches.
*
* Revision 1.9 1998/10/15 15:15:49 rassmann
* Changed Flags Parameters from SK_U8 to int.
* Checked with lint.
*
* Revision 1.8 1998/09/24 19:15:12 rassmann
* Code cleanup.
*
* Revision 1.7 1998/09/18 20:22:13 rassmann
* Added HW access.
*
* Revision 1.6 1998/09/04 19:40:20 rassmann
* Interface enhancements.
*
* Revision 1.5 1998/09/04 12:40:57 rassmann
* Interface cleanup.
*
* Revision 1.4 1998/09/04 12:14:13 rassmann
* Interface cleanup.
*
* Revision 1.3 1998/09/02 16:56:40 rassmann
* Updated interface.
*
* Revision 1.2 1998/08/27 14:26:09 rassmann
* Updated interface.
*
* Revision 1.1 1998/08/21 08:31:08 rassmann
* First public version.
*
******************************************************************************/
/******************************************************************************
*
* Description:
*
* This module is intended to manage multicast addresses and promiscuous mode
* on GEnesis adapters.
*
* Include File Hierarchy:
*
* "skdrv1st.h"
* ...
* "sktypes.h"
* "skqueue.h"
* "skaddr.h"
* ...
* "skdrv2nd.h"
*
******************************************************************************/
#ifndef __INC_SKADDR_H
#define __INC_SKADDR_H
#ifdef __cplusplus
#error C++ is not yet supported.
extern "C" {
#endif /* cplusplus */
/* defines ********************************************************************/
#define SK_MAC_ADDR_LEN 6 /* Length of MAC address. */
#define SK_MAX_ADDRS 14 /* #Addrs for exact match. */
/* ----- Common return values ----- */
#define SK_ADDR_SUCCESS 0 /* Function returned successfully. */
#define SK_ADDR_ILLEGAL_PORT 100 /* Port number too high. */
#define SK_ADDR_TOO_EARLY 101 /* Function called too early. */
/* ----- Clear/Add flag bits ----- */
#define SK_ADDR_PERMANENT 1 /* RLMT Address */
/* ----- Additional Clear flag bits ----- */
#define SK_MC_SW_ONLY 2 /* Do not update HW when clearing. */
/* ----- Override flag bits ----- */
#define SK_ADDR_LOGICAL_ADDRESS 0
#define SK_ADDR_VIRTUAL_ADDRESS (SK_ADDR_LOGICAL_ADDRESS) /* old */
#define SK_ADDR_PHYSICAL_ADDRESS 1
#define SK_ADDR_CLEAR_LOGICAL 2
#define SK_ADDR_SET_LOGICAL 4
/* ----- Override return values ----- */
#define SK_ADDR_OVERRIDE_SUCCESS (SK_ADDR_SUCCESS)
#define SK_ADDR_DUPLICATE_ADDRESS 1
#define SK_ADDR_MULTICAST_ADDRESS 2
/* ----- Partitioning of excact match table ----- */
#define SK_ADDR_EXACT_MATCHES 16 /* #Exact match entries. */
#define SK_ADDR_FIRST_MATCH_RLMT 1
#define SK_ADDR_LAST_MATCH_RLMT 2
#define SK_ADDR_FIRST_MATCH_DRV 3
#define SK_ADDR_LAST_MATCH_DRV (SK_ADDR_EXACT_MATCHES - 1)
/* ----- SkAddrMcAdd/SkAddrMcUpdate return values ----- */
#define SK_MC_FILTERING_EXACT 0 /* Exact filtering. */
#define SK_MC_FILTERING_INEXACT 1 /* Inexact filtering. */
/* ----- Additional SkAddrMcAdd return values ----- */
#define SK_MC_ILLEGAL_ADDRESS 2 /* Illegal address. */
#define SK_MC_ILLEGAL_PORT 3 /* Illegal port (not the active one). */
#define SK_MC_RLMT_OVERFLOW 4 /* Too many RLMT mc addresses. */
/* Promiscuous mode bits ----- */
#define SK_PROM_MODE_NONE 0 /* Normal receive. */
#define SK_PROM_MODE_LLC 1 /* Receive all LLC frames. */
#define SK_PROM_MODE_ALL_MC 2 /* Receive all multicast frames. */
/* #define SK_PROM_MODE_NON_LLC 4 */ /* Receive all non-LLC frames. */
/* Macros */
#if 0
#ifndef SK_ADDR_EQUAL
/*
* "&" instead of "&&" allows better optimization on IA-64.
* The replacement is safe here, as all bytes exist.
*/
#ifndef SK_ADDR_DWORD_COMPARE
#define SK_ADDR_EQUAL(A1,A2) ( \
(((SK_U8 *)(A1))[5] == ((SK_U8 *)(A2))[5]) & \
(((SK_U8 *)(A1))[4] == ((SK_U8 *)(A2))[4]) & \
(((SK_U8 *)(A1))[3] == ((SK_U8 *)(A2))[3]) & \
(((SK_U8 *)(A1))[2] == ((SK_U8 *)(A2))[2]) & \
(((SK_U8 *)(A1))[1] == ((SK_U8 *)(A2))[1]) & \
(((SK_U8 *)(A1))[0] == ((SK_U8 *)(A2))[0]))
#else /* SK_ADDR_DWORD_COMPARE */
#define SK_ADDR_EQUAL(A1,A2) ( \
(*(SK_U32 *)&(((SK_U8 *)(A1))[2]) == *(SK_U32 *)&(((SK_U8 *)(A2))[2])) & \
(*(SK_U32 *)&(((SK_U8 *)(A1))[0]) == *(SK_U32 *)&(((SK_U8 *)(A2))[0])))
#endif /* SK_ADDR_DWORD_COMPARE */
#endif /* SK_ADDR_EQUAL */
#endif /* 0 */
#ifndef SK_ADDR_EQUAL
#ifndef SK_ADDR_DWORD_COMPARE
#define SK_ADDR_EQUAL(A1,A2) ( \
(((SK_U8 *)(A1))[5] == ((SK_U8 *)(A2))[5]) & \
(((SK_U8 *)(A1))[4] == ((SK_U8 *)(A2))[4]) & \
(((SK_U8 *)(A1))[3] == ((SK_U8 *)(A2))[3]) & \
(((SK_U8 *)(A1))[2] == ((SK_U8 *)(A2))[2]) & \
(((SK_U8 *)(A1))[1] == ((SK_U8 *)(A2))[1]) & \
(((SK_U8 *)(A1))[0] == ((SK_U8 *)(A2))[0]))
#else /* SK_ADDR_DWORD_COMPARE */
#define SK_ADDR_EQUAL(A1,A2) ( \
(*(SK_U16 *)&(((SK_U8 *)(A1))[4]) == *(SK_U16 *)&(((SK_U8 *)(A2))[4])) && \
(*(SK_U32 *)&(((SK_U8 *)(A1))[0]) == *(SK_U32 *)&(((SK_U8 *)(A2))[0])))
#endif /* SK_ADDR_DWORD_COMPARE */
#endif /* SK_ADDR_EQUAL */
/* typedefs *******************************************************************/
typedef struct s_MacAddr {
SK_U8 a[SK_MAC_ADDR_LEN];
} SK_MAC_ADDR;
/* SK_FILTER is used to ensure alignment of the filter. */
typedef union s_InexactFilter {
SK_U8 Bytes[8];
SK_U64 Val; /* Dummy entry for alignment only. */
} SK_FILTER64;
typedef struct s_AddrNet SK_ADDR_NET;
typedef struct s_AddrPort {
/* ----- Public part (read-only) ----- */
SK_MAC_ADDR CurrentMacAddress; /* Current physical MAC Address. */
SK_MAC_ADDR PermanentMacAddress; /* Permanent physical MAC Address. */
int PromMode; /* Promiscuous Mode. */
/* ----- Private part ----- */
SK_MAC_ADDR PreviousMacAddress; /* Prev. phys. MAC Address. */
SK_BOOL CurrentMacAddressSet; /* CurrentMacAddress is set. */
SK_U8 Align01;
SK_U32 FirstExactMatchRlmt;
SK_U32 NextExactMatchRlmt;
SK_U32 FirstExactMatchDrv;
SK_U32 NextExactMatchDrv;
SK_MAC_ADDR Exact[SK_ADDR_EXACT_MATCHES];
SK_FILTER64 InexactFilter; /* For 64-bit hash register. */
SK_FILTER64 InexactRlmtFilter; /* For 64-bit hash register. */
SK_FILTER64 InexactDrvFilter; /* For 64-bit hash register. */
} SK_ADDR_PORT;
struct s_AddrNet {
/* ----- Public part (read-only) ----- */
SK_MAC_ADDR CurrentMacAddress; /* Logical MAC Address. */
SK_MAC_ADDR PermanentMacAddress; /* Logical MAC Address. */
/* ----- Private part ----- */
SK_U32 ActivePort; /* View of module ADDR. */
SK_BOOL CurrentMacAddressSet; /* CurrentMacAddress is set. */
SK_U8 Align01;
SK_U16 Align02;
};
typedef struct s_Addr {
/* ----- Public part (read-only) ----- */
SK_ADDR_NET Net[SK_MAX_NETS];
SK_ADDR_PORT Port[SK_MAX_MACS];
/* ----- Private part ----- */
} SK_ADDR;
/* function prototypes ********************************************************/
#ifndef SK_KR_PROTO
/* Functions provided by SkAddr */
/* ANSI/C++ compliant function prototypes */
extern int SkAddrInit(
SK_AC *pAC,
SK_IOC IoC,
int Level);
extern int SkAddrMcClear(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber,
int Flags);
extern int SkAddrXmacMcClear(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber,
int Flags);
extern int SkAddrGmacMcClear(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber,
int Flags);
extern int SkAddrMcAdd(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber,
SK_MAC_ADDR *pMc,
int Flags);
extern int SkAddrXmacMcAdd(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber,
SK_MAC_ADDR *pMc,
int Flags);
extern int SkAddrGmacMcAdd(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber,
SK_MAC_ADDR *pMc,
int Flags);
extern int SkAddrMcUpdate(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber);
extern int SkAddrXmacMcUpdate(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber);
extern int SkAddrGmacMcUpdate(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber);
extern int SkAddrOverride(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber,
SK_MAC_ADDR *pNewAddr,
int Flags);
extern int SkAddrPromiscuousChange(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber,
int NewPromMode);
extern int SkAddrXmacPromiscuousChange(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber,
int NewPromMode);
extern int SkAddrGmacPromiscuousChange(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber,
int NewPromMode);
extern int SkAddrSwap(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 FromPortNumber,
SK_U32 ToPortNumber);
#else /* defined(SK_KR_PROTO)) */
/* Non-ANSI/C++ compliant function prototypes */
#error KR-style prototypes are not yet provided.
#endif /* defined(SK_KR_PROTO)) */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __INC_SKADDR_H */

@ -0,0 +1,261 @@
/******************************************************************************
*
* Name: skcsum.h
* Project: GEnesis - SysKonnect SK-NET Gigabit Ethernet (SK-98xx)
* Version: $Revision: 1.9 $
* Date: $Date: 2001/02/06 11:21:39 $
* Purpose: Store/verify Internet checksum in send/receive packets.
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2001 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: skcsum.h,v $
* Revision 1.9 2001/02/06 11:21:39 rassmann
* Editorial changes.
*
* Revision 1.8 2001/02/06 11:15:36 rassmann
* Supporting two nets on dual-port adapters.
*
* Revision 1.7 2000/06/29 13:17:05 rassmann
* Corrected reception of a packet with UDP checksum == 0 (which means there
* is no UDP checksum).
*
* Revision 1.6 2000/02/28 12:33:44 cgoos
* Changed C++ style comments to C style.
*
* Revision 1.5 2000/02/21 12:10:05 cgoos
* Fixed license comment.
*
* Revision 1.4 2000/02/21 11:08:37 cgoos
* Merged changes back into common source.
*
* Revision 1.1 1999/07/26 14:47:49 mkarl
* changed from common source to windows specific source
* added return SKCS_STATUS_IP_CSUM_ERROR_UDP and
* SKCS_STATUS_IP_CSUM_ERROR_TCP to pass the NidsTester
* changes for Tx csum offload
*
* Revision 1.2 1998/09/04 12:16:34 mhaveman
* Checked in for Stephan to allow compilation.
* -Added definition SK_CSUM_EVENT_CLEAR_PROTO_STATS to clear statistic
* -Added prototype for SkCsEvent()
*
* Revision 1.1 1998/09/01 15:36:53 swolf
* initial revision
*
* 01-Sep-1998 sw Created.
*
******************************************************************************/
/******************************************************************************
*
* Description:
*
* Public header file for the "GEnesis" common module "CSUM".
*
* "GEnesis" is an abbreviation of "Gigabit Ethernet Network System in Silicon"
* and is the code name of this SysKonnect project.
*
* Compilation Options:
*
* SK_USE_CSUM - Define if CSUM is to be used. Otherwise, CSUM will be an
* empty module.
*
* SKCS_OVERWRITE_PROTO - Define to overwrite the default protocol id
* definitions. In this case, all SKCS_PROTO_xxx definitions must be made
* external.
*
* SKCS_OVERWRITE_STATUS - Define to overwrite the default return status
* definitions. In this case, all SKCS_STATUS_xxx definitions must be made
* external.
*
* Include File Hierarchy:
*
* "h/skcsum.h"
* "h/sktypes.h"
* "h/skqueue.h"
*
******************************************************************************/
#ifndef __INC_SKCSUM_H
#define __INC_SKCSUM_H
#include "h/sktypes.h"
#include "h/skqueue.h"
/* defines ********************************************************************/
/*
* Define the default bit flags for 'SKCS_PACKET_INFO.ProtocolFlags' if no user
* overwrite.
*/
#ifndef SKCS_OVERWRITE_PROTO /* User overwrite? */
#define SKCS_PROTO_IP 0x1 /* IP (Internet Protocol version 4) */
#define SKCS_PROTO_TCP 0x2 /* TCP (Transmission Control Protocol) */
#define SKCS_PROTO_UDP 0x4 /* UDP (User Datagram Protocol) */
/* Indices for protocol statistics. */
#define SKCS_PROTO_STATS_IP 0
#define SKCS_PROTO_STATS_UDP 1
#define SKCS_PROTO_STATS_TCP 2
#define SKCS_NUM_PROTOCOLS 3 /* Number of supported protocols. */
#endif /* !SKCS_OVERWRITE_PROTO */
/*
* Define the default SKCS_STATUS type and values if no user overwrite.
*
* SKCS_STATUS_UNKNOWN_IP_VERSION - Not an IP v4 frame.
* SKCS_STATUS_IP_CSUM_ERROR - IP checksum error.
* SKCS_STATUS_IP_CSUM_ERROR_TCP - IP checksum error in TCP frame.
* SKCS_STATUS_IP_CSUM_ERROR_UDP - IP checksum error in UDP frame
* SKCS_STATUS_IP_FRAGMENT - IP fragment (IP checksum ok).
* SKCS_STATUS_IP_CSUM_OK - IP checksum ok (not a TCP or UDP frame).
* SKCS_STATUS_TCP_CSUM_ERROR - TCP checksum error (IP checksum ok).
* SKCS_STATUS_UDP_CSUM_ERROR - UDP checksum error (IP checksum ok).
* SKCS_STATUS_TCP_CSUM_OK - IP and TCP checksum ok.
* SKCS_STATUS_UDP_CSUM_OK - IP and UDP checksum ok.
* SKCS_STATUS_IP_CSUM_OK_NO_UDP - IP checksum OK and no UDP checksum.
*/
#ifndef SKCS_OVERWRITE_STATUS /* User overwrite? */
#define SKCS_STATUS int /* Define status type. */
#define SKCS_STATUS_UNKNOWN_IP_VERSION 1
#define SKCS_STATUS_IP_CSUM_ERROR 2
#define SKCS_STATUS_IP_FRAGMENT 3
#define SKCS_STATUS_IP_CSUM_OK 4
#define SKCS_STATUS_TCP_CSUM_ERROR 5
#define SKCS_STATUS_UDP_CSUM_ERROR 6
#define SKCS_STATUS_TCP_CSUM_OK 7
#define SKCS_STATUS_UDP_CSUM_OK 8
/* needed for Microsoft */
#define SKCS_STATUS_IP_CSUM_ERROR_UDP 9
#define SKCS_STATUS_IP_CSUM_ERROR_TCP 10
/* UDP checksum may be omitted */
#define SKCS_STATUS_IP_CSUM_OK_NO_UDP 11
#endif /* !SKCS_OVERWRITE_STATUS */
/* Clear protocol statistics event. */
#define SK_CSUM_EVENT_CLEAR_PROTO_STATS 1
/*
* Add two values in one's complement.
*
* Note: One of the two input values may be "longer" than 16-bit, but then the
* resulting sum may be 17 bits long. In this case, add zero to the result using
* SKCS_OC_ADD() again.
*
* Result = Value1 + Value2
*/
#define SKCS_OC_ADD(Result, Value1, Value2) { \
unsigned long Sum; \
\
Sum = (unsigned long) (Value1) + (unsigned long) (Value2); \
/* Add-in any carry. */ \
(Result) = (Sum & 0xffff) + (Sum >> 16); \
}
/*
* Subtract two values in one's complement.
*
* Result = Value1 - Value2
*/
#define SKCS_OC_SUB(Result, Value1, Value2) \
SKCS_OC_ADD((Result), (Value1), ~(Value2) & 0xffff)
/* typedefs *******************************************************************/
/*
* SKCS_PROTO_STATS - The CSUM protocol statistics structure.
*
* There is one instance of this structure for each protocol supported.
*/
typedef struct s_CsProtocolStatistics {
SK_U64 RxOkCts; /* Receive checksum ok. */
SK_U64 RxUnableCts; /* Unable to verify receive checksum. */
SK_U64 RxErrCts; /* Receive checksum error. */
SK_U64 TxOkCts; /* Transmit checksum ok. */
SK_U64 TxUnableCts; /* Unable to calculate checksum in hw. */
} SKCS_PROTO_STATS;
/*
* s_Csum - The CSUM module context structure.
*/
typedef struct s_Csum {
/* Enabled receive SK_PROTO_XXX bit flags. */
unsigned ReceiveFlags[SK_MAX_NETS];
#ifdef TX_CSUM
unsigned TransmitFlags[SK_MAX_NETS];
#endif /* TX_CSUM */
/* The protocol statistics structure; one per supported protocol. */
SKCS_PROTO_STATS ProtoStats[SK_MAX_NETS][SKCS_NUM_PROTOCOLS];
} SK_CSUM;
/*
* SKCS_PACKET_INFO - The packet information structure.
*/
typedef struct s_CsPacketInfo {
/* Bit field specifiying the desired/found protocols. */
unsigned ProtocolFlags;
/* Length of complete IP header, including any option fields. */
unsigned IpHeaderLength;
/* IP header checksum. */
unsigned IpHeaderChecksum;
/* TCP/UDP pseudo header checksum. */
unsigned PseudoHeaderChecksum;
} SKCS_PACKET_INFO;
/* function prototypes ********************************************************/
#ifndef SkCsCalculateChecksum
extern unsigned SkCsCalculateChecksum(
void *pData,
unsigned Length);
#endif
extern int SkCsEvent(
SK_AC *pAc,
SK_IOC Ioc,
SK_U32 Event,
SK_EVPARA Param);
extern SKCS_STATUS SkCsGetReceiveInfo(
SK_AC *pAc,
void *pIpHeader,
unsigned Checksum1,
unsigned Checksum2,
int NetNumber);
extern void SkCsGetSendInfo(
SK_AC *pAc,
void *pIpHeader,
SKCS_PACKET_INFO *pPacketInfo,
int NetNumber);
extern void SkCsSetReceiveFlags(
SK_AC *pAc,
unsigned ReceiveFlags,
unsigned *pChecksum1Offset,
unsigned *pChecksum2Offset,
int NetNumber);
#endif /* __INC_SKCSUM_H */

@ -0,0 +1,119 @@
/******************************************************************************
*
* Name: skdebug.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.12 $
* Date: $Date: 2002/07/15 15:37:13 $
* Purpose: SK specific DEBUG support
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
* $Log: skdebug.h,v $
* Revision 1.12 2002/07/15 15:37:13 rschmidt
* Power Management support
* Editorial changes
*
* Revision 1.11 2002/04/25 11:04:39 rschmidt
* Editorial changes
*
* Revision 1.10 1999/11/22 13:47:40 cgoos
* Changed license header to GPL.
*
* Revision 1.9 1999/09/14 14:02:43 rwahl
* Added SK_DBGMOD_PECP.
*
* Revision 1.8 1998/11/25 08:31:54 gklug
* fix: no C++ comments allowed in common sources
*
* Revision 1.7 1998/11/24 16:47:24 swolf
* Driver may now define its own SK_DBG_MSG() (eg. in "h/skdrv1st.h").
*
* Revision 1.6 1998/10/28 10:23:55 rassmann
* ADDED SK_DBGMOD_ADDR.
*
* Revision 1.5 1998/10/22 09:43:55 gklug
* add: CSUM module
*
* Revision 1.4 1998/10/01 07:54:44 gklug
* add: PNMI debug module
*
* Revision 1.3 1998/09/18 08:32:34 afischer
* Macros changed according ssr-spec.:
* SK_DBG_MODCHK -> SK_DBG_CHKMOD
* SK_DBG_CATCHK -> SK_DBG_CHKCAT
*
* Revision 1.2 1998/07/03 14:38:25 malthoff
* Add category SK_DBGCAT_FATAL.
*
* Revision 1.1 1998/06/19 13:39:01 malthoff
* created.
*
*
******************************************************************************/
#ifndef __INC_SKDEBUG_H
#define __INC_SKDEBUG_H
#ifdef DEBUG
#ifndef SK_DBG_MSG
#define SK_DBG_MSG(pAC,comp,cat,arg) \
if ( ((comp) & SK_DBG_CHKMOD(pAC)) && \
((cat) & SK_DBG_CHKCAT(pAC)) ) { \
SK_DBG_PRINTF arg ; \
}
#endif
#else
#define SK_DBG_MSG(pAC,comp,lev,arg)
#endif
/* PLS NOTE:
* =========
* Due to any restrictions of kernel printf routines do not use other
* format identifiers as: %x %d %c %s .
* Never use any combined format identifiers such as: %lx %ld in your
* printf - argument (arg) because some OS specific kernel printfs may
* only support some basic identifiers.
*/
/* Debug modules */
#define SK_DBGMOD_MERR 0x00000001L /* general module error indication */
#define SK_DBGMOD_HWM 0x00000002L /* Hardware init module */
#define SK_DBGMOD_RLMT 0x00000004L /* RLMT module */
#define SK_DBGMOD_VPD 0x00000008L /* VPD module */
#define SK_DBGMOD_I2C 0x00000010L /* I2C module */
#define SK_DBGMOD_PNMI 0x00000020L /* PNMI module */
#define SK_DBGMOD_CSUM 0x00000040L /* CSUM module */
#define SK_DBGMOD_ADDR 0x00000080L /* ADDR module */
#define SK_DBGMOD_PECP 0x00000100L /* PECP module */
#define SK_DBGMOD_POWM 0x00000200L /* Power Management module */
/* Debug events */
#define SK_DBGCAT_INIT 0x00000001L /* module/driver initialization */
#define SK_DBGCAT_CTRL 0x00000002L /* controlling devices */
#define SK_DBGCAT_ERR 0x00000004L /* error handling paths */
#define SK_DBGCAT_TX 0x00000008L /* transmit path */
#define SK_DBGCAT_RX 0x00000010L /* receive path */
#define SK_DBGCAT_IRQ 0x00000020L /* general IRQ handling */
#define SK_DBGCAT_QUEUE 0x00000040L /* any queue management */
#define SK_DBGCAT_DUMP 0x00000080L /* large data output e.g. hex dump */
#define SK_DBGCAT_FATAL 0x00000100L /* fatal error */
#endif /* __INC_SKDEBUG_H */

@ -0,0 +1,265 @@
/******************************************************************************
*
* Name: skdrv1st.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.11 $
* Date: $Date: 2003/02/25 14:16:40 $
* Purpose: First header file for driver and all other modules
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2003 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: skdrv1st.h,v $
* Revision 1.11 2003/02/25 14:16:40 mlindner
* Fix: Copyright statement
*
* Revision 1.10 2002/10/02 12:46:02 mlindner
* Add: Support for Yukon
*
* Revision 1.9.2.2 2001/12/07 12:06:42 mlindner
* Fix: malloc -> slab changes
*
* Revision 1.9.2.1 2001/03/12 16:50:59 mlindner
* chg: kernel 2.4 adaption
*
* Revision 1.9 2001/01/22 14:16:04 mlindner
* added ProcFs functionality
* Dual Net functionality integrated
* Rlmt networks added
*
* Revision 1.8 2000/02/21 12:19:18 cgoos
* Added default for SK_DEBUG_CHKMOD/_CHKCAT
*
* Revision 1.7 1999/11/22 13:50:00 cgoos
* Changed license header to GPL.
* Added overwrite for several functions.
* Removed linux 2.0.x definitions.
* Removed PCI vendor ID definition (now in kernel).
*
* Revision 1.6 1999/07/27 08:03:33 cgoos
* Changed SK_IN/OUT macros to readX/writeX instead of memory
* accesses (necessary for ALPHA).
*
* Revision 1.5 1999/07/23 12:10:21 cgoos
* Removed SK_RLMT_SLOW_LOOKAHEAD define.
*
* Revision 1.4 1999/07/14 12:31:13 cgoos
* Added SK_RLMT_SLOW_LOOKAHEAD define.
*
* Revision 1.3 1999/04/07 10:12:54 cgoos
* Added check for KERNEL and OPTIMIZATION defines.
*
* Revision 1.2 1999/03/01 08:51:47 cgoos
* Fixed pcibios_read/write definitions.
*
* Revision 1.1 1999/02/16 07:40:49 cgoos
* First version.
*
*
*
******************************************************************************/
/******************************************************************************
*
* Description:
*
* This is the first include file of the driver, which includes all
* neccessary system header files and some of the GEnesis header files.
* It also defines some basic items.
*
* Include File Hierarchy:
*
* see skge.c
*
******************************************************************************/
#ifndef __INC_SKDRV1ST_H
#define __INC_SKDRV1ST_H
#if 0
/* Check kernel version */
#include <linux/version.h>
#if (LINUX_VERSION_CODE > 0x020300)
#endif
#endif
typedef struct s_AC SK_AC;
/* override some default functions with optimized linux functions */
#define SK_PNMI_STORE_U16(p,v) memcpy((char*)(p),(char*)&(v),2)
#define SK_PNMI_STORE_U32(p,v) memcpy((char*)(p),(char*)&(v),4)
#define SK_PNMI_STORE_U64(p,v) memcpy((char*)(p),(char*)&(v),8)
#define SK_PNMI_READ_U16(p,v) memcpy((char*)&(v),(char*)(p),2)
#define SK_PNMI_READ_U32(p,v) memcpy((char*)&(v),(char*)(p),2)
#define SK_PNMI_READ_U64(p,v) memcpy((char*)&(v),(char*)(p),2)
#define SkCsCalculateChecksum(p,l) ((~ip_compute_csum(p, l)) & 0xffff)
#define SK_ADDR_EQUAL(a1,a2) (!memcmp(a1,a2,6))
#if !defined(__OPTIMIZE__) || !defined(__KERNEL__)
#warning You must compile this file with the correct options!
#warning See the last lines of the source file.
#error You must compile this driver with "-O".
#endif
#if 0
#include <linux/version.h>
#endif
#include <linux/types.h>
#if 0
#include <linux/kernel.h>
#endif
#include <linux/string.h>
#if 0
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#endif
#include <asm/byteorder.h>
#include <asm/bitops.h>
#include <asm/io.h>
#if 0
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#include <net/checksum.h>
#endif
#include "h/sktypes.h"
#include "h/skerror.h"
#include "h/skdebug.h"
#include "h/lm80.h"
#include "h/xmac_ii.h"
#include "u-boot_compat.h"
#ifdef __LITTLE_ENDIAN
#define SK_LITTLE_ENDIAN
#else
#define SK_BIG_ENDIAN
#endif
#if 0
#define SK_NET_DEVICE net_device
#else
#define SK_NET_DEVICE eth_device
#endif
/* we use gethrtime(), return unit: nanoseconds */
#if 0
#define SK_TICKS_PER_SEC HZ
#else
#define SK_TICKS_PER_SEC CFG_HZ
#endif
#define SK_MEM_MAPPED_IO
// #define SK_RLMT_SLOW_LOOKAHEAD
#define SK_MAX_MACS 2
#define SK_MAX_NETS 2
#define SK_IOC char*
typedef struct s_DrvRlmtMbuf SK_MBUF;
#define SK_CONST64 INT64_C
#define SK_CONSTU64 UINT64_C
#define SK_MEMCPY(dest,src,size) memcpy(dest,src,size)
#define SK_MEMCMP(s1,s2,size) memcmp(s1,s2,size)
#define SK_MEMSET(dest,val,size) memset(dest,val,size)
#define SK_STRLEN(pStr) strlen((char*)(pStr))
#define SK_STRNCPY(pDest,pSrc,size) strncpy((char*)(pDest),(char*)(pSrc),size)
#define SK_STRCMP(pStr1,pStr2) strcmp((char*)(pStr1),(char*)(pStr2))
/* macros to access the adapter */
#define SK_OUT8(b,a,v) writeb((v), ((b)+(a)))
#define SK_OUT16(b,a,v) writew((v), ((b)+(a)))
#define SK_OUT32(b,a,v) writel((v), ((b)+(a)))
#define SK_IN8(b,a,pv) (*(pv) = readb((b)+(a)))
#define SK_IN16(b,a,pv) (*(pv) = readw((b)+(a)))
#define SK_IN32(b,a,pv) (*(pv) = readl((b)+(a)))
#define int8_t char
#define int16_t short
#define int32_t long
#define int64_t long long
#define uint8_t u_char
#define uint16_t u_short
#define uint32_t u_long
#define uint64_t unsigned long long
#define t_scalar_t int
#define t_uscalar_t unsigned int
#define uintptr_t unsigned long
#define __CONCAT__(A,B) A##B
#define INT32_C(a) __CONCAT__(a,L)
#define INT64_C(a) __CONCAT__(a,LL)
#define UINT32_C(a) __CONCAT__(a,UL)
#define UINT64_C(a) __CONCAT__(a,ULL)
#ifdef DEBUG
#define SK_DBG_PRINTF printk
#ifndef SK_DEBUG_CHKMOD
#define SK_DEBUG_CHKMOD 0
#endif
#ifndef SK_DEBUG_CHKCAT
#define SK_DEBUG_CHKCAT 0
#endif
/* those come from the makefile */
#define SK_DBG_CHKMOD(pAC) (SK_DEBUG_CHKMOD)
#define SK_DBG_CHKCAT(pAC) (SK_DEBUG_CHKCAT)
extern void SkDbgPrintf(const char *format,...);
#define SK_DBGMOD_DRV 0x00010000
/**** possible driver debug categories ********************************/
#define SK_DBGCAT_DRV_ENTRY 0x00010000
#define SK_DBGCAT_DRV_SAP 0x00020000
#define SK_DBGCAT_DRV_MCA 0x00040000
#define SK_DBGCAT_DRV_TX_PROGRESS 0x00080000
#define SK_DBGCAT_DRV_RX_PROGRESS 0x00100000
#define SK_DBGCAT_DRV_PROGRESS 0x00200000
#define SK_DBGCAT_DRV_MSG 0x00400000
#define SK_DBGCAT_DRV_PROM 0x00800000
#define SK_DBGCAT_DRV_TX_FRAME 0x01000000
#define SK_DBGCAT_DRV_ERROR 0x02000000
#define SK_DBGCAT_DRV_INT_SRC 0x04000000
#define SK_DBGCAT_DRV_EVENT 0x08000000
#endif
#define SK_ERR_LOG SkErrorLog
extern void SkErrorLog(SK_AC*, int, int, char*);
#endif

@ -0,0 +1,565 @@
/******************************************************************************
*
* Name: skdrv2nd.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.15 $
* Date: $Date: 2003/02/25 14:16:40 $
* Purpose: Second header file for driver and all other modules
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2003 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: skdrv2nd.h,v $
* Revision 1.15 2003/02/25 14:16:40 mlindner
* Fix: Copyright statement
*
* Revision 1.14 2003/02/25 13:26:26 mlindner
* Add: Support for various vendors
*
* Revision 1.13 2002/10/02 12:46:02 mlindner
* Add: Support for Yukon
*
* Revision 1.12.2.2 2001/09/05 12:14:50 mlindner
* add: New hardware revision int
*
* Revision 1.12.2.1 2001/03/12 16:50:59 mlindner
* chg: kernel 2.4 adaption
*
* Revision 1.12 2001/03/01 12:52:15 mlindner
* Fixed ring size
*
* Revision 1.11 2001/02/19 13:28:02 mlindner
* Changed PNMI parameter values
*
* Revision 1.10 2001/01/22 14:16:04 mlindner
* added ProcFs functionality
* Dual Net functionality integrated
* Rlmt networks added
*
* Revision 1.1 2000/10/05 19:46:50 phargrov
* Add directory src/vipk_devs_nonlbl/vipk_sk98lin/
* This is the SysKonnect SK-98xx Gigabit Ethernet driver,
* contributed by SysKonnect.
*
* Revision 1.9 2000/02/21 10:39:55 cgoos
* Added flag for jumbo support usage.
*
* Revision 1.8 1999/11/22 13:50:44 cgoos
* Changed license header to GPL.
* Fixed two comments.
*
* Revision 1.7 1999/09/28 12:38:21 cgoos
* Added CheckQueue to SK_AC.
*
* Revision 1.6 1999/07/27 08:04:05 cgoos
* Added checksumming variables to SK_AC.
*
* Revision 1.5 1999/03/29 12:33:26 cgoos
* Rreversed to fine lock granularity.
*
* Revision 1.4 1999/03/15 12:14:02 cgoos
* Added DriverLock to SK_AC.
* Removed other locks.
*
* Revision 1.3 1999/03/01 08:52:27 cgoos
* Changed pAC->PciDev declaration.
*
* Revision 1.2 1999/02/18 10:57:14 cgoos
* Removed SkDrvTimeStamp prototype.
* Fixed SkGeOsGetTime prototype.
*
* Revision 1.1 1999/02/16 07:41:01 cgoos
* First version.
*
*
*
******************************************************************************/
/******************************************************************************
*
* Description:
*
* This is the second include file of the driver, which includes all other
* neccessary files and defines all structures and constants used by the
* driver and the common modules.
*
* Include File Hierarchy:
*
* see skge.c
*
******************************************************************************/
#ifndef __INC_SKDRV2ND_H
#define __INC_SKDRV2ND_H
#include "h/skqueue.h"
#include "h/skgehwt.h"
#include "h/sktimer.h"
#include "h/ski2c.h"
#include "h/skgepnmi.h"
#include "h/skvpd.h"
#include "h/skgehw.h"
#include "h/skgeinit.h"
#include "h/skaddr.h"
#include "h/skgesirq.h"
#include "h/skcsum.h"
#include "h/skrlmt.h"
#include "h/skgedrv.h"
#define SK_PCI_ISCOMPLIANT(result, pdev) { \
result = SK_FALSE; /* default */ \
/* 3Com (0x10b7) */ \
if (pdev->vendor == 0x10b7) { \
/* Gigabit Ethernet Adapter (0x1700) */ \
if ((pdev->device == 0x1700)) { \
result = SK_TRUE; \
} \
/* SysKonnect (0x1148) */ \
} else if (pdev->vendor == 0x1148) { \
/* SK-98xx Gigabit Ethernet Server Adapter (0x4300) */ \
/* SK-98xx V2 Gigabit Ethernet Adapter (0x4320) */ \
if ((pdev->device == 0x4300) || \
(pdev->device == 0x4320)) { \
result = SK_TRUE; \
} \
/* D-Link (0x1186) */ \
} else if (pdev->vendor == 0x1186) { \
/* Gigabit Ethernet Adapter (0x4c00) */ \
if ((pdev->device == 0x4c00)) { \
result = SK_TRUE; \
} \
/* CNet (0x1371) */ \
} else if (pdev->vendor == 0x1371) { \
/* GigaCard Network Adapter (0x434e) */ \
if ((pdev->device == 0x434e)) { \
result = SK_TRUE; \
} \
/* Linksys (0x1737) */ \
} else if (pdev->vendor == 0x1737) { \
/* Gigabit Network Adapter (0x1032) */ \
/* Gigabit Network Adapter (0x1064) */ \
if ((pdev->device == 0x1032) || \
(pdev->device == 0x1064)) { \
result = SK_TRUE; \
} \
} else { \
result = SK_FALSE; \
} \
}
extern SK_MBUF *SkDrvAllocRlmtMbuf(SK_AC*, SK_IOC, unsigned);
extern void SkDrvFreeRlmtMbuf(SK_AC*, SK_IOC, SK_MBUF*);
extern SK_U64 SkOsGetTime(SK_AC*);
extern int SkPciReadCfgDWord(SK_AC*, int, SK_U32*);
extern int SkPciReadCfgWord(SK_AC*, int, SK_U16*);
extern int SkPciReadCfgByte(SK_AC*, int, SK_U8*);
extern int SkPciWriteCfgDWord(SK_AC*, int, SK_U32);
extern int SkPciWriteCfgWord(SK_AC*, int, SK_U16);
extern int SkPciWriteCfgByte(SK_AC*, int, SK_U8);
extern int SkDrvEvent(SK_AC*, SK_IOC IoC, SK_U32, SK_EVPARA);
struct s_DrvRlmtMbuf {
SK_MBUF *pNext; /* Pointer to next RLMT Mbuf. */
SK_U8 *pData; /* Data buffer (virtually contig.). */
unsigned Size; /* Data buffer size. */
unsigned Length; /* Length of packet (<= Size). */
SK_U32 PortIdx; /* Receiving/transmitting port. */
#ifdef SK_RLMT_MBUF_PRIVATE
SK_RLMT_MBUF Rlmt; /* Private part for RLMT. */
#endif /* SK_RLMT_MBUF_PRIVATE */
struct sk_buff *pOs; /* Pointer to message block */
};
/*
* ioctl definitions
*/
#define SK_IOCTL_BASE (SIOCDEVPRIVATE)
#define SK_IOCTL_GETMIB (SK_IOCTL_BASE + 0)
#define SK_IOCTL_SETMIB (SK_IOCTL_BASE + 1)
#define SK_IOCTL_PRESETMIB (SK_IOCTL_BASE + 2)
typedef struct s_IOCTL SK_GE_IOCTL;
struct s_IOCTL {
char* pData;
unsigned int Len;
};
/*
* define sizes of descriptor rings in bytes
*/
#if 0
#define TX_RING_SIZE (8*1024)
#define RX_RING_SIZE (24*1024)
#else
#define TX_RING_SIZE (10 * 40)
#define RX_RING_SIZE (10 * 40)
#endif
/*
* Buffer size for ethernet packets
*/
#define ETH_BUF_SIZE 1540
#define ETH_MAX_MTU 1514
#define ETH_MIN_MTU 60
#define ETH_MULTICAST_BIT 0x01
#define SK_JUMBO_MTU 9000
/*
* transmit priority selects the queue: LOW=asynchron, HIGH=synchron
*/
#define TX_PRIO_LOW 0
#define TX_PRIO_HIGH 1
/*
* alignment of rx/tx descriptors
*/
#define DESCR_ALIGN 8
/*
* definitions for pnmi. TODO
*/
#define SK_DRIVER_RESET(pAC, IoC) 0
#define SK_DRIVER_SENDEVENT(pAC, IoC) 0
#define SK_DRIVER_SELFTEST(pAC, IoC) 0
/* For get mtu you must add an own function */
#define SK_DRIVER_GET_MTU(pAc,IoC,i) 0
#define SK_DRIVER_SET_MTU(pAc,IoC,i,v) 0
#define SK_DRIVER_PRESET_MTU(pAc,IoC,i,v) 0
/* TX and RX descriptors *****************************************************/
typedef struct s_RxD RXD; /* the receive descriptor */
struct s_RxD {
volatile SK_U32 RBControl; /* Receive Buffer Control */
SK_U32 VNextRxd; /* Next receive descriptor,low dword */
SK_U32 VDataLow; /* Receive buffer Addr, low dword */
SK_U32 VDataHigh; /* Receive buffer Addr, high dword */
SK_U32 FrameStat; /* Receive Frame Status word */
SK_U32 TimeStamp; /* Time stamp from XMAC */
SK_U32 TcpSums; /* TCP Sum 2 / TCP Sum 1 */
SK_U32 TcpSumStarts; /* TCP Sum Start 2 / TCP Sum Start 1 */
RXD *pNextRxd; /* Pointer to next Rxd */
struct sk_buff *pMBuf; /* Pointer to Linux' socket buffer */
};
typedef struct s_TxD TXD; /* the transmit descriptor */
struct s_TxD {
volatile SK_U32 TBControl; /* Transmit Buffer Control */
SK_U32 VNextTxd; /* Next transmit descriptor,low dword */
SK_U32 VDataLow; /* Transmit Buffer Addr, low dword */
SK_U32 VDataHigh; /* Transmit Buffer Addr, high dword */
SK_U32 FrameStat; /* Transmit Frame Status Word */
SK_U32 TcpSumOfs; /* Reserved / TCP Sum Offset */
SK_U16 TcpSumSt; /* TCP Sum Start */
SK_U16 TcpSumWr; /* TCP Sum Write */
SK_U32 TcpReserved; /* not used */
TXD *pNextTxd; /* Pointer to next Txd */
struct sk_buff *pMBuf; /* Pointer to Linux' socket buffer */
};
/* definition of flags in descriptor control field */
#define RX_CTRL_OWN_BMU UINT32_C(0x80000000)
#define RX_CTRL_STF UINT32_C(0x40000000)
#define RX_CTRL_EOF UINT32_C(0x20000000)
#define RX_CTRL_EOB_IRQ UINT32_C(0x10000000)
#define RX_CTRL_EOF_IRQ UINT32_C(0x08000000)
#define RX_CTRL_DEV_NULL UINT32_C(0x04000000)
#define RX_CTRL_STAT_VALID UINT32_C(0x02000000)
#define RX_CTRL_TIME_VALID UINT32_C(0x01000000)
#define RX_CTRL_CHECK_DEFAULT UINT32_C(0x00550000)
#define RX_CTRL_CHECK_CSUM UINT32_C(0x00560000)
#define RX_CTRL_LEN_MASK UINT32_C(0x0000FFFF)
#define TX_CTRL_OWN_BMU UINT32_C(0x80000000)
#define TX_CTRL_STF UINT32_C(0x40000000)
#define TX_CTRL_EOF UINT32_C(0x20000000)
#define TX_CTRL_EOB_IRQ UINT32_C(0x10000000)
#define TX_CTRL_EOF_IRQ UINT32_C(0x08000000)
#define TX_CTRL_ST_FWD UINT32_C(0x04000000)
#define TX_CTRL_DISAB_CRC UINT32_C(0x02000000)
#define TX_CTRL_SOFTWARE UINT32_C(0x01000000)
#define TX_CTRL_CHECK_DEFAULT UINT32_C(0x00550000)
#define TX_CTRL_CHECK_CSUM UINT32_C(0x00560000)
#define TX_CTRL_LEN_MASK UINT32_C(0x0000FFFF)
/* The offsets of registers in the TX and RX queue control io area ***********/
#define RX_Q_BUF_CTRL_CNT 0x00
#define RX_Q_NEXT_DESCR_LOW 0x04
#define RX_Q_BUF_ADDR_LOW 0x08
#define RX_Q_BUF_ADDR_HIGH 0x0c
#define RX_Q_FRAME_STAT 0x10
#define RX_Q_TIME_STAMP 0x14
#define RX_Q_CSUM_1_2 0x18
#define RX_Q_CSUM_START_1_2 0x1c
#define RX_Q_CUR_DESCR_LOW 0x20
#define RX_Q_DESCR_HIGH 0x24
#define RX_Q_CUR_ADDR_LOW 0x28
#define RX_Q_CUR_ADDR_HIGH 0x2c
#define RX_Q_CUR_BYTE_CNT 0x30
#define RX_Q_CTRL 0x34
#define RX_Q_FLAG 0x38
#define RX_Q_TEST1 0x3c
#define RX_Q_TEST2 0x40
#define RX_Q_TEST3 0x44
#define TX_Q_BUF_CTRL_CNT 0x00
#define TX_Q_NEXT_DESCR_LOW 0x04
#define TX_Q_BUF_ADDR_LOW 0x08
#define TX_Q_BUF_ADDR_HIGH 0x0c
#define TX_Q_FRAME_STAT 0x10
#define TX_Q_CSUM_START 0x14
#define TX_Q_CSUM_START_POS 0x18
#define TX_Q_RESERVED 0x1c
#define TX_Q_CUR_DESCR_LOW 0x20
#define TX_Q_DESCR_HIGH 0x24
#define TX_Q_CUR_ADDR_LOW 0x28
#define TX_Q_CUR_ADDR_HIGH 0x2c
#define TX_Q_CUR_BYTE_CNT 0x30
#define TX_Q_CTRL 0x34
#define TX_Q_FLAG 0x38
#define TX_Q_TEST1 0x3c
#define TX_Q_TEST2 0x40
#define TX_Q_TEST3 0x44
/* definition of flags in the queue control field */
#define RX_Q_CTRL_POLL_ON 0x00000080
#define RX_Q_CTRL_POLL_OFF 0x00000040
#define RX_Q_CTRL_STOP 0x00000020
#define RX_Q_CTRL_START 0x00000010
#define RX_Q_CTRL_CLR_I_PAR 0x00000008
#define RX_Q_CTRL_CLR_I_EOB 0x00000004
#define RX_Q_CTRL_CLR_I_EOF 0x00000002
#define RX_Q_CTRL_CLR_I_ERR 0x00000001
#define TX_Q_CTRL_POLL_ON 0x00000080
#define TX_Q_CTRL_POLL_OFF 0x00000040
#define TX_Q_CTRL_STOP 0x00000020
#define TX_Q_CTRL_START 0x00000010
#define TX_Q_CTRL_CLR_I_EOB 0x00000004
#define TX_Q_CTRL_CLR_I_EOF 0x00000002
#define TX_Q_CTRL_CLR_I_ERR 0x00000001
/* Interrupt bits in the interrupts source register **************************/
#define IRQ_HW_ERROR 0x80000000
#define IRQ_RESERVED 0x40000000
#define IRQ_PKT_TOUT_RX1 0x20000000
#define IRQ_PKT_TOUT_RX2 0x10000000
#define IRQ_PKT_TOUT_TX1 0x08000000
#define IRQ_PKT_TOUT_TX2 0x04000000
#define IRQ_I2C_READY 0x02000000
#define IRQ_SW 0x01000000
#define IRQ_EXTERNAL_REG 0x00800000
#define IRQ_TIMER 0x00400000
#define IRQ_MAC1 0x00200000
#define IRQ_LINK_SYNC_C_M1 0x00100000
#define IRQ_MAC2 0x00080000
#define IRQ_LINK_SYNC_C_M2 0x00040000
#define IRQ_EOB_RX1 0x00020000
#define IRQ_EOF_RX1 0x00010000
#define IRQ_CHK_RX1 0x00008000
#define IRQ_EOB_RX2 0x00004000
#define IRQ_EOF_RX2 0x00002000
#define IRQ_CHK_RX2 0x00001000
#define IRQ_EOB_SY_TX1 0x00000800
#define IRQ_EOF_SY_TX1 0x00000400
#define IRQ_CHK_SY_TX1 0x00000200
#define IRQ_EOB_AS_TX1 0x00000100
#define IRQ_EOF_AS_TX1 0x00000080
#define IRQ_CHK_AS_TX1 0x00000040
#define IRQ_EOB_SY_TX2 0x00000020
#define IRQ_EOF_SY_TX2 0x00000010
#define IRQ_CHK_SY_TX2 0x00000008
#define IRQ_EOB_AS_TX2 0x00000004
#define IRQ_EOF_AS_TX2 0x00000002
#define IRQ_CHK_AS_TX2 0x00000001
#define DRIVER_IRQS (IRQ_SW | IRQ_EOF_RX1 | IRQ_EOF_RX2 | \
IRQ_EOF_SY_TX1 | IRQ_EOF_AS_TX1 | \
IRQ_EOF_SY_TX2 | IRQ_EOF_AS_TX2)
#define SPECIAL_IRQS (IRQ_HW_ERROR | IRQ_PKT_TOUT_RX1 | IRQ_PKT_TOUT_RX2 | \
IRQ_PKT_TOUT_TX1 | IRQ_PKT_TOUT_TX2 | \
IRQ_I2C_READY | IRQ_EXTERNAL_REG | IRQ_TIMER | \
IRQ_MAC1 | IRQ_LINK_SYNC_C_M1 | \
IRQ_MAC2 | IRQ_LINK_SYNC_C_M2 | \
IRQ_CHK_RX1 | IRQ_CHK_RX2 | \
IRQ_CHK_SY_TX1 | IRQ_CHK_AS_TX1 | \
IRQ_CHK_SY_TX2 | IRQ_CHK_AS_TX2)
#define IRQ_MASK (IRQ_SW | IRQ_EOB_RX1 | IRQ_EOF_RX1 | \
IRQ_EOB_RX2 | IRQ_EOF_RX2 | \
IRQ_EOB_SY_TX1 | IRQ_EOF_SY_TX1 | \
IRQ_EOB_AS_TX1 | IRQ_EOF_AS_TX1 | \
IRQ_EOB_SY_TX2 | IRQ_EOF_SY_TX2 | \
IRQ_EOB_AS_TX2 | IRQ_EOF_AS_TX2 | \
IRQ_HW_ERROR | IRQ_PKT_TOUT_RX1 | IRQ_PKT_TOUT_RX2 | \
IRQ_PKT_TOUT_TX1 | IRQ_PKT_TOUT_TX2 | \
IRQ_I2C_READY | IRQ_EXTERNAL_REG | IRQ_TIMER | \
IRQ_MAC1 | \
IRQ_MAC2 | \
IRQ_CHK_RX1 | IRQ_CHK_RX2 | \
IRQ_CHK_SY_TX1 | IRQ_CHK_AS_TX1 | \
IRQ_CHK_SY_TX2 | IRQ_CHK_AS_TX2)
#define IRQ_HWE_MASK 0x00000FFF /* enable all HW irqs */
typedef struct s_DevNet DEV_NET;
struct s_DevNet {
int PortNr;
int NetNr;
int Mtu;
int Up;
SK_AC *pAC;
};
typedef struct s_TxPort TX_PORT;
struct s_TxPort {
/* the transmit descriptor rings */
caddr_t pTxDescrRing; /* descriptor area memory */
SK_U64 VTxDescrRing; /* descr. area bus virt. addr. */
TXD *pTxdRingHead; /* Head of Tx rings */
TXD *pTxdRingTail; /* Tail of Tx rings */
TXD *pTxdRingPrev; /* descriptor sent previously */
int TxdRingFree; /* # of free entrys */
#if 0
spinlock_t TxDesRingLock; /* serialize descriptor accesses */
#endif
caddr_t HwAddr; /* bmu registers address */
int PortIndex; /* index number of port (0 or 1) */
};
typedef struct s_RxPort RX_PORT;
struct s_RxPort {
/* the receive descriptor rings */
caddr_t pRxDescrRing; /* descriptor area memory */
SK_U64 VRxDescrRing; /* descr. area bus virt. addr. */
RXD *pRxdRingHead; /* Head of Rx rings */
RXD *pRxdRingTail; /* Tail of Rx rings */
RXD *pRxdRingPrev; /* descriptor given to BMU previously */
int RxdRingFree; /* # of free entrys */
#if 0
spinlock_t RxDesRingLock; /* serialize descriptor accesses */
#endif
int RxFillLimit; /* limit for buffers in ring */
caddr_t HwAddr; /* bmu registers address */
int PortIndex; /* index number of port (0 or 1) */
};
typedef struct s_PerStrm PER_STRM;
#define SK_ALLOC_IRQ 0x00000001
/****************************************************************************
* Per board structure / Adapter Context structure:
* Allocated within attach(9e) and freed within detach(9e).
* Contains all 'per device' necessary handles, flags, locks etc.:
*/
struct s_AC {
SK_GEINIT GIni; /* GE init struct */
SK_PNMI Pnmi; /* PNMI data struct */
SK_VPD vpd; /* vpd data struct */
SK_QUEUE Event; /* Event queue */
SK_HWT Hwt; /* Hardware Timer control struct */
SK_TIMCTRL Tim; /* Software Timer control struct */
SK_I2C I2c; /* I2C relevant data structure */
SK_ADDR Addr; /* for Address module */
SK_CSUM Csum; /* for checksum module */
SK_RLMT Rlmt; /* for rlmt module */
#if 0
spinlock_t SlowPathLock; /* Normal IRQ lock */
#endif
SK_PNMI_STRUCT_DATA PnmiStruct; /* structure to get all Pnmi-Data */
int RlmtMode; /* link check mode to set */
int RlmtNets; /* Number of nets */
SK_IOC IoBase; /* register set of adapter */
int BoardLevel; /* level of active hw init (0-2) */
char DeviceStr[80]; /* adapter string from vpd */
SK_U32 AllocFlag; /* flag allocation of resources */
#if 0
struct pci_dev *PciDev; /* for access to pci config space */
SK_U32 PciDevId; /* pci device id */
#else
int PciDev;
#endif
struct SK_NET_DEVICE *dev[2]; /* pointer to device struct */
char Name[30]; /* driver name */
struct SK_NET_DEVICE *Next; /* link all devices (for clearing) */
int RxBufSize; /* length of receive buffers */
#if 0
struct net_device_stats stats; /* linux 'netstat -i' statistics */
#endif
int Index; /* internal board index number */
/* adapter RAM sizes for queues of active port */
int RxQueueSize; /* memory used for receive queue */
int TxSQueueSize; /* memory used for sync. tx queue */
int TxAQueueSize; /* memory used for async. tx queue */
int PromiscCount; /* promiscuous mode counter */
int AllMultiCount; /* allmulticast mode counter */
int MulticCount; /* number of different MC */
/* addresses for this board */
/* (may be more than HW can)*/
int HWRevision; /* Hardware revision */
int ActivePort; /* the active XMAC port */
int MaxPorts; /* number of activated ports */
int TxDescrPerRing; /* # of descriptors per tx ring */
int RxDescrPerRing; /* # of descriptors per rx ring */
caddr_t pDescrMem; /* Pointer to the descriptor area */
dma_addr_t pDescrMemDMA; /* PCI DMA address of area */
/* the port structures with descriptor rings */
TX_PORT TxPort[SK_MAX_MACS][2];
RX_PORT RxPort[SK_MAX_MACS];
unsigned int CsOfs1; /* for checksum calculation */
unsigned int CsOfs2; /* for checksum calculation */
SK_U32 CsOfs; /* for checksum calculation */
SK_BOOL CheckQueue; /* check event queue soon */
/* Only for tests */
int PortUp;
int PortDown;
};
#endif /* __INC_SKDRV2ND_H */

@ -0,0 +1,80 @@
/******************************************************************************
*
* Name: skerror.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.5 $
* Date: $Date: 2002/04/25 11:05:10 $
* Purpose: SK specific Error log support
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
* $Log: skerror.h,v $
* Revision 1.5 2002/04/25 11:05:10 rschmidt
* Editorial changes
*
* Revision 1.4 1999/11/22 13:51:59 cgoos
* Changed license header to GPL.
*
* Revision 1.3 1999/09/14 14:04:42 rwahl
* Added error base SK_ERRBASE_PECP.
* Changed error base for driver.
*
* Revision 1.2 1998/08/11 11:15:41 gklug
* chg: comments
*
* Revision 1.1 1998/08/11 11:09:38 gklug
* add: error bases
* add: error Classes
* first version
*
*
*
******************************************************************************/
#ifndef _INC_SKERROR_H_
#define _INC_SKERROR_H_
/*
* Define Error Classes
*/
#define SK_ERRCL_OTHER (0) /* Other error */
#define SK_ERRCL_CONFIG (1L<<0) /* Configuration error */
#define SK_ERRCL_INIT (1L<<1) /* Initialization error */
#define SK_ERRCL_NORES (1L<<2) /* Out of Resources error */
#define SK_ERRCL_SW (1L<<3) /* Internal Software error */
#define SK_ERRCL_HW (1L<<4) /* Hardware Failure */
#define SK_ERRCL_COMM (1L<<5) /* Communication error */
/*
* Define Error Code Bases
*/
#define SK_ERRBASE_RLMT 100 /* Base Error number for RLMT */
#define SK_ERRBASE_HWINIT 200 /* Base Error number for HWInit */
#define SK_ERRBASE_VPD 300 /* Base Error number for VPD */
#define SK_ERRBASE_PNMI 400 /* Base Error number for PNMI */
#define SK_ERRBASE_CSUM 500 /* Base Error number for Checksum */
#define SK_ERRBASE_SIRQ 600 /* Base Error number for Special IRQ */
#define SK_ERRBASE_I2C 700 /* Base Error number for I2C module */
#define SK_ERRBASE_QUEUE 800 /* Base Error number for Scheduler */
#define SK_ERRBASE_ADDR 900 /* Base Error number for Address module */
#define SK_ERRBASE_PECP 1000 /* Base Error number for PECP */
#define SK_ERRBASE_DRV 1100 /* Base Error number for Driver */
#endif /* _INC_SKERROR_H_ */

@ -0,0 +1,72 @@
/******************************************************************************
*
* Name: skgedrv.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.6 $
* Date: $Date: 2002/07/15 15:38:01 $
* Purpose: Interface with the driver
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: skgedrv.h,v $
* Revision 1.6 2002/07/15 15:38:01 rschmidt
* Power Management support
* Editorial changes
*
* Revision 1.5 2002/04/25 11:05:47 rschmidt
* Editorial changes
*
* Revision 1.4 1999/11/22 13:52:46 cgoos
* Changed license header to GPL.
*
* Revision 1.3 1998/12/01 13:31:39 cgoos
* SWITCH INTERN Event added.
*
* Revision 1.2 1998/11/25 08:28:38 gklug
* rmv: PORT SWITCH Event
*
* Revision 1.1 1998/09/29 06:14:07 gklug
* add: driver events (initial version)
*
*
******************************************************************************/
#ifndef __INC_SKGEDRV_H_
#define __INC_SKGEDRV_H_
/* defines ********************************************************************/
/*
* Define the driver events.
* Usually the events are defined by the destination module.
* In case of the driver we put the definition of the events here.
*/
#define SK_DRV_PORT_RESET 1 /* The port needs to be reset */
#define SK_DRV_NET_UP 2 /* The net is operational */
#define SK_DRV_NET_DOWN 3 /* The net is down */
#define SK_DRV_SWITCH_SOFT 4 /* Ports switch with both links connected */
#define SK_DRV_SWITCH_HARD 5 /* Port switch due to link failure */
#define SK_DRV_RLMT_SEND 6 /* Send a RLMT packet */
#define SK_DRV_ADAP_FAIL 7 /* The whole adapter fails */
#define SK_DRV_PORT_FAIL 8 /* One port fails */
#define SK_DRV_SWITCH_INTERN 9 /* Port switch by the driver itself */
#define SK_DRV_POWER_DOWN 10 /* Power down mode */
#endif /* __INC_SKGEDRV_H_ */

File diff suppressed because it is too large Load Diff

@ -0,0 +1,74 @@
/******************************************************************************
*
* Name: skhwt.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.5 $
* Date: $Date: 1999/11/22 13:54:24 $
* Purpose: Defines for the hardware timer functions
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998,1999 SysKonnect,
* a business unit of Schneider & Koch & Co. Datensysteme GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: skgehwt.h,v $
* Revision 1.5 1999/11/22 13:54:24 cgoos
* Changed license header to GPL.
*
* Revision 1.4 1998/08/19 09:50:58 gklug
* fix: remove struct keyword from c-code (see CCC) add typedefs
*
* Revision 1.3 1998/08/14 07:09:29 gklug
* fix: chg pAc -> pAC
*
* Revision 1.2 1998/08/07 12:54:21 gklug
* fix: first compiled version
*
* Revision 1.1 1998/08/07 09:32:58 gklug
* first version
*
*
*
*
*
******************************************************************************/
/*
* SKGEHWT.H contains all defines and types for the timer functions
*/
#ifndef _SKGEHWT_H_
#define _SKGEHWT_H_
/*
* SK Hardware Timer
* - needed wherever the HWT module is used
* - use in Adapters context name pAC->Hwt
*/
typedef struct s_Hwt {
SK_U32 TStart ; /* HWT start */
SK_U32 TStop ; /* HWT stop */
int TActive ; /* HWT: flag : active/inactive */
} SK_HWT;
extern void SkHwtInit(SK_AC *pAC, SK_IOC Ioc);
extern void SkHwtStart(SK_AC *pAC, SK_IOC Ioc, SK_U32 Time);
extern void SkHwtStop(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);
#endif /* _SKGEHWT_H_ */

@ -0,0 +1,299 @@
/******************************************************************************
*
* Name: skgei2c.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.23 $
* Date: $Date: 2002/12/19 14:34:27 $
* Purpose: Special GEnesis defines for TWSI
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: skgei2c.h,v $
* Revision 1.23 2002/12/19 14:34:27 rschmidt
* Added cast in macros SK_I2C_SET_BIT() and SK_I2C_CLR_BIT()
* Editorial changes (TWSI)
*
* Revision 1.22 2002/10/14 16:45:56 rschmidt
* Editorial changes (TWSI)
*
* Revision 1.21 2002/08/13 08:42:24 rschmidt
* Changed define for SK_MIN_SENSORS back to 5
* Merged defines for PHY PLL 3V3 voltage (A and B)
* Editorial changes
*
* Revision 1.20 2002/08/06 09:43:56 jschmalz
* Extensions and changes for Yukon
*
* Revision 1.19 2002/08/02 12:00:08 rschmidt
* Added defines for YUKON sensors
* Editorial changes
*
* Revision 1.18 2001/08/16 12:44:33 afischer
* LM80 sensor init values corrected
*
* Revision 1.17 1999/11/22 13:55:25 cgoos
* Changed license header to GPL.
*
* Revision 1.16 1999/11/12 08:24:10 malthoff
* Change voltage warning and error limits
* (warning +-5%, error +-10%).
*
* Revision 1.15 1999/09/14 14:14:43 malthoff
* The 1000BT Dual Link adapter has got only one Fan.
* The second Fan has been removed.
*
* Revision 1.14 1999/05/27 13:40:50 malthoff
* Fan Divisor = 1. Assuming fan with 6500 rpm.
*
* Revision 1.13 1999/05/20 14:56:55 malthoff
* Bug Fix: Missing brace in SK_LM80_FAN_FAKTOR.
*
* Revision 1.12 1999/05/20 09:22:00 cgoos
* Changes for 1000Base-T (Fan sensors).
*
* Revision 1.11 1998/10/14 05:57:22 cgoos
* Fixed compilation warnings.
*
* Revision 1.10 1998/09/04 08:37:00 malthoff
* bugfix: correct the SK_I2C_GET_CTL() macro.
*
* Revision 1.9 1998/08/25 06:10:03 gklug
* add: thresholds for all sensors
*
* Revision 1.8 1998/08/20 11:37:42 gklug
* chg: change Ioc to IoC
*
* Revision 1.7 1998/08/20 08:53:11 gklug
* fix: compiler errors
* add: Threshold values
*
* Revision 1.6 1998/08/17 11:37:09 malthoff
* Bugfix in SK_I2C_CTL macro. The parameter 'dev'
* has to be shifted 9 bits.
*
* Revision 1.5 1998/08/17 06:52:21 malthoff
* Remove unrequired macros.
* Add macros for accessing TWSI SW register.
*
* Revision 1.4 1998/08/13 08:30:18 gklug
* add: conversion factors for read values
* add: new state SEN_VALEXT to read extension value of temperature sensor
*
* Revision 1.3 1998/08/12 13:37:56 gklug
* rmv: error numbers and messages
*
* Revision 1.2 1998/08/11 07:54:38 gklug
* add: sensor states for GE sensors
* add: Macro to access TWSI hardware register
* chg: Error messages for TWSI errors
*
* Revision 1.1 1998/07/17 11:27:56 gklug
* Created.
*
*
*
******************************************************************************/
/*
* SKGEI2C.H contains all SK-98xx specific defines for the TWSI handling
*/
#ifndef _INC_SKGEI2C_H_
#define _INC_SKGEI2C_H_
/*
* Macros to access the B2_I2C_CTRL
*/
#define SK_I2C_CTL(IoC, flag, dev, reg, burst) \
SK_OUT32(IoC, B2_I2C_CTRL,\
(flag ? 0x80000000UL : 0x0L) | \
(((SK_U32) reg << 16) & I2C_ADDR) | \
(((SK_U32) dev << 9) & I2C_DEV_SEL) | \
(( burst << 4) & I2C_BURST_LEN))
#define SK_I2C_STOP(IoC) { \
SK_U32 I2cCtrl; \
SK_IN32(IoC, B2_I2C_CTRL, &I2cCtrl); \
SK_OUT32(IoC, B2_I2C_CTRL, I2cCtrl | I2C_STOP); \
}
#define SK_I2C_GET_CTL(IoC, pI2cCtrl) SK_IN32(IoC, B2_I2C_CTRL, pI2cCtrl)
/*
* Macros to access the TWSI SW Registers
*/
#define SK_I2C_SET_BIT(IoC, SetBits) { \
SK_U8 OrgBits; \
SK_IN8(IoC, B2_I2C_SW, &OrgBits); \
SK_OUT8(IoC, B2_I2C_SW, OrgBits | (SK_U8)(SetBits)); \
}
#define SK_I2C_CLR_BIT(IoC, ClrBits) { \
SK_U8 OrgBits; \
SK_IN8(IoC, B2_I2C_SW, &OrgBits); \
SK_OUT8(IoC, B2_I2C_SW, OrgBits & ~((SK_U8)(ClrBits))); \
}
#define SK_I2C_GET_SW(IoC, pI2cSw) SK_IN8(IoC, B2_I2C_SW, pI2cSw)
/*
* define the possible sensor states
*/
#define SK_SEN_IDLE 0 /* Idle: sensor not read */
#define SK_SEN_VALUE 1 /* Value Read cycle */
#define SK_SEN_VALEXT 2 /* Extended Value Read cycle */
/*
* Conversion factor to convert read Voltage sensor to milli Volt
* Conversion factor to convert read Temperature sensor to 10th degree Celsius
*/
#define SK_LM80_VT_LSB 22 /* 22mV 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
* extension value
*/
#define SK_LM80_FAN_FAKTOR ((22500L*60)/(1*2))
/* formula: counter = (22500*60)/(rpm * divisor * pulses/2)
* assuming: 6500rpm, 4 pulses, divisor 1
*/
/*
* Define sensor management data
* Maximum is reached on copperfield with dual Broadcom.
* Board specific maximum is in pAC->I2c.MaxSens
*/
#define SK_MAX_SENSORS 8 /* maximal 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
*/
#define SK_TIMER_WATCH_STATEMACHINE 0 /* Watch the statemachine to finish in a specific time */
#define SK_TIMER_NEW_GAUGING 1 /* Start a new gauging when timer expires */
/*
* Defines for the individual Thresholds
*/
/* Temperature sensor */
#define SK_SEN_TEMP_HIGH_ERR 800 /* Temperature High Err Threshold */
#define SK_SEN_TEMP_HIGH_WARN 700 /* Temperature High Warn Threshold */
#define SK_SEN_TEMP_LOW_WARN 100 /* Temperature Low Warn Threshold */
#define SK_SEN_TEMP_LOW_ERR 0 /* Temperature Low Err Threshold */
/* VCC which should be 5 V */
#define SK_SEN_PCI_5V_HIGH_ERR 5588 /* Voltage PCI High Err Threshold */
#define SK_SEN_PCI_5V_HIGH_WARN 5346 /* Voltage PCI High Warn Threshold */
#define SK_SEN_PCI_5V_LOW_WARN 4664 /* Voltage PCI Low Warn Threshold */
#define SK_SEN_PCI_5V_LOW_ERR 4422 /* Voltage PCI Low Err Threshold */
/*
* VIO may be 5 V or 3.3 V. Initialization takes two parts:
* 1. Initialize lowest lower limit and highest higher limit.
* 2. After the first value is read correct the upper or the lower limit to
* the appropriate C constant.
*
* Warning limits are +-5% of the exepected voltage.
* Error limits are +-10% of the expected voltage.
*/
/* Bug fix AF: 16.Aug.2001: Correct the init base of LM80 sensor */
#define SK_SEN_PCI_IO_5V_HIGH_ERR 5566 /* + 10% V PCI-IO High Err Threshold */
#define SK_SEN_PCI_IO_5V_HIGH_WARN 5324 /* + 5% V PCI-IO High Warn Threshold */
/* 5000 mVolt */
#define SK_SEN_PCI_IO_5V_LOW_WARN 4686 /* - 5% V PCI-IO Low Warn Threshold */
#define SK_SEN_PCI_IO_5V_LOW_ERR 4444 /* - 10% V PCI-IO Low Err Threshold */
#define SK_SEN_PCI_IO_RANGE_LIMITER 4000 /* 4000 mV range delimiter */
/* correction values for the second pass */
#define SK_SEN_PCI_IO_3V3_HIGH_ERR 3850 /* + 15% V PCI-IO High Err Threshold */
#define SK_SEN_PCI_IO_3V3_HIGH_WARN 3674 /* + 10% V PCI-IO High Warn Threshold */
/* 3300 mVolt */
#define SK_SEN_PCI_IO_3V3_LOW_WARN 2926 /* - 10% V PCI-IO Low Warn Threshold */
#define SK_SEN_PCI_IO_3V3_LOW_ERR 2772 /* - 15% V PCI-IO Low Err Threshold */
/*
* VDD voltage
*/
#define SK_SEN_VDD_HIGH_ERR 3630 /* Voltage ASIC High Err Threshold */
#define SK_SEN_VDD_HIGH_WARN 3476 /* Voltage ASIC High Warn Threshold */
#define SK_SEN_VDD_LOW_WARN 3146 /* Voltage ASIC Low Warn Threshold */
#define SK_SEN_VDD_LOW_ERR 2970 /* Voltage ASIC Low Err Threshold */
/*
* PHY PLL 3V3 voltage
*/
#define SK_SEN_PLL_3V3_HIGH_ERR 3630 /* Voltage PMA High Err Threshold */
#define SK_SEN_PLL_3V3_HIGH_WARN 3476 /* Voltage PMA High Warn Threshold */
#define SK_SEN_PLL_3V3_LOW_WARN 3146 /* Voltage PMA Low Warn Threshold */
#define SK_SEN_PLL_3V3_LOW_ERR 2970 /* Voltage PMA Low Err Threshold */
/*
* VAUX (YUKON only)
*/
#define SK_SEN_VAUX_3V3_HIGH_ERR 3630 /* Voltage VAUX High Err Threshold */
#define SK_SEN_VAUX_3V3_HIGH_WARN 3476 /* Voltage VAUX High Warn Threshold */
#define SK_SEN_VAUX_3V3_LOW_WARN 3146 /* Voltage VAUX Low Warn Threshold */
#define SK_SEN_VAUX_3V3_LOW_ERR 2970 /* Voltage VAUX Low Err Threshold */
#define SK_SEN_VAUX_0V_WARN_ERR 0 /* if VAUX not present */
#define SK_SEN_VAUX_RANGE_LIMITER 1000 /* 1000 mV range delimiter */
/*
* PHY 2V5 voltage
*/
#define SK_SEN_PHY_2V5_HIGH_ERR 2750 /* Voltage PHY High Err Threshold */
#define SK_SEN_PHY_2V5_HIGH_WARN 2640 /* Voltage PHY High Warn Threshold */
#define SK_SEN_PHY_2V5_LOW_WARN 2376 /* Voltage PHY Low Warn Threshold */
#define SK_SEN_PHY_2V5_LOW_ERR 2222 /* Voltage PHY Low Err Threshold */
/*
* ASIC Core 1V5 voltage (YUKON only)
*/
#define SK_SEN_CORE_1V5_HIGH_ERR 1650 /* Voltage ASIC Core High Err Threshold */
#define SK_SEN_CORE_1V5_HIGH_WARN 1575 /* Voltage ASIC Core High Warn Threshold */
#define SK_SEN_CORE_1V5_LOW_WARN 1425 /* Voltage ASIC Core Low Warn Threshold */
#define SK_SEN_CORE_1V5_LOW_ERR 1350 /* Voltage ASIC Core Low Err Threshold */
/*
* FAN 1 speed
*/
/* assuming: 6500rpm +-15%, 4 pulses,
* warning at: 80 %
* error at: 70 %
* no upper limit
*/
#define SK_SEN_FAN_HIGH_ERR 20000 /* FAN Speed High Err Threshold */
#define SK_SEN_FAN_HIGH_WARN 20000 /* FAN Speed High Warn Threshold */
#define SK_SEN_FAN_LOW_WARN 5200 /* FAN Speed Low Warn Threshold */
#define SK_SEN_FAN_LOW_ERR 4550 /* FAN Speed Low Err Threshold */
/*
* Some Voltages need dynamic thresholds
*/
#define SK_SEN_DYN_INIT_NONE 0 /* No dynamic init of thresholds */
#define SK_SEN_DYN_INIT_PCI_IO 10 /* Init PCI-IO with new thresholds */
#define SK_SEN_DYN_INIT_VAUX 11 /* Init VAUX with new thresholds */
extern int SkLm80ReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen);
#endif /* n_INC_SKGEI2C_H */

File diff suppressed because it is too large Load Diff

@ -0,0 +1,462 @@
/*****************************************************************************
*
* Name: skgepnm2.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.34 $
* Date: $Date: 2002/12/16 09:05:18 $
* Purpose: Defines for Private Network Management Interface
*
****************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2001 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/*****************************************************************************
*
* History:
*
* $Log: skgepnm2.h,v $
* Revision 1.34 2002/12/16 09:05:18 tschilli
* Code for VCT handling added.
*
* Revision 1.33 2002/09/10 09:00:03 rwahl
* Adapted boolean definitions according sktypes.
*
* Revision 1.32 2002/08/09 09:47:01 rwahl
* Added write-only flag to oid access defines.
* Editorial changes.
*
* Revision 1.31 2002/07/17 19:23:18 rwahl
* - Replaced MAC counter definitions by enumeration.
* - Added definition SK_PNMI_MAC_TYPES.
* - Added chipset defnition for Yukon.
*
* Revision 1.30 2001/02/06 10:03:41 mkunz
* - Pnmi V4 dual net support added. Interface functions and macros extended
* - Vpd bug fixed
* - OID_SKGE_MTU added
*
* Revision 1.29 2001/01/22 13:41:37 rassmann
* Supporting two nets on dual-port adapters.
*
* Revision 1.28 2000/08/03 15:12:48 rwahl
* - Additional comment for MAC statistic data structure.
*
* Revision 1.27 2000/08/01 16:10:18 rwahl
* - Added mac statistic data structure for StatRxLongFrame counter.
*
* Revision 1.26 2000/03/31 13:51:34 rwahl
* Added SK_UPTR cast to offset calculation for PNMI struct fields;
* missing cast caused compiler warnings by Win64 compiler.
*
* Revision 1.25 1999/11/22 13:57:41 cgoos
* Changed license header to GPL.
* Allowing overwrite for SK_PNMI_STORE/_READ defines.
*
* Revision 1.24 1999/04/13 15:11:11 mhaveman
* Changed copyright.
*
* Revision 1.23 1999/01/28 15:07:12 mhaveman
* Changed default threshold for port switches per hour from 10
* to 240 which means 4 switches per minute. This fits better
* the granularity of 32 for the port switch estimate
* counter.
*
* Revision 1.22 1999/01/05 12:52:30 mhaveman
* Removed macro SK_PNMI_MICRO_SEC.
*
* Revision 1.21 1999/01/05 12:50:34 mhaveman
* Enlarged macro definition SK_PNMI_HUNDREDS_SEC() so that no 64-bit
* arithmetic is necessary if SK_TICKS_PER_SEC is 100.
*
* Revision 1.20 1998/12/09 14:02:53 mhaveman
* Defined macro SK_PNMI_DEF_RLMT_CHG_THRES for default port switch
* threshold.
*
* Revision 1.19 1998/12/03 11:28:41 mhaveman
* Removed SK_PNMI_CHECKPTR macro.
*
* Revision 1.18 1998/12/03 11:21:00 mhaveman
* -Added pointer check macro SK_PNMI_CHECKPTR
* -Added macros SK_PNMI_VPD_ARR_SIZE and SK_PNMI_VPD_STR_SIZE for
* VPD key evaluation.
*
* Revision 1.17 1998/11/20 13:20:33 mhaveman
* Fixed bug in SK_PNMI_SET_STAT macro. ErrorStatus was not correctly set.
*
* Revision 1.16 1998/11/20 08:08:49 mhaveman
* Macro SK_PNMI_CHECKFLAGS has got a if clause.
*
* Revision 1.15 1998/11/03 13:53:40 mhaveman
* Fixed alignment problem in macor SK_PNMI_SET_STAT macro.
*
* Revision 1.14 1998/10/30 15:50:13 mhaveman
* Added macro SK_PNMI_MICRO_SEC()
*
* Revision 1.13 1998/10/30 12:32:20 mhaveman
* Added forgotten cast in SK_PNMI_READ_U32 macro.
*
* Revision 1.12 1998/10/29 15:40:26 mhaveman
* -Changed SK_PNMI_TRAP_SENSOR_LEN because SensorDescr has now
* variable string length.
* -Defined SK_PNMI_CHECKFLAGS macro
*
* Revision 1.11 1998/10/29 08:53:34 mhaveman
* Removed SK_PNMI_RLM_XXX table indexed because these counters need
* not been saved over XMAC resets.
*
* Revision 1.10 1998/10/28 08:48:20 mhaveman
* -Added macros for storage according to alignment
* -Changed type of Instance to SK_U32 because of VPD
* -Removed trap structures. Not needed because of alignment problem
* -Changed type of Action form SK_U8 to int
*
* Revision 1.9 1998/10/21 13:34:45 mhaveman
* Shit, mismatched calculation of SK_PNMI_HUNDREDS_SEC. Corrected.
*
* Revision 1.8 1998/10/21 13:24:58 mhaveman
* Changed calculation of hundreds of seconds.
*
* Revision 1.7 1998/10/20 07:31:41 mhaveman
* Made type changes to unsigned int where possible.
*
* Revision 1.6 1998/09/04 17:04:05 mhaveman
* Added Sync counters to offset storage to provided settled values on
* port switch.
*
* Revision 1.5 1998/09/04 12:45:35 mhaveman
* Removed dummies for SK_DRIVER_ macros. They should be added by driver
* writer in skdrv2nd.h.
*
* Revision 1.4 1998/09/04 11:59:50 mhaveman
* Everything compiles now. Driver Macros for counting still missing.
*
* Revision 1.3 1998/08/24 12:01:35 mhaveman
* Intermediate state.
*
* Revision 1.2 1998/08/17 07:51:40 mhaveman
* Intermediate state.
*
* Revision 1.1 1998/08/11 09:08:40 mhaveman
* Intermediate state.
*
****************************************************************************/
#ifndef _SKGEPNM2_H_
#define _SKGEPNM2_H_
/*
* General definitions
*/
#define SK_PNMI_CHIPSET_XMAC 1 /* XMAC11800FP */
#define SK_PNMI_CHIPSET_YUKON 2 /* YUKON */
#define SK_PNMI_BUS_PCI 1 /* PCI bus*/
/*
* Actions
*/
#define SK_PNMI_ACT_IDLE 1
#define SK_PNMI_ACT_RESET 2
#define SK_PNMI_ACT_SELFTEST 3
#define SK_PNMI_ACT_RESETCNT 4
/*
* VPD releated defines
*/
#define SK_PNMI_VPD_RW 1
#define SK_PNMI_VPD_RO 2
#define SK_PNMI_VPD_OK 0
#define SK_PNMI_VPD_NOTFOUND 1
#define SK_PNMI_VPD_CUT 2
#define SK_PNMI_VPD_TIMEOUT 3
#define SK_PNMI_VPD_FULL 4
#define SK_PNMI_VPD_NOWRITE 5
#define SK_PNMI_VPD_FATAL 6
#define SK_PNMI_VPD_IGNORE 0
#define SK_PNMI_VPD_CREATE 1
#define SK_PNMI_VPD_DELETE 2
/*
* RLMT related defines
*/
#define SK_PNMI_DEF_RLMT_CHG_THRES 240 /* 4 changes per minute */
/*
* VCT internal status values
*/
#define SK_PNMI_VCT_PENDING 32
#define SK_PNMI_VCT_TEST_DONE 64
#define SK_PNMI_VCT_LINK 128
/*
* Internal table definitions
*/
#define SK_PNMI_GET 0
#define SK_PNMI_PRESET 1
#define SK_PNMI_SET 2
#define SK_PNMI_RO 0
#define SK_PNMI_RW 1
#define SK_PNMI_WO 2
typedef struct s_OidTabEntry {
SK_U32 Id;
SK_U32 InstanceNo;
unsigned int StructSize;
unsigned int Offset;
int Access;
int (* Func)(SK_AC *pAc, SK_IOC pIo, int action,
SK_U32 Id, char* pBuf, unsigned int* pLen,
SK_U32 Instance, unsigned int TableIndex,
SK_U32 NetNumber);
SK_U16 Param;
} SK_PNMI_TAB_ENTRY;
/*
* Trap lengths
*/
#define SK_PNMI_TRAP_SIMPLE_LEN 17
#define SK_PNMI_TRAP_SENSOR_LEN_BASE 46
#define SK_PNMI_TRAP_RLMT_CHANGE_LEN 23
#define SK_PNMI_TRAP_RLMT_PORT_LEN 23
/*
* Number of MAC types supported
*/
#define SK_PNMI_MAC_TYPES (SK_MAC_GMAC + 1)
/*
* MAC statistic data list (overall set for MAC types used)
*/
enum SK_MACSTATS {
SK_PNMI_HTX = 0,
SK_PNMI_HTX_OCTET,
SK_PNMI_HTX_OCTETHIGH = SK_PNMI_HTX_OCTET,
SK_PNMI_HTX_OCTETLOW,
SK_PNMI_HTX_BROADCAST,
SK_PNMI_HTX_MULTICAST,
SK_PNMI_HTX_UNICAST,
SK_PNMI_HTX_BURST,
SK_PNMI_HTX_PMACC,
SK_PNMI_HTX_MACC,
SK_PNMI_HTX_COL,
SK_PNMI_HTX_SINGLE_COL,
SK_PNMI_HTX_MULTI_COL,
SK_PNMI_HTX_EXCESS_COL,
SK_PNMI_HTX_LATE_COL,
SK_PNMI_HTX_DEFFERAL,
SK_PNMI_HTX_EXCESS_DEF,
SK_PNMI_HTX_UNDERRUN,
SK_PNMI_HTX_CARRIER,
SK_PNMI_HTX_UTILUNDER,
SK_PNMI_HTX_UTILOVER,
SK_PNMI_HTX_64,
SK_PNMI_HTX_127,
SK_PNMI_HTX_255,
SK_PNMI_HTX_511,
SK_PNMI_HTX_1023,
SK_PNMI_HTX_MAX,
SK_PNMI_HTX_LONGFRAMES,
SK_PNMI_HTX_SYNC,
SK_PNMI_HTX_SYNC_OCTET,
SK_PNMI_HTX_RESERVED,
SK_PNMI_HRX,
SK_PNMI_HRX_OCTET,
SK_PNMI_HRX_OCTETHIGH = SK_PNMI_HRX_OCTET,
SK_PNMI_HRX_OCTETLOW,
SK_PNMI_HRX_BADOCTET,
SK_PNMI_HRX_BADOCTETHIGH = SK_PNMI_HRX_BADOCTET,
SK_PNMI_HRX_BADOCTETLOW,
SK_PNMI_HRX_BROADCAST,
SK_PNMI_HRX_MULTICAST,
SK_PNMI_HRX_UNICAST,
SK_PNMI_HRX_PMACC,
SK_PNMI_HRX_MACC,
SK_PNMI_HRX_PMACC_ERR,
SK_PNMI_HRX_MACC_UNKWN,
SK_PNMI_HRX_BURST,
SK_PNMI_HRX_MISSED,
SK_PNMI_HRX_FRAMING,
SK_PNMI_HRX_UNDERSIZE,
SK_PNMI_HRX_OVERFLOW,
SK_PNMI_HRX_JABBER,
SK_PNMI_HRX_CARRIER,
SK_PNMI_HRX_IRLENGTH,
SK_PNMI_HRX_SYMBOL,
SK_PNMI_HRX_SHORTS,
SK_PNMI_HRX_RUNT,
SK_PNMI_HRX_TOO_LONG,
SK_PNMI_HRX_FCS,
SK_PNMI_HRX_CEXT,
SK_PNMI_HRX_UTILUNDER,
SK_PNMI_HRX_UTILOVER,
SK_PNMI_HRX_64,
SK_PNMI_HRX_127,
SK_PNMI_HRX_255,
SK_PNMI_HRX_511,
SK_PNMI_HRX_1023,
SK_PNMI_HRX_MAX,
SK_PNMI_HRX_LONGFRAMES,
SK_PNMI_HRX_RESERVED,
SK_PNMI_MAX_IDX /* NOTE: Ensure SK_PNMI_CNT_NO is set to this value */
};
/*
* MAC specific data
*/
typedef struct s_PnmiStatAddr {
SK_U16 Reg; /* MAC register containing the value */
SK_BOOL GetOffset; /* TRUE: Offset managed by PNMI (call GetStatVal())*/
} SK_PNMI_STATADDR;
/*
* SK_PNMI_STRUCT_DATA copy offset evaluation macros
*/
#define SK_PNMI_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_STRUCT_DATA *)0)->e))
#define SK_PNMI_MAI_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_STRUCT_DATA *)0)->e))
#define SK_PNMI_VPD_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_VPD *)0)->e))
#define SK_PNMI_SEN_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_SENSOR *)0)->e))
#define SK_PNMI_CHK_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_CHECKSUM *)0)->e))
#define SK_PNMI_STA_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_STAT *)0)->e))
#define SK_PNMI_CNF_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_CONF *)0)->e))
#define SK_PNMI_RLM_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_RLMT *)0)->e))
#define SK_PNMI_MON_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_RLMT_MONITOR *)0)->e))
#define SK_PNMI_TRP_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_TRAP *)0)->e))
#define SK_PNMI_SET_STAT(b,s,o) {SK_U32 Val32; char *pVal; \
Val32 = (s); \
pVal = (char *)(b) + ((SK_U32)(SK_UPTR) \
&(((SK_PNMI_STRUCT_DATA *)0)-> \
ReturnStatus.ErrorStatus)); \
SK_PNMI_STORE_U32(pVal, Val32); \
Val32 = (o); \
pVal = (char *)(b) + ((SK_U32)(SK_UPTR) \
&(((SK_PNMI_STRUCT_DATA *)0)-> \
ReturnStatus.ErrorOffset)); \
SK_PNMI_STORE_U32(pVal, Val32);}
/*
* Time macros
*/
#if SK_TICKS_PER_SEC == 100
#define SK_PNMI_HUNDREDS_SEC(t) (t)
#else
#define SK_PNMI_HUNDREDS_SEC(t) (((t) * 100) / (SK_TICKS_PER_SEC))
#endif
/*
* Macros to work around alignment problems
*/
#ifndef SK_PNMI_STORE_U16
#define SK_PNMI_STORE_U16(p,v) {*(char *)(p) = *((char *)&(v)); \
*((char *)(p) + 1) = \
*(((char *)&(v)) + 1);}
#endif
#ifndef SK_PNMI_STORE_U32
#define SK_PNMI_STORE_U32(p,v) {*(char *)(p) = *((char *)&(v)); \
*((char *)(p) + 1) = \
*(((char *)&(v)) + 1); \
*((char *)(p) + 2) = \
*(((char *)&(v)) + 2); \
*((char *)(p) + 3) = \
*(((char *)&(v)) + 3);}
#endif
#ifndef SK_PNMI_STORE_U64
#define SK_PNMI_STORE_U64(p,v) {*(char *)(p) = *((char *)&(v)); \
*((char *)(p) + 1) = \
*(((char *)&(v)) + 1); \
*((char *)(p) + 2) = \
*(((char *)&(v)) + 2); \
*((char *)(p) + 3) = \
*(((char *)&(v)) + 3); \
*((char *)(p) + 4) = \
*(((char *)&(v)) + 4); \
*((char *)(p) + 5) = \
*(((char *)&(v)) + 5); \
*((char *)(p) + 6) = \
*(((char *)&(v)) + 6); \
*((char *)(p) + 7) = \
*(((char *)&(v)) + 7);}
#endif
#ifndef SK_PNMI_READ_U16
#define SK_PNMI_READ_U16(p,v) {*((char *)&(v)) = *(char *)(p); \
*(((char *)&(v)) + 1) = \
*((char *)(p) + 1);}
#endif
#ifndef SK_PNMI_READ_U32
#define SK_PNMI_READ_U32(p,v) {*((char *)&(v)) = *(char *)(p); \
*(((char *)&(v)) + 1) = \
*((char *)(p) + 1); \
*(((char *)&(v)) + 2) = \
*((char *)(p) + 2); \
*(((char *)&(v)) + 3) = \
*((char *)(p) + 3);}
#endif
#ifndef SK_PNMI_READ_U64
#define SK_PNMI_READ_U64(p,v) {*((char *)&(v)) = *(char *)(p); \
*(((char *)&(v)) + 1) = \
*((char *)(p) + 1); \
*(((char *)&(v)) + 2) = \
*((char *)(p) + 2); \
*(((char *)&(v)) + 3) = \
*((char *)(p) + 3); \
*(((char *)&(v)) + 4) = \
*((char *)(p) + 4); \
*(((char *)&(v)) + 5) = \
*((char *)(p) + 5); \
*(((char *)&(v)) + 6) = \
*((char *)(p) + 6); \
*(((char *)&(v)) + 7) = \
*((char *)(p) + 7);}
#endif
/*
* Macros for Debug
*/
#ifdef DEBUG
#define SK_PNMI_CHECKFLAGS(vSt) {if (pAC->Pnmi.MacUpdatedFlag > 0 || \
pAC->Pnmi.RlmtUpdatedFlag > 0 || \
pAC->Pnmi.SirqUpdatedFlag > 0) { \
SK_DBG_MSG(pAC, \
SK_DBGMOD_PNMI, \
SK_DBGCAT_CTRL, \
("PNMI: ERR: %s MacUFlag=%d, RlmtUFlag=%d, SirqUFlag=%d\n", \
vSt, \
pAC->Pnmi.MacUpdatedFlag, \
pAC->Pnmi.RlmtUpdatedFlag, \
pAC->Pnmi.SirqUpdatedFlag))}}
#else /* !DEBUG */
#define SK_PNMI_CHECKFLAGS(vSt) /* Nothing */
#endif /* !DEBUG */
#endif /* _SKGEPNM2_H_ */

File diff suppressed because it is too large Load Diff

@ -0,0 +1,194 @@
/******************************************************************************
*
* Name: skgesirq.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.26 $
* Date: $Date: 2002/10/14 09:52:36 $
* Purpose: SK specific Gigabit Ethernet special IRQ functions
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
* $Log: skgesirq.h,v $
* Revision 1.26 2002/10/14 09:52:36 rschmidt
* Added SKERR_SIRQ_E023 and SKERR_SIRQ_E023 for GPHY (Yukon)
* Editorial changes
*
* Revision 1.25 2002/07/15 18:15:52 rwahl
* Editorial changes.
*
* Revision 1.24 2002/07/15 15:39:21 rschmidt
* Corrected define for SKERR_SIRQ_E022
* Editorial changes
*
* Revision 1.23 2002/04/25 11:09:45 rschmidt
* Removed declarations for SkXmInitPhy(), SkXmRxTxEnable()
* Editorial changes
*
* Revision 1.22 2000/11/09 11:30:10 rassmann
* WA: Waiting after releasing reset until BCom chip is accessible.
*
* Revision 1.21 2000/10/18 12:22:40 cgoos
* Added workaround for half duplex hangup.
*
* Revision 1.20 1999/12/06 10:00:44 cgoos
* Added SET event for role.
*
* Revision 1.19 1999/11/22 13:58:26 cgoos
* Changed license header to GPL.
*
* Revision 1.18 1999/05/19 07:32:59 cgoos
* Changes for 1000Base-T.
*
* Revision 1.17 1999/03/12 13:29:31 malthoff
* Move Autonegotiation Error Codes to skgeinit.h.
*
* Revision 1.16 1999/03/08 10:11:28 gklug
* add: AutoNegDone return codes
*
* Revision 1.15 1998/11/18 13:20:53 gklug
* add: different timeouts for active and non-active links
*
* Revision 1.14 1998/11/04 07:18:14 cgoos
* Added prototype for SkXmRxTxEnable.
*
* Revision 1.13 1998/10/21 05:52:23 gklug
* add: parameter DoLoop to InitPhy function
*
* Revision 1.12 1998/10/19 06:45:03 cgoos
* Added prototype for SkXmInitPhy.
*
* Revision 1.11 1998/10/15 14:34:10 gklug
* add: WA_TIME is 500 msec
*
* Revision 1.10 1998/10/14 14:49:41 malthoff
* Remove err log defines E021 and E022. They are
* defined in skgeinit.h now.
*
* Revision 1.9 1998/10/14 14:00:39 gklug
* add: error logs for init phys
*
* Revision 1.8 1998/10/14 05:44:05 gklug
* add: E020
*
* Revision 1.7 1998/10/02 06:24:58 gklug
* add: error messages
*
* Revision 1.6 1998/10/01 07:54:45 gklug
* add: PNMI debug module
*
* Revision 1.5 1998/09/28 13:36:31 malthoff
* Move the bit definitions for Autonegotiation
* and Flow Control to skgeinit.h.
*
* Revision 1.4 1998/09/15 12:29:34 gklug
* add: error logs
*
* Revision 1.3 1998/09/03 13:54:02 gklug
* add: function prototypes
*
* Revision 1.2 1998/09/03 10:24:36 gklug
* add: Events send by PNMI
* add: parameter definition for Flow Control etc.
*
* Revision 1.1 1998/08/27 11:50:27 gklug
* initial revision
*
*
******************************************************************************/
#ifndef _INC_SKGESIRQ_H_
#define _INC_SKGESIRQ_H_
/*
* Define the Event the special IRQ/INI module can handle
*/
#define SK_HWEV_WATIM 1 /* Timeout for WA errata #2 XMAC */
#define SK_HWEV_PORT_START 2 /* Port Start Event by RLMT */
#define SK_HWEV_PORT_STOP 3 /* Port Stop Event by RLMT */
#define SK_HWEV_CLEAR_STAT 4 /* Clear Statistics by PNMI */
#define SK_HWEV_UPDATE_STAT 5 /* Update Statistics by PNMI */
#define SK_HWEV_SET_LMODE 6 /* Set Link Mode by PNMI */
#define SK_HWEV_SET_FLOWMODE 7 /* Set Flow Control Mode by PNMI */
#define SK_HWEV_SET_ROLE 8 /* Set Master/Slave (Role) by PNMI */
#define SK_HWEV_SET_SPEED 9 /* Set Link Speed by PNMI */
#define SK_HWEV_HALFDUP_CHK 10 /* Half Duplex Hangup Workaround */
#define SK_WA_ACT_TIME (5000000L) /* 5 sec */
#define SK_WA_INA_TIME (100000L) /* 100 msec */
#define SK_HALFDUP_CHK_TIME (10000L) /* 10 msec */
/*
* Define the error numbers and messages
*/
#define SKERR_SIRQ_E001 (SK_ERRBASE_SIRQ+0)
#define SKERR_SIRQ_E001MSG "Unknown event"
#define SKERR_SIRQ_E002 (SKERR_SIRQ_E001+1)
#define SKERR_SIRQ_E002MSG "Packet timeout RX1"
#define SKERR_SIRQ_E003 (SKERR_SIRQ_E002+1)
#define SKERR_SIRQ_E003MSG "Packet timeout RX2"
#define SKERR_SIRQ_E004 (SKERR_SIRQ_E003+1)
#define SKERR_SIRQ_E004MSG "MAC 1 not correctly initialized"
#define SKERR_SIRQ_E005 (SKERR_SIRQ_E004+1)
#define SKERR_SIRQ_E005MSG "MAC 2 not correctly initialized"
#define SKERR_SIRQ_E006 (SKERR_SIRQ_E005+1)
#define SKERR_SIRQ_E006MSG "CHECK failure R1"
#define SKERR_SIRQ_E007 (SKERR_SIRQ_E006+1)
#define SKERR_SIRQ_E007MSG "CHECK failure R2"
#define SKERR_SIRQ_E008 (SKERR_SIRQ_E007+1)
#define SKERR_SIRQ_E008MSG "CHECK failure XS1"
#define SKERR_SIRQ_E009 (SKERR_SIRQ_E008+1)
#define SKERR_SIRQ_E009MSG "CHECK failure XA1"
#define SKERR_SIRQ_E010 (SKERR_SIRQ_E009+1)
#define SKERR_SIRQ_E010MSG "CHECK failure XS2"
#define SKERR_SIRQ_E011 (SKERR_SIRQ_E010+1)
#define SKERR_SIRQ_E011MSG "CHECK failure XA2"
#define SKERR_SIRQ_E012 (SKERR_SIRQ_E011+1)
#define SKERR_SIRQ_E012MSG "unexpected IRQ Master error"
#define SKERR_SIRQ_E013 (SKERR_SIRQ_E012+1)
#define SKERR_SIRQ_E013MSG "unexpected IRQ Status error"
#define SKERR_SIRQ_E014 (SKERR_SIRQ_E013+1)
#define SKERR_SIRQ_E014MSG "Parity error on RAM (read)"
#define SKERR_SIRQ_E015 (SKERR_SIRQ_E014+1)
#define SKERR_SIRQ_E015MSG "Parity error on RAM (write)"
#define SKERR_SIRQ_E016 (SKERR_SIRQ_E015+1)
#define SKERR_SIRQ_E016MSG "Parity error MAC 1"
#define SKERR_SIRQ_E017 (SKERR_SIRQ_E016+1)
#define SKERR_SIRQ_E017MSG "Parity error MAC 2"
#define SKERR_SIRQ_E018 (SKERR_SIRQ_E017+1)
#define SKERR_SIRQ_E018MSG "Parity error RX 1"
#define SKERR_SIRQ_E019 (SKERR_SIRQ_E018+1)
#define SKERR_SIRQ_E019MSG "Parity error RX 2"
#define SKERR_SIRQ_E020 (SKERR_SIRQ_E019+1)
#define SKERR_SIRQ_E020MSG "MAC transmit FIFO underrun"
#define SKERR_SIRQ_E021 (SKERR_SIRQ_E020+1)
#define SKERR_SIRQ_E021MSG "Spurious TWSI interrupt"
#define SKERR_SIRQ_E022 (SKERR_SIRQ_E021+1)
#define SKERR_SIRQ_E022MSG "Cable pair swap error"
#define SKERR_SIRQ_E023 (SKERR_SIRQ_E022+1)
#define SKERR_SIRQ_E023MSG "Auto-negotiation error"
#define SKERR_SIRQ_E024 (SKERR_SIRQ_E023+1)
#define SKERR_SIRQ_E024MSG "FIFO overflow error"
extern void SkGeSirqIsr(SK_AC *pAC, SK_IOC IoC, SK_U32 Istatus);
extern int SkGeSirqEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Para);
extern void SkHWLinkUp(SK_AC *pAC, SK_IOC IoC, int Port);
extern void SkHWLinkDown(SK_AC *pAC, SK_IOC IoC, int Port);
#endif /* _INC_SKGESIRQ_H_ */

@ -0,0 +1,291 @@
/******************************************************************************
*
* Name: ski2c.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.34 $
* Date: $Date: 2003/01/28 09:11:21 $
* Purpose: Defines to access Voltage and Temperature Sensor
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2003 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: ski2c.h,v $
* Revision 1.34 2003/01/28 09:11:21 rschmidt
* Editorial changes
*
* Revision 1.33 2002/10/14 16:40:50 rschmidt
* Editorial changes (TWSI)
*
* Revision 1.32 2002/08/13 08:55:07 rschmidt
* Editorial changes
*
* Revision 1.31 2002/08/06 09:44:22 jschmalz
* Extensions and changes for Yukon
*
* Revision 1.30 2001/04/05 11:38:09 rassmann
* Set SenState to idle in SkI2cWaitIrq().
* Changed error message in SkI2cWaitIrq().
*
* Revision 1.29 2000/08/03 14:28:17 rassmann
* - Added function to wait for I2C being ready before resetting the board.
* - Replaced one duplicate "out of range" message with correct one.
*
* Revision 1.28 1999/11/22 13:55:46 cgoos
* Changed license header to GPL.
*
* Revision 1.27 1999/05/20 09:23:10 cgoos
* Changes for 1000Base-T (Fan sensors).
*
* Revision 1.26 1998/12/01 13:45:47 gklug
* add: InitLevel to I2c struct
*
* Revision 1.25 1998/11/03 06:55:16 gklug
* add: Dummy Reads to I2c struct
*
* Revision 1.24 1998/10/02 14:28:59 cgoos
* Added prototype for SkI2cIsr.
*
* Revision 1.23 1998/09/08 12:20:11 gklug
* add: prototypes for init and read functions
*
* Revision 1.22 1998/09/08 07:37:56 gklug
* add: log error if PCI_IO voltage sensor could not be initialized
*
* Revision 1.21 1998/09/04 08:38:05 malthoff
* Change the values for I2C_READ and I2C_WRITE
*
* Revision 1.20 1998/08/25 07:52:22 gklug
* chg: Timestamps (last) added for logging
*
* Revision 1.19 1998/08/25 06:09:00 gklug
* rmv: warning and error levels of the individual sensors.
* add: timing definitions for sending traps and logging errors
*
* Revision 1.18 1998/08/20 11:41:15 gklug
* chg: omit STRCPY macro by using char * as Sensor Description
*
* Revision 1.17 1998/08/20 11:37:43 gklug
* chg: change Ioc to IoC
*
* Revision 1.16 1998/08/20 11:30:38 gklug
* fix: SenRead declaration
*
* Revision 1.15 1998/08/20 11:27:53 gklug
* fix: Compile bugs with new awrning constants
*
* Revision 1.14 1998/08/20 08:53:12 gklug
* fix: compiler errors
* add: Threshold values
*
* Revision 1.13 1998/08/19 12:21:16 gklug
* fix: remove struct from C files (see CCC)
* add: typedefs for all structs
*
* Revision 1.12 1998/08/19 10:57:41 gklug
* add: Warning levels
*
* Revision 1.11 1998/08/18 08:37:02 malthoff
* Prototypes not required for SK_DIAG.
*
* Revision 1.10 1998/08/17 13:54:00 gklug
* fix: declaration of event function
*
* Revision 1.9 1998/08/17 06:48:39 malthoff
* Remove some unrequired macros.
* Fix the compiler errors.
*
* Revision 1.8 1998/08/14 06:47:19 gklug
* fix: Values are intergers
*
* Revision 1.7 1998/08/14 06:26:05 gklug
* add: Init error message
*
* Revision 1.6 1998/08/13 08:31:08 gklug
* add: Error message
*
* Revision 1.5 1998/08/12 14:32:04 gklug
* add: new error code/message
*
* Revision 1.4 1998/08/12 13:39:08 gklug
* chg: names of error messages
* add: defines for Sensor type and thresholds
*
* Revision 1.3 1998/08/11 07:57:16 gklug
* add: sensor struct
* add: Timeout defines
* add: I2C control struct for pAC
*
* Revision 1.2 1998/07/17 11:29:02 gklug
* rmv: Microwire and SMTPANIC
*
* Revision 1.1 1998/06/19 14:30:10 malthoff
* Created. Sources taken from ML Project.
*
*
******************************************************************************/
/*
* SKI2C.H contains all I2C specific defines
*/
#ifndef _SKI2C_H_
#define _SKI2C_H_
typedef struct s_Sensor SK_SENSOR;
#include "h/skgei2c.h"
/*
* Define the I2C events.
*/
#define SK_I2CEV_IRQ 1 /* IRQ happened Event */
#define SK_I2CEV_TIM 2 /* Timeout event */
#define SK_I2CEV_CLEAR 3 /* Clear MIB Values */
/*
* Define READ and WRITE Constants.
*/
#define I2C_READ 0
#define I2C_WRITE 1
#define I2C_BURST 1
#define I2C_SINGLE 0
#define SKERR_I2C_E001 (SK_ERRBASE_I2C+0)
#define SKERR_I2C_E001MSG "Sensor index unknown"
#define SKERR_I2C_E002 (SKERR_I2C_E001+1)
#define SKERR_I2C_E002MSG "TWSI: transfer does not complete"
#define SKERR_I2C_E003 (SKERR_I2C_E002+1)
#define SKERR_I2C_E003MSG "LM80: NAK on device send"
#define SKERR_I2C_E004 (SKERR_I2C_E003+1)
#define SKERR_I2C_E004MSG "LM80: NAK on register send"
#define SKERR_I2C_E005 (SKERR_I2C_E004+1)
#define SKERR_I2C_E005MSG "LM80: NAK on device (2) send"
#define SKERR_I2C_E006 (SKERR_I2C_E005+1)
#define SKERR_I2C_E006MSG "Unknown event"
#define SKERR_I2C_E007 (SKERR_I2C_E006+1)
#define SKERR_I2C_E007MSG "LM80 read out of state"
#define SKERR_I2C_E008 (SKERR_I2C_E007+1)
#define SKERR_I2C_E008MSG "Unexpected sensor read completed"
#define SKERR_I2C_E009 (SKERR_I2C_E008+1)
#define SKERR_I2C_E009MSG "WARNING: temperature sensor out of range"
#define SKERR_I2C_E010 (SKERR_I2C_E009+1)
#define SKERR_I2C_E010MSG "WARNING: voltage sensor out of range"
#define SKERR_I2C_E011 (SKERR_I2C_E010+1)
#define SKERR_I2C_E011MSG "ERROR: temperature sensor out of range"
#define SKERR_I2C_E012 (SKERR_I2C_E011+1)
#define SKERR_I2C_E012MSG "ERROR: voltage sensor out of range"
#define SKERR_I2C_E013 (SKERR_I2C_E012+1)
#define SKERR_I2C_E013MSG "ERROR: couldn't init sensor"
#define SKERR_I2C_E014 (SKERR_I2C_E013+1)
#define SKERR_I2C_E014MSG "WARNING: fan sensor out of range"
#define SKERR_I2C_E015 (SKERR_I2C_E014+1)
#define SKERR_I2C_E015MSG "ERROR: fan sensor out of range"
#define SKERR_I2C_E016 (SKERR_I2C_E015+1)
#define SKERR_I2C_E016MSG "TWSI: active transfer does not complete"
/*
* Define Timeout values
*/
#define SK_I2C_TIM_LONG 2000000L /* 2 seconds */
#define SK_I2C_TIM_SHORT 100000L /* 100 milliseconds */
#define SK_I2C_TIM_WATCH 1000000L /* 1 second */
/*
* Define trap and error log hold times
*/
#ifndef SK_SEN_ERR_TR_HOLD
#define SK_SEN_ERR_TR_HOLD (4*SK_TICKS_PER_SEC)
#endif
#ifndef SK_SEN_ERR_LOG_HOLD
#define SK_SEN_ERR_LOG_HOLD (60*SK_TICKS_PER_SEC)
#endif
#ifndef SK_SEN_WARN_TR_HOLD
#define SK_SEN_WARN_TR_HOLD (15*SK_TICKS_PER_SEC)
#endif
#ifndef SK_SEN_WARN_LOG_HOLD
#define SK_SEN_WARN_LOG_HOLD (15*60*SK_TICKS_PER_SEC)
#endif
/*
* Defines for SenType
*/
#define SK_SEN_UNKNOWN 0
#define SK_SEN_TEMP 1
#define SK_SEN_VOLT 2
#define SK_SEN_FAN 3
/*
* Define for the SenErrorFlag
*/
#define SK_SEN_ERR_NOT_PRESENT 0 /* Error Flag: Sensor not present */
#define SK_SEN_ERR_OK 1 /* Error Flag: O.K. */
#define SK_SEN_ERR_WARN 2 /* Error Flag: Warning */
#define SK_SEN_ERR_ERR 3 /* Error Flag: Error */
#define SK_SEN_ERR_FAULTY 4 /* Error Flag: Faulty */
/*
* Define the Sensor struct
*/
struct s_Sensor {
char *SenDesc; /* Description */
int SenType; /* Voltage or Temperature */
SK_I32 SenValue; /* Current value of the sensor */
SK_I32 SenThreErrHigh; /* High error Threshhold of this sensor */
SK_I32 SenThreWarnHigh; /* High warning Threshhold of this sensor */
SK_I32 SenThreErrLow; /* Lower error Threshold of the sensor */
SK_I32 SenThreWarnLow; /* Lower warning Threshold of the sensor */
int SenErrFlag; /* Sensor indicated an error */
SK_BOOL SenInit; /* Is sensor initialized ? */
SK_U64 SenErrCts; /* Error trap counter */
SK_U64 SenWarnCts; /* Warning trap counter */
SK_U64 SenBegErrTS; /* Begin error timestamp */
SK_U64 SenBegWarnTS; /* Begin warning timestamp */
SK_U64 SenLastErrTrapTS; /* Last error trap timestamp */
SK_U64 SenLastErrLogTS; /* Last error log timestamp */
SK_U64 SenLastWarnTrapTS; /* Last warning trap timestamp */
SK_U64 SenLastWarnLogTS; /* Last warning log timestamp */
int SenState; /* Sensor State (see HW specific include) */
int (*SenRead)(SK_AC *pAC, SK_IOC IoC, struct s_Sensor *pSen);
/* Sensors read function */
SK_U16 SenReg; /* Register Address for this sensor */
SK_U8 SenDev; /* Device Selection for this sensor */
};
typedef struct s_I2c {
SK_SENSOR SenTable[SK_MAX_SENSORS]; /* Sensor Table */
int CurrSens; /* Which sensor is currently queried */
int MaxSens; /* Max. number of sensors */
int TimerMode; /* Use the timer also to watch the state machine */
int InitLevel; /* Initialized Level */
#ifndef SK_DIAG
int DummyReads; /* Number of non-checked dummy reads */
SK_TIMER SenTimer; /* Sensors timer */
#endif /* !SK_DIAG */
} SK_I2C;
extern int SkI2cReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen);
#ifndef SK_DIAG
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 SkI2cIsr(SK_AC *pAC, SK_IOC IoC);
#endif
#endif /* n_SKI2C_H */

@ -0,0 +1,148 @@
/******************************************************************************
*
* Name: skqueue.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.14 $
* Date: $Date: 2002/03/15 10:52:13 $
* Purpose: Defines for the Event queue
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998,1999 SysKonnect,
* a business unit of Schneider & Koch & Co. Datensysteme GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: skqueue.h,v $
* Revision 1.14 2002/03/15 10:52:13 mkunz
* Added event classes for link aggregation
*
* Revision 1.13 1999/11/22 13:59:05 cgoos
* Changed license header to GPL.
*
* Revision 1.12 1998/09/08 08:48:01 gklug
* add: init level handling
*
* Revision 1.11 1998/09/03 14:15:11 gklug
* add: CSUM and HWAC Eventclass and function.
* fix: pParaPtr according to CCC
*
* Revision 1.10 1998/08/20 12:43:03 gklug
* add: typedef SK_QUEUE
*
* Revision 1.9 1998/08/19 09:50:59 gklug
* fix: remove struct keyword from c-code (see CCC) add typedefs
*
* Revision 1.8 1998/08/18 07:00:01 gklug
* fix: SK_PTR not defined use void * instead.
*
* Revision 1.7 1998/08/17 13:43:19 gklug
* chg: Parameter will be union of 64bit para, 2 times SK_U32 or SK_PTR
*
* Revision 1.6 1998/08/14 07:09:30 gklug
* fix: chg pAc -> pAC
*
* Revision 1.5 1998/08/11 14:26:44 gklug
* chg: Event Dispatcher returns now int.
*
* Revision 1.4 1998/08/11 12:15:21 gklug
* add: Error numbers of skqueue module
*
* Revision 1.3 1998/08/07 12:54:23 gklug
* fix: first compiled version
*
* Revision 1.2 1998/08/07 09:34:00 gklug
* adapt structure defs to CCC
* add: prototypes for functions
*
* Revision 1.1 1998/07/30 14:52:12 gklug
* Initial version.
* Defines Event Classes, Event structs and queue management variables.
*
*
*
******************************************************************************/
/*
* SKQUEUE.H contains all defines and types for the event queue
*/
#ifndef _SKQUEUE_H_
#define _SKQUEUE_H_
/*
* define the event classes to be served
*/
#define SKGE_DRV 1 /* Driver Event Class */
#define SKGE_RLMT 2 /* RLMT Event Class */
#define SKGE_I2C 3 /* i2C Event Class */
#define SKGE_PNMI 4 /* PNMI Event Class */
#define SKGE_CSUM 5 /* Checksum Event Class */
#define SKGE_HWAC 6 /* Hardware Access Event Class */
#define SKGE_SWT 9 /* Software Timer Event Class */
#define SKGE_LACP 10 /* LACP Aggregation Event Class */
#define SKGE_RSF 11 /* RSF Aggregation Event Class */
#define SKGE_MARKER 12 /* MARKER Aggregation Event Class */
#define SKGE_FD 13 /* FD Distributor Event Class */
/*
* define event queue as circular buffer
*/
#define SK_MAX_EVENT 64
/*
* Parameter union for the Para stuff
*/
typedef union u_EvPara {
void *pParaPtr; /* Parameter Pointer */
SK_U64 Para64; /* Parameter 64bit version */
SK_U32 Para32[2]; /* Parameter Array of 32bit parameters */
} SK_EVPARA;
/*
* Event Queue
* skqueue.c
* events are class/value pairs
* class is addressee, e.g. RMT, PCM etc.
* value is command, e.g. line state change, ring op change etc.
*/
typedef struct s_EventElem {
SK_U32 Class ; /* Event class */
SK_U32 Event ; /* Event value */
SK_EVPARA Para ; /* Event parameter */
} SK_EVENTELEM;
typedef struct s_Queue {
SK_EVENTELEM EvQueue[SK_MAX_EVENT];
SK_EVENTELEM *EvPut ;
SK_EVENTELEM *EvGet ;
} SK_QUEUE;
extern void SkEventInit(SK_AC *pAC, SK_IOC Ioc, int Level);
extern void SkEventQueue(SK_AC *pAC, SK_U32 Class, SK_U32 Event,
SK_EVPARA Para);
extern int SkEventDispatcher(SK_AC *pAC,SK_IOC Ioc);
/* Define Error Numbers and messages */
#define SKERR_Q_E001 (SK_ERRBASE_QUEUE+0)
#define SKERR_Q_E001MSG "Event queue overflow"
#define SKERR_Q_E002 (SKERR_Q_E001+1)
#define SKERR_Q_E002MSG "Undefined event class"
#endif /* _SKQUEUE_H_ */

@ -0,0 +1,563 @@
/******************************************************************************
*
* Name: skrlmt.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.35 $
* Date: $Date: 2003/01/31 14:12:41 $
* Purpose: Header file for Redundant Link ManagemenT.
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2001 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: skrlmt.h,v $
* Revision 1.35 2003/01/31 14:12:41 mkunz
* single port adapter runs now with two identical MAC addresses
*
* Revision 1.34 2002/09/23 15:13:41 rwahl
* Editorial changes.
*
* Revision 1.33 2001/07/03 12:16:48 mkunz
* New Flag ChgBcPrio (Change priority of last broadcast received)
*
* Revision 1.32 2001/02/14 14:06:31 rassmann
* Editorial changes.
*
* Revision 1.31 2001/02/05 14:25:26 rassmann
* Prepared RLMT for transparent operation.
*
* Revision 1.30 2001/01/22 13:41:39 rassmann
* Supporting two nets on dual-port adapters.
*
* Revision 1.29 2000/11/17 08:58:00 rassmann
* Moved CheckSwitch from SK_RLMT_PACKET_RECEIVED to SK_RLMT_TIM event.
*
* Revision 1.28 2000/11/09 12:24:34 rassmann
* Editorial changes.
*
* Revision 1.27 1999/11/22 13:59:56 cgoos
* Changed license header to GPL.
*
* Revision 1.26 1999/10/04 14:01:19 rassmann
* Corrected reaction to reception of BPDU frames (#10441).
*
* Revision 1.25 1999/07/20 12:53:39 rassmann
* Fixed documentation errors for lookahead macros.
*
* Revision 1.24 1999/05/28 11:15:56 rassmann
* Changed behaviour to reflect Design Spec v1.2.
* Controlling Link LED(s).
* Introduced RLMT Packet Version field in RLMT Packet.
* Newstyle lookahead macros (checking meta-information before looking at
* the packet).
*
* Revision 1.23 1999/01/28 12:50:42 rassmann
* Not using broadcast time stamps in CheckLinkState mode.
*
* Revision 1.22 1999/01/27 14:13:04 rassmann
* Monitoring broadcast traffic.
* Switching more reliably and not too early if switch is
* configured for spanning tree.
*
* Revision 1.21 1998/12/08 13:11:25 rassmann
* Stopping SegTimer at RlmtStop.
*
* Revision 1.20 1998/11/24 12:37:33 rassmann
* Implemented segmentation check.
*
* Revision 1.19 1998/11/17 13:43:06 rassmann
* Handling (logical) tx failure.
* Sending packet on logical address after PORT_SWITCH.
*
* Revision 1.18 1998/11/13 16:56:56 rassmann
* Added macro version of SkRlmtLookaheadPacket.
*
* Revision 1.17 1998/11/06 18:06:05 rassmann
* Corrected timing when RLMT checks fail.
* Clearing tx counter earlier in periodical checks.
*
* Revision 1.16 1998/11/03 13:53:50 rassmann
* RLMT should switch now (at least in mode 3).
*
* Revision 1.15 1998/10/22 11:39:52 rassmann
* Corrected signed/unsigned mismatches.
* Corrected receive list handling and address recognition.
*
* Revision 1.14 1998/10/15 15:16:36 rassmann
* Finished Spanning Tree checking.
* Checked with lint.
*
* Revision 1.13 1998/09/24 19:16:08 rassmann
* Code cleanup.
* Introduced Timer for PORT_DOWN due to no RX.
*
* Revision 1.12 1998/09/16 11:09:52 rassmann
* Syntax corrections.
*
* Revision 1.11 1998/09/15 11:28:50 rassmann
* Syntax corrections.
*
* Revision 1.10 1998/09/14 17:07:38 rassmann
* Added code for port checking via LAN.
* Changed Mbuf definition.
*
* Revision 1.9 1998/09/07 11:14:15 rassmann
* Syntax corrections.
*
* Revision 1.8 1998/09/07 09:06:08 rassmann
* Syntax corrections.
*
* Revision 1.7 1998/09/04 19:41:34 rassmann
* Syntax corrections.
* Started entering code for checking local links.
*
* Revision 1.6 1998/09/04 12:14:28 rassmann
* Interface cleanup.
*
* Revision 1.5 1998/09/02 16:55:29 rassmann
* Updated to reflect new DRV/HWAC/RLMT interface.
*
* Revision 1.4 1998/09/02 07:26:02 afischer
* typedef for SK_RLMT_PORT
*
* Revision 1.3 1998/08/27 14:29:03 rassmann
* Code cleanup.
*
* Revision 1.2 1998/08/27 14:26:25 rassmann
* Updated interface.
*
* Revision 1.1 1998/08/21 08:29:10 rassmann
* First public version.
*
******************************************************************************/
/******************************************************************************
*
* Description:
*
* This is the header file for Redundant Link ManagemenT.
*
* Include File Hierarchy:
*
* "skdrv1st.h"
* ...
* "sktypes.h"
* "skqueue.h"
* "skaddr.h"
* "skrlmt.h"
* ...
* "skdrv2nd.h"
*
******************************************************************************/
#ifndef __INC_SKRLMT_H
#define __INC_SKRLMT_H
#ifdef __cplusplus
#error C++ is not yet supported.
extern "C" {
#endif /* cplusplus */
/* defines ********************************************************************/
#define SK_RLMT_NET_DOWN_TEMP 1 /* NET_DOWN due to last port down. */
#define SK_RLMT_NET_DOWN_FINAL 2 /* NET_DOWN due to RLMT_STOP. */
/* ----- Default queue sizes - must be multiples of 8 KB ----- */
/* Less than 8 KB free in RX queue => pause frames. */
#define SK_RLMT_STANDBY_QRXSIZE 128 /* Size of rx standby queue in KB. */
#define SK_RLMT_STANDBY_QXASIZE 32 /* Size of async standby queue in KB. */
#define SK_RLMT_STANDBY_QXSSIZE 0 /* Size of sync standby queue in KB. */
#define SK_RLMT_MAX_TX_BUF_SIZE 60 /* Maximum RLMT transmit size. */
/* ----- PORT states ----- */
#define SK_RLMT_PS_INIT 0 /* Port state: Init. */
#define SK_RLMT_PS_LINK_DOWN 1 /* Port state: Link down. */
#define SK_RLMT_PS_DOWN 2 /* Port state: Port down. */
#define SK_RLMT_PS_GOING_UP 3 /* Port state: Going up. */
#define SK_RLMT_PS_UP 4 /* Port state: Up. */
/* ----- RLMT states ----- */
#define SK_RLMT_RS_INIT 0 /* RLMT state: Init. */
#define SK_RLMT_RS_NET_DOWN 1 /* RLMT state: Net down. */
#define SK_RLMT_RS_NET_UP 2 /* RLMT state: Net up. */
/* ----- PORT events ----- */
#define SK_RLMT_LINK_UP 1001 /* Link came up. */
#define SK_RLMT_LINK_DOWN 1002 /* Link went down. */
#define SK_RLMT_PORT_ADDR 1003 /* Port address changed. */
/* ----- RLMT events ----- */
#define SK_RLMT_START 2001 /* Start RLMT. */
#define SK_RLMT_STOP 2002 /* Stop RLMT. */
#define SK_RLMT_PACKET_RECEIVED 2003 /* Packet was received for RLMT. */
#define SK_RLMT_STATS_CLEAR 2004 /* Clear statistics. */
#define SK_RLMT_STATS_UPDATE 2005 /* Update statistics. */
#define SK_RLMT_PREFPORT_CHANGE 2006 /* Change preferred port. */
#define SK_RLMT_MODE_CHANGE 2007 /* New RlmtMode. */
#define SK_RLMT_SET_NETS 2008 /* Number of Nets (1 or 2). */
/* ----- RLMT mode bits ----- */
/*
* CAUTION: These defines are private to RLMT.
* Please use the RLMT mode defines below.
*/
#define SK_RLMT_CHECK_LINK 1 /* Check Link. */
#define SK_RLMT_CHECK_LOC_LINK 2 /* Check other link on same adapter. */
#define SK_RLMT_CHECK_SEG 4 /* Check segmentation. */
#ifndef RLMT_CHECK_REMOTE
#define SK_RLMT_CHECK_OTHERS SK_RLMT_CHECK_LOC_LINK
#else /* RLMT_CHECK_REMOTE */
#define SK_RLMT_CHECK_REM_LINK 8 /* Check link(s) on other adapter(s). */
#define SK_RLMT_MAX_REMOTE_PORTS_CHECKED 3
#define SK_RLMT_CHECK_OTHERS \
(SK_RLMT_CHECK_LOC_LINK | SK_RLMT_CHECK_REM_LINK)
#endif /* RLMT_CHECK_REMOTE */
#ifndef SK_RLMT_ENABLE_TRANSPARENT
#define SK_RLMT_TRANSPARENT 0 /* RLMT transparent - inactive. */
#else /* SK_RLMT_ENABLE_TRANSPARENT */
#define SK_RLMT_TRANSPARENT 128 /* RLMT transparent. */
#endif /* SK_RLMT_ENABLE_TRANSPARENT */
/* ----- RLMT modes ----- */
/* Check Link State. */
#define SK_RLMT_MODE_CLS (SK_RLMT_CHECK_LINK)
/* Check Local Ports: check other links on the same adapter. */
#define SK_RLMT_MODE_CLP (SK_RLMT_CHECK_LINK | SK_RLMT_CHECK_LOC_LINK)
/* Check Local Ports and Segmentation Status. */
#define SK_RLMT_MODE_CLPSS \
(SK_RLMT_CHECK_LINK | SK_RLMT_CHECK_LOC_LINK | SK_RLMT_CHECK_SEG)
#ifdef RLMT_CHECK_REMOTE
/* Check Local and Remote Ports: check links (local or remote). */
Name of define TBD!
#define SK_RLMT_MODE_CRP \
(SK_RLMT_CHECK_LINK | SK_RLMT_CHECK_LOC_LINK | SK_RLMT_CHECK_REM_LINK)
/* Check Local and Remote Ports and Segmentation Status. */
Name of define TBD!
#define SK_RLMT_MODE_CRPSS \
(SK_RLMT_CHECK_LINK | SK_RLMT_CHECK_LOC_LINK | \
SK_RLMT_CHECK_REM_LINK | SK_RLMT_CHECK_SEG)
#endif /* RLMT_CHECK_REMOTE */
/* ----- RLMT lookahead result bits ----- */
#define SK_RLMT_RX_RLMT 1 /* Give packet to RLMT. */
#define SK_RLMT_RX_PROTOCOL 2 /* Give packet to protocol. */
/* Macros */
#if 0
SK_AC *pAC /* adapter context */
SK_U32 PortNum /* receiving port */
unsigned PktLen /* received packet's length */
SK_BOOL IsBc /* Flag: packet is broadcast */
unsigned *pOffset /* offs. of bytes to present to SK_RLMT_LOOKAHEAD */
unsigned *pNumBytes /* #Bytes to present to SK_RLMT_LOOKAHEAD */
#endif /* 0 */
#define SK_RLMT_PRE_LOOKAHEAD(pAC,PortNum,PktLen,IsBc,pOffset,pNumBytes) { \
SK_AC *_pAC; \
SK_U32 _PortNum; \
_pAC = (pAC); \
_PortNum = (SK_U32)(PortNum); \
/* _pAC->Rlmt.Port[_PortNum].PacketsRx++; */ \
_pAC->Rlmt.Port[_PortNum].PacketsPerTimeSlot++; \
if (_pAC->Rlmt.RlmtOff) { \
*(pNumBytes) = 0; \
} \
else {\
if ((_pAC->Rlmt.Port[_PortNum].Net->RlmtMode & SK_RLMT_TRANSPARENT) != 0) { \
*(pNumBytes) = 0; \
} \
else if (IsBc) { \
if (_pAC->Rlmt.Port[_PortNum].Net->RlmtMode != SK_RLMT_MODE_CLS) { \
*(pNumBytes) = 6; \
*(pOffset) = 6; \
} \
else { \
*(pNumBytes) = 0; \
} \
} \
else { \
if ((PktLen) > SK_RLMT_MAX_TX_BUF_SIZE) { \
/* _pAC->Rlmt.Port[_PortNum].DataPacketsPerTimeSlot++; */ \
*(pNumBytes) = 0; \
} \
else { \
*(pNumBytes) = 6; \
*(pOffset) = 0; \
} \
} \
} \
}
#if 0
SK_AC *pAC /* adapter context */
SK_U32 PortNum /* receiving port */
SK_U8 *pLaPacket, /* received packet's data (points to pOffset) */
SK_BOOL IsBc /* Flag: packet is broadcast */
SK_BOOL IsMc /* Flag: packet is multicast */
unsigned *pForRlmt /* Result: bits SK_RLMT_RX_RLMT, SK_RLMT_RX_PROTOCOL */
SK_RLMT_LOOKAHEAD() expects *pNumBytes from
packet offset *pOffset (s.a.) at *pLaPacket.
If you use SK_RLMT_LOOKAHEAD in a path where you already know if the packet is
BC, MC, or UC, you should use constants for IsBc and IsMc, so that your compiler
can trash unneeded parts of the if construction.
#endif /* 0 */
#define SK_RLMT_LOOKAHEAD(pAC,PortNum,pLaPacket,IsBc,IsMc,pForRlmt) { \
SK_AC *_pAC; \
SK_U32 _PortNum; \
SK_U8 *_pLaPacket; \
_pAC = (pAC); \
_PortNum = (SK_U32)(PortNum); \
_pLaPacket = (SK_U8 *)(pLaPacket); \
if (IsBc) {\
if (!SK_ADDR_EQUAL(_pLaPacket, _pAC->Addr.Net[_pAC->Rlmt.Port[ \
_PortNum].Net->NetNumber].CurrentMacAddress.a)) { \
_pAC->Rlmt.Port[_PortNum].BcTimeStamp = SkOsGetTime(_pAC); \
_pAC->Rlmt.CheckSwitch = SK_TRUE; \
} \
/* _pAC->Rlmt.Port[_PortNum].DataPacketsPerTimeSlot++; */ \
*(pForRlmt) = SK_RLMT_RX_PROTOCOL; \
} \
else if (IsMc) { \
if (SK_ADDR_EQUAL(_pLaPacket, BridgeMcAddr.a)) { \
_pAC->Rlmt.Port[_PortNum].BpduPacketsPerTimeSlot++; \
if (_pAC->Rlmt.Port[_PortNum].Net->RlmtMode & SK_RLMT_CHECK_SEG) { \
*(pForRlmt) = SK_RLMT_RX_RLMT | SK_RLMT_RX_PROTOCOL; \
} \
else { \
*(pForRlmt) = SK_RLMT_RX_PROTOCOL; \
} \
} \
else if (SK_ADDR_EQUAL(_pLaPacket, SkRlmtMcAddr.a)) { \
*(pForRlmt) = SK_RLMT_RX_RLMT; \
} \
else { \
/* _pAC->Rlmt.Port[_PortNum].DataPacketsPerTimeSlot++; */ \
*(pForRlmt) = SK_RLMT_RX_PROTOCOL; \
} \
} \
else { \
if (SK_ADDR_EQUAL( \
_pLaPacket, \
_pAC->Addr.Port[_PortNum].CurrentMacAddress.a)) { \
*(pForRlmt) = SK_RLMT_RX_RLMT; \
} \
else { \
/* _pAC->Rlmt.Port[_PortNum].DataPacketsPerTimeSlot++; */ \
*(pForRlmt) = SK_RLMT_RX_PROTOCOL; \
} \
} \
}
#ifdef SK_RLMT_FAST_LOOKAHEAD
Error: SK_RLMT_FAST_LOOKAHEAD no longer used. Use new macros for lookahead.
#endif /* SK_RLMT_FAST_LOOKAHEAD */
#ifdef SK_RLMT_SLOW_LOOKAHEAD
Error: SK_RLMT_SLOW_LOOKAHEAD no longer used. Use new macros for lookahead.
#endif /* SK_RLMT_SLOW_LOOKAHEAD */
/* typedefs *******************************************************************/
#ifdef SK_RLMT_MBUF_PRIVATE
typedef struct s_RlmtMbuf {
some content
} SK_RLMT_MBUF;
#endif /* SK_RLMT_MBUF_PRIVATE */
#ifdef SK_LA_INFO
typedef struct s_Rlmt_PacketInfo {
unsigned PacketLength; /* Length of packet. */
unsigned PacketType; /* Directed/Multicast/Broadcast. */
} SK_RLMT_PINFO;
#endif /* SK_LA_INFO */
typedef struct s_RootId {
SK_U8 Id[8]; /* Root Bridge Id. */
} SK_RLMT_ROOT_ID;
typedef struct s_port {
SK_MAC_ADDR CheckAddr;
SK_BOOL SuspectTx;
} SK_PORT_CHECK;
typedef struct s_RlmtNet SK_RLMT_NET;
typedef struct s_RlmtPort {
/* ----- Public part (read-only) ----- */
SK_U8 PortState; /* Current state of this port. */
/* For PNMI */
SK_BOOL LinkDown;
SK_BOOL PortDown;
SK_U8 Align01;
SK_U32 PortNumber; /* Number of port on adapter. */
SK_RLMT_NET * Net; /* Net port belongs to. */
SK_U64 TxHelloCts;
SK_U64 RxHelloCts;
SK_U64 TxSpHelloReqCts;
SK_U64 RxSpHelloCts;
/* ----- Private part ----- */
/* SK_U64 PacketsRx; */ /* Total packets received. */
SK_U32 PacketsPerTimeSlot; /* Packets rxed between TOs. */
/* SK_U32 DataPacketsPerTimeSlot; */ /* Data packets ... */
SK_U32 BpduPacketsPerTimeSlot; /* BPDU packets rxed in TS. */
SK_U64 BcTimeStamp; /* Time of last BC receive. */
SK_U64 GuTimeStamp; /* Time of entering GOING_UP. */
SK_TIMER UpTimer; /* Timer struct Link/Port up. */
SK_TIMER DownRxTimer; /* Timer struct down rx. */
SK_TIMER DownTxTimer; /* Timer struct down tx. */
SK_U32 CheckingState; /* Checking State. */
SK_ADDR_PORT * AddrPort;
SK_U8 Random[4]; /* Random value. */
unsigned PortsChecked; /* #ports checked. */
unsigned PortsSuspect; /* #ports checked that are s. */
SK_PORT_CHECK PortCheck[1];
/* SK_PORT_CHECK PortCheck[SK_MAX_MACS - 1]; */
SK_BOOL PortStarted; /* Port is started. */
SK_BOOL PortNoRx; /* NoRx for >= 1 time slot. */
SK_BOOL RootIdSet;
SK_RLMT_ROOT_ID Root; /* Root Bridge Id. */
} SK_RLMT_PORT;
struct s_RlmtNet {
/* ----- Public part (read-only) ----- */
SK_U32 NetNumber; /* Number of net. */
SK_RLMT_PORT * Port[SK_MAX_MACS]; /* Ports that belong to this net. */
SK_U32 NumPorts; /* Number of ports. */
SK_U32 PrefPort; /* Preferred port. */
/* For PNMI */
SK_U32 ChgBcPrio; /* Change Priority of last broadcast received */
SK_U32 RlmtMode; /* Check ... */
SK_U32 ActivePort; /* Active port. */
SK_U32 Preference; /* 0xFFFFFFFF: Automatic. */
SK_U8 RlmtState; /* Current RLMT state. */
/* ----- Private part ----- */
SK_BOOL RootIdSet;
SK_U16 Align01;
int LinksUp; /* #Links up. */
int PortsUp; /* #Ports up. */
SK_U32 TimeoutValue; /* RLMT timeout value. */
SK_U32 CheckingState; /* Checking State. */
SK_RLMT_ROOT_ID Root; /* Root Bridge Id. */
SK_TIMER LocTimer; /* Timer struct. */
SK_TIMER SegTimer; /* Timer struct. */
};
typedef struct s_Rlmt {
/* ----- Public part (read-only) ----- */
SK_U32 NumNets; /* Number of nets. */
SK_U32 NetsStarted; /* Number of nets started. */
SK_RLMT_NET Net[SK_MAX_NETS]; /* Array of available nets. */
SK_RLMT_PORT Port[SK_MAX_MACS]; /* Array of available ports. */
/* ----- Private part ----- */
SK_BOOL CheckSwitch;
SK_BOOL RlmtOff; /* set to zero if the Mac addresses
are equal or the second one
is zero */
SK_U16 Align01;
} SK_RLMT;
extern SK_MAC_ADDR BridgeMcAddr;
extern SK_MAC_ADDR SkRlmtMcAddr;
/* function prototypes ********************************************************/
#ifndef SK_KR_PROTO
/* Functions provided by SkRlmt */
/* ANSI/C++ compliant function prototypes */
extern void SkRlmtInit(
SK_AC *pAC,
SK_IOC IoC,
int Level);
extern int SkRlmtEvent(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 Event,
SK_EVPARA Para);
#else /* defined(SK_KR_PROTO) */
/* Non-ANSI/C++ compliant function prototypes */
#error KR-style function prototypes are not yet provided.
#endif /* defined(SK_KR_PROTO)) */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __INC_SKRLMT_H */

@ -0,0 +1,99 @@
/******************************************************************************
*
* Name: sktimer.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.9 $
* Date: $Date: 1999/11/22 14:00:29 $
* Purpose: Defines for the timer functions
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998,1999 SysKonnect,
* a business unit of Schneider & Koch & Co. Datensysteme GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: sktimer.h,v $
* Revision 1.9 1999/11/22 14:00:29 cgoos
* Changed license header to GPL.
*
* Revision 1.8 1998/09/08 08:48:02 gklug
* add: init level handling
*
* Revision 1.7 1998/08/20 12:31:29 gklug
* fix: SK_TIMCTRL needs to be defined
*
* Revision 1.6 1998/08/19 09:51:00 gklug
* fix: remove struct keyword from c-code (see CCC) add typedefs
*
* 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
*
* Revision 1.4 1998/08/14 07:09:31 gklug
* fix: chg pAc -> pAC
*
* Revision 1.3 1998/08/07 12:54:24 gklug
* fix: first compiled version
*
* Revision 1.2 1998/08/07 09:35:29 gklug
* add: Timer control struct for Adapters context
* add: function prototypes
*
* Revision 1.1 1998/08/05 11:27:01 gklug
* First version: adapted from SMT
*
*
******************************************************************************/
/*
* SKTIMER.H contains all defines and types for the timer functions
*/
#ifndef _SKTIMER_H_
#define _SKTIMER_H_
#include "h/skqueue.h"
/*
* SK timer
* - needed wherever a timer is used. Put this in your data structure
* wherever you want.
*/
typedef struct s_Timer SK_TIMER;
struct s_Timer {
SK_TIMER *TmNext ; /* linked list */
SK_U32 TmClass ; /* Timer Event class */
SK_U32 TmEvent ; /* Timer Event value */
SK_EVPARA TmPara ; /* Timer Event parameter */
SK_U32 TmDelta ; /* delta time */
int TmActive ; /* flag : active/inactive */
} ;
/*
* Timer control struct.
* - use in Adapters context name pAC->Tim
*/
typedef struct s_TimCtrl {
SK_TIMER *StQueue ; /* Head of Timer queue */
} SK_TIMCTRL ;
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 SkTimerStart(SK_AC *pAC,SK_IOC Ioc,SK_TIMER *pTimer,
SK_U32 Time,SK_U32 Class,SK_U32 Event,SK_EVPARA Para);
extern void SkTimerDone(SK_AC *pAC,SK_IOC Ioc);
#endif /* _SKTIMER_H_ */

@ -0,0 +1,87 @@
/******************************************************************************
*
* Name: sktypes.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.3 $
* Date: $Date: 2003/02/25 14:16:40 $
* Purpose: Define data types for Linux
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2003 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/*****************************************************************************
*
* History:
*
* $Log: sktypes.h,v $
* Revision 1.3 2003/02/25 14:16:40 mlindner
* Fix: Copyright statement
*
* Revision 1.2 1999/11/22 14:01:58 cgoos
* Changed license header to GPL.
* Now using Linux' fixed size types instead of standard types.
*
* Revision 1.1 1999/02/16 07:41:40 cgoos
* First version.
*
*
*
*****************************************************************************/
/******************************************************************************
*
* Description:
*
* In this file, all data types that are needed by the common modules
* are mapped to Linux data types.
*
*
* Include File Hierarchy:
*
*
******************************************************************************/
#ifndef __INC_SKTYPES_H
#define __INC_SKTYPES_H
/* defines *******************************************************************/
/*
* Data types with a specific size. 'I' = signed, 'U' = unsigned.
*/
#define SK_I8 s8
#define SK_U8 u8
#define SK_I16 s16
#define SK_U16 u16
#define SK_I32 s32
#define SK_U32 u32
#define SK_I64 s64
#define SK_U64 u64
#define SK_UPTR ulong /* casting pointer <-> integral */
/*
* Boolean type.
*/
#define SK_BOOL SK_U8
#define SK_FALSE 0
#define SK_TRUE (!SK_FALSE)
/* typedefs *******************************************************************/
/* function prototypes ********************************************************/
#endif /* __INC_SKTYPES_H */

@ -0,0 +1,54 @@
/******************************************************************************
*
* Name: version.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.4 $
* Date: $Date: 2003/02/25 14:16:40 $
* Purpose: SK specific Error log support
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2003 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
* $Log: skversion.h,v $
* Revision 1.4 2003/02/25 14:16:40 mlindner
* Fix: Copyright statement
*
* Revision 1.3 2003/02/25 13:30:18 mlindner
* Add: Support for various vendors
*
* Revision 1.1.2.1 2001/09/05 13:38:30 mlindner
* Removed FILE description
*
* Revision 1.1 2001/03/06 09:25:00 mlindner
* first version
*
*
*
******************************************************************************/
static const char SysKonnectFileId[] = "@(#) (C) SysKonnect GmbH.";
static const char SysKonnectBuildNumber[] =
"@(#)SK-BUILD: 6.05 PL: 01";
#define BOOT_STRING "sk98lin: Network Device Driver v6.05\n" \
"(C)Copyright 1999-2003 Marvell(R)."
#define VER_STRING "6.05"

@ -0,0 +1,335 @@
/******************************************************************************
*
* Name: skvpd.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.15 $
* Date: $Date: 2003/01/13 10:39:38 $
* Purpose: Defines and Macros for VPD handling
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2003 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: skvpd.h,v $
* Revision 1.15 2003/01/13 10:39:38 rschmidt
* Replaced define for PCI device Id for YUKON with GENESIS
* Editorial changes
*
* Revision 1.14 2002/11/14 15:18:10 gheinig
* Added const specifier to key and buf parameters for VpdPara,VpdRead
* and VpdWrite. This is necessary for the Diag 7 GUI API
*
* Revision 1.13 2002/10/14 15:58:18 rschmidt
* Added entry in rom_size struct s_vpd
* Editorial changes
*
* Revision 1.12 2002/09/09 14:43:51 mkarl
* added PCI Id of Yukon for reading VPD in diag before the adapter has
* been initialized
* editorial changes
*
* Revision 1.11 2002/07/26 13:19:16 mkarl
* added support for Yukon
* added vpd_size to VPD struct
*
* Revision 1.10 2000/08/10 11:29:07 rassmann
* Editorial changes.
* Preserving 32-bit alignment in structs for the adapter context.
* Removed unused function VpdWriteDword() (#if 0).
* Made VpdReadKeyword() available for SKDIAG only.
*
* Revision 1.9 1999/11/22 14:02:27 cgoos
* Changed license header to GPL.
*
* Revision 1.8 1999/03/11 14:26:40 malthoff
* Replace __STDC__ with SK_KR_PROTO.
*
* Revision 1.7 1998/10/28 07:27:17 gklug
* rmv: SWAP macros
* add: VPD_IN/OUT8 macros
* chg: interface definition
*
* Revision 1.6 1998/10/22 10:03:44 gklug
* fix: use SK_OUT16 instead of SK_OUTW
*
* Revision 1.5 1998/10/14 07:05:31 cgoos
* Changed constants in SK_SWAP_32 to UL.
*
* Revision 1.4 1998/08/19 08:14:09 gklug
* fix: remove struct keyword as much as possible from the C-code (see CCC)
*
* Revision 1.3 1998/08/18 08:18:56 malthoff
* Modify VPD in and out macros for SK_DIAG
*
* Revision 1.2 1998/07/03 14:49:08 malthoff
* Add VPD_INxx() and VPD_OUTxx() macros for the Diagnostics tool.
*
* Revision 1.1 1998/06/19 14:08:03 malthoff
* Created.
*
*
******************************************************************************/
/*
* skvpd.h contains Diagnostic specific defines for VPD handling
*/
#ifndef __INC_SKVPD_H_
#define __INC_SKVPD_H_
/*
* Define Resource Type Identifiers and VPD keywords
*/
#define RES_ID 0x82 /* Resource Type ID String (Product Name) */
#define RES_VPD_R 0x90 /* start of VPD read only area */
#define RES_VPD_W 0x91 /* start of VPD read/write area */
#define RES_END 0x78 /* Resource Type End Tag */
#ifndef VPD_NAME
#define VPD_NAME "Name" /* Product Name, VPD name of RES_ID */
#endif /* VPD_NAME */
#define VPD_PN "PN" /* Adapter Part Number */
#define VPD_EC "EC" /* Adapter Engineering Level */
#define VPD_MN "MN" /* Manufacture ID */
#define VPD_SN "SN" /* Serial Number */
#define VPD_CP "CP" /* Extended Capability */
#define VPD_RV "RV" /* Checksum and Reserved */
#define VPD_YA "YA" /* Asset Tag Identifier */
#define VPD_VL "VL" /* First Error Log Message (SK specific) */
#define VPD_VF "VF" /* Second Error Log Message (SK specific) */
#define VPD_RW "RW" /* Remaining Read / Write Area */
/* 'type' values for vpd_setup_para() */
#define VPD_RO_KEY 1 /* RO keys are "PN", "EC", "MN", "SN", "RV" */
#define VPD_RW_KEY 2 /* RW keys are "Yx", "Vx", and "RW" */
/* 'op' values for vpd_setup_para() */
#define ADD_KEY 1 /* add the key at the pos "RV" or "RW" */
#define OWR_KEY 2 /* overwrite key if already exists */
/*
* Define READ and WRITE Constants.
*/
#define VPD_DEV_ID_GENESIS 0x4300
#define VPD_SIZE_YUKON 256
#define VPD_SIZE_GENESIS 512
#define VPD_SIZE 512
#define VPD_READ 0x0000
#define VPD_WRITE 0x8000
#define VPD_STOP(pAC,IoC) VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG,VPD_WRITE)
#define VPD_GET_RES_LEN(p) ((unsigned int) \
(* (SK_U8 *)&(p)[1]) |\
((* (SK_U8 *)&(p)[2]) << 8))
#define VPD_GET_VPD_LEN(p) ((unsigned int)(* (SK_U8 *)&(p)[2]))
#define VPD_GET_VAL(p) ((char *)&(p)[3])
#define VPD_MAX_LEN 50
/* VPD status */
/* bit 7..1 reserved */
#define VPD_VALID (1<<0) /* VPD data buffer, vpd_free_ro, */
/* and vpd_free_rw valid */
/*
* VPD structs
*/
typedef struct s_vpd_status {
unsigned short Align01; /* Alignment */
unsigned short vpd_status; /* VPD status, description see above */
int vpd_free_ro; /* unused bytes in read only area */
int vpd_free_rw; /* bytes available in read/write area */
} SK_VPD_STATUS;
typedef struct s_vpd {
SK_VPD_STATUS v; /* VPD status structure */
char vpd_buf[VPD_SIZE]; /* VPD buffer */
int rom_size; /* VPD ROM Size from PCI_OUR_REG_2 */
int vpd_size; /* saved VPD-size */
} SK_VPD;
typedef struct s_vpd_para {
unsigned int p_len; /* parameter length */
char *p_val; /* points to the value */
} SK_VPD_PARA;
/*
* structure of Large Resource Type Identifiers
*/
/* was removed because of alignment problems */
/*
* structure of VPD keywords
*/
typedef struct s_vpd_key {
char p_key[2]; /* 2 bytes ID string */
unsigned char p_len; /* 1 byte length */
char p_val; /* start of the value string */
} SK_VPD_KEY;
/*
* System specific VPD macros
*/
#ifndef SKDIAG
#ifndef VPD_DO_IO
#define VPD_OUT8(pAC,IoC,Addr,Val) (void)SkPciWriteCfgByte(pAC,Addr,Val)
#define VPD_OUT16(pAC,IoC,Addr,Val) (void)SkPciWriteCfgWord(pAC,Addr,Val)
#define VPD_OUT32(pAC,IoC,Addr,Val) (void)SkPciWriteCfgDWord(pAC,Addr,Val)
#define VPD_IN8(pAC,IoC,Addr,pVal) (void)SkPciReadCfgByte(pAC,Addr,pVal)
#define VPD_IN16(pAC,IoC,Addr,pVal) (void)SkPciReadCfgWord(pAC,Addr,pVal)
#define VPD_IN32(pAC,IoC,Addr,pVal) (void)SkPciReadCfgDWord(pAC,Addr,pVal)
#else /* VPD_DO_IO */
#define VPD_OUT8(pAC,IoC,Addr,Val) SK_OUT8(IoC,PCI_C(Addr),Val)
#define VPD_OUT16(pAC,IoC,Addr,Val) SK_OUT16(IoC,PCI_C(Addr),Val)
#define VPD_OUT32(pAC,IoC,Addr,Val) SK_OUT32(IoC,PCI_C(Addr),Val)
#define VPD_IN8(pAC,IoC,Addr,pVal) SK_IN8(IoC,PCI_C(Addr),pVal)
#define VPD_IN16(pAC,IoC,Addr,pVal) SK_IN16(IoC,PCI_C(Addr),pVal)
#define VPD_IN32(pAC,IoC,Addr,pVal) SK_IN32(IoC,PCI_C(Addr),pVal)
#endif /* VPD_DO_IO */
#else /* SKDIAG */
#define VPD_OUT8(pAC,Ioc,Addr,Val) { \
if ((pAC)->DgT.DgUseCfgCycle) \
SkPciWriteCfgByte(pAC,Addr,Val); \
else \
SK_OUT8(pAC,PCI_C(Addr),Val); \
}
#define VPD_OUT16(pAC,Ioc,Addr,Val) { \
if ((pAC)->DgT.DgUseCfgCycle) \
SkPciWriteCfgWord(pAC,Addr,Val); \
else \
SK_OUT16(pAC,PCI_C(Addr),Val); \
}
#define VPD_OUT32(pAC,Ioc,Addr,Val) { \
if ((pAC)->DgT.DgUseCfgCycle) \
SkPciWriteCfgDWord(pAC,Addr,Val); \
else \
SK_OUT32(pAC,PCI_C(Addr),Val); \
}
#define VPD_IN8(pAC,Ioc,Addr,pVal) { \
if ((pAC)->DgT.DgUseCfgCycle) \
SkPciReadCfgByte(pAC,Addr,pVal); \
else \
SK_IN8(pAC,PCI_C(Addr),pVal); \
}
#define VPD_IN16(pAC,Ioc,Addr,pVal) { \
if ((pAC)->DgT.DgUseCfgCycle) \
SkPciReadCfgWord(pAC,Addr,pVal); \
else \
SK_IN16(pAC,PCI_C(Addr),pVal); \
}
#define VPD_IN32(pAC,Ioc,Addr,pVal) { \
if ((pAC)->DgT.DgUseCfgCycle) \
SkPciReadCfgDWord(pAC,Addr,pVal); \
else \
SK_IN32(pAC,PCI_C(Addr),pVal); \
}
#endif /* nSKDIAG */
/* function prototypes ********************************************************/
#ifndef SK_KR_PROTO
#ifdef SKDIAG
extern SK_U32 VpdReadDWord(
SK_AC *pAC,
SK_IOC IoC,
int addr);
#endif /* SKDIAG */
extern int VpdSetupPara(
SK_AC *pAC,
const char *key,
const char *buf,
int len,
int type,
int op);
extern SK_VPD_STATUS *VpdStat(
SK_AC *pAC,
SK_IOC IoC);
extern int VpdKeys(
SK_AC *pAC,
SK_IOC IoC,
char *buf,
int *len,
int *elements);
extern int VpdRead(
SK_AC *pAC,
SK_IOC IoC,
const char *key,
char *buf,
int *len);
extern SK_BOOL VpdMayWrite(
char *key);
extern int VpdWrite(
SK_AC *pAC,
SK_IOC IoC,
const char *key,
const char *buf);
extern int VpdDelete(
SK_AC *pAC,
SK_IOC IoC,
char *key);
extern int VpdUpdate(
SK_AC *pAC,
SK_IOC IoC);
extern void VpdErrLog(
SK_AC *pAC,
SK_IOC IoC,
char *msg);
#ifdef SKDIAG
extern int VpdReadBlock(
SK_AC *pAC,
SK_IOC IoC,
char *buf,
int addr,
int len);
extern int VpdWriteBlock(
SK_AC *pAC,
SK_IOC IoC,
char *buf,
int addr,
int len);
#endif /* SKDIAG */
#else /* SK_KR_PROTO */
extern SK_U32 VpdReadDWord();
extern int VpdSetupPara();
extern SK_VPD_STATUS *VpdStat();
extern int VpdKeys();
extern int VpdRead();
extern SK_BOOL VpdMayWrite();
extern int VpdWrite();
extern int VpdDelete();
extern int VpdUpdate();
extern void VpdErrLog();
#endif /* SK_KR_PROTO */
#endif /* __INC_SKVPD_H_ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,923 @@
/******************************************************************************
*
* Name: skcsum.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.10 $
* Date: $Date: 2002/04/11 10:02:04 $
* Purpose: Store/verify Internet checksum in send/receive packets.
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2001 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: skcsum.c,v $
* Revision 1.10 2002/04/11 10:02:04 rwahl
* Fix in SkCsGetSendInfo():
* - function did not return ProtocolFlags in every case.
* - pseudo header csum calculated wrong for big endian.
*
* Revision 1.9 2001/06/13 07:42:08 gklug
* fix: NetNumber was wrong in CLEAR_STAT event
* add: check for good NetNumber in Clear STAT
*
* Revision 1.8 2001/02/06 11:15:36 rassmann
* Supporting two nets on dual-port adapters.
*
* Revision 1.7 2000/06/29 13:17:05 rassmann
* Corrected reception of a packet with UDP checksum == 0 (which means there
* is no UDP checksum).
*
* Revision 1.6 2000/02/21 12:35:10 cgoos
* Fixed license header comment.
*
* Revision 1.5 2000/02/21 11:05:19 cgoos
* Merged changes back to common source.
* Fixed rx path for BIG ENDIAN architecture.
*
* Revision 1.1 1999/07/26 15:28:12 mkarl
* added return SKCS_STATUS_IP_CSUM_ERROR_UDP and
* SKCS_STATUS_IP_CSUM_ERROR_TCP to pass the NidsTester
* changed from common source to windows specific source
* therefore restarting with v1.0
*
* Revision 1.3 1999/05/10 08:39:33 mkarl
* prevent overflows in SKCS_HTON16
* fixed a bug in pseudo header checksum calculation
* added some comments
*
* Revision 1.2 1998/10/22 11:53:28 swolf
* Now using SK_DBG_MSG.
*
* Revision 1.1 1998/09/01 15:35:41 swolf
* initial revision
*
* 13-May-1998 sw Created.
*
******************************************************************************/
#ifdef SK_USE_CSUM /* Check if CSUM is to be used. */
#ifndef lint
static const char SysKonnectFileId[] = "@(#)"
"$Id: skcsum.c,v 1.10 2002/04/11 10:02:04 rwahl Exp $"
" (C) SysKonnect.";
#endif /* !lint */
/******************************************************************************
*
* Description:
*
* This is the "GEnesis" common module "CSUM".
*
* This module contains the code necessary to calculate, store, and verify the
* Internet Checksum of IP, TCP, and UDP frames.
*
* "GEnesis" is an abbreviation of "Gigabit Ethernet Network System in Silicon"
* and is the code name of this SysKonnect project.
*
* Compilation Options:
*
* SK_USE_CSUM - Define if CSUM is to be used. Otherwise, CSUM will be an
* empty module.
*
* SKCS_OVERWRITE_PROTO - Define to overwrite the default protocol id
* definitions. In this case, all SKCS_PROTO_xxx definitions must be made
* external.
*
* SKCS_OVERWRITE_STATUS - Define to overwrite the default return status
* definitions. In this case, all SKCS_STATUS_xxx definitions must be made
* external.
*
* Include File Hierarchy:
*
* "h/skdrv1st.h"
* "h/skcsum.h"
* "h/sktypes.h"
* "h/skqueue.h"
* "h/skdrv2nd.h"
*
******************************************************************************/
#include "h/skdrv1st.h"
#include "h/skcsum.h"
#include "h/skdrv2nd.h"
/* defines ********************************************************************/
/* The size of an Ethernet MAC header. */
#define SKCS_ETHERNET_MAC_HEADER_SIZE (6+6+2)
/* The size of the used topology's MAC header. */
#define SKCS_MAC_HEADER_SIZE SKCS_ETHERNET_MAC_HEADER_SIZE
/* The size of the IP header without any option fields. */
#define SKCS_IP_HEADER_SIZE 20
/*
* Field offsets within the IP header.
*/
/* "Internet Header Version" and "Length". */
#define SKCS_OFS_IP_HEADER_VERSION_AND_LENGTH 0
/* "Total Length". */
#define SKCS_OFS_IP_TOTAL_LENGTH 2
/* "Flags" "Fragment Offset". */
#define SKCS_OFS_IP_FLAGS_AND_FRAGMENT_OFFSET 6
/* "Next Level Protocol" identifier. */
#define SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL 9
/* Source IP address. */
#define SKCS_OFS_IP_SOURCE_ADDRESS 12
/* Destination IP address. */
#define SKCS_OFS_IP_DESTINATION_ADDRESS 16
/*
* Field offsets within the UDP header.
*/
/* UDP checksum. */
#define SKCS_OFS_UDP_CHECKSUM 6
/* IP "Next Level Protocol" identifiers (see RFC 790). */
#define SKCS_PROTO_ID_TCP 6 /* Transport Control Protocol */
#define SKCS_PROTO_ID_UDP 17 /* User Datagram Protocol */
/* IP "Don't Fragment" bit. */
#define SKCS_IP_DONT_FRAGMENT SKCS_HTON16(0x4000)
/* Add a byte offset to a pointer. */
#define SKCS_IDX(pPtr, Ofs) ((void *) ((char *) (pPtr) + (Ofs)))
/*
* Macros that convert host to network representation and vice versa, i.e.
* little/big endian conversion on little endian machines only.
*/
#ifdef SK_LITTLE_ENDIAN
#define SKCS_HTON16(Val16) (((unsigned) (Val16) >> 8) | (((Val16) & 0xFF) << 8))
#endif /* SK_LITTLE_ENDIAN */
#ifdef SK_BIG_ENDIAN
#define SKCS_HTON16(Val16) (Val16)
#endif /* SK_BIG_ENDIAN */
#define SKCS_NTOH16(Val16) SKCS_HTON16(Val16)
/* typedefs *******************************************************************/
/* function prototypes ********************************************************/
/******************************************************************************
*
* SkCsGetSendInfo - get checksum information for a send packet
*
* Description:
* Get all checksum information necessary to send a TCP or UDP packet. The
* function checks the IP header passed to it. If the high-level protocol
* is either TCP or UDP the pseudo header checksum is calculated and
* returned.
*
* The function returns the total length of the IP header (including any
* IP option fields), which is the same as the start offset of the IP data
* which in turn is the start offset of the TCP or UDP header.
*
* The function also returns the TCP or UDP pseudo header checksum, which
* should be used as the start value for the hardware checksum calculation.
* (Note that any actual pseudo header checksum can never calculate to
* zero.)
*
* Note:
* There is a bug in the ASIC which may lead to wrong checksums.
*
* Arguments:
* pAc - A pointer to the adapter context struct.
*
* pIpHeader - Pointer to IP header. Must be at least the IP header *not*
* including any option fields, i.e. at least 20 bytes.
*
* Note: This pointer will be used to address 8-, 16-, and 32-bit
* variables with the respective alignment offsets relative to the pointer.
* Thus, the pointer should point to a 32-bit aligned address. If the
* target system cannot address 32-bit variables on non 32-bit aligned
* addresses, then the pointer *must* point to a 32-bit aligned address.
*
* pPacketInfo - A pointer to the packet information structure for this
* packet. Before calling this SkCsGetSendInfo(), the following field must
* be initialized:
*
* ProtocolFlags - Initialize with any combination of
* SKCS_PROTO_XXX bit flags. SkCsGetSendInfo() will only work on
* the protocols specified here. Any protocol(s) not specified
* here will be ignored.
*
* Note: Only one checksum can be calculated in hardware. Thus, if
* SKCS_PROTO_IP is specified in the 'ProtocolFlags',
* SkCsGetSendInfo() must calculate the IP header checksum in
* software. It might be a better idea to have the calling
* protocol stack calculate the IP header checksum.
*
* Returns: N/A
* On return, the following fields in 'pPacketInfo' may or may not have
* been filled with information, depending on the protocol(s) found in the
* packet:
*
* ProtocolFlags - Returns the SKCS_PROTO_XXX bit flags of the protocol(s)
* that were both requested by the caller and actually found in the packet.
* Protocol(s) not specified by the caller and/or not found in the packet
* will have their respective SKCS_PROTO_XXX bit flags reset.
*
* Note: For IP fragments, TCP and UDP packet information is ignored.
*
* IpHeaderLength - The total length in bytes of the complete IP header
* including any option fields is returned here. This is the start offset
* of the IP data, i.e. the TCP or UDP header if present.
*
* IpHeaderChecksum - If IP has been specified in the 'ProtocolFlags', the
* 16-bit Internet Checksum of the IP header is returned here. This value
* is to be stored into the packet's 'IP Header Checksum' field.
*
* PseudoHeaderChecksum - If this is a TCP or UDP packet and if TCP or UDP
* has been specified in the 'ProtocolFlags', the 16-bit Internet Checksum
* of the TCP or UDP pseudo header is returned here.
*/
#if 0
void SkCsGetSendInfo(
SK_AC *pAc, /* Adapter context struct. */
void *pIpHeader, /* IP header. */
SKCS_PACKET_INFO *pPacketInfo, /* Packet information struct. */
int NetNumber) /* Net number */
{
/* Internet Header Version found in IP header. */
unsigned InternetHeaderVersion;
/* Length of the IP header as found in IP header. */
unsigned IpHeaderLength;
/* Bit field specifiying the desired/found protocols. */
unsigned ProtocolFlags;
/* Next level protocol identifier found in IP header. */
unsigned NextLevelProtocol;
/* Length of IP data portion. */
unsigned IpDataLength;
/* TCP/UDP pseudo header checksum. */
unsigned long PseudoHeaderChecksum;
/* Pointer to next level protocol statistics structure. */
SKCS_PROTO_STATS *NextLevelProtoStats;
/* Temporary variable. */
unsigned Tmp;
Tmp = *(SK_U8 *)
SKCS_IDX(pIpHeader, SKCS_OFS_IP_HEADER_VERSION_AND_LENGTH);
/* Get the Internet Header Version (IHV). */
/* Note: The IHV is stored in the upper four bits. */
InternetHeaderVersion = Tmp >> 4;
/* Check the Internet Header Version. */
/* Note: We currently only support IP version 4. */
if (InternetHeaderVersion != 4) { /* IPv4? */
SK_DBG_MSG(pAc, SK_DBGMOD_CSUM, SK_DBGCAT_ERR | SK_DBGCAT_TX,
("Tx: Unknown Internet Header Version %u.\n",
InternetHeaderVersion));
pPacketInfo->ProtocolFlags = 0;
pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_IP].TxUnableCts++;
return;
}
/* Get the IP header length (IHL). */
/*
* Note: The IHL is stored in the lower four bits as the number of
* 4-byte words.
*/
IpHeaderLength = (Tmp & 0xf) * 4;
pPacketInfo->IpHeaderLength = IpHeaderLength;
/* Check the IP header length. */
/* 04-Aug-1998 sw - Really check the IHL? Necessary? */
if (IpHeaderLength < 5*4) {
SK_DBG_MSG(pAc, SK_DBGMOD_CSUM, SK_DBGCAT_ERR | SK_DBGCAT_TX,
("Tx: Invalid IP Header Length %u.\n", IpHeaderLength));
pPacketInfo->ProtocolFlags = 0;
pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_IP].TxUnableCts++;
return;
}
/* This is an IPv4 frame with a header of valid length. */
pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_IP].TxOkCts++;
/* Check if we should calculate the IP header checksum. */
ProtocolFlags = pPacketInfo->ProtocolFlags;
if (ProtocolFlags & SKCS_PROTO_IP) {
pPacketInfo->IpHeaderChecksum =
SkCsCalculateChecksum(pIpHeader, IpHeaderLength);
}
/* Get the next level protocol identifier. */
NextLevelProtocol =
*(SK_U8 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL);
/*
* Check if this is a TCP or UDP frame and if we should calculate the
* TCP/UDP pseudo header checksum.
*
* Also clear all protocol bit flags of protocols not present in the
* frame.
*/
if ((ProtocolFlags & SKCS_PROTO_TCP) != 0 &&
NextLevelProtocol == SKCS_PROTO_ID_TCP) {
/* TCP/IP frame. */
ProtocolFlags &= SKCS_PROTO_TCP | SKCS_PROTO_IP;
NextLevelProtoStats =
&pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_TCP];
}
else if ((ProtocolFlags & SKCS_PROTO_UDP) != 0 &&
NextLevelProtocol == SKCS_PROTO_ID_UDP) {
/* UDP/IP frame. */
ProtocolFlags &= SKCS_PROTO_UDP | SKCS_PROTO_IP;
NextLevelProtoStats =
&pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_UDP];
}
else {
/*
* Either not a TCP or UDP frame and/or TCP/UDP processing not
* specified.
*/
pPacketInfo->ProtocolFlags = ProtocolFlags & SKCS_PROTO_IP;
return;
}
/* Check if this is an IP fragment. */
/*
* Note: An IP fragment has a non-zero "Fragment Offset" field and/or
* the "More Fragments" bit set. Thus, if both the "Fragment Offset"
* and the "More Fragments" are zero, it is *not* a fragment. We can
* easily check both at the same time since they are in the same 16-bit
* word.
*/
if ((*(SK_U16 *)
SKCS_IDX(pIpHeader, SKCS_OFS_IP_FLAGS_AND_FRAGMENT_OFFSET) &
~SKCS_IP_DONT_FRAGMENT) != 0) {
/* IP fragment; ignore all other protocols. */
pPacketInfo->ProtocolFlags = ProtocolFlags & SKCS_PROTO_IP;
NextLevelProtoStats->TxUnableCts++;
return;
}
/*
* Calculate the TCP/UDP pseudo header checksum.
*/
/* Get total length of IP header and data. */
IpDataLength =
*(SK_U16 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_TOTAL_LENGTH);
/* Get length of IP data portion. */
IpDataLength = SKCS_NTOH16(IpDataLength) - IpHeaderLength;
/* Calculate the sum of all pseudo header fields (16-bit). */
PseudoHeaderChecksum =
(unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader,
SKCS_OFS_IP_SOURCE_ADDRESS + 0) +
(unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader,
SKCS_OFS_IP_SOURCE_ADDRESS + 2) +
(unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader,
SKCS_OFS_IP_DESTINATION_ADDRESS + 0) +
(unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader,
SKCS_OFS_IP_DESTINATION_ADDRESS + 2) +
(unsigned long) SKCS_HTON16(NextLevelProtocol) +
(unsigned long) SKCS_HTON16(IpDataLength);
/* Add-in any carries. */
SKCS_OC_ADD(PseudoHeaderChecksum, PseudoHeaderChecksum, 0);
/* Add-in any new carry. */
SKCS_OC_ADD(pPacketInfo->PseudoHeaderChecksum, PseudoHeaderChecksum, 0);
pPacketInfo->ProtocolFlags = ProtocolFlags;
NextLevelProtoStats->TxOkCts++; /* Success. */
} /* SkCsGetSendInfo */
/******************************************************************************
*
* SkCsGetReceiveInfo - verify checksum information for a received packet
*
* Description:
* Verify a received frame's checksum. The function returns a status code
* reflecting the result of the verification.
*
* Note:
* Before calling this function you have to verify that the frame is
* not padded and Checksum1 and Checksum2 are bigger than 1.
*
* Arguments:
* pAc - Pointer to adapter context struct.
*
* pIpHeader - Pointer to IP header. Must be at least the length in bytes
* of the received IP header including any option fields. For UDP packets,
* 8 additional bytes are needed to access the UDP checksum.
*
* Note: The actual length of the IP header is stored in the lower four
* bits of the first octet of the IP header as the number of 4-byte words,
* so it must be multiplied by four to get the length in bytes. Thus, the
* maximum IP header length is 15 * 4 = 60 bytes.
*
* Checksum1 - The first 16-bit Internet Checksum calculated by the
* hardware starting at the offset returned by SkCsSetReceiveFlags().
*
* Checksum2 - The second 16-bit Internet Checksum calculated by the
* hardware starting at the offset returned by SkCsSetReceiveFlags().
*
* Returns:
* SKCS_STATUS_UNKNOWN_IP_VERSION - Not an IP v4 frame.
* SKCS_STATUS_IP_CSUM_ERROR - IP checksum error.
* SKCS_STATUS_IP_CSUM_ERROR_TCP - IP checksum error in TCP frame.
* SKCS_STATUS_IP_CSUM_ERROR_UDP - IP checksum error in UDP frame
* SKCS_STATUS_IP_FRAGMENT - IP fragment (IP checksum ok).
* SKCS_STATUS_IP_CSUM_OK - IP checksum ok (not a TCP or UDP frame).
* SKCS_STATUS_TCP_CSUM_ERROR - TCP checksum error (IP checksum ok).
* SKCS_STATUS_UDP_CSUM_ERROR - UDP checksum error (IP checksum ok).
* SKCS_STATUS_TCP_CSUM_OK - IP and TCP checksum ok.
* SKCS_STATUS_UDP_CSUM_OK - IP and UDP checksum ok.
* SKCS_STATUS_IP_CSUM_OK_NO_UDP - IP checksum OK and no UDP checksum.
*
* Note: If SKCS_OVERWRITE_STATUS is defined, the SKCS_STATUS_XXX values
* returned here can be defined in some header file by the module using CSUM.
* In this way, the calling module can assign return values for its own needs,
* e.g. by assigning bit flags to the individual protocols.
*/
SKCS_STATUS SkCsGetReceiveInfo(
SK_AC *pAc, /* Adapter context struct. */
void *pIpHeader, /* IP header. */
unsigned Checksum1, /* Hardware checksum 1. */
unsigned Checksum2, /* Hardware checksum 2. */
int NetNumber) /* Net number */
{
/* Internet Header Version found in IP header. */
unsigned InternetHeaderVersion;
/* Length of the IP header as found in IP header. */
unsigned IpHeaderLength;
/* Length of IP data portion. */
unsigned IpDataLength;
/* IP header checksum. */
unsigned IpHeaderChecksum;
/* IP header options checksum, if any. */
unsigned IpOptionsChecksum;
/* IP data checksum, i.e. TCP/UDP checksum. */
unsigned IpDataChecksum;
/* Next level protocol identifier found in IP header. */
unsigned NextLevelProtocol;
/* The checksum of the "next level protocol", i.e. TCP or UDP. */
unsigned long NextLevelProtocolChecksum;
/* Pointer to next level protocol statistics structure. */
SKCS_PROTO_STATS *NextLevelProtoStats;
/* Temporary variable. */
unsigned Tmp;
Tmp = *(SK_U8 *)
SKCS_IDX(pIpHeader, SKCS_OFS_IP_HEADER_VERSION_AND_LENGTH);
/* Get the Internet Header Version (IHV). */
/* Note: The IHV is stored in the upper four bits. */
InternetHeaderVersion = Tmp >> 4;
/* Check the Internet Header Version. */
/* Note: We currently only support IP version 4. */
if (InternetHeaderVersion != 4) { /* IPv4? */
SK_DBG_MSG(pAc, SK_DBGMOD_CSUM, SK_DBGCAT_ERR | SK_DBGCAT_RX,
("Rx: Unknown Internet Header Version %u.\n",
InternetHeaderVersion));
pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_IP].RxUnableCts++;
return (SKCS_STATUS_UNKNOWN_IP_VERSION);
}
/* Get the IP header length (IHL). */
/*
* Note: The IHL is stored in the lower four bits as the number of
* 4-byte words.
*/
IpHeaderLength = (Tmp & 0xf) * 4;
/* Check the IP header length. */
/* 04-Aug-1998 sw - Really check the IHL? Necessary? */
if (IpHeaderLength < 5*4) {
SK_DBG_MSG(pAc, SK_DBGMOD_CSUM, SK_DBGCAT_ERR | SK_DBGCAT_RX,
("Rx: Invalid IP Header Length %u.\n", IpHeaderLength));
pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_IP].RxErrCts++;
return (SKCS_STATUS_IP_CSUM_ERROR);
}
/* This is an IPv4 frame with a header of valid length. */
/* Get the IP header and data checksum. */
IpDataChecksum = Checksum2;
/*
* The IP header checksum is calculated as follows:
*
* IpHeaderChecksum = Checksum1 - Checksum2
*/
SKCS_OC_SUB(IpHeaderChecksum, Checksum1, Checksum2);
/* Check if any IP header options. */
if (IpHeaderLength > SKCS_IP_HEADER_SIZE) {
/* Get the IP options checksum. */
IpOptionsChecksum = SkCsCalculateChecksum(
SKCS_IDX(pIpHeader, SKCS_IP_HEADER_SIZE),
IpHeaderLength - SKCS_IP_HEADER_SIZE);
/* Adjust the IP header and IP data checksums. */
SKCS_OC_ADD(IpHeaderChecksum, IpHeaderChecksum, IpOptionsChecksum);
SKCS_OC_SUB(IpDataChecksum, IpDataChecksum, IpOptionsChecksum);
}
/*
* Check if the IP header checksum is ok.
*
* NOTE: We must check the IP header checksum even if the caller just wants
* us to check upper-layer checksums, because we cannot do any further
* processing of the packet without a valid IP checksum.
*/
/* Get the next level protocol identifier. */
NextLevelProtocol = *(SK_U8 *)
SKCS_IDX(pIpHeader, SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL);
if (IpHeaderChecksum != 0xFFFF) {
pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_IP].RxErrCts++;
/* the NDIS tester wants to know the upper level protocol too */
if (NextLevelProtocol == SKCS_PROTO_ID_TCP) {
return(SKCS_STATUS_IP_CSUM_ERROR_TCP);
}
else if (NextLevelProtocol == SKCS_PROTO_ID_UDP) {
return(SKCS_STATUS_IP_CSUM_ERROR_UDP);
}
return (SKCS_STATUS_IP_CSUM_ERROR);
}
/*
* Check if this is a TCP or UDP frame and if we should calculate the
* TCP/UDP pseudo header checksum.
*
* Also clear all protocol bit flags of protocols not present in the
* frame.
*/
if ((pAc->Csum.ReceiveFlags[NetNumber] & SKCS_PROTO_TCP) != 0 &&
NextLevelProtocol == SKCS_PROTO_ID_TCP) {
/* TCP/IP frame. */
NextLevelProtoStats =
&pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_TCP];
}
else if ((pAc->Csum.ReceiveFlags[NetNumber] & SKCS_PROTO_UDP) != 0 &&
NextLevelProtocol == SKCS_PROTO_ID_UDP) {
/* UDP/IP frame. */
NextLevelProtoStats =
&pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_UDP];
}
else {
/*
* Either not a TCP or UDP frame and/or TCP/UDP processing not
* specified.
*/
return (SKCS_STATUS_IP_CSUM_OK);
}
/* Check if this is an IP fragment. */
/*
* Note: An IP fragment has a non-zero "Fragment Offset" field and/or
* the "More Fragments" bit set. Thus, if both the "Fragment Offset"
* and the "More Fragments" are zero, it is *not* a fragment. We can
* easily check both at the same time since they are in the same 16-bit
* word.
*/
if ((*(SK_U16 *)
SKCS_IDX(pIpHeader, SKCS_OFS_IP_FLAGS_AND_FRAGMENT_OFFSET) &
~SKCS_IP_DONT_FRAGMENT) != 0) {
/* IP fragment; ignore all other protocols. */
NextLevelProtoStats->RxUnableCts++;
return (SKCS_STATUS_IP_FRAGMENT);
}
/*
* 08-May-2000 ra
*
* From RFC 768 (UDP)
* If the computed checksum is zero, it is transmitted as all ones (the
* equivalent in one's complement arithmetic). An all zero transmitted
* checksum value means that the transmitter generated no checksum (for
* debugging or for higher level protocols that don't care).
*/
if (NextLevelProtocol == SKCS_PROTO_ID_UDP &&
*(SK_U16*)SKCS_IDX(pIpHeader, IpHeaderLength + 6) == 0x0000) {
NextLevelProtoStats->RxOkCts++;
return (SKCS_STATUS_IP_CSUM_OK_NO_UDP);
}
/*
* Calculate the TCP/UDP checksum.
*/
/* Get total length of IP header and data. */
IpDataLength =
*(SK_U16 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_TOTAL_LENGTH);
/* Get length of IP data portion. */
IpDataLength = SKCS_NTOH16(IpDataLength) - IpHeaderLength;
NextLevelProtocolChecksum =
/* Calculate the pseudo header checksum. */
(unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader,
SKCS_OFS_IP_SOURCE_ADDRESS + 0) +
(unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader,
SKCS_OFS_IP_SOURCE_ADDRESS + 2) +
(unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader,
SKCS_OFS_IP_DESTINATION_ADDRESS + 0) +
(unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader,
SKCS_OFS_IP_DESTINATION_ADDRESS + 2) +
(unsigned long) SKCS_HTON16(NextLevelProtocol) +
(unsigned long) SKCS_HTON16(IpDataLength) +
/* Add the TCP/UDP header checksum. */
(unsigned long) IpDataChecksum;
/* Add-in any carries. */
SKCS_OC_ADD(NextLevelProtocolChecksum, NextLevelProtocolChecksum, 0);
/* Add-in any new carry. */
SKCS_OC_ADD(NextLevelProtocolChecksum, NextLevelProtocolChecksum, 0);
/* Check if the TCP/UDP checksum is ok. */
if ((unsigned) NextLevelProtocolChecksum == 0xFFFF) {
/* TCP/UDP checksum ok. */
NextLevelProtoStats->RxOkCts++;
return (NextLevelProtocol == SKCS_PROTO_ID_TCP ?
SKCS_STATUS_TCP_CSUM_OK : SKCS_STATUS_UDP_CSUM_OK);
}
/* TCP/UDP checksum error. */
NextLevelProtoStats->RxErrCts++;
return (NextLevelProtocol == SKCS_PROTO_ID_TCP ?
SKCS_STATUS_TCP_CSUM_ERROR : SKCS_STATUS_UDP_CSUM_ERROR);
} /* SkCsGetReceiveInfo */
#endif
/******************************************************************************
*
* SkCsSetReceiveFlags - set checksum receive flags
*
* Description:
* Use this function to set the various receive flags. According to the
* protocol flags set by the caller, the start offsets within received
* packets of the two hardware checksums are returned. These offsets must
* be stored in all receive descriptors.
*
* Arguments:
* pAc - Pointer to adapter context struct.
*
* ReceiveFlags - Any combination of SK_PROTO_XXX flags of the protocols
* for which the caller wants checksum information on received frames.
*
* pChecksum1Offset - The start offset of the first receive descriptor
* hardware checksum to be calculated for received frames is returned
* here.
*
* pChecksum2Offset - The start offset of the second receive descriptor
* hardware checksum to be calculated for received frames is returned
* here.
*
* Returns: N/A
* Returns the two hardware checksum start offsets.
*/
void SkCsSetReceiveFlags(
SK_AC *pAc, /* Adapter context struct. */
unsigned ReceiveFlags, /* New receive flags. */
unsigned *pChecksum1Offset, /* Offset for hardware checksum 1. */
unsigned *pChecksum2Offset, /* Offset for hardware checksum 2. */
int NetNumber)
{
/* Save the receive flags. */
pAc->Csum.ReceiveFlags[NetNumber] = ReceiveFlags;
/* First checksum start offset is the IP header. */
*pChecksum1Offset = SKCS_MAC_HEADER_SIZE;
/*
* Second checksum start offset is the IP data. Note that this may vary
* if there are any IP header options in the actual packet.
*/
*pChecksum2Offset = SKCS_MAC_HEADER_SIZE + SKCS_IP_HEADER_SIZE;
} /* SkCsSetReceiveFlags */
#ifndef SkCsCalculateChecksum
/******************************************************************************
*
* SkCsCalculateChecksum - calculate checksum for specified data
*
* Description:
* Calculate and return the 16-bit Internet Checksum for the specified
* data.
*
* Arguments:
* pData - Pointer to data for which the checksum shall be calculated.
* Note: The pointer should be aligned on a 16-bit boundary.
*
* Length - Length in bytes of data to checksum.
*
* Returns:
* The 16-bit Internet Checksum for the specified data.
*
* Note: The checksum is calculated in the machine's natural byte order,
* i.e. little vs. big endian. Thus, the resulting checksum is different
* for the same input data on little and big endian machines.
*
* However, when written back to the network packet, the byte order is
* always in correct network order.
*/
unsigned SkCsCalculateChecksum(
void *pData, /* Data to checksum. */
unsigned Length) /* Length of data. */
{
SK_U16 *pU16; /* Pointer to the data as 16-bit words. */
unsigned long Checksum; /* Checksum; must be at least 32 bits. */
/* Sum up all 16-bit words. */
pU16 = (SK_U16 *) pData;
for (Checksum = 0; Length > 1; Length -= 2) {
Checksum += *pU16++;
}
/* If this is an odd number of bytes, add-in the last byte. */
if (Length > 0) {
#ifdef SK_BIG_ENDIAN
/* Add the last byte as the high byte. */
Checksum += ((unsigned) *(SK_U8 *) pU16) << 8;
#else /* !SK_BIG_ENDIAN */
/* Add the last byte as the low byte. */
Checksum += *(SK_U8 *) pU16;
#endif /* !SK_BIG_ENDIAN */
}
/* Add-in any carries. */
SKCS_OC_ADD(Checksum, Checksum, 0);
/* Add-in any new carry. */
SKCS_OC_ADD(Checksum, Checksum, 0);
/* Note: All bits beyond the 16-bit limit are now zero. */
return ((unsigned) Checksum);
} /* SkCsCalculateChecksum */
#endif /* SkCsCalculateChecksum */
/******************************************************************************
*
* SkCsEvent - the CSUM event dispatcher
*
* Description:
* This is the event handler for the CSUM module.
*
* Arguments:
* pAc - Pointer to adapter context.
*
* Ioc - I/O context.
*
* Event - Event id.
*
* Param - Event dependent parameter.
*
* Returns:
* The 16-bit Internet Checksum for the specified data.
*
* Note: The checksum is calculated in the machine's natural byte order,
* i.e. little vs. big endian. Thus, the resulting checksum is different
* for the same input data on little and big endian machines.
*
* However, when written back to the network packet, the byte order is
* always in correct network order.
*/
int SkCsEvent(
SK_AC *pAc, /* Pointer to adapter context. */
SK_IOC Ioc, /* I/O context. */
SK_U32 Event, /* Event id. */
SK_EVPARA Param) /* Event dependent parameter. */
{
int ProtoIndex;
int NetNumber;
switch (Event) {
/*
* Clear protocol statistics.
*
* Param - Protocol index, or -1 for all protocols.
* - Net number.
*/
case SK_CSUM_EVENT_CLEAR_PROTO_STATS:
ProtoIndex = (int)Param.Para32[1];
NetNumber = (int)Param.Para32[0];
if (ProtoIndex < 0) { /* Clear for all protocols. */
if (NetNumber >= 0) {
memset(&pAc->Csum.ProtoStats[NetNumber][0], 0,
sizeof(pAc->Csum.ProtoStats[NetNumber]));
}
}
else { /* Clear for individual protocol. */
memset(&pAc->Csum.ProtoStats[NetNumber][ProtoIndex], 0,
sizeof(pAc->Csum.ProtoStats[NetNumber][ProtoIndex]));
}
break;
default:
break;
}
return (0); /* Success. */
} /* SkCsEvent */
#endif /* SK_USE_CSUM */

File diff suppressed because it is too large Load Diff

@ -0,0 +1,214 @@
/******************************************************************************
*
* Name: skgehwt.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.13 $
* Date: $Date: 1999/11/22 13:31:12 $
* Purpose: Hardware Timer.
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998,1999 SysKonnect,
* a business unit of Schneider & Koch & Co. Datensysteme GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: skgehwt.c,v $
* Revision 1.13 1999/11/22 13:31:12 cgoos
* Changed license header to GPL.
*
* Revision 1.12 1998/10/15 15:11:34 gklug
* fix: ID_sccs to SysKonnectFileId
*
* Revision 1.11 1998/10/08 15:27:51 gklug
* chg: correction factor is host clock dependent
*
* Revision 1.10 1998/09/15 14:18:31 cgoos
* Changed more BOOLEANs to SK_xxx
*
* Revision 1.9 1998/09/15 14:16:06 cgoos
* Changed line 107: FALSE to SK_FALSE
*
* Revision 1.8 1998/08/24 13:04:44 gklug
* fix: typo
*
* Revision 1.7 1998/08/19 09:50:49 gklug
* fix: remove struct keyword from c-code (see CCC) add typedefs
*
* Revision 1.6 1998/08/17 09:59:02 gklug
* fix: typos
*
* Revision 1.5 1998/08/14 07:09:10 gklug
* fix: chg pAc -> pAC
*
* Revision 1.4 1998/08/10 14:14:52 gklug
* rmv: unneccessary SK_ADDR macro
*
* Revision 1.3 1998/08/07 12:53:44 gklug
* fix: first compiled version
*
* Revision 1.2 1998/08/07 09:19:29 gklug
* adapt functions to the C coding conventions
* rmv unneccessary functions.
*
* Revision 1.1 1998/08/05 11:28:36 gklug
* first version: adapted from SMT/FDDI
*
*
*
*
******************************************************************************/
/*
Event queue and dispatcher
*/
static const char SysKonnectFileId[] =
"$Header: /usr56/projects/ge/schedule/skgehwt.c,v 1.13 1999/11/22 13:31:12 cgoos Exp $" ;
#include "h/skdrv1st.h" /* Driver Specific Definitions */
#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */
#ifdef __C2MAN__
/*
Hardware Timer function queue management.
General Description:
*/
intro()
{}
#endif
/*
* Prototypes of local functions.
*/
#define SK_HWT_MAX (65000)
/* correction factor */
#define SK_HWT_FAC (1000 * (SK_U32)pAC->GIni.GIHstClkFact / 100)
/*
* Initialize hardware timer.
*
* Must be called during init level 1.
*/
void SkHwtInit(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc) /* IoContext */
{
pAC->Hwt.TStart = 0 ;
pAC->Hwt.TStop = 0 ;
pAC->Hwt.TActive = SK_FALSE ;
SkHwtStop(pAC,Ioc) ;
}
/*
*
* Start hardware timer (clock ticks are 16us).
*
*/
void SkHwtStart(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc, /* IoContext */
SK_U32 Time) /* Time in units of 16us to load the timer with. */
{
SK_U32 Cnt ;
if (Time > SK_HWT_MAX)
Time = SK_HWT_MAX ;
pAC->Hwt.TStart = Time ;
pAC->Hwt.TStop = 0L ;
Cnt = Time ;
/*
* if time < 16 us
* time = 16 us
*/
if (!Cnt) {
Cnt++ ;
}
SK_OUT32(Ioc, B2_TI_INI, Cnt * SK_HWT_FAC) ;
SK_OUT16(Ioc, B2_TI_CRTL, TIM_START) ; /* Start timer. */
pAC->Hwt.TActive = SK_TRUE ;
}
/*
* Stop hardware timer.
* and clear the timer IRQ
*/
void SkHwtStop(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc) /* IoContext */
{
SK_OUT16(Ioc, B2_TI_CRTL, TIM_STOP) ;
SK_OUT16(Ioc, B2_TI_CRTL, TIM_CLR_IRQ) ;
pAC->Hwt.TActive = SK_FALSE ;
}
/*
* Stop hardware timer and read time elapsed since last start.
*
* returns
* The elapsed time since last start in units of 16us.
*
*/
SK_U32 SkHwtRead(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc) /* IoContext */
{
SK_U32 TRead ;
SK_U32 IStatus ;
if (pAC->Hwt.TActive) {
SkHwtStop(pAC,Ioc) ;
SK_IN32(Ioc, B2_TI_VAL, &TRead);
TRead /= SK_HWT_FAC;
SK_IN32(Ioc, B0_ISRC, &IStatus);
/* Check if timer expired (or wraparound). */
if ((TRead > pAC->Hwt.TStart) || (IStatus & IS_TIMINT)) {
SkHwtStop(pAC,Ioc) ;
pAC->Hwt.TStop = pAC->Hwt.TStart ;
} else {
pAC->Hwt.TStop = pAC->Hwt.TStart - TRead ;
}
}
return (pAC->Hwt.TStop) ;
}
/*
* interrupt source= timer
*/
void SkHwtIsr(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc) /* IoContext */
{
SkHwtStop(pAC,Ioc);
pAC->Hwt.TStop = pAC->Hwt.TStart;
SkTimerDone(pAC,Ioc) ;
}
/* End of file */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,286 @@
/******************************************************************************
*
* Name: sklm80.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.20 $
* Date: $Date: 2002/08/13 09:16:27 $
* Purpose: Funktions to access Voltage and Temperature Sensor (LM80)
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: sklm80.c,v $
* Revision 1.20 2002/08/13 09:16:27 rschmidt
* Changed return value for SkLm80ReadSensor() back to 'int'
* Editorial changes
*
* Revision 1.19 2002/08/06 09:43:31 jschmalz
* Extensions and changes for Yukon
*
* Revision 1.18 2002/08/02 12:26:57 rschmidt
* Editorial changes
*
* Revision 1.17 1999/11/22 13:35:51 cgoos
* Changed license header to GPL.
*
* Revision 1.16 1999/05/27 14:05:47 malthoff
* Fans: Set SenVal to 0 if the fan value is 0 or 0xff. Both values
* are outside the limits (0: div zero error, 0xff: value not in
* range, assume 0).
*
* Revision 1.15 1999/05/27 13:38:51 malthoff
* Pervent from Division by zero errors.
*
* Revision 1.14 1999/05/20 09:20:01 cgoos
* Changes for 1000Base-T (Fan sensors).
*
* Revision 1.13 1998/10/22 09:48:14 gklug
* fix: SysKonnectFileId typo
*
* Revision 1.12 1998/10/09 06:12:06 malthoff
* Remove ID_sccs by SysKonnectFileId.
*
* Revision 1.11 1998/09/04 08:33:48 malthoff
* bug fix: SenState = SK_SEN_IDLE when
* leaving SK_SEN_VALEXT state
*
* Revision 1.10 1998/08/20 12:02:10 gklug
* fix: compiler warnings type mismatch
*
* Revision 1.9 1998/08/20 11:37:38 gklug
* chg: change Ioc to IoC
*
* Revision 1.8 1998/08/19 12:20:58 gklug
* fix: remove struct from C files (see CCC)
*
* Revision 1.7 1998/08/17 07:04:57 malthoff
* Take SkLm80RcvReg() function from ski2c.c.
* Add IoC parameter to BREAK_OR_WAIT() macro.
*
* Revision 1.6 1998/08/14 07:11:28 malthoff
* remove pAc with pAC.
*
* Revision 1.5 1998/08/14 06:46:55 gklug
* fix: temperature can get negative
*
* Revision 1.4 1998/08/13 08:27:04 gklug
* add: temperature reading now o.k.
* fix: pSen declaration, SK_ERR_LOG call, ADDR macro
*
* Revision 1.3 1998/08/13 07:28:21 gklug
* fix: pSen was wrong initialized
* add: correct conversion for voltage readings
*
* Revision 1.2 1998/08/11 07:52:14 gklug
* add: Lm80 read sensor function
*
* Revision 1.1 1998/07/17 09:57:12 gklug
* initial version
*
*
*
******************************************************************************/
/*
LM80 functions
*/
static const char SysKonnectFileId[] =
"$Id: sklm80.c,v 1.20 2002/08/13 09:16:27 rschmidt Exp $" ;
#include "h/skdrv1st.h" /* Driver Specific Definitions */
#include "h/lm80.h"
#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */
#ifdef SK_DIAG
#define BREAK_OR_WAIT(pAC,IoC,Event) SkI2cWait(pAC,IoC,Event)
#else /* nSK_DIAG */
#define BREAK_OR_WAIT(pAC,IoC,Event) break
#endif /* nSK_DIAG */
#ifdef SK_DIAG
/*
* read the register 'Reg' from the device 'Dev'
*
* return read error -1
* success the read value
*/
int SkLm80RcvReg(
SK_IOC IoC, /* Adapter Context */
int Dev, /* I2C device address */
int Reg) /* register to read */
{
int Val = 0;
int TempExt;
/* Signal device number */
if (SkI2cSndDev(IoC, Dev, I2C_WRITE)) {
return(-1);
}
if (SkI2cSndByte(IoC, Reg)) {
return(-1);
}
/* repeat start */
if (SkI2cSndDev(IoC, Dev, I2C_READ)) {
return(-1);
}
switch (Reg) {
case LM80_TEMP_IN:
Val = (int)SkI2cRcvByte(IoC, 1);
/* First: correct the value: it might be negative */
if ((Val & 0x80) != 0) {
/* Value is negative */
Val = Val - 256;
}
Val = Val * SK_LM80_TEMP_LSB;
SkI2cStop(IoC);
TempExt = (int)SkLm80RcvReg(IoC, LM80_ADDR, LM80_TEMP_CTRL);
if (Val > 0) {
Val += ((TempExt >> 7) * SK_LM80_TEMPEXT_LSB);
}
else {
Val -= ((TempExt >> 7) * SK_LM80_TEMPEXT_LSB);
}
return(Val);
break;
case LM80_VT0_IN:
case LM80_VT1_IN:
case LM80_VT2_IN:
case LM80_VT3_IN:
Val = (int)SkI2cRcvByte(IoC, 1) * SK_LM80_VT_LSB;
break;
default:
Val = (int)SkI2cRcvByte(IoC, 1);
break;
}
SkI2cStop(IoC);
return(Val);
}
#endif /* SK_DIAG */
/*
* read a sensors value (LM80 specific)
*
* This function reads a sensors value from the I2C sensor chip LM80.
* The sensor is defined by its index into the sensors database in the struct
* pAC points to.
*
* Returns 1 if the read is completed
* 0 if the read must be continued (I2C Bus still allocated)
*/
int SkLm80ReadSensor(
SK_AC *pAC, /* Adapter Context */
SK_IOC IoC, /* I/O Context needed in level 1 and 2 */
SK_SENSOR *pSen) /* Sensor to be read */
{
SK_I32 Value;
switch (pSen->SenState) {
case SK_SEN_IDLE:
/* Send address to ADDR register */
SK_I2C_CTL(IoC, I2C_READ, pSen->SenDev, pSen->SenReg, 0);
pSen->SenState = SK_SEN_VALUE ;
BREAK_OR_WAIT(pAC, IoC, I2C_READ);
case SK_SEN_VALUE:
/* Read value from data register */
SK_IN32(IoC, B2_I2C_DATA, ((SK_U32 *)&Value));
Value &= 0xff; /* only least significant byte is valid */
/* Do NOT check the Value against the thresholds */
/* Checking is done in the calling instance */
if (pSen->SenType == SK_SEN_VOLT) {
/* Voltage sensor */
pSen->SenValue = Value * SK_LM80_VT_LSB;
pSen->SenState = SK_SEN_IDLE ;
return(1);
}
if (pSen->SenType == SK_SEN_FAN) {
if (Value != 0 && Value != 0xff) {
/* Fan speed counter */
pSen->SenValue = SK_LM80_FAN_FAKTOR/Value;
}
else {
/* Indicate Fan error */
pSen->SenValue = 0;
}
pSen->SenState = SK_SEN_IDLE ;
return(1);
}
/* First: correct the value: it might be negative */
if ((Value & 0x80) != 0) {
/* Value is negative */
Value = Value - 256;
}
/* We have a temperature sensor and need to get the signed extension.
* For now we get the extension from the last reading, so in the normal
* case we won't see flickering temperatures.
*/
pSen->SenValue = (Value * SK_LM80_TEMP_LSB) +
(pSen->SenValue % SK_LM80_TEMP_LSB);
/* Send address to ADDR register */
SK_I2C_CTL(IoC, I2C_READ, pSen->SenDev, LM80_TEMP_CTRL, 0);
pSen->SenState = SK_SEN_VALEXT ;
BREAK_OR_WAIT(pAC, IoC, I2C_READ);
case SK_SEN_VALEXT:
/* Read value from data register */
SK_IN32(IoC, B2_I2C_DATA, ((SK_U32 *)&Value));
Value &= LM80_TEMP_LSB_9; /* only bit 7 is valid */
/* cut the LSB bit */
pSen->SenValue = ((pSen->SenValue / SK_LM80_TEMP_LSB) *
SK_LM80_TEMP_LSB);
if (pSen->SenValue < 0) {
/* Value negative: The bit value must be subtracted */
pSen->SenValue -= ((Value >> 7) * SK_LM80_TEMPEXT_LSB);
}
else {
/* Value positive: The bit value must be added */
pSen->SenValue += ((Value >> 7) * SK_LM80_TEMPEXT_LSB);
}
pSen->SenState = SK_SEN_IDLE ;
return(1);
default:
SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E007, SKERR_I2C_E007MSG);
return(1);
}
/* Not completed */
return(0);
}

@ -0,0 +1,515 @@
/******************************************************************************
*
* Name: skproc.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.4 $
* Date: $Date: 2003/02/25 14:16:37 $
* Purpose: Funktions to display statictic data
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2003 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Created 22-Nov-2000
* Author: Mirko Lindner (mlindner@syskonnect.de)
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: skproc.c,v $
* Revision 1.4 2003/02/25 14:16:37 mlindner
* Fix: Copyright statement
*
* Revision 1.3 2002/10/02 12:59:51 mlindner
* Add: Support for Yukon
* Add: Speed check and setup
* Add: Merge source for kernel 2.2.x and 2.4.x
* Add: Read sensor names directly from VPD
* Fix: Volt values
*
* Revision 1.2.2.7 2002/01/14 12:45:15 mlindner
* Fix: Editorial changes
*
* Revision 1.2.2.6 2001/12/06 15:26:07 mlindner
* Fix: Return value of proc_read
*
* Revision 1.2.2.5 2001/12/06 09:57:39 mlindner
* New ProcFs entries
*
* Revision 1.2.2.4 2001/09/05 12:16:02 mlindner
* Add: New ProcFs entries
* Fix: Counter Errors (Jumbo == to long errors)
* Fix: Kernel error compilation
* Fix: too short counters
*
* Revision 1.2.2.3 2001/06/25 07:26:26 mlindner
* Add: More error messages
*
* Revision 1.2.2.2 2001/03/15 12:50:13 mlindner
* fix: ProcFS owner protection
*
* Revision 1.2.2.1 2001/03/12 16:43:48 mlindner
* chg: 2.4 requirements for procfs
*
* Revision 1.1 2001/01/22 14:15:31 mlindner
* added ProcFs functionality
* Dual Net functionality integrated
* Rlmt networks added
*
*
******************************************************************************/
#include <linux/proc_fs.h>
#include "h/skdrv1st.h"
#include "h/skdrv2nd.h"
#define ZEROPAD 1 /* pad with zero */
#define SIGN 2 /* unsigned/signed long */
#define PLUS 4 /* show plus */
#define SPACE 8 /* space if plus */
#define LEFT 16 /* left justified */
#define SPECIALX 32 /* 0x */
#define LARGE 64
extern SK_AC *pACList;
extern struct net_device *SkGeRootDev;
extern char * SkNumber(
char * str,
long long num,
int base,
int size,
int precision,
int type);
/*****************************************************************************
*
* proc_read - print "summaries" entry
*
* Description:
* This function fills the proc entry with statistic data about
* the ethernet device.
*
*
* Returns: buffer with statistic data
*
*/
int proc_read(char *buffer,
char **buffer_location,
off_t offset,
int buffer_length,
int *eof,
void *data)
{
int len = 0;
int t;
int i;
DEV_NET *pNet;
SK_AC *pAC;
char test_buf[100];
char sens_msg[50];
unsigned long Flags;
unsigned int Size;
struct SK_NET_DEVICE *next;
struct SK_NET_DEVICE *SkgeProcDev = SkGeRootDev;
SK_PNMI_STRUCT_DATA *pPnmiStruct;
SK_PNMI_STAT *pPnmiStat;
struct proc_dir_entry *file = (struct proc_dir_entry*) data;
while (SkgeProcDev) {
pNet = (DEV_NET*) SkgeProcDev->priv;
pAC = pNet->pAC;
next = pAC->Next;
pPnmiStruct = &pAC->PnmiStruct;
/* NetIndex in GetStruct is now required, zero is only dummy */
for (t=pAC->GIni.GIMacsFound; t > 0; t--) {
if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 1)
t--;
spin_lock_irqsave(&pAC->SlowPathLock, Flags);
Size = SK_PNMI_STRUCT_SIZE;
SkPnmiGetStruct(pAC, pAC->IoBase,
pPnmiStruct, &Size, t-1);
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
if (strcmp(pAC->dev[t-1]->name, file->name) == 0) {
pPnmiStat = &pPnmiStruct->Stat[0];
len = sprintf(buffer,
"\nDetailed statistic for device %s\n",
pAC->dev[t-1]->name);
len += sprintf(buffer + len,
"=======================================\n");
/* Board statistics */
len += sprintf(buffer + len,
"\nBoard statistics\n\n");
len += sprintf(buffer + len,
"Active Port %c\n",
'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
Net[t-1].PrefPort]->PortNumber);
len += sprintf(buffer + len,
"Preferred Port %c\n",
'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
Net[t-1].PrefPort]->PortNumber);
len += sprintf(buffer + len,
"Bus speed (MHz) %d\n",
pPnmiStruct->BusSpeed);
len += sprintf(buffer + len,
"Bus width (Bit) %d\n",
pPnmiStruct->BusWidth);
len += sprintf(buffer + len,
"Hardware revision v%d.%d\n",
(pAC->GIni.GIPciHwRev >> 4) & 0x0F,
pAC->GIni.GIPciHwRev & 0x0F);
/* Print sensor informations */
for (i=0; i < pAC->I2c.MaxSens; i ++) {
/* Check type */
switch (pAC->I2c.SenTable[i].SenType) {
case 1:
strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
strcat(sens_msg, " (C)");
len += sprintf(buffer + len,
"%-25s %d.%02d\n",
sens_msg,
pAC->I2c.SenTable[i].SenValue / 10,
pAC->I2c.SenTable[i].SenValue % 10);
strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
strcat(sens_msg, " (F)");
len += sprintf(buffer + len,
"%-25s %d.%02d\n",
sens_msg,
((((pAC->I2c.SenTable[i].SenValue)
*10)*9)/5 + 3200)/100,
((((pAC->I2c.SenTable[i].SenValue)
*10)*9)/5 + 3200) % 10);
break;
case 2:
strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
strcat(sens_msg, " (V)");
len += sprintf(buffer + len,
"%-25s %d.%03d\n",
sens_msg,
pAC->I2c.SenTable[i].SenValue / 1000,
pAC->I2c.SenTable[i].SenValue % 1000);
break;
case 3:
strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
strcat(sens_msg, " (rpm)");
len += sprintf(buffer + len,
"%-25s %d\n",
sens_msg,
pAC->I2c.SenTable[i].SenValue);
break;
default:
break;
}
}
/*Receive statistics */
len += sprintf(buffer + len,
"\nReceive statistics\n\n");
len += sprintf(buffer + len,
"Received bytes %s\n",
SkNumber(test_buf, pPnmiStat->StatRxOctetsOkCts,
10,0,-1,0));
len += sprintf(buffer + len,
"Received packets %s\n",
SkNumber(test_buf, pPnmiStat->StatRxOkCts,
10,0,-1,0));
#if 0
if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC &&
pAC->HWRevision < 12) {
pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
pPnmiStat->StatRxShortsCts;
pPnmiStat->StatRxShortsCts = 0;
}
#endif
if (pNet->Mtu > 1500)
pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
pPnmiStat->StatRxTooLongCts;
len += sprintf(buffer + len,
"Receive errors %s\n",
SkNumber(test_buf, pPnmiStruct->InErrorsCts,
10,0,-1,0));
len += sprintf(buffer + len,
"Receive drops %s\n",
SkNumber(test_buf, pPnmiStruct->RxNoBufCts,
10,0,-1,0));
len += sprintf(buffer + len,
"Received multicast %s\n",
SkNumber(test_buf, pPnmiStat->StatRxMulticastOkCts,
10,0,-1,0));
len += sprintf(buffer + len,
"Receive error types\n");
len += sprintf(buffer + len,
" length %s\n",
SkNumber(test_buf, pPnmiStat->StatRxRuntCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
" buffer overflow %s\n",
SkNumber(test_buf, pPnmiStat->StatRxFifoOverflowCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
" bad crc %s\n",
SkNumber(test_buf, pPnmiStat->StatRxFcsCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
" framing %s\n",
SkNumber(test_buf, pPnmiStat->StatRxFramingCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
" missed frames %s\n",
SkNumber(test_buf, pPnmiStat->StatRxMissedCts,
10, 0, -1, 0));
if (pNet->Mtu > 1500)
pPnmiStat->StatRxTooLongCts = 0;
len += sprintf(buffer + len,
" too long %s\n",
SkNumber(test_buf, pPnmiStat->StatRxTooLongCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
" carrier extension %s\n",
SkNumber(test_buf, pPnmiStat->StatRxCextCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
" too short %s\n",
SkNumber(test_buf, pPnmiStat->StatRxShortsCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
" symbol %s\n",
SkNumber(test_buf, pPnmiStat->StatRxSymbolCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
" LLC MAC size %s\n",
SkNumber(test_buf, pPnmiStat->StatRxIRLengthCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
" carrier event %s\n",
SkNumber(test_buf, pPnmiStat->StatRxCarrierCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
" jabber %s\n",
SkNumber(test_buf, pPnmiStat->StatRxJabberCts,
10, 0, -1, 0));
/*Transmit statistics */
len += sprintf(buffer + len,
"\nTransmit statistics\n\n");
len += sprintf(buffer + len,
"Transmited bytes %s\n",
SkNumber(test_buf, pPnmiStat->StatTxOctetsOkCts,
10,0,-1,0));
len += sprintf(buffer + len,
"Transmited packets %s\n",
SkNumber(test_buf, pPnmiStat->StatTxOkCts,
10,0,-1,0));
len += sprintf(buffer + len,
"Transmit errors %s\n",
SkNumber(test_buf, pPnmiStat->StatTxSingleCollisionCts,
10,0,-1,0));
len += sprintf(buffer + len,
"Transmit dropped %s\n",
SkNumber(test_buf, pPnmiStruct->TxNoBufCts,
10,0,-1,0));
len += sprintf(buffer + len,
"Transmit collisions %s\n",
SkNumber(test_buf, pPnmiStat->StatTxSingleCollisionCts,
10,0,-1,0));
len += sprintf(buffer + len,
"Transmit errors types\n");
len += sprintf(buffer + len,
" excessive collision %ld\n",
pAC->stats.tx_aborted_errors);
len += sprintf(buffer + len,
" carrier %s\n",
SkNumber(test_buf, pPnmiStat->StatTxCarrierCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
" fifo underrun %s\n",
SkNumber(test_buf, pPnmiStat->StatTxFifoUnderrunCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
" heartbeat %s\n",
SkNumber(test_buf, pPnmiStat->StatTxCarrierCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
" window %ld\n",
pAC->stats.tx_window_errors);
}
}
SkgeProcDev = next;
}
if (offset >= len) {
*eof = 1;
return 0;
}
*buffer_location = buffer + offset;
if (buffer_length >= len - offset) {
*eof = 1;
}
return (min_t(int, buffer_length, len - offset));
}
/*****************************************************************************
*
* SkDoDiv - convert 64bit number
*
* Description:
* This function "converts" a long long number.
*
* Returns:
* remainder of division
*/
static long SkDoDiv (long long Dividend, int Divisor, long long *pErg)
{
long Rest;
long long Ergebnis;
long Akku;
Akku = Dividend >> 32;
Ergebnis = ((long long) (Akku / Divisor)) << 32;
Rest = Akku % Divisor ;
Akku = Rest << 16;
Akku |= ((Dividend & 0xFFFF0000) >> 16);
Ergebnis += ((long long) (Akku / Divisor)) << 16;
Rest = Akku % Divisor ;
Akku = Rest << 16;
Akku |= (Dividend & 0xFFFF);
Ergebnis += (Akku / Divisor);
Rest = Akku % Divisor ;
*pErg = Ergebnis;
return (Rest);
}
#if 0
#define do_div(n,base) ({ \
long long __res; \
__res = ((unsigned long long) n) % (unsigned) base; \
n = ((unsigned long long) n) / (unsigned) base; \
__res; })
#endif
/*****************************************************************************
*
* SkNumber - Print results
*
* Description:
* This function converts a long long number into a string.
*
* Returns:
* number as string
*/
char * SkNumber(char * str, long long num, int base, int size, int precision
,int type)
{
char c,sign,tmp[66], *strorg = str;
const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
int i;
if (type & LARGE)
digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (type & LEFT)
type &= ~ZEROPAD;
if (base < 2 || base > 36)
return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size--;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if (type & SPECIALX) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++]='0';
else while (num != 0)
tmp[i++] = digits[SkDoDiv(num,base, &num)];
if (i > precision)
precision = i;
size -= precision;
if (!(type&(ZEROPAD+LEFT)))
while(size-->0)
*str++ = ' ';
if (sign)
*str++ = sign;
if (type & SPECIALX) {
if (base==8)
*str++ = '0';
else if (base==16) {
*str++ = '0';
*str++ = digits[33];
}
}
if (!(type & LEFT))
while (size-- > 0)
*str++ = c;
while (i < precision--)
*str++ = '0';
while (i-- > 0)
*str++ = tmp[i];
while (size-- > 0)
*str++ = ' ';
str[0] = '\0';
return strorg;
}

@ -0,0 +1,236 @@
/******************************************************************************
*
* Name: skqueue.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.18 $
* Date: $Date: 2002/05/07 14:11:11 $
* Purpose: Management of an event queue.
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998,1999 SysKonnect,
* a business unit of Schneider & Koch & Co. Datensysteme GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: skqueue.c,v $
* Revision 1.18 2002/05/07 14:11:11 rwahl
* Fixed Watcom Precompiler error.
*
* Revision 1.17 2002/03/25 10:06:41 mkunz
* SkIgnoreEvent deleted
*
* Revision 1.16 2002/03/15 10:51:59 mkunz
* Added event classes for link aggregation
*
* Revision 1.15 1999/11/22 13:36:29 cgoos
* Changed license header to GPL.
*
* Revision 1.14 1998/10/15 15:11:35 gklug
* fix: ID_sccs to SysKonnectFileId
*
* Revision 1.13 1998/09/08 08:47:52 gklug
* add: init level handling
*
* Revision 1.12 1998/09/08 07:43:20 gklug
* fix: Sirq Event function name
*
* Revision 1.11 1998/09/08 05:54:34 gklug
* chg: define SK_CSUM is replaced by SK_USE_CSUM
*
* Revision 1.10 1998/09/03 14:14:49 gklug
* add: CSUM and HWAC Eventclass and function.
*
* Revision 1.9 1998/08/19 09:50:50 gklug
* fix: remove struct keyword from c-code (see CCC) add typedefs
*
* Revision 1.8 1998/08/17 13:43:11 gklug
* chg: Parameter will be union of 64bit para, 2 times SK_U32 or SK_PTR
*
* Revision 1.7 1998/08/14 07:09:11 gklug
* fix: chg pAc -> pAC
*
* Revision 1.6 1998/08/11 12:13:14 gklug
* add: return code feature of Event service routines
* add: correct Error log calls
*
* Revision 1.5 1998/08/07 12:53:45 gklug
* fix: first compiled version
*
* Revision 1.4 1998/08/07 09:20:48 gklug
* adapt functions to C coding conventions.
*
* Revision 1.3 1998/08/05 11:29:32 gklug
* rmv: Timer event entry. Timer will queue event directly
*
* Revision 1.2 1998/07/31 11:22:40 gklug
* Initial version
*
* Revision 1.1 1998/07/30 15:14:01 gklug
* Initial version. Adapted from SMT
*
*
*
******************************************************************************/
/*
Event queue and dispatcher
*/
static const char SysKonnectFileId[] =
"$Header: /usr56/projects/ge/schedule/skqueue.c,v 1.18 2002/05/07 14:11:11 rwahl Exp $" ;
#include "h/skdrv1st.h" /* Driver Specific Definitions */
#include "h/skqueue.h" /* Queue Definitions */
#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */
#ifdef __C2MAN__
/*
Event queue management.
General Description:
*/
intro()
{}
#endif
#define PRINTF(a,b,c)
/*
* init event queue management
*
* Must be called during init level 0.
*/
void SkEventInit(
SK_AC *pAC, /* Adapter context */
SK_IOC Ioc, /* IO context */
int Level) /* Init level */
{
switch (Level) {
case SK_INIT_DATA:
pAC->Event.EvPut = pAC->Event.EvGet = pAC->Event.EvQueue ;
break;
default:
break;
}
}
/*
* add event to queue
*/
void SkEventQueue(
SK_AC *pAC, /* Adapters context */
SK_U32 Class, /* Event Class */
SK_U32 Event, /* Event to be queued */
SK_EVPARA Para) /* Event parameter */
{
pAC->Event.EvPut->Class = Class ;
pAC->Event.EvPut->Event = Event ;
pAC->Event.EvPut->Para = Para ;
if (++pAC->Event.EvPut == &pAC->Event.EvQueue[SK_MAX_EVENT])
pAC->Event.EvPut = pAC->Event.EvQueue ;
if (pAC->Event.EvPut == pAC->Event.EvGet) {
SK_ERR_LOG(pAC, SK_ERRCL_NORES, SKERR_Q_E001, SKERR_Q_E001MSG) ;
}
}
/*
* event dispatcher
* while event queue is not empty
* get event from queue
* send command to state machine
* end
* return error reported by individual Event function
* 0 if no error occured.
*/
int SkEventDispatcher(
SK_AC *pAC, /* Adapters Context */
SK_IOC Ioc) /* Io context */
{
SK_EVENTELEM *pEv ; /* pointer into queue */
SK_U32 Class ;
int Rtv ;
pEv = pAC->Event.EvGet ;
PRINTF("dispatch get %x put %x\n",pEv,pAC->Event.ev_put) ;
while (pEv != pAC->Event.EvPut) {
PRINTF("dispatch Class %d Event %d\n",pEv->Class,pEv->Event) ;
switch(Class = pEv->Class) {
#ifndef SK_USE_LAC_EV
case SKGE_RLMT : /* RLMT Event */
Rtv = SkRlmtEvent(pAC,Ioc,pEv->Event,pEv->Para);
break ;
case SKGE_I2C : /* I2C Event */
Rtv = SkI2cEvent(pAC,Ioc,pEv->Event,pEv->Para);
break ;
case SKGE_PNMI :
Rtv = SkPnmiEvent(pAC,Ioc,pEv->Event,pEv->Para);
break ;
#endif /* SK_USE_LAC_EV */
case SKGE_DRV : /* Driver Event */
Rtv = SkDrvEvent(pAC,Ioc,pEv->Event,pEv->Para);
break ;
#ifndef SK_USE_SW_TIMER
case SKGE_HWAC :
Rtv = SkGeSirqEvent(pAC,Ioc,pEv->Event,pEv->Para);
break ;
#else /* !SK_USE_SW_TIMER */
case SKGE_SWT :
Rtv = SkSwtEvent(pAC,Ioc,pEv->Event,pEv->Para);
break ;
#endif /* !SK_USE_SW_TIMER */
#ifdef SK_USE_LAC_EV
case SKGE_LACP :
Rtv = SkLacpEvent(pAC,Ioc,pEv->Event,pEv->Para);
break ;
case SKGE_RSF :
Rtv = SkRsfEvent(pAC,Ioc,pEv->Event,pEv->Para);
break ;
case SKGE_MARKER :
Rtv = SkMarkerEvent(pAC,Ioc,pEv->Event,pEv->Para);
break ;
case SKGE_FD :
Rtv = SkFdEvent(pAC,Ioc,pEv->Event,pEv->Para);
break ;
#endif /* SK_USE_LAC_EV */
#ifdef SK_USE_CSUM
case SKGE_CSUM :
Rtv = SkCsEvent(pAC,Ioc,pEv->Event,pEv->Para);
break ;
#endif /* SK_USE_CSUM */
default :
SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_Q_E002,
SKERR_Q_E002MSG) ;
Rtv = 0;
}
if (Rtv != 0) {
return(Rtv) ;
}
if (++pEv == &pAC->Event.EvQueue[SK_MAX_EVENT])
pEv = pAC->Event.EvQueue ;
/* Renew get: it is used in queue_events to detect overruns */
pAC->Event.EvGet = pEv;
}
return(0) ;
}
/* End of file */

File diff suppressed because it is too large Load Diff

@ -0,0 +1,291 @@
/******************************************************************************
*
* Name: sktimer.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.12 $
* Date: $Date: 1999/11/22 13:38:51 $
* Purpose: High level timer functions.
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998,1999 SysKonnect,
* a business unit of Schneider & Koch & Co. Datensysteme GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* History:
*
* $Log: sktimer.c,v $
* Revision 1.12 1999/11/22 13:38:51 cgoos
* Changed license header to GPL.
*
* Revision 1.11 1998/12/17 13:24:13 gklug
* fix: restart problem: do NOT destroy timer queue if init 1 is done
*
* Revision 1.10 1998/10/15 15:11:36 gklug
* fix: ID_sccs to SysKonnectFileId
*
* Revision 1.9 1998/09/15 15:15:04 cgoos
* Changed TRUE/FALSE to SK_TRUE/SK_FALSE
*
* Revision 1.8 1998/09/08 08:47:55 gklug
* add: init level handling
*
* Revision 1.7 1998/08/19 09:50:53 gklug
* fix: remove struct keyword from c-code (see CCC) add typedefs
*
* Revision 1.6 1998/08/17 13:43:13 gklug
* chg: Parameter will be union of 64bit para, 2 times SK_U32 or SK_PTR
*
* Revision 1.5 1998/08/14 07:09:14 gklug
* fix: chg pAc -> pAC
*
* Revision 1.4 1998/08/07 12:53:46 gklug
* fix: first compiled version
*
* Revision 1.3 1998/08/07 09:31:53 gklug
* fix: delta spelling
*
* Revision 1.2 1998/08/07 09:31:02 gklug
* adapt functions to new c coding conventions
* rmv: "fast" handling
* chg: inserting of new timer in queue.
* chg: event queue generation when timer runs out
*
* Revision 1.1 1998/08/05 11:27:55 gklug
* first version: adapted from SMT
*
*
*
*
******************************************************************************/
/*
Event queue and dispatcher
*/
static const char SysKonnectFileId[] =
"$Header: /usr56/projects/ge/schedule/sktimer.c,v 1.12 1999/11/22 13:38:51 cgoos Exp $" ;
#include "h/skdrv1st.h" /* Driver Specific Definitions */
#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */
#ifdef __C2MAN__
/*
Event queue management.
General Description:
*/
intro()
{}
#endif
/* Forward declaration */
static void timer_done(SK_AC *pAC,SK_IOC Ioc,int Restart);
/*
* Inits the software timer
*
* needs to be called during Init level 1.
*/
void SkTimerInit(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc, /* IoContext */
int Level) /* Init Level */
{
switch (Level) {
case SK_INIT_DATA:
pAC->Tim.StQueue = 0 ;
break;
case SK_INIT_IO:
SkHwtInit(pAC,Ioc) ;
SkTimerDone(pAC, Ioc);
break;
default:
break;
}
}
/*
* Stops a high level timer
* - If a timer is not in the queue the function returns normally, too.
*/
void SkTimerStop(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc, /* IoContext */
SK_TIMER *pTimer) /* Timer Pointer to be started */
{
SK_TIMER **ppTimPrev ;
SK_TIMER *pTm ;
/*
* remove timer from queue
*/
pTimer->TmActive = SK_FALSE ;
if (pAC->Tim.StQueue == pTimer && !pTimer->TmNext) {
SkHwtStop(pAC,Ioc) ;
}
for (ppTimPrev = &pAC->Tim.StQueue ; (pTm = *ppTimPrev) ;
ppTimPrev = &pTm->TmNext ) {
if (pTm == pTimer) {
/*
* Timer found in queue
* - dequeue it and
* - correct delta of the next timer
*/
*ppTimPrev = pTm->TmNext ;
if (pTm->TmNext) {
/* correct delta of next timer in queue */
pTm->TmNext->TmDelta += pTm->TmDelta ;
}
return ;
}
}
}
/*
* Start a high level software timer
*/
void SkTimerStart(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc, /* IoContext */
SK_TIMER *pTimer, /* Timer Pointer to be started */
SK_U32 Time, /* Time value */
SK_U32 Class, /* Event Class for this timer */
SK_U32 Event, /* Event Value for this timer */
SK_EVPARA Para) /* Event Parameter for this timer */
{
SK_TIMER **ppTimPrev ;
SK_TIMER *pTm ;
SK_U32 Delta ;
Time /= 16 ; /* input is uS, clock ticks are 16uS */
if (!Time)
Time = 1 ;
SkTimerStop(pAC,Ioc,pTimer) ;
pTimer->TmClass = Class ;
pTimer->TmEvent = Event ;
pTimer->TmPara = Para ;
pTimer->TmActive = SK_TRUE ;
if (!pAC->Tim.StQueue) {
/* First Timer to be started */
pAC->Tim.StQueue = pTimer ;
pTimer->TmNext = 0 ;
pTimer->TmDelta = Time ;
SkHwtStart(pAC,Ioc,Time) ;
return ;
}
/*
* timer correction
*/
timer_done(pAC,Ioc,0) ;
/*
* find position in queue
*/
Delta = 0 ;
for (ppTimPrev = &pAC->Tim.StQueue ; (pTm = *ppTimPrev) ;
ppTimPrev = &pTm->TmNext ) {
if (Delta + pTm->TmDelta > Time) {
/* Position found */
/* Here the timer needs to be inserted. */
break ;
}
Delta += pTm->TmDelta ;
}
/* insert in queue */
*ppTimPrev = pTimer ;
pTimer->TmNext = pTm ;
pTimer->TmDelta = Time - Delta ;
if (pTm) {
/* There is a next timer
* -> correct its Delta value.
*/
pTm->TmDelta -= pTimer->TmDelta ;
}
/*
* start new with first
*/
SkHwtStart(pAC,Ioc,pAC->Tim.StQueue->TmDelta) ;
}
void SkTimerDone(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc) /* IoContext */
{
timer_done(pAC,Ioc,1) ;
}
static void timer_done(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc, /* IoContext */
int Restart) /* Do we need to restart the Hardware timer ? */
{
SK_U32 Delta ;
SK_TIMER *pTm ;
SK_TIMER *pTComp ; /* Timer completed now now */
SK_TIMER **ppLast ; /* Next field of Last timer to be deq */
int Done = 0 ;
Delta = SkHwtRead(pAC,Ioc) ;
ppLast = &pAC->Tim.StQueue ;
pTm = pAC->Tim.StQueue ;
while (pTm && !Done) {
if (Delta >= pTm->TmDelta) {
/* Timer ran out */
pTm->TmActive = SK_FALSE ;
Delta -= pTm->TmDelta ;
ppLast = &pTm->TmNext ;
pTm = pTm->TmNext ;
} else {
/* We found the first timer that did not run out */
pTm->TmDelta -= Delta ;
Delta = 0 ;
Done = 1 ;
}
}
*ppLast = 0 ;
/*
* pTm points to the first Timer that did not run out.
* StQueue points to the first Timer that run out.
*/
for ( pTComp = pAC->Tim.StQueue ; pTComp ; pTComp = pTComp->TmNext) {
SkEventQueue(pAC,pTComp->TmClass, pTComp->TmEvent,
pTComp->TmPara) ;
}
/* Set head of timer queue to the first timer that did not run out */
pAC->Tim.StQueue = pTm ;
if (Restart && pAC->Tim.StQueue) {
/* Restart HW timer */
SkHwtStart(pAC,Ioc,pAC->Tim.StQueue->TmDelta) ;
}
}
/* End of file */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,98 @@
/*
* (C) Copyright 2003
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef _UBOOT_COMPAT_H__
#define _UBOOT_COMPAT_H__
#include <pci.h>
#include <pci_ids.h>
#include <common.h>
#include <malloc.h>
#include <net.h>
#define __initdata
#define __init
#define __exit
#define netif_stop_queue(x)
#define netif_wake_queue(x)
#define netif_running(x) 0
#define unregister_netdev(x)
#define remove_proc_entry(x,y)
#define dev_addr enetaddr
#define spin_lock_irqsave(x,y) y = 0;
#define spin_lock_init(x)
#define spin_lock(x)
#define spin_unlock_irqrestore(x,y)
#define spin_unlock(x)
#define ENODEV 1
#define EAGAIN 2
#define EBUSY 3
#define HZ CFG_HZ
#define printk printf
#define KERN_ERR
#define KERN_WARNING
#define KERN_INFO
#define MOD_INC_USE_COUNT
#define MOD_DEC_USE_COUNT
#define kmalloc(x,y) malloc(x)
#define kfree(x) free(x)
#define GFP_ATOMIC 0
#define pci_alloc_consistent(x,y,z) (void *)(*(dma_addr_t *)(z) = (dma_addr_t)malloc(y))
#define pci_free_consistent(x,y,z,d) free(z)
#define pci_dma_sync_single(x,y,z,d)
#define pci_unmap_page(x,y,z,d)
#define pci_unmap_single(x,y,z,d)
#define pci_present() 1
struct sk_buff
{
u8 * data;
u32 len;
u8 * data_unaligned;
};
struct sk_buff * alloc_skb(u32 size, int dummy);
void dev_kfree_skb_any(struct sk_buff *skb);
void skb_reserve(struct sk_buff *skb, unsigned int len);
void skb_put(struct sk_buff *skb, unsigned int len);
#define dev_kfree_skb dev_kfree_skb_any
#define dev_kfree_skb_irq dev_kfree_skb_any
#define eth_copy_and_sum(dest,src,len,base) memcpy(dest->data,src,len);
#endif /* _UBOOT_COMPAT_H__ */

@ -0,0 +1,143 @@
/*
* Driver for SysKonnect Gigabit Ethernet Server Adapters.
*
* (C) Copyright 2003
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <common.h>
#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) && \
defined(CONFIG_SK98)
#include "h/skdrv1st.h"
#include "h/skdrv2nd.h"
#include "u-boot_compat.h"
#define SKGE_MAX_CARDS 2
extern int skge_probe(struct eth_device **);
extern void SkGeIsr(int irq, void *dev_id, struct pt_regs *ptregs);
extern void SkGeIsrOnePort(int irq, void *dev_id, struct pt_regs *ptregs);
extern int SkGeOpen(struct eth_device *);
extern int SkGeClose(struct eth_device *);
extern int SkGeXmit(struct sk_buff *skb, struct eth_device *dev);
extern void ReceiveIrq(SK_AC *pAC, RX_PORT *pRxPort, SK_BOOL SlowPathLock);
static int skge_init(struct eth_device *dev, bd_t * bis);
static int skge_send(struct eth_device *dev, volatile void *packet, int length);
static int skge_recv(struct eth_device *dev);
static void skge_halt(struct eth_device *dev);
int skge_initialize(bd_t * bis)
{
int numdev, i;
struct eth_device *dev[SKGE_MAX_CARDS];
numdev = skge_probe(&dev[0]);
if (numdev > SKGE_MAX_CARDS)
{
printf("ERROR: numdev > SKGE_MAX_CARDS\n");
}
for (i = 0; i < numdev; i++)
{
sprintf (dev[i]->name, "SK98#%d", i);
dev[i]->init = skge_init;
dev[i]->halt = skge_halt;
dev[i]->send = skge_send;
dev[i]->recv = skge_recv;
eth_register(dev[i]);
}
return numdev;
}
static int skge_init(struct eth_device *dev, bd_t * bis)
{
int ret;
SK_AC * pAC = ((DEV_NET*)dev->priv)->pAC;
int i;
ret = SkGeOpen(dev);
while (pAC->Rlmt.Port[0].PortState != SK_RLMT_PS_GOING_UP)
{
SkGeIsrOnePort (0, pAC->dev[0], 0);
}
for (i = 0; i < 100; i ++)
{
udelay(1000);
}
return ret;
}
static void skge_halt(struct eth_device *dev)
{
SkGeClose(dev);
}
static int skge_send(struct eth_device *dev, volatile void *packet,
int length)
{
int ret = -1;
struct sk_buff * skb = alloc_skb(length, 0);
if (! skb)
{
printf("skge_send: failed to alloc skb\n");
goto Done;
}
memcpy(skb->data, (void*)packet, length);
ret = SkGeXmit(skb, dev);
Done:
return ret;
}
static int skge_recv(struct eth_device *dev)
{
DEV_NET *pNet;
SK_AC *pAC;
int FromPort = 0;
pNet = (DEV_NET*) dev->priv;
pAC = pNet->pAC;
ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE);
return 0;
}
#endif /* CONFIG_SK98 */

@ -0,0 +1,116 @@
/*
* Definitions for the 'struct sk_buff' memory handlers in U-Boot.
*
* (C) Copyright 2003
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <common.h>
#include "u-boot_compat.h"
#define MAX_SKB 50
static struct sk_buff *sk_table[MAX_SKB];
struct sk_buff * alloc_skb(u32 size, int dummy)
{
int i;
struct sk_buff * ret = NULL;
for (i = 0; i < MAX_SKB; i++)
{
if (sk_table[i])
{
/* Already allocated.
*/
continue;
}
sk_table[i] = malloc(sizeof(struct sk_buff));
if (! sk_table[i])
{
printf("alloc_skb: malloc failed\n");
break;
}
memset(sk_table[i], 0, sizeof(struct sk_buff));
sk_table[i]->data = sk_table[i]->data_unaligned =
malloc(size + 16);
if (! sk_table[i]->data)
{
printf("alloc_skb: malloc failed\n");
free(sk_table[i]);
sk_table[i] = NULL;
break;
}
sk_table[i]->data += 16 - ((u32)sk_table[i]->data & 15);
sk_table[i]->len = size;
break;
}
if (i < MAX_SKB)
{
ret = sk_table[i];
}
if (! ret)
{
printf("Unable to allocate skb!\n");
}
return ret;
}
void dev_kfree_skb_any(struct sk_buff *skb)
{
int i;
for (i = 0; i < MAX_SKB; i++)
{
if (sk_table[i] != skb)
{
continue;
}
free(skb->data_unaligned);
free(skb);
sk_table[i] = NULL;
break;
}
if (i == MAX_SKB)
{
printf("SKB allocation error!\n");
}
}
void skb_reserve(struct sk_buff *skb, unsigned int len)
{
skb->data+=len;
}
void skb_put(struct sk_buff *skb, unsigned int len)
{
skb->len+=len;
}

@ -102,13 +102,20 @@
/*
* Flash configuration
*/
#define CFG_FLASH_16M 1
#if !defined(CFG_FLASH_16M) /* 8Mb chips support only */
#define CFG_FLASH_BASE 0xff800000
#define CFG_FLASH_SIZE 0x00800000
/*
* Flash organization
*/
#define CFG_MAX_FLASH_BANKS 1 /* max num of memory banks */
#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x740000)
#else
#define CFG_FLASH_BASE 0xff000000
#define CFG_FLASH_SIZE 0x01000000
#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x740000 + 0x800000)
#define CFG_MAX_FLASH_BANKS 2 /* max num of memory banks */
#endif
#define CFG_MAX_FLASH_SECT 128 /* max num of sects on one chip */
#define CFG_FLASH_ERASE_TOUT 240000 /* Flash Erase Timeout (in ms) */
@ -122,7 +129,6 @@
*/
#define CFG_ENV_IS_IN_FLASH 1
#define CFG_ENV_SIZE 0x10000
#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x740000)
#define CFG_ENV_SECT_SIZE 0x10000
#define CONFIG_ENV_OVERWRITE 1

@ -84,10 +84,10 @@
#undef CONFIG_BOOTARGS
#define CONFIG_BOOTCOMMAND \
"bootp && " \
"bootp;" \
"setenv bootargs root=/dev/nfs rw nfsroot=$serverip:$rootpath " \
"ip=$ipaddr:$serverip:$gatewayip:" \
"$netmask:$hostname:eth0:none; && " \
"$netmask:$hostname:eth0:none;" \
"bootm"
#define CONFIG_LOADS_ECHO 0 /* echo off for serial download */

@ -411,7 +411,7 @@
* SCCR - System Clock Control 9-8
*-----------------------------------------------------------------------
*/
#define CFG_SCCR (SCCR_DFBRG01)
#define CFG_SCCR (SCCR_DFBRG00)
/*-----------------------------------------------------------------------
* RCCR - RISC Controller Configuration 13-7

@ -51,7 +51,7 @@
#define CONFIG_BOOTDELAY 5
#define CONFIG_COMMANDS ( CONFIG_CMD_DFL & ~CFG_CMD_NET )
#define CONFIG_COMMANDS (CONFIG_CMD_DFL | CFG_CMD_PCI)
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
@ -265,4 +265,17 @@
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
#define BOOTFLAG_WARM 0x02 /* Software reboot */
/*-----------------------------------------------------------------------
* PCI stuff
*-----------------------------------------------------------------------
*/
#define CONFIG_PCI
#define CONFIG_PCI_PNP
#undef CONFIG_PCI_SCAN_SHOW
#define CONFIG_SK98
#define CONFIG_NET_MULTI
#endif /* __CONFIG_H */

@ -40,6 +40,15 @@
/* Exception offsets (PowerPC standard) */
#define EXC_OFF_SYS_RESET 0x0100
/* useful macros for manipulating CSx_START/STOP */
#if defined(CONFIG_MGT5100)
#define START_REG(start) ((start) >> 15)
#define STOP_REG(start, size) (((start) + (size) - 1) >> 15)
#elif defined(CONFIG_MPC5200)
#define START_REG(start) ((start) >> 16)
#define STOP_REG(start, size) (((start) + (size) - 1) >> 16)
#endif
/* Internal memory map */
#define MPC5XXX_CS0_START (CFG_MBAR + 0x0004)

@ -892,6 +892,7 @@
#define PCI_DEVICE_ID_SYSKONNECT_FP 0x4000
#define PCI_DEVICE_ID_SYSKONNECT_TR 0x4200
#define PCI_DEVICE_ID_SYSKONNECT_GE 0x4300
#define PCI_DEVICE_ID_SYSKONNECT_GE_SA 0x4320
#define PCI_VENDOR_ID_VMIC 0x114a
#define PCI_DEVICE_ID_VMIC_VME 0x7587

@ -44,6 +44,7 @@ extern int inca_switch_initialize(bd_t*);
extern int ppc_4xx_eth_initialize(bd_t *);
extern int plb2800_eth_initialize(bd_t*);
extern int mpc5xxx_fec_initialize(bd_t*);
extern int skge_initialize(bd_t*);
static struct eth_device *eth_devices, *eth_current;
@ -142,6 +143,9 @@ int eth_initialize(bd_t *bis)
#if defined(CONFIG_MPC5XXX_FEC)
mpc5xxx_fec_initialize(bis);
#endif
#if defined(CONFIG_SK98)
skge_initialize(bis);
#endif
if (!eth_devices) {
puts ("No ethernet found.\n");

Loading…
Cancel
Save