/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Charles M. Hannum and Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 THE FOUNDATION 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.
*/
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell and Rick Macklem.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University 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 REGENTS 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 THE REGENTS 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.
*
* @(#)if_lereg.h 8.1 (Berkeley) 6/10/93
*/
/*
* Register description for the following Advanced Micro Devices
* Ethernet chips:
*
* - Am7990 Local Area Network Controller for Ethernet (LANCE)
* (and its descendent Am79c90 C-LANCE).
*
* - Am79c900 Integrated Local Area Communications Controller (ILACC)
*
* - Am79c960 PCnet-ISA Single-Chip Ethernet Controller for ISA
*
* - Am79c961 PCnet-ISA+ Jumperless Single-Chip Ethernet Controller
* for ISA
*
* - Am79c961A PCnet-ISA II Jumperless Full-Duplex Single-Chip
* Ethernet Controller for ISA
*
* - Am79c965A PCnet-32 Single-Chip 32-bit Ethernet Controller
* (for VESA and 486 local busses)
*
* - Am79c970 PCnet-PCI Single-Chip Ethernet Controller for PCI
* Local Bus
*
* - Am79c970A PCnet-PCI II Single-Chip Full-Duplex Ethernet Controller
* for PCI Local Bus
*
* - Am79c971 PCnet-FAST Single-Chip Full-Duplex 10/100Mbps
* Ethernet Controller for PCI Local Bus
*
* - Am79c972 PCnet-FAST+ Enhanced 10/100Mbps PCI Ethernet Controller
* with OnNow Support
*
* - Am79c973/Am79c975 PCnet-FAST III Single-Chip 10/100Mbps PCI
* Ethernet Controller with Integrated PHY
*
* - Am79c978 PCnet-Home Single-Chip 1/10 Mbps PCI Home
* Networking Controller.
*
* Initialization block, transmit descriptor, and receive descriptor
* formats are described in two separate files:
*
* 16-bit software model (LANCE) am7990reg.h
*
* 32-bit software model (ILACC) am79900reg.h
*
* Note that the vast majority of the registers described in this file
* belong to follow-on chips to the original LANCE. Only CSR0-CSR3 are
* valid on the LANCE.
*/
#define LEBLEN 1536 /* ETHERMTU + header + CRC */
#define LEMINSIZE 60 /* should be 64 if mode DTCR is set */
/*
* The byte count fields in descriptors are in two's complement.
* This macro does the conversion for us on unsigned numbers.
*/
#define LE_BCNT(x) (~(x) + 1)
/*
* Control and Status Register addresses
*/
#define LE_CSR0 0x0000 /* Control and status register */
#define LE_CSR1 0x0001 /* low address of init block */
#define LE_CSR2 0x0002 /* high address of init block */
#define LE_CSR3 0x0003 /* Bus master and control */
#define LE_CSR4 0x0004 /* Test and features control */
#define LE_CSR5 0x0005 /* Extended control and Interrupt 1 */
#define LE_CSR6 0x0006 /* Rx/Tx Descriptor table length */
#define LE_CSR7 0x0007 /* Extended control and interrupt 2 */
#define LE_CSR8 0x0008 /* Logical Address Filter 0 */
#define LE_CSR9 0x0009 /* Logical Address Filter 1 */
#define LE_CSR10 0x000a /* Logical Address Filter 2 */
#define LE_CSR11 0x000b /* Logical Address Filter 3 */
#define LE_CSR12 0x000c /* Physical Address 0 */
#define LE_CSR13 0x000d /* Physical Address 1 */
#define LE_CSR14 0x000e /* Physical Address 2 */
#define LE_CSR15 0x000f /* Mode */
#define LE_CSR16 0x0010 /* Initialization Block addr lower */
#define LE_CSR17 0x0011 /* Initialization Block addr upper */
#define LE_CSR18 0x0012 /* Current Rx Buffer addr lower */
#define LE_CSR19 0x0013 /* Current Rx Buffer addr upper */
#define LE_CSR20 0x0014 /* Current Tx Buffer addr lower */
#define LE_CSR21 0x0015 /* Current Tx Buffer addr upper */
#define LE_CSR22 0x0016 /* Next Rx Buffer addr lower */
#define LE_CSR23 0x0017 /* Next Rx Buffer addr upper */
#define LE_CSR24 0x0018 /* Base addr of Rx ring lower */
#define LE_CSR25 0x0019 /* Base addr of Rx ring upper */
#define LE_CSR26 0x001a /* Next Rx Desc addr lower */
#define LE_CSR27 0x001b /* Next Rx Desc addr upper */
#define LE_CSR28 0x001c /* Current Rx Desc addr lower */
#define LE_CSR29 0x001d /* Current Rx Desc addr upper */
#define LE_CSR30 0x001e /* Base addr of Tx ring lower */
#define LE_CSR31 0x001f /* Base addr of Tx ring upper */
#define LE_CSR32 0x0020 /* Next Tx Desc addr lower */
#define LE_CSR33 0x0021 /* Next Tx Desc addr upper */
#define LE_CSR34 0x0022 /* Current Tx Desc addr lower */
#define LE_CSR35 0x0023 /* Current Tx Desc addr upper */
#define LE_CSR36 0x0024 /* Next Next Rx Desc addr lower */
#define LE_CSR37 0x0025 /* Next Next Rx Desc addr upper */
#define LE_CSR38 0x0026 /* Next Next Tx Desc addr lower */
#define LE_CSR39 0x0027 /* Next Next Tx Desc addr upper */
#define LE_CSR40 0x0028 /* Current Rx Byte Count */
#define LE_CSR41 0x0029 /* Current Rx Status */
#define LE_CSR42 0x002a /* Current Tx Byte Count */
#define LE_CSR43 0x002b /* Current Tx Status */
#define LE_CSR44 0x002c /* Next Rx Byte Count */
#define LE_CSR45 0x002d /* Next Rx Status */
#define LE_CSR46 0x002e /* Tx Poll Time Counter */
#define LE_CSR47 0x002f /* Tx Polling Interval */
#define LE_CSR48 0x0030 /* Rx Poll Time Counter */
#define LE_CSR49 0x0031 /* Rx Polling Interval */
#define LE_CSR58 0x003a /* Software Style */
#define LE_CSR60 0x003c /* Previous Tx Desc addr lower */
#define LE_CSR61 0x003d /* Previous Tx Desc addr upper */
#define LE_CSR62 0x003e /* Previous Tx Byte Count */
#define LE_CSR63 0x003f /* Previous Tx Status */
#define LE_CSR64 0x0040 /* Next Tx Buffer addr lower */
#define LE_CSR65 0x0041 /* Next Tx Buffer addr upper */
#define LE_CSR66 0x0042 /* Next Tx Byte Count */
#define LE_CSR67 0x0043 /* Next Tx Status */
#define LE_CSR72 0x0048 /* Receive Ring Counter */
#define LE_CSR74 0x004a /* Transmit Ring Counter */
#define LE_CSR76 0x004c /* Receive Ring Length */
#define LE_CSR78 0x004e /* Transmit Ring Length */
#define LE_CSR80 0x0050 /* DMA Transfer Counter and FIFO
Threshold Control */
#define LE_CSR82 0x0052 /* Tx Desc addr Pointer lower */
#define LE_CSR84 0x0054 /* DMA addr register lower */
#define LE_CSR85 0x0055 /* DMA addr register upper */
#define LE_CSR86 0x0056 /* Buffer Byte Counter */
#define LE_CSR88 0x0058 /* Chip ID Register lower */
#define LE_CSR89 0x0059 /* Chip ID Register upper */
#define LE_CSR92 0x005c /* Ring Length Conversion */
#define LE_CSR100 0x0064 /* Bus Timeout */
#define LE_CSR112 0x0070 /* Missed Frame Count */
#define LE_CSR114 0x0072 /* Receive Collision Count */
#define LE_CSR116 0x0074 /* OnNow Power Mode Register */
#define LE_CSR122 0x007a /* Advanced Feature Control */
#define LE_CSR124 0x007c /* Test Register 1 */
#define LE_CSR125 0x007d /* MAC Enhanced Configuration Control */
/*
* Bus Configuration Register addresses
*/
#define LE_BCR0 0x0000 /* Master Mode Read Active */
#define LE_BCR1 0x0001 /* Master Mode Write Active */
#define LE_BCR2 0x0002 /* Misc. Configuration */
#define LE_BCR4 0x0004 /* LED0 Status */
#define LE_BCR5 0x0005 /* LED1 Status */
#define LE_BCR6 0x0006 /* LED2 Status */
#define LE_BCR7 0x0007 /* LED3 Status */
#define LE_BCR9 0x0009 /* Full-duplex Control */
#define LE_BCR16 0x0010 /* I/O Base Address lower */
#define LE_BCR17 0x0011 /* I/O Base Address upper */
#define LE_BCR18 0x0012 /* Burst and Bus Control Register */
#define LE_BCR19 0x0013 /* EEPROM Control and Status */
#define LE_BCR20 0x0014 /* Software Style */
#define LE_BCR22 0x0016 /* PCI Latency Register */
#define LE_BCR23 0x0017 /* PCI Subsystem Vendor ID */
#define LE_BCR24 0x0018 /* PCI Subsystem ID */
#define LE_BCR25 0x0019 /* SRAM Size Register */
#define LE_BCR26 0x001a /* SRAM Boundary Register */
#define LE_BCR27 0x001b /* SRAM Interface Control Register */
#define LE_BCR28 0x001c /* Exp. Bus Port Addr lower */
#define LE_BCR29 0x001d /* Exp. Bus Port Addr upper */
#define LE_BCR30 0x001e /* Exp. Bus Data Port */
#define LE_BCR31 0x001f /* Software Timer Register */
#define LE_BCR32 0x0020 /* PHY Control and Status Register */
#define LE_BCR33 0x0021 /* PHY Address Register */
#define LE_BCR34 0x0022 /* PHY Management Data Register */
#define LE_BCR35 0x0023 /* PCI Vendor ID Register */
#define LE_BCR36 0x0024 /* PCI Power Management Cap. Alias */
#define LE_BCR37 0x0025 /* PCI DATA0 Alias */
#define LE_BCR38 0x0026 /* PCI DATA1 Alias */
#define LE_BCR39 0x0027 /* PCI DATA2 Alias */
#define LE_BCR40 0x0028 /* PCI DATA3 Alias */
#define LE_BCR41 0x0029 /* PCI DATA4 Alias */
#define LE_BCR42 0x002a /* PCI DATA5 Alias */
#define LE_BCR43 0x002b /* PCI DATA6 Alias */
#define LE_BCR44 0x002c /* PCI DATA7 Alias */
#define LE_BCR45 0x002d /* OnNow Pattern Matching 1 */
#define LE_BCR46 0x002e /* OnNow Pattern Matching 2 */
#define LE_BCR47 0x002f /* OnNow Pattern Matching 3 */
#define LE_BCR48 0x0030 /* LED4 Status */
#define LE_BCR49 0x0031 /* PHY Select */
/* control and status register 122 (csr122) */
#define LE_C122_RCVALGN 0x0001 /* receive packet align */
/* control and status register 124 (csr124) */
#define LE_C124_RPA 0x0008 /* runt packet accept */
/* control and status register 125 (csr125) */
#define LE_C125_IPG 0xff00 /* inter-packet gap */
#define LE_C125_IFS1 0x00ff /* inter-frame spacing part 1 */