From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-x241.google.com (mail-qk0-x241.google.com [IPv6:2607:f8b0:400d:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B276C80347 for ; Mon, 6 Mar 2017 19:14:34 -0800 (PST) Received: by mail-qk0-x241.google.com with SMTP id o135so8866576qke.2 for ; Mon, 06 Mar 2017 19:14:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VFuRPx3NFwuMbXVJqYrZzkSXCE7Vu8r8bNhZdVd9TlY=; b=F5Fl5cCGWAXBZAv/pO73LbiVVWj6DEK11FJ+F67DedoWiELluzGl6UIlO0FK8AMWmy cQe3vTstGk/xpqwid/UZqj0Ir7BiidYTFEqOQysw2pYEuX8KSvpUei9gX8E3XAJtw39V mF6GkY6mw3v2cI+ng3h8hHKaNjMhvvkZJoe6c3k1Qsz03HiGX9GgfhV5W9LFpl5JFwzA yyJ0xoHawkp5sfEeACGt/CRLaTGZVoBjI6gb1OvqtojgVSKe1mPrOGGYoBRHb0RKeTXd HNARSI0kAUtcvTKS8kx+5lsVLmwgCK4Top4AAGl0D+v8trdospNMN20+8dstldjN9F6h f8mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VFuRPx3NFwuMbXVJqYrZzkSXCE7Vu8r8bNhZdVd9TlY=; b=DQa96QvGcyfUtfYadqKbgxzynBeDhB8I6e6gpPJ5vDAQQ6UAVkY+wXB05oahgNe6aF 0KGb4e8DU4hed6WFjGzHSoVzj4HDIlV018UVe/trKMQDgQIgnfbDerP1RS+OJcf27H75 X7xr2WksQE3DCDwDfJwHQeAnOsqarCwKtBapJ+psGYE5+6jO/Qu6/nScMZqEcCmlVkJ+ BwrYQ17FuLgvEZQa7ntYB9spxlJMBopgDkkMlk6XMne8sKgs5Sw5RxlqQOydI41LGbIF plFzjnG3e35kxvZvpdhcL6cOSPBXtgqAAQBc+L7bRH8K+IMGEEi8XewURp0o4AsSfNHv 0iUg== X-Gm-Message-State: AMke39ketS2Uj7dPTc1tGyfhuYp+zQxfVg3AZ2XgF9db2qWd9VFELMGh8BfK3wm1TpMhFw== X-Received: by 10.200.56.210 with SMTP id g18mr18236769qtc.63.1488856473890; Mon, 06 Mar 2017 19:14:33 -0800 (PST) Received: from foober.ini.cmu.edu (pool-108-39-248-175.pitbpa.fios.verizon.net. [108.39.248.175]) by smtp.gmail.com with ESMTPSA id v26sm2901013qtc.13.2017.03.06.19.14.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 19:14:33 -0800 (PST) From: "Gabriel L. Somlo" 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 Date: Mon, 6 Mar 2017 22:14:21 -0500 Message-Id: <1488856465-8965-3-git-send-email-gsomlo@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488856465-8965-1-git-send-email-gsomlo@gmail.com> References: <1488856465-8965-1-git-send-email-gsomlo@gmail.com> Subject: [RFC PATCH 2/6] FswHfsPlus: connect FSW code to EDK2, fix compile discrepancies X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Mar 2017 03:14:35 -0000 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 (gEfiGuid) - edk2's CompareGuid returns TRUE on equal, not 0 like gnu-efi Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gabriel Somlo --- 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 -#include +#include "fsw_efi_edk2_base.h" #define FSW_LITTLE_ENDIAN (1) -- 2.7.4