diff options
author | Mark Nelson <markn@au1.ibm.com> | 2009-03-23 16:30:41 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2009-04-07 01:07:43 -0400 |
commit | b6966b1be568e83a48585369731f1123a6f85157 (patch) | |
tree | cbed24a70a521a32965b18c589035e819003c7a4 /drivers/watchdog | |
parent | ae6e59caefd8d4097ccb096c95df95ec7e52fe88 (diff) |
powerpc/wdrtas: Update wdrtas_get_interval to use rtas_data_buf
The buffer passed to the ibm,get-system-parameter RTAS call must be
in the RMA. To ensure we pass an address in the RMA use rtas_data_buf
for the actual RTAS call and then copy the result to value. We can't
just make it static because this can be compiled in as a module.
Also add the WDRTAS_SP_SPI_LEN so we don't litter '4' throughout the
function.
Signed-off-by: Mark Nelson <markn@au1.ibm.com>
Tested-by: Adrian Reber <adrian@lisas.de>
Acked-by: Utz Bacher <utz.bacher@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/wdrtas.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/watchdog/wdrtas.c b/drivers/watchdog/wdrtas.c index 5d3b1a8e28b0..a38fa4907c92 100644 --- a/drivers/watchdog/wdrtas.c +++ b/drivers/watchdog/wdrtas.c | |||
@@ -106,6 +106,8 @@ static int wdrtas_set_interval(int interval) | |||
106 | return result; | 106 | return result; |
107 | } | 107 | } |
108 | 108 | ||
109 | #define WDRTAS_SP_SPI_LEN 4 | ||
110 | |||
109 | /** | 111 | /** |
110 | * wdrtas_get_interval - returns the current watchdog interval | 112 | * wdrtas_get_interval - returns the current watchdog interval |
111 | * @fallback_value: value (in seconds) to use, if the RTAS call fails | 113 | * @fallback_value: value (in seconds) to use, if the RTAS call fails |
@@ -119,10 +121,17 @@ static int wdrtas_set_interval(int interval) | |||
119 | static int wdrtas_get_interval(int fallback_value) | 121 | static int wdrtas_get_interval(int fallback_value) |
120 | { | 122 | { |
121 | long result; | 123 | long result; |
122 | char value[4]; | 124 | char value[WDRTAS_SP_SPI_LEN]; |
123 | 125 | ||
126 | spin_lock(&rtas_data_buf_lock); | ||
127 | memset(rtas_data_buf, 0, WDRTAS_SP_SPI_LEN); | ||
124 | result = rtas_call(wdrtas_token_get_sp, 3, 1, NULL, | 128 | result = rtas_call(wdrtas_token_get_sp, 3, 1, NULL, |
125 | WDRTAS_SP_SPI, (void *)__pa(&value), 4); | 129 | WDRTAS_SP_SPI, __pa(rtas_data_buf), |
130 | WDRTAS_SP_SPI_LEN); | ||
131 | |||
132 | memcpy(value, rtas_data_buf, WDRTAS_SP_SPI_LEN); | ||
133 | spin_unlock(&rtas_data_buf_lock); | ||
134 | |||
126 | if (value[0] != 0 || value[1] != 2 || value[3] != 0 || result < 0) { | 135 | if (value[0] != 0 || value[1] != 2 || value[3] != 0 || result < 0) { |
127 | printk(KERN_WARNING "wdrtas: could not get sp_spi watchdog " | 136 | printk(KERN_WARNING "wdrtas: could not get sp_spi watchdog " |
128 | "timeout (%li). Continuing\n", result); | 137 | "timeout (%li). Continuing\n", result); |