#include <asm/io.h>
#define	SUPERIO_CONFIG_PORT		0x2e
/*
 * Wade: you should use as below (don't forget any thing ....)
 * 1. superio_enter_config(void)
 * 2. superio_set_logic_device(u8 val)
 * 3. do your ops ............
 *    do your ops ............
 * 4. superio_exit_config(void)
 */
unsigned char superio_get_reg(u8 val) {
	outb (val, SUPERIO_CONFIG_PORT);
	//jackie use "asm out 0xeb, al" as delay, it's the same way
	outb( 0x80,0xeb); // a Small delay
	val = inb (SUPERIO_CONFIG_PORT+1);
	outb( 0x80,0xeb); // a Small delay
	return val;
}

void superio_set_reg(u8 val,u8 index) {
	outb (index, SUPERIO_CONFIG_PORT);
	outb( 0x80, 0xeb); // a Small delay
	outb (val, (SUPERIO_CONFIG_PORT+1));
	outb(0x80, 0xeb); // a Small delay
}

void superio_set_logic_device(u8 val) {
	superio_set_reg(val, 0x07);
	outb( 0x80, 0xeb); // a Small delay
}

void superio_enter_config(void) {
	outb (0x87, SUPERIO_CONFIG_PORT);
	outb(0x80, 0xeb); // a Small delay
	outb (0x87, SUPERIO_CONFIG_PORT);
	outb(0x80, 0xeb); // a Small delay
}

void superio_exit_config(void) {
	outb (0xaa, SUPERIO_CONFIG_PORT);
	outb( 0x80, 0xeb); // a Small delay
}

