OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
OcAppleDiskImageBlockIo.c File Reference
#include <Uefi.h>
#include <Protocol/AppleDiskImage.h>
#include <Protocol/AppleRamDisk.h>
#include <Protocol/BlockIo.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcApfsLib.h>
#include <Library/OcAppleDiskImageLib.h>
#include <Library/OcStringLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include "OcAppleDiskImageLibInternal.h"

Go to the source code of this file.

Data Structures

struct  OC_APPLE_DISK_IMAGE_MOUNTED_DATA
 

Macros

#define DMG_FILE_PATH_LEN   (L_STR_LEN (L"DMG_.dmg") + 16 + 1)
 
#define OC_APPLE_DISK_IMAGE_MOUNTED_DATA_SIGNATURE    SIGNATURE_32('D','m','g','I')
 
#define OC_APPLE_DISK_IMAGE_MOUNTED_DATA_FROM_THIS(This)
 

Typedefs

struct { 
 
   VENDOR_DEFINED_DEVICE_PATH   Vendor 
 
   UINT64   Length 
 
DMG_SIZE_DEVICE_PATH 
 
struct { 
 
   EFI_DEVICE_PATH_PROTOCOL   Header 
 
   CHAR16   PathName [DMG_FILE_PATH_LEN
 
DMG_FILEPATH_DEVICE_PATH 
 
struct { 
 
   APPLE_RAM_DISK_DP_HEADER   RamDisk 
 
   DMG_FILEPATH_DEVICE_PATH   FilePath 
 
   DMG_SIZE_DEVICE_PATH   Size 
 
   EFI_DEVICE_PATH_PROTOCOL   End 
 
DMG_DEVICE_PATH 
 

Functions

STATIC EFI_STATUS EFIAPI DiskImageBlockIoReset (IN EFI_BLOCK_IO_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
 
STATIC EFI_STATUS EFIAPI DiskImageBlockIoReadBlocks (IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer)
 
STATIC EFI_STATUS EFIAPI DiskImageBlockIoWriteBlocks (IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, IN VOID *Buffer)
 
STATIC EFI_STATUS EFIAPI DiskImageBlockIoFlushBlocks (IN EFI_BLOCK_IO_PROTOCOL *This)
 
STATIC VOID InternalConstructDmgDevicePath (IN OUT OC_APPLE_DISK_IMAGE_MOUNTED_DATA *DiskImageData, IN UINTN FileSize)
 
EFI_HANDLE OcAppleDiskImageInstallBlockIo (IN OC_APPLE_DISK_IMAGE_CONTEXT *Context, IN UINTN FileSize, OUT CONST EFI_DEVICE_PATH_PROTOCOL **DevicePath OPTIONAL, OUT UINTN *DevicePathSize OPTIONAL)
 
VOID OcAppleDiskImageUninstallBlockIo (IN OC_APPLE_DISK_IMAGE_CONTEXT *Context, IN VOID *BlockIoHandle)
 

Variables

STATIC UINT32 mDmgCounter
 FIXME: This should exist on a protocol basis!
 
STATIC CONST EFI_BLOCK_IO_PROTOCOL mDiskImageBlockIo
 

Detailed Description

Copyright (C) 2019, Goldfish64. All rights reserved.

This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Definition in file OcAppleDiskImageBlockIo.c.

Macro Definition Documentation

◆ DMG_FILE_PATH_LEN

#define DMG_FILE_PATH_LEN   (L_STR_LEN (L"DMG_.dmg") + 16 + 1)

Definition at line 31 of file OcAppleDiskImageBlockIo.c.

◆ OC_APPLE_DISK_IMAGE_MOUNTED_DATA_FROM_THIS

#define OC_APPLE_DISK_IMAGE_MOUNTED_DATA_FROM_THIS ( This)
Value:

Definition at line 60 of file OcAppleDiskImageBlockIo.c.

◆ OC_APPLE_DISK_IMAGE_MOUNTED_DATA_SIGNATURE

#define OC_APPLE_DISK_IMAGE_MOUNTED_DATA_SIGNATURE    SIGNATURE_32('D','m','g','I')

Definition at line 57 of file OcAppleDiskImageBlockIo.c.

Typedef Documentation

◆ [struct]

typedef PACKED struct { ... } DMG_DEVICE_PATH

◆ [struct]

typedef PACKED struct { ... } DMG_FILEPATH_DEVICE_PATH

◆ [struct]

typedef PACKED struct { ... } DMG_SIZE_DEVICE_PATH

Function Documentation

◆ DiskImageBlockIoFlushBlocks()

STATIC EFI_STATUS EFIAPI DiskImageBlockIoFlushBlocks ( IN EFI_BLOCK_IO_PROTOCOL * This)

Definition at line 151 of file OcAppleDiskImageBlockIo.c.

◆ DiskImageBlockIoReadBlocks()

STATIC EFI_STATUS EFIAPI DiskImageBlockIoReadBlocks ( IN EFI_BLOCK_IO_PROTOCOL * This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
OUT VOID * Buffer )

Definition at line 91 of file OcAppleDiskImageBlockIo.c.

◆ DiskImageBlockIoReset()

STATIC EFI_STATUS EFIAPI DiskImageBlockIoReset ( IN EFI_BLOCK_IO_PROTOCOL * This,
IN BOOLEAN ExtendedVerification )

Definition at line 80 of file OcAppleDiskImageBlockIo.c.

◆ DiskImageBlockIoWriteBlocks()

STATIC EFI_STATUS EFIAPI DiskImageBlockIoWriteBlocks ( IN EFI_BLOCK_IO_PROTOCOL * This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
IN VOID * Buffer )

Definition at line 137 of file OcAppleDiskImageBlockIo.c.

◆ InternalConstructDmgDevicePath()

STATIC VOID InternalConstructDmgDevicePath ( IN OUT OC_APPLE_DISK_IMAGE_MOUNTED_DATA * DiskImageData,
IN UINTN FileSize )

Definition at line 162 of file OcAppleDiskImageBlockIo.c.

◆ OcAppleDiskImageInstallBlockIo()

EFI_HANDLE OcAppleDiskImageInstallBlockIo ( IN OC_APPLE_DISK_IMAGE_CONTEXT * Context,
IN UINTN FileSize,
OUT CONST EFI_DEVICE_PATH_PROTOCOL **DevicePath OPTIONAL,
OUT UINTN *DevicePathSize OPTIONAL )

Definition at line 242 of file OcAppleDiskImageBlockIo.c.

◆ OcAppleDiskImageUninstallBlockIo()

VOID OcAppleDiskImageUninstallBlockIo ( IN OC_APPLE_DISK_IMAGE_CONTEXT * Context,
IN VOID * BlockIoHandle )

Definition at line 330 of file OcAppleDiskImageBlockIo.c.

Variable Documentation

◆ End

EFI_DEVICE_PATH_PROTOCOL End

Definition at line 52 of file OcAppleDiskImageBlockIo.c.

◆ FilePath

Definition at line 50 of file OcAppleDiskImageBlockIo.c.

◆ Header

EFI_DEVICE_PATH_PROTOCOL Header

Definition at line 41 of file OcAppleDiskImageBlockIo.c.

◆ Length

UINT64 Length

Definition at line 37 of file OcAppleDiskImageBlockIo.c.

◆ mDiskImageBlockIo

STATIC CONST EFI_BLOCK_IO_PROTOCOL mDiskImageBlockIo
Initial value:
= {
EFI_BLOCK_IO_PROTOCOL_REVISION,
NULL,
}
STATIC EFI_STATUS EFIAPI DiskImageBlockIoReset(IN EFI_BLOCK_IO_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
STATIC EFI_STATUS EFIAPI DiskImageBlockIoWriteBlocks(IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, IN VOID *Buffer)
STATIC EFI_STATUS EFIAPI DiskImageBlockIoFlushBlocks(IN EFI_BLOCK_IO_PROTOCOL *This)
STATIC EFI_STATUS EFIAPI DiskImageBlockIoReadBlocks(IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer)

Definition at line 232 of file OcAppleDiskImageBlockIo.c.

◆ mDmgCounter

STATIC UINT32 mDmgCounter

FIXME: This should exist on a protocol basis!

Definition at line 158 of file OcAppleDiskImageBlockIo.c.

◆ PathName

CHAR16 PathName[DMG_FILE_PATH_LEN]

A NULL-terminated Path string including directory and file names.

Definition at line 45 of file OcAppleDiskImageBlockIo.c.

◆ RamDisk

Definition at line 49 of file OcAppleDiskImageBlockIo.c.

◆ Size

Definition at line 51 of file OcAppleDiskImageBlockIo.c.

◆ Vendor

VENDOR_DEFINED_DEVICE_PATH Vendor

Definition at line 36 of file OcAppleDiskImageBlockIo.c.