[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [PATCH v5 09/14] pci: Use pci_config_size in pci_data_* a
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-arm] [PATCH v5 09/14] pci: Use pci_config_size in pci_data_* accessors |
Date: |
Wed, 7 Feb 2018 11:29:21 -0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 02/07/2018 01:24 AM, Andrey Smirnov wrote:
> Use pci_config_size (as opposed to PCI_CONFIG_SPACE_SIZE) in
> pci_data_read() and pci_data_write(), so this function would work for
> both classic PCI and PCIe use-cases.
>
> Cc: Peter Maydell <address@hidden>
> Cc: Jason Wang <address@hidden>
> Cc: Philippe Mathieu-Daudé <address@hidden>
> Cc: Marcel Apfelbaum <address@hidden>
> Cc: Michael S. Tsirkin <address@hidden>
> Cc: address@hidden
> Cc: address@hidden
> Cc: address@hidden
> Signed-off-by: Andrey Smirnov <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> hw/pci/pci_host.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c
> index 5eaa935cb5..ea52ea07cd 100644
> --- a/hw/pci/pci_host.c
> +++ b/hw/pci/pci_host.c
> @@ -89,30 +89,35 @@ uint32_t pci_host_config_read_common(PCIDevice *pci_dev,
> uint32_t addr,
> void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len)
> {
> PCIDevice *pci_dev = pci_dev_find_by_addr(s, addr);
> - uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1);
> + uint32_t config_addr;
>
> if (!pci_dev) {
> return;
> }
>
> + config_addr = addr & (pci_config_size(pci_dev) - 1);
> +
> PCI_DPRINTF("%s: %s: addr=%02" PRIx32 " val=%08" PRIx32 " len=%d\n",
> __func__, pci_dev->name, config_addr, val, len);
> - pci_host_config_write_common(pci_dev, config_addr, PCI_CONFIG_SPACE_SIZE,
> + pci_host_config_write_common(pci_dev, config_addr,
> + pci_config_size(pci_dev),
> val, len);
> }
>
> uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len)
> {
> PCIDevice *pci_dev = pci_dev_find_by_addr(s, addr);
> - uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1);
> + uint32_t config_addr;
> uint32_t val;
>
> if (!pci_dev) {
> return ~0x0;
> }
>
> + config_addr = addr & (pci_config_size(pci_dev) - 1);
> +
> val = pci_host_config_read_common(pci_dev, config_addr,
> - PCI_CONFIG_SPACE_SIZE, len);
> + pci_config_size(pci_dev), len);
> PCI_DPRINTF("%s: %s: addr=%02"PRIx32" val=%08"PRIx32" len=%d\n",
> __func__, pci_dev->name, config_addr, val, len);
>
>
- [Qemu-arm] [PATCH v5 01/14] sdhci: Add i.MX specific subtype of SDHCI, (continued)
- [Qemu-arm] [PATCH v5 01/14] sdhci: Add i.MX specific subtype of SDHCI, Andrey Smirnov, 2018/02/06
- [Qemu-arm] [PATCH v5 03/14] i.MX: Add code to emulate i.MX7 CCM, PMU and ANALOG IP blocks, Andrey Smirnov, 2018/02/06
- [Qemu-arm] [PATCH v5 04/14] i.MX: Add code to emulate i.MX2 watchdog IP block, Andrey Smirnov, 2018/02/06
- [Qemu-arm] [PATCH v5 05/14] i.MX: Add code to emulate i.MX7 SNVS IP-block, Andrey Smirnov, 2018/02/06
- [Qemu-arm] [PATCH v5 07/14] i.MX: Add i.MX7 GPT variant, Andrey Smirnov, 2018/02/06
- [Qemu-arm] [PATCH v5 08/14] i.MX: Add implementation of i.MX7 GPR IP block, Andrey Smirnov, 2018/02/06
- [Qemu-arm] [PATCH v5 06/14] i.MX: Add code to emulate GPCv2 IP block, Andrey Smirnov, 2018/02/06
- [Qemu-arm] [PATCH v5 09/14] pci: Use pci_config_size in pci_data_* accessors, Andrey Smirnov, 2018/02/06
[Qemu-arm] [PATCH v5 11/14] usb: Add basic code to emulate Chipidea USB IP, Andrey Smirnov, 2018/02/06
[Qemu-arm] [PATCH v5 13/14] hw/arm: Move virt's PSCI DT fixup code to arm/boot.c, Andrey Smirnov, 2018/02/06
[Qemu-arm] [PATCH v5 10/14] pci: Add support for Designware IP block, Andrey Smirnov, 2018/02/06