[FREELDR] Support drives with 4k sector size

PR was reviewed at pull/5784
This commit is contained in:
Laura Konopinska 2023-09-30 18:11:31 +02:00 committed by Justin Miller
parent bad0dd5991
commit e2fc578f6d
2 changed files with 4 additions and 4 deletions

View file

@ -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;

View file

@ -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;