/* * MsgLog.c * * * Created by Slice on 10.04.12. * Copyright 2012 Home. All rights reserved. * */ #include #include MESSAGE_LOG_PROTOCOL MsgLogProtocol; EFI_HANDLE mHandle = NULL; //define BOOTER_LOG_SIZE (4 * 1024) /* Sample using inside other module: @header.h file #include #include extern CHAR8 *msgCursor; extern MESSAGE_LOG_PROTOCOL *Msg; @main.c #if DEBUG_ACPI==2 #define DBG(x...) AsciiPrint(x) #elif DEBUG_ACPI==1 #define DBG(x...) BootLog(x) #else #define DBG(x...) #endif CHAR8 *msgCursor; MESSAGE_LOG_PROTOCOL *Msg; @entry point Msg = NULL; Status = gBS->LocateProtocol(&gMsgLogProtocolGuid, NULL, (VOID **) &Msg); if (!EFI_ERROR(Status) && (Msg != NULL)) { msgCursor = Msg->Cursor; BootLog("MsgLog Protocol installed in AcpiPlatform\n"); } @inf [Packages] CloverPkg.dec [LibraryClasses] PrintLib [Protocols] gMsgLogProtocolGuid [Depex] ... AND gMsgLogProtocolGuid -- no! */ /************************************************************************************** * Entry point **************************************************************************************/ /** * MsgLog entry point. Installs MESSAGE_LOG_PROTOCOL. */ EFI_STATUS MsgLogEntrypoint ( IN EFI_BOOT_SERVICES* gBS ) { EFI_STATUS Status = EFI_SUCCESS; CHAR8 *tmp; mHandle = NULL; Status = gBS->AllocatePool ( EfiBootServicesData, BOOTER_LOG_SIZE, (VOID**) &tmp ); if (EFI_ERROR (Status)) { return Status; } // Print(L"MsgLogProtocol installed!\n"); gBS->SetMem (tmp, BOOTER_LOG_SIZE, 0); MsgLogProtocol.Log = tmp; MsgLogProtocol.Cursor = tmp; MsgLogProtocol.SizeOfLog = 0; MsgLogProtocol.Dirty = FALSE; Status = gBS->InstallMultipleProtocolInterfaces ( &mHandle, &gMsgLogProtocolGuid, &MsgLogProtocol, NULL ); return Status; }