mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-05 23:16:59 +00:00
hv: pci: use mmio_read/write directly
Use mmio_read/write directly. Tracked-On: #8255 Signed-off-by: Fei Li <fei1.li@intel.com>
This commit is contained in:
parent
65454730de
commit
8d734dd915
@ -179,24 +179,10 @@ static uint32_t pci_mmcfg_read_cfg(union pci_bdf bdf, uint32_t offset, uint32_t
|
||||
{
|
||||
uint32_t addr = mmcfg_off_to_address(bdf, offset);
|
||||
void *hva = hpa2hva(addr);
|
||||
uint32_t val;
|
||||
|
||||
|
||||
ASSERT(pci_is_valid_access(offset, bytes), "the offset should be aligned with 2/4 byte\n");
|
||||
|
||||
switch (bytes) {
|
||||
case 1U:
|
||||
val = (uint32_t)mmio_read8(hva);
|
||||
break;
|
||||
case 2U:
|
||||
val = (uint32_t)mmio_read16(hva);
|
||||
break;
|
||||
default:
|
||||
val = mmio_read32(hva);
|
||||
break;
|
||||
}
|
||||
|
||||
return val;
|
||||
return (uint32_t)mmio_read(hva, bytes);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -211,17 +197,8 @@ static void pci_mmcfg_write_cfg(union pci_bdf bdf, uint32_t offset, uint32_t byt
|
||||
void *hva = hpa2hva(addr);
|
||||
|
||||
ASSERT(pci_is_valid_access(offset, bytes), "the offset should be aligned with 2/4 byte\n");
|
||||
switch (bytes) {
|
||||
case 1U:
|
||||
mmio_write8((uint8_t)val, hva);
|
||||
break;
|
||||
case 2U:
|
||||
mmio_write16((uint16_t)val, hva);
|
||||
break;
|
||||
default:
|
||||
mmio_write32(val, hva);
|
||||
break;
|
||||
}
|
||||
|
||||
mmio_write(hva, bytes, val);
|
||||
}
|
||||
|
||||
static const struct pci_cfg_ops pci_mmcfg_cfg_ops = {
|
||||
|
Loading…
Reference in New Issue
Block a user