diff options
author | Mike Strosaker <strosake@austin.ibm.com> | 2005-06-23 02:09:41 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-06-23 02:09:41 -0400 |
commit | 8f586b2243198194240626fd9695da5564ffa7ee (patch) | |
tree | 716ba2e20edb04a354210f626b73b56e156f171b | |
parent | ae209cf10086b97e92e39af7cec0f84b21b6fca3 (diff) |
[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>
-rw-r--r-- | arch/ppc64/kernel/rtas.c | 59 | ||||
-rw-r--r-- | arch/ppc64/kernel/setup.c | 6 |
2 files changed, 40 insertions, 25 deletions
diff --git a/arch/ppc64/kernel/rtas.c b/arch/ppc64/kernel/rtas.c index 43e1518653d5..5e8eb33b8e54 100644 --- a/arch/ppc64/kernel/rtas.c +++ b/arch/ppc64/kernel/rtas.c | |||
@@ -98,21 +98,29 @@ rtas_progress(char *s, unsigned short hex) | |||
98 | int width, *p; | 98 | int width, *p; |
99 | char *os; | 99 | char *os; |
100 | static int display_character, set_indicator; | 100 | static int display_character, set_indicator; |
101 | static int max_width; | 101 | static int display_width, display_lines, *row_width, form_feed; |
102 | static DEFINE_SPINLOCK(progress_lock); | 102 | static DEFINE_SPINLOCK(progress_lock); |
103 | static int current_line; | ||
103 | static int pending_newline = 0; /* did last write end with unprinted newline? */ | 104 | static int pending_newline = 0; /* did last write end with unprinted newline? */ |
104 | 105 | ||
105 | if (!rtas.base) | 106 | if (!rtas.base) |
106 | return; | 107 | return; |
107 | 108 | ||
108 | if (max_width == 0) { | 109 | if (display_width == 0) { |
109 | if ((root = find_path_device("/rtas")) && | 110 | display_width = 0x10; |
110 | (p = (unsigned int *)get_property(root, | 111 | if ((root = find_path_device("/rtas"))) { |
111 | "ibm,display-line-length", | 112 | if ((p = (unsigned int *)get_property(root, |
112 | NULL))) | 113 | "ibm,display-line-length", NULL))) |
113 | max_width = *p; | 114 | display_width = *p; |
114 | else | 115 | if ((p = (unsigned int *)get_property(root, |
115 | max_width = 0x10; | 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 | display_character = rtas_token("display-character"); | 124 | display_character = rtas_token("display-character"); |
117 | set_indicator = rtas_token("set-indicator"); | 125 | set_indicator = rtas_token("set-indicator"); |
118 | } | 126 | } |
@@ -131,31 +139,39 @@ rtas_progress(char *s, unsigned short hex) | |||
131 | * it would just clear the bottom line of output. Print it now | 139 | * it would just clear the bottom line of output. Print it now |
132 | * instead. | 140 | * instead. |
133 | * | 141 | * |
134 | * If no newline is pending, print a CR to start output at the | 142 | * If no newline is pending and form feed is supported, clear the |
135 | * beginning of the line. | 143 | * display with a form feed; otherwise, print a CR to start output |
144 | * at the beginning of the line. | ||
136 | */ | 145 | */ |
137 | if (pending_newline) { | 146 | if (pending_newline) { |
138 | rtas_call(display_character, 1, 1, NULL, '\r'); | 147 | rtas_call(display_character, 1, 1, NULL, '\r'); |
139 | rtas_call(display_character, 1, 1, NULL, '\n'); | 148 | rtas_call(display_character, 1, 1, NULL, '\n'); |
140 | pending_newline = 0; | 149 | pending_newline = 0; |
141 | } else { | 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 | os = s; | 163 | os = s; |
147 | while (*os) { | 164 | while (*os) { |
148 | if (*os == '\n' || *os == '\r') { | 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 | /* If newline is the last character, save it | 166 | /* If newline is the last character, save it |
154 | * until next call to avoid bumping up the | 167 | * until next call to avoid bumping up the |
155 | * display output. | 168 | * display output. |
156 | */ | 169 | */ |
157 | if (*os == '\n' && !os[1]) { | 170 | if (*os == '\n' && !os[1]) { |
158 | pending_newline = 1; | 171 | pending_newline = 1; |
172 | current_line++; | ||
173 | if (current_line > display_lines-1) | ||
174 | current_line = display_lines-1; | ||
159 | spin_unlock(&progress_lock); | 175 | spin_unlock(&progress_lock); |
160 | return; | 176 | return; |
161 | } | 177 | } |
@@ -172,7 +188,10 @@ rtas_progress(char *s, unsigned short hex) | |||
172 | rtas_call(display_character, 1, 1, NULL, *os); | 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 | } else { | 195 | } else { |
177 | width--; | 196 | width--; |
178 | rtas_call(display_character, 1, 1, NULL, *os); | 197 | rtas_call(display_character, 1, 1, NULL, *os); |
@@ -186,10 +205,6 @@ rtas_progress(char *s, unsigned short hex) | |||
186 | os++; | 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 | spin_unlock(&progress_lock); | 208 | spin_unlock(&progress_lock); |
194 | } | 209 | } |
195 | 210 | ||
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c index 10222008fe20..8a1ca695f8a7 100644 --- a/arch/ppc64/kernel/setup.c +++ b/arch/ppc64/kernel/setup.c | |||
@@ -1080,11 +1080,11 @@ void __init setup_arch(char **cmdline_p) | |||
1080 | static void ppc64_do_msg(unsigned int src, const char *msg) | 1080 | static void ppc64_do_msg(unsigned int src, const char *msg) |
1081 | { | 1081 | { |
1082 | if (ppc_md.progress) { | 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 | ppc_md.progress(buf, 0); | 1086 | ppc_md.progress(buf, 0); |
1087 | sprintf(buf, "%-16s", msg); | 1087 | snprintf(buf, 128, "%s", msg); |
1088 | ppc_md.progress(buf, 0); | 1088 | ppc_md.progress(buf, 0); |
1089 | } | 1089 | } |
1090 | } | 1090 | } |