Exemple #1
0
static long apc_ioctl(struct file *f, unsigned int cmd, unsigned long __arg)
{
	__u8 inarg, __user *arg;

	arg = (__u8 __user *) __arg;

	lock_kernel();

	switch (cmd) {
	case APCIOCGFANCTL:
		if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg)) {
			unlock_kernel();
			return -EFAULT;
		}
		break;

	case APCIOCGCPWR:
		if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg)) {
			unlock_kernel();
			return -EFAULT;
		}
		break;

	case APCIOCGBPORT:
		if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg)) {
			unlock_kernel();
			return -EFAULT;
		}
		break;

	case APCIOCSFANCTL:
		if (get_user(inarg, arg)) {
			unlock_kernel();
			return -EFAULT;
		}
		apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG);
		break;
	case APCIOCSCPWR:
		if (get_user(inarg, arg)) {
			unlock_kernel();
			return -EFAULT;
		}
		apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG);
		break;
	case APCIOCSBPORT:
		if (get_user(inarg, arg)) {
			unlock_kernel();
			return -EFAULT;
		}
		apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG);
		break;
	default:
		unlock_kernel();
		return -EINVAL;
	};

	unlock_kernel();
	return 0;
}
Exemple #2
0
/* 
 * CPU idle callback function
 * See .../arch/sparc/kernel/process.c
 */
void apc_swift_idle(void)
{
#ifdef APC_DEBUG_LED
	set_auxio(0x00, AUXIO_LED); 
#endif

	apc_writeb(apc_readb(APC_IDLE_REG) | APC_IDLE_ON, APC_IDLE_REG);

#ifdef APC_DEBUG_LED
	set_auxio(AUXIO_LED, 0x00); 
#endif
}