summaryrefslogtreecommitdiffstats
path: root/src/include/device/device.h
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2021-06-13 08:02:56 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2022-06-26 15:19:53 +0000
commitad5fab23620a25d53d358dbde5f005bbe955e77b (patch)
tree429593ba55873726e47448ab62577ca645770f63 /src/include/device/device.h
parentce34596f74aa1b2b9865061c6d2cdfa223f33222 (diff)
downloadcoreboot-ad5fab23620a25d53d358dbde5f005bbe955e77b.tar.gz
coreboot-ad5fab23620a25d53d358dbde5f005bbe955e77b.tar.bz2
coreboot-ad5fab23620a25d53d358dbde5f005bbe955e77b.zip
device: Add fixed_io_range_flags() and helpers
Function fixed_io_resource() and alias io_resource() were previously unused. Unlike previously, IORESOURCE_STORED flag needs to be set by the caller, when necessary. For fixed resources, fields alignment, granularity and limit need not be initialised, as the resource cannot be moved. It is assumed the caller provides valid base and size parameters. Change-Id: I8fb4cf2dee4f5193e5652648b63c0ecba7b8bab2 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55458 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/include/device/device.h')
-rw-r--r--src/include/device/device.h29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/include/device/device.h b/src/include/device/device.h
index c01830693b77..8f5407dcfc63 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);