This patch adds support for handling ACS (the alternate/special graphics character set) both on VGA and serial console in libpayload. It also updates coreinfo to use the ACS_ macros for line graphics.
Build tested against svn HEAD. To actually get any output, the previously sent libpayload-kconfig patch, or equivalent, is needed too. Runtime tested with coreboot-v3 in QEMU.
/ulf
On 10/08/08 16:42 +0200, Ulf Jordan wrote:
This patch adds support for handling ACS (the alternate/special graphics character set) both on VGA and serial console in libpayload. It also updates coreinfo to use the ACS_ macros for line graphics.
Build tested against svn HEAD. To actually get any output, the previously sent libpayload-kconfig patch, or equivalent, is needed too. Runtime tested with coreboot-v3 in QEMU.
/ulf
Add support for line drawing characters and the alternate character set. This enables using the ACS_ curses macros with libpayload.
The translation from ACS_ macros (or characters with attribute A_ALTCHARSET) is done using one acs map for the video console, one for serial console (xterm/vt100/vt220), and one fallback, from which an ASCII substitute is taken if the device specific map doesn't contain an entry (ie NUL).
coreinfo is also adapted to take advantage of the symbolic ACS_ constants.
Signed-off-by: Ulf Jordan jordan@chalmers.se
This adds a lot of extra .data space. What do we lose if we don't support alternate character sets? Mabye we can make this conditional in the kconfig.
Jordan
Index: libpayload/include/libpayload.h
--- libpayload/include/libpayload.h.orig 2008-08-10 15:45:28.000000000 +0200 +++ libpayload/include/libpayload.h 2008-08-10 15:47:03.000000000 +0200 @@ -110,6 +110,8 @@ void serial_clear(void); void serial_start_bold(void); void serial_end_bold(void); +void serial_start_altcharset(void); +void serial_end_altcharset(void); void serial_set_cursor(int y, int x);
/* drivers/speaker.c */ Index: libpayload/curses/tinycurses.c =================================================================== --- libpayload/curses/tinycurses.c.orig 2008-08-10 15:45:28.000000000 +0200 +++ libpayload/curses/tinycurses.c 2008-08-10 15:47:03.000000000 +0200 @@ -2,6 +2,7 @@
- This file is part of the libpayload project.
- Copyright (C) 2007 Uwe Hermann uwe@hermann-uwe.de
- Copyright (C) 2008 Ulf Jordan jordan@chalmers.se
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
@@ -88,6 +89,69 @@ SCREEN *SP; chtype acs_map[128];
+/* See terminfo(5). */ +chtype fallback_acs_map[128] =
- {
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', '>', '<', '^', 'v', ' ',
- '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- '+', ':', ' ', ' ', ' ', ' ', '\', '#',
- '#', '#', '+', '+', '+', '+', '+', '~',
- '-', '-', '-', '_', '+', '+', '+', '+',
- '|', '<', '>', '*', '!', 'f', 'o', ' ',
- };
+/* See acsc of vt100. */ +chtype serial_acs_map[128] =
- {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- '`', 'a', 0, 0, 0, 0, 'f', 'g',
- 0, 0, 'j', 'k', 'l', 'm', 'n', 'o',
- 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
- 'x', 'y', 'z', '{', '|', '}', '~', 0,
- };
+/* See acsc of linux. */ +chtype console_acs_map[128] =
- {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, '\020', '\021', '\030', '\031', 0,
- '\333', 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- '\004', '\261', 0, 0, 0, 0, '\370', '\361',
- '\260', '\316', '\331', '\277', '\332', '\300', '\305', '~',
- '\304', '\304', '\304', '_', '\303', '\264', '\301', '\302',
- '\263', '\363', '\362', '\342', '\330', '\234', '\376', 0,
- };
// FIXME: Ugly (and insecure!) hack! char sprintf_tmp[1024];
@@ -213,11 +277,14 @@ /** Note: Must _not_ be called twice! */ WINDOW *initscr(void) {
- int x, y;
int x, y, i;
// newterm(name, stdout, stdin); // def_prog_mode();
for (i = 0; i < 128; i++)
acs_map[i] = (chtype) i | A_ALTCHARSET;
if (curses_flags & F_ENABLE_SERIAL) { serial_clear(); }
@@ -409,12 +476,12 @@ // NCURSES_CH_T wch; // SetChar2(wch, ch);
- win->_line[win->_cury].text[win->_curx].chars[0] = ch;
- /* Use the window attributes - perhaps we also pull attributes from
the ch itself, I don't know */
win->_line[win->_cury].text[win->_curx].chars[0] =
((ch) & (chtype)A_CHARTEXT);
win->_line[win->_cury].text[win->_curx].attr = WINDOW_ATTRS(win);
win->_line[win->_cury].text[win->_curx].attr |=
((ch) & (chtype)A_ATTRIBUTES);
win->_curx++; // FIXME
// if (win && (waddch_nosync(win, wch) != ERR)) {
@@ -595,10 +662,14 @@ { // FIXME. int serial_is_bold = 0;
int serial_is_altcharset = 0;
int x, y;
chtype ch;
int need_altcharset;
serial_end_bold();
serial_end_altcharset();
for (y = 0; y <= win->_maxy; y++) {
@@ -614,6 +685,7 @@ ((int)color_pairs[PAIR_NUMBER(attr)]) << 8;
if (curses_flags & F_ENABLE_SERIAL) {
ch = win->_line[y].text[x].chars[0]; if (attr & A_BOLD) { if (!serial_is_bold) {
@@ -628,10 +700,28 @@ } }
serial_putchar(win->_line[y].text[x].chars[0]);
need_altcharset = 0;
if (attr & A_ALTCHARSET) {
if (serial_acs_map[ch & 0x7f]) {
ch = serial_acs_map[ch & 0x7f];
need_altcharset = 1;
} else
ch = fallback_acs_map[ch & 0x7f];
}
if (need_altcharset && !serial_is_altcharset) {
serial_start_altcharset();
serial_is_altcharset = 1;
}
if (!need_altcharset && serial_is_altcharset) {
serial_end_altcharset();
serial_is_altcharset = 0;
}
serial_putchar(ch); } if (curses_flags & F_ENABLE_CONSOLE) {
ch = win->_line[y].text[x].chars[0]; /* Handle some of the attributes. */ if (attr & A_BOLD)
@@ -643,6 +733,12 @@ c = (c >> 4) & 0xf00; c |= tmp << 12; }
if (attr & A_ALTCHARSET) {
if (console_acs_map[ch & 0x7f])
ch = console_acs_map[ch & 0x7f];
else
ch = fallback_acs_map[ch & 0x7f];
} /* * FIXME: Somewhere along the line, the
@@ -650,7 +746,7 @@ * For now grab just the 8 bit character, * but this will break wide characters! */
c |= (chtype) (win->_line[y].text[x].chars[0] & 0xff);
}c |= (chtype) (ch & 0xff); video_console_putc(win->_begy + y, win->_begx + x, c); }
Index: libpayload/drivers/serial.c
--- libpayload/drivers/serial.c.orig 2008-08-10 15:45:28.000000000 +0200 +++ libpayload/drivers/serial.c 2008-08-10 15:47:03.000000000 +0200 @@ -2,6 +2,7 @@
- This file is part of the libpayload project.
- Copyright (C) 2008 Advanced Micro Devices, Inc.
- Copyright (C) 2008 Ulf Jordan jordan@chalmers.se
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
@@ -104,6 +105,10 @@ #define VT100_SBOLD "\e[1m" #define VT100_EBOLD "\e[m" #define VT100_CURSOR_ADDR "\e[%d;%dH" +/* The following smacs/rmacs are actually for xterm; a real vt100 has
- enacs=\E(B\E)0, smacs=^N, rmacs=^O. */
+#define VT100_SMACS "\e(0" +#define VT100_RMACS "\e(B"
static void serial_putcmd(char *str) { @@ -126,6 +131,16 @@ serial_putcmd(VT100_EBOLD); }
+void serial_start_altcharset(void) +{
- serial_putcmd(VT100_SMACS);
+}
+void serial_end_altcharset(void) +{
- serial_putcmd(VT100_RMACS);
+}
void serial_set_cursor(int y, int x) { char buffer[32]; Index: coreinfo/coreinfo.c =================================================================== --- coreinfo/coreinfo.c.orig 2008-08-10 15:45:28.000000000 +0200 +++ coreinfo/coreinfo.c 2008-08-10 15:47:03.000000000 +0200 @@ -89,7 +89,7 @@
wmove(win, 1, 1); for (i = 0; i < 78; i++)
waddch(win, '\304');
waddch(win, ACS_HLINE);
}
static void print_submenu(struct coreinfo_cat *cat) Index: coreinfo/pci_module.c =================================================================== --- coreinfo/pci_module.c.orig 2008-08-10 15:45:28.000000000 +0200 +++ coreinfo/pci_module.c 2008-08-10 15:47:03.000000000 +0200 @@ -144,11 +144,11 @@
if (i == 0) { if (item != 0)
mvwprintw(win, 2 + i, 19, "\30");
} if (i == MENU_VISIBLE - 1) { if ((item + 1) < devices_index)mvwaddch(win, 2 + i, 19, ACS_UARROW);
mvwprintw(win, 2 + i, 19, "\31");
} }mvwaddch(win, 2 + i, 19, ACS_DARROW);
@@ -160,12 +160,12 @@ wmove(win, 3, 25);
for (i = 0; i < 48; i++)
waddch(win, (i == 0) ? '\332' : '\304');
waddch(win, (i == 0) ? ACS_ULCORNER : ACS_HLINE);
for (i = 0; i < 4; i++) { mvwprintw(win, 4 + i, 23, "%2.2X", i * 16); wmove(win, 4 + i, 25);
waddch(win, '\263');
waddch(win, ACS_VLINE);
}
show_config_space(win, 4, 26, menu_selected);
Index: coreinfo/lar_module.c
--- coreinfo/lar_module.c.orig 2008-08-10 15:45:28.000000000 +0200 +++ coreinfo/lar_module.c 2008-08-10 15:47:03.000000000 +0200 @@ -66,7 +66,7 @@
/* Draw a line down the middle. */ for (i = 2; i < 21; i++)
mvwaddch(win, i, 30, '\263');
mvwaddch(win, i, 30, ACS_VLINE);
/* Draw the names down the left side. */ for (i = 0; i < lcount; i++) {
Index: coreinfo/nvram_module.c
--- coreinfo/nvram_module.c.orig 2008-08-10 15:45:28.000000000 +0200 +++ coreinfo/nvram_module.c 2008-08-10 15:47:03.000000000 +0200 @@ -36,9 +36,9 @@
/* Print vertical and horizontal line. */ for (i = 0; i < 18; i++)
mvwaddch(win, 3 + i, 3, '\263');
for (i = 0; i < 48; i++)mvwaddch(win, 3 + i, 3, ACS_VLINE);
mvwaddch(win, 3, 3 + i, (i == 0) ? '\332' : '\304');
mvwaddch(win, 3, 3 + i, (i == 0) ? ACS_ULCORNER : ACS_HLINE);
/* Dump NVRAM contents. */ for (i = 1; i < 257; i++) {
-- coreboot mailing list coreboot@coreboot.org http://www.coreboot.org/mailman/listinfo/coreboot
On Mon, 11 Aug 2008, Jordan Crouse wrote:
On 10/08/08 16:42 +0200, Ulf Jordan wrote:
Add support for line drawing characters and the alternate character set. This enables using the ACS_ curses macros with libpayload.
The translation from ACS_ macros (or characters with attribute A_ALTCHARSET) is done using one acs map for the video console, one for serial console (xterm/vt100/vt220), and one fallback, from which an ASCII substitute is taken if the device specific map doesn't contain an entry (ie NUL).
coreinfo is also adapted to take advantage of the symbolic ACS_ constants.
Signed-off-by: Ulf Jordan jordan@chalmers.se
This adds a lot of extra .data space.
Yes, this patch is a bit clumsy.
There are several ways to make it less hard on .data space. One way would be to have all *_acs_maps in .bss, and initialize them at runtime in initscr() from the much shorter acsc strings (about 64 bytes per map).
I will try to make a quantitative comparison on the growth of e.g. coreinfo and coreinfo+coreboot-v3 with both the original patch and the scheme outlined above.
What do we lose if we don't support alternate character sets?
(First a side note: this is not general support for different character sets, but support for *the* special graphics/"alternate character set".)
Well, my motivation for implementing ACS support is twofold:
1. Let curses applications continue to use ACS_HLINE when drawing lines etc (in the current code this could at least partially be supported by initializing acs_map with the magic characters '\304' and so on). Consequently, less porting to do when compiling a curses application against libpayload, and the code stays more readable. The patch also adds fallback ASCII characters for the entire set, not just the line drawing part.
2. Better fidelity between what is seen on VGA console and serial console. After applying the ACS and companion color patch, the serial output in xterm looks close to identical to the QEMU VGA (there is still some misalignment due to outputing characters in C0, but that is for a later patch).
I do recognize that sometimes one wants to have very simple serial output, and sometimes one wants eye candy.
Mabye we can make this conditional in the kconfig.
Yes, good idea. I think it would be nice to be able to switch between "pure ASCII+cursor positioning" and "all bells and whistles" over serial.
/ulf
On 11/08/08 22:11 +0200, Ulf Jordan wrote:
On Mon, 11 Aug 2008, Jordan Crouse wrote:
On 10/08/08 16:42 +0200, Ulf Jordan wrote:
Add support for line drawing characters and the alternate character set. This enables using the ACS_ curses macros with libpayload.
The translation from ACS_ macros (or characters with attribute A_ALTCHARSET) is done using one acs map for the video console, one for serial console (xterm/vt100/vt220), and one fallback, from which an ASCII substitute is taken if the device specific map doesn't contain an entry (ie NUL).
coreinfo is also adapted to take advantage of the symbolic ACS_ constants.
Signed-off-by: Ulf Jordan jordan@chalmers.se
This adds a lot of extra .data space.
Yes, this patch is a bit clumsy.
There are several ways to make it less hard on .data space. One way would be to have all *_acs_maps in .bss, and initialize them at runtime in initscr() from the much shorter acsc strings (about 64 bytes per map).
I will try to make a quantitative comparison on the growth of e.g. coreinfo and coreinfo+coreboot-v3 with both the original patch and the scheme outlined above.
What do we lose if we don't support alternate character sets?
(First a side note: this is not general support for different character sets, but support for *the* special graphics/"alternate character set".)
Well, my motivation for implementing ACS support is twofold:
- Let curses applications continue to use ACS_HLINE when drawing lines
etc (in the current code this could at least partially be supported by initializing acs_map with the magic characters '\304' and so on). Consequently, less porting to do when compiling a curses application against libpayload, and the code stays more readable. The patch also adds fallback ASCII characters for the entire set, not just the line drawing part.
- Better fidelity between what is seen on VGA console and serial console.
After applying the ACS and companion color patch, the serial output in xterm looks close to identical to the QEMU VGA (there is still some misalignment due to outputing characters in C0, but that is for a later patch).
I do recognize that sometimes one wants to have very simple serial output, and sometimes one wants eye candy.
Mabye we can make this conditional in the kconfig.
Yes, good idea. I think it would be nice to be able to switch between "pure ASCII+cursor positioning" and "all bells and whistles" over serial.
Okay - great explanation. For what its worth, I wasn't trying to pick on you specifically. The advantage of libpayload is that it doesn't need to support everything and the kitchen sink - only what our customers (the payload writers need). We shouldn't support features just for giggles.
That said, we also want serial curses to Just Work (TM) so that the same payload writers don't need to be aware of it. This is double important to us since serial is more often the primary console.
So, long story short, I accept your excellent summary, and I'll check in the patch as is. We can work on reducing the .data load later.
Jordan
On Mon, 11 Aug 2008, Ulf Jordan wrote:
On Mon, 11 Aug 2008, Jordan Crouse wrote:
This adds a lot of extra .data space.
I will try to make a quantitative comparison on the growth of e.g. coreinfo and coreinfo+coreboot-v3 with both the original patch and the scheme outlined above.
Here is a comparison of the sizes of libpayload.a, coreinfo.elf, and normal/payoad/segment{0,1} in a coreboot-v3 image for three cases: before the ACS support (r3498), with the ACS support from this thread (r3501), and the attached patch, having *_acs_map in .bss and initialized in initscr() (r3501+patch). All tests were done against coreboot-v3 r743 in QEMU. All sizes in bytes. LAR entries are given as compressed/uncompressed (as read from the coreinfo LAR screen).
| libpayload.a | coreinfo.elf | segment0 | segment1 | ------------+--------------+--------------+----------+-------------+ r3498 | 75044 | 39196 | 1/184080 | 15034/34720 | ------------+--------------+--------------+----------+-------------+ r3501 | 77534 | 41212 | 1/184080 | 15305/36736 | ------------+--------------+--------------+----------+-------------+ r3501+patch | 76504 | 40028 | 1/185648 | 15433/35552 | ------------+--------------+--------------+----------+-------------+
So the ACS implementation in svn incresed the uncompressed size of coreinfo segment1 by 2016 bytes, while the compressed size only increased by 271 bytes.
As compared to the non-ACS case, the patched ACS implementation increases the uncompressed size of coreinfo segment1 by 832 bytes, while the compressed size increased by 399 bytes.
So uncompressed is bigger and compressed is smaller in this case, but I'm sure it is possible to come up with something better. The question is if it's worth the work, since the *total* size added by the current ACS implementation after compression is only 271 bytes (Thank you, LZMA!). Are payloads compressed in coreboot-v2 too?
While doing this investigation I also found a mistake in console_acs_map. ACS_PI: '{' should map onto '\343'. I will send a separate patch for correcting this bug.
/ulf
On 10/08/08 16:42 +0200, Ulf Jordan wrote:
This patch adds support for handling ACS (the alternate/special graphics character set) both on VGA and serial console in libpayload. It also updates coreinfo to use the ACS_ macros for line graphics.
Build tested against svn HEAD. To actually get any output, the previously sent libpayload-kconfig patch, or equivalent, is needed too. Runtime tested with coreboot-v3 in QEMU.
/ulf
Add support for line drawing characters and the alternate character set. This enables using the ACS_ curses macros with libpayload.
The translation from ACS_ macros (or characters with attribute A_ALTCHARSET) is done using one acs map for the video console, one for serial console (xterm/vt100/vt220), and one fallback, from which an ASCII substitute is taken if the device specific map doesn't contain an entry (ie NUL).
coreinfo is also adapted to take advantage of the symbolic ACS_ constants.
Signed-off-by: Ulf Jordan jordan@chalmers.se
Acked-by: Jordan Crouse jordan.crouse@amd.com
r3499 for libpayload r3501 for coreinfo
In the future, please try to seperate the patches for the different modules. I know they live in the same tree, but this way is easier if we happen to need to revert something.
Jordan
Index: libpayload/include/libpayload.h
--- libpayload/include/libpayload.h.orig 2008-08-10 15:45:28.000000000 +0200 +++ libpayload/include/libpayload.h 2008-08-10 15:47:03.000000000 +0200 @@ -110,6 +110,8 @@ void serial_clear(void); void serial_start_bold(void); void serial_end_bold(void); +void serial_start_altcharset(void); +void serial_end_altcharset(void); void serial_set_cursor(int y, int x);
/* drivers/speaker.c */ Index: libpayload/curses/tinycurses.c =================================================================== --- libpayload/curses/tinycurses.c.orig 2008-08-10 15:45:28.000000000 +0200 +++ libpayload/curses/tinycurses.c 2008-08-10 15:47:03.000000000 +0200 @@ -2,6 +2,7 @@
- This file is part of the libpayload project.
- Copyright (C) 2007 Uwe Hermann uwe@hermann-uwe.de
- Copyright (C) 2008 Ulf Jordan jordan@chalmers.se
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
@@ -88,6 +89,69 @@ SCREEN *SP; chtype acs_map[128];
+/* See terminfo(5). */ +chtype fallback_acs_map[128] =
- {
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', '>', '<', '^', 'v', ' ',
- '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
- '+', ':', ' ', ' ', ' ', ' ', '\', '#',
- '#', '#', '+', '+', '+', '+', '+', '~',
- '-', '-', '-', '_', '+', '+', '+', '+',
- '|', '<', '>', '*', '!', 'f', 'o', ' ',
- };
+/* See acsc of vt100. */ +chtype serial_acs_map[128] =
- {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- '`', 'a', 0, 0, 0, 0, 'f', 'g',
- 0, 0, 'j', 'k', 'l', 'm', 'n', 'o',
- 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
- 'x', 'y', 'z', '{', '|', '}', '~', 0,
- };
+/* See acsc of linux. */ +chtype console_acs_map[128] =
- {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, '\020', '\021', '\030', '\031', 0,
- '\333', 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- '\004', '\261', 0, 0, 0, 0, '\370', '\361',
- '\260', '\316', '\331', '\277', '\332', '\300', '\305', '~',
- '\304', '\304', '\304', '_', '\303', '\264', '\301', '\302',
- '\263', '\363', '\362', '\342', '\330', '\234', '\376', 0,
- };
// FIXME: Ugly (and insecure!) hack! char sprintf_tmp[1024];
@@ -213,11 +277,14 @@ /** Note: Must _not_ be called twice! */ WINDOW *initscr(void) {
- int x, y;
int x, y, i;
// newterm(name, stdout, stdin); // def_prog_mode();
for (i = 0; i < 128; i++)
acs_map[i] = (chtype) i | A_ALTCHARSET;
if (curses_flags & F_ENABLE_SERIAL) { serial_clear(); }
@@ -409,12 +476,12 @@ // NCURSES_CH_T wch; // SetChar2(wch, ch);
- win->_line[win->_cury].text[win->_curx].chars[0] = ch;
- /* Use the window attributes - perhaps we also pull attributes from
the ch itself, I don't know */
win->_line[win->_cury].text[win->_curx].chars[0] =
((ch) & (chtype)A_CHARTEXT);
win->_line[win->_cury].text[win->_curx].attr = WINDOW_ATTRS(win);
win->_line[win->_cury].text[win->_curx].attr |=
((ch) & (chtype)A_ATTRIBUTES);
win->_curx++; // FIXME
// if (win && (waddch_nosync(win, wch) != ERR)) {
@@ -595,10 +662,14 @@ { // FIXME. int serial_is_bold = 0;
int serial_is_altcharset = 0;
int x, y;
chtype ch;
int need_altcharset;
serial_end_bold();
serial_end_altcharset();
for (y = 0; y <= win->_maxy; y++) {
@@ -614,6 +685,7 @@ ((int)color_pairs[PAIR_NUMBER(attr)]) << 8;
if (curses_flags & F_ENABLE_SERIAL) {
ch = win->_line[y].text[x].chars[0]; if (attr & A_BOLD) { if (!serial_is_bold) {
@@ -628,10 +700,28 @@ } }
serial_putchar(win->_line[y].text[x].chars[0]);
need_altcharset = 0;
if (attr & A_ALTCHARSET) {
if (serial_acs_map[ch & 0x7f]) {
ch = serial_acs_map[ch & 0x7f];
need_altcharset = 1;
} else
ch = fallback_acs_map[ch & 0x7f];
}
if (need_altcharset && !serial_is_altcharset) {
serial_start_altcharset();
serial_is_altcharset = 1;
}
if (!need_altcharset && serial_is_altcharset) {
serial_end_altcharset();
serial_is_altcharset = 0;
}
serial_putchar(ch); } if (curses_flags & F_ENABLE_CONSOLE) {
ch = win->_line[y].text[x].chars[0]; /* Handle some of the attributes. */ if (attr & A_BOLD)
@@ -643,6 +733,12 @@ c = (c >> 4) & 0xf00; c |= tmp << 12; }
if (attr & A_ALTCHARSET) {
if (console_acs_map[ch & 0x7f])
ch = console_acs_map[ch & 0x7f];
else
ch = fallback_acs_map[ch & 0x7f];
} /* * FIXME: Somewhere along the line, the
@@ -650,7 +746,7 @@ * For now grab just the 8 bit character, * but this will break wide characters! */
c |= (chtype) (win->_line[y].text[x].chars[0] & 0xff);
}c |= (chtype) (ch & 0xff); video_console_putc(win->_begy + y, win->_begx + x, c); }
Index: libpayload/drivers/serial.c
--- libpayload/drivers/serial.c.orig 2008-08-10 15:45:28.000000000 +0200 +++ libpayload/drivers/serial.c 2008-08-10 15:47:03.000000000 +0200 @@ -2,6 +2,7 @@
- This file is part of the libpayload project.
- Copyright (C) 2008 Advanced Micro Devices, Inc.
- Copyright (C) 2008 Ulf Jordan jordan@chalmers.se
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
@@ -104,6 +105,10 @@ #define VT100_SBOLD "\e[1m" #define VT100_EBOLD "\e[m" #define VT100_CURSOR_ADDR "\e[%d;%dH" +/* The following smacs/rmacs are actually for xterm; a real vt100 has
- enacs=\E(B\E)0, smacs=^N, rmacs=^O. */
+#define VT100_SMACS "\e(0" +#define VT100_RMACS "\e(B"
static void serial_putcmd(char *str) { @@ -126,6 +131,16 @@ serial_putcmd(VT100_EBOLD); }
+void serial_start_altcharset(void) +{
- serial_putcmd(VT100_SMACS);
+}
+void serial_end_altcharset(void) +{
- serial_putcmd(VT100_RMACS);
+}
void serial_set_cursor(int y, int x) { char buffer[32]; Index: coreinfo/coreinfo.c =================================================================== --- coreinfo/coreinfo.c.orig 2008-08-10 15:45:28.000000000 +0200 +++ coreinfo/coreinfo.c 2008-08-10 15:47:03.000000000 +0200 @@ -89,7 +89,7 @@
wmove(win, 1, 1); for (i = 0; i < 78; i++)
waddch(win, '\304');
waddch(win, ACS_HLINE);
}
static void print_submenu(struct coreinfo_cat *cat) Index: coreinfo/pci_module.c =================================================================== --- coreinfo/pci_module.c.orig 2008-08-10 15:45:28.000000000 +0200 +++ coreinfo/pci_module.c 2008-08-10 15:47:03.000000000 +0200 @@ -144,11 +144,11 @@
if (i == 0) { if (item != 0)
mvwprintw(win, 2 + i, 19, "\30");
} if (i == MENU_VISIBLE - 1) { if ((item + 1) < devices_index)mvwaddch(win, 2 + i, 19, ACS_UARROW);
mvwprintw(win, 2 + i, 19, "\31");
} }mvwaddch(win, 2 + i, 19, ACS_DARROW);
@@ -160,12 +160,12 @@ wmove(win, 3, 25);
for (i = 0; i < 48; i++)
waddch(win, (i == 0) ? '\332' : '\304');
waddch(win, (i == 0) ? ACS_ULCORNER : ACS_HLINE);
for (i = 0; i < 4; i++) { mvwprintw(win, 4 + i, 23, "%2.2X", i * 16); wmove(win, 4 + i, 25);
waddch(win, '\263');
waddch(win, ACS_VLINE);
}
show_config_space(win, 4, 26, menu_selected);
Index: coreinfo/lar_module.c
--- coreinfo/lar_module.c.orig 2008-08-10 15:45:28.000000000 +0200 +++ coreinfo/lar_module.c 2008-08-10 15:47:03.000000000 +0200 @@ -66,7 +66,7 @@
/* Draw a line down the middle. */ for (i = 2; i < 21; i++)
mvwaddch(win, i, 30, '\263');
mvwaddch(win, i, 30, ACS_VLINE);
/* Draw the names down the left side. */ for (i = 0; i < lcount; i++) {
Index: coreinfo/nvram_module.c
--- coreinfo/nvram_module.c.orig 2008-08-10 15:45:28.000000000 +0200 +++ coreinfo/nvram_module.c 2008-08-10 15:47:03.000000000 +0200 @@ -36,9 +36,9 @@
/* Print vertical and horizontal line. */ for (i = 0; i < 18; i++)
mvwaddch(win, 3 + i, 3, '\263');
for (i = 0; i < 48; i++)mvwaddch(win, 3 + i, 3, ACS_VLINE);
mvwaddch(win, 3, 3 + i, (i == 0) ? '\332' : '\304');
mvwaddch(win, 3, 3 + i, (i == 0) ? ACS_ULCORNER : ACS_HLINE);
/* Dump NVRAM contents. */ for (i = 1; i < 257; i++) {
-- coreboot mailing list coreboot@coreboot.org http://www.coreboot.org/mailman/listinfo/coreboot
On Mon, 11 Aug 2008, Jordan Crouse wrote:
Acked-by: Jordan Crouse jordan.crouse@amd.com
r3499 for libpayload r3501 for coreinfo
Thanks.
In the future, please try to seperate the patches for the different modules. I know they live in the same tree, but this way is easier if we happen to need to revert something.
OK, I will do that.
/ulf