2 Implementation for S3 Boot Script Saver state driver.
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions
8 of the BSD License which accompanies this distribution. The
9 full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "InternalS3SaveState.h"
18 EFI_HANDLE mHandle
= NULL
;
19 EFI_S3_SAVE_STATE_PROTOCOL mS3SaveState
= {
26 Internal function to add IO write opcode to the table.
28 @param Marker The variable argument list to get the opcode
29 and associated attributes.
31 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
32 @retval EFI_SUCCESS Opcode is added.
36 BootScriptWriteIoWrite (
40 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
45 Width
= VA_ARG (Marker
, S3_BOOT_SCRIPT_LIB_WIDTH
);
46 Address
= VA_ARG (Marker
, UINT64
);
47 Count
= VA_ARG (Marker
, UINTN
);
48 Buffer
= VA_ARG (Marker
, UINT8
*);
50 return S3BootScriptSaveIoWrite (Width
, Address
, Count
, Buffer
);
53 Internal function to add IO read/write opcode to the table.
55 @param Marker The variable argument list to get the opcode
56 and associated attributes.
58 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
59 @retval EFI_SUCCESS Opcode is added.
63 BootScriptWriteIoReadWrite (
67 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
72 Width
= VA_ARG (Marker
, S3_BOOT_SCRIPT_LIB_WIDTH
);
73 Address
= VA_ARG (Marker
, UINT64
);
74 Data
= VA_ARG (Marker
, UINT8
*);
75 DataMask
= VA_ARG (Marker
, UINT8
*);
77 return S3BootScriptSaveIoReadWrite (Width
, Address
, Data
, DataMask
);
81 Internal function to add memory write opcode to the table.
83 @param Marker The variable argument list to get the opcode
84 and associated attributes.
86 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
87 @retval EFI_SUCCESS Opcode is added.
91 BootScriptWriteMemWrite (
95 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
100 Width
= VA_ARG (Marker
, S3_BOOT_SCRIPT_LIB_WIDTH
);
101 Address
= VA_ARG (Marker
, UINT64
);
102 Count
= VA_ARG (Marker
, UINTN
);
103 Buffer
= VA_ARG (Marker
, UINT8
*);
105 return S3BootScriptSaveMemWrite (Width
, Address
, Count
, Buffer
);
109 Internal function to add memory read/write opcode to the table.
111 @param Marker The variable argument list to get the opcode
112 and associated attributes.
114 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
115 @retval EFI_SUCCESS Opcode is added.
119 BootScriptWriteMemReadWrite (
123 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
128 Width
= VA_ARG (Marker
, S3_BOOT_SCRIPT_LIB_WIDTH
);
129 Address
= VA_ARG (Marker
, UINT64
);
130 Data
= VA_ARG (Marker
, UINT8
*);
131 DataMask
= VA_ARG (Marker
, UINT8
*);
133 return S3BootScriptSaveMemReadWrite (Width
, Address
, Data
, DataMask
);
137 Internal function to add PciCfg write opcode to the table.
139 @param Marker The variable argument list to get the opcode
140 and associated attributes.
142 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
143 @retval EFI_SUCCESS Opcode is added.
147 BootScriptWritePciCfgWrite (
151 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
156 Width
= VA_ARG (Marker
, S3_BOOT_SCRIPT_LIB_WIDTH
);
157 Address
= VA_ARG (Marker
, UINT64
);
158 Count
= VA_ARG (Marker
, UINTN
);
159 Buffer
= VA_ARG (Marker
, UINT8
*);
161 return S3BootScriptSavePciCfgWrite (Width
, Address
, Count
, Buffer
);
165 Internal function to PciCfg read/write opcode to the table.
167 @param Marker The variable argument list to get the opcode
168 and associated attributes.
170 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
171 @retval EFI_SUCCESS Opcode is added.
175 BootScriptWritePciCfgReadWrite (
179 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
184 Width
= VA_ARG (Marker
, S3_BOOT_SCRIPT_LIB_WIDTH
);
185 Address
= VA_ARG (Marker
, UINT64
);
186 Data
= VA_ARG (Marker
, UINT8
*);
187 DataMask
= VA_ARG (Marker
, UINT8
*);
189 return S3BootScriptSavePciCfgReadWrite (Width
, Address
, Data
, DataMask
);
192 Internal function to add PciCfg2 write opcode to the table.
194 @param Marker The variable argument list to get the opcode
195 and associated attributes.
197 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
198 @retval EFI_SUCCESS Opcode is added.
202 BootScriptWritePciCfg2Write (
206 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
212 Width
= VA_ARG (Marker
, S3_BOOT_SCRIPT_LIB_WIDTH
);
213 Address
= VA_ARG (Marker
, UINT64
);
214 Count
= VA_ARG (Marker
, UINTN
);
215 Buffer
= VA_ARG (Marker
, UINT8
*);
216 Segment
= VA_ARG (Marker
, UINT16
);
218 return S3BootScriptSavePciCfg2Write (Width
, Segment
, Address
, Count
, Buffer
);
222 Internal function to PciCfg2 read/write opcode to the table.
224 @param Marker The variable argument list to get the opcode
225 and associated attributes.
227 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
228 @retval EFI_SUCCESS Opcode is added.
232 BootScriptWritePciCfg2ReadWrite (
236 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
242 Width
= VA_ARG (Marker
, S3_BOOT_SCRIPT_LIB_WIDTH
);
243 Address
= VA_ARG (Marker
, UINT64
);
244 Segment
= VA_ARG (Marker
, UINT16
);
245 Data
= VA_ARG (Marker
, UINT8
*);
246 DataMask
= VA_ARG (Marker
, UINT8
*);
248 return S3BootScriptSavePciCfg2ReadWrite (Width
, Segment
, Address
, Data
, DataMask
);
251 Internal function to add smbus excute opcode to the table.
253 @param Marker The variable argument list to get the opcode
254 and associated attributes.
256 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
257 @retval EFI_SUCCESS Opcode is added.
261 BootScriptWriteSmbusExecute (
265 EFI_SMBUS_DEVICE_ADDRESS SlaveAddress
;
266 EFI_SMBUS_DEVICE_COMMAND Command
;
267 EFI_SMBUS_OPERATION Operation
;
273 SlaveAddress
.SmbusDeviceAddress
= VA_ARG (Marker
, UINTN
);
274 Command
= VA_ARG (Marker
, EFI_SMBUS_DEVICE_COMMAND
);
275 Operation
= VA_ARG (Marker
, EFI_SMBUS_OPERATION
);
276 PecCheck
= VA_ARG (Marker
, BOOLEAN
);
277 SmBusAddress
= SMBUS_LIB_ADDRESS (SlaveAddress
.SmbusDeviceAddress
,Command
,0,PecCheck
);
278 DataSize
= VA_ARG (Marker
, UINTN
*);
279 Buffer
= VA_ARG (Marker
, VOID
*);
281 return S3BootScriptSaveSmbusExecute (SmBusAddress
, Operation
, DataSize
, Buffer
);
284 Internal function to add stall opcode to the table.
286 @param Marker The variable argument list to get the opcode
287 and associated attributes.
289 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
290 @retval EFI_SUCCESS Opcode is added.
294 BootScriptWriteStall (
300 Duration
= VA_ARG (Marker
, UINT32
);
302 return S3BootScriptSaveStall (Duration
);
306 Internal function to add Save jmp address according to DISPATCH_OPCODE.
307 We ignore "Context" parameter
309 @param Marker The variable argument list to get the opcode
310 and associated attributes.
312 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
313 @retval EFI_SUCCESS Opcode is added.
317 BootScriptWriteDispatch (
323 EntryPoint
= (VOID
*)(UINTN
)VA_ARG (Marker
, EFI_PHYSICAL_ADDRESS
);
324 return S3BootScriptSaveDispatch (EntryPoint
);
328 Internal function to add memory pool operation to the table.
330 @param Marker The variable argument list to get the opcode
331 and associated attributes.
333 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
334 @retval EFI_SUCCESS Opcode is added.
338 BootScriptWriteMemPoll (
342 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
348 Width
= VA_ARG (Marker
, S3_BOOT_SCRIPT_LIB_WIDTH
);
349 Address
= VA_ARG (Marker
, UINT64
);
350 Data
= VA_ARG (Marker
, VOID
*);
351 DataMask
= VA_ARG (Marker
, VOID
*);
352 Delay
= (UINTN
)VA_ARG (Marker
, UINT64
);
354 // According to the spec, the interval between 2 pools is 100ns
356 return S3BootScriptSaveMemPoll (Width
, Address
, DataMask
, Data
, 100, Delay
);
361 Internal function to add Save jmp address according to DISPATCH_OPCODE2.
362 The "Context" parameter is not ignored.
364 @param Marker The variable argument list to get the opcode
365 and associated attributes.
367 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
368 @retval EFI_SUCCESS Opcode is added.
372 BootScriptWriteDispatch2 (
379 EntryPoint
= (VOID
*)(UINTN
)VA_ARG (Marker
, EFI_PHYSICAL_ADDRESS
);
380 Context
= (VOID
*)(UINTN
)VA_ARG (Marker
, EFI_PHYSICAL_ADDRESS
);
382 return S3BootScriptSaveDispatch2 (EntryPoint
, Context
);
385 Internal function to add INFORAMTION opcode node to the table
387 @param Marker The variable argument list to get the opcode
388 and associated attributes.
390 @retval EFI_OUT_OF_RESOURCES Not enought resource to complete the operations.
391 @retval EFI_SUCCESS The opcode entry is added to the table
395 BootScriptWriteInformation (
399 UINT32 InformationLength
;
400 EFI_PHYSICAL_ADDRESS Information
;
402 InformationLength
= VA_ARG (Marker
, UINT32
);
403 Information
= VA_ARG (Marker
, EFI_PHYSICAL_ADDRESS
);
404 return S3BootScriptSaveInformation (InformationLength
, (VOID
*)(UINTN
)Information
);
407 Internal function to add IO poll opcode node to the table
408 @param Marker The variable argument list to get the opcode
409 and associated attributes.
411 @retval EFI_OUT_OF_RESOURCES Not enought resource to complete the operations.
412 @retval EFI_SUCCESS The opcode entry is added to the table
416 BootScriptWriteIoPoll (
420 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
426 Width
= VA_ARG (Marker
, S3_BOOT_SCRIPT_LIB_WIDTH
);
427 Address
= VA_ARG (Marker
, UINT64
);
428 Data
= VA_ARG (Marker
, VOID
*);
429 DataMask
= VA_ARG (Marker
, VOID
*);
430 Delay
= (UINT64
)VA_ARG (Marker
, UINT64
);
432 return S3BootScriptSaveIoPoll (Width
, Address
, Data
, DataMask
, Delay
);
435 Internal function to add PCI config poll opcode node to the table
437 @param Marker The variable argument list to get the opcode
438 and associated attributes.
440 @retval EFI_OUT_OF_RESOURCES Not enought resource to complete the operations.
441 @retval EFI_SUCCESS The opcode entry is added to the table
445 BootScriptWritePciConfigPoll (
449 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
456 Width
= VA_ARG (Marker
, S3_BOOT_SCRIPT_LIB_WIDTH
);
457 Address
= VA_ARG (Marker
, UINT64
);
458 Data
= VA_ARG (Marker
, VOID
*);
459 DataMask
= VA_ARG (Marker
, VOID
*);
460 Delay
= (UINT64
)VA_ARG (Marker
, UINT64
);
462 return S3BootScriptSavePciPoll (Width
, Address
, Data
, DataMask
, Delay
);
465 Internal function to add PCI config 2 poll opcode node to the table
467 @param Marker The variable argument list to get the opcode
468 and associated attributes.
470 @retval EFI_OUT_OF_RESOURCES Not enought resource to complete the operations.
471 @retval EFI_SUCCESS The opcode entry is added to the table
475 BootScriptWritePciConfig2Poll (
479 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
486 Width
= VA_ARG (Marker
, S3_BOOT_SCRIPT_LIB_WIDTH
);
487 Segment
= VA_ARG (Marker
, UINT16
);
488 Address
= VA_ARG (Marker
, UINT64
);
489 Data
= VA_ARG (Marker
, VOID
*);
490 DataMask
= VA_ARG (Marker
, VOID
*);
491 Delay
= (UINT64
)VA_ARG (Marker
, UINT64
);
493 return S3BootScriptSavePci2Poll (Width
, Segment
, Address
, Data
, DataMask
, Delay
);
498 Adds a record into S3 boot script table.
500 This function is used to store a boot script record into a given boot
501 script table. If the table specified by TableName is nonexistent in the
502 system, a new table will automatically be created and then the script record
503 will be added into the new table. This function is responsible for allocating
504 necessary memory for the script.
506 This function has a variable parameter list. The exact parameter list depends on
507 the OpCode that is passed into the function. If an unsupported OpCode or illegal
508 parameter list is passed in, this function returns EFI_INVALID_PARAMETER.
509 If there are not enough resources available for storing more scripts, this function returns
510 EFI_OUT_OF_RESOURCES.
512 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
513 @param OpCode The operation code (opcode) number.
514 @param ... Argument list that is specific to each opcode.
516 @retval EFI_SUCCESS The operation succeeded. A record was added into the
517 specified script table.
518 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
519 If the opcode is unknow or not supported because of the PCD
521 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
527 IN CONST EFI_S3_SAVE_STATE_PROTOCOL
*This
,
535 // Build script according to opcode
539 case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE
:
540 VA_START (Marker
, OpCode
);
541 Status
= BootScriptWriteIoWrite (Marker
);
545 case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE
:
546 VA_START (Marker
, OpCode
);
547 Status
= BootScriptWriteIoReadWrite (Marker
);
551 case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE
:
552 VA_START (Marker
, OpCode
);
553 Status
= BootScriptWriteMemWrite (Marker
);
557 case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE
:
558 VA_START (Marker
, OpCode
);
559 Status
= BootScriptWriteMemReadWrite (Marker
);
563 case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE
:
564 VA_START (Marker
, OpCode
);
565 Status
= BootScriptWritePciCfgWrite (Marker
);
569 case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE
:
570 VA_START (Marker
, OpCode
);
571 Status
= BootScriptWritePciCfgReadWrite (Marker
);
575 case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE
:
576 VA_START (Marker
, OpCode
);
577 Status
= BootScriptWriteSmbusExecute (Marker
);
581 case EFI_BOOT_SCRIPT_STALL_OPCODE
:
582 VA_START (Marker
, OpCode
);
583 Status
= BootScriptWriteStall (Marker
);
588 case EFI_BOOT_SCRIPT_DISPATCH_OPCODE
:
589 VA_START (Marker
, OpCode
);
590 Status
= BootScriptWriteDispatch (Marker
);
594 case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE
:
595 VA_START (Marker
, OpCode
);
596 Status
= BootScriptWriteDispatch2 (Marker
);
600 case EFI_BOOT_SCRIPT_INFORMATION_OPCODE
:
601 VA_START (Marker
, OpCode
);
602 Status
= BootScriptWriteInformation (Marker
);
606 case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE
:
607 VA_START (Marker
, OpCode
);
608 Status
= BootScriptWriteMemPoll (Marker
);
612 case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE
:
613 VA_START (Marker
, OpCode
);
614 Status
= BootScriptWritePciCfg2Write (Marker
);
618 case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE
:
619 VA_START (Marker
, OpCode
);
620 Status
= BootScriptWritePciCfg2ReadWrite (Marker
);
624 case EFI_BOOT_SCRIPT_IO_POLL_OPCODE
:
625 VA_START (Marker
, OpCode
);
626 Status
= BootScriptWriteIoPoll (Marker
);
630 case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE
:
631 VA_START (Marker
, OpCode
);
632 Status
= BootScriptWritePciConfigPoll (Marker
);
636 case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE
:
637 VA_START (Marker
, OpCode
);
638 Status
= BootScriptWritePciConfig2Poll (Marker
);
643 Status
= EFI_INVALID_PARAMETER
;
650 Insert a record into a specified Framework boot script table.
652 This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is
653 assumed this protocol has platform specific mechanism to store the OpCode set and replay them
654 during the S3 resume.
655 The opcode is inserted before or after the specified position in the boot script table. If Position is
656 NULL then that position is after the last opcode in the table (BeforeOrAfter is FALSE) or before
657 the first opcode in the table (BeforeOrAfter is TRUE). The position which is pointed to by
658 Position upon return can be used for subsequent insertions.
660 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
661 @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position
662 in the boot script table specified by Position. If Position is NULL or points to
663 NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end
664 of the table (if FALSE).
665 @param Position On entry, specifies the position in the boot script table where the opcode will be
666 inserted, either before or after, depending on BeforeOrAfter. On exit, specifies
667 the position of the inserted opcode in the boot script table.
668 @param OpCode The operation code (opcode) number.
669 @param ... Argument list that is specific to each opcode.
671 @retval EFI_SUCCESS The operation succeeded. A record was added into the
672 specified script table.
673 @retval EFI_INVALID_PARAMETER The Opcode is an invalid opcode value or the Position is not a valid position in the boot script table..
674 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
680 IN CONST EFI_S3_SAVE_STATE_PROTOCOL
*This
,
681 IN BOOLEAN BeforeOrAfter
,
682 IN OUT EFI_S3_BOOT_SCRIPT_POSITION
*Position OPTIONAL
,
690 // Build script according to opcode
694 case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE
:
695 VA_START (Marker
, OpCode
);
696 Status
= BootScriptWriteIoWrite (Marker
);
700 case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE
:
701 VA_START (Marker
, OpCode
);
702 Status
= BootScriptWriteIoReadWrite (Marker
);
706 case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE
:
707 VA_START (Marker
, OpCode
);
708 Status
= BootScriptWriteMemWrite (Marker
);
712 case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE
:
713 VA_START (Marker
, OpCode
);
714 Status
= BootScriptWriteMemReadWrite (Marker
);
718 case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE
:
719 VA_START (Marker
, OpCode
);
720 Status
= BootScriptWritePciCfgWrite (Marker
);
724 case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE
:
725 VA_START (Marker
, OpCode
);
726 Status
= BootScriptWritePciCfgReadWrite (Marker
);
730 case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE
:
731 VA_START (Marker
, OpCode
);
732 Status
= BootScriptWriteSmbusExecute (Marker
);
736 case EFI_BOOT_SCRIPT_STALL_OPCODE
:
737 VA_START (Marker
, OpCode
);
738 Status
= BootScriptWriteStall (Marker
);
743 case EFI_BOOT_SCRIPT_DISPATCH_OPCODE
:
744 VA_START (Marker
, OpCode
);
745 Status
= BootScriptWriteDispatch (Marker
);
749 case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE
:
750 VA_START (Marker
, OpCode
);
751 Status
= BootScriptWriteDispatch2 (Marker
);
755 case EFI_BOOT_SCRIPT_INFORMATION_OPCODE
:
756 VA_START (Marker
, OpCode
);
757 Status
= BootScriptWriteInformation (Marker
);
761 case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE
:
762 VA_START (Marker
, OpCode
);
763 Status
= BootScriptWriteMemPoll (Marker
);
767 case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE
:
768 VA_START (Marker
, OpCode
);
769 Status
= BootScriptWritePciCfg2Write (Marker
);
773 case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE
:
774 VA_START (Marker
, OpCode
);
775 Status
= BootScriptWritePciCfg2ReadWrite (Marker
);
779 case EFI_BOOT_SCRIPT_IO_POLL_OPCODE
:
780 VA_START (Marker
, OpCode
);
781 Status
= BootScriptWriteIoPoll (Marker
);
785 case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE
:
786 VA_START (Marker
, OpCode
);
787 Status
= BootScriptWritePciConfigPoll (Marker
);
791 case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE
:
792 VA_START (Marker
, OpCode
);
793 Status
= BootScriptWritePciConfig2Poll (Marker
);
798 Status
= EFI_INVALID_PARAMETER
;
802 if (!EFI_ERROR (Status
)) {
803 Status
= S3BootScriptMoveLastOpcode (BeforeOrAfter
, Position
);
808 Find a label within the boot script table and, if not present, optionally create it.
810 If the label Label is already exists in the boot script table, then no new label is created, the
811 position of the Label is returned in *Position and EFI_SUCCESS is returned.
812 If the label Label does not already exist and CreateIfNotFound is TRUE, then it will be
813 created before or after the specified position and EFI_SUCCESS is returned.
814 If the label Label does not already exist and CreateIfNotFound is FALSE, then
815 EFI_NOT_FOUND is returned.
817 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
818 @param BeforeOrAfter Specifies whether the label is stored before (TRUE) or after (FALSE) the position in
819 the boot script table specified by Position. If Position is NULL or points to
820 NULL then the new label is inserted at the beginning of the table (if TRUE) or end of
821 the table (if FALSE).
822 @param CreateIfNotFound Specifies whether the label will be created if the label does not exists (TRUE) or not
824 @param Position On entry, specifies the position in the boot script table where the label will be inserted,
825 either before or after, depending on BeforeOrAfter. On exit, specifies the position
826 of the inserted label in the boot script table.
827 @param Label Points to the label which will be inserted in the boot script table.
829 @retval EFI_SUCCESS The label already exists or was inserted.
830 @retval EFI_INVALID_PARAMETER The Opcode is an invalid opcode value or the Position is not a valid position in the boot script table..
836 IN CONST EFI_S3_SAVE_STATE_PROTOCOL
*This
,
837 IN BOOLEAN BeforeOrAfter
,
838 IN BOOLEAN CreateIfNotFound
,
839 IN OUT EFI_S3_BOOT_SCRIPT_POSITION
*Position OPTIONAL
,
840 IN CONST CHAR8
*Label
843 return S3BootScriptLabel (BeforeOrAfter
, CreateIfNotFound
, Position
, Label
);
846 Compare two positions in the boot script table and return their relative position.
848 This function compares two positions in the boot script table and returns their relative positions. If
849 Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2,
850 then 0 is returned. If Position1 is after Position2, then 1 is returned.
852 @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
853 @param Position1 The positions in the boot script table to compare
854 @param Position2 The positions in the boot script table to compare
855 @param RelativePosition On return, points to the result of the comparison
857 @retval EFI_SUCCESS The operation succeeded.
858 @retval EFI_INVALID_PARAMETER The Position1 or Position2 is not a valid position in the boot script table.
864 IN CONST EFI_S3_SAVE_STATE_PROTOCOL
*This
,
865 IN EFI_S3_BOOT_SCRIPT_POSITION Position1
,
866 IN EFI_S3_BOOT_SCRIPT_POSITION Position2
,
867 OUT UINTN
*RelativePosition
870 return S3BootScriptCompare (Position1
, Position2
, RelativePosition
);
873 This routine is entry point of ScriptSave driver.
875 @param ImageHandle Handle for this drivers loaded image protocol.
876 @param SystemTable EFI system table.
878 @retval EFI_OUT_OF_RESOURCES No enough resource
879 @retval EFI_SUCCESS Succesfully installed the ScriptSave driver.
880 @retval other Errors occured.
885 InitializeS3SaveState (
886 IN EFI_HANDLE ImageHandle
,
887 IN EFI_SYSTEM_TABLE
*SystemTable
892 return gBS
->InstallProtocolInterface (
894 &gEfiS3SaveStateProtocolGuid
,
895 EFI_NATIVE_INTERFACE
,