From owner-svn-src-all@freebsd.org Tue May 17 14:10:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44DFBB3DBE4; Tue, 17 May 2016 14:10:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 F182E294A; Tue, 17 May 2016 14:10:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4HEAkHU057393; Tue, 17 May 2016 14:10:46 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4HEAjRP057390; Tue, 17 May 2016 14:10:45 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201605171410.u4HEAjRP057390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 17 May 2016 14:10:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300056 - in head/sys/boot: common efi/libefi X-SVN-Group: head 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.22 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: Tue, 17 May 2016 14:10:47 -0000 Author: imp Date: Tue May 17 14:10:45 2016 New Revision: 300056 URL: https://svnweb.freebsd.org/changeset/base/300056 Log: It sure would be nice to use printf with wide strings. Implement %S to do that. The C_WIDEOUT flag indicates that the console supports it. Mark the EFI console as supporting this. MFC After: 3 days Modified: head/sys/boot/common/bootstrap.h head/sys/boot/common/util.c head/sys/boot/efi/libefi/efi_console.c Modified: head/sys/boot/common/bootstrap.h ============================================================================== --- head/sys/boot/common/bootstrap.h Tue May 17 14:10:44 2016 (r300055) +++ head/sys/boot/common/bootstrap.h Tue May 17 14:10:45 2016 (r300056) @@ -102,6 +102,7 @@ struct console #define C_PRESENTOUT (1<<1) /* console can provide output */ #define C_ACTIVEIN (1<<2) /* user wants input from console */ #define C_ACTIVEOUT (1<<3) /* user wants output to console */ +#define C_WIDEOUT (1<<4) /* c_out routine groks wide chars */ void (* c_probe)(struct console *cp); /* set c_flags to match hardware */ int (* c_init)(int arg); /* reinit XXX may need more args */ void (* c_out)(int c); /* emit c */ Modified: head/sys/boot/common/util.c ============================================================================== --- head/sys/boot/common/util.c Tue May 17 14:10:44 2016 (r300055) +++ head/sys/boot/common/util.c Tue May 17 14:10:45 2016 (r300056) @@ -120,6 +120,7 @@ printf(const char *fmt, ...) va_list ap; const char *hex = "0123456789abcdef"; char buf[32], *s; + uint16_t *S; unsigned long long u; int c, l; @@ -143,6 +144,10 @@ nextfmt: for (s = va_arg(ap, char *); *s != '\0'; s++) putchar(*s); break; + case 'S': /* Assume console can cope with wide chars */ + for (S = va_arg(ap, uint16_t *); *S != 0; S++) + putchar(*S); + break; case 'd': /* A lie, always prints unsigned */ case 'u': case 'x': Modified: head/sys/boot/efi/libefi/efi_console.c ============================================================================== --- head/sys/boot/efi/libefi/efi_console.c Tue May 17 14:10:44 2016 (r300055) +++ head/sys/boot/efi/libefi/efi_console.c Tue May 17 14:10:45 2016 (r300056) @@ -61,7 +61,7 @@ int efi_cons_poll(void); struct console efi_console = { "efi", "EFI console", - 0, + C_WIDEOUT, efi_cons_probe, efi_cons_init, efi_cons_putchar,