https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e2fc578f6dcb2cdb3eae3…
commit e2fc578f6dcb2cdb3eae340ce982e72b7dd6f0a9
Author: Laura Konopinska <alula(a)tuta.io>
AuthorDate: Sat Sep 30 18:11:31 2023 +0200
Commit: Justin Miller <justin.miller(a)reactos.org>
CommitDate: Thu Sep 12 20:53:10 2024 -0700
[FREELDR] Support drives with 4k sector size
PR was reviewed at pull/5784
---
boot/freeldr/freeldr/arch/uefi/uefidisk.c | 2 +-
boot/freeldr/freeldr/lib/fs/fat.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/boot/freeldr/freeldr/arch/uefi/uefidisk.c
b/boot/freeldr/freeldr/arch/uefi/uefidisk.c
index 2d5458d4707..98d19b346f1 100644
--- a/boot/freeldr/freeldr/arch/uefi/uefidisk.c
+++ b/boot/freeldr/freeldr/arch/uefi/uefidisk.c
@@ -415,7 +415,7 @@ UefiSetupBlockDevices(VOID)
if (EFI_ERROR(Status) ||
bio == NULL ||
bio->Media->BlockSize == 0 ||
- bio->Media->BlockSize > 2048)
+ bio->Media->BlockSize > 4096)
{
TRACE("UefiSetupBlockDevices: UEFI has found a block device that failed,
skipping\n");
continue;
diff --git a/boot/freeldr/freeldr/lib/fs/fat.c b/boot/freeldr/freeldr/lib/fs/fat.c
index 1b5ad239e1f..556f8086430 100644
--- a/boot/freeldr/freeldr/lib/fs/fat.c
+++ b/boot/freeldr/freeldr/lib/fs/fat.c
@@ -1369,7 +1369,7 @@ BOOLEAN FatReadVolumeSectors(PFAT_VOLUME_INFO Volume, ULONG
SectorNumber, ULONG
//
// Seek to right position
//
- Position.QuadPart = (ULONGLONG)SectorNumber * 512;
+ Position.QuadPart = (ULONGLONG)SectorNumber * Volume->BytesPerSector;
Status = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
{
@@ -1380,8 +1380,8 @@ BOOLEAN FatReadVolumeSectors(PFAT_VOLUME_INFO Volume, ULONG
SectorNumber, ULONG
//
// Read data
//
- Status = ArcRead(Volume->DeviceId, Buffer, SectorCount * 512, &Count);
- if (Status != ESUCCESS || Count != SectorCount * 512)
+ Status = ArcRead(Volume->DeviceId, Buffer, SectorCount *
Volume->BytesPerSector, &Count);
+ if (Status != ESUCCESS || Count != SectorCount * Volume->BytesPerSector)
{
TRACE("FatReadVolumeSectors() Failed to read\n");
return FALSE;