DM: remove unused function virtio_pci_modern_cfgread and virtio_pci_modern_cfgwrite

Change-Id: I3f362858956a642ae0de9ab36387e274fc939659
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
yliu79 2019-05-22 10:19:00 -07:00 committed by ACRN System Integration
parent 62f14bb11f
commit dcd6d8b5a9
2 changed files with 0 additions and 163 deletions

View File

@ -1839,131 +1839,6 @@ virtio_pci_write(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
base->vops->name, baridx);
}
/**
* @brief Handle PCI configuration space reads.
*
* Handle virtio PCI configuration space reads. Only the specific registers
* that need speical operation are handled in this callback. For others just
* fallback to pci core. This interface is only valid for virtio modern.
*
* @param ctx Pointer to struct vmctx representing VM context.
* @param vcpu VCPU ID.
* @param dev Pointer to struct pci_vdev which emulates a PCI device.
* @param coff Register offset in bytes within PCI configuration space.
* @param bytes Access range in bytes.
* @param rv The value returned as read.
*
* @return 0 on handled and non-zero on non-handled.
*/
int
virtio_pci_modern_cfgread(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
int coff, int bytes, uint32_t *rv)
{
struct virtio_base *base = dev->arg;
struct virtio_pci_cfg_cap *cfg;
uint32_t value;
int cfg_coff = base->cfg_coff;
size_t cfg_data_offset;
cfg_data_offset = offsetof(struct virtio_pci_cfg_cap, pci_cfg_data);
/* we only need to handle the read to
* virtio_pci_cfg_cap.pci_cfg_data[]
* fallback for anything else by return -1
*/
if ((cfg_coff > 0) && (coff >= cfg_coff + cfg_data_offset) &&
(coff + bytes <= cfg_coff + sizeof(*cfg))) {
cfg = (struct virtio_pci_cfg_cap *)&dev->cfgdata[cfg_coff];
if (cfg->cap.bar == base->modern_pio_bar_idx)
value = virtio_pci_modern_pio_read(ctx, vcpu, dev,
cfg->cap.bar, cfg->cap.offset, cfg->cap.length);
else if (cfg->cap.bar == base->modern_mmio_bar_idx)
value = virtio_pci_modern_mmio_read(ctx, vcpu, dev,
cfg->cap.bar, cfg->cap.offset, cfg->cap.length);
else {
fprintf(stderr, "%s: cfgread unexpected baridx %d\r\n",
base->vops->name, cfg->cap.bar);
value = 0;
}
/* update pci_cfg_data */
if (cfg->cap.length == 1)
pci_set_cfgdata8(dev, cfg_coff + cfg_data_offset,
value);
else if (cfg->cap.length == 2)
pci_set_cfgdata16(dev, cfg_coff + cfg_data_offset,
value);
else
pci_set_cfgdata32(dev, cfg_coff + cfg_data_offset,
value);
*rv = value;
return 0;
}
return -1;
}
/**
* @brief Handle PCI configuration space writes.
*
* Handle virtio PCI configuration space writes. Only the specific registers
* that need speical operation are handled in this callback. For others just
* fallback to pci core. This interface is only valid for virtio modern.
*
* @param ctx Pointer to struct vmctx representing VM context.
* @param vcpu VCPU ID.
* @param dev Pointer to struct pci_vdev which emulates a PCI device.
* @param coff Register offset in bytes within PCI configuration space.
* @param bytes Access range in bytes.
* @param val The value to write.
*
* @return 0 on handled and non-zero on non-handled.
*/
int
virtio_pci_modern_cfgwrite(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
int coff, int bytes, uint32_t val)
{
struct virtio_base *base = dev->arg;
struct virtio_pci_cfg_cap *cfg;
int cfg_coff = base->cfg_coff;
size_t cfg_data_offset;
cfg_data_offset = offsetof(struct virtio_pci_cfg_cap, pci_cfg_data);
/* we only need to handle the write to
* virtio_pci_cfg_cap.pci_cfg_data[]
* fallback for anything else by return -1
*/
if ((cfg_coff > 0) && (coff >= cfg_coff + cfg_data_offset) &&
(coff + bytes <= cfg_coff + sizeof(*cfg))) {
/* default cfg write */
if (bytes == 1)
pci_set_cfgdata8(dev, coff, val);
else if (bytes == 2)
pci_set_cfgdata16(dev, coff, val);
else
pci_set_cfgdata32(dev, coff, val);
cfg = (struct virtio_pci_cfg_cap *)&dev->cfgdata[cfg_coff];
if (cfg->cap.bar == base->modern_pio_bar_idx)
virtio_pci_modern_pio_write(ctx, vcpu, dev,
cfg->cap.bar, cfg->cap.offset,
cfg->cap.length, val);
else if (cfg->cap.bar == base->modern_mmio_bar_idx)
virtio_pci_modern_mmio_write(ctx, vcpu, dev,
cfg->cap.bar, cfg->cap.offset,
cfg->cap.length, val);
else
fprintf(stderr, "%s: cfgwrite unexpected baridx %d\r\n",
base->vops->name, cfg->cap.bar);
return 0;
}
return -1;
}
/**
* @brief Get the virtio poll parameters
*

View File

@ -730,44 +730,6 @@ void virtio_pci_write(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
*/
int virtio_set_modern_bar(struct virtio_base *base, bool use_notify_pio);
/**
* @brief Handle PCI configuration space reads.
*
* Handle virtio PCI configuration space reads. Only the specific registers
* that need speical operation are handled in this callback. For others just
* fallback to pci core. This interface is only valid for virtio modern.
*
* @param ctx Pointer to struct vmctx representing VM context.
* @param vcpu VCPU ID.
* @param dev Pointer to struct pci_vdev which emulates a PCI device.
* @param coff Register offset in bytes within PCI configuration space.
* @param bytes Access range in bytes.
* @param rv The value returned as read.
*
* @return 0 on handled and non-zero on non-handled.
*/
int virtio_pci_modern_cfgread(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
int coff, int bytes, uint32_t *rv);
/**
* @brief Handle PCI configuration space writes.
*
* Handle virtio PCI configuration space writes. Only the specific registers
* that need speical operation are handled in this callback. For others just
* fallback to pci core. This interface is only valid for virtio modern.
*
* @param ctx Pointer to struct vmctx representing VM context.
* @param vcpu VCPU ID.
* @param dev Pointer to struct pci_vdev which emulates a PCI device.
* @param coff Register offset in bytes within PCI configuration space.
* @param bytes Access range in bytes.
* @param val The value to write.
*
* @return 0 on handled and non-zero on non-handled.
*/
int virtio_pci_modern_cfgwrite(struct vmctx *ctx, int vcpu,
struct pci_vdev *dev, int coff, int bytes,
uint32_t val);
/**
* @}
*/