Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1184137
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Yinghai Lu <yinghai@kernel.org> |
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 27/49] PCI: Unifiy calculate_size for io port and mmio |
| Date | Wed, 15 Jul 2015 01:50:01 +0200 |
| Message-ID | <pMi7v-72M-1@gated-at.bofh.it> (permalink) |
| References | <pMhbr-5GX-3@gated-at.bofh.it> |
| X-Original-To | Bjorn Helgaas <bhelgaas@google.com>, David Miller <davem@davemloft.net>, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Wei Yang <weiyang@linux.vnet.ibm.com>, TJ <linux@iam.tj>, Yijing Wang <wangyijing@huawei.com> |
| X-Mailer | git-send-email 1.8.4.5 |
| X-Source-IP | userv0022.oracle.com [156.151.31.74] |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 91 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Andrew Morton <akpm@linux-foundation.org>, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu <yinghai@kernel.org> |
| X-Original-Date | Tue, 14 Jul 2015 15:46:58 -0700 |
| X-Original-Message-ID | <1436914040-13206-28-git-send-email-yinghai@kernel.org> |
| X-Original-References | <1436914040-13206-1-git-send-email-yinghai@kernel.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | aioe.org linux.kernel:1184137 |
Show key headers only | View raw
We should check size+size1 with min_size for io port.
For example, when hotplug bridge has two children bridges,
every child bridge will need 0x1000, so size1 will be 0x2000
and size is 0. The min_size for the hotplug bridge is 0x100.
with old version calculate_iosize, we get 0x3000 for final
size because we are using size to compare with min_size. That is
not right, we should use 0x2000 instead.
After this change, calculate_memsize and calculate_iosize
is the same.
Change them to calculate_size.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
drivers/pci/setup-bus.c | 27 ++++++---------------------
1 file changed, 6 insertions(+), 21 deletions(-)
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 9d5e550..969a0b1 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1116,23 +1116,7 @@ static struct resource *find_free_bus_resource(struct pci_bus *bus,
return NULL;
}
-static resource_size_t calculate_iosize(resource_size_t size,
- resource_size_t min_size,
- resource_size_t size1,
- resource_size_t old_size,
- resource_size_t align)
-{
- if (size < min_size)
- size = min_size;
- if (old_size == 1)
- old_size = 0;
- size = ALIGN(size + size1, align);
- if (size < old_size)
- size = old_size;
- return size;
-}
-
-static resource_size_t calculate_memsize(resource_size_t size,
+static resource_size_t calculate_size(resource_size_t size,
resource_size_t min_size,
resource_size_t old_size,
resource_size_t align)
@@ -1257,14 +1241,15 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size,
}
size = size_aligned_for_isa(size);
- size0 = calculate_iosize(size, min_size, size1,
+ size += size1;
+ size0 = calculate_size(size, min_size,
resource_size(b_res), min_align);
sum_add_size = size_aligned_for_isa(sum_add_size);
sum_add_size += sum_add_size1;
if (sum_add_size < min_sum_size)
sum_add_size = min_sum_size;
size1 = !realloc_head ? size0 :
- calculate_iosize(sum_add_size, min_size, 0,
+ calculate_size(sum_add_size, min_size,
resource_size(b_res), min_align);
if (!size0 && !size1) {
if (b_res->start || b_res->end)
@@ -1617,7 +1602,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
if (size || min_size) {
min_align = calculate_mem_align(&align_test_list, max_align,
size, window_align);
- size0 = calculate_memsize(size, min_size,
+ size0 = calculate_size(size, min_size,
resource_size(b_res), min_align);
}
free_align_test_list(&align_test_list);
@@ -1642,7 +1627,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
min_add_align = calculate_mem_align(&align_test_add_list,
max_add_align, sum_add_size,
window_align);
- size1 = calculate_memsize(sum_add_size, min_size,
+ size1 = calculate_size(sum_add_size, min_size,
resource_size(b_res), min_add_align);
}
free_align_test_list(&align_test_add_list);
--
1.8.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH v2 27/49] PCI: Unifiy calculate_size for io port and mmio Yinghai Lu <yinghai@kernel.org> - 2015-07-15 01:50 +0200
csiph-web