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