Somehow I missed adding in a dtsi change from
the delta in commit 55830cce09db60147427b881b441e296476c187f.

Correct the apm-storm.dtsi for the pmu.

Signed-off-by: Al Stone <ahs3@redhat.com>
Allow DeviceTree to be read from global variables

This is a simple hack to provide a simple way to overwrite the DTB
included in the UEFI image. The attached script (which would be run on a
Linux image on a Mustang) splits the DTB into ~900 byte blocks and
creates an efivar entry for each block. On the next boot, the firmware
checks for the efivar entries. If they exist, it copies the data in the
entries over the existing DTB data. Then it passes the DTB data buffer
to grub normally (so if no efivar entries exist, the original DTB gets
used).

The script writes the efivar entries from the back of the DTB and starts
at entry n and goes forward in the DTB and down to 0, while UEFI reads
from the front of the DTB with entry 0 and stops when it can no longer
find an efivar. Hopefully, this means that incomplete writes of a new
DTB should be ignored but this has not been heavily tested.

Here's the script that has to be run on the Mustang. Note that dtc is
not currently supported for aarch64 (afaik) so the .dtb has to be
compiled elsewhere and transferred:

#!/bin/bash
#uncomment the following line if you have dtc and want to build from dts
#dtc -o mustang.dtb -O dtb apm-mustang.dts

rm -f /sys/firmware/efi/efivars/DeviceTree*
split -db 932 mustang.dtb
DTB_FILESIZE=$(printf "%d" $(stat --printf="%s" mustang.dtb))
export DTB_FILESIZE
for ((i=$DTB_FILESIZE/932;i>=0;i--))
  do
  j=`printf "%02.2d" $i`
  export j
  (printf "\x07\x00\x00\x00" ; cat x$j) > mustangdtb$j.uefi
  dd if=mustangdtb$j.uefi of=/sys/firmware/efi/efivars/DeviceTree$j-8be4df61-93ca-11d2-aa0d-00e098032b8c bs=$(printf "%d" $(stat --printf="%s" mustangdtb$i.uefi))
done
rm -f x* mustangdtb*

Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
Change SecEntryPoint.S to unix format (vs dos)

Signed-off-by: Al Stone <ahs3@redhat.com>
Boot in EL2

Remove the code to switch to EL1, so that grub comes in EL2 and
virtualization can be used.

Signed-off-by: Tuan Phan <tphan@apm.com>
reformat the NorFlash code

includes changes from upstream to enable UEFI update from UEFI.

updated for this tree since we already had most of these changes
for the NorFlash code already.

Author:    Mark Langsdorf <mlangsdorf@localhost.localdomain>
Signed-off-by: Al Stone <ahs3@redhat.com>
UpgradeFirmware application

Add a UEFI application that can update the UEFI firmware from the UEFI
shell.

Signed-off-by: Tuan Phan <tphan@apm.com>
give sensible defaults to UpgradeFirmware.efi

if UpgradeFirmware is called without a file argument (or with extra
arguments), it will try to open a file called apm_upgrade.cmd. If that
works, it will execute the instructions from the file. Otherwise, it
will print its usage instructions and fail.

Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>