pci_passthru.h (4d846d260e2b9a3d4d0a701462568268cbfe7a5b) | pci_passthru.h (90c3a1b6629c80a7e4c3fa86d6b794596fdf06b4) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2020 Beckhoff Automation GmbH & Co. KG 5 * Author: Corvin Köhne <c.koehne@beckhoff.com> 6 */ 7 8#pragma once 9 | 1/*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2020 Beckhoff Automation GmbH & Co. KG 5 * Author: Corvin Köhne <c.koehne@beckhoff.com> 6 */ 7 8#pragma once 9 |
10#include <sys/linker_set.h> 11 |
|
10#include <vmmapi.h> 11 | 12#include <vmmapi.h> 13 |
14#include "config.h" |
|
12#include "pci_emul.h" 13 14struct passthru_mmio_mapping { 15 vm_paddr_t gpa; /* guest physical address */ 16 void *gva; /* guest virtual address */ 17 vm_paddr_t hpa; /* host physical address */ 18 void *hva; /* guest virtual address */ 19 vm_paddr_t len; 20}; 21 22struct passthru_softc; 23 | 15#include "pci_emul.h" 16 17struct passthru_mmio_mapping { 18 vm_paddr_t gpa; /* guest physical address */ 19 void *gva; /* guest virtual address */ 20 vm_paddr_t hpa; /* host physical address */ 21 void *hva; /* guest virtual address */ 22 vm_paddr_t len; 23}; 24 25struct passthru_softc; 26 |
27struct passthru_dev { 28 int (*probe)(struct pci_devinst *pi); 29 int (*init)(struct pci_devinst *pi, nvlist_t *nvl); 30 void (*deinit)(struct pci_devinst *pi); 31}; 32#define PASSTHRU_DEV_SET(x) DATA_SET(passthru_dev_set, x) 33 |
|
24typedef int (*cfgread_handler)(struct passthru_softc *sc, 25 struct pci_devinst *pi, int coff, int bytes, uint32_t *rv); 26typedef int (*cfgwrite_handler)(struct passthru_softc *sc, 27 struct pci_devinst *pi, int coff, int bytes, uint32_t val); 28 29uint32_t read_config(const struct pcisel *sel, long reg, int width); 30void write_config(const struct pcisel *sel, long reg, int width, uint32_t data); 31int passthru_cfgread_emulate(struct passthru_softc *sc, struct pci_devinst *pi, 32 int coff, int bytes, uint32_t *rv); 33int passthru_cfgwrite_emulate(struct passthru_softc *sc, struct pci_devinst *pi, 34 int coff, int bytes, uint32_t val); 35struct passthru_mmio_mapping *passthru_get_mmio(struct passthru_softc *sc, 36 int num); 37struct pcisel *passthru_get_sel(struct passthru_softc *sc); 38int set_pcir_handler(struct passthru_softc *sc, int reg, int len, 39 cfgread_handler rhandler, cfgwrite_handler whandler); | 34typedef int (*cfgread_handler)(struct passthru_softc *sc, 35 struct pci_devinst *pi, int coff, int bytes, uint32_t *rv); 36typedef int (*cfgwrite_handler)(struct passthru_softc *sc, 37 struct pci_devinst *pi, int coff, int bytes, uint32_t val); 38 39uint32_t read_config(const struct pcisel *sel, long reg, int width); 40void write_config(const struct pcisel *sel, long reg, int width, uint32_t data); 41int passthru_cfgread_emulate(struct passthru_softc *sc, struct pci_devinst *pi, 42 int coff, int bytes, uint32_t *rv); 43int passthru_cfgwrite_emulate(struct passthru_softc *sc, struct pci_devinst *pi, 44 int coff, int bytes, uint32_t val); 45struct passthru_mmio_mapping *passthru_get_mmio(struct passthru_softc *sc, 46 int num); 47struct pcisel *passthru_get_sel(struct passthru_softc *sc); 48int set_pcir_handler(struct passthru_softc *sc, int reg, int len, 49 cfgread_handler rhandler, cfgwrite_handler whandler); |