11.3Sandvar/*	$NetBSD: am79c950reg.h,v 1.3 2025/06/25 08:03:14 andvar Exp $	*/
21.1Stsubai
31.1Stsubai/*-
41.1Stsubai * Copyright (c) 1997 David Huang <khym@bga.com>
51.1Stsubai * All rights reserved.
61.1Stsubai *
71.1Stsubai * Redistribution and use in source and binary forms, with or without
81.1Stsubai * modification, are permitted provided that the following conditions
91.1Stsubai * are met:
101.1Stsubai * 1. Redistributions of source code must retain the above copyright
111.1Stsubai *    notice, this list of conditions and the following disclaimer.
121.1Stsubai * 2. The name of the author may not be used to endorse or promote products
131.1Stsubai *    derived from this software without specific prior written permission
141.1Stsubai *
151.1Stsubai * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
161.1Stsubai * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
171.1Stsubai * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
181.1Stsubai * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
191.1Stsubai * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
201.1Stsubai * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
211.1Stsubai * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
221.1Stsubai * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
231.1Stsubai * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
241.1Stsubai * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
251.1Stsubai *
261.1Stsubai */
271.1Stsubai
281.1Stsubai/*
291.1Stsubai * AMD MACE (Am79C940) register definitions
301.1Stsubai */
311.1Stsubai#define	MACE_RCVFIFO	0   /* Receive FIFO [15-00] (read only) */
321.1Stsubai#define	MACE_XMTFIFO	1   /* Transmit FIFO [15-00] (write only) */
331.1Stsubai#define	MACE_XMTFC	2   /* Transmit Frame Control (read/write) */
341.1Stsubai#define	MACE_XMTFS	3   /* Transmit Frame Status (read only) */
351.1Stsubai#define	MACE_XMTRC	4   /* Transmit Retry Count (read only) */
361.1Stsubai#define	MACE_RCVFC	5   /* Receive Frame Control (read/write) */
371.1Stsubai#define	MACE_RCVFS	6   /* Receive Frame Status (4 bytes) (read only) */
381.1Stsubai#define	MACE_FIFOFC	7   /* FIFO Frame Count (read only) */
391.1Stsubai#define	MACE_IR		8   /* Interrupt Register (read only) */
401.1Stsubai#define	MACE_IMR	9   /* Interrupt Mask Register (read/write) */
411.1Stsubai#define	MACE_PR		10  /* Poll Register (read only) */
421.1Stsubai#define	MACE_BIUCC	11  /* BIU Configuration Control (read/write) */
431.1Stsubai#define	MACE_FIFOCC	12  /* FIFO Configuration Control (read/write) */
441.1Stsubai#define	MACE_MACCC	13  /* MAC Configuration Control (read/write) */
451.1Stsubai#define	MACE_PLSCC	14  /* PLS Configuration Control (read/write) */
461.3Sandvar#define	MACE_PHYCC	15  /* PHY Configuration Control (read/write) */
471.1Stsubai#define	MACE_CHIPIDL	16  /* Chip ID Register [07-00] (read only) */
481.1Stsubai#define	MACE_CHIPIDH	17  /* Chip ID Register [15-08] (read only) */
491.1Stsubai#define	MACE_IAC	18  /* Internal Address Configuration (read/write) */
501.1Stsubai/*	RESERVED	19     Reserved (read/write as 0) */
511.1Stsubai#define	MACE_LADRF	20  /* Logical Address Filter (8 bytes) (read/write) */
521.1Stsubai#define	MACE_PADR	21  /* Physical Address (6 bytes) (read/write) */
531.1Stsubai/*	RESERVED	22     Reserved (read/write as 0) */
541.1Stsubai/*	RESERVED	23     Reserved (read/write as 0) */
551.1Stsubai#define	MACE_MPC	24  /* Missed Packet Count (read only) */
561.1Stsubai/*	RESERVED	25     Reserved (read/write as 0) */
571.1Stsubai#define	MACE_RNTPC	26  /* Runt Packet Count (read only) */
581.1Stsubai#define	MACE_RCVCC	27  /* Receive Collision Count (read only) */
591.1Stsubai/*	RESERVED	28     Reserved (read/write as 0) */
601.1Stsubai#define	MACE_UTR	29  /* User Test Register (read/write) */
611.1Stsubai#define	MACE_RTR1	30  /* Reserved Test Register 1 (read/write as 0) */
621.1Stsubai#define	MACE_RTR2	31  /* Reserved Test Register 2 (read/write as 0) */
631.1Stsubai
641.1Stsubai#define	MACE_NREGS	32
651.1Stsubai
661.1Stsubai/* 2: Transmit Frame Control (XMTFC) */
671.1Stsubai#define	DRTRY		0x80	/* Disable Retry */
681.1Stsubai#define	DXMTFCS		0x08	/* Disable Transmit FCS */
691.1Stsubai#define	APADXMT		0x01	/* Auto Pad Transmit */
701.1Stsubai
711.1Stsubai/* 3: Transmit Frame Status (XMTFS) */
721.1Stsubai#define	XMTSV		0x80	/* Transmit Status Valid */
731.1Stsubai#define	UFLO		0x40	/* Underflow */
741.1Stsubai#define	LCOL		0x20	/* Late Collision */
751.1Stsubai#define	MORE		0x10	/* More than one retry needed */
761.1Stsubai#define	ONE		0x08	/* Exactly one retry needed */
771.1Stsubai#define	DEFER		0x04	/* Transmission deferred */
781.1Stsubai#define	LCAR		0x02	/* Loss of Carrier */
791.1Stsubai#define	RTRY		0x01	/* Retry Error */
801.1Stsubai
811.1Stsubai/* 4: Transmit Retry Count (XMTRC) */
821.1Stsubai#define	EXDEF		0x80	/* Excessive Defer */
831.1Stsubai#define	XMTRC		0x0f	/* Transmit Retry Count */
841.1Stsubai
851.1Stsubai/* 5: Receive Frame Control (RCVFC) */
861.1Stsubai#define	LLRCV		0x08	/* Low Latency Receive */
871.1Stsubai#define	MR		0x04	/* Match/Reject */
881.1Stsubai#define	ASTRPRCV	0x01	/* Auto Strip Receive */
891.1Stsubai
901.1Stsubai/* 6: Receive Frame Status (RCVFS) */
911.1Stsubai/* 4 byte register; read 4 times to get all of the bytes */
921.1Stsubai/* Read 1: RFS0 - Receive Message Byte Count [7-0] (RCVCNT) */
931.1Stsubai
941.1Stsubai/* Read 2: RFS1 - Receive Status (RCVSTS) */
951.1Stsubai#define	OFLO		0x80	/* Overflow flag */
961.1Stsubai#define	CLSN		0x40	/* Collision flag */
971.1Stsubai#define	FRAM		0x20	/* Framing Error flag */
981.1Stsubai#define	FCS		0x10	/* FCS Error flag */
991.1Stsubai#define	RCVCNT		0x0f	/* Receive Message Byte Count [11-8] */
1001.1Stsubai
1011.1Stsubai/* Read 3: RFS2 - Runt Packet Count (RNTPC) [7-0] */
1021.1Stsubai
1031.1Stsubai/* Read 4: RFS3 - Receive Collision Count (RCVCC) [7-0] */
1041.1Stsubai
1051.1Stsubai/* 7: FIFO Frame Count (FIFOFC) */
1061.1Stsubai#define	RCVFC		0xf0	/* Receive Frame Count */
1071.1Stsubai#define	XMTFC		0x0f	/* Transmit Frame Count */
1081.1Stsubai
1091.1Stsubai/* 8: Interrupt Register (IR) */
1101.1Stsubai#define	JAB		0x80	/* Jabber Error */
1111.1Stsubai#define	BABL		0x40	/* Babble Error */
1121.1Stsubai#define	CERR		0x20	/* Collision Error */
1131.1Stsubai#define	RCVCCO		0x10	/* Receive Collision Count Overflow */
1141.1Stsubai#define	RNTPCO		0x08	/* Runt Packet Count Overflow */
1151.1Stsubai#define	MPCO		0x04	/* Missed Packet Count Overflow */
1161.1Stsubai#define	RCVINT		0x02	/* Receive Interrupt */
1171.1Stsubai#define	XMTINT		0x01	/* Transmit Interrupt */
1181.1Stsubai
1191.2Sandvar/* 9: Interrupt Mask Register (IMR) */
1201.1Stsubai#define	JABM		0x80	/* Jabber Error Mask */
1211.1Stsubai#define	BABLM		0x40	/* Babble Error Mask */
1221.1Stsubai#define	CERRM		0x20	/* Collision Error Mask */
1231.1Stsubai#define	RCVCCOM		0x10	/* Receive Collision Count Overflow Mask */
1241.1Stsubai#define	RNTPCOM		0x08	/* Runt Packet Count Overflow Mask */
1251.1Stsubai#define	MPCOM		0x04	/* Missed Packet Count Overflow Mask */
1261.1Stsubai#define	RCVINTM		0x02	/* Receive Interrupt Mask */
1271.1Stsubai#define	XMTINTM		0x01	/* Transmit Interrupt Mask */
1281.1Stsubai
1291.1Stsubai/* 10: Poll Register (PR) */
1301.1Stsubai#define	XMTSV		0x80	/* Transmit Status Valid */
1311.1Stsubai#define	TDTREQ		0x40	/* Transmit Data Transfer Request */
1321.1Stsubai#define	RDTREQ		0x20	/* Receive Data Transfer Request */
1331.1Stsubai
1341.1Stsubai/* 11: BIU Configuration Control (BIUCC) */
1351.1Stsubai#define	BSWP		0x40	/* Byte Swap */
1361.1Stsubai#define	XMTSP		0x30	/* Transmit Start Point */
1371.1Stsubai#define	XMTSP_4		0x00	/* 4 bytes */
1381.1Stsubai#define	XMTSP_16	0x10	/* 16 bytes */
1391.1Stsubai#define	XMTSP_64	0x20	/* 64 bytes */
1401.1Stsubai#define	XMTSP_112	0x30	/* 112 bytes */
1411.1Stsubai#define	SWRST		0x01	/* Software Reset */
1421.1Stsubai
1431.1Stsubai/* 12: FIFO Configuration Control (FIFOCC) */
1441.1Stsubai#define	XMTFW		0xc0	/* Transmit FIFO Watermark */
1451.1Stsubai#define	XMTFW_8		0x00	/* 8 write cycles */
1461.1Stsubai#define	XMTFW_16	0x40	/* 16 write cycles */
1471.1Stsubai#define	XMTFW_32	0x80	/* 32 write cycles */
1481.1Stsubai#define	RCVFW		0x30	/* Receive FIFO Watermark */
1491.1Stsubai#define	RCVFW_16	0x00	/* 16 bytes */
1501.1Stsubai#define	RCVFW_32	0x10	/* 32 bytes */
1511.1Stsubai#define	RCVFW_64	0x20	/* 64 bytes */
1521.1Stsubai#define	XMTFWU		0x08	/* Transmit FIFO Watermark Update */
1531.1Stsubai#define	RCVFWU		0x04	/* Receive FIFO Watermark Update */
1541.1Stsubai#define	XMTBRST		0x02	/* Transmit Burst */
1551.1Stsubai#define	RCVBRST		0x01	/* Receive Burst */
1561.1Stsubai
1571.1Stsubai/* 13: MAC Configuration (MACCC) */
1581.1Stsubai#define	PROM		0x80	/* Promiscuous */
1591.1Stsubai#define	DXMT2PD		0x40	/* Disable Transmit Two Part Deferral */
1601.1Stsubai#define	EMBA		0x20	/* Enable Modified Back-off Algorithm */
1611.1Stsubai#define	DRCVPA		0x08	/* Disable Receive Physical Address */
1621.1Stsubai#define	DRCVBC		0x04	/* Disable Receive Broadcast */
1631.1Stsubai#define	ENXMT		0x02	/* Enable Transmit */
1641.1Stsubai#define	ENRCV		0x01	/* Enable Receive */
1651.1Stsubai
1661.1Stsubai/* 14: PLS Configuration Control (PLSCC) */
1671.1Stsubai#define	XMTSEL		0x08	/* Transmit Mode Select */
1681.1Stsubai#define	PORTSEL		0x06	/* Port Select */
1691.1Stsubai#define	PORTSEL_AUI	0x00	/* Select AUI */
1701.1Stsubai#define	PORTSEL_10BT	0x02	/* Select 10BASE-T */
1711.1Stsubai#define	PORTSEL_DAI	0x04	/* Select DAI port */
1721.1Stsubai#define	PORTSEL_GPSI	0x06	/* Select GPSI */
1731.1Stsubai#define	ENPLSIO		0x01	/* Enable PLS I/O */
1741.1Stsubai
1751.1Stsubai/* 15: PHY Configuration (PHYCC) */
1761.1Stsubai#define	LNKFL		0x80	/* Link Fail */
1771.1Stsubai#define	DLNKTST		0x40	/* Disable Link Test */
1781.1Stsubai#define	REVPOL		0x20	/* Reversed Polarity */
1791.1Stsubai#define	DAPC		0x10	/* Disable Auto Polarity Correction */
1801.1Stsubai#define	LRT		0x08	/* Low Receive Threshold */
1811.1Stsubai#define	ASEL		0x04	/* Auto Select */
1821.1Stsubai#define	RWAKE		0x02	/* Remote Wake */
1831.1Stsubai#define	AWAKE		0x01	/* Auto Wake */
1841.1Stsubai
1851.1Stsubai/* 18: Internal Address Configuration (IAC) */
1861.1Stsubai#define	ADDRCHG		0x80	/* Address Change */
1871.1Stsubai#define	PHYADDR		0x04	/* Physical Address Reset */
1881.1Stsubai#define	LOGADDR		0x02	/* Logical Address Reset */
1891.1Stsubai
1901.1Stsubai/* 28: User Test Register (UTR) */
1911.1Stsubai#define	RTRE		0x80	/* Reserved Test Register Enable */
1921.1Stsubai#define	RTRD		0x40	/* Reserved Test Register Disable */
1931.1Stsubai#define	RPA		0x20	/* Run Packet Accept */
1941.1Stsubai#define	FCOLL		0x10	/* Force Collision */
1951.1Stsubai#define	RCVFCSE		0x08	/* Receive FCS Enable */
1961.1Stsubai#define	LOOP		0x06	/* Loopback Control */
1971.1Stsubai#define	LOOP_NONE	0x00	/* No Loopback */
1981.1Stsubai#define	LOOP_EXT	0x02	/* External Loopback */
1991.1Stsubai#define	LOOP_INT	0x04	/* Internal Loopback, excludes MENDEC */
2001.1Stsubai#define	LOOP_INT_MENDEC	0x06	/* Internal Loopback, includes MENDEC */
201