summaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
authorSubrata Banik <subrata.banik@intel.com>2019-03-15 17:18:44 +0530
committerSubrata Banik <subrata.banik@intel.com>2019-03-17 03:45:50 +0000
commit217ca36377f25f8896b6fee2f4c4700580f5e412 (patch)
tree6717929c79f1ee13ba0494947ba1232ff7bdc01a /src/device
parent41483c9dff9bd68b4c67b947c4cd7175951b9723 (diff)
downloadcoreboot-217ca36377f25f8896b6fee2f4c4700580f5e412.tar.xz
resources: introduce io_resource()
This patch creates new resource function to perform allocation of IO resource, similar to mmio_resource() function does for MMIO. Change-Id: I3fdcabb14302537d6074bfd6a362690c06b66bb5 Signed-off-by: Subrata Banik <subrata.banik@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/31911 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Lijian Zhao <lijian.zhao@intel.com>
Diffstat (limited to 'src/device')
-rw-r--r--src/device/device_util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/device/device_util.c b/src/device/device_util.c
index 38207ebfb8..5c4f911b8b 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -801,6 +801,20 @@ void fixed_mem_resource(struct device *dev, unsigned long index,
resource->flags |= type;
}
+void fixed_io_resource(struct device *dev, unsigned long index,
+ unsigned long base, unsigned long size)
+{
+ struct resource *resource;
+
+ resource = new_resource(dev, index);
+ resource->base = (resource_t)base;
+ resource->size = (resource_t)size;
+ resource->limit = resource->base + resource->size - 1;
+ resource->flags = IORESOURCE_IO | IORESOURCE_FIXED |
+ IORESOURCE_STORED | IORESOURCE_ASSIGNED |
+ IORESOURCE_RESERVE;
+}
+
void mmconf_resource_init(struct resource *resource, resource_t base,
int buses)
{