- This multiboot support is built into linux module for aarch64.
- The implementation for Xen is following <Multiboot on ARM Specification>:
http://wiki.xen.org/wiki/Xen_ARM_with_Virtualization_Extensions/Multiboot
and xen/docs/misc/arm/device-tree/booting.txt in Xen source code.
- The example of this support is <How to boot Xen with GRUB on AArch64 the Foundation FVP model>
https://wiki.linaro.org/LEG/Engineering/Grub2/Xen_booting_on_Foundation_FVP…
- This adds support for the Xen Multiboot on ARM specification for arm64,
enabling config file portability across the architectures.
- The multiboot command is currently x86-only, so reusing these command names
should not conflict with any future additions of ARM support to multiboot2.
- The reason of adding this functionality to the existing "linux" module
rather than "multiboot(2)"
(1)multiboot is x86 only
(2)Multiboot is added to "linux" module because it reuses existing code.
- Some changes in original linux module code
Move some #define from grub-core/loader/arm64/linux.c to include/grub/arm64/linux.h
Make some shared functions for multiboot.c
Remove "loaded" checking in the grub_cmd_devicetree of linux.c
- Add grub_fdt_set_reg64 macro into fdt.h header file for inserting "reg" properiy,
while #address-cells = <0x2> and #size-cells = <0x2>
- Add the introduction of multiboot/module command in docs/grub.texi
This multiboot support will be built in linux module for aarch64,
and can not be used alone.
docs/grub.texi | 10 +
grub-core/Makefile.core.def | 1 +
grub-core/loader/arm64/linux.c | 72 ++---
grub-core/loader/arm64/multiboot.c | 593 +++++++++++++++++++++++++++++++++++++
include/grub/arm64/linux.h | 11 +
include/grub/arm64/multiboot.h | 115 +++++++
include/grub/fdt.h | 12 +
7 files changed, 778 insertions(+), 36 deletions(-)
create mode 100644 grub-core/loader/arm64/multiboot.c
create mode 100644 include/grub/arm64/multiboot.h
Signed-off-by: Fu Wei <fu.wei(a)linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm(a)linaro.org>
--
1.8.3.1
Some simple value negotiation responses are optional,
in particular DataPDUInOrder and DataSequenceInOrder.
If we send "Yes", then the response from the target
is optional, and the Linux target implementation does
not return a response.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Roy Franz <roy.franz(a)linaro.org>
---
MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
index cb1f79b..b8427ab 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
@@ -1290,9 +1290,11 @@ IScsiCheckOpParams (
//
// DataPDUInOrder, result function is OR.
+ // The response is optional if we sent "Yes".
+ // The AsciiStrCmp is not done if we sent "Yes", so it is OK for Value to be NULL
//
Value = IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_DATA_PDU_IN_ORDER);
- if (Value == NULL) {
+ if (!Session->DataPDUInOrder && Value == NULL) {
goto ON_ERROR;
}
@@ -1300,9 +1302,11 @@ IScsiCheckOpParams (
//
// DataSequenceInorder, result function is OR.
+ // The response is optional if we sent "Yes".
+ // The AsciiStrCmp is not done if we sent "Yes", so it is OK for Value to be NULL
//
Value = IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_DATA_SEQUENCE_IN_ORDER);
- if (Value == NULL) {
+ if (!Session->DataSequenceInOrder && Value == NULL) {
goto ON_ERROR;
}
--
1.9.1
From: Fu Wei <fu.wei(a)linaro.org>
Add a driver for the SMSC Lan91x Ethernet controllers, such as
the 91C111 emulated in the ARM RTSM development simulators
Add support for including the SMSC LAN 91C111 driver support
by specify "-D EDK2_ENABLE_SMSC_91X=?" build variable.
A per-platform addition to the .fdf is also required to actually include
the driver and network protocol support in the produced image.
Add conditionalised networking support for
FVP AArch64
RTSM A15
RTSM A15 MPcore
by default (EDK2_ENABLE_SMSC_91X=1).
If specify "-D EDK2_ENABLE_SMSC_91X=0" build variable,
the networking support will be disabled.
This repo is including all the patches:
https://git.linaro.org/people/fu.wei/uefi.git/shortlog/refs/heads/LAN91x_Dx…
Fu Wei (2):
ArmPlatformPkg: Add conditionalised networking support for RTSM A15
MPcore
ArmPlatformPkg: Add conditionalised networking support for RTSM A15
Leif Lindholm (2):
ArmPlatformPkg: Add conditional inclusion of Lan91x ethernet support
ArmPlatformPkg: Add the conditionalised networking support for FVP
AArch64. It is enabled by default (EDK2_ENABLE_SMSC_91X=1).
If specify "-D EDK2_ENABLE_SMSC_91X=0" build variable, the
networking support will be disabled.
Reece R. Pollack (1):
ArmPlatformPkg: Add Lan91x Dxe driver
.../ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc | 3 +
.../ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf | 5 +
.../ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc | 4 +
.../ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf | 21 +-
.../ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc | 4 +
.../ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf | 21 +-
.../ArmVExpressPkg/ArmVExpress-networking.fdf.inc | 28 +
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc | 9 +
EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.c | 2233 ++++++++++++++++++++
EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf | 58 +
EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxeHw.h | 278 +++
EmbeddedPkg/EmbeddedPkg.dec | 3 +
12 files changed, 2635 insertions(+), 32 deletions(-)
create mode 100644 ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-networking.fdf.inc
create mode 100644 EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.c
create mode 100644 EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf
create mode 100644 EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxeHw.h
--
1.9.1
On 22 January 2015 at 14:33, Olivier Martin <olivier.martin(a)arm.com> wrote:
> I guess the reason why I initially did this 'hack' (mark the DRAM occupied
> by the FD as non-present) is because the DXE (or something else) was copying
> over the FD during the dispatching of the UEFI drivers.
> You might not see this issue with your implementation of MemoryInitPeiLib
> because UEFI drivers will be loaded way above the FD file. But the risk
> might still exist - except if the DXE core now takes care of this case.
>
So which part of the FD file would we still be using at DXE time?
And couldn't we use ConvertPages() to turn it into boot services code
instead of removing it entirely?
>> -----Original Message-----
>> From: linaro-uefi-bounces(a)lists.linaro.org [mailto:linaro-uefi-
>> bounces(a)lists.linaro.org] On Behalf Of Ard Biesheuvel
>> Sent: 19 January 2015 17:34
>> To: Varad Gautam
>> Cc: Linaro UEFI Mailman List
>> Subject: Re: [Linaro-uefi] [RFC] arm: efi: handle zImage relocation
>>
>> On 19 January 2015 at 17:28, Varad Gautam <varadgautam(a)gmail.com>
>> wrote:
>> > On 01/19/15 at 05:21 PM Ard Biesheuvel <ard.biesheuvel(a)linaro.org>
>> wrote:
>> >> > The current implementation fails in `handle_kernel_image()` when
>> UEFI
>> >> > finds a discontinuity in the memory map during
>> `allocate_pages()`[1].
>> >> > This patch
>> >> Footnote?
>> >
>> > :)
>> > http://lists.linaro.org/pipermail/linaro-uefi/2015-
>> January/000645.html
>> >
>>
>> The current ARM port in Tianocore does not deal very well with a flash
>> device in RAM. It assumes you are shadowing from flash if it detects
>> that PrePi is running from RAM.
>>
>> I hit something similar here
>> https://git.linaro.org/people/ard.biesheuvel/uefi-
>> next.git/commit/470ecd1480880a80bbb29077a22a3e640d9633f7
>>
>> So how do you load the UEFI image?
>>
>> _______________________________________________
>> Linaro-uefi mailing list
>> Linaro-uefi(a)lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/linaro-uefi
>
>
>
>
Hi Leif,
I working on wrapping up the last details on my iSCSI wiki page
(https://wiki.linaro.org/LEG/Engineering/Kernel/UEFI/UEFI_ISCSI)
and have found a couple of issues.
1) I seem to be unable to save new boot menu entries. I can change
the order, and that persists. The iSCSI configuration itself
persists, but new menu entries themselves don't seem to. I also can't
seem to delete any.
2) In the "change boot order" menu, there is no menu item to save the
config, only the "F10=save". F10 exits the menu,
but does not seem to save it, as the "Configuration changed" stays
up. When you try to exit the boot maintenance manager
it prompts you to save the data.
Have you encountered either of these?
Roy
From: Fu Wei <fu.wei(a)linaro.org>
Add a driver for the SMSC Lan91x Ethernet controllers, such as
the 91C111 emulated in the ARM RTSM development simulators
Add support for including the SMSC LAN 91C111 driver support
by specifying the EDK2_ENABLE_SMSC_91X build variable.
If build with "-D EDK2_ENABLE_SMSC_91X=1" , the driver will be added.
A per-platform addition to the .fdf is also required to actually include
the driver and network protocol support in the produced image.
Add conditionalised networking support for
FVP AArch64
RTSM A15
RTSM A15 MPcore
This repo is including all the patches:
https://git.linaro.org/people/fu.wei/uefi.git/shortlog/refs/heads/LAN91x_Dx…
Fu Wei (2):
ArmPlatformPkg: Add conditionalised networking support for RTSM A15
MPcore
ArmPlatformPkg: Add conditionalised networking support for RTSM A15
Leif Lindholm (2):
ArmPlatformPkg: Add conditional inclusion of Lan91x ethernet support
ArmPlatformPkg: Add conditionalised networking support for FVP AArch64
Reece R. Pollack (1):
ArmPlatformPkg: Add Lan91x Dxe driver
.../ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf | 5 +
.../ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf | 21 +-
.../ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf | 21 +-
.../ArmVExpressPkg/ArmVExpress-networking.fdf.inc | 28 +
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc | 9 +
EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.c | 2233 ++++++++++++++++++++
EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf | 58 +
EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxeHw.h | 278 +++
EmbeddedPkg/EmbeddedPkg.dec | 3 +
9 files changed, 2624 insertions(+), 32 deletions(-)
create mode 100644 ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-networking.fdf.inc
create mode 100644 EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.c
create mode 100644 EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf
create mode 100644 EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxeHw.h
--
1.9.1
On Tue, Jan 27, 2015 at 10:36:23AM -0000, Olivier Martin wrote:
> Any reason to make the Network stack conditional?
> One reason to make the SMSC Lan91x Ethernet controller condition on some
> RTSM models is to use the virtio network driver instead.
> But I am quite keen to get network support by default.
I like configurability. If we want to see UEFI in more embedded/mobile
devices, we need more of it. Both in EDK2 and the ones held in
Linaro's tree - but especially the ones in EDK2. Because people who
create new ports will look at existing ones for guidance.
And since I hide my build flags in a config file[1] and don't need to
worry about remembering them, it doesn't cause overhead for me.
So "by default" becomes a philosophical statement. By default, I get
networking support when I build the models.
/
Leif
[1] https://git.linaro.org/uefi/uefi-tools.git/blob/HEAD:/platforms.config
> > -----Original Message-----
> > From: linaro-uefi-bounces(a)lists.linaro.org [mailto:linaro-uefi-
> > bounces(a)lists.linaro.org] On Behalf Of fu.wei(a)linaro.org
> > Sent: 27 January 2015 02:08
> > To: edk2-devel(a)lists.sourceforge.net; linaro-uefi(a)lists.linaro.org
> > Subject: [Linaro-uefi] [PATCH 0/5] ArmPlatformPkg: Add Lan91x Dxe
> > driver, and networking support for A15/A15 MPcore/FVP AArch64
> >
> > From: Fu Wei <fu.wei(a)linaro.org>
> >
> > Add a driver for the SMSC Lan91x Ethernet controllers, such as
> > the 91C111 emulated in the ARM RTSM development simulators
> >
> > Add support for including the SMSC LAN 91C111 driver support
> > by specifying the EDK2_ENABLE_SMSC_91X build variable.
> > A per-platform addition to the .fdf is also required to actually
> > include
> > the driver and network protocol support in the produced image.
> >
> > Add conditionalised networking support for
> > FVP AArch64
> > RTSM A15
> > RTSM A15 MPcore
> >
> > This repo is including all the patches:
> > https://git.linaro.org/people/fu.wei/uefi.git/shortlog/refs/heads/LAN91
> > x_Dxe_driver_upstream
> >
> > Fu Wei (2):
> > ArmPlatformPkg: Add conditionalised networking support for RTSM A15
> > MPcore
> > ArmPlatformPkg: Add conditionalised networking support for RTSM A15
> >
> > Leif Lindholm (2):
> > ArmPlatformPkg: Add conditional inclusion of Lan91x ethernet support
> > ArmPlatformPkg: Add conditionalised networking support for FVP
> > AArch64
> >
> > Reece R. Pollack (1):
> > ArmPlatformPkg: Add Lan91x Dxe driver
> >
> > .../ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf | 5 +
> > .../ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf | 21 +-
> > .../ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf | 21 +-
> > .../ArmVExpressPkg/ArmVExpress-networking.fdf.inc | 28 +
> > ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc | 9 +
> > EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.c | 2233
> > ++++++++++++++++++++
> > EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf | 58 +
> > EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxeHw.h | 278 +++
> > EmbeddedPkg/EmbeddedPkg.dec | 3 +
> > 9 files changed, 2624 insertions(+), 32 deletions(-)
> > create mode 100644 ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-
> > networking.fdf.inc
> > create mode 100644 EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.c
> > create mode 100644 EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf
> > create mode 100644 EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxeHw.h
> >
> > --
> > 1.8.3.1
> >
> >
> > _______________________________________________
> > Linaro-uefi mailing list
> > Linaro-uefi(a)lists.linaro.org
> > http://lists.linaro.org/mailman/listinfo/linaro-uefi
>
>
>
>
>
> _______________________________________________
> Linaro-uefi mailing list
> Linaro-uefi(a)lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-uefi
From: Fu Wei <fu.wei(a)linaro.org>
Add a driver for the SMSC Lan91x Ethernet controllers, such as
the 91C111 emulated in the ARM RTSM development simulators
Add support for including the SMSC LAN 91C111 driver support
by specifying the EDK2_ENABLE_SMSC_91X build variable.
A per-platform addition to the .fdf is also required to actually include
the driver and network protocol support in the produced image.
Add conditionalised networking support for
FVP AArch64
RTSM A15
RTSM A15 MPcore
This repo is including all the patches:
https://git.linaro.org/people/fu.wei/uefi.git/shortlog/refs/heads/LAN91x_Dx…
Fu Wei (2):
ArmPlatformPkg: Add conditionalised networking support for RTSM A15
MPcore
ArmPlatformPkg: Add conditionalised networking support for RTSM A15
Leif Lindholm (2):
ArmPlatformPkg: Add conditional inclusion of Lan91x ethernet support
ArmPlatformPkg: Add conditionalised networking support for FVP AArch64
Reece R. Pollack (1):
ArmPlatformPkg: Add Lan91x Dxe driver
.../ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf | 5 +
.../ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf | 21 +-
.../ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf | 21 +-
.../ArmVExpressPkg/ArmVExpress-networking.fdf.inc | 28 +
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc | 9 +
EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.c | 2233 ++++++++++++++++++++
EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf | 58 +
EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxeHw.h | 278 +++
EmbeddedPkg/EmbeddedPkg.dec | 3 +
9 files changed, 2624 insertions(+), 32 deletions(-)
create mode 100644 ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-networking.fdf.inc
create mode 100644 EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.c
create mode 100644 EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf
create mode 100644 EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxeHw.h
--
1.8.3.1
From: Fu Wei <fu.wei(a)linaro.org>
Add a driver for the SMSC Lan91x Ethernet controllers, such as
the 91C111 emulated in the ARM RTSM development simulators
Add support for including the SMSC LAN 91C111 driver support
by specifying the EDK2_ENABLE_SMSC_91X build variable.
A per-platform addition to the .fdf is also required to actually include
the driver and network protocol support in the produced image.
Add conditionalised networking support for
FVP AArch64
RTSM A15
RTSM A15 MPcore
This repo is including all the patches:
https://git.linaro.org/people/fu.wei/uefi.git/shortlog/refs/heads/LAN91x_Dx…
Fu Wei (2):
ArmPlatformPkg: Add conditionalised networking support for RTSM A15
MPcore
ArmPlatformPkg: Add conditionalised networking support for RTSM A15
Leif Lindholm (2):
ArmPlatformPkg: Add conditional inclusion of Lan91x ethernet support
ArmPlatformPkg: Add conditionalised networking support for FVP AArch64
Reece R. Pollack (1):
ArmPlatformPkg: Add Lan91x Dxe driver
.../ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf | 5 +
.../ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf | 21 +-
.../ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf | 21 +-
.../ArmVExpressPkg/ArmVExpress-networking.fdf.inc | 28 +
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc | 9 +
EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.c | 2233 ++++++++++++++++++++
EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf | 58 +
EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxeHw.h | 278 +++
EmbeddedPkg/EmbeddedPkg.dec | 3 +
9 files changed, 2624 insertions(+), 32 deletions(-)
create mode 100644 ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-networking.fdf.inc
create mode 100644 EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.c
create mode 100644 EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf
create mode 100644 EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxeHw.h
--
1.8.3.1
Request low-memory from UEFI and relocate.
Signed-off-by: Varad Gautam <varadgautam(a)gmail.com>
---
A couple problems with the patch:
* accessing `linux_banner` in `libstub/fdt.c:update_fdt` causes a Data Abort; need a
better place to define it.
* arch/arm/boot/compressed/head.S: jump to zImage `mov pc, r3` fails, although jump
to hard-coded relocated address (`ldr pc, =0x80008000`) works, 0x80008000 being the
new zImage location. Need help with calling convention - am I setting *image_addr
correctly?
Thanks,
Varad
arch/arm/boot/compressed/efi-stub.c | 64 ++++++++-----------------------------
1 file changed, 14 insertions(+), 50 deletions(-)
diff --git a/arch/arm/boot/compressed/efi-stub.c b/arch/arm/boot/compressed/efi-stub.c
index 1341229..0364e95 100644
--- a/arch/arm/boot/compressed/efi-stub.c
+++ b/arch/arm/boot/compressed/efi-stub.c
@@ -21,10 +21,8 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table,
unsigned long dram_base,
efi_loaded_image_t *image)
{
- unsigned long nr_pages;
efi_status_t status;
- /* Use alloc_addr to tranlsate between types */
- efi_physical_addr_t alloc_addr;
+ unsigned long kernel_size;
/*
* Verify that the DRAM base address is compatible the the ARM
@@ -38,55 +36,21 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table,
return EFI_LOAD_ERROR;
}
- /*
- * Reserve memory for the uncompressed kernel image. This is
- * all that prevents any future allocations from conflicting
- * with the kernel. Since we can't tell from the compressed
- * image how much DRAM the kernel actually uses (due to BSS
- * size uncertainty) we allocate the maximum possible size.
- * Do this very early, as prints can cause memory allocations
- * that may conflict with this.
- */
- alloc_addr = dram_base;
- *reserve_size = MAX_UNCOMP_KERNEL_SIZE;
- nr_pages = round_up(*reserve_size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
- status = sys_table->boottime->allocate_pages(EFI_ALLOCATE_ADDRESS,
- EFI_LOADER_DATA,
- nr_pages, &alloc_addr);
- if (status != EFI_SUCCESS) {
- *reserve_size = 0;
- pr_efi_err(sys_table, "Unable to allocate memory for uncompressed kernel.\n");
- return status;
- }
- *reserve_addr = alloc_addr;
-
- /*
- * Relocate the zImage, if required. ARM doesn't have a
- * preferred address, so we set it to 0, as we want to allocate
- * as low in memory as possible.
- */
+ /* Relocate the image, if required. */
*image_size = image->image_size;
- status = efi_relocate_kernel(sys_table, image_addr, *image_size,
- *image_size, 0, 0);
- if (status != EFI_SUCCESS) {
- pr_efi_err(sys_table, "Failed to relocate kernel.\n");
- efi_free(sys_table, *reserve_size, *reserve_addr);
- *reserve_size = 0;
- return status;
+ if (*image_addr != (dram_base + TEXT_OFFSET)) {
+ kernel_size = *image_size;
+ status = efi_low_alloc(sys_table, kernel_size + TEXT_OFFSET,
+ EFI_PAGE_SIZE, reserve_addr);
+ if (status != EFI_SUCCESS) {
+ pr_efi_err(sys_table, "Failed to relocate kernel\n");
+ return status;
+ }
+ memcpy((void *)(*reserve_addr + TEXT_OFFSET), image->image_base,
+ kernel_size);
+ *image_addr = *reserve_addr + TEXT_OFFSET;
+ *reserve_size = kernel_size + TEXT_OFFSET;
}
- /*
- * Check to see if we were able to allocate memory low enough
- * in memory. The kernel determines the base of DRAM from the
- * address at which the zImage is loaded.
- */
- if (*image_addr + *image_size > dram_base + ZIMAGE_OFFSET_LIMIT) {
- pr_efi_err(sys_table, "Failed to relocate kernel, no low memory available.\n");
- efi_free(sys_table, *reserve_size, *reserve_addr);
- *reserve_size = 0;
- efi_free(sys_table, *image_size, *image_addr);
- *image_size = 0;
- return EFI_LOAD_ERROR;
- }
return EFI_SUCCESS;
}
--
2.1.2