public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Liming Gao" <liming.gao@intel.com>
To: "Agrawal, Sachin" <sachin.agrawal@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Feng, Bob C" <bob.c.feng@intel.com>
Subject: Re: [PATCH] Add support for FuSA ACM in FitGen tool
Date: Tue, 15 Oct 2019 00:24:25 +0000	[thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E517084@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <c0f2f62da71957f4bcf0cb327fe008172591a196.1571094939.git.sachin.agrawal@intel.com>

As you know, FitGen is used to generate firmware interface table. This table is defined in public specification.

Can you let me whether this new entry is defined in the latest FitGen spec? 

Thanks
Liming
>-----Original Message-----
>From: Agrawal, Sachin
>Sent: Tuesday, October 15, 2019 7:24 AM
>To: devel@edk2.groups.io
>Cc: Agrawal, Sachin <sachin.agrawal@intel.com>; Feng, Bob C
><bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [PATCH] Add support for FuSA ACM in FitGen tool
>
>REF https://bugzilla.tianocore.org/show_bug.cgi?id=2200
>
>FitGen Tool is responsible for creating FIT table in UEFI BIOS.
>A new FIT entry type (FIT Type 0x3) has been allocated for FuSa ACM.
>FitGen tool is updated to add support for this FuSa ACM.
>
>Cc: Bob Feng <bob.c.feng@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>
>Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
>---
> Silicon/Intel/Tools/FitGen/FitGen.c | 82
>+++++++++++++++++++++++++++++++++++++
> 1 file changed, 82 insertions(+)
>
>diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c
>b/Silicon/Intel/Tools/FitGen/FitGen.c
>index faf9880060..1ebce40505 100644
>--- a/Silicon/Intel/Tools/FitGen/FitGen.c
>+++ b/Silicon/Intel/Tools/FitGen/FitGen.c
>@@ -217,6 +217,7 @@ typedef struct {
> #define FIT_TABLE_TYPE_HEADER                 0
> #define FIT_TABLE_TYPE_MICROCODE              1
> #define FIT_TABLE_TYPE_STARTUP_ACM            2
>+#define FIT_TABLE_TYPE_FUSA_ACM               3
> #define FIT_TABLE_TYPE_BIOS_MODULE            7
> #define FIT_TABLE_TYPE_TPM_POLICY             8
> #define FIT_TABLE_TYPE_BIOS_POLICY            9
>@@ -246,6 +247,8 @@ typedef struct {
>   UINT32                     FitHeaderVersion;
>   FIT_TABLE_CONTEXT_ENTRY    StartupAcm;
>   UINT32                     StartupAcmVersion;
>+  FIT_TABLE_CONTEXT_ENTRY    FusaAcm;
>+  UINT32                     FusaAcmVersion;
>   FIT_TABLE_CONTEXT_ENTRY    BiosModule[MAX_BIOS_MODULE_ENTRY];
>   UINT32                     BiosModuleVersion;
>   FIT_TABLE_CONTEXT_ENTRY    Microcode[MAX_MICROCODE_ENTRY];
>@@ -317,6 +320,7 @@ Returns:
>           "\t[-CLEAR]\n"
>           "\t[-I <BiosInfoGuid>]\n"
>           "\t[-S <StartupAcmAddress StartupAcmSize>|<StartupAcmGuid>] [-V
><StartupAcmVersion>]\n"
>+          "\t[-F <FusaAcmAddress FusaAcmSize>|<FusaAcmGuid>] [-V
><FusaAcmVersion>]\n"
>           "\t[-B <BiosModuleAddress BiosModuleSize>] [-B ...] [-V
><BiosModuleVersion>]\n"
>           "\t[-M <MicrocodeAddress MicrocodeSize>] [-M ...]|[-U <MicrocodeFv
>MicrocodeBase>|<MicrocodeRegionOffset
>MicrocodeRegionSize>|<MicrocodeGuid>] [-V <MicrocodeVersion>]\n"
>           "\t[-O RecordType <RecordDataAddress RecordDataSize>|<RESERVE
>RecordDataSize>|<RecordDataGuid>|<RecordBinFile> [-V <RecordVersion>]]
>[-O ... [-V ...]]\n"
>@@ -331,6 +335,9 @@ Returns:
>   printf ("\tStartupAcmAddress      - Address of StartupAcm.\n");
>   printf ("\tStartupAcmSize         - Size of StartupAcm.\n");
>   printf ("\tStartupAcmGuid         - Guid of StartupAcm Module, if StartupAcm
>is in a BiosModule, it will be excluded form that.\n");
>+  printf ("\tFusaAcmAddress         - Address of FusaAcm.\n");
>+  printf ("\tFusaAcmSize            - Size of FusaAcm.\n");
>+  printf ("\tFusaAcmGuid            - Guid of FusaAcm Module, if FusaAcm is in a
>BiosModule, it will be excluded from that.\n");
>   printf ("\tBiosModuleAddress      - Address of BiosModule. User should
>ensure there is no overlap.\n");
>   printf ("\tBiosModuleSize         - Size of BiosModule.\n");
>   printf ("\tMicrocodeAddress       - Address of Microcode.\n");
>@@ -349,6 +356,7 @@ Returns:
>   printf ("\tFitEntryDefaultVersion - The default version for all FIT table entries.
>0x%04x is used if this is not specified.\n", DEFAULT_FIT_ENTRY_VERSION);
>   printf ("\tFitHeaderVersion       - The version for FIT header. (Override
>default version)\n");
>   printf ("\tStartupAcmVersion      - The version for StartupAcm. (Override
>default version)\n");
>+  printf ("\tFusaAcmVersion         - The version for FusaAcm. (Override default
>version)\n");
>   printf ("\tBiosModuleVersion      - The version for BiosModule. (Override
>default version)\n");
>   printf ("\tMicrocodeVersion       - The version for Microcode. (Override
>default version)\n");
>   printf ("\tRecordVersion          - The version for Record. (Override default
>version)\n");
>@@ -953,6 +961,17 @@ Returns:
>           gFitTableContext.StartupAcmVersion  =
>BiosInfoStruct[BiosInfoIndex].Version;
>           gFitTableContext.FitEntryNumber ++;
>           break;
>+        case FIT_TABLE_TYPE_FUSA_ACM:
>+          if (gFitTableContext.FusaAcm.Type != 0) {
>+            Error (NULL, 0, 0, "-I Parameter incorrect, Duplicated FusaAcm!", NULL);
>+            return 0;
>+          }
>+          gFitTableContext.FusaAcm.Type    = FIT_TABLE_TYPE_FUSA_ACM;
>+          gFitTableContext.FusaAcm.Address =
>(UINT32)BiosInfoStruct[BiosInfoIndex].Address;
>+          gFitTableContext.FusaAcm.Size    =
>(UINT32)BiosInfoStruct[BiosInfoIndex].Size;
>+          gFitTableContext.FusaAcmVersion  =
>BiosInfoStruct[BiosInfoIndex].Version;
>+          gFitTableContext.FitEntryNumber ++;
>+          break;
>         case FIT_TABLE_TYPE_BIOS_MODULE:
>           if ((BiosInfoStruct[BiosInfoIndex].Attributes &
>BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB) != 0) {
>             continue;
>@@ -1148,6 +1167,52 @@ Returns:
>   } while (FALSE);
>
>   //
>+  // 1.5. FusaAcm
>+  //
>+  do {
>+    if ((Index + 1 >= argc) ||
>+        ((strcmp (argv[Index], "-F") != 0) &&
>+         (strcmp (argv[Index], "-f") != 0)) ) {
>+      if (BiosInfoExist && (gFitTableContext.FusaAcm.Type ==
>FIT_TABLE_TYPE_FUSA_ACM)) {
>+        break;
>+      }
>+      break;
>+    }
>+    if (IsGuidData (argv[Index + 1], &Guid)) {
>+      FileBuffer = FindFileFromFvByGuid (FdBuffer, FdSize, &Guid, &FileSize);
>+      if (FileBuffer == NULL) {
>+        Error (NULL, 0, 0, "-F Parameter incorrect, GUID not found!", "%s",
>argv[Index + 1]);
>+        return 0;
>+      }
>+      FileBuffer = (UINT8 *)MEMORY_TO_FLASH (FileBuffer, FdBuffer, FdSize);
>+      Index += 2;
>+    } else {
>+      if (Index + 2 >= argc) {
>+        Error (NULL, 0, 0, "-F Parameter incorrect, expect Address Size!", NULL);
>+        return 0;
>+      }
>+      FileBuffer = (UINT8 *) (UINTN) xtoi (argv[Index + 1]);
>+      FileSize = xtoi (argv[Index + 2]);
>+      Index += 3;
>+    }
>+    if (gFitTableContext.FusaAcm.Type != 0) {
>+      Error (NULL, 0, 0, "-F Parameter incorrect, Duplicated FusaAcm!", NULL);
>+      return 0;
>+    }
>+    gFitTableContext.FusaAcm.Type = FIT_TABLE_TYPE_FUSA_ACM;
>+    gFitTableContext.FusaAcm.Address = (UINT32) (UINTN) FileBuffer;
>+    gFitTableContext.FusaAcm.Size = FileSize;
>+    gFitTableContext.FitEntryNumber ++;
>+    if ((Index + 1 >= argc) ||
>+        ((strcmp (argv[Index], "-V") != 0) &&
>+         (strcmp (argv[Index], "-v") != 0)) ) {
>+      gFitTableContext.FusaAcmVersion = gFitTableContext.GlobalVersion;
>+    } else {
>+      gFitTableContext.FusaAcmVersion = xtoi (argv[Index + 1]);
>+      Index += 2;
>+    }
>+  } while (FALSE);
>+
>   // 2. BiosModule
>   //
>   do {
>@@ -1555,6 +1620,7 @@ Returns:
>   // Final: Check StartupAcm in BiosModule.
>   //
>   CheckOverlap (gFitTableContext.StartupAcm.Address,
>gFitTableContext.StartupAcm.Size);
>+  CheckOverlap (gFitTableContext.FusaAcm.Address,
>gFitTableContext.FusaAcm.Size);
>   FitEntryNumber = gFitTableContext.FitEntryNumber;
>   for (Index = 0; Index < (INTN)gFitTableContext.OptionalModuleNumber;
>Index++) {
>     if ((gFitTableContext.OptionalModule[Index].Type ==
>FIT_TABLE_TYPE_BIOS_POLICY) ||
>@@ -1821,6 +1887,9 @@ Returns:
>   if (gFitTableContext.StartupAcm.Address != 0) {
>     printf ("StartupAcm - (0x%08x, 0x%08x, 0x%04x)\n",
>gFitTableContext.StartupAcm.Address, gFitTableContext.StartupAcm.Size,
>gFitTableContext.StartupAcmVersion);
>   }
>+  if (gFitTableContext.FusaAcm.Address != 0) {
>+    printf ("FusaAcm - (0x%08x, 0x%08x, 0x%04x)\n",
>gFitTableContext.FusaAcm.Address, gFitTableContext.FusaAcm.Size,
>gFitTableContext.FusaAcmVersion);
>+  }
>   for (Index = 0; Index < gFitTableContext.BiosModuleNumber; Index++) {
>     printf ("BiosModule[%d] - (0x%08x, 0x%08x, 0x%04x)\n", Index,
>gFitTableContext.BiosModule[Index].Address,
>gFitTableContext.BiosModule[Index].Size,
>gFitTableContext.BiosModuleVersion);
>   }
>@@ -1845,6 +1914,7 @@ CHAR8 *mFitTypeStr[] = {
>   "           ",
>   "MICROCODE  ",
>   "STARTUP_ACM",
>+  "FUSA_ACM   ",
>   "           ",
>   "           ",
>   "           ",
>@@ -2413,6 +2483,18 @@ Returns:
>     FitIndex++;
>   }
>
>+  //
>+  // 4.5. FuSaAcm
>+  //
>+  if (gFitTableContext.FusaAcm.Address != 0) {
>+    FitEntry[FitIndex].Address             = gFitTableContext.FusaAcm.Address;
>+    *(UINT32 *)&FitEntry[FitIndex].Size[0] = 0;
>+    FitEntry[FitIndex].Version             =
>(UINT16)gFitTableContext.FusaAcmVersion;
>+    FitEntry[FitIndex].Type                = FIT_TABLE_TYPE_FUSA_ACM;
>+    FitEntry[FitIndex].C_V                 = 0;
>+    FitEntry[FitIndex].Checksum            = 0;
>+    FitIndex++;
>+  }
>   //
>   // 5. BiosModule
>   //
>--
>2.14.3.windows.1


  reply	other threads:[~2019-10-15  0:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-14 23:23 [PATCH] Add support for FuSA ACM in FitGen tool Agrawal, Sachin
2019-10-15  0:24 ` Liming Gao [this message]
2019-10-24 16:39   ` Agrawal, Sachin

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=4A89E2EF3DFEDB4C8BFDE51014F606A14E517084@SHSMSX104.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