Exemple #1
0
/**
  FSP Init continuation function.
  Control will be returned to this callback function after FspInit API call.

  @param[in] Status      Status of the FSP INIT API
  @param[in] HobListPtr  Pointer to the HOB data structure defined in the PI specification.

**/
VOID
ContinuationFunc (
  IN EFI_STATUS Status,
  IN VOID       *HobListPtr
  )
{
  EFI_BOOT_MODE             BootMode;
  UINT64                    StackSize;
  EFI_PHYSICAL_ADDRESS      StackBase;

  DEBUG ((DEBUG_INFO, "ContinuationFunc - %r\n", Status));
  DEBUG ((DEBUG_INFO, "HobListPtr - 0x%x\n", HobListPtr));

  if (Status != EFI_SUCCESS) {
    CpuDeadLoop ();
  }

  //
  // Can not call any PeiServices
  //
  BootMode = GetBootMode ();

  GetStackInfo (BootMode, TRUE, &StackBase, &StackSize);
  DEBUG ((DEBUG_INFO, "StackBase - 0x%x\n", StackBase));
  DEBUG ((DEBUG_INFO, "StackSize - 0x%x\n", StackSize));
  CallPeiCoreEntryPoint (
    HobListPtr,
    (VOID *)(UINTN)StackBase,
    (VOID *)(UINTN)(StackBase + StackSize)
    );
}
Exemple #2
0
EFI_STATUS BootGuardDxe(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
    ...

    if ( BootGuardSupported() == FALSE ) {
        return   EFI_SUCCESS;
    }

    ...

    BootMode  = GetBootMode();
    if ( (BootMode == BOOT_IN_RECOVERY_MODE) || (BootMode == BOOT_ON_FLASH_UPDATE) ) {
        return   EFI_SUCCESS;
    }

    ...

    if ( BootGuardVerifyTransitionPEItoDXEFlag == 0 ) {
        BootGuardRegisterCallBack();
    }

    return   EFI_SUCCESS;
}
Exemple #3
0
void MyPictures_Init( void )
{
	int					nHDD, i;
	char				szPfs[32];
	const char			*pMnt;
	const smbShare_t	*smbShare;

	szCurDir[0]	= 0;
	nNumFiles	= 0;

	GUI_Ctrl_ThumbnailPanel_Clean( GUI_ControlByID(ID_THUMBNAIL_PANEL) );

	if( (nHDD = HDD_Available()) )
	{
		if( nHDD == HDD_AVAIL )
		{
			fileInfo[ nNumFiles ].flags		= FLAG_DIRECTORY;
			fileInfo[ nNumFiles ].size		= 0;

			strcpy( fileInfo[ nNumFiles ].name, "pfs0:/" );

			nNumFiles++;

			// add boot partition
			if( GetBootMode() == BOOT_HDD )
			{
				if( (pMnt = BootMntPoint()) )
				{
					if( strcmp( pMnt, "pfs0" ) )
					{
						fileInfo[ nNumFiles ].flags		= FLAG_DIRECTORY;
						fileInfo[ nNumFiles ].size		= 0;

						strcpy( fileInfo[ nNumFiles ].name, "pfs1:/" );

						nNumFiles++;
					}
				}
			}
		}

		// add other mounted partitions to list
		for( i = 0; i < HDD_NumMounted(); i++ )
		{
			snprintf( szPfs, sizeof(szPfs), "pfs%i:/", i + 2 );

			fileInfo[ nNumFiles ].flags		= FLAG_DIRECTORY;
			fileInfo[ nNumFiles ].size		= 0;

			strcpy( fileInfo[ nNumFiles ].name, szPfs );

			nNumFiles++;
		}
	}

	if( MC_Available(0) )
	{
		fileInfo[ nNumFiles ].flags		= FLAG_DIRECTORY;
		fileInfo[ nNumFiles ].size		= 0;

		strcpy( fileInfo[ nNumFiles ].name, "mc0:/" );

		nNumFiles++;
	}

	if( MC_Available(1) )
	{
		fileInfo[ nNumFiles ].flags		= FLAG_DIRECTORY;
		fileInfo[ nNumFiles ].size		= 0;

		strcpy( fileInfo[ nNumFiles ].name, "mc1:/" );

		nNumFiles++;
	}

	if( USB_Available() )
	{
		fileInfo[ nNumFiles ].flags		= FLAG_DIRECTORY;
		fileInfo[ nNumFiles ].size		= 0;

		strcpy( fileInfo[ nNumFiles ].name, "mass:/" );

		nNumFiles++;
	}

	for( i = 0; i < SMB_GetNumShares(); i++ )
	{
		smbShare = SMB_GetShare(i);

		fileInfo[ nNumFiles ].flags		= FLAG_DIRECTORY;
		fileInfo[ nNumFiles ].size		= 0;

		strcpy( fileInfo[ nNumFiles ].name, smbShare->pSharePath );

		nNumFiles++;
	}

	fileInfo[ nNumFiles ].flags		= FLAG_DIRECTORY;
	fileInfo[ nNumFiles ].size		= 0;

	strcpy( fileInfo[ nNumFiles ].name, "cdfs:/" );

	nNumFiles++;

	for( i = 0; i < nNumFiles; i++ )
		GUI_Ctrl_ThumbnailPanel_AddItem( GUI_ControlByID(ID_THUMBNAIL_PANEL), &fileInfo[i] );
}
Exemple #4
0
/**

  Do memory initialisation for QNC DDR3 SDRAM Controller

  @return EFI_SUCCESS  Memory initialisation completed successfully.
          All other error conditions encountered result in an ASSERT.

**/
EFI_STATUS
MemoryInit (
  VOID
  )
{
  MRC_PARAMS                                 MrcData;
  EFI_BOOT_MODE                               BootMode;
  EFI_STATUS                                  Status;
  EFI_STATUS_CODE_VALUE                       ErrorCodeValue;
  UINT16                                      PmswAdr;
  PEI_DUAL_CHANNEL_DDR_MEMORY_MAP_RANGE MemoryMap[MAX_RANGES];
  UINT8                                 NumRanges;
  EFI_PHYSICAL_ADDRESS                  BadMemoryAddress;
  EFI_PHYSICAL_ADDRESS                  FspReservedArea;
  UINT64                                ReservedBytes;
  UINT32                                RmuMainMemoryAddress;

  ErrorCodeValue  = 0;

  //
  // It is critical that both of these data structures are initialized to 0.
  // This PEIM knows the number of DIMMs in the system and works with that
  // information.  The MCH PEIM that consumes these data structures does not
  // know the number of DIMMs so it expects the entire structure to be
  // properly initialized.  By initializing these to zero, all flags indicating
  // that the SPD is present or the row should be configured are set to false.
  //
  ZeroMem (&MrcData, sizeof(MrcData));

  //
  // Determine boot mode
  //
  BootMode = GetBootMode();

  //
  // Initialize Error type for reporting status code
  //
  switch (BootMode) {
  case BOOT_ON_FLASH_UPDATE:
    ErrorCodeValue = EFI_COMPUTING_UNIT_MEMORY + EFI_CU_MEMORY_EC_UPDATE_FAIL;
    break;
  case BOOT_ON_S3_RESUME:
    ErrorCodeValue = EFI_COMPUTING_UNIT_MEMORY + EFI_CU_MEMORY_EC_S3_RESUME_FAIL;
    break;
  default:
    ErrorCodeValue = EFI_COMPUTING_UNIT_MEMORY;
    break;
  }

  //
  // Specify MRC boot mode
  //
  switch (BootMode) {
  case BOOT_ON_S3_RESUME:
  case BOOT_ON_FLASH_UPDATE:
    MrcData.boot_mode = bmS3;
    break;
  case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:
    MrcData.boot_mode = bmFast;
    break;
  default:
    MrcData.boot_mode = bmCold;
    break;
  }

  //
  // Configure MRC input parameters.
  //
  MrcConfigureFromMcFuses (&MrcData);
  MrcConfigureFromInfoHob (&MrcData);

  if (BootMode == BOOT_IN_RECOVERY_MODE) {
    //
    // Always do bmCold on recovery.
    //
    DEBUG ((DEBUG_INFO, "MemoryInit:Force bmCold on Recovery\n"));
    MrcData.boot_mode = bmCold;
  } else {

    //
    // Get the saved memory data if possible
    //
    if ((GetMrcDataPtr() != 0) && (GetMrcDataLength() != 0)) {
      ASSERT(GetMrcDataLength() == sizeof(MrcData.timings));
      CopyMem (&MrcData.timings, (void *)GetMrcDataPtr(), GetMrcDataLength());
    } else {
      switch (BootMode) {
      case BOOT_ON_S3_RESUME:
      case BOOT_ON_FLASH_UPDATE:
        DEBUG ((DEBUG_ERROR, "ERROR: MRC data missing - reboot\n"));
        REPORT_STATUS_CODE (
          EFI_ERROR_CODE + EFI_ERROR_UNRECOVERED,
          ErrorCodeValue
        );
        return FSP_STATUS_RESET_REQUIRED_COLD;
        break;

      default:
        MrcData.boot_mode = bmCold;
        break;
      }
    }
  }

  PmswAdr = (UINT16)(LpcPciCfg32 (R_QNC_LPC_GPE0BLK) & 0xFFFF) + R_QNC_GPE0BLK_PMSW;
  if( IoRead32 (PmswAdr) & B_QNC_GPE0BLK_PMSW_DRAM_INIT) {
    // MRC did not complete last execution, force cold boot path
    MrcData.boot_mode = bmCold;
  }

  // Mark MRC pending
  IoOr32 (PmswAdr, (UINT32)B_QNC_GPE0BLK_PMSW_DRAM_INIT);

  //
  // Call Memory Reference Code's Routines
  //
  Mrc (&MrcData);

  // Mark MRC completed
  IoAnd32 (PmswAdr, ~(UINT32)B_QNC_GPE0BLK_PMSW_DRAM_INIT);

  //
  // Get the Memory Map
  //
  NumRanges = MAX_RANGES;
  ZeroMem (MemoryMap, sizeof (PEI_DUAL_CHANNEL_DDR_MEMORY_MAP_RANGE) * NumRanges);
  Status = GetMemoryMap (
             MrcData.mem_size,
             (PEI_DUAL_CHANNEL_DDR_MEMORY_MAP_RANGE *) MemoryMap,
             &NumRanges,
             &RmuMainMemoryAddress
             );
  ASSERT_EFI_ERROR (Status);
  ASSERT(NumRanges <= MAX_RANGES);

  //
  // Locate the FSP reserved memory (last entry).
  //
  FspReservedArea = MemoryMap[NumRanges - 1].PhysicalAddress;
  ReservedBytes = MemoryMap[NumRanges - 1].RangeLength;

  //
  // Test the memory from 1M->TOM
  //
  if (BootMode != BOOT_ON_S3_RESUME) {
    if (BootMode != BOOT_ON_FLASH_UPDATE) {
      Status = BaseMemoryTest (
                0x100000,
                (MrcData.mem_size - 0x100000),
                Quick,
                &BadMemoryAddress
                );
      ASSERT_EFI_ERROR (Status);
    }

    //
    // Assign physical memory to PEI
    //
    FspInstallPeiMemory (FspReservedArea, ReservedBytes);
  }

  //
  // Enable memory for use
  //
  PostInstallMemory (&MrcData, FALSE, RmuMainMemoryAddress);

  //
  // Save the memory configuration data into a HOB
  // HOB data size (stored in variable) is required to be multiple of 8 bytes
  //
  if (BootMode != BOOT_ON_S3_RESUME) {
    InitializeHeap((UINTN)FspReservedArea, (UINTN)ReservedBytes);
    BuildHobs (MemoryMap,
               NumRanges,
               FspReservedArea,
               ReservedBytes,
               &MrcData);
  }

  DEBUG ((EFI_D_INFO, "MemoryInit Complete.\n"));
  return EFI_SUCCESS;
}