X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ArmPkg%2FLibrary%2FBdsLib%2FBdsLinuxAtag.c;h=b59df07622e0e33453a3d912b687ee27040cdf73;hb=0a6653bc2aecaa621eb42c7137b6f13815a34a92;hp=253cf65f36109c6ad861d28966294dbaa9c04e90;hpb=d9325c8e4f858abe7b888b21df4bd0a34864492f;p=mirror_edk2.git diff --git a/ArmPkg/Library/BdsLib/BdsLinuxAtag.c b/ArmPkg/Library/BdsLib/BdsLinuxAtag.c index 253cf65f36..b59df07622 100644 --- a/ArmPkg/Library/BdsLib/BdsLinuxAtag.c +++ b/ArmPkg/Library/BdsLib/BdsLinuxAtag.c @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2011, ARM Limited. All rights reserved. +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. * * This program and the accompanying materials * are licensed and made available under the terms and conditions of the BSD License @@ -13,6 +13,7 @@ **/ #include "BdsInternal.h" +#include "BdsLinuxLoader.h" // Point to the current ATAG STATIC LINUX_ATAG *mLinuxKernelCurrentAtag; @@ -78,6 +79,22 @@ SetupCmdlineTag ( } } +STATIC +VOID +SetupInitrdTag ( + IN UINT32 InitrdImage, + IN UINT32 InitrdImageSize + ) +{ + mLinuxKernelCurrentAtag->header.size = tag_size(LINUX_ATAG_INITRD2); + mLinuxKernelCurrentAtag->header.type = ATAG_INITRD2; + + mLinuxKernelCurrentAtag->body.initrd2_tag.start = InitrdImage; + mLinuxKernelCurrentAtag->body.initrd2_tag.size = InitrdImageSize; + + // Move pointer to next tag + mLinuxKernelCurrentAtag = next_tag_address(mLinuxKernelCurrentAtag); +} STATIC VOID SetupEndTag ( @@ -98,11 +115,11 @@ SetupEndTag ( EFI_STATUS PrepareAtagList ( - IN CONST CHAR8* CommandLineString, - IN EFI_PHYSICAL_ADDRESS InitrdImage, - IN UINTN InitrdImageSize, - OUT LINUX_ATAG **AtagBase, - OUT UINT32 *AtagSize + IN CONST CHAR8* CommandLineString, + IN EFI_PHYSICAL_ADDRESS InitrdImage, + IN UINTN InitrdImageSize, + OUT EFI_PHYSICAL_ADDRESS *AtagBase, + OUT UINT32 *AtagSize ) { EFI_STATUS Status; @@ -114,7 +131,7 @@ PrepareAtagList ( AtagStartAddress = LINUX_ATAG_MAX_OFFSET; Status = gBS->AllocatePages (AllocateMaxAddress, EfiBootServicesData, EFI_SIZE_TO_PAGES(ATAG_MAX_SIZE), &AtagStartAddress); if (EFI_ERROR(Status)) { - DEBUG ((EFI_D_ERROR,"Failed to allocate Atag at 0x%lX (%r)\n",AtagStartAddress,Status)); + DEBUG ((EFI_D_WARN, "Warning: Failed to allocate Atag at 0x%lX (%r). The Atag will be allocated somewhere else in System Memory.\n", AtagStartAddress, Status)); Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesData, EFI_SIZE_TO_PAGES(ATAG_MAX_SIZE), &AtagStartAddress); ASSERT_EFI_ERROR(Status); } @@ -141,21 +158,14 @@ PrepareAtagList ( } if (InitrdImageSize > 0 && InitrdImage != 0) { - mLinuxKernelCurrentAtag->header.size = tag_size(LINUX_ATAG_INITRD2); - mLinuxKernelCurrentAtag->header.type = ATAG_INITRD2; - - mLinuxKernelCurrentAtag->body.initrd2_tag.start = (UINT32)InitrdImage; - mLinuxKernelCurrentAtag->body.initrd2_tag.size = (UINT32)InitrdImageSize; - - // Move pointer to next tag - mLinuxKernelCurrentAtag = next_tag_address(mLinuxKernelCurrentAtag); + SetupInitrdTag ((UINT32)InitrdImage, (UINT32)InitrdImageSize); } // End of tags SetupEndTag(); // Calculate atag list size - *AtagBase = (LINUX_ATAG*)(UINTN)AtagStartAddress; + *AtagBase = AtagStartAddress; *AtagSize = (UINT32)mLinuxKernelCurrentAtag - (UINT32)AtagStartAddress + 1; return EFI_SUCCESS;