mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-20 01:02:36 +00:00
PCI ROM is the firmware specific to PCI device and it is provided by the device vendor. The PCI rom resides in 0x30 offset of PCI config space. This can be used to check whether the PCI rom exists. And when it exists, it can load the firmware from the addr that is obtained from ROM bar addr. For the user-vm, it will try to load the rom_file for the given PCI device and enable the VM to access the firmware that is defined in rom_file. BTW: The emulated rom_file is converted from efi image by using EfiRom. It has no dependency on the ROM bar of physical PCI devices. Of course if the physical PCI devices supports the ROM bar, the rom_file can also be dumped from the PCI rom. Now this is limited to PCI display device. V2->V3: Add the function of pci_load_rombar/pci_release_rombar to handle the rombar in course of passthrough_init/deinit. Tracked-On: #8175 Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Acked-by: Wang Yu <yu1.wang@intel.com>
45 lines
731 B
C
45 lines
731 B
C
/*
|
|
* Copyright (C) 2021 Intel Corporation.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*
|
|
*/
|
|
|
|
#ifndef __PASSTHRU_H__
|
|
#define __PASSTHRU_H__
|
|
|
|
#include <types.h>
|
|
|
|
#include "pciaccess.h"
|
|
#include "pci_core.h"
|
|
#include "pciio.h"
|
|
|
|
struct passthru_dev {
|
|
struct pci_vdev *dev;
|
|
struct pcibar bar[PCI_BARMAX + 2];
|
|
struct {
|
|
int capoff;
|
|
} msi;
|
|
struct {
|
|
int capoff;
|
|
} msix;
|
|
struct {
|
|
int capoff;
|
|
} pmcap;
|
|
bool pcie_cap;
|
|
struct pcisel sel;
|
|
int phys_pin;
|
|
uint16_t phys_bdf;
|
|
struct pci_device *phys_dev;
|
|
/* Options for passthrough device:
|
|
* need_reset - reset dev before passthrough
|
|
*/
|
|
bool need_reset;
|
|
bool d3hot_reset;
|
|
bool need_rombar;
|
|
char *rom_buffer;
|
|
bool (*has_virt_pcicfg_regs)(int offset);
|
|
};
|
|
|
|
#endif
|