/**
 * PROJECT:         ExectOS
 * COPYRIGHT:       See COPYING.md in the top level directory
 * FILE:            xtldr/includes/xtbm.h
 * DESCRIPTION:     XTLDR Boot Loader related structures and routines forward references
 * DEVELOPERS:      Rafal Kupiec <belliash@codingworkshop.eu.org>
 */

#ifndef __XTLDR_BOOTMAN_H
#define __XTLDR_BOOTMAN_H

#include <xtbmapi.h>


/* XTLDR routine callbacks */
typedef VOID (BMPRINTCHAR)(IN USHORT Character);

XTCDECL
EFI_STATUS
BlMemoryAllocatePages(IN UINT64 Pages,
                   OUT PEFI_PHYSICAL_ADDRESS Memory);

XTCDECL
EFI_STATUS
BlMemoryAllocatePool(IN UINT_PTR Size,
                  OUT PVOID *Memory);

/* XTLDR routines forward references */
XTCDECL
VOID
BlConsoleClearScreen();

XTCDECL
VOID
BlConsoleDisableCursor();

XTCDECL
VOID
BlConsoleEnableCursor();

XTCDECL
EFI_STATUS
BlMemoreFreePages(IN UINT64 Pages,
               IN EFI_PHYSICAL_ADDRESS Memory);

XTCDECL
EFI_STATUS
BlMemoryFreePool(IN PVOID Memory);


XTCDECL
VOID
BlConsoleInitialize();

XTCDECL
VOID
BlConsolePrint(IN PUINT16 Format,
        IN ...);

XTCDECL
VOID
BlpConsolePrintChar(IN USHORT Character);

XTCDECL
VOID
BlpStringPrint(IN IN BMPRINTCHAR PrintCharRoutine,
              IN PUINT16 Format,
              IN VA_LIST Arguments);

XTCDECL
EFI_STATUS
BmStartXtLoader(IN EFI_HANDLE ImageHandle,
                IN PEFI_SYSTEM_TABLE SystemTable);


XTCDECL
VOID
BlpStringFormat(IN BMPRINTCHAR PrintCharRoutine,
                IN PUINT16 Format,
                IN ...);

XTCDECL
XTSTATUS
BlConfigParseIniFile(IN PWCHAR FileContents,
                     OUT PLIST_ENTRY Sections);

XTCDECL
VOID
BlpConfigParseCommandLine(VOID);

XTCDECL
VOID
BlpStringPrintSigned32(IN BMPRINTCHAR PrintCharRoutine,
                       IN INT Number,
                       IN UINT Base);

XTCDECL
VOID
BlpStringPrintSigned64(IN BMPRINTCHAR PrintCharRoutine,
                       IN INT_PTR Number,
                       IN UINT_PTR Base);

XTCDECL
VOID
BlpStringPrintUnsigned32(IN BMPRINTCHAR PrintCharRoutine,
                         IN UINT Number,
                         IN UINT Base,
                         IN UINT Padding);

XTCDECL
VOID
BlpStringPrintUnsigned64(IN BMPRINTCHAR PrintCharRoutine,
                         IN UINT_PTR Number,
                         IN UINT_PTR Base,
                         IN UINT_PTR Padding);

XTCDECL
UINT64
BlpStringReadPadding(IN PUINT16 *Format);

XTCDECL
VOID
BlpConfigUpdateGlobalConfiguration(IN PWCHAR Options);

#endif /* __XTLDR_BOOTMAN_H */