37 #define res_printk(depth, str, ...) printk(BIOS_DEBUG, "%*c"str, depth, ' ', __VA_ARGS__)
51 unsigned long type_match,
int print_depth)
53 const struct device *child;
56 bool first_child_res =
true;
72 res_printk(print_depth,
"%s %s: size: %llx align: %d gran: %d limit: %llx\n",
92 if (first_child_res && (child_res->
align > bridge_res->
align))
95 first_child_res =
false;
127 res_printk(print_depth + 1,
"%s %02lx * [0x%llx - 0x%llx] %s\n",
142 res_printk(print_depth,
"%s %s: size: %llx align: %d gran: %d limit: %llx done\n",
154 const struct device *child;
159 for (res =
bridge->resource_list; res; res = res->
next) {
163 if ((res->
flags & type_mask) != type_match)
199 const struct device *child;
200 const int print_depth = 1;
225 die(
"Unexpected resource type: flags(%d)!\n", res->
flags);
239 unsigned long memrange_type)
246 unsigned long memrange_type)
253 res_base = res->
base;
254 res_limit = res->
limit;
261 if (res_base <= limit_4g) {
266 range_limit =
MIN(res_limit, limit_4g);
267 memranges_insert(ranges, res_base, range_limit - res_base + 1, memrange_type);
273 if (res_limit <= limit_4g)
280 res_base = limit_4g + 1;
283 if (res_base > res_limit)
303 unsigned long memrange_type)
331 unsigned long memrange_type)
366 unsigned long type_mask,
unsigned long type_match)
418 unsigned long mask_match)
421 const struct device *child;
425 if ((res->
flags & mask_match) != mask_match)
474 printk(
BIOS_DEBUG,
"%s %s: base: %llx size: %llx align: %d gran: %d limit: %llx\n",
492 printk(
BIOS_DEBUG,
"%s %s: base: %llx size: %llx align: %d gran: %d limit: %llx done\n",
516 unsigned long type_match;
520 for (res =
bridge->resource_list; res; res = res->
next) {
527 type_match = res->
flags & type_mask;
660 const struct device *child;
673 printk(
BIOS_INFO,
"=== Resource allocator: %s - Pass 1 (gathering requirements) ===\n",
678 printk(
BIOS_INFO,
"=== Resource allocator: %s - Pass 2 (allocating resources) ===\n",
682 printk(
BIOS_INFO,
"=== Resource allocator: %s - resource allocation complete ===\n",
#define printk(level,...)
void __noreturn die(const char *fmt,...)
const char * dev_path(const struct device *dev)
#define BIOS_INFO
BIOS_INFO - Expected events.
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
bool memranges_steal(struct memranges *ranges, resource_t limit, resource_t size, unsigned char align, unsigned long tag, resource_t *stolen_base)
static resource_t range_entry_base(const struct range_entry *r)
static bool memranges_is_empty(const struct memranges *ranges)
void memranges_create_hole(struct memranges *ranges, resource_t base, resource_t size)
#define memranges_each_entry(r, ranges)
static unsigned long range_entry_tag(const struct range_entry *r)
void memranges_teardown(struct memranges *ranges)
void memranges_insert(struct memranges *ranges, resource_t base, resource_t size, unsigned long tag)
void memranges_init_empty_with_alignment(struct memranges *ranges, struct range_entry *free, size_t num_free, unsigned char align)
static resource_t range_entry_size(const struct range_entry *r)
static const PCI_SUBCLASS bridge[]
static void post_log_path(const struct device *dev)
#define IORESOURCE_ABOVE_4G
#define IORESOURCE_ASSIGNED
#define IORESOURCE_TYPE_MASK
#define IORESOURCE_PREFETCH
#define IORESOURCE_BRIDGE
const struct device * largest_resource(struct bus *bus, struct resource **result_res, unsigned long type_mask, unsigned long type)
static resource_t round(resource_t val, unsigned long pow)
Round a number up to an alignment.
static void initialize_domain_memranges(struct memranges *ranges, const struct resource *res, unsigned long memrange_type)
static unsigned char get_alignment_by_resource_type(const struct resource *res)
#define res_printk(depth, str,...)
static void update_bridge_resource(const struct device *bridge, struct resource *bridge_res, unsigned long type_match, int print_depth)
static void initialize_domain_mem_resource_memranges(struct memranges *ranges, const struct resource *res, unsigned long memrange_type)
static void update_constraints(struct memranges *ranges, const struct device *dev, const struct resource *res)
static void cleanup_resource_ranges(const struct device *dev, struct memranges *ranges, const struct resource *res)
static void constrain_domain_resources(const struct device *domain, struct memranges *ranges, unsigned long type)
static void avoid_fixed_resources(struct memranges *ranges, const struct device *dev, unsigned long mask_match)
static void setup_resource_ranges(const struct device *dev, const struct resource *res, unsigned long type, struct memranges *ranges)
static void allocate_domain_resources(const struct device *domain)
static void initialize_bridge_memranges(struct memranges *ranges, const struct resource *res, unsigned long memrange_type)
static const char * resource2str(const struct resource *res)
static bool is_resource_invalid(const struct resource *res)
void allocate_resources(const struct device *root)
static const struct resource * find_domain_resource(const struct device *domain, unsigned long type)
static void allocate_child_resources(struct bus *bus, struct memranges *ranges, unsigned long type_mask, unsigned long type_match)
static void allocate_bridge_resources(const struct device *bridge)
static void initialize_domain_io_resource_memranges(struct memranges *ranges, const struct resource *res, unsigned long memrange_type)
static bool dev_has_children(const struct device *dev)
static void print_resource_ranges(const struct device *dev, const struct memranges *ranges)
static void compute_bridge_resources(const struct device *bridge, unsigned long type_match, int print_depth)
static void compute_domain_resources(const struct device *domain)
DEVTREE_CONST struct device * children
DEVTREE_CONST struct device * dev
enum device_path_type type
DEVTREE_CONST struct device * sibling
DEVTREE_CONST struct bus * link_list
DEVTREE_CONST struct resource * resource_list
DEVTREE_CONST struct resource * next