From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 08:27:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C78E81065693; Mon, 24 Aug 2009 08:27:42 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B74E48FC13; Mon, 24 Aug 2009 08:27:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O8RgYK086897; Mon, 24 Aug 2009 08:27:42 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O8Rgf0086895; Mon, 24 Aug 2009 08:27:42 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200908240827.n7O8Rgf0086895@svn.freebsd.org> From: Ed Schouten Date: Mon, 24 Aug 2009 08:27:42 +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: r196499 - head/sys/dev/xen/console X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 08:27:43 -0000 Author: ed Date: Mon Aug 24 08:27:42 2009 New Revision: 196499 URL: http://svn.freebsd.org/changeset/base/196499 Log: Cleanups to the Xen console driver: - Use CONSOLE_DRIVER() instead of the deprecated CONS_DRIVER() declaration. - This means we cannot use cn_checkc anymore, which is supposed to do the same as cn_getc nowadays. Remove the cn_getc implementation (that was never being called) and rename cn_checkc to cn_getc. - Don't run-time patch cn_putc, but add the logic to xc_cnputc(). This means I could do some cleanups to our console code... Tested by: nobody on hackers@ Modified: head/sys/dev/xen/console/console.c Modified: head/sys/dev/xen/console/console.c ============================================================================== --- head/sys/dev/xen/console/console.c Mon Aug 24 05:05:38 2009 (r196498) +++ head/sys/dev/xen/console/console.c Mon Aug 24 08:27:42 2009 (r196499) @@ -45,17 +45,15 @@ static int xc_mute; static void xcons_force_flush(void); static void xencons_priv_interrupt(void *); -static cn_probe_t xccnprobe; -static cn_init_t xccninit; -static cn_getc_t xccngetc; -static cn_putc_t xccnputc; -static cn_putc_t xccnputc_dom0; -static cn_checkc_t xccncheckc; +static cn_probe_t xc_cnprobe; +static cn_init_t xc_cninit; +static cn_term_t xc_cnterm; +static cn_getc_t xc_cngetc; +static cn_putc_t xc_cnputc; #define XC_POLLTIME (hz/10) -CONS_DRIVER(xc, xccnprobe, xccninit, NULL, xccngetc, - xccncheckc, xccnputc, NULL); +CONSOLE_DRIVER(xc); static int xen_console_up; static boolean_t xc_start_needed; @@ -105,7 +103,7 @@ static struct ttydevsw xc_ttydevsw = { }; static void -xccnprobe(struct consdev *cp) +xc_cnprobe(struct consdev *cp) { cp->cn_pri = CN_REMOTE; sprintf(cp->cn_name, "%s0", driver_name); @@ -113,37 +111,19 @@ xccnprobe(struct consdev *cp) static void -xccninit(struct consdev *cp) +xc_cninit(struct consdev *cp) { CN_LOCK_INIT(cn_mtx,"XCONS LOCK"); } -int -xccngetc(struct consdev *dev) -{ - int c; - if (xc_mute) - return 0; - do { - if ((c = xccncheckc(dev)) == -1) { -#ifdef KDB - if (!kdb_active) -#endif - /* - * Polling without sleeping in Xen - * doesn't work well. Sleeping gives - * other things like clock a chance to - * run - */ - tsleep(&cn_mtx, PWAIT | PCATCH, - "console sleep", XC_POLLTIME); - } - } while(c == -1); - return c; + +static void +xc_cnterm(struct consdev *cp) +{ } -int -xccncheckc(struct consdev *dev) +static int +xc_cngetc(struct consdev *dev) { int ret = (xc_mute ? 0 : -1); @@ -162,17 +142,27 @@ xccncheckc(struct consdev *dev) } static void -xccnputc(struct consdev *dev, int c) +xc_cnputc_domu(struct consdev *dev, int c) { xcons_putc(c); } static void -xccnputc_dom0(struct consdev *dev, int c) +xc_cnputc_dom0(struct consdev *dev, int c) { HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&c); } +static void +xc_cnputc(struct consdev *dev, int c) +{ + + if (xen_start_info->flags & SIF_INITDOMAIN) + xc_cnputc_dom0(dev, c); + else + xc_cnputc_domu(dev, c); +} + extern int db_active; static boolean_t xcons_putc(int c) @@ -226,10 +216,6 @@ xc_attach(device_t dev) { int error; - if (xen_start_info->flags & SIF_INITDOMAIN) { - xc_consdev.cn_putc = xccnputc_dom0; - } - xccons = tty_alloc(&xc_ttydevsw, NULL); tty_makedev(xccons, NULL, "xc%r", 0); @@ -388,7 +374,7 @@ xc_timeout(void *v) tp = (struct tty *)v; tty_lock(tp); - while ((c = xccncheckc(NULL)) != -1) + while ((c = xc_cngetc(NULL)) != -1) ttydisc_rint(tp, c, 0); if (xc_start_needed) {