Browse Source

Added EISA, ISAPnP and MCA examples.

tags/v0.9.3
Michael Brown 19 years ago
parent
commit
897eeee4ee
1 changed files with 117 additions and 7 deletions
  1. 117
    7
      src/drivers/net/skel.c

+ 117
- 7
src/drivers/net/skel.c View File

187
 static int skel_pci_probe ( struct dev *dev, struct pci_device *pci ) {
187
 static int skel_pci_probe ( struct dev *dev, struct pci_device *pci ) {
188
 	struct nic *nic = nic_device ( dev );
188
 	struct nic *nic = nic_device ( dev );
189
 
189
 
190
-	/* store NIC parameters */
191
 	nic->ioaddr = pci->ioaddr;
190
 	nic->ioaddr = pci->ioaddr;
192
 	nic->irqno = pci->irq;
191
 	nic->irqno = pci->irq;
193
 
192
 
194
 	/* Test for physical presence of NIC */
193
 	/* Test for physical presence of NIC */
195
 	/*
194
 	/*
196
-	  if ( ! my_tests ) {
195
+	   if ( ! my_tests ) {
197
 	  	DBG ( "Could not find NIC: my explanation\n" );
196
 	  	DBG ( "Could not find NIC: my explanation\n" );
198
 		return 0;
197
 		return 0;
199
-	  }
198
+	   }
200
 	*/
199
 	*/
201
 
200
 
202
 	/* point to NIC specific routines */
201
 	/* point to NIC specific routines */
203
-	nic->nic_op	= &skel_operations;
202
+	nic->nic_op = &skel_operations;
204
 	return 1;
203
 	return 1;
205
 }
204
 }
206
 
205
 
207
 static struct pci_id skel_pci_nics[] = {
206
 static struct pci_id skel_pci_nics[] = {
208
-PCI_ROM ( 0x0000, 0x0000, "skel-pci", "Skeleton PCI Adaptor" ),
207
+PCI_ROM ( 0x0000, 0x0000, "skel-pci", "Skeleton PCI Adapter" ),
209
 };
208
 };
210
 
209
 
211
 static struct pci_driver skel_pci_driver =
210
 static struct pci_driver skel_pci_driver =
212
-	PCI_DRIVER ( "SKELETON/PCI", skel_pci_nics, PCI_NO_CLASS );
211
+	PCI_DRIVER ( "SKEL/PCI", skel_pci_nics, PCI_NO_CLASS );
213
 
212
 
214
-BOOT_DRIVER ( "SKELETON/PCI", find_pci_boot_device,
213
+BOOT_DRIVER ( "SKEL/PCI", find_pci_boot_device,
215
 	      skel_pci_driver, skel_pci_probe );
214
 	      skel_pci_driver, skel_pci_probe );
216
 
215
 
216
+/**************************************************************************
217
+ * ISAPnP PROBE - Look for an adapter
218
+ **************************************************************************
219
+ */
220
+static int skel_eisa_probe ( struct dev *dev, struct eisa_device *eisa ) {
221
+	struct nic *nic = nic_device ( dev );
222
+
223
+	enable_eisa_device ( eisa );
224
+	nic->ioaddr = eisa->ioaddr;
225
+	nic->irqno = 0;
226
+
227
+	/* Test for physical presence of NIC */
228
+	/*
229
+	   if ( ! my_tests ) {
230
+	  	DBG ( "Could not find NIC: my explanation\n" );
231
+		return 0;
232
+	   }
233
+	*/
234
+
235
+	/* point to NIC specific routines */
236
+	nic->nic_op = &skel_operations;
237
+	return 1;
238
+}
239
+
240
+static struct eisa_id skel_eisa_nics[] = {
241
+	{ "Skeleton EISA Adapter", EISA_VENDOR('S','K','L'), 0x0000 },
242
+};
243
+
244
+static struct eisa_driver skel_eisa_driver =
245
+	EISA_DRIVER ( "SKEL/EISA", skel_eisa_nics );
246
+
247
+BOOT_DRIVER ( "SKEL/EISA", find_eisa_boot_device,
248
+	      skel_eisa_driver, skel_eisa_probe );
249
+
250
+ISA_ROM ( "skel-eisa", "Skeleton EISA Adapter" );
251
+
252
+/**************************************************************************
253
+ * ISAPnP PROBE - Look for an adapter
254
+ **************************************************************************
255
+ */
256
+static int skel_isapnp_probe ( struct dev *dev,
257
+			       struct isapnp_device *isapnp ) {
258
+	struct nic *nic = nic_device ( dev );
259
+
260
+	nic->ioaddr = isapnp->ioaddr;
261
+	nic->irqno = isapnp->irqno;
262
+
263
+	/* Test for physical presence of NIC */
264
+	/*
265
+	   if ( ! my_tests ) {
266
+	  	DBG ( "Could not find NIC: my explanation\n" );
267
+		return 0;
268
+	   }
269
+	*/
270
+
271
+	/* point to NIC specific routines */
272
+	nic->nic_op = &skel_operations;
273
+	return 1;
274
+}
275
+
276
+static struct isapnp_id skel_isapnp_nics[] = {
277
+	{ "Skeleton ISAPnP Adapter", ISAPNP_VENDOR('S','K','L'), 0x0000 },
278
+};
279
+
280
+static struct isapnp_driver skel_isapnp_driver =
281
+	ISAPNP_DRIVER ( "SKEL/ISAPnP", skel_isapnp_nics );
282
+
283
+BOOT_DRIVER ( "SKEL/ISAPnP", find_isapnp_boot_device,
284
+	      skel_isapnp_driver, skel_isapnp_probe );
285
+
286
+ISA_ROM ( "skel-isapnp", "Skeleton ISAPnP Adapter" );
287
+
288
+/**************************************************************************
289
+ * MCA PROBE - Look for an adapter
290
+ **************************************************************************
291
+ */
292
+static int skel_mca_probe ( struct dev *dev,
293
+			    struct mca_device *mca __unused ) {
294
+	struct nic *nic = nic_device ( dev );
295
+
296
+	/* MCA parameters are available in the mca->pos[] array */
297
+	/*
298
+	   nic->ioaddr = ( mca->pos[xxx] << 8 ) + mca->pos[yyy];
299
+	   nic->irqno = mca->pos[zzz] & 0x0f;
300
+	*/
301
+
302
+	/* Test for physical presence of NIC */
303
+	/*
304
+	   if ( ! my_tests ) {
305
+	  	DBG ( "Could not find NIC: my explanation\n" );
306
+		return 0;
307
+	   }
308
+	*/
309
+
310
+	/* point to NIC specific routines */
311
+	nic->nic_op = &skel_operations;
312
+	return 1;
313
+}
314
+
315
+static struct mca_id skel_mca_nics[] = {
316
+	{ "Skeleton MCA Adapter", 0x0000 },
317
+};
318
+
319
+static struct mca_driver skel_mca_driver =
320
+	MCA_DRIVER ( "SKEL/MCA", skel_mca_nics );
321
+
322
+BOOT_DRIVER ( "SKEL/MCA", find_mca_boot_device,
323
+	      skel_mca_driver, skel_mca_probe );
324
+
325
+ISA_ROM ( "skel-mca", "Skeleton MCA Adapter" );
326
+

Loading…
Cancel
Save