Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/64838 )
Change subject: device/resource: Prepare for resources without index ......................................................................
device/resource: Prepare for resources without index
Change-Id: I666904266d0ee5ada7ed7b500efa3a7bf363f01f Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/device/device_util.c M src/include/device/device.h 2 files changed, 16 insertions(+), 24 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/38/64838/1
diff --git a/src/device/device_util.c b/src/device/device_util.c index a22c7c5..109875c 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -822,7 +822,7 @@ } }
-const struct resource *fixed_mem_resource_f(struct device *dev, unsigned long index, +const struct resource *fixed_resource_idx(struct device *dev, unsigned long index, uint64_t base, uint64_t size, unsigned long flags) { struct resource *resource; @@ -832,25 +832,7 @@ resource = new_resource(dev, index); resource->base = base; resource->size = size; - resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_ASSIGNED | - IORESOURCE_STORED; - resource->flags |= flags; - - return resource; -} - -const struct resource *fixed_io_resource_f(struct device *dev, unsigned long index, - uint16_t base, uint16_t size, unsigned long flags) -{ - struct resource *resource; - if (!size) - return NULL; - - resource = new_resource(dev, index); - resource->base = base; - resource->size = size; - resource->flags = IORESOURCE_IO | IORESOURCE_FIXED | IORESOURCE_ASSIGNED | - IORESOURCE_STORED; + resource->flags = IORESOURCE_FIXED | IORESOURCE_ASSIGNED | IORESOURCE_STORED; resource->flags |= flags;
return resource; diff --git a/src/include/device/device.h b/src/include/device/device.h index 8e52663..b5789ae 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -293,9 +293,16 @@ /* These are temporary resource constructors to get us through the migration away from open-coding all the IORESOURCE_FLAGS. */
-const struct resource *fixed_io_resource_f(struct device *dev, unsigned long index, - uint16_t base, uint16_t size, unsigned long flags); +const struct resource *fixed_resource_idx(struct device *dev, unsigned long index, + uint64_t base, uint64_t size, + unsigned long flags);
+static inline +const struct resource *fixed_io_resource_f(struct device *dev, unsigned long index, + uint16_t base, uint16_t size, unsigned long flags) +{ + return fixed_resource_idx(dev, index, base, size, IORESOURCE_IO | flags); +}
static inline const struct resource *fixed_io_resource(struct device *dev, unsigned long index, @@ -328,9 +335,12 @@ IORESOURCE_SUBTRACTIVE); }
+static inline const struct resource *fixed_mem_resource_f(struct device *dev, unsigned long index, - uint64_t base, uint64_t size, - unsigned long flags); + uint64_t base, uint64_t size, unsigned long flags) +{ + return fixed_resource_idx(dev, index, base, size, IORESOURCE_MEM | flags); +}
static inline const struct resource *fixed_mem_resource(struct device *dev, unsigned long index,