1 /** @file
2   STM service protocol definition
3 
4   Copyright (c) 2015 - 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.
12 
13 **/
14 
15 #ifndef _SM_MONITOR_INIT_PROTOCOL_H_
16 #define _SM_MONITOR_INIT_PROTOCOL_H_
17 
18 #include <PiSmm.h>
19 #include <Register/StmApi.h>
20 
21 #define EFI_SM_MONITOR_INIT_PROTOCOL_GUID \
22     { 0x228f344d, 0xb3de, 0x43bb, 0xa4, 0xd7, 0xea, 0x20, 0xb, 0x1b, 0x14, 0x82}
23 
24 //
25 // STM service
26 //
27 
28 /**
29 
30   Load STM image to MSEG.
31 
32   @param StmImage      STM image
33   @param StmImageSize  STM image size
34 
35   @retval EFI_SUCCESS            Load STM to MSEG successfully
36   @retval EFI_ALREADY_STARTED    STM image is already loaded to MSEG
37   @retval EFI_BUFFER_TOO_SMALL   MSEG is smaller than minimal requirement of STM image
38   @retval EFI_UNSUPPORTED        MSEG is not enabled
39 
40 **/
41 typedef
42 EFI_STATUS
43 (EFIAPI *EFI_SM_MONITOR_LOAD_MONITOR) (
44   IN EFI_PHYSICAL_ADDRESS StmImage,
45   IN UINTN                StmImageSize
46   );
47 
48 /**
49 
50   Add resources in list to database.
51 
52   @param ResourceList  A pointer to resource list to be added
53   @param NumEntries    Optional number of entries.
54                        If 0, list must be terminated by END_OF_RESOURCES.
55 
56   @retval EFI_SUCCESS            If resources are added
57   @retval EFI_INVALID_PARAMETER  If nested procedure detected resource failer
58   @retval EFI_OUT_OF_RESOURCES   If nested procedure returned it and we cannot allocate more areas.
59 
60 **/
61 typedef
62 EFI_STATUS
63 (EFIAPI *EFI_SM_MONITOR_ADD_PI_RESOURCE) (
64   IN STM_RSC *ResourceList,
65   IN UINT32   NumEntries OPTIONAL
66   );
67 
68 /**
69 
70   Delete resources in list to database.
71 
72   @param ResourceList  A pointer to resource list to be deleted
73                        NULL means delete all resources.
74   @param NumEntries    Optional number of entries.
75                        If 0, list must be terminated by END_OF_RESOURCES.
76 
77   @retval EFI_SUCCESS            If resources are deleted
78   @retval EFI_INVALID_PARAMETER  If nested procedure detected resource failer
79 
80 **/
81 typedef
82 EFI_STATUS
83 (EFIAPI *EFI_SM_MONITOR_DELETE_PI_RESOURCE) (
84   IN STM_RSC *ResourceList OPTIONAL,
85   IN UINT32   NumEntries OPTIONAL
86   );
87 
88 /**
89 
90   Get BIOS resources.
91 
92   @param ResourceList  A pointer to resource list to be filled
93   @param ResourceSize  On input it means size of resource list input.
94                        On output it means size of resource list filled,
95                        or the size of resource list to be filled if size of too small.
96 
97   @retval EFI_SUCCESS            If resources are returned.
98   @retval EFI_BUFFER_TOO_SMALL   If resource list buffer is too small to hold the whole resources.
99 
100 **/
101 typedef
102 EFI_STATUS
103 (EFIAPI *EFI_SM_MONITOR_GET_PI_RESOURCE) (
104   OUT    STM_RSC *ResourceList,
105   IN OUT UINT32  *ResourceSize
106   );
107 
108 typedef UINT32 EFI_SM_MONITOR_STATE;
109 #define EFI_SM_MONITOR_STATE_ENABLED     0x1
110 #define EFI_SM_MONITOR_STATE_ACTIVATED   0x2
111 
112 /**
113 
114   Get STM state
115 
116   @return STM state
117 
118 **/
119 typedef
120 EFI_SM_MONITOR_STATE
121 (EFIAPI *EFI_SM_MONITOR_GET_MONITOR_STATE) (
122   VOID
123   );
124 
125 typedef struct _EFI_SM_MONITOR_INIT_PROTOCOL {
126   //
127   // Valid at boot-time only
128   //
129   EFI_SM_MONITOR_LOAD_MONITOR                      LoadMonitor;
130   EFI_SM_MONITOR_ADD_PI_RESOURCE                   AddPiResource;
131   EFI_SM_MONITOR_DELETE_PI_RESOURCE                DeletePiResource;
132   EFI_SM_MONITOR_GET_PI_RESOURCE                   GetPiResource;
133   //
134   // Valid at runtime
135   //
136   EFI_SM_MONITOR_GET_MONITOR_STATE                 GetMonitorState;
137 } EFI_SM_MONITOR_INIT_PROTOCOL;
138 
139 extern EFI_GUID gEfiSmMonitorInitProtocolGuid;
140 
141 #endif
142