utmisc.c (71867) | utmisc.c (73561) |
---|---|
1/******************************************************************************* 2 * 3 * Module Name: cmutils - common utility procedures | 1/******************************************************************************* 2 * 3 * Module Name: cmutils - common utility procedures |
4 * $Revision: 23 $ | 4 * $Revision: 27 $ |
5 * 6 ******************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. --- 458 unchanged lines hidden (view full) --- 471 472 AcpiCmPushGenericState (StateList, State); 473 return (AE_OK); 474} 475 476 477/******************************************************************************* 478 * | 5 * 6 ******************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. --- 458 unchanged lines hidden (view full) --- 471 472 AcpiCmPushGenericState (StateList, State); 473 return (AE_OK); 474} 475 476 477/******************************************************************************* 478 * |
479 * FUNCTION: AcpiCmCreatePkgStateAndPush 480 * 481 * PARAMETERS: *Object - Object to be added to the new state 482 * Action - Increment/Decrement 483 * StateList - List the state will be added to 484 * 485 * RETURN: None 486 * 487 * DESCRIPTION: Create a new state and push it 488 * 489 ******************************************************************************/ 490 491ACPI_STATUS 492AcpiCmCreatePkgStateAndPush ( 493 void *InternalObject, 494 void *ExternalObject, 495 UINT16 Index, 496 ACPI_GENERIC_STATE **StateList) 497{ 498 ACPI_GENERIC_STATE *State; 499 500 501 502 State = AcpiCmCreatePkgState (InternalObject, ExternalObject, Index); 503 if (!State) 504 { 505 return (AE_NO_MEMORY); 506 } 507 508 509 AcpiCmPushGenericState (StateList, State); 510 return (AE_OK); 511} 512 513 514 515/******************************************************************************* 516 * |
|
479 * FUNCTION: AcpiCmPushGenericState 480 * 481 * PARAMETERS: ListHead - Head of the state stack 482 * State - State object to push 483 * 484 * RETURN: Status 485 * 486 * DESCRIPTION: Push a state object onto a state stack --- 158 unchanged lines hidden (view full) --- 645 State->Update.Value = Action; 646 647 return_PTR (State); 648} 649 650 651/******************************************************************************* 652 * | 517 * FUNCTION: AcpiCmPushGenericState 518 * 519 * PARAMETERS: ListHead - Head of the state stack 520 * State - State object to push 521 * 522 * RETURN: Status 523 * 524 * DESCRIPTION: Push a state object onto a state stack --- 158 unchanged lines hidden (view full) --- 683 State->Update.Value = Action; 684 685 return_PTR (State); 686} 687 688 689/******************************************************************************* 690 * |
691 * FUNCTION: AcpiCmCreatePkgState 692 * 693 * PARAMETERS: Object - Initial Object to be installed in the 694 * state 695 * Action - Update action to be performed 696 * 697 * RETURN: Status 698 * 699 * DESCRIPTION: Create an "Update State" - a flavor of the generic state used 700 * to update reference counts and delete complex objects such 701 * as packages. 702 * 703 ******************************************************************************/ 704 705ACPI_GENERIC_STATE * 706AcpiCmCreatePkgState ( 707 void *InternalObject, 708 void *ExternalObject, 709 UINT16 Index) 710{ 711 ACPI_GENERIC_STATE *State; 712 713 714 FUNCTION_TRACE_PTR ("CmCreatePkgState", InternalObject); 715 716 717 /* Create the generic state object */ 718 719 State = AcpiCmCreateGenericState (); 720 if (!State) 721 { 722 return (NULL); 723 } 724 725 /* Init fields specific to the update struct */ 726 727 State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject; 728 State->Pkg.DestObject = ExternalObject; 729 State->Pkg.Index = Index; 730 State->Pkg.NumPackages = 1; 731 732 return_PTR (State); 733} 734 735 736 737/******************************************************************************* 738 * |
|
653 * FUNCTION: AcpiCmCreateControlState 654 * 655 * PARAMETERS: None 656 * 657 * RETURN: Status 658 * 659 * DESCRIPTION: Create a "Control State" - a flavor of the generic state used 660 * to support nested IF/WHILE constructs in the AML. --- 127 unchanged lines hidden (view full) --- 788 * DESCRIPTION: Walk through a package and turn internal references into values 789 * 790 ******************************************************************************/ 791 792ACPI_STATUS 793AcpiCmResolvePackageReferences ( 794 ACPI_OPERAND_OBJECT *ObjDesc) 795{ | 739 * FUNCTION: AcpiCmCreateControlState 740 * 741 * PARAMETERS: None 742 * 743 * RETURN: Status 744 * 745 * DESCRIPTION: Create a "Control State" - a flavor of the generic state used 746 * to support nested IF/WHILE constructs in the AML. --- 127 unchanged lines hidden (view full) --- 874 * DESCRIPTION: Walk through a package and turn internal references into values 875 * 876 ******************************************************************************/ 877 878ACPI_STATUS 879AcpiCmResolvePackageReferences ( 880 ACPI_OPERAND_OBJECT *ObjDesc) 881{ |
796 UINT32 Count; 797 ACPI_OPERAND_OBJECT *SubObject; | 882 UINT32 Count; 883 ACPI_OPERAND_OBJECT *SubObject; |
798 | 884 |
885 |
|
799 FUNCTION_TRACE ("AcpiCmResolvePackageReferences"); 800 | 886 FUNCTION_TRACE ("AcpiCmResolvePackageReferences"); 887 |
888 |
|
801 if (ObjDesc->Common.Type != ACPI_TYPE_PACKAGE) 802 { | 889 if (ObjDesc->Common.Type != ACPI_TYPE_PACKAGE) 890 { |
803 /* Must be a package */ | 891 /* The object must be a package */ |
804 805 REPORT_ERROR (("Must resolve Package Refs on a Package\n")); 806 return_ACPI_STATUS(AE_ERROR); 807 } 808 | 892 893 REPORT_ERROR (("Must resolve Package Refs on a Package\n")); 894 return_ACPI_STATUS(AE_ERROR); 895 } 896 |
897 /* 898 * TBD: what about nested packages? */ 899 |
|
809 for (Count = 0; Count < ObjDesc->Package.Count; Count++) 810 { 811 SubObject = ObjDesc->Package.Elements[Count]; 812 813 if (SubObject->Common.Type == INTERNAL_TYPE_REFERENCE) 814 { 815 if (SubObject->Reference.OpCode == AML_ZERO_OP) 816 { --- 11 unchanged lines hidden (view full) --- 828 SubObject->Integer.Value = ACPI_INTEGER_MAX; 829 } 830 } 831 } 832 833 return_ACPI_STATUS(AE_OK); 834} 835 | 900 for (Count = 0; Count < ObjDesc->Package.Count; Count++) 901 { 902 SubObject = ObjDesc->Package.Elements[Count]; 903 904 if (SubObject->Common.Type == INTERNAL_TYPE_REFERENCE) 905 { 906 if (SubObject->Reference.OpCode == AML_ZERO_OP) 907 { --- 11 unchanged lines hidden (view full) --- 919 SubObject->Integer.Value = ACPI_INTEGER_MAX; 920 } 921 } 922 } 923 924 return_ACPI_STATUS(AE_OK); 925} 926 |
927#ifdef ACPI_DEBUG |
|
836 | 928 |
929/****************************************************************************** 930 * 931 * FUNCTION: AcpiCmDisplayInitPathname 932 * 933 * PARAMETERS: ObjHandle - Handle whose pathname will be displayed 934 * Path - Additional path string to be appended 935 * 936 * RETURN: ACPI_STATUS 937 * 938 * DESCRIPTION: Display full pathnbame of an object, DEBUG ONLY 939 * 940 *****************************************************************************/ 941 942void 943AcpiCmDisplayInitPathname ( 944 ACPI_HANDLE ObjHandle, 945 char *Path) 946{ 947 ACPI_STATUS Status; 948 UINT32 Length = 128; 949 char Buffer[128]; 950 951 952 Status = AcpiNsHandleToPathname (ObjHandle, &Length, Buffer); 953 if (ACPI_SUCCESS (Status)) 954 { 955 if (Path) 956 { 957 DEBUG_PRINT (TRACE_INIT, ("%s.%s\n", Buffer, Path)) 958 } 959 else 960 { 961 DEBUG_PRINT (TRACE_INIT, ("%s\n", Buffer)) 962 } 963 } 964} 965#endif 966 |
|
837/******************************************************************************* 838 * | 967/******************************************************************************* 968 * |
969 * FUNCTION: AcpiCmWalkPackageTree 970 * 971 * PARAMETERS: ObjDesc - The Package object on which to resolve refs 972 * 973 * RETURN: Status 974 * 975 * DESCRIPTION: Walk through a package 976 * 977 ******************************************************************************/ 978 979ACPI_STATUS 980AcpiCmWalkPackageTree ( 981 ACPI_OPERAND_OBJECT *SourceObject, 982 void *TargetObject, 983 ACPI_PKG_CALLBACK WalkCallback, 984 void *Context) 985{ 986 ACPI_STATUS Status = AE_OK; 987 ACPI_GENERIC_STATE *StateList = NULL; 988 ACPI_GENERIC_STATE *State; 989 UINT32 ThisIndex; 990 ACPI_OPERAND_OBJECT *ThisSourceObj; 991 992 993 FUNCTION_TRACE ("AcpiCmWalkPackageTree"); 994 995 996 State = AcpiCmCreatePkgState (SourceObject, TargetObject, 0); 997 if (!State) 998 { 999 return_ACPI_STATUS (AE_NO_MEMORY); 1000 } 1001 1002 while (State) 1003 { 1004 ThisIndex = State->Pkg.Index; 1005 ThisSourceObj = (ACPI_OPERAND_OBJECT *) 1006 State->Pkg.SourceObject->Package.Elements[ThisIndex]; 1007 1008 /* 1009 * Check for 1010 * 1) An uninitialized package element. It is completely 1011 * legal to declare a package and leave it uninitialized 1012 * 2) Not an internal object - can be a namespace node instead 1013 * 3) Any type other than a package. Packages are handled in else case below. 1014 */ 1015 if ((!ThisSourceObj) || 1016 (!VALID_DESCRIPTOR_TYPE ( 1017 ThisSourceObj, ACPI_DESC_TYPE_INTERNAL)) || 1018 (!IS_THIS_OBJECT_TYPE ( 1019 ThisSourceObj, ACPI_TYPE_PACKAGE))) 1020 { 1021 1022 Status = WalkCallback (0, ThisSourceObj, State, Context); 1023 if (ACPI_FAILURE (Status)) 1024 { 1025 /* TBD: must delete package created up to this point */ 1026 1027 return_ACPI_STATUS (Status); 1028 } 1029 1030 State->Pkg.Index++; 1031 while (State->Pkg.Index >= State->Pkg.SourceObject->Package.Count) 1032 { 1033 /* 1034 * We've handled all of the objects at this level, This means 1035 * that we have just completed a package. That package may 1036 * have contained one or more packages itself. 1037 * 1038 * Delete this state and pop the previous state (package). 1039 */ 1040 AcpiCmDeleteGenericState (State); 1041 State = AcpiCmPopGenericState (&StateList); 1042 1043 1044 /* Finished when there are no more states */ 1045 1046 if (!State) 1047 { 1048 /* 1049 * We have handled all of the objects in the top level 1050 * package just add the length of the package objects 1051 * and exit 1052 */ 1053 return_ACPI_STATUS (AE_OK); 1054 } 1055 1056 /* 1057 * Go back up a level and move the index past the just 1058 * completed package object. 1059 */ 1060 State->Pkg.Index++; 1061 } 1062 } 1063 1064 else 1065 { 1066 /* This is a sub-object of type package */ 1067 1068 Status = WalkCallback (1, ThisSourceObj, State, Context); 1069 if (ACPI_FAILURE (Status)) 1070 { 1071 /* TBD: must delete package created up to this point */ 1072 1073 return_ACPI_STATUS (Status); 1074 } 1075 1076 1077 /* 1078 * The callback above returned a new target package object. 1079 */ 1080 1081 /* 1082 * Push the current state and create a new one 1083 */ 1084 AcpiCmPushGenericState (&StateList, State); 1085 State = AcpiCmCreatePkgState (ThisSourceObj, State->Pkg.ThisTargetObj, 0); 1086 if (!State) 1087 { 1088 /* TBD: must delete package created up to this point */ 1089 1090 return_ACPI_STATUS (AE_NO_MEMORY); 1091 } 1092 } 1093 } 1094 1095 /* We should never get here */ 1096 1097 return (AE_AML_INTERNAL); 1098 1099} 1100 1101 1102 1103/******************************************************************************* 1104 * |
|
839 * FUNCTION: _ReportError 840 * 841 * PARAMETERS: ModuleName - Caller's module name (for error output) 842 * LineNumber - Caller's line number (for error output) 843 * ComponentId - Caller's component ID (for error output) 844 * Message - Error message to use on failure 845 * 846 * RETURN: None 847 * | 1105 * FUNCTION: _ReportError 1106 * 1107 * PARAMETERS: ModuleName - Caller's module name (for error output) 1108 * LineNumber - Caller's line number (for error output) 1109 * ComponentId - Caller's component ID (for error output) 1110 * Message - Error message to use on failure 1111 * 1112 * RETURN: None 1113 * |
848 * DESCRIPTION: Print error message from KD table | 1114 * DESCRIPTION: Print error message |
849 * 850 ******************************************************************************/ 851 852void 853_ReportError ( 854 NATIVE_CHAR *ModuleName, 855 UINT32 LineNumber, 856 UINT32 ComponentId) --- 10 unchanged lines hidden (view full) --- 867 * 868 * PARAMETERS: ModuleName - Caller's module name (for error output) 869 * LineNumber - Caller's line number (for error output) 870 * ComponentId - Caller's component ID (for error output) 871 * Message - Error message to use on failure 872 * 873 * RETURN: None 874 * | 1115 * 1116 ******************************************************************************/ 1117 1118void 1119_ReportError ( 1120 NATIVE_CHAR *ModuleName, 1121 UINT32 LineNumber, 1122 UINT32 ComponentId) --- 10 unchanged lines hidden (view full) --- 1133 * 1134 * PARAMETERS: ModuleName - Caller's module name (for error output) 1135 * LineNumber - Caller's line number (for error output) 1136 * ComponentId - Caller's component ID (for error output) 1137 * Message - Error message to use on failure 1138 * 1139 * RETURN: None 1140 * |
875 * DESCRIPTION: Print warning message from KD table | 1141 * DESCRIPTION: Print warning message |
876 * 877 ******************************************************************************/ 878 879void 880_ReportWarning ( 881 NATIVE_CHAR *ModuleName, 882 UINT32 LineNumber, 883 UINT32 ComponentId) --- 9 unchanged lines hidden (view full) --- 893 * 894 * PARAMETERS: ModuleName - Caller's module name (for error output) 895 * LineNumber - Caller's line number (for error output) 896 * ComponentId - Caller's component ID (for error output) 897 * Message - Error message to use on failure 898 * 899 * RETURN: None 900 * | 1142 * 1143 ******************************************************************************/ 1144 1145void 1146_ReportWarning ( 1147 NATIVE_CHAR *ModuleName, 1148 UINT32 LineNumber, 1149 UINT32 ComponentId) --- 9 unchanged lines hidden (view full) --- 1159 * 1160 * PARAMETERS: ModuleName - Caller's module name (for error output) 1161 * LineNumber - Caller's line number (for error output) 1162 * ComponentId - Caller's component ID (for error output) 1163 * Message - Error message to use on failure 1164 * 1165 * RETURN: None 1166 * |
901 * DESCRIPTION: Print information message from KD table | 1167 * DESCRIPTION: Print information message |
902 * 903 ******************************************************************************/ 904 905void 906_ReportInfo ( 907 NATIVE_CHAR *ModuleName, 908 UINT32 LineNumber, 909 UINT32 ComponentId) 910{ 911 912 AcpiOsPrintf ("%8s-%04d: *** Info: ", ModuleName, LineNumber); 913} 914 915 | 1168 * 1169 ******************************************************************************/ 1170 1171void 1172_ReportInfo ( 1173 NATIVE_CHAR *ModuleName, 1174 UINT32 LineNumber, 1175 UINT32 ComponentId) 1176{ 1177 1178 AcpiOsPrintf ("%8s-%04d: *** Info: ", ModuleName, LineNumber); 1179} 1180 1181 |