aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rscreate.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/resources/rscreate.c')
-rw-r--r--drivers/acpi/resources/rscreate.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c
index a3a0cbfda68d..8e0eae0d50bb 100644
--- a/drivers/acpi/resources/rscreate.c
+++ b/drivers/acpi/resources/rscreate.c
@@ -87,9 +87,8 @@ acpi_rs_create_resource_list (
87 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_buffer = %p\n", 87 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_buffer = %p\n",
88 byte_stream_buffer)); 88 byte_stream_buffer));
89 89
90 /* 90 /* Params already validated, so we don't re-validate here */
91 * Params already validated, so we don't re-validate here 91
92 */
93 byte_stream_buffer_length = byte_stream_buffer->buffer.length; 92 byte_stream_buffer_length = byte_stream_buffer->buffer.length;
94 byte_stream_start = byte_stream_buffer->buffer.pointer; 93 byte_stream_start = byte_stream_buffer->buffer.pointer;
95 94
@@ -171,9 +170,8 @@ acpi_rs_create_pci_routing_table (
171 170
172 /* Params already validated, so we don't re-validate here */ 171 /* Params already validated, so we don't re-validate here */
173 172
174 /* 173 /* Get the required buffer length */
175 * Get the required buffer length 174
176 */
177 status = acpi_rs_get_pci_routing_table_length (package_object, 175 status = acpi_rs_get_pci_routing_table_length (package_object,
178 &buffer_size_needed); 176 &buffer_size_needed);
179 if (ACPI_FAILURE (status)) { 177 if (ACPI_FAILURE (status)) {
@@ -217,9 +215,8 @@ acpi_rs_create_pci_routing_table (
217 */ 215 */
218 user_prt->length = (sizeof (struct acpi_pci_routing_table) - 4); 216 user_prt->length = (sizeof (struct acpi_pci_routing_table) - 4);
219 217
220 /* 218 /* Each element of the top-level package must also be a package */
221 * Each element of the top-level package must also be a package 219
222 */
223 if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) { 220 if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) {
224 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 221 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
225 "(PRT[%X]) Need sub-package, found %s\n", 222 "(PRT[%X]) Need sub-package, found %s\n",
@@ -243,9 +240,8 @@ acpi_rs_create_pci_routing_table (
243 */ 240 */
244 sub_object_list = (*top_object_list)->package.elements; 241 sub_object_list = (*top_object_list)->package.elements;
245 242
246 /* 243 /* 1) First subobject: Dereference the PRT.Address */
247 * 1) First subobject: Dereference the PRT.Address 244
248 */
249 obj_desc = sub_object_list[0]; 245 obj_desc = sub_object_list[0];
250 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { 246 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
251 user_prt->address = obj_desc->integer.value; 247 user_prt->address = obj_desc->integer.value;
@@ -257,9 +253,8 @@ acpi_rs_create_pci_routing_table (
257 return_ACPI_STATUS (AE_BAD_DATA); 253 return_ACPI_STATUS (AE_BAD_DATA);
258 } 254 }
259 255
260 /* 256 /* 2) Second subobject: Dereference the PRT.Pin */
261 * 2) Second subobject: Dereference the PRT.Pin 257
262 */
263 obj_desc = sub_object_list[1]; 258 obj_desc = sub_object_list[1];
264 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { 259 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
265 user_prt->pin = (u32) obj_desc->integer.value; 260 user_prt->pin = (u32) obj_desc->integer.value;
@@ -271,9 +266,8 @@ acpi_rs_create_pci_routing_table (
271 return_ACPI_STATUS (AE_BAD_DATA); 266 return_ACPI_STATUS (AE_BAD_DATA);
272 } 267 }
273 268
274 /* 269 /* 3) Third subobject: Dereference the PRT.source_name */
275 * 3) Third subobject: Dereference the PRT.source_name 270
276 */
277 obj_desc = sub_object_list[2]; 271 obj_desc = sub_object_list[2];
278 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { 272 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
279 case ACPI_TYPE_LOCAL_REFERENCE: 273 case ACPI_TYPE_LOCAL_REFERENCE:
@@ -296,7 +290,9 @@ acpi_rs_create_pci_routing_table (
296 290
297 status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer); 291 status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer);
298 292
299 user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1; /* include null terminator */ 293 /* +1 to include null terminator */
294
295 user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1;
300 break; 296 break;
301 297
302 298
@@ -304,8 +300,10 @@ acpi_rs_create_pci_routing_table (
304 300
305 ACPI_STRCPY (user_prt->source, obj_desc->string.pointer); 301 ACPI_STRCPY (user_prt->source, obj_desc->string.pointer);
306 302
307 /* Add to the Length field the length of the string (add 1 for terminator) */ 303 /*
308 304 * Add to the Length field the length of the string
305 * (add 1 for terminator)
306 */
309 user_prt->length += obj_desc->string.length + 1; 307 user_prt->length += obj_desc->string.length + 1;
310 break; 308 break;
311 309
@@ -333,9 +331,8 @@ acpi_rs_create_pci_routing_table (
333 331
334 user_prt->length = (u32) ACPI_ROUND_UP_to_64_bITS (user_prt->length); 332 user_prt->length = (u32) ACPI_ROUND_UP_to_64_bITS (user_prt->length);
335 333
336 /* 334 /* 4) Fourth subobject: Dereference the PRT.source_index */
337 * 4) Fourth subobject: Dereference the PRT.source_index 335
338 */
339 obj_desc = sub_object_list[3]; 336 obj_desc = sub_object_list[3];
340 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { 337 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
341 user_prt->source_index = (u32) obj_desc->integer.value; 338 user_prt->source_index = (u32) obj_desc->integer.value;