]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/bhyve/pci_passthru.h
Update the Arm Optimized Routine library to v23.01
[FreeBSD/FreeBSD.git] / usr.sbin / bhyve / pci_passthru.h
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 <vmmapi.h>
11
12 #include "pci_emul.h"
13
14 struct 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
22 struct passthru_softc;
23
24 typedef int (*cfgread_handler)(struct passthru_softc *sc,
25     struct pci_devinst *pi, int coff, int bytes, uint32_t *rv);
26 typedef int (*cfgwrite_handler)(struct passthru_softc *sc,
27     struct pci_devinst *pi, int coff, int bytes, uint32_t val);
28
29 uint32_t read_config(const struct pcisel *sel, long reg, int width);
30 void write_config(const struct pcisel *sel, long reg, int width, uint32_t data);
31 int passthru_cfgread_emulate(struct passthru_softc *sc, struct pci_devinst *pi,
32     int coff, int bytes, uint32_t *rv);
33 int passthru_cfgwrite_emulate(struct passthru_softc *sc, struct pci_devinst *pi,
34     int coff, int bytes, uint32_t val);
35 struct passthru_mmio_mapping *passthru_get_mmio(struct passthru_softc *sc,
36     int num);
37 struct pcisel *passthru_get_sel(struct passthru_softc *sc);
38 int set_pcir_handler(struct passthru_softc *sc, int reg, int len,
39     cfgread_handler rhandler, cfgwrite_handler whandler);