Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Apr 2006 21:54:00 GMT
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 96168 for review
Message-ID:  <200604262154.k3QLs0Ig063491@repoman.freebsd.org>

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

Change 96168 by marcel@marcel_nfs on 2006/04/26 21:53:10

	Update the puc(4) bus attachment according to the new world
	order. Return BUS_PROBE_LOW_PRIORITY to allow uart(4) to
	take advantage of the serdev I/F.

Affected files ...

.. //depot/projects/uart/dev/sio/sio_puc.c#5 edit

Differences ...

==== //depot/projects/uart/dev/sio/sio_puc.c#5 (text+ko) ====

@@ -39,8 +39,8 @@
 #include <machine/bus.h>
 #include <sys/timepps.h>
 
-#include <dev/pci/pcivar.h>
-#include <dev/puc/pucvar.h>
+#include <dev/puc/puc_bus.h>
+
 #include <dev/sio/siovar.h>
 #include <dev/sio/sioreg.h>
 
@@ -63,30 +63,37 @@
 };
 
 static int
-sio_puc_attach(dev)
-	device_t	dev;
+sio_puc_attach(device_t dev)
 {
 	uintptr_t rclk;
 
-	if (BUS_READ_IVAR(device_get_parent(dev), dev, PUC_IVAR_FREQ,
+	if (BUS_READ_IVAR(device_get_parent(dev), dev, PUC_IVAR_CLOCK,
 	    &rclk) != 0)
 		rclk = DEFAULT_RCLK;
 	return (sioattach(dev, 0, rclk));
 }
 
 static int
-sio_puc_probe(dev)
-	device_t	dev;
+sio_puc_probe(device_t dev)
 {
-	uintptr_t rclk;
+	device_t parent;
+	uintptr_t rclk, type;
+	int error;
+
+	parent = device_get_parent(dev);
+
+	if (BUS_READ_IVAR(parent, dev, PUC_IVAR_TYPE, &type))
+		return (ENXIO);
+	if (type != PUC_TYPE_SERIAL)
+		return (ENXIO);
 
-	if (BUS_READ_IVAR(device_get_parent(dev), dev, PUC_IVAR_FREQ,
-	    &rclk) != 0)
+	if (BUS_READ_IVAR(parent, dev, PUC_IVAR_CLOCK, &rclk))
 		rclk = DEFAULT_RCLK;
 #ifdef PC98
 	SET_FLAG(dev, SET_IFTYPE(COM_IF_NS16550));
 #endif
-	return (sioprobe(dev, 0, rclk, 1));
+	error = sioprobe(dev, 0, rclk, 1);
+	return ((error > 0) ? error : BUS_PROBE_LOW_PRIORITY);
 }
 
 DRIVER_MODULE(sio, puc, sio_puc_driver, sio_devclass, 0, 0);



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