From owner-svn-src-all@FreeBSD.ORG Mon Nov 3 11:58:33 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B91AB456; Mon, 3 Nov 2014 11:58:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 999223CD; Mon, 3 Nov 2014 11:58:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA3BwXMq058116; Mon, 3 Nov 2014 11:58:33 GMT (envelope-from nyan@FreeBSD.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA3BwXLf058114; Mon, 3 Nov 2014 11:58:33 GMT (envelope-from nyan@FreeBSD.org) Message-Id: <201411031158.sA3BwXLf058114@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: nyan set sender to nyan@FreeBSD.org using -f From: Takahashi Yoshihiro Date: Mon, 3 Nov 2014 11:58:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r274041 - in stable/10/sys/boot: i386/boot2 pc98/boot2 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 03 Nov 2014 11:58:33 -0000 Author: nyan Date: Mon Nov 3 11:58:32 2014 New Revision: 274041 URL: https://svnweb.freebsd.org/changeset/base/274041 Log: MFC: r268475 (by imp) Make SERIAL support optional again. Enable it for i386 because a huge percentage of machines has a 16550. Disable it for pc98 since only a tiny fraction of them have one. Modified: stable/10/sys/boot/i386/boot2/boot2.c stable/10/sys/boot/pc98/boot2/boot2.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/i386/boot2/boot2.c ============================================================================== --- stable/10/sys/boot/i386/boot2/boot2.c Mon Nov 3 11:49:35 2014 (r274040) +++ stable/10/sys/boot/i386/boot2/boot2.c Mon Nov 3 11:58:32 2014 (r274041) @@ -34,9 +34,22 @@ __FBSDID("$FreeBSD$"); #include "boot2.h" #include "lib.h" +/* Define to 0 to omit serial support */ +#ifndef SERIAL +#define SERIAL 1 +#endif + #define IO_KEYBOARD 1 #define IO_SERIAL 2 +#if SERIAL +#define DO_KBD (ioctrl & IO_KEYBOARD) +#define DO_SIO (ioctrl & IO_SERIAL) +#else +#define DO_KBD (1) +#define DO_SIO (0) +#endif + #define SECOND 18 /* Circa that many ticks in a second. */ #define RBX_ASKNAME 0x0 /* -a */ @@ -131,9 +144,11 @@ static struct dsk { static char cmd[512], cmddup[512], knamebuf[1024]; static const char *kname; static uint32_t opts; -static int comspeed = SIOSPD; static struct bootinfo bootinfo; +#if SERIAL +static int comspeed = SIOSPD; static uint8_t ioctrl = IO_KEYBOARD; +#endif void exit(int); static void load(void); @@ -276,7 +291,7 @@ main(void) "boot: ", dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit, 'a' + dsk.part, kname); - if (ioctrl & IO_SERIAL) + if (DO_SIO) sio_flush(); if (!autoboot || keyhit(3*SECOND)) getstr(); @@ -398,6 +413,7 @@ parse() } printf("Keyboard: %s\n", cp); continue; +#if SERIAL } else if (c == 'S') { j = 0; while ((unsigned int)(i = *arg++ - '0') <= 9) @@ -407,18 +423,21 @@ parse() break; } /* Fall through to error below ('S' not in optstr[]). */ +#endif } for (i = 0; c != optstr[i]; i++) if (i == NOPT - 1) return -1; opts ^= OPT_SET(flags[i]); } +#if SERIAL ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) : OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD; - if (ioctrl & IO_SERIAL) { + if (DO_SIO) { if (sio_init(115200 / comspeed) != 0) ioctrl &= ~IO_SERIAL; } +#endif } else { for (q = arg--; *q && *q != '('; q++); if (*q) { @@ -626,9 +645,9 @@ keyhit(unsigned ticks) static int xputc(int c) { - if (ioctrl & IO_KEYBOARD) + if (DO_KBD) putc(c); - if (ioctrl & IO_SERIAL) + if (DO_SIO) sio_putc(c); return c; } @@ -648,9 +667,9 @@ xgetc(int fn) if (OPT_CHECK(RBX_NOINTR)) return 0; for (;;) { - if (ioctrl & IO_KEYBOARD && getc(1)) + if (DO_KBD && getc(1)) return fn ? 1 : getc(0); - if (ioctrl & IO_SERIAL && sio_ischar()) + if (DO_SIO && sio_ischar()) return fn ? 1 : sio_getc(); if (fn) return 0; Modified: stable/10/sys/boot/pc98/boot2/boot2.c ============================================================================== --- stable/10/sys/boot/pc98/boot2/boot2.c Mon Nov 3 11:49:35 2014 (r274040) +++ stable/10/sys/boot/pc98/boot2/boot2.c Mon Nov 3 11:58:32 2014 (r274041) @@ -36,9 +36,22 @@ __FBSDID("$FreeBSD$"); #include "boot2.h" #include "lib.h" +/* Define to 0 to omit serial support */ +#ifndef SERIAL +#define SERIAL 0 +#endif + #define IO_KEYBOARD 1 #define IO_SERIAL 2 +#if SERIAL +#define DO_KBD (ioctrl & IO_KEYBOARD) +#define DO_SIO (ioctrl & IO_SERIAL) +#else +#define DO_KBD (1) +#define DO_SIO (0) +#endif + #define SECOND 1 /* Circa that many ticks in a second. */ #define RBX_ASKNAME 0x0 /* -a */ @@ -133,9 +146,11 @@ static struct dsk { static char cmd[512], cmddup[512], knamebuf[1024]; static const char *kname; static uint32_t opts; -static int comspeed = SIOSPD; static struct bootinfo bootinfo; +#if SERIAL +static int comspeed = SIOSPD; static uint8_t ioctrl = IO_KEYBOARD; +#endif void exit(int); static void load(void); @@ -415,7 +430,7 @@ main(void) "boot: ", dsk.unit, dev_nm[dsk.type], dsk.unit, 'a' + dsk.part, kname); - if (ioctrl & IO_SERIAL) + if (DO_SIO) sio_flush(); if (!autoboot || keyhit(3*SECOND)) getstr(); @@ -537,6 +552,7 @@ parse() } printf("Keyboard: %s\n", cp); continue; +#if SERIAL } else if (c == 'S') { j = 0; while ((unsigned int)(i = *arg++ - '0') <= 9) @@ -546,18 +562,21 @@ parse() break; } /* Fall through to error below ('S' not in optstr[]). */ +#endif } for (i = 0; c != optstr[i]; i++) if (i == NOPT - 1) return -1; opts ^= OPT_SET(flags[i]); } +#if SERIAL ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) : OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD; - if (ioctrl & IO_SERIAL) { + if (DO_SIO) { if (sio_init(115200 / comspeed) != 0) ioctrl &= ~IO_SERIAL; } +#endif } else { for (q = arg--; *q && *q != '('; q++); if (*q) { @@ -780,9 +799,9 @@ keyhit(unsigned sec) static int xputc(int c) { - if (ioctrl & IO_KEYBOARD) + if (DO_KBD) putc(c); - if (ioctrl & IO_SERIAL) + if (DO_SIO) sio_putc(c); return c; } @@ -805,9 +824,9 @@ xgetc(int fn) if (OPT_CHECK(RBX_NOINTR)) return 0; for (;;) { - if (ioctrl & IO_KEYBOARD && getc(1)) + if (DO_KBD && getc(1)) return fn ? 1 : getc(0); - if (ioctrl & IO_SERIAL && sio_ischar()) + if (DO_SIO && sio_ischar()) return fn ? 1 : sio_getc(); if (fn) return 0;