1/*-
2 * Copyright (c) 2001 by Thomas Moestl <tmm@FreeBSD.org>.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 11 unchanged lines hidden (view full) ---
20 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_bus_ebus.c 120452 2003-09-26 05:14:56Z marcel $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bus.h>
33#include <sys/kernel.h>
34#include <machine/bus.h>
35#include <sys/rman.h>
36#include <machine/resource.h>
--- 19 unchanged lines hidden (view full) ---
56 uart_driver_name,
57 uart_ebus_methods,
58 sizeof(struct uart_softc),
59};
60
61static int
62uart_ebus_probe(device_t dev)
63{
64 const char *nm;
65 struct uart_softc *sc;
66 int error;
67
68 sc = device_get_softc(dev);
69 sc->sc_class = NULL;
70
71 nm = ebus_get_name(dev);
72 if (!strcmp(nm, "su")) {
73 sc->sc_class = &uart_ns8250_class;
74 return (uart_bus_probe(dev, 0, 0, 0, 0));
75 }
76 if (!strcmp(nm, "se")) {
77 sc->sc_class = &uart_sab82532_class;
78 error = uart_bus_probe(dev, 0, 0, 0, 1);
79 return ((error) ? error : -1);
80 }
81
82 return (ENXIO);
83}
84
85DRIVER_MODULE(uart, ebus, uart_ebus_driver, uart_devclass, 0, 0);
2 * Copyright (c) 2001 by Thomas Moestl <tmm@FreeBSD.org>.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 11 unchanged lines hidden (view full) ---
20 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_bus_ebus.c 120452 2003-09-26 05:14:56Z marcel $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bus.h>
33#include <sys/kernel.h>
34#include <machine/bus.h>
35#include <sys/rman.h>
36#include <machine/resource.h>
--- 19 unchanged lines hidden (view full) ---
56 uart_driver_name,
57 uart_ebus_methods,
58 sizeof(struct uart_softc),
59};
60
61static int
62uart_ebus_probe(device_t dev)
63{
64 const char *nm;
65 struct uart_softc *sc;
66 int error;
67
68 sc = device_get_softc(dev);
69 sc->sc_class = NULL;
70
71 nm = ebus_get_name(dev);
72 if (!strcmp(nm, "su")) {
73 sc->sc_class = &uart_ns8250_class;
74 return (uart_bus_probe(dev, 0, 0, 0, 0));
75 }
76 if (!strcmp(nm, "se")) {
77 sc->sc_class = &uart_sab82532_class;
78 error = uart_bus_probe(dev, 0, 0, 0, 1);
79 return ((error) ? error : -1);
80 }
81
82 return (ENXIO);
83}
84
85DRIVER_MODULE(uart, ebus, uart_ebus_driver, uart_devclass, 0, 0);