aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-04-28 23:40:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-04-28 23:40:17 -0400
commit79dba2eaa771c3173957eccfd288e0e0d12e4d3f (patch)
tree4cafc47b8eaed5d40b2d8705c9f9036fe6b463d3
parentd9e80b7de91db05c1c4d2e5ebbfd70b3b3ba0e0f (diff)
parent48728e077480910df45baabc5f87b04276348c90 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: x86/PCI: compute Address Space length rather than using _LEN x86/PCI: never allocate PCI MMIO resources below BIOS_END
-rw-r--r--arch/x86/pci/acpi.c40
-rw-r--r--arch/x86/pci/i386.c3
2 files changed, 5 insertions, 38 deletions
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 44f83ce02470..31930fd30ea9 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -121,30 +121,6 @@ count_resource(struct acpi_resource *acpi_res, void *data)
121 return AE_OK; 121 return AE_OK;
122} 122}
123 123
124static void
125align_resource(struct acpi_device *bridge, struct resource *res)
126{
127 int align = (res->flags & IORESOURCE_MEM) ? 16 : 4;
128
129 /*
130 * Host bridge windows are not BARs, but the decoders on the PCI side
131 * that claim this address space have starting alignment and length
132 * constraints, so fix any obvious BIOS goofs.
133 */
134 if (!IS_ALIGNED(res->start, align)) {
135 dev_printk(KERN_DEBUG, &bridge->dev,
136 "host bridge window %pR invalid; "
137 "aligning start to %d-byte boundary\n", res, align);
138 res->start &= ~(align - 1);
139 }
140 if (!IS_ALIGNED(res->end + 1, align)) {
141 dev_printk(KERN_DEBUG, &bridge->dev,
142 "host bridge window %pR invalid; "
143 "aligning end to %d-byte boundary\n", res, align);
144 res->end = ALIGN(res->end, align) - 1;
145 }
146}
147
148static acpi_status 124static acpi_status
149setup_resource(struct acpi_resource *acpi_res, void *data) 125setup_resource(struct acpi_resource *acpi_res, void *data)
150{ 126{
@@ -154,7 +130,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
154 acpi_status status; 130 acpi_status status;
155 unsigned long flags; 131 unsigned long flags;
156 struct resource *root, *conflict; 132 struct resource *root, *conflict;
157 u64 start, end, max_len; 133 u64 start, end;
158 134
159 status = resource_to_addr(acpi_res, &addr); 135 status = resource_to_addr(acpi_res, &addr);
160 if (!ACPI_SUCCESS(status)) 136 if (!ACPI_SUCCESS(status))
@@ -171,19 +147,8 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
171 } else 147 } else
172 return AE_OK; 148 return AE_OK;
173 149
174 max_len = addr.maximum - addr.minimum + 1;
175 if (addr.address_length > max_len) {
176 dev_printk(KERN_DEBUG, &info->bridge->dev,
177 "host bridge window length %#llx doesn't fit in "
178 "%#llx-%#llx, trimming\n",
179 (unsigned long long) addr.address_length,
180 (unsigned long long) addr.minimum,
181 (unsigned long long) addr.maximum);
182 addr.address_length = max_len;
183 }
184
185 start = addr.minimum + addr.translation_offset; 150 start = addr.minimum + addr.translation_offset;
186 end = start + addr.address_length - 1; 151 end = addr.maximum + addr.translation_offset;
187 152
188 res = &info->res[info->res_num]; 153 res = &info->res[info->res_num];
189 res->name = info->name; 154 res->name = info->name;
@@ -191,7 +156,6 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
191 res->start = start; 156 res->start = start;
192 res->end = end; 157 res->end = end;
193 res->child = NULL; 158 res->child = NULL;
194 align_resource(info->bridge, res);
195 159
196 if (!pci_use_crs) { 160 if (!pci_use_crs) {
197 dev_printk(KERN_DEBUG, &info->bridge->dev, 161 dev_printk(KERN_DEBUG, &info->bridge->dev,
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 46fd43f79103..97da2ba9344b 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -72,6 +72,9 @@ pcibios_align_resource(void *data, const struct resource *res,
72 return start; 72 return start;
73 if (start & 0x300) 73 if (start & 0x300)
74 start = (start + 0x3ff) & ~0x3ff; 74 start = (start + 0x3ff) & ~0x3ff;
75 } else if (res->flags & IORESOURCE_MEM) {
76 if (start < BIOS_END)
77 start = BIOS_END;
75 } 78 }
76 return start; 79 return start;
77} 80}