Date: Thu, 19 Sep 2019 22:57:38 +0200 From: Heinrich Schuchardt <xypron.glpk@gmx.de> To: Emmanuel Vadot <manu@freebsd.org> Cc: Emmanuel Vadot <manu@bidouilliste.com>, Alexander Graf <agraf@csgraf.de>, U-Boot Mailing List <u-boot@lists.denx.de>, freebsd-bugs@freebsd.org, AKASHI Takahiro <takahiro.akashi@linaro.org> Subject: Re: [BUG] FreeBSD cannot boot with U-Boot patch efi_loader: parameter checks BLOCK_IO_PROTOCOL Message-ID: <d802e3e7-cb67-ccb5-f5c1-08c3d1d94f71@gmx.de> In-Reply-To: <c588c5f7-bce2-bad0-44a0-c2a90498a920@gmx.de> References: <c588c5f7-bce2-bad0-44a0-c2a90498a920@gmx.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On 9/13/19 11:48 PM, Heinrich Schuchardt wrote: > Hello Emmanuel, > > booting current FreeBSD fails since patch > f59f0825e8b9fdeb8abe43ffd10c5119ca1a032f > efi_loader: parameter checks BLOCK_IO_PROTOCOL > > The reason is that the buffer used by FreeBSD to read is not block align= ed. > > The UEFI spec requires that EFI_BLOCK_IO_PROTOCOL.ReadBlocks() returns > EFI_INVALID_PARAMETER if the buffer is not properly aligned (i.e. is not > a multiple of EFI_BLOCK_IO_MEDIA.IoAlign) > > FreeBSD does not guarantee this alignment, e.g. efi_disk_read_blocks() > is called with buffer 00000000995b08d0 which is not aligned to a > multiple of 512. > > FreeBSD function efipart_readwrite writes this error message: > efipart_readwrite: rw=3D1, blk=3D62333952 size=3D1 status=3D2 > > The problem can be traced back to the FreeBSD line: > > stand/efi/libefi/efipart.c(1043) efipart_realstrategy(): > blkbuf =3D malloc(blkio->Media->BlockSize); > > U-Boot does not yet implement the EFI_DISK_IO_PROTOCOL which is a > wrapper for the EFI_BLOCK_IO_PROTOCOL allowing unaligned access. > > malloc() could be replaced in FreeBSD by AllocatePages() which returns a > 4096 byte aligned memory block. > > Best regards > > Heinrich > Commit 16ef880ce6ee ("loader.efi: efipart needs to use ioalign") was merged into FreeBSD on Sep 17th, 2019.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d802e3e7-cb67-ccb5-f5c1-08c3d1d94f71>