payloads/edk2: Add an option to use EDK2 Universal Payload

This add's an option to use EDK2's Universal Payload instead
of the standard UefiPayloadPkg. Universal Payload requires
a ShimLayer, to build the required HOBs and pass them to Universal
Payload.

The ShimLayer is built to encompass UniveralPayload, so only
one ELF binary is added to coreboot.

Universal Payload is based on Intel's USF specification:
https://universalscalablefirmware.github.io/documentation/

This has been added with the repository pointing to
https://github.com/starlabsltd. The required ShimLayer patches
will be merged into edk2 master once corresponding coreboot
patches are merged.

This is because the EDK2 engineers believe it is an impossible
task to patch coreboot to build and use Universal Payload.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Change-Id: I17cc86d5eac0d5d91551ba5bea73fbc07ebdf0d3
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65934
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/payloads/external/Makefile.inc b/payloads/external/Makefile.inc
index 30d82a9..85e01b9 100644
--- a/payloads/external/Makefile.inc
+++ b/payloads/external/Makefile.inc
@@ -161,6 +161,7 @@
 		CONFIG_EDK2_REPOSITORY=$(CONFIG_EDK2_REPOSITORY) \
 		CONFIG_EDK2_TAG_OR_REV=$(CONFIG_EDK2_TAG_OR_REV) \
 		CONFIG_EDK2_UEFIPAYLOAD=$(CONFIG_EDK2_UEFIPAYLOAD) \
+		CONFIG_EDK2_UNIVERSAL_PAYLOAD=$(CONFIG_EDK2_UNIVERSAL_PAYLOAD) \
 		CONFIG_EDK2_REPO_OFFICIAL=$(CONFIG_EDK2_REPO_OFFICIAL) \
 		CONFIG_EDK2_REPO_MRCHROMEBOX=$(CONFIG_EDK2_REPO_MRCHROMEBOX) \
 		CONFIG_EDK2_REPO_CUSTOM=$(CONFIG_EDK2_REPO_CUSTOM) \
@@ -205,6 +206,7 @@
 		CONFIG_EDK2_REPOSITORY=$(CONFIG_EDK2_REPOSITORY) \
 		CONFIG_EDK2_TAG_OR_REV=$(CONFIG_EDK2_TAG_OR_REV) \
 		CONFIG_EDK2_UEFIPAYLOAD=$(CONFIG_EDK2_UEFIPAYLOAD) \
+		CONFIG_EDK2_UNIVERSAL_PAYLOAD=$(CONFIG_EDK2_UNIVERSAL_PAYLOAD) \
 		CONFIG_EDK2_REPO_OFFICIAL=$(CONFIG_EDK2_REPO_OFFICIAL) \
 		CONFIG_EDK2_REPO_MRCHROMEBOX=$(CONFIG_EDK2_REPO_MRCHROMEBOX) \
 		CONFIG_EDK2_REPO_CUSTOM=$(CONFIG_EDK2_REPO_CUSTOM) \
diff --git a/payloads/external/edk2/Kconfig b/payloads/external/edk2/Kconfig
index 6dca097..1057c43 100644
--- a/payloads/external/edk2/Kconfig
+++ b/payloads/external/edk2/Kconfig
@@ -3,15 +3,42 @@
 config PAYLOAD_FILE
 	string "edk2 binary"
 	default "$(obj)/UEFIPAYLOAD.fd" if EDK2_UEFIPAYLOAD
+	default "$(obj)/ShimmedUniversalPayload.elf" if EDK2_UNIVERSAL_PAYLOAD
 	help
 	  The result of a UefiPayloadPkg build
 
+choice
+	prompt "EDK II build type"
+	default EDK2_UEFIPAYLOAD
+	help
+	  Select the build type for edk2. UniversalPayload is recommended, as it is
+	  replacing UefiPayloadPkg. Whilst in the transition phase between the two,
+	  both options exist.
+
 config EDK2_UEFIPAYLOAD
 	bool "Build UefiPayloadPkg"
-	default y
 	help
 	  Build the standard UefiPayloadPkg
 
+config EDK2_UNIVERSAL_PAYLOAD
+	bool "Build Universal Payload"
+	help
+	  Select this option if you want to build a coreboot image
+	  with EDK2s Universal Payload. If you don't know what this is
+	  about, just leave it enabled.
+
+	  Universal Payload should ideally only be built from upstream EDK2,
+	  https://github.com/tianocore/edk2, as this is regularly build tested
+	  and it encourages patches to be merged upstream.
+
+	  Whilst the required patches are being merged, this is pointed to
+	  Star Labs GitHub repository which contains these patches and is based
+	  on a known working commit.
+
+	  See https://universalscalablefirmware.github.io/documentation/ for more information.
+
+endchoice
+
 choice
 	prompt "Tianocore's EDK II payload"
 	default EDK2_REPO_MRCHROMEBOX
@@ -44,6 +71,7 @@
 
 config EDK2_REPOSITORY
 	string "URL to git repository for edk2"
+	default "https://github.com/starlabsltd/edk2" if EDK2_UNIVERSAL_PAYLOAD
 	default "https://github.com/mrchromebox/edk2" if EDK2_REPO_MRCHROMEBOX
 	default "https://github.com/tianocore/edk2" if EDK2_REPO_OFFICIAL
 	default "" if EDK2_REPO_CUSTOM
@@ -54,6 +82,7 @@
 config EDK2_TAG_OR_REV
 	string "Insert a commit's SHA-1 or a branch name"
 	default "origin/uefipayload_202304" if EDK2_REPO_MRCHROMEBOX
+	default "origin/universalpayload" if EDK2_UNIVERSAL_PAYLOAD
 	default "origin/master" if EDK2_REPO_OFFICIAL
 	default "" if EDK2_REPO_CUSTOM
 	help