]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c
MdeModulePkg DxeCore: Fix issue to print GUID value %g without pointer
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Dispatcher / Dependency.c
index e38605e4c4964b5346a373c80a66e309ef57bba0..1d8a57b87984f655cbbfa0c6620efce1885b2579 100644 (file)
@@ -5,8 +5,8 @@
   if a driver can be scheduled for execution.  The criteria for\r
   schedulability is that the dependency expression is satisfied.\r
 \r
   if a driver can be scheduled for execution.  The criteria for\r
   schedulability is that the dependency expression is satisfied.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -231,14 +231,19 @@ CoreIsSchedulable (
     return FALSE;\r
   }\r
 \r
     return FALSE;\r
   }\r
 \r
+  DEBUG ((DEBUG_DISPATCH, "Evaluate DXE DEPEX for FFS(%g)\n", &DriverEntry->FileName));\r
+\r
   if (DriverEntry->Depex == NULL) {\r
     //\r
     // A NULL Depex means treat the driver like an UEFI 2.0 thing.\r
     //\r
     Status = CoreAllEfiServicesAvailable ();\r
   if (DriverEntry->Depex == NULL) {\r
     //\r
     // A NULL Depex means treat the driver like an UEFI 2.0 thing.\r
     //\r
     Status = CoreAllEfiServicesAvailable ();\r
+    DEBUG ((DEBUG_DISPATCH, "  All UEFI Services Available                     = "));\r
     if (EFI_ERROR (Status)) {\r
     if (EFI_ERROR (Status)) {\r
+      DEBUG ((DEBUG_DISPATCH, "FALSE\n  RESULT = FALSE\n"));\r
       return FALSE;\r
     }\r
       return FALSE;\r
     }\r
+    DEBUG ((DEBUG_DISPATCH, "TRUE\n  RESULT = TRUE\n"));\r
     return TRUE;\r
   }\r
 \r
     return TRUE;\r
   }\r
 \r
@@ -257,6 +262,7 @@ CoreIsSchedulable (
     // past the end of the dependency expression.\r
     //\r
     if (((UINTN)Iterator - (UINTN)DriverEntry->Depex) >= DriverEntry->DepexSize) {\r
     // 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
       return FALSE;\r
     }\r
 \r
@@ -272,6 +278,7 @@ CoreIsSchedulable (
       // If the code flow arrives at this point, there was a BEFORE or AFTER\r
       // that were not the first opcodes.\r
       //\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
       ASSERT (FALSE);\r
     case EFI_DEP_SOR:\r
       //\r
@@ -279,8 +286,11 @@ CoreIsSchedulable (
       // at any other location, then the dependency expression evaluates to FALSE\r
       //\r
       if (Iterator != DriverEntry->Depex) {\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
         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
       //\r
       // Otherwise, it is the first opcode and should be treated as a NOP.\r
       //\r
@@ -296,12 +306,15 @@ CoreIsSchedulable (
       Status = CoreLocateProtocol (&DriverGuid, NULL, &Interface);\r
 \r
       if (EFI_ERROR (Status)) {\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
         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
         *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
         return FALSE;\r
       }\r
 \r
@@ -309,75 +322,97 @@ CoreIsSchedulable (
       break;\r
 \r
     case EFI_DEP_AND:\r
       break;\r
 \r
     case EFI_DEP_AND:\r
+      DEBUG ((DEBUG_DISPATCH, "  AND\n"));\r
       Status = PopBool (&Operator);\r
       if (EFI_ERROR (Status)) {\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
         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
         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
         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
       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
         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
         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
         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
       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
         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
         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
       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
         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
       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
         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
       Status = PopBool (&Operator);\r
       if (EFI_ERROR (Status)) {\r
+        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
         return FALSE;\r
       }\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
       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
       Status = PushBool (TRUE);\r
       if (EFI_ERROR (Status)) {\r
+        DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected error)\n"));\r
         return FALSE;\r
       }\r
 \r
         return FALSE;\r
       }\r
 \r
@@ -385,6 +420,7 @@ CoreIsSchedulable (
       break;\r
 \r
     default:\r
       break;\r
 \r
     default:\r
+      DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unknown opcode)\n"));\r
       goto Done;\r
     }\r
 \r
       goto Done;\r
     }\r
 \r