/** Saves an SMBus operation to S3 script to be replayed on S3 resume. This function provides a standard way to save SMBus operation to S3 boot Script. The data can either be of the Length byte, word, or a block of data. If it falis to save S3 boot script, then ASSERT (). @param SmbusOperation Signifies which particular SMBus hardware protocol instance that it will use to execute the SMBus transactions. @param SmBusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC. @param Length Signifies the number of bytes that this operation will do. The maximum number of bytes can be revision specific and operation specific. @param Buffer Contains the value of data to execute to the SMBus slave device. Not all operations require this argument. The length of this buffer is identified by Length. **/ VOID InternalSaveSmBusExecToBootScript ( IN EFI_SMBUS_OPERATION SmbusOperation, IN UINTN SmBusAddress, IN UINTN Length, IN OUT VOID *Buffer ) { RETURN_STATUS Status; Status = S3BootScriptSaveSmbusExecute ( SmBusAddress, SmbusOperation, &Length, Buffer ); ASSERT (Status == RETURN_SUCCESS); }
/** Internal function to add smbus execute opcode to the table. @param Marker The variable argument list to get the opcode and associated attributes. @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation. @retval EFI_SUCCESS Opcode is added. **/ EFI_STATUS BootScriptWriteSmbusExecute ( IN VA_LIST Marker ) { EFI_SMBUS_DEVICE_ADDRESS SlaveAddress; EFI_SMBUS_DEVICE_COMMAND Command; EFI_SMBUS_OPERATION Operation; BOOLEAN PecCheck; VOID *Buffer; UINTN *DataSize; UINTN SmBusAddress; SlaveAddress.SmbusDeviceAddress = VA_ARG (Marker, UINTN); Command = VA_ARG (Marker, EFI_SMBUS_DEVICE_COMMAND); Operation = VA_ARG (Marker, EFI_SMBUS_OPERATION); PecCheck = VA_ARG (Marker, BOOLEAN); SmBusAddress = SMBUS_LIB_ADDRESS (SlaveAddress.SmbusDeviceAddress,Command,0,PecCheck); DataSize = VA_ARG (Marker, UINTN *); Buffer = VA_ARG (Marker, VOID *); return S3BootScriptSaveSmbusExecute (SmBusAddress, Operation, DataSize, Buffer); }