mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-21 08:50:27 +00:00
HV: centralize the pci cfg read/write sanity checking code
Do the pci cfg read/write sanity checking before the request is dispatched to submodules, so that the checking is centralized rather than scattered across multiple files/places Tracked-On: #2534 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -105,12 +105,6 @@ void vdev_pt_deinit(const struct pci_vdev *vdev)
|
||||
int32_t vdev_pt_cfgread(const struct pci_vdev *vdev, uint32_t offset,
|
||||
uint32_t bytes, uint32_t *val)
|
||||
{
|
||||
/* Assumption: access needed to be aligned on 1/2/4 bytes */
|
||||
if ((offset & (bytes - 1U)) != 0U) {
|
||||
*val = 0xFFFFFFFFU;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* PCI BARs is emulated */
|
||||
if (pci_bar_access(offset)) {
|
||||
*val = pci_vdev_read_cfg(vdev, offset, bytes);
|
||||
@@ -184,11 +178,6 @@ static void vdev_pt_cfgwrite_bar(struct pci_vdev *vdev, uint32_t offset,
|
||||
int32_t vdev_pt_cfgwrite(struct pci_vdev *vdev, uint32_t offset,
|
||||
uint32_t bytes, uint32_t val)
|
||||
{
|
||||
/* Assumption: access needed to be aligned on 1/2/4 bytes */
|
||||
if ((offset & (bytes - 1U)) != 0U) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* PCI BARs are emulated */
|
||||
if (pci_bar_access(offset)) {
|
||||
vdev_pt_cfgwrite_bar(vdev, offset, bytes, val);
|
||||
|
Reference in New Issue
Block a user