/* Translates boot script width and address stride to MDE library interface. */
EFI_STATUS BuildLoopData(IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, OUT UINTN *AddressStride, OUT UINTN *BufferStride)
/* Translates boot script width and address stride to MDE library interface. */
EFI_STATUS BuildLoopData(IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, OUT UINTN *AddressStride, OUT UINTN *BufferStride)
{
  UINTN  AlignMask;
  if (Width >= S3BootScriptWidthMaximum) {
    return EFI_INVALID_PARAMETER;
  }
  *AddressStride = (UINT32)(1 << (Width & 0x03));
  *BufferStride  = *AddressStride;
  AlignMask = *AddressStride - 1;
  if ((Address & AlignMask) != 0) {
    return EFI_INVALID_PARAMETER;
  }
  if ((Width >= S3BootScriptWidthFifoUint8) && (Width <= S3BootScriptWidthFifoUint64)) {
    *AddressStride = 0;
  }
  if ((Width >= S3BootScriptWidthFillUint8) && (Width <= S3BootScriptWidthFillUint64)) {
    *BufferStride = 0;
  }
  return EFI_SUCCESS;
}