-/** @file \r
-\r
+/** @file\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
-Copyright (c) 2006 - 2008, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation. <BR>\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
\r
**/\r
\r
-#include <DxeMain.h>\r
+#include "DxeMain.h"\r
\r
\r
//\r
{ &gEfiRuntimeArchProtocolGuid, (VOID **)&gRuntime, NULL, NULL, FALSE },\r
{ &gEfiVariableArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },\r
{ &gEfiVariableWriteArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },\r
- { &gEfiCapsuleArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE},\r
+ { &gEfiCapsuleArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },\r
{ &gEfiMonotonicCounterArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },\r
{ &gEfiResetArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },\r
- { &gEfiRealTimeClockArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },\r
- { NULL, (VOID **)NULL, NULL, NULL, FALSE }\r
+ { &gEfiRealTimeClockArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE }\r
};\r
\r
+//\r
+// Following is needed to display missing architectural protocols in debug builds\r
+//\r
+typedef struct {\r
+ EFI_GUID *ProtocolGuid;\r
+ CHAR8 *GuidString;\r
+} GUID_TO_STRING_PROTOCOL_ENTRY;\r
\r
-EFI_STATUS\r
-CoreAllEfiServicesAvailable (\r
- VOID\r
- )\r
-/*++\r
+GLOBAL_REMOVE_IF_UNREFERENCED CONST GUID_TO_STRING_PROTOCOL_ENTRY MissingProtocols[] = {\r
+ { &gEfiSecurityArchProtocolGuid, "Security" },\r
+ { &gEfiCpuArchProtocolGuid, "CPU" },\r
+ { &gEfiMetronomeArchProtocolGuid, "Metronome" },\r
+ { &gEfiTimerArchProtocolGuid, "Timer" },\r
+ { &gEfiBdsArchProtocolGuid, "Bds" },\r
+ { &gEfiWatchdogTimerArchProtocolGuid, "Watchdog Timer" },\r
+ { &gEfiRuntimeArchProtocolGuid, "Runtime" },\r
+ { &gEfiVariableArchProtocolGuid, "Variable" },\r
+ { &gEfiVariableWriteArchProtocolGuid, "Variable Write" },\r
+ { &gEfiCapsuleArchProtocolGuid, "Capsule" },\r
+ { &gEfiMonotonicCounterArchProtocolGuid, "Monotonic Counter" },\r
+ { &gEfiResetArchProtocolGuid, "Reset" },\r
+ { &gEfiRealTimeClockArchProtocolGuid, "Real Time Clock" }\r
+};\r
\r
-Routine Description:\r
+/**\r
Return TRUE if all AP services are availible.\r
\r
-Arguments:\r
- NONE\r
-\r
-Returns:\r
- EFI_SUCCESS - All AP services are available\r
- EFI_NOT_FOUND - At least one AP service is not available\r
+ @retval EFI_SUCCESS All AP services are available\r
+ @retval EFI_NOT_FOUND At least one AP service is not available\r
\r
---*/\r
+**/\r
+EFI_STATUS\r
+CoreAllEfiServicesAvailable (\r
+ VOID\r
+ )\r
{\r
- ARCHITECTURAL_PROTOCOL_ENTRY *Entry;\r
+ UINTN Index;\r
\r
- for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {\r
- if (!Entry->Present) {\r
+ for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) {\r
+ if (!mArchProtocols[Index].Present) {\r
return EFI_NOT_FOUND;\r
}\r
}\r
return EFI_SUCCESS;\r
}\r
\r
-STATIC\r
-VOID\r
-EFIAPI\r
-GenericArchProtocolNotify (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- )\r
-/*++\r
\r
-Routine Description:\r
+/**\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
System Table headers are updated.\r
\r
-Arguments:\r
-\r
- Event - The Event that is being processed, not used.\r
-\r
- Context - Event Context, not used.\r
+ @param Event The Event that is being processed, not used.\r
+ @param Context Event Context, not used.\r
\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
+**/\r
+VOID\r
+EFIAPI\r
+GenericArchProtocolNotify (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
{\r
EFI_STATUS Status;\r
ARCHITECTURAL_PROTOCOL_ENTRY *Entry;\r
BOOLEAN Found;\r
LIST_ENTRY *Link;\r
LIST_ENTRY TempLinkNode;\r
+ UINTN Index;\r
\r
Found = FALSE;\r
- for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {\r
+ for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) {\r
+ Entry = &mArchProtocols[Index];\r
\r
Status = CoreLocateProtocol (Entry->ProtocolGuid, Entry->Registration, &Protocol);\r
if (EFI_ERROR (Status)) {\r
//\r
if (Found) {\r
CalculateEfiHdrCrc (&gDxeCoreRT->Hdr);\r
- CalculateEfiHdrCrc (&gDxeCoreBS->Hdr);\r
+ CalculateEfiHdrCrc (&gBS->Hdr);\r
CalculateEfiHdrCrc (&gDxeCoreST->Hdr);\r
CalculateEfiHdrCrc (&gDxeCoreDS->Hdr);\r
}\r
\r
\r
\r
+/**\r
+ Creates an event that is fired everytime a Protocol of a specific type is installed.\r
+\r
+**/\r
VOID\r
CoreNotifyOnArchProtocolInstallation (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Creates an event that is fired everytime a Protocol of a specific type is installed\r
-\r
-Arguments:\r
- NONE\r
-\r
-Returns:\r
- NONE\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
ARCHITECTURAL_PROTOCOL_ENTRY *Entry;\r
+ UINTN Index;\r
\r
- for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {\r
+ for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) {\r
+ Entry = &mArchProtocols[Index];\r
\r
//\r
// Create the event\r
}\r
}\r
\r
-//\r
-// Following is needed to display missing architectural protocols in debug builds\r
-//\r
-typedef struct {\r
- EFI_GUID *ProtocolGuid;\r
- CHAR16 *GuidString;\r
-} GUID_TO_STRING_PROTOCOL_ENTRY;\r
\r
-static const GUID_TO_STRING_PROTOCOL_ENTRY MissingProtocols[] = {\r
- { &gEfiSecurityArchProtocolGuid, (CHAR16 *)L"Security" },\r
- { &gEfiCpuArchProtocolGuid, (CHAR16 *)L"CPU" },\r
- { &gEfiMetronomeArchProtocolGuid, (CHAR16 *)L"Metronome" },\r
- { &gEfiTimerArchProtocolGuid, (CHAR16 *)L"Timer" },\r
- { &gEfiBdsArchProtocolGuid, (CHAR16 *)L"Bds" },\r
- { &gEfiWatchdogTimerArchProtocolGuid, (CHAR16 *)L"Watchdog Timer" },\r
- { &gEfiRuntimeArchProtocolGuid, (CHAR16 *)L"Runtime" },\r
- { &gEfiVariableArchProtocolGuid, (CHAR16 *)L"Variable" },\r
- { &gEfiVariableWriteArchProtocolGuid, (CHAR16 *)L"Variable Write" },\r
- { &gEfiCapsuleArchProtocolGuid, (CHAR16 *)L"Capsule" },\r
- { &gEfiMonotonicCounterArchProtocolGuid, (CHAR16 *)L"Monotonic Counter" },\r
- { &gEfiResetArchProtocolGuid, (CHAR16 *)L"Reset" },\r
-// { &gEfiStatusCodeRuntimeProtocolGuid, (CHAR16 *)L"Status Code" },\r
- { &gEfiRealTimeClockArchProtocolGuid, (CHAR16 *)L"Real Time Clock" }\r
-};\r
+/**\r
+ Displays Architectural protocols that were not loaded and are required for DXE\r
+ core to function. Only used in Debug Builds.\r
\r
+**/\r
VOID\r
CoreDisplayMissingArchProtocols (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Displays Architectural protocols that were not loaded and are required for DXE core to function\r
- Only used in Debug Builds\r
-\r
-Arguments:\r
- NONE\r
-\r
-Returns:\r
- NONE\r
-\r
---*/\r
{\r
- const GUID_TO_STRING_PROTOCOL_ENTRY *MissingEntry;\r
+ CONST GUID_TO_STRING_PROTOCOL_ENTRY *MissingEntry;\r
ARCHITECTURAL_PROTOCOL_ENTRY *Entry;\r
+ UINTN Index;\r
\r
- for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {\r
+ for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) {\r
+ Entry = &mArchProtocols[Index];\r
if (!Entry->Present) {\r
- MissingEntry = MissingProtocols;\r
for (MissingEntry = MissingProtocols; TRUE ; MissingEntry++) {\r
if (CompareGuid (Entry->ProtocolGuid, MissingEntry->ProtocolGuid)) {\r
- DEBUG ((EFI_D_ERROR, "\n%s Arch Protocol not present!!\n", MissingEntry->GuidString));\r
+ DEBUG ((DEBUG_ERROR, "\n%a Arch Protocol not present!!\n", MissingEntry->GuidString));\r
break;\r
}\r
}\r