/** * ImcDisableSurebootTimer - IMC Disable Sureboot Timer. * * * @param[in] FchDataPtr Fch configuration structure pointer. * */ VOID ImcDisableSurebootTimer ( IN VOID *FchDataPtr ) { UINT8 Msgdata; AMD_CONFIG_PARAMS *StdHeader; StdHeader = ((FCH_DATA_BLOCK *) FchDataPtr)->StdHeader; if (!(IsImcEnabled (StdHeader)) ) { return; ///IMC is not enabled } ImcWakeup (FchDataPtr); Msgdata = 0x00; WriteECmsg (MSG_REG0, AccessWidth8, &Msgdata, StdHeader); Msgdata = 0x01; WriteECmsg (MSG_REG1, AccessWidth8, &Msgdata, StdHeader); Msgdata = 0x00; WriteECmsg (MSG_REG2, AccessWidth8, &Msgdata, StdHeader); Msgdata = 0x94; WriteECmsg (MSG_SYS_TO_IMC, AccessWidth8, &Msgdata, StdHeader); WaitForEcLDN9MailboxCmdAck (StdHeader); ImcSleep (FchDataPtr); }
/** * ImcSleep - IMC Sleep. * * * @param[in] FchDataPtr Fch configuration structure pointer. * */ VOID ImcSleep ( IN VOID *FchDataPtr ) { UINT8 Msgdata; FCH_DATA_BLOCK *LocalCfgPtr; AMD_CONFIG_PARAMS *StdHeader; LocalCfgPtr = (FCH_DATA_BLOCK *) FchDataPtr; StdHeader = LocalCfgPtr->StdHeader; if (!(IsImcEnabled (StdHeader)) ) { return; ///IMC is not enabled } Msgdata = 0x00; WriteECmsg (MSG_REG0, AccessWidth8, &Msgdata, StdHeader); Msgdata = 0xB4; WriteECmsg (MSG_REG1, AccessWidth8, &Msgdata, StdHeader); Msgdata = 0x00; WriteECmsg (MSG_REG2, AccessWidth8, &Msgdata, StdHeader); Msgdata = 0x96; WriteECmsg (MSG_SYS_TO_IMC, AccessWidth8, &Msgdata, StdHeader); WaitForEcLDN9MailboxCmdAck (StdHeader); }
/** * ImcCrashReset - IMC Crash Reset * * * @param[in] FchDataPtr Fch configuration structure pointer. * */ VOID ImcCrashReset ( IN VOID *FchDataPtr ) { UINT8 Msgdata; FCH_DATA_BLOCK *LocalCfgPtr; AMD_CONFIG_PARAMS *StdHeader; LocalCfgPtr = (FCH_DATA_BLOCK *) FchDataPtr; StdHeader = LocalCfgPtr->StdHeader; if (!(IsImcEnabled (StdHeader)) ) { return; ///IMC is not enabled } ReadECmsg (MSG_REG0, AccessWidth8, &Msgdata, StdHeader); if ( Msgdata != 0xfa) { ReadECmsg (MSG_REGA, AccessWidth8, &Msgdata, StdHeader); if ( Msgdata != 0x5A ) { ReadECmsg (MSG_REGB, AccessWidth8, &Msgdata, StdHeader); if ( Msgdata != 0xA5 ) { // Set up MSG_REGA = 0x5A and MSG_REGB = 0xA5 as a flag to indicate IMC has been // reset once already, this is to prevent repeating the reset forever. Msgdata = 0x5A; WriteECmsg (MSG_REGA, AccessWidth8, &Msgdata, StdHeader); Msgdata = 0xA5; WriteECmsg (MSG_REGB, AccessWidth8, &Msgdata, StdHeader); SoftwareDisableImc (LocalCfgPtr); } } } }
void enable_imc_thermal_zone(void) { AMD_CONFIG_PARAMS StdHeader; UINT8 FunNum; UINT8 regs[9]; int i; regs[0] = 0; regs[1] = 0; FunNum = Fun_80; for (i=0; i<=1; i++) WriteECmsg(MSG_REG0 + i, AccessWidth8, ®s[i], &StdHeader); WriteECmsg(MSG_SYS_TO_IMC, AccessWidth8, &FunNum, &StdHeader); // function number WaitForEcLDN9MailboxCmdAck(&StdHeader); for (i=2; i<=9; i++) ReadECmsg(MSG_REG0 + i, AccessWidth8, ®s[i], &StdHeader); /* enable thermal zone 0 */ regs[2] |= 1; regs[0] = 0; regs[1] = 0; FunNum = Fun_81; for (i=0; i<=9; i++) WriteECmsg(MSG_REG0 + i, AccessWidth8, ®s[i], &StdHeader); WriteECmsg(MSG_SYS_TO_IMC, AccessWidth8, &FunNum, &StdHeader); // function number WaitForEcLDN9MailboxCmdAck(&StdHeader); }
/*------------------------------------------------------------------------------- ;Procedure: SBIMCFanInitializeS3 ; ;Description: This routine initialize IMC fan when S3 resume ; ; ;Exit: None ; ;Modified: None ; ;----------------------------------------------------------------------------- */ VOID SBIMCFanInitializeS3 (VOID) { UINT8 dbPortStatus,Value80,Value82,Value83,Value84; getChipSysMode (&dbPortStatus); if ((dbPortStatus & ChipSysEcEnable) != 0) { Value80 = 0x98; Value82 = 0x00; Value83 = 0x02; Value84 = 0x00; // Clear MSG_REG0 to receive acknowledge byte WriteECmsg (MSG_REG0, AccWidthUint8, &Value82); // Set MSG_REG1 // 0x02 - Notify IMC that the system is waken from any sleep state WriteECmsg (MSG_REG1, AccWidthUint8, &Value83); // Set timeout counter value to 00 which disables watchdog timer WriteECmsg (MSG_REG2, AccWidthUint8, &Value84); // Write mailbox function number to kick off the command // 0x98 - IMC System Sleep and Wake Services WriteECmsg (MSG_SYS_TO_IMC, AccWidthUint8, &Value80); // Read acknowledge byte to make sure function is executed properly WaitForEcLDN9MailboxCmdAck (); } }
static void ImcWakeup(void) { u8 cmd_val = 0x96; /* Kick off IMC Mailbox command 96 */ u8 reg0_val = 0;; /* clear response register */ u8 reg1_val = 0xB5; /* release ownership flag */ WriteECmsg (MSG_REG0, AccWidthUint8, ®0_val); WriteECmsg (MSG_REG1, AccWidthUint8, ®1_val); WriteECmsg (MSG_SYS_TO_IMC, AccWidthUint8, &cmd_val); WaitForEcLDN9MailboxCmdAck(); }
/*------------------------------------------------------------------------------- ;Procedure: sbECfancontrolservice ; ;Description: This routine service EC fan policy ; ; ;Exit: None ; ;Modified: None ; ;----------------------------------------------------------------------------- */ VOID sbECfancontrolservice ( IN AMDSBCFG* pConfig ) { UINT8 ZoneNum; UINT8 FunNum; UINT8 RegNum; UINT8 * CurPoint; UINT8 FunIndex; BOOLEAN IsSendEcMsg; CurPoint = &pConfig->Pecstruct.MSGFun81zone0MSGREG0 + MaxZone[0] * (MaxRegister[0] - MSG_REG0 + 1); for ( FunIndex = 1; FunIndex <= 3; FunIndex++ ) { FunNum = FunctionNumber[FunIndex]; for ( ZoneNum = 0; ZoneNum < MaxZone[FunIndex]; ZoneNum++ ) { IsSendEcMsg = IsZoneFuncEnable (pConfig->Pecstruct.IMCFUNSupportBitMap, FunIndex, ZoneNum); for ( RegNum = MSG_REG0; RegNum <= MaxRegister[FunIndex]; RegNum++ ) { if (IsSendEcMsg) { WriteECmsg (RegNum, AccWidthUint8, CurPoint); // } CurPoint += 1; } if (IsSendEcMsg) { WriteECmsg (MSG_SYS_TO_IMC, AccWidthUint8, &FunNum); // function number WaitForEcLDN9MailboxCmdAck (); } } } CurPoint = &pConfig->Pecstruct.MSGFun81zone0MSGREG0; for ( FunIndex = 0; FunIndex <= 0; FunIndex++ ) { FunNum = FunctionNumber[FunIndex]; for ( ZoneNum = 0; ZoneNum < MaxZone[FunIndex]; ZoneNum++ ) { IsSendEcMsg = IsZoneFuncEnable (pConfig->Pecstruct.IMCFUNSupportBitMap, FunIndex, ZoneNum); for ( RegNum = MSG_REG0; RegNum <= MaxRegister[FunIndex]; RegNum++ ) { if (IsSendEcMsg) { WriteECmsg (RegNum, AccWidthUint8, CurPoint); // } CurPoint += 1; } if (IsSendEcMsg) { WriteECmsg (MSG_SYS_TO_IMC, AccWidthUint8, &FunNum); // function number WaitForEcLDN9MailboxCmdAck (); } } } }