OpenCore
1.0.4
OpenCore Bootloader
|
#include <Uefi.h>
#include <Guid/Gpt.h>
#include <IndustryStandard/Mbr.h>
#include <Protocol/BlockIo.h>
#include <Protocol/BlockIo2.h>
#include <Protocol/DiskIo.h>
#include <Protocol/DiskIo2.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/BaseOverflowLib.h>
#include <Library/DebugLib.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcDebugLogLib.h>
#include <Library/OcDevicePathLib.h>
#include <Library/OcFileLib.h>
#include <Library/UefiBootServicesTableLib.h>
Go to the source code of this file.
Macros | |
#define | MBR_PARTITION_ACTIVE 0x80 |
Functions | |
EFI_STATUS | OcDiskInitializeContext (OUT OC_DISK_CONTEXT *Context, IN EFI_HANDLE DiskHandle, IN BOOLEAN UseBlockIo2) |
EFI_STATUS | OcDiskRead (IN OC_DISK_CONTEXT *Context, IN UINT64 Lba, IN UINTN BufferSize, OUT VOID *Buffer) |
EFI_STATUS | OcDiskWrite (IN OC_DISK_CONTEXT *Context, IN UINT64 Lba, IN UINTN BufferSize, IN VOID *Buffer) |
STATIC VOID | InternalDebugPrintPartitionEntry (IN UINTN ErrorLevel, IN CONST CHAR8 *Message, IN CONST EFI_PARTITION_ENTRY *PartitionEntry) |
STATIC EFI_HANDLE | InternalGetDiskHandle (IN EFI_DEVICE_PATH_PROTOCOL *HdDevicePath, IN BOOLEAN IsPartitionPath, OUT BOOLEAN *HasBlockIo2) |
EFI_DEVICE_PATH_PROTOCOL * | OcDiskGetDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *HdDevicePath) |
EFI_HANDLE | OcPartitionGetDiskHandle (IN EFI_DEVICE_PATH_PROTOCOL *HdDevicePath) |
EFI_HANDLE | OcPartitionGetPartitionHandle (IN EFI_DEVICE_PATH_PROTOCOL *HdDevicePath) |
BOOLEAN | OcIsDiskCdRom (IN EFI_DEVICE_PATH_PROTOCOL *DiskDevicePath) |
EFI_STATUS | OcDiskReadElTorito (IN EFI_DEVICE_PATH_PROTOCOL *DiskDevicePath, OUT UINT8 **Buffer, OUT UINTN *BufferSize) |
EFI_DEVICE_PATH_PROTOCOL * | OcDiskFindSystemPartitionPath (IN CONST EFI_DEVICE_PATH_PROTOCOL *DiskDevicePath, OUT UINTN *EspDevicePathSize, OUT EFI_HANDLE *EspDeviceHandle) |
CONST OC_PARTITION_ENTRIES * | OcGetDiskPartitions (IN EFI_HANDLE DiskHandle, IN BOOLEAN UseBlockIo2) |
CONST EFI_PARTITION_ENTRY * | OcGetGptPartitionEntry (IN EFI_HANDLE FsHandle) |
MASTER_BOOT_RECORD * | OcGetDiskMbrTable (IN EFI_HANDLE DiskHandle, IN BOOLEAN CheckPartitions) |
EFI_STATUS | OcDiskGetMbrPartitionIndex (IN EFI_HANDLE PartitionHandle, OUT UINT8 *PartitionIndex) |
EFI_STATUS | OcDiskMarkMbrPartitionActive (IN EFI_HANDLE DiskHandle, IN UINT8 PartitionIndex) |
EFI_DEVICE_PATH_PROTOCOL * | OcDiskFindActiveMbrPartitionPath (IN EFI_DEVICE_PATH_PROTOCOL *DiskDevicePath, OUT UINTN *PartitionDevicePathSize, OUT EFI_HANDLE *PartitionDeviceHandle) |
Variables | |
STATIC EFI_GUID | mInternalDiskPartitionEntriesProtocolGuid |
STATIC EFI_GUID | mInternalPartitionEntryProtocolGuid |
Copyright (C) 2019, Download-Fritz. 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 DiskMisc.c.
#define MBR_PARTITION_ACTIVE 0x80 |
Definition at line 43 of file DiskMisc.c.
STATIC VOID InternalDebugPrintPartitionEntry | ( | IN UINTN | ErrorLevel, |
IN CONST CHAR8 * | Message, | ||
IN CONST EFI_PARTITION_ENTRY * | PartitionEntry ) |
Definition at line 187 of file DiskMisc.c.
STATIC EFI_HANDLE InternalGetDiskHandle | ( | IN EFI_DEVICE_PATH_PROTOCOL * | HdDevicePath, |
IN BOOLEAN | IsPartitionPath, | ||
OUT BOOLEAN * | HasBlockIo2 ) |
Definition at line 216 of file DiskMisc.c.
EFI_DEVICE_PATH_PROTOCOL * OcDiskFindActiveMbrPartitionPath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DiskDevicePath, |
OUT UINTN * | PartitionDevicePathSize, | ||
OUT EFI_HANDLE * | PartitionDeviceHandle ) |
Locate the disk's active MBR partition.
[in] | DiskDevicePath | The Device Path of the disk to scan. |
[out] | PartitionDevicePathSize | The size of the returned Device Path. |
[out] | PartitionDeviceHandle | Device handle of the returned partition. |
Definition at line 1057 of file DiskMisc.c.
EFI_DEVICE_PATH_PROTOCOL * OcDiskFindSystemPartitionPath | ( | IN CONST EFI_DEVICE_PATH_PROTOCOL * | DiskDevicePath, |
OUT UINTN * | EspDevicePathSize, | ||
OUT EFI_HANDLE * | EspDeviceHandle ) |
Locate the disk's EFI System Partition.
[in] | DiskDevicePath | The Device Path of the disk to scan. |
[out] | EspDevicePathSize | The size of the returned Device Path. |
[out] | EspDeviceHandle | Device handle of the returned partition. |
Definition at line 458 of file DiskMisc.c.
EFI_DEVICE_PATH_PROTOCOL * OcDiskGetDevicePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | HdDevicePath | ) |
Retrieve the disk's Device Path from a partition's Device Path.
[in] | HdDevicePath | The Device Path of the partition. |
Device | Path or NULL |
Definition at line 280 of file DiskMisc.c.
EFI_STATUS OcDiskGetMbrPartitionIndex | ( | IN EFI_HANDLE | PartitionHandle, |
OUT UINT8 * | PartitionIndex ) |
Retrieve the MBR partition index for the specified partition.
[in] | PartitionHandle | Partition device handle to retrieve MBR partition index for. |
[out] | PartitionIndex | Pointer to store partition index in. |
EFI_SUCCESS | on success. |
Definition at line 908 of file DiskMisc.c.
EFI_STATUS OcDiskInitializeContext | ( | OUT OC_DISK_CONTEXT * | Context, |
IN EFI_HANDLE | DiskHandle, | ||
IN BOOLEAN | UseBlockIo2 ) |
Initialize disk I/O context.
[out] | Context | Disk I/O context to intialize. |
[in] | DiskHandle | Disk handle with protocols. |
[in] | UseBlockIo2 | Try to use BlockIo2 protocol if available. |
EFI_SUCCESS | on success. |
Definition at line 46 of file DiskMisc.c.
EFI_STATUS OcDiskMarkMbrPartitionActive | ( | IN EFI_HANDLE | DiskHandle, |
IN UINT8 | PartitionIndex ) |
Mark specified MBR partition as active.
[in] | DiskHandle | Disk device handle containing MBR partition table |
[in] | PartitionIndex | MBR partition index. |
EFI_SUCCESS | on success. |
Definition at line 978 of file DiskMisc.c.
EFI_STATUS OcDiskRead | ( | IN OC_DISK_CONTEXT * | Context, |
IN UINT64 | Lba, | ||
IN UINTN | BufferSize, | ||
OUT VOID * | Buffer ) |
Read information from disk.
[in] | Context | Disk I/O context. |
[in] | Lba | LBA number to read from. |
[in] | BufferSize | Buffer size allocated in Buffer. |
[out] | Buffer | Buffer to store data in. |
EFI_SUCCESS | on success. |
Definition at line 116 of file DiskMisc.c.
EFI_STATUS OcDiskReadElTorito | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DiskDevicePath, |
OUT UINT8 ** | Buffer, | ||
OUT UINTN * | BufferSize ) |
Read El-Torito boot sector from CD-ROM device.
[in] | DiskDevicePath | The Device Path of the disk. |
[out] | Buffer | Pointer to pool-allocated buffer containing the boot sector data. |
[out] | BufferSize | Size of Buffer. |
EFI_SUCCESS | on success. |
Definition at line 392 of file DiskMisc.c.
EFI_STATUS OcDiskWrite | ( | IN OC_DISK_CONTEXT * | Context, |
IN UINT64 | Lba, | ||
IN UINTN | BufferSize, | ||
IN VOID * | Buffer ) |
Write information to disk.
[in] | Context | Disk I/O context. |
[in] | Lba | LBA number to write to. |
[in] | BufferSize | Buffer size allocated in Buffer. |
[out] | Buffer | Buffer containing data to write. |
EFI_SUCCESS | on success. |
Definition at line 151 of file DiskMisc.c.
MASTER_BOOT_RECORD * OcGetDiskMbrTable | ( | IN EFI_HANDLE | DiskHandle, |
IN BOOLEAN | CheckPartitions ) |
Retrieve the disk MBR table, if applicable.
[in] | DiskHandle | Disk device handle to retrive MBR partition table from. |
[in] | CheckPartitions | Check partition layout. This should be FALSE for a PBR. |
MBR | partition table or NULL. |
Definition at line 828 of file DiskMisc.c.
CONST OC_PARTITION_ENTRIES * OcGetDiskPartitions | ( | IN EFI_HANDLE | DiskHandle, |
IN BOOLEAN | UseBlockIo2 ) |
Retrieve the disk GPT partitions, if applicable.
[in] | DiskHandle | Disk device handle to retrive partition table from. |
[in] | UseBlockIo2 | Use 2nd revision of Block I/O if available. |
partition | entry list or NULL. |
Definition at line 573 of file DiskMisc.c.
CONST EFI_PARTITION_ENTRY * OcGetGptPartitionEntry | ( | IN EFI_HANDLE | FsHandle | ) |
Retrieve the partition's GPT information, if applicable
[in] | FsHandle | The device handle of the partition to retrieve info of. |
Definition at line 732 of file DiskMisc.c.
BOOLEAN OcIsDiskCdRom | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DiskDevicePath | ) |
Check if disk is a CD-ROM device.
[in] | DiskDevicePath | The Device Path of the disk. |
Device | Path or NULL |
Definition at line 369 of file DiskMisc.c.
EFI_HANDLE OcPartitionGetDiskHandle | ( | IN EFI_DEVICE_PATH_PROTOCOL * | HdDevicePath | ) |
Retrieve the disk's device handle from a partition's Device Path.
[in] | HdDevicePath | The Device Path of the partition. |
Definition at line 331 of file DiskMisc.c.
EFI_HANDLE OcPartitionGetPartitionHandle | ( | IN EFI_DEVICE_PATH_PROTOCOL * | HdDevicePath | ) |
Retrieve the partition's device handle from a partition's Device Path.
[in] | HdDevicePath | The Device Path of the partition. |
Definition at line 353 of file DiskMisc.c.
STATIC EFI_GUID mInternalDiskPartitionEntriesProtocolGuid |
Definition at line 35 of file DiskMisc.c.
STATIC EFI_GUID mInternalPartitionEntryProtocolGuid |
Definition at line 39 of file DiskMisc.c.