utmisc.c (84491) | utmisc.c (87031) |
---|---|
1/******************************************************************************* 2 * 3 * Module Name: utmisc - common utility procedures | 1/******************************************************************************* 2 * 3 * Module Name: utmisc - common utility procedures |
4 * $Revision: 52 $ | 4 * $Revision: 56 $ |
5 * 6 ******************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. --- 112 unchanged lines hidden (view full) --- 125#include "amlcode.h" 126#include "acdebug.h" 127 128 129#define _COMPONENT ACPI_UTILITIES 130 MODULE_NAME ("utmisc") 131 132 | 5 * 6 ******************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. --- 112 unchanged lines hidden (view full) --- 125#include "amlcode.h" 126#include "acdebug.h" 127 128 129#define _COMPONENT ACPI_UTILITIES 130 MODULE_NAME ("utmisc") 131 132 |
133 | |
134/******************************************************************************* 135 * 136 * FUNCTION: AcpiUtValidAcpiName 137 * 138 * PARAMETERS: Character - The character to be examined 139 * 140 * RETURN: 1 if Character may appear in a name, else 0 141 * --- 602 unchanged lines hidden (view full) --- 744 } 745 746 return (State); 747} 748 749 750/******************************************************************************* 751 * | 133/******************************************************************************* 134 * 135 * FUNCTION: AcpiUtValidAcpiName 136 * 137 * PARAMETERS: Character - The character to be examined 138 * 139 * RETURN: 1 if Character may appear in a name, else 0 140 * --- 602 unchanged lines hidden (view full) --- 743 } 744 745 return (State); 746} 747 748 749/******************************************************************************* 750 * |
751 * FUNCTION: AcpiUtCreateThreadState 752 * 753 * PARAMETERS: None 754 * 755 * RETURN: Thread State 756 * 757 * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used 758 * to track per-thread info during method execution 759 * 760 ******************************************************************************/ 761 762ACPI_THREAD_STATE * 763AcpiUtCreateThreadState ( 764 void) 765{ 766 ACPI_GENERIC_STATE *State; 767 768 769 FUNCTION_TRACE ("UtCreateThreadState"); 770 771 772 /* Create the generic state object */ 773 774 State = AcpiUtCreateGenericState (); 775 if (!State) 776 { 777 return_PTR (NULL); 778 } 779 780 /* Init fields specific to the update struct */ 781 782 State->Common.DataType = ACPI_DESC_TYPE_STATE_THREAD; 783 State->Thread.ThreadId = AcpiOsGetThreadId (); 784 785 return_PTR ((ACPI_THREAD_STATE *) State); 786} 787 788 789/******************************************************************************* 790 * |
|
752 * FUNCTION: AcpiUtCreateUpdateState 753 * 754 * PARAMETERS: Object - Initial Object to be installed in the 755 * state 756 * Action - Update action to be performed 757 * 758 * RETURN: Status 759 * --- 14 unchanged lines hidden (view full) --- 774 FUNCTION_TRACE_PTR ("UtCreateUpdateState", Object); 775 776 777 /* Create the generic state object */ 778 779 State = AcpiUtCreateGenericState (); 780 if (!State) 781 { | 791 * FUNCTION: AcpiUtCreateUpdateState 792 * 793 * PARAMETERS: Object - Initial Object to be installed in the 794 * state 795 * Action - Update action to be performed 796 * 797 * RETURN: Status 798 * --- 14 unchanged lines hidden (view full) --- 813 FUNCTION_TRACE_PTR ("UtCreateUpdateState", Object); 814 815 816 /* Create the generic state object */ 817 818 State = AcpiUtCreateGenericState (); 819 if (!State) 820 { |
782 return (NULL); | 821 return_PTR (NULL); |
783 } 784 785 /* Init fields specific to the update struct */ 786 787 State->Common.DataType = ACPI_DESC_TYPE_STATE_UPDATE; 788 State->Update.Object = Object; 789 State->Update.Value = Action; 790 --- 27 unchanged lines hidden (view full) --- 818 FUNCTION_TRACE_PTR ("UtCreatePkgState", InternalObject); 819 820 821 /* Create the generic state object */ 822 823 State = AcpiUtCreateGenericState (); 824 if (!State) 825 { | 822 } 823 824 /* Init fields specific to the update struct */ 825 826 State->Common.DataType = ACPI_DESC_TYPE_STATE_UPDATE; 827 State->Update.Object = Object; 828 State->Update.Value = Action; 829 --- 27 unchanged lines hidden (view full) --- 857 FUNCTION_TRACE_PTR ("UtCreatePkgState", InternalObject); 858 859 860 /* Create the generic state object */ 861 862 State = AcpiUtCreateGenericState (); 863 if (!State) 864 { |
826 return (NULL); | 865 return_PTR (NULL); |
827 } 828 829 /* Init fields specific to the update struct */ 830 831 State->Common.DataType = ACPI_DESC_TYPE_STATE_PACKAGE; 832 State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject; 833 State->Pkg.DestObject = ExternalObject; 834 State->Pkg.Index = Index; --- 26 unchanged lines hidden (view full) --- 861 FUNCTION_TRACE ("UtCreateControlState"); 862 863 864 /* Create the generic state object */ 865 866 State = AcpiUtCreateGenericState (); 867 if (!State) 868 { | 866 } 867 868 /* Init fields specific to the update struct */ 869 870 State->Common.DataType = ACPI_DESC_TYPE_STATE_PACKAGE; 871 State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject; 872 State->Pkg.DestObject = ExternalObject; 873 State->Pkg.Index = Index; --- 26 unchanged lines hidden (view full) --- 900 FUNCTION_TRACE ("UtCreateControlState"); 901 902 903 /* Create the generic state object */ 904 905 State = AcpiUtCreateGenericState (); 906 if (!State) 907 { |
869 return (NULL); | 908 return_PTR (NULL); |
870 } 871 872 873 /* Init fields specific to the control struct */ 874 875 State->Common.DataType = ACPI_DESC_TYPE_STATE_CONTROL; 876 State->Common.State = CONTROL_CONDITIONAL_EXECUTING; 877 --- 194 unchanged lines hidden (view full) --- 1072 1073 while (State) 1074 { 1075 ThisIndex = State->Pkg.Index; 1076 ThisSourceObj = (ACPI_OPERAND_OBJECT *) 1077 State->Pkg.SourceObject->Package.Elements[ThisIndex]; 1078 1079 /* | 909 } 910 911 912 /* Init fields specific to the control struct */ 913 914 State->Common.DataType = ACPI_DESC_TYPE_STATE_CONTROL; 915 State->Common.State = CONTROL_CONDITIONAL_EXECUTING; 916 --- 194 unchanged lines hidden (view full) --- 1111 1112 while (State) 1113 { 1114 ThisIndex = State->Pkg.Index; 1115 ThisSourceObj = (ACPI_OPERAND_OBJECT *) 1116 State->Pkg.SourceObject->Package.Elements[ThisIndex]; 1117 1118 /* |
1080 * Check for | 1119 * Check for: |
1081 * 1) An uninitialized package element. It is completely 1082 * legal to declare a package and leave it uninitialized 1083 * 2) Not an internal object - can be a namespace node instead 1084 * 3) Any type other than a package. Packages are handled in else 1085 * case below. 1086 */ 1087 if ((!ThisSourceObj) || 1088 (!VALID_DESCRIPTOR_TYPE ( 1089 ThisSourceObj, ACPI_DESC_TYPE_INTERNAL)) || 1090 (!IS_THIS_OBJECT_TYPE ( 1091 ThisSourceObj, ACPI_TYPE_PACKAGE))) 1092 { 1093 1094 Status = WalkCallback (ACPI_COPY_TYPE_SIMPLE, ThisSourceObj, 1095 State, Context); 1096 if (ACPI_FAILURE (Status)) 1097 { | 1120 * 1) An uninitialized package element. It is completely 1121 * legal to declare a package and leave it uninitialized 1122 * 2) Not an internal object - can be a namespace node instead 1123 * 3) Any type other than a package. Packages are handled in else 1124 * case below. 1125 */ 1126 if ((!ThisSourceObj) || 1127 (!VALID_DESCRIPTOR_TYPE ( 1128 ThisSourceObj, ACPI_DESC_TYPE_INTERNAL)) || 1129 (!IS_THIS_OBJECT_TYPE ( 1130 ThisSourceObj, ACPI_TYPE_PACKAGE))) 1131 { 1132 1133 Status = WalkCallback (ACPI_COPY_TYPE_SIMPLE, ThisSourceObj, 1134 State, Context); 1135 if (ACPI_FAILURE (Status)) 1136 { |
1098 /* TBD: must delete package created up to this point */ 1099 | |
1100 return_ACPI_STATUS (Status); 1101 } 1102 1103 State->Pkg.Index++; 1104 while (State->Pkg.Index >= State->Pkg.SourceObject->Package.Count) 1105 { 1106 /* 1107 * We've handled all of the objects at this level, This means 1108 * that we have just completed a package. That package may 1109 * have contained one or more packages itself. 1110 * 1111 * Delete this state and pop the previous state (package). 1112 */ 1113 AcpiUtDeleteGenericState (State); 1114 State = AcpiUtPopGenericState (&StateList); 1115 | 1137 return_ACPI_STATUS (Status); 1138 } 1139 1140 State->Pkg.Index++; 1141 while (State->Pkg.Index >= State->Pkg.SourceObject->Package.Count) 1142 { 1143 /* 1144 * We've handled all of the objects at this level, This means 1145 * that we have just completed a package. That package may 1146 * have contained one or more packages itself. 1147 * 1148 * Delete this state and pop the previous state (package). 1149 */ 1150 AcpiUtDeleteGenericState (State); 1151 State = AcpiUtPopGenericState (&StateList); 1152 |
1116 | |
1117 /* Finished when there are no more states */ 1118 1119 if (!State) 1120 { 1121 /* 1122 * We have handled all of the objects in the top level 1123 * package just add the length of the package objects 1124 * and exit 1125 */ 1126 return_ACPI_STATUS (AE_OK); 1127 } 1128 1129 /* 1130 * Go back up a level and move the index past the just 1131 * completed package object. 1132 */ 1133 State->Pkg.Index++; 1134 } 1135 } | 1153 /* Finished when there are no more states */ 1154 1155 if (!State) 1156 { 1157 /* 1158 * We have handled all of the objects in the top level 1159 * package just add the length of the package objects 1160 * and exit 1161 */ 1162 return_ACPI_STATUS (AE_OK); 1163 } 1164 1165 /* 1166 * Go back up a level and move the index past the just 1167 * completed package object. 1168 */ 1169 State->Pkg.Index++; 1170 } 1171 } |
1136 | |
1137 else 1138 { | 1172 else 1173 { |
1139 /* This is a sub-object of type package */ | 1174 /* This is a subobject of type package */ |
1140 1141 Status = WalkCallback (ACPI_COPY_TYPE_PACKAGE, ThisSourceObj, 1142 State, Context); 1143 if (ACPI_FAILURE (Status)) 1144 { | 1175 1176 Status = WalkCallback (ACPI_COPY_TYPE_PACKAGE, ThisSourceObj, 1177 State, Context); 1178 if (ACPI_FAILURE (Status)) 1179 { |
1145 /* TBD: must delete package created up to this point */ 1146 | |
1147 return_ACPI_STATUS (Status); 1148 } 1149 | 1180 return_ACPI_STATUS (Status); 1181 } 1182 |
1150 | |
1151 /* | 1183 /* |
1184 * Push the current state and create a new one |
|
1152 * The callback above returned a new target package object. 1153 */ | 1185 * The callback above returned a new target package object. 1186 */ |
1154 1155 /* 1156 * Push the current state and create a new one 1157 */ | |
1158 AcpiUtPushGenericState (&StateList, State); 1159 State = AcpiUtCreatePkgState (ThisSourceObj, 1160 State->Pkg.ThisTargetObj, 0); 1161 if (!State) 1162 { | 1187 AcpiUtPushGenericState (&StateList, State); 1188 State = AcpiUtCreatePkgState (ThisSourceObj, 1189 State->Pkg.ThisTargetObj, 0); 1190 if (!State) 1191 { |
1163 /* TBD: must delete package created up to this point */ 1164 | |
1165 return_ACPI_STATUS (AE_NO_MEMORY); 1166 } 1167 } 1168 } 1169 1170 /* We should never get here */ 1171 | 1192 return_ACPI_STATUS (AE_NO_MEMORY); 1193 } 1194 } 1195 } 1196 1197 /* We should never get here */ 1198 |
1172 return (AE_AML_INTERNAL); | 1199 return_ACPI_STATUS (AE_AML_INTERNAL); |
1173} 1174 1175 1176/******************************************************************************* 1177 * 1178 * FUNCTION: AcpiUtReportError 1179 * 1180 * PARAMETERS: ModuleName - Caller's module name (for error output) --- 74 unchanged lines hidden --- | 1200} 1201 1202 1203/******************************************************************************* 1204 * 1205 * FUNCTION: AcpiUtReportError 1206 * 1207 * PARAMETERS: ModuleName - Caller's module name (for error output) --- 74 unchanged lines hidden --- |