diff --git a/port/board/afc-bpm/v3_1/ipmi_oem.c b/port/board/afc-bpm/v3_1/ipmi_oem.c index 0176a3f8f..156342f05 100644 --- a/port/board/afc-bpm/v3_1/ipmi_oem.c +++ b/port/board/afc-bpm/v3_1/ipmi_oem.c @@ -80,7 +80,7 @@ IPMI_HANDLER(ipmi_oem_cmd_i2c_transfer, NETFN_CUSTOM_OEM, IPMI_OEM_CMD_I2C_TRANS if ( read_len > 0 ) { read_data = pvPortMalloc( read_len ); - memset( read_data, read_len, 0 ); + memset( read_data, 0, read_len ); if ( xI2CMasterRead( i2c_interf, i2c_addr, read_data, read_len ) == read_len ) { rsp->data[0] = read_len; diff --git a/port/board/afc-bpm/v3_1/payload.c b/port/board/afc-bpm/v3_1/payload.c index 7761d10c9..68ecb10d0 100644 --- a/port/board/afc-bpm/v3_1/payload.c +++ b/port/board/afc-bpm/v3_1/payload.c @@ -368,7 +368,7 @@ uint8_t payload_hpm_prepare_comp( void ) return IPMI_CC_OUT_OF_SPACE; } - memset(hpm_page, 0xFF, sizeof(hpm_page)); + memset(hpm_page, 0xFF, PAYLOAD_HPM_PAGE_SIZE); hpm_pg_index = 0; hpm_page_addr = 0; @@ -393,7 +393,7 @@ uint8_t payload_hpm_upload_block( uint8_t * block, uint16_t size ) /* TODO: Check DONE pin before accessing the SPI bus, since the FPGA may be reading it in order to boot */ uint8_t remaining_bytes_start; - if ( sizeof(hpm_page) - hpm_pg_index > size ) { + if ( PAYLOAD_HPM_PAGE_SIZE - hpm_pg_index > size ) { /* Our page is not full yet, just append the new data */ memcpy(&hpm_page[hpm_pg_index], block, size); hpm_pg_index += size; @@ -402,16 +402,16 @@ uint8_t payload_hpm_upload_block( uint8_t * block, uint16_t size ) } else { /* Complete the remaining bytes on the buffer */ - memcpy(&hpm_page[hpm_pg_index], block, (sizeof(hpm_page) - hpm_pg_index)); - remaining_bytes_start = (sizeof(hpm_page) - hpm_pg_index); + memcpy(&hpm_page[hpm_pg_index], block, (PAYLOAD_HPM_PAGE_SIZE - hpm_pg_index)); + remaining_bytes_start = (PAYLOAD_HPM_PAGE_SIZE - hpm_pg_index); /* Program the complete page in the Flash */ - flash_program_page( hpm_page_addr, &hpm_page[0], sizeof(hpm_page)); + flash_program_page( hpm_page_addr, &hpm_page[0], PAYLOAD_HPM_PAGE_SIZE); - hpm_page_addr += sizeof(hpm_page); + hpm_page_addr += PAYLOAD_HPM_PAGE_SIZE; /* Empty our buffer and reset the index */ - memset(hpm_page, 0xFF, sizeof(hpm_page)); + memset(hpm_page, 0xFF, PAYLOAD_HPM_PAGE_SIZE); hpm_pg_index = 0; /* Save the trailing bytes */ @@ -430,7 +430,7 @@ uint8_t payload_hpm_finish_upload( uint32_t image_size ) /* Check if the last page was already programmed */ if (!hpm_pg_index) { /* Program the complete page in the Flash */ - flash_program_page( hpm_page_addr, &hpm_page[0], (sizeof(hpm_page)-hpm_pg_index)); + flash_program_page( hpm_page_addr, &hpm_page[0], (PAYLOAD_HPM_PAGE_SIZE-hpm_pg_index)); hpm_pg_index = 0; hpm_page_addr = 0; diff --git a/port/board/afc-timing/ipmi_oem.c b/port/board/afc-timing/ipmi_oem.c index e7f78ee06..bc3780cbe 100644 --- a/port/board/afc-timing/ipmi_oem.c +++ b/port/board/afc-timing/ipmi_oem.c @@ -80,7 +80,7 @@ IPMI_HANDLER(ipmi_oem_cmd_i2c_transfer, NETFN_CUSTOM_OEM, IPMI_OEM_CMD_I2C_TRANS if ( read_len > 0 ) { read_data = pvPortMalloc( read_len ); - memset( read_data, read_len, 0 ); + memset( read_data, 0, read_len ); if ( xI2CMasterRead( i2c_interf, i2c_addr, read_data, read_len ) == read_len ) { rsp->data[0] = read_len; diff --git a/port/board/afc-timing/payload.c b/port/board/afc-timing/payload.c index db9090d35..07994fb45 100644 --- a/port/board/afc-timing/payload.c +++ b/port/board/afc-timing/payload.c @@ -243,17 +243,17 @@ void vTaskPayload( void *pvParameters ) current_evt = xEventGroupGetBits( amc_payload_evt ); if ( current_evt & PAYLOAD_MESSAGE_QUIESCE ) { - + /* - * If you issue a shutdown fru command in the MCH shell, the payload power - * task will receive a PAYLOAD_MESSAGE_QUIESCE message and set the - * QUIESCED_req flag to '1' and the MCH will shutdown the 12VP0 power, - * making the payload power task go to PAYLOAD_NO_POWER state. + * If you issue a shutdown fru command in the MCH shell, the payload power + * task will receive a PAYLOAD_MESSAGE_QUIESCE message and set the + * QUIESCED_req flag to '1' and the MCH will shutdown the 12VP0 power, + * making the payload power task go to PAYLOAD_NO_POWER state. * So, if we are in the PAYLOAD_QUIESCED state and receive a - * PAYLOAD_MESSAGE_QUIESCE message, the QUIESCED_req flag + * PAYLOAD_MESSAGE_QUIESCE message, the QUIESCED_req flag * should be '0' */ - + if (state == PAYLOAD_QUIESCED) { QUIESCED_req = 0; } else { @@ -371,7 +371,7 @@ uint8_t payload_hpm_prepare_comp( void ) return IPMI_CC_OUT_OF_SPACE; } - memset(hpm_page, 0xFF, sizeof(hpm_page)); + memset(hpm_page, 0xFF, PAYLOAD_HPM_PAGE_SIZE); hpm_pg_index = 0; hpm_page_addr = 0; @@ -396,7 +396,7 @@ uint8_t payload_hpm_upload_block( uint8_t * block, uint16_t size ) /* TODO: Check DONE pin before accessing the SPI bus, since the FPGA may be reading it in order to boot */ uint8_t remaining_bytes_start; - if ( sizeof(hpm_page) - hpm_pg_index > size ) { + if ( PAYLOAD_HPM_PAGE_SIZE - hpm_pg_index > size ) { /* Our page is not full yet, just append the new data */ memcpy(&hpm_page[hpm_pg_index], block, size); hpm_pg_index += size; @@ -405,16 +405,16 @@ uint8_t payload_hpm_upload_block( uint8_t * block, uint16_t size ) } else { /* Complete the remaining bytes on the buffer */ - memcpy(&hpm_page[hpm_pg_index], block, (sizeof(hpm_page) - hpm_pg_index)); - remaining_bytes_start = (sizeof(hpm_page) - hpm_pg_index); + memcpy(&hpm_page[hpm_pg_index], block, (PAYLOAD_HPM_PAGE_SIZE - hpm_pg_index)); + remaining_bytes_start = (PAYLOAD_HPM_PAGE_SIZE - hpm_pg_index); /* Program the complete page in the Flash */ - flash_program_page( hpm_page_addr, &hpm_page[0], sizeof(hpm_page)); + flash_program_page( hpm_page_addr, &hpm_page[0], PAYLOAD_HPM_PAGE_SIZE); - hpm_page_addr += sizeof(hpm_page); + hpm_page_addr += PAYLOAD_HPM_PAGE_SIZE; /* Empty our buffer and reset the index */ - memset(hpm_page, 0xFF, sizeof(hpm_page)); + memset(hpm_page, 0xFF, PAYLOAD_HPM_PAGE_SIZE); hpm_pg_index = 0; /* Save the trailing bytes */ @@ -433,7 +433,7 @@ uint8_t payload_hpm_finish_upload( uint32_t image_size ) /* Check if the last page was already programmed */ if (!hpm_pg_index) { /* Program the complete page in the Flash */ - flash_program_page( hpm_page_addr, &hpm_page[0], (sizeof(hpm_page)-hpm_pg_index)); + flash_program_page( hpm_page_addr, &hpm_page[0], (PAYLOAD_HPM_PAGE_SIZE-hpm_pg_index)); hpm_pg_index = 0; hpm_page_addr = 0; diff --git a/port/board/afc-v4/ipmi_oem.c b/port/board/afc-v4/ipmi_oem.c index 5c3362934..7d8382b1f 100644 --- a/port/board/afc-v4/ipmi_oem.c +++ b/port/board/afc-v4/ipmi_oem.c @@ -80,7 +80,7 @@ IPMI_HANDLER(ipmi_oem_cmd_i2c_transfer, NETFN_CUSTOM_OEM, IPMI_OEM_CMD_I2C_TRANS if ( read_len > 0 ) { read_data = pvPortMalloc( read_len ); - memset( read_data, read_len, 0 ); + memset( read_data, 0, read_len ); if ( xI2CMasterRead( i2c_interf, i2c_addr, read_data, read_len ) == read_len ) { rsp->data[0] = read_len;