diff --git a/sbin/fsck_msdosfs/boot.c b/sbin/fsck_msdosfs/boot.c index 319518349eb3..b1760c5c02df 100644 --- a/sbin/fsck_msdosfs/boot.c +++ b/sbin/fsck_msdosfs/boot.c @@ -181,7 +181,7 @@ readboot(int dosfs, struct bootblock *boot) boot->bpbResSectors + boot->bpbFATs * boot->FATsecs - CLUST_FIRST * boot->bpbSecPerClust; - if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE != 0) { + if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE_REAL != 0) { pfatal("Invalid sector size: %u", boot->bpbBytesPerSec); return FSFATAL; } diff --git a/sbin/fsck_msdosfs/dosfs.h b/sbin/fsck_msdosfs/dosfs.h index bd01b2423119..485b3a15e668 100644 --- a/sbin/fsck_msdosfs/dosfs.h +++ b/sbin/fsck_msdosfs/dosfs.h @@ -30,7 +30,9 @@ #ifndef DOSFS_H #define DOSFS_H -#define DOSBOOTBLOCKSIZE 512 +/* support 4Kn disk reads */ +#define DOSBOOTBLOCKSIZE_REAL 512 +#define DOSBOOTBLOCKSIZE 4096 typedef u_int32_t cl_t; /* type holding a cluster number */ diff --git a/sys/boot/amd64/boot1.efi/boot1.c b/sys/boot/amd64/boot1.efi/boot1.c index eb27846383ab..cb75d2a12f47 100644 --- a/sys/boot/amd64/boot1.efi/boot1.c +++ b/sys/boot/amd64/boot1.efi/boot1.c @@ -168,9 +168,12 @@ static int dskread(void *buf, u_int64_t lba, int nblk) { EFI_STATUS status; + int size; + lba = lba / (bootdev->Media->BlockSize / DEV_BSIZE); + size = nblk * DEV_BSIZE; status = bootdev->ReadBlocks(bootdev, bootdev->Media->MediaId, lba, - nblk * bootdev->Media->BlockSize, buf); + size, buf); if (EFI_ERROR(status)) return (-1);