11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds Written 1994 by David C. Davies. 31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds Copyright 1994 David C. Davies. This software may be used and distributed 51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds according to the terms of the GNU General Public License, incorporated herein by 61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds reference. 71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds** I/O addresses. Note that the 2k buffer option is not supported in 111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds** this driver. 121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_NICSR ioaddr+0x00 /* Network interface CSR */ 141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_RBI ioaddr+0x02 /* RAM buffer index (2k buffer mode) */ 151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_DATA ioaddr+0x04 /* LANCE registers' data port */ 161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_ADDR ioaddr+0x06 /* LANCE registers' address port */ 171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_HBASE ioaddr+0x08 /* EISA high memory base address reg. */ 181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_PROM ioaddr+0x0c /* Ethernet address ROM data port */ 191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_CNFG ioaddr+0x0c /* EISA Configuration port */ 201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_RBSA ioaddr+0x0e /* RAM buffer starting address (2k buff.) */ 211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 236aa20a2235535605db6d6d2bd850298b2fe7f31eJeff Garzik** These are LANCE registers addressable through DEPCA_ADDR 241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CSR0 0 261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CSR1 1 271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CSR2 2 281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CSR3 3 291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 306aa20a2235535605db6d6d2bd850298b2fe7f31eJeff Garzik/* 316aa20a2235535605db6d6d2bd850298b2fe7f31eJeff Garzik** NETWORK INTERFACE CSR (NI_CSR) bit definitions 321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 336aa20a2235535605db6d6d2bd850298b2fe7f31eJeff Garzik 341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TO 0x0100 /* Time Out for remote boot */ 351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SHE 0x0080 /* SHadow memory Enable */ 361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BS 0x0040 /* Bank Select */ 371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BUF 0x0020 /* BUFfer size (1->32k, 0->64k) */ 381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RBE 0x0010 /* Remote Boot Enable (1->net boot) */ 391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define AAC 0x0008 /* Address ROM Address Counter (1->enable) */ 401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _128KB 0x0008 /* 128kB Network RAM (1->enable) */ 411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IM 0x0004 /* Interrupt Mask (1->mask) */ 421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IEN 0x0002 /* Interrupt tristate ENable (1->enable) */ 431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LED 0x0001 /* LED control */ 441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 456aa20a2235535605db6d6d2bd850298b2fe7f31eJeff Garzik/* 466aa20a2235535605db6d6d2bd850298b2fe7f31eJeff Garzik** Control and Status Register 0 (CSR0) bit definitions 471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ERR 0x8000 /* Error summary */ 501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BABL 0x4000 /* Babble transmitter timeout error */ 511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CERR 0x2000 /* Collision Error */ 521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define MISS 0x1000 /* Missed packet */ 531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define MERR 0x0800 /* Memory Error */ 541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RINT 0x0400 /* Receiver Interrupt */ 551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TINT 0x0200 /* Transmit Interrupt */ 561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IDON 0x0100 /* Initialization Done */ 571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define INTR 0x0080 /* Interrupt Flag */ 581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define INEA 0x0040 /* Interrupt Enable */ 591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RXON 0x0020 /* Receiver on */ 601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TXON 0x0010 /* Transmitter on */ 611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TDMD 0x0008 /* Transmit Demand */ 621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define STOP 0x0004 /* Stop */ 631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define STRT 0x0002 /* Start */ 641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define INIT 0x0001 /* Initialize */ 651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define INTM 0xff00 /* Interrupt Mask */ 661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define INTE 0xfff0 /* Interrupt Enable */ 671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds** CONTROL AND STATUS REGISTER 3 (CSR3) 701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BSWP 0x0004 /* Byte SWaP */ 731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ACON 0x0002 /* ALE control */ 741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BCON 0x0001 /* Byte CONtrol */ 751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 776aa20a2235535605db6d6d2bd850298b2fe7f31eJeff Garzik** Initialization Block Mode Register 781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define PROM 0x8000 /* Promiscuous Mode */ 811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define EMBA 0x0080 /* Enable Modified Back-off Algorithm */ 821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define INTL 0x0040 /* Internal Loopback */ 831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DRTY 0x0020 /* Disable Retry */ 841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define COLL 0x0010 /* Force Collision */ 851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DTCR 0x0008 /* Disable Transmit CRC */ 861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOOP 0x0004 /* Loopback */ 871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DTX 0x0002 /* Disable the Transmitter */ 881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DRX 0x0001 /* Disable the Receiver */ 891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 916aa20a2235535605db6d6d2bd850298b2fe7f31eJeff Garzik** Receive Message Descriptor 1 (RMD1) bit definitions. 921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R_OWN 0x80000000 /* Owner bit 0 = host, 1 = lance */ 951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R_ERR 0x4000 /* Error Summary */ 961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R_FRAM 0x2000 /* Framing Error */ 971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R_OFLO 0x1000 /* Overflow Error */ 981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R_CRC 0x0800 /* CRC Error */ 991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R_BUFF 0x0400 /* Buffer Error */ 1001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R_STP 0x0200 /* Start of Packet */ 1011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R_ENP 0x0100 /* End of Packet */ 1021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 1046aa20a2235535605db6d6d2bd850298b2fe7f31eJeff Garzik** Transmit Message Descriptor 1 (TMD1) bit definitions. 1051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 1061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define T_OWN 0x80000000 /* Owner bit 0 = host, 1 = lance */ 1081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define T_ERR 0x4000 /* Error Summary */ 1091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define T_ADD_FCS 0x2000 /* More the 1 retry needed to Xmit */ 1101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define T_MORE 0x1000 /* >1 retry to transmit packet */ 1111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define T_ONE 0x0800 /* 1 try needed to transmit the packet */ 1121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define T_DEF 0x0400 /* Deferred */ 1131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define T_STP 0x02000000 /* Start of Packet */ 1141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define T_ENP 0x01000000 /* End of Packet */ 1151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define T_FLAGS 0xff000000 /* TX Flags Field */ 1161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 1181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds** Transmit Message Descriptor 3 (TMD3) bit definitions. 1191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 1201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TMD3_BUFF 0x8000 /* BUFFer error */ 1221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TMD3_UFLO 0x4000 /* UnderFLOw error */ 1231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TMD3_RES 0x2000 /* REServed */ 1241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TMD3_LCOL 0x1000 /* Late COLlision */ 1251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TMD3_LCAR 0x0800 /* Loss of CARrier */ 1261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TMD3_RTRY 0x0400 /* ReTRY error */ 1271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1286aa20a2235535605db6d6d2bd850298b2fe7f31eJeff Garzik/* 1296aa20a2235535605db6d6d2bd850298b2fe7f31eJeff Garzik** EISA configuration Register (CNFG) bit definitions 1301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 1316aa20a2235535605db6d6d2bd850298b2fe7f31eJeff Garzik 1321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TIMEOUT 0x0100 /* 0:2.5 mins, 1: 30 secs */ 1331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define REMOTE 0x0080 /* Remote Boot Enable -> 1 */ 1341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IRQ11 0x0040 /* Enable -> 1 */ 1351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IRQ10 0x0020 /* Enable -> 1 */ 1361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IRQ9 0x0010 /* Enable -> 1 */ 1371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IRQ5 0x0008 /* Enable -> 1 */ 1381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BUFF 0x0004 /* 0: 64kB or 128kB, 1: 32kB */ 1391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define PADR16 0x0002 /* RAM on 64kB boundary */ 1401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define PADR17 0x0001 /* RAM on 128kB boundary */ 1411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 1431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds** Miscellaneous 1441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 1451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define HASH_TABLE_LEN 64 /* Bits */ 1461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define HASH_BITS 0x003f /* 6 LS bits */ 1471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define MASK_INTERRUPTS 1 1491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define UNMASK_INTERRUPTS 0 1501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define EISA_EN 0x0001 /* Enable EISA bus buffers */ 1521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define EISA_ID iobase+0x0080 /* ID long word for EISA card */ 1531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define EISA_CTRL iobase+0x0084 /* Control word for EISA card */ 1541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 1561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds** Include the IOCTL stuff 1571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 1581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/sockios.h> 1591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct depca_ioctl { 1611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned short cmd; /* Command to run */ 1621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned short len; /* Length of the data buffer */ 1631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned char __user *data; /* Pointer to the data buffer */ 1641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1666aa20a2235535605db6d6d2bd850298b2fe7f31eJeff Garzik/* 1676aa20a2235535605db6d6d2bd850298b2fe7f31eJeff Garzik** Recognised commands for the driver 1681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 1691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_GET_HWADDR 0x01 /* Get the hardware address */ 1701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_SET_HWADDR 0x02 /* Get the hardware address */ 1711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_SET_PROM 0x03 /* Set Promiscuous Mode */ 1721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_CLR_PROM 0x04 /* Clear Promiscuous Mode */ 1731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_SAY_BOO 0x05 /* Say "Boo!" to the kernel log file */ 1741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_GET_MCA 0x06 /* Get a multicast address */ 1751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_SET_MCA 0x07 /* Set a multicast address */ 1761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_CLR_MCA 0x08 /* Clear a multicast address */ 1771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_MCA_EN 0x09 /* Enable a multicast address group */ 1781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_GET_STATS 0x0a /* Get the driver statistics */ 1791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_CLR_STATS 0x0b /* Zero out the driver statistics */ 1801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_GET_REG 0x0c /* Get the Register contents */ 1811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_SET_REG 0x0d /* Set the Register contents */ 1821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DEPCA_DUMP 0x0f /* Dump the DEPCA Status */ 1831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 184