rscreate.c (cb5629b10d64a8006622ce3a52bc887d91057d69) rscreate.c (3371c19c294a4cb3649aa4e84606be8a1d999e61)
1/*******************************************************************************
2 *
3 * Module Name: rscreate - Create resource lists/tables
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.

--- 198 unchanged lines hidden (view full) ---

207 * Fill in the Length field with the information we have at this point.
208 * The minus four is to subtract the size of the u8 Source[4] member
209 * because it is added below.
210 */
211 user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4);
212
213 /* Each element of the top-level package must also be a package */
214
1/*******************************************************************************
2 *
3 * Module Name: rscreate - Create resource lists/tables
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.

--- 198 unchanged lines hidden (view full) ---

207 * Fill in the Length field with the information we have at this point.
208 * The minus four is to subtract the size of the u8 Source[4] member
209 * because it is added below.
210 */
211 user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4);
212
213 /* Each element of the top-level package must also be a package */
214
215 if (ACPI_GET_OBJECT_TYPE(*top_object_list) != ACPI_TYPE_PACKAGE) {
215 if ((*top_object_list)->common.type != ACPI_TYPE_PACKAGE) {
216 ACPI_ERROR((AE_INFO,
217 "(PRT[%X]) Need sub-package, found %s",
218 index,
219 acpi_ut_get_object_type_name
220 (*top_object_list)));
221 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
222 }
223

--- 11 unchanged lines hidden (view full) ---

235 * The sub_object_list will now point to an array of the four IRQ
236 * elements: [Address, Pin, Source, source_index]
237 */
238 sub_object_list = (*top_object_list)->package.elements;
239
240 /* 1) First subobject: Dereference the PRT.Address */
241
242 obj_desc = sub_object_list[0];
216 ACPI_ERROR((AE_INFO,
217 "(PRT[%X]) Need sub-package, found %s",
218 index,
219 acpi_ut_get_object_type_name
220 (*top_object_list)));
221 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
222 }
223

--- 11 unchanged lines hidden (view full) ---

235 * The sub_object_list will now point to an array of the four IRQ
236 * elements: [Address, Pin, Source, source_index]
237 */
238 sub_object_list = (*top_object_list)->package.elements;
239
240 /* 1) First subobject: Dereference the PRT.Address */
241
242 obj_desc = sub_object_list[0];
243 if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER) {
243 if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
244 ACPI_ERROR((AE_INFO,
245 "(PRT[%X].Address) Need Integer, found %s",
246 index,
247 acpi_ut_get_object_type_name(obj_desc)));
248 return_ACPI_STATUS(AE_BAD_DATA);
249 }
250
251 user_prt->address = obj_desc->integer.value;
252
253 /* 2) Second subobject: Dereference the PRT.Pin */
254
255 obj_desc = sub_object_list[1];
244 ACPI_ERROR((AE_INFO,
245 "(PRT[%X].Address) Need Integer, found %s",
246 index,
247 acpi_ut_get_object_type_name(obj_desc)));
248 return_ACPI_STATUS(AE_BAD_DATA);
249 }
250
251 user_prt->address = obj_desc->integer.value;
252
253 /* 2) Second subobject: Dereference the PRT.Pin */
254
255 obj_desc = sub_object_list[1];
256 if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER) {
256 if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
257 ACPI_ERROR((AE_INFO,
258 "(PRT[%X].Pin) Need Integer, found %s",
259 index,
260 acpi_ut_get_object_type_name(obj_desc)));
261 return_ACPI_STATUS(AE_BAD_DATA);
262 }
263
264 /*
265 * If BIOS erroneously reversed the _PRT source_name and source_index,
266 * then reverse them back.
267 */
257 ACPI_ERROR((AE_INFO,
258 "(PRT[%X].Pin) Need Integer, found %s",
259 index,
260 acpi_ut_get_object_type_name(obj_desc)));
261 return_ACPI_STATUS(AE_BAD_DATA);
262 }
263
264 /*
265 * If BIOS erroneously reversed the _PRT source_name and source_index,
266 * then reverse them back.
267 */
268 if (ACPI_GET_OBJECT_TYPE(sub_object_list[3]) !=
268 if ((sub_object_list[3])->common.type !=
269 ACPI_TYPE_INTEGER) {
270 if (acpi_gbl_enable_interpreter_slack) {
271 source_name_index = 3;
272 source_index_index = 2;
273 printk(KERN_WARNING
274 "ACPI: Handling Garbled _PRT entry\n");
275 } else {
276 ACPI_ERROR((AE_INFO,

--- 9 unchanged lines hidden (view full) ---

286
287 /*
288 * If the BIOS has erroneously reversed the _PRT source_name (index 2)
289 * and the source_index (index 3), fix it. _PRT is important enough to
290 * workaround this BIOS error. This also provides compatibility with
291 * other ACPI implementations.
292 */
293 obj_desc = sub_object_list[3];
269 ACPI_TYPE_INTEGER) {
270 if (acpi_gbl_enable_interpreter_slack) {
271 source_name_index = 3;
272 source_index_index = 2;
273 printk(KERN_WARNING
274 "ACPI: Handling Garbled _PRT entry\n");
275 } else {
276 ACPI_ERROR((AE_INFO,

--- 9 unchanged lines hidden (view full) ---

286
287 /*
288 * If the BIOS has erroneously reversed the _PRT source_name (index 2)
289 * and the source_index (index 3), fix it. _PRT is important enough to
290 * workaround this BIOS error. This also provides compatibility with
291 * other ACPI implementations.
292 */
293 obj_desc = sub_object_list[3];
294 if (!obj_desc
295 || (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER)) {
294 if (!obj_desc || (obj_desc->common.type != ACPI_TYPE_INTEGER)) {
296 sub_object_list[3] = sub_object_list[2];
297 sub_object_list[2] = obj_desc;
298
299 ACPI_WARNING((AE_INFO,
300 "(PRT[%X].Source) SourceName and SourceIndex are reversed, fixed",
301 index));
302 }
303
304 /*
305 * 3) Third subobject: Dereference the PRT.source_name
306 * The name may be unresolved (slack mode), so allow a null object
307 */
308 obj_desc = sub_object_list[source_name_index];
309 if (obj_desc) {
295 sub_object_list[3] = sub_object_list[2];
296 sub_object_list[2] = obj_desc;
297
298 ACPI_WARNING((AE_INFO,
299 "(PRT[%X].Source) SourceName and SourceIndex are reversed, fixed",
300 index));
301 }
302
303 /*
304 * 3) Third subobject: Dereference the PRT.source_name
305 * The name may be unresolved (slack mode), so allow a null object
306 */
307 obj_desc = sub_object_list[source_name_index];
308 if (obj_desc) {
310 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
309 switch (obj_desc->common.type) {
311 case ACPI_TYPE_LOCAL_REFERENCE:
312
313 if (obj_desc->reference.class !=
314 ACPI_REFCLASS_NAME) {
315 ACPI_ERROR((AE_INFO,
316 "(PRT[%X].Source) Need name, found Reference Class %X",
317 index,
318 obj_desc->reference.class));

--- 56 unchanged lines hidden (view full) ---

375 /* Now align the current length */
376
377 user_prt->length =
378 (u32) ACPI_ROUND_UP_TO_64BIT(user_prt->length);
379
380 /* 4) Fourth subobject: Dereference the PRT.source_index */
381
382 obj_desc = sub_object_list[source_index_index];
310 case ACPI_TYPE_LOCAL_REFERENCE:
311
312 if (obj_desc->reference.class !=
313 ACPI_REFCLASS_NAME) {
314 ACPI_ERROR((AE_INFO,
315 "(PRT[%X].Source) Need name, found Reference Class %X",
316 index,
317 obj_desc->reference.class));

--- 56 unchanged lines hidden (view full) ---

374 /* Now align the current length */
375
376 user_prt->length =
377 (u32) ACPI_ROUND_UP_TO_64BIT(user_prt->length);
378
379 /* 4) Fourth subobject: Dereference the PRT.source_index */
380
381 obj_desc = sub_object_list[source_index_index];
383 if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER) {
382 if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
384 ACPI_ERROR((AE_INFO,
385 "(PRT[%X].SourceIndex) Need Integer, found %s",
386 index,
387 acpi_ut_get_object_type_name(obj_desc)));
388 return_ACPI_STATUS(AE_BAD_DATA);
389 }
390
391 user_prt->source_index = (u32) obj_desc->integer.value;

--- 77 unchanged lines hidden ---
383 ACPI_ERROR((AE_INFO,
384 "(PRT[%X].SourceIndex) Need Integer, found %s",
385 index,
386 acpi_ut_get_object_type_name(obj_desc)));
387 return_ACPI_STATUS(AE_BAD_DATA);
388 }
389
390 user_prt->source_index = (u32) obj_desc->integer.value;

--- 77 unchanged lines hidden ---