Exemplo n.º 1
0
int pcwatchdog_init(void)
#endif
{
#ifdef	DEBUG
	printk("pcwd: Success.\n");
#endif
	printk("pcwd: v%s Ken Hollis ([email protected])\n", WD_VER);

#ifdef	DEBUG
	printk("pcwd: About to perform card autosense loop.\n");
#endif

	is_eof = 0;
	is_open = 0;

	current_ctlport = WD_TIMERRESET_PORT1;
	current_readport = WD_CTLSTAT_PORT1;
	current_ctlport2 = WD_CTLSTAT2_PORT1;
	current_disport = WD_DISABLE_PORT1;

	if (!pcwd_checkcard()) {
#ifdef	DEBUG
		printk("pcwd: Trying port 0x370.\n");
#endif

		current_ctlport = WD_TIMERRESET_PORT2;
		current_readport = WD_CTLSTAT_PORT2;
		current_ctlport2 = WD_CTLSTAT2_PORT2;
		current_disport = WD_DISABLE_PORT2;

		if (!pcwd_checkcard()) {
			printk("pcwd: No card detected, or wrong port assigned.\n");
			return(-EIO);
		} else
			printk("pcwd: Watchdog Rev.A detected at port 0x370\n");
	} else
		printk("pcwd: Watchdog Rev.A detected at port 0x270\n");

	pcwd_showprevstate();

#ifdef	DEBUG
	printk("pcwd: Requesting region entry\n");
#endif

	request_region(current_ctlport, WD_PORT_EXTENT, "PCWD Rev.A (Berkshire)");

#ifdef	DEBUG
	printk("pcwd: character device creation.\n");
#endif

	misc_register(&pcwd_miscdev);

	return 0;
}
Exemplo n.º 2
0
__initfunc(int pcwatchdog_init(void))
#endif
{
	int i, found = 0;

	revision = PCWD_REVISION_A;

	printk("pcwd: v%s Ken Hollis ([email protected])\n", WD_VER);

	/* Initial variables */
	is_open = 0;
	supports_temp = 0;
	mode_debug = 0;
	temp_panic = 0;
	initial_status = 0x0000;

#ifndef	PCWD_BLIND
	for (i = 0; pcwd_ioports[i] != 0; i++) {
		current_readport = pcwd_ioports[i];

		if (pcwd_checkcard()) {
			found = 1;
			break;
		}
	}

	if (!found) {
		printk("pcwd: No card detected, or port not available.\n");
		return(-EIO);
	}
#endif

#ifdef	PCWD_BLIND
	current_readport = PCWD_BLIND;
#endif

	get_support();
	revision = get_revision();

	if (revision == PCWD_REVISION_A)
		printk("pcwd: PC Watchdog (REV.A) detected at port 0x%03x\n", current_readport);
	else if (revision == PCWD_REVISION_C)
		printk("pcwd: PC Watchdog (REV.C) detected at port 0x%03x (Firmware version: %s)\n",
			current_readport, get_firmware());
	else {
		/* Should NEVER happen, unless get_revision() fails. */
		printk("pcwd: Unable to get revision.\n");
		return -1;
	}

	debug_off();

	pcwd_showprevstate();

	/*  Disable the board  */
	if (revision == PCWD_REVISION_C) {
		outb_p(0xA5, current_readport + 3);
		outb_p(0xA5, current_readport + 3);
	}

	if (revision == PCWD_REVISION_A)
		request_region(current_readport, 2, "PCWD Rev.A (Berkshire)");
	else
		request_region(current_readport, 4, "PCWD Rev.C (Berkshire)");

	misc_register(&pcwd_miscdev);

	if (supports_temp)
		misc_register(&temp_miscdev);

	return 0;
}