diff options
| author | Marius Strobl <marius@FreeBSD.org> | 2004-08-12 17:41:33 +0000 |
|---|---|---|
| committer | Marius Strobl <marius@FreeBSD.org> | 2004-08-12 17:41:33 +0000 |
| commit | 26280d88d76716790cf28f23fdb0bda56533e9b6 (patch) | |
| tree | e750b2d26d6511903970a6a2a5d73da06845d58b /sys/dev/zs | |
| parent | 9f7f340a0f9eb8af47d81687feb963fa612242e9 (diff) | |
Notes
Diffstat (limited to 'sys/dev/zs')
| -rw-r--r-- | sys/dev/zs/zs_macio.c | 14 | ||||
| -rw-r--r-- | sys/dev/zs/zs_sbus.c | 73 |
2 files changed, 17 insertions, 70 deletions
diff --git a/sys/dev/zs/zs_macio.c b/sys/dev/zs/zs_macio.c index 182fe77698e3..3879a9edf5d1 100644 --- a/sys/dev/zs/zs_macio.c +++ b/sys/dev/zs/zs_macio.c @@ -37,8 +37,8 @@ __FBSDID("$FreeBSD$"); #include <machine/resource.h> #include <sys/rman.h> +#include <dev/ofw/ofw_bus.h> #include <dev/ofw/openfirm.h> -#include <powerpc/powermac/maciovar.h> #include <dev/zs/z8530reg.h> #include <dev/zs/z8530var.h> @@ -132,7 +132,7 @@ static int zs_macio_probe(device_t dev) { - if (strcmp(macio_get_name(dev), "escc") != 0 || + if (strcmp(ofw_bus_get_name(dev), "escc") != 0 || device_get_unit(dev) != 0) return (ENXIO); return (zs_probe(dev)); @@ -142,10 +142,8 @@ static int zs_macio_attach(device_t dev) { struct zs_macio_softc *sc; - struct macio_reg *reg; sc = device_get_softc(dev); - reg = macio_get_regs(dev); sc->sc_memres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_memrid, RF_ACTIVE); @@ -265,16 +263,15 @@ zstty_set_speed(struct zstty_softc *sc, int ospeed) int zstty_console(device_t dev, char *mode, int len) { - device_t parent; - phandle_t chosen, options; + phandle_t chosen, options, parent; ihandle_t stdin, stdout; phandle_t stdinp, stdoutp; char input[32], output[32]; const char *desc; - parent = device_get_parent(dev); chosen = OF_finddevice("/chosen"); options = OF_finddevice("/options"); + parent = ofw_bus_get_node(device_get_parent(dev)); if (OF_getprop(chosen, "stdin", &stdin, sizeof(stdin)) == -1 || OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) == -1 || OF_getprop(options, "input-device", input, sizeof(input)) == -1 || @@ -285,8 +282,7 @@ zstty_console(device_t dev, char *mode, int len) stdinp = OF_parent(OF_instance_to_package(stdin)); stdoutp = OF_parent(OF_instance_to_package(stdout)); desc = device_get_desc(dev); - if (macio_get_node(parent) == stdinp && - macio_get_node(parent) == stdoutp && + if (parent == stdinp && parent == stdoutp && input[3] == desc[3] && output[3] == desc[3]) { if (mode != NULL) strlcpy(mode, "57600,8,n,1,-", len); diff --git a/sys/dev/zs/zs_sbus.c b/sys/dev/zs/zs_sbus.c index 796d076501eb..40b7ea4fd074 100644 --- a/sys/dev/zs/zs_sbus.c +++ b/sys/dev/zs/zs_sbus.c @@ -34,16 +34,15 @@ __FBSDID("$FreeBSD$"); #include <sys/kernel.h> #include <sys/lock.h> #include <sys/module.h> + +#include <dev/ofw/ofw_bus.h> +#include <dev/ofw/openfirm.h> + #include <machine/bus.h> #include <machine/resource.h> #include <sys/rman.h> -#include <dev/ofw/openfirm.h> - #include <sparc64/fhc/fhcreg.h> -#include <sparc64/fhc/fhcvar.h> - -#include <sparc64/sbus/sbusvar.h> #include <dev/zs/z8530reg.h> #include <dev/zs/z8530var.h> @@ -59,12 +58,6 @@ __FBSDID("$FreeBSD$"); #define ZS_SBUS_DEF_SPEED (9600) -enum zs_device_ivars { - ZS_IVAR_NODE -}; - -__BUS_ACCESSOR(zs, node, ZS, NODE, phandle_t) - struct zs_sbus_softc { struct zs_softc sc_zs; struct resource *sc_irqres; @@ -74,15 +67,10 @@ struct zs_sbus_softc { int sc_memrid; }; -static int zs_fhc_probe(device_t dev); static int zs_fhc_attach(device_t dev); -static int zs_fhc_read_ivar(device_t dev, device_t child, int which, - uintptr_t *result); static int zs_sbus_probe(device_t dev); static int zs_sbus_attach(device_t dev); -static int zs_sbus_read_ivar(device_t dev, device_t child, int which, - uintptr_t *result); static int zs_sbus_detach(device_t dev); @@ -92,12 +80,11 @@ static int zstty_sbus_probe(device_t dev); static int zstty_keyboard(device_t dev); static device_method_t zs_fhc_methods[] = { - DEVMETHOD(device_probe, zs_fhc_probe), + DEVMETHOD(device_probe, zs_sbus_probe), DEVMETHOD(device_attach, zs_fhc_attach), DEVMETHOD(device_detach, zs_sbus_detach), DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, zs_fhc_read_ivar), { 0, 0 } }; @@ -108,7 +95,6 @@ static device_method_t zs_sbus_methods[] = { DEVMETHOD(device_detach, zs_sbus_detach), DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, zs_sbus_read_ivar), { 0, 0 } }; @@ -169,20 +155,10 @@ static uint8_t zs_sbus_init_reg[16] = { }; static int -zs_fhc_probe(device_t dev) -{ - - if (strcmp(fhc_get_name(dev), "zs") != 0 || - device_get_unit(dev) != 0) - return (ENXIO); - return (zs_probe(dev)); -} - -static int zs_sbus_probe(device_t dev) { - if (strcmp(sbus_get_name(dev), "zs") != 0 || + if (strcmp(ofw_bus_get_name(dev), "zs") != 0 || device_get_unit(dev) != 0) return (ENXIO); return (zs_probe(dev)); @@ -260,34 +236,6 @@ zs_sbus_detach(device_t dev) } static int -zs_fhc_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) -{ - - switch (which) { - case ZS_IVAR_NODE: - *result = fhc_get_node(dev); - break; - default: - return (ENOENT); - } - return (0); -} - -static int -zs_sbus_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) -{ - - switch (which) { - case ZS_IVAR_NODE: - *result = sbus_get_node(dev); - break; - default: - return (ENOENT); - } - return (0); -} - -static int zstty_sbus_probe(device_t dev) { @@ -349,6 +297,7 @@ zstty_console(device_t dev, char *mode, int len) { phandle_t chosen; phandle_t options; + phandle_t parent; ihandle_t stdin; ihandle_t stdout; char output[32]; @@ -357,13 +306,14 @@ zstty_console(device_t dev, char *mode, int len) chosen = OF_finddevice("/chosen"); options = OF_finddevice("/options"); + parent = ofw_bus_get_node(device_get_parent(dev)); if (OF_getprop(chosen, "stdin", &stdin, sizeof(stdin)) == -1 || OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) == -1 || OF_getprop(options, "input-device", input, sizeof(input)) == -1 || OF_getprop(options, "output-device", output, sizeof(output)) == -1) return (0); - if (zs_get_node(dev) != OF_instance_to_package(stdin) || - zs_get_node(dev) != OF_instance_to_package(stdout)) + if (parent != OF_instance_to_package(stdin) || + parent != OF_instance_to_package(stdout)) return (0); if ((strcmp(input, device_get_desc(dev)) == 0 && strcmp(output, device_get_desc(dev)) == 0) || @@ -382,5 +332,6 @@ static int zstty_keyboard(device_t dev) { - return (OF_getproplen(zs_get_node(dev), "keyboard") == 0); + return (OF_getproplen(ofw_bus_get_node(device_get_parent(dev)), + "keyboard") == 0); } |
