--- /dev/null
+/** @file\r
+\r
+Copyright (c) 2004 - 2008, 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
+ CommonLib.h\r
+\r
+Abstract:\r
+\r
+ Common library assistance routines.\r
+\r
+**/\r
+\r
+#ifndef _EFI_COMMON_LIB_H\r
+#define _EFI_COMMON_LIB_H\r
+\r
+#include <Common/UefiBaseTypes.h>\r
+#define PRINTED_GUID_BUFFER_SIZE 37 // including null-termination\r
+//\r
+// Function declarations\r
+//\r
+VOID\r
+PeiZeroMem (\r
+ IN VOID *Buffer,\r
+ IN UINTN Size\r
+ )\r
+;\r
+\r
+VOID\r
+PeiCopyMem (\r
+ IN VOID *Destination,\r
+ IN VOID *Source,\r
+ IN UINTN Length\r
+ )\r
+;\r
+\r
+VOID\r
+ZeroMem (\r
+ IN VOID *Buffer,\r
+ IN UINTN Size\r
+ )\r
+;\r
+\r
+VOID\r
+CopyMem (\r
+ IN VOID *Destination,\r
+ IN VOID *Source,\r
+ IN UINTN Length\r
+ )\r
+;\r
+\r
+INTN\r
+CompareGuid (\r
+ IN EFI_GUID *Guid1,\r
+ IN EFI_GUID *Guid2\r
+ )\r
+;\r
+\r
+EFI_STATUS\r
+GetFileImage (\r
+ IN CHAR8 *InputFileName,\r
+ OUT CHAR8 **InputFileImage,\r
+ OUT UINT32 *BytesRead\r
+ )\r
+;\r
+\r
+EFI_STATUS\r
+PutFileImage (\r
+ IN CHAR8 *OutputFileName,\r
+ IN CHAR8 *OutputFileImage,\r
+ IN UINT32 BytesToWrite\r
+ )\r
+;\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ This function opens a file and writes OutputFileImage into the file.\r
+\r
+Arguments:\r
+\r
+ OutputFileName The name of the file to write.\r
+ OutputFileImage A pointer to the memory buffer.\r
+ BytesToWrite The size of the memory buffer.\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS The function completed successfully.\r
+ EFI_INVALID_PARAMETER One of the input parameters was invalid.\r
+ EFI_ABORTED An error occurred.\r
+ EFI_OUT_OF_RESOURCES No resource to complete operations.\r
+\r
+**/\r
+\r
+UINT8\r
+CalculateChecksum8 (\r
+ IN UINT8 *Buffer,\r
+ IN UINTN Size\r
+ )\r
+;\r
+\r
+UINT8\r
+CalculateSum8 (\r
+ IN UINT8 *Buffer,\r
+ IN UINTN Size\r
+ )\r
+;\r
+\r
+UINT16\r
+CalculateChecksum16 (\r
+ IN UINT16 *Buffer,\r
+ IN UINTN Size\r
+ )\r
+;\r
+\r
+UINT16\r
+CalculateSum16 (\r
+ IN UINT16 *Buffer,\r
+ IN UINTN Size\r
+ )\r
+;\r
+\r
+EFI_STATUS\r
+PrintGuid (\r
+ IN EFI_GUID *Guid\r
+ )\r
+;\r
+\r
+#define PRINTED_GUID_BUFFER_SIZE 37 // including null-termination\r
+EFI_STATUS\r
+PrintGuidToBuffer (\r
+ IN EFI_GUID *Guid,\r
+ IN OUT UINT8 *Buffer,\r
+ IN UINT32 BufferLen,\r
+ IN BOOLEAN Uppercase\r
+ )\r
+;\r
+\r
+#define ASSERT(x) assert(x)\r
+\r
+#ifdef __GNUC__\r
+#include <stdio.h>\r
+#include <sys/stat.h>\r
+#define stricmp strcasecmp\r
+#define _stricmp strcasecmp\r
+#define strnicmp strncasecmp\r
+#define strcmpi strcasecmp\r
+size_t _filelength(int fd);\r
+#ifndef __CYGWIN__\r
+char *strlwr(char *s);\r
+#endif\r
+#endif\r
+\r
+//\r
+// On windows, mkdir only has one parameter.\r
+// On unix, it has two parameters\r
+//\r
+#if defined(__GNUC__)\r
+#define mkdir(dir, perm) mkdir(dir, perm)\r
+#else\r
+#define mkdir(dir, perm) mkdir(dir)\r
+#endif\r
+\r
+#endif\r