public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Dong, Eric" <eric.dong@intel.com>
To: "Chen, Chen A" <chen.a.chen@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Zhang, Chao B" <chao.b.zhang@intel.com>
Subject: Re: [PATCH] SecurityPkg: Remove dead code and inf redundant definitions.
Date: Thu, 29 Nov 2018 01:19:57 +0000	[thread overview]
Message-ID: <ED077930C258884BBCB450DB737E662259D51953@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20181128062640.17320-1-chen.a.chen@intel.com>

Reviewed-by: Eric Dong <eric.dong@intel.com>  for Opal part.

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Chen A Chen
> Sent: Wednesday, November 28, 2018 2:27 PM
> To: edk2-devel@lists.01.org
> Cc: Zhang, Chao B <chao.b.zhang@intel.com>
> Subject: [edk2] [PATCH] SecurityPkg: Remove dead code and inf redundant
> definitions.
> 
> Fix BZ1065, https://bugzilla.tianocore.org/show_bug.cgi?id=1065
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
> Cc: Zhang Chao B <chao.b.zhang@intel.com>
> ---
>  SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.inf  |   1 -
>  SecurityPkg/Tcg/Opal/OpalPassword/OpalAhciMode.c   |  52 ----
>  SecurityPkg/Tcg/Opal/OpalPassword/OpalAhciMode.h   |  23 --
>  SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.h        |  11 -
>  .../Tcg/Opal/OpalPassword/OpalHiiCallbacks.c       |  87 ------
>  SecurityPkg/Tcg/Opal/OpalPassword/OpalNvmeMode.c   | 321 ----------------
> -----
>  SecurityPkg/Tcg/Opal/OpalPassword/OpalNvmeMode.h   | 128 --------
>  .../Tcg/Opal/OpalPassword/OpalPasswordDxe.inf      |   2 -
>  .../Tcg/Opal/OpalPassword/OpalPasswordPei.inf      |   1 -
>  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf       |   1 -
>  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf                |   1 -
>  SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf                |   1 -
>  SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDxe.inf      |   1 -
>  .../SecureBootConfigDxe/SecureBootConfigDxe.inf    |   2 -
>  14 files changed, 632 deletions(-)
> 
> diff --git a/SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.inf
> b/SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.inf
> index 6f9a77b868..a17fa4046d 100644
> --- a/SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.inf
> +++ b/SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.inf
> @@ -43,7 +43,6 @@
>    UefiDriverEntryPoint
>    UefiBootServicesTableLib
>    UefiRuntimeServicesTableLib
> -  ReportStatusCodeLib
>    DebugLib
>    UefiLib
>    MemoryAllocationLib
> diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalAhciMode.c
> b/SecurityPkg/Tcg/Opal/OpalPassword/OpalAhciMode.c
> index d51865380f..0c4edd5346 100644
> --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalAhciMode.c
> +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalAhciMode.c
> @@ -969,58 +969,6 @@ AhciReset (
> 
>  }
> 
> -/**
> -  Send Buffer cmd to specific device.
> -
> -  @param[in]  AhciContext         The pointer to the AHCI_CONTEXT.
> -  @param[in]  Port                The port number of attached ATA device.
> -  @param[in]  PortMultiplier      The port number of port multiplier of
> attached ATA device.
> -  @param[in, out]  Buffer         The Data Buffer to store IDENTIFY PACKET Data.
> -
> -  @retval EFI_DEVICE_ERROR    The cmd abort with error occurs.
> -  @retval EFI_TIMEOUT         The operation is time out.
> -  @retval EFI_UNSUPPORTED     The device is not ready for executing.
> -  @retval EFI_SUCCESS         The cmd executes successfully.
> -
> -**/
> -EFI_STATUS
> -EFIAPI
> -AhciIdentify (
> -  IN AHCI_CONTEXT             *AhciContext,
> -  IN UINT8                    Port,
> -  IN UINT8                    PortMultiplier,
> -  IN OUT ATA_IDENTIFY_DATA    *Buffer
> -  )
> -{
> -  EFI_STATUS                   Status;
> -  EFI_ATA_COMMAND_BLOCK        AtaCommandBlock;
> -
> -  if (AhciContext == NULL || Buffer == NULL) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  ZeroMem (&AtaCommandBlock, sizeof (EFI_ATA_COMMAND_BLOCK));
> -
> -  AtaCommandBlock.AtaCommand     = ATA_CMD_IDENTIFY_DRIVE;
> -  AtaCommandBlock.AtaSectorCount = 1;
> -
> -  Status = AhciPioTransfer (
> -             AhciContext,
> -             Port,
> -             PortMultiplier,
> -             NULL,
> -             0,
> -             TRUE,
> -             &AtaCommandBlock,
> -             NULL,
> -             Buffer,
> -             sizeof (ATA_IDENTIFY_DATA),
> -             ATA_TIMEOUT
> -             );
> -
> -  return Status;
> -}
> -
>  /**
>    Allocate transfer-related data struct which is used at AHCI mode.
> 
> diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalAhciMode.h
> b/SecurityPkg/Tcg/Opal/OpalPassword/OpalAhciMode.h
> index 037f81ac24..2076b0411b 100644
> --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalAhciMode.h
> +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalAhciMode.h
> @@ -293,29 +293,6 @@ typedef struct {
>    UINT32                    AhciBar;
>  } AHCI_CONTEXT;
> 
> -/**
> -  Send Buffer cmd to specific device.
> -
> -  @param  AhciContext         The pointer to the AHCI_CONTEXT.
> -  @param  Port                The number of port.
> -  @param  PortMultiplier      The timeout Value of stop.
> -  @param  Buffer              The Data Buffer to store IDENTIFY PACKET Data.
> -
> -  @retval EFI_DEVICE_ERROR    The cmd abort with error occurs.
> -  @retval EFI_TIMEOUT         The operation is time out.
> -  @retval EFI_UNSUPPORTED     The device is not ready for executing.
> -  @retval EFI_SUCCESS         The cmd executes successfully.
> -
> -**/
> -EFI_STATUS
> -EFIAPI
> -AhciIdentify (
> -  IN AHCI_CONTEXT             *AhciContext,
> -  IN UINT8                    Port,
> -  IN UINT8                    PortMultiplier,
> -  IN OUT ATA_IDENTIFY_DATA    *Buffer
> -  );
> -
>  /**
>    Allocate transfer-related data struct which is used at AHCI mode.
> 
> diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.h
> b/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.h
> index a4bb19ad60..8b368fe995 100644
> --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.h
> +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.h
> @@ -285,17 +285,6 @@ OpalHiiAddPackages(
>    VOID
>    );
> 
> -/**
> -  Check whether enable feature or not.
> -
> -  @retval  Return the disk number.
> -
> -**/
> -UINT8
> -HiiGetNumConfigRequiredOpalDisksCB(
> -  VOID
> -  );
> -
>  /**
>    Returns the driver name.
> 
> diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHiiCallbacks.c
> b/SecurityPkg/Tcg/Opal/OpalPassword/OpalHiiCallbacks.c
> index b07e38c144..31e1aa2240 100644
> --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHiiCallbacks.c
> +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalHiiCallbacks.c
> @@ -15,56 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY
> KIND, EITHER EXPRESS OR IMPLIED.
> 
>  #include "OpalHii.h"
> 
> -/**
> -  Get Opal var name.
> -  The return Value must be freed by caller if not NULL
> -
> -  @param      OpalDisk       The disk.
> -  @param      Prefix         The prefix string.
> -
> -  @retval  The var name string.
> -
> -**/
> -CHAR16*
> -OpalDriverGetOpalVarName(
> -  OPAL_DISK        *OpalDisk,
> -  const CHAR16     *Prefix
> -  )
> -{
> -  OPAL_DRIVER_DEVICE*          Dev;
> -  UINTN                        PrefixLen;
> -  UINTN                        NameLen;
> -  UINTN                        VarNameLen;
> -  CHAR16*                      VarName;
> -
> -  Dev = DRIVER_DEVICE_FROM_OPALDISK(OpalDisk);
> -  if (Dev == NULL) {
> -    return NULL;
> -  }
> -
> -  PrefixLen = StrLen(Prefix);
> -
> -  NameLen = 0;
> -  if (Dev->Name16 != NULL) {
> -    NameLen = StrLen(Dev->Name16);
> -  }
> -
> -  VarNameLen = PrefixLen + NameLen;
> -
> -  VarName = (CHAR16*)AllocateZeroPool((VarNameLen + 1) *
> sizeof(CHAR16));
> -  if (VarName == NULL) {
> -    return NULL;
> -  }
> -
> -  CopyMem(VarName, Prefix, PrefixLen * sizeof(CHAR16));
> -  if (Dev->Name16 != NULL) {
> -    CopyMem(VarName + PrefixLen, Dev->Name16, NameLen *
> sizeof(CHAR16));
> -  }
> -  VarName[VarNameLen] = 0;
> -
> -  return VarName;
> -}
> -
>  /**
>    Get the driver image handle.
> 
> @@ -79,43 +29,6 @@ HiiGetDriverImageHandleCB(
>    return gImageHandle;
>  }
> 
> -/**
> -  Check whether enable feature or not.
> -
> -  @retval  Return the disk number.
> -
> -**/
> -UINT8
> -HiiGetNumConfigRequiredOpalDisksCB(
> -  VOID
> -  )
> -{
> -  UINT8                        NumDisks;
> -  UINT8                        NumLockedOpalDisks;
> -  OPAL_DISK                    *OpalDisk;
> -  UINT8                        Index;
> -
> -  NumLockedOpalDisks = 0;
> -
> -  NumDisks = GetDeviceCount();
> -
> -  for (Index = 0; Index < NumDisks; Index++) {
> -    OpalDisk = HiiGetOpalDiskCB(Index);
> -
> -    if (OpalDisk != NULL) {
> -      if (!OpalFeatureEnabled (&OpalDisk->SupportedAttributes, &OpalDisk-
> >LockingFeature)) {
> -        DEBUG ((DEBUG_INFO, "Ignoring disk %u because feature is disabled or
> health has already been inspected\n", Index));
> -      } else if (OpalDeviceLocked (&OpalDisk->SupportedAttributes,
> &OpalDisk->LockingFeature)) {
> -        NumLockedOpalDisks++;
> -      }
> -    }
> -  }
> -
> -  return NumLockedOpalDisks;
> -}
> -
> -
> -
>  /**
>    Returns the opaque pointer to a physical disk context.
> 
> diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalNvmeMode.c
> b/SecurityPkg/Tcg/Opal/OpalPassword/OpalNvmeMode.c
> index 7657bb26e2..01c316d597 100644
> --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalNvmeMode.c
> +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalNvmeMode.c
> @@ -793,46 +793,6 @@ NvmeCreatePrpList (
>    return PrpListPhyAddr;
>  }
> 
> -/**
> -  Check whether there are available command slots.
> -
> -  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data
> structure.
> -  @param[in] Qid                    - Queue index
> -
> -  @retval EFI_SUCCESS               - Available command slot is found
> -  @retval EFI_NOT_READY             - No available command slot is found
> -  @retval EFI_DEVICE_ERROR          - Error occurred on device side.
> -
> -**/
> -EFI_STATUS
> -NvmeHasFreeCmdSlot (
> -  IN NVME_CONTEXT       *Nvme,
> -  IN UINT8              Qid
> -  )
> -{
> -  return TRUE;
> -}
> -
> -/**
> -  Check whether all command slots are clean.
> -
> -  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data
> structure.
> -  @param[in] Qid                    - Queue index
> -
> -  @retval EFI_SUCCESS               - All command slots are clean
> -  @retval EFI_NOT_READY             - Not all command slots are clean
> -  @retval EFI_DEVICE_ERROR          - Error occurred on device side.
> -
> -**/
> -EFI_STATUS
> -NvmeIsAllCmdSlotClean (
> -  IN NVME_CONTEXT       *Nvme,
> -  IN UINT8              Qid
> -  )
> -{
> -  return EFI_SUCCESS;
> -}
> -
>  /**
>    Waits until all NVME commands completed.
> 
> @@ -1861,284 +1821,3 @@ NvmeControllerExit (
>    Nvme->State = NvmeStatusUnknown;
>    return Status;
>  }
> -
> -/**
> -  Read sector Data from the NVMe device.
> -
> -  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data
> structure.
> -  @param[in,out] Buffer             - The Buffer used to store the Data read from
> the device.
> -  @param[in] Lba                    - The start block number.
> -  @param[in] Blocks                 - Total block number to be read.
> -
> -  @retval EFI_SUCCESS               - Datum are read from the device.
> -  @retval Others                    - Fail to read all the datum.
> -
> -**/
> -EFI_STATUS
> -NvmeReadSectors (
> -  IN NVME_CONTEXT                          *Nvme,
> -  IN OUT UINT64                            Buffer,
> -  IN UINT64                                Lba,
> -  IN UINT32                                Blocks
> -  )
> -{
> -  UINT32                                   Bytes;
> -  NVM_EXPRESS_PASS_THRU_COMMAND_PACKET     CommandPacket;
> -  NVM_EXPRESS_COMMAND                      Command;
> -  NVM_EXPRESS_RESPONSE                     Response;
> -  EFI_STATUS                               Status;
> -  UINT32                                   BlockSize;
> -
> -  BlockSize  = Nvme->BlockSize;
> -  Bytes      = Blocks * BlockSize;
> -
> -  ZeroMem (&CommandPacket,
> sizeof(NVM_EXPRESS_PASS_THRU_COMMAND_PACKET));
> -  ZeroMem (&Command, sizeof(NVM_EXPRESS_COMMAND));
> -  ZeroMem (&Response, sizeof(NVM_EXPRESS_RESPONSE));
> -
> -  CommandPacket.NvmeCmd      = &Command;
> -  CommandPacket.NvmeResponse = &Response;
> -
> -  CommandPacket.NvmeCmd->Cdw0.Opcode = NVME_IO_READ_OPC;
> -  CommandPacket.NvmeCmd->Cdw0.Cid    = Nvme-
> >Cid[NVME_IO_QUEUE]++;
> -  CommandPacket.NvmeCmd->Nsid        = Nvme->Nsid;
> -  CommandPacket.TransferBuffer       = Buffer;
> -
> -  CommandPacket.TransferLength = Bytes;
> -  CommandPacket.CommandTimeout = NVME_GENERIC_TIMEOUT;
> -  CommandPacket.QueueId        = NVME_IO_QUEUE;
> -
> -  CommandPacket.NvmeCmd->Cdw10 = (UINT32)Lba;
> -  CommandPacket.NvmeCmd->Cdw11 = (UINT32)(RShiftU64 (Lba, 32));
> -  CommandPacket.NvmeCmd->Cdw12 = (Blocks - 1) & 0xFFFF;
> -
> -  CommandPacket.NvmeCmd->Flags = CDW10_VALID | CDW11_VALID |
> CDW12_VALID;
> -
> -  Status = NvmePassThru (
> -              Nvme,
> -              Nvme->Nsid,
> -              0,
> -              &CommandPacket
> -              );
> -
> -  return Status;
> -}
> -
> -/**
> -  Write sector Data to the NVMe device.
> -
> -  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data
> structure.
> -  @param[in] Buffer                 - The Buffer to be written into the device.
> -  @param[in] Lba                    - The start block number.
> -  @param[in] Blocks                 - Total block number to be written.
> -
> -  @retval EFI_SUCCESS               - Datum are written into the Buffer.
> -  @retval Others                    - Fail to write all the datum.
> -
> -**/
> -EFI_STATUS
> -NvmeWriteSectors (
> -  IN NVME_CONTEXT                          *Nvme,
> -  IN UINT64                                Buffer,
> -  IN UINT64                                Lba,
> -  IN UINT32                                Blocks
> -  )
> -{
> -  NVM_EXPRESS_PASS_THRU_COMMAND_PACKET     CommandPacket;
> -  NVM_EXPRESS_COMMAND                      Command;
> -  NVM_EXPRESS_RESPONSE                     Response;
> -  EFI_STATUS                               Status;
> -  UINT32                                   Bytes;
> -  UINT32                                   BlockSize;
> -
> -  BlockSize  = Nvme->BlockSize;
> -  Bytes      = Blocks * BlockSize;
> -
> -  ZeroMem (&CommandPacket,
> sizeof(NVM_EXPRESS_PASS_THRU_COMMAND_PACKET));
> -  ZeroMem (&Command, sizeof(NVM_EXPRESS_COMMAND));
> -  ZeroMem (&Response, sizeof(NVM_EXPRESS_RESPONSE));
> -
> -  CommandPacket.NvmeCmd      = &Command;
> -  CommandPacket.NvmeResponse = &Response;
> -
> -  CommandPacket.NvmeCmd->Cdw0.Opcode = NVME_IO_WRITE_OPC;
> -  CommandPacket.NvmeCmd->Cdw0.Cid    = Nvme-
> >Cid[NVME_IO_QUEUE]++;
> -  CommandPacket.NvmeCmd->Nsid  = Nvme->Nsid;
> -  CommandPacket.TransferBuffer = Buffer;
> -
> -  CommandPacket.TransferLength = Bytes;
> -  CommandPacket.CommandTimeout = NVME_GENERIC_TIMEOUT;
> -  CommandPacket.QueueId        = NVME_IO_QUEUE;
> -
> -  CommandPacket.NvmeCmd->Cdw10 = (UINT32)Lba;
> -  CommandPacket.NvmeCmd->Cdw11 = (UINT32)(RShiftU64 (Lba, 32));
> -  CommandPacket.NvmeCmd->Cdw12 = (Blocks - 1) & 0xFFFF;
> -
> -  CommandPacket.MetadataBuffer = (UINT64)(UINTN)NULL;
> -  CommandPacket.MetadataLength = 0;
> -
> -  CommandPacket.NvmeCmd->Flags = CDW10_VALID | CDW11_VALID |
> CDW12_VALID;
> -
> -  Status = NvmePassThru (
> -              Nvme,
> -              Nvme->Nsid,
> -              0,
> -              &CommandPacket
> -              );
> -
> -  return Status;
> -}
> -
> -/**
> -  Flushes all modified Data to the device.
> -
> -  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data
> structure.
> -
> -  @retval EFI_SUCCESS               - Datum are written into the Buffer.
> -  @retval Others                    - Fail to write all the datum.
> -
> -**/
> -EFI_STATUS
> -NvmeFlush (
> -  IN NVME_CONTEXT                          *Nvme
> -  )
> -{
> -  NVM_EXPRESS_PASS_THRU_COMMAND_PACKET     CommandPacket;
> -  NVM_EXPRESS_COMMAND                      Command;
> -  NVM_EXPRESS_RESPONSE                     Response;
> -  EFI_STATUS                               Status;
> -
> -  ZeroMem (&CommandPacket,
> sizeof(NVM_EXPRESS_PASS_THRU_COMMAND_PACKET));
> -  ZeroMem (&Command, sizeof(NVM_EXPRESS_COMMAND));
> -  ZeroMem (&Response, sizeof(NVM_EXPRESS_RESPONSE));
> -
> -  CommandPacket.NvmeCmd      = &Command;
> -  CommandPacket.NvmeResponse = &Response;
> -
> -  CommandPacket.NvmeCmd->Cdw0.Opcode = NVME_IO_FLUSH_OPC;
> -  CommandPacket.NvmeCmd->Cdw0.Cid    = Nvme-
> >Cid[NVME_IO_QUEUE]++;
> -  CommandPacket.NvmeCmd->Nsid  = Nvme->Nsid;
> -  CommandPacket.CommandTimeout = NVME_GENERIC_TIMEOUT;
> -  CommandPacket.QueueId        = NVME_IO_QUEUE;
> -
> -  Status = NvmePassThru (
> -              Nvme,
> -              Nvme->Nsid,
> -              0,
> -              &CommandPacket
> -              );
> -  if (!EFI_ERROR (Status)) {
> -    Status = NvmeWaitAllComplete (Nvme, CommandPacket.QueueId);
> -  }
> -
> -  return Status;
> -}
> -
> -/**
> -  Read some blocks from the device.
> -
> -  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data
> structure.
> -  @param[out] Buffer                - The Buffer used to store the Data read from
> the device.
> -  @param[in] Lba                    - The start block number.
> -  @param[in] Blocks                 - Total block number to be read.
> -
> -  @retval EFI_SUCCESS               - Datum are read from the device.
> -  @retval Others                    - Fail to read all the datum.
> -
> -**/
> -EFI_STATUS
> -NvmeRead (
> -  IN NVME_CONTEXT                  *Nvme,
> -  OUT UINT64                       Buffer,
> -  IN UINT64                        Lba,
> -  IN UINTN                         Blocks
> -  )
> -{
> -  EFI_STATUS                       Status;
> -  UINT32                           BlockSize;
> -  UINT32                           MaxTransferBlocks;
> -
> -  ASSERT (Blocks <= NVME_MAX_SECTORS);
> -  Status        = EFI_SUCCESS;
> -  BlockSize     = Nvme->BlockSize;
> -  if (Nvme->ControllerData->Mdts != 0) {
> -    MaxTransferBlocks = (1 << (Nvme->ControllerData->Mdts)) * (1 <<
> (Nvme->Cap.Mpsmin + 12)) / BlockSize;
> -  } else {
> -    MaxTransferBlocks = 1024;
> -  }
> -
> -  while (Blocks > 0) {
> -    if (Blocks > MaxTransferBlocks) {
> -      Status = NvmeReadSectors (Nvme, Buffer, Lba, MaxTransferBlocks);
> -
> -      Blocks -= MaxTransferBlocks;
> -      Buffer += (MaxTransferBlocks * BlockSize);
> -      Lba    += MaxTransferBlocks;
> -    } else {
> -      Status = NvmeReadSectors (Nvme, Buffer, Lba, (UINT32) Blocks);
> -      Blocks = 0;
> -    }
> -
> -    if (EFI_ERROR(Status)) {
> -      DEBUG ((DEBUG_ERROR, "NvmeRead fail, Status = %r\n", Status));
> -      break;
> -    }
> -  }
> -
> -  return Status;
> -}
> -
> -/**
> -  Write some blocks to the device.
> -
> -  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data
> structure.
> -  @param[in] Buffer                 - The Buffer to be written into the device.
> -  @param[in] Lba                    - The start block number.
> -  @param[in] Blocks                 - Total block number to be written.
> -
> -  @retval EFI_SUCCESS               - Datum are written into the Buffer.
> -  @retval Others                    - Fail to write all the datum.
> -
> -**/
> -EFI_STATUS
> -NvmeWrite (
> -  IN NVME_CONTEXT                  *Nvme,
> -  IN UINT64                        Buffer,
> -  IN UINT64                        Lba,
> -  IN UINTN                         Blocks
> -  )
> -{
> -  EFI_STATUS                       Status;
> -  UINT32                           BlockSize;
> -  UINT32                           MaxTransferBlocks;
> -
> -  ASSERT (Blocks <= NVME_MAX_SECTORS);
> -  Status        = EFI_SUCCESS;
> -  BlockSize     = Nvme->BlockSize;
> -
> -  if (Nvme->ControllerData->Mdts != 0) {
> -    MaxTransferBlocks = (1 << (Nvme->ControllerData->Mdts)) * (1 <<
> (Nvme->Cap.Mpsmin + 12)) / BlockSize;
> -  } else {
> -    MaxTransferBlocks = 1024;
> -  }
> -
> -  while (Blocks > 0) {
> -    if (Blocks > MaxTransferBlocks) {
> -      Status = NvmeWriteSectors (Nvme, Buffer, Lba, MaxTransferBlocks);
> -
> -      Blocks -= MaxTransferBlocks;
> -      Buffer += (MaxTransferBlocks * BlockSize);
> -      Lba    += MaxTransferBlocks;
> -    } else {
> -      Status = NvmeWriteSectors (Nvme, Buffer, Lba, (UINT32) Blocks);
> -      Blocks = 0;
> -    }
> -
> -    if (EFI_ERROR(Status)) {
> -      DEBUG ((DEBUG_ERROR, "NvmeWrite fail, Status = %r\n", Status));
> -      break;
> -    }
> -  }
> -
> -  return Status;
> -}
> diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalNvmeMode.h
> b/SecurityPkg/Tcg/Opal/OpalPassword/OpalNvmeMode.h
> index 3fef3dbc1c..bd2bd5239d 100644
> --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalNvmeMode.h
> +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalNvmeMode.h
> @@ -300,134 +300,6 @@ NvmeControllerExit (
>    IN NVME_CONTEXT       *Nvme
>    );
> 
> -/**
> -  Check whether there are available command slots.
> -
> -  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data
> structure.
> -  @param[in] Qid                    - Queue index
> -
> -  @retval EFI_SUCCESS               - Available command slot is found
> -  @retval EFI_NOT_READY             - No available command slot is found
> -  @retval EFI_DEVICE_ERROR          - Error occurred on device side.
> -
> -**/
> -EFI_STATUS
> -NvmeHasFreeCmdSlot (
> -  IN NVME_CONTEXT       *Nvme,
> -  IN UINT8              Qid
> -  );
> -
> -/**
> -  Check whether all command slots are clean.
> -
> -  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data
> structure.
> -  @param[in] Qid                    - Queue index
> -
> -  @retval EFI_SUCCESS               - All command slots are clean
> -  @retval EFI_NOT_READY             - Not all command slots are clean
> -  @retval EFI_DEVICE_ERROR          - Error occurred on device side.
> -
> -**/
> -EFI_STATUS
> -NvmeIsAllCmdSlotClean (
> -  IN NVME_CONTEXT       *Nvme,
> -  IN UINT8              Qid
> -  );
> -
> -/**
> -  Read sector Data from the NVMe device.
> -
> -  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data
> structure.
> -  @param[in,out] Buffer             - The Buffer used to store the Data read from
> the device.
> -  @param[in] Lba                    - The start block number.
> -  @param[in] Blocks                 - Total block number to be read.
> -
> -  @retval EFI_SUCCESS               - Datum are read from the device.
> -  @retval Others                    - Fail to read all the datum.
> -
> -**/
> -EFI_STATUS
> -NvmeReadSectors (
> -  IN NVME_CONTEXT                          *Nvme,
> -  IN OUT UINT64                            Buffer,
> -  IN UINT64                                Lba,
> -  IN UINT32                                Blocks
> -  );
> -
> -/**
> -  Write sector Data to the NVMe device.
> -
> -  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data
> structure.
> -  @param[in] Buffer                 - The Buffer to be written into the device.
> -  @param[in] Lba                    - The start block number.
> -  @param[in] Blocks                 - Total block number to be written.
> -
> -  @retval EFI_SUCCESS               - Datum are written into the Buffer.
> -  @retval Others                    - Fail to write all the datum.
> -
> -**/
> -EFI_STATUS
> -NvmeWriteSectors (
> -  IN NVME_CONTEXT                          *Nvme,
> -  IN UINT64                                Buffer,
> -  IN UINT64                                Lba,
> -  IN UINT32                                Blocks
> -  );
> -
> -/**
> -  Flushes all modified Data to the device.
> -
> -  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data
> structure.
> -
> -  @retval EFI_SUCCESS               - Datum are written into the Buffer.
> -  @retval Others                    - Fail to write all the datum.
> -
> -**/
> -EFI_STATUS
> -NvmeFlush (
> -  IN NVME_CONTEXT                          *Nvme
> -  );
> -
> -/**
> -  Read some blocks from the device.
> -
> -  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data
> structure.
> -  @param[out] Buffer                - The Buffer used to store the Data read from
> the device.
> -  @param[in] Lba                    - The start block number.
> -  @param[in] Blocks                 - Total block number to be read.
> -
> -  @retval EFI_SUCCESS               - Datum are read from the device.
> -  @retval Others                    - Fail to read all the datum.
> -
> -**/
> -EFI_STATUS
> -NvmeRead (
> -  IN NVME_CONTEXT                  *Nvme,
> -  OUT UINT64                       Buffer,
> -  IN UINT64                        Lba,
> -  IN UINTN                         Blocks
> -  );
> -
> -/**
> -  Write some blocks to the device.
> -
> -  @param[in] Nvme                   - The pointer to the NVME_CONTEXT Data
> structure.
> -  @param[in] Buffer                 - The Buffer to be written into the device.
> -  @param[in] Lba                    - The start block number.
> -  @param[in] Blocks                 - Total block number to be written.
> -
> -  @retval EFI_SUCCESS               - Datum are written into the Buffer.
> -  @retval Others                    - Fail to write all the datum.
> -
> -**/
> -EFI_STATUS
> -NvmeWrite (
> -  IN NVME_CONTEXT                  *Nvme,
> -  IN UINT64                        Buffer,
> -  IN UINT64                        Lba,
> -  IN UINTN                         Blocks
> -  );
> -
>  /**
>    Security send and receive commands.
> 
> diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordDxe.inf
> b/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordDxe.inf
> index 0a82f30959..cfa55dded7 100644
> --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordDxe.inf
> +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordDxe.inf
> @@ -71,8 +71,6 @@
>    gEfiComponentNameProtocolGuid                 ## PRODUCES
>    gEfiComponentName2ProtocolGuid                ## PRODUCES
>    gEfiBlockIoProtocolGuid                       ## CONSUMES
> -  gEfiPciIoProtocolGuid                         ## CONSUMES
> -  gEfiDevicePathToTextProtocolGuid              ## CONSUMES
> 
>  [Guids]
>    gEfiEndOfDxeEventGroupGuid                    ## CONSUMES             ## Event
> diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordPei.inf
> b/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordPei.inf
> index 81c57c36d2..482b7c25af 100644
> --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordPei.inf
> +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordPei.inf
> @@ -50,7 +50,6 @@
>    BaseMemoryLib
>    MemoryAllocationLib
>    TimerLib
> -  HobLib
>    LockBoxLib
>    TcgStorageOpalLib
>    Tcg2PhysicalPresenceLib
> diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
> b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
> index 581669a277..4477c6fcad 100644
> --- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
> +++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
> @@ -43,7 +43,6 @@
>  [LibraryClasses]
>    BaseLib
>    BaseMemoryLib
> -  MemoryAllocationLib
>    PeiServicesLib
>    PeimEntryPoint
>    DebugLib
> diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> index 12b7448ade..87f0492750 100644
> --- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> +++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> @@ -92,7 +92,6 @@
>  [Protocols]
>    gEfiTcg2ProtocolGuid                               ## PRODUCES
>    gEfiTcg2FinalEventsTableGuid                       ## PRODUCES
> -  gEfiAcpiTableProtocolGuid                          ## NOTIFY
>    gEfiMpServiceProtocolGuid                          ## SOMETIMES_CONSUMES
>    gEfiVariableWriteArchProtocolGuid                  ## NOTIFY
>    gEfiResetNotificationProtocolGuid                  ## CONSUMES
> diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf
> b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf
> index 0a08885786..97cec443e4 100644
> --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf
> +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf
> @@ -59,7 +59,6 @@
>    TpmMeasurementLib
>    Tpm2CommandLib
>    Tcg2PhysicalPresenceLib
> -  IoLib
>    PcdLib
> 
>  [Guids]
> diff --git a/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDxe.inf
> b/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDxe.inf
> index 179426978c..2a9f61a8c2 100644
> --- a/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDxe.inf
> +++ b/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDxe.inf
> @@ -59,7 +59,6 @@
>    ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence"
>    gEfiPhysicalPresenceGuid
> 
> -  gEfiIfrTianoGuid                                    ## SOMETIMES_PRODUCES  ## GUID
> # HII opcode
>    ## PRODUCES            ## HII
>    ## CONSUMES            ## HII
>    gTcgConfigFormSetGuid
> diff --git
> a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCon
> figDxe.inf
> b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCon
> figDxe.inf
> index caf95ddac7..8a1e2bc76b 100644
> ---
> a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCon
> figDxe.inf
> +++
> b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCon
> figDxe.inf
> @@ -105,7 +105,6 @@
>    gEfiCertPkcs7Guid                             ## SOMETIMES_PRODUCES  ## GUID  #
> Unique ID for the type of the certificate.
>    gEfiCertTypeRsa2048Sha256Guid                 ## SOMETIMES_CONSUMES  ##
> GUID  # Unique ID for the type of the certificate.
>    gEfiFileSystemVolumeLabelInfoIdGuid           ## SOMETIMES_CONSUMES
> ## GUID  # Indicate the information type
> -  gEfiFileInfoGuid                              ## SOMETIMES_CONSUMES  ## GUID  #
> Indicate the information type
> 
>    gEfiCertX509Sha256Guid                        ## SOMETIMES_PRODUCES  ## GUID
> # Unique ID for the type of the certificate.
>    gEfiCertX509Sha384Guid                        ## SOMETIMES_PRODUCES  ## GUID
> # Unique ID for the type of the certificate.
> @@ -114,7 +113,6 @@
>  [Protocols]
>    gEfiHiiConfigAccessProtocolGuid               ## PRODUCES
>    gEfiDevicePathProtocolGuid                    ## PRODUCES
> -  gEfiBlockIoProtocolGuid                       ## SOMETIMES_CONSUMES
> 
>  [Depex]
>    gEfiHiiConfigRoutingProtocolGuid  AND
> --
> 2.16.2.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


      parent reply	other threads:[~2018-11-29  1:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28  6:26 [PATCH] SecurityPkg: Remove dead code and inf redundant definitions Chen A Chen
2018-11-28 14:18 ` Zhang, Chao B
2018-11-29  1:19 ` Dong, Eric [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ED077930C258884BBCB450DB737E662259D51953@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox