mirror of
https://github.com/ipxe/ipxe.git
synced 2026-05-04 12:01:25 +02:00
[efi] Add partition information protocol header and GUID definition
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
c8a96482e2
commit
75115ee998
54
src/include/ipxe/efi/IndustryStandard/Mbr.h
Normal file
54
src/include/ipxe/efi/IndustryStandard/Mbr.h
Normal file
@ -0,0 +1,54 @@
|
||||
/** @file
|
||||
Legacy Master Boot Record Format Definition.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_SECBOOT ( PERMITTED );
|
||||
|
||||
#define MBR_SIGNATURE 0xaa55
|
||||
|
||||
#define EXTENDED_DOS_PARTITION 0x05
|
||||
#define EXTENDED_WINDOWS_PARTITION 0x0F
|
||||
|
||||
#define MAX_MBR_PARTITIONS 4
|
||||
|
||||
#define PMBR_GPT_PARTITION 0xEE
|
||||
#define EFI_PARTITION 0xEF
|
||||
|
||||
#define MBR_SIZE 512
|
||||
|
||||
#pragma pack(1)
|
||||
///
|
||||
/// MBR Partition Entry
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 BootIndicator;
|
||||
UINT8 StartHead;
|
||||
UINT8 StartSector;
|
||||
UINT8 StartTrack;
|
||||
UINT8 OSIndicator;
|
||||
UINT8 EndHead;
|
||||
UINT8 EndSector;
|
||||
UINT8 EndTrack;
|
||||
UINT8 StartingLBA[4];
|
||||
UINT8 SizeInLBA[4];
|
||||
} MBR_PARTITION_RECORD;
|
||||
|
||||
///
|
||||
/// MBR Partition Table
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 BootStrapCode[440];
|
||||
UINT8 UniqueMbrSignature[4];
|
||||
UINT8 Unknown[2];
|
||||
MBR_PARTITION_RECORD Partition[MAX_MBR_PARTITIONS];
|
||||
UINT16 Signature;
|
||||
} MASTER_BOOT_RECORD;
|
||||
|
||||
#pragma pack()
|
||||
67
src/include/ipxe/efi/Protocol/PartitionInfo.h
Normal file
67
src/include/ipxe/efi/Protocol/PartitionInfo.h
Normal file
@ -0,0 +1,67 @@
|
||||
/** @file
|
||||
This file defines the EFI Partition Information Protocol.
|
||||
|
||||
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Revision Reference:
|
||||
This Protocol is introduced in UEFI Specification 2.7
|
||||
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_SECBOOT ( PERMITTED );
|
||||
|
||||
#include <ipxe/efi/IndustryStandard/Mbr.h>
|
||||
#include <ipxe/efi/Uefi/UefiGpt.h>
|
||||
|
||||
//
|
||||
// EFI Partition Information Protocol GUID value
|
||||
//
|
||||
#define EFI_PARTITION_INFO_PROTOCOL_GUID \
|
||||
{ 0x8cf2f62c, 0xbc9b, 0x4821, { 0x80, 0x8d, 0xec, 0x9e, 0xc4, 0x21, 0xa1, 0xa0 }};
|
||||
|
||||
#define EFI_PARTITION_INFO_PROTOCOL_REVISION 0x0001000
|
||||
#define PARTITION_TYPE_OTHER 0x00
|
||||
#define PARTITION_TYPE_MBR 0x01
|
||||
#define PARTITION_TYPE_GPT 0x02
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
///
|
||||
/// Partition Information Protocol structure.
|
||||
///
|
||||
typedef struct {
|
||||
//
|
||||
// Set to EFI_PARTITION_INFO_PROTOCOL_REVISION.
|
||||
//
|
||||
UINT32 Revision;
|
||||
//
|
||||
// Partition info type (PARTITION_TYPE_MBR, PARTITION_TYPE_GPT, or PARTITION_TYPE_OTHER).
|
||||
//
|
||||
UINT32 Type;
|
||||
//
|
||||
// If 1, partition describes an EFI System Partition.
|
||||
//
|
||||
UINT8 System;
|
||||
UINT8 Reserved[7];
|
||||
union {
|
||||
///
|
||||
/// MBR data
|
||||
///
|
||||
MBR_PARTITION_RECORD Mbr;
|
||||
///
|
||||
/// GPT data
|
||||
///
|
||||
EFI_PARTITION_ENTRY Gpt;
|
||||
} Info;
|
||||
} EFI_PARTITION_INFO_PROTOCOL;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
///
|
||||
/// Partition Information Protocol GUID variable.
|
||||
///
|
||||
extern EFI_GUID gEfiPartitionInfoProtocolGuid;
|
||||
@ -228,6 +228,7 @@ extern EFI_GUID efi_mtftp6_protocol_guid;
|
||||
extern EFI_GUID efi_mtftp6_service_binding_protocol_guid;
|
||||
extern EFI_GUID efi_nii_protocol_guid;
|
||||
extern EFI_GUID efi_nii31_protocol_guid;
|
||||
extern EFI_GUID efi_partition_info_protocol_guid;
|
||||
extern EFI_GUID efi_pci_io_protocol_guid;
|
||||
extern EFI_GUID efi_pci_root_bridge_io_protocol_guid;
|
||||
extern EFI_GUID efi_pxe_base_code_protocol_guid;
|
||||
|
||||
@ -63,6 +63,7 @@ FILE_SECBOOT ( PERMITTED );
|
||||
#include <ipxe/efi/Protocol/Mtftp4.h>
|
||||
#include <ipxe/efi/Protocol/Mtftp6.h>
|
||||
#include <ipxe/efi/Protocol/NetworkInterfaceIdentifier.h>
|
||||
#include <ipxe/efi/Protocol/PartitionInfo.h>
|
||||
#include <ipxe/efi/Protocol/PciIo.h>
|
||||
#include <ipxe/efi/Protocol/PciRootBridgeIo.h>
|
||||
#include <ipxe/efi/Protocol/PxeBaseCode.h>
|
||||
@ -308,6 +309,10 @@ EFI_GUID efi_nii_protocol_guid
|
||||
EFI_GUID efi_nii31_protocol_guid
|
||||
= EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID_31;
|
||||
|
||||
/** Partition information protocol GUID */
|
||||
EFI_GUID efi_partition_info_protocol_guid
|
||||
= EFI_PARTITION_INFO_PROTOCOL_GUID;
|
||||
|
||||
/** PCI I/O protocol GUID */
|
||||
EFI_GUID efi_pci_io_protocol_guid
|
||||
= EFI_PCI_IO_PROTOCOL_GUID;
|
||||
@ -639,6 +644,8 @@ static struct efi_well_known_guid efi_well_known_guids[] = {
|
||||
"Nii" },
|
||||
{ &efi_nii31_protocol_guid,
|
||||
"Nii31" },
|
||||
{ &efi_partition_info_protocol_guid,
|
||||
"PartitionInfo" },
|
||||
{ &efi_pci_io_protocol_guid,
|
||||
"PciIo" },
|
||||
{ &efi_pci_root_bridge_io_protocol_guid,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user