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:
24 added
1 deleted
50 edited

Legend:

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

  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf

    r80721 r85718  
    77#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
    88#  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
     9#  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
    910#
    1011#  SPDX-License-Identifier: BSD-2-Clause-Patent
     
    4243  ArmCache.c
    4344
     45[Sources.RISCV64]
     46  RiscVCache.c
     47
    4448[Packages]
    4549  MdePkg/MdePkg.dec
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf

    r80721 r85718  
    88#  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
    99#  Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
     10#  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
    1011#
    1112#  SPDX-License-Identifier: BSD-2-Clause-Patent
     
    2526
    2627#
    27 #  VALID_ARCHITECTURES           = IA32 X64 EBC ARM AARCH64
     28#  VALID_ARCHITECTURES           = IA32 X64 EBC ARM AARCH64 RISCV64
    2829#
    2930
     
    6061  AArch64/CpuSleep.asm    | MSFT
    6162
     63[Sources.RISCV64]
     64  RiscV/Cpu.S
     65
    6266[Packages]
    6367  MdePkg/MdePkg.dec
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni

    r80721 r85718  
    22// Instance of CPU Library for various architecture.
    33//
    4 // CPU Library implemented using ASM functions for IA-32 and X64,
     4// CPU Library implemented using ASM functions for IA-32, X64 and RISCV64,
    55// PAL CALLs for IPF, and empty functions for EBC.
    66//
     
    88// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
    99// Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
     10// Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
    1011//
    1112// SPDX-License-Identifier: BSD-2-Clause-Patent
     
    1617#string STR_MODULE_ABSTRACT             #language en-US "Instance of CPU Library for various architectures"
    1718
    18 #string STR_MODULE_DESCRIPTION          #language en-US "CPU Library implemented using ASM functions for IA-32 and X64, PAL CALLs for IPF, and empty functions for EBC."
     19#string STR_MODULE_DESCRIPTION          #language en-US "CPU Library implemented using ASM functions for IA-32, X64 and RISCV64, PAL CALLs for IPF, and empty functions for EBC."
    1920
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf

    r80721 r85718  
    55#  for IA-32 and x64.  On IPF, I/O port requests are translated into MMIO requests.
    66#  MMIO requests are forwarded directly to memory.  For EBC, I/O port requests
    7 #  ASSERT().
     7#  ASSERT(). For ARM, AARCH64 and RISCV64, this I/O library only provides non I/O
     8#  read and write.
    89#
    910#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
    1011#  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
    1112#  Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
     13#  Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
    1214#
    1315#  SPDX-License-Identifier: BSD-2-Clause-Patent
     
    2628
    2729#
    28 #  VALID_ARCHITECTURES           = IA32 X64 EBC ARM AARCH64
     30#  VALID_ARCHITECTURES           = IA32 X64 EBC ARM AARCH64 RISCV64
    2931#
    3032
     
    5153
    5254[Sources.ARM]
    53   IoLibArm.c
     55  IoLibNoIo.c
    5456
    5557[Sources.AARCH64]
    56   IoLibArm.c
     58  IoLibNoIo.c
     59
     60[Sources.RISCV64]
     61  IoLibNoIo.c
    5762
    5863[Packages]
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c

    r80721 r85718  
    3333
    3434**/
    35 __inline__
    3635UINT8
    3736EFIAPI
     
    6160
    6261**/
    63 __inline__
    6462UINT8
    6563EFIAPI
     
    8886
    8987**/
    90 __inline__
    9188UINT16
    9289EFIAPI
     
    118115
    119116**/
    120 __inline__
    121117UINT16
    122118EFIAPI
     
    146142
    147143**/
    148 __inline__
    149144UINT32
    150145EFIAPI
     
    176171
    177172**/
    178 __inline__
    179173UINT32
    180174EFIAPI
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseLib/BaseLib.inf

    r80721 r85718  
    55#  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
    66#  Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
     7#  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
    78#
    89#  SPDX-License-Identifier: BSD-2-Clause-Patent
     
    2122
    2223#
    23 #  VALID_ARCHITECTURES           = IA32 X64 EBC ARM AARCH64
     24#  VALID_ARCHITECTURES           = IA32 X64 EBC ARM AARCH64 RISCV64
    2425#
    2526
     
    395396  AArch64/SpeculationBarrier.asm    | MSFT
    396397
     398[Sources.RISCV64]
     399  Math64.c
     400  Unaligned.c
     401  RiscV64/InternalSwitchStack.c
     402  RiscV64/CpuBreakpoint.c
     403  RiscV64/GetInterruptState.c
     404  RiscV64/DisableInterrupts.c
     405  RiscV64/EnableInterrupts.c
     406  RiscV64/CpuPause.c
     407  RiscV64/RiscVSetJumpLongJump.S    | GCC
     408  RiscV64/RiscVCpuBreakpoint.S      | GCC
     409  RiscV64/RiscVCpuPause.S           | GCC
     410  RiscV64/RiscVInterrupt.S          | GCC
     411  RiscV64/FlushCache.S              | GCC
     412
    397413[Packages]
    398414  MdePkg/MdePkg.dec
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseLib/SafeString.c

    r80721 r85718  
    1515#define SAFE_STRING_CONSTRAINT_CHECK(Expression, Status)  \
    1616  do { \
    17     ASSERT (Expression); \
    1817    if (!(Expression)) { \
     18      DEBUG ((DEBUG_VERBOSE, \
     19        "%a(%d) %a: SAFE_STRING_CONSTRAINT_CHECK(%a) failed.  Return %r\n", \
     20        __FILE__, __LINE__, __FUNCTION__, #Expression, Status)); \
    1921      return Status; \
    2022    } \
     
    198200  If Destination is not aligned on a 16-bit boundary, then ASSERT().
    199201  If Source is not aligned on a 16-bit boundary, then ASSERT().
    200   If an error would be returned, then the function will also ASSERT().
    201202
    202203  If an error is returned, then the Destination is unmodified.
     
    280281  If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().
    281282  If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().
    282   If an error would be returned, then the function will also ASSERT().
    283283
    284284  If an error is returned, then the Destination is unmodified.
     
    373373  If Destination is not aligned on a 16-bit boundary, then ASSERT().
    374374  If Source is not aligned on a 16-bit boundary, then ASSERT().
    375   If an error would be returned, then the function will also ASSERT().
    376375
    377376  If an error is returned, then the Destination is unmodified.
     
    474473  If Destination is not aligned on a 16-bit boundary, then ASSERT().
    475474  If Source is not aligned on a 16-bit boundary, then ASSERT().
    476   If an error would be returned, then the function will also ASSERT().
    477475
    478476  If an error is returned, then the Destination is unmodified.
     
    591589  valid decimal character or a Null-terminator, whichever one comes first.
    592590
    593   If String is NULL, then ASSERT().
    594   If Data is NULL, then ASSERT().
    595591  If String is not aligned in a 16-bit boundary, then ASSERT().
    596   If PcdMaximumUnicodeStringLength is not zero, and String contains more than
    597   PcdMaximumUnicodeStringLength Unicode characters, not including the
    598   Null-terminator, then ASSERT().
    599592
    600593  If String has no valid decimal digits in the above format, then 0 is stored
     
    706699  valid decimal character or a Null-terminator, whichever one comes first.
    707700
    708   If String is NULL, then ASSERT().
    709   If Data is NULL, then ASSERT().
    710701  If String is not aligned in a 16-bit boundary, then ASSERT().
    711   If PcdMaximumUnicodeStringLength is not zero, and String contains more than
    712   PcdMaximumUnicodeStringLength Unicode characters, not including the
    713   Null-terminator, then ASSERT().
    714702
    715703  If String has no valid decimal digits in the above format, then 0 is stored
     
    826814  whichever one comes first.
    827815
    828   If String is NULL, then ASSERT().
    829   If Data is NULL, then ASSERT().
    830816  If String is not aligned in a 16-bit boundary, then ASSERT().
    831   If PcdMaximumUnicodeStringLength is not zero, and String contains more than
    832   PcdMaximumUnicodeStringLength Unicode characters, not including the
    833   Null-terminator, then ASSERT().
    834817
    835818  If String has no valid hexadecimal digits in the above format, then 0 is
     
    957940  whichever one comes first.
    958941
    959   If String is NULL, then ASSERT().
    960   If Data is NULL, then ASSERT().
    961942  If String is not aligned in a 16-bit boundary, then ASSERT().
    962   If PcdMaximumUnicodeStringLength is not zero, and String contains more than
    963   PcdMaximumUnicodeStringLength Unicode characters, not including the
    964   Null-terminator, then ASSERT().
    965943
    966944  If String has no valid hexadecimal digits in the above format, then 0 is
     
    10921070  The "::" can only appear once in the String.
    10931071
    1094   If String is NULL, then ASSERT().
    1095 
    1096   If Address is NULL, then ASSERT().
    1097 
    10981072  If String is not aligned in a 16-bit boundary, then ASSERT().
    1099 
    1100   If PcdMaximumUnicodeStringLength is not zero, and String contains more than
    1101   PcdMaximumUnicodeStringLength Unicode characters, not including the
    1102   Null-terminator, then ASSERT().
    11031073
    11041074  If EndPointer is not NULL and Address is translated from String, a pointer
     
    13181288  a valid decimal digit character after P is converted.
    13191289
    1320   If String is NULL, then ASSERT().
    1321 
    1322   If Address is NULL, then ASSERT().
    1323 
    13241290  If String is not aligned in a 16-bit boundary, then ASSERT().
    1325 
    1326   If PcdMaximumUnicodeStringLength is not zero, and String contains more than
    1327   PcdMaximumUnicodeStringLength Unicode characters, not including the
    1328   Null-terminator, then ASSERT().
    13291291
    13301292  If EndPointer is not NULL and Address is translated from String, a pointer
     
    14831445                  pp          Data4[56:63]
    14841446
    1485   If String is NULL, then ASSERT().
    1486   If Guid is NULL, then ASSERT().
    14871447  If String is not aligned in a 16-bit boundary, then ASSERT().
    14881448
     
    15891549
    15901550  If String is not aligned in a 16-bit boundary, then ASSERT().
    1591 
    1592   If String is NULL, then ASSERT().
    1593 
    1594   If Buffer is NULL, then ASSERT().
    1595 
    1596   If Length is not multiple of 2, then ASSERT().
    1597 
    1598   If PcdMaximumUnicodeStringLength is not zero and Length is greater than
    1599   PcdMaximumUnicodeStringLength, then ASSERT().
    1600 
    1601   If MaxBufferSize is less than (Length / 2), then ASSERT().
    16021551
    16031552  @param  String                   Pointer to a Null-terminated Unicode string.
     
    17801729  This function is similar as strcpy_s defined in C11.
    17811730
    1782   If an error would be returned, then the function will also ASSERT().
    1783 
    17841731  If an error is returned, then the Destination is unmodified.
    17851732
     
    18561803
    18571804  This function is similar as strncpy_s defined in C11.
    1858 
    1859   If an error would be returned, then the function will also ASSERT().
    18601805
    18611806  If an error is returned, then the Destination is unmodified.
     
    19441889
    19451890  This function is similar as strcat_s defined in C11.
    1946 
    1947   If an error would be returned, then the function will also ASSERT().
    19481891
    19491892  If an error is returned, then the Destination is unmodified.
     
    20401983
    20411984  This function is similar as strncat_s defined in C11.
    2042 
    2043   If an error would be returned, then the function will also ASSERT().
    20441985
    20451986  If an error is returned, then the Destination is unmodified.
     
    21552096  valid decimal character or a Null-terminator, whichever one comes first.
    21562097
    2157   If String is NULL, then ASSERT().
    2158   If Data is NULL, then ASSERT().
    2159   If PcdMaximumAsciiStringLength is not zero, and String contains more than
    2160   PcdMaximumAsciiStringLength Ascii characters, not including the
    2161   Null-terminator, then ASSERT().
    2162 
    21632098  If String has no valid decimal digits in the above format, then 0 is stored
    21642099  at the location pointed to by Data.
     
    22672202  valid decimal character or a Null-terminator, whichever one comes first.
    22682203
    2269   If String is NULL, then ASSERT().
    2270   If Data is NULL, then ASSERT().
    2271   If PcdMaximumAsciiStringLength is not zero, and String contains more than
    2272   PcdMaximumAsciiStringLength Ascii characters, not including the
    2273   Null-terminator, then ASSERT().
    2274 
    22752204  If String has no valid decimal digits in the above format, then 0 is stored
    22762205  at the location pointed to by Data.
     
    23832312  whichever on comes first.
    23842313
    2385   If String is NULL, then ASSERT().
    2386   If Data is NULL, then ASSERT().
    2387   If PcdMaximumAsciiStringLength is not zero, and String contains more than
    2388   PcdMaximumAsciiStringLength Ascii characters, not including the
    2389   Null-terminator, then ASSERT().
    2390 
    23912314  If String has no valid hexadecimal digits in the above format, then 0 is
    23922315  stored at the location pointed to by Data.
     
    25102433  whichever on comes first.
    25112434
    2512   If String is NULL, then ASSERT().
    2513   If Data is NULL, then ASSERT().
    2514   If PcdMaximumAsciiStringLength is not zero, and String contains more than
    2515   PcdMaximumAsciiStringLength Ascii characters, not including the
    2516   Null-terminator, then ASSERT().
    2517 
    25182435  If String has no valid hexadecimal digits in the above format, then 0 is
    25192436  stored at the location pointed to by Data.
     
    26362553
    26372554  If Source is not aligned on a 16-bit boundary, then ASSERT().
    2638   If an error would be returned, then the function will also ASSERT().
    26392555
    26402556  If an error is returned, then the Destination is unmodified.
     
    27362652  bits, then ASSERT().
    27372653  If Source is not aligned on a 16-bit boundary, then ASSERT().
    2738   If an error would be returned, then the function will also ASSERT().
    27392654
    27402655  If an error is returned, then Destination and DestinationLength are
     
    28562771
    28572772  If Destination is not aligned on a 16-bit boundary, then ASSERT().
    2858   If an error would be returned, then the function will also ASSERT().
    28592773
    28602774  If an error is returned, then the Destination is unmodified.
     
    29492863
    29502864  If Destination is not aligned on a 16-bit boundary, then ASSERT().
    2951   If an error would be returned, then the function will also ASSERT().
    29522865
    29532866  If an error is returned, then Destination and DestinationLength are
     
    30722985  "::" can be used to compress one or more groups of X when X contains only 0.
    30732986  The "::" can only appear once in the String.
    3074 
    3075   If String is NULL, then ASSERT().
    3076 
    3077   If Address is NULL, then ASSERT().
    30782987
    30792988  If EndPointer is not NULL and Address is translated from String, a pointer
     
    32913200  When /P is in the String, the function stops at the first character that is not
    32923201  a valid decimal digit character after P is converted.
    3293 
    3294   If String is NULL, then ASSERT().
    3295 
    3296   If Address is NULL, then ASSERT().
    32973202
    32983203  If EndPointer is not NULL and Address is translated from String, a pointer
     
    34493354                  pp          Data4[56:63]
    34503355
    3451   If String is NULL, then ASSERT().
    3452   If Guid is NULL, then ASSERT().
    3453 
    34543356  @param  String                   Pointer to a Null-terminated ASCII string.
    34553357  @param  Guid                     Pointer to the converted GUID.
     
    35503452  decoding stops after Length of characters and outputs Buffer containing
    35513453  (Length / 2) bytes.
    3552 
    3553   If String is NULL, then ASSERT().
    3554 
    3555   If Buffer is NULL, then ASSERT().
    3556 
    3557   If Length is not multiple of 2, then ASSERT().
    3558 
    3559   If PcdMaximumAsciiStringLength is not zero and Length is greater than
    3560   PcdMaximumAsciiStringLength, then ASSERT().
    3561 
    3562   If MaxBufferSize is less than (Length / 2), then ASSERT().
    35633454
    35643455  @param  String                   Pointer to a Null-terminated ASCII string.
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BasePeCoffLib/BasePeCoff.c

    r80721 r85718  
    11/** @file
    22  Base PE/COFF loader supports loading any PE32/PE32+ or TE image, but
    3   only supports relocating IA32, x64, IPF, and EBC images.
     3  only supports relocating IA32, x64, IPF, ARM, RISC-V and EBC images.
    44
    55  Caution: This file requires additional review when modified.
     
    1818  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
    1919  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
     20  Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
    2021  SPDX-License-Identifier: BSD-2-Clause-Patent
    2122
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf

    r80721 r85718  
    44#  The IA32 version library support loading IA32, X64 and EBC PE/COFF images.
    55#  The X64 version library support loading IA32, X64 and EBC PE/COFF images.
     6#  The RISC-V version library support loading RISC-V images.
    67#
    78#  Caution: This module requires additional review when modified.
     
    1213#  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
    1314#  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
     15#  Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
    1416#
    1517#  SPDX-License-Identifier: BSD-2-Clause-Patent
     
    4244  Arm/PeCoffLoaderEx.c
    4345
     46[Sources.RISCV64]
     47  RiscV/PeCoffLoaderEx.c
     48
    4449[Packages]
    4550  MdePkg/MdePkg.dec
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BasePeCoffLib/BasePeCoffLib.uni

    r80721 r85718  
    55// The IA32 version library support loading IA32, X64 and EBC PE/COFF images.
    66// The X64 version library support loading IA32, X64 and EBC PE/COFF images.
     7// The RISC-V version library support loading RISC-V32 and RISC-V64 PE/COFF images.
    78//
    89// Caution: This module requires additional review when modified.
     
    1314// Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
    1415// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
     16// Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
    1517//
    1618// SPDX-License-Identifier: BSD-2-Clause-Patent
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h

    r80721 r85718  
    33
    44  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
     5  Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
    56  SPDX-License-Identifier: BSD-2-Clause-Patent
    67
     
    1718#include <IndustryStandard/PeImage.h>
    1819
     20//
     21// Macro definitions for RISC-V architecture.
     22//
     23#define RV_X(x, s, n) (((x) >> (s)) & ((1<<(n))-1))
     24#define RISCV_IMM_BITS 12
     25#define RISCV_IMM_REACH (1LL<<RISCV_IMM_BITS)
     26#define RISCV_CONST_HIGH_PART(VALUE) \
     27  (((VALUE) + (RISCV_IMM_REACH/2)) & ~(RISCV_IMM_REACH-1))
    1928
    2029
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf

    r80721 r85718  
    77#  Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
    88# Copyright (c) 2017, Microsoft Corporation
     9#  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
     10
    911#
    1012# All rights reserved.
     
    2426# The following information is for reference only and not required by the build tools.
    2527#
    26 #  VALID_ARCHITECTURES           = IA32 X64
     28#  VALID_ARCHITECTURES           = IA32 X64 ARM AARCH64 RISCV64
    2729#
    2830
     
    3335  SafeIntLib32.c
    3436
    35 [Sources.X64, Sources.AARCH64]
     37[Sources.X64, Sources.AARCH64, Sources.RISCV64]
    3638  SafeIntLib64.c
    3739
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSafeIntLib/SafeIntLib.c

    r80721 r85718  
    33813381      // a * d must be less than 2^32 or there would be bits set in the high 64-bits
    33823382      //
    3383       ProductAD = (((UINT64)DwordA) *(UINT64)DwordD);
     3383      ProductAD = MultU64x64 ((UINT64)DwordA, (UINT64)DwordD);
    33843384      if ((ProductAD & 0xffffffff00000000) == 0) {
    33853385        DwordB = (UINT32)Multiplicand;
     
    33883388        // b * c must be less than 2^32 or there would be bits set in the high 64-bits
    33893389        //
    3390         ProductBC = (((UINT64)DwordB) *(UINT64)DwordC);
     3390        ProductBC = MultU64x64 ((UINT64)DwordB, (UINT64)DwordC);
    33913391        if ((ProductBC & 0xffffffff00000000) == 0) {
    33923392          //
     
    33983398            // b * d
    33993399            //
    3400             ProductBD = (((UINT64)DwordB) *(UINT64)DwordD);
     3400            ProductBD = MultU64x64 ((UINT64)DwordB, (UINT64)DwordD);
    34013401
    34023402            if (!RETURN_ERROR (SafeUint64Add (UnsignedResult, ProductBD, &UnsignedResult))) {
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf

    r80721 r85718  
    44#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
    55#  Portions copyright (c) 2008 - 2009, Apple Inc. 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
     
    7980  AArch64/Synchronization.asm   | MSFT
    8081
     82[Sources.RISCV64]
     83  Synchronization.c
     84  RiscV64/Synchronization.S
     85
    8186[Packages]
    8287  MdePkg/MdePkg.dec
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c

    r80721 r85718  
    151151  If DecodeHandler is NULL, then ASSERT().
    152152
    153   @param[in]  SectionGuid    A pointer to the GUID associated with the the handlers
     153  @param[in]  SectionGuid    A pointer to the GUID associated with the handlers
    154154                             of the GUIDed section type being registered.
    155155  @param[in]  GetInfoHandler The pointer to a function that examines a GUIDed section and returns the
     
    232232  If GUID for InputSection does not match any of the GUIDs registered through ExtractGuidedSectionRegisterHandlers(),
    233233  then RETURN_UNSUPPORTED is returned.
    234   If the GUID of InputSection does match the GUID that this handler supports, then the the associated handler
     234  If the GUID of InputSection does match the GUID that this handler supports, then the associated handler
    235235  of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers()
    236   is used to retrieve the OututBufferSize, ScratchSize, and Attributes values. The return status from the handler of
     236  is used to retrieve the OutputBufferSize, ScratchSize, and Attributes values. The return status from the handler of
    237237  type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER is returned.
    238238
     
    312312  If GUID for InputSection does not match any of the GUIDs registered through ExtractGuidedSectionRegisterHandlers(),
    313313  then RETURN_UNSUPPORTED is returned.
    314   If the GUID of InputSection does match the GUID that this handler supports, then the the associated handler
     314  If the GUID of InputSection does match the GUID that this handler supports, then the associated handler
    315315  of type EXTRACT_GUIDED_SECTION_DECODE_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers()
    316316  is used to decode InputSection into the buffer specified by OutputBuffer and the authentication status of this
     
    398398  If SectionGuid is NULL, then ASSERT().
    399399
    400   @param[in]  SectionGuid    A pointer to the GUID associated with the handlersof the GUIDed
     400  @param[in]  SectionGuid    A pointer to the GUID associated with the handlers of the GUIDed
    401401                             section type being retrieved.
    402402  @param[out] GetInfoHandler Pointer to a function that examines a GUIDed section and returns
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/DxeHobLib/HobLib.c

    r80721 r85718  
    11/** @file
    2   HOB Library implemenation for Dxe Phase.
     2  HOB Library implementation for Dxe Phase.
    33
    44Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/DxeHstiLib/HstiDxe.c

    r80721 r85718  
    7878                    &InfoTypesBufferCount
    7979                    );
    80     if (EFI_ERROR (Status)) {
     80    if (EFI_ERROR (Status) || (InfoTypesBuffer == NULL) || (InfoTypesBufferCount == 0)) {
    8181      continue;
    8282    }
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/DxeIoLibCpuIo2/IoLib.c

    r80721 r85718  
    1212
    1313//
    14 // Globle varible to cache pointer to CpuIo2 protocol.
     14// Global variable to cache pointer to CpuIo2 protocol.
    1515//
    1616EFI_CPU_IO2_PROTOCOL  *mCpuIo = NULL;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/DxePcdLib/DxePcdLib.inf

    r80721 r85718  
    1717#  in their initialization without any issues to access Dynamic and DynamicEx PCD. They can't
    1818#  access Dynamic and DynamicEx PCD in the implementation of runtime services and SMI handlers.
    19 #  Because EFI_PCD_PROTOCOL is DXE protocol that is not aviable in OS runtime phase.
     19#  Because EFI_PCD_PROTOCOL is DXE protocol that is not available in OS runtime phase.
    2020#
    2121# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/DxePcdLib/DxePcdLib.uni

    r80721 r85718  
    2323#string STR_MODULE_ABSTRACT             #language en-US "PCD Library using PCD Protocol"
    2424
    25 #string STR_MODULE_DESCRIPTION          #language en-US "There are two PCD protocols: 1) PCD_PROTOCOL It is an EDKII implementation that supporst Dynamic/DynamicEx PCDs. 2) EFI_PCD_PROTOCOL It is defined by PI Specification 1.2, Vol 3, which only support dynamicEx type PCD.  For dynamicEx type PCDs, it is compatible between PCD_PROTOCOL and EFI_PCD_PROTOCOL.  This library instance uses the PCD_PROTOCOL to handle dynamic PCD requests and uses EFI_PCD_PROTOCOL to handle DynamicEx type PCDs."
     25#string STR_MODULE_DESCRIPTION          #language en-US "There are two PCD protocols: 1) PCD_PROTOCOL It is an EDKII implementation that supports Dynamic/DynamicEx PCDs. 2) EFI_PCD_PROTOCOL It is defined by PI Specification 1.2, Vol 3, which only support dynamicEx type PCD.  For dynamicEx type PCDs, it is compatible between PCD_PROTOCOL and EFI_PCD_PROTOCOL.  This library instance uses the PCD_PROTOCOL to handle dynamic PCD requests and uses EFI_PCD_PROTOCOL to handle DynamicEx type PCDs."
    2626
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c

    r80721 r85718  
    7878  }
    7979
    80   return SystemTable->BootServices->CreateEventEx (EVT_NOTIFY_SIGNAL,
     80  return SystemTable->BootServices->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES,
    8181                                      TPL_NOTIFY, ExitBootServicesEvent, NULL,
    82                                       &gEfiEventExitBootServicesGuid,
    8382                                      &mEfiExitBootServicesEvent);
    8483}
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf

    r80721 r85718  
    4242  SerialPortLib
    4343
    44 [Guids]
    45   gEfiEventExitBootServicesGuid                         ## CONSUMES ## Event
    46 
    4744[Pcd]
    4845  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue     ## SOMETIMES_CONSUMES
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/DxeRuntimePciExpressLib/DxeRuntimePciExpressLib.inf

    r80721 r85718  
    4848[Pcd]
    4949  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress  ## CONSUMES
    50 
    51 [Guids]
    52   gEfiEventVirtualAddressChangeGuid         ## CONSUMES ## Event
    53 
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c

    r80721 r85718  
    125125  // Register SetVirtualAddressMap () notify function
    126126  //
    127   Status = gBS->CreateEventEx (
    128                   EVT_NOTIFY_SIGNAL,
     127  Status = gBS->CreateEvent (
     128                  EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
    129129                  TPL_NOTIFY,
    130130                  DxeRuntimePciExpressLibVirtualNotify,
    131131                  NULL,
    132                   &gEfiEventVirtualAddressChangeGuid,
    133132                  &mDxeRuntimePciExpressLibVirtualNotifyEvent
    134133                  );
     
    300299
    301300  //
    302   // See if Address has already been registerd for runtime access
     301  // See if Address has already been registered for runtime access
    303302  //
    304303  for (Index = 0; Index < mDxeRuntimePciExpressLibNumberOfRuntimeRanges; Index++) {
     
    14581457  configuration registers from a single PCI function to be read. Size is
    14591458  returned. When possible 32-bit PCI configuration read cycles are used to read
    1460   from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit
     1459  from StartAddress to StartAddress + Size. Due to alignment restrictions, 8-bit
    14611460  and 16-bit PCI configuration read cycles may be used at the beginning and the
    14621461  end of the range.
     
    15611560  configuration registers from a single PCI function to be written. Size is
    15621561  returned. When possible 32-bit PCI configuration write cycles are used to
    1563   write from StartAdress to StartAddress + Size. Due to alignment restrictions,
     1562  write from StartAddress to StartAddress + Size. Due to alignment restrictions,
    15641563  8-bit and 16-bit PCI configuration write cycles may be used at the beginning
    15651564  and the end of the range.
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/DxeServicesLib/DxeServicesLib.c

    r80721 r85718  
    2626  Identify the device handle from which the Image is loaded from. As this device handle is passed to
    2727  GetSectionFromFv as the identifier for a Firmware Volume, an EFI_FIRMWARE_VOLUME2_PROTOCOL
    28   protocol instance should be located succesfully by calling gBS->HandleProtocol ().
     28  protocol instance should be located successfully by calling gBS->HandleProtocol ().
    2929
    3030  This function locates the EFI_LOADED_IMAGE_PROTOCOL instance installed
     
    5050
    5151  Status = gBS->HandleProtocol (
    52              (EFI_HANDLE *) ImageHandle,
     52             ImageHandle,
    5353             &gEfiLoadedImageProtocolGuid,
    5454             (VOID **) &LoadedImage
     
    7272
    7373  This functions first locate the EFI_FIRMWARE_VOLUME2_PROTOCOL protocol instance on FvHandle in order to
    74   carry out the Firmware Volume read operation. The function then reads the Firmware Section found sepcifed
     74  carry out the Firmware Volume read operation. The function then reads the Firmware Section found specified
    7575  by NameGuid, SectionType and SectionInstance.
    7676
     
    9595  @param  SectionInstance         The instance number of Firmware Section to
    9696                                  read from starting from 0.
    97   @param  Buffer                  On output, Buffer contains the the data read
     97  @param  Buffer                  On output, Buffer contains the data read
    9898                                  from the section in the Firmware File found.
    9999  @param  Size                    On output, the size of Buffer.
     
    518518
    519519/**
    520   Searches the FFS file the the currently executing module was loaded from and returns the first matching FFS section.
     520  Searches the FFS file the currently executing module was loaded from and returns the first matching FFS section.
    521521
    522522  This function searches the FFS file that the currently executing module was loaded from for a FFS sections of type SectionType.
     
    598598                                        match an exact file to be loaded.
    599599  @param[in]       FilePath             The pointer to the device path of the file
    600                                         that is absracted to the file buffer.
     600                                        that is abstracted to the file buffer.
    601601  @param[out]      FileSize             The pointer to the size of the abstracted
    602602                                        file buffer.
     
    746746        //
    747747        // Parse each MEDIA_FILEPATH_DP node. There may be more than one, since the
    748         // directory information and filename can be seperate. The goal is to inch
     748        // directory information and filename can be separate. The goal is to inch
    749749        // our way down each device path node and close the previous node
    750750        //
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/DxeServicesLib/DxeServicesLib.inf

    r80721 r85718  
    2323
    2424#
    25 #  VALID_ARCHITECTURES           = IA32 X64 EBC ARM AARCH64
     25#  VALID_ARCHITECTURES           = IA32 X64 EBC ARM AARCH64 RISCV64
    2626#
    2727
     
    2929  DxeServicesLib.c
    3030
    31 [Sources.IA32, Sources.EBC, Sources.ARM, Sources.AARCH64]
     31[Sources.IA32, Sources.EBC, Sources.ARM, Sources.AARCH64, Sources.RISCV64]
    3232  Allocate.c
    3333
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.c

    r80721 r85718  
    1010  initialized.
    1111
    12   This library contains contruct function to retrieve EFI_DXE_SERIVCE, this construct
     12  This library contains construct function to retrieve EFI_DXE_SERVICE, this construct
    1313  function will be invoked in DXE driver's autogen file.
    1414
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.c

    r80721 r85718  
    1313
    1414//
    15 // Globle varible to cache pointer to Smbus protocol.
     15// Global variable to cache pointer to Smbus protocol.
    1616//
    1717EFI_SMBUS_HC_PROTOCOL      *mSmbus = NULL;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c

    r80721 r85718  
    110110  // Register SetVirtualAddressMap () notify function
    111111  //
    112   Status = gBS->CreateEventEx (
    113                   EVT_NOTIFY_SIGNAL,
     112  Status = gBS->CreateEvent (
     113                  EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
    114114                  TPL_NOTIFY,
    115115                  DxeRuntimePciSegmentLibVirtualNotify,
    116116                  NULL,
    117                   &gEfiEventVirtualAddressChangeGuid,
    118117                  &mDxeRuntimePciSegmentLibVirtualNotifyEvent
    119118                  );
     
    212211
    213212  //
    214   // See if Address has already been registerd for runtime access
     213  // See if Address has already been registered for runtime access
    215214  //
    216215  for (Index = 0; Index < mDxeRuntimePciSegmentLibNumberOfRuntimeRanges; Index++) {
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLibSegmentInfo.inf

    r80721 r85718  
    4646  DxeServicesTableLib
    4747  UefiBootServicesTableLib
    48 
    49 [Guids]
    50   gEfiEventVirtualAddressChangeGuid         ## CONSUMES ## Event
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.c

    r80721 r85718  
    11701170  configuration registers from a single PCI function to be read. Size is
    11711171  returned. When possible 32-bit PCI configuration read cycles are used to read
    1172   from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit
     1172  from StartAddress to StartAddress + Size. Due to alignment restrictions, 8-bit
    11731173  and 16-bit PCI configuration read cycles may be used at the beginning and the
    11741174  end of the range.
     
    12731273  configuration registers from a single PCI function to be written. Size is
    12741274  returned. When possible 32-bit PCI configuration write cycles are used to
    1275   write from StartAdress to StartAddress + Size. Due to alignment restrictions,
     1275  write from StartAddress to StartAddress + Size. Due to alignment restrictions,
    12761276  8-bit and 16-bit PCI configuration write cycles may be used at the beginning
    12771277  and the end of the range.
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/SmmMemLib/SmmMemLib.c

    r80721 r85718  
    276276  @param  Length              The number of bytes to copy from SourceBuffer to DestinationBuffer.
    277277
    278   @retval EFI_SECURITY_VIOLATION The DesinationBuffer is invalid per processor architecture or overlap with SMRAM.
     278  @retval EFI_SECURITY_VIOLATION The DestinationBuffer is invalid per processor architecture or overlap with SMRAM.
    279279  @retval EFI_SUCCESS            Memory is copied.
    280280
     
    309309  @param  Length              The number of bytes to copy from SourceBuffer to DestinationBuffer.
    310310
    311   @retval EFI_SECURITY_VIOLATION The DesinationBuffer is invalid per processor architecture or overlap with SMRAM.
     311  @retval EFI_SECURITY_VIOLATION The DestinationBuffer is invalid per processor architecture or overlap with SMRAM.
    312312  @retval EFI_SECURITY_VIOLATION The SourceBuffer is invalid per processor architecture or overlap with SMRAM.
    313313  @retval EFI_SUCCESS            Memory is copied.
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/SmmPciExpressLib/PciExpressLib.c

    r80721 r85718  
    12271227 configuration registers from a single PCI function to be read. Size is
    12281228 returned. When possible 32-bit PCI configuration read cycles are used to read
    1229  from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit
     1229 from StartAddress to StartAddress + Size. Due to alignment restrictions, 8-bit
    12301230 and 16-bit PCI configuration read cycles may be used at the beginning and the
    12311231 end of the range.
     
    13301330 configuration registers from a single PCI function to be written. Size is
    13311331 returned. When possible 32-bit PCI configuration write cycles are used to
    1332  write from StartAdress to StartAddress + Size. Due to alignment restrictions,
     1332 write from StartAddress to StartAddress + Size. Due to alignment restrictions,
    13331333 8-bit and 16-bit PCI configuration write cycles may be used at the beginning
    13341334 and the end of the range.
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/SmmPciLibPciRootBridgeIo/PciLib.c

    r80721 r85718  
    3636
    3737//
    38 // Global varible to cache pointer to PCI Root Bridge I/O protocol.
     38// Global variable to cache pointer to PCI Root Bridge I/O protocol.
    3939//
    4040EFI_SMM_PCI_ROOT_BRIDGE_IO_PROTOCOL      *mSmmPciRootBridgeIo = NULL;
     
    12391239  configuration registers from a single PCI function to be read. Size is
    12401240  returned. When possible 32-bit PCI configuration read cycles are used to read
    1241   from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit
     1241  from StartAddress to StartAddress + Size. Due to alignment restrictions, 8-bit
    12421242  and 16-bit PCI configuration read cycles may be used at the beginning and the
    12431243  end of the range.
     
    13371337  configuration registers from a single PCI function to be written. Size is
    13381338  returned. When possible 32-bit PCI configuration write cycles are used to
    1339   write from StartAdress to StartAddress + Size. Due to alignment restrictions,
     1339  write from StartAddress to StartAddress + Size. Due to alignment restrictions,
    13401340  8-bit and 16-bit PCI configuration write cycles may be used at the beginning
    13411341  and the end of the range.
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.c

    r80721 r85718  
    108108  ///
    109109  /// The performance counter value that was captured the last time that the
    110   /// periodic SMI handler called PeriodcSmiExecutionTime().  This allows the
    111   /// time value returned by PeriodcSmiExecutionTime() to be accurate even when
     110  /// periodic SMI handler called PeriodicSmiExecutionTime().  This allows the
     111  /// time value returned by PeriodicSmiExecutionTime() to be accurate even when
    112112  /// the performance counter rolls over.
    113113  ///
     
    128128  /// Buffer used to save the context when a periodic SMI handler requests to
    129129  /// yield using PeriodicSmiYield().  This context is used to resume the
    130   /// execution of a periodic SMI handler the next time control is transferd
     130  /// execution of a periodic SMI handler the next time control is transferred
    131131  /// to the periodic SMI handler that yielded.
    132132  ///
     
    153153
    154154///
    155 /// Pointer to the SMM Periodic Timer Disatch Protocol that was located in the constuctor.
     155/// Pointer to the SMM Periodic Timer Dispatch Protocol that was located in the constructor.
    156156///
    157157EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL  *gSmmPeriodicTimerDispatch2           = NULL;
     
    523523  periodic SMI for the currently executing handler is triggered, the periodic
    524524  SMI handler will be resumed and this function will return.  Use of this
    525   function requires a seperate stack for the periodic SMI handler.  A non zero
     525  function requires a separate stack for the periodic SMI handler.  A non zero
    526526  stack size must be specified in PeriodicSmiEnable() for this function to be
    527527  used.
     
    573573  if (SetJumpFlag == 0) {
    574574    //
    575     // The intial call to SetJump() always returns 0.
     575    // The initial call to SetJump() always returns 0.
    576576    // If this is the initial call, then exit the current periodic SMI handler
    577577    //
     
    589589
    590590  //
    591   // Return the amount elapsed time that occured while yielded
     591  // Return the amount elapsed time that occurred while yielded
    592592  //
    593593  return PeriodicSmiLibraryHandler->ElapsedTime;
     
    621621  // Dispatch the registered handler passing in the context that was registered
    622622  // and the amount of time that has elapsed since the previous time this
    623   // periodic SMI handler was dispacthed.
     623  // periodic SMI handler was dispatched.
    624624  //
    625625  PeriodicSmiLibraryHandler->DispatchFunction (
     
    629629
    630630  //
    631   // If this DispatchFunction() returns, then unconditially call PeriodicSmiExit()
     631  // If this DispatchFunction() returns, then unconditionally call PeriodicSmiExit()
    632632  // to perform a LongJump() back to PeriodicSmiDispatchFunctionOnCpu(). The
    633   // LongJump() will resume exection on the original stack.
     633  // LongJump() will resume execution on the original stack.
    634634  //
    635635  PeriodicSmiExit ();
     
    638638/**
    639639  Internal worker function that transfers control to an enabled periodic SMI
    640   handler on the specified logial CPU.  This function determines if the periodic
     640  handler on the specified logical CPU.  This function determines if the periodic
    641641  SMI handler yielded and needs to be resumed.  It also and switches to an
    642642  allocated stack if one was allocated in PeriodicSmiEnable().
     
    653653{
    654654  //
    655   // Save context in DispatchJumpBuffer.  The intial call to SetJump() always
     655  // Save context in DispatchJumpBuffer.  The initial call to SetJump() always
    656656  // returns 0.  If this is the initial call, then either resume from a prior
    657   // call to PeriodicSmiYield() or call the DispatchFunction registerd in
     657  // call to PeriodicSmiYield() or call the DispatchFunction registered in
    658658  // PeriodicSmiEnable() using an allocated stack if one was specified.
    659659  //
     
    680680    // If Stack is NULL then call DispatchFunction using current stack passing
    681681    // in the context that was registered and the amount of time that has
    682     // elapsed since the previous time this periodic SMI handler was dispacthed.
     682    // elapsed since the previous time this periodic SMI handler was dispatched.
    683683    //
    684684    PeriodicSmiLibraryHandler->DispatchFunction (
     
    688688
    689689    //
    690     // If this DispatchFunction() returns, then unconditially call PeriodicSmiExit()
     690    // If this DispatchFunction() returns, then unconditionally call PeriodicSmiExit()
    691691    // to perform a LongJump() back to this function.
    692692    //
     
    713713/**
    714714  Internal worker function that transfers control to an enabled periodic SMI
    715   handler on the specified logial CPU.  This worker function is only called
     715  handler on the specified logical CPU.  This worker function is only called
    716716  using the SMM Services Table function SmmStartupThisAp() to execute the
    717717  periodic SMI handler on a logical CPU that is different than the one that is
     
    737737
    738738  //
    739   // Execute dispatch function on the currently excuting logical CPU
     739  // Execute dispatch function on the currently executing logical CPU
    740740  //
    741741  PeriodicSmiDispatchFunctionOnCpu (PeriodicSmiLibraryHandler);
     
    806806    //
    807807    // Dispatch on the currently execution CPU if the CPU specified in PeriodicSmiEnable()
    808     // was PERIODIC_SMI_LIBARRY_ANY_CPU or the currently executing CPU matches the CPU
     808    // was PERIODIC_SMI_LIBRARY_ANY_CPU or the currently executing CPU matches the CPU
    809809    // that was specified in PeriodicSmiEnable().
    810810    //
     
    868868  @param[in]     Context           Optional content to pass into DispatchFunction.
    869869  @param[in]     TickPeriod        The requested tick period in 100ns units that
    870                                    control should be givien to the periodic SMI
     870                                   control should be given to the periodic SMI
    871871                                   handler.  Must be one of the supported values
    872872                                   returned by PeriodicSmiSupportedPickPeriod().
     
    892892                                 periodic SMI handler.
    893893  @retval EFI_OUT_OF_RESOURCES   There are not enough resources to allocate the
    894                                  stack speficied by StackSize.
     894                                 stack specified by StackSize.
    895895  @retval EFI_SUCCESS            The periodic SMI handler was enabled.
    896896
     
    10781078  //
    10791079  // Count the number of periodic SMI tick intervals that the SMM Periodic Timer
    1080   // Dipatch 2 Protocol supports.
     1080  // Dispatch 2 Protocol supports.
    10811081  //
    10821082  SmiTickInterval = NULL;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.c

    r80721 r85718  
    3737  // Retrieve SMM Base2 Protocol,  Do not use gBS from UefiBootServicesTableLib on purpose
    3838  // to prevent inclusion of gBS, gST, and gImageHandle from SMM Drivers unless the
    39   // SMM driver explicity declares that dependency.
     39  // SMM driver explicitly declares that dependency.
    4040  //
    4141  Status = SystemTable->BootServices->LocateProtocol (
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/UefiDebugLibConOut/DebugLib.c

    r80721 r85718  
    105105    //
    106106    if (BaseListMarker == NULL) {
    107       UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, VaListMarker);
     107      UnicodeVSPrintAsciiFormat (Buffer, sizeof (Buffer), Format, VaListMarker);
    108108    } else {
    109       UnicodeBSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, BaseListMarker);
     109      UnicodeBSPrintAsciiFormat (Buffer, sizeof (Buffer), Format, BaseListMarker);
    110110    }
    111111
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c

    r80721 r85718  
    6565  mDebugST = SystemTable;
    6666
    67   SystemTable->BootServices->CreateEventEx (
    68                                 EVT_NOTIFY_SIGNAL,
     67  SystemTable->BootServices->CreateEvent (
     68                                EVT_SIGNAL_EXIT_BOOT_SERVICES,
    6969                                TPL_NOTIFY,
    7070                                ExitBootServicesCallback,
    7171                                NULL,
    72                                 &gEfiEventExitBootServicesGuid,
    7372                                &mExitBootServicesEvent
    7473                                );
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf

    r80721 r85718  
    4747  DebugPrintErrorLevelLib
    4848
    49 [Guids]
    50   gEfiEventExitBootServicesGuid                 ## CONSUMES
    51 
    5249[Pcd]
    5350  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue        ## SOMETIMES_CONSUMES
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c

    r80721 r85718  
    6565  mDebugBS = SystemTable->BootServices;
    6666
    67   mDebugBS->CreateEventEx (
    68               EVT_NOTIFY_SIGNAL,
     67  mDebugBS->CreateEvent (
     68              EVT_SIGNAL_EXIT_BOOT_SERVICES,
    6969              TPL_NOTIFY,
    7070              ExitBootServicesCallback,
    7171              NULL,
    72               &gEfiEventExitBootServicesGuid,
    7372              &mExitBootServicesEvent
    7473              );
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf

    r80721 r85718  
    4747  DebugPrintErrorLevelLib
    4848
    49 [Guids]
    50   gEfiEventExitBootServicesGuid                 ## CONSUMES
    51 
    5249[Protocols]
    5350  gEfiDebugPortProtocolGuid                     ## CONSUMES
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c

    r80721 r85718  
    107107    //
    108108    if (BaseListMarker == NULL) {
    109       UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, VaListMarker);
     109      UnicodeVSPrintAsciiFormat (Buffer, sizeof (Buffer), Format, VaListMarker);
    110110    } else {
    111       UnicodeBSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, BaseListMarker);
     111      UnicodeBSPrintAsciiFormat (Buffer, sizeof (Buffer), Format, BaseListMarker);
    112112    }
    113113
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c

    r80721 r85718  
    6565  mDebugST = SystemTable;
    6666
    67   SystemTable->BootServices->CreateEventEx (
    68                                 EVT_NOTIFY_SIGNAL,
     67  SystemTable->BootServices->CreateEvent (
     68                                EVT_SIGNAL_EXIT_BOOT_SERVICES,
    6969                                TPL_NOTIFY,
    7070                                ExitBootServicesCallback,
    7171                                NULL,
    72                                 &gEfiEventExitBootServicesGuid,
    7372                                &mExitBootServicesEvent
    7473                                );
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf

    r80721 r85718  
    4545  DebugPrintErrorLevelLib
    4646
    47 [Guids]
    48   gEfiEventExitBootServicesGuid                 ## CONSUMES
    49 
    5047[Pcd]
    5148  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue   ## SOMETIMES_CONSUMES
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c

    r80721 r85718  
    6969    //
    7070    FileInfo = AllocateZeroPool(FileInfoSize);
    71     //
    72     // now get the information
    73     //
    74     Status = FileHandle->GetInfo(FileHandle,
    75                                  &gEfiFileInfoGuid,
    76                                  &FileInfoSize,
    77                                  FileInfo);
    78     //
    79     // if we got an error free the memory and return NULL
    80     //
    81     if (EFI_ERROR(Status) && (FileInfo != NULL)) {
    82       FreePool(FileInfo);
    83       FileInfo = NULL;
     71    if (FileInfo != NULL) {
     72      //
     73      // now get the information
     74      //
     75      Status = FileHandle->GetInfo(FileHandle,
     76                                   &gEfiFileInfoGuid,
     77                                   &FileInfoSize,
     78                                   FileInfo);
     79      //
     80      // if we got an error free the memory and return NULL
     81      //
     82      if (EFI_ERROR(Status)) {
     83        FreePool(FileInfo);
     84        FileInfo = NULL;
     85      }
    8486    }
    8587  }
     
    816818      } else {
    817819        //
     820        // Prepare to move to the parent directory.
     821        // Also determine whether CurrentHandle refers to the Root directory.
     822        //
     823        Status = CurrentHandle->Open (CurrentHandle, &NextHigherHandle, L"..", EFI_FILE_MODE_READ, 0);
     824        //
    818825        // We got info... do we have a name? if yes precede the current path with it...
    819826        //
    820         if (StrLen (FileInfo->FileName) == 0) {
     827        if ((StrLen (FileInfo->FileName) == 0) || EFI_ERROR (Status)) {
     828          //
     829          // Both FileInfo->FileName being '\0' and EFI_ERROR() suggest that
     830          // CurrentHandle refers to the Root directory.  As this loop ensures
     831          // FullFileName is starting with '\\' at all times, signal success
     832          // and exit the loop.
     833          // While FileInfo->FileName could theoretically be a value other than
     834          // '\0' or '\\', '\\' is guaranteed to be supported by the
     835          // specification and hence its value can safely be ignored.
     836          //
     837          Status = EFI_SUCCESS;
    821838          if (*FullFileName == NULL) {
    822839            ASSERT((*FullFileName == NULL && Size == 0) || (*FullFileName != NULL));
     
    836853        }
    837854      }
     855
     856      FileHandleClose(CurrentHandle);
    838857      //
    839858      // Move to the parent directory
    840859      //
    841       Status = CurrentHandle->Open (CurrentHandle, &NextHigherHandle, L"..", EFI_FILE_MODE_READ, 0);
    842       if (EFI_ERROR (Status)) {
    843         break;
    844       }
    845 
    846       FileHandleClose(CurrentHandle);
    847860      CurrentHandle = NextHigherHandle;
    848861    }
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/UefiLib/UefiLib.c

    r80721 r85718  
    639639  FreePool (OpenInfoBuffer);
    640640  return Status;
     641}
     642
     643/**
     644  This function checks the supported languages list for a target language,
     645  This only supports RFC 4646 Languages.
     646
     647  @param  SupportedLanguages  The supported languages
     648  @param  TargetLanguage      The target language
     649
     650  @retval Returns EFI_SUCCESS if the language is supported,
     651          EFI_UNSUPPORTED otherwise
     652**/
     653EFI_STATUS
     654EFIAPI
     655IsLanguageSupported (
     656  IN CONST CHAR8 *SupportedLanguages,
     657  IN CONST CHAR8 *TargetLanguage
     658  )
     659{
     660  UINTN Index;
     661  while (*SupportedLanguages != 0) {
     662    for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++);
     663    if ((AsciiStrnCmp(SupportedLanguages, TargetLanguage, Index) == 0) && (TargetLanguage[Index] == 0)) {
     664      return EFI_SUCCESS;
     665    }
     666    SupportedLanguages += Index;
     667    for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++);
     668  }
     669
     670  return EFI_UNSUPPORTED;
    641671}
    642672
     
    801831  //
    802832  Found = FALSE;
    803   while (*SupportedLanguages != 0) {
    804     if (Iso639Language) {
     833  if (Iso639Language) {
     834    while (*SupportedLanguages != 0) {
    805835      if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
    806836        Found = TRUE;
     
    808838      }
    809839      SupportedLanguages += 3;
    810     } else {
    811       for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++);
    812       if ((AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) && (Language[Index] == 0)) {
    813         Found = TRUE;
    814         break;
    815       }
    816       SupportedLanguages += Index;
    817       for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++);
    818840    }
    819   }
     841  } else {
     842    Found = !IsLanguageSupported(Language, SupportedLanguages);
     843  }
     844
    820845
    821846  //
     
    11001125  //
    11011126  Found = FALSE;
    1102   while (*SupportedLanguages != 0) {
    1103     if (Iso639Language) {
     1127  if (Iso639Language) {
     1128    while (*SupportedLanguages != 0) {
    11041129      if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
    11051130        Found = TRUE;
     
    11071132      }
    11081133      SupportedLanguages += 3;
    1109     } else {
    1110       for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++);
    1111       if (AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) {
    1112         Found = TRUE;
    1113         break;
    1114       }
    1115       SupportedLanguages += Index;
    1116       for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++);
    11171134    }
    1118   }
    1119 
     1135  } else {
     1136    Found = !IsLanguageSupported(Language, SupportedLanguages);
     1137  }
    11201138  //
    11211139  // If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/UefiRuntimeLib/RuntimeLib.c

    r80721 r85718  
    9494  // Register SetVirtualAddressMap () notify function
    9595  //
    96   Status = gBS->CreateEventEx (
    97                   EVT_NOTIFY_SIGNAL,
     96  Status = gBS->CreateEvent (
     97                  EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
    9898                  TPL_NOTIFY,
    9999                  RuntimeLibVirtualNotifyEvent,
    100100                  NULL,
    101                   &gEfiEventVirtualAddressChangeGuid,
    102101                  &mEfiVirtualNotifyEvent
    103102                  );
     
    105104  ASSERT_EFI_ERROR (Status);
    106105
    107   Status = gBS->CreateEventEx (
    108                   EVT_NOTIFY_SIGNAL,
     106  Status = gBS->CreateEvent (
     107                  EVT_SIGNAL_EXIT_BOOT_SERVICES,
    109108                  TPL_NOTIFY,
    110109                  RuntimeLibExitBootServicesEvent,
    111110                  NULL,
    112                   &gEfiEventExitBootServicesGuid,
    113111                  &mEfiExitBootServicesEvent
    114112                  );
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf

    r80721 r85718  
    4040  UefiRuntimeServicesTableLib
    4141  DebugLib
    42 
    43 [Guids]
    44   gEfiEventExitBootServicesGuid             ## CONSUMES ## Event
    45   gEfiEventVirtualAddressChangeGuid         ## CONSUMES ## Event
    46 
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/UefiScsiLib/UefiScsiLib.c

    r80721 r85718  
    22  UEFI SCSI Library implementation
    33
    4   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
    55  SPDX-License-Identifier: BSD-2-Clause-Patent
    66
     
    2424#define EFI_SCSI_OP_LENGTH_SIX      0x6
    2525#define EFI_SCSI_OP_LENGTH_TEN      0xa
     26#define EFI_SCSI_OP_LENGTH_TWELVE   0xc
    2627#define EFI_SCSI_OP_LENGTH_SIXTEEN  0x10
    2728
     
    10551056  ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);
    10561057
    1057   CommandPacket.Timeout         = Timeout;
    1058   CommandPacket.OutDataBuffer    = DataBuffer;
    1059   CommandPacket.SenseData       = SenseData;
    1060   CommandPacket.OutTransferLength= *DataLength;
    1061   CommandPacket.Cdb             = Cdb;
     1058  CommandPacket.Timeout           = Timeout;
     1059  CommandPacket.OutDataBuffer     = DataBuffer;
     1060  CommandPacket.SenseData         = SenseData;
     1061  CommandPacket.OutTransferLength = *DataLength;
     1062  CommandPacket.Cdb               = Cdb;
    10621063  //
    10631064  // Fill Cdb for Write (10) Command
    10641065  //
    10651066  Cdb[0]                        = EFI_SCSI_OP_WRITE10;
     1067  Cdb[1]                        = EFI_SCSI_BLOCK_FUA;
    10661068  WriteUnaligned32 ((UINT32 *)&Cdb[2], SwapBytes32 (StartLba));
    10671069  WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16) SectorSize));
     
    12631265  //
    12641266  Cdb[0]                        = EFI_SCSI_OP_WRITE16;
     1267  Cdb[1]                        = EFI_SCSI_BLOCK_FUA;
    12651268  WriteUnaligned64 ((UINT64 *)&Cdb[2], SwapBytes64 (StartLba));
    12661269  WriteUnaligned32 ((UINT32 *)&Cdb[10], SwapBytes32 (SectorSize));
     
    12761279  *SenseDataLength              = CommandPacket.SenseDataLength;
    12771280  *DataLength                   = CommandPacket.OutTransferLength;
     1281
     1282  return Status;
     1283}
     1284
     1285
     1286/**
     1287  Execute Security Protocol In SCSI command on a specific SCSI target.
     1288
     1289  Executes the SCSI Security Protocol In command on the SCSI target specified by ScsiIo.
     1290  If Timeout is zero, then this function waits indefinitely for the command to complete.
     1291  If Timeout is greater than zero, then the command is executed and will timeout after
     1292  Timeout 100 ns units.
     1293  If ScsiIo is NULL, then ASSERT().
     1294  If SenseDataLength is NULL, then ASSERT().
     1295  If HostAdapterStatus is NULL, then ASSERT().
     1296  If TargetStatus is NULL, then ASSERT().
     1297  If TransferLength is NULL, then ASSERT().
     1298
     1299  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet buffer
     1300  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER
     1301  gets returned.
     1302
     1303  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet buffer
     1304  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER
     1305  gets returned.
     1306
     1307  @param[in]      ScsiIo                    SCSI IO Protocol to use.
     1308  @param[in]      Timeout                   The length of timeout period.
     1309  @param[in, out] SenseData                 A pointer to output sense data.
     1310  @param[in, out] SenseDataLength           The length of output sense data.
     1311  @param[out]     HostAdapterStatus         The status of Host Adapter.
     1312  @param[out]     TargetStatus              The status of the target.
     1313  @param[in]      SecurityProtocol          The Security Protocol to use.
     1314  @param[in]      SecurityProtocolSpecific  The Security Protocol Specific data.
     1315  @param[in]      Inc512                    If TRUE, 512 increment (INC_512) bit will be set for the
     1316                                            SECURITY PROTOCOL IN command.
     1317  @param[in]      DataLength                The size in bytes of the data buffer.
     1318  @param[in, out] DataBuffer                A pointer to a data buffer.
     1319  @param[out]     TransferLength            A pointer to a buffer to store the size in
     1320                                            bytes of the data written to the data buffer.
     1321
     1322  @retval  EFI_SUCCESS                 Command is executed successfully.
     1323  @retval  EFI_BAD_BUFFER_SIZE         The SCSI Request Packet was executed, but the entire DataBuffer could
     1324                                       not be transferred. The actual number of bytes transferred is returned in TransferLength.
     1325  @retval  EFI_NOT_READY               The SCSI Request Packet could not be sent because there are too many
     1326                                       SCSI Command Packets already queued.
     1327  @retval  EFI_DEVICE_ERROR            A device error occurred while attempting to send SCSI Request Packet.
     1328  @retval  EFI_UNSUPPORTED             The command described by the SCSI Request Packet is not supported by
     1329                                       the SCSI initiator(i.e., SCSI  Host Controller)
     1330  @retval  EFI_TIMEOUT                 A timeout occurred while waiting for the SCSI Request Packet to execute.
     1331  @retval  EFI_INVALID_PARAMETER       The contents of the SCSI Request Packet are invalid.
     1332
     1333**/
     1334EFI_STATUS
     1335EFIAPI
     1336ScsiSecurityProtocolInCommand (
     1337  IN     EFI_SCSI_IO_PROTOCOL  *ScsiIo,
     1338  IN     UINT64                Timeout,
     1339  IN OUT VOID                  *SenseData,   OPTIONAL
     1340  IN OUT UINT8                 *SenseDataLength,
     1341     OUT UINT8                 *HostAdapterStatus,
     1342     OUT UINT8                 *TargetStatus,
     1343  IN     UINT8                 SecurityProtocol,
     1344  IN     UINT16                SecurityProtocolSpecific,
     1345  IN     BOOLEAN               Inc512,
     1346  IN     UINTN                 DataLength,
     1347  IN OUT VOID                  *DataBuffer,  OPTIONAL
     1348     OUT UINTN                 *TransferLength
     1349  )
     1350{
     1351  EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
     1352  EFI_STATUS                      Status;
     1353  UINT8                           Cdb[EFI_SCSI_OP_LENGTH_TWELVE];
     1354
     1355  ASSERT (SenseDataLength != NULL);
     1356  ASSERT (HostAdapterStatus != NULL);
     1357  ASSERT (TargetStatus != NULL);
     1358  ASSERT (ScsiIo != NULL);
     1359  ASSERT (TransferLength != NULL);
     1360  ASSERT (DataLength <= MAX_UINT32);
     1361
     1362  ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
     1363  ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TWELVE);
     1364
     1365  CommandPacket.Timeout           = Timeout;
     1366  CommandPacket.InDataBuffer      = DataBuffer;
     1367  CommandPacket.SenseData         = SenseData;
     1368  CommandPacket.InTransferLength  = (UINT32) DataLength;
     1369  CommandPacket.Cdb               = Cdb;
     1370  //
     1371  // Fill Cdb for Security Protocol In Command
     1372  //
     1373  Cdb[0]                        = EFI_SCSI_OP_SECURITY_PROTOCOL_IN;
     1374  Cdb[1]                        = SecurityProtocol;
     1375  WriteUnaligned16 ((UINT16 *)&Cdb[2], SwapBytes16 (SecurityProtocolSpecific));
     1376
     1377  if (Inc512) {
     1378    if (DataLength % 512 != 0) {
     1379      return EFI_INVALID_PARAMETER;
     1380    }
     1381    Cdb[4]                      = BIT7;
     1382    WriteUnaligned32 ((UINT32 *)&Cdb[6], SwapBytes32 ((UINT32) DataLength / 512));
     1383  } else {
     1384    WriteUnaligned32 ((UINT32 *)&Cdb[6], SwapBytes32 ((UINT32) DataLength));
     1385  }
     1386
     1387  CommandPacket.CdbLength       = EFI_SCSI_OP_LENGTH_TWELVE;
     1388  CommandPacket.DataDirection   = EFI_SCSI_DATA_IN;
     1389  CommandPacket.SenseDataLength = *SenseDataLength;
     1390
     1391  Status                        = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
     1392
     1393  *HostAdapterStatus            = CommandPacket.HostAdapterStatus;
     1394  *TargetStatus                 = CommandPacket.TargetStatus;
     1395  *SenseDataLength              = CommandPacket.SenseDataLength;
     1396  *TransferLength               = (UINTN) CommandPacket.InTransferLength;
     1397
     1398  return Status;
     1399}
     1400
     1401
     1402/**
     1403  Execute Security Protocol Out SCSI command on a specific SCSI target.
     1404
     1405  Executes the SCSI Security Protocol Out command on the SCSI target specified by ScsiIo.
     1406  If Timeout is zero, then this function waits indefinitely for the command to complete.
     1407  If Timeout is greater than zero, then the command is executed and will timeout after
     1408  Timeout 100 ns units.
     1409  If ScsiIo is NULL, then ASSERT().
     1410  If SenseDataLength is NULL, then ASSERT().
     1411  If HostAdapterStatus is NULL, then ASSERT().
     1412  If TargetStatus is NULL, then ASSERT().
     1413
     1414  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet buffer
     1415  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER
     1416  gets returned.
     1417
     1418  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet buffer
     1419  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER
     1420  gets returned.
     1421
     1422  @param[in]      ScsiIo                    SCSI IO Protocol to use.
     1423  @param[in]      Timeout                   The length of timeout period.
     1424  @param[in, out] SenseData                 A pointer to output sense data.
     1425  @param[in, out] SenseDataLength           The length of output sense data.
     1426  @param[out]     HostAdapterStatus         The status of Host Adapter.
     1427  @param[out]     TargetStatus              The status of the target.
     1428  @param[in]      SecurityProtocol          The Security Protocol to use.
     1429  @param[in]      SecurityProtocolSpecific  The Security Protocol Specific data.
     1430  @param[in]      Inc512                    If TRUE, 512 increment (INC_512) bit will be set for the
     1431                                            SECURITY PROTOCOL OUT command.
     1432  @param[in]      DataLength                The size in bytes of the transfer data.
     1433  @param[in, out] DataBuffer                A pointer to a data buffer.
     1434
     1435  @retval  EFI_SUCCESS                 Command is executed successfully.
     1436  @retval  EFI_BAD_BUFFER_SIZE         The SCSI Request Packet was executed, but the entire DataBuffer could
     1437                                       not be transferred. The actual number of bytes transferred is returned in DataLength.
     1438  @retval  EFI_NOT_READY               The SCSI Request Packet could not be sent because there are too many
     1439                                       SCSI Command Packets already queued.
     1440  @retval  EFI_DEVICE_ERROR            A device error occurred while attempting to send SCSI Request Packet.
     1441  @retval  EFI_UNSUPPORTED             The command described by the SCSI Request Packet is not supported by
     1442                                       the SCSI initiator(i.e., SCSI  Host Controller)
     1443  @retval  EFI_TIMEOUT                 A timeout occurred while waiting for the SCSI Request Packet to execute.
     1444  @retval  EFI_INVALID_PARAMETER       The contents of the SCSI Request Packet are invalid.
     1445
     1446**/
     1447EFI_STATUS
     1448EFIAPI
     1449ScsiSecurityProtocolOutCommand (
     1450  IN     EFI_SCSI_IO_PROTOCOL  *ScsiIo,
     1451  IN     UINT64                Timeout,
     1452  IN OUT VOID                  *SenseData,   OPTIONAL
     1453  IN OUT UINT8                 *SenseDataLength,
     1454     OUT UINT8                 *HostAdapterStatus,
     1455     OUT UINT8                 *TargetStatus,
     1456  IN     UINT8                 SecurityProtocol,
     1457  IN     UINT16                SecurityProtocolSpecific,
     1458  IN     BOOLEAN               Inc512,
     1459  IN     UINTN                 DataLength,
     1460  IN OUT VOID                  *DataBuffer   OPTIONAL
     1461  )
     1462{
     1463  EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
     1464  EFI_STATUS                      Status;
     1465  UINT8                           Cdb[EFI_SCSI_OP_LENGTH_TWELVE];
     1466
     1467  ASSERT (SenseDataLength != NULL);
     1468  ASSERT (HostAdapterStatus != NULL);
     1469  ASSERT (TargetStatus != NULL);
     1470  ASSERT (ScsiIo != NULL);
     1471  ASSERT (DataLength <= MAX_UINT32);
     1472
     1473  ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
     1474  ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TWELVE);
     1475
     1476  CommandPacket.Timeout           = Timeout;
     1477  CommandPacket.OutDataBuffer     = DataBuffer;
     1478  CommandPacket.SenseData         = SenseData;
     1479  CommandPacket.OutTransferLength = (UINT32) DataLength;
     1480  CommandPacket.Cdb               = Cdb;
     1481  //
     1482  // Fill Cdb for Security Protocol Out Command
     1483  //
     1484  Cdb[0]                        = EFI_SCSI_OP_SECURITY_PROTOCOL_OUT;
     1485  Cdb[1]                        = SecurityProtocol;
     1486  WriteUnaligned16 ((UINT16 *)&Cdb[2], SwapBytes16 (SecurityProtocolSpecific));
     1487
     1488  if (Inc512) {
     1489    if (DataLength % 512 != 0) {
     1490      return EFI_INVALID_PARAMETER;
     1491    }
     1492    Cdb[4]                      = BIT7;
     1493    WriteUnaligned32 ((UINT32 *)&Cdb[6], SwapBytes32 ((UINT32) DataLength / 512));
     1494  } else {
     1495    WriteUnaligned32 ((UINT32 *)&Cdb[6], SwapBytes32 ((UINT32) DataLength));
     1496  }
     1497
     1498  CommandPacket.CdbLength       = EFI_SCSI_OP_LENGTH_TWELVE;
     1499  CommandPacket.DataDirection   = EFI_SCSI_DATA_OUT;
     1500  CommandPacket.SenseDataLength = *SenseDataLength;
     1501
     1502  Status                        = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
     1503
     1504  *HostAdapterStatus            = CommandPacket.HostAdapterStatus;
     1505  *TargetStatus                 = CommandPacket.TargetStatus;
     1506  *SenseDataLength              = CommandPacket.SenseDataLength;
    12781507
    12791508  return Status;
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