diff options
author | Tony Breeds <tony@bakeyournoodle.com> | 2007-10-02 21:19:09 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-10-03 01:31:37 -0400 |
commit | a0c7ce9c877ceef8428798ac91fb794f83609aed (patch) | |
tree | d572e80603e1a9b0e4999bfbc7d30984ea5b1b80 | |
parent | 2d5f5659649924b86d527a2af2552bab741d1d6f (diff) |
[POWERPC] Fix panic in RTAS code
Some older pSeries machines were panicking in pSeries_log_error
because it was getting called before it was ready. This is a result
of commit "[POWERPC] pseries: Fix jumbled no_logging flag."
(79c0108d1b9db4864ab77b2a95dfa04f2dcf264c).
This fixes it by explicitly enabling RTAS error logging when it has
been initialized, and also makes the code clearer by renaming the
"no_more_logging" variable to "logging_enabled".
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/platforms/pseries/rtasd.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c index 30925d29bcea..73401c820110 100644 --- a/arch/powerpc/platforms/pseries/rtasd.c +++ b/arch/powerpc/platforms/pseries/rtasd.c | |||
@@ -54,8 +54,9 @@ static unsigned int rtas_event_scan_rate; | |||
54 | static int full_rtas_msgs = 0; | 54 | static int full_rtas_msgs = 0; |
55 | 55 | ||
56 | /* Stop logging to nvram after first fatal error */ | 56 | /* Stop logging to nvram after first fatal error */ |
57 | static int no_more_logging; | 57 | static int logging_enabled; /* Until we initialize everything, |
58 | 58 | * make sure we don't try logging | |
59 | * anything */ | ||
59 | static int error_log_cnt; | 60 | static int error_log_cnt; |
60 | 61 | ||
61 | /* | 62 | /* |
@@ -217,7 +218,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal) | |||
217 | } | 218 | } |
218 | 219 | ||
219 | /* Write error to NVRAM */ | 220 | /* Write error to NVRAM */ |
220 | if (!no_more_logging && !(err_type & ERR_FLAG_BOOT)) | 221 | if (logging_enabled && !(err_type & ERR_FLAG_BOOT)) |
221 | nvram_write_error_log(buf, len, err_type, error_log_cnt); | 222 | nvram_write_error_log(buf, len, err_type, error_log_cnt); |
222 | 223 | ||
223 | /* | 224 | /* |
@@ -229,8 +230,8 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal) | |||
229 | printk_log_rtas(buf, len); | 230 | printk_log_rtas(buf, len); |
230 | 231 | ||
231 | /* Check to see if we need to or have stopped logging */ | 232 | /* Check to see if we need to or have stopped logging */ |
232 | if (fatal || no_more_logging) { | 233 | if (fatal || !logging_enabled) { |
233 | no_more_logging = 1; | 234 | logging_enabled = 0; |
234 | spin_unlock_irqrestore(&rtasd_log_lock, s); | 235 | spin_unlock_irqrestore(&rtasd_log_lock, s); |
235 | return; | 236 | return; |
236 | } | 237 | } |
@@ -302,7 +303,7 @@ static ssize_t rtas_log_read(struct file * file, char __user * buf, | |||
302 | 303 | ||
303 | spin_lock_irqsave(&rtasd_log_lock, s); | 304 | spin_lock_irqsave(&rtasd_log_lock, s); |
304 | /* if it's 0, then we know we got the last one (the one in NVRAM) */ | 305 | /* if it's 0, then we know we got the last one (the one in NVRAM) */ |
305 | if (rtas_log_size == 0 && !no_more_logging) | 306 | if (rtas_log_size == 0 && logging_enabled) |
306 | nvram_clear_error_log(); | 307 | nvram_clear_error_log(); |
307 | spin_unlock_irqrestore(&rtasd_log_lock, s); | 308 | spin_unlock_irqrestore(&rtasd_log_lock, s); |
308 | 309 | ||
@@ -414,6 +415,8 @@ static int rtasd(void *unused) | |||
414 | memset(logdata, 0, rtas_error_log_max); | 415 | memset(logdata, 0, rtas_error_log_max); |
415 | rc = nvram_read_error_log(logdata, rtas_error_log_max, | 416 | rc = nvram_read_error_log(logdata, rtas_error_log_max, |
416 | &err_type, &error_log_cnt); | 417 | &err_type, &error_log_cnt); |
418 | /* We can use rtas_log_buf now */ | ||
419 | logging_enabled = 1; | ||
417 | 420 | ||
418 | if (!rc) { | 421 | if (!rc) { |
419 | if (err_type != ERR_FLAG_ALREADY_LOGGED) { | 422 | if (err_type != ERR_FLAG_ALREADY_LOGGED) { |