[PATCH v2 08/18] pci: Fix use of flags in dm_pci_map_bar()
Bin Meng
bmeng.cn at gmail.com
Wed Apr 13 15:11:39 CEST 2022
On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull <ascull at google.com> wrote:
>
> The flags parameter of dm_pci_map_bar() is used for PCI region flags
> rather than memory mapping flags. Fix the type to match that of the
> region flags and stop using the regions flags as memory mapping flags.
>
> Signed-off-by: Andrew Scull <ascull at google.com>
> ---
> drivers/pci/pci-uclass.c | 10 +++++-----
> include/pci.h | 2 +-
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> index 33dda00002..8bbeb62f2e 100644
> --- a/drivers/pci/pci-uclass.c
> +++ b/drivers/pci/pci-uclass.c
> @@ -1533,8 +1533,8 @@ static phys_addr_t dm_pci_map_ea_virt(struct udevice *dev, int ea_off,
> return addr;
> }
>
> -static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags,
> - int ea_off, struct pci_child_plat *pdata)
> +static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int ea_off,
> + struct pci_child_plat *pdata)
> {
> int ea_cnt, i, entry_size;
> int bar_id = (bar - PCI_BASE_ADDRESS_0) >> 2;
> @@ -1577,13 +1577,13 @@ static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags,
> addr += dm_pci_map_ea_virt(dev, ea_off, pdata);
>
> /* size ignored for now */
> - return map_physmem(addr, 0, flags);
> + return map_physmem(addr, 0, MAP_NOCACHE);
> }
>
> return 0;
> }
>
> -void *dm_pci_map_bar(struct udevice *dev, int bar, int flags)
> +void *dm_pci_map_bar(struct udevice *dev, int bar, unsigned long flags)
Why is this change (int => unsigned long) necessary?
> {
> struct pci_child_plat *pdata = dev_get_parent_plat(dev);
> struct udevice *udev = dev;
> @@ -1608,7 +1608,7 @@ void *dm_pci_map_bar(struct udevice *dev, int bar, int flags)
> */
> ea_off = dm_pci_find_capability(udev, PCI_CAP_ID_EA);
> if (ea_off)
> - return dm_pci_map_ea_bar(udev, bar, flags, ea_off, pdata);
> + return dm_pci_map_ea_bar(udev, bar, ea_off, pdata);
>
> /* read BAR address */
> dm_pci_read_config32(udev, bar, &bar_response);
> diff --git a/include/pci.h b/include/pci.h
> index 673c95c6bb..5ba82826f4 100644
> --- a/include/pci.h
> +++ b/include/pci.h
> @@ -1472,7 +1472,7 @@ pci_addr_t dm_pci_phys_to_bus(struct udevice *dev, phys_addr_t addr,
> * @flags: Flags for the region type (PCI_REGION_...)
> * @return: pointer to the virtual address to use or 0 on error
> */
> -void *dm_pci_map_bar(struct udevice *dev, int bar, int flags);
> +void *dm_pci_map_bar(struct udevice *dev, int bar, unsigned long flags);
>
> /**
> * dm_pci_find_next_capability() - find a capability starting from an offset
> --
Regards,
Bin
More information about the U-Boot
mailing list