I have just taken a pass through the aha_isa driver to convert it to
newbus and to make it use the new pnp system. Unfortunately I don't own
the hardware so I need testers, preferably both with non-pnp and pnp
cards. The code does compile but I have not tested it at all. Here is the
patch:
Index: aha_isa.c
===
RCS file: /home/ncvs/src/sys/i386/isa/aha_isa.c,v
retrieving revision 1.11
diff -u -r1.11 aha_isa.c
--- aha_isa.c 1999/09/02 04:37:07 1.11
+++ aha_isa.c 1999/09/03 20:47:55
@@ -31,34 +31,28 @@
* $FreeBSD: src/sys/i386/isa/aha_isa.c,v 1.11 1999/09/02 04:37:07 peter Exp $
*/
-/* #include "pnp.h" */
-#define NPNP 0
-
#include sys/param.h
#include sys/systm.h
#include sys/kernel.h
#include machine/bus_pio.h
#include machine/bus.h
+#include machine/resource.h
+#include sys/module.h
+#include sys/bus.h
+#include sys/rman.h
+
+#include isa/isareg.h
+#include isa/isavar.h
-#include i386/isa/isa_device.h
#include dev/aha/ahareg.h
#include cam/scsi/scsi_all.h
-
-#if NPNP 0
-#include i386/isa/pnp.h
-#endif
-
-static int aha_isa_probe(struct isa_device *dev);
-static int aha_isa_attach(struct isa_device *dev);
-static void aha_isa_intr(void *unit);
-struct isa_driver ahadriver =
-{
-aha_isa_probe,
-aha_isa_attach,
-"aha"
+static struct isa_pnp_id aha_ids[] = {
+ {AHA1542_PNP, NULL}, /* ADP1542 */
+ {AHA1542_PNPCOMPAT, NULL}, /* PNP00A0 */
+ {0}
};
/*
@@ -68,26 +62,41 @@
* autoconf.c
*/
static int
-aha_isa_probe(dev)
- struct isa_device *dev;
+aha_isa_probe(device_t dev)
{
/*
* find unit and check we have that many defined
*/
+ struct aha_softc **sc = device_get_softc(dev);
struct aha_softc *aha;
int port_index;
int max_port_index;
+ int error;
+ u_long port_start, port_count;
+ struct resource *port_res;
+ int port_rid;
+ int drq;
aha = NULL;
+ /* Check isapnp ids */
+ if (ISA_PNP_PROBE(device_get_parent(dev), dev, aha_ids) == ENXIO)
+ return (ENXIO);
+
+ error = ISA_GET_RESOURCE(device_get_parent(dev), dev,
+SYS_RES_IOPORT, 0,
+port_start, port_count);
+ if (error != 0)
+ port_start = 0;
+
/*
* Bound our board search if the user has
* specified an exact port.
*/
- aha_find_probe_range(dev-id_iobase, port_index, max_port_index);
+ aha_find_probe_range(port_start, port_index, max_port_index);
if (port_index 0)
- return 0;
+ return ENXIO;
/* Attempt to find an adapter */
for (;port_index = max_port_index; port_index++) {
@@ -103,12 +112,21 @@
*/
if (aha_check_probed_iop(ioport) != 0)
continue;
- dev-id_iobase = ioport;
- if (haveseen_iobase(dev, AHA_NREGS))
+ error = ISA_SET_RESOURCE(device_get_parent(dev), dev,
+SYS_RES_IOPORT, 0,
+ioport, AHA_NREGS);
+ if (error)
+ return error;
+
+ port_rid = 0;
+ port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, port_rid,
+ 0, ~0, AHA_NREGS, RF_ACTIVE);
+ if (!port_res)
continue;
/* Allocate a softc for use during probing */
- aha = aha_alloc(dev-id_unit, I386_BUS_SPACE_IO, ioport);
+ aha = aha_alloc(device_get_unit(dev),
+ I386_BUS_SPACE_IO, ioport);
if (aha == NULL)
break;
@@ -139,44 +157,90 @@
switch (config_data.dma_chan) {
case DMA_CHAN_5:
- dev-id_drq = 5;
+ drq = 5;
break;
case DMA_CHAN_6:
- dev-id_drq = 6;
+ drq = 6;
break;
case DMA_CHAN_7:
- dev-id_drq = 7;
+ drq = 7;
break;
default:
printf("aha_isa_probe: Invalid DMA setting "
"detected for adapter at 0x%x. "
"Failing probe\n", ioport);
- return (0);
+ return (ENXIO);
}
- dev-id_irq = (config_data.irq 9);
- dev-id_intr = aha_isa_intr;
+ error = ISA_SET_RESOURCE(device_get_parent(dev), dev,
+SYS_RES_DRQ, 0, drq, 1);
+ if (error)
+