aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resource.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2015-09-01 09:35:24 -0400
committerJiri Kosina <jkosina@suse.cz>2015-09-01 09:35:24 -0400
commit067e2601d3c076abbf45db91261f9065eaa879b2 (patch)
tree86c8d4b913873dbd3b4ff23562a3a8597984b4df /drivers/acpi/resource.c
parent3e097d1271ecdff2f251a54ddfc5eaa1f9821e96 (diff)
parent931830aa5c251e0803523213428f777a48bde254 (diff)
Merge branch 'for-4.3/gembird' into for-linus
Diffstat (limited to 'drivers/acpi/resource.c')
-rw-r--r--drivers/acpi/resource.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index 8244f013f210..f1c966e05078 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -193,6 +193,7 @@ static bool acpi_decode_space(struct resource_win *win,
193 u8 iodec = attr->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16; 193 u8 iodec = attr->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16;
194 bool wp = addr->info.mem.write_protect; 194 bool wp = addr->info.mem.write_protect;
195 u64 len = attr->address_length; 195 u64 len = attr->address_length;
196 u64 start, end, offset = 0;
196 struct resource *res = &win->res; 197 struct resource *res = &win->res;
197 198
198 /* 199 /*
@@ -204,9 +205,6 @@ static bool acpi_decode_space(struct resource_win *win,
204 pr_debug("ACPI: Invalid address space min_addr_fix %d, max_addr_fix %d, len %llx\n", 205 pr_debug("ACPI: Invalid address space min_addr_fix %d, max_addr_fix %d, len %llx\n",
205 addr->min_address_fixed, addr->max_address_fixed, len); 206 addr->min_address_fixed, addr->max_address_fixed, len);
206 207
207 res->start = attr->minimum;
208 res->end = attr->maximum;
209
210 /* 208 /*
211 * For bridges that translate addresses across the bridge, 209 * For bridges that translate addresses across the bridge,
212 * translation_offset is the offset that must be added to the 210 * translation_offset is the offset that must be added to the
@@ -214,12 +212,22 @@ static bool acpi_decode_space(struct resource_win *win,
214 * primary side. Non-bridge devices must list 0 for all Address 212 * primary side. Non-bridge devices must list 0 for all Address
215 * Translation offset bits. 213 * Translation offset bits.
216 */ 214 */
217 if (addr->producer_consumer == ACPI_PRODUCER) { 215 if (addr->producer_consumer == ACPI_PRODUCER)
218 res->start += attr->translation_offset; 216 offset = attr->translation_offset;
219 res->end += attr->translation_offset; 217 else if (attr->translation_offset)
220 } else if (attr->translation_offset) {
221 pr_debug("ACPI: translation_offset(%lld) is invalid for non-bridge device.\n", 218 pr_debug("ACPI: translation_offset(%lld) is invalid for non-bridge device.\n",
222 attr->translation_offset); 219 attr->translation_offset);
220 start = attr->minimum + offset;
221 end = attr->maximum + offset;
222
223 win->offset = offset;
224 res->start = start;
225 res->end = end;
226 if (sizeof(resource_size_t) < sizeof(u64) &&
227 (offset != win->offset || start != res->start || end != res->end)) {
228 pr_warn("acpi resource window ([%#llx-%#llx] ignored, not CPU addressable)\n",
229 attr->minimum, attr->maximum);
230 return false;
223 } 231 }
224 232
225 switch (addr->resource_type) { 233 switch (addr->resource_type) {
@@ -236,8 +244,6 @@ static bool acpi_decode_space(struct resource_win *win,
236 return false; 244 return false;
237 } 245 }
238 246
239 win->offset = attr->translation_offset;
240
241 if (addr->producer_consumer == ACPI_PRODUCER) 247 if (addr->producer_consumer == ACPI_PRODUCER)
242 res->flags |= IORESOURCE_WINDOW; 248 res->flags |= IORESOURCE_WINDOW;
243 249