1 /** @file
2   ACPI Firmware Performance Data Table (FPDT) implementation specific definitions.
3 
4   Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
5   SPDX-License-Identifier: BSD-2-Clause-Patent
6 
7 **/
8 
9 #ifndef _FIRMWARE_PERFORMANCE_GUID_H_
10 #define _FIRMWARE_PERFORMANCE_GUID_H_
11 
12 #include <PiPei.h>
13 #include <IndustryStandard/Acpi.h>
14 #include <Ppi/SecPerformance.h>
15 
16 ///
17 /// This GUID is used for FPDT implementation specific EFI Variable, LockBox and Hob.
18 ///
19 /// EFI Variable:
20 ///   GUID - gEfiFirmwarePerformanceGuid
21 ///   Name - EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME
22 ///   Data - FIRMWARE_PERFORMANCE_VARIABLE
23 ///
24 /// LockBox:
25 ///   GUID - gEfiFirmwarePerformanceGuid
26 ///   Data - EFI_ACPI_BASIC_S3_SUSPEND_PERFORMANCE_RECORD
27 ///
28 /// Hob:
29 ///   GUID - gEfiFirmwarePerformanceGuid
30 ///   Data - FIRMWARE_SEC_PERFORMANCE (defined in <Ppi/SecPerformance.h>)
31 ///
32 /// SMI:
33 ///   GUID - gEfiFirmwarePerformanceGuid
34 ///   Data - SMM_BOOT_RECORD_COMMUNICATE
35 ///
36 /// StatusCodeData:
37 ///   Type - gEfiFirmwarePerformanceGuid
38 ///   Data - One or more boot record
39 ///
40 #define EFI_FIRMWARE_PERFORMANCE_GUID \
41   { \
42     0xc095791a, 0x3001, 0x47b2, {0x80, 0xc9, 0xea, 0xc7, 0x31, 0x9f, 0x2f, 0xa4 } \
43   }
44 
45 #define EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME  L"FirmwarePerformance"
46 
47 /// LockBox:
48 ///   GUID - gFirmwarePerformanceS3PointerGuid
49 ///   Data - S3 performance table pointer
50 ///
51 #define FIRMWARE_PERFORMANCE_S3_POINTER_GUID \
52   { \
53     0xdc65adc, 0xa973, 0x4130, { 0x8d, 0xf0, 0x2a, 0xdb, 0xeb, 0x9e, 0x4a, 0x31 } \
54   }
55 
56 #pragma pack(1)
57 
58 ///
59 /// Firmware Performance Data Table.
60 /// This structure will be installed into ACPI table as FPDT in normal boot path.
61 ///
62 typedef struct {
63   EFI_ACPI_DESCRIPTION_HEADER                             Header;            ///< Common ACPI description table header.
64   EFI_ACPI_5_0_FPDT_BOOT_PERFORMANCE_TABLE_POINTER_RECORD BootPointerRecord; ///< Basic Boot Performance Table Pointer record.
65   EFI_ACPI_5_0_FPDT_S3_PERFORMANCE_TABLE_POINTER_RECORD   S3PointerRecord;   ///< S3 Performance Table Pointer record.
66 } FIRMWARE_PERFORMANCE_TABLE;
67 
68 ///
69 /// S3 Performance Data Table.
70 /// This structure contains S3 performance records which will be updated in S3
71 /// suspend and S3 resume boot path.
72 ///
73 typedef struct {
74   EFI_ACPI_5_0_FPDT_PERFORMANCE_TABLE_HEADER  Header;    ///< Common ACPI table header.
75   EFI_ACPI_5_0_FPDT_S3_RESUME_RECORD          S3Resume;  ///< Basic S3 Resume performance record.
76   EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD         S3Suspend; ///< Basic S3 Suspend performance record.
77 } S3_PERFORMANCE_TABLE;
78 
79 ///
80 /// Basic Boot Performance Data Table.
81 /// This structure contains BasicBoot performance record.
82 ///
83 typedef struct {
84   EFI_ACPI_5_0_FPDT_PERFORMANCE_TABLE_HEADER   Header;     ///< Common ACPI table header.
85   EFI_ACPI_5_0_FPDT_FIRMWARE_BASIC_BOOT_RECORD BasicBoot;  ///< Basic Boot Resume performance record.
86   //
87   // one or more boot performance records.
88   //
89 } BOOT_PERFORMANCE_TABLE;
90 
91 ///
92 /// Boot performance table for the performance record in SMM phase.
93 ///
94 ///
95 typedef struct {
96   EFI_ACPI_5_0_FPDT_PERFORMANCE_TABLE_HEADER   Header;     ///< Common ACPI table header.
97   //
98   // one or more boot performance records.
99   //
100 } SMM_BOOT_PERFORMANCE_TABLE;
101 
102 ///
103 /// Performance data pointed by Performance Pointer Record.
104 ///
105 typedef struct {
106   BOOT_PERFORMANCE_TABLE         BootPerformance; ///< Basic Boot Performance.
107   S3_PERFORMANCE_TABLE           S3Performance;   ///< S3 performance.
108 } FIRMWARE_PERFORMANCE_RUNTIME_DATA;
109 
110 ///
111 /// Variable defined for FPDT implementation.
112 /// This Variable is produced by FPDT DXE module.
113 ///
114 typedef struct {
115   EFI_PHYSICAL_ADDRESS  BootPerformanceTablePointer; ///< Pointer to Boot Performance Table.
116   EFI_PHYSICAL_ADDRESS  S3PerformanceTablePointer;   ///< Pointer to S3 Performance Table.
117 } FIRMWARE_PERFORMANCE_VARIABLE;
118 
119 #pragma pack()
120 
121 //
122 // Log BOOT RECORD from SMM driver on boot time.
123 //
124 #define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE           1
125 #define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA           2
126 #define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET 3
127 
128 typedef struct {
129   UINTN             Function;
130   EFI_STATUS        ReturnStatus;
131   UINTN             BootRecordSize;
132   VOID              *BootRecordData;
133   UINTN             BootRecordOffset;
134 } SMM_BOOT_RECORD_COMMUNICATE;
135 
136 extern EFI_GUID gEfiFirmwarePerformanceGuid;
137 extern EFI_GUID gFirmwarePerformanceS3PointerGuid;
138 
139 #endif
140