static void pci_uart_intr_deassert(void *arg) { struct pci_devinst *pi = arg; pci_lintr_deassert(pi); }
/* * 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); }
static void pci_wdt_bar_write(struct vmctx *ctx, int vcpu, struct pci_vdev *dev, int baridx, uint64_t offset, int size, uint64_t value) { assert(baridx == 0); DPRINTF("%s: addr = 0x%x, val = 0x%x, size=%d\n", __func__, (int) offset, (int)value, size); if (offset == ESB_GIS_REG) { if ((value & ESB_WDT_INT_ACT) == 1) { wdt_state.intr_active = false; if ((wdt_state.intr_enabled == true) && (dev->lintr.state == ASSERTED)) { pci_lintr_deassert(dev); DPRINTF("%s: intr deasserted\n\r", __func__); } } } else if (offset == ESB_RELOAD_REG) { assert(size == 2); if (value == ESB_UNLOCK1) wdt_state.unlock_state = 1; else if ((value == ESB_UNLOCK2) && (wdt_state.unlock_state == 1)) wdt_state.unlock_state = 2; else if (wdt_state.unlock_state == 2) { if (value & ESB_WDT_RELOAD) { wdt_state.stage = 1; start_wdt_timer(); } /* write ES_WDT_TIMEOUT bit clear wdt timeout */ if (value & ESB_WDT_TIMEOUT) { DPRINTF("%s: timeout cleaned\n\r", __func__); wdt_timeout = 0; } wdt_state.unlock_state = 0; } } else if (wdt_state.unlock_state == 2) { if (offset == ESB_TIMER1_REG) wdt_state.timer1_val = value & DEFAULT_MAX_TIMER_VAL; else if (offset == ESB_TIMER2_REG) wdt_state.timer2_val = value & DEFAULT_MAX_TIMER_VAL; wdt_state.unlock_state = 0; } }
/* * Reset device (device-wide). This erases all queues, i.e., * all the queues become invalid (though we don't wipe out the * internal pointers, we just clear the VQ_ALLOC flag). * * It resets negotiated features to "none". * * If MSI-X is enabled, this also resets all the vectors to NO_VECTOR. */ void vi_reset_dev(struct virtio_softc *vs) { struct vqueue_info *vq; int i, nvq; nvq = vs->vs_vc->vc_nvq; for (vq = vs->vs_queues, i = 0; i < nvq; vq++, i++) { vq->vq_flags = 0; vq->vq_last_avail = 0; vq->vq_pfn = 0; vq->vq_msix_idx = VIRTIO_MSI_NO_VECTOR; } vs->vs_negotiated_caps = 0; vs->vs_curq = 0; /* vs->vs_status = 0; -- redundant */ VS_LOCK(vs); if (vs->vs_isr) pci_lintr_deassert(vs->vs_pi); vs->vs_isr = 0; VS_UNLOCK(vs); vs->vs_msix_cfg_idx = VIRTIO_MSI_NO_VECTOR; }