NeKernel
dev
Loading...
Searching...
No Matches
EPM.h
Go to the documentation of this file.
1
/* ========================================
2
3
Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.
4
5
======================================== */
6
10
11
#ifndef FIRMWAREKIT_EPM_H
12
#define FIRMWAREKIT_EPM_H
13
14
#include <
NeKit/Config.h
>
15
16
#define kEPMNameLength (32)
17
#define kEPMFilesystemLength (16)
18
#define kEPMMagicLength (5)
19
20
/* @brief AMD64 magic for EPM */
21
#define kEPMMagic86 "EPMAM"
22
23
/* @brief RISC-V magic for EPM */
24
#define kEPMMagicRISCV "EPMRV"
25
26
/* @brief ARM magic for EPM */
27
#define kEPMMagicARM "EPMAR"
28
29
/* @brief 64x0 magic for EPM */
30
#define kEPMMagic64k "EPM64"
31
32
/* @brief 32x0 magic for EPM */
33
#define kEPMMagic32k "EPM32"
34
35
/* @brief POWER magic for EPM */
36
#define kEPMMagicPPC "EPMPC"
37
38
/* @brief Invalid magic for EPM */
39
#define kEPMMagicError "EPM??"
40
41
#ifdef __NE_AMD64__
42
#define kEPMMagic kEPMMagic86
43
#else
44
#ifdef __NE_ARM64__
45
#define kEPMMagic kEPMMagicARM
46
#else
47
#define kEPMMagic kEPMMagicError
48
#endif
49
#endif
50
53
#define kEPMPartBlockLba (sizeof(EPM_PART_BLOCK))
54
56
#define kEPMRevisionBcd (0x0100)
57
59
#define kEPMBootBlockLba (0U)
60
61
#define kEPMReserveLen (399)
62
63
struct
EPM_GUID
;
64
struct
EPM_PART_BLOCK
;
65
66
/* The first 0 > 128 addresses of a disk contains these headers. */
67
69
typedef
struct
EPM_GUID
{
70
Kernel::UInt32
Data1
;
71
Kernel::UInt16
Data2
;
72
Kernel::UInt16
Data3
;
73
Kernel::UInt8
Data4
[8];
74
}
PACKED
EPM_GUID
;
75
80
struct
PACKED
EPM_PART_BLOCK
{
81
Kernel::Char
Magic
[
kEPMMagicLength
];
82
Kernel::Char
Name
[
kEPMNameLength
];
83
EPM_GUID
Guid
;
84
Kernel::Int32
Version
;
85
Kernel::Int64
NumBlocks
;
86
Kernel::Int64
SectorSz
;
87
Kernel::Int64
LbaStart
;
// base offset
88
Kernel::Int64
LbaEnd
;
// end offset
89
Kernel::Int16
Kind
;
90
Kernel::Int16
Flags
;
91
Kernel::Int32
FsVersion
;
92
Kernel::Char
Fs
[
kEPMFilesystemLength
];
/* NeFS, OpenHeFS... */
93
Kernel::Char
Reserved
[
kEPMReserveLen
];
// to fill a full sector.
94
};
95
98
99
enum
{
100
kEPMInvalid
= 0x00,
101
kEPMGeneric
= 0xcf,
102
kEPMLinux
= 0x8f,
103
kEPMBSD
= 0x9f,
104
kEPMNeKernel
= 0x1f,
105
kEPMLegacy
= 0x2f,
107
kEPMInvalidOS
= 0xff,
108
};
109
110
inline
EPM_GUID
kEPMNilGuid
= {0x0U, 0x0U, 0x0U, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
111
112
#endif
// ifndef FIRMWAREKIT_EPM_H
PACKED
#define PACKED
kEPMMagicLength
#define kEPMMagicLength
Definition
EPM.h:18
kEPMNeKernel
@ kEPMNeKernel
BSD on EPM.
Definition
EPM.h:104
kEPMLinux
@ kEPMLinux
Generic OS.
Definition
EPM.h:102
kEPMGeneric
@ kEPMGeneric
Definition
EPM.h:101
kEPMLegacy
@ kEPMLegacy
NeKernel.
Definition
EPM.h:105
kEPMBSD
@ kEPMBSD
Linux on EPM.
Definition
EPM.h:103
kEPMInvalidOS
@ kEPMInvalidOS
Legacy VMKernel.
Definition
EPM.h:107
kEPMInvalid
@ kEPMInvalid
Definition
EPM.h:100
kEPMFilesystemLength
#define kEPMFilesystemLength
Definition
EPM.h:17
kEPMNilGuid
EPM_GUID kEPMNilGuid
Definition
EPM.h:110
kEPMNameLength
#define kEPMNameLength
The Explicit Partition Map scheme.
Definition
EPM.h:16
kEPMReserveLen
#define kEPMReserveLen
Definition
EPM.h:61
Config.h
Kernel::Char
char Char
Definition
Config.h:51
Kernel::UInt16
__UINT16_TYPE__ UInt16
Definition
Config.h:40
Kernel::Int64
__INT64_TYPE__ Int64
Definition
Config.h:46
Kernel::UInt8
__UINT8_TYPE__ UInt8
Definition
Config.h:55
Kernel::UInt32
__UINT32_TYPE__ UInt32
Definition
Config.h:44
Kernel::Int32
__INT32_TYPE__ Int32
Definition
Config.h:38
Kernel::Int16
__INT16_TYPE__ Int16
Definition
Config.h:42
EPM_GUID
EPM GUID structure.
Definition
EPM.h:69
EPM_GUID::Data2
Kernel::UInt16 Data2
Definition
EPM.h:71
EPM_GUID::Data3
Kernel::UInt16 Data3
Definition
EPM.h:72
EPM_GUID::Data4
Kernel::UInt8 Data4[8]
Definition
EPM.h:73
EPM_GUID::Data1
Kernel::UInt32 Data1
Definition
EPM.h:70
EPM_PART_BLOCK
The EPM boot block.
Definition
EPM.h:80
EPM_PART_BLOCK::Name
Kernel::Char Name[kEPMNameLength]
Definition
EPM.h:82
EPM_PART_BLOCK::LbaStart
Kernel::Int64 LbaStart
Definition
EPM.h:87
EPM_PART_BLOCK::Reserved
Kernel::Char Reserved[kEPMReserveLen]
Definition
EPM.h:93
EPM_PART_BLOCK::Flags
Kernel::Int16 Flags
Definition
EPM.h:90
EPM_PART_BLOCK::LbaEnd
Kernel::Int64 LbaEnd
Definition
EPM.h:88
EPM_PART_BLOCK::Fs
Kernel::Char Fs[kEPMFilesystemLength]
Definition
EPM.h:92
EPM_PART_BLOCK::FsVersion
Kernel::Int32 FsVersion
Definition
EPM.h:91
EPM_PART_BLOCK::Guid
EPM_GUID Guid
Definition
EPM.h:83
EPM_PART_BLOCK::Version
Kernel::Int32 Version
Definition
EPM.h:84
EPM_PART_BLOCK::SectorSz
Kernel::Int64 SectorSz
Definition
EPM.h:86
EPM_PART_BLOCK::NumBlocks
Kernel::Int64 NumBlocks
Definition
EPM.h:85
EPM_PART_BLOCK::Kind
Kernel::Int16 Kind
Definition
EPM.h:89
EPM_PART_BLOCK::Magic
Kernel::Char Magic[kEPMMagicLength]
Definition
EPM.h:81
src
kernel
FirmwareKit
EPM.h
Generated by
1.15.0