Exemple #1
0
static void
pci_uart_intr_assert(void *arg)
{
	struct pci_devinst *pi = arg;

	pci_lintr_assert(pi);
}
Exemple #2
0
/*
 * Toggle the COM port's intr pin depending on whether or not we have an
 * interrupt condition to report to the processor.
 */
static void
pci_uart_toggle_intr(struct pci_uart_softc *sc)
{
	uint8_t intr_reason;

	intr_reason = pci_uart_intr_reason(sc);

	if (intr_reason == IIR_NOPEND)
		pci_lintr_deassert(sc->pi);
	else
		pci_lintr_assert(sc->pi);
}
/*
 * WDT timer, start when guest OS start watchdog service; and re-start for
 * each dog-kick / ping action if time out, it will trigger reboot or other
 * action to guest OS
 */
static void
wdt_expired_handler(void *arg, uint64_t nexp)
{
	struct pci_vdev *dev = (struct pci_vdev *)arg;

	DPRINTF("wdt timer out! stage=%d, reboot=%d\n",
		wdt_state.stage, wdt_state.reboot_enabled);

	if (wdt_state.stage == 1) {
		if (wdt_state.intr_enabled) {

			if (pci_msi_enabled(dev))
				pci_generate_msi(dev, 0);
			else
				pci_lintr_assert(dev);

			wdt_state.intr_active = true;
		}

		wdt_state.stage = 2;
		start_wdt_timer();
	} else {
		if (wdt_state.reboot_enabled) {
			wdt_state.stage = 1;
			wdt_timeout = 1;

			/* watchdog timer out, set the uos to reboot */
			vm_set_suspend_mode(VM_SUSPEND_FULL_RESET);
			mevent_notify();
		} else {
			/* if not need reboot, just loop timer */
			wdt_state.stage = 1;
			start_wdt_timer();
		}
	}
}