EmbeddedPkg: add platform boot manager protocol
authorHaojian Zhuang <haojian.zhuang@linaro.org>
Mon, 23 Apr 2018 06:21:53 +0000 (14:21 +0800)
committerLeif Lindholm <leif.lindholm@linaro.org>
Tue, 5 Jun 2018 14:43:15 +0000 (15:43 +0100)
Create the PlatformBootManagerProtocol that is used to add
predefined boot options in platform driver. This interface
will be used in ArmPkg/PlatformBootManagerLib.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
EmbeddedPkg/EmbeddedPkg.dec
EmbeddedPkg/Include/Protocol/PlatformBootManager.h [new file with mode: 0644]

index 179c1b1..28a1438 100644 (file)
@@ -81,6 +81,7 @@
   gAndroidFastbootTransportProtocolGuid = { 0x74bd9fe0, 0x8902, 0x11e3, {0xb9, 0xd3, 0xf7, 0x22, 0x38, 0xfc, 0x9a, 0x31}}\r
   gAndroidFastbootPlatformProtocolGuid =  { 0x524685a0, 0x89a0, 0x11e3, {0x9d, 0x4d, 0xbf, 0xa9, 0xf6, 0xa4, 0x03, 0x08}}\r
   gUsbDeviceProtocolGuid =  { 0x021bd2ca, 0x51d2, 0x11e3, {0x8e, 0x56, 0xb7, 0x54, 0x17, 0xc7,  0x0b, 0x44 }}\r
+  gPlatformBootManagerProtocolGuid = { 0x7197c8a7, 0x6559, 0x4c93, { 0x93, 0xd5, 0x8a, 0x84, 0xf9, 0x88, 0x79, 0x8b }}\r
   gPlatformGpioProtocolGuid = { 0x52ce9845, 0x5af4, 0x43e2, {0xba, 0xfd, 0x23, 0x08, 0x12, 0x54, 0x7a, 0xc2 }}\r
   gPlatformVirtualKeyboardProtocolGuid = { 0x0e3606d2, 0x1dc3, 0x4e6f, { 0xbe, 0x65, 0x39, 0x49, 0x82, 0xa2, 0x65, 0x47 }}\r
   gAndroidBootImgProtocolGuid = { 0x9859bb19, 0x407c, 0x4f8b, {0xbc, 0xe1, 0xf8, 0xda, 0x65, 0x65, 0xf4, 0xa5 }}\r
diff --git a/EmbeddedPkg/Include/Protocol/PlatformBootManager.h b/EmbeddedPkg/Include/Protocol/PlatformBootManager.h
new file mode 100644 (file)
index 0000000..4175c85
--- /dev/null
@@ -0,0 +1,86 @@
+/** @file\r
+\r
+  Copyright (c) 2018, Linaro. All rights reserved.<BR>\r
+\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __PLATFORM_BOOT_MANAGER_PROTOCOL_H__\r
+#define __PLATFORM_BOOT_MANAGER_PROTOCOL_H__\r
+\r
+//\r
+// Protocol interface structure\r
+//\r
+typedef struct _PLATFORM_BOOT_MANAGER_PROTOCOL    PLATFORM_BOOT_MANAGER_PROTOCOL;\r
+\r
+//\r
+// Function Prototypes\r
+//\r
+\r
+/*\r
+  Get predefined boot options for platform.\r
+\r
+  @param[out] Count            The number of elements in each of\r
+                               BootOptions and BootKeys. On successful\r
+                               return, Count is at least one.\r
+\r
+  @param[out] BootOptions      An array of platform boot options.\r
+                               BootOptions is pool-allocated by\r
+                               GET_PLATFORM_BOOT_OPTIONS_AND_KEYS, and\r
+                               GET_PLATFORM_BOOT_OPTIONS_AND_KEYS populates\r
+                               every element in BootOptions with\r
+                               EfiBootManagerInitializeLoadOption().\r
+                               BootOptions shall not contain duplicate\r
+                               entries. The caller is responsible for\r
+                               releasing BootOptions after use with\r
+                               EfiBootManagerFreeLoadOptions().\r
+\r
+  @param[out] BootKeys         A pool-allocated array of platform boot\r
+                               hotkeys. For every 0 <= Index < Count, if\r
+                               BootOptions[Index] is not to be associated\r
+                               with a hotkey, then BootKeys[Index] is\r
+                               zero-filled. Otherwise, BootKeys[Index]\r
+                               specifies the boot hotkey for\r
+                               BootOptions[Index]. BootKeys shall not\r
+                               contain duplicate entries (other than\r
+                               zero-filled entries). The caller is\r
+                               responsible for releasing BootKeys with\r
+                               FreePool() after use.\r
+\r
+  @retval EFI_SUCCESS          Count, BootOptions and BootKeys have\r
+                               been set.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r
+\r
+  @retval EFI_UNSUPPORTED      The platform doesn't provide boot options\r
+                               as a feature.\r
+\r
+  @retval EFI_NOT_FOUND        The platform could provide boot options\r
+                               as a feature, but none have been\r
+                               configured.\r
+\r
+  @return                      Error codes propagated from underlying\r
+                               functions.\r
+*/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *GET_PLATFORM_BOOT_OPTIONS_AND_KEYS) (\r
+  OUT UINTN                              *Count,\r
+  OUT EFI_BOOT_MANAGER_LOAD_OPTION       **BootOptions,\r
+  OUT EFI_INPUT_KEY                      **BootKeys\r
+  );\r
+\r
+struct _PLATFORM_BOOT_MANAGER_PROTOCOL {\r
+  GET_PLATFORM_BOOT_OPTIONS_AND_KEYS     GetPlatformBootOptionsAndKeys;\r
+};\r
+\r
+extern EFI_GUID gPlatformBootManagerProtocolGuid;\r
+\r
+#endif /* __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ */\r