1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2020 Beckhoff Automation GmbH & Co. KG 5 * Author: Corvin K<C3><B6>hne <c.koehne@beckhoff.com> 6 */ 7 8 #ifndef _PCI_PASSTHRU_H_ 9 #define _PCI_PASSTHRU_H_ 10 11 #include <vmmapi.h> 12 13 #include "pci_emul.h" 14 15 struct passthru_softc; 16 17 typedef int (*cfgread_handler)(struct passthru_softc *sc, 18 struct pci_devinst *pi, int coff, int bytes, uint32_t *rv); 19 typedef int (*cfgwrite_handler)(struct passthru_softc *sc, 20 struct pci_devinst *pi, int coff, int bytes, uint32_t val); 21 22 uint32_t pci_host_read_config(const struct pcisel *sel, long reg, int width); 23 void pci_host_write_config(const struct pcisel *sel, long reg, int width, 24 uint32_t data); 25 26 int passthru_cfgread_emulate(struct passthru_softc *sc, struct pci_devinst *pi, 27 int coff, int bytes, uint32_t *rv); 28 int passthru_cfgwrite_emulate(struct passthru_softc *sc, struct pci_devinst *pi, 29 int coff, int bytes, uint32_t val); 30 int set_pcir_handler(struct passthru_softc *sc, int reg, int len, 31 cfgread_handler rhandler, cfgwrite_handler whandler); 32 33 #endif /* _PCI_PASSTHRU_H_ */ 34