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