]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/PiSmmCore/Dependency.c
Update PEI/DXE/SMM dispatchers to include DEBUG ((DEBUG_DISPATCH, )) macros to log...
[mirror_edk2.git] / MdeModulePkg / Core / PiSmmCore / Dependency.c
index cf8c3e9ff75548d64c9475f0b4a009bb3656db81..4bf8502cf8be7aac6e9a3d15c1ab72fefc777bb7 100644 (file)
@@ -183,6 +183,8 @@ SmmIsSchedulable (
   EFI_GUID    DriverGuid;\r
   VOID        *Interface;\r
 \r
+  DEBUG ((DEBUG_DISPATCH, "Evaluate SMM DEPEX for FFS(%g)\n", &DriverEntry->FileName));\r
+  \r
   Operator = FALSE;\r
   Operator2 = FALSE;\r
 \r
@@ -199,6 +201,7 @@ SmmIsSchedulable (
     // A NULL Depex means that the SMM driver is not built correctly.  \r
     // All SMM drivers must have a valid depex expressiion.\r
     //\r
+    DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Depex is empty)\n"));\r
     ASSERT (FALSE);\r
     return FALSE;\r
   }\r
@@ -218,6 +221,7 @@ SmmIsSchedulable (
     // past the end of the dependency expression.\r
     //\r
     if (((UINTN)Iterator - (UINTN)DriverEntry->Depex) >= DriverEntry->DepexSize) {\r
+      DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Attempt to fetch past end of depex)\n"));\r
       return FALSE;\r
     }\r
 \r
@@ -233,6 +237,7 @@ SmmIsSchedulable (
       // 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
@@ -240,8 +245,11 @@ SmmIsSchedulable (
       // 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
@@ -263,12 +271,15 @@ SmmIsSchedulable (
       }\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
       if (EFI_ERROR (Status)) {\r
+        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
         return FALSE;\r
       }\r
 \r
@@ -276,75 +287,96 @@ SmmIsSchedulable (
       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
       Status = PushBool (TRUE);\r
       if (EFI_ERROR (Status)) {\r
+        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
         return FALSE;\r
       }\r
 \r
@@ -352,6 +384,7 @@ SmmIsSchedulable (
       break;\r
 \r
     default:\r
+      DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unknown opcode)\n"));\r
       goto Done;\r
     }\r
 \r