view bootx64.c @ 8:b4db4b6c8d00

can open protocol and close protocol
author taiki
date Fri, 28 Mar 2014 21:29:59 +0900
parents 7047eac9c44e
children d6a8d676a1ac
line wrap: on
line source

#include <efi.h>
#include <efilib.h>

#include "registers.h"

EFI_STATUS
efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
    EFI_LOADED_IMAGE *loadedImage;

    InitializeLib(image, systab);

    uefi_call_wrapper(systab->ConOut->Reset, 2, systab->ConOut, FALSE);

    Print(L"---- start ----\n");

    EFI_STATUS status;
    
    Print(L"Open Protocol\n");
    status = uefi_call_wrapper(
        BS->OpenProtocol,
        6,
        image,
        &LoadedImageProtocol,
        (void **)&loadedImage,
        image,
        NULL,
        EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);

    if (EFI_ERROR(status)) {
        Print(L"OpenProtocol is %r\n", status);
    }

    Print(L"Close Protocol\n");
    status = uefi_call_wrapper(
        BS->CloseProtocol,
        4,
        image,
        &LoadedImageProtocol,
        image,
        NULL);

    if (EFI_ERROR(status)) {
        Print(L"CloseProtocol is %r\n", status);
    }


    return EFI_SUCCESS;
}