Deleted Added
full compact
if_ep_isa.c (52549) if_ep_isa.c (54196)
1/*
2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
1/*
2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * $FreeBSD: head/sys/dev/ep/if_ep_isa.c 52549 1999-10-27 06:25:16Z mdodd $
30 * $FreeBSD: head/sys/dev/ep/if_ep_isa.c 54196 1999-12-06 08:31:47Z mdodd $
31 */
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/socket.h>
37
38#include <sys/module.h>

--- 94 unchanged lines hidden (view full) ---

133static void
134ep_isa_identify (driver_t *driver, device_t parent)
135{
136 int tag = EP_LAST_TAG;
137 int found = 0;
138 int i;
139 int j;
140 const char * desc;
31 */
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/socket.h>
37
38#include <sys/module.h>

--- 94 unchanged lines hidden (view full) ---

133static void
134ep_isa_identify (driver_t *driver, device_t parent)
135{
136 int tag = EP_LAST_TAG;
137 int found = 0;
138 int i;
139 int j;
140 const char * desc;
141 u_int32_t data;
141 u_int16_t data;
142 u_int32_t irq;
143 u_int32_t ioport;
144 u_int32_t isa_id;
145 device_t child;
146
147 outb(ELINK_ID_PORT, 0);
148 outb(ELINK_ID_PORT, 0);
142 u_int32_t irq;
143 u_int32_t ioport;
144 u_int32_t isa_id;
145 device_t child;
146
147 outb(ELINK_ID_PORT, 0);
148 outb(ELINK_ID_PORT, 0);
149
150 elink_idseq(ELINK_509_POLY);
151 elink_reset();
152
153 DELAY(DELAY_MULTIPLE * 10000);
154
155 for (i = 0; i < EP_MAX_BOARDS; i++) {
156
157 outb(ELINK_ID_PORT, 0);
158 outb(ELINK_ID_PORT, 0);
149 elink_idseq(ELINK_509_POLY);
150 elink_reset();
151
152 DELAY(DELAY_MULTIPLE * 10000);
153
154 for (i = 0; i < EP_MAX_BOARDS; i++) {
155
156 outb(ELINK_ID_PORT, 0);
157 outb(ELINK_ID_PORT, 0);
159 elink_idseq(0xCF);
158 elink_idseq(ELINK_509_POLY);
159 DELAY(400);
160
161 /* For the first probe, clear all
162 * board's tag registers.
163 * Otherwise kill off already-found
164 * boards. -- linux 3c509.c
165 */
166 if (i == 0) {
167 outb(ELINK_ID_PORT, 0xd0);
168 } else {
169 outb(ELINK_ID_PORT, 0xd8);
170 }
171
160
161 /* For the first probe, clear all
162 * board's tag registers.
163 * Otherwise kill off already-found
164 * boards. -- linux 3c509.c
165 */
166 if (i == 0) {
167 outb(ELINK_ID_PORT, 0xd0);
168 } else {
169 outb(ELINK_ID_PORT, 0xd8);
170 }
171
172 /* Get out of loop if we're out of cards. */
173 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_MFG_ID);
174 if (data != MFG_ID) {
175 break;
176 }
177
178 /* resolve contention using the Ethernet address */
179 for (j = 0; j < 3; j++) {
180 (void)get_eeprom_data(ELINK_ID_PORT, j);
181 }
182
172 /*
173 * Construct an 'isa_id' in 'EISA'
174 * format.
175 */
176 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_MFG_ID);
177 isa_id = (htons(data) << 16);
178 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_PROD_ID);
179 isa_id |= htons(data);
180
181 /* Find known ISA boards */
182 desc = ep_isa_match_id(isa_id, ep_isa_devs);
183 if (!desc) {
184 if (bootverbose) {
185 device_printf(parent, "if_ep: unknown ID 0x%08x\n",
186 isa_id);
187 }
188 break;
189 }
190
183 /*
184 * Construct an 'isa_id' in 'EISA'
185 * format.
186 */
187 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_MFG_ID);
188 isa_id = (htons(data) << 16);
189 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_PROD_ID);
190 isa_id |= htons(data);
191
192 /* Find known ISA boards */
193 desc = ep_isa_match_id(isa_id, ep_isa_devs);
194 if (!desc) {
195 if (bootverbose) {
196 device_printf(parent, "if_ep: unknown ID 0x%08x\n",
197 isa_id);
198 }
199 break;
200 }
201
191 /* resolve contention using the Ethernet address */
192 for (j = 0; j < 3; j++) {
193 get_eeprom_data(ELINK_ID_PORT, j);
194 }
195
196 /* Retreive IRQ */
197 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_RESOURCE_CFG);
198 irq = (data >> 12);
199
200 /* Retreive IOPORT */
201 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_ADDR_CFG);
202#ifdef PC98
202 /* Retreive IRQ */
203 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_RESOURCE_CFG);
204 irq = (data >> 12);
205
206 /* Retreive IOPORT */
207 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_ADDR_CFG);
208#ifdef PC98
203 ioport = ((data * 0x100) + 0x40d0);
209 ioport = (((data & 0x1f) * 0x100) + 0x40d0);
204#else
210#else
205 ioport = ((data << 4) + 0x200);
211 ioport = (((data & 0x1f) << 4) + 0x200);
206#endif
207
212#endif
213
214 /* Test for an adapter with PnP support. */
215 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_CAP);
216 if (data == CAP_ISA) {
217 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_INT_CONFIG_1);
218 if (data & ICW1_IAS_PNP) {
219 if (bootverbose) {
220 device_printf(parent, "if_ep: Adapter at 0x%03x in PnP mode!\n",
221 ioport);
222 }
223 /* Set the adaptor tag so that the next card can be found. */
224 outb(ELINK_ID_PORT, tag--);
225 continue;
226 }
227 }
228
208 /* Set the adaptor tag so that the next card can be found. */
209 outb(ELINK_ID_PORT, tag--);
210
211 /* Activate the adaptor at the EEPROM location. */
229 /* Set the adaptor tag so that the next card can be found. */
230 outb(ELINK_ID_PORT, tag--);
231
232 /* Activate the adaptor at the EEPROM location. */
212 outb(ELINK_ID_PORT, ((ioport >> 4) | 0xe0));
233 outb(ELINK_ID_PORT, ACTIVATE_ADAPTER_TO_CONFIG);
213
234
214 /* Test for an adapter in PnP mode */
235 /* Test for an adapter in TEST mode. */
236 outw(ioport + EP_COMMAND, WINDOW_SELECT | 0);
215 data = inw(ioport + EP_W0_EEPROM_COMMAND);
216 if (data & EEPROM_TST_MODE) {
237 data = inw(ioport + EP_W0_EEPROM_COMMAND);
238 if (data & EEPROM_TST_MODE) {
217 device_printf(parent, "if_ep: Adapter at 0x%03x in PnP mode!\n",
218 ioport);
239 device_printf(parent, "if_ep: Adapter at 0x%03x in TEST mode! Erase pencil mark.\n",
240 ioport);
219 continue;
220 }
221
222 child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "ep", -1);
223 device_set_desc_copy(child, desc);
224 device_set_driver(child, driver);
225 bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1);
226 bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EP_IOSIZE);

--- 90 unchanged lines hidden ---
241 continue;
242 }
243
244 child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "ep", -1);
245 device_set_desc_copy(child, desc);
246 device_set_driver(child, driver);
247 bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1);
248 bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EP_IOSIZE);

--- 90 unchanged lines hidden ---