aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries
diff options
context:
space:
mode:
authorLinas Vepstas <linas@austin.ibm.com>2007-08-08 16:03:37 -0400
committerPaul Mackerras <paulus@samba.org>2007-08-16 21:01:52 -0400
commit4511dad42a8da41fc2f5a58066c519c2228896ac (patch)
tree9bff1d822ef8fce1f146346043642d57d559553c /arch/powerpc/platforms/pseries
parentba28cc09316510aacb17f8421fdaae37969a4d5b (diff)
[POWERPC] pseries: Simplify rtasd initialization
Simplify rtasd initialization code; this also fixes a buglet, where the /proc entries weren't being cleaned up in case of failure. Signed-off-by: Linas Vepstas <linas@austin.ibm.com> ---- arch/powerpc/platforms/pseries/rtasd.c | 53 +++++++++++---------------------- 1 file changed, 19 insertions(+), 34 deletions(-) Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/pseries')
-rw-r--r--arch/powerpc/platforms/pseries/rtasd.c53
1 files changed, 19 insertions, 34 deletions
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c
index 48e6dc0ae15a..d902097646b7 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/platforms/pseries/rtasd.c
@@ -64,8 +64,6 @@ volatile int error_log_cnt = 0;
64 */ 64 */
65static unsigned char logdata[RTAS_ERROR_LOG_MAX]; 65static unsigned char logdata[RTAS_ERROR_LOG_MAX];
66 66
67static int get_eventscan_parms(void);
68
69static char *rtas_type[] = { 67static char *rtas_type[] = {
70 "Unknown", "Retry", "TCE Error", "Internal Device Failure", 68 "Unknown", "Retry", "TCE Error", "Internal Device Failure",
71 "Timeout", "Data Parity", "Address Parity", "Cache Parity", 69 "Timeout", "Data Parity", "Address Parity", "Cache Parity",
@@ -169,9 +167,9 @@ static int log_rtas_len(char * buf)
169 len += err->extended_log_length; 167 len += err->extended_log_length;
170 } 168 }
171 169
172 if (rtas_error_log_max == 0) { 170 if (rtas_error_log_max == 0)
173 get_eventscan_parms(); 171 rtas_error_log_max = rtas_get_error_log_max();
174 } 172
175 if (len > rtas_error_log_max) 173 if (len > rtas_error_log_max)
176 len = rtas_error_log_max; 174 len = rtas_error_log_max;
177 175
@@ -359,22 +357,6 @@ static int enable_surveillance(int timeout)
359 return -1; 357 return -1;
360} 358}
361 359
362static int get_eventscan_parms(void)
363{
364 rtas_event_scan_rate = rtas_token("rtas-event-scan-rate");
365 if (rtas_event_scan_rate == RTAS_UNKNOWN_SERVICE) {
366 printk(KERN_ERR "rtasd: no rtas-event-scan-rate\n");
367 return -1;
368 }
369 DEBUG("rtas-event-scan-rate %d\n", rtas_event_scan_rate);
370
371 /* Make room for the sequence number */
372 rtas_error_log_max = rtas_get_error_log_max();
373 rtas_error_log_buffer_max = rtas_error_log_max + sizeof(int);
374
375 return 0;
376}
377
378static void do_event_scan(void) 360static void do_event_scan(void)
379{ 361{
380 int error; 362 int error;
@@ -424,22 +406,11 @@ static int rtasd(void *unused)
424 406
425 daemonize("rtasd"); 407 daemonize("rtasd");
426 408
427 if (get_eventscan_parms() == -1)
428 goto error;
429
430 rtas_log_buf = vmalloc(rtas_error_log_buffer_max*LOG_NUMBER);
431 if (!rtas_log_buf) {
432 printk(KERN_ERR "rtasd: no memory\n");
433 goto error;
434 }
435
436 printk(KERN_DEBUG "RTAS daemon started\n"); 409 printk(KERN_DEBUG "RTAS daemon started\n");
437
438 DEBUG("will sleep for %d milliseconds\n", (30000/rtas_event_scan_rate)); 410 DEBUG("will sleep for %d milliseconds\n", (30000/rtas_event_scan_rate));
439 411
440 /* See if we have any error stored in NVRAM */ 412 /* See if we have any error stored in NVRAM */
441 memset(logdata, 0, rtas_error_log_max); 413 memset(logdata, 0, rtas_error_log_max);
442
443 rc = nvram_read_error_log(logdata, rtas_error_log_max, &err_type); 414 rc = nvram_read_error_log(logdata, rtas_error_log_max, &err_type);
444 415
445 /* We can use rtas_log_buf now */ 416 /* We can use rtas_log_buf now */
@@ -466,8 +437,6 @@ static int rtasd(void *unused)
466 for (;;) 437 for (;;)
467 do_event_scan_all_cpus(30000/rtas_event_scan_rate); 438 do_event_scan_all_cpus(30000/rtas_event_scan_rate);
468 439
469error:
470 /* Should delete proc entries */
471 return -EINVAL; 440 return -EINVAL;
472} 441}
473 442
@@ -485,6 +454,22 @@ static int __init rtas_init(void)
485 return -ENODEV; 454 return -ENODEV;
486 } 455 }
487 456
457 rtas_event_scan_rate = rtas_token("rtas-event-scan-rate");
458 if (rtas_event_scan_rate == RTAS_UNKNOWN_SERVICE) {
459 printk(KERN_ERR "rtasd: no rtas-event-scan-rate on system\n");
460 return -ENODEV;
461 }
462
463 /* Make room for the sequence number */
464 rtas_error_log_max = rtas_get_error_log_max();
465 rtas_error_log_buffer_max = rtas_error_log_max + sizeof(int);
466
467 rtas_log_buf = vmalloc(rtas_error_log_buffer_max*LOG_NUMBER);
468 if (!rtas_log_buf) {
469 printk(KERN_ERR "rtasd: no memory\n");
470 return -ENOMEM;
471 }
472
488 entry = create_proc_entry("ppc64/rtas/error_log", S_IRUSR, NULL); 473 entry = create_proc_entry("ppc64/rtas/error_log", S_IRUSR, NULL);
489 if (entry) 474 if (entry)
490 entry->proc_fops = &proc_rtas_log_operations; 475 entry->proc_fops = &proc_rtas_log_operations;