]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiScriptLib.h
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / Dxe / Include / EfiScriptLib.h
1 /*++
2
3 Copyright (c) 2004, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 EfiScriptLib.h
15
16 Abstract:
17
18
19 --*/
20
21 #ifndef _EFI_SCRIPT_LIB_H_
22 #define _EFI_SCRIPT_LIB_H_
23
24 #include "Tiano.h"
25 #include "EfiCommonLib.h"
26 #include "EfiBootScript.h"
27 #include EFI_PROTOCOL_DEFINITION (BootScriptSave)
28
29
30 EFI_STATUS
31 BootScriptSaveInitialize (
32 IN EFI_HANDLE ImageHandle,
33 IN EFI_SYSTEM_TABLE *SystemTable
34 )
35 /*++
36
37 Routine Description:
38
39 Intialize Boot Script Lib if it has not yet been initialized.
40
41 Arguments:
42
43 ImageHandle - The firmware allocated handle for the EFI image.
44
45 SystemTable - A pointer to the EFI System Table.
46
47 Returns:
48
49 EFI_STATUS always returns EFI_SUCCESS
50
51 --*/
52 ;
53
54 EFI_STATUS
55 BootScriptSaveIoWrite (
56 IN UINT16 TableName,
57 IN EFI_BOOT_SCRIPT_WIDTH Width,
58 IN UINT64 Address,
59 IN UINTN Count,
60 IN VOID *Buffer
61 )
62 /*++
63
64 Routine Description:
65
66 Save I/O write to boot script with opcode EFI_BOOT_SCRIPT_IO_WRITE_OPCODE
67
68 Arguments:
69
70 TableName - Desired boot script table
71
72 Width - The width of the I/O operations.
73
74 Address - The base address of the I/O operations.
75
76 Count - The number of I/O operations to perform.
77
78 Buffer - The source buffer from which to write data.
79
80 Returns:
81
82 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
83
84 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
85
86 --*/
87 ;
88
89 EFI_STATUS
90 BootScriptSaveIoReadWrite (
91 IN UINT16 TableName,
92 IN EFI_BOOT_SCRIPT_WIDTH Width,
93 IN UINT64 Address,
94 IN VOID *Data,
95 IN VOID *DataMask
96 )
97 /*++
98
99 Routine Description:
100
101 Save I/O modify to boot script with opcode EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE
102
103 Arguments:
104
105 TableName - Desired boot script table
106
107 Width - The width of the I/O operations.
108
109 Address - The base address of the I/O operations.
110
111 Data - A pointer to the data to be OR-ed.
112
113 DataMask - A pointer to the data mask to be AND-ed with the data read from the register.
114
115 Returns:
116
117 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
118
119 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
120
121 --*/
122 ;
123
124 EFI_STATUS
125 BootScriptSaveMemWrite (
126 IN UINT16 TableName,
127 IN EFI_BOOT_SCRIPT_WIDTH Width,
128 IN UINT64 Address,
129 IN UINTN Count,
130 IN VOID *Buffer
131 )
132 /*++
133
134 Routine Description:
135
136 Save memory write to boot script with opcode EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE
137
138 Arguments:
139
140 TableName - Desired boot script table
141
142 Width - The width of the memory operations.
143
144 Address - The base address of the memory operations.
145
146 Count - The number of memory operations to perform.
147
148 Buffer - The source buffer from which to write the data.
149
150 Returns:
151
152 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
153
154 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
155
156 --*/
157 ;
158
159 EFI_STATUS
160 BootScriptSaveMemReadWrite (
161 IN UINT16 TableName,
162 IN EFI_BOOT_SCRIPT_WIDTH Width,
163 IN UINT64 Address,
164 IN VOID *Data,
165 IN VOID *DataMask
166 )
167 /*++
168
169 Routine Description:
170
171 Save memory modify to boot script with opcode EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE
172
173 Arguments:
174
175 TableName - Desired boot script table
176
177 Width - The width of the memory operations.
178
179 Address - The base address of the memory operations.
180
181 Data - A pointer to the data to be OR-ed.
182
183 DataMask - A pointer to the data mask to be AND-ed with the data read from the register.
184
185 Returns:
186
187 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
188
189 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
190
191 --*/
192 ;
193
194 EFI_STATUS
195 BootScriptSavePciCfgWrite (
196 IN UINT16 TableName,
197 IN EFI_BOOT_SCRIPT_WIDTH Width,
198 IN UINT64 Address,
199 IN UINTN Count,
200 IN VOID *Buffer
201 )
202 /*++
203
204 Routine Description:
205
206 Save PCI configuration space write operation to boot script with opcode
207 EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE
208
209 Arguments:
210
211 TableName - Desired boot script table
212
213 Width - The width of the PCI operations
214
215 Address - The address within the PCI configuration space.
216
217 Count - The number of PCI operations to perform.
218
219 Buffer - The source buffer from which to write the data.
220
221 Returns:
222
223 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
224
225 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
226
227 --*/
228 ;
229
230 EFI_STATUS
231 BootScriptSavePciCfgReadWrite (
232 IN UINT16 TableName,
233 IN EFI_BOOT_SCRIPT_WIDTH Width,
234 IN UINT64 Address,
235 IN VOID *Data,
236 IN VOID *DataMask
237 )
238 /*++
239
240 Routine Description:
241
242 Save PCI configuration space modify operation to boot script with opcode
243 EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE
244
245 Arguments:
246
247 TableName - Desired boot script table
248
249 Width - The width of the PCI operations
250
251 Address - The address within the PCI configuration space.
252
253 Data - A pointer to the data to be OR-ed.
254
255 DataMask - A pointer to the data mask to be AND-ed with the data read from the register.
256
257 Returns:
258
259 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
260
261 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
262
263 --*/
264 ;
265 ;
266
267 EFI_STATUS
268 BootScriptSaveSmbusExecute (
269 IN UINT16 TableName,
270 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
271 IN EFI_SMBUS_DEVICE_COMMAND Command,
272 IN EFI_SMBUS_OPERATION Operation,
273 IN BOOLEAN PecCheck,
274 IN UINTN *Length,
275 IN VOID *Buffer
276 )
277 /*++
278
279 Routine Description:
280
281 Save SMBus command execution to boot script with opcode
282 EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE
283
284 Arguments:
285
286 TableName - Desired boot script table
287 SlaveAddress - The SMBus address for the slave device that the operation is targeting.
288 Command - The command that is transmitted by the SMBus host controller to the
289 SMBus slave device.
290 Operation - Indicates which particular SMBus protocol it will use to execute the
291 SMBus transactions.
292 PecCheck - Defines if Packet Error Code (PEC) checking is required for this operation.
293 Length - A pointer to signify the number of bytes that this operation will do.
294 Buffer - Contains the value of data to execute to the SMBUS slave device.
295
296 Returns:
297
298 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
299
300 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
301
302 --*/
303 ;
304
305 EFI_STATUS
306 BootScriptSaveStall (
307 IN UINT16 TableName,
308 IN UINTN Duration
309 )
310 /*++
311
312 Routine Description:
313
314 Save execution stall on the processor to boot script with opcode
315 EFI_BOOT_SCRIPT_STALL_OPCODE
316
317 Arguments:
318
319 TableName - Desired boot script table
320
321 Duration - Duration in microseconds of the stall.
322
323 Returns:
324
325 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
326
327 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
328
329 --*/
330 ;
331
332 EFI_STATUS
333 BootScriptSaveDispatch (
334 IN UINT16 TableName,
335 IN EFI_PHYSICAL_ADDRESS EntryPoint
336 )
337 /*++
338
339 Routine Description:
340
341 Save dispatching specified arbitrary code to boot script with opcode
342 EFI_BOOT_SCRIPT_DISPATCH_OPCODE
343
344 Arguments:
345
346 TableName - Desired boot script table
347
348 EntryPoint - Entry point of the code to be dispatched.
349
350 Returns:
351
352 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
353
354 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
355
356 --*/
357 ;
358
359 EFI_STATUS
360 EFIAPI
361 BootScriptSaveInformation (
362 IN UINT16 TableName,
363 IN UINT32 Length,
364 IN EFI_PHYSICAL_ADDRESS Buffer
365 )
366 /*++
367
368 Routine Description:
369
370 Save a Information Opcode record in table specified with TableName
371
372 Arguments:
373
374 TableName - Desired boot script table
375 Length - Length of information in bytes
376 Buffer - Content of information that will be saved in script table
377
378 Returns:
379
380 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
381
382 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
383
384 --*/
385 ;
386
387 EFI_STATUS
388 EFIAPI
389 BootScriptSaveInformationUnicodeString (
390 IN UINT16 TableName,
391 IN CHAR16 *String
392 )
393 /*++
394
395 Routine Description:
396
397 Save a Information Opcode record in table specified with TableName, the information
398 is a unicode string.
399
400 Arguments:
401
402 TableName - Desired boot script table
403 String - The string that will be saved in script table
404
405 Returns:
406
407 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
408
409 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
410
411 --*/
412 ;
413
414 EFI_STATUS
415 EFIAPI
416 BootScriptSaveInformationAsciiString (
417 IN UINT16 TableName,
418 IN CHAR8 *String
419 )
420 /*++
421
422 Routine Description:
423
424 Save a Information Opcode record in table specified with TableName, the information
425 is a ascii string.
426
427 Arguments:
428
429 TableName - Desired boot script table
430 String - The string that will be saved in script table
431
432 Returns:
433
434 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
435
436 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
437
438 --*/
439 ;
440
441 #ifdef EFI_S3_RESUME
442
443 #define INITIALIZE_SCRIPT(ImageHandle, SystemTable) \
444 BootScriptSaveInitialize(ImageHandle, SystemTable)
445
446 #define SCRIPT_IO_WRITE(TableName, Width, Address, Count, Buffer) \
447 BootScriptSaveIoWrite(TableName, Width, Address, Count, Buffer)
448
449 #define SCRIPT_IO_READ_WRITE(TableName, Width, Address, Data, DataMask) \
450 BootScriptSaveIoReadWrite(TableName, Width, Address, Data, DataMask)
451
452 #define SCRIPT_MEM_WRITE(TableName, Width, Address, Count, Buffer) \
453 BootScriptSaveMemWrite(TableName, Width, Address, Count, Buffer)
454
455 #define SCRIPT_MEM_WRITE_THIS(TableName, Width, Address, Count) \
456 BootScriptSaveMemWrite(TableName, Width, Address, Count, (VOID*)(UINTN)Address)
457
458 #define SCRIPT_MEM_READ_WRITE(TableName, Width, Address, Data, DataMask) \
459 BootScriptSaveMemReadWrite(TableName, Width, Address, Data, DataMask)
460
461 #define SCRIPT_PCI_CFG_WRITE(TableName, Width, Address, Count, Buffer) \
462 BootScriptSavePciCfgWrite(TableName, Width, Address, Count, Buffer)
463
464 #define SCRIPT_PCI_CFG_READ_WRITE(TableName, Width, Address, Data, DataMask) \
465 BootScriptSavePciCfgReadWrite(TableName, Width, Address, Data, DataMask)
466
467 #define SCRIPT_SMBUS_EXECUTE(TableName, SlaveAddress, Command, Operation, PecCheck, Length, Buffer) \
468 BootScriptSaveSmbusExecute(TableName, SlaveAddress, Command, Operation, PecCheck, Length, Buffer)
469
470 #define SCRIPT_STALL(TableName, Duration) \
471 BootScriptSaveStall(TableName, Duration)
472
473 #define SCRIPT_DISPATCH(TableName, EntryPoint) \
474 BootScriptSaveDispatch(TableName, EntryPoint)
475
476 #define SCRIPT_INOFRMATION(TableName, Length, Buffer) \
477 BootScriptSaveInformation(TableName, Length, Buffer)
478
479 #define SCRIPT_INOFRMATION_UNICODE_STRING(TableName, String) \
480 BootScriptSaveInformationUnicodeString(TableName, String)
481
482 #define SCRIPT_INOFRMATION_ASCII_STRING(TableName, String) \
483 BootScriptSaveInformationAsciiString(TableName, String)
484
485 #else
486
487 #define INITIALIZE_SCRIPT(ImageHandle, SystemTable)
488
489 #define SCRIPT_IO_WRITE(TableName, Width, Address, Count, Buffer)
490
491 #define SCRIPT_IO_READ_WRITE(TableName, Width, Address, Data, DataMask)
492
493 #define SCRIPT_MEM_WRITE(TableName, Width, Address, Count, Buffer)
494
495 #define SCRIPT_MEM_WRITE_THIS(TableName, Width, Address, Count)
496
497 #define SCRIPT_MEM_READ_WRITE(TableName, Width, Address, Data, DataMask)
498
499 #define SCRIPT_PCI_CFG_WRITE(TableName, Width, Address, Count, Buffer)
500
501 #define SCRIPT_PCI_CFG_READ_WRITE(TableName, Width, Address, Data, DataMask)
502
503 #define SCRIPT_SMBUS_EXECUTE(TableName, SlaveAddress, Command, Operation, PecCheck, Length, Buffer)
504
505 #define SCRIPT_STALL(TableName, Duration)
506
507 #define SCRIPT_DISPATCH(TableName, EntryPoint)
508
509 #define SCRIPT_INOFRMATION(TableName, Length, Buffer)
510
511 #define SCRIPT_INOFRMATION_UNICODE_STRING(TableName, String)
512
513 #define SCRIPT_INOFRMATION_ASCII_STRING(TableName, String)
514
515 #endif
516
517 #endif