Hi,
There are macros in MdePkg/Include/Base.h that help align values and pointers
to the next boundary.
This patch could use the following:
TftpBufferSize = ALIGN_VALUE (TftpBufferSize, SIZE_16MB);
/**
Rounds a value up to the next boundary using a specified alignment.
This function rounds Value up to the next boundary using the specified
Alignment.
This aligned value is returned.
@param Value The value to round up.
@param Alignment The alignment boundary used to return the aligned value.
@return A value up to the next boundary.
**/
#define ALIGN_VALUE(Value, Alignment) ((Value) + (((Alignment) - (Value)) &
((Alignment) - 1)))
Mike
>-----Original Message-----
>From: edk2-devel [mailto:[email protected]] On Behalf Of
>Ashutosh Singh
>Sent: Friday, November 06, 2015 9:01 AM
>To: [email protected]
>Cc: [email protected]; [email protected]; [email protected];
>[email protected]; [email protected]
>Subject: [edk2] [PATCH] ArmPkg/BdsLib: Increase fallback tftp buffer size
>
>When performing a tftp download from a server which does not support
>rfc2349 transfer size option (such as netkit-tftpd), the existing code
>falls back to allocating an 8MB buffer. Since this is insufficient for
>an uncompressed AArch64 Linux kernel image, double the size to 16MB.
>
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Ashutosh Singh <[email protected]>
>---
> ArmPkg/Library/BdsLib/BdsFilePath.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/ArmPkg/Library/BdsLib/BdsFilePath.c
>b/ArmPkg/Library/BdsLib/BdsFilePath.c
>index ff42175..0410236 100644
>--- a/ArmPkg/Library/BdsLib/BdsFilePath.c
>+++ b/ArmPkg/Library/BdsLib/BdsFilePath.c
>@@ -1198,7 +1198,7 @@ BdsTftpLoadImage (
> if (Mtftp4GetFileSize (Mtftp4, AsciiFilePath, &FileSize) == EFI_SUCCESS) {
> TftpBufferSize = FileSize;
> } else {
>- TftpBufferSize = SIZE_8MB;
>+ TftpBufferSize = SIZE_16MB;
> }
>
> TftpContext = AllocatePool (sizeof (BDS_TFTP_CONTEXT));
>@@ -1209,7 +1209,7 @@ BdsTftpLoadImage (
> TftpContext->FileSize = FileSize;
>
> for (; TftpBufferSize <= FixedPcdGet32 (PcdMaxTftpFileSize);
>- TftpBufferSize = (TftpBufferSize + SIZE_8MB) & (~(SIZE_8MB-1))) {
>+ TftpBufferSize = (TftpBufferSize + SIZE_16MB) & (~(SIZE_16MB-1))) {
> //
> // Allocate a buffer to hold the whole file.
> //
>--
>1.7.9.5
>
>
>________________________________
>
>-- IMPORTANT NOTICE: The contents of this email and any attachments are
>confidential and may also be privileged. If you are not the intended recipient,
>please notify the sender immediately and do not disclose the contents to any
>other person, use it for any purpose, or store or copy the information in any
>medium. Thank you.
>
>_______________________________________________
>edk2-devel mailing list
>[email protected]
>https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel