1bf21cd93STycho Nightingale /*- 2*4c87aefeSPatrick Mooney * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3*4c87aefeSPatrick Mooney * 4*4c87aefeSPatrick Mooney * Copyright (c) 2014 Hudson River Trading LLC 5bf21cd93STycho Nightingale * Written by: John H. Baldwin <jhb@FreeBSD.org> 6bf21cd93STycho Nightingale * All rights reserved. 7bf21cd93STycho Nightingale * 8bf21cd93STycho Nightingale * Redistribution and use in source and binary forms, with or without 9bf21cd93STycho Nightingale * modification, are permitted provided that the following conditions 10bf21cd93STycho Nightingale * are met: 11bf21cd93STycho Nightingale * 1. Redistributions of source code must retain the above copyright 12bf21cd93STycho Nightingale * notice, this list of conditions and the following disclaimer. 13bf21cd93STycho Nightingale * 2. Redistributions in binary form must reproduce the above copyright 14bf21cd93STycho Nightingale * notice, this list of conditions and the following disclaimer in the 15bf21cd93STycho Nightingale * documentation and/or other materials provided with the distribution. 16bf21cd93STycho Nightingale * 17bf21cd93STycho Nightingale * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18bf21cd93STycho Nightingale * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19bf21cd93STycho Nightingale * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20bf21cd93STycho Nightingale * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21bf21cd93STycho Nightingale * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22bf21cd93STycho Nightingale * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23bf21cd93STycho Nightingale * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24bf21cd93STycho Nightingale * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25bf21cd93STycho Nightingale * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26bf21cd93STycho Nightingale * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27bf21cd93STycho Nightingale * SUCH DAMAGE. 28bf21cd93STycho Nightingale * 29*4c87aefeSPatrick Mooney * $FreeBSD$ 30bf21cd93STycho Nightingale */ 31bf21cd93STycho Nightingale 32bf21cd93STycho Nightingale #ifndef __PCI_IRQ_H__ 33bf21cd93STycho Nightingale #define __PCI_IRQ_H__ 34bf21cd93STycho Nightingale 35bf21cd93STycho Nightingale struct pci_devinst; 36bf21cd93STycho Nightingale 37bf21cd93STycho Nightingale void pci_irq_assert(struct pci_devinst *pi); 38bf21cd93STycho Nightingale void pci_irq_deassert(struct pci_devinst *pi); 39bf21cd93STycho Nightingale void pci_irq_init(struct vmctx *ctx); 40bf21cd93STycho Nightingale void pci_irq_reserve(int irq); 41bf21cd93STycho Nightingale void pci_irq_use(int irq); 42*4c87aefeSPatrick Mooney int pirq_alloc_pin(struct pci_devinst *pi); 43bf21cd93STycho Nightingale int pirq_irq(int pin); 44bf21cd93STycho Nightingale uint8_t pirq_read(int pin); 45bf21cd93STycho Nightingale void pirq_write(struct vmctx *ctx, int pin, uint8_t val); 46bf21cd93STycho Nightingale 47bf21cd93STycho Nightingale #endif 48