===================================================================
@@ -1094,7 +1094,7 @@ void __init e820_reserve_resources(void)
* pci device BAR resource and insert them later in
* pcibios_resource_survey()
*/
- if (e820.map[i].type != E820_RESERVED || res->start < (1ULL<<20)) {
+ if (e820.map[i].type != E820_RESERVED) {
res->flags |= IORESOURCE_BUSY;
insert_resource(&iomem_resource, res);
}
@@ -1135,8 +1135,12 @@ void __init e820_reserve_resources_late(
res = e820_res;
for (i = 0; i < e820.nr_map; i++) {
- if (!res->parent && res->end)
- insert_resource_expand_to_fit(&iomem_resource, res);
+ if (!res->parent && res->end) {
+ if (res->start < (1ULL<<20))
+ reserve_region_with_split_check_child(&iomem_resource, res->start, res->end, res->name);
+ else
+ insert_resource_expand_to_fit(&iomem_resource, res);
+ }
res++;
}
===================================================================
@@ -120,6 +120,9 @@ void release_child_resources(struct reso
extern void reserve_region_with_split(struct resource *root,
resource_size_t start, resource_size_t end,
const char *name);
+void reserve_region_with_split_check_child(struct resource *root,
+ resource_size_t start, resource_size_t end,
+ const char *name);
extern struct resource *insert_resource_conflict(struct resource *parent, struct resource *new);
extern int insert_resource(struct resource *parent, struct resource *new);
extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new);
===================================================================
@@ -609,7 +609,7 @@ int adjust_resource(struct resource *res
static void __init __reserve_region_with_split(struct resource *root,
resource_size_t start, resource_size_t end,
- const char *name)
+ const char *name, bool check_child)
{
struct resource *parent = root;
struct resource *conflict;
@@ -631,13 +631,18 @@ static void __init __reserve_region_with
kfree(res);
/* conflict covered whole area */
- if (conflict->start <= start && conflict->end >= end)
+ if (conflict->start <= start && conflict->end >= end) {
+ if (check_child && !conflict->child && strstr(conflict->name, "PCI Bus"))
+ __reserve_region_with_split(conflict, start, end, name, false);
return;
+ }
if (conflict->start > start)
- __reserve_region_with_split(root, start, conflict->start-1, name);
+ __reserve_region_with_split(root, start, conflict->start-1, name, check_child);
if (conflict->end < end)
- __reserve_region_with_split(root, conflict->end+1, end, name);
+ __reserve_region_with_split(root, conflict->end+1, end, name, check_child);
+ if (check_child && !conflict->child && strstr(conflict->name, "PCI Bus"))
+ __reserve_region_with_split(conflict, conflict->start, conflict->end, name, false);
}
void __init reserve_region_with_split(struct resource *root,
@@ -645,7 +650,16 @@ void __init reserve_region_with_split(st
const char *name)
{
write_lock(&resource_lock);
- __reserve_region_with_split(root, start, end, name);
+ __reserve_region_with_split(root, start, end, name, false);
+ write_unlock(&resource_lock);
+}
+
+void __init reserve_region_with_split_check_child(struct resource *root,
+ resource_size_t start, resource_size_t end,
+ const char *name)
+{
+ write_lock(&resource_lock);
+ __reserve_region_with_split(root, start, end, name, true);
write_unlock(&resource_lock);
}