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>
This commit is contained in:
Shuo Liu 2024-04-29 18:16:30 +08:00 committed by Lean Sheng Tan
commit 6c708d8a46
5 changed files with 81 additions and 85 deletions

View file

@ -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
@ -284,6 +285,24 @@ 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 *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,