Commit a4ec1eff authored by Ingo Molnar's avatar Ingo Molnar

x86: mach-voyager, lindent

lindent the mach-voyager files to get rid of more than 300 style errors:

                                       errors   lines of code   errors/KLOC
 arch/x86/mach-voyager/   [old]           409            3729         109.6
 arch/x86/mach-voyager/   [new]            71            3678          19.3
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 31183ba8
...@@ -59,44 +59,47 @@ void __init time_init_hook(void) ...@@ -59,44 +59,47 @@ void __init time_init_hook(void)
/* Hook for machine specific memory setup. */ /* Hook for machine specific memory setup. */
char * __init machine_specific_memory_setup(void) char *__init machine_specific_memory_setup(void)
{ {
char *who; char *who;
who = "NOT VOYAGER"; who = "NOT VOYAGER";
if(voyager_level == 5) { if (voyager_level == 5) {
__u32 addr, length; __u32 addr, length;
int i; int i;
who = "Voyager-SUS"; who = "Voyager-SUS";
e820.nr_map = 0; e820.nr_map = 0;
for(i=0; voyager_memory_detect(i, &addr, &length); i++) { for (i = 0; voyager_memory_detect(i, &addr, &length); i++) {
add_memory_region(addr, length, E820_RAM); add_memory_region(addr, length, E820_RAM);
} }
return who; return who;
} else if(voyager_level == 4) { } else if (voyager_level == 4) {
__u32 tom; __u32 tom;
__u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT)<<8; __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT) << 8;
/* select the DINO config space */ /* select the DINO config space */
outb(VOYAGER_DINO, VOYAGER_CAT_CONFIG_PORT); outb(VOYAGER_DINO, VOYAGER_CAT_CONFIG_PORT);
/* Read DINO top of memory register */ /* Read DINO top of memory register */
tom = ((inb(catbase + 0x4) & 0xf0) << 16) tom = ((inb(catbase + 0x4) & 0xf0) << 16)
+ ((inb(catbase + 0x5) & 0x7f) << 24); + ((inb(catbase + 0x5) & 0x7f) << 24);
if(inb(catbase) != VOYAGER_DINO) { if (inb(catbase) != VOYAGER_DINO) {
printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n"); printk(KERN_ERR
tom = (boot_params.screen_info.ext_mem_k)<<10; "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n");
tom = (boot_params.screen_info.ext_mem_k) << 10;
} }
who = "Voyager-TOM"; who = "Voyager-TOM";
add_memory_region(0, 0x9f000, E820_RAM); add_memory_region(0, 0x9f000, E820_RAM);
/* map from 1M to top of memory */ /* map from 1M to top of memory */
add_memory_region(1*1024*1024, tom - 1*1024*1024, E820_RAM); add_memory_region(1 * 1024 * 1024, tom - 1 * 1024 * 1024,
E820_RAM);
/* FIXME: Should check the ASICs to see if I need to /* FIXME: Should check the ASICs to see if I need to
* take out the 8M window. Just do it at the moment * take out the 8M window. Just do it at the moment
* */ * */
add_memory_region(8*1024*1024, 8*1024*1024, E820_RESERVED); add_memory_region(8 * 1024 * 1024, 8 * 1024 * 1024,
E820_RESERVED);
return who; return who;
} }
...@@ -114,8 +117,7 @@ char * __init machine_specific_memory_setup(void) ...@@ -114,8 +117,7 @@ char * __init machine_specific_memory_setup(void)
unsigned long mem_size; unsigned long mem_size;
/* compare results from other methods and take the greater */ /* compare results from other methods and take the greater */
if (boot_params.alt_mem_k if (boot_params.alt_mem_k < boot_params.screen_info.ext_mem_k) {
< boot_params.screen_info.ext_mem_k) {
mem_size = boot_params.screen_info.ext_mem_k; mem_size = boot_params.screen_info.ext_mem_k;
who = "BIOS-88"; who = "BIOS-88";
} else { } else {
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
/* /*
* Power off function, if any * Power off function, if any
*/ */
void (*pm_power_off)(void); void (*pm_power_off) (void);
EXPORT_SYMBOL(pm_power_off); EXPORT_SYMBOL(pm_power_off);
int voyager_level = 0; int voyager_level = 0;
...@@ -43,8 +43,7 @@ int voyager_level = 0; ...@@ -43,8 +43,7 @@ int voyager_level = 0;
struct voyager_SUS *voyager_SUS = NULL; struct voyager_SUS *voyager_SUS = NULL;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
static void static void voyager_dump(int dummy1, struct tty_struct *dummy3)
voyager_dump(int dummy1, struct tty_struct *dummy3)
{ {
/* get here via a sysrq */ /* get here via a sysrq */
voyager_smp_dump(); voyager_smp_dump();
...@@ -57,25 +56,25 @@ static struct sysrq_key_op sysrq_voyager_dump_op = { ...@@ -57,25 +56,25 @@ static struct sysrq_key_op sysrq_voyager_dump_op = {
}; };
#endif #endif
void void voyager_detect(struct voyager_bios_info *bios)
voyager_detect(struct voyager_bios_info *bios)
{ {
if(bios->len != 0xff) { if (bios->len != 0xff) {
int class = (bios->class_1 << 8) int class = (bios->class_1 << 8)
| (bios->class_2 & 0xff); | (bios->class_2 & 0xff);
printk("Voyager System detected.\n" printk("Voyager System detected.\n"
" Class %x, Revision %d.%d\n", " Class %x, Revision %d.%d\n",
class, bios->major, bios->minor); class, bios->major, bios->minor);
if(class == VOYAGER_LEVEL4) if (class == VOYAGER_LEVEL4)
voyager_level = 4; voyager_level = 4;
else if(class < VOYAGER_LEVEL5_AND_ABOVE) else if (class < VOYAGER_LEVEL5_AND_ABOVE)
voyager_level = 3; voyager_level = 3;
else else
voyager_level = 5; voyager_level = 5;
printk(" Architecture Level %d\n", voyager_level); printk(" Architecture Level %d\n", voyager_level);
if(voyager_level < 4) if (voyager_level < 4)
printk("\n**WARNING**: Voyager HAL only supports Levels 4 and 5 Architectures at the moment\n\n"); printk
("\n**WARNING**: Voyager HAL only supports Levels 4 and 5 Architectures at the moment\n\n");
/* install the power off handler */ /* install the power off handler */
pm_power_off = voyager_power_off; pm_power_off = voyager_power_off;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
...@@ -86,15 +85,13 @@ voyager_detect(struct voyager_bios_info *bios) ...@@ -86,15 +85,13 @@ voyager_detect(struct voyager_bios_info *bios)
} }
} }
void void voyager_system_interrupt(int cpl, void *dev_id)
voyager_system_interrupt(int cpl, void *dev_id)
{ {
printk("Voyager: detected system interrupt\n"); printk("Voyager: detected system interrupt\n");
} }
/* Routine to read information from the extended CMOS area */ /* Routine to read information from the extended CMOS area */
__u8 __u8 voyager_extended_cmos_read(__u16 addr)
voyager_extended_cmos_read(__u16 addr)
{ {
outb(addr & 0xff, 0x74); outb(addr & 0xff, 0x74);
outb((addr >> 8) & 0xff, 0x75); outb((addr >> 8) & 0xff, 0x75);
...@@ -113,7 +110,6 @@ typedef struct ClickMap { ...@@ -113,7 +110,6 @@ typedef struct ClickMap {
} Entry[CLICK_ENTRIES]; } Entry[CLICK_ENTRIES];
} ClickMap_t; } ClickMap_t;
/* This routine is pretty much an awful hack to read the bios clickmap by /* This routine is pretty much an awful hack to read the bios clickmap by
* mapping it into page 0. There are usually three regions in the map: * mapping it into page 0. There are usually three regions in the map:
* Base Memory * Base Memory
...@@ -122,8 +118,7 @@ typedef struct ClickMap { ...@@ -122,8 +118,7 @@ typedef struct ClickMap {
* *
* Returns are 0 for failure and 1 for success on extracting region. * Returns are 0 for failure and 1 for success on extracting region.
*/ */
int __init int __init voyager_memory_detect(int region, __u32 * start, __u32 * length)
voyager_memory_detect(int region, __u32 *start, __u32 *length)
{ {
int i; int i;
int retval = 0; int retval = 0;
...@@ -132,13 +127,14 @@ voyager_memory_detect(int region, __u32 *start, __u32 *length) ...@@ -132,13 +127,14 @@ voyager_memory_detect(int region, __u32 *start, __u32 *length)
unsigned long map_addr; unsigned long map_addr;
unsigned long old; unsigned long old;
if(region >= CLICK_ENTRIES) { if (region >= CLICK_ENTRIES) {
printk("Voyager: Illegal ClickMap region %d\n", region); printk("Voyager: Illegal ClickMap region %d\n", region);
return 0; return 0;
} }
for(i = 0; i < sizeof(cmos); i++) for (i = 0; i < sizeof(cmos); i++)
cmos[i] = voyager_extended_cmos_read(VOYAGER_MEMORY_CLICKMAP + i); cmos[i] =
voyager_extended_cmos_read(VOYAGER_MEMORY_CLICKMAP + i);
map_addr = *(unsigned long *)cmos; map_addr = *(unsigned long *)cmos;
...@@ -147,10 +143,10 @@ voyager_memory_detect(int region, __u32 *start, __u32 *length) ...@@ -147,10 +143,10 @@ voyager_memory_detect(int region, __u32 *start, __u32 *length)
pg0[0] = ((map_addr & PAGE_MASK) | _PAGE_RW | _PAGE_PRESENT); pg0[0] = ((map_addr & PAGE_MASK) | _PAGE_RW | _PAGE_PRESENT);
local_flush_tlb(); local_flush_tlb();
/* now clear everything out but page 0 */ /* now clear everything out but page 0 */
map = (ClickMap_t *)(map_addr & (~PAGE_MASK)); map = (ClickMap_t *) (map_addr & (~PAGE_MASK));
/* zero length is the end of the clickmap */ /* zero length is the end of the clickmap */
if(map->Entry[region].Length != 0) { if (map->Entry[region].Length != 0) {
*length = map->Entry[region].Length * CLICK_SIZE; *length = map->Entry[region].Length * CLICK_SIZE;
*start = map->Entry[region].Address; *start = map->Entry[region].Address;
retval = 1; retval = 1;
...@@ -165,10 +161,9 @@ voyager_memory_detect(int region, __u32 *start, __u32 *length) ...@@ -165,10 +161,9 @@ voyager_memory_detect(int region, __u32 *start, __u32 *length)
/* voyager specific handling code for timer interrupts. Used to hand /* voyager specific handling code for timer interrupts. Used to hand
* off the timer tick to the SMP code, since the VIC doesn't have an * off the timer tick to the SMP code, since the VIC doesn't have an
* internal timer (The QIC does, but that's another story). */ * internal timer (The QIC does, but that's another story). */
void void voyager_timer_interrupt(void)
voyager_timer_interrupt(void)
{ {
if((jiffies & 0x3ff) == 0) { if ((jiffies & 0x3ff) == 0) {
/* There seems to be something flaky in either /* There seems to be something flaky in either
* hardware or software that is resetting the timer 0 * hardware or software that is resetting the timer 0
...@@ -192,12 +187,14 @@ voyager_timer_interrupt(void) ...@@ -192,12 +187,14 @@ voyager_timer_interrupt(void)
val |= inb(0x40) << 8; val |= inb(0x40) << 8;
spin_unlock(&i8253_lock); spin_unlock(&i8253_lock);
if(val > LATCH) { if (val > LATCH) {
printk("\nVOYAGER: countdown timer value too high (%d), resetting\n\n", val); printk
("\nVOYAGER: countdown timer value too high (%d), resetting\n\n",
val);
spin_lock(&i8253_lock); spin_lock(&i8253_lock);
outb(0x34,0x43); outb(0x34, 0x43);
outb_p(LATCH & 0xff , 0x40); /* LSB */ outb_p(LATCH & 0xff, 0x40); /* LSB */
outb(LATCH >> 8 , 0x40); /* MSB */ outb(LATCH >> 8, 0x40); /* MSB */
spin_unlock(&i8253_lock); spin_unlock(&i8253_lock);
} }
} }
...@@ -206,14 +203,13 @@ voyager_timer_interrupt(void) ...@@ -206,14 +203,13 @@ voyager_timer_interrupt(void)
#endif #endif
} }
void void voyager_power_off(void)
voyager_power_off(void)
{ {
printk("VOYAGER Power Off\n"); printk("VOYAGER Power Off\n");
if(voyager_level == 5) { if (voyager_level == 5) {
voyager_cat_power_off(); voyager_cat_power_off();
} else if(voyager_level == 4) { } else if (voyager_level == 4) {
/* This doesn't apparently work on most L4 machines, /* This doesn't apparently work on most L4 machines,
* but the specs say to do this to get automatic power * but the specs say to do this to get automatic power
* off. Unfortunately, if it doesn't power off the * off. Unfortunately, if it doesn't power off the
...@@ -222,10 +218,8 @@ voyager_power_off(void) ...@@ -222,10 +218,8 @@ voyager_power_off(void)
#if 0 #if 0
int port; int port;
/* enable the voyager Configuration Space */ /* enable the voyager Configuration Space */
outb((inb(VOYAGER_MC_SETUP) & 0xf0) | 0x8, outb((inb(VOYAGER_MC_SETUP) & 0xf0) | 0x8, VOYAGER_MC_SETUP);
VOYAGER_MC_SETUP);
/* the port for the power off flag is an offset from the /* the port for the power off flag is an offset from the
floating base */ floating base */
port = (inb(VOYAGER_SSPB_RELOCATION_PORT) << 8) + 0x21; port = (inb(VOYAGER_SSPB_RELOCATION_PORT) << 8) + 0x21;
...@@ -235,62 +229,57 @@ voyager_power_off(void) ...@@ -235,62 +229,57 @@ voyager_power_off(void)
} }
/* and wait for it to happen */ /* and wait for it to happen */
local_irq_disable(); local_irq_disable();
for(;;) for (;;)
halt(); halt();
} }
/* copied from process.c */ /* copied from process.c */
static inline void static inline void kb_wait(void)
kb_wait(void)
{ {
int i; int i;
for (i=0; i<0x10000; i++) for (i = 0; i < 0x10000; i++)
if ((inb_p(0x64) & 0x02) == 0) if ((inb_p(0x64) & 0x02) == 0)
break; break;
} }
void void machine_shutdown(void)
machine_shutdown(void)
{ {
/* Architecture specific shutdown needed before a kexec */ /* Architecture specific shutdown needed before a kexec */
} }
void void machine_restart(char *cmd)
machine_restart(char *cmd)
{ {
printk("Voyager Warm Restart\n"); printk("Voyager Warm Restart\n");
kb_wait(); kb_wait();
if(voyager_level == 5) { if (voyager_level == 5) {
/* write magic values to the RTC to inform system that /* write magic values to the RTC to inform system that
* shutdown is beginning */ * shutdown is beginning */
outb(0x8f, 0x70); outb(0x8f, 0x70);
outb(0x5 , 0x71); outb(0x5, 0x71);
udelay(50); udelay(50);
outb(0xfe,0x64); /* pull reset low */ outb(0xfe, 0x64); /* pull reset low */
} else if(voyager_level == 4) { } else if (voyager_level == 4) {
__u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT)<<8; __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT) << 8;
__u8 basebd = inb(VOYAGER_MC_SETUP); __u8 basebd = inb(VOYAGER_MC_SETUP);
outb(basebd | 0x08, VOYAGER_MC_SETUP); outb(basebd | 0x08, VOYAGER_MC_SETUP);
outb(0x02, catbase + 0x21); outb(0x02, catbase + 0x21);
} }
local_irq_disable(); local_irq_disable();
for(;;) for (;;)
halt(); halt();
} }
void void machine_emergency_restart(void)
machine_emergency_restart(void)
{ {
/*for now, just hook this to a warm restart */ /*for now, just hook this to a warm restart */
machine_restart(NULL); machine_restart(NULL);
} }
void void mca_nmi_hook(void)
mca_nmi_hook(void)
{ {
__u8 dumpval __maybe_unused = inb(0xf823); __u8 dumpval __maybe_unused = inb(0xf823);
__u8 swnmi __maybe_unused = inb(0xf813); __u8 swnmi __maybe_unused = inb(0xf813);
...@@ -301,8 +290,8 @@ mca_nmi_hook(void) ...@@ -301,8 +290,8 @@ mca_nmi_hook(void)
/* clear swnmi */ /* clear swnmi */
outb(0xff, 0xf813); outb(0xff, 0xf813);
/* tell SUS to ignore dump */ /* tell SUS to ignore dump */
if(voyager_level == 5 && voyager_SUS != NULL) { if (voyager_level == 5 && voyager_SUS != NULL) {
if(voyager_SUS->SUS_mbox == VOYAGER_DUMP_BUTTON_NMI) { if (voyager_SUS->SUS_mbox == VOYAGER_DUMP_BUTTON_NMI) {
voyager_SUS->kernel_mbox = VOYAGER_NO_COMMAND; voyager_SUS->kernel_mbox = VOYAGER_NO_COMMAND;
voyager_SUS->kernel_flags |= VOYAGER_OS_IN_PROGRESS; voyager_SUS->kernel_flags |= VOYAGER_OS_IN_PROGRESS;
udelay(1000); udelay(1000);
...@@ -310,15 +299,14 @@ mca_nmi_hook(void) ...@@ -310,15 +299,14 @@ mca_nmi_hook(void)
voyager_SUS->kernel_flags &= ~VOYAGER_OS_IN_PROGRESS; voyager_SUS->kernel_flags &= ~VOYAGER_OS_IN_PROGRESS;
} }
} }
printk(KERN_ERR "VOYAGER: Dump switch pressed, printing CPU%d tracebacks\n", smp_processor_id()); printk(KERN_ERR
"VOYAGER: Dump switch pressed, printing CPU%d tracebacks\n",
smp_processor_id());
show_stack(NULL, NULL); show_stack(NULL, NULL);
show_state(); show_state();
} }
void machine_halt(void)
void
machine_halt(void)
{ {
/* treat a halt like a power off */ /* treat a halt like a power off */
machine_power_off(); machine_power_off();
......
This diff is collapsed.
This diff is collapsed.
...@@ -30,12 +30,10 @@ ...@@ -30,12 +30,10 @@
#include <asm/mtrr.h> #include <asm/mtrr.h>
#include <asm/msr.h> #include <asm/msr.h>
struct task_struct *voyager_thread; struct task_struct *voyager_thread;
static __u8 set_timeout; static __u8 set_timeout;
static int static int execute(const char *string)
execute(const char *string)
{ {
int ret; int ret;
...@@ -52,21 +50,21 @@ execute(const char *string) ...@@ -52,21 +50,21 @@ execute(const char *string)
NULL, NULL,
}; };
if ((ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC)) != 0) { if ((ret =
printk(KERN_ERR "Voyager failed to run \"%s\": %i\n", call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC)) != 0) {
string, ret); printk(KERN_ERR "Voyager failed to run \"%s\": %i\n", string,
ret);
} }
return ret; return ret;
} }
static void static void check_from_kernel(void)
check_from_kernel(void)
{ {
if(voyager_status.switch_off) { if (voyager_status.switch_off) {
/* FIXME: This should be configurable via proc */ /* FIXME: This should be configurable via proc */
execute("umask 600; echo 0 > /etc/initrunlvl; kill -HUP 1"); execute("umask 600; echo 0 > /etc/initrunlvl; kill -HUP 1");
} else if(voyager_status.power_fail) { } else if (voyager_status.power_fail) {
VDEBUG(("Voyager daemon detected AC power failure\n")); VDEBUG(("Voyager daemon detected AC power failure\n"));
/* FIXME: This should be configureable via proc */ /* FIXME: This should be configureable via proc */
...@@ -75,25 +73,25 @@ check_from_kernel(void) ...@@ -75,25 +73,25 @@ check_from_kernel(void)
} }
} }
static void static void check_continuing_condition(void)
check_continuing_condition(void)
{ {
if(voyager_status.power_fail) { if (voyager_status.power_fail) {
__u8 data; __u8 data;
voyager_cat_psi(VOYAGER_PSI_SUBREAD, voyager_cat_psi(VOYAGER_PSI_SUBREAD,
VOYAGER_PSI_AC_FAIL_REG, &data); VOYAGER_PSI_AC_FAIL_REG, &data);
if((data & 0x1f) == 0) { if ((data & 0x1f) == 0) {
/* all power restored */ /* all power restored */
printk(KERN_NOTICE "VOYAGER AC power restored, cancelling shutdown\n"); printk(KERN_NOTICE
"VOYAGER AC power restored, cancelling shutdown\n");
/* FIXME: should be user configureable */ /* FIXME: should be user configureable */
execute("umask 600; echo O > /etc/powerstatus; kill -PWR 1"); execute
("umask 600; echo O > /etc/powerstatus; kill -PWR 1");
set_timeout = 0; set_timeout = 0;
} }
} }
} }
static int static int thread(void *unused)
thread(void *unused)
{ {
printk(KERN_NOTICE "Voyager starting monitor thread\n"); printk(KERN_NOTICE "Voyager starting monitor thread\n");
...@@ -102,7 +100,7 @@ thread(void *unused) ...@@ -102,7 +100,7 @@ thread(void *unused)
schedule_timeout(set_timeout ? HZ : MAX_SCHEDULE_TIMEOUT); schedule_timeout(set_timeout ? HZ : MAX_SCHEDULE_TIMEOUT);
VDEBUG(("Voyager Daemon awoken\n")); VDEBUG(("Voyager Daemon awoken\n"));
if(voyager_status.request_from_kernel == 0) { if (voyager_status.request_from_kernel == 0) {
/* probably awoken from timeout */ /* probably awoken from timeout */
check_continuing_condition(); check_continuing_condition();
} else { } else {
...@@ -112,20 +110,18 @@ thread(void *unused) ...@@ -112,20 +110,18 @@ thread(void *unused)
} }
} }
static int __init static int __init voyager_thread_start(void)
voyager_thread_start(void)
{ {
voyager_thread = kthread_run(thread, NULL, "kvoyagerd"); voyager_thread = kthread_run(thread, NULL, "kvoyagerd");
if (IS_ERR(voyager_thread)) { if (IS_ERR(voyager_thread)) {
printk(KERN_ERR "Voyager: Failed to create system monitor thread.\n"); printk(KERN_ERR
"Voyager: Failed to create system monitor thread.\n");
return PTR_ERR(voyager_thread); return PTR_ERR(voyager_thread);
} }
return 0; return 0;
} }
static void __exit voyager_thread_stop(void)
static void __exit
voyager_thread_stop(void)
{ {
kthread_stop(voyager_thread); kthread_stop(voyager_thread);
} }
......
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