Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 263120
b: refs/heads/master
c: be76891
h: refs/heads/master
v: v3
  • Loading branch information
Yinghai Lu authored and Jesse Barnes committed Aug 1, 2011
1 parent 8af6e81 commit 8527f26
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b03e7495a862b028294f59fc87286d6d78ee7fa1
refs/heads/master: be768912a49b10b68e96fbd8fa3cab0adfbd3091
26 changes: 26 additions & 0 deletions trunk/drivers/pci/setup-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,20 @@ static resource_size_t calculate_memsize(resource_size_t size,
return size;
}

static resource_size_t get_res_add_size(struct resource_list_x *add_head,
struct resource *res)
{
struct resource_list_x *list;

/* check if it is in add_head list */
for (list = add_head->next; list && list->res != res;
list = list->next);
if (list)
return list->add_size;

return 0;
}

/**
* pbus_size_io() - size the io window of a given bus
*
Expand All @@ -559,6 +573,7 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size,
struct pci_dev *dev;
struct resource *b_res = find_free_bus_resource(bus, IORESOURCE_IO);
unsigned long size = 0, size0 = 0, size1 = 0;
resource_size_t children_add_size = 0;

if (!b_res)
return;
Expand All @@ -579,10 +594,15 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size,
size += r_size;
else
size1 += r_size;

if (add_head)
children_add_size += get_res_add_size(add_head, r);
}
}
size0 = calculate_iosize(size, min_size, size1,
resource_size(b_res), 4096);
if (children_add_size > add_size)
add_size = children_add_size;
size1 = (!add_head || (add_head && !add_size)) ? size0 :
calculate_iosize(size, min_size+add_size, size1,
resource_size(b_res), 4096);
Expand Down Expand Up @@ -624,6 +644,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
int order, max_order;
struct resource *b_res = find_free_bus_resource(bus, type);
unsigned int mem64_mask = 0;
resource_size_t children_add_size = 0;

if (!b_res)
return 0;
Expand Down Expand Up @@ -665,6 +686,9 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
if (order > max_order)
max_order = order;
mem64_mask &= r->flags & IORESOURCE_MEM_64;

if (add_head)
children_add_size += get_res_add_size(add_head, r);
}
}
align = 0;
Expand All @@ -681,6 +705,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
align += aligns[order];
}
size0 = calculate_memsize(size, min_size, 0, resource_size(b_res), min_align);
if (children_add_size > add_size)
add_size = children_add_size;
size1 = (!add_head || (add_head && !add_size)) ? size0 :
calculate_memsize(size, min_size+add_size, 0,
resource_size(b_res), min_align);
Expand Down

0 comments on commit 8527f26

Please sign in to comment.