public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jeff Fan <jeff.fan@intel.com>
To: edk2-devel@lists.01.org
Cc: Michael Kinney <michael.d.kinney@intel.com>,
	Feng Tian <feng.tian@intel.com>,
	Giri P Mudusuru <giri.p.mudusuru@intel.com>
Subject: [Patch 6/7] UefiCpuPkg/SecCore: Abstract worker function GetBistFromHob()
Date: Fri,  9 Sep 2016 15:59:32 +0800	[thread overview]
Message-ID: <20160909075933.14320-7-jeff.fan@intel.com> (raw)
In-Reply-To: <20160909075933.14320-1-jeff.fan@intel.com>

Abstract one worker function to get CPU BIST from the GUIDed-HOB. Add
SecPlatformInformationBist() and SecPlatformInformation2Bist() to invoke
GetBistFromHob(). Add in/out for parameter in function header.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
---
 UefiCpuPkg/SecCore/SecBist.c | 81 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 61 insertions(+), 20 deletions(-)

diff --git a/UefiCpuPkg/SecCore/SecBist.c b/UefiCpuPkg/SecCore/SecBist.c
index cba445d..10bebbc 100644
--- a/UefiCpuPkg/SecCore/SecBist.c
+++ b/UefiCpuPkg/SecCore/SecBist.c
@@ -15,30 +15,26 @@
 #include "SecMain.h"
 
 /**
-  Implementation of the PlatformInformation2 service in EFI_SEC_PLATFORM_INFORMATION2_PPI.
+  Worker function to parse CPU BIST information from Guided HOB.
 
-  @param  PeiServices                The pointer to the PEI Services Table.
-  @param  StructureSize              The pointer to the variable describing size of the input buffer.
-  @param  PlatformInformationRecord2 The pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD2.
+  @param[out] StructureSize     Pointer to the variable describing size of the input buffer.
+  @param[out] StructureBuffer   Pointer to the buffer save CPU BIST information.
 
-  @retval EFI_SUCCESS                The data was successfully returned.
-  @retval EFI_BUFFER_TOO_SMALL       The buffer was too small. The current buffer size needed to
-                                     hold the record is returned in StructureSize.
+  @retval EFI_SUCCESS           The data was successfully returned.
+  @retval EFI_BUFFER_TOO_SMALL  The buffer was too small.
 
 **/
 EFI_STATUS
-EFIAPI
-SecPlatformInformation2 (
-  IN CONST EFI_PEI_SERVICES                   **PeiServices,
-  IN OUT UINT64                               *StructureSize,
-     OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2
+GetBistFromHob (
+  IN OUT UINT64           *StructureSize,
+  IN OUT VOID             *StructureBuffer
   )
 {
   EFI_HOB_GUID_TYPE       *GuidHob;
   VOID                    *DataInHob;
   UINTN                   DataSize;
 
-  GuidHob = GetFirstGuidHob (&gEfiSecPlatformInformation2PpiGuid);
+  GuidHob = GetFirstGuidHob (&gEfiCallerIdGuid);
   if (GuidHob == NULL) {
     *StructureSize = 0;
     return EFI_SUCCESS;
@@ -56,20 +52,65 @@ SecPlatformInformation2 (
   }
 
   *StructureSize = (UINT64) DataSize;
-  CopyMem (PlatformInformationRecord2, DataInHob, DataSize);
+  CopyMem (StructureBuffer, DataInHob, DataSize);
   return EFI_SUCCESS;
 }
 
 /**
+  Implementation of the PlatformInformation service in EFI_SEC_PLATFORM_INFORMATION_PPI.
+
+  @param[in]  PeiServices                Pointer to the PEI Services Table.
+  @param[out] StructureSize              Pointer to the variable describing size of the input buffer.
+  @param[out  PlatformInformationRecord  Pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD.
+
+  @retval EFI_SUCCESS                    The data was successfully returned.
+  @retval EFI_BUFFER_TOO_SMALL           The buffer was too small.
+
+**/
+EFI_STATUS
+EFIAPI
+SecPlatformInformationBist (
+  IN CONST EFI_PEI_SERVICES                  **PeiServices,
+  IN OUT UINT64                              *StructureSize,
+     OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
+  )
+{
+  return GetBistFromHob (StructureSize, PlatformInformationRecord);
+}
+
+/**
+  Implementation of the PlatformInformation2 service in EFI_SEC_PLATFORM_INFORMATION2_PPI.
+
+  @param[in]  PeiServices                The pointer to the PEI Services Table.
+  @param[out] StructureSize              The pointer to the variable describing size of the input buffer.
+  @param[out] PlatformInformationRecord2 The pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD2.
+
+  @retval EFI_SUCCESS                    The data was successfully returned.
+  @retval EFI_BUFFER_TOO_SMALL           The buffer was too small. The current buffer size needed to
+                                         hold the record is returned in StructureSize.
+
+**/
+EFI_STATUS
+EFIAPI
+SecPlatformInformation2Bist (
+  IN CONST EFI_PEI_SERVICES                   **PeiServices,
+  IN OUT UINT64                               *StructureSize,
+     OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2
+  )
+{
+  return GetBistFromHob (StructureSize, PlatformInformationRecord2);
+}
+
+/**
   Worker function to get CPUs' BIST by calling SecPlatformInformationPpi
   or SecPlatformInformation2Ppi.
 
-  @param  PeiServices         Pointer to PEI Services Table
-  @param  Guid                PPI Guid
-  @param  PpiDescriptor       Return a pointer to instance of the
-                              EFI_PEI_PPI_DESCRIPTOR
-  @param  BistInformationData Pointer to BIST information data
-  @param  BistInformationSize Return the size in bytes of BIST information
+  @param[in]  PeiServices         Pointer to PEI Services Table
+  @param[in]  Guid                PPI Guid
+  @param[out] PpiDescriptor       Return a pointer to instance of the
+                                  EFI_PEI_PPI_DESCRIPTOR
+  @param[out] BistInformationData Pointer to BIST information data
+  @param[out] BistInformationSize Return the size in bytes of BIST information
 
   @retval EFI_SUCCESS         Retrieve of the BIST data successfully
   @retval EFI_NOT_FOUND       No sec platform information(2) ppi export
-- 
2.9.3.windows.2



  parent reply	other threads:[~2016-09-09  8:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09  7:59 [Patch 0/7] Re-install SEC Platform Information PPI Jeff Fan
2016-09-09  7:59 ` [Patch 1/7] UefiCpuPkg/CpuDxe: Fix duplicated status code report Jeff Fan
2016-09-09  7:59 ` [Patch 2/7] UefiCpuPkg/CpuMpPei: Add parameter BistInformationSize Jeff Fan
2016-09-09  7:59 ` [Patch 3/7] UefiCpuPkg/CpuMpPei: Fix BistData ouput error Jeff Fan
2016-09-09  7:59 ` [Patch 4/7] UefiCpuPkg/CpuMpPei: Build GUIDed-HOB to store all CPU BIST Data Jeff Fan
2016-09-09  7:59 ` [Patch 5/7] UefiCpuPkg/SecCore: Add SecBist.c Jeff Fan
2016-09-09  7:59 ` Jeff Fan [this message]
2016-09-09  7:59 ` [Patch 7/7] UefiCpuPkg/SecCore: Re-install SEC platform information(2) PPI Jeff Fan
2016-09-13  7:41 ` [Patch 0/7] Re-install SEC Platform Information PPI Tian, Feng

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=20160909075933.14320-7-jeff.fan@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