CloverBootloader/Trash/BiosVideoAuto/MsgLog.c
Sergey Isakov 081d1b5210 added absent files and fixed dependencies
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
2019-09-03 15:19:03 +03:00

102 lines
2.1 KiB
C

/*
* MsgLog.c
*
*
* Created by Slice on 10.04.12.
* Copyright 2012 Home. All rights reserved.
*
*/
#include <Protocol/MsgLog.h>
#include <Library/PrintLib.h>
MESSAGE_LOG_PROTOCOL MsgLogProtocol;
EFI_HANDLE mHandle = NULL;
//define BOOTER_LOG_SIZE (4 * 1024)
/* Sample using inside other module:
@header.h file
#include <Protocol/MsgLog.h>
#include <Library/PrintLib.h>
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;
}