1*cbe0a0c4SAugustin Cavalier /* 2*cbe0a0c4SAugustin Cavalier Copyright 1999, Be Incorporated. All Rights Reserved. 3*cbe0a0c4SAugustin Cavalier This file may be used under the terms of the Be Sample Code License. 4*cbe0a0c4SAugustin Cavalier */ 5*cbe0a0c4SAugustin Cavalier /* 6*cbe0a0c4SAugustin Cavalier * etherpci_private.h 7*cbe0a0c4SAugustin Cavalier * Copyright (c) 1998 Be, Inc. All Rights Reserved 8*cbe0a0c4SAugustin Cavalier * 9*cbe0a0c4SAugustin Cavalier * Definitions private to ne2000 PCI ethernet driver 10*cbe0a0c4SAugustin Cavalier * 11*cbe0a0c4SAugustin Cavalier * Modification History (most recent first): 12*cbe0a0c4SAugustin Cavalier * 13*cbe0a0c4SAugustin Cavalier * 18 May 98 malyn new today 14*cbe0a0c4SAugustin Cavalier */ 15*cbe0a0c4SAugustin Cavalier 16*cbe0a0c4SAugustin Cavalier #ifndef _ETHERPCI_PRIVATE_H 17*cbe0a0c4SAugustin Cavalier #define _ETHERPCI_PRIVATE_H 18*cbe0a0c4SAugustin Cavalier 19*cbe0a0c4SAugustin Cavalier #ifndef _KERNEL_EXPORT_H 20*cbe0a0c4SAugustin Cavalier #include <KernelExport.h> 21*cbe0a0c4SAugustin Cavalier #endif 22*cbe0a0c4SAugustin Cavalier 23*cbe0a0c4SAugustin Cavalier /* 24*cbe0a0c4SAugustin Cavalier * Wait this long before giving up on an ethernet transmit 25*cbe0a0c4SAugustin Cavalier */ 26*cbe0a0c4SAugustin Cavalier #define ETHER_TRANSMIT_TIMEOUT ((bigtime_t)1000000) /* one second */ 27*cbe0a0c4SAugustin Cavalier 28*cbe0a0c4SAugustin Cavalier #define NIRQS 128 //x hmm... 29*cbe0a0c4SAugustin Cavalier 30*cbe0a0c4SAugustin Cavalier #define MAX_MULTI 14 31*cbe0a0c4SAugustin Cavalier 32*cbe0a0c4SAugustin Cavalier #define ETHER_BUF_START_NE2000 0x4000 33*cbe0a0c4SAugustin Cavalier #define ETHER_BUF_SIZE_NE2000 0x4000 34*cbe0a0c4SAugustin Cavalier 35*cbe0a0c4SAugustin Cavalier #define ETHER_BUF_SIZE_MAX ETHER_BUF_SIZE_NE2000 36*cbe0a0c4SAugustin Cavalier 37*cbe0a0c4SAugustin Cavalier #define ETHER_MTU 1500 38*cbe0a0c4SAugustin Cavalier #define ETHER_MIN_SIZE 60 39*cbe0a0c4SAugustin Cavalier #define ETHER_MAX_SIZE 1514 40*cbe0a0c4SAugustin Cavalier #define ETHER_IRQ2 0x10 41*cbe0a0c4SAugustin Cavalier #define ETHER_IRQ3 0x20 42*cbe0a0c4SAugustin Cavalier #define ETHER_IRQ4 0x40 43*cbe0a0c4SAugustin Cavalier #define ETHER_IRQ5 0x80 44*cbe0a0c4SAugustin Cavalier 45*cbe0a0c4SAugustin Cavalier 46*cbe0a0c4SAugustin Cavalier #define ECNTRL_RESET 0x01 47*cbe0a0c4SAugustin Cavalier #define ECNTRL_ONBOARD 0x02 48*cbe0a0c4SAugustin Cavalier #define ECNTRL_SAPROM 0x04 49*cbe0a0c4SAugustin Cavalier 50*cbe0a0c4SAugustin Cavalier #define EGACFR_NORM 0x49 51*cbe0a0c4SAugustin Cavalier #define EGACFR_IRQOFF 0xc9 52*cbe0a0c4SAugustin Cavalier 53*cbe0a0c4SAugustin Cavalier #define EC_PAGE_SIZE 256 54*cbe0a0c4SAugustin Cavalier #define EC_PAGE_SHIFT 8 55*cbe0a0c4SAugustin Cavalier 56*cbe0a0c4SAugustin Cavalier #define EN_CCMD 0x0 57*cbe0a0c4SAugustin Cavalier 58*cbe0a0c4SAugustin Cavalier #define EN0_STARTPG 0x01 59*cbe0a0c4SAugustin Cavalier #define EN0_STOPPG 0x02 60*cbe0a0c4SAugustin Cavalier #define EN0_BOUNDARY 0x03 61*cbe0a0c4SAugustin Cavalier #define EN0_TPSR 0x04 62*cbe0a0c4SAugustin Cavalier #define EN0_TCNTLO 0x05 63*cbe0a0c4SAugustin Cavalier #define EN0_TCNTHI 0x06 64*cbe0a0c4SAugustin Cavalier #define EN0_ISR 0x07 65*cbe0a0c4SAugustin Cavalier #define EN0_RADDRLO 0x08 66*cbe0a0c4SAugustin Cavalier #define EN0_RADDRHI 0x09 67*cbe0a0c4SAugustin Cavalier #define EN0_RCNTLO 0x0a 68*cbe0a0c4SAugustin Cavalier #define EN0_RCNTHI 0x0b 69*cbe0a0c4SAugustin Cavalier 70*cbe0a0c4SAugustin Cavalier #define NE_DATA 0x10 71*cbe0a0c4SAugustin Cavalier #define NE_RESET 0x1f 72*cbe0a0c4SAugustin Cavalier 73*cbe0a0c4SAugustin Cavalier #define ISR_RECEIVE 0x01 74*cbe0a0c4SAugustin Cavalier #define ISR_TRANSMIT 0x02 75*cbe0a0c4SAugustin Cavalier #define ISR_RECEIVE_ERROR 0x04 76*cbe0a0c4SAugustin Cavalier #define ISR_TRANSMIT_ERROR 0x08 77*cbe0a0c4SAugustin Cavalier #define ISR_OVERWRITE 0x10 78*cbe0a0c4SAugustin Cavalier #define ISR_COUNTER 0x20 79*cbe0a0c4SAugustin Cavalier #define ISR_DMADONE 0x40 80*cbe0a0c4SAugustin Cavalier #define ISR_RESET 0x80 81*cbe0a0c4SAugustin Cavalier 82*cbe0a0c4SAugustin Cavalier #define EN0_RXCR 0xc 83*cbe0a0c4SAugustin Cavalier #define EN0_TXCR 0xd 84*cbe0a0c4SAugustin Cavalier #define EN0_DCFG 0xe 85*cbe0a0c4SAugustin Cavalier #define EN0_IMR 0xf 86*cbe0a0c4SAugustin Cavalier 87*cbe0a0c4SAugustin Cavalier #define EN0_CNTR0 0x0d 88*cbe0a0c4SAugustin Cavalier #define EN0_CNTR1 0x0e 89*cbe0a0c4SAugustin Cavalier #define EN0_CNTR2 0x0f 90*cbe0a0c4SAugustin Cavalier 91*cbe0a0c4SAugustin Cavalier #define DCFG_BM8 0x48 92*cbe0a0c4SAugustin Cavalier #define DCFG_BM16 0x49 93*cbe0a0c4SAugustin Cavalier 94*cbe0a0c4SAugustin Cavalier #define EN1_PHYS 0x1 95*cbe0a0c4SAugustin Cavalier #define EN1_CURPAG 0x7 96*cbe0a0c4SAugustin Cavalier #define EN1_MULT 0x8 97*cbe0a0c4SAugustin Cavalier 98*cbe0a0c4SAugustin Cavalier #define ENRXCR_MON 0x20 99*cbe0a0c4SAugustin Cavalier #define ENRXCR_MCST 0x08 100*cbe0a0c4SAugustin Cavalier #define ENRXCR_BCST 0x04 101*cbe0a0c4SAugustin Cavalier 102*cbe0a0c4SAugustin Cavalier #define TXCR_LOOPBACK 0x02 103*cbe0a0c4SAugustin Cavalier 104*cbe0a0c4SAugustin Cavalier #define ENC_PAGE0 0x00 105*cbe0a0c4SAugustin Cavalier #define ENC_STOP 0x01 106*cbe0a0c4SAugustin Cavalier #define ENC_START 0x02 107*cbe0a0c4SAugustin Cavalier #define ENC_TRANS 0x04 108*cbe0a0c4SAugustin Cavalier #define ENC_DMAREAD 0x08 109*cbe0a0c4SAugustin Cavalier #define ENC_DMAWRITE 0x10 110*cbe0a0c4SAugustin Cavalier #define ENC_NODMA 0x20 111*cbe0a0c4SAugustin Cavalier #define ENC_PAGE1 0x40 112*cbe0a0c4SAugustin Cavalier 113*cbe0a0c4SAugustin Cavalier 114*cbe0a0c4SAugustin Cavalier #define RSR_INTACT 0x01 115*cbe0a0c4SAugustin Cavalier 116*cbe0a0c4SAugustin Cavalier #define TSR_ABORTED 0x08 117*cbe0a0c4SAugustin Cavalier #define TSR_UNDERRUN 0x20 118*cbe0a0c4SAugustin Cavalier #define TSR_HEARTBEAT 0x40 119*cbe0a0c4SAugustin Cavalier 120*cbe0a0c4SAugustin Cavalier #define ETHER_ADDR_LEN 6 121*cbe0a0c4SAugustin Cavalier 122*cbe0a0c4SAugustin Cavalier /* 123*cbe0a0c4SAugustin Cavalier * Maximum iterations to poll before assuming error 124*cbe0a0c4SAugustin Cavalier */ 125*cbe0a0c4SAugustin Cavalier #define MAXWAIT 10000 126*cbe0a0c4SAugustin Cavalier 127*cbe0a0c4SAugustin Cavalier 128*cbe0a0c4SAugustin Cavalier /* 129*cbe0a0c4SAugustin Cavalier * Swap the bytes in a short, but not on a little-endian machine 130*cbe0a0c4SAugustin Cavalier */ 131*cbe0a0c4SAugustin Cavalier static const union { long l; char b[4]; } ENDIAN_TEST = { 1 }; 132*cbe0a0c4SAugustin Cavalier #define LITTLE_ENDIAN ENDIAN_TEST.b[0] 133*cbe0a0c4SAugustin Cavalier #define SWAPSHORT(x) (((x & 0xff) << 8) | ((x >> 8) & 0xff)) 134*cbe0a0c4SAugustin Cavalier #define swapshort(x) (LITTLE_ENDIAN ? (x) : SWAPSHORT(x)) 135*cbe0a0c4SAugustin Cavalier 136*cbe0a0c4SAugustin Cavalier 137*cbe0a0c4SAugustin Cavalier /* 138*cbe0a0c4SAugustin Cavalier * NS8390 ring header structure 139*cbe0a0c4SAugustin Cavalier */ 140*cbe0a0c4SAugustin Cavalier typedef struct ring_header { 141*cbe0a0c4SAugustin Cavalier unsigned char status; 142*cbe0a0c4SAugustin Cavalier unsigned char next_packet; 143*cbe0a0c4SAugustin Cavalier unsigned short count; 144*cbe0a0c4SAugustin Cavalier } ring_header; 145*cbe0a0c4SAugustin Cavalier 146*cbe0a0c4SAugustin Cavalier #endif 147