Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Dec 2002 11:19:51 -0800 (PST)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 22625 for review
Message-ID:  <200212221919.gBMJJpY3009686@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=22625

Change 22625 by marcel@marcel_nfs on 2002/12/22 11:19:45

	Convert to the new sioprobe/sioattach interface. Untested.

Affected files ...

.. //depot/projects/ia64/sys/dev/sio/sio_ebus.c#4 edit

Differences ...

==== //depot/projects/ia64/sys/dev/sio/sio_ebus.c#4 (text+ko) ====

@@ -34,6 +34,9 @@
 #include <sys/tty.h>
 
 #include <machine/bus.h>
+#include <machine/resource.h>
+
+#include <sys/rman.h>
 
 #include <dev/sio/siovar.h>
 
@@ -55,7 +58,7 @@
 static driver_t sio_ebus_driver = {
 	sio_driver_name,
 	sio_ebus_methods,
-	0,
+	sizeof(struct com_s),
 };
 
 DRIVER_MODULE(sio, ebus, sio_ebus_driver, sio_devclass, 0, 0);
@@ -94,20 +97,43 @@
 sio_ebus_probe(dev)
 	device_t	dev;
 {
-	char	*n;
+	struct com_s *com;
+	struct resource *res;
+	char *n;
+	int error, rid;
 
 	n = ebus_get_name(dev);
 	if (!sio_ofw_inlist(n, sio_ofw_names) && (strcmp(n, "serial") != 0 ||
 	    !sio_ofw_inlist(ebus_get_compat(dev), sio_ofw_compat)))
 		return (ENXIO);
-	/* Do not probe IRQ - isa_irq_pending() does not work for ebus. */
-	return (sioprobe(dev, 0, 0UL, 1));
+
+	com = device_get_softc(dev);
+	rid = 0;
+	res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 8,
+	    RF_ACTIVE);
+	com->bsh = rman_get_bushandle(res);
+	com->bst = rman_get_bustag(res);
+	error = sioprobe(dev);
+	bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
+	return (error);
 }
 
 static int
 sio_ebus_attach(dev)
 	device_t	dev;
 {
+	struct com_s *com;
+	struct resource *res;
+	int error, rid;
 
-	return (sioattach(dev, 0, 0UL));
+	com = device_get_softc(dev);
+	rid = 0;
+	res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 8,
+	    RF_ACTIVE);
+	com->bsh = rman_get_bushandle(res);
+	com->bst = rman_get_bustag(res);
+	error = sioattach(dev, 0, 0UL);
+	if (error)
+		bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
+	return (error);
 }

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212221919.gBMJJpY3009686>