From f8100ce2a70db5c60672578fee913d986ac1cf01 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Mon, 2 Apr 2007 22:00:22 +0000 Subject: Don't expose the uart_ops structure directly, but instead have it obtained through the uart_class structure. This allows us to declare the uart_class structure as weak and as such allows us to reference it even when it's not compiled-in. It also allows is to get the uart_ops structure by name, which makes it possible to implement the dt tag handling in uart_getenv(). The side-effect of all this is that we're using the uart_class structure more consistently which means that we now also have access to the size of the bus space block needed by the hardware when we map the bus space, eliminating any hardcoding. --- sys/dev/uart/uart_cpu_powerpc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sys/dev/uart/uart_cpu_powerpc.c') diff --git a/sys/dev/uart/uart_cpu_powerpc.c b/sys/dev/uart/uart_cpu_powerpc.c index 53f57dc7e49a5..6647c7dbb3479 100644 --- a/sys/dev/uart/uart_cpu_powerpc.c +++ b/sys/dev/uart/uart_cpu_powerpc.c @@ -52,9 +52,14 @@ int uart_cpu_getdev(int devtype, struct uart_devinfo *di) { char buf[64]; + struct uart_class *class; phandle_t input, opts; int error; + class = &uart_z8530_class; + if (class == NULL) + return (ENXIO); + if ((opts = OF_finddevice("/options")) == -1) return (ENXIO); switch (devtype) { @@ -93,7 +98,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) if (error) return (error); - di->ops = uart_z8530_ops; + di->ops = uart_getops(class); di->bas.rclk = 230400; di->bas.chan = 1; -- cgit v1.2.3