VirtualBox

Ignore:
Timestamp:
Sep 11, 2019 8:46:37 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
133262
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:
2 edited

Legend:

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

  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Include/Library/PerformanceLib.h

    r77662 r80721  
    22  Provides services to log the execution times and retrieve them later.
    33
    4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
    5 This program and the accompanying materials
    6 are licensed and made available under the terms and conditions of the BSD License
    7 which accompanies this distribution.  The full text of the license may be found at
    8 http://opensource.org/licenses/bsd-license.php
    9 
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     4Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
     5SPDX-License-Identifier: BSD-2-Clause-Patent
    126
    137**/
     
    2014///
    2115#define PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED  0x00000001
     16
     17//
     18// Public Progress Identifiers for Event Records.
     19//
     20#define PERF_EVENT_ID                   0x00
     21
     22#define MODULE_START_ID                 0x01
     23#define MODULE_END_ID                   0x02
     24#define MODULE_LOADIMAGE_START_ID       0x03
     25#define MODULE_LOADIMAGE_END_ID         0x04
     26#define MODULE_DB_START_ID              0x05
     27#define MODULE_DB_END_ID                0x06
     28#define MODULE_DB_SUPPORT_START_ID      0x07
     29#define MODULE_DB_SUPPORT_END_ID        0x08
     30#define MODULE_DB_STOP_START_ID         0x09
     31#define MODULE_DB_STOP_END_ID           0x0A
     32
     33#define PERF_EVENTSIGNAL_START_ID       0x10
     34#define PERF_EVENTSIGNAL_END_ID         0x11
     35#define PERF_CALLBACK_START_ID          0x20
     36#define PERF_CALLBACK_END_ID            0x21
     37#define PERF_FUNCTION_START_ID          0x30
     38#define PERF_FUNCTION_END_ID            0x31
     39#define PERF_INMODULE_START_ID          0x40
     40#define PERF_INMODULE_END_ID            0x41
     41#define PERF_CROSSMODULE_START_ID       0x50
     42#define PERF_CROSSMODULE_END_ID         0x51
     43
     44//
     45// Declare bits for PcdPerformanceLibraryPropertyMask and
     46// also used as the Type parameter of LogPerformanceMeasurementEnabled().
     47//
     48#define PERF_CORE_START_IMAGE            0x0002
     49#define PERF_CORE_LOAD_IMAGE             0x0004
     50#define PERF_CORE_DB_SUPPORT             0x0008
     51#define PERF_CORE_DB_START               0x0010
     52#define PERF_CORE_DB_STOP                0x0020
     53
     54#define PERF_GENERAL_TYPE                0x0040
    2255
    2356/**
     
    272305  );
    273306
     307
     308/**
     309  Check whether the specified performance measurement can be logged.
     310
     311  This function returns TRUE when the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set
     312  and the Type disable bit in PcdPerformanceLibraryPropertyMask is not set.
     313
     314  @param Type        - Type of the performance measurement entry.
     315
     316  @retval TRUE         The performance measurement can be logged.
     317  @retval FALSE        The performance measurement can NOT be logged.
     318
     319**/
     320BOOLEAN
     321EFIAPI
     322LogPerformanceMeasurementEnabled (
     323  IN  CONST UINTN        Type
     324  );
     325
     326/**
     327  Create performance record with event description.
     328
     329  @param CallerIdentifier - Image handle or pointer to caller ID GUID
     330  @param Guid             - Pointer to a GUID.
     331                            Used for event signal perf and callback perf to cache the event guid.
     332  @param String           - Pointer to a string describing the measurement
     333  @param Address          - Pointer to a location in memory relevant to the measurement.
     334  @param Identifier       - Performance identifier describing the type of measurement.
     335
     336  @retval RETURN_SUCCESS           - Successfully created performance record
     337  @retval RETURN_OUT_OF_RESOURCES  - Ran out of space to store the records
     338  @retval RETURN_INVALID_PARAMETER - Invalid parameter passed to function - NULL
     339                                     pointer or invalid Identifier.
     340
     341**/
     342RETURN_STATUS
     343EFIAPI
     344LogPerformanceMeasurement (
     345  IN CONST VOID   *CallerIdentifier, OPTIONAL
     346  IN CONST VOID   *Guid,    OPTIONAL
     347  IN CONST CHAR8  *String,  OPTIONAL
     348  IN UINT64       Address,  OPTIONAL
     349  IN UINT32       Identifier
     350  );
     351
     352/**
     353  Begin Macro to measure the performance of StartImage in core.
     354
     355  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     356  and the BIT1(dsiable PERF_CORE_START_IMAGE) of PcdPerformanceLibraryPropertyMask is not set.
     357  then LogPerformanceMeasurement() is called.
     358
     359**/
     360#define PERF_START_IMAGE_BEGIN(ModuleHandle) \
     361  do { \
     362    if (LogPerformanceMeasurementEnabled (PERF_CORE_START_IMAGE)) { \
     363      LogPerformanceMeasurement (ModuleHandle, NULL, NULL, 0, MODULE_START_ID); \
     364    } \
     365  } while (FALSE)
     366
     367/**
     368  End Macro to measure the performance of StartImage in core.
     369
     370  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     371  and the BIT1 (dsiable PERF_CORE_START_IMAGE)of PcdPerformanceLibraryPropertyMask is not set.
     372  then LogPerformanceMeasurement() is called.
     373
     374**/
     375#define PERF_START_IMAGE_END(ModuleHandle) \
     376  do { \
     377    if (LogPerformanceMeasurementEnabled (PERF_CORE_START_IMAGE)) { \
     378      LogPerformanceMeasurement (ModuleHandle, NULL, NULL, 0, MODULE_END_ID); \
     379    } \
     380  } while (FALSE)
     381
     382/**
     383  Begin Macro to measure the performance of LoadImage in core.
     384
     385  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     386  and the BIT2 (dsiable PERF_CORE_LOAD_IAMGE) of PcdPerformanceLibraryPropertyMask is not set.
     387  then LogPerformanceMeasurement() is called.
     388
     389**/
     390#define PERF_LOAD_IMAGE_BEGIN(ModuleHandle) \
     391  do { \
     392    if (LogPerformanceMeasurementEnabled (PERF_CORE_LOAD_IMAGE)) { \
     393      LogPerformanceMeasurement (ModuleHandle, NULL, NULL, 0, MODULE_LOADIMAGE_START_ID); \
     394    } \
     395  } while (FALSE)
     396
     397/**
     398  End Macro to measure the performance of LoadImage in core.
     399
     400  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     401  and the BIT2 (dsiable PERF_CORE_LOAD_IAMGE) of PcdPerformanceLibraryPropertyMask is not set.
     402  then LogPerformanceMeasurement() is called.
     403
     404**/
     405#define PERF_LOAD_IMAGE_END(ModuleHandle) \
     406  do { \
     407    if (LogPerformanceMeasurementEnabled (PERF_CORE_LOAD_IMAGE)) { \
     408      LogPerformanceMeasurement (ModuleHandle, NULL, NULL, 0, MODULE_LOADIMAGE_END_ID); \
     409    } \
     410  } while (FALSE)
     411
     412/**
     413  Start Macro to measure the performance of DriverBinding Support in core.
     414
     415  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     416  and the BIT3 (dsiable PERF_CORE_DB_SUPPORT) of PcdPerformanceLibraryPropertyMask is not set.
     417  then LogPerformanceMeasurement() is called.
     418
     419**/
     420#define PERF_DRIVER_BINDING_SUPPORT_BEGIN(ModuleHandle, ControllerHandle) \
     421  do { \
     422    if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_SUPPORT)) { \
     423      LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_SUPPORT_START_ID); \
     424    } \
     425  } while (FALSE)
     426
     427/**
     428  End Macro to measure the performance of DriverBinding Support in core.
     429
     430  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     431  and the BIT3 (dsiable PERF_CORE_DB_SUPPORT) of PcdPerformanceLibraryPropertyMask is not set.
     432  then LogPerformanceMeasurement() is called.
     433
     434**/
     435#define PERF_DRIVER_BINDING_SUPPORT_END(ModuleHandle, ControllerHandle) \
     436  do { \
     437    if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_SUPPORT)) { \
     438      LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_SUPPORT_END_ID); \
     439    } \
     440  } while (FALSE)
     441
     442/**
     443  Begin Macro to measure the performance of DriverBinding Start in core.
     444
     445  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     446  and the BIT4 (dsiable PERF_CORE_DB_START) of PcdPerformanceLibraryPropertyMask is not set.
     447  then LogPerformanceMeasurement() is called.
     448
     449**/
     450#define PERF_DRIVER_BINDING_START_BEGIN(ModuleHandle, ControllerHandle) \
     451  do { \
     452    if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_START)) { \
     453      LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_START_ID); \
     454    } \
     455  } while (FALSE)
     456
     457/**
     458  End Macro to measure the performance of DriverBinding Start in core.
     459
     460  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     461  and the BIT4 (dsiable PERF_CORE_DB_START) of PcdPerformanceLibraryPropertyMask is not set.
     462  then LogPerformanceMeasurement() is called.
     463
     464**/
     465#define PERF_DRIVER_BINDING_START_END(ModuleHandle, ControllerHandle) \
     466  do { \
     467    if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_START)) { \
     468      LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_END_ID); \
     469    } \
     470  } while (FALSE)
     471
     472/**
     473  Start Macro to measure the performance of DriverBinding Stop in core.
     474
     475  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     476  and the BIT5 (dsiable PERF_CORE_DB_STOP) of PcdPerformanceLibraryPropertyMask is not set.
     477  then LogPerformanceMeasurement() is called.
     478
     479**/
     480#define PERF_DRIVER_BINDING_STOP_BEGIN(ModuleHandle, ControllerHandle) \
     481  do { \
     482    if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_STOP)) { \
     483      LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_STOP_START_ID); \
     484    } \
     485  } while (FALSE)
     486
     487/**
     488  End Macro to measure the performance of DriverBinding Stop in core.
     489
     490  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     491  and the BIT5 (dsiable PERF_CORE_DB_STOP) of PcdPerformanceLibraryPropertyMask is not set.
     492  then LogPerformanceMeasurement() is called.
     493
     494**/
     495#define PERF_DRIVER_BINDING_STOP_END(ModuleHandle, ControllerHandle) \
     496  do { \
     497    if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_STOP)) { \
     498      LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_STOP_END_ID); \
     499    } \
     500  } while (FALSE)
     501
     502/**
     503  Macro to measure the time from power-on to this macro execution.
     504  It can be used to log a meaningful thing which happens at a time point.
     505
     506  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     507  and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
     508  then LogPerformanceMeasurement() is called.
     509
     510**/
     511#define PERF_EVENT(EventString) \
     512  do { \
     513    if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
     514      LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, EventString , 0, PERF_EVENT_ID); \
     515    } \
     516  } while (FALSE)
     517
     518/**
     519  Begin Macro to measure the perofrmance of evnent signal behavior in any module.
     520  The event guid will be passed with this macro.
     521
     522  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     523  and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
     524  then LogPerformanceMeasurement() is called.
     525
     526**/
     527#define PERF_EVENT_SIGNAL_BEGIN(EventGuid) \
     528  do { \
     529    if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
     530      LogPerformanceMeasurement (&gEfiCallerIdGuid, EventGuid, __FUNCTION__ , 0, PERF_EVENTSIGNAL_START_ID); \
     531    } \
     532  } while (FALSE)
     533
     534/**
     535  End Macro to measure the perofrmance of evnent signal behavior in any module.
     536  The event guid will be passed with this macro.
     537
     538  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     539  and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
     540  then LogPerformanceMeasurement() is called.
     541
     542**/
     543#define PERF_EVENT_SIGNAL_END(EventGuid) \
     544  do { \
     545    if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
     546      LogPerformanceMeasurement (&gEfiCallerIdGuid, EventGuid, __FUNCTION__ , 0, PERF_EVENTSIGNAL_END_ID); \
     547    } \
     548  } while (FALSE)
     549
     550/**
     551  Begin Macro to measure the perofrmance of a callback function in any module.
     552  The event guid which trigger the callback function will be passed with this macro.
     553
     554  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     555  and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
     556  then LogPerformanceMeasurement() is called.
     557
     558**/
     559#define PERF_CALLBACK_BEGIN(TriggerGuid) \
     560  do { \
     561    if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
     562      LogPerformanceMeasurement (&gEfiCallerIdGuid, TriggerGuid, __FUNCTION__ , 0, PERF_CALLBACK_START_ID); \
     563    } \
     564  } while (FALSE)
     565
     566/**
     567  End Macro to measure the perofrmance of a callback function in any module.
     568  The event guid which trigger the callback function will be passed with this macro.
     569
     570  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     571  and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
     572  then LogPerformanceMeasurement() is called.
     573
     574**/
     575#define PERF_CALLBACK_END(TriggerGuid) \
     576  do { \
     577    if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
     578      LogPerformanceMeasurement (&gEfiCallerIdGuid, TriggerGuid, __FUNCTION__ , 0, PERF_CALLBACK_END_ID); \
     579    } \
     580  } while (FALSE)
     581
     582/**
     583  Begin Macro to measure the perofrmance of a general function in any module.
     584
     585  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     586  and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
     587  then LogPerformanceMeasurement() is called.
     588
     589**/
     590#define PERF_FUNCTION_BEGIN() \
     591  do { \
     592    if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
     593      LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, __FUNCTION__ , 0, PERF_FUNCTION_START_ID); \
     594    } \
     595  } while (FALSE)
     596
     597/**
     598  End Macro to measure the perofrmance of a general function in any module.
     599
     600  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     601  and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
     602  then LogPerformanceMeasurement() is called.
     603
     604**/
     605#define PERF_FUNCTION_END() \
     606  do { \
     607    if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
     608      LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, __FUNCTION__ , 0, PERF_FUNCTION_END_ID); \
     609    } \
     610  } while (FALSE)
     611
     612/**
     613  Begin Macro to measure the perofrmance of a behavior within one module.
     614
     615  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     616  and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
     617  then LogPerformanceMeasurement() is called.
     618
     619**/
     620#define PERF_INMODULE_BEGIN(MeasurementString) \
     621  do { \
     622    if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
     623      LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, MeasurementString, 0, PERF_INMODULE_START_ID); \
     624    } \
     625  } while (FALSE)
     626
     627/**
     628  End Macro to measure the perofrmance of a behavior within one module.
     629
     630  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     631  and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
     632  then LogPerformanceMeasurement() is called.
     633
     634**/
     635#define PERF_INMODULE_END(MeasurementString) \
     636  do { \
     637    if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
     638      LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, MeasurementString, 0, PERF_INMODULE_END_ID); \
     639    } \
     640  } while (FALSE)
     641
     642/**
     643  Begin Macro to measure the perofrmance of a behavior in different modules.
     644  Such as the performance of PEI phase, DXE phase, BDS phase.
     645
     646  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     647  and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
     648  then LogPerformanceMeasurement() is called.
     649
     650**/
     651#define PERF_CROSSMODULE_BEGIN(MeasurementString) \
     652  do { \
     653    if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
     654      LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, MeasurementString, 0, PERF_CROSSMODULE_START_ID); \
     655    } \
     656  } while (FALSE)
     657
     658/**
     659  End Macro to measure the perofrmance of a behavior in different modules.
     660  Such as the performance of PEI phase, DXE phase, BDS phase.
     661
     662  If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
     663  and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
     664  then LogPerformanceMeasurement() is called.
     665
     666**/
     667#define PERF_CROSSMODULE_END(MeasurementString) \
     668  do { \
     669    if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
     670      LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, MeasurementString, 0, PERF_CROSSMODULE_END_ID); \
     671    } \
     672  } while (FALSE)
     673
    274674/**
    275675  Macro that calls EndPerformanceMeasurement().
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