]> git.proxmox.com Git - mirror_edk2.git/blame - Vlv2TbltDevicePkg/BootScriptSaveDxe/ScriptSave.c
Vlv2TbltDevicePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / Vlv2TbltDevicePkg / BootScriptSaveDxe / ScriptSave.c
CommitLineData
3cbfba02
DW
1/** @file\r
2 Implementation for S3 Boot Script Saver driver.\r
3\r
4Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
5 \r\r
9dc8036d
MK
6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
7\r
3cbfba02
DW
8 \r\r
9\r
10**/\r
11\r
12#include "InternalBootScriptSave.h"\r
13\r
14EFI_HANDLE mHandle = NULL;\r
15EFI_BOOT_SCRIPT_SAVE_PROTOCOL mS3ScriptSave = {\r
16 BootScriptWrite,\r
17 BootScriptCloseTable\r
18 };\r
19\r
20/**\r
21 Internal function to add IO write opcode to the table.\r
22\r
23 @param Marker The variable argument list to get the opcode\r
24 and associated attributes.\r
25\r
26 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.\r
27 @retval EFI_SUCCESS Opcode is added.\r
28\r
29**/\r
30EFI_STATUS\r
31BootScriptIoWrite (\r
32 IN VA_LIST Marker\r
33 )\r
34{\r
35 S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
36 UINT64 Address;\r
37 UINTN Count;\r
38 UINT8 *Buffer;\r
39\r
40 Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
41 Address = VA_ARG (Marker, UINT64);\r
42 Count = VA_ARG (Marker, UINTN);\r
43 Buffer = VA_ARG (Marker, UINT8 *);\r
44\r
45 return S3BootScriptSaveIoWrite (Width, Address, Count, Buffer);\r
46}\r
47\r
48/**\r
49 Internal function to add IO read/write opcode to the table.\r
50\r
51 @param Marker The variable argument list to get the opcode\r
52 and associated attributes.\r
53\r
54 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.\r
55 @retval EFI_SUCCESS Opcode is added.\r
56\r
57**/\r
58EFI_STATUS\r
59BootScriptIoReadWrite (\r
60 IN VA_LIST Marker\r
61 )\r
62{\r
63 S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
64 UINT64 Address;\r
65 UINT8 *Data;\r
66 UINT8 *DataMask;\r
67\r
68 Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
69 Address = VA_ARG (Marker, UINT64);\r
70 Data = VA_ARG (Marker, UINT8 *);\r
71 DataMask = VA_ARG (Marker, UINT8 *);\r
72\r
73 return S3BootScriptSaveIoReadWrite (Width, Address, Data, DataMask);\r
74}\r
75\r
76/**\r
77 Internal function to add memory write opcode to the table.\r
78\r
79 @param Marker The variable argument list to get the opcode\r
80 and associated attributes.\r
81\r
82 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.\r
83 @retval EFI_SUCCESS Opcode is added.\r
84\r
85**/\r
86EFI_STATUS\r
87BootScriptMemWrite (\r
88 IN VA_LIST Marker\r
89 )\r
90{\r
91 S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
92 UINT64 Address;\r
93 UINTN Count;\r
94 UINT8 *Buffer;\r
95\r
96 Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
97 Address = VA_ARG (Marker, UINT64);\r
98 Count = VA_ARG (Marker, UINTN);\r
99 Buffer = VA_ARG (Marker, UINT8 *);\r
100\r
101 return S3BootScriptSaveMemWrite (Width, Address, Count, Buffer);\r
102}\r
103\r
104/**\r
105 Internal function to add memory read/write opcode to the table.\r
106\r
107 @param Marker The variable argument list to get the opcode\r
108 and associated attributes.\r
109\r
110 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.\r
111 @retval EFI_SUCCESS Opcode is added.\r
112\r
113**/\r
114EFI_STATUS\r
115BootScriptMemReadWrite (\r
116 IN VA_LIST Marker\r
117 )\r
118{\r
119 S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
120 UINT64 Address;\r
121 UINT8 *Data;\r
122 UINT8 *DataMask;\r
123\r
124 Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
125 Address = VA_ARG (Marker, UINT64);\r
126 Data = VA_ARG (Marker, UINT8 *);\r
127 DataMask = VA_ARG (Marker, UINT8 *);\r
128\r
129 return S3BootScriptSaveMemReadWrite (Width, Address, Data, DataMask);\r
130}\r
131\r
132/**\r
133 Internal function to add PciCfg write opcode to the table.\r
134\r
135 @param Marker The variable argument list to get the opcode\r
136 and associated attributes.\r
137\r
138 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.\r
139 @retval EFI_SUCCESS Opcode is added.\r
140\r
141**/\r
142EFI_STATUS\r
143BootScriptPciCfgWrite (\r
144 IN VA_LIST Marker\r
145 )\r
146{\r
147 S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
148 UINT64 Address;\r
149 UINTN Count;\r
150 UINT8 *Buffer;\r
151\r
152 Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
153 Address = VA_ARG (Marker, UINT64);\r
154 Count = VA_ARG (Marker, UINTN);\r
155 Buffer = VA_ARG (Marker, UINT8 *);\r
156\r
157 return S3BootScriptSavePciCfgWrite (Width, Address, Count, Buffer);\r
158}\r
159\r
160/**\r
161 Internal function to PciCfg read/write opcode to the table.\r
162\r
163 @param Marker The variable argument list to get the opcode\r
164 and associated attributes.\r
165\r
166 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.\r
167 @retval EFI_SUCCESS Opcode is added.\r
168\r
169**/\r
170EFI_STATUS\r
171BootScriptPciCfgReadWrite (\r
172 IN VA_LIST Marker\r
173 )\r
174{\r
175 S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
176 UINT64 Address;\r
177 UINT8 *Data;\r
178 UINT8 *DataMask;\r
179\r
180 Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
181 Address = VA_ARG (Marker, UINT64);\r
182 Data = VA_ARG (Marker, UINT8 *);\r
183 DataMask = VA_ARG (Marker, UINT8 *);\r
184\r
185 return S3BootScriptSavePciCfgReadWrite (Width, Address, Data, DataMask);\r
186}\r
187\r
188/**\r
189 Internal function to add PciCfg2 write opcode to the table.\r
190\r
191 @param Marker The variable argument list to get the opcode\r
192 and associated attributes.\r
193\r
194 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.\r
195 @retval EFI_SUCCESS Opcode is added.\r
196\r
197**/\r
198EFI_STATUS\r
199BootScriptPciCfg2Write (\r
200 IN VA_LIST Marker\r
201 )\r
202{\r
203 S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
204 UINT64 Address;\r
205 UINTN Count;\r
206 UINT8 *Buffer;\r
207 UINT16 Segment;\r
208\r
209 Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
210 Address = VA_ARG (Marker, UINT64);\r
211 Count = VA_ARG (Marker, UINTN);\r
212 Buffer = VA_ARG (Marker, UINT8 *);\r
213 Segment = VA_ARG (Marker, UINT16);\r
214\r
215 return S3BootScriptSavePciCfg2Write (Width, Segment, Address, Count, Buffer);\r
216}\r
217\r
218/**\r
219 Internal function to PciCfg2 read/write opcode to the table.\r
220\r
221 @param Marker The variable argument list to get the opcode\r
222 and associated attributes.\r
223\r
224 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.\r
225 @retval EFI_SUCCESS Opcode is added.\r
226\r
227**/\r
228EFI_STATUS\r
229BootScriptPciCfg2ReadWrite (\r
230 IN VA_LIST Marker\r
231 )\r
232{\r
233 S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
234 UINT16 Segment;\r
235 UINT64 Address;\r
236 UINT8 *Data;\r
237 UINT8 *DataMask;\r
238\r
239 Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
240 Address = VA_ARG (Marker, UINT64);\r
241 Segment = VA_ARG (Marker, UINT16);\r
242 Data = VA_ARG (Marker, UINT8 *);\r
243 DataMask = VA_ARG (Marker, UINT8 *);\r
244\r
245 return S3BootScriptSavePciCfg2ReadWrite (Width, Segment, Address, Data, DataMask);\r
246}\r
247\r
248/**\r
2e182e30 249 Internal function to add smbus execute opcode to the table.\r
3cbfba02
DW
250\r
251 @param Marker The variable argument list to get the opcode\r
252 and associated attributes.\r
253\r
254 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.\r
255 @retval EFI_SUCCESS Opcode is added.\r
256\r
257**/\r
258EFI_STATUS\r
259BootScriptSmbusExecute (\r
260 IN VA_LIST Marker\r
261 )\r
262{\r
263 EFI_SMBUS_DEVICE_ADDRESS SlaveAddress;\r
264 EFI_SMBUS_DEVICE_COMMAND Command;\r
265 EFI_SMBUS_OPERATION Operation;\r
266 BOOLEAN PecCheck;\r
267 VOID *Buffer;\r
268 UINTN *DataSize;\r
269 UINTN SmBusAddress;\r
270\r
271 SlaveAddress.SmbusDeviceAddress = VA_ARG (Marker, UINTN);\r
272 Command = VA_ARG (Marker, EFI_SMBUS_DEVICE_COMMAND);\r
273 Operation = VA_ARG (Marker, EFI_SMBUS_OPERATION);\r
274 PecCheck = VA_ARG (Marker, BOOLEAN);\r
275 SmBusAddress = SMBUS_LIB_ADDRESS (SlaveAddress.SmbusDeviceAddress,Command,0,PecCheck);\r
276 DataSize = VA_ARG (Marker, UINTN *);\r
277 Buffer = VA_ARG (Marker, VOID *);\r
278\r
279 return S3BootScriptSaveSmbusExecute (SmBusAddress, Operation, DataSize, Buffer);\r
280}\r
281\r
282/**\r
283 Internal function to add stall opcode to the table.\r
284\r
285 @param Marker The variable argument list to get the opcode\r
286 and associated attributes.\r
287\r
288 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.\r
289 @retval EFI_SUCCESS Opcode is added.\r
290\r
291**/\r
292EFI_STATUS\r
293BootScriptStall (\r
294 IN VA_LIST Marker\r
295 )\r
296{\r
297 UINT32 Duration;\r
298\r
299 Duration = VA_ARG (Marker, UINT32);\r
300\r
301 return S3BootScriptSaveStall (Duration);\r
302}\r
303\r
304/**\r
305 Internal function to add Save jmp address according to DISPATCH_OPCODE.\r
306 We ignore "Context" parameter.\r
307\r
308 @param Marker The variable argument list to get the opcode\r
309 and associated attributes.\r
310\r
311 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.\r
312 @retval EFI_SUCCESS Opcode is added.\r
313\r
314**/\r
315EFI_STATUS\r
316BootScriptDispatch (\r
317 IN VA_LIST Marker\r
318 )\r
319{\r
320 VOID *EntryPoint;\r
321\r
322 EntryPoint = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);\r
323 return S3BootScriptSaveDispatch (EntryPoint);\r
324}\r
325\r
326/**\r
327 Internal function to add memory pool operation to the table.\r
328\r
329 @param Marker The variable argument list to get the opcode\r
330 and associated attributes.\r
331\r
332 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.\r
333 @retval EFI_SUCCESS Opcode is added.\r
334\r
335**/\r
336EFI_STATUS\r
337BootScriptMemPoll (\r
338 IN VA_LIST Marker\r
339 )\r
340{\r
341 S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
342 UINT64 Address;\r
343 UINT8 *BitMask;\r
344 UINT8 *BitValue;\r
345 UINTN Duration;\r
32ea56f0 346 UINT64 LoopTimes;\r
3cbfba02
DW
347\r
348 Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
349 Address = VA_ARG (Marker, UINT64);\r
350 BitMask = VA_ARG (Marker, UINT8 *);\r
351 BitValue = VA_ARG (Marker, UINT8 *);\r
352 Duration = (UINTN)VA_ARG (Marker, UINT64);\r
32ea56f0 353 LoopTimes = VA_ARG (Marker, UINT64);\r
3cbfba02
DW
354\r
355 return S3BootScriptSaveMemPoll (Width, Address, BitMask, BitValue, Duration, LoopTimes);\r
356}\r
357\r
358/**\r
359 Internal function to add Save jmp address according to DISPATCH_OPCODE2.\r
360 The "Context" parameter is not ignored.\r
361\r
362 @param Marker The variable argument list to get the opcode\r
363 and associated attributes.\r
364\r
365 @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.\r
366 @retval EFI_SUCCESS Opcode is added.\r
367\r
368**/\r
369EFI_STATUS\r
370BootScriptDispatch2 (\r
371 IN VA_LIST Marker\r
372 )\r
373{\r
374 VOID *EntryPoint;\r
375 VOID *Context;\r
376\r
377 EntryPoint = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);\r
378 Context = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);\r
379\r
380 return S3BootScriptSaveDispatch2 (EntryPoint, Context);\r
381}\r
382\r
383/**\r
384 Internal function to add the opcode link node to the link list.\r
385\r
386 @param Marker The variable argument list to get the opcode\r
387 and associated attributes.\r
388\r
389 @retval EFI_OUT_OF_RESOURCES Not enought resource to complete the operations.\r
390 @retval EFI_SUCCESS The opcode entry is added to the link list\r
391 successfully.\r
392**/\r
393EFI_STATUS\r
394BootScriptInformation (\r
395 IN VA_LIST Marker\r
396 )\r
397{\r
398 UINT32 InformationLength;\r
399 EFI_PHYSICAL_ADDRESS Information;\r
400\r
401 InformationLength = VA_ARG (Marker, UINT32);\r
402 Information = VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);\r
403 return S3BootScriptSaveInformation (InformationLength, (VOID*)(UINTN)Information);\r
404}\r
405\r
406/**\r
407 Adds a record into a specified Framework boot script table.\r
408\r
409 This function is used to store a boot script record into a given boot\r
410 script table. If the table specified by TableName is nonexistent in the\r
411 system, a new table will automatically be created and then the script record\r
412 will be added into the new table. A boot script table can add new script records\r
413 until EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is called. Currently, the only\r
414 meaningful table name is EFI_ACPI_S3_RESUME_SCRIPT_TABLE. This function is\r
415 responsible for allocating necessary memory for the script.\r
416\r
417 This function has a variable parameter list. The exact parameter list depends on\r
418 the OpCode that is passed into the function. If an unsupported OpCode or illegal\r
419 parameter list is passed in, this function returns EFI_INVALID_PARAMETER.\r
420 If there are not enough resources available for storing more scripts, this function returns\r
421 EFI_OUT_OF_RESOURCES.\r
422\r
423 @param This A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.\r
424 @param TableName Name of the script table. Currently, the only meaningful value is\r
425 EFI_ACPI_S3_RESUME_SCRIPT_TABLE.\r
426 @param OpCode The operation code (opcode) number.\r
427 @param ... Argument list that is specific to each opcode.\r
428\r
429 @retval EFI_SUCCESS The operation succeeded. A record was added into the\r
430 specified script table.\r
431 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r
432 If the opcode is unknow or not supported because of the PCD\r
433 Feature Flags.\r
434 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r
435\r
436**/\r
437EFI_STATUS\r
438EFIAPI\r
439BootScriptWrite (\r
440 IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL *This,\r
441 IN UINT16 TableName,\r
442 IN UINT16 OpCode,\r
443 ...\r
444 )\r
445{\r
446 EFI_STATUS Status;\r
447 VA_LIST Marker;\r
448\r
449 if (TableName != FRAMEWORK_EFI_ACPI_S3_RESUME_SCRIPT_TABLE) {\r
450 //\r
451 // Only S3 boot script is supported for now.\r
452 //\r
453 return EFI_OUT_OF_RESOURCES;\r
454 }\r
455\r
456 //\r
457 // Build script according to opcode.\r
458 //\r
459 switch (OpCode) {\r
460\r
461 case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE:\r
462 VA_START (Marker, OpCode);\r
463 Status = BootScriptIoWrite (Marker);\r
464 VA_END (Marker);\r
465 break;\r
466\r
467 case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:\r
468 VA_START (Marker, OpCode);\r
469 Status = BootScriptIoReadWrite (Marker);\r
470 VA_END (Marker);\r
471 break;\r
472\r
473 case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:\r
474 VA_START (Marker, OpCode);\r
475 Status = BootScriptMemWrite (Marker);\r
476 VA_END (Marker);\r
477 break;\r
478\r
479 case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:\r
480 VA_START (Marker, OpCode);\r
481 Status = BootScriptMemReadWrite (Marker);\r
482 VA_END (Marker);\r
483 break;\r
484\r
485 case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE:\r
486 VA_START (Marker, OpCode);\r
487 Status = BootScriptPciCfgWrite (Marker);\r
488 VA_END (Marker);\r
489 break;\r
490\r
491 case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:\r
492 VA_START (Marker, OpCode);\r
493 Status = BootScriptPciCfgReadWrite (Marker);\r
494 VA_END (Marker);\r
495 break;\r
496\r
497 case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE:\r
498 VA_START (Marker, OpCode);\r
499 Status = BootScriptSmbusExecute (Marker);\r
500 VA_END (Marker);\r
501 break;\r
502\r
503 case EFI_BOOT_SCRIPT_STALL_OPCODE:\r
504 VA_START (Marker, OpCode);\r
505 Status = BootScriptStall (Marker);\r
506 VA_END (Marker);\r
507\r
508 break;\r
509\r
510 case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:\r
511 VA_START (Marker, OpCode);\r
512 Status = BootScriptDispatch (Marker);\r
513 VA_END (Marker);\r
514 break;\r
515\r
516 case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE:\r
517 VA_START (Marker, OpCode);\r
518 Status = BootScriptDispatch2 (Marker);\r
519 VA_END (Marker);\r
520 break;\r
521\r
522 case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:\r
523 VA_START (Marker, OpCode);\r
524 Status = BootScriptInformation (Marker);\r
525 VA_END (Marker);\r
526 break;\r
527\r
528 case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:\r
529 VA_START (Marker, OpCode);\r
530 Status = BootScriptMemPoll (Marker);\r
531 VA_END (Marker);\r
532 break;\r
533\r
534 case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE:\r
535 VA_START (Marker, OpCode);\r
536 Status = BootScriptPciCfg2Write (Marker);\r
537 VA_END (Marker);\r
538 break;\r
539\r
540 case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:\r
541 VA_START (Marker, OpCode);\r
542 Status = BootScriptPciCfg2ReadWrite (Marker);\r
543 VA_END (Marker);\r
544 break;\r
545\r
546 default:\r
547 Status = EFI_INVALID_PARAMETER;\r
548 break;\r
549 }\r
550\r
551 return Status;\r
552}\r
553\r
554/**\r
555 Closes the specified script table.\r
556\r
557 This function closes the specified boot script table and returns the base address\r
558 of the table. It allocates a new pool to duplicate all the boot scripts in the specified\r
559 table. Once this function is called, the specified table will be destroyed after it is\r
560 copied into the allocated pool. As a result, any attempts to add a script record into a\r
561 closed table will cause a new table to be created. The base address of the allocated pool\r
562 will be returned in Address. After using the boot script table, the caller is responsible\r
563 for freeing the pool that is allocated by this function. If the boot script table,\r
564 such as EFI_ACPI_S3_RESUME_SCRIPT_TABLE, is required to be stored in a nonperturbed\r
565 memory region, the caller should copy the table into the nonperturbed memory region by itself.\r
566\r
567 @param This A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.\r
568 @param TableName Name of the script table. Currently, the only meaningful value is\r
569 EFI_ACPI_S3_RESUME_SCRIPT_TABLE.\r
570 @param Address A pointer to the physical address where the table begins.\r
571\r
572 @retval EFI_SUCCESS The table was successfully returned.\r
573 @retval EFI_NOT_FOUND The specified table was not created previously.\r
574 @retval EFI_OUT_OF_RESOURCE Memory is insufficient to hold the reorganized boot script table.\r
575 @retval EFI_UNSUPPORTED The table type is not EFI_ACPI_S3_RESUME_SCRIPT_TABLE.\r
576\r
577**/\r
578EFI_STATUS\r
579EFIAPI\r
580BootScriptCloseTable (\r
581 IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL *This,\r
582 IN UINT16 TableName,\r
583 OUT EFI_PHYSICAL_ADDRESS *Address\r
584 )\r
585{\r
586 if (TableName != FRAMEWORK_EFI_ACPI_S3_RESUME_SCRIPT_TABLE) {\r
587 //\r
588 // Only S3 boot script is supported for now.\r
589 //\r
590 return EFI_NOT_FOUND;\r
591 }\r
592 *Address = (EFI_PHYSICAL_ADDRESS)(UINTN)S3BootScriptCloseTable ();\r
593\r
594 if (*Address == 0) {\r
595 return EFI_NOT_FOUND;\r
596 }\r
597 return EFI_SUCCESS;\r
598}\r
599\r
600/**\r
601 This routine is entry point of ScriptSave driver.\r
602\r
603 @param ImageHandle Handle for this drivers loaded image protocol.\r
604 @param SystemTable EFI system table.\r
605\r
606 @retval EFI_OUT_OF_RESOURCES No enough resource.\r
607 @retval EFI_SUCCESS Succesfully installed the ScriptSave driver.\r
608 @retval other Errors occured.\r
609\r
610**/\r
611EFI_STATUS\r
612EFIAPI\r
613InitializeScriptSave (\r
614 IN EFI_HANDLE ImageHandle,\r
615 IN EFI_SYSTEM_TABLE *SystemTable\r
616 )\r
617{\r
618 return gBS->InstallProtocolInterface (\r
619 &mHandle,\r
620 &gEfiBootScriptSaveProtocolGuid,\r
621 EFI_NATIVE_INTERFACE,\r
622 &mS3ScriptSave\r
623 );\r
624\r
625}\r
626\r