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: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Ingo Molnar
2008-01-30 13:30:10 +01:00
parent 31183ba8fd
commit a4ec1effce
5 changed files with 718 additions and 771 deletions

View File

@@ -86,17 +86,20 @@ char * __init machine_specific_memory_setup(void)
+ ((inb(catbase + 0x5) & 0x7f) << 24);
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
"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";
add_memory_region(0, 0x9f000, E820_RAM);
/* 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
* 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;
}
@@ -114,8 +117,7 @@ char * __init machine_specific_memory_setup(void)
unsigned long mem_size;
/* compare results from other methods and take the greater */
if (boot_params.alt_mem_k
< boot_params.screen_info.ext_mem_k) {
if (boot_params.alt_mem_k < boot_params.screen_info.ext_mem_k) {
mem_size = boot_params.screen_info.ext_mem_k;
who = "BIOS-88";
} else {

View File

@@ -43,8 +43,7 @@ int voyager_level = 0;
struct voyager_SUS *voyager_SUS = NULL;
#ifdef CONFIG_SMP
static void
voyager_dump(int dummy1, struct tty_struct *dummy3)
static void voyager_dump(int dummy1, struct tty_struct *dummy3)
{
/* get here via a sysrq */
voyager_smp_dump();
@@ -57,8 +56,7 @@ static struct sysrq_key_op sysrq_voyager_dump_op = {
};
#endif
void
voyager_detect(struct voyager_bios_info *bios)
void voyager_detect(struct voyager_bios_info *bios)
{
if (bios->len != 0xff) {
int class = (bios->class_1 << 8)
@@ -75,7 +73,8 @@ voyager_detect(struct voyager_bios_info *bios)
voyager_level = 5;
printk(" Architecture Level %d\n", voyager_level);
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 */
pm_power_off = voyager_power_off;
#ifdef CONFIG_SMP
@@ -86,15 +85,13 @@ voyager_detect(struct voyager_bios_info *bios)
}
}
void
voyager_system_interrupt(int cpl, void *dev_id)
void voyager_system_interrupt(int cpl, void *dev_id)
{
printk("Voyager: detected system interrupt\n");
}
/* Routine to read information from the extended CMOS area */
__u8
voyager_extended_cmos_read(__u16 addr)
__u8 voyager_extended_cmos_read(__u16 addr)
{
outb(addr & 0xff, 0x74);
outb((addr >> 8) & 0xff, 0x75);
@@ -113,7 +110,6 @@ typedef struct ClickMap {
} Entry[CLICK_ENTRIES];
} ClickMap_t;
/* 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:
* Base Memory
@@ -122,8 +118,7 @@ typedef struct ClickMap {
*
* Returns are 0 for failure and 1 for success on extracting region.
*/
int __init
voyager_memory_detect(int region, __u32 *start, __u32 *length)
int __init voyager_memory_detect(int region, __u32 * start, __u32 * length)
{
int i;
int retval = 0;
@@ -138,7 +133,8 @@ voyager_memory_detect(int region, __u32 *start, __u32 *length)
}
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;
@@ -165,8 +161,7 @@ voyager_memory_detect(int region, __u32 *start, __u32 *length)
/* 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
* internal timer (The QIC does, but that's another story). */
void
voyager_timer_interrupt(void)
void voyager_timer_interrupt(void)
{
if ((jiffies & 0x3ff) == 0) {
@@ -193,7 +188,9 @@ voyager_timer_interrupt(void)
spin_unlock(&i8253_lock);
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);
outb(0x34, 0x43);
outb_p(LATCH & 0xff, 0x40); /* LSB */
@@ -206,8 +203,7 @@ voyager_timer_interrupt(void)
#endif
}
void
voyager_power_off(void)
void voyager_power_off(void)
{
printk("VOYAGER Power Off\n");
@@ -222,10 +218,8 @@ voyager_power_off(void)
#if 0
int port;
/* enable the voyager Configuration Space */
outb((inb(VOYAGER_MC_SETUP) & 0xf0) | 0x8,
VOYAGER_MC_SETUP);
outb((inb(VOYAGER_MC_SETUP) & 0xf0) | 0x8, VOYAGER_MC_SETUP);
/* the port for the power off flag is an offset from the
floating base */
port = (inb(VOYAGER_SSPB_RELOCATION_PORT) << 8) + 0x21;
@@ -240,8 +234,7 @@ voyager_power_off(void)
}
/* copied from process.c */
static inline void
kb_wait(void)
static inline void kb_wait(void)
{
int i;
@@ -250,14 +243,12 @@ kb_wait(void)
break;
}
void
machine_shutdown(void)
void machine_shutdown(void)
{
/* Architecture specific shutdown needed before a kexec */
}
void
machine_restart(char *cmd)
void machine_restart(char *cmd)
{
printk("Voyager Warm Restart\n");
kb_wait();
@@ -282,15 +273,13 @@ machine_restart(char *cmd)
halt();
}
void
machine_emergency_restart(void)
void machine_emergency_restart(void)
{
/*for now, just hook this to a warm restart */
machine_restart(NULL);
}
void
mca_nmi_hook(void)
void mca_nmi_hook(void)
{
__u8 dumpval __maybe_unused = inb(0xf823);
__u8 swnmi __maybe_unused = inb(0xf813);
@@ -310,15 +299,14 @@ mca_nmi_hook(void)
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_state();
}
void
machine_halt(void)
void machine_halt(void)
{
/* treat a halt like a power off */
machine_power_off();

View File

@@ -39,8 +39,7 @@
#define CAT_DATA (sspb + 0xd)
/* the internal cat functions */
static void cat_pack(__u8 *msg, __u16 start_bit, __u8 *data,
__u16 num_bits);
static void cat_pack(__u8 * msg, __u16 start_bit, __u8 * data, __u16 num_bits);
static void cat_unpack(__u8 * msg, __u16 start_bit, __u8 * data,
__u16 num_bits);
static void cat_build_header(__u8 * header, const __u16 len,
@@ -63,8 +62,7 @@ static int cat_senddata(voyager_module_t *modp, voyager_asic_t *asicp,
static int cat_disconnect(voyager_module_t * modp, voyager_asic_t * asicp);
static int cat_connect(voyager_module_t * modp, voyager_asic_t * asicp);
static inline const char *
cat_module_name(int module_id)
static inline const char *cat_module_name(int module_id)
{
switch (module_id) {
case 0x10:
@@ -156,6 +154,7 @@ cat_pack(__u8 *msg, const __u16 start_bit, __u8 *data, const __u16 num_bits)
}
return;
}
/* unpack the data again (same arguments as cat_pack()). data buffer
* must be zero populated.
*
@@ -188,8 +187,7 @@ cat_unpack(__u8 *msg, const __u16 start_bit, __u8 *data, const __u16 num_bits)
if (offset != 0) {
data[i] = msg[byte++] << offset;
data[i] |= msg[byte] >> (BITS_PER_BYTE - offset);
}
else {
} else {
data[i] = msg[byte++];
}
}
@@ -241,7 +239,8 @@ cat_sendinst(voyager_module_t *modp, voyager_asic_t *asicp, __u8 reg, __u8 op)
outb(VOYAGER_CAT_IRCYC, CAT_CMD);
if (!modp->scan_path_connected) {
if (asicp->asic_id != VOYAGER_CAT_ID) {
printk("**WARNING***: cat_sendinst has disconnected scan path not to CAT asic\n");
printk
("**WARNING***: cat_sendinst has disconnected scan path not to CAT asic\n");
return 1;
}
outb(VOYAGER_CAT_HEADER, CAT_DATA);
@@ -303,12 +302,12 @@ cat_getdata(voyager_module_t *modp, voyager_asic_t *asicp, __u8 reg,
return 1;
}
return 0;
}
else {
} else {
__u16 sbits = modp->num_asics - 1 + asicp->ireg_length;
__u16 sbytes = sbits / BITS_PER_BYTE;
__u16 tbytes;
__u8 string[VOYAGER_MAX_SCAN_PATH], trailer[VOYAGER_MAX_REG_SIZE];
__u8 string[VOYAGER_MAX_SCAN_PATH],
trailer[VOYAGER_MAX_REG_SIZE];
__u8 padbits;
int i;
@@ -325,7 +324,6 @@ cat_getdata(voyager_module_t *modp, voyager_asic_t *asicp, __u8 reg,
tbytes, sbytes, padbits));
cat_build_header(trailer, tbytes, 1, asicp->ireg_length);
for (i = tbytes - 1; i >= 0; i--) {
outb(trailer[i], CAT_DATA);
string[sbytes + i] = inb(CAT_DATA);
@@ -336,7 +334,9 @@ cat_getdata(voyager_module_t *modp, voyager_asic_t *asicp, __u8 reg,
string[i] = inb(CAT_DATA);
}
*value = 0;
cat_unpack(string, padbits + (tbytes * BITS_PER_BYTE) + asicp->asic_location, value, asicp->ireg_length);
cat_unpack(string,
padbits + (tbytes * BITS_PER_BYTE) +
asicp->asic_location, value, asicp->ireg_length);
#ifdef VOYAGER_CAT_DEBUG
printk("value=0x%x, string: ", *value);
for (i = 0; i < tbytes + sbytes; i++)
@@ -348,7 +348,8 @@ cat_getdata(voyager_module_t *modp, voyager_asic_t *asicp, __u8 reg,
for (i = 0; i < tbytes; i++) {
__u8 input = 0;
cat_unpack(string, padbits + (i * BITS_PER_BYTE), &input, BITS_PER_BYTE);
cat_unpack(string, padbits + (i * BITS_PER_BYTE),
&input, BITS_PER_BYTE);
if (trailer[i] != input) {
CDEBUG(("cat_getdata: failed to sanity check rest of ret(%d) 0x%x != 0x%x\n", i, input, trailer[i]));
return 1;
@@ -407,10 +408,10 @@ cat_senddata(voyager_module_t *modp, voyager_asic_t *asicp,
}
return 0;
}
else {
} else {
__u16 hbytes = asicp->ireg_length / BITS_PER_BYTE;
__u16 dbytes = (modp->num_asics - 1 + asicp->ireg_length)/BITS_PER_BYTE;
__u16 dbytes =
(modp->num_asics - 1 + asicp->ireg_length) / BITS_PER_BYTE;
__u8 padbits, dseq[VOYAGER_MAX_SCAN_PATH],
hseq[VOYAGER_MAX_REG_SIZE];
int i;
@@ -445,8 +446,7 @@ cat_senddata(voyager_module_t *modp, voyager_asic_t *asicp,
}
static int
cat_write(voyager_module_t *modp, voyager_asic_t *asicp, __u8 reg,
__u8 value)
cat_write(voyager_module_t * modp, voyager_asic_t * asicp, __u8 reg, __u8 value)
{
if (cat_sendinst(modp, asicp, reg, VOYAGER_WRITE_CONFIG))
return 1;
@@ -476,7 +476,8 @@ cat_subaddrsetup(voyager_module_t *modp, voyager_asic_t *asicp, __u16 offset,
CDEBUG(("cat_subaddrsetup: read of VOYAGER_AUTO_INC_REG failed\n"));
return 1;
}
CDEBUG(("cat_subaddrsetup: VOYAGER_AUTO_INC_REG = 0x%x\n", val));
CDEBUG(("cat_subaddrsetup: VOYAGER_AUTO_INC_REG = 0x%x\n",
val));
newval = val | VOYAGER_AUTO_INC;
if (newval != val) {
if (cat_write(modp, asicp, VOYAGER_AUTO_INC_REG, val)) {
@@ -490,12 +491,14 @@ cat_subaddrsetup(voyager_module_t *modp, voyager_asic_t *asicp, __u16 offset,
return 1;
}
if (asicp->subaddr > VOYAGER_SUBADDR_LO) {
if(cat_write(modp, asicp, VOYAGER_SUBADDRHI, (__u8)(offset >> 8))) {
if (cat_write
(modp, asicp, VOYAGER_SUBADDRHI, (__u8) (offset >> 8))) {
CDEBUG(("cat_subaddrsetup: write to SUBADDRHI failed\n"));
return 1;
}
cat_read(modp, asicp, VOYAGER_SUBADDRHI, &val);
CDEBUG(("cat_subaddrsetup: offset = %d, hi = %d\n", offset, val));
CDEBUG(("cat_subaddrsetup: offset = %d, hi = %d\n", offset,
val));
}
cat_read(modp, asicp, VOYAGER_SUBADDRLO, &val);
CDEBUG(("cat_subaddrsetup: offset = %d, lo = %d\n", offset, val));
@@ -522,13 +525,16 @@ cat_subwrite(voyager_module_t *modp, voyager_asic_t *asicp, __u16 offset,
return retval;
}
if(cat_sendinst(modp, asicp, VOYAGER_SUBADDRDATA, VOYAGER_WRITE_CONFIG)) {
if (cat_sendinst
(modp, asicp, VOYAGER_SUBADDRDATA, VOYAGER_WRITE_CONFIG)) {
printk("cat_subwrite: cat_sendinst FAILED\n");
return 1;
}
for (i = 0; i < len; i++) {
if (cat_senddata(modp, asicp, 0xFF, ((__u8 *) buf)[i])) {
printk("cat_subwrite: cat_sendata element at %d FAILED\n", i);
printk
("cat_subwrite: cat_sendata element at %d FAILED\n",
i);
return 1;
}
}
@@ -550,16 +556,15 @@ cat_subread(voyager_module_t *modp, voyager_asic_t *asicp, __u16 offset,
return 1;
}
for (i = 0; i < len; i++) {
if(cat_getdata(modp, asicp, 0xFF,
&((__u8 *)buf)[i])) {
CDEBUG(("cat_subread: cat_getdata element %d failed\n", i));
if (cat_getdata(modp, asicp, 0xFF, &((__u8 *) buf)[i])) {
CDEBUG(("cat_subread: cat_getdata element %d failed\n",
i));
return 1;
}
}
return 0;
}
/* buffer for storing EPROM data read in during initialisation */
static __initdata __u8 eprom_buf[0xFFFF];
static voyager_module_t *voyager_initial_module;
@@ -568,8 +573,7 @@ static voyager_module_t *voyager_initial_module;
* boot cpu *after* all memory initialisation has been done (so we can
* use kmalloc) but before smp initialisation, so we can probe the SMP
* configuration and pick up necessary information. */
void __init
voyager_cat_init(void)
void __init voyager_cat_init(void)
{
voyager_module_t **modpp = &voyager_initial_module;
voyager_asic_t **asicpp;
@@ -588,7 +592,9 @@ voyager_cat_init(void)
cmos[i] = voyager_extended_cmos_read(VOYAGER_DUMP_LOCATION + i);
addr = *(unsigned long *)cmos;
if ((addr & 0xff000000) != 0xff000000) {
printk(KERN_ERR "Voyager failed to get SUS mailbox (addr = 0x%lx\n", addr);
printk(KERN_ERR
"Voyager failed to get SUS mailbox (addr = 0x%lx\n",
addr);
} else {
static struct resource res;
@@ -609,8 +615,6 @@ voyager_cat_init(void)
voyager_extended_vic_processors = 0;
voyager_quad_processors = 0;
printk("VOYAGER: beginning CAT bus probe\n");
/* set up the SuperSet Port Block which tells us where the
* CAT communication port is */
@@ -621,11 +625,11 @@ voyager_cat_init(void)
if ((inb(VIC_PROC_WHO_AM_I) & EIGHT_SLOT_IDENTIFIER)
== EIGHT_SLOT_IDENTIFIER) {
voyager_8slot = 1;
printk(KERN_NOTICE "Voyager: Eight slot 51xx configuration detected\n");
printk(KERN_NOTICE
"Voyager: Eight slot 51xx configuration detected\n");
}
for(i = VOYAGER_MIN_MODULE;
i <= VOYAGER_MAX_MODULE; i++) {
for (i = VOYAGER_MIN_MODULE; i <= VOYAGER_MAX_MODULE; i++) {
__u8 input;
int asic;
__u16 eprom_size;
@@ -678,20 +682,25 @@ voyager_cat_init(void)
if (cat_subread(*modpp, (*modpp)->asic,
VOYAGER_XSUM_END_OFFSET, sizeof(eprom_size),
&eprom_size)) {
printk("**WARNING**: Voyager couldn't read EPROM size for module 0x%x\n", i);
printk
("**WARNING**: Voyager couldn't read EPROM size for module 0x%x\n",
i);
outb(VOYAGER_CAT_END, CAT_CMD);
continue;
}
if (eprom_size > sizeof(eprom_buf)) {
printk("**WARNING**: Voyager insufficient size to read EPROM data, module 0x%x. Need %d\n", i, eprom_size);
printk
("**WARNING**: Voyager insufficient size to read EPROM data, module 0x%x. Need %d\n",
i, eprom_size);
outb(VOYAGER_CAT_END, CAT_CMD);
continue;
}
outb(VOYAGER_CAT_END, CAT_CMD);
outb(VOYAGER_CAT_RUN, CAT_CMD);
CDEBUG(("cat_init: module 0x%x, eeprom_size %d\n", i, eprom_size));
if(cat_subread(*modpp, (*modpp)->asic, 0,
eprom_size, eprom_buf)) {
CDEBUG(("cat_init: module 0x%x, eeprom_size %d\n", i,
eprom_size));
if (cat_subread
(*modpp, (*modpp)->asic, 0, eprom_size, eprom_buf)) {
outb(VOYAGER_CAT_END, CAT_CMD);
continue;
}
@@ -717,7 +726,8 @@ voyager_cat_init(void)
&num_submodules);
/* lowest two bits, active low */
num_submodules = ~(0xfc | num_submodules);
CDEBUG(("VOYAGER CAT: %d submodules present\n", num_submodules));
CDEBUG(("VOYAGER CAT: %d submodules present\n",
num_submodules));
if (num_submodules == 0) {
/* fill in the dyadic extended processors */
__u8 cpu = i & 0x07;
@@ -741,27 +751,31 @@ voyager_cat_init(void)
outb(VOYAGER_CAT_END, CAT_CMD);
CDEBUG(("cat_init: Reading eeprom for module 0x%x at offset %d\n", i, VOYAGER_XSUM_END_OFFSET));
outb(VOYAGER_CAT_RUN, CAT_CMD);
cat_disconnect(*modpp, (*modpp)->asic);
if (cat_subread(*modpp, (*modpp)->asic,
VOYAGER_XSUM_END_OFFSET, sizeof(eprom_size),
&eprom_size)) {
printk("**WARNING**: Voyager couldn't read EPROM size for module 0x%x\n", i);
printk
("**WARNING**: Voyager couldn't read EPROM size for module 0x%x\n",
i);
outb(VOYAGER_CAT_END, CAT_CMD);
continue;
}
if (eprom_size > sizeof(eprom_buf)) {
printk("**WARNING**: Voyager insufficient size to read EPROM data, module 0x%x. Need %d\n", i, eprom_size);
printk
("**WARNING**: Voyager insufficient size to read EPROM data, module 0x%x. Need %d\n",
i, eprom_size);
outb(VOYAGER_CAT_END, CAT_CMD);
continue;
}
outb(VOYAGER_CAT_END, CAT_CMD);
outb(VOYAGER_CAT_RUN, CAT_CMD);
CDEBUG(("cat_init: module 0x%x, eeprom_size %d\n", i, eprom_size));
if(cat_subread(*modpp, (*modpp)->asic, 0,
eprom_size, eprom_buf)) {
CDEBUG(("cat_init: module 0x%x, eeprom_size %d\n", i,
eprom_size));
if (cat_subread
(*modpp, (*modpp)->asic, 0, eprom_size, eprom_buf)) {
outb(VOYAGER_CAT_END, CAT_CMD);
continue;
}
@@ -775,24 +789,29 @@ voyager_cat_init(void)
kfree((*modpp)->asic);
for (asic = 0; asic < (*modpp)->num_asics; asic++) {
int j;
voyager_asic_t *asicp = *asicpp
= kzalloc(sizeof(voyager_asic_t), GFP_KERNEL); /*&voyager_asic_storage[asic_count++];*/
voyager_asic_t *asicp = *asicpp = kzalloc(sizeof(voyager_asic_t), GFP_KERNEL); /*&voyager_asic_storage[asic_count++]; */
voyager_sp_table_t *sp_table;
voyager_at_t *asic_table;
voyager_jtt_t *jtag_table;
if (asicp == NULL) {
printk("**WARNING** kmalloc failure in cat_init\n");
printk
("**WARNING** kmalloc failure in cat_init\n");
continue;
}
asicpp = &(asicp->next);
asicp->asic_location = asic;
sp_table = (voyager_sp_table_t *)(eprom_buf + sp_offset);
sp_table =
(voyager_sp_table_t *) (eprom_buf + sp_offset);
asicp->asic_id = sp_table->asic_id;
asic_table = (voyager_at_t *)(eprom_buf + sp_table->asic_data_offset);
asic_table =
(voyager_at_t *) (eprom_buf +
sp_table->asic_data_offset);
for (j = 0; j < 4; j++)
asicp->jtag_id[j] = asic_table->jtag_id[j];
jtag_table = (voyager_jtt_t *)(eprom_buf + asic_table->jtag_offset);
jtag_table =
(voyager_jtt_t *) (eprom_buf +
asic_table->jtag_offset);
asicp->ireg_length = jtag_table->ireg_len;
asicp->bit_location = (*modpp)->inst_bits;
(*modpp)->inst_bits += asicp->ireg_length;
@@ -810,9 +829,7 @@ voyager_cat_init(void)
}
sp_offset += sizeof(voyager_sp_table_t);
}
CDEBUG(("Module inst_bits = %d, largest_reg = %d, smallest_reg=%d\n",
(*modpp)->inst_bits, (*modpp)->largest_reg,
(*modpp)->smallest_reg));
CDEBUG(("Module inst_bits = %d, largest_reg = %d, smallest_reg=%d\n", (*modpp)->inst_bits, (*modpp)->largest_reg, (*modpp)->smallest_reg));
/* OK, now we have the QUAD ASICs set up, use them.
* we need to:
*
@@ -828,7 +845,8 @@ voyager_cat_init(void)
qic_addr = qabc_data[5] << 8;
qic_addr = (qic_addr | qabc_data[6]) << 8;
qic_addr = (qic_addr | qabc_data[7]) << 8;
printk("Module \"%s\": Quad Processor Card; CPI 0x%lx, SET=0x%x\n",
printk
("Module \"%s\": Quad Processor Card; CPI 0x%lx, SET=0x%x\n",
cat_module_name(i), qic_addr, qabc_data[8]);
#if 0 /* plumbing fails---FIXME */
if ((qabc_data[8] & 0xf0) == 0) {
@@ -843,16 +861,19 @@ voyager_cat_init(void)
/* verify plumbing */
cat_subread(*modpp, qabc_asic, 8, 1, &qabc_data[8]);
if ((qabc_data[8] & 0xf0) == 0) {
CDEBUG(("PLUMBING FAILED: 0x%x\n", qabc_data[8]));
CDEBUG(("PLUMBING FAILED: 0x%x\n",
qabc_data[8]));
}
#endif
}
#endif
{
struct resource *res = kzalloc(sizeof(struct resource),GFP_KERNEL);
struct resource *res =
kzalloc(sizeof(struct resource), GFP_KERNEL);
res->name = kmalloc(128, GFP_KERNEL);
sprintf((char *)res->name, "Voyager %s Quad CPI", cat_module_name(i));
sprintf((char *)res->name, "Voyager %s Quad CPI",
cat_module_name(i));
res->start = qic_addr;
res->end = qic_addr + 0x3ff;
request_resource(&iomem_resource, res);
@@ -880,7 +901,8 @@ voyager_cat_init(void)
* Secondary cannot be booted as a VIC
* CPU */
voyager_extended_vic_processors |= (1 << cpu);
voyager_allowed_boot_processors &= (~(1<<cpu));
voyager_allowed_boot_processors &=
(~(1 << cpu));
}
voyager_quad_processors |= (1 << cpu);
@@ -891,27 +913,26 @@ voyager_cat_init(void)
}
outb(VOYAGER_CAT_END, CAT_CMD);
*asicpp = NULL;
modpp = &((*modpp)->next);
}
*modpp = NULL;
printk("CAT Bus Initialisation finished: extended procs 0x%x, quad procs 0x%x, allowed vic boot = 0x%x\n", voyager_extended_vic_processors, voyager_quad_processors, voyager_allowed_boot_processors);
printk
("CAT Bus Initialisation finished: extended procs 0x%x, quad procs 0x%x, allowed vic boot = 0x%x\n",
voyager_extended_vic_processors, voyager_quad_processors,
voyager_allowed_boot_processors);
request_resource(&ioport_resource, &vic_res);
if (voyager_quad_processors)
request_resource(&ioport_resource, &qic_res);
/* set up the front power switch */
}
int
voyager_cat_readb(__u8 module, __u8 asic, int reg)
int voyager_cat_readb(__u8 module, __u8 asic, int reg)
{
return 0;
}
static int
cat_disconnect(voyager_module_t *modp, voyager_asic_t *asicp)
static int cat_disconnect(voyager_module_t * modp, voyager_asic_t * asicp)
{
__u8 val;
int err = 0;
@@ -940,8 +961,7 @@ cat_disconnect(voyager_module_t *modp, voyager_asic_t *asicp)
return 0;
}
static int
cat_connect(voyager_module_t *modp, voyager_asic_t *asicp)
static int cat_connect(voyager_module_t * modp, voyager_asic_t * asicp)
{
__u8 val;
int err = 0;
@@ -971,8 +991,7 @@ cat_connect(voyager_module_t *modp, voyager_asic_t *asicp)
return 0;
}
void
voyager_cat_power_off(void)
void voyager_cat_power_off(void)
{
/* Power the machine off by writing to the PSI over the CAT
* bus */
@@ -1009,8 +1028,7 @@ voyager_cat_power_off(void)
struct voyager_status voyager_status = { 0 };
void
voyager_cat_psi(__u8 cmd, __u16 reg, __u8 *data)
void voyager_cat_psi(__u8 cmd, __u16 reg, __u8 * data)
{
voyager_module_t psi = { 0 };
voyager_asic_t psi_asic = { 0 };
@@ -1047,8 +1065,7 @@ voyager_cat_psi(__u8 cmd, __u16 reg, __u8 *data)
outb(VOYAGER_CAT_END, CAT_CMD);
}
void
voyager_cat_do_common_interrupt(void)
void voyager_cat_do_common_interrupt(void)
{
/* This is caused either by a memory parity error or something
* in the PSI */
@@ -1104,11 +1121,13 @@ voyager_cat_do_common_interrupt(void)
if (psi_reg.subregs.supply & PSI_SWITCH_OFF) {
if (voyager_status.switch_off) {
printk(KERN_ERR "Voyager front panel switch turned off again---Immediate power off!\n");
printk(KERN_ERR
"Voyager front panel switch turned off again---Immediate power off!\n");
voyager_cat_power_off();
/* not reached */
} else {
printk(KERN_ERR "Voyager front panel switch turned off\n");
printk(KERN_ERR
"Voyager front panel switch turned off\n");
voyager_status.switch_off = 1;
voyager_status.request_from_kernel = 1;
wake_up_process(voyager_thread);
@@ -1160,10 +1179,10 @@ voyager_cat_do_common_interrupt(void)
wake_up_process(voyager_thread);
}
} else if (psi_reg.regs.intstatus & PSI_FAULT) {
/* Major fault! */
printk(KERN_ERR "Voyager PSI Detected major fault, immediate power off!\n");
printk(KERN_ERR
"Voyager PSI Detected major fault, immediate power off!\n");
voyager_cat_power_off();
/* not reached */
} else if (psi_reg.regs.intstatus & (PSI_DC_FAIL | PSI_ALARM

View File

@@ -32,7 +32,8 @@
DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate) = { &init_mm, 0 };
/* CPU IRQ affinity -- set to all ones initially */
static unsigned long cpu_irq_affinity[NR_CPUS] __cacheline_aligned = { [0 ... NR_CPUS-1] = ~0UL };
static unsigned long cpu_irq_affinity[NR_CPUS] __cacheline_aligned =
{[0 ... NR_CPUS-1] = ~0UL };
/* per CPU data structure (for /proc/cpuinfo et al), visible externally
* indexed physically */
@@ -76,7 +77,6 @@ EXPORT_SYMBOL(cpu_online_map);
* by scheduler but indexed physically */
cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
/* The internal functions */
static void send_CPI(__u32 cpuset, __u8 cpi);
static void ack_CPI(__u8 cpi);
@@ -101,15 +101,13 @@ int hard_smp_processor_id(void);
int safe_smp_processor_id(void);
/* Inline functions */
static inline void
send_one_QIC_CPI(__u8 cpu, __u8 cpi)
static inline void send_one_QIC_CPI(__u8 cpu, __u8 cpi)
{
voyager_quad_cpi_addr[cpu]->qic_cpi[cpi].cpi =
(smp_processor_id() << 16) + cpi;
}
static inline void
send_QIC_CPI(__u32 cpuset, __u8 cpi)
static inline void send_QIC_CPI(__u32 cpuset, __u8 cpi)
{
int cpu;
@@ -117,23 +115,23 @@ send_QIC_CPI(__u32 cpuset, __u8 cpi)
if (cpuset & (1 << cpu)) {
#ifdef VOYAGER_DEBUG
if (!cpu_isset(cpu, cpu_online_map))
VDEBUG(("CPU%d sending cpi %d to CPU%d not in cpu_online_map\n", hard_smp_processor_id(), cpi, cpu));
VDEBUG(("CPU%d sending cpi %d to CPU%d not in "
"cpu_online_map\n",
hard_smp_processor_id(), cpi, cpu));
#endif
send_one_QIC_CPI(cpu, cpi - QIC_CPI_OFFSET);
}
}
}
static inline void
wrapper_smp_local_timer_interrupt(void)
static inline void wrapper_smp_local_timer_interrupt(void)
{
irq_enter();
smp_local_timer_interrupt();
irq_exit();
}
static inline void
send_one_CPI(__u8 cpu, __u8 cpi)
static inline void send_one_CPI(__u8 cpu, __u8 cpi)
{
if (voyager_quad_processors & (1 << cpu))
send_one_QIC_CPI(cpu, cpi - QIC_CPI_OFFSET);
@@ -141,31 +139,27 @@ send_one_CPI(__u8 cpu, __u8 cpi)
send_CPI(1 << cpu, cpi);
}
static inline void
send_CPI_allbutself(__u8 cpi)
static inline void send_CPI_allbutself(__u8 cpi)
{
__u8 cpu = smp_processor_id();
__u32 mask = cpus_addr(cpu_online_map)[0] & ~(1 << cpu);
send_CPI(mask, cpi);
}
static inline int
is_cpu_quad(void)
static inline int is_cpu_quad(void)
{
__u8 cpumask = inb(VIC_PROC_WHO_AM_I);
return ((cpumask & QUAD_IDENTIFIER) == QUAD_IDENTIFIER);
}
static inline int
is_cpu_extended(void)
static inline int is_cpu_extended(void)
{
__u8 cpu = hard_smp_processor_id();
return (voyager_extended_vic_processors & (1 << cpu));
}
static inline int
is_cpu_vic_boot(void)
static inline int is_cpu_vic_boot(void)
{
__u8 cpu = hard_smp_processor_id();
@@ -173,9 +167,7 @@ is_cpu_vic_boot(void)
& voyager_allowed_boot_processors & (1 << cpu));
}
static inline void
ack_CPI(__u8 cpi)
static inline void ack_CPI(__u8 cpi)
{
switch (cpi) {
case VIC_CPU_BOOT_CPI:
@@ -262,8 +254,7 @@ static unsigned long vic_tick[NR_CPUS] __cacheline_aligned = { 0 };
static unsigned long vic_cpi_mailbox[NR_CPUS] __cacheline_aligned;
/* debugging routine to read the isr of the cpu's pic */
static inline __u16
vic_read_isr(void)
static inline __u16 vic_read_isr(void)
{
__u16 isr;
@@ -275,8 +266,7 @@ vic_read_isr(void)
return isr;
}
static __init void
qic_setup(void)
static __init void qic_setup(void)
{
if (!is_cpu_quad()) {
/* not a quad, no setup */
@@ -295,8 +285,7 @@ qic_setup(void)
}
}
static __init void
vic_setup_pic(void)
static __init void vic_setup_pic(void)
{
outb(1, VIC_REDIRECT_REGISTER_1);
/* clear the claim registers for dynamic routing */
@@ -341,8 +330,7 @@ vic_setup_pic(void)
outb(0x01, 0xA1);
}
static void
do_quad_bootstrap(void)
static void do_quad_bootstrap(void)
{
if (is_cpu_quad() && is_cpu_vic_boot()) {
int i;
@@ -368,12 +356,10 @@ do_quad_bootstrap(void)
}
}
/* Set up all the basic stuff: read the SMP config and make all the
* SMP information reflect only the boot cpu. All others will be
* brought on-line later. */
void __init
find_smp_config(void)
void __init find_smp_config(void)
{
int i;
@@ -394,12 +380,19 @@ find_smp_config(void)
/* set up everything for just this CPU, we can alter
* this as we start the other CPUs later */
/* now get the CPU disposition from the extended CMOS */
cpus_addr(phys_cpu_present_map)[0] = voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK);
cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8;
cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 2) << 16;
cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 3) << 24;
cpus_addr(phys_cpu_present_map)[0] =
voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK);
cpus_addr(phys_cpu_present_map)[0] |=
voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8;
cpus_addr(phys_cpu_present_map)[0] |=
voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK +
2) << 16;
cpus_addr(phys_cpu_present_map)[0] |=
voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK +
3) << 24;
cpu_possible_map = phys_cpu_present_map;
printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n", cpus_addr(phys_cpu_present_map)[0]);
printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n",
cpus_addr(phys_cpu_present_map)[0]);
/* Here we set up the VIC to enable SMP */
/* enable the CPIs by writing the base vector to their register */
outb(VIC_DEFAULT_CPI_BASE, VIC_CPI_BASE_REGISTER);
@@ -427,8 +420,7 @@ find_smp_config(void)
/*
* The bootstrap kernel entry code has set these up. Save them
* for a given CPU, id is physical */
void __init
smp_store_cpu_info(int id)
void __init smp_store_cpu_info(int id)
{
struct cpuinfo_x86 *c = &cpu_data(id);
@@ -438,8 +430,7 @@ smp_store_cpu_info(int id)
}
/* set up the trampoline and return the physical address of the code */
static __u32 __init
setup_trampoline(void)
static __u32 __init setup_trampoline(void)
{
/* these two are global symbols in trampoline.S */
extern const __u8 trampoline_end[];
@@ -451,8 +442,7 @@ setup_trampoline(void)
}
/* Routine initially called when a non-boot CPU is brought online */
static void __init
start_secondary(void *unused)
static void __init start_secondary(void *unused)
{
__u8 cpuid = hard_smp_processor_id();
/* external functions not defined in the headers */
@@ -474,7 +464,8 @@ start_secondary(void *unused)
/* clear the boot CPI */
__u8 dummy;
dummy = voyager_quad_cpi_addr[cpuid]->qic_cpi[VIC_CPU_BOOT_CPI].cpi;
dummy =
voyager_quad_cpi_addr[cpuid]->qic_cpi[VIC_CPU_BOOT_CPI].cpi;
printk("read dummy %d\n", dummy);
}
@@ -516,7 +507,6 @@ start_secondary(void *unused)
cpu_idle();
}
/* Routine to kick start the given CPU and wait for it to report ready
* (or timeout in startup). When this routine returns, the requested
* CPU is either fully running and configured or known to be dead.
@@ -524,8 +514,7 @@ start_secondary(void *unused)
* We call this routine sequentially 1 CPU at a time, so no need for
* locking */
static void __init
do_boot_cpu(__u8 cpu)
static void __init do_boot_cpu(__u8 cpu)
{
struct task_struct *idle;
int timeout;
@@ -588,14 +577,21 @@ do_boot_cpu(__u8 cpu)
if (quad_boot) {
printk("CPU %d: non extended Quad boot\n", cpu);
hijack_vector = (__u32 *)phys_to_virt((VIC_CPU_BOOT_CPI + QIC_DEFAULT_CPI_BASE)*4);
hijack_vector =
(__u32 *)
phys_to_virt((VIC_CPU_BOOT_CPI + QIC_DEFAULT_CPI_BASE) * 4);
*hijack_vector = hijack_source.val;
} else {
printk("CPU%d: extended VIC boot\n", cpu);
hijack_vector = (__u32 *)phys_to_virt((VIC_CPU_BOOT_CPI + VIC_DEFAULT_CPI_BASE)*4);
hijack_vector =
(__u32 *)
phys_to_virt((VIC_CPU_BOOT_CPI + VIC_DEFAULT_CPI_BASE) * 4);
*hijack_vector = hijack_source.val;
/* VIC errata, may also receive interrupt at this address */
hijack_vector = (__u32 *)phys_to_virt((VIC_CPU_BOOT_ERRATA_CPI + VIC_DEFAULT_CPI_BASE)*4);
hijack_vector =
(__u32 *)
phys_to_virt((VIC_CPU_BOOT_ERRATA_CPI +
VIC_DEFAULT_CPI_BASE) * 4);
*hijack_vector = hijack_source.val;
}
/* All non-boot CPUs start with interrupts fully masked. Need
@@ -638,10 +634,11 @@ do_boot_cpu(__u8 cpu)
wmb();
cpu_set(cpu, cpu_callout_map);
cpu_set(cpu, cpu_present_map);
}
else {
} else {
printk("CPU%d FAILED TO BOOT: ", cpu);
if (*((volatile unsigned char *)phys_to_virt(start_phys_address))==0xA5)
if (*
((volatile unsigned char *)phys_to_virt(start_phys_address))
== 0xA5)
printk("Stuck.\n");
else
printk("Not responding.\n");
@@ -650,8 +647,7 @@ do_boot_cpu(__u8 cpu)
}
}
void __init
smp_boot_cpus(void)
void __init smp_boot_cpus(void)
{
int i;
@@ -664,12 +660,15 @@ smp_boot_cpus(void)
/* now that the cat has probed the Voyager System Bus, sanity
* check the cpu map */
if (((voyager_quad_processors | voyager_extended_vic_processors)
& cpus_addr(phys_cpu_present_map)[0]) != cpus_addr(phys_cpu_present_map)[0]) {
& cpus_addr(phys_cpu_present_map)[0]) !=
cpus_addr(phys_cpu_present_map)[0]) {
/* should panic */
printk("\n\n***WARNING*** Sanity check of CPU present map FAILED\n");
printk("\n\n***WARNING*** "
"Sanity check of CPU present map FAILED\n");
}
} else if (voyager_level == 4)
voyager_extended_vic_processors = cpus_addr(phys_cpu_present_map)[0];
voyager_extended_vic_processors =
cpus_addr(phys_cpu_present_map)[0];
/* this sets up the idle task to run on the current cpu */
voyager_extended_cpus = 1;
@@ -715,13 +714,15 @@ smp_boot_cpus(void)
for (i = 0; i < NR_CPUS; i++)
if (cpu_isset(i, cpu_online_map))
bogosum += cpu_data(i).loops_per_jiffy;
printk(KERN_INFO "Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
cpucount+1,
bogosum/(500000/HZ),
printk(KERN_INFO "Total of %d processors activated "
"(%lu.%02lu BogoMIPS).\n",
cpucount + 1, bogosum / (500000 / HZ),
(bogosum / (5000 / HZ)) % 100);
}
voyager_extended_cpus = hweight32(voyager_extended_vic_processors);
printk("VOYAGER: Extended (interrupt handling CPUs): %d, non-extended: %d\n", voyager_extended_cpus, num_booting_cpus() - voyager_extended_cpus);
printk("VOYAGER: Extended (interrupt handling CPUs): "
"%d, non-extended: %d\n", voyager_extended_cpus,
num_booting_cpus() - voyager_extended_cpus);
/* that's it, switch to symmetric mode */
outb(0, VIC_PRIORITY_REGISTER);
outb(0, VIC_CLAIM_REGISTER_0);
@@ -732,8 +733,7 @@ smp_boot_cpus(void)
/* Reload the secondary CPUs task structure (this function does not
* return ) */
void __init
initialize_secondary(void)
void __init initialize_secondary(void)
{
#if 0
// AC kernels only
@@ -745,11 +745,9 @@ initialize_secondary(void)
* basically just the stack pointer and the eip.
*/
asm volatile(
"movl %0,%%esp\n\t"
"jmp *%1"
:
:"r" (current->thread.esp),"r" (current->thread.eip));
asm volatile ("movl %0,%%esp\n\t"
"jmp *%1"::"r" (current->thread.esp),
"r"(current->thread.eip));
}
/* handle a Voyager SYS_INT -- If we don't, the base board will
@@ -758,8 +756,7 @@ initialize_secondary(void)
* System interrupts occur because some problem was detected on the
* various busses. To find out what you have to probe all the
* hardware via the CAT bus. FIXME: At the moment we do nothing. */
fastcall void
smp_vic_sys_interrupt(struct pt_regs *regs)
fastcall void smp_vic_sys_interrupt(struct pt_regs *regs)
{
ack_CPI(VIC_SYS_INT);
printk("Voyager SYSTEM INTERRUPT\n");
@@ -768,8 +765,7 @@ smp_vic_sys_interrupt(struct pt_regs *regs)
/* Handle a voyager CMN_INT; These interrupts occur either because of
* a system status change or because a single bit memory error
* occurred. FIXME: At the moment, ignore all this. */
fastcall void
smp_vic_cmn_interrupt(struct pt_regs *regs)
fastcall void smp_vic_cmn_interrupt(struct pt_regs *regs)
{
static __u8 in_cmn_int = 0;
static DEFINE_SPINLOCK(cmn_int_lock);
@@ -797,8 +793,7 @@ smp_vic_cmn_interrupt(struct pt_regs *regs)
/*
* Reschedule call back. Nothing to do, all the work is done
* automatically when we return from the interrupt. */
static void
smp_reschedule_interrupt(void)
static void smp_reschedule_interrupt(void)
{
/* do nothing */
}
@@ -815,8 +810,7 @@ static DEFINE_SPINLOCK(tlbstate_lock);
* We need to reload %cr3 since the page tables may be going
* away from under us..
*/
static inline void
leave_mm (unsigned long cpu)
static inline void leave_mm(unsigned long cpu)
{
if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK)
BUG();
@@ -824,12 +818,10 @@ leave_mm (unsigned long cpu)
load_cr3(swapper_pg_dir);
}
/*
* Invalidate call-back
*/
static void
smp_invalidate_interrupt(void)
static void smp_invalidate_interrupt(void)
{
__u8 cpu = smp_processor_id();
@@ -857,7 +849,6 @@ smp_invalidate_interrupt(void)
/* All the new flush operations for 2.4 */
/* This routine is called with a physical cpu mask */
static void
voyager_flush_tlb_others(unsigned long cpumask, struct mm_struct *mm,
@@ -888,7 +879,8 @@ voyager_flush_tlb_others (unsigned long cpumask, struct mm_struct *mm,
while (smp_invalidate_needed) {
mb();
if (--stuck == 0) {
printk("***WARNING*** Stuck doing invalidate CPI (CPU%d)\n", smp_processor_id());
printk("***WARNING*** Stuck doing invalidate CPI "
"(CPU%d)\n", smp_processor_id());
break;
}
}
@@ -902,8 +894,7 @@ voyager_flush_tlb_others (unsigned long cpumask, struct mm_struct *mm,
spin_unlock(&tlbstate_lock);
}
void
flush_tlb_current_task(void)
void flush_tlb_current_task(void)
{
struct mm_struct *mm = current->mm;
unsigned long cpu_mask;
@@ -918,9 +909,7 @@ flush_tlb_current_task(void)
preempt_enable();
}
void
flush_tlb_mm (struct mm_struct * mm)
void flush_tlb_mm(struct mm_struct *mm)
{
unsigned long cpu_mask;
@@ -960,11 +949,11 @@ void flush_tlb_page(struct vm_area_struct * vma, unsigned long va)
preempt_enable();
}
EXPORT_SYMBOL(flush_tlb_page);
/* enable the requested IRQs */
static void
smp_enable_irq_interrupt(void)
static void smp_enable_irq_interrupt(void)
{
__u8 irq;
__u8 cpu = get_cpu();
@@ -986,8 +975,7 @@ smp_enable_irq_interrupt(void)
/*
* CPU halt call-back
*/
static void
smp_stop_cpu_function(void *dummy)
static void smp_stop_cpu_function(void *dummy)
{
VDEBUG(("VOYAGER SMP: CPU%d is STOPPING\n", smp_processor_id()));
cpu_clear(smp_processor_id(), cpu_online_map);
@@ -1012,8 +1000,7 @@ static struct call_data_struct * call_data;
* previously set up. This is used to schedule a function for
* execution on all CPUs - set up the function then broadcast a
* function_interrupt CPI to come here on each CPU */
static void
smp_call_function_interrupt(void)
static void smp_call_function_interrupt(void)
{
void (*func) (void *info) = call_data->func;
void *info = call_data->info;
@@ -1029,7 +1016,8 @@ smp_call_function_interrupt(void)
mb();
if (!test_and_clear_bit(cpu, &call_data->started)) {
/* If the bit wasn't set, this could be a replay */
printk(KERN_WARNING "VOYAGER SMP: CPU %d received call funtion with no call pending\n", cpu);
printk(KERN_WARNING "VOYAGER SMP: CPU %d received call funtion"
" with no call pending\n", cpu);
return;
}
/*
@@ -1047,8 +1035,7 @@ smp_call_function_interrupt(void)
static int
voyager_smp_call_function_mask(cpumask_t cpumask,
void (*func) (void *info), void *info,
int wait)
void (*func) (void *info), void *info, int wait)
{
struct call_data_struct data;
u32 mask = cpus_addr(cpumask)[0];
@@ -1101,8 +1088,7 @@ voyager_smp_call_function_mask (cpumask_t cpumask,
* no local APIC, so I can't do this
*
* This function is currently a placeholder and is unused in the code */
fastcall void
smp_apic_timer_interrupt(struct pt_regs *regs)
fastcall void smp_apic_timer_interrupt(struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);
wrapper_smp_local_timer_interrupt();
@@ -1110,8 +1096,7 @@ smp_apic_timer_interrupt(struct pt_regs *regs)
}
/* All of the QUAD interrupt GATES */
fastcall void
smp_qic_timer_interrupt(struct pt_regs *regs)
fastcall void smp_qic_timer_interrupt(struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);
ack_QIC_CPI(QIC_TIMER_CPI);
@@ -1119,36 +1104,31 @@ smp_qic_timer_interrupt(struct pt_regs *regs)
set_irq_regs(old_regs);
}
fastcall void
smp_qic_invalidate_interrupt(struct pt_regs *regs)
fastcall void smp_qic_invalidate_interrupt(struct pt_regs *regs)
{
ack_QIC_CPI(QIC_INVALIDATE_CPI);
smp_invalidate_interrupt();
}
fastcall void
smp_qic_reschedule_interrupt(struct pt_regs *regs)
fastcall void smp_qic_reschedule_interrupt(struct pt_regs *regs)
{
ack_QIC_CPI(QIC_RESCHEDULE_CPI);
smp_reschedule_interrupt();
}
fastcall void
smp_qic_enable_irq_interrupt(struct pt_regs *regs)
fastcall void smp_qic_enable_irq_interrupt(struct pt_regs *regs)
{
ack_QIC_CPI(QIC_ENABLE_IRQ_CPI);
smp_enable_irq_interrupt();
}
fastcall void
smp_qic_call_function_interrupt(struct pt_regs *regs)
fastcall void smp_qic_call_function_interrupt(struct pt_regs *regs)
{
ack_QIC_CPI(QIC_CALL_FUNCTION_CPI);
smp_call_function_interrupt();
}
fastcall void
smp_vic_cpi_interrupt(struct pt_regs *regs)
fastcall void smp_vic_cpi_interrupt(struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);
__u8 cpu = smp_processor_id();
@@ -1171,8 +1151,7 @@ smp_vic_cpi_interrupt(struct pt_regs *regs)
set_irq_regs(old_regs);
}
static void
do_flush_tlb_all(void* info)
static void do_flush_tlb_all(void *info)
{
unsigned long cpu = smp_processor_id();
@@ -1181,18 +1160,15 @@ do_flush_tlb_all(void* info)
leave_mm(cpu);
}
/* flush the TLB of every active CPU in the system */
void
flush_tlb_all(void)
void flush_tlb_all(void)
{
on_each_cpu(do_flush_tlb_all, 0, 1, 1);
}
/* used to set up the trampoline for other CPUs when the memory manager
* is sorted out */
void __init
smp_alloc_memory(void)
void __init smp_alloc_memory(void)
{
trampoline_base = (__u32) alloc_bootmem_low_pages(PAGE_SIZE);
if (__pa(trampoline_base) >= 0x93000)
@@ -1200,15 +1176,12 @@ smp_alloc_memory(void)
}
/* send a reschedule CPI to one CPU by physical CPU number*/
static void
voyager_smp_send_reschedule(int cpu)
static void voyager_smp_send_reschedule(int cpu)
{
send_one_CPI(cpu, VIC_RESCHEDULE_CPI);
}
int
hard_smp_processor_id(void)
int hard_smp_processor_id(void)
{
__u8 i;
__u8 cpumask = inb(VIC_PROC_WHO_AM_I);
@@ -1223,23 +1196,20 @@ hard_smp_processor_id(void)
return 0;
}
int
safe_smp_processor_id(void)
int safe_smp_processor_id(void)
{
return hard_smp_processor_id();
}
/* broadcast a halt to all other CPUs */
static void
voyager_smp_send_stop(void)
static void voyager_smp_send_stop(void)
{
smp_call_function(smp_stop_cpu_function, NULL, 1, 1);
}
/* this function is triggered in time.c when a clock tick fires
* we need to re-broadcast the tick to all CPUs */
void
smp_vic_timer_interrupt(void)
void smp_vic_timer_interrupt(void)
{
send_CPI_allbutself(VIC_TIMER_CPI);
smp_local_timer_interrupt();
@@ -1253,8 +1223,7 @@ smp_vic_timer_interrupt(void)
* multiplier is 1 and it can be changed by writing the new multiplier
* value into /proc/profile.
*/
void
smp_local_timer_interrupt(void)
void smp_local_timer_interrupt(void)
{
int cpu = smp_processor_id();
long weight;
@@ -1345,8 +1314,7 @@ smp_local_timer_interrupt(void)
}
/* setup the profiling timer */
int
setup_profiling_timer(unsigned int multiplier)
int setup_profiling_timer(unsigned int multiplier)
{
int i;
@@ -1367,15 +1335,13 @@ setup_profiling_timer(unsigned int multiplier)
/* This is a bit of a mess, but forced on us by the genirq changes
* there's no genirq handler that really does what voyager wants
* so hack it up with the simple IRQ handler */
static void fastcall
handle_vic_irq(unsigned int irq, struct irq_desc *desc)
static void fastcall handle_vic_irq(unsigned int irq, struct irq_desc *desc)
{
before_handle_vic_irq(irq);
handle_simple_irq(irq, desc);
after_handle_vic_irq(irq);
}
/* The CPIs are handled in the per cpu 8259s, so they must be
* enabled to be received: FIX: enabling the CPIs in the early
* boot sequence interferes with bug checking; enable them later
@@ -1385,8 +1351,7 @@ handle_vic_irq(unsigned int irq, struct irq_desc *desc)
#define QIC_SET_GATE(cpi, vector) \
set_intr_gate((cpi) + QIC_DEFAULT_CPI_BASE, (vector))
void __init
smp_intr_init(void)
void __init smp_intr_init(void)
{
int i;
@@ -1405,7 +1370,6 @@ smp_intr_init(void)
QIC_SET_GATE(QIC_ENABLE_IRQ_CPI, qic_enable_irq_interrupt);
QIC_SET_GATE(QIC_CALL_FUNCTION_CPI, qic_call_function_interrupt);
/* now put the VIC descriptor into the first 48 IRQs
*
* This is for later: first 16 correspond to PC IRQs; next 16
@@ -1416,8 +1380,7 @@ smp_intr_init(void)
/* send a CPI at level cpi to a set of cpus in cpuset (set 1 bit per
* processor to receive CPI */
static void
send_CPI(__u32 cpuset, __u8 cpi)
static void send_CPI(__u32 cpuset, __u8 cpi)
{
int cpu;
__u32 quad_cpuset = (cpuset & voyager_quad_processors);
@@ -1448,8 +1411,8 @@ send_CPI(__u32 cpuset, __u8 cpi)
* DON'T make this inline otherwise the cache line read will be
* optimised away
* */
static int
ack_QIC_CPI(__u8 cpi) {
static int ack_QIC_CPI(__u8 cpi)
{
__u8 cpu = hard_smp_processor_id();
cpi &= 7;
@@ -1458,8 +1421,7 @@ ack_QIC_CPI(__u8 cpi) {
return voyager_quad_cpi_addr[cpu]->qic_cpi[cpi].cpi;
}
static void
ack_special_QIC_CPI(__u8 cpi)
static void ack_special_QIC_CPI(__u8 cpi)
{
switch (cpi) {
case VIC_CMN_INT:
@@ -1474,8 +1436,7 @@ ack_special_QIC_CPI(__u8 cpi)
}
/* Acknowledge receipt of CPI in the VIC (essentially an EOI) */
static void
ack_VIC_CPI(__u8 cpi)
static void ack_VIC_CPI(__u8 cpi)
{
#ifdef VOYAGER_DEBUG
unsigned long flags;
@@ -1506,8 +1467,7 @@ ack_VIC_CPI(__u8 cpi)
#define cached_21(cpu) (__byte(0,vic_irq_mask[cpu]))
#define cached_A1(cpu) (__byte(1,vic_irq_mask[cpu]))
static unsigned int
startup_vic_irq(unsigned int irq)
static unsigned int startup_vic_irq(unsigned int irq)
{
unmask_vic_irq(irq);
@@ -1535,8 +1495,7 @@ startup_vic_irq(unsigned int irq)
* broadcast an Interrupt enable CPI which causes all other CPUs to
* adjust their masks accordingly. */
static void
unmask_vic_irq(unsigned int irq)
static void unmask_vic_irq(unsigned int irq)
{
/* linux doesn't to processor-irq affinity, so enable on
* all CPUs we know about */
@@ -1557,8 +1516,7 @@ unmask_vic_irq(unsigned int irq)
}
if (real_cpu == cpu) {
enable_local_vic_irq(irq);
}
else if(vic_irq_mask[real_cpu] & mask) {
} else if (vic_irq_mask[real_cpu] & mask) {
vic_irq_enable_mask[real_cpu] |= mask;
processorList |= (1 << real_cpu);
}
@@ -1568,14 +1526,12 @@ unmask_vic_irq(unsigned int irq)
send_CPI(processorList, VIC_ENABLE_IRQ_CPI);
}
static void
mask_vic_irq(unsigned int irq)
static void mask_vic_irq(unsigned int irq)
{
/* lazy disable, do nothing */
}
static void
enable_local_vic_irq(unsigned int irq)
static void enable_local_vic_irq(unsigned int irq)
{
__u8 cpu = smp_processor_id();
__u16 mask = ~(1 << irq);
@@ -1591,15 +1547,13 @@ enable_local_vic_irq(unsigned int irq)
if (irq & 8) {
outb_p(cached_A1(cpu), 0xA1);
(void)inb_p(0xA1);
}
else {
} else {
outb_p(cached_21(cpu), 0x21);
(void)inb_p(0x21);
}
}
static void
disable_local_vic_irq(unsigned int irq)
static void disable_local_vic_irq(unsigned int irq)
{
__u8 cpu = smp_processor_id();
__u16 mask = (1 << irq);
@@ -1618,8 +1572,7 @@ disable_local_vic_irq(unsigned int irq)
if (irq & 8) {
outb_p(cached_A1(cpu), 0xA1);
(void)inb_p(0xA1);
}
else {
} else {
outb_p(cached_21(cpu), 0x21);
(void)inb_p(0x21);
}
@@ -1631,8 +1584,7 @@ disable_local_vic_irq(unsigned int irq)
* interrupt in the vic, so we merely set a flag (IRQ_DISABLED). If
* this interrupt actually comes in, then we mask and ack here to push
* the interrupt off to another CPU */
static void
before_handle_vic_irq(unsigned int irq)
static void before_handle_vic_irq(unsigned int irq)
{
irq_desc_t *desc = irq_desc + irq;
__u8 cpu = smp_processor_id();
@@ -1644,8 +1596,8 @@ before_handle_vic_irq(unsigned int irq)
if (!(cpu_irq_affinity[cpu] & (1 << irq))) {
/* The irq is not in our affinity mask, push it off
* onto another CPU */
VDEBUG(("VOYAGER DEBUG: affinity triggered disable of irq %d on cpu %d\n",
irq, cpu));
VDEBUG(("VOYAGER DEBUG: affinity triggered disable of irq %d "
"on cpu %d\n", irq, cpu));
disable_local_vic_irq(irq);
/* set IRQ_INPROGRESS to prevent the handler in irq.c from
* actually calling the interrupt routine */
@@ -1667,8 +1619,7 @@ before_handle_vic_irq(unsigned int irq)
}
/* Finish the VIC interrupt: basically mask */
static void
after_handle_vic_irq(unsigned int irq)
static void after_handle_vic_irq(unsigned int irq)
{
irq_desc_t *desc = irq_desc + irq;
@@ -1699,7 +1650,8 @@ after_handle_vic_irq(unsigned int irq)
VIC_PROCESSOR_ID);
isr = vic_read_isr();
if (isr & (1 << irq)) {
printk("VOYAGER SMP: CPU%d ack irq %d\n",
printk
("VOYAGER SMP: CPU%d ack irq %d\n",
real_cpu, irq);
ack_vic_irq(irq);
}
@@ -1721,8 +1673,8 @@ after_handle_vic_irq(unsigned int irq)
#ifdef VOYAGER_DEBUG
isr = vic_read_isr();
if ((isr & (1 << irq)) != 0)
printk("VOYAGER SMP: after_handle_vic_irq() after ack irq=%d, isr=0x%x\n",
irq, isr);
printk("VOYAGER SMP: after_handle_vic_irq() after "
"ack irq=%d, isr=0x%x\n", irq, isr);
#endif /* VOYAGER_DEBUG */
}
_raw_spin_unlock(&vic_irq_lock);
@@ -1731,7 +1683,6 @@ after_handle_vic_irq(unsigned int irq)
* may be intercepted by another CPU if reasserted */
}
/* Linux processor - interrupt affinity manipulations.
*
* For each processor, we maintain a 32 bit irq affinity mask.
@@ -1748,8 +1699,7 @@ after_handle_vic_irq(unsigned int irq)
* change the mask and then do an interrupt enable CPI to re-enable on
* the selected processors */
void
set_vic_irq_affinity(unsigned int irq, cpumask_t mask)
void set_vic_irq_affinity(unsigned int irq, cpumask_t mask)
{
/* Only extended processors handle interrupts */
unsigned long real_mask;
@@ -1800,8 +1750,7 @@ set_vic_irq_affinity(unsigned int irq, cpumask_t mask)
unmask_vic_irq(irq);
}
static void
ack_vic_irq(unsigned int irq)
static void ack_vic_irq(unsigned int irq)
{
if (irq & 8) {
outb(0x62, 0x20); /* Specific EOI to cascade */
@@ -1814,8 +1763,7 @@ ack_vic_irq(unsigned int irq)
/* enable the CPIs. In the VIC, the CPIs are delivered by the 8259
* but are not vectored by it. This means that the 8259 mask must be
* lowered to receive them */
static __init void
vic_enable_cpi(void)
static __init void vic_enable_cpi(void)
{
__u8 cpu = smp_processor_id();
@@ -1838,8 +1786,7 @@ vic_enable_cpi(void)
cpu, vic_irq_mask[cpu]));
}
void
voyager_smp_dump()
void voyager_smp_dump()
{
int old_cpu = smp_processor_id(), cpu;
@@ -1884,8 +1831,7 @@ voyager_smp_dump()
}
}
void
smp_voyager_power_off(void *dummy)
void smp_voyager_power_off(void *dummy)
{
if (smp_processor_id() == boot_cpu_id)
voyager_power_off();
@@ -1893,8 +1839,7 @@ smp_voyager_power_off(void *dummy)
smp_stop_cpu_function(NULL);
}
static void __init
voyager_smp_prepare_cpus(unsigned int max_cpus)
static void __init voyager_smp_prepare_cpus(unsigned int max_cpus)
{
/* FIXME: ignore max_cpus for now */
smp_boot_cpus();
@@ -1911,8 +1856,7 @@ static void __cpuinit voyager_smp_prepare_boot_cpu(void)
cpu_set(smp_processor_id(), cpu_present_map);
}
static int __cpuinit
voyager_cpu_up(unsigned int cpu)
static int __cpuinit voyager_cpu_up(unsigned int cpu)
{
/* This only works at boot for x86. See "rewrite" above. */
if (cpu_isset(cpu, smp_commenced_mask))
@@ -1928,14 +1872,12 @@ voyager_cpu_up(unsigned int cpu)
return 0;
}
static void __init
voyager_smp_cpus_done(unsigned int max_cpus)
static void __init voyager_smp_cpus_done(unsigned int max_cpus)
{
zap_low_mappings();
}
void __init
smp_setup_processor_id(void)
void __init smp_setup_processor_id(void)
{
current_thread_info()->cpu = hard_smp_processor_id();
x86_write_percpu(cpu_number, hard_smp_processor_id());

View File

@@ -30,12 +30,10 @@
#include <asm/mtrr.h>
#include <asm/msr.h>
struct task_struct *voyager_thread;
static __u8 set_timeout;
static int
execute(const char *string)
static int execute(const char *string)
{
int ret;
@@ -52,15 +50,15 @@ execute(const char *string)
NULL,
};
if ((ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC)) != 0) {
printk(KERN_ERR "Voyager failed to run \"%s\": %i\n",
string, ret);
if ((ret =
call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC)) != 0) {
printk(KERN_ERR "Voyager failed to run \"%s\": %i\n", string,
ret);
}
return ret;
}
static void
check_from_kernel(void)
static void check_from_kernel(void)
{
if (voyager_status.switch_off) {
@@ -75,8 +73,7 @@ check_from_kernel(void)
}
}
static void
check_continuing_condition(void)
static void check_continuing_condition(void)
{
if (voyager_status.power_fail) {
__u8 data;
@@ -84,16 +81,17 @@ check_continuing_condition(void)
VOYAGER_PSI_AC_FAIL_REG, &data);
if ((data & 0x1f) == 0) {
/* 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 */
execute("umask 600; echo O > /etc/powerstatus; kill -PWR 1");
execute
("umask 600; echo O > /etc/powerstatus; kill -PWR 1");
set_timeout = 0;
}
}
}
static int
thread(void *unused)
static int thread(void *unused)
{
printk(KERN_NOTICE "Voyager starting monitor thread\n");
@@ -112,20 +110,18 @@ thread(void *unused)
}
}
static int __init
voyager_thread_start(void)
static int __init voyager_thread_start(void)
{
voyager_thread = kthread_run(thread, NULL, "kvoyagerd");
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 0;
}
static void __exit
voyager_thread_stop(void)
static void __exit voyager_thread_stop(void)
{
kthread_stop(voyager_thread);
}