]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupport.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Universal / EbcDxe / EbcDebugger / EdbSupport.h
index ed1abe6ba576facfb257c8a032c0ad1429eecdde..43f750440fefd420df97c913d4abd17a3c3ab4ab 100644 (file)
@@ -1,13 +1,7 @@
 /** @file\r
 \r
-Copyright (c) 2007, Intel Corporation All rights reserved.<BR>\r
-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
+Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 \r
 **/\r
@@ -23,169 +17,364 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #define EFI_DEBUGGER_LINE_NUMBER_IN_PAGE  0x10\r
 \r
-#define EFI_DEBUG_MAX_PRINT_BUFFER   (80 * 4)\r
+#define EFI_DEBUG_MAX_PRINT_BUFFER  (80 * 4)\r
+\r
+/**\r
+\r
+  Convert hex string to uint.\r
+\r
+  @param  Str  -  The string\r
 \r
+**/\r
 UINTN\r
 EFIAPI\r
 Xtoi (\r
-  CHAR16  *str\r
+  CHAR16  *Str\r
   );\r
 \r
+/**\r
+\r
+  Convert hex string to uint.\r
+\r
+  @param  Str  -  The string\r
+\r
+**/\r
 UINT64\r
 EFIAPI\r
 LXtoi (\r
-  CHAR16  *str\r
+  CHAR16  *Str\r
   );\r
 \r
+/**\r
+\r
+  Convert hex string to uint.\r
+\r
+  @param Str  -  The string\r
+\r
+**/\r
 UINTN\r
 EFIAPI\r
 Atoi (\r
-  CHAR16  *str\r
+  CHAR16  *Str\r
   );\r
 \r
+/**\r
+\r
+  Convert hex string to uint.\r
+\r
+  @param  Str  -  The string\r
+\r
+**/\r
 UINTN\r
 EFIAPI\r
 AsciiXtoi (\r
-  CHAR8  *str\r
+  CHAR8  *Str\r
   );\r
 \r
+/**\r
+\r
+  Convert hex string to uint.\r
+\r
+  @param Str  -  The string\r
+\r
+**/\r
 UINTN\r
 EFIAPI\r
 AsciiAtoi (\r
-  CHAR8  *str\r
+  CHAR8  *Str\r
   );\r
 \r
+/**\r
+  Compare the Unicode and Ascii string pointed by String to the string pointed by String2.\r
+\r
+  @param String - Unicode String to process\r
+\r
+  @param String2 - Ascii string to process\r
+\r
+  @return Return a positive integer if String is lexicall greater than String2; Zero if\r
+  the two strings are identical; and a negative interger if String is lexically\r
+  less than String2.\r
+\r
+**/\r
 INTN\r
 EFIAPI\r
 StrCmpUnicodeAndAscii (\r
-  IN CHAR16   *String,\r
-  IN CHAR8    *String2\r
+  IN CHAR16  *String,\r
+  IN CHAR8   *String2\r
   );\r
 \r
+/**\r
+\r
+  Compare the Unicode string pointed by String to the string pointed by String2.\r
+\r
+  @param  String - Unicode String to process\r
+  @param  String2 - Unicode string to process\r
+\r
+  @return Return a positive integer if String is lexically greater than String2; Zero if\r
+  the two strings are identical; and a negative integer if String is lexically\r
+  less than String2.\r
+\r
+**/\r
 INTN\r
 EFIAPI\r
 StriCmp (\r
-  IN CHAR16   *String,\r
-  IN CHAR16   *String2\r
+  IN CHAR16  *String,\r
+  IN CHAR16  *String2\r
   );\r
 \r
+/**\r
+\r
+  Compare the Unicode and Ascii string pointed by String to the string pointed by String2.\r
+\r
+  @param  String - Unicode String to process\r
+  @param  String2 - Ascii string to process\r
+\r
+  @return Return a positive integer if String is lexically greater than String2; Zero if\r
+  the two strings are identical; and a negative integer if String is lexically\r
+  less than String2.\r
+\r
+**/\r
 INTN\r
 EFIAPI\r
 StriCmpUnicodeAndAscii (\r
-  IN CHAR16   *String,\r
-  IN CHAR8    *String2\r
+  IN CHAR16  *String,\r
+  IN CHAR8   *String2\r
   );\r
 \r
+/**\r
+\r
+  Verify if the string is end with the sub string.\r
+\r
+  @param  Str - The string where to search the sub string\r
+  @param  SubStr - The substring.\r
+\r
+**/\r
 BOOLEAN\r
 EFIAPI\r
 StrEndWith (\r
-  IN CHAR16                       *Str,\r
-  IN CHAR16                       *SubStr\r
+  IN CHAR16  *Str,\r
+  IN CHAR16  *SubStr\r
   );\r
 \r
+/**\r
+  Duplicate a string.\r
+\r
+  @param  Src  The string to be duplicated.\r
+\r
+**/\r
 CHAR16 *\r
 EFIAPI\r
 StrDuplicate (\r
-  IN CHAR16   *Src\r
+  IN CHAR16  *Src\r
   );\r
 \r
+/**\r
+\r
+  Find the next token after one or more specified characters.\r
+\r
+  @param  String    Point to the string where to find the substring.\r
+  @param  CharSet   Point to the string to be found.\r
+\r
+**/\r
 CHAR16 *\r
 EFIAPI\r
 StrGetNewTokenLine (\r
-  IN CHAR16                       *String,\r
-  IN CHAR16                       *CharSet\r
+  IN CHAR16  *String,\r
+  IN CHAR16  *CharSet\r
   );\r
 \r
+/**\r
+\r
+  Find the next token after one or more specified characters.\r
+\r
+  @param  CharSet   Point to the string to be found.\r
+\r
+**/\r
 CHAR16 *\r
 EFIAPI\r
 StrGetNextTokenLine (\r
-  IN CHAR16                       *CharSet\r
+  IN CHAR16  *CharSet\r
   );\r
 \r
+/**\r
+\r
+  Find the next token after one specificed characters.\r
+\r
+  @param  String    Point to the string where to find the substring.\r
+  @param  CharSet   Point to the string to be found.\r
+\r
+**/\r
 CHAR16 *\r
 EFIAPI\r
 StrGetNewTokenField (\r
-  IN CHAR16                       *String,\r
-  IN CHAR16                       *CharSet\r
+  IN CHAR16  *String,\r
+  IN CHAR16  *CharSet\r
   );\r
 \r
+/**\r
+\r
+  Find the next token after one specificed characters.\r
+\r
+  @param  CharSet   Point to the string to be found.\r
+\r
+**/\r
 CHAR16 *\r
 EFIAPI\r
 StrGetNextTokenField (\r
-  IN CHAR16                       *CharSet\r
+  IN CHAR16  *CharSet\r
   );\r
 \r
+/**\r
+\r
+  Patch a character to the end of a string.\r
+\r
+  @param  Buffer   The string to be patched.\r
+  @param  Patch    The patch character.\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 PatchForStrTokenAfter (\r
-  IN CHAR16    *Buffer,\r
-  IN CHAR16    Patch\r
+  IN CHAR16  *Buffer,\r
+  IN CHAR16  Patch\r
   );\r
 \r
+/**\r
+  Patch a character at the beginning of a string.\r
+\r
+  @param  Buffer   The string to be patched.\r
+  @param  Patch    The patch character.\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 PatchForStrTokenBefore (\r
-  IN CHAR16    *Buffer,\r
-  IN CHAR16    Patch\r
+  IN CHAR16  *Buffer,\r
+  IN CHAR16  Patch\r
   );\r
 \r
+/**\r
+\r
+  Find the next token after one or more specified characters.\r
+\r
+  @param  String    Point to the string where to find the substring.\r
+  @param  CharSet   Point to the string to be found.\r
+\r
+**/\r
 CHAR8 *\r
 EFIAPI\r
 AsciiStrGetNewTokenLine (\r
-  IN CHAR8                       *String,\r
-  IN CHAR8                       *CharSet\r
+  IN CHAR8  *String,\r
+  IN CHAR8  *CharSet\r
   );\r
 \r
+/**\r
+\r
+  Find the next token after one or more specified characters.\r
+\r
+  @param  CharSet   Point to the string to be found.\r
+\r
+**/\r
 CHAR8 *\r
 EFIAPI\r
 AsciiStrGetNextTokenLine (\r
-  IN CHAR8                       *CharSet\r
+  IN CHAR8  *CharSet\r
   );\r
 \r
+/**\r
+\r
+  Find the next token after one specificed characters.\r
+\r
+  @param  String    Point to the string where to find the substring.\r
+  @param  CharSet   Point to the string to be found.\r
+\r
+**/\r
 CHAR8 *\r
 EFIAPI\r
 AsciiStrGetNewTokenField (\r
-  IN CHAR8                       *String,\r
-  IN CHAR8                       *CharSet\r
+  IN CHAR8  *String,\r
+  IN CHAR8  *CharSet\r
   );\r
 \r
+/**\r
+\r
+  Find the next token after one specificed characters.\r
+\r
+  @param  CharSet   Point to the string to be found.\r
+\r
+**/\r
 CHAR8 *\r
 EFIAPI\r
 AsciiStrGetNextTokenField (\r
-  IN CHAR8                       *CharSet\r
+  IN CHAR8  *CharSet\r
   );\r
 \r
+/**\r
+\r
+  Patch a character to the end of a string.\r
+\r
+  @param  Buffer   The string to be patched.\r
+  @param  Patch    The patch character.\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 PatchForAsciiStrTokenAfter (\r
-  IN CHAR8    *Buffer,\r
-  IN CHAR8    Patch\r
+  IN CHAR8  *Buffer,\r
+  IN CHAR8  Patch\r
   );\r
 \r
+/**\r
+  Patch a character at the beginning of a string.\r
+\r
+  @param  Buffer   The string to be patched.\r
+  @param  Patch    The patch character.\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 PatchForAsciiStrTokenBefore (\r
-  IN CHAR8    *Buffer,\r
-  IN CHAR8    Patch\r
+  IN CHAR8  *Buffer,\r
+  IN CHAR8  Patch\r
   );\r
 \r
 /**\r
-Shell Library.\r
+\r
+  Shell Library.\r
+  Get user input.\r
+\r
+  @param  Prompt    The prompt string.\r
+  @param  InStr     Point to the input string.\r
+  @param  StrLen    The max length of string user can input.\r
+\r
 **/\r
 VOID\r
 EFIAPI\r
 Input (\r
-  IN CHAR16    *Prompt OPTIONAL,\r
-  OUT CHAR16   *InStr,\r
-  IN UINTN     StrLen\r
+  IN CHAR16   *Prompt OPTIONAL,\r
+  OUT CHAR16  *InStr,\r
+  IN UINTN    StrLen\r
   );\r
 \r
+/**\r
+\r
+  SetPageBreak.\r
+\r
+**/\r
 BOOLEAN\r
 EFIAPI\r
 SetPageBreak (\r
   VOID\r
   );\r
 \r
+/**\r
+  Print a Unicode string to the output device.\r
+\r
+  @param  Format    A Null-terminated Unicode format string.\r
+  @param  ...       The variable argument list that contains pointers to Null-\r
+                    terminated Unicode strings to be printed\r
+\r
+**/\r
 UINTN\r
 EFIAPI\r
 EDBPrint (\r
@@ -193,6 +382,17 @@ EDBPrint (
   ...\r
   );\r
 \r
+/**\r
+  Print a Unicode string to the output buffer.\r
+\r
+  @param  Buffer          A pointer to the output buffer for the produced Null-terminated\r
+                          Unicode string.\r
+  @param  BufferSize      The size, in bytes, of the output buffer specified by StartOfBuffer.\r
+  @param  Format          A Null-terminated Unicode format string.\r
+  @param  ...             The variable argument list that contains pointers to Null-\r
+                          terminated Unicode strings to be printed\r
+\r
+**/\r
 UINTN\r
 EFIAPI\r
 EDBSPrint (\r
@@ -202,6 +402,18 @@ EDBSPrint (
   ...\r
   );\r
 \r
+/**\r
+  Print a Unicode string to the output buffer with specified offset..\r
+\r
+  @param  Buffer          A pointer to the output buffer for the produced Null-terminated\r
+                          Unicode string.\r
+  @param  BufferSize      The size, in bytes, of the output buffer specified by StartOfBuffer.\r
+  @param  Offset          The offset of the buffer.\r
+  @param  Format          A Null-terminated Unicode format string.\r
+  @param  ...             The variable argument list that contains pointers to Null-\r
+                          terminated Unicode strings to be printed\r
+\r
+**/\r
 UINTN\r
 EFIAPI\r
 EDBSPrintWithOffset (\r
@@ -212,23 +424,54 @@ EDBSPrintWithOffset (
   ...\r
   );\r
 \r
+/**\r
+\r
+  Read a file.\r
+  If ScanFs is FLASE, it will use DebuggerPrivate->Vol as default Fs.\r
+  If ScanFs is TRUE, it will scan all FS and check the file.\r
+  If there is only one file match the name, it will be read.\r
+  If there is more than one file match the name, it will return Error.\r
+\r
+  @param  DebuggerPrivate - EBC Debugger private data structure\r
+  @param  FileName        - The file to be read.\r
+  @param  BufferSize      - The file buffer size\r
+  @param  Buffer          - The file buffer\r
+  @param  ScanFs          - Need Scan all FS\r
+\r
+  @retval EFI_SUCCESS    - read file successfully\r
+  @retval EFI_NOT_FOUND  - file not found\r
+  @retval EFI_NO_MAPPING - there is duplicated files found\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ReadFileToBuffer (\r
-  IN  EFI_DEBUGGER_PRIVATE_DATA   *DebuggerPrivate,\r
-  IN  CHAR16                      *FileName,\r
-  OUT UINTN                       *BufferSize,\r
-  OUT VOID                        **Buffer,\r
-  IN  BOOLEAN                     ScanFs\r
+  IN  EFI_DEBUGGER_PRIVATE_DATA  *DebuggerPrivate,\r
+  IN  CHAR16                     *FileName,\r
+  OUT UINTN                      *BufferSize,\r
+  OUT VOID                       **Buffer,\r
+  IN  BOOLEAN                    ScanFs\r
   );\r
 \r
+/**\r
+\r
+  Get file name under this dir with index\r
+\r
+  @param  DebuggerPrivate - EBC Debugger private data structure\r
+  @param  DirName         - The dir to be read.\r
+  @param  FileName        - The file name pattern under this dir\r
+  @param  Index           - The file index under this dir\r
+\r
+  @return File Name which match the pattern and index.\r
+\r
+**/\r
 CHAR16 *\r
 EFIAPI\r
 GetFileNameUnderDir (\r
-  IN  EFI_DEBUGGER_PRIVATE_DATA   *DebuggerPrivate,\r
-  IN  CHAR16                      *DirName,\r
-  IN  CHAR16                      *FileName,\r
-  IN OUT UINTN                    *Index\r
+  IN  EFI_DEBUGGER_PRIVATE_DATA  *DebuggerPrivate,\r
+  IN  CHAR16                     *DirName,\r
+  IN  CHAR16                     *FileName,\r
+  IN OUT UINTN                   *Index\r
   );\r
 \r
 #endif\r