/** @file\r
Implementation for S3 Boot Script Saver state driver.\r
\r
- Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
Address = VA_ARG (Marker, UINT64);\r
Count = VA_ARG (Marker, UINTN);\r
Buffer = VA_ARG (Marker, UINT8 *);\r
- \r
+\r
return S3BootScriptSaveIoWrite (Width, Address, Count, Buffer);\r
}\r
/**\r
UINT64 Address;\r
UINT8 *Data;\r
UINT8 *DataMask;\r
- \r
+\r
Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
Address = VA_ARG (Marker, UINT64);\r
Data = VA_ARG (Marker, UINT8 *);\r
DataMask = VA_ARG (Marker, UINT8 *);\r
- \r
+\r
return S3BootScriptSaveIoReadWrite (Width, Address, Data, DataMask);\r
}\r
\r
UINT64 Address;\r
UINTN Count;\r
UINT8 *Buffer;\r
- \r
+\r
Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
Address = VA_ARG (Marker, UINT64);\r
Count = VA_ARG (Marker, UINTN);\r
UINT64 Address;\r
UINT8 *Data;\r
UINT8 *DataMask;\r
- \r
+\r
Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
Address = VA_ARG (Marker, UINT64);\r
Data = VA_ARG (Marker, UINT8 *);\r
UINT16 Segment;\r
\r
Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
+ Segment = VA_ARG (Marker, UINT16);\r
Address = VA_ARG (Marker, UINT64);\r
Count = VA_ARG (Marker, UINTN);\r
Buffer = VA_ARG (Marker, UINT8 *);\r
- Segment = VA_ARG (Marker, UINT16);\r
\r
return S3BootScriptSavePciCfg2Write (Width, Segment, Address, Count, Buffer);\r
}\r
UINT64 Address;\r
UINT8 *Data;\r
UINT8 *DataMask;\r
- \r
+\r
Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
- Address = VA_ARG (Marker, UINT64);\r
Segment = VA_ARG (Marker, UINT16);\r
+ Address = VA_ARG (Marker, UINT64);\r
Data = VA_ARG (Marker, UINT8 *);\r
DataMask = VA_ARG (Marker, UINT8 *);\r
- \r
+\r
return S3BootScriptSavePciCfg2ReadWrite (Width, Segment, Address, Data, DataMask);\r
}\r
/**\r
VOID *Buffer;\r
UINTN *DataSize;\r
UINTN SmBusAddress;\r
- \r
+\r
SlaveAddress.SmbusDeviceAddress = VA_ARG (Marker, UINTN);\r
Command = VA_ARG (Marker, EFI_SMBUS_DEVICE_COMMAND);\r
Operation = VA_ARG (Marker, EFI_SMBUS_OPERATION);\r
PecCheck = VA_ARG (Marker, BOOLEAN);\r
SmBusAddress = SMBUS_LIB_ADDRESS (SlaveAddress.SmbusDeviceAddress,Command,0,PecCheck);\r
- DataSize = VA_ARG (Marker, UINTN *); \r
+ DataSize = VA_ARG (Marker, UINTN *);\r
Buffer = VA_ARG (Marker, VOID *);\r
- \r
+\r
return S3BootScriptSaveSmbusExecute (SmBusAddress, Operation, DataSize, Buffer);\r
}\r
/**\r
}\r
\r
/**\r
- Internal function to add Save jmp address according to DISPATCH_OPCODE. \r
+ Internal function to add Save jmp address according to DISPATCH_OPCODE.\r
We ignore "Context" parameter\r
\r
@param Marker The variable argument list to get the opcode\r
}\r
\r
/**\r
- Internal function to add memory pool operation to the table. \r
- \r
+ Internal function to add memory pool operation to the table.\r
+\r
@param Marker The variable argument list to get the opcode\r
and associated attributes.\r
\r
IN VA_LIST Marker\r
)\r
{\r
- S3_BOOT_SCRIPT_LIB_WIDTH Width; \r
- UINT64 Address; \r
- VOID *Data; \r
- VOID *DataMask; \r
- UINTN Delay; \r
- UINTN LoopTimes;\r
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
+ UINT64 Address;\r
+ VOID *Data;\r
+ VOID *DataMask;\r
+ UINT64 Delay;\r
+ UINT64 LoopTimes;\r
UINT32 Remainder;\r
\r
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH); \r
- Address = VA_ARG (Marker, UINT64); \r
- Data = VA_ARG (Marker, VOID *); \r
- DataMask = VA_ARG (Marker, VOID *); \r
- Delay = (UINTN)VA_ARG (Marker, UINT64); \r
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
+ Address = VA_ARG (Marker, UINT64);\r
+ Data = VA_ARG (Marker, VOID *);\r
+ DataMask = VA_ARG (Marker, VOID *);\r
+ Delay = VA_ARG (Marker, UINT64);\r
//\r
// According to the spec, the interval between 2 polls is 100ns,\r
// but the unit of Duration for S3BootScriptSaveMemPoll() is microsecond(1000ns).\r
// Duration will be minimum 1(microsecond) to be minimum deviation,\r
// so LoopTimes = Delay / 10.\r
//\r
- LoopTimes = (UINTN) DivU64x32Remainder (\r
+ LoopTimes = DivU64x32Remainder (\r
Delay,\r
10,\r
&Remainder\r
}\r
\r
/**\r
- Internal function to add Save jmp address according to DISPATCH_OPCODE2. \r
+ Internal function to add Save jmp address according to DISPATCH_OPCODE2.\r
The "Context" parameter is not ignored.\r
\r
@param Marker The variable argument list to get the opcode\r
)\r
{\r
VOID *EntryPoint;\r
- VOID *Context; \r
+ VOID *Context;\r
\r
EntryPoint = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);\r
Context = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);\r
)\r
{\r
UINT32 InformationLength;\r
- EFI_PHYSICAL_ADDRESS Information; \r
+ EFI_PHYSICAL_ADDRESS Information;\r
\r
InformationLength = VA_ARG (Marker, UINT32);\r
Information = VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);\r
)\r
{\r
S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
- UINT64 Address; \r
- VOID *Data; \r
- VOID *DataMask; \r
- UINT64 Delay; \r
- \r
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH); \r
- Address = VA_ARG (Marker, UINT64); \r
- Data = VA_ARG (Marker, VOID *); \r
- DataMask = VA_ARG (Marker, VOID *); \r
- Delay = (UINT64)VA_ARG (Marker, UINT64); \r
- \r
+ UINT64 Address;\r
+ VOID *Data;\r
+ VOID *DataMask;\r
+ UINT64 Delay;\r
+\r
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
+ Address = VA_ARG (Marker, UINT64);\r
+ Data = VA_ARG (Marker, VOID *);\r
+ DataMask = VA_ARG (Marker, VOID *);\r
+ Delay = (UINT64)VA_ARG (Marker, UINT64);\r
+\r
return S3BootScriptSaveIoPoll (Width, Address, Data, DataMask, Delay);\r
}\r
/**\r
VOID *DataMask;\r
UINT64 Delay;\r
\r
- \r
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH); \r
- Address = VA_ARG (Marker, UINT64); \r
- Data = VA_ARG (Marker, VOID *); \r
- DataMask = VA_ARG (Marker, VOID *); \r
- Delay = (UINT64)VA_ARG (Marker, UINT64); \r
- \r
+\r
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
+ Address = VA_ARG (Marker, UINT64);\r
+ Data = VA_ARG (Marker, VOID *);\r
+ DataMask = VA_ARG (Marker, VOID *);\r
+ Delay = (UINT64)VA_ARG (Marker, UINT64);\r
+\r
return S3BootScriptSavePciPoll (Width, Address, Data, DataMask, Delay);\r
}\r
/**\r
VOID *Data;\r
VOID *DataMask;\r
UINT64 Delay;\r
- \r
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH); \r
- Segment = VA_ARG (Marker, UINT16); \r
- Address = VA_ARG (Marker, UINT64); \r
- Data = VA_ARG (Marker, VOID *); \r
- DataMask = VA_ARG (Marker, VOID *); \r
- Delay = (UINT64)VA_ARG (Marker, UINT64); \r
- \r
+\r
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
+ Segment = VA_ARG (Marker, UINT16);\r
+ Address = VA_ARG (Marker, UINT64);\r
+ Data = VA_ARG (Marker, VOID *);\r
+ DataMask = VA_ARG (Marker, VOID *);\r
+ Delay = (UINT64)VA_ARG (Marker, UINT64);\r
+\r
return S3BootScriptSavePci2Poll (Width, Segment, Address, Data, DataMask, Delay);\r
}\r
\r
Adds a record into S3 boot script table.\r
\r
This function is used to store a boot script record into a given boot\r
- script table. If the table specified by TableName is nonexistent in the \r
- system, a new table will automatically be created and then the script record \r
- will be added into the new table. This function is responsible for allocating \r
+ script table. If the table specified by TableName is nonexistent in the\r
+ system, a new table will automatically be created and then the script record\r
+ will be added into the new table. This function is responsible for allocating\r
necessary memory for the script.\r
\r
- This function has a variable parameter list. The exact parameter list depends on \r
- the OpCode that is passed into the function. If an unsupported OpCode or illegal \r
+ This function has a variable parameter list. The exact parameter list depends on\r
+ the OpCode that is passed into the function. If an unsupported OpCode or illegal\r
parameter list is passed in, this function returns EFI_INVALID_PARAMETER.\r
If there are not enough resources available for storing more scripts, this function returns\r
EFI_OUT_OF_RESOURCES.\r
\r
@param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
@param OpCode The operation code (opcode) number.\r
- @param ... Argument list that is specific to each opcode. \r
- \r
+ @param ... Argument list that is specific to each opcode.\r
+\r
@retval EFI_SUCCESS The operation succeeded. A record was added into the\r
specified script table.\r
@retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r
- If the opcode is unknow or not supported because of the PCD \r
+ If the opcode is unknow or not supported because of the PCD\r
Feature Flags.\r
@retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r
\r
EFIAPI\r
BootScriptWrite (\r
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r
- IN UINT16 OpCode,\r
+ IN UINTN OpCode,\r
...\r
)\r
{\r
EFI_STATUS Status;\r
- VA_LIST Marker; \r
+ VA_LIST Marker;\r
//\r
// Build script according to opcode\r
//\r
case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:\r
VA_START (Marker, OpCode);\r
Status = BootScriptWriteMemWrite (Marker);\r
- VA_END (Marker); \r
+ VA_END (Marker);\r
break;\r
\r
case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:\r
VA_START (Marker, OpCode);\r
Status = BootScriptWriteStall (Marker);\r
VA_END (Marker);\r
- \r
+\r
break;\r
\r
case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:\r
VA_END (Marker);\r
break;\r
\r
- case EFI_BOOT_SCRIPT_IO_POLL_OPCODE: \r
+ case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:\r
VA_START (Marker, OpCode);\r
Status = BootScriptWriteIoPoll (Marker);\r
VA_END (Marker);\r
- break; \r
- \r
- case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE: \r
+ break;\r
+\r
+ case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:\r
VA_START (Marker, OpCode);\r
Status = BootScriptWritePciConfigPoll (Marker);\r
VA_END (Marker);\r
- break; \r
- \r
+ break;\r
+\r
case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:\r
VA_START (Marker, OpCode);\r
Status = BootScriptWritePciConfig2Poll (Marker);\r
VA_END (Marker);\r
- break; \r
+ break;\r
\r
default:\r
Status = EFI_INVALID_PARAMETER;\r
inserted, either before or after, depending on BeforeOrAfter. On exit, specifies\r
the position of the inserted opcode in the boot script table.\r
@param OpCode The operation code (opcode) number.\r
- @param ... Argument list that is specific to each opcode. \r
+ @param ... Argument list that is specific to each opcode.\r
\r
@retval EFI_SUCCESS The operation succeeded. A record was added into the\r
specified script table.\r
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r
IN BOOLEAN BeforeOrAfter,\r
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,\r
- IN UINT16 OpCode,\r
+ IN UINTN OpCode,\r
...\r
)\r
{\r
EFI_STATUS Status;\r
- VA_LIST Marker; \r
+ VA_LIST Marker;\r
//\r
// Build script according to opcode\r
//\r
case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:\r
VA_START (Marker, OpCode);\r
Status = BootScriptWriteMemWrite (Marker);\r
- VA_END (Marker); \r
+ VA_END (Marker);\r
break;\r
\r
case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:\r
VA_START (Marker, OpCode);\r
Status = BootScriptWriteStall (Marker);\r
VA_END (Marker);\r
- \r
+\r
break;\r
\r
case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:\r
Status = BootScriptWritePciCfg2ReadWrite (Marker);\r
VA_END (Marker);\r
break;\r
- \r
- case EFI_BOOT_SCRIPT_IO_POLL_OPCODE: \r
+\r
+ case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:\r
VA_START (Marker, OpCode);\r
Status = BootScriptWriteIoPoll (Marker);\r
VA_END (Marker);\r
- break; \r
- \r
- case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE: \r
+ break;\r
+\r
+ case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:\r
VA_START (Marker, OpCode);\r
Status = BootScriptWritePciConfigPoll (Marker);\r
VA_END (Marker);\r
- break; \r
- \r
+ break;\r
+\r
case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:\r
VA_START (Marker, OpCode);\r
Status = BootScriptWritePciConfig2Poll (Marker);\r
VA_END (Marker);\r
- break; \r
+ break;\r
\r
default:\r
Status = EFI_INVALID_PARAMETER;\r
break;\r
}\r
- \r
+\r
if (!EFI_ERROR (Status)) {\r
Status = S3BootScriptMoveLastOpcode (BeforeOrAfter, Position);\r
}\r
@retval EFI_SUCCESS The label already exists or was inserted.\r
@retval EFI_INVALID_PARAMETER The Label is NULL or points to an empty string.\r
@retval EFI_INVALID_PARAMETER The Position is not a valid position in the boot script table.\r
- \r
+\r
**/\r
EFI_STATUS\r
EFIAPI\r
IN CONST CHAR8 *Label\r
)\r
{\r
- return S3BootScriptLabel (BeforeOrAfter, CreateIfNotFound, Position, Label);\r
+ return S3BootScriptLabel (BeforeOrAfter, CreateIfNotFound, Position, Label);\r
}\r
/**\r
Compare two positions in the boot script table and return their relative position.\r
- \r
+\r
This function compares two positions in the boot script table and returns their relative positions. If\r
Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2,\r
then 0 is returned. If Position1 is after Position2, then 1 is returned.\r
- \r
+\r
@param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
@param Position1 The positions in the boot script table to compare\r
@param Position2 The positions in the boot script table to compare\r
@param RelativePosition On return, points to the result of the comparison\r
\r
- @retval EFI_SUCCESS The operation succeeded. \r
+ @retval EFI_SUCCESS The operation succeeded.\r
@retval EFI_INVALID_PARAMETER The Position1 or Position2 is not a valid position in the boot script table.\r
@retval EFI_INVALID_PARAMETER The RelativePosition is NULL.\r
\r
**/\r
EFI_STATUS\r
-EFIAPI \r
+EFIAPI\r
BootScriptCompare (\r
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r
IN EFI_S3_BOOT_SCRIPT_POSITION Position1,\r
OUT UINTN *RelativePosition\r
)\r
{\r
- return S3BootScriptCompare (Position1, Position2, RelativePosition);\r
+ return S3BootScriptCompare (Position1, Position2, RelativePosition);\r
}\r
/**\r
This routine is entry point of ScriptSave driver.\r