Most register of the PCI header are either constant values or require emulation anyway. The command and status register are the only exception which require hardware access. So, we're adding an emulation handler for all other register. As this emulation handler will be reused by some future features like GPU passthrough, we directly export it. Reviewed by: markj MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33010
29 lines
1009 B
C
29 lines
1009 B
C
/*-
|
|
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
|
*
|
|
* Copyright (c) 2020 Beckhoff Automation GmbH & Co. KG
|
|
* Author: Corvin Köhne <c.koehne@beckhoff.com>
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <vmmapi.h>
|
|
|
|
#include "pci_emul.h"
|
|
|
|
struct passthru_softc;
|
|
|
|
typedef int (*cfgread_handler)(struct passthru_softc *sc,
|
|
struct pci_devinst *pi, int coff, int bytes, uint32_t *rv);
|
|
typedef int (*cfgwrite_handler)(struct passthru_softc *sc,
|
|
struct pci_devinst *pi, int coff, int bytes, uint32_t val);
|
|
|
|
uint32_t read_config(const struct pcisel *sel, long reg, int width);
|
|
void write_config(const struct pcisel *sel, long reg, int width, uint32_t data);
|
|
int passthru_cfgread_emulate(struct passthru_softc *sc, struct pci_devinst *pi,
|
|
int coff, int bytes, uint32_t *rv);
|
|
int passthru_cfgwrite_emulate(struct passthru_softc *sc, struct pci_devinst *pi,
|
|
int coff, int bytes, uint32_t val);
|
|
int set_pcir_handler(struct passthru_softc *sc, int reg, int len,
|
|
cfgread_handler rhandler, cfgwrite_handler whandler);
|