diff --git a/src/soc/amd/stoneyridge/imc.c b/src/soc/amd/stoneyridge/imc.c index 4c505df522..f7eed205d0 100644 --- a/src/soc/amd/stoneyridge/imc.c +++ b/src/soc/amd/stoneyridge/imc.c @@ -50,7 +50,7 @@ void enable_imc_thermal_zone(void) { AMD_CONFIG_PARAMS StdHeader; UINT8 FunNum; - UINT8 regs[9]; + UINT8 regs[10]; int i; regs[0] = 0; @@ -61,7 +61,7 @@ void enable_imc_thermal_zone(void) WriteECmsg(MSG_SYS_TO_IMC, AccessWidth8, &FunNum, &StdHeader); WaitForEcLDN9MailboxCmdAck(&StdHeader); - for (i = 2 ; i <= 9 ; i++) + for (i = 2 ; i < ARRAY_SIZE(regs) ; i++) ReadECmsg(MSG_REG0 + i, AccessWidth8, ®s[i], &StdHeader); /* enable thermal zone 0 */ @@ -69,7 +69,7 @@ void enable_imc_thermal_zone(void) regs[0] = 0; regs[1] = 0; FunNum = Fun_81; - for (i = 0 ; i <= 9 ; i++) + for (i = 0 ; i < ARRAY_SIZE(regs) ; i++) WriteECmsg(MSG_REG0 + i, AccessWidth8, ®s[i], &StdHeader); WriteECmsg(MSG_SYS_TO_IMC, AccessWidth8, &FunNum, &StdHeader); WaitForEcLDN9MailboxCmdAck(&StdHeader); diff --git a/src/southbridge/amd/agesa/hudson/imc.c b/src/southbridge/amd/agesa/hudson/imc.c index 799cc32e40..3d758d7ab1 100644 --- a/src/southbridge/amd/agesa/hudson/imc.c +++ b/src/southbridge/amd/agesa/hudson/imc.c @@ -60,7 +60,7 @@ void enable_imc_thermal_zone(void) { AMD_CONFIG_PARAMS StdHeader; UINT8 FunNum; - UINT8 regs[9]; + UINT8 regs[10]; int i; regs[0] = 0; @@ -71,7 +71,7 @@ void enable_imc_thermal_zone(void) WriteECmsg(MSG_SYS_TO_IMC, AccessWidth8, &FunNum, &StdHeader); // function number WaitForEcLDN9MailboxCmdAck(&StdHeader); - for (i = 2; i <= 9; i++) + for (i = 2; i < ARRAY_SIZE(regs); i++) ReadECmsg(MSG_REG0 + i, AccessWidth8, ®s[i], &StdHeader); /* enable thermal zone 0 */ @@ -79,7 +79,7 @@ void enable_imc_thermal_zone(void) regs[0] = 0; regs[1] = 0; FunNum = Fun_81; - for (i = 0; i <= 9; i++) + for (i = 0; i < ARRAY_SIZE(regs); i++) WriteECmsg(MSG_REG0 + i, AccessWidth8, ®s[i], &StdHeader); WriteECmsg(MSG_SYS_TO_IMC, AccessWidth8, &FunNum, &StdHeader); // function number WaitForEcLDN9MailboxCmdAck(&StdHeader); diff --git a/src/southbridge/amd/pi/hudson/imc.c b/src/southbridge/amd/pi/hudson/imc.c index 53e97fbae3..bb630149b8 100644 --- a/src/southbridge/amd/pi/hudson/imc.c +++ b/src/southbridge/amd/pi/hudson/imc.c @@ -56,7 +56,7 @@ void enable_imc_thermal_zone(void) { AMD_CONFIG_PARAMS StdHeader; UINT8 FunNum; - UINT8 regs[9]; + UINT8 regs[10]; int i; regs[0] = 0; @@ -67,7 +67,7 @@ void enable_imc_thermal_zone(void) WriteECmsg(MSG_SYS_TO_IMC, AccessWidth8, &FunNum, &StdHeader); WaitForEcLDN9MailboxCmdAck(&StdHeader); - for (i = 2; i <= 9; i++) + for (i = 2; i < ARRAY_SIZE(regs); i++) ReadECmsg(MSG_REG0 + i, AccessWidth8, ®s[i], &StdHeader); /* enable thermal zone 0 */ @@ -75,7 +75,7 @@ void enable_imc_thermal_zone(void) regs[0] = 0; regs[1] = 0; FunNum = Fun_81; - for (i = 0; i <= 9; i++) + for (i = 0; i < ARRAY_SIZE(regs); i++) WriteECmsg(MSG_REG0 + i, AccessWidth8, ®s[i], &StdHeader); WriteECmsg(MSG_SYS_TO_IMC, AccessWidth8, &FunNum, &StdHeader); WaitForEcLDN9MailboxCmdAck(&StdHeader);