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