Ver código fonte

Added "classical" ISA example.

tags/v0.9.3
Michael Brown 19 anos atrás
pai
commit
f61fa0dc64
1 arquivos alterados com 63 adições e 0 exclusões
  1. 63
    0
      src/drivers/net/skel.c

+ 63
- 0
src/drivers/net/skel.c Ver arquivo

@@ -177,6 +177,11 @@ static struct nic_operations skel_operations = {
177 177
  * example, most PCI devices will only need the PCI probing section;
178 178
  * ISAPnP, EISA, etc. can all be deleted.
179 179
  *
180
+ * Some devices will need custom bus logic.  The ISA 3c509 is a good
181
+ * example of this; it has a contention-resolution mechanism that is
182
+ * similar to ISAPnP, but not close enough to use the generic ISAPnP
183
+ * code.  Look at 3c509.c to see how it works.
184
+ *
180 185
  **************************************************************************
181 186
  */
182 187
 
@@ -324,3 +329,61 @@ BOOT_DRIVER ( "SKEL/MCA", find_mca_boot_device,
324 329
 
325 330
 ISA_ROM ( "skel-mca", "Skeleton MCA Adapter" );
326 331
 
332
+/**************************************************************************
333
+ * ISA PROBE - Look for an adapter
334
+ *
335
+ * The "classical" ISA probe is split into two stages: trying a list
336
+ * of I/O addresses to see if there's anything listening, and then
337
+ * using that I/O address to fill in the information in the nic
338
+ * structure.
339
+ *
340
+ * The list of probe addresses defined in skel_isa_probe_addrs[] will
341
+ * be passed to skel_isa_probe_addr().  If skel_isa_probe_addr()
342
+ * returns true, a struct isa_device will be created with isa->ioaddr
343
+ * set to the working I/O address, and skel_isa_probe() will be
344
+ * called.
345
+ *
346
+ * There is a standard mechanism for overriding the probe address list
347
+ * using ISA_PROBE_ADDRS.  Do not implement any custom code to
348
+ * override the probe address list.
349
+ *
350
+ **************************************************************************
351
+ */
352
+static int skel_isa_probe_addr ( uint16_t ioaddr __unused ) {
353
+	return 0;
354
+}
355
+
356
+static int skel_isa_probe ( struct dev *dev, struct isa_device *isa ) {
357
+	struct nic *nic = nic_device ( dev );
358
+
359
+	nic->ioaddr = isa->ioaddr;
360
+	nic->irqno = 0;
361
+
362
+	/* Test for physical presence of NIC */
363
+	/*
364
+	   if ( ! my_tests ) {
365
+	  	DBG ( "Could not find NIC: my explanation\n" );
366
+		return 0;
367
+	   }
368
+	*/
369
+
370
+	/* point to NIC specific routines */
371
+	nic->nic_op = &skel_operations;
372
+	return 1;
373
+}
374
+
375
+static struct isa_probe_addr skel_isa_probe_addrs[] = {
376
+	/*
377
+	   { 0x200 }, { 0x240 },
378
+	*/
379
+};
380
+
381
+static struct isa_driver skel_isa_driver =
382
+	ISA_DRIVER ( "SKEL/ISA", skel_isa_probe_addrs, skel_isa_probe_addr,
383
+		     ISA_VENDOR('S','K','L'), 0x0000 );
384
+
385
+BOOT_DRIVER ( "SKEL/ISA", find_isa_boot_device,
386
+	      skel_isa_driver, skel_isa_probe );
387
+
388
+ISA_ROM ( "skel-isa", "Skeleton ISA Adapter" );
389
+

Carregando…
Cancelar
Salvar