source: SVN/cambria/redboot/packages/devs/eth/intel/i82559/current/include/i82559_info.h @ 1

Last change on this file since 1 was 1, checked in by Tim Harvey, 2 years ago

restored latest version of files from server backup

Signed-off-by: Tim Harvey <tharvey@…>

File size: 8.2 KB
Line 
1#ifndef CYGONCE_DEVS_ETH_INTEL_I82559_INFO_H
2#define CYGONCE_DEVS_ETH_INTEL_I82559_INFO_H
3/*==========================================================================
4//
5//        i82559_info.h
6//
7//
8//==========================================================================
9//####ECOSGPLCOPYRIGHTBEGIN####
10// -------------------------------------------
11// This file is part of eCos, the Embedded Configurable Operating System.
12// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
13//
14// eCos is free software; you can redistribute it and/or modify it under
15// the terms of the GNU General Public License as published by the Free
16// Software Foundation; either version 2 or (at your option) any later version.
17//
18// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
19// WARRANTY; without even the implied warranty of MERCHANTABILITY or
20// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
21// for more details.
22//
23// You should have received a copy of the GNU General Public License along
24// with eCos; if not, write to the Free Software Foundation, Inc.,
25// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26//
27// As a special exception, if other files instantiate templates or use macros
28// or inline functions from this file, or you compile this file and link it
29// with other works to produce a work based on this file, this file does not
30// by itself cause the resulting work to be covered by the GNU General Public
31// License. However the source code for this file must still be made available
32// in accordance with section (3) of the GNU General Public License.
33//
34// This exception does not invalidate any other reasons why a work based on
35// this file might be covered by the GNU General Public License.
36//
37// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
38// at http://sources.redhat.com/ecos/ecos-license/
39// -------------------------------------------
40//####ECOSGPLCOPYRIGHTEND####
41//==========================================================================
42//#####DESCRIPTIONBEGIN####
43//
44// Author(s):     hmt
45// Contributors:  hmt
46// Date:          2000-05-03
47// Description:
48//
49//####DESCRIPTIONEND####
50*/
51
52#include <pkgconf/devs_eth_intel_i82559.h>
53
54#ifdef CYGDBG_DEVS_ETH_INTEL_I82559_KEEP_STATISTICS
55# define KEEP_STATISTICS
56# define nDISPLAY_STATISTICS
57# define nDISPLAY_82559_STATISTICS
58#else
59# define nKEEP_STATISTICS
60# define nDISPLAY_STATISTICS
61# define nDISPLAY_82559_STATISTICS
62#endif
63
64
65// ------------------------------------------------------------------------
66//
67//                       STATISTICAL COUNTER STRUCTURE
68//
69// ------------------------------------------------------------------------
70#ifdef KEEP_STATISTICS
71typedef struct {
72/*  0 */    cyg_uint32 tx_good;
73/*  4 */    cyg_uint32 tx_max_collisions;
74/*  8 */    cyg_uint32 tx_late_collisions;
75/* 12 */    cyg_uint32 tx_underrun;
76/* 16 */    cyg_uint32 tx_carrier_loss;
77/* 20 */    cyg_uint32 tx_deferred;
78/* 24 */    cyg_uint32 tx_single_collisions;
79/* 28 */    cyg_uint32 tx_mult_collisions;
80/* 32 */    cyg_uint32 tx_total_collisions;
81/* 36 */    cyg_uint32 rx_good;
82/* 40 */    cyg_uint32 rx_crc_errors;
83/* 44 */    cyg_uint32 rx_align_errors;
84/* 48 */    cyg_uint32 rx_resource_errors;
85/* 52 */    cyg_uint32 rx_overrun_errors;
86/* 56 */    cyg_uint32 rx_collisions; // Always 0
87/* 60 */    cyg_uint32 rx_short_frames;
88// In this setup; can also be flow-control counts after.
89// If these are to be used, a config command (as in set promiscuous mode)
90// must be issued at start, to let those stats escape.  Params are in
91// comments around the config command setup...
92/* 64 */    cyg_uint32 done;
93} I82559_COUNTERS;
94
95
96typedef struct {
97    cyg_uint32 interrupts;
98    cyg_uint32 rx_count;
99    cyg_uint32 rx_deliver;
100    cyg_uint32 rx_resource;
101    cyg_uint32 rx_restart;
102    cyg_uint32 tx_count;
103    cyg_uint32 tx_complete;
104    cyg_uint32 tx_dropped;
105} STATISTICS;
106
107
108extern STATISTICS statistics[CYGNUM_DEVS_ETH_INTEL_I82559_DEV_COUNT];
109#ifdef CYGDBG_DEVS_ETH_INTEL_I82559_KEEP_82559_STATISTICS
110extern I82559_COUNTERS i82559_counters[CYGNUM_DEVS_ETH_INTEL_I82559_DEV_COUNT];
111#endif
112
113#endif // KEEP_STATISTICS
114
115// ------------------------------------------------------------------------
116//
117//                      DEVICES AND PACKET QUEUES
118//
119// ------------------------------------------------------------------------
120// The system seems to work OK with as few as 8 of RX and TX descriptors.
121// It limps very painfully with only 4.
122// Performance is better with more than 8.
123// But the size of non-cached (so useless for anything else)
124// memory window is 1Mb, so we might as well use it all.
125//
126// 128 for these uses the whole 1Mb, near enough.
127
128#ifndef MAX_RX_DESCRIPTORS
129#define MAX_RX_DESCRIPTORS      128     // number of Rx descriptors
130#endif
131#ifndef MAX_TX_DESCRIPTORS
132#define MAX_TX_DESCRIPTORS      128     // number of Tx descriptors
133#endif
134
135// Use packet type for selfdocumenting code
136typedef cyg_uint8 RFD;
137typedef cyg_uint8 TxCB;
138typedef cyg_uint8 CFG;
139
140typedef struct i82559 {
141    cyg_uint8                           // (split up for atomic byte access)
142        found:1,                        // was hardware discovered?
143        mac_addr_ok:1,                  // can we bring up?
144        active:1,                       // has this if been brung up?
145        hardwired_esa:1,                // set if ESA is hardwired via CDL
146        promisc:1,                      // set if in promisc mode
147        multicast_all:1,                // set if MultiCastALL mode
148        oversized:1,                    // set if oversized packets are received (VLAN mode)
149        spare1:1; 
150    cyg_uint8                           // Count nested sends to reject
151        within_send:8;                  //     nested requests to send
152    cyg_uint8
153        tx_in_progress:1,               // transmit in progress flag
154        tx_queue_full:1,                // all Tx descriptors used flag
155        spare3:6; 
156    cyg_uint8  index;                   // 0 or 1 or whatever
157    cyg_uint32 devid;                   // PCI device id
158    cyg_uint32 memory_address;          // PCI memory address
159    cyg_uint32 io_address;              // memory mapped I/O address
160    cyg_uint8  mac_address[6];          // mac (hardware) address
161    void *ndp;                          // Network Device Pointer
162
163    int next_rx_descriptor;             // descriptor index for RFDs
164    RFD* rx_ring[MAX_RX_DESCRIPTORS];   // location of Rx descriptors
165
166    int tx_descriptor_add;              // descriptor index for additions
167    int tx_descriptor_active;           // descriptor index for active tx
168    int tx_descriptor_remove;           // descriptor index for remove
169
170    TxCB* tx_ring[MAX_TX_DESCRIPTORS];  // location of Tx descriptors
171    unsigned long tx_keys[MAX_TX_DESCRIPTORS];
172                                        // keys for tx q management
173
174    // Interrupt handling stuff
175    cyg_vector_t    vector;             // interrupt vector
176    cyg_handle_t    interrupt_handle;   // handle for int.handler
177    cyg_interrupt   interrupt_object;
178
179#ifdef KEEP_STATISTICS
180    void *p_statistics;                 // pointer to statistical counters
181#endif
182
183    cyg_uint32 platform_timeout;        // Some platforms use a timeout
184    int tx_descriptor_timeout;          // Is it fixated on this tx?
185
186} I82559;
187
188
189// ------------------------------------------------------------------------
190//
191//                   82559 GENERAL STATUS REGISTER
192//
193// ------------------------------------------------------------------------
194#define GEN_STATUS_FDX          0x04    // 1 = full duplex, 0 = half
195#define GEN_STATUS_100MBPS      0x02    // 1 = 100 Mbps, 0 = 10 Mbps
196#define GEN_STATUS_LINK         0x01    // 1 = link up, 0 = link down
197
198extern int i82559_status( struct eth_drv_sc *sc );
199
200// ------------------------------------------------------------------------
201
202#ifdef KEEP_STATISTICS
203void update_statistics(struct i82559* p_i82559);
204#endif
205
206
207#ifdef CYGDBG_DEVS_ETH_INTEL_I82559_KEEP_82559_STATISTICS
208#define ETH_STATS_INIT( p ) \
209        update_statistics( (struct i82559 *)((p)->driver_private) )
210#else
211#define ETH_STATS_INIT( p ) // otherwise do nothing
212#endif
213
214#define CYGDAT_DEVS_ETH_DESCRIPTION "Intel EtherPRO 10/100+ (i82559)"
215
216#define ETH_DEV_DOT3STATSETHERCHIPSET 1,3,6,1,2,1,10,7,8,2,5
217
218#endif /* ifndef CYGONCE_DEVS_ETH_INTEL_I82559_INFO_H */
219
220/* EOF i82559_info.h */
221
Note: See TracBrowser for help on using the repository browser.