PERFORCE change 96168 for review
Marcel Moolenaar
marcel at FreeBSD.org
Wed Apr 26 21:54:01 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=96168
Change 96168 by marcel at 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);
More information about the p4-projects
mailing list