提交 8f586b22 编写于 作者: M Mike Strosaker 提交者: Paul Mackerras

[PATCH] correct printing to operator panel

This patch corrects the printing of progress indicators to the op
panel on p/iSeries ppc64 systems.  Each discrete reference code should
begin with a form feed char to clear the op panel, and the first and
second lines should be separated with a CR/LF sequence.  Padding with
spaces is not necessary.

Also, capitalize the hex value printed on the first line, to be
consistent with the values printed by firmware, service processor,
etc.

It turns out that there's an ibm,form-feed property; this patch uses
it in the pSeries-specific progress routine.  This patch also checks
the number of rows and the specific width of each row (the second row
on power5 systems can actually hold 80 characters).  If the displayed
text is too wide for the physical display, it can be viewed in the ASM
menus, or by selecting option 14 on the op panel.
Signed-off-by: NMike Strosaker <strosake@austin.ibm.com>
Signed-off-by: NPaul Mackerras <paulus@samba.org>
上级 ae209cf1
...@@ -98,21 +98,29 @@ rtas_progress(char *s, unsigned short hex) ...@@ -98,21 +98,29 @@ rtas_progress(char *s, unsigned short hex)
int width, *p; int width, *p;
char *os; char *os;
static int display_character, set_indicator; static int display_character, set_indicator;
static int max_width; static int display_width, display_lines, *row_width, form_feed;
static DEFINE_SPINLOCK(progress_lock); static DEFINE_SPINLOCK(progress_lock);
static int current_line;
static int pending_newline = 0; /* did last write end with unprinted newline? */ static int pending_newline = 0; /* did last write end with unprinted newline? */
if (!rtas.base) if (!rtas.base)
return; return;
if (max_width == 0) { if (display_width == 0) {
if ((root = find_path_device("/rtas")) && display_width = 0x10;
(p = (unsigned int *)get_property(root, if ((root = find_path_device("/rtas"))) {
"ibm,display-line-length", if ((p = (unsigned int *)get_property(root,
NULL))) "ibm,display-line-length", NULL)))
max_width = *p; display_width = *p;
else if ((p = (unsigned int *)get_property(root,
max_width = 0x10; "ibm,form-feed", NULL)))
form_feed = *p;
if ((p = (unsigned int *)get_property(root,
"ibm,display-number-of-lines", NULL)))
display_lines = *p;
row_width = (unsigned int *)get_property(root,
"ibm,display-truncation-length", NULL);
}
display_character = rtas_token("display-character"); display_character = rtas_token("display-character");
set_indicator = rtas_token("set-indicator"); set_indicator = rtas_token("set-indicator");
} }
...@@ -131,31 +139,39 @@ rtas_progress(char *s, unsigned short hex) ...@@ -131,31 +139,39 @@ rtas_progress(char *s, unsigned short hex)
* it would just clear the bottom line of output. Print it now * it would just clear the bottom line of output. Print it now
* instead. * instead.
* *
* If no newline is pending, print a CR to start output at the * If no newline is pending and form feed is supported, clear the
* beginning of the line. * display with a form feed; otherwise, print a CR to start output
* at the beginning of the line.
*/ */
if (pending_newline) { if (pending_newline) {
rtas_call(display_character, 1, 1, NULL, '\r'); rtas_call(display_character, 1, 1, NULL, '\r');
rtas_call(display_character, 1, 1, NULL, '\n'); rtas_call(display_character, 1, 1, NULL, '\n');
pending_newline = 0; pending_newline = 0;
} else { } else {
rtas_call(display_character, 1, 1, NULL, '\r'); current_line = 0;
if (form_feed)
rtas_call(display_character, 1, 1, NULL,
(char)form_feed);
else
rtas_call(display_character, 1, 1, NULL, '\r');
} }
width = max_width; if (row_width)
width = row_width[current_line];
else
width = display_width;
os = s; os = s;
while (*os) { while (*os) {
if (*os == '\n' || *os == '\r') { if (*os == '\n' || *os == '\r') {
/* Blank to end of line. */
while (width-- > 0)
rtas_call(display_character, 1, 1, NULL, ' ');
/* If newline is the last character, save it /* If newline is the last character, save it
* until next call to avoid bumping up the * until next call to avoid bumping up the
* display output. * display output.
*/ */
if (*os == '\n' && !os[1]) { if (*os == '\n' && !os[1]) {
pending_newline = 1; pending_newline = 1;
current_line++;
if (current_line > display_lines-1)
current_line = display_lines-1;
spin_unlock(&progress_lock); spin_unlock(&progress_lock);
return; return;
} }
...@@ -172,7 +188,10 @@ rtas_progress(char *s, unsigned short hex) ...@@ -172,7 +188,10 @@ rtas_progress(char *s, unsigned short hex)
rtas_call(display_character, 1, 1, NULL, *os); rtas_call(display_character, 1, 1, NULL, *os);
} }
width = max_width; if (row_width)
width = row_width[current_line];
else
width = display_width;
} else { } else {
width--; width--;
rtas_call(display_character, 1, 1, NULL, *os); rtas_call(display_character, 1, 1, NULL, *os);
...@@ -186,10 +205,6 @@ rtas_progress(char *s, unsigned short hex) ...@@ -186,10 +205,6 @@ rtas_progress(char *s, unsigned short hex)
os++; os++;
} }
/* Blank to end of line. */
while (width-- > 0)
rtas_call(display_character, 1, 1, NULL, ' ');
spin_unlock(&progress_lock); spin_unlock(&progress_lock);
} }
......
...@@ -1080,11 +1080,11 @@ void __init setup_arch(char **cmdline_p) ...@@ -1080,11 +1080,11 @@ void __init setup_arch(char **cmdline_p)
static void ppc64_do_msg(unsigned int src, const char *msg) static void ppc64_do_msg(unsigned int src, const char *msg)
{ {
if (ppc_md.progress) { if (ppc_md.progress) {
char buf[32]; char buf[128];
sprintf(buf, "%08x \n", src); sprintf(buf, "%08X\n", src);
ppc_md.progress(buf, 0); ppc_md.progress(buf, 0);
sprintf(buf, "%-16s", msg); snprintf(buf, 128, "%s", msg);
ppc_md.progress(buf, 0); ppc_md.progress(buf, 0);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册