summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/device/device_util.c14
-rw-r--r--src/include/device/device.h29
2 files changed, 23 insertions, 20 deletions
diff --git a/src/device/device_util.c b/src/device/device_util.c
index 9e2c3d5d9b..383e17b0f6 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -841,20 +841,6 @@ const struct resource *fixed_resource_range_idx(struct device *dev, unsigned lon
return resource;
}
-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(struct device *dev, unsigned long index)
{
struct resource *resource = new_resource(dev, index);
diff --git a/src/include/device/device.h b/src/include/device/device.h
index c01830693b..8f5407dcfc 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -307,9 +307,6 @@ void pci_domain_read_resources(struct device *dev);
void pci_domain_set_resources(struct device *dev);
void pci_domain_scan_bus(struct device *dev);
-void fixed_io_resource(struct device *dev, unsigned long index,
- unsigned long base, unsigned long size);
-
void mmconf_resource(struct device *dev, unsigned long index);
/* These are temporary resource constructors to get us through the
@@ -336,6 +333,29 @@ const struct resource *fixed_mem_from_to_flags(struct device *dev, unsigned long
return fixed_mem_range_flags(dev, index, base, end - base, flags);
}
+static inline
+const struct resource *fixed_io_range_flags(struct device *dev, unsigned long index,
+ uint16_t base, uint16_t size, unsigned long flags)
+{
+ return fixed_resource_range_idx(dev, index, base, size, IORESOURCE_IO | flags);
+}
+
+static inline
+const struct resource *fixed_io_from_to_flags(struct device *dev, unsigned long index,
+ uint16_t base, uint16_t end, unsigned long flags)
+{
+ if (end <= base)
+ return NULL;
+ return fixed_io_range_flags(dev, index, base, end - base, flags);
+}
+
+static inline
+const struct resource *fixed_io_range_reserved(struct device *dev, unsigned long index,
+ uint16_t base, uint16_t size)
+{
+ return fixed_io_range_flags(dev, index, base, size, IORESOURCE_RESERVE);
+}
+
/* Compatibility code */
static inline void fixed_mem_resource_kb(struct device *dev, unsigned long index,
@@ -365,9 +385,6 @@ static inline void fixed_mem_resource_kb(struct device *dev, unsigned long index
#define mmio_resource_kb(dev, idx, basek, sizek) \
fixed_mem_resource_kb(dev, idx, basek, sizek, IORESOURCE_RESERVE)
-#define io_resource(dev, idx, base, size) \
- fixed_io_resource(dev, idx, base, size)
-
void tolm_test(void *gp, struct device *dev, struct resource *new);
u32 find_pci_tolm(struct bus *bus);