]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseS3BootScriptLibNull/BootScriptLib.c
MdePkg/BaseMemoryLib: Fix VS2015 build error
[mirror_edk2.git] / MdePkg / Library / BaseS3BootScriptLibNull / BootScriptLib.c
CommitLineData
fe69ac84 1/** @file\r
2 Null function implementation for EFI S3 boot script. \r
3\r
300f2c6a 4 Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
fe69ac84 5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions\r
8 of the BSD License which accompanies this distribution. The\r
9 full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17\r
18#include <Base.h>\r
19#include <Library/S3BootScriptLib.h>\r
20\r
21/**\r
22 Save I/O write to boot script \r
23\r
24 @param Width the width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.\r
25 @param Address The base address of the I/O operations.\r
26 @param Count The number of I/O operations to perform.\r
27 @param Buffer The source buffer from which to write data.\r
28\r
29 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
30 @retval RETURN_SUCCESS Opcode is added.\r
31**/\r
32RETURN_STATUS\r
33EFIAPI\r
34S3BootScriptSaveIoWrite (\r
35 IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
36 IN UINT64 Address,\r
37 IN UINTN Count,\r
38 IN VOID *Buffer\r
39 )\r
40{\r
41 return RETURN_SUCCESS;\r
42}\r
43\r
44/**\r
45 Adds a record for an I/O modify operation into a S3 boot script table\r
46\r
47 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.\r
48 @param Address The base address of the I/O operations.\r
49 @param Data A pointer to the data to be OR-ed.\r
50 @param DataMask A pointer to the data mask to be AND-ed with the data read from the register\r
51\r
52 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
53 @retval RETURN_SUCCESS Opcode is added.\r
54**/\r
55RETURN_STATUS\r
56EFIAPI\r
57S3BootScriptSaveIoReadWrite (\r
58 IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
59 IN UINT64 Address,\r
60 IN VOID *Data,\r
61 IN VOID *DataMask\r
62 )\r
63{\r
64 return RETURN_SUCCESS;\r
65}\r
66\r
67/**\r
68 Adds a record for a memory write operation into a specified boot script table.\r
69\r
70 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.\r
71 @param Address The base address of the memory operations\r
72 @param Count The number of memory operations to perform.\r
73 @param Buffer The source buffer from which to write the data.\r
74\r
75 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
76 @retval RETURN_SUCCESS Opcode is added.\r
77**/\r
78RETURN_STATUS\r
79EFIAPI\r
80S3BootScriptSaveMemWrite (\r
81 IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
82 IN UINT64 Address,\r
83 IN UINTN Count,\r
84 IN VOID *Buffer\r
85 )\r
86{\r
87 return RETURN_SUCCESS;\r
88}\r
89/**\r
90 Adds a record for a memory modify operation into a specified boot script table.\r
91\r
92 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.\r
93 @param Address The base address of the memory operations. Address needs alignment if required\r
94 @param Data A pointer to the data to be OR-ed.\r
95 @param DataMask A pointer to the data mask to be AND-ed with the data read from the register.\r
96\r
97 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
98 @retval RETURN_SUCCESS Opcode is added.\r
99**/\r
100RETURN_STATUS\r
101EFIAPI\r
102S3BootScriptSaveMemReadWrite (\r
103 IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
104 IN UINT64 Address,\r
105 IN VOID *Data,\r
106 IN VOID *DataMask\r
107 )\r
108{\r
109 return RETURN_SUCCESS;\r
110}\r
111/**\r
112 Adds a record for a PCI configuration space write operation into a specified boot script table.\r
113\r
114 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.\r
115 @param Address The address within the PCI configuration space.\r
116 @param Count The number of PCI operations to perform.\r
117 @param Buffer The source buffer from which to write the data.\r
118\r
119 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
120 @retval RETURN_SUCCESS Opcode is added.\r
121**/\r
122RETURN_STATUS\r
123EFIAPI\r
124S3BootScriptSavePciCfgWrite (\r
125 IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
126 IN UINT64 Address,\r
127 IN UINTN Count,\r
128 IN VOID *Buffer\r
129 )\r
130{\r
131 return RETURN_SUCCESS;\r
132}\r
133\r
134/**\r
135 Adds a record for a PCI configuration space modify operation into a specified boot script table.\r
136\r
137 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.\r
138 @param Address The address within the PCI configuration space.\r
139 @param Data A pointer to the data to be OR-ed.The size depends on Width.\r
140 @param DataMask A pointer to the data mask to be AND-ed.\r
141\r
142 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
143 @retval RETURN__SUCCESS Opcode is added.\r
144**/\r
145RETURN_STATUS\r
146EFIAPI\r
147S3BootScriptSavePciCfgReadWrite (\r
148 IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
149 IN UINT64 Address,\r
150 IN VOID *Data,\r
151 IN VOID *DataMask\r
152 )\r
153{\r
154 return RETURN_SUCCESS;\r
155}\r
156/**\r
157 Adds a record for a PCI configuration space modify operation into a specified boot script table.\r
158\r
159 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.\r
160 @param Segment The PCI segment number for Address.\r
161 @param Address The address within the PCI configuration space.\r
162 @param Count The number of PCI operations to perform.\r
163 @param Buffer The source buffer from which to write the data.\r
164\r
165 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
166 @retval RETURN_SUCCESS Opcode is added.\r
167**/\r
168RETURN_STATUS\r
169EFIAPI\r
170S3BootScriptSavePciCfg2Write (\r
171 IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
172 IN UINT16 Segment,\r
173 IN UINT64 Address,\r
174 IN UINTN Count,\r
175 IN VOID *Buffer\r
176 )\r
177{\r
178 return RETURN_SUCCESS;\r
179}\r
180/**\r
181 Adds a record for a PCI configuration space modify operation into a specified boot script table.\r
182\r
183 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.\r
184 @param Segment The PCI segment number for Address.\r
185 @param Address The address within the PCI configuration space.\r
186 @param Data A pointer to the data to be OR-ed. The size depends on Width.\r
187 @param DataMask A pointer to the data mask to be AND-ed.\r
188\r
189 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
190 @retval RETURN_SUCCESS Opcode is added.\r
191**/\r
192RETURN_STATUS\r
193EFIAPI\r
194S3BootScriptSavePciCfg2ReadWrite (\r
195 IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
196 IN UINT16 Segment,\r
197 IN UINT64 Address,\r
198 IN VOID *Data,\r
199 IN VOID *DataMask\r
200 )\r
201{ \r
202 return RETURN_SUCCESS;\r
203}\r
204/**\r
205 Adds a record for an SMBus command execution into a specified boot script table.\r
206\r
207 @param SmBusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC.\r
208 @param Operation Indicates which particular SMBus protocol it will use to execute the SMBus\r
209 transactions.\r
210 @param Length A pointer to signify the number of bytes that this operation will do.\r
211 @param Buffer Contains the value of data to execute to the SMBUS slave device.\r
212 \r
213 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
214 @retval RETURN_SUCCESS Opcode is added.\r
215**/\r
216RETURN_STATUS\r
217EFIAPI\r
218S3BootScriptSaveSmbusExecute (\r
219 IN UINTN SmBusAddress, \r
220 IN EFI_SMBUS_OPERATION Operation,\r
221 IN UINTN *Length,\r
222 IN VOID *Buffer\r
223 )\r
224{\r
225 return RETURN_SUCCESS;\r
226}\r
227/**\r
228 Adds a record for an execution stall on the processor into a specified boot script table.\r
229\r
230 @param Duration Duration in microseconds of the stall\r
231 \r
232 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
233 @retval RETURN_SUCCESS Opcode is added.\r
234**/\r
235RETURN_STATUS\r
236EFIAPI\r
237S3BootScriptSaveStall (\r
238 IN UINTN Duration\r
239 )\r
240{\r
241 return RETURN_SUCCESS;\r
242}\r
243/**\r
244 Adds a record for dispatching specified arbitrary code into a specified boot script table.\r
245\r
246 @param EntryPoint Entry point of the code to be dispatched.\r
247 \r
248 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
249 @retval RETURN_SUCCESS Opcode is added.\r
250**/\r
251RETURN_STATUS\r
252EFIAPI\r
253S3BootScriptSaveDispatch (\r
254 IN VOID *EntryPoint\r
255 )\r
256{\r
257 return RETURN_SUCCESS;\r
258}\r
259/**\r
300f2c6a 260 Adds a record for dispatching specified arbitrary code into a specified boot script table.\r
fe69ac84 261\r
262 @param EntryPoint Entry point of the code to be dispatched.\r
263 @param Context Argument to be passed into the EntryPoint of the code to be dispatched.\r
264 \r
265 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
266 @retval RETURN_SUCCESS Opcode is added.\r
267**/\r
268RETURN_STATUS\r
269EFIAPI\r
270S3BootScriptSaveDispatch2 (\r
271 IN VOID *EntryPoint,\r
272 IN VOID *Context\r
273 )\r
274{\r
275 return RETURN_SUCCESS;\r
276}\r
277\r
278/**\r
279 Adds a record for memory reads of the memory location and continues when the exit criteria is\r
280 satisfied or after a defined duration.\r
57a1b9c4
JY
281 \r
282 Please aware, below interface is different with PI specification, Vol 5:\r
283 EFI_S3_SAVE_STATE_PROTOCOL.Write() for EFI_BOOT_SCRIPT_MEM_POLL_OPCODE.\r
284 "Duration" below is microseconds, while "Delay" in PI specification means\r
285 the number of 100ns units to poll.\r
286\r
fe69ac84 287 @param Width The width of the memory operations.\r
288 @param Address The base address of the memory operations.\r
289 @param BitMask A pointer to the bit mask to be AND-ed with the data read from the register.\r
290 @param BitValue A pointer to the data value after to be Masked.\r
291 @param Duration Duration in microseconds of the stall.\r
292 @param LoopTimes The times of the register polling.\r
293\r
294 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
295 @retval RETURN_SUCCESS Opcode is added.\r
296\r
297**/\r
298RETURN_STATUS\r
299EFIAPI\r
300S3BootScriptSaveMemPoll (\r
301 IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
302 IN UINT64 Address,\r
303 IN VOID *BitMask,\r
304 IN VOID *BitValue,\r
305 IN UINTN Duration,\r
306 IN UINTN LoopTimes\r
307 )\r
308{\r
309 return RETURN_SUCCESS;\r
310}\r
311\r
312/**\r
313 Store arbitrary information in the boot script table. This opcode is a no-op on dispatch and is only\r
314 used for debugging script issues.\r
315 \r
316 @param InformationLength Length of the data in bytes\r
317 @param Information Information to be logged in the boot scrpit\r
318 \r
319 @retval RETURN_UNSUPPORTED If entering runtime, this method will not support.\r
320 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
321 @retval RETURN_SUCCESS Opcode is added.\r
322\r
323**/\r
324RETURN_STATUS\r
325EFIAPI\r
326S3BootScriptSaveInformation (\r
327 IN UINT32 InformationLength, \r
328 IN VOID *Information\r
329 )\r
330{\r
331 return RETURN_SUCCESS;\r
332}\r
333/**\r
334 Adds a record for I/O reads the I/O location and continues when the exit criteria is satisfied or after a\r
335 defined duration.\r
336 \r
337 @param Width The width of the I/O operations. \r
338 @param Address The base address of the I/O operations.\r
339 @param Data The comparison value used for the polling exit criteria.\r
340 @param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero\r
341 in Data are ignored when polling the memory address.\r
342 @param Delay The number of 100ns units to poll. Note that timer available may be of poorer\r
343 granularity so the delay may be longer.\r
344\r
345 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
346 @retval RETURN_SUCCESS Opcode is added.\r
347\r
348**/\r
349RETURN_STATUS\r
350EFIAPI\r
351S3BootScriptSaveIoPoll (\r
352 IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
353 IN UINT64 Address,\r
354 IN VOID *Data,\r
355 IN VOID *DataMask, \r
356 IN UINT64 Delay \r
357 )\r
358{\r
359 return RETURN_SUCCESS;\r
360}\r
361\r
362/**\r
363 Adds a record for PCI configuration space reads and continues when the exit criteria is satisfied or\r
364 after a defined duration.\r
365\r
366 @param Width The width of the I/O operations. \r
367 @param Address The address within the PCI configuration space.\r
368 @param Data The comparison value used for the polling exit criteria.\r
369 @param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero\r
370 in Data are ignored when polling the memory address\r
371 @param Delay The number of 100ns units to poll. Note that timer available may be of poorer\r
372 granularity so the delay may be longer.\r
373\r
374 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
375 @retval RETURN_SUCCESS Opcode is added.\r
376\r
377**/\r
378RETURN_STATUS\r
379EFIAPI\r
380S3BootScriptSavePciPoll (\r
381 IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
382 IN UINT64 Address,\r
383 IN VOID *Data,\r
384 IN VOID *DataMask,\r
385 IN UINT64 Delay\r
386 )\r
387{\r
388 return RETURN_SUCCESS;\r
389}\r
390/**\r
391 Adds a record for PCI configuration space reads and continues when the exit criteria is satisfied or\r
392 after a defined duration.\r
393\r
394 @param Width The width of the I/O operations. \r
395 @param Segment The PCI segment number for Address.\r
396 @param Address The address within the PCI configuration space.\r
397 @param Data The comparison value used for the polling exit criteria.\r
398 @param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero\r
399 in Data are ignored when polling the memory address\r
400 @param Delay The number of 100ns units to poll. Note that timer available may be of poorer\r
401 granularity so the delay may be longer.\r
402\r
403 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
404 @retval RETURN_SUCCESS Opcode is added.\r
405 @note A known Limitations in the implementation: When interpreting the opcode EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE\r
406 EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE and EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE, the 'Segment' parameter is assumed as \r
407 Zero, or else, assert.\r
408\r
409**/\r
410RETURN_STATUS\r
411EFIAPI\r
412S3BootScriptSavePci2Poll (\r
413 IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
414 IN UINT16 Segment,\r
415 IN UINT64 Address,\r
416 IN VOID *Data,\r
417 IN VOID *DataMask,\r
418 IN UINT64 Delay\r
419 )\r
420{\r
421 return RETURN_SUCCESS;\r
422}\r
423/**\r
424 Save ASCII string information specified by Buffer to\r
425 boot script with opcode EFI_BOOT_SCRIPT_INFORMATION_OPCODE\r
426\r
427 @param String the ascii string to store into the S3 boot script table\r
428\r
429 @retval RETURN_NOT_FOUND BootScriptSave Protocol not exist.\r
430 @retval RETURN_SUCCESS BootScriptSave Protocol exist, always returns RETURN_SUCCESS\r
431\r
432**/\r
433RETURN_STATUS\r
434EFIAPI\r
435S3BootScriptSaveInformationAsciiString (\r
436 IN CONST CHAR8 *String\r
437 )\r
438{\r
439 return RETURN_SUCCESS;\r
440}\r
441/**\r
442 This is an function to close the S3 boot script table. The function could only be called in \r
443 BOOT time phase. To comply with the Framework spec definition on \r
444 EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable(), this function will fulfill following things:\r
445 1. Closes the specified boot script table\r
446 2. It allocates a new memory pool to duplicate all the boot scripts in the specified table. \r
447 Once this function is called, the table maintained by the library will be destroyed \r
448 after it is copied into the allocated pool.\r
449 3. Any attempts to add a script record after calling this function will cause a new table \r
450 to be created by the library.\r
451 4. The base address of the allocated pool will be returned in Address. Note that after \r
452 using the boot script table, the CALLER is responsible for freeing the pool that is allocated\r
453 by this function. \r
454\r
455 In Spec PI1.1, this EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is retired. By then it is not\r
456 necessary to provide this API in BootScriptLib. To provides this API for now is only to meet\r
457 the requirement from Framework Spec.\r
458 \r
459 If anyone does call CloseTable() on a real platform, then the caller is responsible for figuring out \r
460 how to get the script to run on an S3 resume because the boot script maintained by the lib will be \r
461 destroyed.\r
462 \r
e8480a18 463 @return the base address of the new copy of the boot script table. \r
fe69ac84 464\r
465**/\r
466UINT8*\r
467EFIAPI\r
468S3BootScriptCloseTable (\r
469 VOID\r
470 )\r
471{\r
472 return 0;\r
473}\r
474/**\r
475 Executes the S3 boot script table.\r
476\r
477 @param RETURN_SUCCESS The boot script table was executed successfully.\r
478 @param RETURN_UNSUPPORTED Invalid script table or opcode. \r
479**/\r
480RETURN_STATUS\r
481EFIAPI\r
482S3BootScriptExecute (\r
483 VOID\r
484 )\r
485{\r
486 return RETURN_SUCCESS;\r
487}\r
488/**\r
489 Move the last boot script entry to the position \r
490\r
491 @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position\r
492 in the boot script table specified by Position. If Position is NULL or points to\r
493 NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end\r
494 of the table (if FALSE).\r
495 @param Position On entry, specifies the position in the boot script table where the opcode will be\r
496 inserted, either before or after, depending on BeforeOrAfter. On exit, specifies\r
497 the position of the inserted opcode in the boot script table.\r
498\r
499 @retval RETURN_OUT_OF_RESOURCES The table is not available.\r
500 @retval RETURN_INVALID_PARAMETER The Position is not a valid position in the boot script table.\r
501 @retval RETURN_SUCCESS Opcode is inserted.\r
502**/\r
503RETURN_STATUS\r
504EFIAPI\r
505S3BootScriptMoveLastOpcode (\r
506 IN BOOLEAN BeforeOrAfter,\r
507 IN OUT VOID **Position OPTIONAL\r
508)\r
509{\r
510 return RETURN_SUCCESS;\r
511}\r
512/**\r
513 Find a label within the boot script table and, if not present, optionally create it.\r
514\r
515 @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE)\r
516 or after (FALSE) the position in the boot script table \r
517 specified by Position.\r
518 @param CreateIfNotFound Specifies whether the label will be created if the label \r
519 does not exists (TRUE) or not (FALSE).\r
520 @param Position On entry, specifies the position in the boot script table\r
521 where the opcode will be inserted, either before or after,\r
522 depending on BeforeOrAfter. On exit, specifies the position\r
523 of the inserted opcode in the boot script table.\r
524 @param Label Points to the label which will be inserted in the boot script table.\r
525\r
526 @retval EFI_SUCCESS The operation succeeded. A record was added into the\r
527 specified script table.\r
528 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r
529 If the opcode is unknow or not supported because of the PCD \r
530 Feature Flags.\r
531 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r
532\r
533**/\r
534RETURN_STATUS\r
535EFIAPI \r
536S3BootScriptLabel (\r
537 IN BOOLEAN BeforeOrAfter,\r
538 IN BOOLEAN CreateIfNotFound,\r
539 IN OUT VOID **Position OPTIONAL,\r
540 IN CONST CHAR8 *Label\r
541 )\r
542{\r
543 return RETURN_SUCCESS;\r
544}\r
545/**\r
546 Compare two positions in the boot script table and return their relative position.\r
547 @param Position1 The positions in the boot script table to compare\r
548 @param Position2 The positions in the boot script table to compare\r
549 @param RelativePosition On return, points to the result of the comparison\r
550\r
551 @retval EFI_SUCCESS The operation succeeded. A record was added into the\r
552 specified script table.\r
553 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r
554 If the opcode is unknow or not supported because of the PCD \r
555 Feature Flags.\r
556 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r
557\r
558**/\r
559RETURN_STATUS\r
560EFIAPI \r
561S3BootScriptCompare (\r
562 IN UINT8 *Position1,\r
563 IN UINT8 *Position2,\r
564 OUT UINTN *RelativePosition\r
565 )\r
566{\r
567 return RETURN_SUCCESS;\r
568}\r