From d8dc7b1b43b47371a532abe378dbb63e21d589d0 Mon Sep 17 00:00:00 2001 From: marius Date: Sat, 4 Feb 2006 23:27:16 +0000 Subject: - Add support for using LOM (Lights Out Management) and RSC (Remote System Control) devices as console. These are microcontrollers which are either on-board or part of an add-on card and provide terminal server, remote power switch and monitoring functionality. For console usage these are connected to the rest of the system via a SCC or an UART. This commit adds support for the following variants (corresponds to what 'input-device' and 'output-device' have to be set to): rsc found on-board in E250 and supposedly some Netra, connected via a SAB82532, com. parameters can be determined via OFW rsc-console RSC card found in E280R, Fire V4x0, Fire V8x0, connected via a NS16550, hardwired to 115200 8N1 lom-console LOMlite2 card found in Netra 20/T4, connected via a NS16550, hardwired to 9600 8N1 - Add my copyright to uart_cpu_sparc64.c as I've rewritten about one third of that file over time. Tested on: E250, E280R Thanks to: dwhite@ for providing access to an E280R OK'ed by: marcel MFC after: 1 week --- sys/dev/uart/uart_bus_ebus.c | 10 +++++++--- sys/dev/uart/uart_cpu_sparc64.c | 36 ++++++++++++++++++++++++++---------- 2 files changed, 33 insertions(+), 13 deletions(-) (limited to 'sys/dev/uart') diff --git a/sys/dev/uart/uart_bus_ebus.c b/sys/dev/uart/uart_bus_ebus.c index cdff725..76e36b3 100644 --- a/sys/dev/uart/uart_bus_ebus.c +++ b/sys/dev/uart/uart_bus_ebus.c @@ -72,8 +72,12 @@ uart_ebus_probe(device_t dev) nm = ofw_bus_get_name(dev); cmpt = ofw_bus_get_compat(dev); - if (!strcmp(nm, "su") || !strcmp(nm, "su_pnp") || (cmpt != NULL && - (!strcmp(cmpt, "su") || !strcmp(cmpt, "su16550")))) { + if (cmpt == NULL) + cmpt = ""; + if (!strcmp(nm, "lom-console") || !strcmp(nm, "su") || + !strcmp(nm, "su_pnp") || !strcmp(cmpt, "rsc-console") || + !strcmp(cmpt, "rsc-control") || !strcmp(cmpt, "su") || + !strcmp(cmpt, "su16550")) { /* * On AXi and AXmp boards the NS16550 (used to connect * keyboard/mouse) share their IRQ lines with the i8042. @@ -95,7 +99,7 @@ uart_ebus_probe(device_t dev) sc->sc_class = &uart_ns8250_class; return (uart_bus_probe(dev, 0, 0, 0, 0)); } - if (!strcmp(nm, "se") || (cmpt != NULL && !strcmp(cmpt, "sab82532"))) { + if (!strcmp(nm, "se") || !strcmp(cmpt, "sab82532")) { sc->sc_class = &uart_sab82532_class; return (uart_bus_probe(dev, 0, 0, 0, 1)); } diff --git a/sys/dev/uart/uart_cpu_sparc64.c b/sys/dev/uart/uart_cpu_sparc64.c index 61c9e01..efe0283 100644 --- a/sys/dev/uart/uart_cpu_sparc64.c +++ b/sys/dev/uart/uart_cpu_sparc64.c @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003, 2004 Marcel Moolenaar + * Copyright (c) 2004 - 2006 Marius Strobl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,12 +46,18 @@ bus_space_tag_t uart_bus_space_mem; static struct bus_space_tag bst_store[3]; /* - * Determine which channel of a SCC a device referenced by an alias is. - * The information present in the OF device tree only allows to do this - * for "ttyX" aliases. If a device is a channel of a SCC its property - * in the /aliases node looks like one of these: + * Determine which channel of a SCC a device referenced by a full device + * path or as an alias is (in the latter case we try to look up the device + * path via the /aliases node). + * Only the device paths of devices which are used for TTYs really allow + * to do this as they look like these (taken from /aliases nodes): * ttya: '/central/fhc/zs@0,902000:a' * ttyc: '/pci@1f,0/pci@1,1/ebus@1/se@14,400000:a' + * Additionally, for device paths of SCCs which are connected to a RSC + * (Remote System Control) device we can hardcode the appropriate channel. + * Such device paths look like these: + * rsc: '/pci@1f,4000/ebus@1/se@14,200000:ssp' + * ttyc: '/pci@1f,4000/ebus@1/se@14,200000:ssp' */ static int uart_cpu_channel(char *dev) @@ -58,15 +65,20 @@ uart_cpu_channel(char *dev) char alias[64]; phandle_t aliases; int len; + const char *p; strcpy(alias, dev); if ((aliases = OF_finddevice("/aliases")) != -1) - OF_getprop(aliases, dev, alias, sizeof(alias)); + (void)OF_getprop(aliases, dev, alias, sizeof(alias)); len = strlen(alias); - if (len < 2 || alias[len - 2] != ':' || alias[len - 1] < 'a' || - alias[len - 1] > 'b') + if ((p = rindex(alias, ':')) == NULL) return (0); - return (alias[len - 1] - 'a' + 1); + p++; + if (p - alias == len - 1 && (*p == 'a' || *p == 'b')) + return (*p - 'a' + 1); + if (strcmp(p, "ssp") == 0) + return (1); + return (0); } int @@ -237,7 +249,8 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) } di->bas.regshft = 1; addr += 4 - 4 * (di->bas.chan - 1); - } else if (!strcmp(buf, "su") || !strcmp(buf, "su_pnp") || + } else if (!strcmp(buf, "lom-console") || !strcmp(buf, "su") || + !strcmp(buf, "su_pnp") || !strcmp(compat, "rsc-console") || !strcmp(compat, "su") || !strcmp(compat, "su16550")) { di->ops = uart_ns8250_ops; di->bas.chan = 0; @@ -251,13 +264,16 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) /* Get the line settings. */ if (devtype == UART_DEV_KEYBOARD) di->baudrate = 1200; + else if (!strcmp(compat, "rsc-console")) + di->baudrate = 115200; else di->baudrate = 9600; di->databits = 8; di->stopbits = 1; di->parity = UART_PARITY_NONE; snprintf(buf, sizeof(buf), "%s-mode", dev); - if (OF_getprop(options, buf, buf, sizeof(buf)) == -1) + if (OF_getprop(options, buf, buf, sizeof(buf)) == -1 && + OF_getprop(input, "ssp-console-modes", buf, sizeof(buf)) == -1) return (0); if (sscanf(buf, "%d,%d,%c,%d,%c", &baud, &bits, &par, &stop, &flag) != 5) -- cgit v1.1