VirtualBox

Ignore:
Timestamp:
Aug 12, 2020 4:09:12 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
139865
Message:

Devices/EFI: Merge edk-stable202005 and make it build, bugref:4643

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
6 added
81 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/Shell/ConsoleLogger.c

    r80721 r85718  
    311311
    312312        //
    313         // Find the first char with a different arrribute and make that temporarily NULL
     313        // Find the first char with a different attribute and make that temporarily NULL
    314314        // so we can do fewer printout statements.  (later) restore that one and we will
    315         // start at that collumn on the next loop.
     315        // start at that column on the next loop.
    316316        //
    317317        StringSegmentEndChar = CHAR_NULL;
     
    396396
    397397/**
    398   Reset the text output device hardware and optionaly run diagnostics
     398  Reset the text output device hardware and optionally run diagnostics
    399399
    400400  @param  This                pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
     
    724724
    725725      //
    726       // restore the temp NULL terminator to it's original character
     726      // restore the temp NULL terminator to its original character
    727727      //
    728728      *((CHAR16*)(Walker+1)) = TempChar;
     
    771771
    772772        //
    773         // restore the temp NULL terminator to it's original character
     773        // restore the temp NULL terminator to its original character
    774774        //
    775775        *((CHAR16*)(Walker+1)) = TempChar;
     
    11901190  @param[in] ConsoleInfo  The pointer to the instance of the console logger information.
    11911191
    1192   This will be used when a mode has changed or a reset ocurred to verify all
     1192  This will be used when a mode has changed or a reset occurred to verify all
    11931193  history buffers.
    11941194**/
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/Shell/ConsoleLogger.h

    r80721 r85718  
    118118
    119119/**
    120   Reset the text output device hardware and optionaly run diagnostics
     120  Reset the text output device hardware and optionally run diagnostics
    121121
    122122  @param This                 Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
     
    306306  @param[in] ConsoleInfo  The pointer to the instance of the console logger information.
    307307
    308   This will be used when a mode has changed or a reset ocurred to verify all
     308  This will be used when a mode has changed or a reset occurred to verify all
    309309  history buffers.
    310310**/
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/Shell/ConsoleWrappers.c

    r80721 r85718  
    221221
    222222/**
    223   Reset the text output device hardware and optionaly run diagnostics.
     223  Reset the text output device hardware and optionally run diagnostics.
    224224
    225225  @param  This                pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/Shell/FileHandleWrappers.c

    r80721 r85718  
    518518
    519519  //
    520   // Limit the line length to the buffer size or the minimun size of the
     520  // Limit the line length to the buffer size or the minimum size of the
    521521  // screen. (The smaller takes effect)
    522522  //
     
    866866      if (Key.UnicodeChar != CHAR_BACKSPACE && !(Key.UnicodeChar == 0 && Key.ScanCode == SCAN_DELETE)) {
    867867        //
    868         // Calulate row and column of the tail of current string
     868        // Calculate row and column of the tail of current string
    869869        //
    870870        TailRow     = Row + (StringLen - StringCurPos + Column + OutputLength) / TotalColumn;
     
    933933
    934934//
    935 // FILE sytle interfaces for StdIn/StdOut/StdErr
     935// FILE style interfaces for StdIn/StdOut/StdErr
    936936//
    937937EFI_FILE_PROTOCOL FileInterfaceStdIn = {
     
    10701070        ((CHAR16*)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] = CHAR_NULL;
    10711071        //
    1072         // If the NewBuffer end with \r\n\0, We will repace '\r' by '\0' and then update TotalSize.
     1072        // If the NewBuffer end with \r\n\0, We will replace '\r' by '\0' and then update TotalSize.
    10731073        //
    10741074        TotalSize -= sizeof(CHAR16) * 2;
     
    16451645    if ((UINTN)(MemFile->Position + (*BufferSize)) > (UINTN)(MemFile->BufferSize)) {
    16461646      MemFile->Buffer = ReallocatePool((UINTN)(MemFile->BufferSize), (UINTN)(MemFile->BufferSize) + (*BufferSize) + MEM_WRITE_REALLOC_OVERHEAD, MemFile->Buffer);
     1647      if (MemFile->Buffer == NULL){
     1648        return EFI_OUT_OF_RESOURCES;
     1649      }
    16471650      MemFile->BufferSize += (*BufferSize) + MEM_WRITE_REALLOC_OVERHEAD;
    16481651    }
     
    16621665    if ((UINTN)(MemFile->Position + AsciiStrSize(AsciiBuffer)) > (UINTN)(MemFile->BufferSize)) {
    16631666      MemFile->Buffer = ReallocatePool((UINTN)(MemFile->BufferSize), (UINTN)(MemFile->BufferSize) + AsciiStrSize(AsciiBuffer) + MEM_WRITE_REALLOC_OVERHEAD, MemFile->Buffer);
     1667      if (MemFile->Buffer == NULL){
     1668        FreePool(AsciiBuffer);
     1669        return EFI_OUT_OF_RESOURCES;
     1670      }
    16641671      MemFile->BufferSize += AsciiStrSize(AsciiBuffer) + MEM_WRITE_REALLOC_OVERHEAD;
    16651672    }
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/Shell/FileHandleWrappers.h

    r80721 r85718  
    2121
    2222///
    23 /// FILE sytle interfaces for StdIn.
     23/// FILE styte interfaces for StdIn.
    2424///
    2525extern EFI_FILE_PROTOCOL FileInterfaceStdIn;
    2626
    2727///
    28 /// FILE sytle interfaces for StdOut.
     28/// FILE styte interfaces for StdOut.
    2929///
    3030extern EFI_FILE_PROTOCOL FileInterfaceStdOut;
    3131
    3232///
    33 /// FILE sytle interfaces for StdErr.
     33/// FILE styte interfaces for StdErr.
    3434///
    3535extern EFI_FILE_PROTOCOL FileInterfaceStdErr;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/Shell/Shell.c

    r80721 r85718  
    10821082        }
    10831083        //
    1084         // If an argumnent contains a space, then add double quotes before the argument
     1084        // If an argument contains a space, then add double quotes before the argument
    10851085        //
    10861086        if (StrStr (gEfiShellParametersProtocol->Argv[LoopVar], L" ") != NULL) {
     
    11031103        }
    11041104        //
    1105         // If an argumnent contains a space, then add double quotes after the argument
     1105        // If an argument contains a space, then add double quotes after the argument
    11061106        //
    11071107        if (StrStr (gEfiShellParametersProtocol->Argv[LoopVar], L" ") != NULL) {
     
    11771177
    11781178  //
    1179   // Try to find 'Startup.nsh' in the execution path defined by the envrionment variable PATH.
     1179  // Try to find 'Startup.nsh' in the execution path defined by the environment variable PATH.
    11801180  //
    11811181  if ((StartupScriptPath == NULL) || EFI_ERROR (ShellIsFile (StartupScriptPath))) {
     
    22522252
    22532253/**
    2254   Converts the command line to it's post-processed form.  this replaces variables and alias' per UEFI Shell spec.
     2254  Converts the command line to its post-processed form.  this replaces variables and alias' per UEFI Shell spec.
    22552255
    22562256  @param[in,out] CmdLine        pointer to the command line to update
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/Shell/Shell.h

    r80721 r85718  
    136136
    137137/**
    138   Converts the command line to it's post-processed form.  this replaces variables and alias' per UEFI Shell spec.
     138  Converts the command line to its post-processed form.  this replaces variables and alias' per UEFI Shell spec.
    139139
    140140  @param[in,out] CmdLine        pointer to the command line to update
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/Shell/ShellEnvVar.c

    r80721 r85718  
    119119                                 storing this list.
    120120
    121   @retval EFI_SUCCESS           the list was created sucessfully.
     121  @retval EFI_SUCCESS           the list was created successfully.
    122122**/
    123123EFI_STATUS
     
    234234                                GetShellEnvVarList().
    235235
    236   @retval EFI_SUCCESS           the list was Set sucessfully.
     236  @retval EFI_SUCCESS           the list was Set successfully.
    237237**/
    238238EFI_STATUS
     
    267267
    268268  //
    269   // set all the variables fron the list
     269  // set all the variables from the list
    270270  //
    271271  for ( Node = (ENV_VAR_LIST*)GetFirstNode(ListHead)
     
    480480
    481481  //
    482   // If the environment varialbe key doesn't exist in list just insert
     482  // If the environment variable key doesn't exist in list just insert
    483483  // a new node.
    484484  //
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/Shell/ShellEnvVar.h

    r80721 r85718  
    4444
    4545/**
    46   Delete a Non-Violatile environment variable.
    47 
    48   This will use the Runtime Services call SetVariable to remove a non-violatile variable.
    49 
    50   @param EnvVarName             The name of the environment variable in question
    51 
    52   @retval EFI_SUCCESS           The variable was deleted sucessfully
    53   @retval other                 An error ocurred
     46  Delete a Non-Volatile environment variable.
     47
     48  This will use the Runtime Services call SetVariable to remove a non-volatile variable.
     49
     50  @param EnvVarName             The name of the environment variable in question
     51
     52  @retval EFI_SUCCESS           The variable was deleted successfully
     53  @retval other                 An error occurred
    5454  @sa SetVariable
    5555**/
     
    6262
    6363/**
    64   Set a Non-Violatile environment variable.
    65 
    66   This will use the Runtime Services call SetVariable to set a non-violatile variable.
     64  Set a Non-Volatile environment variable.
     65
     66  This will use the Runtime Services call SetVariable to set a non-volatile variable.
    6767
    6868  @param EnvVarName             The name of the environment variable in question
     
    7070  @param Buffer                 Pointer to value to set variable to
    7171
    72   @retval EFI_SUCCESS           The variable was changed sucessfully
    73   @retval other                 An error ocurred
     72  @retval EFI_SUCCESS           The variable was changed successfully
     73  @retval other                 An error occurred
    7474  @sa SetVariable
    7575**/
     
    9090  @param Buffer                 Pointer buffer to get variable value into
    9191
    92   @retval EFI_SUCCESS           The variable's value was retrieved sucessfully
    93   @retval other                 An error ocurred
     92  @retval EFI_SUCCESS           The variable's value was retrieved successfully
     93  @retval other                 An error occurred
    9494  @sa SetVariable
    9595**/
     
    111111  @param Buffer                 Pointer buffer to get variable value into
    112112
    113   @retval EFI_SUCCESS           The variable's value was retrieved sucessfully
    114   @retval other                 An error ocurred
     113  @retval EFI_SUCCESS           The variable's value was retrieved successfully
     114  @retval other                 An error occurred
    115115  @sa SetVariable
    116116**/
     
    123123
    124124/**
    125   Set a Violatile environment variable.
    126 
    127   This will use the Runtime Services call SetVariable to set a violatile variable.
     125  Set a Volatile environment variable.
     126
     127  This will use the Runtime Services call SetVariable to set a volatile variable.
    128128
    129129  @param EnvVarName             The name of the environment variable in question
     
    131131  @param Buffer                 Pointer to value to set variable to
    132132
    133   @retval EFI_SUCCESS           The variable was changed sucessfully
    134   @retval other                 An error ocurred
     133  @retval EFI_SUCCESS           The variable was changed successfully
     134  @retval other                 An error occurred
    135135  @sa SetVariable
    136136**/
     
    148148                                 storing this list.
    149149
    150   @retval EFI_SUCCESS           the list was created sucessfully.
     150  @retval EFI_SUCCESS           the list was created successfully.
    151151**/
    152152EFI_STATUS
     
    165165                                GetShellEnvVarList().
    166166
    167   @retval EFI_SUCCESS           The list was Set sucessfully.
     167  @retval EFI_SUCCESS           The list was Set successfully.
    168168**/
    169169EFI_STATUS
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/Shell/ShellManParser.c

    r80721 r85718  
    180180
    181181/**
    182   parses through the MAN file specified by SHELL_FILE_HANDLE and returns the
    183   detailed help for any sub section specified in the comma seperated list of
     182  Parses through the MAN file specified by SHELL_FILE_HANDLE and returns the
     183  detailed help for any sub section specified in the comma separated list of
    184184  sections provided.  If the end of the file or a .TH section is found then
    185185  return.
    186186
    187   Upon a sucessful return the caller is responsible to free the memory in *HelpText
     187  Upon a successful return the caller is responsible to free the memory in *HelpText
    188188
    189189  @param[in] Handle             FileHandle to read from
     
    194194
    195195  @retval EFI_OUT_OF_RESOURCES  a memory allocation failed.
    196   @retval EFI_SUCCESS           the section was found and its description sotred in
    197                                 an alloceted buffer.
     196  @retval EFI_SUCCESS           the section was found and its description stored in
     197                                an allocated buffer.
    198198**/
    199199EFI_STATUS
     
    297297  Parses a line from a MAN file to see if it is the Title Header. If it is, then
    298298  if the "Brief Description" is desired, allocate a buffer for it and return a
    299   copy. Upon a sucessful return the caller is responsible to free the memory in
     299  copy. Upon a successful return the caller is responsible to free the memory in
    300300  *BriefDesc
    301301
    302302  Uses a simple state machine that allows "unlimited" whitespace before and after the
    303   ".TH", compares Command and the MAN file commnd name without respect to case, and
     303  ".TH", compares Command and the MAN file command name without respect to case, and
    304304  allows "unlimited" whitespace and '0' and '1' characters before the Short Description.
    305305  The PCRE regex describing this functionality is: ^\s*\.TH\s+(\S)\s[\s01]*(.*)$
     
    422422
    423423/**
    424   parses through the MAN file specified by SHELL_FILE_HANDLE and returns the
     424  Parses through the MAN file specified by SHELL_FILE_HANDLE and returns the
    425425  "Brief Description" for the .TH section as specified by Command.  If the
    426426  command section is not found return EFI_NOT_FOUND.
    427427
    428   Upon a sucessful return the caller is responsible to free the memory in *BriefDesc
     428  Upon a successful return the caller is responsible to free the memory in *BriefDesc
    429429
    430430  @param[in] Handle              FileHandle to read from
     
    513513  available will be returned.
    514514
    515   if BriefDesc is NULL, then the breif description will not be savedd seperatly,
     515  if BriefDesc is NULL, then the breif description will not be saved separately,
    516516  but placed first in the main HelpText.
    517517
     
    646646    Status      = gBS->LoadImage(FALSE, gImageHandle, DevPath, NULL, 0, &CmdFileImgHandle);
    647647    if(EFI_ERROR(Status)) {
     648      //
     649      // With EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created
     650      // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now.
     651      // If the caller doesn't have the option to defer the execution of an image, we should
     652      // unload image for the EFI_SECURITY_VIOLATION to avoid the resource leak.
     653      //
     654      if (Status == EFI_SECURITY_VIOLATION) {
     655        gBS->UnloadImage (CmdFileImgHandle);
     656      }
    648657      *HelpText = NULL;
    649658      goto Done;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/Shell/ShellManParser.h

    r80721 r85718  
    2020  available will be returned.
    2121
    22   if BriefDesc is NULL, then the breif description will not be savedd seperatly,
     22  if BriefDesc is NULL, then the breif description will not be savedd separately,
    2323  but placed first in the main HelpText.
    2424
     
    5050/**
    5151  parses through the MAN file specified by SHELL_FILE_HANDLE and returns the
    52   detailed help for any sub section specified in the comma seperated list of
     52  detailed help for any sub section specified in the comma separated list of
    5353  sections provided.  If the end of the file or a .TH section is found then
    5454  return.
    5555
    56   Upon a sucessful return the caller is responsible to free the memory in *HelpText
     56  Upon a successful return the caller is responsible to free the memory in *HelpText
    5757
    5858  @param[in] Handle             FileHandle to read from
     
    6363
    6464  @retval EFI_OUT_OF_RESOURCES  a memory allocation failed.
    65   @retval EFI_SUCCESS           the section was found and its description sotred in
    66                                 an alloceted buffer.
     65  @retval EFI_SUCCESS           the section was found and its description stored in
     66                                an allocated buffer.
    6767**/
    6868EFI_STATUS
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/Shell/ShellParametersProtocol.c

    r80721 r85718  
    7070
    7171  @param[in, out] Walker          pointer to string of command line.  Adjusted to
    72                                   reminaing command line on return
     72                                  remaining command line on return
    7373  @param[in, out] TempParameter   pointer to string of command line item extracted.
    7474  @param[in]      Length          buffer size of TempParameter.
     
    7676                                  the parameters.
    7777
    78   @return   EFI_INALID_PARAMETER A required parameter was NULL or pointed to a NULL or empty string.
     78  @return   EFI_INVALID_PARAMETER A required parameter was NULL or pointed to a NULL or empty string.
    7979  @return   EFI_NOT_FOUND         A closing " could not be found on the specified string
    8080**/
     
    127127
    128128  //
    129   // Add a CHAR_NULL if we didnt get one via the copy
     129  // Add a CHAR_NULL if we didn't get one via the copy
    130130  //
    131131  if (*NextDelim != CHAR_NULL) {
     
    185185  @param[in, out] Argc            pointer to number of strings in Argv array
    186186
    187   @return EFI_SUCCESS           the operation was sucessful
     187  @return EFI_SUCCESS           the operation was successful
     188  @return EFI_INVALID_PARAMETER some parameters are invalid
    188189  @return EFI_OUT_OF_RESOURCES  a memory allocation failed.
    189190**/
     
    417418
    418419/**
    419   frees all memory used by createion and installation of shell parameters protocol
     420  frees all memory used by creation and installation of shell parameters protocol
    420421  and if there was an old version installed it will restore that one.
    421422
     
    467468
    468469/**
    469   Determin if a file name represents a unicode file.
     470  Determine if a file name represents a unicode file.
    470471
    471472  @param[in] FileName     Pointer to the filename to open.
     
    527528
    528529/**
    529   Calcualte the 32-bit CRC in a EFI table using the service provided by the
     530  Calculate the 32-bit CRC in a EFI table using the service provided by the
    530531  gRuntime service.
    531532
     
    652653
    653654/**
    654   Funcion will replace the current StdIn and StdOut in the ShellParameters protocol
     655  Function will replace the current StdIn and StdOut in the ShellParameters protocol
    655656  structure by parsing NewCommandLine.  The current values are returned to the
    656657  user.
     
    665666  @param[out] SystemTableInfo            Pointer to old system table information.
    666667
    667   @retval   EFI_SUCCESS                 Operation was sucessful, Argv and Argc are valid.
     668  @retval   EFI_SUCCESS                 Operation was successful, Argv and Argc are valid.
    668669  @retval   EFI_OUT_OF_RESOURCES        A memory allocation failed.
    669670**/
     
    12581259
    12591260/**
    1260   Funcion will replace the current StdIn and StdOut in the ShellParameters protocol
     1261  Function will replace the current StdIn and StdOut in the ShellParameters protocol
    12611262  structure with StdIn and StdOut.  The current values are de-allocated.
    12621263
     
    13281329}
    13291330/**
    1330   Funcion will replace the current Argc and Argv in the ShellParameters protocol
     1331  Function will replace the current Argc and Argv in the ShellParameters protocol
    13311332  structure by parsing NewCommandLine.  The current values are returned to the
    13321333  user.
     
    13401341  @param[out] OldArgc                    Pointer to old number of items in Argv list.
    13411342
    1342   @retval   EFI_SUCCESS                 Operation was sucessful, Argv and Argc are valid.
     1343
     1344  @retval   EFI_SUCCESS                 Operation was successful, Argv and Argc are valid.
     1345  @return   EFI_INVALID_PARAMETER       Some parameters are invalid.
    13431346  @retval   EFI_OUT_OF_RESOURCES        A memory allocation failed.
    13441347**/
     
    13761379
    13771380/**
    1378   Funcion will replace the current Argc and Argv in the ShellParameters protocol
     1381  Function will replace the current Argc and Argv in the ShellParameters protocol
    13791382  structure with Argv and Argc.  The current values are de-allocated and the
    13801383  OldArgv must not be deallocated by the caller.
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/Shell/ShellParametersProtocol.h

    r80721 r85718  
    4444
    4545/**
    46   frees all memory used by createion and installation of shell parameters protocol
     46  frees all memory used by creation and installation of shell parameters protocol
    4747  and if there was an old version installed it will restore that one.
    4848
     
    6161
    6262/**
    63   Funcion will replace the current Argc and Argv in the ShellParameters protocol
     63  Function will replace the current Argc and Argv in the ShellParameters protocol
    6464  structure by parsing NewCommandLine.  The current values are returned to the
    6565  user.
     
    7171  @param[out] OldArgc                   pointer to old number of items in Argv list
    7272
    73   @retval   EFI_SUCCESS                 operation was sucessful, Argv and Argc are valid
     73  @retval   EFI_SUCCESS                 operation was successful, Argv and Argc are valid
     74  @return   EFI_INVALID_PARAMETER       some parameters are invalid
    7475  @retval   EFI_OUT_OF_RESOURCES        a memory allocation failed.
    7576**/
     
    8485
    8586/**
    86   Funcion will replace the current Argc and Argv in the ShellParameters protocol
     87  Function will replace the current Argc and Argv in the ShellParameters protocol
    8788  structure with Argv and Argc.  The current values are de-allocated and the
    8889  OldArgv must not be deallocated by the caller.
     
    109110
    110111/**
    111   Funcion will replace the current StdIn and StdOut in the ShellParameters protocol
     112  Function will replace the current StdIn and StdOut in the ShellParameters protocol
    112113  structure by parsing NewCommandLine.  The current values are returned to the
    113114  user.
     
    122123  @param[out] SystemTableInfo            Pointer to old system table information.
    123124
    124   @retval   EFI_SUCCESS                 Operation was sucessful, Argv and Argc are valid.
     125  @retval   EFI_SUCCESS                 Operation was successful, Argv and Argc are valid.
    125126  @retval   EFI_OUT_OF_RESOURCES        A memory allocation failed.
    126127**/
     
    136137
    137138/**
    138   Funcion will replace the current StdIn and StdOut in the ShellParameters protocol
     139  Function will replace the current StdIn and StdOut in the ShellParameters protocol
    139140  structure with StdIn and StdOut.  The current values are de-allocated.
    140141
     
    167168  @param[in, out] Argc            pointer to number of strings in Argv array
    168169
    169   @return EFI_SUCCESS           the operation was sucessful
     170  @return EFI_SUCCESS           the operation was successful
     171  @return EFI_INVALID_PARAMETER some parameters are invalid
    170172  @return EFI_OUT_OF_RESOURCES  a memory allocation failed.
    171173**/
     
    189191
    190192  @param[in, out] Walker          pointer to string of command line.  Adjusted to
    191                                   reminaing command line on return
     193                                  remaining command line on return
    192194  @param[in, out] TempParameter   pointer to string of command line item extracted.
    193195  @param[in]      Length          Length of (*TempParameter) in bytes
     
    195197                                  the parameters.
    196198
    197   @return   EFI_INALID_PARAMETER A required parameter was NULL or pointed to a NULL or empty string.
     199  @return   EFI_INVALID_PARAMETER A required parameter was NULL or pointed to a NULL or empty string.
    198200  @return   EFI_NOT_FOUND         A closing " could not be found on the specified string
    199201**/
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/Shell/ShellProtocol.c

    r80721 r85718  
    9797  This function creates a mapping for a device path.
    9898
    99   If both DeviecPath and Mapping are NULL, this will reset the mapping to default values.
     99  If both DevicePath and Mapping are NULL, this will reset the mapping to default values.
    100100
    101101  @param DevicePath             Points to the device path. If this is NULL and Mapping points to a valid mapping,
     
    153153
    154154    //
    155     // We didnt find one to delete
     155    // We didn't find one to delete
    156156    //
    157157    return (EFI_NOT_FOUND);
     
    233233  points to the end-of-device-path node.
    234234
    235   If there are multiple map names they will be semi-colon seperated in the
     235  If there are multiple map names they will be semi-colon separated in the
    236236  NULL-terminated string.
    237237
     
    911911
    912912  @retval EFI_SUCCESS             the file is open and FileHandle is valid
    913   @retval EFI_UNSUPPORTED         the device path cotained non-path elements
    914   @retval other                   an error ocurred.
     913  @retval EFI_UNSUPPORTED         the device path contained non-path elements
     914  @retval other                   an error occurred.
    915915**/
    916916EFI_STATUS
     
    947947    if (Handle1 != NULL) {
    948948      //
    949       // chop off the begining part before the file system part...
     949      // chop off the beginning part before the file system part...
    950950      //
    951951      ///@todo BlockIo?
     
    10651065
    10661066  @param FileName           Pointer to NULL-terminated file path
    1067   @param FileAttribs        The new file's attrbiutes.  the different attributes are
     1067  @param FileAttribs        The new file's attributes.  the different attributes are
    10681068                            described in EFI_FILE_PROTOCOL.Open().
    10691069  @param FileHandle         On return, points to the created file handle or directory's handle
     
    10721072  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
    10731073  @retval EFI_UNSUPPORTED   could not open the file path
    1074   @retval EFI_NOT_FOUND     the specified file could not be found on the devide, or could not
     1074  @retval EFI_NOT_FOUND     the specified file could not be found on the device, or could not
    10751075                            file the file system on the device.
    10761076  @retval EFI_NO_MEDIA      the device has no medium.
     
    14981498    ShellParamsProtocol.StdErr  = ShellInfoObject.NewShellParametersProtocol->StdErr;
    14991499    Status = UpdateArgcArgv(&ShellParamsProtocol, NewCmdLine, Efi_Application, NULL, NULL);
    1500     ASSERT_EFI_ERROR(Status);
     1500    if (EFI_ERROR (Status)) {
     1501      goto UnloadImage;
     1502    }
     1503
    15011504    //
    15021505    // Replace Argv[0] with the full path of the binary we're executing:
     
    19061909  @param[in] Save     TRUE to set Node->Handle to NULL, FALSE otherwise.
    19071910
    1908   @retval NULL        a memory allocation error ocurred
     1911  @retval NULL        a memory allocation error occurred
    19091912  @return != NULL     a pointer to the new node
    19101913**/
     
    19581961  @param[in] Info             Info struct to copy.
    19591962
    1960   @retval NULL                An error ocurred.
     1963  @retval NULL                An error occurred.
    19611964  @return                     a pointer to the newly allocated structure.
    19621965**/
     
    21182121    ShellFileListItem = CreateAndPopulateShellFileInfo(
    21192122      BasePath,
    2120       EFI_SUCCESS,  // success since we didnt fail to open it...
     2123      EFI_SUCCESS,  // success since we didn't fail to open it...
    21212124      FileInfo->FileName,
    21222125      NULL,         // no handle since not open
     
    27042707      }
    27052708      //
    2706       // we didnt get it (might not exist)
     2709      // we didn't get it (might not exist)
    27072710      // free the memory if we allocated any and return NULL
    27082711      //
     
    29252928  @param Dir                    Points to the NULL-terminated directory on the device specified by FileSystem.
    29262929
    2927   @retval EFI_SUCCESS           The operation was sucessful
     2930  @retval EFI_SUCCESS           The operation was successful
    29282931  @retval EFI_NOT_FOUND         The file system could not be found
    29292932**/
     
    31773180
    31783181/**
    3179   function to return a semi-colon delimeted list of all alias' in the current shell
     3182  function to return a semi-colon delimited list of all alias' in the current shell
    31803183
    31813184  up to caller to free the memory.
    31823185
    31833186  @retval NULL    No alias' were found
    3184   @retval NULL    An error ocurred getting alias'
     3187  @retval NULL    An error occurred getting alias'
    31853188  @return !NULL   a list of all alias'
    31863189**/
     
    32853288                                delimited list of alias (e.g.
    32863289                                ReturnedData = "dir;del;copy;mfp") that is NULL-terminated.
    3287   @retval NULL                  an error ocurred
     3290  @retval NULL                  an error occurred
    32883291  @retval NULL                  Alias was not a valid Alias
    32893292**/
     
    36103613        if (!EFI_ERROR(Status)) {
    36113614          //
    3612           // we reinstalled sucessfully.  log this so we can reverse it later.
     3615          // we reinstalled successfully.  log this so we can reverse it later.
    36133616          //
    36143617
     
    37573760
    37583761  @retval EFI_SUCCESS           The feature is enabled.
    3759   @retval EFI_OUT_OF_RESOURCES  There is not enough mnemory available.
     3762  @retval EFI_OUT_OF_RESOURCES  There is not enough memory available.
    37603763**/
    37613764EFI_STATUS
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/Shell/ShellProtocol.h

    r80721 r85718  
    284284
    285285  @retval EFI_SUCCESS             the file is open and FileHandle is valid
    286   @retval EFI_UNSUPPORTED         the device path cotained non-path elements
    287   @retval other                   an error ocurred.
     286  @retval EFI_UNSUPPORTED         the device path contained non-path elements
     287  @retval other                   an error occurred.
    288288**/
    289289EFI_STATUS
     
    310310
    311311  @param FileName           Pointer to NULL-terminated file path
    312   @param FileAttribs        The new file's attrbiutes.  the different attributes are
     312  @param FileAttribs        The new file's attributes.  the different attributes are
    313313                            described in EFI_FILE_PROTOCOL.Open().
    314314  @param FileHandle         On return, points to the created file handle or directory's handle
     
    735735  @param Dir                    Points to the NULL-terminated directory on the device specified by FileSystem.
    736736
    737   @retval EFI_SUCCESS           The operation was sucessful
     737  @retval EFI_SUCCESS           The operation was successful
    738738**/
    739739EFI_STATUS
     
    819819                                delimited list of alias (e.g.
    820820                                ReturnedData = "dir;del;copy;mfp") that is NULL-terminated.
    821   @retval NULL                  an error ocurred
     821  @retval NULL                  an error occurred
    822822  @retval NULL                  Alias was not a valid Alias
    823823**/
     
    916916
    917917  @retval EFI_SUCCESS           The feature is enabled.
    918   @retval EFI_OUT_OF_RESOURCES  There is not enough mnemory available.
     918  @retval EFI_OUT_OF_RESOURCES  There is not enough memory available.
    919919**/
    920920EFI_STATUS
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Application/ShellCTestApp/README.txt

    r80721 r85718  
    11TestArgv.nsh is a very simple shell script to test how the interpreter parses
    22the parameters. It uses ShellCTestApp.efi to dump the parameters passed from the
    3 intepreter.
     3interpreter.
    44
    55TestArgv.log is the desired output created using "TestArgv.nsh > TestArgv.log".
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c

    r80721 r85718  
    3737#pragma pack()
    3838
    39 EFI_HANDLE   mDpHiiHandle;
     39EFI_HII_HANDLE   mDpHiiHandle;
    4040
    4141typedef struct {
     
    155155  }
    156156  //
    157   // Try to get the Handle form the caached array.
     157  // Try to get the Handle from the cached array.
    158158  //
    159159  for (Index = 0; Index < mCachePairCount; Index++) {
     
    919919
    920920/**
    921   Retrive HII package list from ImageHandle and publish to HII database.
     921  Retrieve HII package list from ImageHandle and publish to HII database.
    922922
    923923  @param ImageHandle            The image handle of the process.
     
    925925  @return HII handle.
    926926**/
    927 EFI_HANDLE
     927EFI_HII_HANDLE
    928928InitializeHiiPackage (
    929929  EFI_HANDLE                  ImageHandle
     
    932932  EFI_STATUS                  Status;
    933933  EFI_HII_PACKAGE_LIST_HEADER *PackageList;
    934   EFI_HANDLE                  HiiHandle;
     934  EFI_HII_HANDLE              HiiHandle;
    935935
    936936  //
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h

    r80721 r85718  
    3737#include <Library/PerformanceLib.h>
    3838
    39 extern EFI_HANDLE mDpHiiHandle;
     39extern EFI_HII_HANDLE mDpHiiHandle;
    4040
    4141#define DP_MAJOR_VERSION        2
     
    128128
    129129/**
    130   Retrive HII package list from ImageHandle and publish to HII database.
     130  Retrieve HII package list from ImageHandle and publish to HII database.
    131131
    132132  @param ImageHandle            The image handle of the process.
     
    134134  @return HII handle.
    135135**/
    136 EFI_HANDLE
     136EFI_HII_HANDLE
    137137InitializeHiiPackage (
    138138  EFI_HANDLE                  ImageHandle
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c

    r80721 r85718  
    2525  @param SystemTable            The EFI System Table pointer.
    2626
    27   @retval EFI_SUCCESS           Tftp command is executed sucessfully.
     27  @retval EFI_SUCCESS           Tftp command is executed successfully.
    2828  @retval EFI_ABORTED           HII package was failed to initialize.
    2929  @retval others                Other errors when executing tftp command.
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c

    r80721 r85718  
    2020                                    of processing this command.
    2121
    22   @return EFI_SUCCESS               the operation was sucessful
     22  @return EFI_SUCCESS               the operation was successful
    2323  @return other                     the operation failed.
    2424**/
     
    7171  @param SystemTable            The EFI System Table pointer.
    7272
    73   @retval EFI_SUCCESS           Tftp command is executed sucessfully.
     73  @retval EFI_SUCCESS           Tftp command is executed successfully.
    7474  @retval EFI_ABORTED           HII package was failed to initialize.
    7575  @retval others                Other errors when executing tftp command.
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c

    r80721 r85718  
    8686        current performance logs.
    8787
    88   @param[in, out] CustomCumulativeData  A pointer to the cumtom cumulative data.
     88  @param[in, out] CustomCumulativeData  A pointer to the custom cumulative data.
    8989
    9090**/
     
    831831  Finally, print the gathered cumulative statistics.
    832832
    833   @param[in]    CustomCumulativeData  A pointer to the cumtom cumulative data.
     833  @param[in]    CustomCumulativeData  A pointer to the custom cumulative data.
    834834
    835835**/
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c

    r80721 r85718  
    1212
    1313#define IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH 32
    14 EFI_HANDLE   mTftpHiiHandle;
     14EFI_HII_HANDLE   mTftpHiiHandle;
    1515
    1616/*
    1717   Constant strings and definitions related to the message indicating the amount of
    18    progress in the dowloading of a TFTP file.
     18   progress in the downloading of a TFTP file.
    1919*/
    2020
     
    4949
    5050  @return     TRUE      The value was returned.
    51   @return     FALSE     A parsing error occured.
     51  @return     FALSE     A parsing error occurred.
    5252**/
    5353STATIC
     
    586586
    587587  @return     TRUE      The value was returned.
    588   @return     FALSE     A parsing error occured.
     588  @return     FALSE     A parsing error occurred.
    589589**/
    590590STATIC
     
    10821082
    10831083/**
    1084   Retrive HII package list from ImageHandle and publish to HII database.
     1084  Retrieve HII package list from ImageHandle and publish to HII database.
    10851085
    10861086  @param ImageHandle            The image handle of the process.
     
    10881088  @return HII handle.
    10891089**/
    1090 EFI_HANDLE
     1090EFI_HII_HANDLE
    10911091InitializeHiiPackage (
    10921092  EFI_HANDLE                  ImageHandle
     
    10951095  EFI_STATUS                  Status;
    10961096  EFI_HII_PACKAGE_LIST_HEADER *PackageList;
    1097   EFI_HANDLE                  HiiHandle;
     1097  EFI_HII_HANDLE              HiiHandle;
    10981098
    10991099  //
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h

    r80721 r85718  
    3131#include <Library/UefiHiiServicesLib.h>
    3232
    33 extern EFI_HANDLE mTftpHiiHandle;
     33extern EFI_HII_HANDLE mTftpHiiHandle;
    3434
    3535typedef struct {
     
    5757
    5858/**
    59   Retrive HII package list from ImageHandle and publish to HII database.
     59  Retrieve HII package list from ImageHandle and publish to HII database.
    6060
    6161  @param ImageHandle            The image handle of the process.
     
    6363  @return HII handle.
    6464**/
    65 EFI_HANDLE
     65EFI_HII_HANDLE
    6666InitializeHiiPackage (
    6767  EFI_HANDLE                  ImageHandle
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.c

    r80721 r85718  
    2626  @param SystemTable            The EFI System Table pointer.
    2727
    28   @retval EFI_SUCCESS           Tftp command is executed sucessfully.
     28  @retval EFI_SUCCESS           Tftp command is executed successfully.
    2929  @retval EFI_ABORTED           HII package was failed to initialize.
    3030  @retval others                Other errors when executing tftp command.
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c

    r80721 r85718  
    2121                                    of processing this command.
    2222
    23   @return EFI_SUCCESS               the operation was sucessful
     23  @return EFI_SUCCESS               the operation was successful
    2424  @return other                     the operation failed.
    2525**/
     
    7272  @param SystemTable            The EFI System Table pointer.
    7373
    74   @retval EFI_SUCCESS           Tftp command is executed sucessfully.
     74  @retval EFI_SUCCESS           Tftp command is executed successfully.
    7575  @retval EFI_ABORTED           HII package was failed to initialize.
    7676  @retval others                Other errors when executing tftp command.
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Include/Library/ShellCommandLib.h

    r80721 r85718  
    137137  IN CONST  CHAR16                      *ProfileName,
    138138  IN CONST  BOOLEAN                     CanAffectLE,
    139   IN CONST  EFI_HANDLE                  HiiHandle,
     139  IN CONST  EFI_HII_HANDLE              HiiHandle,
    140140  IN CONST  EFI_STRING_ID               ManFormatHelp
    141141  );
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Include/Library/ShellLib.h

    r80721 r85718  
    966966  IN CONST CHAR8          *Language OPTIONAL,
    967967  IN CONST EFI_STRING_ID  HiiFormatStringId,
    968   IN CONST EFI_HANDLE    HiiFormatHandle,
     968  IN CONST EFI_HII_HANDLE HiiFormatHandle,
    969969  ...
    970970  );
     
    12611261  IN SHELL_PROMPT_REQUEST_TYPE         Type,
    12621262  IN CONST EFI_STRING_ID  HiiFormatStringId,
    1263   IN CONST EFI_HANDLE    HiiFormatHandle,
     1263  IN CONST EFI_HII_HANDLE HiiFormatHandle,
    12641264  IN OUT VOID             **Response
    12651265  );
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c

    r80721 r85718  
    1515#include <Protocol/FirmwareVolume2.h>
    1616
    17 EFI_HANDLE        mHandleParsingHiiHandle = NULL;
     17EFI_HII_HANDLE    mHandleParsingHiiHandle = NULL;
    1818HANDLE_INDEX_LIST mHandleList = {{{NULL,NULL},0,0},0};
    1919GUID_INFO_BLOCK   *mGuidList;
     
    24632463  )
    24642464{
    2465   ASSERT(Guid   != NULL);
    2466   ASSERT(NameID != 0);
    2467 
    2468   mGuidList = ReallocatePool(mGuidListCount * sizeof(GUID_INFO_BLOCK), mGuidListCount+1 * sizeof(GUID_INFO_BLOCK), mGuidList);
     2465  ASSERT (Guid   != NULL);
     2466  ASSERT (NameID != 0);
     2467
     2468  mGuidList = ReallocatePool (
     2469                mGuidListCount * sizeof (GUID_INFO_BLOCK),
     2470                (mGuidListCount + 1) * sizeof (GUID_INFO_BLOCK),
     2471                mGuidList
     2472                );
    24692473  if (mGuidList == NULL) {
    24702474    mGuidListCount = 0;
     
    24732477  mGuidListCount++;
    24742478
    2475   mGuidList[mGuidListCount - 1].GuidId   = AllocateCopyPool(sizeof(EFI_GUID), Guid);
     2479  mGuidList[mGuidListCount - 1].GuidId   = AllocateCopyPool (sizeof (EFI_GUID), Guid);
    24762480  mGuidList[mGuidListCount - 1].StringId = NameID;
    24772481  mGuidList[mGuidListCount - 1].DumpInfo = DumpFunc;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c

    r80721 r85718  
    22  ACPI parser
    33
    4   Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
     4  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
    55  SPDX-License-Identifier: BSD-2-Clause-Patent
    66**/
     
    407407
    408408/**
     409  This function traces 12 characters which can be optionally
     410  formated using the format string if specified.
     411
     412  If no format string is specified the Format must be NULL.
     413
     414  @param [in] Format  Optional format string for tracing the data.
     415  @param [in] Ptr     Pointer to the start of the buffer.
     416**/
     417VOID
     418EFIAPI
     419Dump12Chars (
     420  IN CONST CHAR16* Format OPTIONAL,
     421  IN       UINT8*  Ptr
     422  )
     423{
     424  Print (
     425    (Format != NULL) ? Format : L"%c%c%c%c%c%c%c%c%c%c%c%c",
     426    Ptr[0],
     427    Ptr[1],
     428    Ptr[2],
     429    Ptr[3],
     430    Ptr[4],
     431    Ptr[5],
     432    Ptr[6],
     433    Ptr[7],
     434    Ptr[8],
     435    Ptr[9],
     436    Ptr[10],
     437    Ptr[11]
     438    );
     439}
     440
     441/**
    409442  This function indents and prints the ACPI table Field Name.
    410443
     
    511544  for (Index = 0; Index < ParserItems; Index++) {
    512545    if ((Offset + Parser[Index].Length) > Length) {
     546
     547      // For fields outside the buffer length provided, reset any pointers
     548      // which were supposed to be updated by this function call
     549      if (Parser[Index].ItemPtr != NULL) {
     550        *Parser[Index].ItemPtr = NULL;
     551      }
     552
    513553      // We don't parse past the end of the max length specified
    514       break;
     554      continue;
    515555    }
    516556
     
    634674  )
    635675{
    636   DumpGasStruct (Ptr, 2, GAS_LENGTH);
     676  DumpGasStruct (Ptr, 2, sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE));
    637677}
    638678
     
    655695           "ACPI Table Header",
    656696           Ptr,
    657            ACPI_DESCRIPTION_HEADER_LENGTH,
     697           sizeof (EFI_ACPI_DESCRIPTION_HEADER),
    658698           PARSER_PARAMS (AcpiHeaderParser)
    659699           );
     
    689729                  NULL,
    690730                  Ptr,
    691                   ACPI_DESCRIPTION_HEADER_LENGTH,
     731                  sizeof (EFI_ACPI_DESCRIPTION_HEADER),
    692732                  PARSER_PARAMS (AcpiHeaderParser)
    693733                  );
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h

    r80721 r85718  
    22  Header file for ACPI parser
    33
    4   Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
     4  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
    55  SPDX-License-Identifier: BSD-2-Clause-Patent
    66**/
     
    183183  IN CONST CHAR16* Format OPTIONAL,
    184184  IN UINT8*        Ptr
     185  );
     186
     187/**
     188  This function traces 12 characters which can be optionally
     189  formated using the format string if specified.
     190
     191  If no format string is specified the Format must be NULL.
     192
     193  @param [in] Format  Optional format string for tracing the data.
     194  @param [in] Ptr     Pointer to the start of the buffer.
     195**/
     196VOID
     197EFIAPI
     198Dump12Chars (
     199  IN CONST CHAR16* Format OPTIONAL,
     200  IN       UINT8*  Ptr
    185201  );
    186202
     
    382398
    383399/**
    384   Length of the ACPI GAS structure.
    385 
    386   NOTE: This might normally be defined as
    387         sizeof (EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE).
    388         However, we deliberately minimise any reference to the EDK2 ACPI
    389         headers in an attempt to provide cross checking.
    390 **/
    391 #define GAS_LENGTH                     12
    392 
    393 /**
    394   Length of the ACPI Header structure.
    395 
    396   NOTE: This might normally be defined as
    397         sizeof (EFI_ACPI_DESCRIPTION_HEADER).
    398         However, we deliberately minimise any reference to the EDK2 ACPI
    399         headers in an attempt to provide cross checking.
    400 **/
    401 #define ACPI_DESCRIPTION_HEADER_LENGTH  36
    402 
    403 /**
    404400  This function indents and traces the GAS structure as described by the GasParser.
    405401
     
    523519EFIAPI
    524520ParseAcpiDsdt (
     521  IN BOOLEAN Trace,
     522  IN UINT8*  Ptr,
     523  IN UINT32  AcpiTableLength,
     524  IN UINT8   AcpiTableRevision
     525  );
     526
     527/**
     528  This function parses the ACPI FACS table.
     529  When trace is enabled this function parses the FACS table and
     530  traces the ACPI table fields.
     531
     532  This function also performs validation of the ACPI table fields.
     533
     534  @param [in] Trace              If TRUE, trace the ACPI fields.
     535  @param [in] Ptr                Pointer to the start of the buffer.
     536  @param [in] AcpiTableLength    Length of the ACPI table.
     537  @param [in] AcpiTableRevision  Revision of the ACPI table.
     538**/
     539VOID
     540EFIAPI
     541ParseAcpiFacs (
    525542  IN BOOLEAN Trace,
    526543  IN UINT8*  Ptr,
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c

    r80721 r85718  
    22  ACPI table parser
    33
    4   Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
     4  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
    55  SPDX-License-Identifier: BSD-2-Clause-Patent
     6
     7  @par Glossary:
     8    - Sbbr or SBBR   - Server Base Boot Requirements
     9
     10  @par Reference(s):
     11    - Arm Server Base Boot Requirements 1.2, September 2019
    612**/
    713
     
    1319#include "AcpiView.h"
    1420
     21#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
     22#include "Arm/SbbrValidator.h"
     23#endif
     24
    1525/**
    1626  A list of registered ACPI table parsers.
     
    177187  CONST UINT32* AcpiTableLength;
    178188  CONST UINT8*  AcpiTableRevision;
     189  CONST UINT8*  SignaturePtr;
    179190  PARSE_ACPI_TABLE_PROC ParserProc;
    180191
     
    194205  if (Trace) {
    195206    DumpRaw (Ptr, *AcpiTableLength);
     207
     208    // Do not process the ACPI table any further if the table length read
     209    // is invalid. The ACPI table should at least contain the table header.
     210    if (*AcpiTableLength < sizeof (EFI_ACPI_DESCRIPTION_HEADER)) {
     211      SignaturePtr = (CONST UINT8*)AcpiTableSignature;
     212      IncrementErrorCount ();
     213      Print (
     214        L"ERROR: Invalid %c%c%c%c table length. Length = %d\n",
     215        SignaturePtr[0],
     216        SignaturePtr[1],
     217        SignaturePtr[2],
     218        SignaturePtr[3],
     219        *AcpiTableLength
     220        );
     221      return;
     222    }
     223
    196224    if (GetConsistencyChecking ()) {
    197225      VerifyChecksum (TRUE, Ptr, *AcpiTableLength);
    198226    }
    199227  }
     228
     229#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
     230  if (GetMandatoryTableValidate ()) {
     231    ArmSbbrIncrementTableCount (*AcpiTableSignature);
     232  }
     233#endif
    200234
    201235  Status = GetParser (*AcpiTableSignature, &ParserProc);
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c

    r80721 r85718  
    11/** @file
    22
    3   Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
     3  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
    44  SPDX-License-Identifier: BSD-2-Clause-Patent
     5
     6  @par Glossary:
     7    - Sbbr or SBBR   - Server Base Boot Requirements
     8
     9  @par Reference(s):
     10    - Arm Server Base Boot Requirements 1.2, September 2019
    511**/
    612
     
    1723#include "UefiShellAcpiViewCommandLib.h"
    1824
     25#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
     26#include "Arm/SbbrValidator.h"
     27#endif
     28
    1929EFI_HII_HANDLE gShellAcpiViewHiiHandle = NULL;
    2030
     
    2838STATIC BOOLEAN            mConsistencyCheck;
    2939STATIC BOOLEAN            mColourHighlighting;
     40STATIC BOOLEAN            mMandatoryTableValidate;
     41STATIC UINTN              mMandatoryTableSpec;
    3042
    3143/**
     
    3850  {L"-l", TypeFlag},
    3951  {L"-s", TypeValue},
     52  {L"-r", TypeValue},
    4053  {NULL, TypeMax}
    4154};
     
    93106{
    94107  mConsistencyCheck = ConsistencyChecking;
     108}
     109
     110/**
     111  This function returns the ACPI table requirements validation flag.
     112
     113  @retval TRUE if check for mandatory table presence should be performed.
     114**/
     115BOOLEAN
     116GetMandatoryTableValidate (
     117  VOID
     118  )
     119{
     120  return mMandatoryTableValidate;
     121}
     122
     123/**
     124  This function sets the ACPI table requirements validation flag.
     125
     126  @param  Validate    Enable/Disable ACPI table requirements validation.
     127**/
     128VOID
     129SetMandatoryTableValidate (
     130  BOOLEAN Validate
     131  )
     132{
     133  mMandatoryTableValidate = Validate;
     134}
     135
     136/**
     137  This function returns the identifier of specification to validate ACPI table
     138  requirements against.
     139
     140  @return   ID of specification listing mandatory tables.
     141**/
     142UINTN
     143GetMandatoryTableSpec (
     144  VOID
     145  )
     146{
     147  return mMandatoryTableSpec;
     148}
     149
     150/**
     151  This function sets the identifier of specification to validate ACPI table
     152  requirements against.
     153
     154  @param  Spec      ID of specification listing mandatory tables.
     155**/
     156VOID
     157SetMandatoryTableSpec (
     158  UINTN Spec
     159  )
     160{
     161  mMandatoryTableSpec = Spec;
    95162}
    96163
     
    382449    }
    383450
     451#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
     452    if (GetMandatoryTableValidate ()) {
     453      ArmSbbrResetTableCounts ();
     454    }
     455#endif
     456
    384457    // The RSDP length is 4 bytes starting at offset 20
    385458    RsdpLength = *(UINT32*)(RsdpPtr + RSDP_LENGTH_OFFSET);
     
    409482    return EFI_NOT_FOUND;
    410483  }
     484
     485#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
     486  if (GetMandatoryTableValidate ()) {
     487    ArmSbbrReqsValidate ((ARM_SBBR_VERSION)GetMandatoryTableSpec ());
     488  }
     489#endif
    411490
    412491  ReportOption = GetReportOption ();
     
    471550  CHAR16*            ProblemParam;
    472551  SHELL_FILE_HANDLE  TmpDumpFileHandle;
     552  CONST CHAR16*      MandatoryTableSpecStr;
    473553
    474554  // Set Defaults
     
    480560  mSelectedAcpiTableFound = FALSE;
    481561  mConsistencyCheck = TRUE;
     562  mMandatoryTableValidate = FALSE;
     563  mMandatoryTableSpec = 0;
    482564
    483565  ShellStatus = SHELL_SUCCESS;
     
    536618        L"acpiview",
    537619        L"-s"
     620        );
     621      ShellStatus = SHELL_INVALID_PARAMETER;
     622    } else if (ShellCommandLineGetFlag (Package, L"-r") &&
     623               ShellCommandLineGetValue (Package, L"-r") == NULL) {
     624      ShellPrintHiiEx (
     625        -1,
     626        -1,
     627        NULL,
     628        STRING_TOKEN (STR_GEN_NO_VALUE),
     629        gShellAcpiViewHiiHandle,
     630        L"acpiview",
     631        L"-r"
    538632        );
    539633      ShellStatus = SHELL_INVALID_PARAMETER;
     
    569663      SetConsistencyChecking (!ShellCommandLineGetFlag (Package, L"-q"));
    570664
     665      // Evaluate the parameters for mandatory ACPI table presence checks
     666      SetMandatoryTableValidate (ShellCommandLineGetFlag (Package, L"-r"));
     667      MandatoryTableSpecStr = ShellCommandLineGetValue (Package, L"-r");
     668
     669      if (MandatoryTableSpecStr != NULL) {
     670        SetMandatoryTableSpec (ShellHexStrToUintn (MandatoryTableSpecStr));
     671      }
     672
    571673      if (ShellCommandLineGetFlag (Package, L"-l")) {
    572674        mReportType = ReportTableList;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h

    r80721 r85718  
    22  Header file for AcpiView
    33
    4   Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
     4  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
    55  SPDX-License-Identifier: BSD-2-Clause-Patent
    66**/
     
    114114
    115115/**
     116  This function returns the ACPI table requirements validation flag.
     117
     118  @retval TRUE if check for mandatory table presence should be performed.
     119**/
     120BOOLEAN
     121GetMandatoryTableValidate (
     122  VOID
     123  );
     124
     125/**
     126  This function sets the ACPI table requirements validation flag.
     127
     128  @param  Validate    Enable/Disable ACPI table requirements validation.
     129**/
     130VOID
     131SetMandatoryTableValidate (
     132  BOOLEAN Validate
     133  );
     134
     135/**
     136  This function returns the identifier of specification to validate ACPI table
     137  requirements against.
     138
     139  @return   ID of specification listing mandatory tables.
     140**/
     141UINTN
     142GetMandatoryTableSpec (
     143  VOID
     144  );
     145
     146/**
     147  This function sets the identifier of specification to validate ACPI table
     148  requirements against.
     149
     150  @param  Spec      ID of specification listing mandatory tables.
     151**/
     152VOID
     153SetMandatoryTableSpec (
     154  UINTN Spec
     155  );
     156
     157/**
    116158  This function processes the table reporting options for the ACPI table.
    117159
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c

    r80721 r85718  
    22  DBG2 table parser
    33
    4   Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
     4  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
    55  SPDX-License-Identifier: BSD-2-Clause-Patent
    66
     
    123123    PARSER_PARAMS (DbgDevInfoParser)
    124124    );
     125
     126  // Check if the values used to control the parsing logic have been
     127  // successfully read.
     128  if ((GasCount == NULL)              ||
     129      (NameSpaceStringLength == NULL) ||
     130      (NameSpaceStringOffset == NULL) ||
     131      (OEMDataLength == NULL)         ||
     132      (OEMDataOffset == NULL)         ||
     133      (BaseAddrRegOffset == NULL)     ||
     134      (AddrSizeOffset == NULL)) {
     135    IncrementErrorCount ();
     136    Print (
     137      L"ERROR: Insufficient Debug Device Information Structure length. " \
     138        L"Length = %d.\n",
     139      Length
     140      );
     141    return;
     142  }
    125143
    126144  // GAS
     
    225243             );
    226244
     245  // Check if the values used to control the parsing logic have been
     246  // successfully read.
     247  if ((OffsetDbgDeviceInfo == NULL) ||
     248      (NumberDbgDeviceInfo == NULL)) {
     249    IncrementErrorCount ();
     250    Print (
     251      L"ERROR: Insufficient table length. AcpiTableLength = %d\n",
     252      AcpiTableLength
     253      );
     254    return;
     255  }
     256
    227257  Offset = *OffsetDbgDeviceInfo;
    228258  Index = 0;
     
    240270      );
    241271
    242     // Make sure the Debug Device Information structure lies inside the table.
    243     if ((Offset + *DbgDevInfoLen) > AcpiTableLength) {
     272    // Check if the values used to control the parsing logic have been
     273    // successfully read.
     274    if (DbgDevInfoLen == NULL) {
    244275      IncrementErrorCount ();
    245276      Print (
    246         L"ERROR: Invalid Debug Device Information structure length. " \
    247           L"DbgDevInfoLen = %d. RemainingTableBufferLength = %d. " \
    248           L"DBG2 parsing aborted.\n",
    249         *DbgDevInfoLen,
     277        L"ERROR: Insufficient remaining table buffer length to read the " \
     278          L"Debug Device Information structure's 'Length' field. " \
     279          L"RemainingTableBufferLength = %d.\n",
    250280        AcpiTableLength - Offset
    251281        );
     
    253283    }
    254284
     285    // Validate Debug Device Information Structure length
     286    if ((*DbgDevInfoLen == 0) ||
     287        ((Offset + (*DbgDevInfoLen)) > AcpiTableLength)) {
     288      IncrementErrorCount ();
     289      Print (
     290        L"ERROR: Invalid Debug Device Information Structure length. " \
     291          L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
     292        *DbgDevInfoLen,
     293        Offset,
     294        AcpiTableLength
     295        );
     296      return;
     297    }
     298
    255299    DumpDbgDeviceInfo (Ptr + Offset, (*DbgDevInfoLen));
    256300    Offset += (*DbgDevInfoLen);
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c

    r80721 r85718  
    22  FADT table parser
    33
    4   Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
     4  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
    55  SPDX-License-Identifier: BSD-2-Clause-Patent
    66
    77  @par Reference(s):
    8     - ACPI 6.2 Specification - Errata A, September 2017
     8    - ACPI 6.3 Specification - January 2019
    99**/
    1010
     
    1313#include "AcpiParser.h"
    1414#include "AcpiTableParser.h"
     15#include "AcpiView.h"
    1516
    1617// Local variables
    1718STATIC CONST UINT32* DsdtAddress;
    1819STATIC CONST UINT64* X_DsdtAddress;
     20STATIC CONST UINT32* Flags;
     21STATIC CONST UINT32* FirmwareCtrl;
     22STATIC CONST UINT64* X_FirmwareCtrl;
    1923STATIC CONST UINT8*  FadtMinorRevision;
    2024STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
     
    2428**/
    2529#define HW_REDUCED_ACPI   BIT20
     30
     31/**
     32  Offset to the FACS signature from the start of the FACS.
     33**/
     34#define FACS_SIGNATURE_OFFSET   0
     35
     36/**
     37  Offset to the FACS revision from the start of the FACS.
     38**/
     39#define FACS_VERSION_OFFSET     32
     40
     41/**
     42  Offset to the FACS length from the start of the FACS.
     43**/
     44#define FACS_LENGTH_OFFSET      4
    2645
    2746/**
     
    114133STATIC CONST ACPI_PARSER FadtParser[] = {
    115134  PARSE_ACPI_HEADER (&AcpiHdrInfo),
    116   {L"FIRMWARE_CTRL", 4, 36, L"0x%x", NULL, NULL, ValidateFirmwareCtrl, NULL},
     135  {L"FIRMWARE_CTRL", 4, 36, L"0x%x", NULL, (VOID**)&FirmwareCtrl,
     136    ValidateFirmwareCtrl, NULL},
    117137  {L"DSDT", 4, 40, L"0x%x", NULL, (VOID**)&DsdtAddress, NULL, NULL},
    118138  {L"Reserved", 1, 44, L"%x", NULL, NULL, NULL, NULL},
     
    151171  {L"IAPC_BOOT_ARCH", 2, 109, L"0x%x", NULL, NULL, NULL, NULL},
    152172  {L"Reserved", 1, 111, L"0x%x", NULL, NULL, NULL, NULL},
    153   {L"Flags", 4, 112, L"0x%x", NULL, NULL, ValidateFlags, NULL},
     173  {L"Flags", 4, 112, L"0x%x", NULL, (VOID**)&Flags, ValidateFlags, NULL},
    154174  {L"RESET_REG", 12, 116, NULL, DumpGas, NULL, NULL, NULL},
    155175  {L"RESET_VALUE", 1, 128, L"0x%x", NULL, NULL, NULL, NULL},
     
    157177  {L"FADT Minor Version", 1, 131, L"0x%x", NULL, (VOID**)&FadtMinorRevision,
    158178    NULL, NULL},
    159   {L"X_FIRMWARE_CTRL", 8, 132, L"0x%lx", NULL, NULL,
     179  {L"X_FIRMWARE_CTRL", 8, 132, L"0x%lx", NULL, (VOID**)&X_FirmwareCtrl,
    160180    ValidateXFirmwareCtrl, NULL},
    161181  {L"X_DSDT", 8, 140, L"0x%lx", NULL, (VOID**)&X_DsdtAddress, NULL, NULL},
     
    193213  )
    194214{
    195   UINT8*  DsdtPtr;
     215  EFI_STATUS              Status;
     216  UINT8*                  DsdtPtr;
     217  UINT8*                  FirmwareCtrlPtr;
     218  UINT32                  FacsSignature;
     219  UINT32                  FacsLength;
     220  UINT8                   FacsRevision;
     221  PARSE_ACPI_TABLE_PROC   FacsParserProc;
    196222
    197223  ParseAcpi (
     
    205231
    206232  if (Trace) {
    207     Print (L"\nSummary:\n");
    208     PrintFieldName (2, L"FADT Version");
    209     Print (L"%d.%d\n",  *AcpiHdrInfo.Revision, *FadtMinorRevision);
     233    if (FadtMinorRevision != NULL) {
     234      Print (L"\nSummary:\n");
     235      PrintFieldName (2, L"FADT Version");
     236      Print (L"%d.%d\n",  *AcpiHdrInfo.Revision, *FadtMinorRevision);
     237    }
    210238
    211239    if (*GetAcpiXsdtHeaderInfo ()->OemTableId != *AcpiHdrInfo.OemTableId) {
     
    215243  }
    216244
    217   // If X_DSDT is not zero then use X_DSDT and ignore DSDT,
    218   // else use DSDT.
    219   if (*X_DsdtAddress != 0) {
     245  // If X_FIRMWARE_CTRL is not zero then use X_FIRMWARE_CTRL and ignore
     246  // FIRMWARE_CTRL, else use FIRMWARE_CTRL.
     247  if ((X_FirmwareCtrl != NULL) && (*X_FirmwareCtrl != 0)) {
     248    FirmwareCtrlPtr = (UINT8*)(UINTN)(*X_FirmwareCtrl);
     249  } else if ((FirmwareCtrl != NULL) && (*FirmwareCtrl != 0)) {
     250    FirmwareCtrlPtr = (UINT8*)(UINTN)(*FirmwareCtrl);
     251  } else {
     252    FirmwareCtrlPtr = NULL;
     253    // if HW_REDUCED_ACPI flag is not set, both FIRMWARE_CTRL and
     254    // X_FIRMWARE_CTRL cannot be zero, and the FACS Table must be
     255    // present.
     256    if ((Trace) &&
     257        (Flags != NULL) &&
     258        ((*Flags & EFI_ACPI_6_3_HW_REDUCED_ACPI) != EFI_ACPI_6_3_HW_REDUCED_ACPI)) {
     259      IncrementErrorCount ();
     260      Print (L"ERROR: No FACS table found, "
     261               L"both X_FIRMWARE_CTRL and FIRMWARE_CTRL are zero.\n");
     262    }
     263  }
     264
     265  if (FirmwareCtrlPtr != NULL) {
     266    // The FACS table does not have a standard ACPI table header. Therefore,
     267    // the signature, length and version needs to be initially parsed.
     268    // The FACS signature is 4 bytes starting at offset 0.
     269    FacsSignature = *(UINT32*)(FirmwareCtrlPtr + FACS_SIGNATURE_OFFSET);
     270
     271    // The FACS length is 4 bytes starting at offset 4.
     272    FacsLength = *(UINT32*)(FirmwareCtrlPtr + FACS_LENGTH_OFFSET);
     273
     274    // The FACS version is 1 byte starting at offset 32.
     275    FacsRevision = *(UINT8*)(FirmwareCtrlPtr + FACS_VERSION_OFFSET);
     276
     277    Trace = ProcessTableReportOptions (
     278              FacsSignature,
     279              FirmwareCtrlPtr,
     280              FacsLength
     281              );
     282
     283    Status = GetParser (FacsSignature, &FacsParserProc);
     284    if (EFI_ERROR (Status)) {
     285      Print (
     286        L"ERROR: No registered parser found for FACS.\n"
     287        );
     288      return;
     289    }
     290
     291    FacsParserProc (
     292      Trace,
     293      FirmwareCtrlPtr,
     294      FacsLength,
     295      FacsRevision
     296      );
     297  }
     298
     299  // If X_DSDT is valid then use X_DSDT and ignore DSDT, else use DSDT.
     300  if ((X_DsdtAddress != NULL) && (*X_DsdtAddress != 0)) {
    220301    DsdtPtr = (UINT8*)(UINTN)(*X_DsdtAddress);
    221   } else if (*DsdtAddress != 0) {
     302  } else if ((DsdtAddress != NULL) && (*DsdtAddress != 0)) {
    222303    DsdtPtr = (UINT8*)(UINTN)(*DsdtAddress);
    223304  } else {
    224     // Both DSDT and X_DSDT cannot be zero.
     305    // Both DSDT and X_DSDT cannot be invalid.
    225306#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
    226307    if (Trace) {
     
    229310      // the DSDT.
    230311      IncrementErrorCount ();
    231       Print (L"ERROR: Both X_DSDT and DSDT are NULL.\n");
     312      Print (L"ERROR: Both X_DSDT and DSDT are invalid.\n");
    232313    }
    233314#endif
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c

    r80721 r85718  
    22  GTDT table parser
    33
    4   Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
     4  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
    55  SPDX-License-Identifier: BSD-2-Clause-Patent
    66
     
    189189    PARSER_PARAMS (GtBlockParser)
    190190    );
     191
     192  // Check if the values used to control the parsing logic have been
     193  // successfully read.
     194  if ((GtBlockTimerCount == NULL) ||
     195      (GtBlockTimerOffset == NULL)) {
     196    IncrementErrorCount ();
     197    Print (
     198      L"ERROR: Insufficient GT Block Structure length. Length = %d.\n",
     199      Length
     200      );
     201    return;
     202  }
    191203
    192204  Offset = *GtBlockTimerOffset;
     
    273285    );
    274286
     287  // Check if the values used to control the parsing logic have been
     288  // successfully read.
     289  if ((GtdtPlatformTimerCount == NULL) ||
     290      (GtdtPlatformTimerOffset == NULL)) {
     291    IncrementErrorCount ();
     292    Print (
     293      L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
     294      AcpiTableLength
     295      );
     296    return;
     297  }
     298
    275299  TimerPtr = Ptr + *GtdtPlatformTimerOffset;
    276300  Offset = *GtdtPlatformTimerOffset;
     
    291315      );
    292316
    293     // Make sure the Platform Timer is inside the table.
    294     if ((Offset + *PlatformTimerLength) > AcpiTableLength) {
     317    // Check if the values used to control the parsing logic have been
     318    // successfully read.
     319    if ((PlatformTimerType == NULL) ||
     320        (PlatformTimerLength == NULL)) {
     321      IncrementErrorCount ();
     322      Print (
     323        L"ERROR: Insufficient remaining table buffer length to read the " \
     324          L"Platform Timer Structure header. Length = %d.\n",
     325        AcpiTableLength - Offset
     326        );
     327      return;
     328    }
     329
     330    // Validate Platform Timer Structure length
     331    if ((*PlatformTimerLength == 0) ||
     332        ((Offset + (*PlatformTimerLength)) > AcpiTableLength)) {
    295333      IncrementErrorCount ();
    296334      Print (
    297335        L"ERROR: Invalid Platform Timer Structure length. " \
    298           L"PlatformTimerLength = %d. RemainingTableBufferLength = %d. " \
    299           L"GTDT parsing aborted.\n",
     336          L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
    300337        *PlatformTimerLength,
    301         AcpiTableLength - Offset
     338        Offset,
     339        AcpiTableLength
    302340        );
    303341      return;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c

    r80721 r85718  
    22  IORT table parser
    33
    4   Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
     4  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
    55  SPDX-License-Identifier: BSD-2-Clause-Patent
    66
    77  @par Reference(s):
    8     - IO Remapping Table, Platform Design Document, Revision C, 15 May 2017
     8    - IO Remapping Table, Platform Design Document, Revision D, March 2018
    99**/
    1010
     
    194194  {L"PRI", 4, 48, L"0x%x", NULL, NULL, NULL, NULL},
    195195  {L"GERR", 4, 52, L"0x%x", NULL, NULL, NULL, NULL},
    196   {L"Sync", 4, 56, L"0x%x", NULL, NULL, NULL, NULL}
     196  {L"Sync", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},
     197  {L"Proximity domain", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},
     198  {L"Device ID mapping index", 4, 64, L"%d", NULL, NULL, NULL, NULL}
    197199};
    198200
     
    232234  {L"Memory access properties", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},
    233235  {L"ATS Attribute", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
    234   {L"PCI Segment number", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}
     236  {L"PCI Segment number", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},
     237  {L"Memory access size limit", 1, 32, L"0x%x", NULL, NULL, NULL, NULL},
     238  {L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}
    235239};
    236240
     
    240244STATIC CONST ACPI_PARSER IortNodePmcgParser[] = {
    241245  PARSE_IORT_NODE_HEADER (ValidatePmcgIdMappingCount, NULL),
    242   {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},
     246  {L"Page 0 Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},
    243247  {L"Overflow interrupt GSIV", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
    244248  {L"Node reference", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},
     249  {L"Page 1 Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}
    245250};
    246251
     
    318323    );
    319324
     325  // Check if the values used to control the parsing logic have been
     326  // successfully read.
     327  if ((InterruptContextCount == NULL)   ||
     328      (InterruptContextOffset == NULL)  ||
     329      (PmuInterruptCount == NULL)       ||
     330      (PmuInterruptOffset == NULL)) {
     331    IncrementErrorCount ();
     332    Print (
     333      L"ERROR: Insufficient SMMUv1/2 node length. Length = %d\n",
     334      Length
     335      );
     336    return;
     337  }
     338
    320339  Offset = *InterruptContextOffset;
    321340  Index = 0;
     
    429448            );
    430449
     450  // Check if the values used to control the parsing logic have been
     451  // successfully read.
     452  if (ItsCount == NULL) {
     453    IncrementErrorCount ();
     454    Print (
     455      L"ERROR: Insufficient ITS group length. Length = %d.\n",
     456      Length
     457      );
     458    return;
     459  }
     460
    431461  Index = 0;
    432462
     
    613643    );
    614644
     645  // Check if the values used to control the parsing logic have been
     646  // successfully read.
     647  if ((IortNodeCount == NULL) ||
     648      (IortNodeOffset == NULL)) {
     649    IncrementErrorCount ();
     650    Print (
     651      L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
     652      AcpiTableLength
     653      );
     654    return;
     655  }
     656
    615657  Offset = *IortNodeOffset;
    616658  NodePtr = Ptr + Offset;
     
    631673      );
    632674
    633     // Make sure the IORT Node is inside the table
    634     if ((Offset + (*IortNodeLength)) > AcpiTableLength) {
     675    // Check if the values used to control the parsing logic have been
     676    // successfully read.
     677    if ((IortNodeType == NULL)        ||
     678        (IortNodeLength == NULL)      ||
     679        (IortIdMappingCount == NULL)  ||
     680        (IortIdMappingOffset == NULL)) {
    635681      IncrementErrorCount ();
    636682      Print (
    637         L"ERROR: Invalid IORT node length. IortNodeLength = %d. " \
    638           L"RemainingTableBufferLength = %d. IORT parsing aborted.\n",
     683        L"ERROR: Insufficient remaining table buffer length to read the " \
     684          L"IORT node header. Length = %d.\n",
     685        AcpiTableLength - Offset
     686        );
     687      return;
     688    }
     689
     690    // Validate IORT Node length
     691    if ((*IortNodeLength == 0) ||
     692        ((Offset + (*IortNodeLength)) > AcpiTableLength)) {
     693      IncrementErrorCount ();
     694      Print (
     695        L"ERROR: Invalid IORT Node length. " \
     696          L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
    639697        *IortNodeLength,
    640         AcpiTableLength - Offset
     698        Offset,
     699        AcpiTableLength
    641700        );
    642701      return;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c

    r80721 r85718  
    22  MADT table parser
    33
    4   Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
     4  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
    55  SPDX-License-Identifier: BSD-2-Clause-Patent
    66
     
    261261      );
    262262
    263     // Make sure forward progress is made.
    264     if (*MadtInterruptControllerLength < 2) {
     263    // Check if the values used to control the parsing logic have been
     264    // successfully read.
     265    if ((MadtInterruptControllerType == NULL) ||
     266        (MadtInterruptControllerLength == NULL)) {
    265267      IncrementErrorCount ();
    266268      Print (
    267         L"ERROR: Structure length is too small: " \
    268           L"MadtInterruptControllerLength = %d. " \
    269           L"MadtInterruptControllerType = %d. MADT parsing aborted.\n",
    270         *MadtInterruptControllerLength,
    271         *MadtInterruptControllerType
     269        L"ERROR: Insufficient remaining table buffer length to read the " \
     270          L"Interrupt Controller Structure header. Length = %d.\n",
     271        AcpiTableLength - Offset
    272272        );
    273273      return;
    274274    }
    275275
    276     // Make sure the MADT structure lies inside the table
    277     if ((Offset + *MadtInterruptControllerLength) > AcpiTableLength) {
     276    // Validate Interrupt Controller Structure length
     277    if ((*MadtInterruptControllerLength == 0) ||
     278        ((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength)) {
    278279      IncrementErrorCount ();
    279280      Print (
    280         L"ERROR: Invalid MADT structure length. " \
    281           L"MadtInterruptControllerLength = %d. " \
    282           L"RemainingTableBufferLength = %d. MADT parsing aborted.\n",
     281        L"ERROR: Invalid Interrupt Controller Structure length. " \
     282          L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
    283283        *MadtInterruptControllerLength,
    284         AcpiTableLength - Offset
     284        Offset,
     285        AcpiTableLength
    285286        );
    286287      return;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c

    r80721 r85718  
    22  PPTT table parser
    33
    4   Copyright (c) 2019, ARM Limited. All rights reserved.
     4  Copyright (c) 2019 - 2020, ARM Limited. All rights reserved.
    55  SPDX-License-Identifier: BSD-2-Clause-Patent
    66
     
    265265             );
    266266
     267  // Check if the values used to control the parsing logic have been
     268  // successfully read.
     269  if (NumberOfPrivateResources == NULL) {
     270    IncrementErrorCount ();
     271    Print (
     272      L"ERROR: Insufficient Processor Hierarchy Node length. Length = %d.\n",
     273      Length
     274      );
     275    return;
     276  }
     277
    267278  // Make sure the Private Resource array lies inside this structure
    268279  if (Offset + (*NumberOfPrivateResources * sizeof (UINT32)) > Length) {
     
    388399             PARSER_PARAMS (PpttParser)
    389400             );
     401
    390402  ProcessorTopologyStructurePtr = Ptr + Offset;
    391403
     
    401413      );
    402414
    403     // Make sure the PPTT structure lies inside the table
    404     if ((Offset + *ProcessorTopologyStructureLength) > AcpiTableLength) {
     415    // Check if the values used to control the parsing logic have been
     416    // successfully read.
     417    if ((ProcessorTopologyStructureType == NULL) ||
     418        (ProcessorTopologyStructureLength == NULL)) {
    405419      IncrementErrorCount ();
    406420      Print (
    407         L"ERROR: Invalid PPTT structure length. " \
    408           L"ProcessorTopologyStructureLength = %d. " \
    409           L"RemainingTableBufferLength = %d. PPTT parsing aborted.\n",
     421        L"ERROR: Insufficient remaining table buffer length to read the " \
     422          L"processor topology structure header. Length = %d.\n",
     423        AcpiTableLength - Offset
     424        );
     425      return;
     426    }
     427
     428    // Validate Processor Topology Structure length
     429    if ((*ProcessorTopologyStructureLength == 0) ||
     430        ((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength)) {
     431      IncrementErrorCount ();
     432      Print (
     433        L"ERROR: Invalid Processor Topology Structure length. " \
     434          L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
    410435        *ProcessorTopologyStructureLength,
    411         AcpiTableLength - Offset
     436        Offset,
     437        AcpiTableLength
    412438        );
    413439      return;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c

    r80721 r85718  
    139139    );
    140140
     141  // Check if the values used to control the parsing logic have been
     142  // successfully read.
     143  if (XsdtAddress == NULL) {
     144    IncrementErrorCount ();
     145    Print (
     146      L"ERROR: Insufficient table length. AcpiTableLength = %d." \
     147        L"RSDP parsing aborted.\n",
     148      AcpiTableLength
     149      );
     150    return;
     151  }
     152
    141153  // This code currently supports parsing of XSDT table only
    142154  // and does not parse the RSDT table. Platforms provide the
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c

    r80721 r85718  
    22  SLIT table parser
    33
    4   Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
     4  Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
    55  SPDX-License-Identifier: BSD-2-Clause-Patent
    66
     
    3131  Macro to get the value of a System Locality
    3232**/
    33 #define SLIT_ELEMENT(Ptr, i, j) *(Ptr + (MultU64x64 (i, LocalityCount)) + j)
     33#define SLIT_ELEMENT(Ptr, i, j) *(Ptr + (i * LocalityCount) + j)
    3434
    3535/**
     
    5858{
    5959  UINT32 Offset;
    60   UINT64 Count;
    61   UINT64 Index;
    62   UINT64 LocalityCount;
     60  UINT32 Count;
     61  UINT32 Index;
     62  UINT32 LocalityCount;
    6363  UINT8* LocalityPtr;
    6464  CHAR16 Buffer[80];  // Used for AsciiName param of ParseAcpi
     
    7676             PARSER_PARAMS (SlitParser)
    7777             );
     78
     79  // Check if the values used to control the parsing logic have been
     80  // successfully read.
     81  if (SlitSystemLocalityCount == NULL) {
     82    IncrementErrorCount ();
     83    Print (
     84      L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
     85      AcpiTableLength
     86      );
     87    return;
     88  }
     89
     90  /*
     91    Despite the 'Number of System Localities' being a 64-bit field in SLIT,
     92    the maximum number of localities that can be represented in SLIT is limited
     93    by the 'Length' field of the ACPI table.
     94
     95    Since the ACPI table length field is 32-bit wide. The maximum number of
     96    localities that can be represented in SLIT can be calculated as:
     97
     98    MaxLocality = sqrt (MAX_UINT32 - sizeof (EFI_ACPI_6_3_SYSTEM_LOCALITY_DISTANCE_INFORMATION_TABLE_HEADER))
     99                = 65535
     100                = MAX_UINT16
     101  */
     102  if (*SlitSystemLocalityCount > MAX_UINT16) {
     103    IncrementErrorCount ();
     104    Print (
     105      L"ERROR: The Number of System Localities provided can't be represented " \
     106        L"in the SLIT table. SlitSystemLocalityCount = %ld. " \
     107        L"MaxLocalityCountAllowed = %d.\n",
     108      *SlitSystemLocalityCount,
     109      MAX_UINT16
     110      );
     111    return;
     112  }
     113
     114  LocalityCount = (UINT32)*SlitSystemLocalityCount;
     115
     116  // Make sure system localities fit in the table buffer provided
     117  if (Offset + (LocalityCount * LocalityCount) > AcpiTableLength) {
     118    IncrementErrorCount ();
     119    Print (
     120      L"ERROR: Invalid Number of System Localities. " \
     121        L"SlitSystemLocalityCount = %ld. AcpiTableLength = %d.\n",
     122      *SlitSystemLocalityCount,
     123      AcpiTableLength
     124      );
     125    return;
     126  }
     127
    78128  LocalityPtr = Ptr + Offset;
    79129
    80   LocalityCount = *SlitSystemLocalityCount;
    81130  // We only print the Localities if the count is less than 16
    82131  // If the locality count is more than 16 then refer to the
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c

    r80721 r85718  
    22  SRAT table parser
    33
    4   Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
     4  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
    55  SPDX-License-Identifier: BSD-2-Clause-Patent
    66
    77  @par Reference(s):
    8     - ACPI 6.2 Specification - Errata A, September 2017
     8    - ACPI 6.3 Specification - January 2019
    99**/
    1010
     
    1818STATIC CONST UINT8* SratRAType;
    1919STATIC CONST UINT8* SratRALength;
     20STATIC CONST UINT8* SratDeviceHandleType;
    2021STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
    2122
     
    4243
    4344/**
     45  This function validates the Device Handle Type field in the Generic Initiator
     46  Affinity Structure.
     47
     48  @param [in] Ptr     Pointer to the start of the field data.
     49  @param [in] Context Pointer to context specific information e.g. this
     50                      could be a pointer to the ACPI table header.
     51**/
     52STATIC
     53VOID
     54EFIAPI
     55ValidateSratDeviceHandleType (
     56  IN UINT8* Ptr,
     57  IN VOID*  Context
     58  )
     59{
     60  UINT8   DeviceHandleType;
     61
     62  DeviceHandleType = *Ptr;
     63
     64  if (DeviceHandleType > EFI_ACPI_6_3_PCI_DEVICE_HANDLE) {
     65    IncrementErrorCount ();
     66    Print (
     67      L"\nERROR: Invalid Device Handle Type: %d. Must be between 0 and %d.",
     68      DeviceHandleType,
     69      EFI_ACPI_6_3_PCI_DEVICE_HANDLE
     70      );
     71  }
     72}
     73
     74/**
     75  This function traces the PCI BDF Number field inside Device Handle - PCI
     76
     77  @param [in] Format  Format string for tracing the data.
     78  @param [in] Ptr     Pointer to the start of the buffer.
     79**/
     80STATIC
     81VOID
     82EFIAPI
     83DumpSratPciBdfNumber (
     84  IN CONST CHAR16* Format,
     85  IN UINT8*        Ptr
     86  )
     87{
     88  CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
     89
     90  Print (L"\n");
     91
     92  /*
     93    The PCI BDF Number subfields are printed in the order specified in the ACPI
     94    specification. The format of the 16-bit PCI BDF Number field is as follows:
     95
     96    +-----+------+------+
     97    |DEV  | FUNC | BUS  |
     98    +-----+------+------+
     99    |15:11| 10:8 |  7:0 |
     100    +-----+------+------+
     101  */
     102
     103  // Print PCI Bus Number (Bits 7:0 of Byte 2)
     104  UnicodeSPrint (
     105    Buffer,
     106    sizeof (Buffer),
     107    L"PCI Bus Number"
     108    );
     109  PrintFieldName (4, Buffer);
     110  Print (
     111    L"0x%x\n",
     112    *Ptr
     113    );
     114
     115  Ptr++;
     116
     117  // Print PCI Device Number (Bits 7:3 of Byte 3)
     118  UnicodeSPrint (
     119    Buffer,
     120    sizeof (Buffer),
     121    L"PCI Device Number"
     122    );
     123  PrintFieldName (4, Buffer);
     124  Print (
     125    L"0x%x\n",
     126    (*Ptr & (BIT7 | BIT6 | BIT5 | BIT4 | BIT3)) >> 3
     127    );
     128
     129  // PCI Function Number (Bits 2:0 of Byte 3)
     130  UnicodeSPrint (
     131    Buffer,
     132    sizeof (Buffer),
     133    L"PCI Function Number"
     134    );
     135  PrintFieldName (4, Buffer);
     136  Print (
     137    L"0x%x\n",
     138    *Ptr & (BIT2 | BIT1 | BIT0)
     139    );
     140}
     141
     142/**
     143  An ACPI_PARSER array describing the Device Handle - ACPI
     144**/
     145STATIC CONST ACPI_PARSER SratDeviceHandleAcpiParser[] = {
     146  {L"ACPI_HID", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL},
     147  {L"ACPI_UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
     148  {L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}
     149};
     150
     151/**
     152  An ACPI_PARSER array describing the Device Handle - PCI
     153**/
     154STATIC CONST ACPI_PARSER SratDeviceHandlePciParser[] = {
     155  {L"PCI Segment", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},
     156  {L"PCI BDF Number", 2, 2, NULL, DumpSratPciBdfNumber, NULL, NULL, NULL},
     157  {L"Reserved", 12, 4, L"%x %x %x %x - %x %x %x %x - %x %x %x %x", Dump12Chars,
     158   NULL, NULL, NULL}
     159};
     160
     161/**
     162  This function traces the Device Handle field inside Generic Initiator
     163  Affinity Structure.
     164
     165  @param [in] Format  Format string for tracing the data.
     166  @param [in] Ptr     Pointer to the start of the buffer.
     167**/
     168STATIC
     169VOID
     170EFIAPI
     171DumpSratDeviceHandle (
     172  IN CONST CHAR16* Format,
     173  IN UINT8*        Ptr
     174 )
     175{
     176  if (SratDeviceHandleType == NULL) {
     177    IncrementErrorCount ();
     178    Print (L"\nERROR: Device Handle Type read incorrectly.\n");
     179    return;
     180  }
     181
     182  Print (L"\n");
     183
     184  if (*SratDeviceHandleType == EFI_ACPI_6_3_ACPI_DEVICE_HANDLE) {
     185    ParseAcpi (
     186      TRUE,
     187      2,
     188      NULL,
     189      Ptr,
     190      sizeof (EFI_ACPI_6_3_DEVICE_HANDLE_ACPI),
     191      PARSER_PARAMS (SratDeviceHandleAcpiParser)
     192      );
     193  } else if (*SratDeviceHandleType == EFI_ACPI_6_3_PCI_DEVICE_HANDLE) {
     194    ParseAcpi (
     195      TRUE,
     196      2,
     197      NULL,
     198      Ptr,
     199      sizeof (EFI_ACPI_6_3_DEVICE_HANDLE_PCI),
     200      PARSER_PARAMS (SratDeviceHandlePciParser)
     201      );
     202  }
     203}
     204
     205/**
    44206  This function traces the APIC Proximity Domain field.
    45207
     
    102264  {L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL},
    103265  {L"ITS Id", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
     266};
     267
     268/**
     269  An ACPI_PARSER array describing the Generic Initiator Affinity Structure
     270**/
     271STATIC CONST ACPI_PARSER SratGenericInitiatorAffinityParser[] = {
     272  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
     273  {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
     274
     275  {L"Reserved", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},
     276  {L"Device Handle Type", 1, 3, L"%d", NULL, (VOID**)&SratDeviceHandleType,
     277   ValidateSratDeviceHandleType, NULL},
     278  {L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
     279  {L"Device Handle", 16, 8, L"%s", DumpSratDeviceHandle, NULL, NULL, NULL},
     280  {L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
     281  {L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}
    104282};
    105283
     
    184362  UINT32 GicCAffinityIndex;
    185363  UINT32 GicITSAffinityIndex;
     364  UINT32 GenericInitiatorAffinityIndex;
    186365  UINT32 MemoryAffinityIndex;
    187366  UINT32 ApicSapicAffinityIndex;
     
    191370  GicCAffinityIndex = 0;
    192371  GicITSAffinityIndex = 0;
     372  GenericInitiatorAffinityIndex = 0;
    193373  MemoryAffinityIndex = 0;
    194374  ApicSapicAffinityIndex = 0;
     
    220400      );
    221401
    222     // Make sure the SRAT structure lies inside the table
    223     if ((Offset + *SratRALength) > AcpiTableLength) {
     402    // Check if the values used to control the parsing logic have been
     403    // successfully read.
     404    if ((SratRAType == NULL) ||
     405        (SratRALength == NULL)) {
    224406      IncrementErrorCount ();
    225407      Print (
    226         L"ERROR: Invalid SRAT structure length. SratRALength = %d. " \
    227           L"RemainingTableBufferLength = %d. SRAT parsing aborted.\n",
    228         *SratRALength,
     408        L"ERROR: Insufficient remaining table buffer length to read the " \
     409          L"Static Resource Allocation structure header. Length = %d.\n",
    229410        AcpiTableLength - Offset
    230411        );
     
    232413    }
    233414
     415    // Validate Static Resource Allocation Structure length
     416    if ((*SratRALength == 0) ||
     417        ((Offset + (*SratRALength)) > AcpiTableLength)) {
     418      IncrementErrorCount ();
     419      Print (
     420        L"ERROR: Invalid Static Resource Allocation Structure length. " \
     421          L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
     422        *SratRALength,
     423        Offset,
     424        AcpiTableLength
     425        );
     426      return;
     427    }
     428
    234429    switch (*SratRAType) {
    235       case EFI_ACPI_6_2_GICC_AFFINITY:
     430      case EFI_ACPI_6_3_GICC_AFFINITY:
    236431        AsciiSPrint (
    237432          Buffer,
     
    250445        break;
    251446
    252       case EFI_ACPI_6_2_GIC_ITS_AFFINITY:
     447      case EFI_ACPI_6_3_GIC_ITS_AFFINITY:
    253448        AsciiSPrint (
    254449          Buffer,
     
    267462        break;
    268463
    269       case EFI_ACPI_6_2_MEMORY_AFFINITY:
     464      case EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY:
     465        AsciiSPrint (
     466          Buffer,
     467          sizeof (Buffer),
     468          "Generic Initiator Affinity Structure [%d]",
     469          GenericInitiatorAffinityIndex++
     470        );
     471        ParseAcpi (
     472          TRUE,
     473          2,
     474          Buffer,
     475          ResourcePtr,
     476          *SratRALength,
     477          PARSER_PARAMS (SratGenericInitiatorAffinityParser)
     478        );
     479        break;
     480
     481      case EFI_ACPI_6_3_MEMORY_AFFINITY:
    270482        AsciiSPrint (
    271483          Buffer,
     
    284496        break;
    285497
    286       case EFI_ACPI_6_2_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY:
     498      case EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY:
    287499        AsciiSPrint (
    288500          Buffer,
     
    301513        break;
    302514
    303       case EFI_ACPI_6_2_PROCESSOR_LOCAL_X2APIC_AFFINITY:
     515      case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC_AFFINITY:
    304516        AsciiSPrint (
    305517          Buffer,
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c

    r80721 r85718  
    3030  {EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
    3131   ParseAcpiDsdt},
     32  {EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE, ParseAcpiFacs},
    3233  {EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiFadt},
    3334  {EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiGtdt},
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf

    r80721 r85718  
    22# Provides Shell 'acpiview' command functions
    33#
    4 # Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.<BR>
     4# Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.<BR>
    55#
    66#  SPDX-License-Identifier: BSD-2-Clause-Patent
     
    3232  Parsers/Dbg2/Dbg2Parser.c
    3333  Parsers/Dsdt/DsdtParser.c
     34  Parsers/Facs/FacsParser.c
    3435  Parsers/Fadt/FadtParser.c
    3536  Parsers/Gtdt/GtdtParser.c
     
    4647  Parsers/Madt/MadtParser.h
    4748  Parsers/Pptt/PpttParser.h
     49
     50[Sources.ARM, Sources.AARCH64]
     51  Arm/SbbrValidator.h
     52  Arm/SbbrValidator.c
    4853
    4954[Packages]
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni

    r80721 r85718  
    11// /**
    22//
    3 // Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.<BR>
     3// Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.<BR>
    44// SPDX-License-Identifier: BSD-2-Clause-Patent
    55//
     
    3131".SH SYNOPSIS\r\n"
    3232" \r\n"
    33 "ACPIVIEW [[-?] | [[-l] | [-s AcpiTable [-d]]] [-q] [-h]]\r\n"
     33"ACPIVIEW [[-?] | [[[[-l] | [-s AcpiTable [-d]]] [-q] [-h]] [-r Spec]]]\r\n"
    3434" \r\n"
    3535".SH OPTIONS\r\n"
     
    4242"  -q - Quiet. Suppress errors and warnings. Disables consistency checks.\r\n"
    4343"  -h - Enable colour highlighting.\r\n"
     44"  -r - Validate that all required ACPI tables are installed\r\n"
     45"         Spec  : Specification to validate against.\r\n"
     46"                 For Arm, the possible values are:\r\n"
     47"                   0 - Server Base Boot Requirements v1.0\r\n"
     48"                   1 - Server Base Boot Requirements v1.1\r\n"
     49"                   2 - Server Base Boot Requirements v1.2\r\n"
    4450"  -? - Show help.\r\n"
    4551" \r\n"
     
    119125"    fs0:\> acpiview\r\n"
    120126" \r\n"
     127"  * To check if all Server Base Boot Requirements (SBBR) v1.2 mandatory\r\n"
     128"    ACPI tables are installed (Arm only):\r\n"
     129"    fs0:\> acpiview -r 2\r\n"
     130" \r\n"
    121131".SH RETURNVALUES\r\n"
    122132" \r\n"
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c

    r80721 r85718  
    3939
    4040STATIC CONST CHAR16 mFileName[] = L"ShellCommands";
    41 STATIC EFI_HANDLE gShellBcfgHiiHandle  = NULL;
     41STATIC EFI_HII_HANDLE gShellBcfgHiiHandle  = NULL;
    4242
    4343typedef enum {
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c

    r80721 r85718  
    7575  CHAR8                           *PlatformLang;
    7676
    77   GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, (VOID**)&PlatformLang, NULL);
    78   if (PlatformLang == NULL) {
    79     return EFI_UNSUPPORTED;
    80   }
    81 
    8277  if (gUnicodeCollation == NULL) {
     78
     79    GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, (VOID**)&PlatformLang, NULL);
     80
    8381    Status = gBS->LocateHandleBuffer (
    8482                    ByProtocol,
     
    109107
    110108      //
     109      // Without clue provided use the first Unicode Collation2 protocol.
     110      // This may happen when PlatformLang is NULL or when no installed Unicode
     111      // Collation2 protocol instance supports PlatformLang.
     112      //
     113      if (gUnicodeCollation == NULL) {
     114        gUnicodeCollation = Uc;
     115      }
     116      if (PlatformLang == NULL) {
     117        break;
     118      }
     119
     120      //
    111121      // Find the best matching matching language from the supported languages
    112122      // of Unicode Collation2 protocol.
     
    127137      FreePool (Handles);
    128138    }
    129     FreePool (PlatformLang);
     139    if (PlatformLang != NULL) {
     140      FreePool (PlatformLang);
     141    }
    130142  }
    131143
     
    547559  IN CONST  CHAR16                      *ProfileName,
    548560  IN CONST  BOOLEAN                     CanAffectLE,
    549   IN CONST  EFI_HANDLE                  HiiHandle,
     561  IN CONST  EFI_HII_HANDLE              HiiHandle,
    550562  IN CONST  EFI_STRING_ID               ManFormatHelp
    551563  )
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h

    r80721 r85718  
    4747  SHELL_RUN_COMMAND           CommandHandler;
    4848  BOOLEAN                     LastError;
    49   EFI_HANDLE                  HiiHandle;
     49  EFI_HII_HANDLE              HiiHandle;
    5050  EFI_STRING_ID               ManFormatHelp;
    5151} SHELL_COMMAND_INTERNAL_LIST_ENTRY;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c

    r80721 r85718  
    14631463    if (Info != NULL && Info->Attribute & EFI_FILE_DIRECTORY) {
    14641464      StatusBarSetStatusString (L"Directory Can Not Be Saved");
    1465       ShellCloseFile(FileHandle);
     1465      ShellCloseFile (&FileHandle);
    14661466      FreePool(Info);
    14671467      return EFI_LOAD_ERROR;
     
    16031603  // set status string
    16041604  //
    1605   Str = CatSPrint (NULL, L"%d Lines Wrote", NumLines);
     1605  Str = CatSPrint (NULL, L"%d Lines Written", NumLines);
    16061606  if (Str == NULL) {
    16071607    return EFI_OUT_OF_RESOURCES;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c

    r80721 r85718  
    369369  // set status string
    370370  //
    371   Str = CatSPrint(NULL, L"%d Lines Wrote", NumLines);
     371  Str = CatSPrint(NULL, L"%d Lines Written", NumLines);
    372372  StatusBarSetStatusString (Str);
    373373  FreePool (Str);
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/LoadPciRom.c

    r80721 r85718  
    33
    44  (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
    5   Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
     5  Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.<BR>
    66  SPDX-License-Identifier: BSD-2-Clause-Patent
    77
     
    335335                       );
    336336          if (EFI_ERROR (Status)) {
     337            //
     338            // With EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created
     339            // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now.
     340            // If the caller doesn't have the option to defer the execution of an image, we should
     341            // unload image for the EFI_SECURITY_VIOLATION to avoid resource leak.
     342            //
     343            if (Status == EFI_SECURITY_VIOLATION) {
     344              gBS->UnloadImage (ImageHandle);
     345            }
    337346            ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_LOAD_FAIL), gShellDebug1HiiHandle, L"loadpcirom", FileName, ImageIndex);
    338347//            PrintToken (STRING_TOKEN (STR_LOADPCIROM_LOAD_IMAGE_ERROR), HiiHandle, ImageIndex, Status);
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c

    r80721 r85718  
    22  Main file for Pci shell Debug1 function.
    33
    4   Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.<BR>
    55  (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
    66  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
     
    45164516      MaxLinkSpeed = L"8.0 GT/s";
    45174517      break;
     4518    case 4:
     4519      MaxLinkSpeed = L"16.0 GT/s";
     4520      break;
     4521    case 5:
     4522      MaxLinkSpeed = L"32.0 GT/s";
     4523      break;
    45184524    default:
    4519       MaxLinkSpeed = L"Unknown";
     4525      MaxLinkSpeed = L"Reserved";
    45204526      break;
    45214527  }
     
    46724678    case 3:
    46734679      CurLinkSpeed = L"8.0 GT/s";
     4680      break;
     4681    case 4:
     4682      CurLinkSpeed = L"16.0 GT/s";
     4683      break;
     4684    case 5:
     4685      CurLinkSpeed = L"32.0 GT/s";
    46744686      break;
    46754687    default:
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c

    r80721 r85718  
    44  Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
    55  (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
    6   (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP<BR>
     6  (C) Copyright 2015-2019 Hewlett Packard Enterprise Development LP<BR>
    77  SPDX-License-Identifier: BSD-2-Clause-Patent
    88
     
    11701170
    11711171  //
     1172  // Processor Additional Information (Type 44)
     1173  //
     1174  case 44:
     1175    DisplayProcessorArchitectureType (Struct->Type44->ProcessorSpecificBlock.ProcessorArchType, Option);
     1176    break;
     1177
     1178  //
    11721179  // Inactive (Type 126)
    11731180  //
     
    23492356    case 0x1F4:
    23502357      Print (L"Video Processor\n");
     2358      break;
     2359
     2360    case 0x200:
     2361      Print (L"RISC-V RV32\n");
     2362      break;
     2363
     2364    case 0x201:
     2365      Print (L"RISC-V RV64\n");
     2366      break;
     2367
     2368    case 0x202:
     2369      Print (L"RISC-V RV128\n");
    23512370      break;
    23522371
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h

    r80721 r85718  
    33
    44  Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
    5   (C) Copyright 2017 Hewlett Packard Enterprise Development LP<BR>
     5  (C) Copyright 2017 - 2019 Hewlett Packard Enterprise Development LP<BR>
    66  SPDX-License-Identifier: BSD-2-Clause-Patent
    77
     
    428428  );
    429429
     430/**
     431  Display Processor Architecture Type (Type 44).
     432
     433  @param[in] Key            The key of the structure.
     434  @param[in] Option         The optional information.
     435**/
     436VOID
     437DisplayProcessorArchitectureType (
     438  IN UINT8 Key,
     439  IN UINT8 Option
     440  );
    430441#endif
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c

    r80721 r85718  
    33  And give a interface of query a string out of a table.
    44
    5   Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
    6   (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP<BR>
     5  Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.<BR>
     6  (C) Copyright 2016-2019 Hewlett Packard Enterprise Development LP<BR>
    77  SPDX-License-Identifier: BSD-2-Clause-Patent
    88
     
    621621    7,
    622622    L" Power/Performance Control"
     623  },
     624  {
     625    8,
     626    L" 128-bit Capable"
    623627  }
    624628};
     
    14301434  },
    14311435  {
     1436    SlotTypeCXLFlexbus10,
     1437    L"CXL Flexbus 1.0"
     1438  },
     1439  {
    14321440    0xA0,
    14331441    L"PC-98/C20 "
     
    15201528    0xB6,
    15211529    L"PCI Express Gen 3 X16"
     1530  },
     1531  {
     1532    SlotTypePciExpressGen4,
     1533    L"PCI Express Gen 4"
     1534  },
     1535  {
     1536    SlotTypePciExpressGen4X1,
     1537    L"PCI Express Gen 4 X1"
     1538  },
     1539  {
     1540    SlotTypePciExpressGen4X2,
     1541    L"PCI Express Gen 4 X2"
     1542  },
     1543  {
     1544    SlotTypePciExpressGen4X4,
     1545    L"PCI Express Gen 4 X4"
     1546  },
     1547  {
     1548    SlotTypePciExpressGen4X8,
     1549    L"PCI Express Gen 4 X8"
     1550  },
     1551  {
     1552    SlotTypePciExpressGen4X16,
     1553    L"PCI Express Gen 4 X16"
    15221554  }
    15231555};
     
    22632295    0xA3,
    22642296    L"  PC-98/Local bus add-on card"
     2297  },
     2298  {
     2299    MemoryArrayLocationCXLFlexbus10AddonCard,
     2300    L"  CXL Flexbus 1.0 add-on card"
    22652301  }
    22662302};
     
    23882424    0x0F,
    23892425    L"  FB-DIMM"
     2426  },
     2427  {
     2428    MemoryFormFactorDie,
     2429    L"  Die"
    23902430  }
    23912431};
     
    25032543    0x1F,
    25042544    L"  Logical non-volatile device"
     2545  },
     2546  {
     2547    MemoryTypeHBM,
     2548    L"  HBM (High Bandwidth Memory)"
     2549  },
     2550  {
     2551    MemoryTypeHBM2,
     2552    L"  HBM2 (High Bandwidth Memory Generation 2)"
    25052553  }
    25062554};
     
    25912639  },
    25922640  {
    2593     0x07,
    2594     L" Intel persistent memory"
     2641    MemoryTechnologyIntelPersistentMemory,
     2642    L" Intel Optane DC Persistent Memory"
    25952643  }
    25962644};
     
    32693317};
    32703318
     3319TABLE_ITEM  ProcessorArchitectureTypesTable[] = {
     3320  {
     3321    0,
     3322    L" Reserved "
     3323  },
     3324  {
     3325    1,
     3326    L" IA32 (x86) "
     3327  },
     3328  {
     3329    2,
     3330    L" x64 (x86-64, intel64, AMD64, EM64T) "
     3331  },
     3332  {
     3333    3,
     3334    L" Intel Itanium architecture "
     3335  },
     3336  {
     3337    4,
     3338    L" 32-bit ARM (Aarch32) "
     3339  },
     3340  {
     3341    5,
     3342    L" 64-bit ARM (Aarch64) "
     3343  },
     3344  {
     3345    6,
     3346    L" 32-bit RISC-V (RV32) "
     3347  },
     3348  {
     3349    7,
     3350    L" 64-bit RISC-V (RV64) "
     3351  },
     3352  {
     3353    8,
     3354    L" 128-bit RISC-V (RV128) "
     3355  }
     3356};
    32713357
    32723358TABLE_ITEM  StructureTypeInfoTable[] = {
     
    34463532    43,
    34473533    L" TPM Device"
     3534  },
     3535  {
     3536    44,
     3537    L" Processor Additional Information"
    34483538  },
    34493539  {
     
    46984788
    46994789/**
     4790  Display Processor Architecture Type (Type 44).
     4791
     4792  @param[in] Key            The key of the structure.
     4793  @param[in] Option         The optional information.
     4794**/
     4795VOID
     4796DisplayProcessorArchitectureType (
     4797  IN UINT8 Key,
     4798  IN UINT8 Option
     4799  )
     4800{
     4801  ShellPrintHiiEx (-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROCESSOR_ARCH_TYPE), gShellDebug1HiiHandle);
     4802  PRINT_INFO_OPTION (Key, Option);
     4803  PRINT_TABLE_ITEM (ProcessorArchitectureTypesTable, Key);
     4804}
     4805
     4806/**
    47004807  Display the structure type information.
    47014808
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h

    r80721 r85718  
    33  and give a interface of query a string out of a table.
    44
    5   Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
     5  Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.<BR>
    66  SPDX-License-Identifier: BSD-2-Clause-Patent
    77
     
    1010#ifndef _SMBIOS_QUERY_TABLE_H_
    1111#define _SMBIOS_QUERY_TABLE_H_
     12
     13#include <IndustryStandard/SmBios.h>
    1214
    1315#define QUERY_TABLE_UNFOUND 0xFF
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni

    r80721 r85718  
    33// Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
    44// (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.<BR>
    5 // (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP<BR>
     5// (C) Copyright 2015-2019 Hewlett Packard Enterprise Development LP<BR>
    66// SPDX-License-Identifier: BSD-2-Clause-Patent
    77//
     
    448448#string STR_SMBIOSVIEW_QUERYTABLE_MC_HOST_INTERFACE_TYPE        #language en-US "MC Host Interface Type:"
    449449#string STR_SMBIOSVIEW_QUERYTABLE_STRUCT_TYPE                   #language en-US "Structure Type:"
     450#string STR_SMBIOSVIEW_QUERYTABLE_PROCESSOR_ARCH_TYPE           #language en-US "Processor Architecture Type:"
    450451#string STR_SMBIOSVIEW_SMBIOSVIEW_ONE_VAR_ARGV                  #language en-US "%s "
    451452#string STR_SMBIOSVIEW_SMBIOSVIEW_QUERY_STRUCT_COND             #language en-US "Query Structure, conditions are:\r\n"
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c

    r80721 r85718  
    1111
    1212STATIC CONST CHAR16 mFileName[] = L"Debug1Commands";
    13 EFI_HANDLE gShellDebug1HiiHandle = NULL;
     13EFI_HII_HANDLE gShellDebug1HiiHandle = NULL;
    1414
    1515/**
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h

    r80721 r85718  
    5353
    5454
    55 extern        EFI_HANDLE                        gShellDebug1HiiHandle;
     55extern        EFI_HII_HANDLE                    gShellDebug1HiiHandle;
    5656
    5757/**
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni

    r80721 r85718  
    33// Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
    44// (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
    5 // (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
     5// (C) Copyright 2016 - 2019 Hewlett Packard Enterprise Development LP<BR>
    66// SPDX-License-Identifier: BSD-2-Clause-Patent
    77//
     
    977977"       42 - Management Controller Host Interface\r\n"
    978978"       43 - TPM Device\r\n"
     979"       44 - Processor Additional Information\r\n"
    979980"  2. Enter the SmbiosHandle parameter in hexadecimal format.\r\n"
    980981"     Do not use the '0x' prefix format for hexadecimal values.\r\n"
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c

    r80721 r85718  
    347347EFI_STATUS
    348348ConvertAndConnectControllers (
    349   IN EFI_HANDLE     *Handle1 OPTIONAL,
    350   IN EFI_HANDLE     *Handle2 OPTIONAL,
     349  IN EFI_HANDLE     Handle1 OPTIONAL,
     350  IN EFI_HANDLE     Handle2 OPTIONAL,
    351351  IN CONST BOOLEAN  Recursive,
    352352  IN CONST BOOLEAN  Output
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.c

    r80721 r85718  
    1010
    1111STATIC CONST CHAR16 mFileName[] = L"Driver1Commands";
    12 EFI_HANDLE gShellDriver1HiiHandle = NULL;
     12EFI_HII_HANDLE gShellDriver1HiiHandle = NULL;
    1313BOOLEAN    gInReconnect = FALSE;
    1414
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h

    r80721 r85718  
    5959
    6060
    61 extern        EFI_HANDLE                        gShellDriver1HiiHandle;
     61extern        EFI_HII_HANDLE                    gShellDriver1HiiHandle;
    6262extern        BOOLEAN                           gInReconnect;
    6363
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.c

    r80721 r85718  
    1111
    1212STATIC CONST CHAR16 mFileName[] = L"ShellCommands";
    13 EFI_HANDLE gShellLevel1HiiHandle = NULL;
     13EFI_HII_HANDLE gShellLevel1HiiHandle = NULL;
    1414
    1515/**
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.h

    r80721 r85718  
    3434#include <Library/FileHandleLib.h>
    3535
    36 extern        EFI_HANDLE                        gShellLevel1HiiHandle;
     36extern        EFI_HII_HANDLE                    gShellLevel1HiiHandle;
    3737
    3838/**
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c

    r80721 r85718  
    33
    44  (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
    5   Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
     5  Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
    66  SPDX-License-Identifier: BSD-2-Clause-Patent
    77
     
    113113
    114114  if (EFI_ERROR(Status)) {
     115    //
     116    // With EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created
     117    // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now.
     118    // If the caller doesn't have the option to defer the execution of an image, we should
     119    // unload image for the EFI_SECURITY_VIOLATION to avoid resource leak.
     120    //
     121    if (Status == EFI_SECURITY_VIOLATION) {
     122      gBS->UnloadImage (LoadedDriverHandle);
     123    }
    115124    ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOAD_NOT_IMAGE), gShellLevel2HiiHandle, FileName, Status);
    116125  } else {
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c

    r80721 r85718  
    418418  @param[in] Count          The count of bits enabled in Attribs.
    419419  @param[in] TimeZone       The current time zone offset.
     420  @param[in] ListUnfiltered TRUE to request listing the directory contents
     421                            unfiltered.
    420422
    421423  @retval SHELL_SUCCESS     the printing was sucessful.
     
    430432  IN       BOOLEAN *Found,
    431433  IN CONST UINTN   Count,
    432   IN CONST INT16   TimeZone
     434  IN CONST INT16   TimeZone,
     435  IN CONST BOOLEAN ListUnfiltered
    433436  )
    434437{
     
    501504      //
    502505      Status = gRT->GetTime(&LocalTime, NULL);
    503       if (!EFI_ERROR (Status)) {
     506      if (!EFI_ERROR (Status) && (LocalTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE)) {
    504507        if ((Node->Info->CreateTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) &&
    505508            (Node->Info->CreateTime.Month >= 1 && Node->Info->CreateTime.Month <= 12)) {
     
    556559    }
    557560
    558     if (!Sfo && ShellStatus != SHELL_ABORTED) {
     561    if (!Sfo && ShellStatus != SHELL_ABORTED && HeaderPrinted) {
    559562      PrintNonSfoFooter(FileCount, FileSize, DirCount);
    560563    }
     
    603606            &FoundOne,
    604607            Count,
    605             TimeZone);
     608            TimeZone,
     609            FALSE);
    606610
    607611          //
     
    620624
    621625  if (Found == NULL && !FoundOne) {
    622     return (SHELL_NOT_FOUND);
     626    if (ListUnfiltered) {
     627      //
     628      // When running "ls" without any filtering request, avoid outputing
     629      // "File not found" when the directory is entirely empty, but print
     630      // header and footer stating "0 File(s), 0 Dir(s)".
     631      //
     632      if (!Sfo) {
     633        PrintNonSfoHeader (RootPath);
     634        if (ShellStatus != SHELL_ABORTED) {
     635          PrintNonSfoFooter (FileCount, FileSize, DirCount);
     636        }
     637      }
     638    } else {
     639      return (SHELL_NOT_FOUND);
     640    }
    623641  }
    624642
     
    663681  EFI_TIME      TheTime;
    664682  CHAR16        *SearchString;
     683  BOOLEAN       ListUnfiltered;
    665684
    666685  Size                = 0;
     
    674693  CurDir              = NULL;
    675694  Count               = 0;
     695  ListUnfiltered      = FALSE;
    676696
    677697  //
     
    769789            ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"ls");
    770790          }
     791          ListUnfiltered = TRUE;
    771792          //
    772793          // Copy to the 2 strings for starting path and file search string
     
    809830              // is listing ends with a directory, then we list all files in that directory
    810831              //
     832              ListUnfiltered = TRUE;
    811833              StrnCatGrow(&SearchString, NULL, L"*", 0);
    812834            } else {
     
    840862            NULL,
    841863            Count,
    842             TheTime.TimeZone
     864            TheTime.TimeZone,
     865            ListUnfiltered
    843866           );
    844867          if (ShellStatus == SHELL_NOT_FOUND) {
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c

    r80721 r85718  
    2525BOOLEAN
    2626IsDirectoryEmpty (
    27   IN EFI_HANDLE   FileHandle
     27  IN SHELL_FILE_HANDLE   FileHandle
    2828  )
    2929{
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c

    r80721 r85718  
    3030
    3131CONST CHAR16 mFileName[] = L"ShellCommands";
    32 EFI_HANDLE gShellLevel2HiiHandle = NULL;
     32EFI_HII_HANDLE gShellLevel2HiiHandle = NULL;
    3333
    3434/**
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h

    r80721 r85718  
    4444
    4545extern CONST  CHAR16                            mFileName[];
    46 extern        EFI_HANDLE                        gShellLevel2HiiHandle;
     46extern        EFI_HII_HANDLE                    gShellLevel2HiiHandle;
    4747
    4848/**
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c

    r80721 r85718  
    2222EFI_STATUS
    2323TouchFileByHandle (
    24   IN EFI_HANDLE Handle
     24  IN SHELL_FILE_HANDLE Handle
    2525  )
    2626{
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c

    r80721 r85718  
    1010
    1111CONST CHAR16 gShellLevel3FileName[] = L"ShellCommands";
    12 EFI_HANDLE gShellLevel3HiiHandle = NULL;
     12EFI_HII_HANDLE gShellLevel3HiiHandle = NULL;
    1313
    1414/**
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h

    r80721 r85718  
    3333#include <Library/FileHandleLib.h>
    3434
    35 extern EFI_HANDLE gShellLevel3HiiHandle;
     35extern EFI_HII_HANDLE gShellLevel3HiiHandle;
    3636
    3737/**
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellLib/UefiShellLib.c

    r80721 r85718  
    12921292    //
    12931293    // Call EFI Shell version.
    1294     // Due to oddity in the EFI shell we want to dereference the ParentHandle here
    1295     //
    1296     CmdStatus = (mEfiShellEnvironment2->Execute(*ParentHandle,
     1294    //
     1295    // Due to an unfixable bug in the EdkShell implementation, we must
     1296    // dereference "ParentHandle" here:
     1297    //
     1298    // 1. The EFI shell installs the EFI_SHELL_ENVIRONMENT2 protocol,
     1299    //    identified by gEfiShellEnvironment2Guid.
     1300    // 2. The Execute() member function takes "ParentImageHandle" as first
     1301    //    parameter, with type (EFI_HANDLE*).
     1302    // 3. In the EdkShell implementation, SEnvExecute() implements the
     1303    //    Execute() member function. It passes "ParentImageHandle" correctly to
     1304    //    SEnvDoExecute().
     1305    // 4. SEnvDoExecute() takes the (EFI_HANDLE*), and passes it directly --
     1306    //    without de-referencing -- to the HandleProtocol() boot service.
     1307    // 5. But HandleProtocol() takes an EFI_HANDLE.
     1308    //
     1309    // Therefore we must
     1310    // - de-reference "ParentHandle" here, to mask the bug in
     1311    //   SEnvDoExecute(), and
     1312    // - pass the resultant EFI_HANDLE as an (EFI_HANDLE*).
     1313    //
     1314    CmdStatus = (mEfiShellEnvironment2->Execute((EFI_HANDLE *)*ParentHandle,
    12971315                                          CommandLine,
    12981316                                          Output));
     
    29983016  IN CONST CHAR8          *Language OPTIONAL,
    29993017  IN CONST EFI_STRING_ID  HiiFormatStringId,
    3000   IN CONST EFI_HANDLE    HiiFormatHandle,
     3018  IN CONST EFI_HII_HANDLE HiiFormatHandle,
    30013019  ...
    30023020  )
     
    36103628  IN SHELL_PROMPT_REQUEST_TYPE         Type,
    36113629  IN CONST EFI_STRING_ID  HiiFormatStringId,
    3612   IN CONST EFI_HANDLE    HiiFormatHandle,
     3630  IN CONST EFI_HII_HANDLE HiiFormatHandle,
    36133631  IN OUT VOID             **Response
    36143632  )
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c

    r80721 r85718  
    615615ON_EXIT:
    616616
     617  //
     618  // Recycle the packet before reusing RxToken
     619  //
     620  gBS->SignalEvent (Private->IpChoice == PING_IP_CHOICE_IP6?((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->RecycleSignal:((EFI_IP4_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->RecycleSignal);
     621
    617622  if (Private->RxCount < Private->SendNum) {
    618623    //
     
    633638    Private->Status = EFI_SUCCESS;
    634639  }
    635   //
    636   // Singal to recycle the each rxdata here, not at the end of process.
    637   //
    638   gBS->SignalEvent (Private->IpChoice == PING_IP_CHOICE_IP6?((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->RecycleSignal:((EFI_IP4_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->RecycleSignal);
    639640}
    640641
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.c

    r80721 r85718  
    99
    1010CONST CHAR16 gShellNetwork1FileName[] = L"ShellCommands";
    11 EFI_HANDLE gShellNetwork1HiiHandle = NULL;
     11EFI_HII_HANDLE gShellNetwork1HiiHandle = NULL;
    1212
    1313/**
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.h

    r80721 r85718  
    3939#include <Library/PrintLib.h>
    4040
    41 extern EFI_HANDLE gShellNetwork1HiiHandle;
     41extern EFI_HII_HANDLE gShellNetwork1HiiHandle;
    4242
    4343/**
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.c

    r80721 r85718  
    99
    1010CONST CHAR16 gShellNetwork2FileName[] = L"ShellCommands";
    11 EFI_HANDLE gShellNetwork2HiiHandle = NULL;
     11EFI_HII_HANDLE gShellNetwork2HiiHandle = NULL;
    1212
    1313/**
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.h

    r80721 r85718  
    2828#include <Library/NetLib.h>
    2929
    30 extern EFI_HANDLE gShellNetwork2HiiHandle;
     30extern EFI_HII_HANDLE gShellNetwork2HiiHandle;
    3131
    3232/**
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/ShellPkg.dsc

    r80721 r85718  
    44# Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
    55# Copyright (c) 2018, Arm Limited. All rights reserved.<BR>
     6# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
    67#
    78#    SPDX-License-Identifier: BSD-2-Clause-Patent
     
    1516  DSC_SPECIFICATION              = 0x00010006
    1617  OUTPUT_DIRECTORY               = Build/Shell
    17   SUPPORTED_ARCHITECTURES        = IA32|X64|EBC|ARM|AARCH64
     18  SUPPORTED_ARCHITECTURES        = IA32|X64|EBC|ARM|AARCH64|RISCV64
    1819  BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
    1920  SKUID_IDENTIFIER               = DEFAULT
     
    5960  ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
    6061
    61 [LibraryClasses.ARM]
     62[LibraryClasses.ARM,LibraryClasses.AARCH64]
    6263  #
    6364  # It is not possible to prevent the ARM compiler for generic intrinsic functions.
     
    6970  # Add support for GCC stack protector
    7071  NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
    71 
    72 [LibraryClasses.AARCH64]
    73   NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
    7472
    7573[PcdsFixedAtBuild]
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette