示例#1
0
AGESA_STATUS agesawrapper_amdS3Save(void)
{
	AGESA_STATUS Status;
	AMD_S3SAVE_PARAMS *AmdS3SaveParamsPtr;
	AMD_INTERFACE_PARAMS  AmdInterfaceParams;
	S3_DATA_TYPE          S3DataType;

	LibAmdMemFill (&AmdInterfaceParams,
		       0,
		       sizeof (AMD_INTERFACE_PARAMS),
		       &(AmdInterfaceParams.StdHeader));

	AmdInterfaceParams.StdHeader.ImageBasePtr = 0;
	AmdInterfaceParams.StdHeader.HeapStatus = HEAP_SYSTEM_MEM;
	AmdInterfaceParams.StdHeader.CalloutPtr = &GetBiosCallout;
	AmdInterfaceParams.AllocationMethod = PostMemDram;
	AmdInterfaceParams.AgesaFunctionName = AMD_S3_SAVE;
	AmdInterfaceParams.StdHeader.AltImageBasePtr = 0;
	AmdInterfaceParams.StdHeader.Func = 0;

	AmdCreateStruct(&AmdInterfaceParams);
	AmdS3SaveParamsPtr = (AMD_S3SAVE_PARAMS *)AmdInterfaceParams.NewStructPtr;
	AmdS3SaveParamsPtr->StdHeader = AmdInterfaceParams.StdHeader;

	Status = AmdS3Save(AmdS3SaveParamsPtr);
	if (Status != AGESA_SUCCESS) {
		agesawrapper_amdreadeventlog(AmdInterfaceParams.StdHeader.HeapStatus);
		ASSERT(Status == AGESA_SUCCESS);
	}

	S3DataType = S3DataTypeNonVolatile;
	printk(BIOS_DEBUG, "NvStorageSize=%x, NvStorage=%x\n",
	       (unsigned int)AmdS3SaveParamsPtr->S3DataBlock.NvStorageSize,
	       (unsigned int)AmdS3SaveParamsPtr->S3DataBlock.NvStorage);

	Status = OemAgesaSaveS3Info (
		S3DataType,
		AmdS3SaveParamsPtr->S3DataBlock.NvStorageSize,
		AmdS3SaveParamsPtr->S3DataBlock.NvStorage);

	printk(BIOS_DEBUG, "VolatileStorageSize=%x, VolatileStorage=%x\n",
	       (unsigned int)AmdS3SaveParamsPtr->S3DataBlock.VolatileStorageSize,
	       (unsigned int)AmdS3SaveParamsPtr->S3DataBlock.VolatileStorage);

	if (AmdS3SaveParamsPtr->S3DataBlock.VolatileStorageSize != 0) {
		S3DataType = S3DataTypeVolatile;

		Status = OemAgesaSaveS3Info (
			S3DataType,
			AmdS3SaveParamsPtr->S3DataBlock.VolatileStorageSize,
			AmdS3SaveParamsPtr->S3DataBlock.VolatileStorage);
	}
	OemAgesaSaveMtrr();

	AmdReleaseStruct (&AmdInterfaceParams);

	return Status;
}
示例#2
0
VOID
EFIAPI
AgesaInitRtb (
  IN EFI_EVENT        Event,
  IN VOID             *Context
  )
/*++

Routine Description:

  Do last minute configuration and preparation for system suspend-to-RAM mode.
  This function gets called each time the EFI_EVENT_SIGNAL_READY_TO_BOOT gets signaled

Arguments & Return Values: Standard event handling function prototype

--*/
{
  EFI_STATUS            Status;
  AMD_INTERFACE_PARAMS  AmdInterfaceParams;
  AMD_RTB_PARAMS       *AmdInitRtbParamsPtr;
  AGESA_STATUS          AgesaStatus;
  S3_DATA_TYPE          S3DataType;

  //
  // Prepare for S3Save
  //
  AmdInterfaceParams.StdHeader.ImageBasePtr = 0;
  AmdInterfaceParams.StdHeader.HeapStatus = HEAP_SYSTEM_MEM;
  AmdInterfaceParams.AllocationMethod = PostMemDram;
  AmdInterfaceParams.AgesaFunctionName = AMD_INIT_RTB;

  AgesaStatus = AmdCreateStruct (&AmdInterfaceParams);
  AmdInitRtbParamsPtr = (AMD_RTB_PARAMS *) AmdInterfaceParams.NewStructPtr;
  //
  // OEM hook to customize any S3 Info required
  //
  OemCustomizeInitRtb (gBS, AmdInitRtbParamsPtr);

  AgesaStatus = AmdInitRtb (AmdInitRtbParamsPtr);

  if (AgesaStatus !=  AGESA_SUCCESS) {
    return;
  }

  if (AmdInitRtbParamsPtr->S3DataBlock.NvStorageSize != 0) {
    S3DataType = S3DataTypeNonVolatile;

    Status = OemAgesaSaveS3Info (
      S3DataType,
      AmdInitRtbParamsPtr->S3DataBlock.NvStorageSize,
      AmdInitRtbParamsPtr->S3DataBlock.NvStorage
      );
  }

  if (AmdInitRtbParamsPtr->S3DataBlock.VolatileStorageSize != 0) {
    S3DataType = S3DataTypeVolatile;

    Status = OemAgesaSaveS3Info (
      S3DataType,
      AmdInitRtbParamsPtr->S3DataBlock.VolatileStorageSize,
      AmdInitRtbParamsPtr->S3DataBlock.VolatileStorage
      );
  }

  //
  // Close this event to avoid any alternate run
  //
  gBS->CloseEvent (Event);
}