File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / sys / tahoeif / if_acereg.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:24:19 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v12b, v121, HEAD
Power 6/32 Unix version 1.2b

/*								*/
/*	ACC ethernet controller definitions, VERSAbus version	*/
/*	product name V/EIU, unix name ACE			*/
/*								*/

/*								*/
/*	register definitions					*/
/*								*/
struct acedevice{
	struct rx_addr_ram  {         /* receive address match ram.     */
	  short	station_addr[6];     /* Ethernet Station Addr  */
	  short	broadcast_en[2];     /* Broadcast Reception OK */
	  short	mcast_hash_code[8];  /* Multicast Hash Code    */
	}	rar;      
	short	csr;		/* hardwired control and status register */
	short	tseg;		/* active transmit segment #             */
	short	rseg;		/* active receive  segment #             */
	short	segb;		/* segment boundary register             */
	short	lrf;		/* lost receive frame counter            */
	short	ivct;		/* interrupt vector register.            */
	short	nada0;		/*  -- reserved for future use --        */
	short	fcoll;		/* force collision register.             */
};

/*
The following two structure define the format of "transmit and receive
segments" in the V/EIU's Dual-Ported Memory.  Each segment is 2KBytes
long and buffers either an outgoing (transmit segment) or incoming 
(receive segment) Ethernet Frame.
*/

struct tx_segment {
          short        tx_csr;         /* control and status register */
          char         tx_data[2014];  /* frame buffer area           */
          short        tx_backoff[16]; /* control and status register */
          };

struct rx_segment {
          short        rx_csr;         /* control and status register */
          char         rx_data[2046];  /* frame buffer area           */
          };

/*
The following two structures define the descriptors used to represent a logical
queue of Ethernet frames.  The structure supports a FIFO queue mechanism.
For each queue there is a general control structure that tracks the location
of the first and last elements of the queue.  Each element contains infromation
relating to the location of the Ethernet frame & the # of bytes it contains,
and the location of the next element in the queue.
*/

struct ace_element {
	struct	ace_element *pNext;  /* ptr to the next element of the queue  */
	char	*pFrame; 	/* ptr to Ethernet frame assoc w/ elem.  */
     };


struct ace_queue {
     struct ace_element* phead;       /* ptr to first element of queue */
     struct ace_element* ptail;       /* ptr to last element of queue  */
     };


/*
The following structure defines the statistics control block which maintains
the Ethernet data transfer statistics for a single V/EIU unit.
*/ 

struct ace_stats {
            int            rx_datagrams;    /* # valid datagrams received    */
            int            rx_crc_errors;   /* # rcv'd w/ CRC errors         */
            int            rx_overruns;     /* # rcv'd too large( > 1514)    */
            int            rx_underruns;    /* # rcv'd too small( < 64)      */
            int            rx_align_errors; /* # rcv'd w/ odd # bytes        */
            int            rx_reserved;     /* <reserved for future use>     */
	    int		   rx_busy;	    /* # of busy recv segment        */
            int	           rx_mbuf;	    /* # of recvd mbufs              */
            int		   rx_oddoff;	    /* # of odd offset in recv mbuf  */
	    int		   rx_rintcnt;	    /* # of incoming packets */
	    int		   rx_rwoint;	    /* # of recv WITHOUT interrpt    */

            int            tx_datagrams;    /* # datagrams tx'd successful   */
            int            tx_retries;      /* # tx retries due to collision */
            int            tx_discarded;    /* # tx dropped from >15 retries */
            int		   tx_busy;	    /* # of busy xmit segment        */
            int		   tx_cbusy;	    /* # acecint() finds busy segment*/
            int	 	   tx_mbuf;	    /* # of transmitted mbufs        */
	    int		   tx_oddoff;	    /* # of odd offset in xmit mbuf  */
	    int		   tx_outcnt;	    /* # of outputting requests      */
	    int		   tx_startcnt;	    /* # of calls to acestart()      */
	    int		   tx_cintcnt;	    /* # of completed transmissions  */
	    int		   tx_xwoint;	    /* # of xmit WITHOUT interrpt    */
       };

/*
The following structure defines the format of Ethernet Station Address and
the format of the Hash Code used by the V/EIU do filter receipt of multicast
datagram incoming from the Ethernet.
*/ 

struct station_addr {
            char           esa[6];          /* 6 byte field in address */
       };

struct hash_code    {
            char           mhc[8];          /* 8 byte field in hash code */
       };

/*
The following structure defines the descriptor used to represent a logical
V/EIU unit.  Often referred to as "Unit Control Block (UCB)", this structure
maintains information as to the location, state, and status of the controller.
*/

#ifdef	INLINE
struct ace_unit {
     struct ace_regs   *pReg;           /* ptr to unit's I/O registers    */
            char*         pDpm;           /* ptr to unit's Dual-Port Memory */
            short         segboundry;     /* first Tx Seg in unit's DPM     */
            short         eictr;          /* Rx segment tracking counter    */
            short         eoctr;          /* Tx segment tracking counter    */
            short         tx_next;        /* next available Tx segment ctr  */
            EVENTCOUNT    rx_arrived;     /* received frames eventcounter   */
            EVENTCOUNT    rx_processed;   /* rx'd & processed frames EC     */
            EVENTCOUNT    tx_complete;    /* tx'd frames eventcounter       */
            SEMAPHORE     rx_semaphore;   /* receive frame semaphore        */
            SEMAPHORE     tx_semaphore;   /* transmit frame semaphore       */
            short         cur_rnd;        /* current random # value         */
            short         diag_code;      /* diagnostic error & test codes  */
            short         state;          /* status of unit                 */
     struct ace_queue   rx_queue;       /* received frame queue           */
     struct ace_queue   av_queue;       /* available queue (free list)    */
     struct ace_element av_elements[9]; /* unit queue elements            */
     struct ace_stats   statistics;     /* unit's statistics              */
            short         rx_reset;       /* receive code's reset ctl word  */
            short         tx_reset;       /* transmit code's reset ctl word */
            short         rx_waiting;     /* receiver sleeping status flag  */
            short         tx_waiting;     /* transmitter sleeping status flg*/
     };
#endif	INLINE

 /*
V/EIU CONTROL/STATUS REGISTER BIT DEFINITIONS
=============================================

The following defines the bits in the V/EIU's "Control/Status Register".
Each bit definition is followed by a brief description which includes 
a reference to its read/write capabilities as well as it's active state
if appropriate.  "r/w" := read/write, "r" := read only, and "w" := write 
only.  "aL" := active LOW and "aH" := active high".  The first three letters 
of the bits' names, "CSR", indicate definition for the "CSR register" only.
*/

#define  CSR_UNUSED      0xFD00 /* unused bits                       "??_??" */
#define  CSR_ENXMITODD   0x0200 /* Enable Odd # byte transmission    "rw_aH" */
#define  CSR_ACTIVE      0x0080 /* V/EIU is active & running         "r _aH" */
#define  CSR_RESET       0x0040 /* V/EIU reset control line          " w_aH" */
#define  CSR_PROMISCUOUS 0x0020 /* Enable "promiscous mode" operation"rw_aH" */
#define  CSR_NOXMITCRC   0x0010 /* Disable CRC generation & checking "rw_aH" */
#define  CSR_LOOP3       0x0008 /* Enable MODE 3 LOOPBACK mode       "rw_aH" */
#define  CSR_LOOP2       0x0004 /* Enable MODE 2 LOOPBACK mode       "rw_aH" */
#define  CSR_ENINT       0x0002 /* Enable Interrupts to VERSAbus     "rw_aH" */
#define  CSR_GO          0x0001 /* Enable V/EIU operations           " w_aH" */

/*
V/EIU VALID BIT MASKS
=====================

The following defines the valid bits of "short" fields contained in
the V/EIU's "Receive Address Match Ram".  The first three letters
of the masks' names indicate definition for the following:
   RAR ==> Receive Address Ram          IVC ==> Interrupt Vector Register
   LRF ==> Lost Receive Frame Counter   FCL ==> Force Collision Register
*/

#define  RAR_VALID       0x00FF /* Valid bits in Receive Address Ram fields  */
#define  LRF_VALID       0x000F /* Valid bits in Lost Receive Frame register */
#define  IVC_VALID       0x00F8 /* Valid bits in Interrupt Vector register   */
#define  FCL_VALID       0xFFFF /* Valid bits in Force Collision register    */

/*
V/EIU TRANSMIT SEGMENT CONTROL/STATUS BIT DEFINITIONS
=====================================================

The following defines the bit-fields in the "Control/Status Field" of a 
Transmit Segment in the V/EIU's Dual-Ported Memory.  There are two 
types of bit-fields it this field, those that produce a response by the 
V/EIU ("command") and those that indicate the response ("status")
The first three letters of the bits' names, "TCS", indicate definition 
for the "Tx segment CSr" only.
*/

/* commands */
#define  TCS_TBFULL   	 (short)0x8000 /*   Tx Bfr Full so send it           */
#define  TCS_TBC         (short)0x07FF /*   Tx Byte Count                    */
/* status */
#define  TCS_TBMT        (short)0x8000 /*   Tx Buffer Empty   (avail for Tx) */
#define  TCS_RTFAIL      (short)0x4000 /*   Tx Retries Failed (frame dropped)*/
#define  TCS_RTC         (short)0x000F /*   Tx # Retries which collided      */

/*
V/EIU RECEIVE SEGMENT CONTROL/STATUS BIT DEFINITIONS
====================================================

The following defines the bit-fields in the "Control/Status Field" of a 
Receive Segment in the V/EIU's Dual-Ported Memory.  There are two 
types of bit-fields it this field, those that produce a response by the 
V/EIU ("command") and those that indicate the response ("status")
The first three letters of the bits' names, "RCS", indicate definition 
for the "Rx segment CSr" only.
*/

#define  RCS_RBMT        0x8000 /* command:  Rx Bfr Empty      (avail for Rx) */
#define  RCS_RBFULL      0x8000 /* status :  Rx Bfr Full       (frame Rx'd)   */
#define  RCS_ROVRN       0x4000 /*        :  Rx Bfr Overrun Error (too long)  */
#define  RCS_RCRC        0x2000 /*        :  Rx Bfr CRC Error  (bad data)     */
#define  RCS_RODD        0x1000 /*        :  Rx Bfr Alignment Error (odd cnt) */
#define  RCS_RBC         0x07FF /*        :  Rx Bfr Byte Count                */

/*
V/EIU SPECIAL FUNCTION CODE DEFINITIONS
=======================================

The following define the valid functions codes available for use with
the "spfun ()" entry point into this driver.
*/

#define  ACE_INIT      0x0001     /* V/EIU Initialize command        */
#define  ACE_RESP      0x0002     /* V/EIU Initialize response       */
#define  ACE_STATS     0x0003     /* V/EIU Statistics query          */
#define  ACE_ECMAP     0x0004     /* V/EIU Event counter map request */
#define  ACE_IOPORTS   0x0005     /* V/EIU I/O Ports Dump            */
#define  ACE_UCBSTATS  0x0006     /* V/EIU UCB contents Dump         */

/*
V/EIU RETURNED ERROR CODES
==========================

The following define the range of error codes which may be returned by
this driver to calling user processes.  The first letter of the error code's 
names, "E", indicates definition for "returned error codes" only.
*/

#define  E_BADDEV        (-100)    /* illegal minor device                   */
#define  E_OFFLINE       (-101)    /* requested unit is not on-line          */
#define  E_LOSTSYNC      (-102)    /* driver syncronization lost w/ hardware */
#define  E_SIGNALED      (-103)    /* I/O request terminated due to signal() */
#define  E_2BIG          (-104)    /* transmit request for oversize frame    */
#define  E_2SMALL        (-105)    /* receive request for undersize frame    */
#define  E_BADCALL       (-106)    /* illegal "spfun()" call                 */
#define  E_RESET         (-107)    /* unit reset while waiting for i/o to end*/

/*
V/EIU MISCELLANEOUS DEFINTIIONS
===============================

The following are miscellaneous constant definitions and come from
a number of places for a number of different reasons.
*/

#define  ACE_OFFLINE   0         /* off-line unit status                   */
#define  ACE_ONLINE    0         /* on-line unit status                    */
#define  CRC_SIZE        4         /* number of bytes in a rx seg's CRC      */
#define  RCW_SIZE        2         /* number of bytes in a rx seg's csr      */
#define  M_READ          "read"    /* read diagnostic string                 */
#define  M_WRITE         "write"   /* write diagnostic string                */
#define  SEG_MAX         15        /* largest valid V/EIU segment number     */
#define  MXRXPKTSZ       1516      /* max. size of allowed rx/tx frames +RCW */
#define  ET_MINLEN       64        /* min. size of allowed rx/tx frames      */
#define  ET_MAXLEN       1514      /* max. size of rx/tx frames w/o CRC & RCW*/
#define  EC_ARRIVED      42        /* EC mapping number for "rx_arrived EC   */
#define  EC_PROCESSED    43        /* EC mapping number for "rx_processed EC */
#define  RX_ARVD_EC      42        /* Select code for rx_arrived EC mapping  */
#define  RX_PRCD_EC      43        /* Select code for rx_processed EC mapping*/


/*
 * Ethernet software status per interface.
 *
 * Each interface is referenced by a network interface structure,
 * is_if, which the routing code uses to locate the interface.
 * This structure contains the output queue for the interface, its address, ...
 */
struct	ace_softc {
	struct	arpcom is_ac;		/* Ethernet common part		*/
#define	is_if	is_ac.ac_if		/* network-visible interface	*/
#define	is_addr	is_ac.ac_enaddr		/* hardware Ethernet address	*/
	char	*is_dpm;
	short	is_flags;
#define	ACEF_OACTIVE	0x1		/* output is active		*/
#define	ACEF_RCVPENDING	0x2		/* start rcv in acecint		*/
	short	is_promiscuous;		/* true is enabled		*/
	short	is_segboundry;		/* first TX Seg in dpm		*/
	short	is_eictr;		/* Rx segment tracking ctr	*/
	short	is_eoctr;		/* Tx segment tracking ctr	*/
	short	is_txnext;		/* Next available Tx segment	*/
	short	is_currnd;		/* current random backoff	*/
	struct	ace_stats is_stats;	/* holds board statistics	*/
	short	is_xcnt;		/* count xmitted segments to be acked 
					   by the controller */
};

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.