* [PATCH] SecurityPkg/OpalPassword: Remove dependency on EFI_BLOCK_IO_PROTOCOL
@ 2019-11-04 4:04 Maggie Chu
2019-11-04 4:08 ` Yao, Jiewen
2019-11-06 0:03 ` Dong, Eric
0 siblings, 2 replies; 4+ messages in thread
From: Maggie Chu @ 2019-11-04 4:04 UTC (permalink / raw)
To: devel; +Cc: Eric Dong, Chao Zhang, Jiewen Yao
https://bugzilla.tianocore.org/show_bug.cgi?id=2327
RAID drivers abstract their physical drives that make up
the array into a single unit, and do not supply individual
EFI_BLOCK_IO_PROTOCOL instances for each physical drive in the array.
This breaks support for the Security Storage Command Protocol,
which currently requires an EFI_BLOCK_IO_PROTOCOL to be associated
with the same device the protocol is installed on and provide
all the same parameters.
This patch remove dependency on EFI_BLOCK_IO_PROTOCOL and
allows access to Opal drive members of a RAID array.
Signed-off-by: Maggie Chu <maggie.chu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
---
SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 70 ++++++++++----------------
1 file changed, 27 insertions(+), 43 deletions(-)
diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
index 77905d2bf9..6bec54b932 100644
--- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
+++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
@@ -2667,7 +2667,6 @@ OpalEfiDriverBindingSupported(
{
EFI_STATUS Status;
EFI_STORAGE_SECURITY_COMMAND_PROTOCOL* SecurityCommand;
- EFI_BLOCK_IO_PROTOCOL* BlkIo;
if (mOpalEndOfDxe) {
return EFI_UNSUPPORTED;
@@ -2703,33 +2702,6 @@ OpalEfiDriverBindingSupported(
Controller
);
- //
- // Test EFI_BLOCK_IO_PROTOCOL on controller Handle, required by EFI_STORAGE_SECURITY_COMMAND_PROTOCOL
- // function APIs
- //
- Status = gBS->OpenProtocol(
- Controller,
- &gEfiBlockIoProtocolGuid,
- (VOID **)&BlkIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR(Status)) {
- DEBUG((DEBUG_INFO, "No EFI_BLOCK_IO_PROTOCOL on controller\n"));
- return Status;
- }
-
- //
- // Close protocol and reopen in Start call
- //
- gBS->CloseProtocol(
- Controller,
- &gEfiBlockIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
return EFI_SUCCESS;
}
@@ -2827,30 +2799,42 @@ OpalEfiDriverBindingStart(
);
if (EFI_ERROR(Status)) {
//
- // Close storage security that was opened
+ // Block_IO not supported on handle
//
- gBS->CloseProtocol(
- Controller,
- &gEfiStorageSecurityCommandProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
+ if(Status == EFI_UNSUPPORTED) {
+ BlkIo = NULL;
+ } else {
+ //
+ // Close storage security that was opened
+ //
+ gBS->CloseProtocol(
+ Controller,
+ &gEfiStorageSecurityCommandProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
- FreePool(Dev);
- return Status;
+ FreePool(Dev);
+ return Status;
+ }
}
//
// Save mediaId
//
- Dev->MediaId = BlkIo->Media->MediaId;
+ if(BlkIo == NULL) {
+ // If no Block IO present, use defined MediaId value.
+ Dev->MediaId = 0x0;
+ } else {
+ Dev->MediaId = BlkIo->Media->MediaId;
- gBS->CloseProtocol(
- Controller,
- &gEfiBlockIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
+ gBS->CloseProtocol(
+ Controller,
+ &gEfiBlockIoProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
);
+ }
//
// Acquire Ascii printable name of child, if not found, then ignore device
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] SecurityPkg/OpalPassword: Remove dependency on EFI_BLOCK_IO_PROTOCOL
2019-11-04 4:04 [PATCH] SecurityPkg/OpalPassword: Remove dependency on EFI_BLOCK_IO_PROTOCOL Maggie Chu
@ 2019-11-04 4:08 ` Yao, Jiewen
2019-11-05 3:43 ` [edk2-devel] " Maggie Chu
2019-11-06 0:03 ` Dong, Eric
1 sibling, 1 reply; 4+ messages in thread
From: Yao, Jiewen @ 2019-11-04 4:08 UTC (permalink / raw)
To: Chu, Maggie, devel@edk2.groups.io; +Cc: Dong, Eric, Zhang, Chao B
Hello
May I know what test has been done for this patch?
> -----Original Message-----
> From: Chu, Maggie <maggie.chu@intel.com>
> Sent: Monday, November 4, 2019 12:04 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Zhang, Chao B
> <chao.b.zhang@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [PATCH] SecurityPkg/OpalPassword: Remove dependency on
> EFI_BLOCK_IO_PROTOCOL
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=2327
>
> RAID drivers abstract their physical drives that make up
> the array into a single unit, and do not supply individual
> EFI_BLOCK_IO_PROTOCOL instances for each physical drive in the array.
> This breaks support for the Security Storage Command Protocol,
> which currently requires an EFI_BLOCK_IO_PROTOCOL to be associated
> with the same device the protocol is installed on and provide
> all the same parameters.
>
> This patch remove dependency on EFI_BLOCK_IO_PROTOCOL and
> allows access to Opal drive members of a RAID array.
>
> Signed-off-by: Maggie Chu <maggie.chu@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Chao Zhang <chao.b.zhang@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> ---
> SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 70 ++++++++++--------------
> --
> 1 file changed, 27 insertions(+), 43 deletions(-)
>
> diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> index 77905d2bf9..6bec54b932 100644
> --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> @@ -2667,7 +2667,6 @@ OpalEfiDriverBindingSupported(
> {
>
> EFI_STATUS Status;
>
> EFI_STORAGE_SECURITY_COMMAND_PROTOCOL* SecurityCommand;
>
> - EFI_BLOCK_IO_PROTOCOL* BlkIo;
>
>
>
> if (mOpalEndOfDxe) {
>
> return EFI_UNSUPPORTED;
>
> @@ -2703,33 +2702,6 @@ OpalEfiDriverBindingSupported(
> Controller
>
> );
>
>
>
> - //
>
> - // Test EFI_BLOCK_IO_PROTOCOL on controller Handle, required by
> EFI_STORAGE_SECURITY_COMMAND_PROTOCOL
>
> - // function APIs
>
> - //
>
> - Status = gBS->OpenProtocol(
>
> - Controller,
>
> - &gEfiBlockIoProtocolGuid,
>
> - (VOID **)&BlkIo,
>
> - This->DriverBindingHandle,
>
> - Controller,
>
> - EFI_OPEN_PROTOCOL_BY_DRIVER
>
> - );
>
> -
>
> - if (EFI_ERROR(Status)) {
>
> - DEBUG((DEBUG_INFO, "No EFI_BLOCK_IO_PROTOCOL on controller\n"));
>
> - return Status;
>
> - }
>
> -
>
> - //
>
> - // Close protocol and reopen in Start call
>
> - //
>
> - gBS->CloseProtocol(
>
> - Controller,
>
> - &gEfiBlockIoProtocolGuid,
>
> - This->DriverBindingHandle,
>
> - Controller
>
> - );
>
>
>
> return EFI_SUCCESS;
>
> }
>
> @@ -2827,30 +2799,42 @@ OpalEfiDriverBindingStart(
> );
>
> if (EFI_ERROR(Status)) {
>
> //
>
> - // Close storage security that was opened
>
> + // Block_IO not supported on handle
>
> //
>
> - gBS->CloseProtocol(
>
> - Controller,
>
> - &gEfiStorageSecurityCommandProtocolGuid,
>
> - This->DriverBindingHandle,
>
> - Controller
>
> - );
>
> + if(Status == EFI_UNSUPPORTED) {
>
> + BlkIo = NULL;
>
> + } else {
>
> + //
>
> + // Close storage security that was opened
>
> + //
>
> + gBS->CloseProtocol(
>
> + Controller,
>
> + &gEfiStorageSecurityCommandProtocolGuid,
>
> + This->DriverBindingHandle,
>
> + Controller
>
> + );
>
>
>
> - FreePool(Dev);
>
> - return Status;
>
> + FreePool(Dev);
>
> + return Status;
>
> + }
>
> }
>
>
>
> //
>
> // Save mediaId
>
> //
>
> - Dev->MediaId = BlkIo->Media->MediaId;
>
> + if(BlkIo == NULL) {
>
> + // If no Block IO present, use defined MediaId value.
>
> + Dev->MediaId = 0x0;
>
> + } else {
>
> + Dev->MediaId = BlkIo->Media->MediaId;
>
>
>
> - gBS->CloseProtocol(
>
> - Controller,
>
> - &gEfiBlockIoProtocolGuid,
>
> - This->DriverBindingHandle,
>
> - Controller
>
> + gBS->CloseProtocol(
>
> + Controller,
>
> + &gEfiBlockIoProtocolGuid,
>
> + This->DriverBindingHandle,
>
> + Controller
>
> );
>
> + }
>
>
>
> //
>
> // Acquire Ascii printable name of child, if not found, then ignore device
>
> --
> 2.16.2.windows.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [edk2-devel] [PATCH] SecurityPkg/OpalPassword: Remove dependency on EFI_BLOCK_IO_PROTOCOL
2019-11-04 4:08 ` Yao, Jiewen
@ 2019-11-05 3:43 ` Maggie Chu
0 siblings, 0 replies; 4+ messages in thread
From: Maggie Chu @ 2019-11-05 3:43 UTC (permalink / raw)
To: devel@edk2.groups.io, Yao, Jiewen; +Cc: Dong, Eric, Zhang, Chao B
Hi Jiewen,
This patch has been added to client bios as override since last year and validated on WHL/CFL/ICL and also CML.
It was asked by RST team because BLOCK IO protocol is unable to be provided on each physical device when RAID volume created.
Thanks,
Maggie
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Yao, Jiewen
Sent: Monday, November 4, 2019 12:08 PM
To: Chu, Maggie <maggie.chu@intel.com>; devel@edk2.groups.io
Cc: Dong, Eric <eric.dong@intel.com>; Zhang, Chao B <chao.b.zhang@intel.com>
Subject: Re: [edk2-devel] [PATCH] SecurityPkg/OpalPassword: Remove dependency on EFI_BLOCK_IO_PROTOCOL
Hello
May I know what test has been done for this patch?
> -----Original Message-----
> From: Chu, Maggie <maggie.chu@intel.com>
> Sent: Monday, November 4, 2019 12:04 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Zhang, Chao B
> <chao.b.zhang@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [PATCH] SecurityPkg/OpalPassword: Remove dependency on
> EFI_BLOCK_IO_PROTOCOL
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=2327
>
> RAID drivers abstract their physical drives that make up the array
> into a single unit, and do not supply individual EFI_BLOCK_IO_PROTOCOL
> instances for each physical drive in the array.
> This breaks support for the Security Storage Command Protocol, which
> currently requires an EFI_BLOCK_IO_PROTOCOL to be associated with the
> same device the protocol is installed on and provide all the same
> parameters.
>
> This patch remove dependency on EFI_BLOCK_IO_PROTOCOL and allows
> access to Opal drive members of a RAID array.
>
> Signed-off-by: Maggie Chu <maggie.chu@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Chao Zhang <chao.b.zhang@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> ---
> SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 70
> ++++++++++--------------
> --
> 1 file changed, 27 insertions(+), 43 deletions(-)
>
> diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> index 77905d2bf9..6bec54b932 100644
> --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> @@ -2667,7 +2667,6 @@ OpalEfiDriverBindingSupported( {
>
> EFI_STATUS Status;
>
> EFI_STORAGE_SECURITY_COMMAND_PROTOCOL* SecurityCommand;
>
> - EFI_BLOCK_IO_PROTOCOL* BlkIo;
>
>
>
> if (mOpalEndOfDxe) {
>
> return EFI_UNSUPPORTED;
>
> @@ -2703,33 +2702,6 @@ OpalEfiDriverBindingSupported(
> Controller
>
> );
>
>
>
> - //
>
> - // Test EFI_BLOCK_IO_PROTOCOL on controller Handle, required by
> EFI_STORAGE_SECURITY_COMMAND_PROTOCOL
>
> - // function APIs
>
> - //
>
> - Status = gBS->OpenProtocol(
>
> - Controller,
>
> - &gEfiBlockIoProtocolGuid,
>
> - (VOID **)&BlkIo,
>
> - This->DriverBindingHandle,
>
> - Controller,
>
> - EFI_OPEN_PROTOCOL_BY_DRIVER
>
> - );
>
> -
>
> - if (EFI_ERROR(Status)) {
>
> - DEBUG((DEBUG_INFO, "No EFI_BLOCK_IO_PROTOCOL on controller\n"));
>
> - return Status;
>
> - }
>
> -
>
> - //
>
> - // Close protocol and reopen in Start call
>
> - //
>
> - gBS->CloseProtocol(
>
> - Controller,
>
> - &gEfiBlockIoProtocolGuid,
>
> - This->DriverBindingHandle,
>
> - Controller
>
> - );
>
>
>
> return EFI_SUCCESS;
>
> }
>
> @@ -2827,30 +2799,42 @@ OpalEfiDriverBindingStart(
> );
>
> if (EFI_ERROR(Status)) {
>
> //
>
> - // Close storage security that was opened
>
> + // Block_IO not supported on handle
>
> //
>
> - gBS->CloseProtocol(
>
> - Controller,
>
> - &gEfiStorageSecurityCommandProtocolGuid,
>
> - This->DriverBindingHandle,
>
> - Controller
>
> - );
>
> + if(Status == EFI_UNSUPPORTED) {
>
> + BlkIo = NULL;
>
> + } else {
>
> + //
>
> + // Close storage security that was opened
>
> + //
>
> + gBS->CloseProtocol(
>
> + Controller,
>
> + &gEfiStorageSecurityCommandProtocolGuid,
>
> + This->DriverBindingHandle,
>
> + Controller
>
> + );
>
>
>
> - FreePool(Dev);
>
> - return Status;
>
> + FreePool(Dev);
>
> + return Status;
>
> + }
>
> }
>
>
>
> //
>
> // Save mediaId
>
> //
>
> - Dev->MediaId = BlkIo->Media->MediaId;
>
> + if(BlkIo == NULL) {
>
> + // If no Block IO present, use defined MediaId value.
>
> + Dev->MediaId = 0x0;
>
> + } else {
>
> + Dev->MediaId = BlkIo->Media->MediaId;
>
>
>
> - gBS->CloseProtocol(
>
> - Controller,
>
> - &gEfiBlockIoProtocolGuid,
>
> - This->DriverBindingHandle,
>
> - Controller
>
> + gBS->CloseProtocol(
>
> + Controller,
>
> + &gEfiBlockIoProtocolGuid,
>
> + This->DriverBindingHandle,
>
> + Controller
>
> );
>
> + }
>
>
>
> //
>
> // Acquire Ascii printable name of child, if not found, then ignore
> device
>
> --
> 2.16.2.windows.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] SecurityPkg/OpalPassword: Remove dependency on EFI_BLOCK_IO_PROTOCOL
2019-11-04 4:04 [PATCH] SecurityPkg/OpalPassword: Remove dependency on EFI_BLOCK_IO_PROTOCOL Maggie Chu
2019-11-04 4:08 ` Yao, Jiewen
@ 2019-11-06 0:03 ` Dong, Eric
1 sibling, 0 replies; 4+ messages in thread
From: Dong, Eric @ 2019-11-06 0:03 UTC (permalink / raw)
To: Chu, Maggie, devel@edk2.groups.io; +Cc: Zhang, Chao B, Yao, Jiewen
Reviewed-by: Eric Dong <eric.dong@intel.com>
-----Original Message-----
From: Chu, Maggie
Sent: Monday, November 4, 2019 12:04 PM
To: devel@edk2.groups.io
Cc: Dong, Eric <eric.dong@intel.com>; Zhang, Chao B <chao.b.zhang@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
Subject: [PATCH] SecurityPkg/OpalPassword: Remove dependency on EFI_BLOCK_IO_PROTOCOL
https://bugzilla.tianocore.org/show_bug.cgi?id=2327
RAID drivers abstract their physical drives that make up
the array into a single unit, and do not supply individual
EFI_BLOCK_IO_PROTOCOL instances for each physical drive in the array.
This breaks support for the Security Storage Command Protocol,
which currently requires an EFI_BLOCK_IO_PROTOCOL to be associated
with the same device the protocol is installed on and provide
all the same parameters.
This patch remove dependency on EFI_BLOCK_IO_PROTOCOL and
allows access to Opal drive members of a RAID array.
Signed-off-by: Maggie Chu <maggie.chu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
---
SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 70 ++++++++++----------------
1 file changed, 27 insertions(+), 43 deletions(-)
diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
index 77905d2bf9..6bec54b932 100644
--- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
+++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
@@ -2667,7 +2667,6 @@ OpalEfiDriverBindingSupported(
{
EFI_STATUS Status;
EFI_STORAGE_SECURITY_COMMAND_PROTOCOL* SecurityCommand;
- EFI_BLOCK_IO_PROTOCOL* BlkIo;
if (mOpalEndOfDxe) {
return EFI_UNSUPPORTED;
@@ -2703,33 +2702,6 @@ OpalEfiDriverBindingSupported(
Controller
);
- //
- // Test EFI_BLOCK_IO_PROTOCOL on controller Handle, required by EFI_STORAGE_SECURITY_COMMAND_PROTOCOL
- // function APIs
- //
- Status = gBS->OpenProtocol(
- Controller,
- &gEfiBlockIoProtocolGuid,
- (VOID **)&BlkIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR(Status)) {
- DEBUG((DEBUG_INFO, "No EFI_BLOCK_IO_PROTOCOL on controller\n"));
- return Status;
- }
-
- //
- // Close protocol and reopen in Start call
- //
- gBS->CloseProtocol(
- Controller,
- &gEfiBlockIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
return EFI_SUCCESS;
}
@@ -2827,30 +2799,42 @@ OpalEfiDriverBindingStart(
);
if (EFI_ERROR(Status)) {
//
- // Close storage security that was opened
+ // Block_IO not supported on handle
//
- gBS->CloseProtocol(
- Controller,
- &gEfiStorageSecurityCommandProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
+ if(Status == EFI_UNSUPPORTED) {
+ BlkIo = NULL;
+ } else {
+ //
+ // Close storage security that was opened
+ //
+ gBS->CloseProtocol(
+ Controller,
+ &gEfiStorageSecurityCommandProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
- FreePool(Dev);
- return Status;
+ FreePool(Dev);
+ return Status;
+ }
}
//
// Save mediaId
//
- Dev->MediaId = BlkIo->Media->MediaId;
+ if(BlkIo == NULL) {
+ // If no Block IO present, use defined MediaId value.
+ Dev->MediaId = 0x0;
+ } else {
+ Dev->MediaId = BlkIo->Media->MediaId;
- gBS->CloseProtocol(
- Controller,
- &gEfiBlockIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
+ gBS->CloseProtocol(
+ Controller,
+ &gEfiBlockIoProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
);
+ }
//
// Acquire Ascii printable name of child, if not found, then ignore device
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-11-06 0:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-04 4:04 [PATCH] SecurityPkg/OpalPassword: Remove dependency on EFI_BLOCK_IO_PROTOCOL Maggie Chu
2019-11-04 4:08 ` Yao, Jiewen
2019-11-05 3:43 ` [edk2-devel] " Maggie Chu
2019-11-06 0:03 ` Dong, Eric
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox