]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Not needed
authorbbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 21 Jun 2006 21:09:12 +0000 (21:09 +0000)
committerbbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 21 Jun 2006 21:09:12 +0000 (21:09 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@588 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/TianoTools/GenFdImage/GenFdImage.h [deleted file]
Tools/Source/TianoTools/GenFdImage/GenFdImageDll.c [deleted file]
Tools/Source/TianoTools/GenFdImage/GenFdImageExe.c [deleted file]
Tools/Source/TianoTools/GenFdImage/GenFdImageExe.h [deleted file]
Tools/Source/TianoTools/GenFdImage/GenFdImageLib.c [deleted file]

diff --git a/Tools/Source/TianoTools/GenFdImage/GenFdImage.h b/Tools/Source/TianoTools/GenFdImage/GenFdImage.h
deleted file mode 100644 (file)
index a2c1afb..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*++\r
-\r
-Copyright (c)  1999 - 2002 Intel Corporation. All rights reserved\r
-This software and associated documentation (if any) is furnished\r
-under a license and may only be used or copied in accordance\r
-with the terms of the license. Except as permitted by such\r
-license, no part of this software or documentation may be\r
-reproduced, stored in a retrieval system, or transmitted in any\r
-form or by any means without the express written consent of\r
-Intel Corporation.\r
-\r
-\r
-Module Name:\r
-  \r
-  GenFdImage.h\r
-\r
-Abstract:\r
-\r
-  This file contains the relevant declarations required\r
-  to generate the Firmware Device\r
-\r
---*/\r
-\r
-//\r
-// Coded to EFI 2.0 Coding Standard\r
-//\r
-#ifndef _EFI_GEN_FD_IMAGE_H\r
-#define _EFI_GEN_FD_IMAGE_H\r
-\r
-//\r
-// Included Header files\r
-//\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <assert.h>\r
-\r
-#include "ParseInf.h"\r
-\r
-//\r
-// Defines\r
-//\r
-#define FILE_NAME_SIZE  256\r
-\r
-//\r
-// Type Definition\r
-//\r
-typedef struct {\r
-  UINT64  FdSize;\r
-  UINT64  FdBaseAddress;\r
-  UINT8   PadValue;\r
-  CHAR8   OutFileName[FILE_NAME_SIZE];\r
-} FDINFO;\r
-\r
-//\r
-// Exported Function Prototype\r
-//\r
-EFI_STATUS\r
-GenerateFdImage (\r
-  IN UINT64  BaseAddress,\r
-  IN UINT64  Size,\r
-  IN UINT8   PadByte,\r
-  IN CHAR8   *OutFile,\r
-  IN CHAR8   **FileList\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  BaseAddress - GC_TODO: add argument description\r
-  Size        - GC_TODO: add argument description\r
-  PadByte     - GC_TODO: add argument description\r
-  OutFile     - GC_TODO: add argument description\r
-  FileList    - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
-\r
---*/\r
-;\r
-\r
-#endif\r
diff --git a/Tools/Source/TianoTools/GenFdImage/GenFdImageDll.c b/Tools/Source/TianoTools/GenFdImage/GenFdImageDll.c
deleted file mode 100644 (file)
index 057c108..0000000
+++ /dev/null
@@ -1,864 +0,0 @@
-/*++\r
-Copyright (c)  1999 - 2002 Intel Corporation. All rights reserved\r
-This software and associated documentation (if any) is furnished\r
-under a license and may only be used or copied in accordance\r
-with the terms of the license. Except as permitted by such\r
-license, no part of this software or documentation may be\r
-reproduced, stored in a retrieval system, or transmitted in any\r
-form or by any means without the express written consent of\r
-Intel Corporation.\r
-\r
-\r
-  Module Name:  \r
-          GenFdImageDll.C\r
-\r
-  Abstarct:\r
-          This file contains the relevant functions required to complete\r
-          the API to generate Firmware Device\r
---*/\r
-\r
-// GC_TODO: fix comment to add:  Abstract:\r
-//\r
-// This tells the compiler to export the DLL functions\r
-//\r
-#define GEN_FD_IMAGE_EXPORTS\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <assert.h>\r
-\r
-#include <Common/UefiBaseTypes.h>\r
-\r
-#include "GenFdImage.h"\r
-#include "ParseInf.h"\r
-\r
-//\r
-// Global declaration\r
-//\r
-UINTN         ValidLineNum  = 0;\r
-\r
-UINTN         NumFvFiles    = 0;\r
-static UINT64 LastAddress   = 0;\r
-\r
-CHAR8         **TokenStr;\r
-CHAR8         **OrgStrTokPtr;\r
-\r
-FDINFO        *FdInfo;\r
-FDINFO        *OrgFdInfoPtr;\r
-\r
-FVINFO        **FvInfo;\r
-FVINFO        **OrgFvInfoPtr;\r
-\r
-//\r
-// Global function declarations\r
-//\r
-EFI_STATUS\r
-BuildFirmwareDeviceBinaryFromFwVolumes (\r
-  IN UINT64   FvBaseAddress,\r
-  IN CHAR8    *FvFileName,\r
-  IN CHAR8    *FdFileName\r
-  );\r
-\r
-INTN\r
-CompareItems (\r
-  IN  const VOID *Arg1,\r
-  IN  const VOID *Arg2\r
-  )\r
-/*++\r
-Description:\r
-\r
-    This function is used by qsort to sort the Fv list based on FvBaseAddress\r
-\r
-Input:\r
-    Arg1\r
-    Arg2\r
-\r
-Return:\r
-\r
-    None\r
---*/\r
-// GC_TODO: function comment is missing 'Routine Description:'\r
-// GC_TODO: function comment is missing 'Arguments:'\r
-// GC_TODO: function comment is missing 'Returns:'\r
-// GC_TODO:    Arg1 - add argument and description to function comment\r
-// GC_TODO:    Arg2 - add argument and description to function comment\r
-{\r
-  if ((*(FVINFO **) Arg1)->FvBaseAddress > (*(FVINFO **) Arg2)->FvBaseAddress) {\r
-    return 1;\r
-  } else if ((*(FVINFO **) Arg1)->FvBaseAddress < (*(FVINFO **) Arg2)->FvBaseAddress) {\r
-    return -1;\r
-  } else {\r
-    return 0;\r
-  }\r
-}\r
-\r
-VOID\r
-BuildTokenList (\r
-  IN  CHAR8 *Token\r
-  )\r
-/*++\r
-Description:\r
-\r
-    This function builds the token list in an array which will be parsed later\r
-\r
-Input:\r
-    Token    String,\r
-\r
-Return:\r
-\r
-    None\r
---*/\r
-// GC_TODO: function comment is missing 'Routine Description:'\r
-// GC_TODO: function comment is missing 'Arguments:'\r
-// GC_TODO: function comment is missing 'Returns:'\r
-// GC_TODO:    Token - add argument and description to function comment\r
-{\r
-\r
-  strcpy (*TokenStr, Token);\r
-  TokenStr++;\r
-}\r
-\r
-VOID\r
-TrimLine (\r
-  IN  CHAR8 *Line\r
-  )\r
-/*++\r
-Description:\r
-\r
-  This function cleans up the line by removing all whitespace and \r
-  comments\r
-\r
-Input:\r
-\r
-  Line    String,\r
-\r
-Return:\r
-    None\r
---*/\r
-// GC_TODO: function comment is missing 'Routine Description:'\r
-// GC_TODO: function comment is missing 'Arguments:'\r
-// GC_TODO: function comment is missing 'Returns:'\r
-// GC_TODO:    Line - add argument and description to function comment\r
-{\r
-  CHAR8 TmpLine[FILE_NAME_SIZE];\r
-  CHAR8 c;\r
-  CHAR8 *Ptr0;\r
-  UINTN i;\r
-  UINTN j;\r
-\r
-  //\r
-  // Change '#' to '//' for Comment style\r
-  //\r
-  //  if((Ptr0=strchr(Line, '#')) != NULL) {\r
-  //\r
-  if ((Ptr0 = strstr (Line, "//")) != NULL) {\r
-    Line[Ptr0 - Line] = 0;\r
-  }\r
-\r
-  i = j = 0;\r
-\r
-  while ((c = Line[i]) != 0) {\r
-    if ((c != ' ') && (c != '\t') && (c != '\n')) {\r
-      TmpLine[j++] = c;\r
-    }\r
-\r
-    i++;\r
-  }\r
-\r
-  TmpLine[j] = 0;\r
-  strcpy (Line, TmpLine);\r
-}\r
-\r
-VOID\r
-ValidLineCount (\r
-  IN  FILE *Fp\r
-  )\r
-/*++\r
-\r
-Description:\r
-\r
-  This function calculated number of valid lines in a input file.\r
-  \r
-Input:\r
-\r
-  Fp     Pointer to a file handle which has been opened.\r
-\r
-Return:\r
-\r
-  None\r
---*/\r
-// GC_TODO: function comment is missing 'Routine Description:'\r
-// GC_TODO: function comment is missing 'Arguments:'\r
-// GC_TODO: function comment is missing 'Returns:'\r
-// GC_TODO:    Fp - add argument and description to function comment\r
-{\r
-  CHAR8 Buff[FILE_NAME_SIZE];\r
-\r
-  while (fgets (Buff, sizeof (Buff), Fp)) {\r
-    TrimLine (Buff);\r
-    if (Buff[0] == 0) {\r
-      continue;\r
-    }\r
-\r
-    ValidLineNum++;\r
-  }\r
-}\r
-\r
-VOID\r
-ParseInputFile (\r
-  IN  FILE *Fp\r
-  )\r
-/*++\r
-  \r
-Description:\r
-\r
-  This function parses the input file and tokenize the string\r
-  \r
-Input:\r
-\r
-  Fp     Pointer to a file handle which has been opened.\r
-  \r
-Return:\r
-\r
-  None\r
---*/\r
-// GC_TODO: function comment is missing 'Routine Description:'\r
-// GC_TODO: function comment is missing 'Arguments:'\r
-// GC_TODO: function comment is missing 'Returns:'\r
-// GC_TODO:    Fp - add argument and description to function comment\r
-{\r
-  CHAR8 *Token;\r
-  CHAR8 Buff[FILE_NAME_SIZE];\r
-  CHAR8 OrgLine[FILE_NAME_SIZE];\r
-  CHAR8 Str[FILE_NAME_SIZE];\r
-  CHAR8 Delimit[] = "=";\r
-\r
-  while (fgets (Buff, sizeof (Buff), Fp) != NULL) {\r
-    strcpy (OrgLine, Buff);\r
-    TrimLine (Buff);\r
-\r
-    if (Buff[0] == 0) {\r
-      continue;\r
-    }\r
-\r
-    Token = strtok (Buff, Delimit);\r
-\r
-    while (Token != NULL) {\r
-      strcpy (Str, Token);\r
-      BuildTokenList (Str);\r
-      Token = strtok (NULL, Delimit);\r
-    }\r
-  }\r
-}\r
-\r
-EFI_STATUS\r
-InitializeComps (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Description:\r
-\r
-  This function intializes the relevant global variable which is being\r
-  used to store the information retrieved from INF file.\r
-  \r
-Input:\r
-\r
-  None\r
-\r
-Return:\r
-\r
-  EFI_STATUS\r
---*/\r
-// GC_TODO: function comment is missing 'Routine Description:'\r
-// GC_TODO: function comment is missing 'Arguments:'\r
-// GC_TODO: function comment is missing 'Returns:'\r
-// GC_TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment\r
-// GC_TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment\r
-// GC_TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
-{\r
-  UINTN Index;\r
-\r
-  FdInfo = malloc (sizeof (FDINFO));\r
-\r
-  if (FdInfo == NULL) {\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-\r
-  OrgFdInfoPtr  = FdInfo;\r
-\r
-  FvInfo        = malloc (sizeof (int) * NumFvFiles);\r
-\r
-  if (FvInfo == NULL) {\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-\r
-  OrgFvInfoPtr = FvInfo;\r
-\r
-  for (Index = 0; Index < NumFvFiles; Index++) {\r
-    *FvInfo = malloc (sizeof (FVINFO));\r
-\r
-    if (*FvInfo == NULL) {\r
-      return EFI_OUT_OF_RESOURCES;\r
-    }\r
-\r
-    memset (*FvInfo, 0, sizeof (FVINFO));\r
-    FvInfo++;\r
-  }\r
-\r
-  FvInfo = OrgFvInfoPtr;\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-VOID\r
-InitializeInFileInfo (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Description:\r
-\r
-  This function intializes the relevant global variable which is being\r
-  used to store the information retrieved from INF file.\r
-\r
-Input:\r
-\r
-  NONE\r
-\r
-Return:\r
-\r
-  NONE\r
---*/\r
-// GC_TODO: function comment is missing 'Routine Description:'\r
-// GC_TODO: function comment is missing 'Arguments:'\r
-// GC_TODO: function comment is missing 'Returns:'\r
-{\r
-  UINTN   OptionFlag;\r
-  UINT64  StringValue;\r
-\r
-  OptionFlag  = 0;\r
-  TokenStr    = OrgStrTokPtr;\r
-\r
-  while (*TokenStr != NULL) {\r
-    if (stricmp (*TokenStr, "[options]") == 0) {\r
-      OptionFlag = 1;\r
-    }\r
-\r
-    if (OptionFlag) {\r
-      if (stricmp (*TokenStr, "EFI_FV_BASE_ADDRESS") == 0) {\r
-        *TokenStr++;\r
-        if (AsciiStringToUint64 (*TokenStr, FALSE, &StringValue) != EFI_SUCCESS) {\r
-          printf ("\nERROR: Cannot determine the FV base address.");\r
-          return ;\r
-        }\r
-        (*FvInfo)->FvBaseAddress = StringValue;\r
-      } else if (stricmp (*TokenStr, "EFI_FV_FILE_NAME") == 0) {\r
-        *TokenStr++;\r
-        strcpy ((*FvInfo)->FvFile, *TokenStr);\r
-      }\r
-    }\r
-\r
-    TokenStr++;\r
-  }\r
-}\r
-\r
-EFI_STATUS\r
-GetFvRelatedInfoFromInfFile (\r
-  IN  CHAR8 *FileName\r
-  )\r
-/*++\r
-  \r
-Description:\r
-\r
-  This function reads the input file, parse it and create a list of tokens\r
-  which is parsed and used, to intialize the data related to Firmware Volume.\r
-  \r
-Input:\r
-\r
-  FileName  FileName which needed to be read to parse data\r
-\r
-Return:\r
-\r
-  EFI_STATUS\r
-    \r
---*/\r
-// GC_TODO: function comment is missing 'Routine Description:'\r
-// GC_TODO: function comment is missing 'Arguments:'\r
-// GC_TODO: function comment is missing 'Returns:'\r
-// GC_TODO:    FileName - add argument and description to function comment\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
-{\r
-  FILE  *Fp;\r
-  UINTN Index;\r
-\r
-  Fp = fopen (FileName, "r");\r
-\r
-  if (Fp == NULL) {\r
-    printf ("Error in opening %s file\n", FileName);\r
-    return EFI_ABORTED;\r
-  }\r
-\r
-  ValidLineCount (Fp);\r
-\r
-  if (ValidLineNum == 0) {\r
-    printf ("\nFile doesn't contain any valid informations");\r
-    return EFI_ABORTED;\r
-  }\r
-\r
-  TokenStr = (CHAR8 **) malloc (sizeof (UINTN) * (2 * ValidLineNum));\r
-  memset (TokenStr, 0, sizeof (UINTN) * (2 * ValidLineNum));\r
-  OrgStrTokPtr = TokenStr;\r
-\r
-  for (Index = 0; Index < (2 * ValidLineNum); Index++) {\r
-    *TokenStr = (CHAR8 *) malloc (sizeof (CHAR8) * FILE_NAME_SIZE);\r
-    memset (*TokenStr, 0, FILE_NAME_SIZE);\r
-    TokenStr++;\r
-  }\r
-\r
-  *TokenStr = NULL;\r
-  TokenStr  = OrgStrTokPtr;\r
-  fseek (Fp, 0L, SEEK_SET);\r
-\r
-  ParseInputFile (Fp);\r
-  InitializeInFileInfo ();\r
-\r
-  if (Fp) {\r
-    fclose (Fp);\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-EFI_STATUS\r
-WriteFwBinary (\r
-  IN  CHAR8   *FileName,\r
-  IN  UINT64  StartAddress,\r
-  IN  UINT64  Size,\r
-  IN  UINT8   *Buffer\r
-  )\r
-/*++\r
-  \r
-Description:\r
-\r
-  This function reads the input file, parse it and create a list of tokens\r
-  which is parsed and used, to intialize the data related to Firmware Volume.\r
-  \r
-Input:\r
-\r
-  FileName        FileName which needed to be read to parse data\r
-  StartAddress    This will set the file position.\r
-  Size            Size in bytes needed to be written\r
-  Buffer          Buffer needed to e written\r
-\r
-Return:\r
-\r
-  EFI_STATUS\r
-    \r
---*/\r
-// GC_TODO: function comment is missing 'Routine Description:'\r
-// GC_TODO: function comment is missing 'Arguments:'\r
-// GC_TODO: function comment is missing 'Returns:'\r
-// GC_TODO:    FileName - add argument and description to function comment\r
-// GC_TODO:    StartAddress - add argument and description to function comment\r
-// GC_TODO:    Size - add argument and description to function comment\r
-// GC_TODO:    Buffer - add argument and description to function comment\r
-// GC_TODO:    EFI_INVALID_PARAMETER - add return value to function comment\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
-{\r
-  FILE  *Fp;\r
-  UINTN NumByte;\r
-\r
-  Fp = fopen (FileName, "a+b");\r
-\r
-  if (Fp == NULL) {\r
-    printf ("\nERROR:Error in opening file %s ", FileName);\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  fseek (Fp, (UINTN) StartAddress, SEEK_SET);\r
-  NumByte = fwrite ((VOID *) Buffer, sizeof (UINT8), (UINTN) Size, Fp);\r
-\r
-  //\r
-  // Check to ensure that buffer has been copied successfully\r
-  //\r
-  if (NumByte != Size) {\r
-    printf ("\nERROR: Error in copying the buffer into file");\r
-    return EFI_ABORTED;\r
-  }\r
-\r
-  if (Fp) {\r
-    fclose (Fp);\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-EFI_STATUS\r
-BuildFirmwareDeviceBinaryFromFwVolumes (\r
-  IN UINT64   FvBaseAddress,\r
-  IN CHAR8    *FvFileName,\r
-  IN CHAR8    *FdFileName\r
-  )\r
-/*++\r
-  \r
-Description:\r
-\r
-  This function reads the input file, parse it and create a list of tokens\r
-  which is parsed and used, to intialize the data related to Firmware Volume.\r
-  \r
-Input:\r
-\r
-  FvBaseAddress   Base Address. This info is retrieved from INF file\r
-  FvFileName      InputFileName\r
-  FdFileName      Output File Name\r
-\r
-Return:\r
-\r
-  EFI_STATUS\r
-    \r
---*/\r
-// GC_TODO: function comment is missing 'Routine Description:'\r
-// GC_TODO: function comment is missing 'Arguments:'\r
-// GC_TODO: function comment is missing 'Returns:'\r
-// GC_TODO:    FvBaseAddress - add argument and description to function comment\r
-// GC_TODO:    FvFileName - add argument and description to function comment\r
-// GC_TODO:    FdFileName - add argument and description to function comment\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
-{\r
-  FILE          *Fp;\r
-  UINT64        FileSize;\r
-  UINT64        NumByteRead;\r
-  UINT64        PadByteSize;\r
-  UINTN         Index;\r
-  UINT64        BaseAddress;\r
-  UINT8         *Buffer;\r
-  EFI_STATUS    Status;\r
-  static UINT64 StartAddress  = 0;\r
-\r
-  Fp                          = fopen (FvFileName, "r+b");\r
-\r
-  if (Fp == NULL) {\r
-    printf ("\nERROR:Error in opening file %s", FvFileName);\r
-    return EFI_ABORTED;\r
-  }\r
-\r
-  BaseAddress = FdInfo->FdBaseAddress;\r
-\r
-  //\r
-  // Check if Base Address of Firmware Volume falls below the Base Address\r
-  // Firmware Device, if yes, then abort this process.\r
-  //\r
-  if (FvBaseAddress < BaseAddress) {\r
-    printf ("\nERROR: Firmware Volume Base Address falls below Firmware Device Address.\n");\r
-    return EFI_ABORTED;\r
-  }\r
-  //\r
-  // Check if there are any hole between two Firmware Volumes. If any hole\r
-  // exists, fill the hole with PadByte data.\r
-  //\r
-  if (FvBaseAddress > LastAddress) {\r
-    PadByteSize = (FvBaseAddress - LastAddress);\r
-    Buffer      = malloc ((UINTN) PadByteSize);\r
-\r
-    for (Index = 0; Index < PadByteSize; Index++) {\r
-      *Buffer = FdInfo->PadValue;\r
-      Buffer++;\r
-    }\r
-\r
-    Buffer -= PadByteSize;\r
-    Status = WriteFwBinary (FdFileName, StartAddress, (UINT64) PadByteSize, Buffer);\r
-\r
-    if (Buffer) {\r
-      free (Buffer);\r
-    }\r
-\r
-    if (Status != EFI_SUCCESS) {\r
-      printf ("\nERROR: Error in writing the binary image to file");\r
-      return Status;\r
-    }\r
-\r
-    StartAddress += PadByteSize;\r
-    LastAddress += PadByteSize;\r
-  }\r
-  //\r
-  // Proceed with next Firmware Volume updates\r
-  //\r
-  FileSize = _filelength (fileno (Fp));\r
-\r
-  if ((FvBaseAddress + FileSize) > (FdInfo->FdBaseAddress + FdInfo->FdSize)) {\r
-    printf (\r
-      "\nERROR:Unable to update Firmware Device. File %s is larger than \\r
-                                  available space.",\r
-      FvFileName\r
-      );\r
-    if (Fp) {\r
-      fclose (Fp);\r
-    }\r
-\r
-    return EFI_ABORTED;\r
-  }\r
-\r
-  Buffer = malloc ((UINTN) FileSize);\r
-\r
-  if (Buffer == NULL) {\r
-    printf ("Error in allocating buffer to read specific file\n");\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-\r
-  NumByteRead = fread ((VOID *) Buffer, sizeof (UINT8), (UINTN) FileSize, Fp);\r
-\r
-  Status      = WriteFwBinary (FdFileName, StartAddress, FileSize, Buffer);\r
-\r
-  if (Buffer) {\r
-    free ((VOID *) Buffer);\r
-  }\r
-\r
-  if (Fp) {\r
-    fclose (Fp);\r
-  }\r
-\r
-  if (Status != EFI_SUCCESS) {\r
-    printf ("\nERROR: Error in writing the binary image to file");\r
-    return Status;\r
-  }\r
-\r
-  StartAddress += NumByteRead;\r
-  LastAddress += FileSize;\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-VOID\r
-CleanUpMemory (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Description:\r
-\r
-  This function cleans up any allocated buffer\r
-  \r
-Input:\r
-\r
-  NONE\r
-\r
-Return:\r
-  \r
-  NONE\r
---*/\r
-// GC_TODO: function comment is missing 'Routine Description:'\r
-// GC_TODO: function comment is missing 'Arguments:'\r
-// GC_TODO: function comment is missing 'Returns:'\r
-{\r
-  UINTN Index;\r
-\r
-  if (FdInfo) {\r
-    free (FdInfo);\r
-  }\r
-\r
-  FvInfo = OrgFvInfoPtr;\r
-\r
-  if (FvInfo) {\r
-    for (Index = 0; Index < NumFvFiles; Index++) {\r
-      if (*FvInfo) {\r
-        free (*FvInfo);\r
-      }\r
-\r
-      FvInfo++;\r
-    }\r
-\r
-    FvInfo = OrgFvInfoPtr;\r
-    free (FvInfo);\r
-  }\r
-}\r
-\r
-GEN_FD_IMAGE_API\r
-EFI_STATUS\r
-GenerateFdImage (\r
-  IN  UINT64  BaseAddress,\r
-  IN  UINT64  Size,\r
-  IN  UINT8   PadByte,\r
-  IN  CHAR8   *OutFile,\r
-  IN  CHAR8   **FileList\r
-  )\r
-/*++\r
-  \r
-Description:\r
-\r
-  This function reads the input file, parse it and create a list of tokens\r
-  which is parsed and used, to intialize the data related to Firmware Volume.\r
-  \r
-Input:\r
-\r
-  BaseAddress   Base Address for this Firmware Device\r
-  Size,         Total Size of the Firmware Device\r
-  PadByte       Pad byte data\r
-  OutFile       Output File Name\r
-  FileList      File List pointer to INF file names.\r
-\r
-Return:\r
-\r
-  EFI_STATUS\r
-    \r
---*/\r
-// GC_TODO: function comment is missing 'Routine Description:'\r
-// GC_TODO: function comment is missing 'Arguments:'\r
-// GC_TODO: function comment is missing 'Returns:'\r
-// GC_TODO:    BaseAddress - add argument and description to function comment\r
-// GC_TODO:    Size - add argument and description to function comment\r
-// GC_TODO:    PadByte - add argument and description to function comment\r
-// GC_TODO:    OutFile - add argument and description to function comment\r
-// GC_TODO:    FileList - add argument and description to function comment\r
-// GC_TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
-{\r
-  EFI_STATUS  Status;\r
-  UINTN       Index;\r
-  UINTN       PadSize;\r
-  UINTN       FileSize;\r
-  CHAR8       **InFile;\r
-  FILE        *Fp;\r
-  UINT8       *Buffer;\r
-  UINTN       NumByte;\r
-\r
-  //\r
-  // Ensure, if there are any previous Firmware Device exists,\r
-  // If yes, make it to 0 bytes\r
-  //\r
-  if ((Fp = fopen (OutFile, "w")) != NULL) {\r
-    fclose (Fp);\r
-  }\r
-\r
-  InFile = FileList;\r
-\r
-  while (*InFile != NULL) {\r
-    NumFvFiles++;\r
-    InFile++;\r
-  }\r
-\r
-  InitializeComps ();\r
-\r
-  //\r
-  // Restore the orginal pointers\r
-  //\r
-  FvInfo  = OrgFvInfoPtr;\r
-  InFile  = FileList;\r
-\r
-  while (*InFile != NULL) {\r
-    strcpy ((*FvInfo)->FvInfoFile, *InFile);\r
-    Status = GetFvRelatedInfoFromInfFile (*InFile);\r
-\r
-    if (Status != EFI_SUCCESS) {\r
-      printf ("\nERROR: Error occurred in processsing INF file");\r
-      CleanUpMemory ();\r
-      return Status;\r
-    }\r
-\r
-    InFile++;\r
-    FvInfo++;\r
-  }\r
-\r
-  FdInfo->FdSize        = Size;\r
-  FdInfo->FdBaseAddress = BaseAddress;\r
-  FdInfo->PadValue      = PadByte;\r
-  FvInfo                = OrgFvInfoPtr;\r
-  strcpy (FdInfo->OutFileName, OutFile);\r
-\r
-  for (Index = 0; Index < NumFvFiles; Index++) {\r
-    Status = GenerateFvImage ((*FvInfo)->FvInfoFile);\r
-\r
-    if (Status != EFI_SUCCESS) {\r
-      CleanUpMemory ();\r
-      return Status;\r
-    }\r
-\r
-    FvInfo++;\r
-  }\r
-\r
-  FvInfo = OrgFvInfoPtr;\r
-\r
-  //\r
-  // Sort the Firmware Volume informations. Firmware Volume with lower\r
-  // base addresses will be processed first and hiher base address one\r
-  // will be processed later.\r
-  //\r
-  qsort ((VOID *) FvInfo, NumFvFiles, sizeof (FVINFO *), CompareItems);\r
-\r
-  LastAddress = (*FvInfo)->FvBaseAddress;\r
-\r
-  for (Index = 0; Index < NumFvFiles; Index++) {\r
-    Status = BuildFirmwareDeviceBinaryFromFwVolumes (\r
-              (*FvInfo)->FvBaseAddress,\r
-              (*FvInfo)->FvFile,\r
-              FdInfo->OutFileName\r
-              );\r
-    if (Status != EFI_SUCCESS) {\r
-      CleanUpMemory ();\r
-      return Status;\r
-    }\r
-\r
-    FvInfo++;\r
-  }\r
-  //\r
-  // Check if any space left after copying data from all Firmware Volumes\r
-  // If yes, then fill those location with PadValue.\r
-  //\r
-  if ((FdInfo->FdBaseAddress + Size) > LastAddress) {\r
-\r
-    PadSize = (UINTN) ((FdInfo->FdBaseAddress + FdInfo->FdSize) - LastAddress);\r
-    Buffer  = malloc (PadSize);\r
-\r
-    if (Buffer == NULL) {\r
-      CleanUpMemory ();\r
-      return EFI_OUT_OF_RESOURCES;\r
-    }\r
-\r
-    for (Index = 0; Index < PadSize; Index++) {\r
-      *Buffer = FdInfo->PadValue;\r
-      Buffer++;\r
-    }\r
-\r
-    Buffer -= PadSize;\r
-\r
-    Fp = fopen (OutFile, "a+b");\r
-\r
-    if (Fp == NULL) {\r
-      printf ("\nERROR:Opening file %s", OutFile);\r
-      CleanUpMemory ();\r
-      return EFI_ABORTED;\r
-    }\r
-\r
-    FileSize = _filelength (fileno (Fp));\r
-    fseek (Fp, FileSize, SEEK_SET);\r
-    NumByte = fwrite (Buffer, sizeof (UINT8), PadSize, Fp);\r
-\r
-    if (Buffer) {\r
-      free (Buffer);\r
-    }\r
-\r
-    fclose (Fp);\r
-\r
-    if (NumByte != (sizeof (UINT8) * PadSize)) {\r
-      printf ("\nERROR: Copying data from buffer to File %s ", OutFile);\r
-      CleanUpMemory ();\r
-      return EFI_ABORTED;\r
-    }\r
-  }\r
-  //\r
-  // Clean up all the memory which has been allocated so far.\r
-  //\r
-  CleanUpMemory ();\r
-  return EFI_SUCCESS;\r
-}\r
diff --git a/Tools/Source/TianoTools/GenFdImage/GenFdImageExe.c b/Tools/Source/TianoTools/GenFdImage/GenFdImageExe.c
deleted file mode 100644 (file)
index 9c56d06..0000000
+++ /dev/null
@@ -1,330 +0,0 @@
-/*++\r
-\r
-Copyright (c)  1999 - 2002 Intel Corporation. All rights reserved\r
-This software and associated documentation (if any) is furnished\r
-under a license and may only be used or copied in accordance\r
-with the terms of the license. Except as permitted by such\r
-license, no part of this software or documentation may be\r
-reproduced, stored in a retrieval system, or transmitted in any\r
-form or by any means without the express written consent of\r
-Intel Corporation.\r
-\r
-\r
-Module Name:\r
-\r
-  GenFdImageExe.c\r
-\r
-Abstract:\r
-\r
-  This contains all code necessary to build the GenFdImage.exe utility.\r
-  This utility relies heavily on the GenFdImage Lib.  Definitions for both     \r
-  can be found in the GenFdImage Utility Specification, review draft.\r
-\r
---*/\r
-\r
-//\r
-// Coded to EFI 2.0 Coding Standards\r
-//\r
-//\r
-// Include files\r
-//\r
-#include "GenFdImage.h"\r
-#include "GenFdImageExe.h"\r
-\r
-VOID\r
-PrintUtilityInfo (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Displays the standard utility information to SDTOUT\r
-\r
-Arguments:\r
-\r
-  None\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
-{\r
-  printf (\r
-    "%s, EFI 2.0 Firmware Device Image Generation Utility. ""Version %i.%i, %s.\n\n",\r
-    UTILITY_NAME,\r
-    UTILITY_MAJOR_VERSION,\r
-    UTILITY_MINOR_VERSION,\r
-    UTILITY_DATE\r
-    );\r
-}\r
-\r
-VOID\r
-PrintUsage (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Displays the utility usage syntax to STDOUT\r
-\r
-Arguments:\r
-\r
-  None\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
-{\r
-  printf (\r
-    "Usage: %s -B BaseAddress -S Size -F FillByte"" [-I FvInfFileName] -O OutputFileName \n",\r
-    UTILITY_NAME\r
-    );\r
-  printf ("  Where:\n");\r
-  printf ("\tBaseAddress is the starting address of the FD Image\n\n");\r
-  printf ("\tSize is the size of the FD Image.\n\n");\r
-  printf ("\tFillByte is the desired value of free space in the Image\n\n");\r
-  printf ("\tFvInfFileName is the name of an FV Image description file.\n\n");\r
-  printf ("\tOutputFileName is the desired output file name.\n\n");\r
-}\r
-\r
-EFI_STATUS\r
-main (\r
-  IN INTN   argc,\r
-  IN CHAR8  **argv\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This utility uses GenFdImage.lib to build a Firmware Device Image\r
-  which will include several Firmware Volume Images.\r
-\r
-Arguments:\r
-\r
-  Base Address      Base Address of the firmware volume..\r
-  Size              Size of the Firmware Volume\r
-  FillByte          The byte value which would be needed to pad\r
-                    between various Firmware Volumes\r
-  FvInfFile         Fv inf file\r
-  OutputFileName    The name of output file which would be created\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS            No error conditions detected.\r
-  EFI_INVALID_PARAMETER  One or more of the input parameters is invalid.\r
-  EFI_OUT_OF_RESOURCES   A resource required by the utility was unavailable.  \r
-                         Most commonly this will be memory allocation or \r
-                         file creation.\r
-  EFI_LOAD_ERROR         GenFvImage.lib could not be loaded.\r
-  EFI_ABORTED            Error executing the GenFvImage lib.\r
-\r
---*/\r
-// GC_TODO:    argc - add argument and description to function comment\r
-// GC_TODO:    argv - add argument and description to function comment\r
-{\r
-  UINTN       Index;\r
-  UINTN       FvFilesCount;\r
-\r
-  UINT8       i;\r
-\r
-  UINT64      StartAddress;\r
-  UINT64      Size;\r
-  UINT64      FillByteVal;\r
-\r
-  CHAR8       **FvInfFileList;\r
-  CHAR8       **OrgFvInfFileList;\r
-  CHAR8       OutputFileName[_MAX_PATH];\r
-\r
-  EFI_STATUS  Status;\r
-\r
-  INTN        arg_counter;\r
-\r
-  //\r
-  //  Echo for makefile debug\r
-  //\r
-  printf ("\n\n");\r
-  for (arg_counter = 0; arg_counter < argc; arg_counter++) {\r
-    printf ("%s ", argv[arg_counter]);\r
-  }\r
-\r
-  printf ("\n\n");\r
-\r
-  //\r
-  // Display utility information\r
-  //\r
-  PrintUtilityInfo ();\r
-\r
-  //\r
-  // Verify the correct number of arguments\r
-  //\r
-  if (argc < MIN_ARGS) {\r
-    printf ("ERROR: missing 1 or more input arguments.\n\n");\r
-    PrintUsage ();\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-  //\r
-  // Initialize variables\r
-  //\r
-  StartAddress  = 0;\r
-  Size          = 0;\r
-  FillByteVal   = 0;\r
-  FvFilesCount  = 0;\r
-\r
-  for (i = 1; i < argc; i++) {\r
-    if (stricmp (argv[i], "-I") == 0) {\r
-      FvFilesCount++;\r
-    }\r
-  }\r
-\r
-  FvInfFileList = malloc (sizeof (UINTN) * (FvFilesCount + 1));\r
-  if (FvInfFileList == NULL) {\r
-    printf ("ERROR: allocating memory for FvInfFileList in -main- function.\n");\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-\r
-  memset (FvInfFileList, 0, sizeof (UINTN) * (FvFilesCount + 1));\r
-\r
-  OrgFvInfFileList = FvInfFileList;\r
-\r
-  for (Index = 0; Index < FvFilesCount; Index++) {\r
-    *FvInfFileList = malloc (_MAX_PATH);\r
-    memset (*FvInfFileList, 0, _MAX_PATH);\r
-    FvInfFileList++;\r
-  }\r
-\r
-  strcpy (OutputFileName, "");\r
-\r
-  //\r
-  // Parse the command line arguments\r
-  //\r
-  FvInfFileList = OrgFvInfFileList;\r
-\r
-  for (i = 1; i < argc; i += 2) {\r
-    //\r
-    // Make sure argument pair begin with - or /\r
-    //\r
-    if (argv[i][0] != '-' && argv[i][0] != '/') {\r
-      PrintUsage ();\r
-      printf ("ERROR: Argument pair must begin with \"-\" or \"/\"\n");\r
-      return EFI_INVALID_PARAMETER;\r
-    }\r
-    //\r
-    // Make sure argument specifier is only one letter\r
-    //\r
-    if (argv[i][2] != 0) {\r
-      PrintUsage ();\r
-      printf ("ERROR: Unrecognized argument \"%s\".\n", argv[i]);\r
-      return EFI_INVALID_PARAMETER;\r
-    }\r
-    //\r
-    // Determine argument to read\r
-    //\r
-    switch (argv[i][1]) {\r
-\r
-    case 'I':\r
-    case 'i':\r
-      if ((FvInfFileList != NULL) && (strlen (*FvInfFileList) == 0)) {\r
-        strcpy (*FvInfFileList, argv[i + 1]);\r
-        FvInfFileList++;\r
-      } else {\r
-        printf ("ERROR: FvInfFile Name is more than specifed.\n");\r
-        return EFI_INVALID_PARAMETER;\r
-      }\r
-      break;\r
-\r
-    case 'O':\r
-    case 'o':\r
-      if (strlen (OutputFileName) == 0) {\r
-        strcpy (OutputFileName, argv[i + 1]);\r
-      } else {\r
-        PrintUsage ();\r
-        printf ("ERROR: OutputFileName may only be specified once.\n");\r
-        return EFI_INVALID_PARAMETER;\r
-      }\r
-      break;\r
-\r
-    case 'B':\r
-    case 'b':\r
-      Status = AsciiStringToUint64 (argv[i + 1], FALSE, &StartAddress);\r
-      if (Status != EFI_SUCCESS) {\r
-        printf ("\nERROR: Bad FD Image start address specified");\r
-        return EFI_INVALID_PARAMETER;\r
-      }\r
-      break;\r
-\r
-    case 'S':\r
-    case 's':\r
-      Status = AsciiStringToUint64 (argv[i + 1], FALSE, &Size);\r
-      if (Status != EFI_SUCCESS) {\r
-        printf ("\nERROR: Bad FD Image size specified");\r
-        return EFI_INVALID_PARAMETER;\r
-      }\r
-      break;\r
-\r
-    case 'F':\r
-    case 'f':\r
-      Status = AsciiStringToUint64 (argv[i + 1], FALSE, &FillByteVal);\r
-      if (Status != EFI_SUCCESS) {\r
-        printf ("\nERROR: Not a recognized Fill Byte value");\r
-        return EFI_INVALID_PARAMETER;\r
-      }\r
-      break;\r
-\r
-    default:\r
-      PrintUsage ();\r
-      printf ("ERROR: Unrecognized argument \"%s\".\n", argv[i]);\r
-      return EFI_INVALID_PARAMETER;\r
-      break;\r
-    }\r
-  }\r
-  //\r
-  // Call the GenFdImage Lib\r
-  //\r
-  FvInfFileList = OrgFvInfFileList;\r
-\r
-  Status = GenerateFdImage (\r
-            StartAddress,\r
-            Size,\r
-            (UINT8) FillByteVal,\r
-            OutputFileName,\r
-            FvInfFileList\r
-            );\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    switch (Status) {\r
-\r
-    case EFI_INVALID_PARAMETER:\r
-      printf ("\nERROR: Invalid parameter passed to GenFdImage lib.\n");\r
-      break;\r
-\r
-    case EFI_ABORTED:\r
-      printf ("\nERROR: Error detected while creating the file image.\n");\r
-      break;\r
-\r
-    case EFI_OUT_OF_RESOURCES:\r
-      printf ("\nERROR: GenFdImage Lib could not allocate required resources.\n");\r
-      break;\r
-\r
-    case EFI_VOLUME_CORRUPTED:\r
-      printf ("\nERROR: No base address was specified \n");\r
-      break;\r
-\r
-    case EFI_LOAD_ERROR:\r
-      printf ("\nERROR: An error occurred loading one of the required support Lib.\n");\r
-      break;\r
-\r
-    default:\r
-      printf ("\nERROR: GenFdImage lib returned unknown status %X.\n", Status);\r
-      break;\r
-    }\r
-\r
-    return Status;\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
diff --git a/Tools/Source/TianoTools/GenFdImage/GenFdImageExe.h b/Tools/Source/TianoTools/GenFdImage/GenFdImageExe.h
deleted file mode 100644 (file)
index e07cb23..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*++\r
-\r
-Copyright (c)  1999 - 2002 Intel Corporation. All rights reserved\r
-This software and associated documentation (if any) is furnished\r
-under a license and may only be used or copied in accordance\r
-with the terms of the license. Except as permitted by such\r
-license, no part of this software or documentation may be\r
-reproduced, stored in a retrieval system, or transmitted in any\r
-form or by any means without the express written consent of\r
-Intel Corporation.\r
-\r
-\r
-Module Name:\r
-\r
-  GenFdImageExe.h\r
-\r
-Abstract:\r
-\r
-  Definitions for the Boot Strap File Image generation utility.\r
-\r
---*/\r
-\r
-#ifndef _EFI_GEN_FD_IMAGE_EXE_H\r
-#define _EFI_GEN_FD_IMAGE_EXE_H\r
-\r
-//\r
-// Utility Name\r
-//\r
-#define UTILITY_NAME  "GenFdImage"\r
-\r
-//\r
-// Utility version information\r
-//\r
-#define UTILITY_MAJOR_VERSION 0\r
-#define UTILITY_MINOR_VERSION 0\r
-#define UTILITY_DATE          __DATE__\r
-\r
-//\r
-// The maximum number of arguments accepted from the command line.\r
-//\r
-#define MIN_ARGS  10\r
-\r
-//\r
-// The function that displays general utility information\r
-//\r
-VOID\r
-PrintUtilityInfo (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  None\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
-\r
---*/\r
-;\r
-\r
-//\r
-// The function that displays the utility usage message.\r
-//\r
-VOID\r
-PrintUsage (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  None\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
-\r
---*/\r
-;\r
-\r
-#endif\r
diff --git a/Tools/Source/TianoTools/GenFdImage/GenFdImageLib.c b/Tools/Source/TianoTools/GenFdImage/GenFdImageLib.c
deleted file mode 100644 (file)
index 39698d9..0000000
+++ /dev/null
@@ -1,848 +0,0 @@
-/*++\r
-\r
-Copyright (c)  1999 - 2002 Intel Corporation. All rights reserved\r
-This software and associated documentation (if any) is furnished\r
-under a license and may only be used or copied in accordance\r
-with the terms of the license. Except as permitted by such\r
-license, no part of this software or documentation may be\r
-reproduced, stored in a retrieval system, or transmitted in any\r
-form or by any means without the express written consent of\r
-Intel Corporation.\r
-\r
-\r
-Module Name:\r
-  \r
-  GenFdImageLib.C\r
-\r
-Abstract:\r
-\r
-  This file contains the functions required to generate \r
-  the Firmware Device\r
-\r
---*/\r
-\r
-//\r
-// Coded to EFI 2.0 Coding Standards\r
-//\r
-//\r
-// Include file in build\r
-//\r
-#include "GenFdImage.h"\r
-\r
-//\r
-// Global declarations\r
-//\r
-UINTN         ValidLineNum  = 0;\r
-UINTN         NumFvFiles    = 0;\r
-\r
-static UINT64 LastAddress   = 0;\r
-\r
-CHAR8         **TokenStr;\r
-CHAR8         **OrgStrTokPtr;\r
-\r
-FDINFO        *FdInfo;\r
-FDINFO        *OrgFdInfoPtr;\r
-\r
-FVINFO        **FvInfo;\r
-FVINFO        **OrgFvInfoPtr;\r
-\r
-//\r
-// Internal Functions\r
-//\r
-INTN\r
-CompareItems (\r
-  IN const VOID  *Arg1,\r
-  IN const VOID  *Arg2\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-    This function is used by qsort to sort the Fv list based on FvBaseAddress  \r
-\r
-Arguments:\r
-\r
-    Arg1\r
-    Arg2\r
-\r
-Returns:\r
-\r
-    None\r
-\r
---*/\r
-// GC_TODO:    Arg1 - add argument and description to function comment\r
-// GC_TODO:    Arg2 - add argument and description to function comment\r
-{\r
-  if ((*(FVINFO **) Arg1)->FvBaseAddress > (*(FVINFO **) Arg2)->FvBaseAddress) {\r
-    return 1;\r
-  } else if ((*(FVINFO **) Arg1)->FvBaseAddress < (*(FVINFO **) Arg2)->FvBaseAddress) {\r
-    return -1;\r
-  } else {\r
-    return 0;\r
-  }\r
-}\r
-\r
-VOID\r
-BuildTokenList (\r
-  IN CHAR8  *Token\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-    This function builds the token list in an array which will be parsed later\r
-\r
-Arguments:\r
-\r
-    Token    String,\r
-\r
-Returns:\r
-\r
-    None\r
-\r
---*/\r
-{\r
-  strcpy (*TokenStr, Token);\r
-  TokenStr++;\r
-}\r
-\r
-VOID\r
-TrimLine (\r
-  IN CHAR8  *Line\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This function cleans up the line by removing all whitespace and \r
-  comments.\r
-\r
-Arguments:\r
-\r
-  Line    String,\r
-\r
-Returns:\r
-\r
-    None\r
-\r
---*/\r
-{\r
-  CHAR8 TmpLine[FILE_NAME_SIZE];\r
-  CHAR8 c;\r
-  CHAR8 *Ptr0;\r
-\r
-  UINTN i;\r
-  UINTN j;\r
-\r
-  //\r
-  // Change '#' to '//' for Comment style\r
-  //\r
-  //  if((Ptr0=strchr(Line, '#')) != NULL) {\r
-  //\r
-  if ((Ptr0 = strstr (Line, "//")) != NULL) {\r
-    Line[Ptr0 - Line] = 0;\r
-  }\r
-\r
-  i = 0;\r
-  j = 0;\r
-  while ((c = Line[i]) != 0) {\r
-    if ((c != ' ') && (c != '\t') && (c != '\n')) {\r
-      TmpLine[j++] = c;\r
-    }\r
-\r
-    i++;\r
-  }\r
-\r
-  TmpLine[j] = 0;\r
-  strcpy (Line, TmpLine);\r
-}\r
-\r
-VOID\r
-ValidLineCount (\r
-  IN FILE  *Fp\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This function calculates number of valid lines in a input file.\r
-  \r
-Arguments:\r
-\r
-  Fp     Pointer to a file handle which has been opened.\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
-{\r
-  CHAR8 Buff[FILE_NAME_SIZE];\r
-\r
-  while (fgets (Buff, sizeof (Buff), Fp)) {\r
-    TrimLine (Buff);\r
-    if (Buff[0] == 0) {\r
-      continue;\r
-    }\r
-\r
-    ValidLineNum++;\r
-  }\r
-}\r
-\r
-VOID\r
-ParseInputFile (\r
-  IN FILE  *Fp\r
-  )\r
-/*++\r
-  \r
-Routine Description:\r
-\r
-  This function parses the input file and tokenizes the string\r
-  \r
-Arguments:\r
-\r
-  Fp     Pointer to a file handle which has been opened.\r
-  \r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
-{\r
-  CHAR8 *Token;\r
-  CHAR8 Buff[FILE_NAME_SIZE];\r
-  CHAR8 OrgLine[FILE_NAME_SIZE];\r
-  CHAR8 Str[FILE_NAME_SIZE];\r
-  CHAR8 Delimit[] = "=";\r
-\r
-  while (fgets (Buff, sizeof (Buff), Fp) != NULL) {\r
-    strcpy (OrgLine, Buff);\r
-    TrimLine (Buff);\r
-\r
-    if (Buff[0] == 0) {\r
-      continue;\r
-    }\r
-\r
-    Token = strtok (Buff, Delimit);\r
-\r
-    while (Token != NULL) {\r
-      strcpy (Str, Token);\r
-      BuildTokenList (Str);\r
-      Token = strtok (NULL, Delimit);\r
-    }\r
-  }\r
-}\r
-\r
-EFI_STATUS\r
-InitializeComps (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This function intializes the relevant global variable \r
-  used to store the information retrieved from the INF file.\r
-  \r
-Arguments:\r
-\r
-  None\r
-\r
-Returns:\r
-\r
-  EFI_STATUS\r
-\r
---*/\r
-// GC_TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment\r
-// GC_TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment\r
-// GC_TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
-{\r
-  UINTN Index;\r
-\r
-  FdInfo = malloc (sizeof (FDINFO));\r
-\r
-  if (FdInfo == NULL) {\r
-    printf ("ERROR: allocating memory (struct FDINFO) in"" function InitializeComps.\n");\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-\r
-  OrgFdInfoPtr  = FdInfo;\r
-\r
-  FvInfo        = malloc (sizeof (INTN) * NumFvFiles);\r
-\r
-  if (FvInfo == NULL) {\r
-    printf ("ERROR: allocating memory (INTN * NumFvFiles) in"" function InitializeComps.\n");\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-\r
-  OrgFvInfoPtr = FvInfo;\r
-\r
-  for (Index = 0; Index < NumFvFiles; Index++) {\r
-    *FvInfo = malloc (sizeof (FVINFO));\r
-\r
-    if (*FvInfo == NULL) {\r
-      printf ("ERROR: allocating memory (FVINFO) in"" function InitializeComps.\n");\r
-      return EFI_OUT_OF_RESOURCES;\r
-    }\r
-\r
-    memset (*FvInfo, 0, sizeof (FVINFO));\r
-    FvInfo++;\r
-  }\r
-\r
-  FvInfo = OrgFvInfoPtr;\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-VOID\r
-InitializeInFileInfo (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This function intializes the relevant global variable \r
-  used to store the information retrieved from the INF file.\r
-\r
-Arguments:\r
-\r
-  None\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
-{\r
-  UINTN   OptionFlag;\r
-\r
-  UINT64  StringValue;\r
-\r
-  OptionFlag  = 0;\r
-  TokenStr    = OrgStrTokPtr;\r
-\r
-  while (*TokenStr != NULL) {\r
-    if (stricmp (*TokenStr, "[options]") == 0) {\r
-      OptionFlag = 1;\r
-    }\r
-\r
-    if (OptionFlag) {\r
-      if (stricmp (*TokenStr, "EFI_FV_BASE_ADDRESS") == 0) {\r
-        *TokenStr++;\r
-        if (AsciiStringToUint64 (\r
-              *TokenStr,\r
-              FALSE,\r
-              &StringValue\r
-              ) != EFI_SUCCESS) {\r
-          printf ("\nERROR: Cannot determine the FV base address.");\r
-          return ;\r
-        }\r
-        (*FvInfo)->FvBaseAddress = StringValue;\r
-      } else if (stricmp (*TokenStr, "EFI_FV_FILE_NAME") == 0) {\r
-        *TokenStr++;\r
-        strcpy ((*FvInfo)->FvFile, *TokenStr);\r
-      }\r
-    }\r
-\r
-    TokenStr++;\r
-  }\r
-}\r
-\r
-EFI_STATUS\r
-GetFvRelatedInfoFromInfFile (\r
-  IN CHAR8  *FileName\r
-  )\r
-/*++\r
-  \r
-Routine Description:\r
-\r
-  This function reads the input file, parses it and create a list of tokens\r
-  which are parsed and used, to intialize the data related to the Firmware \r
-  Volume.\r
-  \r
-Arguments:\r
-\r
-  FileName  FileName which needed to be read to parse data\r
-\r
-Returns:\r
-\r
-  EFI_STATUS\r
-    \r
---*/\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
-{\r
-  FILE  *Fp;\r
-\r
-  UINTN Index;\r
-\r
-  Fp = fopen (FileName, "r");\r
-\r
-  if (Fp == NULL) {\r
-    printf ("Error in opening %s file\n", FileName);\r
-    return EFI_ABORTED;\r
-  }\r
-\r
-  ValidLineCount (Fp);\r
-\r
-  if (ValidLineNum == 0) {\r
-    printf ("\nFile doesn't contain any valid informations");\r
-    return EFI_ABORTED;\r
-  }\r
-\r
-  TokenStr = (CHAR8 **) malloc (sizeof (UINTN) * (2 * ValidLineNum));\r
-  memset (TokenStr, 0, sizeof (UINTN) * (2 * ValidLineNum));\r
-  OrgStrTokPtr = TokenStr;\r
-\r
-  for (Index = 0; Index < (2 * ValidLineNum); Index++) {\r
-    *TokenStr = (CHAR8 *) malloc (sizeof (CHAR8) * FILE_NAME_SIZE);\r
-    memset (*TokenStr, 0, FILE_NAME_SIZE);\r
-    TokenStr++;\r
-  }\r
-\r
-  *TokenStr = NULL;\r
-  TokenStr  = OrgStrTokPtr;\r
-  fseek (Fp, 0L, SEEK_SET);\r
-\r
-  ParseInputFile (Fp);\r
-  InitializeInFileInfo ();\r
-\r
-  if (Fp) {\r
-    fclose (Fp);\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-EFI_STATUS\r
-WriteFwBinary (\r
-  IN CHAR8   *FileName,\r
-  IN UINT64  StartAddress,\r
-  IN UINT64  Size,\r
-  IN UINT8   *Buffer\r
-  )\r
-/*++\r
-  \r
-Routine Description:\r
-\r
-  This function reads the input file, parses it and creates a list of tokens\r
-  which are parsed and used to intialize the data related to the Firmware \r
-  Volume.\r
-  \r
-Arguments:\r
-\r
-  FileName        FileName which needed to be read to parse data\r
-  StartAddress    This will set the file position.\r
-  Size            Size in bytes needed to be written\r
-  Buffer          Buffer needed to e written\r
-\r
-Returns:\r
-\r
-  EFI_STATUS\r
-    \r
---*/\r
-// GC_TODO:    EFI_INVALID_PARAMETER - add return value to function comment\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
-{\r
-  FILE  *Fp;\r
-\r
-  UINTN NumByte;\r
-\r
-  Fp = fopen (FileName, "a+b");\r
-\r
-  if (Fp == NULL) {\r
-    printf ("\nERROR:Error in opening file %s ", FileName);\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  fseek (Fp, (UINTN) StartAddress, SEEK_SET);\r
-  NumByte = fwrite ((VOID *) Buffer, sizeof (UINT8), (UINTN) Size, Fp);\r
-\r
-  //\r
-  // Check to ensure that buffer has been copied successfully\r
-  //\r
-  if (NumByte != Size) {\r
-    printf ("\nERROR: Error in copying the buffer into file");\r
-    return EFI_ABORTED;\r
-  }\r
-\r
-  if (Fp) {\r
-    fclose (Fp);\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-EFI_STATUS\r
-BuildFirmwareDeviceBinaryFromFwVolumes (\r
-  IN UINT64  FvBaseAddress,\r
-  IN CHAR8   *FvFileName,\r
-  IN CHAR8   *FdFileName\r
-  )\r
-/*++\r
-  \r
-Routine Description:\r
-\r
-  This function reads the input file, parses it and creates a list of tokens\r
-  which are parsed and used to intialize the data related to the Firmware \r
-  Volume.\r
-  \r
-Arguments:\r
-\r
-  FvBaseAddress   Base Address. This info is retrieved from INF file\r
-  FvFileName      InputFileName\r
-  FdFileName      Output File Name\r
-\r
-Returns:\r
-\r
-  EFI_STATUS\r
-    \r
---*/\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
-{\r
-  FILE          *Fp;\r
-\r
-  UINT64        FileSize;\r
-  UINT64        NumByteRead;\r
-  UINT64        PadByteSize;\r
-  UINT64        BaseAddress;\r
-\r
-  UINTN         Index;\r
-\r
-  UINT8         *Buffer;\r
-\r
-  EFI_STATUS    Status;\r
-\r
-  static UINT64 StartAddress  = 0;\r
-\r
-  Fp                          = fopen (FvFileName, "r+b");\r
-\r
-  if (Fp == NULL) {\r
-    printf ("\nERROR:Error in opening file %s", FvFileName);\r
-    return EFI_ABORTED;\r
-  }\r
-\r
-  BaseAddress = FdInfo->FdBaseAddress;\r
-\r
-  //\r
-  // Check if Base Address of Firmware Volume falls below the Base Address\r
-  // Firmware Device, if yes, then abort this process.\r
-  //\r
-  if (FvBaseAddress < BaseAddress) {\r
-    printf ("\nERROR: Firmware Volume Base Address falls below Firmware ""Device Address.\n");\r
-    return EFI_ABORTED;\r
-  }\r
-  //\r
-  // Check if there are any holes between two Firmware Volumes. If any holes\r
-  // exist, fill the hole with PadByted data.\r
-  //\r
-  if (FvBaseAddress > LastAddress) {\r
-    PadByteSize = (FvBaseAddress - LastAddress);\r
-    Buffer      = malloc ((UINTN) PadByteSize);\r
-    if (Buffer == NULL) {\r
-      printf ("ERROR: allocating (Buffer) memory in"" function BuildFirmwareDeviceBinaryFromFwVolumes.\n");\r
-      return EFI_OUT_OF_RESOURCES;\r
-    }\r
-\r
-    for (Index = 0; Index < PadByteSize; Index++) {\r
-      *Buffer = FdInfo->PadValue;\r
-      Buffer++;\r
-    }\r
-\r
-    Buffer -= PadByteSize;\r
-    Status = WriteFwBinary (\r
-              FdFileName,\r
-              StartAddress,\r
-              (UINT64) PadByteSize,\r
-              Buffer\r
-              );\r
-\r
-    if (Buffer) {\r
-      free (Buffer);\r
-    }\r
-\r
-    if (Status != EFI_SUCCESS) {\r
-      printf ("\nERROR: Error in writing the binary image to file");\r
-      return Status;\r
-    }\r
-\r
-    StartAddress += PadByteSize;\r
-    LastAddress += PadByteSize;\r
-  }\r
-  //\r
-  // Proceed with next Firmware Volume updates\r
-  //\r
-  FileSize = _filelength (fileno (Fp));\r
-\r
-  if ((FvBaseAddress + FileSize) > (FdInfo->FdBaseAddress + FdInfo->FdSize)) {\r
-    printf (\r
-      "\nERROR:Unable to update Firmware Device. File %s is larger than \\r
-                                  available space.",\r
-      FvFileName\r
-      );\r
-    if (Fp) {\r
-      fclose (Fp);\r
-    }\r
-\r
-    return EFI_ABORTED;\r
-  }\r
-\r
-  Buffer = malloc ((UINTN) FileSize);\r
-\r
-  if (Buffer == NULL) {\r
-    printf ("Error in allocating buffer to read specific file\n");\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-\r
-  NumByteRead = fread ((VOID *) Buffer, sizeof (UINT8), (UINTN) FileSize, Fp);\r
-\r
-  Status      = WriteFwBinary (FdFileName, StartAddress, FileSize, Buffer);\r
-\r
-  if (Buffer) {\r
-    free ((VOID *) Buffer);\r
-  }\r
-\r
-  if (Fp) {\r
-    fclose (Fp);\r
-  }\r
-\r
-  if (Status != EFI_SUCCESS) {\r
-    printf ("\nERROR: Error in writing the binary image to file");\r
-    return Status;\r
-  }\r
-\r
-  StartAddress += NumByteRead;\r
-  LastAddress += FileSize;\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-VOID\r
-CleanUpMemory (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This function cleans up any allocated buffer\r
-  \r
-Arguments:\r
-\r
-  None\r
-\r
-Returns:\r
-  \r
-  None\r
-\r
---*/\r
-{\r
-  UINTN Index;\r
-\r
-  if (FdInfo) {\r
-    free (FdInfo);\r
-  }\r
-\r
-  FvInfo = OrgFvInfoPtr;\r
-\r
-  if (FvInfo) {\r
-    for (Index = 0; Index < NumFvFiles; Index++) {\r
-      if (*FvInfo) {\r
-        free (*FvInfo);\r
-      }\r
-\r
-      FvInfo++;\r
-    }\r
-\r
-    FvInfo = OrgFvInfoPtr;\r
-    free (FvInfo);\r
-  }\r
-}\r
-\r
-EFI_STATUS\r
-GenerateFdImage (\r
-  IN UINT64  BaseAddress,\r
-  IN UINT64  Size,\r
-  IN UINT8   PadByte,\r
-  IN CHAR8   *OutFile,\r
-  IN CHAR8   **FileList\r
-  )\r
-/*++\r
-  \r
-Routine Description:\r
-\r
-  This function reads the input file, parses it and creates a list of tokens\r
-  which are parsed and used to intialize the data related to the Firmware \r
-  Volume.\r
-  \r
-Arguments:\r
-\r
-  BaseAddress   Base Address for this Firmware Device\r
-  Size,         Total Size of the Firmware Device\r
-  PadByte       Pad byte data\r
-  OutFile       Output File Name\r
-  FileList      File List pointer to INF file names.\r
-\r
-Returns:\r
-\r
-  EFI_STATUS\r
-    \r
---*/\r
-// GC_TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_ABORTED - add return value to function comment\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
-{\r
-  EFI_STATUS  Status;\r
-\r
-  UINTN       Index;\r
-  UINTN       PadSize;\r
-  UINTN       FileSize;\r
-  UINTN       NumByte;\r
-\r
-  CHAR8       **InFile;\r
-\r
-  FILE        *Fp;\r
-\r
-  UINT8       *Buffer;\r
-\r
-  //\r
-  // If any previous Firmware Device existed,\r
-  // make it to 0 bytes\r
-  //\r
-  if ((Fp = fopen (OutFile, "w")) != NULL) {\r
-    fclose (Fp);\r
-  }\r
-\r
-  InFile = FileList;\r
-\r
-  while (*InFile != NULL) {\r
-    NumFvFiles++;\r
-    InFile++;\r
-  }\r
-\r
-  InitializeComps ();\r
-\r
-  //\r
-  // Restore the orginal pointers\r
-  //\r
-  FvInfo  = OrgFvInfoPtr;\r
-  InFile  = FileList;\r
-\r
-  while (*InFile != NULL) {\r
-    strcpy ((*FvInfo)->FvInfoFile, *InFile);\r
-    Status = GetFvRelatedInfoFromInfFile (*InFile);\r
-\r
-    if (Status != EFI_SUCCESS) {\r
-      printf ("\nERROR: Error occurred in processsing INF file");\r
-      CleanUpMemory ();\r
-      return Status;\r
-    }\r
-\r
-    InFile++;\r
-    FvInfo++;\r
-  }\r
-\r
-  FdInfo->FdSize        = Size;\r
-  FdInfo->FdBaseAddress = BaseAddress;\r
-  FdInfo->PadValue      = PadByte;\r
-  FvInfo                = OrgFvInfoPtr;\r
-  strcpy (FdInfo->OutFileName, OutFile);\r
-\r
-  for (Index = 0; Index < NumFvFiles; Index++) {\r
-    Status = GenerateFvImage ((*FvInfo)->FvInfoFile);\r
-\r
-    if (Status != EFI_SUCCESS) {\r
-      CleanUpMemory ();\r
-      return Status;\r
-    }\r
-\r
-    FvInfo++;\r
-  }\r
-\r
-  FvInfo = OrgFvInfoPtr;\r
-\r
-  //\r
-  // Sort the Firmware Volume information. Firmware Volume with lower\r
-  // base addresses will be processed first and higher base address one\r
-  // will be processed later.\r
-  //\r
-  qsort ((VOID *) FvInfo, NumFvFiles, sizeof (FVINFO *), CompareItems);\r
-\r
-  LastAddress = (*FvInfo)->FvBaseAddress;\r
-\r
-  for (Index = 0; Index < NumFvFiles; Index++) {\r
-    Status = BuildFirmwareDeviceBinaryFromFwVolumes (\r
-              (*FvInfo)->FvBaseAddress,\r
-              (*FvInfo)->FvFile,\r
-              FdInfo->OutFileName\r
-              );\r
-    if (Status != EFI_SUCCESS) {\r
-      CleanUpMemory ();\r
-      return Status;\r
-    }\r
-\r
-    FvInfo++;\r
-  }\r
-  //\r
-  // Check if any space left after copying data from all Firmware Volumes\r
-  // If yes, then fill those location with PadValue.\r
-  //\r
-  if ((FdInfo->FdBaseAddress + Size) > LastAddress) {\r
-\r
-    PadSize = (UINTN) ((FdInfo->FdBaseAddress + FdInfo->FdSize) - LastAddress);\r
-    Buffer  = malloc (PadSize);\r
-\r
-    if (Buffer == NULL) {\r
-      printf ("\nERROR: allocating PadSize memory in function GenerateFdImage.\n");\r
-      CleanUpMemory ();\r
-      return EFI_OUT_OF_RESOURCES;\r
-    }\r
-\r
-    for (Index = 0; Index < PadSize; Index++) {\r
-      *Buffer = FdInfo->PadValue;\r
-      Buffer++;\r
-    }\r
-\r
-    Buffer -= PadSize;\r
-\r
-    Fp = fopen (OutFile, "a+b");\r
-\r
-    if (Fp == NULL) {\r
-      printf ("\nERROR:Opening file %s", OutFile);\r
-      CleanUpMemory ();\r
-      return EFI_ABORTED;\r
-    }\r
-\r
-    FileSize = _filelength (fileno (Fp));\r
-    fseek (Fp, FileSize, SEEK_SET);\r
-    NumByte = fwrite (Buffer, sizeof (UINT8), PadSize, Fp);\r
-\r
-    if (Buffer) {\r
-      free (Buffer);\r
-    }\r
-\r
-    fclose (Fp);\r
-\r
-    if (NumByte != (sizeof (UINT8) * PadSize)) {\r
-      printf ("\nERROR: Copying data from buffer to File %s ", OutFile);\r
-      CleanUpMemory ();\r
-      return EFI_ABORTED;\r
-    }\r
-  }\r
-  //\r
-  // Clean up all the memory which has been allocated so far.\r
-  //\r
-  CleanUpMemory ();\r
-\r
-  return EFI_SUCCESS;\r
-}\r