提交 b6966b1b 编写于 作者: M Mark Nelson 提交者: Paul Mackerras

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: NMark Nelson <markn@au1.ibm.com>
Tested-by: NAdrian Reber <adrian@lisas.de>
Acked-by: NUtz Bacher <utz.bacher@de.ibm.com>
Signed-off-by: NPaul Mackerras <paulus@samba.org>
上级 ae6e59ca
...@@ -106,6 +106,8 @@ static int wdrtas_set_interval(int interval) ...@@ -106,6 +106,8 @@ static int wdrtas_set_interval(int interval)
return result; return result;
} }
#define WDRTAS_SP_SPI_LEN 4
/** /**
* wdrtas_get_interval - returns the current watchdog interval * wdrtas_get_interval - returns the current watchdog interval
* @fallback_value: value (in seconds) to use, if the RTAS call fails * @fallback_value: value (in seconds) to use, if the RTAS call fails
...@@ -119,10 +121,17 @@ static int wdrtas_set_interval(int interval) ...@@ -119,10 +121,17 @@ static int wdrtas_set_interval(int interval)
static int wdrtas_get_interval(int fallback_value) static int wdrtas_get_interval(int fallback_value)
{ {
long result; long result;
char value[4]; char value[WDRTAS_SP_SPI_LEN];
spin_lock(&rtas_data_buf_lock);
memset(rtas_data_buf, 0, WDRTAS_SP_SPI_LEN);
result = rtas_call(wdrtas_token_get_sp, 3, 1, NULL, result = rtas_call(wdrtas_token_get_sp, 3, 1, NULL,
WDRTAS_SP_SPI, (void *)__pa(&value), 4); WDRTAS_SP_SPI, __pa(rtas_data_buf),
WDRTAS_SP_SPI_LEN);
memcpy(value, rtas_data_buf, WDRTAS_SP_SPI_LEN);
spin_unlock(&rtas_data_buf_lock);
if (value[0] != 0 || value[1] != 2 || value[3] != 0 || result < 0) { if (value[0] != 0 || value[1] != 2 || value[3] != 0 || result < 0) {
printk(KERN_WARNING "wdrtas: could not get sp_spi watchdog " printk(KERN_WARNING "wdrtas: could not get sp_spi watchdog "
"timeout (%li). Continuing\n", result); "timeout (%li). Continuing\n", result);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册