]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c
1. Removed #ifndef to enable Capsule architecture protocol on IPF.
[mirror_edk2.git] / EdkModulePkg / Core / Dxe / DxeMain / DxeProtocolNotify.c
index 53f3b3be9bfb9b684d7098cb1b8035ef4a86f5e5..24ccc49a9b8c412fd6dd7ac5d1f396bd210724bb 100644 (file)
@@ -1,13 +1,13 @@
 /*++\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. 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
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. 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
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 Module Name:\r
 \r
@@ -15,8 +15,8 @@ Module Name:
 \r
 Abstract:\r
 \r
-  This file deals with Architecture Protocol (AP) registration in \r
-  the Dxe Core. The mArchProtocols[] array represents a list of \r
+  This file deals with Architecture Protocol (AP) registration in\r
+  the Dxe Core. The mArchProtocols[] array represents a list of\r
   events that represent the Architectural Protocols.\r
 \r
 --*/\r
@@ -43,23 +43,9 @@ ARCHITECTURAL_PROTOCOL_ENTRY  mArchProtocols[] = {
   { &gEfiRuntimeArchProtocolGuid,          (VOID **)&gRuntime,       NULL, NULL, FALSE },\r
   { &gEfiVariableArchProtocolGuid,         (VOID **)NULL,            NULL, NULL, FALSE },\r
   { &gEfiVariableWriteArchProtocolGuid,    (VOID **)NULL,            NULL, NULL, FALSE },\r
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
-  //\r
-  // UEFI 2.0 added support for Capsule services. DXE CIS ??? Added support for this AP\r
-  //\r
   { &gEfiCapsuleArchProtocolGuid,          (VOID **)NULL,            NULL, NULL, FALSE},\r
-#endif\r
   { &gEfiMonotonicCounterArchProtocolGuid, (VOID **)NULL,            NULL, NULL, FALSE },\r
   { &gEfiResetArchProtocolGuid,            (VOID **)NULL,            NULL, NULL, FALSE },\r
-#if ((EDK_RELEASE_VERSION != 0) && (EFI_SPECIFICATION_VERSION <  0x00020000))\r
-  //\r
-  // The ReportStatusCode Runtime service is in conflict with the UEFI 2.0 specificaiton\r
-  // Thus gEfiStatusCodeRuntimeProtocolGuid becomes a normal protocol in UEFI 2.0 systems\r
-  // It is only included if the EFI 1.10 with Tiano extensions is enabled for backward\r
-  // compatability\r
-  //\r
-  { &gEfiStatusCodeRuntimeProtocolGuid,    (VOID **)&gStatusCode,    NULL, NULL, FALSE },\r
-#endif\r
   { &gEfiRealTimeClockArchProtocolGuid,    (VOID **)NULL,            NULL, NULL, FALSE },\r
   { NULL,                                  (VOID **)NULL,            NULL, NULL, FALSE }\r
 };\r
@@ -79,7 +65,7 @@ Arguments:
 \r
 Returns:\r
   EFI_SUCCESS   - All AP services are available\r
-  EFI_NOT_FOUND - At least one AP service is not available \r
+  EFI_NOT_FOUND - At least one AP service is not available\r
 \r
 --*/\r
 {\r
@@ -94,7 +80,7 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
+STATIC\r
 VOID\r
 EFIAPI\r
 GenericArchProtocolNotify (\r
@@ -106,14 +92,14 @@ GenericArchProtocolNotify (
 Routine Description:\r
   Notification event handler registered by CoreNotifyOnArchProtocolInstallation ().\r
   This notify function is registered for every architectural protocol. This handler\r
-  updates mArchProtocol[] array entry with protocol instance data and sets it's \r
-  present flag to TRUE. If any constructor is required it is executed. The EFI \r
+  updates mArchProtocol[] array entry with protocol instance data and sets it's\r
+  present flag to TRUE. If any constructor is required it is executed. The EFI\r
   System Table headers are updated.\r
 \r
 Arguments:\r
 \r
   Event   - The Event that is being processed, not used.\r
-  \r
+\r
   Context - Event Context, not used.\r
 \r
 Returns:\r
@@ -126,21 +112,23 @@ Returns:
   ARCHITECTURAL_PROTOCOL_ENTRY    *Entry;\r
   VOID                            *Protocol;\r
   BOOLEAN                         Found;\r
-  \r
+  LIST_ENTRY                      *Link;\r
+  LIST_ENTRY                      TempLinkNode;\r
+\r
   Found = FALSE;\r
   for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {\r
\r
+\r
     Status = CoreLocateProtocol (Entry->ProtocolGuid, Entry->Registration, &Protocol);\r
     if (EFI_ERROR (Status)) {\r
       continue;\r
-    } \r
-    \r
+    }\r
+\r
     Found = TRUE;\r
     Entry->Present = TRUE;\r
-    \r
+\r
     //\r
     // Update protocol global variable if one exists. Entry->Protocol points to a global variable\r
-    // if one exists in the DXE core for this Architectural Protocol \r
+    // if one exists in the DXE core for this Architectural Protocol\r
     //\r
     if (Entry->Protocol != NULL) {\r
       *(Entry->Protocol) = Protocol;\r
@@ -158,6 +146,34 @@ Returns:
       // When runtime architectural protocol is available, updates CRC32 in the Debug Table\r
       //\r
       CoreUpdateDebugTableCrc32 ();\r
+\r
+      //\r
+      // Update the Runtime Architectural protocol with the template that the core was\r
+      // using so there would not need to be a dependency on the Runtime AP\r
+      //\r
+\r
+      //\r
+      // Copy all the registered Image to new gRuntime protocol\r
+      //\r
+      for (Link = gRuntimeTemplate.ImageHead.ForwardLink; Link != &gRuntimeTemplate.ImageHead; Link = TempLinkNode.ForwardLink) {\r
+        CopyMem (&TempLinkNode, Link, sizeof(LIST_ENTRY));\r
+        InsertTailList (&gRuntime->ImageHead, Link);\r
+      }\r
+      //\r
+      // Copy all the registered Event to new gRuntime protocol\r
+      //\r
+      for (Link = gRuntimeTemplate.EventHead.ForwardLink; Link != &gRuntimeTemplate.EventHead; Link = TempLinkNode.ForwardLink) {\r
+        CopyMem (&TempLinkNode, Link, sizeof(LIST_ENTRY));\r
+        InsertTailList (&gRuntime->EventHead, Link);\r
+      }\r
+\r
+      //\r
+      // Clean up gRuntimeTemplate\r
+      //\r
+      gRuntimeTemplate.ImageHead.ForwardLink = &gRuntimeTemplate.ImageHead;\r
+      gRuntimeTemplate.ImageHead.BackLink    = &gRuntimeTemplate.ImageHead;\r
+      gRuntimeTemplate.EventHead.ForwardLink = &gRuntimeTemplate.EventHead;\r
+      gRuntimeTemplate.EventHead.BackLink    = &gRuntimeTemplate.EventHead;\r
     }\r
   }\r
 \r
@@ -195,7 +211,7 @@ Returns:
   ARCHITECTURAL_PROTOCOL_ENTRY    *Entry;\r
 \r
   for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {\r
-    \r
+\r
     //\r
     // Create the event\r
     //\r
@@ -212,8 +228,8 @@ Returns:
     // Register for protocol notifactions on this event\r
     //\r
     Status = CoreRegisterProtocolNotify (\r
-              Entry->ProtocolGuid, \r
-              Entry->Event, \r
+              Entry->ProtocolGuid,\r
+              Entry->Event,\r
               &Entry->Registration\r
               );\r
     ASSERT_EFI_ERROR(Status);\r
@@ -239,9 +255,7 @@ static const GUID_TO_STRING_PROTOCOL_ENTRY MissingProtocols[] = {
   { &gEfiRuntimeArchProtocolGuid,          (CHAR16 *)L"Runtime"            },\r
   { &gEfiVariableArchProtocolGuid,         (CHAR16 *)L"Variable"           },\r
   { &gEfiVariableWriteArchProtocolGuid,    (CHAR16 *)L"Variable Write"     },\r
-  #if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
   { &gEfiCapsuleArchProtocolGuid,          (CHAR16 *)L"Capsule"            },\r
-  #endif\r
   { &gEfiMonotonicCounterArchProtocolGuid, (CHAR16 *)L"Monotonic Counter"  },\r
   { &gEfiResetArchProtocolGuid,            (CHAR16 *)L"Reset"              },\r
 //  { &gEfiStatusCodeRuntimeProtocolGuid,       (CHAR16 *)L"Status Code"        },\r
@@ -279,5 +293,5 @@ Returns:
         }\r
       }\r
     }\r
-  } \r
+  }\r
 }\r