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.c144
1 files changed, 87 insertions, 57 deletions
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c
index 7f46ca0bf33a..8c128dea3252 100644
--- a/drivers/acpi/resources/rscreate.c
+++ b/drivers/acpi/resources/rscreate.c
@@ -207,14 +207,20 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
207 /* Each element of the top-level package must also be a package */ 207 /* Each element of the top-level package must also be a package */
208 208
209 if (ACPI_GET_OBJECT_TYPE(*top_object_list) != ACPI_TYPE_PACKAGE) { 209 if (ACPI_GET_OBJECT_TYPE(*top_object_list) != ACPI_TYPE_PACKAGE) {
210 ACPI_REPORT_ERROR(("(PRT[%X]) Need sub-package, found %s\n", index, acpi_ut_get_object_type_name(*top_object_list))); 210 ACPI_ERROR((AE_INFO,
211 "(PRT[%X]) Need sub-package, found %s",
212 index,
213 acpi_ut_get_object_type_name
214 (*top_object_list)));
211 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 215 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
212 } 216 }
213 217
214 /* Each sub-package must be of length 4 */ 218 /* Each sub-package must be of length 4 */
215 219
216 if ((*top_object_list)->package.count != 4) { 220 if ((*top_object_list)->package.count != 4) {
217 ACPI_REPORT_ERROR(("(PRT[%X]) Need package of length 4, found length %d\n", index, (*top_object_list)->package.count)); 221 ACPI_ERROR((AE_INFO,
222 "(PRT[%X]) Need package of length 4, found length %d",
223 index, (*top_object_list)->package.count));
218 return_ACPI_STATUS(AE_AML_PACKAGE_LIMIT); 224 return_ACPI_STATUS(AE_AML_PACKAGE_LIMIT);
219 } 225 }
220 226
@@ -231,7 +237,10 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
231 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 237 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
232 user_prt->address = obj_desc->integer.value; 238 user_prt->address = obj_desc->integer.value;
233 } else { 239 } else {
234 ACPI_REPORT_ERROR(("(PRT[%X].Address) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); 240 ACPI_ERROR((AE_INFO,
241 "(PRT[%X].Address) Need Integer, found %s",
242 index,
243 acpi_ut_get_object_type_name(obj_desc)));
235 return_ACPI_STATUS(AE_BAD_DATA); 244 return_ACPI_STATUS(AE_BAD_DATA);
236 } 245 }
237 246
@@ -241,65 +250,83 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
241 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 250 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
242 user_prt->pin = (u32) obj_desc->integer.value; 251 user_prt->pin = (u32) obj_desc->integer.value;
243 } else { 252 } else {
244 ACPI_REPORT_ERROR(("(PRT[%X].Pin) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); 253 ACPI_ERROR((AE_INFO,
254 "(PRT[%X].Pin) Need Integer, found %s",
255 index,
256 acpi_ut_get_object_type_name(obj_desc)));
245 return_ACPI_STATUS(AE_BAD_DATA); 257 return_ACPI_STATUS(AE_BAD_DATA);
246 } 258 }
247 259
248 /* 3) Third subobject: Dereference the PRT.source_name */ 260 /*
249 261 * 3) Third subobject: Dereference the PRT.source_name
262 * The name may be unresolved (slack mode), so allow a null object
263 */
250 obj_desc = sub_object_list[2]; 264 obj_desc = sub_object_list[2];
251 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { 265 if (obj_desc) {
252 case ACPI_TYPE_LOCAL_REFERENCE: 266 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
253 267 case ACPI_TYPE_LOCAL_REFERENCE:
254 if (obj_desc->reference.opcode != AML_INT_NAMEPATH_OP) { 268
255 ACPI_REPORT_ERROR(("(PRT[%X].Source) Need name, found reference op %X\n", index, obj_desc->reference.opcode)); 269 if (obj_desc->reference.opcode !=
270 AML_INT_NAMEPATH_OP) {
271 ACPI_ERROR((AE_INFO,
272 "(PRT[%X].Source) Need name, found reference op %X",
273 index,
274 obj_desc->reference.
275 opcode));
276 return_ACPI_STATUS(AE_BAD_DATA);
277 }
278
279 node = obj_desc->reference.node;
280
281 /* Use *remaining* length of the buffer as max for pathname */
282
283 path_buffer.length = output_buffer->length -
284 (u32) ((u8 *) user_prt->source -
285 (u8 *) output_buffer->pointer);
286 path_buffer.pointer = user_prt->source;
287
288 status =
289 acpi_ns_handle_to_pathname((acpi_handle)
290 node,
291 &path_buffer);
292
293 /* +1 to include null terminator */
294
295 user_prt->length +=
296 (u32) ACPI_STRLEN(user_prt->source) + 1;
297 break;
298
299 case ACPI_TYPE_STRING:
300
301 ACPI_STRCPY(user_prt->source,
302 obj_desc->string.pointer);
303
304 /*
305 * Add to the Length field the length of the string
306 * (add 1 for terminator)
307 */
308 user_prt->length += obj_desc->string.length + 1;
309 break;
310
311 case ACPI_TYPE_INTEGER:
312 /*
313 * If this is a number, then the Source Name is NULL, since the
314 * entire buffer was zeroed out, we can leave this alone.
315 *
316 * Add to the Length field the length of the u32 NULL
317 */
318 user_prt->length += sizeof(u32);
319 break;
320
321 default:
322
323 ACPI_ERROR((AE_INFO,
324 "(PRT[%X].Source) Need Ref/String/Integer, found %s",
325 index,
326 acpi_ut_get_object_type_name
327 (obj_desc)));
256 return_ACPI_STATUS(AE_BAD_DATA); 328 return_ACPI_STATUS(AE_BAD_DATA);
257 } 329 }
258
259 node = obj_desc->reference.node;
260
261 /* Use *remaining* length of the buffer as max for pathname */
262
263 path_buffer.length = output_buffer->length -
264 (u32) ((u8 *) user_prt->source -
265 (u8 *) output_buffer->pointer);
266 path_buffer.pointer = user_prt->source;
267
268 status =
269 acpi_ns_handle_to_pathname((acpi_handle) node,
270 &path_buffer);
271
272 /* +1 to include null terminator */
273
274 user_prt->length +=
275 (u32) ACPI_STRLEN(user_prt->source) + 1;
276 break;
277
278 case ACPI_TYPE_STRING:
279
280 ACPI_STRCPY(user_prt->source, obj_desc->string.pointer);
281
282 /*
283 * Add to the Length field the length of the string
284 * (add 1 for terminator)
285 */
286 user_prt->length += obj_desc->string.length + 1;
287 break;
288
289 case ACPI_TYPE_INTEGER:
290 /*
291 * If this is a number, then the Source Name is NULL, since the
292 * entire buffer was zeroed out, we can leave this alone.
293 *
294 * Add to the Length field the length of the u32 NULL
295 */
296 user_prt->length += sizeof(u32);
297 break;
298
299 default:
300
301 ACPI_REPORT_ERROR(("(PRT[%X].Source) Need Ref/String/Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc)));
302 return_ACPI_STATUS(AE_BAD_DATA);
303 } 330 }
304 331
305 /* Now align the current length */ 332 /* Now align the current length */
@@ -313,7 +340,10 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
313 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 340 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
314 user_prt->source_index = (u32) obj_desc->integer.value; 341 user_prt->source_index = (u32) obj_desc->integer.value;
315 } else { 342 } else {
316 ACPI_REPORT_ERROR(("(PRT[%X].source_index) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); 343 ACPI_ERROR((AE_INFO,
344 "(PRT[%X].source_index) Need Integer, found %s",
345 index,
346 acpi_ut_get_object_type_name(obj_desc)));
317 return_ACPI_STATUS(AE_BAD_DATA); 347 return_ACPI_STATUS(AE_BAD_DATA);
318 } 348 }
319 349