diff options
| author | Marius Strobl <marius@FreeBSD.org> | 2004-08-14 23:54:27 +0000 |
|---|---|---|
| committer | Marius Strobl <marius@FreeBSD.org> | 2004-08-14 23:54:27 +0000 |
| commit | efa79eb77e9583863d9f6e8c0c935ae90ca1c2b1 (patch) | |
| tree | 45f3053dc7134b15d707744ad441add24d7905eb | |
| parent | d25ed517a469a2344b00193c03356a022a4f08e2 (diff) | |
Notes
| -rw-r--r-- | sys/dev/uart/uart_bus_isa.c | 2 | ||||
| -rw-r--r-- | sys/dev/uart/uart_cpu.h | 1 | ||||
| -rw-r--r-- | sys/dev/uart/uart_cpu_alpha.c | 6 | ||||
| -rw-r--r-- | sys/dev/uart/uart_cpu_amd64.c | 6 | ||||
| -rw-r--r-- | sys/dev/uart/uart_cpu_i386.c | 6 | ||||
| -rw-r--r-- | sys/dev/uart/uart_cpu_ia64.c | 6 | ||||
| -rw-r--r-- | sys/dev/uart/uart_cpu_pc98.c | 6 | ||||
| -rw-r--r-- | sys/dev/uart/uart_cpu_sparc64.c | 46 | ||||
| -rw-r--r-- | sys/modules/uart/Makefile | 9 |
9 files changed, 86 insertions, 2 deletions
diff --git a/sys/dev/uart/uart_bus_isa.c b/sys/dev/uart/uart_bus_isa.c index d6b5cda734bb..72e054987954 100644 --- a/sys/dev/uart/uart_bus_isa.c +++ b/sys/dev/uart/uart_bus_isa.c @@ -39,11 +39,13 @@ __FBSDID("$FreeBSD$"); #include <dev/uart/uart.h> #include <dev/uart/uart_bus.h> +#include <dev/uart/uart_cpu.h> static int uart_isa_probe(device_t dev); static device_method_t uart_isa_methods[] = { /* Device interface */ + DEVMETHOD(device_identify, uart_cpu_identify), DEVMETHOD(device_probe, uart_isa_probe), DEVMETHOD(device_attach, uart_bus_attach), DEVMETHOD(device_detach, uart_bus_detach), diff --git a/sys/dev/uart/uart_cpu.h b/sys/dev/uart/uart_cpu.h index 462eb59b1e83..78626339fa14 100644 --- a/sys/dev/uart/uart_cpu.h +++ b/sys/dev/uart/uart_cpu.h @@ -75,6 +75,7 @@ int uart_cpu_getdev(int, struct uart_devinfo *); int uart_getenv(int, struct uart_devinfo *); void uart_add_sysdev(struct uart_devinfo *); +void uart_cpu_identify(driver_t *, device_t); /* * Operations for low-level access to the UART. Primarily for use diff --git a/sys/dev/uart/uart_cpu_alpha.c b/sys/dev/uart/uart_cpu_alpha.c index a3a132f6aa2b..67b49b4f0c50 100644 --- a/sys/dev/uart/uart_cpu_alpha.c +++ b/sys/dev/uart/uart_cpu_alpha.c @@ -123,3 +123,9 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) return (ENXIO); } + +void +uart_cpu_identify(driver_t *driver, device_t parent) +{ + +} diff --git a/sys/dev/uart/uart_cpu_amd64.c b/sys/dev/uart/uart_cpu_amd64.c index c0270ae6a2cb..8a32574f0c32 100644 --- a/sys/dev/uart/uart_cpu_amd64.c +++ b/sys/dev/uart/uart_cpu_amd64.c @@ -99,3 +99,9 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) return (ENXIO); } + +void +uart_cpu_identify(driver_t *driver, device_t parent) +{ + +} diff --git a/sys/dev/uart/uart_cpu_i386.c b/sys/dev/uart/uart_cpu_i386.c index 93ca77079459..7cf2fd09c089 100644 --- a/sys/dev/uart/uart_cpu_i386.c +++ b/sys/dev/uart/uart_cpu_i386.c @@ -99,3 +99,9 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) return (ENXIO); } + +void +uart_cpu_identify(driver_t *driver, device_t parent) +{ + +} diff --git a/sys/dev/uart/uart_cpu_ia64.c b/sys/dev/uart/uart_cpu_ia64.c index 6c3f3809826e..70464567036a 100644 --- a/sys/dev/uart/uart_cpu_ia64.c +++ b/sys/dev/uart/uart_cpu_ia64.c @@ -104,3 +104,9 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) /* Check the environment. */ return (uart_getenv(devtype, di)); } + +void +uart_cpu_identify(driver_t *driver, device_t parent) +{ + +} diff --git a/sys/dev/uart/uart_cpu_pc98.c b/sys/dev/uart/uart_cpu_pc98.c index ffe7957ecec9..3fc263017afb 100644 --- a/sys/dev/uart/uart_cpu_pc98.c +++ b/sys/dev/uart/uart_cpu_pc98.c @@ -104,3 +104,9 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) return (ENXIO); } + +void +uart_cpu_identify(driver_t *driver, device_t parent) +{ + +} diff --git a/sys/dev/uart/uart_cpu_sparc64.c b/sys/dev/uart/uart_cpu_sparc64.c index df89a2e0789d..a56b0ad7b3c6 100644 --- a/sys/dev/uart/uart_cpu_sparc64.c +++ b/sys/dev/uart/uart_cpu_sparc64.c @@ -27,18 +27,28 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_isa.h" + #include <sys/param.h> #include <sys/systm.h> #include <machine/bus.h> #include <machine/bus_private.h> +#include <machine/resource.h> +#include <dev/ofw/ofw_bus.h> #include <dev/ofw/openfirm.h> #include <machine/ofw_machdep.h> +#include <isa/isavar.h> + #include <dev/uart/uart.h> +#include <dev/uart/uart_bus.h> #include <dev/uart/uart_cpu.h> +#include <sparc64/pci/ofw_pci.h> +#include <sparc64/isa/ofw_isa.h> + bus_space_tag_t uart_bus_space_io; bus_space_tag_t uart_bus_space_mem; @@ -240,3 +250,39 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) (par == 'o') ? UART_PARITY_ODD : UART_PARITY_EVEN; return (0); } + +void +uart_cpu_identify(driver_t *driver, device_t parent) +{ +#ifdef DEV_ISA + char buf[32]; + struct isa_regs reg; + device_t child; + phandle_t node; + ofw_isa_intr_t intr; +#endif + +#ifdef DEV_ISA + if (strcmp(device_get_name(parent), "isa") == 0) { + if ((node = ofw_bus_get_node(device_get_parent(parent))) == 0) + return; + for (node = OF_child(node); node != 0; node = OF_peer(node)) { + if (OF_getprop(node, "name", buf, sizeof(buf)) == -1) + continue; + if (strcmp(buf, "serial") != 0) + continue; + if ((OF_getprop(node, "reg", ®, + sizeof(reg)) == -1) || + (OF_getprop(node, "interrupts", &intr, + sizeof(intr)) == -1)) + continue; + if ((child = BUS_ADD_CHILD(parent, ISA_ORDER_SENSITIVE, + uart_driver_name, -1)) == NULL) + return; + bus_set_resource(child, SYS_RES_IOPORT, 0, + ISA_REG_PHYS(®), reg.size); + bus_set_resource(child, SYS_RES_IRQ, 0, intr, 1); + } + } +#endif +} diff --git a/sys/modules/uart/Makefile b/sys/modules/uart/Makefile index 9214a73ddf7e..8a418faa11bc 100644 --- a/sys/modules/uart/Makefile +++ b/sys/modules/uart/Makefile @@ -5,6 +5,8 @@ .if ${MACHINE_ARCH} == "sparc64" uart_bus_ebus= uart_bus_ebus.c ofw_bus_if= ofw_bus_if.h +ofw_pci_if= ofw_pci_if.h +opt_isa= opt_isa.h .endif KMOD= uart @@ -12,7 +14,10 @@ SRCS= uart_bus_acpi.c ${uart_bus_ebus} uart_bus_isa.c uart_bus_pccard.c \ uart_bus_pci.c uart_bus_puc.c uart_core.c uart_cpu_${MACHINE}.c \ uart_dbg.c uart_dev_i8251.c uart_dev_ns8250.c uart_dev_sab82532.c \ uart_dev_z8530.c uart_if.c uart_subr.c uart_tty.c -SRCS+= bus_if.h card_if.h device_if.h isa_if.h ${ofw_bus_if} pci_if.h \ - power_if.h uart_if.h pccarddevs.h +SRCS+= bus_if.h card_if.h device_if.h isa_if.h ${ofw_bus_if} ${ofw_pci_if} \ + ${opt_isa} pci_if.h power_if.h uart_if.h pccarddevs.h + +opt_isa.h: + echo "#define DEV_ISA 1" > ${.TARGET} .include <bsd.kmod.mk> |
