summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resource.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2015-02-01 21:42:52 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-02-03 16:27:19 -0500
commit72e26b0d487fc494f40aa61e10a0757791e62e36 (patch)
treeda73aa6333c8b1eda30e35f33839c6ed7f8d735b /drivers/acpi/resource.c
parenteb76d55e66a9bed2359cc5a0f08168b287c4dea8 (diff)
ACPI: Move the window flag logic to the combined parser
Normal memory and io resources have window always set to false. Move the flag logic to the unified address space parser. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/resource.c')
-rw-r--r--drivers/acpi/resource.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index 99903d196024..15d17937c431 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -53,7 +53,7 @@ static bool acpi_dev_resource_len_valid(u64 start, u64 end, u64 len, bool io)
53} 53}
54 54
55static void acpi_dev_memresource_flags(struct resource *res, u64 len, 55static void acpi_dev_memresource_flags(struct resource *res, u64 len,
56 u8 write_protect, bool window) 56 u8 write_protect)
57{ 57{
58 res->flags = IORESOURCE_MEM; 58 res->flags = IORESOURCE_MEM;
59 59
@@ -62,9 +62,6 @@ static void acpi_dev_memresource_flags(struct resource *res, u64 len,
62 62
63 if (write_protect == ACPI_READ_WRITE_MEMORY) 63 if (write_protect == ACPI_READ_WRITE_MEMORY)
64 res->flags |= IORESOURCE_MEM_WRITEABLE; 64 res->flags |= IORESOURCE_MEM_WRITEABLE;
65
66 if (window)
67 res->flags |= IORESOURCE_WINDOW;
68} 65}
69 66
70static void acpi_dev_get_memresource(struct resource *res, u64 start, u64 len, 67static void acpi_dev_get_memresource(struct resource *res, u64 start, u64 len,
@@ -72,7 +69,7 @@ static void acpi_dev_get_memresource(struct resource *res, u64 start, u64 len,
72{ 69{
73 res->start = start; 70 res->start = start;
74 res->end = start + len - 1; 71 res->end = start + len - 1;
75 acpi_dev_memresource_flags(res, len, write_protect, false); 72 acpi_dev_memresource_flags(res, len, write_protect);
76} 73}
77 74
78/** 75/**
@@ -118,7 +115,7 @@ bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res)
118EXPORT_SYMBOL_GPL(acpi_dev_resource_memory); 115EXPORT_SYMBOL_GPL(acpi_dev_resource_memory);
119 116
120static void acpi_dev_ioresource_flags(struct resource *res, u64 len, 117static void acpi_dev_ioresource_flags(struct resource *res, u64 len,
121 u8 io_decode, bool window) 118 u8 io_decode)
122{ 119{
123 res->flags = IORESOURCE_IO; 120 res->flags = IORESOURCE_IO;
124 121
@@ -130,9 +127,6 @@ static void acpi_dev_ioresource_flags(struct resource *res, u64 len,
130 127
131 if (io_decode == ACPI_DECODE_16) 128 if (io_decode == ACPI_DECODE_16)
132 res->flags |= IORESOURCE_IO_16BIT_ADDR; 129 res->flags |= IORESOURCE_IO_16BIT_ADDR;
133
134 if (window)
135 res->flags |= IORESOURCE_WINDOW;
136} 130}
137 131
138static void acpi_dev_get_ioresource(struct resource *res, u64 start, u64 len, 132static void acpi_dev_get_ioresource(struct resource *res, u64 start, u64 len,
@@ -140,7 +134,7 @@ static void acpi_dev_get_ioresource(struct resource *res, u64 start, u64 len,
140{ 134{
141 res->start = start; 135 res->start = start;
142 res->end = start + len - 1; 136 res->end = start + len - 1;
143 acpi_dev_ioresource_flags(res, len, io_decode, false); 137 acpi_dev_ioresource_flags(res, len, io_decode);
144} 138}
145 139
146/** 140/**
@@ -183,7 +177,6 @@ static bool acpi_decode_space(struct resource *res,
183 struct acpi_address64_attribute *attr) 177 struct acpi_address64_attribute *attr)
184{ 178{
185 u8 iodec = attr->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16; 179 u8 iodec = attr->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16;
186 bool window = addr->producer_consumer == ACPI_PRODUCER;
187 bool wp = addr->info.mem.write_protect; 180 bool wp = addr->info.mem.write_protect;
188 u64 len = attr->address_length; 181 u64 len = attr->address_length;
189 182
@@ -192,10 +185,10 @@ static bool acpi_decode_space(struct resource *res,
192 185
193 switch (addr->resource_type) { 186 switch (addr->resource_type) {
194 case ACPI_MEMORY_RANGE: 187 case ACPI_MEMORY_RANGE:
195 acpi_dev_memresource_flags(res, len, wp, window); 188 acpi_dev_memresource_flags(res, len, wp);
196 break; 189 break;
197 case ACPI_IO_RANGE: 190 case ACPI_IO_RANGE:
198 acpi_dev_ioresource_flags(res, len, iodec, window); 191 acpi_dev_ioresource_flags(res, len, iodec);
199 break; 192 break;
200 case ACPI_BUS_NUMBER_RANGE: 193 case ACPI_BUS_NUMBER_RANGE:
201 res->flags = IORESOURCE_BUS; 194 res->flags = IORESOURCE_BUS;
@@ -204,6 +197,9 @@ static bool acpi_decode_space(struct resource *res,
204 return false; 197 return false;
205 } 198 }
206 199
200 if (addr->producer_consumer == ACPI_PRODUCER)
201 res->flags |= IORESOURCE_WINDOW;
202
207 return !(res->flags & IORESOURCE_DISABLED); 203 return !(res->flags & IORESOURCE_DISABLED);
208} 204}
209 205