@@ -61,13 +61,14 @@ static struct Fan FAN = {
6161 .interpolate = SMOOTH_FANS != 0 ,
6262};
6363
64- int16_t peci_set_fan_curve (uint8_t count , struct FanPoint * points ) {
64+ int16_t peci_set_fan_curve (uint8_t count , struct FanPoint * points ) __reentrant {
65+ int i ;
6566 if (count != FAN .points_size ) {
6667 TRACE ("PECI: Incorrect number of fan points: %d, expected %d\n" , count , FAN .points_size );
6768 return -1 ;
6869 }
6970
70- for (int i = 0 ; i < count ; ++ i ) {
71+ for (i = 0 ; i < count ; ++ i ) {
7172 TRACE ("PECI: fan curve t%d: %d, d%d: %d\n" , i , points [i ].temp , i , points [i ].duty );
7273 FAN .points [i ].temp = points [i ].temp ;
7374 FAN .points [i ].duty = points [i ].duty ;
@@ -347,9 +348,10 @@ bool peci_get_temp(int16_t *data) {
347348
348349// Returns positive completion code on success, negative completion code or
349350// negative (0x1000 | status register) on PECI hardware error
350- int16_t peci_wr_pkg_config (uint8_t index , uint16_t param , uint32_t data ) {
351+ int16_t peci_wr_pkg_config (uint8_t index , uint16_t param , uint32_t data ) __reentrant {
351352 int retry = 50 ; // TODO how many retries are appropriate?
352353 uint8_t cc = HORDDR ;
354+ uint8_t status ;
353355
354356 // Wait for any in-progress transaction to complete
355357 while (HOSTAR & BIT (0 )) {}
@@ -387,7 +389,7 @@ int16_t peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) {
387389 // Wait for command completion
388390 while (!(HOSTAR & BIT (1 ))) {}
389391
390- uint8_t status = HOSTAR ;
392+ status = HOSTAR ;
391393 if (status & 0xEC ) {
392394 ERROR ("peci_wr_pkg_config: hardware error: 0x%02X\n" , status );
393395 // Clear status
@@ -411,9 +413,11 @@ int16_t peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) {
411413 return - ((int16_t )cc );
412414}
413415
414- int16_t peci_rd_pkg_config (uint8_t index , uint16_t param , uint32_t * value ) {
416+ int16_t peci_rd_pkg_config (uint8_t index , uint16_t param , uint32_t * value ) __reentrant {
415417 int retry = 50 ; // TODO how many retries are appropriate?
416418 uint8_t cc = HORDDR ;
419+ uint8_t status ;
420+ int i ;
417421 * value = 0 ;
418422
419423 // Wait for any in-progress transaction to complete
@@ -447,7 +451,7 @@ int16_t peci_rd_pkg_config(uint8_t index, uint16_t param, uint32_t *value) {
447451 // Wait for command completion
448452 while (!(HOSTAR & BIT (1 ))) {}
449453
450- uint8_t status = HOSTAR ;
454+ status = HOSTAR ;
451455 if (status & 0xEC ) {
452456 ERROR ("peci_rd_pkg_config: hardware error: 0x%02X\n" , status );
453457 // Clear status
@@ -466,7 +470,7 @@ int16_t peci_rd_pkg_config(uint8_t index, uint16_t param, uint32_t *value) {
466470 return - ((int16_t )cc );
467471 } else {
468472 // Read data if finished successfully
469- for (int i = 0 ; i < 4 ; ++ i ) {
473+ for (i = 0 ; i < 4 ; ++ i ) {
470474 * value |= (((uint32_t )HORDDR ) << (8 * i ));
471475 }
472476
0 commit comments