PERFORCE change 149113 for review
Rui Paulo
rpaulo at FreeBSD.org
Wed Sep 3 13:30:27 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=149113
Change 149113 by rpaulo at 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 <mode number>\"\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.
More information about the p4-projects
mailing list