2 Implementation for S3 Boot Script Save thunk driver.
3 This thunk driver consumes PI S3SaveState protocol to produce framework S3BootScriptSave Protocol
5 Copyright (c) 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 of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "ScriptSave.h"
18 EFI_BOOT_SCRIPT_SAVE_PROTOCOL mS3ScriptSave
= {
22 EFI_S3_SAVE_STATE_PROTOCOL
*mS3SaveState
;
25 Wrapper for a thunk to transition from long mode to compatibility mode to execute 32-bit code and then transit back to
28 @param Function The 32bit code entry to be executed.
29 @param Param1 The first parameter to pass to 32bit code
30 @param Param2 The second parameter to pass to 32bit code
31 @retval EFI_SUCCESS Execute 32bit code successfully.
32 @retval other Something wrong when execute the 32bit code
43 A stub to convert framework boot script dispatch to PI boot script dispatch.
45 @param ImageHandle It should be is NULL.
46 @param Context The first parameter to pass to 32bit code
48 @return dispatch value.
53 FrameworkBootScriptDispatchStub (
54 IN EFI_HANDLE ImageHandle
,
59 DISPATCH_ENTRYPOINT_FUNC EntryFunc
;
63 DEBUG ((EFI_D_ERROR
, "FrameworkBootScriptDispatchStub - 0x%08x\n", (UINTN
)Context
));
65 EntryFunc
= (DISPATCH_ENTRYPOINT_FUNC
) (UINTN
) (Context
);
67 PeiServices
= (VOID
*)(UINTN
)(*(UINT32
*)(Idtr
.Base
- sizeof (UINT32
)));
70 // ECP assumes first parameter is NULL, and second parameter is PeiServices.
72 Status
= Execute32BitCode ((UINT64
)(UINTN
)EntryFunc
, 0, (UINT64
)(UINTN
)PeiServices
);
78 Internal function to add IO write opcode to the table.
80 @param Marker The variable argument list to get the opcode
81 and associated attributes.
83 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
84 @retval EFI_SUCCESS Opcode is added.
92 EFI_BOOT_SCRIPT_WIDTH Width
;
97 Width
= VA_ARG (Marker
, EFI_BOOT_SCRIPT_WIDTH
);
98 Address
= VA_ARG (Marker
, UINT64
);
99 Count
= VA_ARG (Marker
, UINTN
);
100 Buffer
= VA_ARG (Marker
, UINT8
*);
102 return mS3SaveState
->Write (
104 EFI_BOOT_SCRIPT_IO_WRITE_OPCODE
,
112 Internal function to add IO read/write opcode to the table.
114 @param Marker The variable argument list to get the opcode
115 and associated attributes.
117 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
118 @retval EFI_SUCCESS Opcode is added.
122 BootScriptIoReadWrite (
126 EFI_BOOT_SCRIPT_WIDTH Width
;
131 Width
= VA_ARG (Marker
, EFI_BOOT_SCRIPT_WIDTH
);
132 Address
= VA_ARG (Marker
, UINT64
);
133 Data
= VA_ARG (Marker
, UINT8
*);
134 DataMask
= VA_ARG (Marker
, UINT8
*);
136 return mS3SaveState
->Write (
138 EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE
,
147 Internal function to add memory write opcode to the table.
149 @param Marker The variable argument list to get the opcode
150 and associated attributes.
152 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
153 @retval EFI_SUCCESS Opcode is added.
161 EFI_BOOT_SCRIPT_WIDTH Width
;
166 Width
= VA_ARG (Marker
, EFI_BOOT_SCRIPT_WIDTH
);
167 Address
= VA_ARG (Marker
, UINT64
);
168 Count
= VA_ARG (Marker
, UINTN
);
169 Buffer
= VA_ARG (Marker
, UINT8
*);
171 return mS3SaveState
->Write (
173 EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE
,
182 Internal function to add memory read/write opcode to the table.
184 @param Marker The variable argument list to get the opcode
185 and associated attributes.
187 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
188 @retval EFI_SUCCESS Opcode is added.
192 BootScriptMemReadWrite (
196 EFI_BOOT_SCRIPT_WIDTH Width
;
201 Width
= VA_ARG (Marker
, EFI_BOOT_SCRIPT_WIDTH
);
202 Address
= VA_ARG (Marker
, UINT64
);
203 Data
= VA_ARG (Marker
, UINT8
*);
204 DataMask
= VA_ARG (Marker
, UINT8
*);
206 return mS3SaveState
->Write (
208 EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE
,
217 Internal function to add PciCfg write opcode to the table.
219 @param Marker The variable argument list to get the opcode
220 and associated attributes.
222 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
223 @retval EFI_SUCCESS Opcode is added.
227 BootScriptPciCfgWrite (
231 EFI_BOOT_SCRIPT_WIDTH Width
;
236 Width
= VA_ARG (Marker
, EFI_BOOT_SCRIPT_WIDTH
);
237 Address
= VA_ARG (Marker
, UINT64
);
238 Count
= VA_ARG (Marker
, UINTN
);
239 Buffer
= VA_ARG (Marker
, UINT8
*);
241 return mS3SaveState
->Write (
243 EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE
,
252 Internal function to PciCfg read/write opcode to the table.
254 @param Marker The variable argument list to get the opcode
255 and associated attributes.
257 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
258 @retval EFI_SUCCESS Opcode is added.
262 BootScriptPciCfgReadWrite (
266 EFI_BOOT_SCRIPT_WIDTH Width
;
271 Width
= VA_ARG (Marker
, EFI_BOOT_SCRIPT_WIDTH
);
272 Address
= VA_ARG (Marker
, UINT64
);
273 Data
= VA_ARG (Marker
, UINT8
*);
274 DataMask
= VA_ARG (Marker
, UINT8
*);
276 return mS3SaveState
->Write (
278 EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE
,
286 Internal function to add PciCfg2 write opcode to the table.
288 @param Marker The variable argument list to get the opcode
289 and associated attributes.
291 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
292 @retval EFI_SUCCESS Opcode is added.
296 BootScriptPciCfg2Write (
300 EFI_BOOT_SCRIPT_WIDTH Width
;
306 Width
= VA_ARG (Marker
, EFI_BOOT_SCRIPT_WIDTH
);
307 Address
= VA_ARG (Marker
, UINT64
);
308 Count
= VA_ARG (Marker
, UINTN
);
309 Buffer
= VA_ARG (Marker
, UINT8
*);
310 Segment
= VA_ARG (Marker
, UINT16
);
312 return mS3SaveState
->Write (
314 EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE
,
324 Internal function to PciCfg2 read/write opcode to the table.
326 @param Marker The variable argument list to get the opcode
327 and associated attributes.
329 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
330 @retval EFI_SUCCESS Opcode is added.
334 BootScriptPciCfg2ReadWrite (
338 EFI_BOOT_SCRIPT_WIDTH Width
;
344 Width
= VA_ARG (Marker
, EFI_BOOT_SCRIPT_WIDTH
);
345 Address
= VA_ARG (Marker
, UINT64
);
346 Segment
= VA_ARG (Marker
, UINT16
);
347 Data
= VA_ARG (Marker
, UINT8
*);
348 DataMask
= VA_ARG (Marker
, UINT8
*);
350 return mS3SaveState
->Write (
352 EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE
,
361 Internal function to add smbus excute opcode to the table.
363 @param Marker The variable argument list to get the opcode
364 and associated attributes.
366 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
367 @retval EFI_SUCCESS Opcode is added.
371 BootScriptSmbusExecute (
375 EFI_SMBUS_DEVICE_ADDRESS SlaveAddress
;
376 EFI_SMBUS_DEVICE_COMMAND Command
;
377 EFI_SMBUS_OPERATION Operation
;
382 SlaveAddress
.SmbusDeviceAddress
= VA_ARG (Marker
, UINTN
);
383 Command
= VA_ARG (Marker
, EFI_SMBUS_DEVICE_COMMAND
);
384 Operation
= VA_ARG (Marker
, EFI_SMBUS_OPERATION
);
385 PecCheck
= VA_ARG (Marker
, BOOLEAN
);
386 DataSize
= VA_ARG (Marker
, UINTN
*);
387 Buffer
= VA_ARG (Marker
, VOID
*);
389 return mS3SaveState
->Write (
391 EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE
,
401 Internal function to add stall opcode to the table.
403 @param Marker The variable argument list to get the opcode
404 and associated attributes.
406 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
407 @retval EFI_SUCCESS Opcode is added.
417 Duration
= VA_ARG (Marker
, UINT32
);
419 return mS3SaveState
->Write (
421 EFI_BOOT_SCRIPT_STALL_OPCODE
,
427 Internal function to add Save jmp address according to DISPATCH_OPCODE.
428 We ignore "Context" parameter
430 @param Marker The variable argument list to get the opcode
431 and associated attributes.
433 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
434 @retval EFI_SUCCESS Opcode is added.
444 EntryPoint
= (VOID
*)(UINTN
)VA_ARG (Marker
, EFI_PHYSICAL_ADDRESS
);
445 return mS3SaveState
->Write (
447 EFI_BOOT_SCRIPT_DISPATCH_OPCODE
,
453 Internal function to add Save jmp address according to DISPATCH_OPCODE.
454 We ignore "Context" parameter.
455 We need create thunk stub to convert PEI entrypoint (used in Framework version)
456 to DXE entrypoint (defined in PI spec).
458 @param Marker The variable argument list to get the opcode
459 and associated attributes.
461 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
462 @retval EFI_SUCCESS Opcode is added.
466 FrameworkBootScriptDispatch (
473 EntryPoint
= (VOID
*)(UINTN
)VA_ARG (Marker
, EFI_PHYSICAL_ADDRESS
);
478 Context
= EntryPoint
;
479 EntryPoint
= (VOID
*)(UINTN
)FrameworkBootScriptDispatchStub
;
480 return mS3SaveState
->Write (
482 EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE
,
489 Internal function to add memory pool operation to the table.
491 @param Marker The variable argument list to get the opcode
492 and associated attributes.
494 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
495 @retval EFI_SUCCESS Opcode is added.
503 EFI_BOOT_SCRIPT_WIDTH Width
;
511 Width
= VA_ARG (Marker
, EFI_BOOT_SCRIPT_WIDTH
);
512 Address
= VA_ARG (Marker
, UINT64
);
513 BitMask
= VA_ARG (Marker
, UINT8
*);
514 BitValue
= VA_ARG (Marker
, UINT8
*);
515 Duration
= (UINT64
)VA_ARG (Marker
, UINT64
);
516 LoopTimes
= (UINT64
)VA_ARG (Marker
, UINT64
);
517 Delay
= MultU64x64 (DivU64x32(Duration
, 100), LoopTimes
);
519 return mS3SaveState
->Write (
521 EFI_BOOT_SCRIPT_MEM_POLL_OPCODE
,
531 Internal function to add Save jmp address according to DISPATCH_OPCODE2.
532 The "Context" parameter is not ignored.
534 @param Marker The variable argument list to get the opcode
535 and associated attributes.
537 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
538 @retval EFI_SUCCESS Opcode is added.
542 BootScriptDispatch2 (
549 EntryPoint
= (VOID
*)(UINTN
)VA_ARG (Marker
, EFI_PHYSICAL_ADDRESS
);
550 Context
= (VOID
*)(UINTN
)VA_ARG (Marker
, EFI_PHYSICAL_ADDRESS
);
552 return mS3SaveState
->Write (
554 EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE
,
560 Internal function to add the opcode link node to the link
562 @param Marker The variable argument list to get the opcode
563 and associated attributes.
565 @retval EFI_OUT_OF_RESOURCES Not enought resource to complete the operations.
566 @retval EFI_SUCCESS The opcode entry is added to the link list
570 BootScriptInformation (
574 UINT32 InformationLength
;
575 EFI_PHYSICAL_ADDRESS Information
;
577 InformationLength
= VA_ARG (Marker
, UINT32
);
578 Information
= VA_ARG (Marker
, EFI_PHYSICAL_ADDRESS
);
580 return mS3SaveState
->Write (
582 EFI_BOOT_SCRIPT_INFORMATION_OPCODE
,
584 (VOID
*)(UINTN
)Information
589 Adds a record into a specified Framework boot script table.
591 This function is used to store a boot script record into a given boot
592 script table. If the table specified by TableName is nonexistent in the
593 system, a new table will automatically be created and then the script record
594 will be added into the new table. A boot script table can add new script records
595 until EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is called. Currently, the only
596 meaningful table name is EFI_ACPI_S3_RESUME_SCRIPT_TABLE. This function is
597 responsible for allocating necessary memory for the script.
599 This function has a variable parameter list. The exact parameter list depends on
600 the OpCode that is passed into the function. If an unsupported OpCode or illegal
601 parameter list is passed in, this function returns EFI_INVALID_PARAMETER.
602 If there are not enough resources available for storing more scripts, this function returns
603 EFI_OUT_OF_RESOURCES.
605 @param This A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.
606 @param TableName Name of the script table. Currently, the only meaningful value is
607 EFI_ACPI_S3_RESUME_SCRIPT_TABLE.
608 @param OpCode The operation code (opcode) number.
609 @param ... Argument list that is specific to each opcode.
611 @retval EFI_SUCCESS The operation succeeded. A record was added into the
612 specified script table.
613 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
614 If the opcode is unknow or not supported because of the PCD
616 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
622 IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL
*This
,
631 if (TableName
!= FRAMEWORK_EFI_ACPI_S3_RESUME_SCRIPT_TABLE
) {
633 // Only S3 boot script is supported for now
635 return EFI_OUT_OF_RESOURCES
;
638 // Build script according to opcode
642 case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE
:
643 VA_START (Marker
, OpCode
);
644 Status
= BootScriptIoWrite (Marker
);
648 case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE
:
649 VA_START (Marker
, OpCode
);
650 Status
= BootScriptIoReadWrite (Marker
);
654 case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE
:
655 VA_START (Marker
, OpCode
);
656 Status
= BootScriptMemWrite (Marker
);
660 case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE
:
661 VA_START (Marker
, OpCode
);
662 Status
= BootScriptMemReadWrite (Marker
);
666 case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE
:
667 VA_START (Marker
, OpCode
);
668 Status
= BootScriptPciCfgWrite (Marker
);
672 case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE
:
673 VA_START (Marker
, OpCode
);
674 Status
= BootScriptPciCfgReadWrite (Marker
);
678 case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE
:
679 VA_START (Marker
, OpCode
);
680 Status
= BootScriptSmbusExecute (Marker
);
684 case EFI_BOOT_SCRIPT_STALL_OPCODE
:
685 VA_START (Marker
, OpCode
);
686 Status
= BootScriptStall (Marker
);
691 case EFI_BOOT_SCRIPT_DISPATCH_OPCODE
:
692 VA_START (Marker
, OpCode
);
693 Status
= FrameworkBootScriptDispatch (Marker
);
697 case FRAMEWORK_EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE
:
698 VA_START (Marker
, OpCode
);
699 Status
= BootScriptDispatch2 (Marker
);
703 case EFI_BOOT_SCRIPT_INFORMATION_OPCODE
:
704 VA_START (Marker
, OpCode
);
705 Status
= BootScriptInformation (Marker
);
709 case FRAMEWORK_EFI_BOOT_SCRIPT_MEM_POLL_OPCODE
:
710 VA_START (Marker
, OpCode
);
711 Status
= BootScriptMemPoll (Marker
);
715 case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE
:
716 VA_START (Marker
, OpCode
);
717 Status
= BootScriptPciCfg2Write (Marker
);
721 case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE
:
722 VA_START (Marker
, OpCode
);
723 Status
= BootScriptPciCfg2ReadWrite (Marker
);
728 Status
= EFI_INVALID_PARAMETER
;
736 Closes the specified script table.
738 This function closes the specified boot script table and returns the base address
739 of the table. It allocates a new pool to duplicate all the boot scripts in the specified
740 table. Once this function is called, the specified table will be destroyed after it is
741 copied into the allocated pool. As a result, any attempts to add a script record into a
742 closed table will cause a new table to be created. The base address of the allocated pool
743 will be returned in Address. After using the boot script table, the caller is responsible
744 for freeing the pool that is allocated by this function. If the boot script table,
745 such as EFI_ACPI_S3_RESUME_SCRIPT_TABLE, is required to be stored in a nonperturbed
746 memory region, the caller should copy the table into the nonperturbed memory region by itself.
748 @param This A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.
749 @param TableName Name of the script table. Currently, the only meaningful value is
750 EFI_ACPI_S3_RESUME_SCRIPT_TABLE.
751 @param Address A pointer to the physical address where the table begins.
753 @retval EFI_SUCCESS The table was successfully returned.
754 @retval EFI_NOT_FOUND The specified table was not created previously.
755 @retval EFI_OUT_OF_RESOURCE Memory is insufficient to hold the reorganized boot script table.
756 @retval EFI_UNSUPPORTED the table type is not EFI_ACPI_S3_RESUME_SCRIPT_TABLE
761 BootScriptCloseTable (
762 IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL
*This
,
764 OUT EFI_PHYSICAL_ADDRESS
*Address
767 if (TableName
!= FRAMEWORK_EFI_ACPI_S3_RESUME_SCRIPT_TABLE
) {
769 // Only S3 boot script is supported for now
771 return EFI_NOT_FOUND
;
774 // Here the close table is not implemented.
777 return EFI_UNSUPPORTED
;
781 This routine is entry point of ScriptSave driver.
783 @param ImageHandle Handle for this drivers loaded image protocol.
784 @param SystemTable EFI system table.
786 @retval EFI_OUT_OF_RESOURCES No enough resource
787 @retval EFI_SUCCESS Succesfully installed the ScriptSave driver.
788 @retval other Errors occured.
793 InitializeScriptSaveOnS3SaveState (
794 IN EFI_HANDLE ImageHandle
,
795 IN EFI_SYSTEM_TABLE
*SystemTable
801 PE_COFF_LOADER_IMAGE_CONTEXT ImageContext
;
802 BOOT_SCRIPT_THUNK_DATA
*BootScriptThunkData
;
807 // Test if the gEfiCallerIdGuid of this image is already installed. if not, the entry
808 // point is loaded by DXE code which is the first time loaded. or else, it is already
809 // be reloaded be itself.This is a work-around
811 Status
= gBS
->LocateProtocol (&gEfiCallerIdGuid
, NULL
, &DevicePath
);
812 if (EFI_ERROR (Status
)) {
814 // This is the first-time loaded by DXE core. reload itself to NVS mem
817 // A workarouond: Here we install a dummy handle
819 Status
= gBS
->InstallProtocolInterface (
822 EFI_NATIVE_INTERFACE
,
826 Status
= GetSectionFromAnyFv (
833 ImageContext
.Handle
= Buffer
;
834 ImageContext
.ImageRead
= PeCoffLoaderImageReadFromMemory
;
836 // Get information about the image being loaded
838 Status
= PeCoffLoaderGetImageInfo (&ImageContext
);
839 if (EFI_ERROR (Status
)) {
842 Status
= gBS
->AllocatePool (
844 BufferSize
+ ImageContext
.SectionAlignment
,
847 if (EFI_ERROR (Status
)) {
848 return EFI_OUT_OF_RESOURCES
;
850 ImageContext
.ImageAddress
= (PHYSICAL_ADDRESS
)(UINTN
)FfsBuffer
;
852 // Align buffer on section boundry
854 ImageContext
.ImageAddress
+= ImageContext
.SectionAlignment
- 1;
855 ImageContext
.ImageAddress
&= ~(ImageContext
.SectionAlignment
- 1);
857 // Load the image to our new buffer
859 Status
= PeCoffLoaderLoadImage (&ImageContext
);
860 if (EFI_ERROR (Status
)) {
861 gBS
->FreePool (FfsBuffer
);
866 // Relocate the image in our new buffer
868 Status
= PeCoffLoaderRelocateImage (&ImageContext
);
870 if (EFI_ERROR (Status
)) {
871 PeCoffLoaderUnloadImage (&ImageContext
);
872 gBS
->FreePool (FfsBuffer
);
876 // Flush the instruction cache so the image data is written before we execute it
878 InvalidateInstructionCacheRange ((VOID
*)(UINTN
)ImageContext
.ImageAddress
, (UINTN
)ImageContext
.ImageSize
);
879 Status
= ((EFI_IMAGE_ENTRY_POINT
)(UINTN
)(ImageContext
.EntryPoint
)) ((EFI_HANDLE
)(UINTN
)(ImageContext
.ImageAddress
), SystemTable
);
880 if (EFI_ERROR (Status
)) {
881 gBS
->FreePool (FfsBuffer
);
885 // Additional step for BootScriptThunk integrity
889 // Allocate BootScriptThunkData
891 BootScriptThunkData
= AllocatePool (sizeof (BOOT_SCRIPT_THUNK_DATA
));
892 if (BootScriptThunkData
== NULL
) {
893 return EFI_OUT_OF_RESOURCES
;
896 BootScriptThunkData
->BootScriptThunkBase
= ImageContext
.ImageAddress
;
897 BootScriptThunkData
->BootScriptThunkLength
= ImageContext
.ImageSize
;
899 // Set BootScriptThunkData
901 PcdSet64 (BootScriptThunkDataPtr
, (UINT64
)(UINTN
)BootScriptThunkData
);
905 // the entry point is invoked after reloading. following code only run in ACPI NVS
909 // Locate and cache PI S3 Save State Protocol.
911 Status
= gBS
->LocateProtocol (
912 &gEfiS3SaveStateProtocolGuid
,
914 (VOID
**) &mS3SaveState
916 ASSERT_EFI_ERROR (Status
);
918 return gBS
->InstallProtocolInterface (
920 &gEfiBootScriptSaveProtocolGuid
,
921 EFI_NATIVE_INTERFACE
,