]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Dispatcher / Dependency.c
index 89e540ba75b9741ce4eef9b0900eec856c0dd0d0..acbf68b700fbba4cb54f97daa4fabee1d60acf6a 100644 (file)
@@ -15,15 +15,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //\r
 // Global stack used to evaluate dependency expressions\r
 //\r
-BOOLEAN *mDepexEvaluationStack        = NULL;\r
-BOOLEAN *mDepexEvaluationStackEnd     = NULL;\r
-BOOLEAN *mDepexEvaluationStackPointer = NULL;\r
+BOOLEAN  *mDepexEvaluationStack        = NULL;\r
+BOOLEAN  *mDepexEvaluationStackEnd     = NULL;\r
+BOOLEAN  *mDepexEvaluationStackPointer = NULL;\r
 \r
 //\r
 // Worker functions\r
 //\r
 \r
-\r
 /**\r
   Grow size of the Depex stack\r
 \r
@@ -36,8 +35,8 @@ GrowDepexStack (
   VOID\r
   )\r
 {\r
-  BOOLEAN     *NewStack;\r
-  UINTN       Size;\r
+  BOOLEAN  *NewStack;\r
+  UINTN    Size;\r
 \r
   Size = DEPEX_STACK_SIZE_INCREMENT;\r
   if (mDepexEvaluationStack != NULL) {\r
@@ -75,8 +74,6 @@ GrowDepexStack (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
-\r
 /**\r
   Push an element onto the Boolean Stack.\r
 \r
@@ -115,8 +112,6 @@ PushBool (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
-\r
 /**\r
   Pop an element from the Boolean stack.\r
 \r
@@ -146,8 +141,6 @@ PopBool (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
-\r
 /**\r
   Preprocess dependency expression and update DriverEntry to reflect the\r
   state of  Before, After, and SOR dependencies. If DriverEntry->Before\r
@@ -162,7 +155,7 @@ PopBool (
 **/\r
 EFI_STATUS\r
 CorePreProcessDepex (\r
-  IN  EFI_CORE_DRIVER_ENTRY   *DriverEntry\r
+  IN  EFI_CORE_DRIVER_ENTRY  *DriverEntry\r
   )\r
 {\r
   UINT8  *Iterator;\r
@@ -187,8 +180,6 @@ CorePreProcessDepex (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
-\r
 /**\r
   This is the POSTFIX version of the dependency evaluator.  This code does\r
   not need to handle Before or After, as it is not valid to call this\r
@@ -204,7 +195,7 @@ CorePreProcessDepex (
 **/\r
 BOOLEAN\r
 CoreIsSchedulable (\r
-  IN  EFI_CORE_DRIVER_ENTRY   *DriverEntry\r
+  IN  EFI_CORE_DRIVER_ENTRY  *DriverEntry\r
   )\r
 {\r
   EFI_STATUS  Status;\r
@@ -214,7 +205,7 @@ CoreIsSchedulable (
   EFI_GUID    DriverGuid;\r
   VOID        *Interface;\r
 \r
-  Operator = FALSE;\r
+  Operator  = FALSE;\r
   Operator2 = FALSE;\r
 \r
   if (DriverEntry->After || DriverEntry->Before) {\r
@@ -237,6 +228,7 @@ CoreIsSchedulable (
       DEBUG ((DEBUG_DISPATCH, "FALSE\n  RESULT = FALSE\n"));\r
       return FALSE;\r
     }\r
+\r
     DEBUG ((DEBUG_DISPATCH, "TRUE\n  RESULT = TRUE\n"));\r
     return TRUE;\r
   }\r
@@ -247,7 +239,6 @@ CoreIsSchedulable (
   //\r
   mDepexEvaluationStackPointer = mDepexEvaluationStack;\r
 \r
-\r
   Iterator = DriverEntry->Depex;\r
 \r
   while (TRUE) {\r
@@ -264,158 +255,166 @@ CoreIsSchedulable (
     // Look at the opcode of the dependency expression instruction.\r
     //\r
     switch (*Iterator) {\r
-    case EFI_DEP_BEFORE:\r
-    case EFI_DEP_AFTER:\r
-      //\r
-      // For a well-formed Dependency Expression, the code should never get here.\r
-      // The BEFORE and AFTER are processed prior to this routine's invocation.\r
-      // If the code flow arrives at this point, there was a BEFORE or AFTER\r
-      // that were not the first opcodes.\r
-      //\r
-      DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected BEFORE or AFTER opcode)\n"));\r
-      ASSERT (FALSE);\r
-    case EFI_DEP_SOR:\r
-      //\r
-      // These opcodes can only appear once as the first opcode.  If it is found\r
-      // at any other location, then the dependency expression evaluates to FALSE\r
-      //\r
-      if (Iterator != DriverEntry->Depex) {\r
-        DEBUG ((DEBUG_DISPATCH, "  SOR\n"));\r
-        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected SOR opcode)\n"));\r
-        return FALSE;\r
-      }\r
-      DEBUG ((DEBUG_DISPATCH, "  SOR                                             = Requested\n"));\r
-      //\r
-      // Otherwise, it is the first opcode and should be treated as a NOP.\r
-      //\r
-      break;\r
-\r
-    case EFI_DEP_PUSH:\r
-      //\r
-      // Push operator is followed by a GUID. Test to see if the GUID protocol\r
-      // is installed and push the boolean result on the stack.\r
-      //\r
-      CopyMem (&DriverGuid, Iterator + 1, sizeof (EFI_GUID));\r
-\r
-      Status = CoreLocateProtocol (&DriverGuid, NULL, &Interface);\r
-\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_DISPATCH, "  PUSH GUID(%g) = FALSE\n", &DriverGuid));\r
+      case EFI_DEP_BEFORE:\r
+      case EFI_DEP_AFTER:\r
+        //\r
+        // For a well-formed Dependency Expression, the code should never get here.\r
+        // The BEFORE and AFTER are processed prior to this routine's invocation.\r
+        // If the code flow arrives at this point, there was a BEFORE or AFTER\r
+        // that were not the first opcodes.\r
+        //\r
+        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected BEFORE or AFTER opcode)\n"));\r
+        ASSERT (FALSE);\r
+      case EFI_DEP_SOR:\r
+        //\r
+        // These opcodes can only appear once as the first opcode.  If it is found\r
+        // at any other location, then the dependency expression evaluates to FALSE\r
+        //\r
+        if (Iterator != DriverEntry->Depex) {\r
+          DEBUG ((DEBUG_DISPATCH, "  SOR\n"));\r
+          DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected SOR opcode)\n"));\r
+          return FALSE;\r
+        }\r
+\r
+        DEBUG ((DEBUG_DISPATCH, "  SOR                                             = Requested\n"));\r
+        //\r
+        // Otherwise, it is the first opcode and should be treated as a NOP.\r
+        //\r
+        break;\r
+\r
+      case EFI_DEP_PUSH:\r
+        //\r
+        // Push operator is followed by a GUID. Test to see if the GUID protocol\r
+        // is installed and push the boolean result on the stack.\r
+        //\r
+        CopyMem (&DriverGuid, Iterator + 1, sizeof (EFI_GUID));\r
+\r
+        Status = CoreLocateProtocol (&DriverGuid, NULL, &Interface);\r
+\r
+        if (EFI_ERROR (Status)) {\r
+          DEBUG ((DEBUG_DISPATCH, "  PUSH GUID(%g) = FALSE\n", &DriverGuid));\r
+          Status = PushBool (FALSE);\r
+        } else {\r
+          DEBUG ((DEBUG_DISPATCH, "  PUSH GUID(%g) = TRUE\n", &DriverGuid));\r
+          *Iterator = EFI_DEP_REPLACE_TRUE;\r
+          Status    = PushBool (TRUE);\r
+        }\r
+\r
+        if (EFI_ERROR (Status)) {\r
+          DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
+          return FALSE;\r
+        }\r
+\r
+        Iterator += sizeof (EFI_GUID);\r
+        break;\r
+\r
+      case EFI_DEP_AND:\r
+        DEBUG ((DEBUG_DISPATCH, "  AND\n"));\r
+        Status = PopBool (&Operator);\r
+        if (EFI_ERROR (Status)) {\r
+          DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
+          return FALSE;\r
+        }\r
+\r
+        Status = PopBool (&Operator2);\r
+        if (EFI_ERROR (Status)) {\r
+          DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
+          return FALSE;\r
+        }\r
+\r
+        Status = PushBool ((BOOLEAN)(Operator && Operator2));\r
+        if (EFI_ERROR (Status)) {\r
+          DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
+          return FALSE;\r
+        }\r
+\r
+        break;\r
+\r
+      case EFI_DEP_OR:\r
+        DEBUG ((DEBUG_DISPATCH, "  OR\n"));\r
+        Status = PopBool (&Operator);\r
+        if (EFI_ERROR (Status)) {\r
+          DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
+          return FALSE;\r
+        }\r
+\r
+        Status = PopBool (&Operator2);\r
+        if (EFI_ERROR (Status)) {\r
+          DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
+          return FALSE;\r
+        }\r
+\r
+        Status = PushBool ((BOOLEAN)(Operator || Operator2));\r
+        if (EFI_ERROR (Status)) {\r
+          DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
+          return FALSE;\r
+        }\r
+\r
+        break;\r
+\r
+      case EFI_DEP_NOT:\r
+        DEBUG ((DEBUG_DISPATCH, "  NOT\n"));\r
+        Status = PopBool (&Operator);\r
+        if (EFI_ERROR (Status)) {\r
+          DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
+          return FALSE;\r
+        }\r
+\r
+        Status = PushBool ((BOOLEAN)(!Operator));\r
+        if (EFI_ERROR (Status)) {\r
+          DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
+          return FALSE;\r
+        }\r
+\r
+        break;\r
+\r
+      case EFI_DEP_TRUE:\r
+        DEBUG ((DEBUG_DISPATCH, "  TRUE\n"));\r
+        Status = PushBool (TRUE);\r
+        if (EFI_ERROR (Status)) {\r
+          DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
+          return FALSE;\r
+        }\r
+\r
+        break;\r
+\r
+      case EFI_DEP_FALSE:\r
+        DEBUG ((DEBUG_DISPATCH, "  FALSE\n"));\r
         Status = PushBool (FALSE);\r
-      } else {\r
+        if (EFI_ERROR (Status)) {\r
+          DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
+          return FALSE;\r
+        }\r
+\r
+        break;\r
+\r
+      case EFI_DEP_END:\r
+        DEBUG ((DEBUG_DISPATCH, "  END\n"));\r
+        Status = PopBool (&Operator);\r
+        if (EFI_ERROR (Status)) {\r
+          DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
+          return FALSE;\r
+        }\r
+\r
+        DEBUG ((DEBUG_DISPATCH, "  RESULT = %a\n", Operator ? "TRUE" : "FALSE"));\r
+        return Operator;\r
+\r
+      case EFI_DEP_REPLACE_TRUE:\r
+        CopyMem (&DriverGuid, Iterator + 1, sizeof (EFI_GUID));\r
         DEBUG ((DEBUG_DISPATCH, "  PUSH GUID(%g) = TRUE\n", &DriverGuid));\r
-        *Iterator = EFI_DEP_REPLACE_TRUE;\r
+\r
         Status = PushBool (TRUE);\r
-      }\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
-        return FALSE;\r
-      }\r
-\r
-      Iterator += sizeof (EFI_GUID);\r
-      break;\r
-\r
-    case EFI_DEP_AND:\r
-      DEBUG ((DEBUG_DISPATCH, "  AND\n"));\r
-      Status = PopBool (&Operator);\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
-        return FALSE;\r
-      }\r
-\r
-      Status = PopBool (&Operator2);\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
-        return FALSE;\r
-      }\r
-\r
-      Status = PushBool ((BOOLEAN)(Operator && Operator2));\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
-        return FALSE;\r
-      }\r
-      break;\r
-\r
-    case EFI_DEP_OR:\r
-      DEBUG ((DEBUG_DISPATCH, "  OR\n"));\r
-      Status = PopBool (&Operator);\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
-        return FALSE;\r
-      }\r
-\r
-      Status = PopBool (&Operator2);\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
-        return FALSE;\r
-      }\r
-\r
-      Status = PushBool ((BOOLEAN)(Operator || Operator2));\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
-        return FALSE;\r
-      }\r
-      break;\r
-\r
-    case EFI_DEP_NOT:\r
-      DEBUG ((DEBUG_DISPATCH, "  NOT\n"));\r
-      Status = PopBool (&Operator);\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
-        return FALSE;\r
-      }\r
-\r
-      Status = PushBool ((BOOLEAN)(!Operator));\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
-        return FALSE;\r
-      }\r
-      break;\r
-\r
-    case EFI_DEP_TRUE:\r
-      DEBUG ((DEBUG_DISPATCH, "  TRUE\n"));\r
-      Status = PushBool (TRUE);\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
-        return FALSE;\r
-      }\r
-      break;\r
-\r
-    case EFI_DEP_FALSE:\r
-      DEBUG ((DEBUG_DISPATCH, "  FALSE\n"));\r
-      Status = PushBool (FALSE);\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
-        return FALSE;\r
-      }\r
-      break;\r
-\r
-    case EFI_DEP_END:\r
-      DEBUG ((DEBUG_DISPATCH, "  END\n"));\r
-      Status = PopBool (&Operator);\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
-        return FALSE;\r
-      }\r
-      DEBUG ((DEBUG_DISPATCH, "  RESULT = %a\n", Operator ? "TRUE" : "FALSE"));\r
-      return Operator;\r
-\r
-    case EFI_DEP_REPLACE_TRUE:\r
-      CopyMem (&DriverGuid, Iterator + 1, sizeof (EFI_GUID));\r
-      DEBUG ((DEBUG_DISPATCH, "  PUSH GUID(%g) = TRUE\n", &DriverGuid));\r
-\r
-      Status = PushBool (TRUE);\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
-        return FALSE;\r
-      }\r
-\r
-      Iterator += sizeof (EFI_GUID);\r
-      break;\r
-\r
-    default:\r
-      DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unknown opcode)\n"));\r
-      goto Done;\r
+        if (EFI_ERROR (Status)) {\r
+          DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
+          return FALSE;\r
+        }\r
+\r
+        Iterator += sizeof (EFI_GUID);\r
+        break;\r
+\r
+      default:\r
+        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unknown opcode)\n"));\r
+        goto Done;\r
     }\r
 \r
     //\r
@@ -432,5 +431,3 @@ CoreIsSchedulable (
 Done:\r
   return FALSE;\r
 }\r
-\r
-\r