amd8111s_main.h revision 99dda20867d903eec23291ba1ecb18a82d70096b
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef AMD8111S_MAIN_H
#define AMD8111S_MAIN_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 2001-2006 Advanced Micro Devices, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* + Redistributions of source code must retain the above copyright notice,
* + this list of conditions and the following disclaimer.
*
* + Redistributions in binary form must reproduce the above copyright
* + notice, this list of conditions and the following disclaimer in the
*
* + Neither the name of Advanced Micro Devices, Inc. nor the names of its
* + contributors may be used to endorse or promote products derived from
* + this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Compliance with Applicable Laws. Notice is hereby given that
* the software may be subject to restrictions on use, release,
* the laws and regulations of the United States or other
* countries ("Applicable Laws"), which include but are not
* limited to U.S. export control laws such as the Export
* Administration Regulations and national security controls as
* defined thereunder, as well as State Department controls under
* redistribute the software is conditioned upon compliance with
* all Applicable Laws, including U.S. export control laws
* regarding specifically designated persons, countries and
* nationals of countries subject to national security controls.
*/
#pragma ident "@(#)$RCSfile: odl.h,v $ $Revision: 1.1 $ " \
"$Date: 2004/04/22 15:22:52 $ AMD"
#include <sys/dditypes.h>
#include <sys/ethernet.h>
#include <sys/mac_ether.h>
#include "amd8111s_hw.h"
#define MEM_REQ_MAX 100
#define MEMSET 4
#define IOC_LINESIZE 40
/*
* Loopback definitions
*/
#define AMD8111S_LB_NONE 0
#define AMD8111S_LB_EXTERNAL_1000 1
#define AMD8111S_LB_EXTERNAL_100 2
#define AMD8111S_LB_EXTERNAL_10 3
#define AMD8111S_LB_INTERNAL_PHY 4
#define AMD8111S_LB_INTERNAL_MAC 5
/* ((2 ^ (32 - 1)) * 8) / (10 ^ 8) >= 100 */
#define AMD8111S_DUMP_MIB_SECONDS_THRESHOLD 100
#define AMD8111S_DUMP_MIB_BYTES_THRESHOLD 0x80000000
/* Bit flags for 'attach_progress' */
#define AMD8111S_TRY_SEND 0x0001
#define AMD8111S_SEND_READY 0x0002
/*
* (Internal) return values from ioctl subroutines
*/
enum ioc_reply {
IOC_DONE, /* OK, reply sent */
IOC_ACK, /* OK, just send ACK */
IOC_REPLY, /* OK, just send reply */
IOC_RESTART_ACK, /* OK, restart & ACK */
IOC_RESTART_REPLY /* OK, restart & reply */
};
typedef int (*TIMERfUNC) (struct LayerPointers *);
struct TimerStructure {
int Type;
int Period; /* in milliseconds */
int (*TimerFunptr)(struct LayerPointers *);
struct LayerPointers *pLayerPointers;
};
struct amd8111s_statistics
{
/* # of call amd8111s_dump_mib function */
/*
* From MIB registers (TX)
*/
/* Packet drop due to Tx FIFO underrun */
/* Packets successfully transmitted after experiencing one collision */
/* # of late collisions that occur */
/*
* Some error counter after "ifconfig amd8111sX unplumb"
*/
/*
* Count Tx mp number from GLD even after NIC has been unplumbed.
* This value should always be 0.
*/
/*
* We drain all pending tx packets during unplumb operation. This
* variable is to count the drain time.
* 30 means success; =30 means fail
*/
/*
* From MIB registers (RX)
*/
/*
* The total number of valid frames received that are less than 64
* bytes long (include the FCS).
*/
/*
* The total number of valid frames received that are greater than the
* maximum valid frame size (include the FCS).
*/
/* Invalid data symbol (RX_ER) */
/* Packets that were dropped because no descriptor was available */
/*
* Packets that were dropped due to lack of resources. This includes
* the number of times a packet was dropped due to receive FIFO
* overflow and lack of receive descriptor.
*/
};
struct amd8111s_msgbuf {
};
struct amd8111s_dma_ringbuf {
struct amd8111s_msgbuf *msg_buf;
struct amd8111s_msgbuf *free;
struct amd8111s_msgbuf *next;
struct amd8111s_msgbuf *curr;
};
struct odl {
struct amd8111s_statistics statistics;
/* Locks */
/*
* other functions change the hardware configuration, such as attach()
* detach() etc are executed.
*/
/*
* HW operators and parameters on attach period
*/
/* For pci configuration */
/*
* FreeQ: Transfer Rx Buffer parameters from top layer to low layers.
* Format of parameter:
* (struct RxBufInfo *, physical address)
*/
unsigned long *FreeQStart;
unsigned long *FreeQEnd;
long *FreeQWrite;
long *FreeQRead;
/* For Rx descriptors */
/* For Tx descriptors */
/* For Tx buffers */
struct amd8111s_dma_ringbuf tx_buf;
/* For Rx buffers */
struct amd8111s_dma_ringbuf rx_buf;
/* Multicast addresses table */
/* Timer */
int (*TimerFunc)(struct LayerPointers *);
int timer_run;
int timer_linkdown;
unsigned int dump_mib_seconds;
unsigned int rx_fcs_stripped;
unsigned int rx_overflow_counter;
unsigned int pause_interval;
};
#endif /* AMD8111S_MAIN_H */