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