Commit fe3a3a65 authored by Paul Mackerras's avatar Paul Mackerras Committed by Linus Torvalds

[PATCH] ppc64: clean up prom.c and related files

Somebody back in the mists of time decided that call_prom and rtas_call
should return longs even though both of those bits of firmware run in
32-bit mode and produce a 32-bit result.  To make life more interesting,
the 32-bit result gets zero-extended to 64 bits, which makes checking
for a -1 return value more complicated than it should be.

This patch changes call_prom and rtas_call to return an int, and makes
the corresponding changes to use ints for the variables used to hold
those return values. 

While I was doing this I finally got annoyed enough with the strings of
prom_print() and prom_print_hex() calls that we do to write a simple
prom_printf.  I deliberately didn't use snprintf because the execution
environment is weird at this point - we aren't running at the address we
are linked at just yet - and I didn't want to inflict that on any code
outside this file.  I also did a prom_debug() macro, which eliminated a
few ifdefs. 

There are also a bunch of other minor cleanups.  This patch makes very
few algorithmic changes but does get rid of a lot of casts.  :)

I have been running with this patch for a couple of weeks, and Anton has
tested it too.
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 91bc6523
...@@ -365,7 +365,8 @@ unsigned long eeh_check_failure(void *token, unsigned long val) ...@@ -365,7 +365,8 @@ unsigned long eeh_check_failure(void *token, unsigned long val)
unsigned long addr; unsigned long addr;
struct pci_dev *dev; struct pci_dev *dev;
struct device_node *dn; struct device_node *dn;
unsigned long ret, rets[2]; unsigned long ret;
int rets[2];
static spinlock_t lock = SPIN_LOCK_UNLOCKED; static spinlock_t lock = SPIN_LOCK_UNLOCKED;
/* dont want this on the stack */ /* dont want this on the stack */
static unsigned char slot_err_buf[RTAS_ERROR_LOG_MAX]; static unsigned char slot_err_buf[RTAS_ERROR_LOG_MAX];
...@@ -444,11 +445,11 @@ unsigned long eeh_check_failure(void *token, unsigned long val) ...@@ -444,11 +445,11 @@ unsigned long eeh_check_failure(void *token, unsigned long val)
* can use it here. * can use it here.
*/ */
if (panic_on_oops) { if (panic_on_oops) {
panic("EEH: MMIO failure (%ld) on device:%s %s\n", panic("EEH: MMIO failure (%d) on device:%s %s\n",
rets[0], pci_name(dev), pci_pretty_name(dev)); rets[0], pci_name(dev), pci_pretty_name(dev));
} else { } else {
__get_cpu_var(ignored_failures)++; __get_cpu_var(ignored_failures)++;
printk(KERN_INFO "EEH: MMIO failure (%ld) on device:%s %s\n", printk(KERN_INFO "EEH: MMIO failure (%d) on device:%s %s\n",
rets[0], pci_name(dev), pci_pretty_name(dev)); rets[0], pci_name(dev), pci_pretty_name(dev));
} }
} else { } else {
......
...@@ -37,7 +37,8 @@ static spinlock_t nvram_lock = SPIN_LOCK_UNLOCKED; ...@@ -37,7 +37,8 @@ static spinlock_t nvram_lock = SPIN_LOCK_UNLOCKED;
static ssize_t pSeries_nvram_read(char *buf, size_t count, loff_t *index) static ssize_t pSeries_nvram_read(char *buf, size_t count, loff_t *index)
{ {
unsigned int i; unsigned int i;
unsigned long len, done; unsigned long len;
int done;
unsigned long flags; unsigned long flags;
char *p = buf; char *p = buf;
...@@ -80,7 +81,8 @@ static ssize_t pSeries_nvram_read(char *buf, size_t count, loff_t *index) ...@@ -80,7 +81,8 @@ static ssize_t pSeries_nvram_read(char *buf, size_t count, loff_t *index)
static ssize_t pSeries_nvram_write(char *buf, size_t count, loff_t *index) static ssize_t pSeries_nvram_write(char *buf, size_t count, loff_t *index)
{ {
unsigned int i; unsigned int i;
unsigned long len, done; unsigned long len;
int done;
unsigned long flags; unsigned long flags;
const char *p = buf; const char *p = buf;
......
...@@ -62,7 +62,7 @@ extern unsigned long pci_probe_only; ...@@ -62,7 +62,7 @@ extern unsigned long pci_probe_only;
static int rtas_read_config(struct device_node *dn, int where, int size, u32 *val) static int rtas_read_config(struct device_node *dn, int where, int size, u32 *val)
{ {
unsigned long returnval = ~0L; int returnval = -1;
unsigned long buid, addr; unsigned long buid, addr;
int ret; int ret;
...@@ -72,7 +72,8 @@ static int rtas_read_config(struct device_node *dn, int where, int size, u32 *va ...@@ -72,7 +72,8 @@ static int rtas_read_config(struct device_node *dn, int where, int size, u32 *va
addr = (dn->busno << 16) | (dn->devfn << 8) | where; addr = (dn->busno << 16) | (dn->devfn << 8) | where;
buid = dn->phb->buid; buid = dn->phb->buid;
if (buid) { if (buid) {
ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval, addr, buid >> 32, buid & 0xffffffff, size); ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval,
addr, buid >> 32, buid & 0xffffffff, size);
} else { } else {
ret = rtas_call(read_pci_config, 2, 2, &returnval, addr, size); ret = rtas_call(read_pci_config, 2, 2, &returnval, addr, size);
} }
......
This diff is collapsed.
...@@ -394,7 +394,7 @@ static ssize_t ppc_rtas_clock_read(struct file * file, char * buf, ...@@ -394,7 +394,7 @@ static ssize_t ppc_rtas_clock_read(struct file * file, char * buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
unsigned int year, mon, day, hour, min, sec; unsigned int year, mon, day, hour, min, sec;
unsigned long *ret = kmalloc(4*8, GFP_KERNEL); int ret[8];
int n, sn, error; int n, sn, error;
char stkbuf[40]; /* its small, its on stack */ char stkbuf[40]; /* its small, its on stack */
...@@ -411,7 +411,6 @@ static ssize_t ppc_rtas_clock_read(struct file * file, char * buf, ...@@ -411,7 +411,6 @@ static ssize_t ppc_rtas_clock_read(struct file * file, char * buf,
n = scnprintf (stkbuf, sizeof(stkbuf), "%lu\n", n = scnprintf (stkbuf, sizeof(stkbuf), "%lu\n",
mktime(year, mon, day, hour, min, sec)); mktime(year, mon, day, hour, min, sec));
} }
kfree(ret);
sn = strlen (stkbuf) +1; sn = strlen (stkbuf) +1;
if (*ppos >= sn) if (*ppos >= sn)
...@@ -434,7 +433,6 @@ static int ppc_rtas_sensor_read(char * buf, char ** start, off_t off, ...@@ -434,7 +433,6 @@ static int ppc_rtas_sensor_read(char * buf, char ** start, off_t off,
int count, int *eof, void *data) int count, int *eof, void *data)
{ {
int i,j,n; int i,j,n;
unsigned long ret;
int state, error; int state, error;
char *buffer; char *buffer;
int get_sensor_state = rtas_token("get-sensor-state"); int get_sensor_state = rtas_token("get-sensor-state");
...@@ -464,11 +462,10 @@ static int ppc_rtas_sensor_read(char * buf, char ** start, off_t off, ...@@ -464,11 +462,10 @@ static int ppc_rtas_sensor_read(char * buf, char ** start, off_t off,
/* A sensor may have multiple instances */ /* A sensor may have multiple instances */
while (j >= 0) { while (j >= 0) {
error = rtas_call(get_sensor_state, 2, 2, &ret, error = rtas_call(get_sensor_state, 2, 2, &state,
sensors.sensor[i].token, sensors.sensor[i].token,
sensors.sensor[i].quant - j); sensors.sensor[i].quant - j);
state = (int) ret;
n += ppc_rtas_process_sensor(sensors.sensor[i], state, n += ppc_rtas_process_sensor(sensors.sensor[i], state,
error, buffer+n ); error, buffer+n );
n += sprintf (buffer+n, "\n"); n += sprintf (buffer+n, "\n");
......
...@@ -139,15 +139,13 @@ log_rtas_error(struct rtas_args *rtas_args) ...@@ -139,15 +139,13 @@ log_rtas_error(struct rtas_args *rtas_args)
log_error(rtas_err_buf, ERR_TYPE_RTAS_LOG, 0); log_error(rtas_err_buf, ERR_TYPE_RTAS_LOG, 0);
} }
long int rtas_call(int token, int nargs, int nret, int *outputs, ...)
rtas_call(int token, int nargs, int nret,
unsigned long *outputs, ...)
{ {
va_list list; va_list list;
int i, logit = 0; int i, logit = 0;
unsigned long s; unsigned long s;
struct rtas_args *rtas_args; struct rtas_args *rtas_args;
long ret; int ret;
PPCDBG(PPCDBG_RTAS, "Entering rtas_call\n"); PPCDBG(PPCDBG_RTAS, "Entering rtas_call\n");
PPCDBG(PPCDBG_RTAS, "\ttoken = 0x%x\n", token); PPCDBG(PPCDBG_RTAS, "\ttoken = 0x%x\n", token);
...@@ -167,8 +165,8 @@ rtas_call(int token, int nargs, int nret, ...@@ -167,8 +165,8 @@ rtas_call(int token, int nargs, int nret,
rtas_args->rets = (rtas_arg_t *)&(rtas_args->args[nargs]); rtas_args->rets = (rtas_arg_t *)&(rtas_args->args[nargs]);
va_start(list, outputs); va_start(list, outputs);
for (i = 0; i < nargs; ++i) { for (i = 0; i < nargs; ++i) {
rtas_args->args[i] = (rtas_arg_t)LONG_LSW(va_arg(list, ulong)); rtas_args->args[i] = va_arg(list, rtas_arg_t);
PPCDBG(PPCDBG_RTAS, "\tnarg[%d] = 0x%lx\n", i, rtas_args->args[i]); PPCDBG(PPCDBG_RTAS, "\tnarg[%d] = 0x%x\n", i, rtas_args->args[i]);
} }
va_end(list); va_end(list);
...@@ -191,7 +189,7 @@ rtas_call(int token, int nargs, int nret, ...@@ -191,7 +189,7 @@ rtas_call(int token, int nargs, int nret,
if (nret > 1 && outputs != NULL) if (nret > 1 && outputs != NULL)
for (i = 0; i < nret-1; ++i) for (i = 0; i < nret-1; ++i)
outputs[i] = rtas_args->rets[i+1]; outputs[i] = rtas_args->rets[i+1];
ret = (ulong)((nret > 0) ? rtas_args->rets[0] : 0); ret = (nret > 0)? rtas_args->rets[0]: 0;
/* Gotta do something different here, use global lock for now... */ /* Gotta do something different here, use global lock for now... */
spin_unlock_irqrestore(&rtas.lock, s); spin_unlock_irqrestore(&rtas.lock, s);
...@@ -227,20 +225,13 @@ int ...@@ -227,20 +225,13 @@ int
rtas_get_power_level(int powerdomain, int *level) rtas_get_power_level(int powerdomain, int *level)
{ {
int token = rtas_token("get-power-level"); int token = rtas_token("get-power-level");
long powerlevel;
int rc; int rc;
if (token == RTAS_UNKNOWN_SERVICE) if (token == RTAS_UNKNOWN_SERVICE)
return RTAS_UNKNOWN_OP; return RTAS_UNKNOWN_OP;
while(1) { while ((rc = rtas_call(token, 1, 2, level, powerdomain)) == RTAS_BUSY)
rc = (int) rtas_call(token, 1, 2, &powerlevel, powerdomain); udelay(1);
if (rc == RTAS_BUSY)
udelay(1);
else
break;
}
*level = (int) powerlevel;
return rc; return rc;
} }
...@@ -249,25 +240,21 @@ rtas_set_power_level(int powerdomain, int level, int *setlevel) ...@@ -249,25 +240,21 @@ rtas_set_power_level(int powerdomain, int level, int *setlevel)
{ {
int token = rtas_token("set-power-level"); int token = rtas_token("set-power-level");
unsigned int wait_time; unsigned int wait_time;
long returned_level;
int rc; int rc;
if (token == RTAS_UNKNOWN_SERVICE) if (token == RTAS_UNKNOWN_SERVICE)
return RTAS_UNKNOWN_OP; return RTAS_UNKNOWN_OP;
while (1) { while (1) {
rc = (int) rtas_call(token, 2, 2, &returned_level, powerdomain, rc = rtas_call(token, 2, 2, setlevel, powerdomain, level);
level);
if (rc == RTAS_BUSY) if (rc == RTAS_BUSY)
udelay(1); udelay(1);
else if (rtas_is_extended_busy(rc)) { else if (rtas_is_extended_busy(rc)) {
wait_time = rtas_extended_busy_delay_time(rc); wait_time = rtas_extended_busy_delay_time(rc);
udelay(wait_time * 1000); udelay(wait_time * 1000);
} } else
else
break; break;
} }
*setlevel = (int) returned_level;
return rc; return rc;
} }
...@@ -276,25 +263,21 @@ rtas_get_sensor(int sensor, int index, int *state) ...@@ -276,25 +263,21 @@ rtas_get_sensor(int sensor, int index, int *state)
{ {
int token = rtas_token("get-sensor-state"); int token = rtas_token("get-sensor-state");
unsigned int wait_time; unsigned int wait_time;
long returned_state;
int rc; int rc;
if (token == RTAS_UNKNOWN_SERVICE) if (token == RTAS_UNKNOWN_SERVICE)
return RTAS_UNKNOWN_OP; return RTAS_UNKNOWN_OP;
while (1) { while (1) {
rc = (int) rtas_call(token, 2, 2, &returned_state, sensor, rc = rtas_call(token, 2, 2, state, sensor, index);
index);
if (rc == RTAS_BUSY) if (rc == RTAS_BUSY)
udelay(1); udelay(1);
else if (rtas_is_extended_busy(rc)) { else if (rtas_is_extended_busy(rc)) {
wait_time = rtas_extended_busy_delay_time(rc); wait_time = rtas_extended_busy_delay_time(rc);
udelay(wait_time * 1000); udelay(wait_time * 1000);
} } else
else
break; break;
} }
*state = (int) returned_state;
return rc; return rc;
} }
...@@ -309,8 +292,7 @@ rtas_set_indicator(int indicator, int index, int new_value) ...@@ -309,8 +292,7 @@ rtas_set_indicator(int indicator, int index, int new_value)
return RTAS_UNKNOWN_OP; return RTAS_UNKNOWN_OP;
while (1) { while (1) {
rc = (int) rtas_call(token, 3, 1, NULL, indicator, index, rc = rtas_call(token, 3, 1, NULL, indicator, index, new_value);
new_value);
if (rc == RTAS_BUSY) if (rc == RTAS_BUSY)
udelay(1); udelay(1);
else if (rtas_is_extended_busy(rc)) { else if (rtas_is_extended_busy(rc)) {
...@@ -409,7 +391,7 @@ rtas_restart(char *cmd) ...@@ -409,7 +391,7 @@ rtas_restart(char *cmd)
if (rtas_firmware_flash_list.next) if (rtas_firmware_flash_list.next)
rtas_flash_firmware(); rtas_flash_firmware();
printk("RTAS system-reboot returned %ld\n", printk("RTAS system-reboot returned %d\n",
rtas_call(rtas_token("system-reboot"), 0, 1, NULL)); rtas_call(rtas_token("system-reboot"), 0, 1, NULL));
for (;;); for (;;);
} }
...@@ -420,8 +402,8 @@ rtas_power_off(void) ...@@ -420,8 +402,8 @@ rtas_power_off(void)
if (rtas_firmware_flash_list.next) if (rtas_firmware_flash_list.next)
rtas_flash_bypass_warning(); rtas_flash_bypass_warning();
/* allow power on only with power button press */ /* allow power on only with power button press */
printk("RTAS power-off returned %ld\n", printk("RTAS power-off returned %d\n",
rtas_call(rtas_token("power-off"), 2, 1, NULL,0xffffffff,0xffffffff)); rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1));
for (;;); for (;;);
} }
...@@ -438,7 +420,7 @@ static char rtas_os_term_buf[2048]; ...@@ -438,7 +420,7 @@ static char rtas_os_term_buf[2048];
void rtas_os_term(char *str) void rtas_os_term(char *str)
{ {
long status; int status;
snprintf(rtas_os_term_buf, 2048, "OS panic: %s", str); snprintf(rtas_os_term_buf, 2048, "OS panic: %s", str);
...@@ -449,7 +431,7 @@ void rtas_os_term(char *str) ...@@ -449,7 +431,7 @@ void rtas_os_term(char *str)
if (status == RTAS_BUSY) if (status == RTAS_BUSY)
udelay(1); udelay(1);
else if (status != 0) else if (status != 0)
printk(KERN_EMERG "ibm,os-term call failed %ld\n", printk(KERN_EMERG "ibm,os-term call failed %d\n",
status); status);
} while (status == RTAS_BUSY); } while (status == RTAS_BUSY);
} }
......
...@@ -344,8 +344,8 @@ static void manage_flash(struct rtas_manage_flash_t *args_buf) ...@@ -344,8 +344,8 @@ static void manage_flash(struct rtas_manage_flash_t *args_buf)
s32 rc; s32 rc;
while (1) { while (1) {
rc = (s32) rtas_call(rtas_token("ibm,manage-flash-image"), 1, rc = rtas_call(rtas_token("ibm,manage-flash-image"), 1,
1, NULL, (long) args_buf->op); 1, NULL, args_buf->op);
if (rc == RTAS_RC_BUSY) if (rc == RTAS_RC_BUSY)
udelay(1); udelay(1);
else if (rtas_is_extended_busy(rc)) { else if (rtas_is_extended_busy(rc)) {
...@@ -429,15 +429,15 @@ static void validate_flash(struct rtas_validate_flash_t *args_buf) ...@@ -429,15 +429,15 @@ static void validate_flash(struct rtas_validate_flash_t *args_buf)
{ {
int token = rtas_token("ibm,validate-flash-image"); int token = rtas_token("ibm,validate-flash-image");
unsigned int wait_time; unsigned int wait_time;
long update_results; int update_results;
s32 rc; s32 rc;
rc = 0; rc = 0;
while(1) { while(1) {
spin_lock(&rtas_data_buf_lock); spin_lock(&rtas_data_buf_lock);
memcpy(rtas_data_buf, args_buf->buf, VALIDATE_BUF_SIZE); memcpy(rtas_data_buf, args_buf->buf, VALIDATE_BUF_SIZE);
rc = (s32) rtas_call(token, 2, 2, &update_results, rc = rtas_call(token, 2, 2, &update_results,
__pa(rtas_data_buf), args_buf->buf_size); (u32) __pa(rtas_data_buf), args_buf->buf_size);
memcpy(args_buf->buf, rtas_data_buf, VALIDATE_BUF_SIZE); memcpy(args_buf->buf, rtas_data_buf, VALIDATE_BUF_SIZE);
spin_unlock(&rtas_data_buf_lock); spin_unlock(&rtas_data_buf_lock);
...@@ -451,7 +451,7 @@ static void validate_flash(struct rtas_validate_flash_t *args_buf) ...@@ -451,7 +451,7 @@ static void validate_flash(struct rtas_validate_flash_t *args_buf)
} }
args_buf->status = rc; args_buf->status = rc;
args_buf->update_results = (u32) update_results; args_buf->update_results = update_results;
} }
static int get_validate_flash_msg(struct rtas_validate_flash_t *args_buf, static int get_validate_flash_msg(struct rtas_validate_flash_t *args_buf,
......
...@@ -346,13 +346,13 @@ void iSeries_get_boot_time(struct rtc_time *tm) ...@@ -346,13 +346,13 @@ void iSeries_get_boot_time(struct rtc_time *tm)
#define RTAS_CLOCK_BUSY (-2) #define RTAS_CLOCK_BUSY (-2)
void pSeries_get_boot_time(struct rtc_time *rtc_tm) void pSeries_get_boot_time(struct rtc_time *rtc_tm)
{ {
unsigned long ret[8]; int ret[8];
int error, wait_time; int error, wait_time;
unsigned long max_wait_tb; unsigned long max_wait_tb;
max_wait_tb = __get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT; max_wait_tb = __get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT;
do { do {
error = rtas_call(rtas_token("get-time-of-day"), 0, 8, (void *)&ret); error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret);
if (error == RTAS_CLOCK_BUSY || rtas_is_extended_busy(error)) { if (error == RTAS_CLOCK_BUSY || rtas_is_extended_busy(error)) {
wait_time = rtas_extended_busy_delay_time(error); wait_time = rtas_extended_busy_delay_time(error);
/* This is boot time so we spin. */ /* This is boot time so we spin. */
...@@ -381,13 +381,13 @@ void pSeries_get_boot_time(struct rtc_time *rtc_tm) ...@@ -381,13 +381,13 @@ void pSeries_get_boot_time(struct rtc_time *rtc_tm)
*/ */
void pSeries_get_rtc_time(struct rtc_time *rtc_tm) void pSeries_get_rtc_time(struct rtc_time *rtc_tm)
{ {
unsigned long ret[8]; int ret[8];
int error, wait_time; int error, wait_time;
unsigned long max_wait_tb; unsigned long max_wait_tb;
max_wait_tb = __get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT; max_wait_tb = __get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT;
do { do {
error = rtas_call(rtas_token("get-time-of-day"), 0, 8, (void *)&ret); error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret);
if (error == RTAS_CLOCK_BUSY || rtas_is_extended_busy(error)) { if (error == RTAS_CLOCK_BUSY || rtas_is_extended_busy(error)) {
if (in_interrupt()) { if (in_interrupt()) {
printk(KERN_WARNING "error: reading clock would delay interrupt\n"); printk(KERN_WARNING "error: reading clock would delay interrupt\n");
......
...@@ -49,7 +49,7 @@ static ssize_t scanlog_read(struct file *file, char *buf, ...@@ -49,7 +49,7 @@ static ssize_t scanlog_read(struct file *file, char *buf,
struct inode * inode = file->f_dentry->d_inode; struct inode * inode = file->f_dentry->d_inode;
struct proc_dir_entry *dp; struct proc_dir_entry *dp;
unsigned int *data; unsigned int *data;
unsigned long status; int status;
unsigned long len, off; unsigned long len, off;
unsigned int wait_time; unsigned int wait_time;
...@@ -81,11 +81,11 @@ static ssize_t scanlog_read(struct file *file, char *buf, ...@@ -81,11 +81,11 @@ static ssize_t scanlog_read(struct file *file, char *buf,
spin_lock(&rtas_data_buf_lock); spin_lock(&rtas_data_buf_lock);
memcpy(rtas_data_buf, data, RTAS_DATA_BUF_SIZE); memcpy(rtas_data_buf, data, RTAS_DATA_BUF_SIZE);
status = rtas_call(ibm_scan_log_dump, 2, 1, NULL, status = rtas_call(ibm_scan_log_dump, 2, 1, NULL,
__pa(rtas_data_buf), count); (u32) __pa(rtas_data_buf), (u32) count);
memcpy(data, rtas_data_buf, RTAS_DATA_BUF_SIZE); memcpy(data, rtas_data_buf, RTAS_DATA_BUF_SIZE);
spin_unlock(&rtas_data_buf_lock); spin_unlock(&rtas_data_buf_lock);
DEBUG("status=%ld, data[0]=%x, data[1]=%x, data[2]=%x\n", DEBUG("status=%d, data[0]=%x, data[1]=%x, data[2]=%x\n",
status, data[0], data[1], data[2]); status, data[0], data[1], data[2]);
switch (status) { switch (status) {
case SCANLOG_COMPLETE: case SCANLOG_COMPLETE:
...@@ -133,7 +133,7 @@ static ssize_t scanlog_write(struct file * file, const char * buf, ...@@ -133,7 +133,7 @@ static ssize_t scanlog_write(struct file * file, const char * buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
char stkbuf[20]; char stkbuf[20];
unsigned long status; int status;
if (count > 19) count = 19; if (count > 19) count = 19;
if (copy_from_user (stkbuf, buf, count)) { if (copy_from_user (stkbuf, buf, count)) {
...@@ -144,8 +144,8 @@ static ssize_t scanlog_write(struct file * file, const char * buf, ...@@ -144,8 +144,8 @@ static ssize_t scanlog_write(struct file * file, const char * buf,
if (buf) { if (buf) {
if (strncmp(stkbuf, "reset", 5) == 0) { if (strncmp(stkbuf, "reset", 5) == 0) {
DEBUG("reset scanlog\n"); DEBUG("reset scanlog\n");
status = rtas_call(ibm_scan_log_dump, 2, 1, NULL, NULL, 0); status = rtas_call(ibm_scan_log_dump, 2, 1, NULL, 0, 0);
DEBUG("rtas returns %ld\n", status); DEBUG("rtas returns %d\n", status);
} else if (strncmp(stkbuf, "debugon", 7) == 0) { } else if (strncmp(stkbuf, "debugon", 7) == 0) {
printk(KERN_ERR "scanlog: debug on\n"); printk(KERN_ERR "scanlog: debug on\n");
scanlog_debug = 1; scanlog_debug = 1;
......
...@@ -164,7 +164,7 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -164,7 +164,7 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7) unsigned long r6, unsigned long r7)
{ {
#if defined(CONFIG_SMP) && defined(CONFIG_PPC_PSERIES) #if defined(CONFIG_SMP) && defined(CONFIG_PPC_PSERIES)
unsigned int ret, i; int ret, i;
#endif #endif
#ifdef CONFIG_XMON_DEFAULT #ifdef CONFIG_XMON_DEFAULT
...@@ -232,12 +232,11 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -232,12 +232,11 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5,
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* Start secondary threads on SMT systems */ /* Start secondary threads on SMT systems */
for (i = 0; i < NR_CPUS; i++) { for (i = 0; i < NR_CPUS; i++) {
if(cpu_available(i) && !cpu_possible(i)) { if (cpu_available(i) && !cpu_possible(i)) {
printk("%16.16x : starting thread\n", i); printk("%16.16x : starting thread\n", i);
rtas_call(rtas_token("start-cpu"), 3, 1, rtas_call(rtas_token("start-cpu"), 3, 1, &ret,
(void *)&ret,
get_hard_smp_processor_id(i), get_hard_smp_processor_id(i),
*((unsigned long *)pseries_secondary_smp_init), (u32)*((unsigned long *)pseries_secondary_smp_init),
i); i);
cpu_set(i, cpu_possible_map); cpu_set(i, cpu_possible_map);
systemcfg->processorCount++; systemcfg->processorCount++;
......
...@@ -241,7 +241,7 @@ static void __devinit smp_openpic_setup_cpu(int cpu) ...@@ -241,7 +241,7 @@ static void __devinit smp_openpic_setup_cpu(int cpu)
*/ */
static int query_cpu_stopped(unsigned int pcpu) static int query_cpu_stopped(unsigned int pcpu)
{ {
long cpu_status; int cpu_status;
int status, qcss_tok; int status, qcss_tok;
qcss_tok = rtas_token("query-cpu-stopped-state"); qcss_tok = rtas_token("query-cpu-stopped-state");
......
...@@ -172,9 +172,9 @@ static struct rtas_error_log *FWNMI_get_errinfo(struct pt_regs *regs) ...@@ -172,9 +172,9 @@ static struct rtas_error_log *FWNMI_get_errinfo(struct pt_regs *regs)
*/ */
static void FWNMI_release_errinfo(void) static void FWNMI_release_errinfo(void)
{ {
unsigned long ret = rtas_call(rtas_token("ibm,nmi-interlock"), 0, 1, NULL); int ret = rtas_call(rtas_token("ibm,nmi-interlock"), 0, 1, NULL);
if (ret != 0) if (ret != 0)
printk("FWNMI: nmi-interlock failed: %ld\n", ret); printk("FWNMI: nmi-interlock failed: %d\n", ret);
} }
#endif #endif
......
...@@ -275,7 +275,7 @@ static int get_irq_server(unsigned int irq) ...@@ -275,7 +275,7 @@ static int get_irq_server(unsigned int irq)
static void xics_enable_irq(unsigned int virq) static void xics_enable_irq(unsigned int virq)
{ {
unsigned int irq; unsigned int irq;
long call_status; int call_status;
unsigned int server; unsigned int server;
irq = virt_irq_to_real(irq_offset_down(virq)); irq = virt_irq_to_real(irq_offset_down(virq));
...@@ -287,7 +287,7 @@ static void xics_enable_irq(unsigned int virq) ...@@ -287,7 +287,7 @@ static void xics_enable_irq(unsigned int virq)
DEFAULT_PRIORITY); DEFAULT_PRIORITY);
if (call_status != 0) { if (call_status != 0) {
printk(KERN_ERR "xics_enable_irq: irq=%x: ibm_set_xive " printk(KERN_ERR "xics_enable_irq: irq=%x: ibm_set_xive "
"returned %lx\n", irq, call_status); "returned %x\n", irq, call_status);
return; return;
} }
...@@ -295,14 +295,14 @@ static void xics_enable_irq(unsigned int virq) ...@@ -295,14 +295,14 @@ static void xics_enable_irq(unsigned int virq)
call_status = rtas_call(ibm_int_on, 1, 1, NULL, irq); call_status = rtas_call(ibm_int_on, 1, 1, NULL, irq);
if (call_status != 0) { if (call_status != 0) {
printk(KERN_ERR "xics_enable_irq: irq=%x: ibm_int_on " printk(KERN_ERR "xics_enable_irq: irq=%x: ibm_int_on "
"returned %lx\n", irq, call_status); "returned %x\n", irq, call_status);
return; return;
} }
} }
static void xics_disable_real_irq(unsigned int irq) static void xics_disable_real_irq(unsigned int irq)
{ {
long call_status; int call_status;
unsigned int server; unsigned int server;
if (irq == XICS_IPI) if (irq == XICS_IPI)
...@@ -311,7 +311,7 @@ static void xics_disable_real_irq(unsigned int irq) ...@@ -311,7 +311,7 @@ static void xics_disable_real_irq(unsigned int irq)
call_status = rtas_call(ibm_int_off, 1, 1, NULL, irq); call_status = rtas_call(ibm_int_off, 1, 1, NULL, irq);
if (call_status != 0) { if (call_status != 0) {
printk(KERN_ERR "xics_disable_real_irq: irq=%x: " printk(KERN_ERR "xics_disable_real_irq: irq=%x: "
"ibm_int_off returned %lx\n", irq, call_status); "ibm_int_off returned %x\n", irq, call_status);
return; return;
} }
...@@ -320,7 +320,7 @@ static void xics_disable_real_irq(unsigned int irq) ...@@ -320,7 +320,7 @@ static void xics_disable_real_irq(unsigned int irq)
call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, 0xff); call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, 0xff);
if (call_status != 0) { if (call_status != 0) {
printk(KERN_ERR "xics_disable_irq: irq=%x: ibm_set_xive(0xff)" printk(KERN_ERR "xics_disable_irq: irq=%x: ibm_set_xive(0xff)"
" returned %lx\n", irq, call_status); " returned %x\n", irq, call_status);
return; return;
} }
} }
...@@ -612,8 +612,8 @@ void xics_request_IPIs(void) ...@@ -612,8 +612,8 @@ void xics_request_IPIs(void)
static void xics_set_affinity(unsigned int virq, cpumask_t cpumask) static void xics_set_affinity(unsigned int virq, cpumask_t cpumask)
{ {
unsigned int irq; unsigned int irq;
long status; int status;
unsigned long xics_status[2]; int xics_status[2];
unsigned long newmask; unsigned long newmask;
cpumask_t tmp = CPU_MASK_NONE; cpumask_t tmp = CPU_MASK_NONE;
...@@ -621,11 +621,11 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask) ...@@ -621,11 +621,11 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask)
if (irq == XICS_IPI || irq == NO_IRQ) if (irq == XICS_IPI || irq == NO_IRQ)
return; return;
status = rtas_call(ibm_get_xive, 1, 3, (void *)&xics_status, irq); status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq);
if (status) { if (status) {
printk(KERN_ERR "xics_set_affinity: irq=%d ibm,get-xive " printk(KERN_ERR "xics_set_affinity: irq=%d ibm,get-xive "
"returns %ld\n", irq, status); "returns %d\n", irq, status);
return; return;
} }
...@@ -644,7 +644,7 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask) ...@@ -644,7 +644,7 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask)
if (status) { if (status) {
printk(KERN_ERR "xics_set_affinity irq=%d ibm,set-xive " printk(KERN_ERR "xics_set_affinity irq=%d ibm,set-xive "
"returns %ld\n", irq, status); "returns %d\n", irq, status);
return; return;
} }
} }
...@@ -655,10 +655,10 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask) ...@@ -655,10 +655,10 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask)
void xics_migrate_irqs_away(void) void xics_migrate_irqs_away(void)
{ {
int set_indicator = rtas_token("set-indicator"); int set_indicator = rtas_token("set-indicator");
const unsigned long giqs = 9005UL; /* Global Interrupt Queue Server */ const unsigned int giqs = 9005UL; /* Global Interrupt Queue Server */
unsigned long status = 0; int status = 0;
unsigned int irq, cpu = smp_processor_id(); unsigned int irq, cpu = smp_processor_id();
unsigned long xics_status[2]; int xics_status[2];
unsigned long flags; unsigned long flags;
BUG_ON(set_indicator == RTAS_UNKNOWN_SERVICE); BUG_ON(set_indicator == RTAS_UNKNOWN_SERVICE);
...@@ -669,7 +669,7 @@ void xics_migrate_irqs_away(void) ...@@ -669,7 +669,7 @@ void xics_migrate_irqs_away(void)
/* Refuse any new interrupts... */ /* Refuse any new interrupts... */
rtas_call(set_indicator, 3, 1, &status, giqs, rtas_call(set_indicator, 3, 1, &status, giqs,
hard_smp_processor_id(), 0UL); hard_smp_processor_id(), 0);
WARN_ON(status != 0); WARN_ON(status != 0);
/* Allow IPIs again... */ /* Allow IPIs again... */
...@@ -692,11 +692,10 @@ void xics_migrate_irqs_away(void) ...@@ -692,11 +692,10 @@ void xics_migrate_irqs_away(void)
spin_lock_irqsave(&desc->lock, flags); spin_lock_irqsave(&desc->lock, flags);
status = rtas_call(ibm_get_xive, 1, 3, (void *)&xics_status, status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq);
irq);
if (status) { if (status) {
printk(KERN_ERR "migrate_irqs_away: irq=%d " printk(KERN_ERR "migrate_irqs_away: irq=%d "
"ibm,get-xive returns %ld\n", "ibm,get-xive returns %d\n",
irq, status); irq, status);
goto unlock; goto unlock;
} }
...@@ -719,7 +718,7 @@ void xics_migrate_irqs_away(void) ...@@ -719,7 +718,7 @@ void xics_migrate_irqs_away(void)
irq, xics_status[0], xics_status[1]); irq, xics_status[0], xics_status[1]);
if (status) if (status)
printk(KERN_ERR "migrate_irqs_away irq=%d " printk(KERN_ERR "migrate_irqs_away irq=%d "
"ibm,set-xive returns %ld\n", "ibm,set-xive returns %d\n",
irq, status); irq, status);
unlock: unlock:
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#define LONG_MSW(X) (((unsigned long)X) >> 32) #define LONG_MSW(X) (((unsigned long)X) >> 32)
typedef u32 phandle; typedef u32 phandle;
typedef void *ihandle; typedef u32 ihandle;
typedef u32 phandle32; typedef u32 phandle32;
typedef u32 ihandle32; typedef u32 ihandle32;
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* Where n_in is the number of input parameters and * Where n_in is the number of input parameters and
* n_out is the number of output parameters * n_out is the number of output parameters
* *
* If the "string" is invalid on this system, RTAS_UNKOWN_SERVICE * If the "string" is invalid on this system, RTAS_UNKNOWN_SERVICE
* will be returned as a token. rtas_call() does look for this * will be returned as a token. rtas_call() does look for this
* token and error out gracefully so rtas_call(rtas_token("str"), ...) * token and error out gracefully so rtas_call(rtas_token("str"), ...)
* may be safely used for one-shot calls to RTAS. * may be safely used for one-shot calls to RTAS.
...@@ -168,7 +168,7 @@ extern struct rtas_t rtas; ...@@ -168,7 +168,7 @@ extern struct rtas_t rtas;
extern void enter_rtas(unsigned long); extern void enter_rtas(unsigned long);
extern int rtas_token(const char *service); extern int rtas_token(const char *service);
extern long rtas_call(int token, int, int, unsigned long *, ...); extern int rtas_call(int token, int, int, int *, ...);
extern void call_rtas_display_status(char); extern void call_rtas_display_status(char);
extern void rtas_restart(char *cmd); extern void rtas_restart(char *cmd);
extern void rtas_power_off(void); extern void rtas_power_off(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment