diff options
| author | Will Schmidt <will_schmidt@vnet.ibm.com> | 2006-03-31 10:07:48 -0500 | 
|---|---|---|
| committer | Paul Mackerras <paulus@samba.org> | 2006-04-01 06:37:07 -0500 | 
| commit | 34422fed65bb1cf609892d73f1cf5e9626445f9e (patch) | |
| tree | a3abaef434b9c746157dd53853834654d8d22fdc /arch/powerpc/kernel | |
| parent | a219be2cf48fc77e73936d07187a5f8d1bca2511 (diff) | |
[PATCH] powerpc/pseries: misc lparcfg fixes
This fixes several problems with the lparcfg code.  In case
someone gets a sense of deja-vu, part of this was submitted last Sep, I
thought the changes went in, but either got backed out, or just got
lost.
First, change the local_buffer declaration to be unsigned char *.  We
had a bad-math problem in a 2.4 tree which was built with a
"-fsigned-char" parm.  I dont believe we ever build with that parm
now-a-days, but to be safe, I'd prefer the declaration be explicit.
Second, fix a bad math calculation for splpar_strlen.
Third, on the rtas_call for get-system-parameter, pass in
RTAS_DATA_BUF_SIZE for the rtas_data_buf size, instead of letting random
data determine the size.   Until recently, we've had a sufficiently
large 'random data' value get passed in, so the function just happens to
have worked OK.   Now it's getting passed a '0', which causes the
rtas_call to return success, but no data shows up in the buffer.
(oops!).   This was found by the LTC test org.
This is in a branch of code that only gets run on SPLPAR systems.
Tested on power5 Lpar.
Signed-off-by: Will Schmidt <willschm@us.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel')
| -rw-r--r-- | arch/powerpc/kernel/lparcfg.c | 9 | 
1 files changed, 5 insertions, 4 deletions
| diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c index 8be687700a50..2cbde865d4f5 100644 --- a/arch/powerpc/kernel/lparcfg.c +++ b/arch/powerpc/kernel/lparcfg.c | |||
| @@ -37,7 +37,7 @@ | |||
| 37 | #include <asm/prom.h> | 37 | #include <asm/prom.h> | 
| 38 | #include <asm/vdso_datapage.h> | 38 | #include <asm/vdso_datapage.h> | 
| 39 | 39 | ||
| 40 | #define MODULE_VERS "1.6" | 40 | #define MODULE_VERS "1.7" | 
| 41 | #define MODULE_NAME "lparcfg" | 41 | #define MODULE_NAME "lparcfg" | 
| 42 | 42 | ||
| 43 | /* #define LPARCFG_DEBUG */ | 43 | /* #define LPARCFG_DEBUG */ | 
| @@ -242,7 +242,7 @@ static void parse_system_parameter_string(struct seq_file *m) | |||
| 242 | { | 242 | { | 
| 243 | int call_status; | 243 | int call_status; | 
| 244 | 244 | ||
| 245 | char *local_buffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); | 245 | unsigned char *local_buffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); | 
| 246 | if (!local_buffer) { | 246 | if (!local_buffer) { | 
| 247 | printk(KERN_ERR "%s %s kmalloc failure at line %d \n", | 247 | printk(KERN_ERR "%s %s kmalloc failure at line %d \n", | 
| 248 | __FILE__, __FUNCTION__, __LINE__); | 248 | __FILE__, __FUNCTION__, __LINE__); | 
| @@ -254,7 +254,8 @@ static void parse_system_parameter_string(struct seq_file *m) | |||
| 254 | call_status = rtas_call(rtas_token("ibm,get-system-parameter"), 3, 1, | 254 | call_status = rtas_call(rtas_token("ibm,get-system-parameter"), 3, 1, | 
| 255 | NULL, | 255 | NULL, | 
| 256 | SPLPAR_CHARACTERISTICS_TOKEN, | 256 | SPLPAR_CHARACTERISTICS_TOKEN, | 
| 257 | __pa(rtas_data_buf)); | 257 | __pa(rtas_data_buf), | 
| 258 | RTAS_DATA_BUF_SIZE); | ||
| 258 | memcpy(local_buffer, rtas_data_buf, SPLPAR_MAXLENGTH); | 259 | memcpy(local_buffer, rtas_data_buf, SPLPAR_MAXLENGTH); | 
| 259 | spin_unlock(&rtas_data_buf_lock); | 260 | spin_unlock(&rtas_data_buf_lock); | 
| 260 | 261 | ||
| @@ -275,7 +276,7 @@ static void parse_system_parameter_string(struct seq_file *m) | |||
| 275 | #ifdef LPARCFG_DEBUG | 276 | #ifdef LPARCFG_DEBUG | 
| 276 | printk(KERN_INFO "success calling get-system-parameter \n"); | 277 | printk(KERN_INFO "success calling get-system-parameter \n"); | 
| 277 | #endif | 278 | #endif | 
| 278 | splpar_strlen = local_buffer[0] * 16 + local_buffer[1]; | 279 | splpar_strlen = local_buffer[0] * 256 + local_buffer[1]; | 
| 279 | local_buffer += 2; /* step over strlen value */ | 280 | local_buffer += 2; /* step over strlen value */ | 
| 280 | 281 | ||
| 281 | memset(workbuffer, 0, SPLPAR_MAXLENGTH); | 282 | memset(workbuffer, 0, SPLPAR_MAXLENGTH); | 
