-/* $Id: fsw_efi.c 29125 2010-05-06 09:43:05Z vboxsync $ */
-/** @file
- * fsw_efi.c - EFI host environment code.
- */
-
-/*
- * Copyright (C) 2010 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+/**
+ * \file fsw_efi.c
+ * EFI host environment code.
*/
/*-
- * This code is based on:
- *
* Copyright (c) 2006 Christoph Pfisterer
*
* Redistribution and use in source and binary forms, with or without
#define DEBUG_LEVEL 0
#ifndef FSTYPE
-#error FSTYPE must be defined!
-#endif
-
-#define DEBUG_VBFS 1
-
-#if DEBUG_VBFS==2
-#define DBG(x...) AsciiPrint(x)
-#elif DEBUG_VBFS==1
-#define DBG(x...) BootLog(x)
-#else
-#define DBG(x...)
+/** The file system type name to use. */
+#define FSTYPE ext2
#endif
#ifdef __MAKEWITH_GNUEFI
EFI_GUID gEfiDriverBindingProtocolGuid = EFI_DRIVER_BINDING_PROTOCOL_GUID;
EFI_GUID gEfiComponentNameProtocolGuid = EFI_COMPONENT_NAME_PROTOCOL_GUID;
-EFI_GUID gEfiDiskIoProtocolGuid = EFI_DISK_IO_PROTOCOL_GUID;
-EFI_GUID gEfiBlockIoProtocolGuid = EFI_BLOCK_IO_PROTOCOL_GUID;
+extern EFI_GUID gEfiDiskIoProtocolGuid = EFI_DISK_IO_PROTOCOL_GUID;
+extern EFI_GUID gEfiBlockIoProtocolGuid = EFI_BLOCK_IO_PROTOCOL_GUID;
EFI_GUID gEfiFileInfoGuid = EFI_FILE_INFO_ID;
EFI_GUID gEfiFileSystemInfoGuid = EFI_FILE_SYSTEM_INFO_ID;
EFI_GUID gEfiFileSystemVolumeLabelInfoIdGuid = EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID;
-#define SimpleFileSystemProtocol FileSystemProtocol
+#define gEfiSimpleFileSystemProtocolGuid FileSystemProtocol
#endif
/** Helper macro for stringification. */
extern struct fsw_fstype_table FSW_FSTYPE_TABLE_NAME(FSTYPE);
-//#include "OverrideFunctions-kabyl.edk2.c.include"
static VOID EFIAPI fsw_efi_clear_cache(VOID) {
int i;
// first, open DiskIO
Status = refit_call6_wrapper(BS->OpenProtocol, ControllerHandle,
- &PROTO_NAME(DiskIoProtocol),
+ &gEfiDiskIoProtocolGuid,
(VOID **) &DiskIo,
This->DriverBindingHandle,
ControllerHandle,
// we were just checking, close it again
refit_call4_wrapper(BS->CloseProtocol, ControllerHandle,
- &PROTO_NAME(DiskIoProtocol),
+ &gEfiDiskIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle);
// next, check BlockIO without actually opening it
Status = refit_call6_wrapper(BS->OpenProtocol, ControllerHandle,
- &PROTO_NAME(BlockIoProtocol),
+ &gEfiBlockIoProtocolGuid,
NULL,
This->DriverBindingHandle,
ControllerHandle,
// open consumed protocols
Status = refit_call6_wrapper(BS->OpenProtocol, ControllerHandle,
- &PROTO_NAME(BlockIoProtocol),
+ &gEfiBlockIoProtocolGuid,
(VOID **) &BlockIo,
This->DriverBindingHandle,
ControllerHandle,
}
Status = refit_call6_wrapper(BS->OpenProtocol, ControllerHandle,
- &PROTO_NAME(DiskIoProtocol),
+ &gEfiDiskIoProtocolGuid,
(VOID **) &DiskIo,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER);
if (EFI_ERROR(Status)) {
+ Print(L"Fsw ERROR: OpenProtocol(DiskIo) returned %x\n", Status);
return Status;
}
Volume->FileSystem.Revision = EFI_FILE_IO_INTERFACE_REVISION;
Volume->FileSystem.OpenVolume = fsw_efi_FileSystem_OpenVolume;
Status = refit_call4_wrapper(BS->InstallMultipleProtocolInterfaces, &ControllerHandle,
- &PROTO_NAME(SimpleFileSystemProtocol),
+ &gEfiSimpleFileSystemProtocolGuid,
&Volume->FileSystem,
NULL);
if (EFI_ERROR(Status)) {
FreePool(Volume);
refit_call4_wrapper(BS->CloseProtocol, ControllerHandle,
- &PROTO_NAME(DiskIoProtocol),
+ &gEfiDiskIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle);
}
// get the installed SimpleFileSystem interface
Status = refit_call6_wrapper(BS->OpenProtocol, ControllerHandle,
- &PROTO_NAME(SimpleFileSystemProtocol),
+ &gEfiSimpleFileSystemProtocolGuid,
(VOID **) &FileSystem,
This->DriverBindingHandle,
ControllerHandle,
// uninstall Simple File System protocol
Status = refit_call4_wrapper(BS->UninstallMultipleProtocolInterfaces, ControllerHandle,
- &PROTO_NAME(SimpleFileSystemProtocol), &Volume->FileSystem,
+ &gEfiSimpleFileSystemProtocolGuid, &Volume->FileSystem,
NULL);
if (EFI_ERROR(Status)) {
// Print(L"Fsw ERROR: UninstallMultipleProtocolInterfaces returned %x\n", Status);
// close the consumed protocols
Status = refit_call4_wrapper(BS->CloseProtocol, ControllerHandle,
- &PROTO_NAME(DiskIoProtocol),
+ &gEfiDiskIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle);
-/* $Id: fsw_efi.h 33540 2010-10-28 09:27:05Z vboxsync $ */
-/** @file
- * fsw_efi.h - EFI host environment header.
- */
-
-/*
- * Copyright (C) 2010 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
+/**
+ * \file fsw_efi.h
+ * EFI host environment header.
+*/
/*-
- * This code is based on:
- *
- * Copyright (c) 2006 Christoph Pfisterer
+ * Copyright (c) 2006 Christoph Pfisterer
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
#define CompareGuid(a, b) CompareGuid(a, b)==0
#endif
-// extern CHAR8 *msgCursor;
-// extern MESSAGE_LOG_PROTOCOL *Msg;
-
/**
* EFI Host: Private per-volume structure.
*/
#ifdef __MAKEWITH_GNUEFI
#include "edk2/DriverBinding.h"
#include "edk2/ComponentName.h"
+extern EFI_GUID gEfiDiskIoProtocolGuid;
+extern EFI_GUID gEfiBlockIoProtocolGuid;
#endif
#include "../include/refit_call_wrapper.h"
Print(L" ");
#endif
DPRINT(L"Scanning disks\n");
- Status = refit_call5_wrapper(BS->LocateHandleBuffer, ByProtocol, &PROTO_NAME(DiskIoProtocol), NULL, &HandleCount, &Handles);
+ Status = refit_call5_wrapper(BS->LocateHandleBuffer, ByProtocol, &gEfiDiskIoProtocolGuid, NULL, &HandleCount, &Handles);
if (Status == EFI_NOT_FOUND)
return -1; // no filesystems. strange, but true...
for (i = 0; i < HandleCount; i++) {
EFI_DISK_IO *diskio;
EFI_BLOCK_IO *blockio;
- Status = refit_call3_wrapper(BS->HandleProtocol, Handles[i], &PROTO_NAME(DiskIoProtocol), (VOID **) &diskio);
+ Status = refit_call3_wrapper(BS->HandleProtocol, Handles[i], &gEfiDiskIoProtocolGuid, (VOID **) &diskio);
if (Status != 0)
continue;
- Status = refit_call3_wrapper(BS->HandleProtocol, Handles[i], &PROTO_NAME(BlockIoProtocol), (VOID **) &blockio);
+ Status = refit_call3_wrapper(BS->HandleProtocol, Handles[i], &gEfiBlockIoProtocolGuid, (VOID **) &blockio);
if (Status != 0)
continue;
struct fsw_volume *vol = create_dummy_volume(diskio, blockio->Media->MediaId);