* [PATCH] MdeModulePkg/UefiBootManagerLib: Support skipping BM enumeration
@ 2019-11-04 17:51 Ashish Singhal
0 siblings, 0 replies; 2+ messages in thread
From: Ashish Singhal @ 2019-11-04 17:51 UTC (permalink / raw)
To: devel, jian.j.wang, hao.a.wu; +Cc: Ashish Singhal
Allow support for skipping auto enumeration of a BlockIO or
SimpleFileSystem or LoadFile protocol based on a new protocol
installed on the same handle. EdkiiSkipBmAutoEnumerate protocol
has been added for that purpose.
Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
---
.../Include/Protocol/SkipBmAutoEnumerate.h | 25 ++++++++++++++
MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 40 +++++++++++++++++++++-
.../Library/UefiBootManagerLib/InternalBm.h | 1 +
.../UefiBootManagerLib/UefiBootManagerLib.inf | 1 +
MdeModulePkg/MdeModulePkg.dec | 3 ++
5 files changed, 69 insertions(+), 1 deletion(-)
create mode 100644 MdeModulePkg/Include/Protocol/SkipBmAutoEnumerate.h
diff --git a/MdeModulePkg/Include/Protocol/SkipBmAutoEnumerate.h b/MdeModulePkg/Include/Protocol/SkipBmAutoEnumerate.h
new file mode 100644
index 0000000..7efca7a
--- /dev/null
+++ b/MdeModulePkg/Include/Protocol/SkipBmAutoEnumerate.h
@@ -0,0 +1,25 @@
+/** @file
+ Skip Boot Manager Auto Enumerate protocol header file.
+
+ This is used to skip auto boot manager enumeration. This protocol can
+ be installed on any handle having BlockIo or SimpleFileSystem or LoadFile
+ protocol and UEFI boot manager would skip its enumeration.
+
+Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _SKIP_BM_AUTO_ENUMERATE_PROTOCOL_H_
+#define _SKIP_BM_AUTO_ENUMERATE_PROTOCOL_H_
+
+///
+/// Global ID for the EDKII SKIP BM AUTO ENUMERATE Protocol.
+///
+#define EDKII_SKIP_BM_AUTO_ENUMERATE_PROTOCOL_GUID \
+ { 0x2733f321, 0x5a7e, 0x4178, { 0x86, 0xcc, 0x21, 0x65, 0xd2, 0x0c, 0xec, 0x1e }}
+
+extern EFI_GUID gEdkiiSkipBmAutoEnumerateProtocolGuid;
+
+#endif
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 760d764..7b5f176 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -2080,6 +2080,7 @@ BmEnumerateBootOptions (
UINTN HandleCount;
EFI_HANDLE *Handles;
EFI_BLOCK_IO_PROTOCOL *BlkIo;
+ VOID *SkipBmAutoEnumerate;
UINTN Removable;
UINTN Index;
CHAR16 *Description;
@@ -2111,6 +2112,18 @@ BmEnumerateBootOptions (
continue;
}
+ Status = gBS->HandleProtocol (
+ Handles[Index],
+ &gEdkiiSkipBmAutoEnumerateProtocolGuid,
+ (VOID **) &SkipBmAutoEnumerate
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Skip if the file system handle supports a SkipBmAutoEnumerate protocol
+ //
+ continue;
+ }
+
//
// Skip the logical partitions
//
@@ -2169,12 +2182,25 @@ BmEnumerateBootOptions (
&gEfiBlockIoProtocolGuid,
(VOID **) &BlkIo
);
- if (!EFI_ERROR (Status)) {
+ if (!EFI_ERROR (Status)) {
//
// Skip if the file system handle supports a BlkIo protocol, which we've handled in above
//
continue;
}
+
+ Status = gBS->HandleProtocol (
+ Handles[Index],
+ &gEdkiiSkipBmAutoEnumerateProtocolGuid,
+ (VOID **) &SkipBmAutoEnumerate
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Skip if the file system handle supports a SkipBmAutoEnumerate protocol
+ //
+ continue;
+ }
+
Description = BmGetBootDescription (Handles[Index]);
BootOptions = ReallocatePool (
sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount),
@@ -2212,6 +2238,18 @@ BmEnumerateBootOptions (
&Handles
);
for (Index = 0; Index < HandleCount; Index++) {
+ Status = gBS->HandleProtocol (
+ Handles[Index],
+ &gEdkiiSkipBmAutoEnumerateProtocolGuid,
+ (VOID **) &SkipBmAutoEnumerate
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Skip if the file system handle supports a SkipBmAutoEnumerate protocol
+ //
+ continue;
+ }
+
//
// Ignore BootManagerMenu. its boot option will be created by EfiBootManagerGetBootManagerMenu().
//
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
index 027eb25..f95e58f 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
+++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
@@ -41,6 +41,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Protocol/VariableLock.h>
#include <Protocol/RamDisk.h>
#include <Protocol/DeferredImageLoad.h>
+#include <Protocol/SkipBmAutoEnumerate.h>
#include <Guid/MemoryTypeInformation.h>
#include <Guid/FileInfo.h>
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
index ed6b467..40c668c 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+++ b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
@@ -107,6 +107,7 @@
gEfiFormBrowser2ProtocolGuid ## SOMETIMES_CONSUMES
gEfiRamDiskProtocolGuid ## SOMETIMES_CONSUMES
gEfiDeferredImageLoadProtocolGuid ## SOMETIMES_CONSUMES
+ gEdkiiSkipBmAutoEnumerateProtocolGuid ## SOMETIMES_CONSUMES
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange ## SOMETIMES_CONSUMES
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index d6bac97..64ef22a 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -604,6 +604,9 @@
## Include/Protocol/PeCoffImageEmulator.h
gEdkiiPeCoffImageEmulatorProtocolGuid = { 0x96f46153, 0x97a7, 0x4793, { 0xac, 0xc1, 0xfa, 0x19, 0xbf, 0x78, 0xea, 0x97 } }
+ ## Include/Protocol/SkipBmAutoEnumerate.h
+ gEdkiiSkipBmAutoEnumerateProtocolGuid = { 0x2733f321, 0x5a7e, 0x4178, { 0x86, 0xcc, 0x21, 0x65, 0xd2, 0x0c, 0xec, 0x1e } }
+
#
# [Error.gEfiMdeModulePkgTokenSpaceGuid]
# 0x80000001 | Invalid value provided.
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] Support skipping automatic BM enumeration
@ 2019-10-30 3:47 Ashish Singhal
2019-10-30 3:47 ` [PATCH] MdeModulePkg/UefiBootManagerLib: Support skipping " Ashish Singhal
0 siblings, 1 reply; 2+ messages in thread
From: Ashish Singhal @ 2019-10-30 3:47 UTC (permalink / raw)
To: devel, jian.j.wang, hao.a.wu; +Cc: Ashish Singhal
Right now, any and every handle with a BlockIO or SimpleFileSystem or
LoadFile protocol installed on the system is used to enumerate BM
automatically. There may be cases where on a platform, some of these
are not desirable to be enumerated automatically. This patch adds
support for skipping this automatic enumeration if on the same handle,
a new protocol defined as EdkiiSkipBmAutoEnumerate is found to be installed.
Ashish Singhal (1):
MdeModulePkg/UefiBootManagerLib: Support skipping BM enumeration
.../Include/Protocol/SkipBmAutoEnumerate.h | 25 ++++++++++++++
MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 40 +++++++++++++++++++++-
.../Library/UefiBootManagerLib/InternalBm.h | 1 +
.../UefiBootManagerLib/UefiBootManagerLib.inf | 1 +
MdeModulePkg/MdeModulePkg.dec | 3 ++
5 files changed, 69 insertions(+), 1 deletion(-)
create mode 100644 MdeModulePkg/Include/Protocol/SkipBmAutoEnumerate.h
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] MdeModulePkg/UefiBootManagerLib: Support skipping BM enumeration
2019-10-30 3:47 [PATCH] Support skipping automatic " Ashish Singhal
@ 2019-10-30 3:47 ` Ashish Singhal
0 siblings, 0 replies; 2+ messages in thread
From: Ashish Singhal @ 2019-10-30 3:47 UTC (permalink / raw)
To: devel, jian.j.wang, hao.a.wu; +Cc: Ashish Singhal
Allow support for skipping auto enumeration of a BlockIO or
SimpleFileSystem or LoadFile protocol based on a new protocol
installed on the same handle. EdkiiSkipBmAutoEnumerate protocol
has been added for that purpose.
Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
---
.../Include/Protocol/SkipBmAutoEnumerate.h | 25 ++++++++++++++
MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 40 +++++++++++++++++++++-
.../Library/UefiBootManagerLib/InternalBm.h | 1 +
.../UefiBootManagerLib/UefiBootManagerLib.inf | 1 +
MdeModulePkg/MdeModulePkg.dec | 3 ++
5 files changed, 69 insertions(+), 1 deletion(-)
create mode 100644 MdeModulePkg/Include/Protocol/SkipBmAutoEnumerate.h
diff --git a/MdeModulePkg/Include/Protocol/SkipBmAutoEnumerate.h b/MdeModulePkg/Include/Protocol/SkipBmAutoEnumerate.h
new file mode 100644
index 0000000..7efca7a
--- /dev/null
+++ b/MdeModulePkg/Include/Protocol/SkipBmAutoEnumerate.h
@@ -0,0 +1,25 @@
+/** @file
+ Skip Boot Manager Auto Enumerate protocol header file.
+
+ This is used to skip auto boot manager enumeration. This protocol can
+ be installed on any handle having BlockIo or SimpleFileSystem or LoadFile
+ protocol and UEFI boot manager would skip its enumeration.
+
+Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _SKIP_BM_AUTO_ENUMERATE_PROTOCOL_H_
+#define _SKIP_BM_AUTO_ENUMERATE_PROTOCOL_H_
+
+///
+/// Global ID for the EDKII SKIP BM AUTO ENUMERATE Protocol.
+///
+#define EDKII_SKIP_BM_AUTO_ENUMERATE_PROTOCOL_GUID \
+ { 0x2733f321, 0x5a7e, 0x4178, { 0x86, 0xcc, 0x21, 0x65, 0xd2, 0x0c, 0xec, 0x1e }}
+
+extern EFI_GUID gEdkiiSkipBmAutoEnumerateProtocolGuid;
+
+#endif
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 760d764..7b5f176 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -2080,6 +2080,7 @@ BmEnumerateBootOptions (
UINTN HandleCount;
EFI_HANDLE *Handles;
EFI_BLOCK_IO_PROTOCOL *BlkIo;
+ VOID *SkipBmAutoEnumerate;
UINTN Removable;
UINTN Index;
CHAR16 *Description;
@@ -2111,6 +2112,18 @@ BmEnumerateBootOptions (
continue;
}
+ Status = gBS->HandleProtocol (
+ Handles[Index],
+ &gEdkiiSkipBmAutoEnumerateProtocolGuid,
+ (VOID **) &SkipBmAutoEnumerate
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Skip if the file system handle supports a SkipBmAutoEnumerate protocol
+ //
+ continue;
+ }
+
//
// Skip the logical partitions
//
@@ -2169,12 +2182,25 @@ BmEnumerateBootOptions (
&gEfiBlockIoProtocolGuid,
(VOID **) &BlkIo
);
- if (!EFI_ERROR (Status)) {
+ if (!EFI_ERROR (Status)) {
//
// Skip if the file system handle supports a BlkIo protocol, which we've handled in above
//
continue;
}
+
+ Status = gBS->HandleProtocol (
+ Handles[Index],
+ &gEdkiiSkipBmAutoEnumerateProtocolGuid,
+ (VOID **) &SkipBmAutoEnumerate
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Skip if the file system handle supports a SkipBmAutoEnumerate protocol
+ //
+ continue;
+ }
+
Description = BmGetBootDescription (Handles[Index]);
BootOptions = ReallocatePool (
sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount),
@@ -2212,6 +2238,18 @@ BmEnumerateBootOptions (
&Handles
);
for (Index = 0; Index < HandleCount; Index++) {
+ Status = gBS->HandleProtocol (
+ Handles[Index],
+ &gEdkiiSkipBmAutoEnumerateProtocolGuid,
+ (VOID **) &SkipBmAutoEnumerate
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Skip if the file system handle supports a SkipBmAutoEnumerate protocol
+ //
+ continue;
+ }
+
//
// Ignore BootManagerMenu. its boot option will be created by EfiBootManagerGetBootManagerMenu().
//
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
index 027eb25..f95e58f 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
+++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
@@ -41,6 +41,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Protocol/VariableLock.h>
#include <Protocol/RamDisk.h>
#include <Protocol/DeferredImageLoad.h>
+#include <Protocol/SkipBmAutoEnumerate.h>
#include <Guid/MemoryTypeInformation.h>
#include <Guid/FileInfo.h>
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
index ed6b467..40c668c 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+++ b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
@@ -107,6 +107,7 @@
gEfiFormBrowser2ProtocolGuid ## SOMETIMES_CONSUMES
gEfiRamDiskProtocolGuid ## SOMETIMES_CONSUMES
gEfiDeferredImageLoadProtocolGuid ## SOMETIMES_CONSUMES
+ gEdkiiSkipBmAutoEnumerateProtocolGuid ## SOMETIMES_CONSUMES
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange ## SOMETIMES_CONSUMES
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index d6bac97..64ef22a 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -604,6 +604,9 @@
## Include/Protocol/PeCoffImageEmulator.h
gEdkiiPeCoffImageEmulatorProtocolGuid = { 0x96f46153, 0x97a7, 0x4793, { 0xac, 0xc1, 0xfa, 0x19, 0xbf, 0x78, 0xea, 0x97 } }
+ ## Include/Protocol/SkipBmAutoEnumerate.h
+ gEdkiiSkipBmAutoEnumerateProtocolGuid = { 0x2733f321, 0x5a7e, 0x4178, { 0x86, 0xcc, 0x21, 0x65, 0xd2, 0x0c, 0xec, 0x1e } }
+
#
# [Error.gEfiMdeModulePkgTokenSpaceGuid]
# 0x80000001 | Invalid value provided.
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-04 17:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-04 17:51 [PATCH] MdeModulePkg/UefiBootManagerLib: Support skipping BM enumeration Ashish Singhal
-- strict thread matches above, loose matches on Subject: below --
2019-10-30 3:47 [PATCH] Support skipping automatic " Ashish Singhal
2019-10-30 3:47 ` [PATCH] MdeModulePkg/UefiBootManagerLib: Support skipping " Ashish Singhal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox