+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2004, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- GuidList.c \r
-\r
-Abstract:\r
-\r
- Utility to create a GUID-to-name listing file that can\r
- be used by other utilities. Basic operation is to take the\r
- table of name+GUIDs that we have compiled into this utility,\r
- and create a text file that can be parsed by other utilities\r
- to do replacement of "name" with "GUID".\r
-\r
-Notes:\r
- To add a new GUID to this database:\r
- 1. Add a "#include EFI_GUID_DEFINITION(name)" statement below\r
- 2. Modify the mGuidList[] array below to add the new GUID name\r
-\r
- The only issue that may come up is that, if the source GUID file\r
- is not in the standard GUID directory, then this utility won't\r
- compile because the #include fails. In this case you'd need\r
- to define a new macro (if it's in a standard place) or modify\r
- this utility's makefile to add the path to your new .h file.\r
-\r
---*/\r
-\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <stdlib.h>\r
-#include <ctype.h>\r
-\r
-#include <Common/UefiBaseTypes.h>\r
-#include <Guid/Apriori.h>\r
-#include <Guid/AcpiTableStorage.h>\r
-\r
-#include "EfiUtilityMsgs.h"\r
-\r
-\r
-#define GUID_XREF(varname, guid) { \\r
- #varname, #guid, guid \\r
- }\r
-\r
-#define NULL_GUID \\r
- { \\r
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 \\r
- }\r
-\r
-typedef struct {\r
- INT8 *VariableName;\r
- INT8 *DefineName;\r
- EFI_GUID Guid;\r
-} GUID_LIST;\r
-\r
-//\r
-// This is our table of all GUIDs we want to print out to create\r
-// a GUID-to-name cross reference.\r
-// Use the #defined name from the GUID definition's source .h file.\r
-//\r
-static GUID_LIST mGuidList[] = {\r
- GUID_XREF(gAprioriGuid, EFI_APRIORI_GUID),\r
- GUID_XREF(gEfiAcpiTableStorageGuid, EFI_ACPI_TABLE_STORAGE_GUID),\r
- // FIXME The next line was removed in the port to R9.\r
- // GUID_XREF(gEfiDefaultBmpLogoGuid, EFI_DEFAULT_BMP_LOGO_GUID),\r
- GUID_XREF(gEfiAcpiTableStorageGuid, EFI_ACPI_TABLE_STORAGE_GUID),\r
- //\r
- // Terminator\r
- //\r
- {\r
- NULL,\r
- NULL,\r
- NULL_GUID\r
- }\r
-};\r
-\r
-void\r
-PrintGuidText (\r
- FILE *OutFptr,\r
- INT8 *VariableName,\r
- INT8 *DefineName,\r
- EFI_GUID *Guid\r
- );\r
-\r
-int\r
-CreateGuidList (\r
- INT8 *OutFileName\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Print our GUID/name list to the specified output file.\r
- \r
-Arguments:\r
- OutFileName - name of the output file to write our results to.\r
-\r
-Returns:\r
- 0 if successful\r
- nonzero otherwise\r
- \r
---*/\r
-{\r
- FILE *OutFptr;\r
- int Index;\r
-\r
- //\r
- // Open output file for writing. If the name is NULL, then write to stdout\r
- //\r
- if (OutFileName != NULL) {\r
- OutFptr = fopen (OutFileName, "w");\r
- if (OutFptr == NULL) {\r
- Error (NULL, 0, 0, OutFileName, "failed to open output file for writing");\r
- return STATUS_ERROR;\r
- }\r
- } else {\r
- OutFptr = stdout;\r
- }\r
-\r
- for (Index = 0; mGuidList[Index].VariableName != NULL; Index++) {\r
- PrintGuidText (OutFptr, mGuidList[Index].VariableName, mGuidList[Index].DefineName, &mGuidList[Index].Guid);\r
- }\r
- //\r
- // Close the output file if they specified one.\r
- //\r
- if (OutFileName != NULL) {\r
- fclose (OutFptr);\r
- }\r
-\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-void\r
-PrintGuidText (\r
- FILE *OutFptr,\r
- INT8 *VariableName,\r
- INT8 *DefineName,\r
- EFI_GUID *Guid\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Print a GUID/name combo in INF-style format\r
-\r
- guid-guid-guid-guid DEFINE_NAME gName\r
-\r
-Arguments:\r
- OutFptr - file pointer to which to write the output\r
- VariableName - the GUID variable's name\r
- DefineName - the name used in the #define\r
- Guid - pointer to the GUID value\r
-\r
-Returns:\r
- NA\r
-\r
---*/\r
-{\r
- if (OutFptr == NULL) {\r
- OutFptr = stdout;\r
- }\r
-\r
- fprintf (\r
- OutFptr,\r
- "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X %s %s\n",\r
- Guid->Data1,\r
- Guid->Data2,\r
- Guid->Data3,\r
- Guid->Data4[0],\r
- Guid->Data4[1],\r
- Guid->Data4[2],\r
- Guid->Data4[3],\r
- Guid->Data4[4],\r
- Guid->Data4[5],\r
- Guid->Data4[6],\r
- Guid->Data4[7],\r
- DefineName,\r
- VariableName\r
- );\r
-}\r