Refine code to remove the last entry of mArchProtocol.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5917 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8
2008-09-17 13:31:43 +00:00
parent 57b4ecb94b
commit 3f1435782f

View File

@ -39,8 +39,7 @@ ARCHITECTURAL_PROTOCOL_ENTRY mArchProtocols[] = {
{ &gEfiCapsuleArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE }, { &gEfiCapsuleArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },
{ &gEfiMonotonicCounterArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE }, { &gEfiMonotonicCounterArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },
{ &gEfiResetArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE }, { &gEfiResetArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },
{ &gEfiRealTimeClockArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE }, { &gEfiRealTimeClockArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE }
{ NULL, (VOID **)NULL, NULL, NULL, FALSE }
}; };
@ -57,10 +56,10 @@ CoreAllEfiServicesAvailable (
VOID VOID
) )
{ {
ARCHITECTURAL_PROTOCOL_ENTRY *Entry; UINTN Index;
for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) { for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) {
if (!Entry->Present) { if (!mArchProtocols[Index].Present) {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
} }
@ -93,9 +92,11 @@ GenericArchProtocolNotify (
BOOLEAN Found; BOOLEAN Found;
LIST_ENTRY *Link; LIST_ENTRY *Link;
LIST_ENTRY TempLinkNode; LIST_ENTRY TempLinkNode;
UINTN Index;
Found = FALSE; Found = FALSE;
for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) { for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) {
Entry = &mArchProtocols[Index];
Status = CoreLocateProtocol (Entry->ProtocolGuid, Entry->Registration, &Protocol); Status = CoreLocateProtocol (Entry->ProtocolGuid, Entry->Registration, &Protocol);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -180,8 +181,10 @@ CoreNotifyOnArchProtocolInstallation (
{ {
EFI_STATUS Status; EFI_STATUS Status;
ARCHITECTURAL_PROTOCOL_ENTRY *Entry; ARCHITECTURAL_PROTOCOL_ENTRY *Entry;
UINTN Index;
for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) { for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) {
Entry = &mArchProtocols[Index];
// //
// Create the event // Create the event
@ -245,8 +248,10 @@ CoreDisplayMissingArchProtocols (
{ {
CONST GUID_TO_STRING_PROTOCOL_ENTRY *MissingEntry; CONST GUID_TO_STRING_PROTOCOL_ENTRY *MissingEntry;
ARCHITECTURAL_PROTOCOL_ENTRY *Entry; ARCHITECTURAL_PROTOCOL_ENTRY *Entry;
UINTN Index;
for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) { for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) {
Entry = &mArchProtocols[Index];
if (!Entry->Present) { if (!Entry->Present) {
for (MissingEntry = MissingProtocols; TRUE ; MissingEntry++) { for (MissingEntry = MissingProtocols; TRUE ; MissingEntry++) {
if (CompareGuid (Entry->ProtocolGuid, MissingEntry->ProtocolGuid)) { if (CompareGuid (Entry->ProtocolGuid, MissingEntry->ProtocolGuid)) {