pci: serial: Support reading PCI-register size with base

The PCI helpers read only the base address for a PCI region. In some cases
the size is needed as well, e.g. to pass along to a driver which needs to
know the size of its register area.

Update the functions to allow the size to be returned. For serial, record
the information and provided it with the serial_info() call.

A limitation still exists in that the size is not available when OF_LIVE
is enabled, so take account of that in the tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2023-09-26 08:14:58 -06:00
committed by Tom Rini
parent 61fc132051
commit f69d3d6d10
16 changed files with 61 additions and 32 deletions

View File

@@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev);
* fdtdec_get_addr() and friends.
*
* @dev: Device to read from
* @sizep: If non-NULL, returns size of address space found
* Return: address or FDT_ADDR_T_NONE if not found
*/
fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep);
/**
* dev_remap_addr() - Get the reg property of a device as a
@@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev)
return devfdt_get_addr_ptr(dev);
}
static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev,
fdt_size_t *sizep)
{
return devfdt_get_addr_pci(dev);
return devfdt_get_addr_pci(dev, sizep);
}
static inline void *dev_remap_addr(const struct udevice *dev)