summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorShuo Liu <shuo.liu@intel.com>2024-04-29 18:16:30 +0800
committerLean Sheng Tan <sheng.tan@9elements.com>2024-05-28 09:45:35 +0000
commit6c708d8a467e7027cd841896b8f5cbc8555fb254 (patch)
treef7bf2633ce752731d385bd69bc55e25ca5a5ee33 /src/include
parent94bfdd12821d0473e8bac1920342b0271a3771d5 (diff)
soc/intel/xeon_sp: Add domain resource window creation utils
It might be benefical to have utils for domain resource window creation so that the correct IORESOURCE flags used could be guaranteed. TEST=Build and boot on intel/archercity CRB TEST=Build on intel/avenuecity CRB Change-Id: I1e90512a48ab002a1c1d5031585ddadaac63673e Signed-off-by: Shuo Liu <shuo.liu@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/82103 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/device/device.h43
1 files changed, 40 insertions, 3 deletions
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 48e539f8dc..367635a952 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -263,7 +263,7 @@ void mmconf_resource(struct device *dev, unsigned long index);
/* These are temporary resource constructors to get us through the
migration away from open-coding all the IORESOURCE_FLAGS. */
-const struct resource *fixed_resource_range_idx(struct device *dev, unsigned long index,
+const struct resource *resource_range_idx(struct device *dev, unsigned long index,
uint64_t base, uint64_t size,
unsigned long flags);
@@ -272,7 +272,8 @@ const struct resource *fixed_mem_range_flags(struct device *dev, unsigned long i
uint64_t base, uint64_t size,
unsigned long flags)
{
- return fixed_resource_range_idx(dev, index, base, size, IORESOURCE_MEM | flags);
+ return resource_range_idx(dev, index, base, size,
+ IORESOURCE_FIXED | IORESOURCE_MEM | flags);
}
static inline
@@ -285,6 +286,24 @@ const struct resource *fixed_mem_from_to_flags(struct device *dev, unsigned long
}
static inline
+const struct resource *domain_mem_window_range(struct device *dev, unsigned long index,
+ uint64_t base, uint64_t size)
+{
+ return resource_range_idx(dev, index, base, size,
+ IORESOURCE_MEM | IORESOURCE_BRIDGE);
+}
+
+static inline
+const struct resource *domain_mem_window_from_to(struct device *dev, unsigned long index,
+ uint64_t base, uint64_t end)
+{
+ if (end <= base)
+ return NULL;
+ return domain_mem_window_range(dev, index, base, end - base);
+}
+
+
+static inline
const struct resource *ram_range(struct device *dev, unsigned long index, uint64_t base,
uint64_t size)
{
@@ -344,7 +363,8 @@ 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);
+ return resource_range_idx(dev, index, base, size,
+ IORESOURCE_FIXED | IORESOURCE_IO | flags);
}
static inline
@@ -363,6 +383,23 @@ const struct resource *fixed_io_range_reserved(struct device *dev, unsigned long
return fixed_io_range_flags(dev, index, base, size, IORESOURCE_RESERVE);
}
+static inline
+const struct resource *domain_io_window_range(struct device *dev, unsigned long index,
+ uint16_t base, uint16_t size)
+{
+ return resource_range_idx(dev, index, base, size,
+ IORESOURCE_IO | IORESOURCE_BRIDGE);
+}
+
+static inline
+const struct resource *domain_io_window_from_to(struct device *dev, unsigned long index,
+ uint16_t base, uint16_t end)
+{
+ if (end <= base)
+ return NULL;
+ return domain_io_window_range(dev, index, base, end - base);
+}
+
/* Compatibility code */
static inline void fixed_mem_resource_kb(struct device *dev, unsigned long index,