aboutsummaryrefslogtreecommitdiff
path: root/src/vendorcode/intel/edk2/UDK2017/MdePkg/Include/Protocol/ExtendedSalBootService.h
blob: 167201d85a951406cccdb04a6cc4c6793f3fec6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
/** @file
  Definition of Extended SAL Boot Service Protocol

  The Extended SAL Boot Service Protocol provides a mechanisms for platform specific 
  drivers to update the SAL System Table and register Extended SAL Procedures that are
  callable in physical or virtual mode using the SAL calling convention.

  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
  This program and the accompanying materials                          
  are licensed and made available under the terms and conditions of the BSD License         
  which accompanies this distribution.  The full text of the license may be found at        
  http://opensource.org/licenses/bsd-license.php                                            

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

**/

#ifndef _EXTENDED_SAL_BOOT_SERVICE_PROTOCOL_H_
#define _EXTENDED_SAL_BOOT_SERVICE_PROTOCOL_H_

#include <IndustryStandard/Sal.h>

#define EXTENDED_SAL_BOOT_SERVICE_PROTOCOL_GUID   \
  { 0xde0ee9a4, 0x3c7a, 0x44f2, {0xb7, 0x8b, 0xe3, 0xcc, 0xd6, 0x9c, 0x3a, 0xf7 } }

typedef struct _EXTENDED_SAL_BOOT_SERVICE_PROTOCOL EXTENDED_SAL_BOOT_SERVICE_PROTOCOL;

/**
  Adds platform specific information to the to the header of the SAL System Table.

  @param  This                  A pointer to the EXTENDED_SAL_BOOT_SERVICE_PROTOCOL instance.
  @param  SalAVersion           Version of recovery SAL PEIM(s) in BCD format. Higher byte contains
                                the major revision and the lower byte contains the minor revision.
  @param  SalBVersion           Version of DXE SAL Driver in BCD format. Higher byte contains
                                the major revision and the lower byte contains the minor revision.
  @param  OemId                 A pointer to a Null-terminated ASCII string that contains OEM unique string.
                                The string cannot be longer than 32 bytes in total length
  @param  ProductId             A pointer to a Null-terminated ASCII string that uniquely identifies a family of 
                                compatible products. The string cannot be longer than 32 bytes in total length.

  @retval EFI_SUCCESS           The SAL System Table header was updated successfully.
  @retval EFI_INVALID_PARAMETER OemId is NULL.
  @retval EFI_INVALID_PARAMETER ProductId is NULL.
  @retval EFI_INVALID_PARAMETER The length of OemId is greater than 32 characters.
  @retval EFI_INVALID_PARAMETER The length of ProductId is greater than 32 characters.

**/
typedef
EFI_STATUS
(EFIAPI *EXTENDED_SAL_ADD_SST_INFO)(
  IN EXTENDED_SAL_BOOT_SERVICE_PROTOCOL  *This,
  IN UINT16                              SalAVersion,
  IN UINT16                              SalBVersion,
  IN CHAR8                               *OemId,
  IN CHAR8                               *ProductId
  );

/**
  Adds an entry to the SAL System Table.

  This function adds the SAL System Table Entry specified by TableEntry and EntrySize
  to the SAL System Table.

  @param  This         A pointer to the EXTENDED_SAL_BOOT_SERVICE_PROTOCOL instance.
  @param  TableEntry   Pointer to a buffer containing a SAL System Table entry that is EntrySize bytes 
                       in length. The first byte of the TableEntry describes the type of entry.
  @param  EntrySize    The size, in bytes, of TableEntry.

  @retval EFI_SUCCESSThe        SAL System Table was updated successfully.
  @retval EFI_INVALID_PARAMETER TableEntry is NULL.
  @retval EFI_INVALID_PARAMETER TableEntry specifies an invalid entry type.
  @retval EFI_INVALID_PARAMETER EntrySize is not valid for this type of entry.

**/
typedef
EFI_STATUS
(EFIAPI *EXTENDED_SAL_ADD_SST_ENTRY)(
  IN EXTENDED_SAL_BOOT_SERVICE_PROTOCOL  *This,
  IN UINT8                               *TableEntry,
  IN UINTN                               EntrySize
  );

/**
  Internal ESAL procedures.

  This is prototype of internal Extended SAL procedures, which is registerd by
  EXTENDED_SAL_REGISTER_INTERNAL_PROC service.

  @param  FunctionId         The Function ID associated with this Extended SAL Procedure.
  @param  Arg2               Second argument to the Extended SAL procedure.
  @param  Arg3               Third argument to the Extended SAL procedure.
  @param  Arg4               Fourth argument to the Extended SAL procedure.
  @param  Arg5               Fifth argument to the Extended SAL procedure.
  @param  Arg6               Sixth argument to the Extended SAL procedure.
  @param  Arg7               Seventh argument to the Extended SAL procedure.
  @param  Arg8               Eighth argument to the Extended SAL procedure.
  @param  VirtualMode        TRUE if the Extended SAL Procedure is being invoked in virtual mode.
                             FALSE if the Extended SAL Procedure is being invoked in physical mode.
  @param  ModuleGlobal       A pointer to the global context associated with this Extended SAL Procedure. 

  @return The result returned from the specified Extended SAL Procedure

**/
typedef
SAL_RETURN_REGS
(EFIAPI *SAL_INTERNAL_EXTENDED_SAL_PROC)(
  IN  UINT64   FunctionId,
  IN  UINT64   Arg2,
  IN  UINT64   Arg3,
  IN  UINT64   Arg4,
  IN  UINT64   Arg5,
  IN  UINT64   Arg6,
  IN  UINT64   Arg7,
  IN  UINT64   Arg8,
  IN  BOOLEAN  VirtualMode,
  IN  VOID     *ModuleGlobal  OPTIONAL
  ); 

/**
  Registers an Extended SAL Procedure.

  The Extended SAL Procedure specified by InternalSalProc and named by ClassGuidLo,
  ClassGuidHi, and FunctionId is added to the set of available Extended SAL Procedures.

  @param  This                   A pointer to the EXTENDED_SAL_BOOT_SERVICE_PROTOCOL instance.
  @param  ClassGuidLo            The lower 64-bits of  the class GUID for the Extended SAL Procedure being added.  
                                 Each class GUID contains one or more functions specified by a Function ID.
  @param  ClassGuidHi            The upper 64-bits of  the class GUID for the Extended SAL Procedure being added.  
                                 Each class GUID contains one or more functions specified by a Function ID.
  @param  FunctionId             The Function ID for the Extended SAL Procedure that is being added.  This Function 
                                 ID is a member of the Extended SAL Procedure class specified by ClassGuidLo 
                                 and ClassGuidHi.
  @param  InternalSalProc        A pointer to the Extended SAL Procedure being added.
  @param  PhysicalModuleGlobal   Pointer to a  module global structure. This is a physical mode pointer.
                                 This pointer is passed to the Extended SAL Procedure specified by ClassGuidLo, 
                                 ClassGuidHi, FunctionId, and InternalSalProc.  If the system is in physical mode,
                                 then this pointer is passed unmodified to InternalSalProc.  If the system is in
                                 virtual mode, then the virtual address associated with this pointer is passed to
                                 InternalSalProc.

  @retval EFI_SUCCESS            The Extended SAL Procedure was added.
  @retval EFI_OUT_OF_RESOURCES   There are not enough resources available to add the Extended SAL Procedure.

**/
typedef
EFI_STATUS
(EFIAPI *EXTENDED_SAL_REGISTER_INTERNAL_PROC)(
  IN EXTENDED_SAL_BOOT_SERVICE_PROTOCOL  *This,
  IN UINT64                              ClassGuidLo,
  IN UINT64                              ClassGuidHi,
  IN UINT64                              FunctionId,
  IN SAL_INTERNAL_EXTENDED_SAL_PROC      InternalSalProc,
  IN VOID                                *PhysicalModuleGlobal  OPTIONAL
  );

/**
  Calls a previously registered Extended SAL Procedure.

  This function calls the Extended SAL Procedure specified by ClassGuidLo, ClassGuidHi, 
  and FunctionId.  The set of previously registered Extended SAL Procedures is searched for a 
  matching ClassGuidLo, ClassGuidHi, and FunctionId.  If a match is not found, then 
  EFI_SAL_NOT_IMPLEMENTED is returned.

  @param  ClassGuidLo        The lower 64-bits of the class GUID for the Extended SAL Procedure
                             that is being called.
  @param  ClassGuidHi        The upper 64-bits of the class GUID for the Extended SAL Procedure
                             that is being called.
  @param  FunctionId         Function ID for the Extended SAL Procedure being called.
  @param  Arg2               Second argument to the Extended SAL procedure.
  @param  Arg3               Third argument to the Extended SAL procedure.
  @param  Arg4               Fourth argument to the Extended SAL procedure.
  @param  Arg5               Fifth argument to the Extended SAL procedure.
  @param  Arg6               Sixth argument to the Extended SAL procedure.
  @param  Arg7               Seventh argument to the Extended SAL procedure.
  @param  Arg8               Eighth argument to the Extended SAL procedure.

  @retval EFI_SAL_NOT_IMPLEMENTED        The Extended SAL Procedure specified by ClassGuidLo, 
                                         ClassGuidHi, and FunctionId has not been registered.
  @retval EFI_SAL_VIRTUAL_ADDRESS_ERROR  This function was called in virtual mode before virtual mappings 
                                         for the specified Extended SAL Procedure are available.
  @retval Other                          The result returned from the specified Extended SAL Procedure

**/
typedef
SAL_RETURN_REGS
(EFIAPI *EXTENDED_SAL_PROC)(
  IN UINT64  ClassGuidLo,
  IN UINT64  ClassGuidHi,
  IN UINT64  FunctionId,
  IN UINT64  Arg2,
  IN UINT64  Arg3,
  IN UINT64  Arg4,
  IN UINT64  Arg5,
  IN UINT64  Arg6,
  IN UINT64  Arg7,
  IN UINT64  Arg8
  );

///
/// The EXTENDED_SAL_BOOT_SERVICE_PROTOCOL provides a mechanisms for platform specific 
/// drivers to update the SAL System Table and register Extended SAL Procedures that are
/// callable in physical or virtual mode using the SAL calling convention.
///
struct _EXTENDED_SAL_BOOT_SERVICE_PROTOCOL {
  EXTENDED_SAL_ADD_SST_INFO            AddSalSystemTableInfo;
  EXTENDED_SAL_ADD_SST_ENTRY           AddSalSystemTableEntry;
  EXTENDED_SAL_REGISTER_INTERNAL_PROC  RegisterExtendedSalProc;   
  EXTENDED_SAL_PROC                    ExtendedSalProc;
};

extern EFI_GUID  gEfiExtendedSalBootServiceProtocolGuid;

#endif