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
;
1127 CopyMem((VOID
*)&PciCfgReadWrite
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE
));
1129 DEBUG ((EFI_D_INFO
, "BootScriptExecutePciCfgReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfgReadWrite
.Address
), AndMask
, OrMask
));
1131 Status
= ScriptPciCfgRead (
1132 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfgReadWrite
.Width
,
1133 PciCfgReadWrite
.Address
,
1137 if (EFI_ERROR (Status
)) {
1141 Data
= (Data
& AndMask
) | OrMask
;
1143 Status
= ScriptPciCfgWrite (
1144 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfgReadWrite
.Width
,
1145 PciCfgReadWrite
.Address
,
1153 Interprete the boot script node with EFI_BOOT_SCRIPT_SMBUS_EXECUTE OP code.
1155 @param Script The pointer of typed node in boot script table
1157 @retval EFI_SUCCESS The operation was executed successfully
1158 @retval EFI_UNSUPPORTED Cannot locate smbus ppi or occur error of script execution
1159 @retval Others Result of script execution
1162 BootScriptExecuteSmbusExecute (
1168 EFI_BOOT_SCRIPT_SMBUS_EXECUTE SmbusExecuteEntry
;
1170 CopyMem ((VOID
*)&SmbusExecuteEntry
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_SMBUS_EXECUTE
));
1172 DEBUG ((EFI_D_INFO
, "BootScriptExecuteSmbusExecute - 0x%08x, 0x%08x\n", (UINTN
)SmbusExecuteEntry
.SmBusAddress
, (UINTN
)SmbusExecuteEntry
.Operation
));
1174 SmBusAddress
= (UINTN
)SmbusExecuteEntry
.SmBusAddress
;
1175 DataSize
= (UINTN
) SmbusExecuteEntry
.DataSize
;
1176 return SmbusExecute (
1178 (EFI_SMBUS_OPERATION
) SmbusExecuteEntry
.Operation
,
1180 Script
+ sizeof (EFI_BOOT_SCRIPT_SMBUS_EXECUTE
)
1184 Interprete the boot script node with EFI_BOOT_SCRIPT_STALL OP code.
1186 @param Script The pointer of typed node in boot script table
1188 @retval EFI_SUCCESS The operation was executed successfully
1191 BootScriptExecuteStall (
1195 EFI_BOOT_SCRIPT_STALL Stall
;
1197 CopyMem ((VOID
*)&Stall
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_STALL
));
1199 DEBUG ((EFI_D_INFO
, "BootScriptExecuteStall - 0x%08x\n", (UINTN
)Stall
.Duration
));
1201 MicroSecondDelay ((UINTN
) Stall
.Duration
);
1205 Interprete the boot script node with EFI_BOOT_SCRIPT_DISPATCH OP code.
1207 @param Script The pointer of typed node in boot script table
1208 @retval EFI_SUCCESS The operation was executed successfully
1211 BootScriptExecuteDispatch (
1216 DISPATCH_ENTRYPOINT_FUNC EntryFunc
;
1217 EFI_BOOT_SCRIPT_DISPATCH ScriptDispatch
;
1219 CopyMem ((VOID
*)&ScriptDispatch
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_DISPATCH
));
1220 EntryFunc
= (DISPATCH_ENTRYPOINT_FUNC
) (UINTN
) (ScriptDispatch
.EntryPoint
);
1222 DEBUG ((EFI_D_INFO
, "BootScriptExecuteDispatch - 0x%08x\n", (UINTN
)ScriptDispatch
.EntryPoint
));
1224 Status
= EntryFunc (NULL
, NULL
);
1229 Interprete the boot script node with EFI_BOOT_SCRIPT_DISPATCH_2 OP code.
1231 @param Script The pointer of typed node in boot script table
1232 @retval EFI_SUCCESS The operation was executed successfully
1235 BootScriptExecuteDispatch2 (
1240 DISPATCH_ENTRYPOINT_FUNC EntryFunc
;
1241 EFI_BOOT_SCRIPT_DISPATCH_2 ScriptDispatch2
;
1243 CopyMem ((VOID
*)&ScriptDispatch2
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_DISPATCH_2
));
1245 DEBUG ((EFI_D_INFO
, "BootScriptExecuteDispatch2 - 0x%08x(0x%08x)\n", (UINTN
)ScriptDispatch2
.EntryPoint
, (UINTN
)ScriptDispatch2
.Context
));
1247 EntryFunc
= (DISPATCH_ENTRYPOINT_FUNC
) (UINTN
) (ScriptDispatch2
.EntryPoint
);
1249 Status
= EntryFunc (NULL
, (VOID
*) (UINTN
) ScriptDispatch2
.Context
);
1254 Interprete the boot script node with EFI_BOOT_SCRIPT_MEM_POLL OP code.
1256 @param Script The pointer of typed node in boot script table
1257 @param AndMask Mask value for 'and' operation
1258 @param OrMask Mask value for 'or' operation
1260 @retval EFI_DEVICE_ERROR Data polled from memory does not equal to
1261 the epecting data within the Loop Times.
1262 @retval EFI_SUCCESS The operation was executed successfully
1265 BootScriptExecuteMemPoll (
1275 EFI_BOOT_SCRIPT_MEM_POLL MemPoll
;
1277 CopyMem ((VOID
*)&MemPoll
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_MEM_POLL
));
1279 DEBUG ((EFI_D_INFO
, "BootScriptExecuteMemPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN
)MemPoll
.Address
, AndMask
, OrMask
));
1282 Status
= ScriptMemoryRead (
1283 (S3_BOOT_SCRIPT_LIB_WIDTH
) MemPoll
.Width
,
1288 if ((!EFI_ERROR (Status
)) && (Data
& AndMask
) == OrMask
) {
1292 for (LoopTimes
= 0; LoopTimes
< MemPoll
.LoopTimes
; LoopTimes
++) {
1293 NanoSecondDelay ((UINTN
)MemPoll
.Duration
);
1296 Status
= ScriptMemoryRead (
1297 (S3_BOOT_SCRIPT_LIB_WIDTH
) MemPoll
.Width
,
1302 if ((!EFI_ERROR (Status
)) && (Data
& AndMask
) == OrMask
) {
1307 if (LoopTimes
< MemPoll
.LoopTimes
) {
1310 return EFI_DEVICE_ERROR
;
1314 Execute the boot script to interpret the Store arbitrary information.
1315 This opcode is a no-op on dispatch and is only used for debugging script issues.
1317 @param Script The pointer of node in boot script table
1321 BootScriptExecuteInformation (
1327 EFI_BOOT_SCRIPT_INFORMATION Information
;
1328 UINT8
*InformationData
;
1330 CopyMem ((VOID
*)&Information
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_INFORMATION
));
1332 InformationData
= Script
+ sizeof (EFI_BOOT_SCRIPT_INFORMATION
);
1333 DEBUG ((EFI_D_INFO
, "BootScriptExecuteInformation - 0x%08x\n", (UINTN
) InformationData
));
1335 DEBUG ((EFI_D_INFO
, "BootScriptInformation: "));
1336 for (Index
= 0; Index
< Information
.InformationLength
; Index
++) {
1337 DEBUG ((EFI_D_INFO
, "%02x ", InformationData
[Index
]));
1339 DEBUG ((EFI_D_INFO
, "\n"));
1343 Execute the boot script to interpret the Label information.
1345 @param Script The pointer of node in boot script table
1349 BootScriptExecuteLabel (
1355 EFI_BOOT_SCRIPT_INFORMATION Information
;
1356 UINT8
*InformationData
;
1358 CopyMem ((VOID
*)&Information
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_INFORMATION
));
1360 InformationData
= Script
+ sizeof (EFI_BOOT_SCRIPT_INFORMATION
);
1361 DEBUG ((EFI_D_INFO
, "BootScriptExecuteLabel - 0x%08x\n", (UINTN
) InformationData
));
1363 DEBUG ((EFI_D_INFO
, "BootScriptLabel: "));
1364 for (Index
= 0; Index
< Information
.InformationLength
; Index
++) {
1365 DEBUG ((EFI_D_INFO
, "%02x ", InformationData
[Index
]));
1367 DEBUG ((EFI_D_INFO
, "\n"));
1371 calculate the mask value for 'and' and 'or' operation
1372 @param ScriptHeader The pointer of header of node in boot script table
1373 @param AndMask The Mask value for 'and' operation
1374 @param OrMask The Mask value for 'or' operation
1375 @param Script Pointer to the entry.
1380 IN EFI_BOOT_SCRIPT_COMMON_HEADER
*ScriptHeader
,
1381 OUT UINT64
*AndMask
,
1389 switch (ScriptHeader
->OpCode
) {
1390 case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE
:
1391 Size
= sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE
);
1394 case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE
:
1395 Size
= sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE
);
1398 case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE
:
1399 Size
= sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE
);
1401 case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE
:
1402 Size
= sizeof (EFI_BOOT_SCRIPT_MEM_POLL
);
1405 case EFI_BOOT_SCRIPT_IO_POLL_OPCODE
:
1406 Size
= sizeof (EFI_BOOT_SCRIPT_IO_POLL
);
1409 case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE
:
1410 Size
= sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE
);
1413 case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE
:
1414 Size
= sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL
);
1417 case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE
:
1418 Size
= sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL
);
1425 DataPtr
= Script
+ Size
;
1427 switch (ScriptHeader
->Width
) {
1428 case S3BootScriptWidthUint8
:
1429 *AndMask
= (UINT64
) *(DataPtr
+ 1);
1430 *OrMask
= (UINT64
) (*DataPtr
);
1433 case S3BootScriptWidthUint16
:
1434 *AndMask
= (UINT64
) (*(UINT16
*) (DataPtr
+ 2));
1435 *OrMask
= (UINT64
) (*(UINT16
*) DataPtr
);
1438 case S3BootScriptWidthUint32
:
1439 *AndMask
= (UINT64
) (*(UINT32
*) (DataPtr
+ 4));
1440 *OrMask
= (UINT64
) (*(UINT32
*) DataPtr
);
1443 case S3BootScriptWidthUint64
:
1444 *AndMask
= (UINT64
) (*(UINT64
*) (DataPtr
+ 8));
1445 *OrMask
= (UINT64
) (*(UINT64
*) DataPtr
);
1455 Interprete the boot script node with EFI_BOOT_SCRIPT_IO_POLL OP code.
1457 @param Script The pointer of typed node in boot script table
1458 @param AndMask Mask value for 'and' operation
1459 @param OrMask Mask value for 'or' operation
1461 @retval EFI_DEVICE_ERROR Data polled from memory does not equal to
1462 the epecting data within the Loop Times.
1463 @retval EFI_SUCCESS The operation was executed successfully
1466 BootScriptExecuteIoPoll (
1475 EFI_BOOT_SCRIPT_IO_POLL IoPoll
;
1477 CopyMem ((VOID
*)&IoPoll
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_IO_POLL
));
1479 DEBUG ((EFI_D_INFO
, "BootScriptExecuteIoPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN
)IoPoll
.Address
, AndMask
, OrMask
));
1482 Status
= ScriptIoRead (
1483 (S3_BOOT_SCRIPT_LIB_WIDTH
) IoPoll
.Width
,
1488 if ((!EFI_ERROR (Status
)) && (Data
& AndMask
) == OrMask
) {
1491 for (LoopTimes
= 0; LoopTimes
< IoPoll
.Delay
; LoopTimes
++) {
1492 NanoSecondDelay (100);
1494 Status
= ScriptIoRead (
1495 (S3_BOOT_SCRIPT_LIB_WIDTH
) IoPoll
.Width
,
1500 if ((!EFI_ERROR (Status
)) &&(Data
& AndMask
) == OrMask
) {
1505 if (LoopTimes
< IoPoll
.Delay
) {
1508 return EFI_DEVICE_ERROR
;
1512 Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE OP code.
1514 @param Script The pointer of S3 boot script
1516 @retval EFI_SUCCESS The operation was executed successfully
1520 BootScriptExecutePciCfg2Write (
1525 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
1529 EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE PciCfg2Write
;
1531 CopyMem ((VOID
*)&PciCfg2Write
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE
));
1533 Width
= (S3_BOOT_SCRIPT_LIB_WIDTH
)PciCfg2Write
.Width
;
1534 Segment
= PciCfg2Write
.Segment
;
1535 Address
= PciCfg2Write
.Address
;
1536 Count
= PciCfg2Write
.Count
;
1537 Buffer
= Script
+ sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE
);
1539 DEBUG ((EFI_D_INFO
, "BootScriptExecutePciCfg2Write - 0x%04x, 0x%08x, 0x%08x, 0x%08x\n", Segment
, PCI_ADDRESS_ENCODE (Address
), Count
, (UINTN
)Width
));
1540 return ScriptPciCfg2Write (Width
, Segment
, Address
, Count
, Buffer
);
1545 Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE OP code.
1547 @param Script The pointer of S3 boot script
1548 @param AndMask Mask value for 'and' operation
1549 @param OrMask Mask value for 'or' operation
1551 @retval EFI_SUCCESS The operation was executed successfully
1555 BootScriptExecutePciCfg2ReadWrite (
1563 EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE PciCfg2ReadWrite
;
1564 CopyMem ((VOID
*)&PciCfg2ReadWrite
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE
));
1566 DEBUG ((EFI_D_INFO
, "BootScriptExecutePciCfg2ReadWrite - 0x%04x, 0x%08x, 0x%016lx, 0x%016lx\n", PciCfg2ReadWrite
.Segment
, PCI_ADDRESS_ENCODE (PciCfg2ReadWrite
.Address
), AndMask
, OrMask
));
1568 Status
= ScriptPciCfg2Read (
1569 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfg2ReadWrite
.Width
,
1570 PciCfg2ReadWrite
.Segment
,
1571 PciCfg2ReadWrite
.Address
,
1575 if (EFI_ERROR (Status
)) {
1579 Data
= (Data
& AndMask
) | OrMask
;
1580 Status
= ScriptPciCfg2Write (
1581 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfg2ReadWrite
.Width
,
1582 PciCfg2ReadWrite
.Segment
,
1583 PciCfg2ReadWrite
.Address
,
1590 Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG_POLL OP code.
1592 @param Script The pointer of S3 boot script
1593 @param AndMask Mask value for 'and' operation
1594 @param OrMask Mask value for 'or' operation
1596 @retval EFI_SUCCESS The operation was executed successfully
1597 @retval EFI_DEVICE_ERROR Data polled from Pci configuration space does not equal to
1598 epecting data within the Loop Times.
1601 BootScriptPciCfgPoll (
1610 EFI_BOOT_SCRIPT_PCI_CONFIG_POLL PciCfgPoll
;
1611 CopyMem ((VOID
*)&PciCfgPoll
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_POLL
));
1613 DEBUG ((EFI_D_INFO
, "BootScriptPciCfgPoll - 0x%08x, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfgPoll
.Address
), AndMask
, OrMask
));
1616 Status
= ScriptPciCfgRead (
1617 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfgPoll
.Width
,
1622 if ((!EFI_ERROR (Status
)) &&(Data
& AndMask
) == OrMask
) {
1626 for (LoopTimes
= 0; LoopTimes
< PciCfgPoll
.Delay
; LoopTimes
++) {
1627 NanoSecondDelay (100);
1629 Status
= ScriptPciCfgRead (
1630 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfgPoll
.Width
,
1635 if ((!EFI_ERROR (Status
)) &&
1636 (Data
& AndMask
) == OrMask
) {
1641 if (LoopTimes
< PciCfgPoll
.Delay
) {
1644 return EFI_DEVICE_ERROR
;
1649 Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL OP code.
1651 @param Script The pointer of S3 Boot Script
1652 @param AndMask Mask value for 'and' operation
1653 @param OrMask Mask value for 'or' operation
1655 @retval EFI_SUCCESS The operation was executed successfully
1656 @retval EFI_DEVICE_ERROR Data polled from Pci configuration space does not equal to
1657 epecting data within the Loop Times.
1661 BootScriptPciCfg2Poll (
1670 EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL PciCfg2Poll
;
1673 CopyMem ((VOID
*)&PciCfg2Poll
, (VOID
*)Script
, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL
));
1675 DEBUG ((EFI_D_INFO
, "BootScriptPciCfg2Poll - 0x%04x, 0x%08x, 0x%016lx, 0x%016lx\n", PciCfg2Poll
.Segment
, PCI_ADDRESS_ENCODE (PciCfg2Poll
.Address
), AndMask
, OrMask
));
1677 Status
= ScriptPciCfg2Read (
1678 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfg2Poll
.Width
,
1679 PciCfg2Poll
.Segment
,
1680 PciCfg2Poll
.Address
,
1684 if ((!EFI_ERROR (Status
)) && (Data
& AndMask
) == OrMask
) {
1688 for (LoopTimes
= 0; LoopTimes
< PciCfg2Poll
.Delay
; LoopTimes
++) {
1689 NanoSecondDelay (100);
1692 Status
= ScriptPciCfg2Read (
1693 (S3_BOOT_SCRIPT_LIB_WIDTH
) PciCfg2Poll
.Width
,
1694 PciCfg2Poll
.Segment
,
1695 PciCfg2Poll
.Address
,
1699 if ((!EFI_ERROR (Status
)) && (Data
& AndMask
) == OrMask
) {
1704 if (LoopTimes
< PciCfg2Poll
.Delay
) {
1707 return EFI_DEVICE_ERROR
;
1713 Executes the S3 boot script table.
1715 @retval RETURN_SUCCESS The boot script table was executed successfully.
1716 @retval RETURN_UNSUPPORTED Invalid script table or opcode.
1718 @note A known Limitations in the implementation: When interpreting the opcode EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE
1719 EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE and EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE, the 'Segment' parameter is assumed as
1720 Zero, or else, assert.
1724 S3BootScriptExecute (
1734 EFI_BOOT_SCRIPT_COMMON_HEADER ScriptHeader
;
1735 EFI_BOOT_SCRIPT_TABLE_HEADER TableHeader
;
1736 Script
= mS3BootScriptTablePtr
->TableBase
;
1738 CopyMem ((VOID
*)&TableHeader
, Script
, sizeof(EFI_BOOT_SCRIPT_TABLE_HEADER
));
1740 return EFI_INVALID_PARAMETER
;
1743 DEBUG ((EFI_D_INFO
, "S3BootScriptExecute:\n"));
1744 if (TableHeader
.OpCode
!= S3_BOOT_SCRIPT_LIB_TABLE_OPCODE
) {
1745 return EFI_UNSUPPORTED
;
1748 DEBUG ((EFI_D_INFO
, "TableHeader - 0x%08x\n", Script
));
1750 StartAddress
= (UINTN
) Script
;
1751 TableLength
= TableHeader
.TableLength
;
1752 Script
= Script
+ TableHeader
.Length
;
1753 Status
= EFI_SUCCESS
;
1757 DEBUG ((EFI_D_INFO
, "TableHeader.TableLength - 0x%08x\n", (UINTN
)TableLength
));
1759 while ((UINTN
) Script
< (UINTN
) (StartAddress
+ TableLength
)) {
1760 DEBUG ((EFI_D_INFO
, "ExecuteBootScript - %08x\n", (UINTN
)Script
));
1762 CopyMem ((VOID
*)&ScriptHeader
, Script
, sizeof(EFI_BOOT_SCRIPT_COMMON_HEADER
));
1763 switch (ScriptHeader
.OpCode
) {
1765 case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE
:
1766 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE\n"));
1767 Status
= BootScriptExecuteMemoryWrite (Script
);
1770 case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE
:
1771 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE\n"));
1772 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1773 Status
= BootScriptExecuteMemoryReadWrite (
1780 case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE
:
1781 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_IO_WRITE_OPCODE\n"));
1782 Status
= BootScriptExecuteIoWrite (Script
);
1785 case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE
:
1786 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE\n"));
1787 Status
= BootScriptExecutePciCfgWrite (Script
);
1790 case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE
:
1791 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE\n"));
1792 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1793 Status
= BootScriptExecutePciCfgReadWrite (
1799 case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE
:
1800 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE\n"));
1801 Status
= BootScriptExecutePciCfg2Write (Script
);
1804 case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE
:
1805 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE\n"));
1806 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1807 Status
= BootScriptExecutePciCfg2ReadWrite (
1813 case EFI_BOOT_SCRIPT_DISPATCH_OPCODE
:
1814 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_DISPATCH_OPCODE\n"));
1815 Status
= BootScriptExecuteDispatch (Script
);
1818 case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE
:
1819 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE\n"));
1820 Status
= BootScriptExecuteDispatch2 (Script
);
1823 case EFI_BOOT_SCRIPT_INFORMATION_OPCODE
:
1824 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_INFORMATION_OPCODE\n"));
1825 BootScriptExecuteInformation (Script
);
1828 case S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE
:
1829 DEBUG ((EFI_D_INFO
, "S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE\n"));
1830 DEBUG ((EFI_D_INFO
, "S3BootScriptDone - %r\n", EFI_SUCCESS
));
1833 case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE
:
1834 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE\n"));
1835 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1836 Status
= BootScriptExecuteIoReadWrite (
1843 case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE
:
1844 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE\n"));
1845 Status
= BootScriptExecuteSmbusExecute (Script
);
1848 case EFI_BOOT_SCRIPT_STALL_OPCODE
:
1849 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_STALL_OPCODE\n"));
1850 Status
= BootScriptExecuteStall (Script
);
1853 case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE
:
1854 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_MEM_POLL_OPCODE\n"));
1855 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1856 Status
= BootScriptExecuteMemPoll (Script
, AndMask
, OrMask
);
1860 case EFI_BOOT_SCRIPT_IO_POLL_OPCODE
:
1861 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_IO_POLL_OPCODE\n"));
1862 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1863 Status
= BootScriptExecuteIoPoll (Script
, AndMask
, OrMask
);
1866 case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE
:
1867 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE\n"));
1868 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1869 Status
= BootScriptPciCfgPoll (Script
, AndMask
, OrMask
);
1872 case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE
:
1873 DEBUG ((EFI_D_INFO
, "EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE\n"));
1874 CheckAndOrMask (&ScriptHeader
, &AndMask
, &OrMask
, Script
);
1875 Status
= BootScriptPciCfg2Poll (Script
, AndMask
, OrMask
);
1878 case S3_BOOT_SCRIPT_LIB_LABEL_OPCODE
:
1882 DEBUG ((EFI_D_INFO
, "S3_BOOT_SCRIPT_LIB_LABEL_OPCODE\n"));
1883 BootScriptExecuteLabel (Script
);
1886 DEBUG ((EFI_D_INFO
, "S3BootScriptDone - %r\n", EFI_UNSUPPORTED
));
1887 return EFI_UNSUPPORTED
;
1890 if (EFI_ERROR (Status
)) {
1891 DEBUG ((EFI_D_INFO
, "S3BootScriptDone - %r\n", Status
));
1895 Script
= Script
+ ScriptHeader
.Length
;
1898 DEBUG ((EFI_D_INFO
, "S3BootScriptDone - %r\n", Status
));