Re: [edk2] [PATCH v5 00/13] Split the S3 PEI phase HW init codes from Opal driver

2019-02-15 Thread Laszlo Ersek
On 02/15/19 07:23, Hao Wu wrote:
> The series is also available at:
> https://github.com/hwu25/edk2/tree/opal_remodel_v5
> 
> V5 changes:
> For patch 11, as suggested by Star:
> * Refine the UpdateLockBox() API description comment to be more precise;
> * Ensure the parameter for macro 'EFI_SIZE_TO_PAGES' is of type 'UINTN';
> 
> Since the changes are minor, I still keep the origin 'Reviewed-by' from
> Ray and the 'Acked-by' tag from Laszlo.
> 
> For patch 12, sync the UpdateLockBox() API description comment with the
> change made in patch 11.
> 
> Since the changes are minor, I still keep the origin 'Reviewed-by' from
> Laszlo an Ray.

OK with me, thanks.
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v5 00/13] Split the S3 PEI phase HW init codes from Opal driver

2019-02-14 Thread Hao Wu
The series is also available at:
https://github.com/hwu25/edk2/tree/opal_remodel_v5

V5 changes:
For patch 11, as suggested by Star:
* Refine the UpdateLockBox() API description comment to be more precise;
* Ensure the parameter for macro 'EFI_SIZE_TO_PAGES' is of type 'UINTN';

Since the changes are minor, I still keep the origin 'Reviewed-by' from
Ray and the 'Acked-by' tag from Laszlo.

For patch 12, sync the UpdateLockBox() API description comment with the
change made in patch 11.

Since the changes are minor, I still keep the origin 'Reviewed-by' from
Laszlo an Ray.

For patch 13, additional handling logic to prevent NULL pointer
de-reference, just as what has been done in commit
d72d8561fbe03a64e01c2ad57a93777de4b9ae2f.


V4 history:

As suggested by Laszlo, add a new patch to sync the API description
comment for UpdateLockBox() in file
"OvmfPkg/Library/LockBoxLib/LockBoxLib.c" with its counterparts in
MdeModulePkg.

For patch 13 (compared with patch 12 in V3), minor type refinement in
structure definition 'OPAL_DEVICE_LOCKBOX_DATA'.

V3 history:

For patch 2, reuse the definitions within AtaPassThru protocol header file
to reduce code duplication.

For patch 4, add detailed comments to illustrate the content that will be
stored in the newly introduced LockBox.

For patch 6, device path validity check refinement within function
NvmeCheckHcDevicePath().

For patch 7:
* Remove a redundant check within function NvmeS3SkipThisController();
* Replace internal implementation of GetNextDevicePathInstance() with
  GetDevicePathInstanceSize(), which avoids unnecessary memory allocation.

For patch 8:
* Device path validity check refinement within function
  AhciCheckHcDevicePath();
* Remove a redundant check within function AhciS3GetEumeratePorts();
* Replace internal implementation of GetNextDevicePathInstance() with
  GetDevicePathInstanceSize(), which avoids unnecessary memory allocation.

For patch 11:
* Remove the ASSERT() for memory allocation failure. Since error handling
  codes already exist, no new code is added for this;
* Refine the codes to only allocate new SMM buffer when the required
  LockBox size is greater than the size of origin pages allocated;
* Add additional parameter check for 'Offset' & 'Length' to prevent
  potential numeric overflow.


V2 history:

For patch 8, the new series removes the codes to produce the Block IO PPIs
from the AhciPei driver.

The task to produce the Block IO services is out of the scope of BZ-1409
(actually covered by BZ-1483). And we will later propose seperate patch(s)
to address this.

V1 history:

For the below 2 types of storage device:

1. NVM Express devices;
2. ATA hard disk devices working under AHCI mode.

the OpalPassword driver supports auto-unlocking those devices during S3
resume.

Current implementation of the OpalPassword driver is handling the device
initialization (using boot script to restore the host controller PCI
configuration space also counts) in the PEI phase during S3 resume by
itself.

Meanwhile, the NvmExpressPei driver in MdeModulePkg also handles the NVME
device initialization during the PEI phase in order to produce the Block
IO PPI.

Moreover, there is a Bugzilla request (BZ-1483) for adding the Block IO
PPI support for ATA device as well. So there is likely to be an PEI driver
for ATA device that will handle the ATA device initialization.

In order to remove code duplication, the series will split the S3 phase
device initialization related codes out from the OpalPassword driver. And
let the existing NvmExpressPei driver and the new AhciPei driver to handle
the task.

After this remodel, NvmExpressPei and AhciPei drivers will produce a PPI
called Storage Security Command PPI. And the OpalPassword driver will
consume this PPI to perform the device auto-unlock in S3 resume.


Patch   1~4: Add the definitions of PPIs and GUIDs;
Patch 5: Refinement for the NvmExpressPei driver;
Patch   6~7: Update the NvmExpressPei driver to produce the PPI needed by
 OpalPassword;
Patch 8: Add the Ahci mode ATA device support in the PEI phase, it
 will produce the PPI needed by OpalPassword;
Patch  9~10: Refinements for the SmmLockBoxLib;
Patch11: Support LockBox enlarge for LockBoxLib API UpdateLockBox();
Patch12: Remove the hardware initialization codes from the
 OpalPassword driver. And consume the SSC PPI to unlock device
 in S3 resume.

Cc: Jian J Wang 
Cc: Ray Ni 
Cc: Eric Dong 
Cc: Star Zeng 
Cc: Chao Zhang 
Cc: Jiewen Yao 
Cc: Laszlo Ersek 

Hao Wu (12):
  MdeModulePkg: Add definitions for ATA AHCI host controller PPI
  MdeModulePkg: Add definitions for EDKII PEI ATA PassThru PPI
  MdeModulePkg: Add definitions for Storage Security Command PPI
  MdeModulePkg: Add GUID for LockBox to save storage dev to init in S3
  MdeModulePkg/NvmExpressPei: Avoid updating the module-level variable
  MdeModulePkg/NvmExpressPei: Add logic to produce SSC PPI
  MdeModulePkg/NvmExpressPei: