• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Definition of Extended SAL Boot Service Protocol
3 
4   The Extended SAL Boot Service Protocol provides a mechanisms for platform specific
5   drivers to update the SAL System Table and register Extended SAL Procedures that are
6   callable in physical or virtual mode using the SAL calling convention.
7 
8   Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
9   This program and the accompanying materials
10   are licensed and made available under the terms and conditions of the BSD License
11   which accompanies this distribution.  The full text of the license may be found at
12   http://opensource.org/licenses/bsd-license.php
13 
14   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 
17 **/
18 
19 #ifndef _EXTENDED_SAL_BOOT_SERVICE_PROTOCOL_H_
20 #define _EXTENDED_SAL_BOOT_SERVICE_PROTOCOL_H_
21 
22 #include <IndustryStandard/Sal.h>
23 
24 #define EXTENDED_SAL_BOOT_SERVICE_PROTOCOL_GUID   \
25   { 0xde0ee9a4, 0x3c7a, 0x44f2, {0xb7, 0x8b, 0xe3, 0xcc, 0xd6, 0x9c, 0x3a, 0xf7 } }
26 
27 typedef struct _EXTENDED_SAL_BOOT_SERVICE_PROTOCOL EXTENDED_SAL_BOOT_SERVICE_PROTOCOL;
28 
29 /**
30   Adds platform specific information to the to the header of the SAL System Table.
31 
32   @param  This                  A pointer to the EXTENDED_SAL_BOOT_SERVICE_PROTOCOL instance.
33   @param  SalAVersion           Version of recovery SAL PEIM(s) in BCD format. Higher byte contains
34                                 the major revision and the lower byte contains the minor revision.
35   @param  SalBVersion           Version of DXE SAL Driver in BCD format. Higher byte contains
36                                 the major revision and the lower byte contains the minor revision.
37   @param  OemId                 A pointer to a Null-terminated ASCII string that contains OEM unique string.
38                                 The string cannot be longer than 32 bytes in total length
39   @param  ProductId             A pointer to a Null-terminated ASCII string that uniquely identifies a family of
40                                 compatible products. The string cannot be longer than 32 bytes in total length.
41 
42   @retval EFI_SUCCESS           The SAL System Table header was updated successfully.
43   @retval EFI_INVALID_PARAMETER OemId is NULL.
44   @retval EFI_INVALID_PARAMETER ProductId is NULL.
45   @retval EFI_INVALID_PARAMETER The length of OemId is greater than 32 characters.
46   @retval EFI_INVALID_PARAMETER The length of ProductId is greater than 32 characters.
47 
48 **/
49 typedef
50 EFI_STATUS
51 (EFIAPI *EXTENDED_SAL_ADD_SST_INFO)(
52   IN EXTENDED_SAL_BOOT_SERVICE_PROTOCOL  *This,
53   IN UINT16                              SalAVersion,
54   IN UINT16                              SalBVersion,
55   IN CHAR8                               *OemId,
56   IN CHAR8                               *ProductId
57   );
58 
59 /**
60   Adds an entry to the SAL System Table.
61 
62   This function adds the SAL System Table Entry specified by TableEntry and EntrySize
63   to the SAL System Table.
64 
65   @param  This         A pointer to the EXTENDED_SAL_BOOT_SERVICE_PROTOCOL instance.
66   @param  TableEntry   Pointer to a buffer containing a SAL System Table entry that is EntrySize bytes
67                        in length. The first byte of the TableEntry describes the type of entry.
68   @param  EntrySize    The size, in bytes, of TableEntry.
69 
70   @retval EFI_SUCCESSThe        SAL System Table was updated successfully.
71   @retval EFI_INVALID_PARAMETER TableEntry is NULL.
72   @retval EFI_INVALID_PARAMETER TableEntry specifies an invalid entry type.
73   @retval EFI_INVALID_PARAMETER EntrySize is not valid for this type of entry.
74 
75 **/
76 typedef
77 EFI_STATUS
78 (EFIAPI *EXTENDED_SAL_ADD_SST_ENTRY)(
79   IN EXTENDED_SAL_BOOT_SERVICE_PROTOCOL  *This,
80   IN UINT8                               *TableEntry,
81   IN UINTN                               EntrySize
82   );
83 
84 /**
85   Internal ESAL procedures.
86 
87   This is prototype of internal Extended SAL procedures, which is registerd by
88   EXTENDED_SAL_REGISTER_INTERNAL_PROC service.
89 
90   @param  FunctionId         The Function ID associated with this Extended SAL Procedure.
91   @param  Arg2               Second argument to the Extended SAL procedure.
92   @param  Arg3               Third argument to the Extended SAL procedure.
93   @param  Arg4               Fourth argument to the Extended SAL procedure.
94   @param  Arg5               Fifth argument to the Extended SAL procedure.
95   @param  Arg6               Sixth argument to the Extended SAL procedure.
96   @param  Arg7               Seventh argument to the Extended SAL procedure.
97   @param  Arg8               Eighth argument to the Extended SAL procedure.
98   @param  VirtualMode        TRUE if the Extended SAL Procedure is being invoked in virtual mode.
99                              FALSE if the Extended SAL Procedure is being invoked in physical mode.
100   @param  ModuleGlobal       A pointer to the global context associated with this Extended SAL Procedure.
101 
102   @return The result returned from the specified Extended SAL Procedure
103 
104 **/
105 typedef
106 SAL_RETURN_REGS
107 (EFIAPI *SAL_INTERNAL_EXTENDED_SAL_PROC)(
108   IN  UINT64   FunctionId,
109   IN  UINT64   Arg2,
110   IN  UINT64   Arg3,
111   IN  UINT64   Arg4,
112   IN  UINT64   Arg5,
113   IN  UINT64   Arg6,
114   IN  UINT64   Arg7,
115   IN  UINT64   Arg8,
116   IN  BOOLEAN  VirtualMode,
117   IN  VOID     *ModuleGlobal  OPTIONAL
118   );
119 
120 /**
121   Registers an Extended SAL Procedure.
122 
123   The Extended SAL Procedure specified by InternalSalProc and named by ClassGuidLo,
124   ClassGuidHi, and FunctionId is added to the set of available Extended SAL Procedures.
125 
126   @param  This                   A pointer to the EXTENDED_SAL_BOOT_SERVICE_PROTOCOL instance.
127   @param  ClassGuidLo            The lower 64-bits of  the class GUID for the Extended SAL Procedure being added.
128                                  Each class GUID contains one or more functions specified by a Function ID.
129   @param  ClassGuidHi            The upper 64-bits of  the class GUID for the Extended SAL Procedure being added.
130                                  Each class GUID contains one or more functions specified by a Function ID.
131   @param  FunctionId             The Function ID for the Extended SAL Procedure that is being added.  This Function
132                                  ID is a member of the Extended SAL Procedure class specified by ClassGuidLo
133                                  and ClassGuidHi.
134   @param  InternalSalProc        A pointer to the Extended SAL Procedure being added.
135   @param  PhysicalModuleGlobal   Pointer to a  module global structure. This is a physical mode pointer.
136                                  This pointer is passed to the Extended SAL Procedure specified by ClassGuidLo,
137                                  ClassGuidHi, FunctionId, and InternalSalProc.  If the system is in physical mode,
138                                  then this pointer is passed unmodified to InternalSalProc.  If the system is in
139                                  virtual mode, then the virtual address associated with this pointer is passed to
140                                  InternalSalProc.
141 
142   @retval EFI_SUCCESS            The Extended SAL Procedure was added.
143   @retval EFI_OUT_OF_RESOURCES   There are not enough resources available to add the Extended SAL Procedure.
144 
145 **/
146 typedef
147 EFI_STATUS
148 (EFIAPI *EXTENDED_SAL_REGISTER_INTERNAL_PROC)(
149   IN EXTENDED_SAL_BOOT_SERVICE_PROTOCOL  *This,
150   IN UINT64                              ClassGuidLo,
151   IN UINT64                              ClassGuidHi,
152   IN UINT64                              FunctionId,
153   IN SAL_INTERNAL_EXTENDED_SAL_PROC      InternalSalProc,
154   IN VOID                                *PhysicalModuleGlobal  OPTIONAL
155   );
156 
157 /**
158   Calls a previously registered Extended SAL Procedure.
159 
160   This function calls the Extended SAL Procedure specified by ClassGuidLo, ClassGuidHi,
161   and FunctionId.  The set of previously registered Extended SAL Procedures is searched for a
162   matching ClassGuidLo, ClassGuidHi, and FunctionId.  If a match is not found, then
163   EFI_SAL_NOT_IMPLEMENTED is returned.
164 
165   @param  ClassGuidLo        The lower 64-bits of the class GUID for the Extended SAL Procedure
166                              that is being called.
167   @param  ClassGuidHi        The upper 64-bits of the class GUID for the Extended SAL Procedure
168                              that is being called.
169   @param  FunctionId         Function ID for the Extended SAL Procedure being called.
170   @param  Arg2               Second argument to the Extended SAL procedure.
171   @param  Arg3               Third argument to the Extended SAL procedure.
172   @param  Arg4               Fourth argument to the Extended SAL procedure.
173   @param  Arg5               Fifth argument to the Extended SAL procedure.
174   @param  Arg6               Sixth argument to the Extended SAL procedure.
175   @param  Arg7               Seventh argument to the Extended SAL procedure.
176   @param  Arg8               Eighth argument to the Extended SAL procedure.
177 
178   @retval EFI_SAL_NOT_IMPLEMENTED        The Extended SAL Procedure specified by ClassGuidLo,
179                                          ClassGuidHi, and FunctionId has not been registered.
180   @retval EFI_SAL_VIRTUAL_ADDRESS_ERROR  This function was called in virtual mode before virtual mappings
181                                          for the specified Extended SAL Procedure are available.
182   @retval Other                          The result returned from the specified Extended SAL Procedure
183 
184 **/
185 typedef
186 SAL_RETURN_REGS
187 (EFIAPI *EXTENDED_SAL_PROC)(
188   IN UINT64  ClassGuidLo,
189   IN UINT64  ClassGuidHi,
190   IN UINT64  FunctionId,
191   IN UINT64  Arg2,
192   IN UINT64  Arg3,
193   IN UINT64  Arg4,
194   IN UINT64  Arg5,
195   IN UINT64  Arg6,
196   IN UINT64  Arg7,
197   IN UINT64  Arg8
198   );
199 
200 ///
201 /// The EXTENDED_SAL_BOOT_SERVICE_PROTOCOL provides a mechanisms for platform specific
202 /// drivers to update the SAL System Table and register Extended SAL Procedures that are
203 /// callable in physical or virtual mode using the SAL calling convention.
204 ///
205 struct _EXTENDED_SAL_BOOT_SERVICE_PROTOCOL {
206   EXTENDED_SAL_ADD_SST_INFO            AddSalSystemTableInfo;
207   EXTENDED_SAL_ADD_SST_ENTRY           AddSalSystemTableEntry;
208   EXTENDED_SAL_REGISTER_INTERNAL_PROC  RegisterExtendedSalProc;
209   EXTENDED_SAL_PROC                    ExtendedSalProc;
210 };
211 
212 extern EFI_GUID  gEfiExtendedSalBootServiceProtocolGuid;
213 
214 #endif
215