Commit a4ec1eff authored by Ingo Molnar's avatar Ingo Molnar
Browse files

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
Loading
Loading
Loading
Loading
+17 −15
Original line number Diff line number Diff line
@@ -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 {
+60 −72
Original line number Diff line number Diff line
@@ -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();
+310 −291
Original line number Diff line number Diff line
@@ -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
+307 −365

File changed.

Preview size limit exceeded, changes collapsed.

+24 −28
Original line number Diff line number Diff line
@@ -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);
}