if_efreg.h revision 1.2 1 1.2 pk /* $NetBSD: if_efreg.h,v 1.2 1998/02/28 01:14:15 pk Exp $ */
2 1.2 pk /* $Id: if_efreg.h,v 1.2 1998/02/28 01:14:15 pk Exp $ */
3 1.1 pk
4 1.1 pk /*-
5 1.1 pk * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 1.1 pk * All rights reserved.
7 1.1 pk *
8 1.1 pk * This code is derived from software contributed to The NetBSD Foundation
9 1.1 pk * by Rafal K. Boni.
10 1.1 pk *
11 1.1 pk * Redistribution and use in source and binary forms, with or without
12 1.1 pk * modification, are permitted provided that the following conditions
13 1.1 pk * are met:
14 1.1 pk * 1. Redistributions of source code must retain the above copyright
15 1.1 pk * notice, this list of conditions and the following disclaimer.
16 1.1 pk * 2. Redistributions in binary form must reproduce the above copyright
17 1.1 pk * notice, this list of conditions and the following disclaimer in the
18 1.1 pk * documentation and/or other materials provided with the distribution.
19 1.1 pk * 3. All advertising materials mentioning features or use of this software
20 1.1 pk * must display the following acknowledgement:
21 1.1 pk * This product includes software developed by the NetBSD
22 1.1 pk * Foundation, Inc. and its contributors.
23 1.1 pk * 4. Neither the name of The NetBSD Foundation nor the names of its
24 1.1 pk * contributors may be used to endorse or promote products derived
25 1.1 pk * from this software without specific prior written permission.
26 1.1 pk *
27 1.1 pk * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 1.1 pk * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 1.1 pk * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 1.1 pk * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 1.1 pk * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 1.1 pk * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 1.1 pk * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 1.1 pk * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 1.1 pk * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 1.1 pk * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 1.1 pk * POSSIBILITY OF SUCH DAMAGE.
38 1.1 pk */
39 1.1 pk
40 1.1 pk /*
41 1.1 pk * Card-specific definitions and macros for the 3Com 3C507/3C507TP
42 1.1 pk */
43 1.1 pk
44 1.1 pk /*
45 1.1 pk * Register offsets (from IOBASE)
46 1.1 pk */
47 1.1 pk
48 1.1 pk /* All banks */
49 1.1 pk #define EF_CTRL 6 /* offset of general control register */
50 1.1 pk #define EF_ICTRL 10 /* offset of intr. latch clear register */
51 1.1 pk #define EF_ATTN 11 /* offset of CA register */
52 1.1 pk #define EF_MEDIA 13 /* offset of ROM & xcvr config register */
53 1.1 pk #define EF_MADDR 14 /* offset of shared memory config register */
54 1.1 pk #define EF_IRQ 15 /* offset of IRQ configuration register */
55 1.1 pk
56 1.1 pk /* Bank 0 -- "*3COM*" signature */
57 1.1 pk #define EF_SIG 0 /* offset of ASCII signature -- "*3COM*" */
58 1.1 pk
59 1.1 pk /* Bank 1 -- ethernet address */
60 1.1 pk #define EF_ADDR 0 /* offset of card's ethernet address */
61 1.1 pk
62 1.1 pk /* Bank 2 -- card part #, revision, date of manufacture */
63 1.1 pk #define EF_TYPE 0 /* offset of card part # */
64 1.1 pk #define EF_TYPE_HI 0 /* offset of card part # -- high byte */
65 1.1 pk #define EF_TYPE_MID 1 /* offset of card part # -- middle byte */
66 1.1 pk #define EF_TYPE_LOW 2 /* offset of card part # -- low byte */
67 1.1 pk #define EF_REV 3 /* offset of card revision, in BCD */
68 1.1 pk #define EF_DOM_DAY 4 /* offset of date of manf: day in BCD */
69 1.1 pk #define EF_DOM_MY 4 /* offset of date of manf: month, year in BCD */
70 1.1 pk
71 1.1 pk /*
72 1.2 pk * Definitions for non-bankswitched registers
73 1.1 pk */
74 1.1 pk
75 1.1 pk /* General control register */
76 1.1 pk #define EF_CTRL_BNK0 0x00 /* register bank 0 */
77 1.1 pk #define EF_CTRL_BNK1 0x01 /* register bank 1 */
78 1.1 pk #define EF_CTRL_BNK2 0x02 /* register bank 2 */
79 1.1 pk #define EF_CTRL_IEN 0x04 /* interrupt enable */
80 1.1 pk #define EF_CTRL_INTL 0x08 /* interrupt active latch */
81 1.1 pk #define EF_CTRL_16BIT 0x10 /* bus width; clear = 8-bit, set = 16-bit */
82 1.1 pk #define EF_CTRL_LOOP 0x20 /* loopback mode */
83 1.1 pk #define EF_CTRL_NRST 0x80 /* turn off to reset */
84 1.1 pk #define EF_CTRL_RESET (EF_CTRL_LOOP)
85 1.1 pk #define EF_CTRL_NORMAL (EF_CTRL_NRST | EF_CTRL_IEN | EF_CTRL_BNK1)
86 1.1 pk
87 1.1 pk /* ROM & media control register */
88 1.1 pk #define EF_MEDIA_MASK 0x80 /* m1 = (EF_MEDIA register) & EF_MEDIA_MASK */
89 1.1 pk #define EF_MEDIA_SHIFT 7 /* media index = m1 >> EF_MEDIA_SHIFT */
90 1.1 pk
91 1.1 pk /* shared memory control register */
92 1.1 pk #define EF_MADDR_HIGH 0x20 /* memory mapping above 15Meg */
93 1.1 pk #define EF_MADDR_MASK 0x1c /* m1 = (EF_MADDR register) & EF_MADDR_MASK */
94 1.1 pk #define EF_MADDR_SHIFT 12 /* m2 = m1 << EF_MADDR_SHIFT */
95 1.1 pk #define EF_MADDR_BASE 0xc0000 /* maddr = m2 + EF_MADDR_BASE */
96 1.1 pk #define EF_MSIZE_MASK 0x03 /* m1 = (EF_MADDR register) & EF_MSIZE_MASK */
97 1.1 pk #define EF_MSIZE_STEP 16384 /* msize = (m1 + 1) * EF_MSIZE_STEP */
98 1.1 pk
99 1.1 pk /* interrupt control register */
100 1.1 pk #define EF_IRQ_MASK 0x0f /* irq = (EF_IRQ register) & EF_IRQ_MASK */
101 1.1 pk
102 1.1 pk /*
103 1.2 pk * Definitions for Bank 0 registers
104 1.1 pk */
105 1.1 pk #define EF_SIG_LEN 6 /* signature length */
106 1.1 pk #define EF_SIGNATURE "*3COM*"
107 1.1 pk
108 1.1 pk /*
109 1.2 pk * Definitions for Bank 1 registers
110 1.1 pk */
111 1.1 pk #define EF_ADDR_LEN 6 /* ether address length */
112 1.1 pk
113 1.1 pk /*
114 1.2 pk * Definitions for Bank 2 registers
115 1.1 pk */
116 1.1 pk #define EF_TYPE_LEN 3 /* card part # length */
117 1.1 pk
118 1.1 pk /*
119 1.1 pk * General card-specific macros and definitions
120 1.1 pk */
121 1.1 pk #define EF_IOBASE_LOW 0x200
122 1.1 pk #define EF_IOBASE_HIGH 0x3e0
123 1.1 pk #define EF_IOSIZE 16
124 1.1 pk
125 1.2 pk /*
126 1.2 pk * XXX: It seems that the 3C507-TP is differentiated from AUI/BNC 3C507
127 1.2 pk * by part numbers, but I'm not sure how accurate this test is, seeing
128 1.1 pk * as it's based on the sample of 3 cards I own (2AUI/BNC, 1 TP).
129 1.1 pk */
130 1.1 pk #define EF_IS_TP(type) ((type)[EF_TYPE_MID] > 0x70)
131 1.1 pk
132 1.1 pk #define EF_CARD_BNC 0 /* regular AUI/BNC 3C507 */
133 1.1 pk #define EF_CARD_TP 1 /* 3C507-TP -- no AUI/BNC */
134 1.1 pk
135