1*4f693a8fSBagas Sanjaya /* SPDX-License-Identifier: GPL-2.0-only */ 211597885SJeff Kirsher /* 311597885SJeff Kirsher * Intel i82586 Ethernet definitions 411597885SJeff Kirsher * 511597885SJeff Kirsher * This is an extension to the Linux operating system, and is covered by the 611597885SJeff Kirsher * same Gnu Public License that covers that work. 711597885SJeff Kirsher * 811597885SJeff Kirsher * copyrights (c) 1994 by Michael Hipp (hippm@informatik.uni-tuebingen.de) 911597885SJeff Kirsher * 1011597885SJeff Kirsher * I have done a look in the following sources: 1111597885SJeff Kirsher * crynwr-packet-driver by Russ Nelson 1211597885SJeff Kirsher * Garret A. Wollman's i82586-driver for BSD 1311597885SJeff Kirsher */ 1411597885SJeff Kirsher 1511597885SJeff Kirsher /* 1611597885SJeff Kirsher * Cloned from ni52.h, copyright as above. 1711597885SJeff Kirsher * 1811597885SJeff Kirsher * Modified for Sun3 OBIO i82586 by Sam Creasey (sammy@sammy.net) 1911597885SJeff Kirsher */ 2011597885SJeff Kirsher 2111597885SJeff Kirsher 2211597885SJeff Kirsher /* defines for the obio chip (not vme) */ 2311597885SJeff Kirsher #define IEOB_NORSET 0x80 /* don't reset the board */ 2411597885SJeff Kirsher #define IEOB_ONAIR 0x40 /* put us on the air */ 2511597885SJeff Kirsher #define IEOB_ATTEN 0x20 /* attention! */ 2611597885SJeff Kirsher #define IEOB_IENAB 0x10 /* interrupt enable */ 2711597885SJeff Kirsher #define IEOB_XXXXX 0x08 /* free bit */ 2811597885SJeff Kirsher #define IEOB_XCVRL2 0x04 /* level 2 transceiver? */ 2911597885SJeff Kirsher #define IEOB_BUSERR 0x02 /* bus error */ 3011597885SJeff Kirsher #define IEOB_INT 0x01 /* interrupt */ 3111597885SJeff Kirsher 3211597885SJeff Kirsher /* where the obio one lives */ 3311597885SJeff Kirsher #define IE_OBIO 0xc0000 3411597885SJeff Kirsher #define IE_IRQ 3 3511597885SJeff Kirsher 3611597885SJeff Kirsher /* 3711597885SJeff Kirsher * where to find the System Configuration Pointer (SCP) 3811597885SJeff Kirsher */ 3911597885SJeff Kirsher #define SCP_DEFAULT_ADDRESS 0xfffff4 4011597885SJeff Kirsher 4111597885SJeff Kirsher 4211597885SJeff Kirsher /* 4311597885SJeff Kirsher * System Configuration Pointer Struct 4411597885SJeff Kirsher */ 4511597885SJeff Kirsher 4611597885SJeff Kirsher struct scp_struct 4711597885SJeff Kirsher { 4811597885SJeff Kirsher unsigned short zero_dum0; /* has to be zero */ 4911597885SJeff Kirsher unsigned char sysbus; /* 0=16Bit,1=8Bit */ 5011597885SJeff Kirsher unsigned char zero_dum1; /* has to be zero for 586 */ 5111597885SJeff Kirsher unsigned short zero_dum2; 5211597885SJeff Kirsher unsigned short zero_dum3; 5311597885SJeff Kirsher char *iscp; /* pointer to the iscp-block */ 5411597885SJeff Kirsher }; 5511597885SJeff Kirsher 5611597885SJeff Kirsher 5711597885SJeff Kirsher /* 5811597885SJeff Kirsher * Intermediate System Configuration Pointer (ISCP) 5911597885SJeff Kirsher */ 6011597885SJeff Kirsher struct iscp_struct 6111597885SJeff Kirsher { 6211597885SJeff Kirsher unsigned char busy; /* 586 clears after successful init */ 6311597885SJeff Kirsher unsigned char zero_dummy; /* has to be zero */ 6411597885SJeff Kirsher unsigned short scb_offset; /* pointeroffset to the scb_base */ 6511597885SJeff Kirsher char *scb_base; /* base-address of all 16-bit offsets */ 6611597885SJeff Kirsher }; 6711597885SJeff Kirsher 6811597885SJeff Kirsher /* 6911597885SJeff Kirsher * System Control Block (SCB) 7011597885SJeff Kirsher */ 7111597885SJeff Kirsher struct scb_struct 7211597885SJeff Kirsher { 7311597885SJeff Kirsher unsigned char rus; 7411597885SJeff Kirsher unsigned char cus; 7511597885SJeff Kirsher unsigned char cmd_ruc; /* command word: RU part */ 7611597885SJeff Kirsher unsigned char cmd_cuc; /* command word: CU part & ACK */ 7711597885SJeff Kirsher unsigned short cbl_offset; /* pointeroffset, command block list */ 7811597885SJeff Kirsher unsigned short rfa_offset; /* pointeroffset, receive frame area */ 7911597885SJeff Kirsher unsigned short crc_errs; /* CRC-Error counter */ 8011597885SJeff Kirsher unsigned short aln_errs; /* allignmenterror counter */ 8111597885SJeff Kirsher unsigned short rsc_errs; /* Resourceerror counter */ 8211597885SJeff Kirsher unsigned short ovrn_errs; /* OVerrunerror counter */ 8311597885SJeff Kirsher }; 8411597885SJeff Kirsher 8511597885SJeff Kirsher /* 8611597885SJeff Kirsher * possible command values for the command word 8711597885SJeff Kirsher */ 8811597885SJeff Kirsher #define RUC_MASK 0x0070 /* mask for RU commands */ 8911597885SJeff Kirsher #define RUC_NOP 0x0000 /* NOP-command */ 9011597885SJeff Kirsher #define RUC_START 0x0010 /* start RU */ 9111597885SJeff Kirsher #define RUC_RESUME 0x0020 /* resume RU after suspend */ 9211597885SJeff Kirsher #define RUC_SUSPEND 0x0030 /* suspend RU */ 9311597885SJeff Kirsher #define RUC_ABORT 0x0040 /* abort receiver operation immediately */ 9411597885SJeff Kirsher 9511597885SJeff Kirsher #define CUC_MASK 0x07 /* mask for CU command */ 9611597885SJeff Kirsher #define CUC_NOP 0x00 /* NOP-command */ 9711597885SJeff Kirsher #define CUC_START 0x01 /* start execution of 1. cmd on the CBL */ 9811597885SJeff Kirsher #define CUC_RESUME 0x02 /* resume after suspend */ 9911597885SJeff Kirsher #define CUC_SUSPEND 0x03 /* Suspend CU */ 10011597885SJeff Kirsher #define CUC_ABORT 0x04 /* abort command operation immediately */ 10111597885SJeff Kirsher 10211597885SJeff Kirsher #define ACK_MASK 0xf0 /* mask for ACK command */ 10311597885SJeff Kirsher #define ACK_CX 0x80 /* acknowledges STAT_CX */ 10411597885SJeff Kirsher #define ACK_FR 0x40 /* ack. STAT_FR */ 10511597885SJeff Kirsher #define ACK_CNA 0x20 /* ack. STAT_CNA */ 10611597885SJeff Kirsher #define ACK_RNR 0x10 /* ack. STAT_RNR */ 10711597885SJeff Kirsher 10811597885SJeff Kirsher /* 10911597885SJeff Kirsher * possible status values for the status word 11011597885SJeff Kirsher */ 11111597885SJeff Kirsher #define STAT_MASK 0xf0 /* mask for cause of interrupt */ 11211597885SJeff Kirsher #define STAT_CX 0x80 /* CU finished cmd with its I bit set */ 11311597885SJeff Kirsher #define STAT_FR 0x40 /* RU finished receiving a frame */ 11411597885SJeff Kirsher #define STAT_CNA 0x20 /* CU left active state */ 11511597885SJeff Kirsher #define STAT_RNR 0x10 /* RU left ready state */ 11611597885SJeff Kirsher 11711597885SJeff Kirsher #define CU_STATUS 0x7 /* CU status, 0=idle */ 11811597885SJeff Kirsher #define CU_SUSPEND 0x1 /* CU is suspended */ 11911597885SJeff Kirsher #define CU_ACTIVE 0x2 /* CU is active */ 12011597885SJeff Kirsher 12111597885SJeff Kirsher #define RU_STATUS 0x70 /* RU status, 0=idle */ 12211597885SJeff Kirsher #define RU_SUSPEND 0x10 /* RU suspended */ 12311597885SJeff Kirsher #define RU_NOSPACE 0x20 /* RU no resources */ 12411597885SJeff Kirsher #define RU_READY 0x40 /* RU is ready */ 12511597885SJeff Kirsher 12611597885SJeff Kirsher /* 12711597885SJeff Kirsher * Receive Frame Descriptor (RFD) 12811597885SJeff Kirsher */ 12911597885SJeff Kirsher struct rfd_struct 13011597885SJeff Kirsher { 13111597885SJeff Kirsher unsigned char stat_low; /* status word */ 13211597885SJeff Kirsher unsigned char stat_high; /* status word */ 13311597885SJeff Kirsher unsigned char rfd_sf; /* 82596 mode only */ 13411597885SJeff Kirsher unsigned char last; /* Bit15,Last Frame on List / Bit14,suspend */ 13511597885SJeff Kirsher unsigned short next; /* linkoffset to next RFD */ 13611597885SJeff Kirsher unsigned short rbd_offset; /* pointeroffset to RBD-buffer */ 1371409a932SJoe Perches unsigned char dest[ETH_ALEN]; /* ethernet-address, destination */ 1381409a932SJoe Perches unsigned char source[ETH_ALEN]; /* ethernet-address, source */ 13911597885SJeff Kirsher unsigned short length; /* 802.3 frame-length */ 14011597885SJeff Kirsher unsigned short zero_dummy; /* dummy */ 14111597885SJeff Kirsher }; 14211597885SJeff Kirsher 14311597885SJeff Kirsher #define RFD_LAST 0x80 /* last: last rfd in the list */ 14411597885SJeff Kirsher #define RFD_SUSP 0x40 /* last: suspend RU after */ 14511597885SJeff Kirsher #define RFD_COMPL 0x80 14611597885SJeff Kirsher #define RFD_OK 0x20 14711597885SJeff Kirsher #define RFD_BUSY 0x40 14811597885SJeff Kirsher #define RFD_ERR_LEN 0x10 /* Length error (if enabled length-checking */ 14911597885SJeff Kirsher #define RFD_ERR_CRC 0x08 /* CRC error */ 15011597885SJeff Kirsher #define RFD_ERR_ALGN 0x04 /* Alignment error */ 15111597885SJeff Kirsher #define RFD_ERR_RNR 0x02 /* status: receiver out of resources */ 15211597885SJeff Kirsher #define RFD_ERR_OVR 0x01 /* DMA Overrun! */ 15311597885SJeff Kirsher 154d2d803d1STong Zhang #define RFD_ERR_FTS 0x0080 /* Frame too short */ 15511597885SJeff Kirsher #define RFD_ERR_NEOP 0x0040 /* No EOP flag (for bitstuffing only) */ 15611597885SJeff Kirsher #define RFD_ERR_TRUN 0x0020 /* (82596 only/SF mode) indicates truncated frame */ 15711597885SJeff Kirsher #define RFD_MATCHADD 0x0002 /* status: Destinationaddress !matches IA (only 82596) */ 15811597885SJeff Kirsher #define RFD_COLLDET 0x0001 /* Detected collision during reception */ 15911597885SJeff Kirsher 16011597885SJeff Kirsher /* 16111597885SJeff Kirsher * Receive Buffer Descriptor (RBD) 16211597885SJeff Kirsher */ 16311597885SJeff Kirsher struct rbd_struct 16411597885SJeff Kirsher { 16511597885SJeff Kirsher unsigned short status; /* status word,number of used bytes in buff */ 16611597885SJeff Kirsher unsigned short next; /* pointeroffset to next RBD */ 16711597885SJeff Kirsher char *buffer; /* receive buffer address pointer */ 16811597885SJeff Kirsher unsigned short size; /* size of this buffer */ 16911597885SJeff Kirsher unsigned short zero_dummy; /* dummy */ 17011597885SJeff Kirsher }; 17111597885SJeff Kirsher 17211597885SJeff Kirsher #define RBD_LAST 0x8000 /* last buffer */ 17311597885SJeff Kirsher #define RBD_USED 0x4000 /* this buffer has data */ 17411597885SJeff Kirsher #define RBD_MASK 0x3fff /* size-mask for length */ 17511597885SJeff Kirsher 17611597885SJeff Kirsher /* 17711597885SJeff Kirsher * Statusvalues for Commands/RFD 17811597885SJeff Kirsher */ 17911597885SJeff Kirsher #define STAT_COMPL 0x8000 /* status: frame/command is complete */ 18011597885SJeff Kirsher #define STAT_BUSY 0x4000 /* status: frame/command is busy */ 18111597885SJeff Kirsher #define STAT_OK 0x2000 /* status: frame/command is ok */ 18211597885SJeff Kirsher 18311597885SJeff Kirsher /* 18411597885SJeff Kirsher * Action-Commands 18511597885SJeff Kirsher */ 18611597885SJeff Kirsher #define CMD_NOP 0x0000 /* NOP */ 18711597885SJeff Kirsher #define CMD_IASETUP 0x0001 /* initial address setup command */ 18811597885SJeff Kirsher #define CMD_CONFIGURE 0x0002 /* configure command */ 18911597885SJeff Kirsher #define CMD_MCSETUP 0x0003 /* MC setup command */ 19011597885SJeff Kirsher #define CMD_XMIT 0x0004 /* transmit command */ 19111597885SJeff Kirsher #define CMD_TDR 0x0005 /* time domain reflectometer (TDR) command */ 19211597885SJeff Kirsher #define CMD_DUMP 0x0006 /* dump command */ 19311597885SJeff Kirsher #define CMD_DIAGNOSE 0x0007 /* diagnose command */ 19411597885SJeff Kirsher 19511597885SJeff Kirsher /* 19611597885SJeff Kirsher * Action command bits 19711597885SJeff Kirsher */ 19811597885SJeff Kirsher #define CMD_LAST 0x8000 /* indicates last command in the CBL */ 19911597885SJeff Kirsher #define CMD_SUSPEND 0x4000 /* suspend CU after this CB */ 20011597885SJeff Kirsher #define CMD_INT 0x2000 /* generate interrupt after execution */ 20111597885SJeff Kirsher 20211597885SJeff Kirsher /* 20311597885SJeff Kirsher * NOP - command 20411597885SJeff Kirsher */ 20511597885SJeff Kirsher struct nop_cmd_struct 20611597885SJeff Kirsher { 20711597885SJeff Kirsher unsigned short cmd_status; /* status of this command */ 20811597885SJeff Kirsher unsigned short cmd_cmd; /* the command itself (+bits) */ 20911597885SJeff Kirsher unsigned short cmd_link; /* offsetpointer to next command */ 21011597885SJeff Kirsher }; 21111597885SJeff Kirsher 21211597885SJeff Kirsher /* 21311597885SJeff Kirsher * IA Setup command 21411597885SJeff Kirsher */ 21511597885SJeff Kirsher struct iasetup_cmd_struct 21611597885SJeff Kirsher { 21711597885SJeff Kirsher unsigned short cmd_status; 21811597885SJeff Kirsher unsigned short cmd_cmd; 21911597885SJeff Kirsher unsigned short cmd_link; 22011597885SJeff Kirsher unsigned char iaddr[6]; 22111597885SJeff Kirsher }; 22211597885SJeff Kirsher 22311597885SJeff Kirsher /* 22411597885SJeff Kirsher * Configure command 22511597885SJeff Kirsher */ 22611597885SJeff Kirsher struct configure_cmd_struct 22711597885SJeff Kirsher { 22811597885SJeff Kirsher unsigned short cmd_status; 22911597885SJeff Kirsher unsigned short cmd_cmd; 23011597885SJeff Kirsher unsigned short cmd_link; 23111597885SJeff Kirsher unsigned char byte_cnt; /* size of the config-cmd */ 23211597885SJeff Kirsher unsigned char fifo; /* fifo/recv monitor */ 23311597885SJeff Kirsher unsigned char sav_bf; /* save bad frames (bit7=1)*/ 23411597885SJeff Kirsher unsigned char adr_len; /* adr_len(0-2),al_loc(3),pream(4-5),loopbak(6-7)*/ 23511597885SJeff Kirsher unsigned char priority; /* lin_prio(0-2),exp_prio(4-6),bof_metd(7) */ 23611597885SJeff Kirsher unsigned char ifs; /* inter frame spacing */ 23711597885SJeff Kirsher unsigned char time_low; /* slot time low */ 23811597885SJeff Kirsher unsigned char time_high; /* slot time high(0-2) and max. retries(4-7) */ 23911597885SJeff Kirsher unsigned char promisc; /* promisc-mode(0) , et al (1-7) */ 24011597885SJeff Kirsher unsigned char carr_coll; /* carrier(0-3)/collision(4-7) stuff */ 24111597885SJeff Kirsher unsigned char fram_len; /* minimal frame len */ 24211597885SJeff Kirsher unsigned char dummy; /* dummy */ 24311597885SJeff Kirsher }; 24411597885SJeff Kirsher 24511597885SJeff Kirsher /* 24611597885SJeff Kirsher * Multicast Setup command 24711597885SJeff Kirsher */ 24811597885SJeff Kirsher struct mcsetup_cmd_struct 24911597885SJeff Kirsher { 25011597885SJeff Kirsher unsigned short cmd_status; 25111597885SJeff Kirsher unsigned short cmd_cmd; 25211597885SJeff Kirsher unsigned short cmd_link; 25311597885SJeff Kirsher unsigned short mc_cnt; /* number of bytes in the MC-List */ 2545224f790SGustavo A. R. Silva unsigned char mc_list[][6]; /* pointer to 6 bytes entries */ 25511597885SJeff Kirsher }; 25611597885SJeff Kirsher 25711597885SJeff Kirsher /* 25811597885SJeff Kirsher * DUMP command 25911597885SJeff Kirsher */ 26011597885SJeff Kirsher struct dump_cmd_struct 26111597885SJeff Kirsher { 26211597885SJeff Kirsher unsigned short cmd_status; 26311597885SJeff Kirsher unsigned short cmd_cmd; 26411597885SJeff Kirsher unsigned short cmd_link; 26511597885SJeff Kirsher unsigned short dump_offset; /* pointeroffset to DUMP space */ 26611597885SJeff Kirsher }; 26711597885SJeff Kirsher 26811597885SJeff Kirsher /* 26911597885SJeff Kirsher * transmit command 27011597885SJeff Kirsher */ 27111597885SJeff Kirsher struct transmit_cmd_struct 27211597885SJeff Kirsher { 27311597885SJeff Kirsher unsigned short cmd_status; 27411597885SJeff Kirsher unsigned short cmd_cmd; 27511597885SJeff Kirsher unsigned short cmd_link; 27611597885SJeff Kirsher unsigned short tbd_offset; /* pointeroffset to TBD */ 27711597885SJeff Kirsher unsigned char dest[6]; /* destination address of the frame */ 27811597885SJeff Kirsher unsigned short length; /* user defined: 802.3 length / Ether type */ 27911597885SJeff Kirsher }; 28011597885SJeff Kirsher 28111597885SJeff Kirsher #define TCMD_ERRMASK 0x0fa0 28211597885SJeff Kirsher #define TCMD_MAXCOLLMASK 0x000f 28311597885SJeff Kirsher #define TCMD_MAXCOLL 0x0020 28411597885SJeff Kirsher #define TCMD_HEARTBEAT 0x0040 28511597885SJeff Kirsher #define TCMD_DEFERRED 0x0080 28611597885SJeff Kirsher #define TCMD_UNDERRUN 0x0100 28711597885SJeff Kirsher #define TCMD_LOSTCTS 0x0200 28811597885SJeff Kirsher #define TCMD_NOCARRIER 0x0400 28911597885SJeff Kirsher #define TCMD_LATECOLL 0x0800 29011597885SJeff Kirsher 29111597885SJeff Kirsher struct tdr_cmd_struct 29211597885SJeff Kirsher { 29311597885SJeff Kirsher unsigned short cmd_status; 29411597885SJeff Kirsher unsigned short cmd_cmd; 29511597885SJeff Kirsher unsigned short cmd_link; 29611597885SJeff Kirsher unsigned short status; 29711597885SJeff Kirsher }; 29811597885SJeff Kirsher 29911597885SJeff Kirsher #define TDR_LNK_OK 0x8000 /* No link problem identified */ 30011597885SJeff Kirsher #define TDR_XCVR_PRB 0x4000 /* indicates a transceiver problem */ 30111597885SJeff Kirsher #define TDR_ET_OPN 0x2000 /* open, no correct termination */ 30211597885SJeff Kirsher #define TDR_ET_SRT 0x1000 /* TDR detected a short circuit */ 30311597885SJeff Kirsher #define TDR_TIMEMASK 0x07ff /* mask for the time field */ 30411597885SJeff Kirsher 30511597885SJeff Kirsher /* 30611597885SJeff Kirsher * Transmit Buffer Descriptor (TBD) 30711597885SJeff Kirsher */ 30811597885SJeff Kirsher struct tbd_struct 30911597885SJeff Kirsher { 31011597885SJeff Kirsher unsigned short size; /* size + EOF-Flag(15) */ 31111597885SJeff Kirsher unsigned short next; /* pointeroffset to next TBD */ 31211597885SJeff Kirsher char *buffer; /* pointer to buffer */ 31311597885SJeff Kirsher }; 31411597885SJeff Kirsher 31511597885SJeff Kirsher #define TBD_LAST 0x8000 /* EOF-Flag, indicates last buffer in list */ 31611597885SJeff Kirsher 31711597885SJeff Kirsher 31811597885SJeff Kirsher 31911597885SJeff Kirsher 320