From: "Gabriel L. Somlo" <gsomlo@gmail.com>
To: edk2-devel@ml01.01.org
Cc: lersek@redhat.com, jordan.l.justen@intel.com,
reza.jelveh@tuhh.de, agraf@suse.de, kraxel@redhat.com
Subject: [RFC PATCH 2/6] FswHfsPlus: connect FSW code to EDK2, fix compile discrepancies
Date: Mon, 6 Mar 2017 22:14:21 -0500 [thread overview]
Message-ID: <1488856465-8965-3-git-send-email-gsomlo@gmail.com> (raw)
In-Reply-To: <1488856465-8965-1-git-send-email-gsomlo@gmail.com>
Connect FSW to EDK2:
- in fsw_efi_base.h, s/efi[lib].h/fsw_efi_edk2_base.h/
Fix compile discrepancies:
- Fix FSW_INVALID_BNO, FSW_EFI_STRINGIFY macros
- Remove EFI_DRIVER_ENTRY_POINT, InitializeLib() call
- use correct protocol name GUIDs (gEfi<ProtoName>Guid)
- edk2's CompareGuid returns TRUE on equal, not 0 like gnu-efi
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
---
OvmfPkg/FswHfsPlus/fsw_core.h | 2 +-
OvmfPkg/FswHfsPlus/fsw_efi.c | 36 ++++++++++++++++--------------------
OvmfPkg/FswHfsPlus/fsw_efi_base.h | 3 +--
3 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/OvmfPkg/FswHfsPlus/fsw_core.h b/OvmfPkg/FswHfsPlus/fsw_core.h
index 0041ce1..a611b19 100644
--- a/OvmfPkg/FswHfsPlus/fsw_core.h
+++ b/OvmfPkg/FswHfsPlus/fsw_core.h
@@ -52,7 +52,7 @@
#define FSW_FSTYPE_TABLE_NAME(t) FSW_CONCAT3(fsw_,t,_table)
/** Indicates that the block cache entry is empty. */
-#define FSW_INVALID_BNO (~0UL)
+#define FSW_INVALID_BNO (~0U)
//
diff --git a/OvmfPkg/FswHfsPlus/fsw_efi.c b/OvmfPkg/FswHfsPlus/fsw_efi.c
index c024162..d2b53a7 100644
--- a/OvmfPkg/FswHfsPlus/fsw_efi.c
+++ b/OvmfPkg/FswHfsPlus/fsw_efi.c
@@ -46,7 +46,7 @@
#endif
/** Helper macro for stringification. */
-#define FSW_EFI_STRINGIFY(x) L#x
+#define FSW_EFI_STRINGIFY(x) #x
/** Expands to the EFI driver name given the file system type name. */
#define FSW_EFI_DRIVER_NAME(t) L"Fsw " FSW_EFI_STRINGIFY(t) L" File System Driver"
@@ -149,8 +149,6 @@ struct fsw_host_table fsw_efi_host_table = {
extern struct fsw_fstype_table FSW_FSTYPE_TABLE_NAME(FSTYPE);
-EFI_DRIVER_ENTRY_POINT(fsw_efi_main)
-
/**
* Image entry point. Installs the Driver Binding and Component Name protocols
* on the image's handle. Actually mounting a file system is initiated through
@@ -162,14 +160,12 @@ EFI_STATUS EFIAPI fsw_efi_main(IN EFI_HANDLE ImageHandle,
{
EFI_STATUS Status;
- InitializeLib(ImageHandle, SystemTable);
-
// complete Driver Binding protocol instance
fsw_efi_DriverBinding_table.ImageHandle = ImageHandle;
fsw_efi_DriverBinding_table.DriverBindingHandle = ImageHandle;
// install Driver Binding protocol
Status = BS->InstallProtocolInterface(&fsw_efi_DriverBinding_table.DriverBindingHandle,
- &DriverBindingProtocol,
+ &gEfiDriverBindingProtocolGuid,
EFI_NATIVE_INTERFACE,
&fsw_efi_DriverBinding_table);
if (EFI_ERROR (Status)) {
@@ -178,7 +174,7 @@ EFI_STATUS EFIAPI fsw_efi_main(IN EFI_HANDLE ImageHandle,
// install Component Name protocol
Status = BS->InstallProtocolInterface(&fsw_efi_DriverBinding_table.DriverBindingHandle,
- &ComponentNameProtocol,
+ &gEfiComponentNameProtocolGuid,
EFI_NATIVE_INTERFACE,
&fsw_efi_ComponentName_table);
if (EFI_ERROR (Status)) {
@@ -206,7 +202,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Supported(IN EFI_DRIVER_BINDING_PROTOCOL
// first, open DiskIO
Status = BS->OpenProtocol(ControllerHandle,
- &DiskIoProtocol,
+ &gEfiDiskIoProtocolGuid,
(VOID **) &DiskIo,
This->DriverBindingHandle,
ControllerHandle,
@@ -216,13 +212,13 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Supported(IN EFI_DRIVER_BINDING_PROTOCOL
// we were just checking, close it again
BS->CloseProtocol(ControllerHandle,
- &DiskIoProtocol,
+ &gEfiDiskIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle);
// next, check BlockIO without actually opening it
Status = BS->OpenProtocol(ControllerHandle,
- &BlockIoProtocol,
+ &gEfiBlockIoProtocolGuid,
NULL,
This->DriverBindingHandle,
ControllerHandle,
@@ -258,7 +254,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL *T
// open consumed protocols
Status = BS->OpenProtocol(ControllerHandle,
- &BlockIoProtocol,
+ &gEfiBlockIoProtocolGuid,
(VOID **) &BlockIo,
This->DriverBindingHandle,
ControllerHandle,
@@ -269,7 +265,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL *T
}
Status = BS->OpenProtocol(ControllerHandle,
- &DiskIoProtocol,
+ &gEfiDiskIoProtocolGuid,
(VOID **) &DiskIo,
This->DriverBindingHandle,
ControllerHandle,
@@ -297,7 +293,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL *T
Volume->FileSystem.Revision = EFI_FILE_IO_INTERFACE_REVISION;
Volume->FileSystem.OpenVolume = fsw_efi_FileSystem_OpenVolume;
Status = BS->InstallMultipleProtocolInterfaces(&ControllerHandle,
- &FileSystemProtocol, &Volume->FileSystem,
+ &gEfiSimpleFileSystemProtocolGuid, &Volume->FileSystem,
NULL);
if (EFI_ERROR(Status))
Print(L"Fsw ERROR: InstallMultipleProtocolInterfaces returned %x\n", Status);
@@ -310,7 +306,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL *T
FreePool(Volume);
BS->CloseProtocol(ControllerHandle,
- &DiskIoProtocol,
+ &gEfiDiskIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle);
}
@@ -343,7 +339,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Stop(IN EFI_DRIVER_BINDING_PROTOCOL *T
// get the installed SimpleFileSystem interface
Status = BS->OpenProtocol(ControllerHandle,
- &FileSystemProtocol,
+ &gEfiSimpleFileSystemProtocolGuid,
(VOID **) &FileSystem,
This->DriverBindingHandle,
ControllerHandle,
@@ -356,7 +352,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Stop(IN EFI_DRIVER_BINDING_PROTOCOL *T
// uninstall Simple File System protocol
Status = BS->UninstallMultipleProtocolInterfaces(ControllerHandle,
- &FileSystemProtocol, &Volume->FileSystem,
+ &gEfiSimpleFileSystemProtocolGuid, &Volume->FileSystem,
NULL);
if (EFI_ERROR(Status)) {
Print(L"Fsw ERROR: UninstallMultipleProtocolInterfaces returned %x\n", Status);
@@ -373,7 +369,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Stop(IN EFI_DRIVER_BINDING_PROTOCOL *T
// close the consumed protocols
Status = BS->CloseProtocol(ControllerHandle,
- &DiskIoProtocol,
+ &gEfiDiskIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle);
@@ -884,14 +880,14 @@ EFI_STATUS fsw_efi_dnode_getinfo(IN FSW_FILE_DATA *File,
UINTN RequiredSize;
struct fsw_volume_stat vsb;
- if (CompareGuid(InformationType, &GenericFileInfo) == 0) {
+ if (CompareGuid(InformationType, &gEfiFileInfoGuid)) {
#if DEBUG_LEVEL
Print(L"fsw_efi_dnode_getinfo: FILE_INFO\n");
#endif
Status = fsw_efi_dnode_fill_FileInfo(Volume, File->shand.dnode, BufferSize, Buffer);
- } else if (CompareGuid(InformationType, &FileSystemInfo) == 0) {
+ } else if (CompareGuid(InformationType, &gEfiFileSystemInfoGuid)) {
#if DEBUG_LEVEL
Print(L"fsw_efi_dnode_getinfo: FILE_SYSTEM_INFO\n");
#endif
@@ -922,7 +918,7 @@ EFI_STATUS fsw_efi_dnode_getinfo(IN FSW_FILE_DATA *File,
*BufferSize = RequiredSize;
Status = EFI_SUCCESS;
- } else if (CompareGuid(InformationType, &FileSystemVolumeLabelInfo) == 0) {
+ } else if (CompareGuid(InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
#if DEBUG_LEVEL
Print(L"fsw_efi_dnode_getinfo: FILE_SYSTEM_VOLUME_LABEL\n");
#endif
diff --git a/OvmfPkg/FswHfsPlus/fsw_efi_base.h b/OvmfPkg/FswHfsPlus/fsw_efi_base.h
index 3643b3b..5884b92 100644
--- a/OvmfPkg/FswHfsPlus/fsw_efi_base.h
+++ b/OvmfPkg/FswHfsPlus/fsw_efi_base.h
@@ -39,8 +39,7 @@
#define _FSW_EFI_BASE_H_
-#include <efi.h>
-#include <efilib.h>
+#include "fsw_efi_edk2_base.h"
#define FSW_LITTLE_ENDIAN (1)
--
2.7.4
next prev parent reply other threads:[~2017-03-07 3:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-07 3:14 [RFC PATCH 0/6] OVMF: HFS+ (and Mac OS X boot) Gabriel L. Somlo
2017-03-07 3:14 ` [RFC PATCH 1/6] FswHfsPlus: add File System Wrapper (FSW) interface code Gabriel L. Somlo
2017-03-07 3:14 ` Gabriel L. Somlo [this message]
2017-03-07 3:14 ` [RFC PATCH 3/6] FswHfsPlus: implement FSW driver for the HFS+ file system Gabriel L. Somlo
2017-03-07 3:14 ` [RFC PATCH 4/6] EdkCompatibilityPkg: allow ConsoleControl protocol to be used Gabriel L. Somlo
2017-03-07 3:14 ` [RFC PATCH 5/6] OvmfPkg: add Apple boot support Gabriel L. Somlo
2017-03-07 16:14 ` Laszlo Ersek
2017-03-07 3:14 ` [RFC PATCH 6/6] OvmfPkg: enable AppleSupport library for Ovmf firmware Gabriel L. Somlo
2017-03-07 16:21 ` Laszlo Ersek
2017-03-07 15:41 ` [RFC PATCH 0/6] OVMF: HFS+ (and Mac OS X boot) Laszlo Ersek
2017-03-29 23:22 ` Phil Dennis-Jordan
2017-03-31 20:01 ` Gabriel L. Somlo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1488856465-8965-3-git-send-email-gsomlo@gmail.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox