summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-31 21:06:50 +0200
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-31 21:07:56 +0200
commit33e44574e6fb4c571a370d5ebdfdf1cdb6735763 (patch)
tree986518c8c455f171fdc92aa4adaa8ce81d98cf7b
parent21b5569ce53892167fb44867b4319ad528602e1e (diff)
FirmwareKit: Update EPM specs and implementation.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
-rw-r--r--Private/FirmwareKit/EPM.hxx17
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx16
2 files changed, 18 insertions, 15 deletions
diff --git a/Private/FirmwareKit/EPM.hxx b/Private/FirmwareKit/EPM.hxx
index 7dab6edc..b26c722b 100644
--- a/Private/FirmwareKit/EPM.hxx
+++ b/Private/FirmwareKit/EPM.hxx
@@ -37,7 +37,7 @@ struct PACKED BootBlock {
NewOS::Int32 Version;
NewOS::Int64 NumBlocks;
NewOS::Int64 SectorSz;
- NewOS::Int64 SectorStart;
+ NewOS::Int64 LbaStart;
};
/**
@@ -46,12 +46,12 @@ struct PACKED BootBlock {
*/
struct PACKED PartitionBlock {
NewOS::Char Name[kEPMNameLength];
- NewOS::Int32 Magic;
- NewOS::Int64 SectorEnd;
+ NewOS::Int32 Version;
+ NewOS::Int64 LbaEnd;
NewOS::Int64 SectorSz;
- NewOS::Int64 SectorStart;
+ NewOS::Int64 LbaStart;
NewOS::Int16 Kind;
- NewOS::Int32 Version;
+ NewOS::Int32 FsVersion;
NewOS::Char Fs[kEPMFilesystemLength]; /* NewFS, HCFS... */
};
@@ -100,8 +100,11 @@ typedef struct PartitionBlock PartitionBlockType;
#define kEPMMagic kEPMMagicError
#endif
-/// partition must start after this address.
-#define kEPMStartPartitionBlk 34
+///! @brief partition must start after this address.
+#define kEPMStartPartitionBlk 0
+
+///! @brief Current EPM revision (2)
+#define kEPMRevision 2
/// END SPECS
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx b/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx
index 52c6a001..9a858a68 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx
@@ -43,7 +43,7 @@ EXTERN_C Boolean boot_write_epm_partition(const Char* namePart, SizeT namePartLe
BootBlockType* bootBlock = (BootBlockType*)buf;
- bootBlock->Version = kEPMNewOS;
+ bootBlock->Version = kEPMRevision;
bootBlock->NumBlocks = 2;
for (SizeT i = 0; i < kEPMNameLength; i++) {
@@ -54,7 +54,7 @@ EXTERN_C Boolean boot_write_epm_partition(const Char* namePart, SizeT namePartLe
bootBlock->Name[i] = namePart[i];
}
- bootBlock->SectorStart =
+ bootBlock->LbaStart =
sizeof(BootBlockType) + (sizeof(PartitionBlockType) * kEPMMaxBlks);
bootBlock->SectorSz = kATASectorSize;
@@ -70,7 +70,7 @@ EXTERN_C Boolean boot_write_epm_partition(const Char* namePart, SizeT namePartLe
partBlock->Fs[i] = fsName[i];
}
- partBlock->Magic = kEPMNewOS;
+ partBlock->Version = kEPMNewOS;
char* partName = "System HD";
int partNameLength = 10;
@@ -80,10 +80,10 @@ EXTERN_C Boolean boot_write_epm_partition(const Char* namePart, SizeT namePartLe
}
partBlock->SectorSz = kATASectorSize;
- partBlock->SectorStart = kEPMStartPartitionBlk + kSwapSize;
+ partBlock->LbaStart = kEPMStartPartitionBlk + kSwapSize;
partBlock->Version = kNewFSVersionInteger;
partBlock->Kind = kNewFSPartitionTypeStandard;
- partBlock->SectorEnd = 0; /// grows on the disk.
+ partBlock->LbaEnd = 0UL; ///! grows on the disk.
PartitionBlock* swapBlock = (PartitionBlock*)(buf + sizeof(BootBlock) + sizeof(PartitionBlock));
@@ -91,7 +91,7 @@ EXTERN_C Boolean boot_write_epm_partition(const Char* namePart, SizeT namePartLe
swapBlock->Fs[i] = fsName[i];
}
- swapBlock->Magic = kEPMNewOS;
+ swapBlock->Version = kEPMNewOS;
partName = "Swap HD";
partNameLength = 8;
@@ -101,10 +101,10 @@ EXTERN_C Boolean boot_write_epm_partition(const Char* namePart, SizeT namePartLe
}
swapBlock->SectorSz = kATASectorSize;
- swapBlock->SectorStart = kEPMStartPartitionBlk;
+ swapBlock->LbaStart = kEPMStartPartitionBlk;
swapBlock->Version = kNewFSVersionInteger;
swapBlock->Kind = kNewFSPartitionTypePage;
- swapBlock->SectorEnd = kSwapSize; /// 4 MIB swap partition.
+ swapBlock->LbaEnd = kSwapSize; /// 4 MIB swap partition.
ataInterface->Write(buf, 1);