Commit 8f586b2243198194240626fd9695da5564ffa7ee

Authored by Mike Strosaker
Committed by Paul Mackerras
1 parent ae209cf100

[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: Mike Strosaker <strosake@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>

Showing 2 changed files with 40 additions and 25 deletions Side-by-side Diff

arch/ppc64/kernel/rtas.c
... ... @@ -98,21 +98,29 @@
98 98 int width, *p;
99 99 char *os;
100 100 static int display_character, set_indicator;
101   - static int max_width;
  101 + static int display_width, display_lines, *row_width, form_feed;
102 102 static DEFINE_SPINLOCK(progress_lock);
  103 + static int current_line;
103 104 static int pending_newline = 0; /* did last write end with unprinted newline? */
104 105  
105 106 if (!rtas.base)
106 107 return;
107 108  
108   - if (max_width == 0) {
109   - if ((root = find_path_device("/rtas")) &&
110   - (p = (unsigned int *)get_property(root,
111   - "ibm,display-line-length",
112   - NULL)))
113   - max_width = *p;
114   - else
115   - max_width = 0x10;
  109 + if (display_width == 0) {
  110 + display_width = 0x10;
  111 + if ((root = find_path_device("/rtas"))) {
  112 + if ((p = (unsigned int *)get_property(root,
  113 + "ibm,display-line-length", NULL)))
  114 + display_width = *p;
  115 + if ((p = (unsigned int *)get_property(root,
  116 + "ibm,form-feed", NULL)))
  117 + form_feed = *p;
  118 + if ((p = (unsigned int *)get_property(root,
  119 + "ibm,display-number-of-lines", NULL)))
  120 + display_lines = *p;
  121 + row_width = (unsigned int *)get_property(root,
  122 + "ibm,display-truncation-length", NULL);
  123 + }
116 124 display_character = rtas_token("display-character");
117 125 set_indicator = rtas_token("set-indicator");
118 126 }
119 127  
120 128  
121 129  
122 130  
... ... @@ -131,31 +139,39 @@
131 139 * it would just clear the bottom line of output. Print it now
132 140 * instead.
133 141 *
134   - * If no newline is pending, print a CR to start output at the
135   - * beginning of the line.
  142 + * If no newline is pending and form feed is supported, clear the
  143 + * display with a form feed; otherwise, print a CR to start output
  144 + * at the beginning of the line.
136 145 */
137 146 if (pending_newline) {
138 147 rtas_call(display_character, 1, 1, NULL, '\r');
139 148 rtas_call(display_character, 1, 1, NULL, '\n');
140 149 pending_newline = 0;
141 150 } else {
142   - rtas_call(display_character, 1, 1, NULL, '\r');
  151 + current_line = 0;
  152 + if (form_feed)
  153 + rtas_call(display_character, 1, 1, NULL,
  154 + (char)form_feed);
  155 + else
  156 + rtas_call(display_character, 1, 1, NULL, '\r');
143 157 }
144 158  
145   - width = max_width;
  159 + if (row_width)
  160 + width = row_width[current_line];
  161 + else
  162 + width = display_width;
146 163 os = s;
147 164 while (*os) {
148 165 if (*os == '\n' || *os == '\r') {
149   - /* Blank to end of line. */
150   - while (width-- > 0)
151   - rtas_call(display_character, 1, 1, NULL, ' ');
152   -
153 166 /* If newline is the last character, save it
154 167 * until next call to avoid bumping up the
155 168 * display output.
156 169 */
157 170 if (*os == '\n' && !os[1]) {
158 171 pending_newline = 1;
  172 + current_line++;
  173 + if (current_line > display_lines-1)
  174 + current_line = display_lines-1;
159 175 spin_unlock(&progress_lock);
160 176 return;
161 177 }
... ... @@ -172,7 +188,10 @@
172 188 rtas_call(display_character, 1, 1, NULL, *os);
173 189 }
174 190  
175   - width = max_width;
  191 + if (row_width)
  192 + width = row_width[current_line];
  193 + else
  194 + width = display_width;
176 195 } else {
177 196 width--;
178 197 rtas_call(display_character, 1, 1, NULL, *os);
... ... @@ -186,10 +205,6 @@
186 205 os++;
187 206 }
188 207  
189   - /* Blank to end of line. */
190   - while (width-- > 0)
191   - rtas_call(display_character, 1, 1, NULL, ' ');
192   -
193 208 spin_unlock(&progress_lock);
194 209 }
195 210  
arch/ppc64/kernel/setup.c
... ... @@ -1080,11 +1080,11 @@
1080 1080 static void ppc64_do_msg(unsigned int src, const char *msg)
1081 1081 {
1082 1082 if (ppc_md.progress) {
1083   - char buf[32];
  1083 + char buf[128];
1084 1084  
1085   - sprintf(buf, "%08x \n", src);
  1085 + sprintf(buf, "%08X\n", src);
1086 1086 ppc_md.progress(buf, 0);
1087   - sprintf(buf, "%-16s", msg);
  1087 + snprintf(buf, 128, "%s", msg);
1088 1088 ppc_md.progress(buf, 0);
1089 1089 }
1090 1090 }