2 Interpret and execute the S3 data in S3 boot script.
4 Copyright (c) 2006 - 2012, 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 "InternalBootScriptLib.h"
19 Checks the parameter of SmbusExecute().
21 This function checks the input parameters of SmbusExecute(). If the input parameters are valid
22 for certain SMBus bus protocol, it will return EFI_SUCCESS; otherwise, it will return certain
23 error code based on the input SMBus bus protocol.
25 @param SmBusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length,
27 @param Operation Signifies which particular SMBus hardware protocol instance that
28 it will use to execute the SMBus transactions. This SMBus
29 hardware protocol is defined by the SMBus Specification and is
31 @param Length Signifies the number of bytes that this operation will do. The
32 maximum number of bytes can be revision specific and operation
33 specific. This field will contain the actual number of bytes that
34 are executed for this operation. Not all operations require this
36 @param Buffer Contains the value of data to execute to the SMBus slave device.
37 Not all operations require this argument. The length of this
38 buffer is identified by Length.
40 @retval EFI_SUCCESS All the parameters are valid for the corresponding SMBus bus
42 @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.
43 @retval EFI_INVALID_PARAMETER Length/Buffer is NULL for operations except for EfiSmbusQuickRead
44 and EfiSmbusQuickWrite. Length is outside the range of valid
46 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.
47 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.
52 IN UINTN SmBusAddress
,
53 IN EFI_SMBUS_OPERATION Operation
,
60 EFI_SMBUS_DEVICE_COMMAND Command
;
63 Command
= SMBUS_LIB_COMMAND (SmBusAddress
);
64 PecCheck
= SMBUS_LIB_PEC (SmBusAddress
);
66 // Set default value to be 2:
67 // for SmbusReadWord, SmbusWriteWord and SmbusProcessCall.
72 case EfiSmbusQuickRead
:
73 case EfiSmbusQuickWrite
:
74 if (PecCheck
|| Command
!= 0) {
75 return EFI_UNSUPPORTED
;
78 case EfiSmbusReceiveByte
:
79 case EfiSmbusSendByte
:
81 return EFI_UNSUPPORTED
;
84 // Cascade to check length parameter.
86 case EfiSmbusReadByte
:
87 case EfiSmbusWriteByte
:
90 // Cascade to check length parameter.
92 case EfiSmbusReadWord
:
93 case EfiSmbusWriteWord
:
94 case EfiSmbusProcessCall
:
95 if (Buffer
== NULL
|| Length
== NULL
) {
96 return EFI_INVALID_PARAMETER
;
97 } else if (*Length
< RequiredLen
) {
98 Status
= EFI_BUFFER_TOO_SMALL
;
100 *Length
= RequiredLen
;
102 case EfiSmbusReadBlock
:
103 case EfiSmbusWriteBlock
:
104 if ((Buffer
== NULL
) ||
106 (*Length
< MIN_SMBUS_BLOCK_LEN
) ||
107 (*Length
> MAX_SMBUS_BLOCK_LEN
)) {
108 return EFI_INVALID_PARAMETER
;
111 case EfiSmbusBWBRProcessCall
:
112 return EFI_UNSUPPORTED
;
114 return EFI_INVALID_PARAMETER
;
120 Executes an SMBus operation to an SMBus controller. Returns when either the command has been
121 executed or an error is encountered in doing the operation.
123 The SmbusExecute() function provides a standard way to execute an operation as defined in the System
124 Management Bus (SMBus) Specification. The resulting transaction will be either that the SMBus
125 slave devices accept this transaction or that this function returns with error.
127 @param SmbusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length,
129 @param Operation Signifies which particular SMBus hardware protocol instance that
130 it will use to execute the SMBus transactions. This SMBus
131 hardware protocol is defined by the SMBus Specification and is
133 @param Length Signifies the number of bytes that this operation will do. The
134 maximum number of bytes can be revision specific and operation
135 specific. This field will contain the actual number of bytes that
136 are executed for this operation. Not all operations require this
138 @param Buffer Contains the value of data to execute to the SMBus slave device.
139 Not all operations require this argument. The length of this
140 buffer is identified by Length.
142 @retval EFI_SUCCESS The last data that was returned from the access matched the poll
144 @retval EFI_CRC_ERROR Checksum is not correct (PEC is incorrect).
145 @retval EFI_TIMEOUT Timeout expired before the operation was completed. Timeout is
146 determined by the SMBus host controller device.
147 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
148 @retval EFI_DEVICE_ERROR The request was not completed because a failure that was
149 reflected in the Host Status Register bit. Device errors are a
150 result of a transaction collision, illegal command field,
151 unclaimed cycle (host initiated), or bus errors (collisions).
152 @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.
153 @retval EFI_INVALID_PARAMETER Length/Buffer is NULL for operations except for EfiSmbusQuickRead
154 and EfiSmbusQuickWrite. Length is outside the range of valid
156 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.
157 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.
162 IN UINTN SmbusAddress
,
163 IN EFI_SMBUS_OPERATION Operation
,
164 IN OUT UINTN
*Length
,
170 UINT8 WorkBuffer
[MAX_SMBUS_BLOCK_LEN
];
172 Status
= CheckParameters (SmbusAddress
, Operation
, Length
, Buffer
);
173 if (EFI_ERROR (Status
)) {
178 case EfiSmbusQuickRead
:
179 DEBUG ((EFI_D_INFO
, "EfiSmbusQuickRead - 0x%08x\n", SmbusAddress
));
180 SmBusQuickRead (SmbusAddress
, &Status
);
182 case EfiSmbusQuickWrite
:
183 DEBUG ((EFI_D_INFO
, "EfiSmbusQuickWrite - 0x%08x\n", SmbusAddress
));
184 SmBusQuickWrite (SmbusAddress
, &Status
);
186 case EfiSmbusReceiveByte
:
187 DEBUG ((EFI_D_INFO
, "EfiSmbusReceiveByte - 0x%08x\n", SmbusAddress
));
188 *(UINT8
*) Buffer
= SmBusReceiveByte (SmbusAddress
, &Status
);
190 case EfiSmbusSendByte
:
191 DEBUG ((EFI_D_INFO
, "EfiSmbusReceiveByte - 0x%08x (0x%02x)\n", SmbusAddress
, (UINTN
)*(UINT8
*) Buffer
));
192 SmBusSendByte (SmbusAddress
, *(UINT8
*) Buffer
, &Status
);
194 case EfiSmbusReadByte
:
195 DEBUG ((EFI_D_INFO
, "EfiSmbusReadByte - 0x%08x\n", SmbusAddress
));
196 *(UINT8
*) Buffer
= SmBusReadDataByte (SmbusAddress
, &Status
);
198 case EfiSmbusWriteByte
:
199 DEBUG ((EFI_D_INFO
, "EfiSmbusWriteByte - 0x%08x (0x%02x)\n", SmbusAddress
, (UINTN
)*(UINT8
*) Buffer
));
200 SmBusWriteDataByte (SmbusAddress
, *(UINT8
*) Buffer
, &Status
);
202 case EfiSmbusReadWord
:
203 DEBUG ((EFI_D_INFO
, "EfiSmbusReadWord - 0x%08x\n", SmbusAddress
));
204 *(UINT16
*) Buffer
= SmBusReadDataWord (SmbusAddress
, &Status
);
206 case EfiSmbusWriteWord
:
207 DEBUG ((EFI_D_INFO
, "EfiSmbusWriteByte - 0x%08x (0x%04x)\n", SmbusAddress
, (UINTN
)*(UINT16
*) Buffer
));
208 SmBusWriteDataWord (SmbusAddress
, *(UINT16
*) Buffer
, &Status
);
210 case EfiSmbusProcessCall
:
211 DEBUG ((EFI_D_INFO
, "EfiSmbusProcessCall - 0x%08x (0x%04x)\n", SmbusAddress
, (UINTN
)*(UINT16
*) Buffer
));
212 *(UINT16
*) Buffer
= SmBusProcessCall (SmbusAddress
, *(UINT16
*) Buffer
, &Status
);
214 case EfiSmbusReadBlock
:
215 DEBUG ((EFI_D_INFO
, "EfiSmbusReadBlock - 0x%08x\n", SmbusAddress
));
216 WorkBufferLen
= SmBusReadBlock (SmbusAddress
, WorkBuffer
, &Status
);
217 if (!EFI_ERROR (Status
)) {
219 // Read block transaction is complete successfully, and then
220 // check whether the output buffer is large enough.
222 if (*Length
>= WorkBufferLen
) {
223 CopyMem (Buffer
, WorkBuffer
, WorkBufferLen
);
225 Status
= EFI_BUFFER_TOO_SMALL
;
227 *Length
= WorkBufferLen
;
230 case EfiSmbusWriteBlock
:
231 DEBUG ((EFI_D_INFO
, "EfiSmbusWriteBlock - 0x%08x (0x%04x)\n", SmbusAddress
, (UINTN
)*(UINT16
*) Buffer
));
232 SmBusWriteBlock ((SmbusAddress
+ SMBUS_LIB_ADDRESS (0, 0, (*Length
), FALSE
)) , Buffer
, &Status
);
234 case EfiSmbusBWBRProcessCall
:
236 // BUGBUG: Should this case be handled?
245 Translates boot script width and address stride to MDE library interface.
248 @param Width Width of the operation.
249 @param Address Address of the operation.
250 @param AddressStride Instride for stepping input buffer.
251 @param BufferStride Outstride for stepping output buffer.
253 @retval EFI_SUCCESS Successful translation.
254 @retval EFI_INVALID_PARAMETER Width or Address is invalid.
258 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
260 OUT UINTN
*AddressStride
,
261 OUT UINTN
*BufferStride
266 if (Width
>= S3BootScriptWidthMaximum
) {
267 return EFI_INVALID_PARAMETER
;
270 *AddressStride
= (UINT32
)(1 << (Width
& 0x03));
271 *BufferStride
= *AddressStride
;
273 AlignMask
= *AddressStride
- 1;
274 if ((Address
& AlignMask
) != 0) {
275 return EFI_INVALID_PARAMETER
;
278 if (Width
>= S3BootScriptWidthFifoUint8
&& Width
<= S3BootScriptWidthFifoUint64
) {
282 if (Width
>= S3BootScriptWidthFillUint8
&& Width
<= S3BootScriptWidthFillUint64
) {
290 Perform IO read operation
292 @param[in] Width Width of the operation.
293 @param[in] Address Address of the operation.
294 @param[in] Count Count of the number of accesses to perform.
295 @param[out] Buffer Pointer to the buffer to read from I/O space.
297 @retval EFI_SUCCESS The data was written to the EFI System.
298 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.
300 The Buffer is not aligned for the given Width.
301 Address is outside the legal range of I/O ports.
306 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
317 Out
.Buf
= (UINT8
*) Buffer
;
319 if (Address
> MAX_IO_ADDRESS
) {
320 return EFI_INVALID_PARAMETER
;
323 Status
= BuildLoopData (Width
, Address
, &AddressStride
, &BufferStride
);
324 if (EFI_ERROR (Status
)) {
328 // Loop for each iteration and move the data
330 for (; Count
> 0; Count
--, Address
+= AddressStride
, Out
.Buf
+= BufferStride
) {
333 case S3BootScriptWidthUint8
:
334 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint8 - 0x%08x\n", (UINTN
) Address
));
335 *Out
.Uint8
= IoRead8 ((UINTN
) Address
);
337 case S3BootScriptWidthFifoUint8
:
338 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint8 - 0x%08x\n", (UINTN
) Address
));
339 *Out
.Uint8
= IoRead8 ((UINTN
) Address
);
341 case S3BootScriptWidthFillUint8
:
342 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint8 - 0x%08x\n", (UINTN
) Address
));
343 *Out
.Uint8
= IoRead8 ((UINTN
) Address
);
346 case S3BootScriptWidthUint16
:
347 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint16 - 0x%08x\n", (UINTN
) Address
));
348 *Out
.Uint16
= IoRead16 ((UINTN
) Address
);
350 case S3BootScriptWidthFifoUint16
:
351 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint16 - 0x%08x\n", (UINTN
) Address
));
352 *Out
.Uint16
= IoRead16 ((UINTN
) Address
);
354 case S3BootScriptWidthFillUint16
:
355 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint16 - 0x%08x\n", (UINTN
) Address
));
356 *Out
.Uint16
= IoRead16 ((UINTN
) Address
);
359 case S3BootScriptWidthUint32
:
360 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint32 - 0x%08x\n", (UINTN
) Address
));
361 *Out
.Uint32
= IoRead32 ((UINTN
) Address
);
363 case S3BootScriptWidthFifoUint32
:
364 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint32 - 0x%08x\n", (UINTN
) Address
));
365 *Out
.Uint32
= IoRead32 ((UINTN
) Address
);
367 case S3BootScriptWidthFillUint32
:
368 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint32 - 0x%08x\n", (UINTN
) Address
));
369 *Out
.Uint32
= IoRead32 ((UINTN
) Address
);
372 case S3BootScriptWidthUint64
:
373 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint64 - 0x%08x\n", (UINTN
) Address
));
374 *Out
.Uint64
= IoRead64 ((UINTN
) Address
);
376 case S3BootScriptWidthFifoUint64
:
377 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint64 - 0x%08x\n", (UINTN
) Address
));
378 *Out
.Uint64
= IoRead64 ((UINTN
) Address
);
380 case S3BootScriptWidthFillUint64
:
381 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint64 - 0x%08x\n", (UINTN
) Address
));
382 *Out
.Uint64
= IoRead64 ((UINTN
) Address
);
386 return EFI_INVALID_PARAMETER
;
394 Perform IO write operation
396 @param[in] Width Width of the operation.
397 @param[in] Address Address of the operation.
398 @param[in] Count Count of the number of accesses to perform.
399 @param[in] Buffer Pointer to the buffer to write to I/O space.
401 @retval EFI_SUCCESS The data was written to the EFI System.
402 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.
404 The Buffer is not aligned for the given Width.
405 Address is outside the legal range of I/O ports.
410 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
419 UINT64 OriginalAddress
;
423 In
.Buf
= (UINT8
*) Buffer
;
425 if (Address
> MAX_IO_ADDRESS
) {
426 return EFI_INVALID_PARAMETER
;
429 Status
= BuildLoopData (Width
, Address
, &AddressStride
, &BufferStride
);
430 if (EFI_ERROR (Status
)) {
434 // Loop for each iteration and move the data
436 OriginalAddress
= Address
;
437 OriginalIn
.Buf
= In
.Buf
;
438 for (; Count
> 0; Count
--, Address
+= AddressStride
, In
.Buf
+= BufferStride
) {
440 case S3BootScriptWidthUint8
:
441 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", (UINTN
)Address
, (UINTN
)*In
.Uint8
));
442 IoWrite8 ((UINTN
) Address
, *In
.Uint8
);
444 case S3BootScriptWidthFifoUint8
:
445 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", (UINTN
)OriginalAddress
, (UINTN
)*In
.Uint8
));
446 IoWrite8 ((UINTN
) OriginalAddress
, *In
.Uint8
);
448 case S3BootScriptWidthFillUint8
:
449 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", (UINTN
)Address
, (UINTN
)*OriginalIn
.Uint8
));
450 IoWrite8 ((UINTN
) Address
, *OriginalIn
.Uint8
);
452 case S3BootScriptWidthUint16
:
453 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", (UINTN
)Address
, (UINTN
)*In
.Uint16
));
454 IoWrite16 ((UINTN
) Address
, *In
.Uint16
);
456 case S3BootScriptWidthFifoUint16
:
457 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", (UINTN
)OriginalAddress
, (UINTN
)*In
.Uint16
));
458 IoWrite16 ((UINTN
) OriginalAddress
, *In
.Uint16
);
460 case S3BootScriptWidthFillUint16
:
461 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", (UINTN
)Address
, (UINTN
)*OriginalIn
.Uint16
));
462 IoWrite16 ((UINTN
) Address
, *OriginalIn
.Uint16
);
464 case S3BootScriptWidthUint32
:
465 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", (UINTN
)Address
, (UINTN
)*In
.Uint32
));
466 IoWrite32 ((UINTN
) Address
, *In
.Uint32
);
468 case S3BootScriptWidthFifoUint32
:
469 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", (UINTN
)OriginalAddress
, (UINTN
)*In
.Uint32
));
470 IoWrite32 ((UINTN
) OriginalAddress
, *In
.Uint32
);
472 case S3BootScriptWidthFillUint32
:
473 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint32 - 0x%08x (0x%08x)\n", (UINTN
)Address
, (UINTN
)*OriginalIn
.Uint32
));
474 IoWrite32 ((UINTN
) Address
, *OriginalIn
.Uint32
);
476 case S3BootScriptWidthUint64
:
477 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint64 - 0x%08x (0x%016lx)\n", (UINTN
)Address
, *In
.Uint64
));
478 IoWrite64 ((UINTN
) Address
, *In
.Uint64
);
480 case S3BootScriptWidthFifoUint64
:
481 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint64 - 0x%08x (0x%016lx)\n", (UINTN
)OriginalAddress
, *In
.Uint64
));
482 IoWrite64 ((UINTN
) OriginalAddress
, *In
.Uint64
);
484 case S3BootScriptWidthFillUint64
:
485 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint64 - 0x%08x (0x%016lx)\n", (UINTN
)Address
, *OriginalIn
.Uint64
));
486 IoWrite64 ((UINTN
) Address
, *OriginalIn
.Uint64
);
489 return EFI_INVALID_PARAMETER
;
497 Interprete the boot script node with EFI_BOOT_SCRIPT_IO_WRITE OP code.
499 @param Script Pointer to the node which is to be interpreted.
501 @retval EFI_SUCCESS The data was written to the EFI System.
502 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.
504 The Buffer is not aligned for the given Width.
505 Address is outside the legal range of I/O ports.
509 BootScriptExecuteIoWrite (
513 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
517 EFI_BOOT_SCRIPT_IO_WRITE IoWrite
;
519 CopyMem ((VOID
*)&IoWrite
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_IO_WRITE
));
520 Width
= (S3_BOOT_SCRIPT_LIB_WIDTH
) IoWrite
.Width
;
521 Address
= IoWrite
.Address
;
522 Count
= IoWrite
.Count
;
523 Buffer
= Script
+ sizeof (EFI_BOOT_SCRIPT_IO_WRITE
);
525 DEBUG ((EFI_D_INFO
, "BootScriptExecuteIoWrite - 0x%08x, 0x%08x, 0x%08x\n", (UINTN
)Address
, Count
, (UINTN
)Width
));
526 return ScriptIoWrite(Width
, Address
, Count
, Buffer
);
529 Perform memory read operation
531 @param Width Width of the operation.
532 @param Address Address of the operation.
533 @param Count Count of the number of accesses to perform.
534 @param Buffer Pointer to the buffer read from memory.
536 @retval EFI_SUCCESS The data was written to the EFI System.
537 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.
539 The Buffer is not aligned for the given Width.
540 @retval EFI_UNSUPPORTED The address range specified by Address, Width, and Count
541 is not valid for this EFI System.
546 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
559 Status
= BuildLoopData (Width
, Address
, &AddressStride
, &BufferStride
);
560 if (EFI_ERROR (Status
)) {
564 // Loop for each iteration and move the data
566 for (; Count
> 0; Count
--, Address
+= AddressStride
, Out
.Buf
+= BufferStride
) {
568 case S3BootScriptWidthUint8
:
569 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint8 - 0x%08x\n", (UINTN
)Address
));
570 *Out
.Uint8
= MmioRead8 ((UINTN
) Address
);
572 case S3BootScriptWidthFifoUint8
:
573 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint8 - 0x%08x\n", (UINTN
)Address
));
574 *Out
.Uint8
= MmioRead8 ((UINTN
) Address
);
576 case S3BootScriptWidthFillUint8
:
577 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint8 - 0x%08x\n", (UINTN
)Address
));
578 *Out
.Uint8
= MmioRead8 ((UINTN
) Address
);
581 case S3BootScriptWidthUint16
:
582 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint16 - 0x%08x\n", (UINTN
)Address
));
583 *Out
.Uint16
= MmioRead16 ((UINTN
) Address
);
585 case S3BootScriptWidthFifoUint16
:
586 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint16 - 0x%08x\n", (UINTN
)Address
));
587 *Out
.Uint16
= MmioRead16 ((UINTN
) Address
);
589 case S3BootScriptWidthFillUint16
:
590 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint16 - 0x%08x\n", (UINTN
)Address
));
591 *Out
.Uint16
= MmioRead16 ((UINTN
) Address
);
594 case S3BootScriptWidthUint32
:
595 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint32 - 0x%08x\n", (UINTN
)Address
));
596 *Out
.Uint32
= MmioRead32 ((UINTN
) Address
);
598 case S3BootScriptWidthFifoUint32
:
599 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint32 - 0x%08x\n", (UINTN
)Address
));
600 *Out
.Uint32
= MmioRead32 ((UINTN
) Address
);
602 case S3BootScriptWidthFillUint32
:
603 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint32 - 0x%08x\n", (UINTN
)Address
));
604 *Out
.Uint32
= MmioRead32 ((UINTN
) Address
);
607 case S3BootScriptWidthUint64
:
608 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint64 - 0x%08x\n", (UINTN
)Address
));
609 *Out
.Uint64
= MmioRead64 ((UINTN
) Address
);
611 case S3BootScriptWidthFifoUint64
:
612 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint64 - 0x%08x\n", (UINTN
)Address
));
613 *Out
.Uint64
= MmioRead64 ((UINTN
) Address
);
615 case S3BootScriptWidthFillUint64
:
616 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint64 - 0x%08x\n", (UINTN
)Address
));
617 *Out
.Uint64
= MmioRead64 ((UINTN
) Address
);
621 return EFI_UNSUPPORTED
;
628 Perform memory write operation
630 @param Width Width of the operation.
631 @param Address Address of the operation.
632 @param Count Count of the number of accesses to perform.
633 @param Buffer Pointer to the buffer write to memory.
635 @retval EFI_SUCCESS The data was written to the EFI System.
636 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.
638 The Buffer is not aligned for the given Width.
639 @retval EFI_UNSUPPORTED The address range specified by Address, Width, and Count
640 is not valid for this EFI System.
645 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
653 UINT64 OriginalAddress
;
660 Status
= BuildLoopData (Width
, Address
, &AddressStride
, &BufferStride
);
661 if (EFI_ERROR (Status
)) {
665 // Loop for each iteration and move the data
667 OriginalAddress
= Address
;
668 OriginalIn
.Buf
= In
.Buf
;
669 for (; Count
> 0; Count
--, Address
+= AddressStride
, In
.Buf
+= BufferStride
) {
671 case S3BootScriptWidthUint8
:
672 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", (UINTN
)Address
, (UINTN
)*In
.Uint8
));
673 MmioWrite8 ((UINTN
) Address
, *In
.Uint8
);
675 case S3BootScriptWidthFifoUint8
:
676 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", (UINTN
)OriginalAddress
, (UINTN
)*In
.Uint8
));
677 MmioWrite8 ((UINTN
) OriginalAddress
, *In
.Uint8
);
679 case S3BootScriptWidthFillUint8
:
680 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", (UINTN
)Address
, (UINTN
)*OriginalIn
.Uint8
));
681 MmioWrite8 ((UINTN
) Address
, *OriginalIn
.Uint8
);
683 case S3BootScriptWidthUint16
:
684 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", (UINTN
)Address
, (UINTN
)*In
.Uint16
));
685 MmioWrite16 ((UINTN
) Address
, *In
.Uint16
);
687 case S3BootScriptWidthFifoUint16
:
688 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", (UINTN
)OriginalAddress
, (UINTN
)*In
.Uint16
));
689 MmioWrite16 ((UINTN
) OriginalAddress
, *In
.Uint16
);
691 case S3BootScriptWidthFillUint16
:
692 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", (UINTN
)Address
, (UINTN
)*OriginalIn
.Uint16
));
693 MmioWrite16 ((UINTN
) Address
, *OriginalIn
.Uint16
);
695 case S3BootScriptWidthUint32
:
696 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", (UINTN
)Address
, (UINTN
)*In
.Uint32
));
697 MmioWrite32 ((UINTN
) Address
, *In
.Uint32
);
699 case S3BootScriptWidthFifoUint32
:
700 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", (UINTN
)OriginalAddress
, (UINTN
)*In
.Uint32
));
701 MmioWrite32 ((UINTN
) OriginalAddress
, *In
.Uint32
);
703 case S3BootScriptWidthFillUint32
:
704 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint32 - 0x%08x (0x%08x)\n", (UINTN
)Address
, (UINTN
)*OriginalIn
.Uint32
));
705 MmioWrite32 ((UINTN
) Address
, *OriginalIn
.Uint32
);
707 case S3BootScriptWidthUint64
:
708 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint64 - 0x%08x (0x%016lx)\n", (UINTN
)Address
, *In
.Uint64
));
709 MmioWrite64 ((UINTN
) Address
, *In
.Uint64
);
711 case S3BootScriptWidthFifoUint64
:
712 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint64 - 0x%08x (0x%016lx)\n", (UINTN
)OriginalAddress
, *In
.Uint64
));
713 MmioWrite64 ((UINTN
) OriginalAddress
, *In
.Uint64
);
715 case S3BootScriptWidthFillUint64
:
716 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint64 - 0x%08x (0x%016lx)\n", (UINTN
)Address
, *OriginalIn
.Uint64
));
717 MmioWrite64 ((UINTN
) Address
, *OriginalIn
.Uint64
);
720 return EFI_UNSUPPORTED
;
726 Interprete the boot script node with EFI_BOOT_SCRIPT_MEM_WRITE OP code.
728 @param[in] Script Pointer to the node which is to be interpreted.
730 @retval EFI_SUCCESS The data was written to the EFI System.
731 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.
733 The Buffer is not aligned for the given Width.
734 @retval EFI_UNSUPPORTED The address range specified by Address, Width, and Count
735 is not valid for this EFI System.
739 BootScriptExecuteMemoryWrite (
744 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
747 EFI_BOOT_SCRIPT_MEM_WRITE MemWrite
;
749 CopyMem((VOID
*)&MemWrite
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_MEM_WRITE
));
750 Width
= (S3_BOOT_SCRIPT_LIB_WIDTH
)MemWrite
.Width
;
751 Address
= MemWrite
.Address
;
752 Count
= MemWrite
.Count
;
753 Buffer
= Script
+ sizeof(EFI_BOOT_SCRIPT_MEM_WRITE
);
755 DEBUG ((EFI_D_INFO
, "BootScriptExecuteMemoryWrite - 0x%08x, 0x%08x, 0x%08x\n", (UINTN
)Address
, Count
, (UINTN
)Width
));
756 return ScriptMemoryWrite (Width
,Address
, Count
, Buffer
);
760 Performance PCI configuration read operation
762 @param Width Width of the operation.
763 @param Address Address of the operation.
764 @param Count Count of the number of accesses to perform.
765 @param Buffer Pointer to the buffer read from PCI config space
767 @retval EFI_SUCCESS The read succeed.
768 @retval EFI_INVALID_PARAMETER if Width is not defined
773 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
785 Out
.Buf
= (UINT8
*) Buffer
;
787 PciAddress
= PCI_ADDRESS_ENCODE (Address
);
789 Status
= BuildLoopData (Width
, PciAddress
, &AddressStride
, &BufferStride
);
790 if (EFI_ERROR (Status
)) {
794 // Loop for each iteration and move the data
796 for (; Count
> 0; Count
--, PciAddress
+= AddressStride
, Out
.Buf
+= BufferStride
) {
798 case S3BootScriptWidthUint8
:
799 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint8 - 0x%08x\n", PciAddress
));
800 *Out
.Uint8
= PciRead8 (PciAddress
);
802 case S3BootScriptWidthFifoUint8
:
803 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint8 - 0x%08x\n", PciAddress
));
804 *Out
.Uint8
= PciRead8 (PciAddress
);
806 case S3BootScriptWidthFillUint8
:
807 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint8 - 0x%08x\n", PciAddress
));
808 *Out
.Uint8
= PciRead8 (PciAddress
);
811 case S3BootScriptWidthUint16
:
812 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint16 - 0x%08x\n", PciAddress
));
813 *Out
.Uint16
= PciRead16 (PciAddress
);
815 case S3BootScriptWidthFifoUint16
:
816 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint16 - 0x%08x\n", PciAddress
));
817 *Out
.Uint16
= PciRead16 (PciAddress
);
819 case S3BootScriptWidthFillUint16
:
820 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint16 - 0x%08x\n", PciAddress
));
821 *Out
.Uint16
= PciRead16 (PciAddress
);
824 case S3BootScriptWidthUint32
:
825 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint32 - 0x%08x\n", PciAddress
));
826 *Out
.Uint32
= PciRead32 (PciAddress
);
828 case S3BootScriptWidthFifoUint32
:
829 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint32 - 0x%08x\n", PciAddress
));
830 *Out
.Uint32
= PciRead32 (PciAddress
);
832 case S3BootScriptWidthFillUint32
:
833 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint32 - 0x%08x\n", PciAddress
));
834 *Out
.Uint32
= PciRead32 (PciAddress
);
838 return EFI_INVALID_PARAMETER
;
845 Performance PCI configuration write operation
847 @param Width Width of the operation.
848 @param Address Address of the operation.
849 @param Count Count of the number of accesses to perform.
850 @param Buffer Pointer to the buffer write to PCI config space
852 @retval EFI_SUCCESS The write succeed.
853 @retval EFI_INVALID_PARAMETER if Width is not defined
858 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
867 UINTN OriginalPciAddress
;
872 In
.Buf
= (UINT8
*) Buffer
;
874 PciAddress
= PCI_ADDRESS_ENCODE (Address
);
876 Status
= BuildLoopData (Width
, PciAddress
, &AddressStride
, &BufferStride
);
877 if (EFI_ERROR (Status
)) {
881 // Loop for each iteration and move the data
883 OriginalPciAddress
= PciAddress
;
884 OriginalIn
.Buf
= In
.Buf
;
885 for (; Count
> 0; Count
--, PciAddress
+= AddressStride
, In
.Buf
+= BufferStride
) {
887 case S3BootScriptWidthUint8
:
888 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", PciAddress
, (UINTN
)*In
.Uint8
));
889 PciWrite8 (PciAddress
, *In
.Uint8
);
891 case S3BootScriptWidthFifoUint8
:
892 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", OriginalPciAddress
, (UINTN
)*In
.Uint8
));
893 PciWrite8 (OriginalPciAddress
, *In
.Uint8
);
895 case S3BootScriptWidthFillUint8
:
896 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", PciAddress
, (UINTN
)*OriginalIn
.Uint8
));
897 PciWrite8 (PciAddress
, *OriginalIn
.Uint8
);
899 case S3BootScriptWidthUint16
:
900 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", PciAddress
, (UINTN
)*In
.Uint16
));
901 PciWrite16 (PciAddress
, *In
.Uint16
);
903 case S3BootScriptWidthFifoUint16
:
904 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", OriginalPciAddress
, (UINTN
)*In
.Uint16
));
905 PciWrite16 (OriginalPciAddress
, *In
.Uint16
);
907 case S3BootScriptWidthFillUint16
:
908 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", PciAddress
, (UINTN
)*OriginalIn
.Uint16
));
909 PciWrite16 (PciAddress
, *OriginalIn
.Uint16
);
911 case S3BootScriptWidthUint32
:
912 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", PciAddress
, (UINTN
)*In
.Uint32
));
913 PciWrite32 (PciAddress
, *In
.Uint32
);
915 case S3BootScriptWidthFifoUint32
:
916 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", OriginalPciAddress
, (UINTN
)*In
.Uint32
));
917 PciWrite32 (OriginalPciAddress
, *In
.Uint32
);
919 case S3BootScriptWidthFillUint32
:
920 DEBUG ((EFI_D_INFO
, "S3BootScriptWidthFillUint32 - 0x%08x (0x%08x)\n", (UINTN
)PciAddress
, (UINTN
)*OriginalIn
.Uint32
));
921 PciWrite32 (PciAddress
, *OriginalIn
.Uint32
);
924 return EFI_INVALID_PARAMETER
;
930 Performance PCI configuration 2 read operation
932 @param Width Width of the operation.
933 @param Segment Pci segment number
934 @param Address Address of the operation.
935 @param Count Count of the number of accesses to perform.
936 @param Buffer Pointer to the buffer to read from PCI config space.
938 @retval EFI_SUCCESS The data was written to the EFI System.
939 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.
941 The Buffer is not aligned for the given Width.
942 Address is outside the legal range of I/O ports.
943 @note A known Limitations in the implementation which is the 'Segment' parameter is assumed as
944 Zero, or else, assert.
948 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
957 return ScriptPciCfgRead (Width
, Address
, Count
, Buffer
);
960 Performance PCI configuration 2 write operation
962 @param Width Width of the operation.
963 @param Segment Pci segment number
964 @param Address Address of the operation.
965 @param Count Count of the number of accesses to perform.
966 @param Buffer Pointer to the buffer to write to PCI config space.
968 @retval EFI_SUCCESS The data was written to the EFI System.
969 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.
971 The Buffer is not aligned for the given Width.
972 Address is outside the legal range of I/O ports.
973 @note A known Limitations in the implementation which is the 'Segment' parameter is assumed as
974 Zero, or else, assert.
980 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
988 return ScriptPciCfgWrite (Width
, Address
, Count
, Buffer
);
991 Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE OP code.
993 @param Script The pointer of typed node in boot script table
995 @retval EFI_SUCCESS The operation was executed successfully
998 BootScriptExecutePciCfgWrite (
1003 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
1006 EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE PciCfgWrite
;
1008 CopyMem ((VOID
*)&PciCfgWrite
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE
));
1010 Width
= (S3_BOOT_SCRIPT_LIB_WIDTH
)PciCfgWrite
.Width
;
1011 Address
= PciCfgWrite
.Address
;
1012 Count
= PciCfgWrite
.Count
;
1013 Buffer
= Script
+ sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE
);
1015 DEBUG ((EFI_D_INFO
, "BootScriptExecutePciCfgWrite - 0x%08x, 0x%08x, 0x%08x\n", PCI_ADDRESS_ENCODE (Address
), Count
, (UINTN
)Width
));
1016 return ScriptPciCfgWrite (Width
, Address
, Count
, Buffer
);
1019 Interprete the boot script node with EFI_BOOT_SCRIPT_IO_READ_WRITE OP code.
1021 @param Script The pointer of typed node in boot script table
1022 @param AndMask Mask value for 'and' operation
1023 @param OrMask Mask value for 'or' operation
1025 @retval EFI_SUCCESS The operation was executed successfully
1028 BootScriptExecuteIoReadWrite (
1037 EFI_BOOT_SCRIPT_IO_READ_WRITE IoReadWrite
;
1041 CopyMem((VOID
*)&IoReadWrite
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_IO_READ_WRITE
));
1043 DEBUG ((EFI_D_INFO
, "BootScriptExecuteIoReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN
)IoReadWrite
.Address
, AndMask
, OrMask
));
1045 Status
= ScriptIoRead (
1046 (S3_BOOT_SCRIPT_LIB_WIDTH
) IoReadWrite
.Width
,
1047 IoReadWrite
.Address
,
1051 if (!EFI_ERROR (Status
)) {
1052 Data
= (Data
& AndMask
) | OrMask
;
1053 Status
= ScriptIoWrite (
1054 (S3_BOOT_SCRIPT_LIB_WIDTH
) IoReadWrite
.Width
,
1055 IoReadWrite
.Address
,
1063 Interprete the boot script node with EFI_BOOT_SCRIPT_MEM_READ_WRITE OP code.
1065 @param Script The pointer of typed node in boot script table
1066 @param AndMask Mask value for 'and' operation
1067 @param OrMask Mask value for 'or' operation
1069 @retval EFI_SUCCESS The operation was executed successfully
1072 BootScriptExecuteMemoryReadWrite (
1081 EFI_BOOT_SCRIPT_MEM_READ_WRITE MemReadWrite
;
1085 CopyMem((VOID
*)&MemReadWrite
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_MEM_READ_WRITE
));
1087 DEBUG ((EFI_D_INFO
, "BootScriptExecuteMemoryReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN
)MemReadWrite
.Address
, AndMask
, OrMask
));
1089 Status
= ScriptMemoryRead (
1090 (S3_BOOT_SCRIPT_LIB_WIDTH
) MemReadWrite
.Width
,
1091 MemReadWrite
.Address
,
1095 if (!EFI_ERROR (Status
)) {
1096 Data
= (Data
& AndMask
) | OrMask
;
1097 Status
= ScriptMemoryWrite (
1098 (S3_BOOT_SCRIPT_LIB_WIDTH
) MemReadWrite
.Width
,
1099 MemReadWrite
.Address
,
1107 Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CFG_READ_WRITE OP code.
1109 @param Script The pointer of typed node in boot script table
1110 @param AndMask Mask value for 'and' operation
1111 @param OrMask Mask value for 'or' operation
1113 @retval EFI_SUCCESS The operation was executed successfully
1116 BootScriptExecutePciCfgReadWrite (
1125 EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE PciCfgReadWrite
;
1129 CopyMem((VOID
*)&PciCfgReadWrite
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE
));
1131 DEBUG ((EFI_D_INFO
, "BootScriptExecutePciCfgReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfgReadWrite
.Address
), AndMask
, OrMask
));
1133 Status
= ScriptPciCfgRead (
1134 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfgReadWrite
.Width
,
1135 PciCfgReadWrite
.Address
,
1139 if (EFI_ERROR (Status
)) {
1143 Data
= (Data
& AndMask
) | OrMask
;
1145 Status
= ScriptPciCfgWrite (
1146 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfgReadWrite
.Width
,
1147 PciCfgReadWrite
.Address
,
1155 Interprete the boot script node with EFI_BOOT_SCRIPT_SMBUS_EXECUTE OP code.
1157 @param Script The pointer of typed node in boot script table
1159 @retval EFI_SUCCESS The operation was executed successfully
1160 @retval EFI_UNSUPPORTED Cannot locate smbus ppi or occur error of script execution
1161 @retval Others Result of script execution
1164 BootScriptExecuteSmbusExecute (
1170 EFI_BOOT_SCRIPT_SMBUS_EXECUTE SmbusExecuteEntry
;
1172 CopyMem ((VOID
*)&SmbusExecuteEntry
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_SMBUS_EXECUTE
));
1174 DEBUG ((EFI_D_INFO
, "BootScriptExecuteSmbusExecute - 0x%08x, 0x%08x\n", (UINTN
)SmbusExecuteEntry
.SmBusAddress
, (UINTN
)SmbusExecuteEntry
.Operation
));
1176 SmBusAddress
= (UINTN
)SmbusExecuteEntry
.SmBusAddress
;
1177 DataSize
= (UINTN
) SmbusExecuteEntry
.DataSize
;
1178 return SmbusExecute (
1180 (EFI_SMBUS_OPERATION
) SmbusExecuteEntry
.Operation
,
1182 Script
+ sizeof (EFI_BOOT_SCRIPT_SMBUS_EXECUTE
)
1186 Interprete the boot script node with EFI_BOOT_SCRIPT_STALL OP code.
1188 @param Script The pointer of typed node in boot script table
1190 @retval EFI_SUCCESS The operation was executed successfully
1193 BootScriptExecuteStall (
1197 EFI_BOOT_SCRIPT_STALL Stall
;
1199 CopyMem ((VOID
*)&Stall
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_STALL
));
1201 DEBUG ((EFI_D_INFO
, "BootScriptExecuteStall - 0x%08x\n", (UINTN
)Stall
.Duration
));
1203 MicroSecondDelay ((UINTN
) Stall
.Duration
);
1207 Interprete the boot script node with EFI_BOOT_SCRIPT_DISPATCH OP code.
1209 @param Script The pointer of typed node in boot script table
1210 @retval EFI_SUCCESS The operation was executed successfully
1213 BootScriptExecuteDispatch (
1218 DISPATCH_ENTRYPOINT_FUNC EntryFunc
;
1219 EFI_BOOT_SCRIPT_DISPATCH ScriptDispatch
;
1221 CopyMem ((VOID
*)&ScriptDispatch
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_DISPATCH
));
1222 EntryFunc
= (DISPATCH_ENTRYPOINT_FUNC
) (UINTN
) (ScriptDispatch
.EntryPoint
);
1224 DEBUG ((EFI_D_INFO
, "BootScriptExecuteDispatch - 0x%08x\n", (UINTN
)ScriptDispatch
.EntryPoint
));
1226 Status
= EntryFunc (NULL
, NULL
);
1231 Interprete the boot script node with EFI_BOOT_SCRIPT_DISPATCH_2 OP code.
1233 @param Script The pointer of typed node in boot script table
1234 @retval EFI_SUCCESS The operation was executed successfully
1237 BootScriptExecuteDispatch2 (
1242 DISPATCH_ENTRYPOINT_FUNC EntryFunc
;
1243 EFI_BOOT_SCRIPT_DISPATCH_2 ScriptDispatch2
;
1245 CopyMem ((VOID
*)&ScriptDispatch2
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_DISPATCH_2
));
1247 DEBUG ((EFI_D_INFO
, "BootScriptExecuteDispatch2 - 0x%08x(0x%08x)\n", (UINTN
)ScriptDispatch2
.EntryPoint
, (UINTN
)ScriptDispatch2
.Context
));
1249 EntryFunc
= (DISPATCH_ENTRYPOINT_FUNC
) (UINTN
) (ScriptDispatch2
.EntryPoint
);
1251 Status
= EntryFunc (NULL
, (VOID
*) (UINTN
) ScriptDispatch2
.Context
);
1256 Interprete the boot script node with EFI_BOOT_SCRIPT_MEM_POLL OP code.
1258 @param Script The pointer of typed node in boot script table
1259 @param AndMask Mask value for 'and' operation
1260 @param OrMask Mask value for 'or' operation
1262 @retval EFI_DEVICE_ERROR Data polled from memory does not equal to
1263 the epecting data within the Loop Times.
1264 @retval EFI_SUCCESS The operation was executed successfully
1267 BootScriptExecuteMemPoll (
1277 EFI_BOOT_SCRIPT_MEM_POLL MemPoll
;
1279 CopyMem ((VOID
*)&MemPoll
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_MEM_POLL
));
1281 DEBUG ((EFI_D_INFO
, "BootScriptExecuteMemPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN
)MemPoll
.Address
, AndMask
, OrMask
));
1284 Status
= ScriptMemoryRead (
1285 (S3_BOOT_SCRIPT_LIB_WIDTH
) MemPoll
.Width
,
1290 if ((!EFI_ERROR (Status
)) && (Data
& AndMask
) == OrMask
) {
1294 for (LoopTimes
= 0; LoopTimes
< MemPoll
.LoopTimes
; LoopTimes
++) {
1295 NanoSecondDelay ((UINTN
)MemPoll
.Duration
);
1298 Status
= ScriptMemoryRead (
1299 (S3_BOOT_SCRIPT_LIB_WIDTH
) MemPoll
.Width
,
1304 if ((!EFI_ERROR (Status
)) && (Data
& AndMask
) == OrMask
) {
1309 if (LoopTimes
< MemPoll
.LoopTimes
) {
1312 return EFI_DEVICE_ERROR
;
1316 Execute the boot script to interpret the Store arbitrary information.
1317 This opcode is a no-op on dispatch and is only used for debugging script issues.
1319 @param Script The pointer of node in boot script table
1323 BootScriptExecuteInformation (
1329 EFI_BOOT_SCRIPT_INFORMATION Information
;
1330 UINT8
*InformationData
;
1332 CopyMem ((VOID
*)&Information
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_INFORMATION
));
1334 InformationData
= Script
+ sizeof (EFI_BOOT_SCRIPT_INFORMATION
);
1335 DEBUG ((EFI_D_INFO
, "BootScriptExecuteInformation - 0x%08x\n", (UINTN
) InformationData
));
1337 DEBUG ((EFI_D_INFO
, "BootScriptInformation: "));
1338 for (Index
= 0; Index
< Information
.InformationLength
; Index
++) {
1339 DEBUG ((EFI_D_INFO
, "%02x ", InformationData
[Index
]));
1341 DEBUG ((EFI_D_INFO
, "\n"));
1345 Execute the boot script to interpret the Label information.
1347 @param Script The pointer of node in boot script table
1351 BootScriptExecuteLabel (
1357 EFI_BOOT_SCRIPT_INFORMATION Information
;
1358 UINT8
*InformationData
;
1360 CopyMem ((VOID
*)&Information
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_INFORMATION
));
1362 InformationData
= Script
+ sizeof (EFI_BOOT_SCRIPT_INFORMATION
);
1363 DEBUG ((EFI_D_INFO
, "BootScriptExecuteLabel - 0x%08x\n", (UINTN
) InformationData
));
1365 DEBUG ((EFI_D_INFO
, "BootScriptLabel: "));
1366 for (Index
= 0; Index
< Information
.InformationLength
; Index
++) {
1367 DEBUG ((EFI_D_INFO
, "%02x ", InformationData
[Index
]));
1369 DEBUG ((EFI_D_INFO
, "\n"));
1373 calculate the mask value for 'and' and 'or' operation
1374 @param ScriptHeader The pointer of header of node in boot script table
1375 @param AndMask The Mask value for 'and' operation
1376 @param OrMask The Mask value for 'or' operation
1377 @param Script Pointer to the entry.
1382 IN EFI_BOOT_SCRIPT_COMMON_HEADER
*ScriptHeader
,
1383 OUT UINT64
*AndMask
,
1391 switch (ScriptHeader
->OpCode
) {
1392 case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE
:
1393 Size
= sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE
);
1396 case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE
:
1397 Size
= sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE
);
1400 case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE
:
1401 Size
= sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE
);
1403 case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE
:
1404 Size
= sizeof (EFI_BOOT_SCRIPT_MEM_POLL
);
1407 case EFI_BOOT_SCRIPT_IO_POLL_OPCODE
:
1408 Size
= sizeof (EFI_BOOT_SCRIPT_IO_POLL
);
1411 case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE
:
1412 Size
= sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE
);
1415 case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE
:
1416 Size
= sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL
);
1419 case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE
:
1420 Size
= sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL
);
1427 DataPtr
= Script
+ Size
;
1429 switch (ScriptHeader
->Width
) {
1430 case S3BootScriptWidthUint8
:
1431 *AndMask
= (UINT64
) *(DataPtr
+ 1);
1432 *OrMask
= (UINT64
) (*DataPtr
);
1435 case S3BootScriptWidthUint16
:
1436 *AndMask
= (UINT64
) (*(UINT16
*) (DataPtr
+ 2));
1437 *OrMask
= (UINT64
) (*(UINT16
*) DataPtr
);
1440 case S3BootScriptWidthUint32
:
1441 *AndMask
= (UINT64
) (*(UINT32
*) (DataPtr
+ 4));
1442 *OrMask
= (UINT64
) (*(UINT32
*) DataPtr
);
1445 case S3BootScriptWidthUint64
:
1446 *AndMask
= (UINT64
) (*(UINT64
*) (DataPtr
+ 8));
1447 *OrMask
= (UINT64
) (*(UINT64
*) DataPtr
);
1457 Interprete the boot script node with EFI_BOOT_SCRIPT_IO_POLL OP code.
1459 @param Script The pointer of typed node in boot script table
1460 @param AndMask Mask value for 'and' operation
1461 @param OrMask Mask value for 'or' operation
1463 @retval EFI_DEVICE_ERROR Data polled from memory does not equal to
1464 the epecting data within the Loop Times.
1465 @retval EFI_SUCCESS The operation was executed successfully
1468 BootScriptExecuteIoPoll (
1477 EFI_BOOT_SCRIPT_IO_POLL IoPoll
;
1479 CopyMem ((VOID
*)&IoPoll
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_IO_POLL
));
1481 DEBUG ((EFI_D_INFO
, "BootScriptExecuteIoPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN
)IoPoll
.Address
, AndMask
, OrMask
));
1484 Status
= ScriptIoRead (
1485 (S3_BOOT_SCRIPT_LIB_WIDTH
) IoPoll
.Width
,
1490 if ((!EFI_ERROR (Status
)) && (Data
& AndMask
) == OrMask
) {
1493 for (LoopTimes
= 0; LoopTimes
< IoPoll
.Delay
; LoopTimes
++) {
1494 NanoSecondDelay (100);
1496 Status
= ScriptIoRead (
1497 (S3_BOOT_SCRIPT_LIB_WIDTH
) IoPoll
.Width
,
1502 if ((!EFI_ERROR (Status
)) &&(Data
& AndMask
) == OrMask
) {
1507 if (LoopTimes
< IoPoll
.Delay
) {
1510 return EFI_DEVICE_ERROR
;
1514 Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE OP code.
1516 @param Script The pointer of S3 boot script
1518 @retval EFI_SUCCESS The operation was executed successfully
1522 BootScriptExecutePciCfg2Write (
1527 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
1531 EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE PciCfg2Write
;
1533 CopyMem ((VOID
*)&PciCfg2Write
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE
));
1535 Width
= (S3_BOOT_SCRIPT_LIB_WIDTH
)PciCfg2Write
.Width
;
1536 Segment
= PciCfg2Write
.Segment
;
1537 Address
= PciCfg2Write
.Address
;
1538 Count
= PciCfg2Write
.Count
;
1539 Buffer
= Script
+ sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE
);
1541 DEBUG ((EFI_D_INFO
, "BootScriptExecutePciCfg2Write - 0x%04x, 0x%08x, 0x%08x, 0x%08x\n", Segment
, PCI_ADDRESS_ENCODE (Address
), Count
, (UINTN
)Width
));
1542 return ScriptPciCfg2Write (Width
, Segment
, Address
, Count
, Buffer
);
1547 Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE OP code.
1549 @param Script The pointer of S3 boot script
1550 @param AndMask Mask value for 'and' operation
1551 @param OrMask Mask value for 'or' operation
1553 @retval EFI_SUCCESS The operation was executed successfully
1557 BootScriptExecutePciCfg2ReadWrite (
1565 EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE PciCfg2ReadWrite
;
1569 CopyMem ((VOID
*)&PciCfg2ReadWrite
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE
));
1571 DEBUG ((EFI_D_INFO
, "BootScriptExecutePciCfg2ReadWrite - 0x%04x, 0x%08x, 0x%016lx, 0x%016lx\n", PciCfg2ReadWrite
.Segment
, PCI_ADDRESS_ENCODE (PciCfg2ReadWrite
.Address
), AndMask
, OrMask
));
1573 Status
= ScriptPciCfg2Read (
1574 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfg2ReadWrite
.Width
,
1575 PciCfg2ReadWrite
.Segment
,
1576 PciCfg2ReadWrite
.Address
,
1580 if (EFI_ERROR (Status
)) {
1584 Data
= (Data
& AndMask
) | OrMask
;
1585 Status
= ScriptPciCfg2Write (
1586 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfg2ReadWrite
.Width
,
1587 PciCfg2ReadWrite
.Segment
,
1588 PciCfg2ReadWrite
.Address
,
1595 Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG_POLL OP code.
1597 @param Script The pointer of S3 boot script
1598 @param AndMask Mask value for 'and' operation
1599 @param OrMask Mask value for 'or' operation
1601 @retval EFI_SUCCESS The operation was executed successfully
1602 @retval EFI_DEVICE_ERROR Data polled from Pci configuration space does not equal to
1603 epecting data within the Loop Times.
1606 BootScriptPciCfgPoll (
1615 EFI_BOOT_SCRIPT_PCI_CONFIG_POLL PciCfgPoll
;
1616 CopyMem ((VOID
*)&PciCfgPoll
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_POLL
));
1618 DEBUG ((EFI_D_INFO
, "BootScriptPciCfgPoll - 0x%08x, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfgPoll
.Address
), AndMask
, OrMask
));
1621 Status
= ScriptPciCfgRead (
1622 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfgPoll
.Width
,
1627 if ((!EFI_ERROR (Status
)) &&(Data
& AndMask
) == OrMask
) {
1631 for (LoopTimes
= 0; LoopTimes
< PciCfgPoll
.Delay
; LoopTimes
++) {
1632 NanoSecondDelay (100);
1634 Status
= ScriptPciCfgRead (
1635 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfgPoll
.Width
,
1640 if ((!EFI_ERROR (Status
)) &&
1641 (Data
& AndMask
) == OrMask
) {
1646 if (LoopTimes
< PciCfgPoll
.Delay
) {
1649 return EFI_DEVICE_ERROR
;
1654 Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL OP code.
1656 @param Script The pointer of S3 Boot Script
1657 @param AndMask Mask value for 'and' operation
1658 @param OrMask Mask value for 'or' operation
1660 @retval EFI_SUCCESS The operation was executed successfully
1661 @retval EFI_DEVICE_ERROR Data polled from Pci configuration space does not equal to
1662 epecting data within the Loop Times.
1666 BootScriptPciCfg2Poll (
1675 EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL PciCfg2Poll
;
1678 CopyMem ((VOID
*)&PciCfg2Poll
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL
));
1680 DEBUG ((EFI_D_INFO
, "BootScriptPciCfg2Poll - 0x%04x, 0x%08x, 0x%016lx, 0x%016lx\n", PciCfg2Poll
.Segment
, PCI_ADDRESS_ENCODE (PciCfg2Poll
.Address
), AndMask
, OrMask
));
1682 Status
= ScriptPciCfg2Read (
1683 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfg2Poll
.Width
,
1684 PciCfg2Poll
.Segment
,
1685 PciCfg2Poll
.Address
,
1689 if ((!EFI_ERROR (Status
)) && (Data
& AndMask
) == OrMask
) {
1693 for (LoopTimes
= 0; LoopTimes
< PciCfg2Poll
.Delay
; LoopTimes
++) {
1694 NanoSecondDelay (100);
1697 Status
= ScriptPciCfg2Read (
1698 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfg2Poll
.Width
,
1699 PciCfg2Poll
.Segment
,
1700 PciCfg2Poll
.Address
,
1704 if ((!EFI_ERROR (Status
)) && (Data
& AndMask
) == OrMask
) {
1709 if (LoopTimes
< PciCfg2Poll
.Delay
) {
1712 return EFI_DEVICE_ERROR
;
1718 Executes the S3 boot script table.
1720 @retval RETURN_SUCCESS The boot script table was executed successfully.
1721 @retval RETURN_UNSUPPORTED Invalid script table or opcode.
1723 @note A known Limitations in the implementation: When interpreting the opcode EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE
1724 EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE and EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE, the 'Segment' parameter is assumed as
1725 Zero, or else, assert.
1729 S3BootScriptExecute (
1739 EFI_BOOT_SCRIPT_COMMON_HEADER ScriptHeader
;
1740 EFI_BOOT_SCRIPT_TABLE_HEADER TableHeader
;
1741 Script
= mS3BootScriptTablePtr
->TableBase
;
1743 CopyMem ((VOID
*)&TableHeader
, Script
, sizeof(EFI_BOOT_SCRIPT_TABLE_HEADER
));
1745 return EFI_INVALID_PARAMETER
;
1748 DEBUG ((EFI_D_INFO
, "S3BootScriptExecute:\n"));
1749 if (TableHeader
.OpCode
!= S3_BOOT_SCRIPT_LIB_TABLE_OPCODE
) {
1750 return EFI_UNSUPPORTED
;
1753 DEBUG ((EFI_D_INFO
, "TableHeader - 0x%08x\n", Script
));
1755 StartAddress
= (UINTN
) Script
;
1756 TableLength
= TableHeader
.TableLength
;
1757 Script
= Script
+ TableHeader
.Length
;
1758 Status
= EFI_SUCCESS
;
1762 DEBUG ((EFI_D_INFO
, "TableHeader.TableLength - 0x%08x\n", (UINTN
)TableLength
));
1764 while ((UINTN
) Script
< (UINTN
) (StartAddress
+ TableLength
)) {
1765 DEBUG ((EFI_D_INFO
, "ExecuteBootScript - %08x\n", (UINTN
)Script
));
1767 CopyMem ((VOID
*)&ScriptHeader
, Script
, sizeof(EFI_BOOT_SCRIPT_COMMON_HEADER
));
1768 switch (ScriptHeader
.OpCode
) {
1770 case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE
:
1771 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE\n"));
1772 Status
= BootScriptExecuteMemoryWrite (Script
);
1775 case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE
:
1776 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE\n"));
1777 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1778 Status
= BootScriptExecuteMemoryReadWrite (
1785 case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE
:
1786 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_IO_WRITE_OPCODE\n"));
1787 Status
= BootScriptExecuteIoWrite (Script
);
1790 case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE
:
1791 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE\n"));
1792 Status
= BootScriptExecutePciCfgWrite (Script
);
1795 case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE
:
1796 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE\n"));
1797 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1798 Status
= BootScriptExecutePciCfgReadWrite (
1804 case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE
:
1805 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE\n"));
1806 Status
= BootScriptExecutePciCfg2Write (Script
);
1809 case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE
:
1810 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE\n"));
1811 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1812 Status
= BootScriptExecutePciCfg2ReadWrite (
1818 case EFI_BOOT_SCRIPT_DISPATCH_OPCODE
:
1819 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_DISPATCH_OPCODE\n"));
1820 Status
= BootScriptExecuteDispatch (Script
);
1823 case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE
:
1824 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE\n"));
1825 Status
= BootScriptExecuteDispatch2 (Script
);
1828 case EFI_BOOT_SCRIPT_INFORMATION_OPCODE
:
1829 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_INFORMATION_OPCODE\n"));
1830 BootScriptExecuteInformation (Script
);
1833 case S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE
:
1834 DEBUG ((EFI_D_INFO
, "S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE\n"));
1835 DEBUG ((EFI_D_INFO
, "S3BootScriptDone - %r\n", EFI_SUCCESS
));
1838 case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE
:
1839 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE\n"));
1840 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1841 Status
= BootScriptExecuteIoReadWrite (
1848 case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE
:
1849 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE\n"));
1850 Status
= BootScriptExecuteSmbusExecute (Script
);
1853 case EFI_BOOT_SCRIPT_STALL_OPCODE
:
1854 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_STALL_OPCODE\n"));
1855 Status
= BootScriptExecuteStall (Script
);
1858 case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE
:
1859 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_MEM_POLL_OPCODE\n"));
1860 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1861 Status
= BootScriptExecuteMemPoll (Script
, AndMask
, OrMask
);
1865 case EFI_BOOT_SCRIPT_IO_POLL_OPCODE
:
1866 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_IO_POLL_OPCODE\n"));
1867 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1868 Status
= BootScriptExecuteIoPoll (Script
, AndMask
, OrMask
);
1871 case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE
:
1872 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE\n"));
1873 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1874 Status
= BootScriptPciCfgPoll (Script
, AndMask
, OrMask
);
1877 case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE
:
1878 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE\n"));
1879 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1880 Status
= BootScriptPciCfg2Poll (Script
, AndMask
, OrMask
);
1883 case S3_BOOT_SCRIPT_LIB_LABEL_OPCODE
:
1887 DEBUG ((EFI_D_INFO
, "S3_BOOT_SCRIPT_LIB_LABEL_OPCODE\n"));
1888 BootScriptExecuteLabel (Script
);
1891 DEBUG ((EFI_D_INFO
, "S3BootScriptDone - %r\n", EFI_UNSUPPORTED
));
1892 return EFI_UNSUPPORTED
;
1895 if (EFI_ERROR (Status
)) {
1896 DEBUG ((EFI_D_INFO
, "S3BootScriptDone - %r\n", Status
));
1900 Script
= Script
+ ScriptHeader
.Length
;
1903 DEBUG ((EFI_D_INFO
, "S3BootScriptDone - %r\n", Status
));