From owner-svn-src-head@FreeBSD.ORG Thu Jul 23 12:51:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C37E61065676; Thu, 23 Jul 2009 12:51:27 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B0A3F8FC1C; Thu, 23 Jul 2009 12:51:27 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6NCpRcX078924; Thu, 23 Jul 2009 12:51:27 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6NCpR2J078923; Thu, 23 Jul 2009 12:51:27 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200907231251.n6NCpR2J078923@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 23 Jul 2009 12:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195831 - head/sys/dev/uart X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jul 2009 12:51:28 -0000 Author: nwhitehorn Date: Thu Jul 23 12:51:27 2009 New Revision: 195831 URL: http://svn.freebsd.org/changeset/base/195831 Log: Fix serial console on Apple Xserve G5 by falling back to input-device-1 if input-device is unavailable. The Xserve G5 defaults to using screen/keyboard for output-device/input-device even if these are not installed, and then falls back to serial ports at boot time. Reviewed by: marcel Hardware from: grehan Approved by: re (kib) Modified: head/sys/dev/uart/uart_cpu_powerpc.c Modified: head/sys/dev/uart/uart_cpu_powerpc.c ============================================================================== --- head/sys/dev/uart/uart_cpu_powerpc.c Thu Jul 23 10:20:12 2009 (r195830) +++ head/sys/dev/uart/uart_cpu_powerpc.c Thu Jul 23 12:51:27 2009 (r195831) @@ -78,6 +78,27 @@ uart_cpu_getdev(int devtype, struct uart return (uart_getenv(devtype, di, class)); } #else +static int +ofw_get_uart_console(phandle_t opts, phandle_t *result, const char *inputdev, + const char *outputdev) +{ + char buf[64]; + phandle_t input; + + if (OF_getprop(opts, inputdev, buf, sizeof(buf)) == -1) + return (ENXIO); + input = OF_finddevice(buf); + if (input == -1) + return (ENXIO); + if (OF_getprop(opts, outputdev, buf, sizeof(buf)) == -1) + return (ENXIO); + if (OF_finddevice(buf) != input) + return (ENXIO); + + *result = input; + return (0); +} + int uart_cpu_getdev(int devtype, struct uart_devinfo *di) { @@ -94,15 +115,17 @@ uart_cpu_getdev(int devtype, struct uart return (ENXIO); switch (devtype) { case UART_DEV_CONSOLE: - if (OF_getprop(opts, "input-device", buf, sizeof(buf)) == -1) - return (ENXIO); - input = OF_finddevice(buf); - if (input == -1) - return (ENXIO); - if (OF_getprop(opts, "output-device", buf, sizeof(buf)) == -1) - return (ENXIO); - if (OF_finddevice(buf) != input) - return (ENXIO); + if (ofw_get_uart_console(opts, &input, "input-device", + "output-device")) { + /* + * At least some G5 Xserves require that we + * probe input-device-1 as well + */ + + if (ofw_get_uart_console(opts, &input, "input-device-1", + "output-device-1")) + return (ENXIO); + } break; case UART_DEV_DBGPORT: if (!getenv_string("hw.uart.dbgport", buf, sizeof(buf)))