|
@@ -6,7 +6,6 @@
|
6
|
6
|
|
7
|
7
|
#include "eisa.h"
|
8
|
8
|
#include "isa.h"
|
9
|
|
-#include "dev.h"
|
10
|
9
|
#include "io.h"
|
11
|
10
|
#include "timer.h"
|
12
|
11
|
#include "string.h"
|
|
@@ -25,7 +24,6 @@
|
25
|
24
|
*/
|
26
|
25
|
struct t509_device {
|
27
|
26
|
char *magic; /* must be first */
|
28
|
|
- struct dev *dev;
|
29
|
27
|
uint16_t id_port;
|
30
|
28
|
uint16_t ioaddr;
|
31
|
29
|
unsigned char current_tag;
|
|
@@ -123,16 +121,11 @@ static inline int fill_t509_device ( struct t509_device *t509 ) {
|
123
|
121
|
uint16_t iobase;
|
124
|
122
|
|
125
|
123
|
/*
|
126
|
|
- * If this is the start of the scan, find an id_port and clear
|
127
|
|
- * all tag registers. Otherwise, tell already-found NICs not
|
128
|
|
- * to respond.
|
|
124
|
+ * If this is the start of the scan, clear all tag registers.
|
|
125
|
+ * Otherwise, tell already-found NICs not to respond.
|
129
|
126
|
*
|
130
|
127
|
*/
|
131
|
128
|
if ( t509->current_tag == 0 ) {
|
132
|
|
- if ( ! find_id_port ( t509 ) ) {
|
133
|
|
- DBG ( "No ID port available for contention select\n" );
|
134
|
|
- return 0;
|
135
|
|
- }
|
136
|
129
|
outb ( 0xd0, t509->id_port );
|
137
|
130
|
} else {
|
138
|
131
|
outb ( 0xd8, t509->id_port ) ;
|
|
@@ -166,42 +159,48 @@ static inline int fill_t509_device ( struct t509_device *t509 ) {
|
166
|
159
|
}
|
167
|
160
|
|
168
|
161
|
/*
|
169
|
|
- * Obtain a struct t509_device * from a struct dev *
|
|
162
|
+ * Find a t509 device matching the specified driver. ("Matching the
|
|
163
|
+ * specified driver" is, in this case, a no-op, but we want to
|
|
164
|
+ * preserve the common bus API).
|
|
165
|
+ *
|
|
166
|
+ * Called only once, so inlined for efficiency.
|
170
|
167
|
*
|
171
|
|
- * If dev has not previously been used for a PCI device scan, blank
|
172
|
|
- * out struct t509_device
|
173
|
168
|
*/
|
174
|
|
-static struct t509_device * t509_device ( struct dev *dev ) {
|
175
|
|
- struct t509_device *t509 = dev->bus;
|
|
169
|
+static inline int find_t509_device ( struct t509_device *t509,
|
|
170
|
+ struct t509_driver *driver __unused ) {
|
176
|
171
|
|
|
172
|
+ /* Initialise struct t509 if it's the first time it's been used. */
|
177
|
173
|
if ( t509->magic != t509_magic ) {
|
178
|
174
|
memset ( t509, 0, sizeof ( *t509 ) );
|
179
|
175
|
t509->magic = t509_magic;
|
|
176
|
+ if ( ! find_id_port ( t509 ) ) {
|
|
177
|
+ DBG ( "No ID port available for contention select\n" );
|
|
178
|
+ return 0;
|
|
179
|
+ }
|
180
|
180
|
}
|
181
|
|
- t509->dev = dev;
|
182
|
|
- return t509;
|
|
181
|
+
|
|
182
|
+ /* Find the next t509 device */
|
|
183
|
+ if ( ! fill_t509_device ( t509 ) )
|
|
184
|
+ return 0;
|
|
185
|
+
|
|
186
|
+ return 1;
|
183
|
187
|
}
|
184
|
188
|
|
185
|
189
|
/*
|
186
|
|
- * Find a t509 device matching the specified driver. ("Matching the
|
187
|
|
- * specified driver" is, in this case, a no-op, but we want to
|
188
|
|
- * preserve the common bus API).
|
|
190
|
+ * Find the next T509 device that can be used to boot using the
|
|
191
|
+ * specified driver.
|
189
|
192
|
*
|
190
|
193
|
*/
|
191
|
|
-static int find_t509_device ( struct t509_device *t509,
|
192
|
|
- struct t509_driver *driver ) {
|
193
|
|
- /* Find the next t509 device */
|
194
|
|
- if ( ! fill_t509_device ( t509 ) )
|
|
194
|
+int find_t509_boot_device ( struct dev *dev, struct t509_driver *driver ) {
|
|
195
|
+ struct t509_device *t509 = ( struct t509_device * )dev->bus;
|
|
196
|
+
|
|
197
|
+ if ( ! find_t509_device ( t509, driver ) )
|
195
|
198
|
return 0;
|
196
|
|
-
|
197
|
|
- /* Fill in dev structure, if present */
|
198
|
|
- if ( t509->dev ) {
|
199
|
|
- t509->dev->name = driver->name;
|
200
|
|
- t509->dev->devid.bus_type = ISA_BUS_TYPE;
|
201
|
|
- t509->dev->devid.vendor_id = MFG_ID;
|
202
|
|
- t509->dev->devid.device_id = PROD_ID;
|
203
|
|
- }
|
204
|
199
|
|
|
200
|
+ dev->name = driver->name;
|
|
201
|
+ dev->devid.bus_type = ISA_BUS_TYPE;
|
|
202
|
+ dev->devid.vendor_id = MFG_ID;
|
|
203
|
+ dev->devid.device_id = PROD_ID;
|
205
|
204
|
return 1;
|
206
|
205
|
}
|
207
|
206
|
|
|
@@ -209,42 +208,28 @@ static int find_t509_device ( struct t509_device *t509,
|
209
|
208
|
* The ISA probe function
|
210
|
209
|
*
|
211
|
210
|
*/
|
212
|
|
-static struct t509_driver el3_t509_driver = { "3c509 (ISA)" };
|
213
|
|
-
|
214
|
|
-static int el3_t509_probe ( struct dev *dev ) {
|
|
211
|
+static int el3_t509_probe ( struct dev *dev, struct t509_device *t509 ) {
|
215
|
212
|
struct nic *nic = nic_device ( dev );
|
216
|
|
- struct t509_device *t509 = t509_device ( dev );
|
217
|
|
-
|
218
|
|
- if ( ! find_t509_device ( t509, &el3_t509_driver ) )
|
219
|
|
- return 0;
|
220
|
213
|
|
221
|
214
|
nic->ioaddr = t509->ioaddr;
|
222
|
215
|
nic->irqno = 0;
|
223
|
|
- printf ( "3C5x9 board on ISA at %#hx - ", nic->ioaddr );
|
|
216
|
+ printf ( "3c509 board on ISA at %#hx - ", nic->ioaddr );
|
224
|
217
|
|
225
|
218
|
/* Hand off to generic t5x9 probe routine */
|
226
|
219
|
return t5x9_probe ( nic, ISA_PROD_ID ( PROD_ID ), ISA_PROD_ID_MASK );
|
227
|
220
|
}
|
228
|
221
|
|
229
|
|
-BOOT_DRIVER ( "3c509", el3_t509_probe );
|
|
222
|
+static struct t509_driver el3_t509_driver = { "3c509 (ISA)" };
|
|
223
|
+
|
|
224
|
+BOOT_DRIVER ( "3c509", find_t509_boot_device, el3_t509_driver,
|
|
225
|
+ el3_t509_probe );
|
230
|
226
|
|
231
|
227
|
/*
|
232
|
|
- * The 3c509 driver also supports EISA cards
|
|
228
|
+ * The EISA probe function
|
233
|
229
|
*
|
234
|
230
|
*/
|
235
|
|
-static struct eisa_id el3_eisa_adapters[] = {
|
236
|
|
- { "3Com 3c509 EtherLink III (EISA)", MFG_ID, PROD_ID },
|
237
|
|
-};
|
238
|
|
-
|
239
|
|
-static struct eisa_driver el3_eisa_driver =
|
240
|
|
- EISA_DRIVER ( "3c509 (EISA)", el3_eisa_adapters );
|
241
|
|
-
|
242
|
|
-static int el3_eisa_probe ( struct dev *dev ) {
|
|
231
|
+static int el3_eisa_probe ( struct dev *dev, struct eisa_device *eisa ) {
|
243
|
232
|
struct nic *nic = nic_device ( dev );
|
244
|
|
- struct eisa_device *eisa = eisa_device ( dev );
|
245
|
|
-
|
246
|
|
- if ( ! find_eisa_device ( eisa, &el3_eisa_driver ) )
|
247
|
|
- return 0;
|
248
|
233
|
|
249
|
234
|
enable_eisa_device ( eisa );
|
250
|
235
|
nic->ioaddr = eisa->ioaddr;
|
|
@@ -255,7 +240,15 @@ static int el3_eisa_probe ( struct dev *dev ) {
|
255
|
240
|
return t5x9_probe ( nic, ISA_PROD_ID ( PROD_ID ), ISA_PROD_ID_MASK );
|
256
|
241
|
}
|
257
|
242
|
|
258
|
|
-BOOT_DRIVER ( "3c509 (EISA)", el3_eisa_probe );
|
|
243
|
+static struct eisa_id el3_eisa_adapters[] = {
|
|
244
|
+ { "3Com 3c509 EtherLink III (EISA)", MFG_ID, PROD_ID },
|
|
245
|
+};
|
|
246
|
+
|
|
247
|
+static struct eisa_driver el3_eisa_driver =
|
|
248
|
+ EISA_DRIVER ( "3c509 (EISA)", el3_eisa_adapters );
|
|
249
|
+
|
|
250
|
+BOOT_DRIVER ( "3c509 (EISA)", find_eisa_boot_device, el3_eisa_driver,
|
|
251
|
+ el3_eisa_probe );
|
259
|
252
|
|
260
|
253
|
/*
|
261
|
254
|
* We currently build both ISA and EISA support into a single ROM
|