From owner-p4-projects@FreeBSD.ORG Wed Sep 3 13:30:27 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4B3C51065673; Wed, 3 Sep 2008 13:30:27 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F51B1065670 for ; Wed, 3 Sep 2008 13:30:27 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id ED7868FC1C for ; Wed, 3 Sep 2008 13:30:26 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m83DUQFN032148 for ; Wed, 3 Sep 2008 13:30:26 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m83DUQwV032146 for perforce@freebsd.org; Wed, 3 Sep 2008 13:30:26 GMT (envelope-from rpaulo@FreeBSD.org) Date: Wed, 3 Sep 2008 13:30:26 GMT Message-Id: <200809031330.m83DUQwV032146@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo To: Perforce Change Reviews Cc: Subject: PERFORCE change 149113 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Sep 2008 13:30:27 -0000 http://perforce.freebsd.org/chv.cgi?CH=149113 Change 149113 by rpaulo@rpaulo_phi on 2008/09/03 13:30:20 Add the 'col' command with the same purpose as the EFI shell command with the same name: change the text mode resolution. This allows the boot loader to switch to the native LCD resolution if the system supports it. (I can change the screen resolution to 1280x800 on my MacBook). While there, add my copyright. Keep the loader version in sync with loader MBR because loader.4th on i386 fails if the version is < 1.1. Affected files ... .. //depot/projects/efi/boot/i386/efi/main.c#3 edit .. //depot/projects/efi/boot/i386/efi/version#2 edit Differences ... ==== //depot/projects/efi/boot/i386/efi/main.c#3 (text+ko) ==== @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2008 Rui Paulo * Copyright (c) 2006 Marcel Moolenaar * All rights reserved. * @@ -255,3 +256,52 @@ return CMD_OK; } + + +COMMAND_SET(col, "col", "change or display text modes", command_col); + +static int +command_col(int argc, char *argv[]) +{ + unsigned int cols, rows, mode; + int i, status; + char *cp; + char rowenv[8]; + SIMPLE_TEXT_OUTPUT_INTERFACE *conout; + + conout = ST->ConOut; + + if (argc > 1) { + mode = strtol(argv[1], &cp, 0); + if (cp[0] != '\0') { + printf("Invalid mode\n"); + return (CMD_ERROR); + } + status = conout->QueryMode(conout, mode, &cols, &rows); + if (EFI_ERROR(status)) { + printf("invalid mode %d\n", mode); + return (CMD_ERROR); + } + status = conout->SetMode(conout, mode); + if (EFI_ERROR(status)) { + printf("couldn't set mode %d\n", mode); + return (CMD_ERROR); + } + sprintf(rowenv, "%d", rows); + setenv("LINES", rowenv, 1); + + return (CMD_OK); + } + + for (i = 0; ; i++) { + status = conout->QueryMode(conout, i, &cols, &rows); + if (EFI_ERROR(status)) + break; + printf("Mode %d: %d columns, %d rows\n", i, cols, rows); + } + + if (i != 0) + printf("Choose the mode with \"col \"\n"); + + return (CMD_OK); +} ==== //depot/projects/efi/boot/i386/efi/version#2 (text+ko) ==== @@ -3,4 +3,5 @@ NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this file is important. Make sure the current version number is on line 6. +1.1: Keep in sync with i386 version. 0.1: Initial i386 version. Derived from ia64.