Deleted Added
full compact
uteval.c (114237) uteval.c (117521)
1/******************************************************************************
2 *
3 * Module Name: uteval - Object evaluation
1/******************************************************************************
2 *
3 * Module Name: uteval - Object evaluation
4 * $Revision: 45 $
4 * $Revision: 48 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.

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

287
288 AcpiUtRemoveReference (ObjDesc);
289 return_ACPI_STATUS (Status);
290}
291
292
293/*******************************************************************************
294 *
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.

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

287
288 AcpiUtRemoveReference (ObjDesc);
289 return_ACPI_STATUS (Status);
290}
291
292
293/*******************************************************************************
294 *
295 * FUNCTION: AcpiUtCopyIdString
296 *
297 * PARAMETERS: Destination - Where to copy the string
298 * Source - Source string
299 * MaxLength - Length of the destination buffer
300 *
301 * RETURN: None
302 *
303 * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods.
304 * Performs removal of a leading asterisk if present -- workaround
305 * for a known issue on a bunch of machines.
306 *
307 ******************************************************************************/
308
309static void
310AcpiUtCopyIdString (
311 char *Destination,
312 char *Source,
313 ACPI_SIZE MaxLength)
314{
315
316
317 /*
318 * Workaround for ID strings that have a leading asterisk. This construct
319 * is not allowed by the ACPI specification (ID strings must be
320 * alphanumeric), but enough existing machines have this embedded in their
321 * ID strings that the following code is useful.
322 */
323 if (*Source == '*')
324 {
325 Source++;
326 }
327
328 /* Do the actual copy */
329
330 ACPI_STRNCPY (Destination, Source, MaxLength);
331}
332
333
334/*******************************************************************************
335 *
295 * FUNCTION: AcpiUtExecute_HID
296 *
297 * PARAMETERS: DeviceNode - Node for the device
298 * *Hid - Where the HID is returned
299 *
300 * RETURN: Status
301 *
302 * DESCRIPTION: Executes the _HID control method that returns the hardware

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

324 {
325 return_ACPI_STATUS (Status);
326 }
327
328 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
329 {
330 /* Convert the Numeric HID to string */
331
336 * FUNCTION: AcpiUtExecute_HID
337 *
338 * PARAMETERS: DeviceNode - Node for the device
339 * *Hid - Where the HID is returned
340 *
341 * RETURN: Status
342 *
343 * DESCRIPTION: Executes the _HID control method that returns the hardware

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

365 {
366 return_ACPI_STATUS (Status);
367 }
368
369 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
370 {
371 /* Convert the Numeric HID to string */
372
332 AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Buffer);
373 AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Value);
333 }
334 else
335 {
336 /* Copy the String HID from the returned object */
337
374 }
375 else
376 {
377 /* Copy the String HID from the returned object */
378
338 ACPI_STRNCPY (Hid->Buffer, ObjDesc->String.Pointer, sizeof(Hid->Buffer));
379 AcpiUtCopyIdString (Hid->Value, ObjDesc->String.Pointer,
380 sizeof (Hid->Value));
339 }
340
341 /* On exit, we must delete the return object */
342
343 AcpiUtRemoveReference (ObjDesc);
344 return_ACPI_STATUS (Status);
345}
346
347
348/*******************************************************************************
349 *
381 }
382
383 /* On exit, we must delete the return object */
384
385 AcpiUtRemoveReference (ObjDesc);
386 return_ACPI_STATUS (Status);
387}
388
389
390/*******************************************************************************
391 *
392 * FUNCTION: AcpiUtTranslateOneCid
393 *
394 * PARAMETERS: ObjDesc - _CID object, must be integer or string
395 * OneCid - Where the CID string is returned
396 *
397 * RETURN: Status
398 *
399 * DESCRIPTION: Return a numeric or string _CID value as a string.
400 * (Compatible ID)
401 *
402 * NOTE: Assumes a maximum _CID string length of
403 * ACPI_MAX_CID_LENGTH.
404 *
405 ******************************************************************************/
406
407static ACPI_STATUS
408AcpiUtTranslateOneCid (
409 ACPI_OPERAND_OBJECT *ObjDesc,
410 ACPI_COMPATIBLE_ID *OneCid)
411{
412
413
414 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
415 {
416 case ACPI_TYPE_INTEGER:
417
418 /* Convert the Numeric CID to string */
419
420 AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, OneCid->Value);
421 return (AE_OK);
422
423 case ACPI_TYPE_STRING:
424
425 if (ObjDesc->String.Length > ACPI_MAX_CID_LENGTH)
426 {
427 return (AE_AML_STRING_LIMIT);
428 }
429
430 /* Copy the String CID from the returned object */
431
432 AcpiUtCopyIdString (OneCid->Value, ObjDesc->String.Pointer,
433 ACPI_MAX_CID_LENGTH);
434 return (AE_OK);
435
436 default:
437
438 return (AE_TYPE);
439 }
440}
441
442
443/*******************************************************************************
444 *
350 * FUNCTION: AcpiUtExecute_CID
351 *
352 * PARAMETERS: DeviceNode - Node for the device
353 * *Cid - Where the CID is returned
354 *
355 * RETURN: Status
356 *
357 * DESCRIPTION: Executes the _CID control method that returns one or more
358 * compatible hardware IDs for the device.
359 *
360 * NOTE: Internal function, no parameter validation
361 *
362 ******************************************************************************/
363
364ACPI_STATUS
365AcpiUtExecute_CID (
366 ACPI_NAMESPACE_NODE *DeviceNode,
445 * FUNCTION: AcpiUtExecute_CID
446 *
447 * PARAMETERS: DeviceNode - Node for the device
448 * *Cid - Where the CID is returned
449 *
450 * RETURN: Status
451 *
452 * DESCRIPTION: Executes the _CID control method that returns one or more
453 * compatible hardware IDs for the device.
454 *
455 * NOTE: Internal function, no parameter validation
456 *
457 ******************************************************************************/
458
459ACPI_STATUS
460AcpiUtExecute_CID (
461 ACPI_NAMESPACE_NODE *DeviceNode,
367 ACPI_DEVICE_ID *Cid)
462 ACPI_COMPATIBLE_ID_LIST **ReturnCidList)
368{
369 ACPI_OPERAND_OBJECT *ObjDesc;
370 ACPI_STATUS Status;
463{
464 ACPI_OPERAND_OBJECT *ObjDesc;
465 ACPI_STATUS Status;
466 UINT32 Count;
467 UINT32 Size;
468 ACPI_COMPATIBLE_ID_LIST *CidList;
469 ACPI_NATIVE_UINT i;
371
372
373 ACPI_FUNCTION_TRACE ("UtExecute_CID");
374
375
470
471
472 ACPI_FUNCTION_TRACE ("UtExecute_CID");
473
474
475 /* Evaluate the _CID method for this device */
476
376 Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CID,
477 Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CID,
377 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, &ObjDesc);
478 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE,
479 &ObjDesc);
378 if (ACPI_FAILURE (Status))
379 {
380 return_ACPI_STATUS (Status);
381 }
382
480 if (ACPI_FAILURE (Status))
481 {
482 return_ACPI_STATUS (Status);
483 }
484
383 /*
384 * A _CID can return either a single compatible ID or a package of compatible
385 * IDs. Each compatible ID can be a Number (32 bit compressed EISA ID) or
386 * string (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss").
387 */
388 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
485 /* Get the number of _CIDs returned */
486
487 Count = 1;
488 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE)
389 {
489 {
390 case ACPI_TYPE_INTEGER:
490 Count = ObjDesc->Package.Count;
491 }
391
492
392 /* Convert the Numeric CID to string */
493 /* Allocate a worst-case buffer for the _CIDs */
393
494
394 AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Cid->Buffer);
395 break;
495 Size = (((Count - 1) * sizeof (ACPI_COMPATIBLE_ID)) +
496 sizeof (ACPI_COMPATIBLE_ID_LIST));
396
497
397 case ACPI_TYPE_STRING:
498 CidList = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Size);
499 if (!CidList)
500 {
501 return_ACPI_STATUS (AE_NO_MEMORY);
502 }
398
503
399 /* Copy the String CID from the returned object */
504 /* Init CID list */
400
505
401 ACPI_STRNCPY (Cid->Buffer, ObjDesc->String.Pointer, sizeof (Cid->Buffer));
402 break;
506 CidList->Count = Count;
507 CidList->Size = Size;
403
508
404 case ACPI_TYPE_PACKAGE:
509 /*
510 * A _CID can return either a single compatible ID or a package of compatible
511 * IDs. Each compatible ID can be one of the following:
512 * -- Number (32 bit compressed EISA ID) or
513 * -- String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss").
514 */
405
515
406 /* TBD: Parse package elements; need different return struct, etc. */
516 /* The _CID object can be either a single CID or a package (list) of CIDs */
407
517
408 Status = AE_SUPPORT;
409 break;
518 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE)
519 {
520 /* Translate each package element */
410
521
411 default:
522 for (i = 0; i < Count; i++)
523 {
524 Status = AcpiUtTranslateOneCid (ObjDesc->Package.Elements[i],
525 &CidList->Id[i]);
526 if (ACPI_FAILURE (Status))
527 {
528 break;
529 }
530 }
531 }
532 else
533 {
534 /* Only one CID, translate to a string */
412
535
413 Status = AE_TYPE;
414 break;
536 Status = AcpiUtTranslateOneCid (ObjDesc, CidList->Id);
415 }
416
537 }
538
417 /* On exit, we must delete the return object */
539 /* Cleanup on error */
418
540
541 if (ACPI_FAILURE (Status))
542 {
543 ACPI_MEM_FREE (CidList);
544 }
545 else
546 {
547 *ReturnCidList = CidList;
548 }
549
550 /* On exit, we must delete the _CID return object */
551
419 AcpiUtRemoveReference (ObjDesc);
420 return_ACPI_STATUS (Status);
421}
422
423
424/*******************************************************************************
425 *
426 * FUNCTION: AcpiUtExecute_UID

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

455 {
456 return_ACPI_STATUS (Status);
457 }
458
459 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
460 {
461 /* Convert the Numeric UID to string */
462
552 AcpiUtRemoveReference (ObjDesc);
553 return_ACPI_STATUS (Status);
554}
555
556
557/*******************************************************************************
558 *
559 * FUNCTION: AcpiUtExecute_UID

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

588 {
589 return_ACPI_STATUS (Status);
590 }
591
592 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
593 {
594 /* Convert the Numeric UID to string */
595
463 AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Buffer);
596 AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Value);
464 }
465 else
466 {
467 /* Copy the String UID from the returned object */
468
597 }
598 else
599 {
600 /* Copy the String UID from the returned object */
601
469 ACPI_STRNCPY (Uid->Buffer, ObjDesc->String.Pointer, sizeof (Uid->Buffer));
602 AcpiUtCopyIdString (Uid->Value, ObjDesc->String.Pointer,
603 sizeof (Uid->Value));
470 }
471
472 /* On exit, we must delete the return object */
473
474 AcpiUtRemoveReference (ObjDesc);
475 return_ACPI_STATUS (Status);
476}
477

--- 55 unchanged lines hidden ---
604 }
605
606 /* On exit, we must delete the return object */
607
608 AcpiUtRemoveReference (ObjDesc);
609 return_ACPI_STATUS (Status);
610}
611

--- 55 unchanged lines hidden ---