VirtualBox

Ignore:
Timestamp:
Sep 11, 2019 8:46:37 AM (5 years ago)
Author:
vboxsync
Message:

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
4 edited

Legend:

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

  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c

    r77662 r80721  
    77  performance information.
    88
    9   Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
    10 This program and the accompanying materials
    11 are licensed and made available under the terms and conditions of the BSD License
    12 which accompanies this distribution.  The full text of the license may be found at
    13 http://opensource.org/licenses/bsd-license.php
    14 
    15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     9  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
     10SPDX-License-Identifier: BSD-2-Clause-Patent
    1711
    1812**/
     
    2115#include <PiDxe.h>
    2216
    23 #include <Guid/Performance.h>
     17#include <Guid/PerformanceMeasurement.h>
    2418
    2519#include <Library/PerformanceLib.h>
     
    3125// The cached Performance Protocol and PerformanceEx Protocol interface.
    3226//
    33 PERFORMANCE_PROTOCOL        *mPerformance = NULL;
    34 PERFORMANCE_EX_PROTOCOL     *mPerformanceEx = NULL;
     27EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL      *mPerformanceMeasurement = NULL;
    3528
    3629/**
     
    4437**/
    4538EFI_STATUS
    46 GetPerformanceProtocol (
     39GetPerformanceMeasurementProtocol (
    4740  VOID
    4841  )
    4942{
    5043  EFI_STATUS                Status;
    51   PERFORMANCE_PROTOCOL      *Performance;
    52   PERFORMANCE_EX_PROTOCOL   *PerformanceEx;
    53 
    54   if (mPerformanceEx != NULL || mPerformance != NULL) {
     44  EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL   *PerformanceMeasurement;
     45
     46  if (mPerformanceMeasurement != NULL) {
    5547    return EFI_SUCCESS;
    5648  }
    5749
    58   Status = gBS->LocateProtocol (&gPerformanceExProtocolGuid, NULL, (VOID **) &PerformanceEx);
     50  Status = gBS->LocateProtocol (&gEdkiiPerformanceMeasurementProtocolGuid, NULL, (VOID **) &PerformanceMeasurement);
    5951  if (!EFI_ERROR (Status)) {
    60     ASSERT (PerformanceEx != NULL);
     52    ASSERT (PerformanceMeasurement != NULL);
    6153    //
    62     // Cache PerformanceEx Protocol.
     54    // Cache PerformanceMeasurement Protocol.
    6355    //
    64     mPerformanceEx = PerformanceEx;
    65     return EFI_SUCCESS;
    66   }
    67 
    68   Status = gBS->LocateProtocol (&gPerformanceProtocolGuid, NULL, (VOID **) &Performance);
    69   if (!EFI_ERROR (Status)) {
    70     ASSERT (Performance != NULL);
    71     //
    72     // Cache performance protocol.
    73     //
    74     mPerformance = Performance;
     56    mPerformanceMeasurement = PerformanceMeasurement;
    7557    return EFI_SUCCESS;
    7658  }
     
    11193  )
    11294{
    113   EFI_STATUS  Status;
    114 
    115   Status = GetPerformanceProtocol ();
     95  EFI_STATUS    Status;
     96  CONST CHAR8*  String;
     97
     98  Status = GetPerformanceMeasurementProtocol ();
    11699  if (EFI_ERROR (Status)) {
    117     return RETURN_OUT_OF_RESOURCES;
    118   }
    119 
    120   if (mPerformanceEx != NULL) {
    121     Status = mPerformanceEx->StartGaugeEx (Handle, Token, Module, TimeStamp, Identifier);
    122   } else if (mPerformance != NULL) {
    123     Status = mPerformance->StartGauge (Handle, Token, Module, TimeStamp);
     100    return RETURN_NOT_FOUND;
     101  }
     102
     103  if (Token != NULL) {
     104    String = Token;
     105  } else if (Module != NULL) {
     106    String = Module;
     107  } else {
     108    String = NULL;
     109  }
     110
     111  if (mPerformanceMeasurement != NULL) {
     112    Status = mPerformanceMeasurement->CreatePerformanceMeasurement (Handle, NULL, String, TimeStamp, 0, Identifier, PerfStartEntry);
    124113  } else {
    125114    ASSERT (FALSE);
     
    163152  )
    164153{
    165   EFI_STATUS  Status;
    166 
    167   Status = GetPerformanceProtocol ();
     154  EFI_STATUS    Status;
     155  CONST CHAR8*  String;
     156
     157  Status = GetPerformanceMeasurementProtocol ();
    168158  if (EFI_ERROR (Status)) {
    169159    return RETURN_NOT_FOUND;
    170160  }
    171161
    172   if (mPerformanceEx != NULL) {
    173     Status = mPerformanceEx->EndGaugeEx (Handle, Token, Module, TimeStamp, Identifier);
    174   } else if (mPerformance != NULL) {
    175     Status = mPerformance->EndGauge (Handle, Token, Module, TimeStamp);
     162  if (Token != NULL) {
     163    String = Token;
     164  } else if (Module != NULL) {
     165    String = Module;
     166  } else {
     167    String = NULL;
     168  }
     169
     170  if (mPerformanceMeasurement != NULL) {
     171    Status = mPerformanceMeasurement->CreatePerformanceMeasurement (Handle, NULL, String, TimeStamp, 0, Identifier, PerfEndEntry);
    176172  } else {
    177173    ASSERT (FALSE);
     
    234230  )
    235231{
    236   EFI_STATUS            Status;
    237   GAUGE_DATA_ENTRY_EX   *GaugeData;
    238 
    239   GaugeData = NULL;
    240 
    241   ASSERT (Handle != NULL);
    242   ASSERT (Token != NULL);
    243   ASSERT (Module != NULL);
    244   ASSERT (StartTimeStamp != NULL);
    245   ASSERT (EndTimeStamp != NULL);
    246   ASSERT (Identifier != NULL);
    247 
    248   Status = GetPerformanceProtocol ();
    249   if (EFI_ERROR (Status)) {
    250     return 0;
    251   }
    252 
    253   if (mPerformanceEx != NULL) {
    254     Status = mPerformanceEx->GetGaugeEx (LogEntryKey++, &GaugeData);
    255   } else if (mPerformance != NULL) {
    256     Status = mPerformance->GetGauge (LogEntryKey++, (GAUGE_DATA_ENTRY **) &GaugeData);
    257   } else {
    258     ASSERT (FALSE);
    259     return 0;
    260   }
    261 
    262   //
    263   // Make sure that LogEntryKey is a valid log entry key,
    264   //
    265   ASSERT (Status != EFI_INVALID_PARAMETER);
    266 
    267   if (EFI_ERROR (Status)) {
    268     //
    269     // The LogEntryKey is the last entry (equals to the total entry number).
    270     //
    271     return 0;
    272   }
    273 
    274   ASSERT (GaugeData != NULL);
    275 
    276   *Handle         = (VOID *) (UINTN) GaugeData->Handle;
    277   *Token          = GaugeData->Token;
    278   *Module         = GaugeData->Module;
    279   *StartTimeStamp = GaugeData->StartTimeStamp;
    280   *EndTimeStamp   = GaugeData->EndTimeStamp;
    281   if (mPerformanceEx != NULL) {
    282     *Identifier   = GaugeData->Identifier;
    283   } else {
    284     *Identifier   = 0;
    285   }
    286 
    287   return LogEntryKey;
     232  return 0;
     233
    288234}
    289235
     
    404350  )
    405351{
    406   UINT32 Identifier;
    407   return GetPerformanceMeasurementEx (LogEntryKey, Handle, Token, Module, StartTimeStamp, EndTimeStamp, &Identifier);
     352  return 0;
    408353}
    409354
     
    428373  return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
    429374}
     375
     376/**
     377  Create performance record with event description and a timestamp.
     378
     379  @param CallerIdentifier  - Image handle or pointer to caller ID GUID
     380  @param Guid              - Pointer to a GUID
     381  @param String            - Pointer to a string describing the measurement
     382  @param Address           - Pointer to a location in memory relevant to the measurement
     383  @param Identifier        - Performance identifier describing the type of measurement
     384
     385  @retval RETURN_SUCCESS           - Successfully created performance record
     386  @retval RETURN_OUT_OF_RESOURCES  - Ran out of space to store the records
     387  @retval RETURN_INVALID_PARAMETER - Invalid parameter passed to function - NULL
     388                                     pointer or invalid PerfId
     389
     390**/
     391RETURN_STATUS
     392EFIAPI
     393LogPerformanceMeasurement (
     394  IN CONST VOID   *CallerIdentifier,
     395  IN CONST VOID   *Guid,    OPTIONAL
     396  IN CONST CHAR8  *String,  OPTIONAL
     397  IN  UINT64       Address, OPTIONAL
     398  IN UINT32       Identifier
     399  )
     400{
     401  EFI_STATUS  Status;
     402
     403  Status = GetPerformanceMeasurementProtocol ();
     404  if (EFI_ERROR (Status)) {
     405    return RETURN_OUT_OF_RESOURCES;
     406  }
     407
     408  if (mPerformanceMeasurement != NULL) {
     409    Status = mPerformanceMeasurement->CreatePerformanceMeasurement (CallerIdentifier, Guid, String, 0, Address, Identifier, PerfEntry);
     410  } else {
     411    ASSERT (FALSE);
     412  }
     413
     414  return (RETURN_STATUS) Status;
     415}
     416
     417/**
     418  Check whether the specified performance measurement can be logged.
     419
     420  This function returns TRUE when the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set
     421  and the Type disable bit in PcdPerformanceLibraryPropertyMask is not set.
     422
     423  @param Type        - Type of the performance measurement entry.
     424
     425  @retval TRUE         The performance measurement can be logged.
     426  @retval FALSE        The performance measurement can NOT be logged.
     427
     428**/
     429BOOLEAN
     430EFIAPI
     431LogPerformanceMeasurementEnabled (
     432  IN  CONST UINTN        Type
     433  )
     434{
     435  //
     436  // When Performance measurement is enabled and the type is not filtered, the performance can be logged.
     437  //
     438  if (PerformanceMeasurementEnabled () && (PcdGet8(PcdPerformanceLibraryPropertyMask) & Type) == 0) {
     439    return TRUE;
     440  }
     441  return FALSE;
     442}
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf

    r58466 r80721  
    77#  it does not log any performance information.
    88#
    9 #  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    10 #  This program and the accompanying materials
    11 #  are licensed and made available under the terms and conditions of the BSD License
    12 #  which accompanies this distribution.  The full text of the license may be found at
    13 #  http://opensource.org/licenses/bsd-license.php
    14 #
    15 #  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    16 #  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     9#  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
     10#  SPDX-License-Identifier: BSD-2-Clause-Patent
    1711#
    1812##
     
    2519  MODULE_TYPE                    = DXE_DRIVER
    2620  VERSION_STRING                 = 1.0
    27   LIBRARY_CLASS                  = PerformanceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
     21  LIBRARY_CLASS                  = PerformanceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
    2822
    2923#
    3024# The following information is for reference only and not required by the build tools.
    3125#
    32 #  VALID_ARCHITECTURES           = IA32 X64 IPF EBC
     26#  VALID_ARCHITECTURES           = IA32 X64 EBC
    3327#
    3428
     
    4943
    5044[Guids]
    51   gPerformanceProtocolGuid      ## SOMETIMES_CONSUMES   ## UNDEFINED # Locate protocol
    52   gPerformanceExProtocolGuid    ## SOMETIMES_CONSUMES   ## UNDEFINED # Locate protocol
     45  gEdkiiPerformanceMeasurementProtocolGuid    ## SOMETIMES_CONSUMES   ## UNDEFINED # Locate protocol
    5346
    5447
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.uni

    r77662 r80721  
    77// it does not log any performance information.
    88//
    9 // Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
     9// Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
    1010//
    11 // This program and the accompanying materials
    12 // are licensed and made available under the terms and conditions of the BSD License
    13 // which accompanies this distribution.  The full text of the license may be found at
    14 // http://opensource.org/licenses/bsd-license.php
    15 //
    16 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    17 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     11// SPDX-License-Identifier: BSD-2-Clause-Patent
    1812//
    1913// **/
Note: See TracChangeset for help on using the changeset viewer.

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