/** * Disassembles chunks from a received datagram * * FIXME : data chunks may only be parsed after control chunks..... * * All chunks within the datagram are dispatched and sent to the appropriate * module, i.e.: control chunks are sent to sctp_control/pathmanagement, * SACK chunks to reliable_transfer, and data_chunks to RX_control. * Those modules must get a pointer to the start of a chunk and * information about its size (without padding). * @param address_index index of address on which this data arrived * @param datagram pointer to first chunk of the newly received data * @param len length of payload (i.e. len of the concatenation of chunks) */ gint rbu_rcvDatagram(guint address_index, guchar * datagram, guint len) { /* sctp common header header has been verified */ /* tag (if association is established) and CRC is okay */ /* get first chunk-id and length, pass pointers & len on to relevant module : - CHUNK_INIT, CHUNK_INIT_ACK,CHUNK_ABORT, CHUNK_SHUTDOWN,CHUNK_SHUTDOWN_ACK CHUNK_COOKIE_ECHO,CHUNK_COOKIE_ACK go to SCTP_CONTROL (change of association state) - CHUNK_HBREQ, CHUNK_HBACK go to PATH_MAN instance - CHUNK_SACK goes to RELIABLE_TRANSFER - CHUNK_ERROR probably to SCTP_CONTROL as well (at least there !) - CHUNK_DATA goes to RX_CONTROL */ guchar *current_position; gushort processed_len = 0, chunk_len; gushort pad_bytes; SCTP_simple_chunk *chunk; gboolean data_chunk_received = FALSE; int association_state = STATE_OK; gboolean send_it = FALSE; bu_lock_sender(); current_position = datagram; /* points to the first chunk in this pdu */ event_log(INTERNAL_EVENT_0, "Entered rbu_rcvDatagram()...... "); /* CHECKME : beim Empfangen leerer Chunks tritt im Bundling eine Endlosschleife auf ??? */ while (processed_len < len) { chunk = (SCTP_simple_chunk *) current_position; chunk_len = CHUNKP_LENGTH((SCTP_chunk_header *) chunk); event_logiiii(INTERNAL_EVENT_0, "rbu_rcvDatagram(address=%u) : len==%u, processed_len = %u, chunk_len=%u", address_index, len, processed_len, chunk_len); if ((processed_len+chunk_len) > len || chunk_len < 4) { error_logiii(ERROR_MINOR, "Faulty chunklen=%u, total len=%u,processed_len=%u --> dropping packet !", chunk_len,len,processed_len); /* if the association has already been removed, we cannot unlock it anymore */ bu_unlock_sender(&address_index); return 1; } /* * TODO : Add return values to the chunk-functions, where they can indicate what * to do with the rest of the datagram (i.e. DISCARD after stale COOKIE_ECHO * with tie tags that do not match the current ones) */ switch (chunk->chunk_header.chunk_id) { case CHUNK_DATA: event_log(INTERNAL_EVENT_0, "******************* Bundling received DATA chunk"); rxc_data_chunk_rx((SCTP_data_chunk*) chunk, address_index); data_chunk_received = TRUE; break; case CHUNK_INIT: event_log(INTERNAL_EVENT_0, "******************* Bundling received INIT chunk"); association_state = sctlr_init((SCTP_init *) chunk); break; case CHUNK_INIT_ACK: event_log(INTERNAL_EVENT_0, "******************* Bundling received INIT ACK chunk"); association_state = sctlr_initAck((SCTP_init *) chunk); break; case CHUNK_SACK: event_log(INTERNAL_EVENT_0, "******************* Bundling received SACK chunk"); rtx_process_sack(address_index, chunk, len); break; case CHUNK_HBREQ: event_log(INTERNAL_EVENT_0, "******************* Bundling received HB_REQ chunk"); pm_heartbeat((SCTP_heartbeat *) chunk, address_index); break; case CHUNK_HBACK: event_log(INTERNAL_EVENT_0, "******************* Bundling received HB_ACK chunk"); pm_heartbeatAck((SCTP_heartbeat *) chunk); break; case CHUNK_ABORT: event_log(INTERNAL_EVENT_0, "******************* Bundling received ABORT chunk"); association_state = sctlr_abort(); break; case CHUNK_SHUTDOWN: event_log(INTERNAL_EVENT_0, "******************* Bundling received SHUTDOWN chunk"); association_state = sctlr_shutdown((SCTP_simple_chunk *) chunk); break; case CHUNK_SHUTDOWN_ACK: event_log(INTERNAL_EVENT_0, "******************* Bundling received SHUTDOWN ACK chunk"); association_state = sctlr_shutdownAck(); break; case CHUNK_ERROR: event_log(INTERNAL_EVENT_0, "Error Chunk"); eh_recv_chunk(chunk); break; case CHUNK_COOKIE_ECHO: event_log(INTERNAL_EVENT_0, "******************* Bundling received COOKIE ECHO chunk"); sctlr_cookie_echo((SCTP_cookie_echo *) chunk); break; case CHUNK_COOKIE_ACK: event_log(INTERNAL_EVENT_0, "******************* Bundling received COOKIE ACK chunk"); sctlr_cookieAck((SCTP_simple_chunk *) chunk); break; /* case CHUNK_ECNE: case CHUNK_CWR: event_logi(INTERNAL_EVENT_0, "Chunktype %u not Supported Yet !!!!!!!!", chunk->chunk_header.chunk_id); break;*/ case CHUNK_SHUTDOWN_COMPLETE: event_log(INTERNAL_EVENT_0, "******************* Bundling received SHUTDOWN_COMPLETE chunk"); association_state = sctlr_shutdownComplete(); break; case CHUNK_FORWARD_TSN: if (mdi_supportsPRSCTP() == TRUE) { event_log(INTERNAL_EVENT_0, "******************* Bundling received FORWARD_TSN chunk"); rxc_process_forward_tsn((SCTP_simple_chunk *) chunk); break; } else continue; /* case CHUNK_ASCONF: */ /* check that ASCONF chunks are standalone chunks, not bundled with any other chunks. Else ignore the ASCONF chunk (but not the others) */ /* event_log(INTERNAL_EVENT_0, "Bundling received ASCONF chunk"); asc_recv_asconf_chunk((SCTP_simple_chunk *) chunk); break; case CHUNK_ASCONF_ACK: event_log(INTERNAL_EVENT_0, "Bundling received ASCONF_ACK chunk"); asc_recv_asconf_ack((SCTP_simple_chunk *) chunk); break; */ default: /* 00 - Stop processing this SCTP packet and discard it, do not process any further chunks within it. 01 - Stop processing this SCTP packet and discard it, do not process any further chunks within it, and report the unrecognized parameter in an 'Unrecognized Parameter Type' (in either an ERROR or in the INIT ACK). 10 - Skip this chunk and continue processing. 11 - Skip this chunk and continue processing, but report in an ERROR Chunk using the 'Unrecognized Chunk Type' cause of error. */ if ((chunk->chunk_header.chunk_id & 0xC0) == 0x0) { /* 00 */ processed_len = len; event_logi(EXTERNAL_EVENT_X, "00: Unknown chunktype %u in rbundling.c", chunk->chunk_header.chunk_id); } else if ((chunk->chunk_header.chunk_id & 0xC0) == 0x40) { /* 01 */ processed_len = len; eh_send_unrecognized_chunktype((unsigned char*)chunk,chunk_len); event_logi(EXTERNAL_EVENT_X, "01: Unknown chunktype %u in rbundling.c",chunk->chunk_header.chunk_id); } else if ((chunk->chunk_header.chunk_id & 0xC0) == 0x80) { /* 10 */ /* nothing */ event_logi(EXTERNAL_EVENT_X, "10: Unknown chunktype %u in rbundling.c",chunk->chunk_header.chunk_id); } else if ((chunk->chunk_header.chunk_id & 0xC0) == 0xC0) { /* 11 */ event_logi(EXTERNAL_EVENT_X, "11: Unknown chunktype %u in rbundling.c", chunk->chunk_header.chunk_id); eh_send_unrecognized_chunktype((unsigned char*)chunk,chunk_len); } break; } processed_len += chunk_len; pad_bytes = ((processed_len % 4) == 0) ? 0 : (4 - processed_len % 4); processed_len += pad_bytes; current_position += (chunk_len + pad_bytes) * sizeof(unsigned char); if (association_state != STATE_OK) processed_len = len; event_logiiii(VVERBOSE, "processed_len=%u, pad_bytes=%u, current_position=%u, chunk_len=%u", processed_len, pad_bytes, current_position,chunk_len); } if (association_state != STATE_STOP_PARSING_REMOVED) { if (data_chunk_received == TRUE) { /* update SACK structure and start SACK timer */ rxc_all_chunks_processed(TRUE); } else { /* update SACK structure and datagram counter */ rxc_all_chunks_processed(FALSE); } /* optionally also add a SACK chunk, at least for every second datagram * see section 6.2, second paragraph */ if (data_chunk_received == TRUE){ send_it = rxc_create_sack(&address_index, FALSE); se_doNotifications(); if (send_it==TRUE) bu_sendAllChunks(&address_index); } /* if the association has already been removed, we cannot unlock it anymore */ bu_unlock_sender(&address_index); } return 0; }
/** * respond to an request message from Carrier Manager/BMC. * * \param request message which has to be responded * \param response response message */ int bmc_respond(ipmbMSG_t *request, ipmbMSG_t *response) { int ret = E_OK; /* Initialize general response message parameters */ response->rsSA = request->rqSA; response->netFN = (request->netFN | 0x01); /* response */ response->rsLUN = request->rqLUN; response->rqSA = global_data.bmc_ipmb_addr; /* BMC's IPMB address */ response->rqSeq = request->rqSeq; response->rqLUN = request->rsLUN; response->cmd = request->cmd; response->orig_channel = request->dest_channel; /* swap destination and origin channel */ response->dest_channel = request->orig_channel; response->data_len = 0; /* first evaluate net function */ switch (request->netFN) { /* NetFN = 0x04 (Sensor/Event) */ case NETFN_SENSOR_EVENT_RQ: switch (request->cmd) { case CMD_SET_EVENT_RECEIVER: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_EVENT_RECEIVER'\n"); bmc_set_event_receiver(request, response); break; case CMD_GET_EVENT_RECEIVER: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_EVENT_RECEIVER'\n"); bmc_get_event_receiver(request, response); break; case CMD_PLATFORM_EVENT: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_PLATFORM_EVENT'\n"); bmc_platform_event(request, response); break; #ifdef CFG_PEF_ENABLE case CMD_GET_PEF_CAPABILITIES: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_PEF_CAPABILITIES'\n"); bmc_get_pef_capabilities(request, response); break; case CMD_ARM_PEF_POSTPONE_TIMER: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_ARM_PEF_POSTPONE_TIMER'\n"); bmc_arm_pef_postpone_timer(request, response); break; case CMD_SET_PEF_CONFIGURATION: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_PEF_CONFIG'\n"); bmc_set_pef_config(request, response); /* see event.c */ break; case CMD_GET_PEF_CONFIGURATION: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_PEF_CONFIG'\n"); bmc_get_pef_config(request, response); /* see event.c */ break; case CMD_SET_LAST_PROCESSED_EVENT_ID: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_LAST_PROCESSED_EVENT_ID'\n"); bmc_set_last_processed_eventid(request, response); /* see event.c */ break; case CMD_GET_LAST_PROCESSED_EVENT_ID: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_LAST_PROCESSED_EVENT_ID'\n"); bmc_get_last_processed_eventid(request, response); /* see event.c */ break; #endif /* CFG_PEF_ENABLE */ case CMD_GET_DEVICE_SDR_INFO: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_DEVICE_SDR_INFO'\n"); bmc_get_device_sdr_info(request, response); break; case CMD_GET_DEVICE_SDR: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_DEVICE_SDR'\n"); bmc_get_sdr_entry(request, response); break; case CMD_RES_DEVICE_SDR_REPO: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_RES_DEVICE_SDR_REPO'\n"); bmc_sdr_reserve_id(request, response); break; #if 0 case CMD_GET_SENSOR_READING_FACTORS: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SENSOR_READING_FACTORS'\n"); bmc_unknown_command(request, response); break; #endif case CMD_SET_SENSOR_HYSTERESIS: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_SENSOR_HYSTERESIS'\n"); bmc_set_sensor_hysteresis(request, response); break; case CMD_GET_SENSOR_HYSTERESIS: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SENSOR_HYSTERESIS'\n"); bmc_get_sensor_hysteresis(request, response); break; case CMD_SET_SENSOR_TRESHOLD: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_SENSOR_TRESHOLD'\n"); bmc_set_sensor_threshold(request, response); break; case CMD_GET_SENSOR_TRESHOLD: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SENSOR_TRESHOLD'\n"); bmc_get_sensor_threshold(request, response); break; case CMD_SET_SENSOR_EVENT_ENABLE: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_SENSOR_EVENT_ENABLE'\n"); bmc_set_sensor_event_en(request, response); break; case CMD_GET_SENSOR_EVENT_ENABLE: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SENSOR_EVENT_ENABLE'\n"); bmc_get_sensor_event_en(request, response); break; case CMD_REARM_SENSOR_EVENTS: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_REARM_SENSOR_EVENTS'\n"); bmc_rearm_sensor_events(request, response); break; case CMD_GET_SENSOR_EVENT_STATUS: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SENSOR_EVENT_STATUS'\n"); bmc_get_sensor_event_status(request, response); break; case CMD_GET_SENSOR_READING: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SENSOR_READING'\n"); bmc_get_sensor_reading(request, response); break; #if 0 case CMD_SET_SENSOR_TYPE: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_SENSOR_TYPE'\n"); bmc_set_sensor_type(request, response); break; case CMD_GET_SENSOR_TYPE: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SENSOR_TYPE'\n"); bmc_get_sensor_type(request, response); break; #endif /* Unknown command, respond with "invalid command" */ default: debug_uart_printf(DBG_GRP_BMC, 3, "ERR: %s: Unknown cmd 0x%02x netFN 0x%02x\n", __func__, request->cmd, request->netFN); bmc_unknown_command(request, response); break; } break; /* NetFN = 0x05 (Sensor/Event) */ #ifdef CFG_ATCA case NETFN_SENSOR_EVENT_RS: switch (request->cmd) { case CMD_PLATFORM_EVENT: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_handle_response: 'CMD_PLATFORM_EVENT'\n"); bmc_platform_event_response(request); break; /* Unknown command, respond with "invalid command" */ default: debug_uart_printf(DBG_GRP_BMC, 3, "ERR: %s: Unknown rsp 0x%02x netFN 0x%02x\n", __func__, request->cmd, request->netFN); break; } break; #endif /* NetFN = 0x06 (Application) */ case NETFN_APP_RQ: switch (request->cmd) { case CMD_GET_DEVICE_ID: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_DEVICE_ID'\n"); bmc_get_device_id(request, response); break; case CMD_COLD_RESET: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_COLD_RESET'\n"); bmc_cold_reset(request, response); break; #ifndef CFG_MCMC case CMD_WARM_RESET: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_WARM_RESET'\n"); bmc_warm_reset(request, response); break; #endif case CMD_GET_SELF_TEST_RESULT: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SELF_TEST_RESULT'\n"); bmc_get_selftest_results(request, response); break; case CMD_GET_DEVICE_GUID: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_DEVICE_GUID'\n"); bmc_get_device_guid(request, response); break; case CMD_RESET_WD_TIMER: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_RESET_WD_TIMER'\n"); bmc_reset_watchdog(request, response); break; case CMD_SET_WD_TIMER: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_WD_TIMER' timer use:%d\n", (request->data[0] & 0x7)); bmc_set_wd_timer(request, response); break; case CMD_GET_WD_TIMER: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_WD_TIMER'\n"); bmc_get_wd_timer(request, response); break; case CMD_SET_BMC_GLOBAL_ENABLES: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_BMC_GLOBAL_ENABLES'\n"); bmc_set_global_enables(request, response); break; case CMD_GET_BMC_GLOBAL_ENABLES: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_BMC_GLOBAL_ENABLES'\n"); bmc_get_global_enables(request, response); break; case CMD_CLR_MSG_FLAG: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_CLR_MSG_FLAG' %02x\n", request->data[0]); bmc_clr_msg_flags(request, response); break; case CMD_GET_MSG_FLAG: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_MSG_FLAG'\n"); bmc_get_msg_flags(request, response); break; case CMD_GET_MSG: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_MSG'\n"); bmc_get_recv_msg(request, response); break; case CMD_READ_EVENT_MSG_BUFFER: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_READ_EVENT_MSG_BUFFER'\n"); bmc_read_event_msg_buffer(request, response); break; case CMD_GET_SYSTEM_GUID: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SYSTEM_GUID'\n"); bmc_get_device_guid(request, response); break; #ifndef CFG_MCMC case CMD_GET_CHAN_AUTH_CAP: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_CHAN_AUTH_CAP'\n"); bmc_get_chan_auth_cap(request, response); break; case CMD_SET_CHANNEL_ACCESS: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_CHANNEL_ACCESS' %02x\n", request->data[0]); bmc_set_channel_access(request, response); break; case CMD_GET_CHANNEL_ACCESS: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_CHANNEL_ACCESS' %02x\n", request->data[0]); bmc_get_channel_access(request, response); break; #endif case CMD_GET_CH_INFO: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_CH_INFO' ch 0x%02x\n", request->data[0]); bmc_get_ch_info(request, response); break; #ifndef CFG_MCMC case CMD_SET_USER_ACCESS: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_USER_ACCESS' ch 0x%02x\n", (request->data[0] & 0x0F)); bmc_set_user_access(request, response); break; case CMD_GET_USER_ACCESS: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_USER_ACCESS' ch 0x%02x\n", (request->data[0] & 0x0F)); bmc_get_user_access(request, response); break; case CMD_SET_USER_NAME: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_USER_NAME'\n"); bmc_set_user_name(request, response); break; case CMD_GET_USER_NAME: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_USER_NAME'\n"); bmc_get_user_name(request, response); break; case CMD_SET_USER_PASSWORD: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_USER_PASSWORD'\n"); bmc_set_user_password(request, response); break; #endif case CMD_MASTER_WRITE_READ: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_MASTER_WRITE_READ'\n"); bmc_master_write_read(request, response); break; /* NOTE: Removed because command is optional and we do not support * a valid System Interface as defined by IPMI2.0 table 22-12. */ #if 0 case CMD_GET_SYS_INT_CAP: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SYS_INT_CAP' %02x\n", request->data[0]); bmc_get_sys_cap(request, response); break; #endif default: debug_uart_printf(DBG_GRP_BMC, 3, "ERR: %s: Unknown cmd 0x%02x netFN 0x%02x\n", __func__, request->cmd, request->netFN); bmc_unknown_command(request, response); break; } break; /* NetFN = 0x0A (Storage) */ case NETFN_STORAGE_RQ: switch (request->cmd) { case CMD_GET_FRU_INVENTORY_AREA_INFO: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_FRU_INVENTORY_AREA_INFO'\n"); bmc_fru_invent_area(request, response); break; case CMD_READ_FRU_DATA: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_READ_FRU_DATA'\n"); bmc_read_fru_data(request, response); break; case CMD_WRITE_FRU_DATA: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_WRITE_FRU_DATA'\n"); bmc_write_fru_data(request, response); break; case CMD_GET_SDR_REPO_INFO: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SDR_REPO_INFO'\n"); bmc_get_sdr_repo_info(request, response); break; case CMD_RES_SDR_REPO: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_RES_SDR_REPO'\n"); bmc_sdr_reserve_id(request, response); break; case CMD_GET_SDR: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SDR' ID:%02x%02x\n", request->data[3], request->data[2]); bmc_get_sdr_entry(request, response); break; case CMD_ADD_SDR: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_ADD_SDR'\n"); bmc_add_sdr(request, response); break; case CMD_PART_ADD_SDR: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_PART_ADD_SDR'\n"); bmc_part_add_sdr(request, response); break; #if 0 case CMD_DEL_SDR: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_DEL_SDR' ID:%02x%02x\n", request->data[3], request->data[2]); bmc_del_sdr(request, response); break; #endif case CMD_CLR_SDR_REPO: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_CLR_SDR_REPO'\n"); bmc_clr_sdr_repo(request, response); break; #ifndef CFG_MCMC case CMD_GET_SDR_REPO_TIME: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SDR_REPO_TIME'\n"); bmc_sel_time_get(request, response); break; case CMD_SET_SDR_REPO_TIME: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_SDR_REPO_TIME'\n"); bmc_sel_time_set(request, response); break; #endif // END CFG_MCMC #ifdef CFG_SEL_ENABLE case CMD_GET_SEL_INFO: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SEL_INFO'\n"); bmc_get_sel_info(request, response); break; #ifndef CFG_MCMC case CMD_GET_SEL_ALLOC_INFO: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SEL_ALLOC_INFO'\n"); bmc_get_sel_alloc_info(request, response); break; #endif // END CFG_MCMC case CMD_RESERVE_SEL: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_RESERVE_SEL'\n"); bmc_sel_reserve_id(request, response); break; case CMD_GET_SEL_ENTRY: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SEL_ENTRY' ID:%02x%02x\n", request->data[3], request->data[2]); bmc_get_sel_entry(request, response); break; case CMD_ADD_SEL_ENTRY: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_ADD_SEL_ENTRY'\n"); if (xSemaphoreTake(sel_in_use, QUEUE_BLOCK_SEM) == pdTRUE) /* wait until sel access is free */ { bmc_add_sel_entry(request, response); xSemaphoreGive(sel_in_use); } else { /* print error message and retry... */ debug_uart_printf(DBG_GRP_BMC, 3, "ERR: %s: Could not obtain semaphore for SEL.\n", __func__); } break; case CMD_CLR_SEL: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_CLR_SEL'\n"); bmc_clr_sel(request, response); break; case CMD_GET_SEL_TIME: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_SEL_TIME'\n"); bmc_sel_time_get(request, response); break; case CMD_SET_SEL_TIME: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_SEL_TIME'\n"); bmc_sel_time_set(request, response); break; #endif /* CFG_SEL_ENABLE */ /* Unknown command, respond with "invalid command" */ default: debug_uart_printf(DBG_GRP_BMC, 3, "ERR: %s: Unknown cmd 0x%02x netFN 0x%02x\n", __func__, request->cmd, request->netFN); bmc_unknown_command(request, response); break; } break; #ifndef CFG_MCMC /* NetFN = 0x0B (Storage) */ case NETFN_STORAGE_RS: switch (request->cmd) { case CMD_READ_FRU_DATA: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_response_handle : 'CMD_READ_FRU_DATA'\n"); bmc_read_fru_data_response(request); break; case CMD_WRITE_FRU_DATA: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_response_handle : 'CMD_WRITE_FRU_DATA'\n"); bmc_write_fru_data_response(request); break; #ifdef ADV_OEM_RTC_SYNC case CMD_GET_SEL_TIME: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_response_handle: 'CMD_GET_SEL_TIME'\n"); bmc_get_sel_time_response(request); break; #endif /* Unknown command, respond with "invalid command" */ default: debug_uart_printf(DBG_GRP_BMC, 3, "ERR: %s: Unknown rsp 0x%02x netFN 0x%02x\n", __func__, request->cmd, request->netFN); break; } break; #endif // END CFG_MCMC /* NetFN = 0x0C (Transport) */ case NETFN_TRANSPORT_RQ: switch (request->cmd) { #ifdef CFG_LAN case CMD_SET_LAN_CONFIG_PARAM: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_LAN_CONFIG_PARAM'\n"); bmc_set_lan_config(request, response); break; case CMD_GET_LAN_CONFIG_PARAM: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_LAN_CONFIG_PARAM'\n"); bmc_get_lan_config(request, response); break; #endif /* Unknown command, respond with "invalid command" */ default: debug_uart_printf(DBG_GRP_BMC, 3, "ERR: %s: Unknown cmd 0x%02x netFN 0x%02x\n", __func__, request->cmd, request->netFN); bmc_unknown_command(request, response); break; } break; /* NetFN = 0x2C (Group Extension -> PICMG) */ case NETFN_PICMG_RQ: /* check for PICMG identifier */ if ((request->data_len < 1) || (request->data[0] != PICMG_IDENTIFIER)) { debug_uart_printf(DBG_GRP_BMC, 3, "ERR: %s: Unknown identifier in NetFN Group Extension\n", __func__); bmc_unknown_command(request, response); break; } /* PICMG identifier is valid, process command */ switch (request->cmd) { case CMD_GET_PICMG_PROPERTIES: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_PICMG_PROPERTIES'\n"); bmc_get_picmg_prop(request, response); break; #if defined(CFG_ATCA) || defined(CFG_MCMC) case CMD_GET_ADDRESS_INFO: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_ADDRESS_INFO'\n"); bmc_get_address_info(request, response); break; #endif #ifdef CFG_CHECKPOINT case CMD_GET_SHELF_ADDRESS_INFO: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_response : 'CMD_GET_SHELF_ADDRESS_INFO'\n"); bmc_get_shelf_address(request, response); break; #endif #ifndef CFG_MCMC case CMD_FRU_CONTROL_CAPABILITIES: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_FRU_CONTROL_CAPABILITIES'\n"); bmc_fru_control_cap(request, response); break; case CMD_FRU_CONTROL: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_FRU_CONTROL'\n"); bmc_fru_control(request, response); break; case CMD_GET_FRU_LED_PROPERTIES: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'GET_FRU_LED_PROP'\n"); bmc_get_fru_led_properties(request, response); break; case CMD_GET_LED_COLOR_CAPABILITIES: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'GET_LED_COLOR_CAP'\n"); bmc_get_led_color_capabilities(request, response); break; #endif case CMD_SET_FRU_LED_STATE: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'SET_FRU_LED'\n"); bmc_set_fru_led_state(request, response); break; case CMD_GET_FRU_LED_STATE: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'GET_FRU_LED'\n"); bmc_get_fru_led_state(request, response); break; #ifdef CFG_ATCA case CMD_SET_IPMB_STATE: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_IPMB_STATE'\n"); bmc_set_ipmb_state(request, response); break; case CMD_SET_FRU_ACTIVATION_POLICY: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_FRU_ACTIVATION_POLICY'\n"); bmc_set_fru_activation_policy(request, response); break; case CMD_GET_FRU_ACTIVATION_POLICY: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_FRU_ACTIVATION_POLICY'\n"); bmc_get_fru_activation_policy(request, response); break; case CMD_SET_FRU_ACTIVATION: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_FRU_ACTIVATION'\n"); bmc_set_fru_activation(request, response); break; #endif case CMD_GET_DEVICE_LOCATOR_RECORD_ID: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_DEVICE_LOCATOR_RECORD_ID'\n"); bmc_get_device_locator_record(request, response); break; #ifdef CFG_ATCA case CMD_SET_PORT_STATE: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'SET_PORT_STATE'\n"); bmc_set_port_state(request, response); break; case CMD_GET_PORT_STATE: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'GET_PORT_STATE'\n"); bmc_get_port_state(request, response); break; case CMD_COMPUTE_POWER_PROPERTIES: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_COMPUTE_POWER_PROPERTIES'\n"); bmc_compute_power_properties(request, response); break; case CMD_SET_POWER_LEVEL: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'SET_POWER_LEVEL'\n"); bmc_set_power_level(request, response); break; case CMD_GET_POWER_LEVEL: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'GET_POWER_LEVEL'\n"); bmc_get_power_level(request, response); break; case CMD_GET_IPMB_LINK_INFO: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_IPMB_LINK_INFO'\n"); bmc_get_ipmb_link_info(request, response); break; #endif #ifdef CFG_NCP3110 case CMD_GET_FAN_SPEED_PROP: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_FAN_SPEED_PROP'\n"); bmc_get_fan_speed_prop(request, response); break; case CMD_SET_FAN_LEVEL: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_FAN_LEVEL'\n"); bmc_set_fan_level(request, response); break; case CMD_GET_FAN_LEVEL: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_FAN_LEVEL'\n"); bmc_get_fan_level(request, response); break; #endif #if defined(CFG_MMC) || defined(CFG_IRTM) case CMD_SET_AMC_PORT_STATE: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_AMC_PORT_STATE'\n"); bmc_set_amc_port_state(request, response); break; case CMD_GET_AMC_PORT_STATE: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_AMC_PORT_STATE'\n"); bmc_get_amc_port_state(request, response); break; case CMD_SET_CLOCK_STATE: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_SET_CLOCK_STATE'\n"); bmc_set_amc_clock_state(request, response); break; case CMD_GET_CLOCK_STATE: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_CLOCK_STATE'\n"); bmc_get_amc_clock_state(request, response); break; #endif /* CFG_MMC || CFG_IRTM */ #ifdef CFG_EMMCPM case CMD_POWER_CHANNEL_CONTROL: debug_uart_printf(DBG_GRP_BMC, 3, "pm_respond: 'CMD_POWER_CHANNEL_CONTROL'\n"); pm_power_chan_control(request, response); break; case CMD_GET_POWER_CHANNEL_STATUS: debug_uart_printf(DBG_GRP_BMC, 3, "pm_respond: 'CMD_GET_POWER_CHANNEL_STATUS'\n"); pm_get_power_chan_status(request, response); break; case CMD_PM_RESET: debug_uart_printf(DBG_GRP_BMC, 3, "pm_respond: 'CMD_PM_RESET'\n"); pm_reset(request, response); break; case CMD_GET_PM_STATUS: debug_uart_printf(DBG_GRP_BMC, 3, "pm_respond: 'CMD_GET_PM_STATUS'\n"); pm_get_status(request, response); break; case CMD_PM_HEARTBEAT: debug_uart_printf(DBG_GRP_BMC, 3, "pm_respond: 'CMD_PM_HEARTBEAT'\n"); pm_heartbeat(request, response); break; #endif case CMD_GET_UPGRADE_CAPABILITIES: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_UPGRADE_CAPABILITIES'\n"); bmc_get_upgrade_cap(request, response); break; case CMD_GET_COMPONENT_PROP: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_COMPONENT_PROP'\n"); bmc_get_component_prop(request, response); break; case CMD_ABORT_FIRMWARE_UPGRADE: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_ABORT_FIRMWARE_UPGRADE'\n"); bmc_abort_firmware_upgrade(request, response); break; case CMD_INITIATE_UPGRADE_ACTION: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_INITIATE_UPGRADE_ACTION'\n"); bmc_init_upgrade_action(request, response); break; case CMD_UPLOAD_FIRMWARE_BLOCK: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_UPLOAD_FIRMWARE_BLOCK'\n"); bmc_upload_firmware_block(request, response); break; case CMD_FINISH_FIRMWARE_UPLOAD: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_FINISH_FIRMWARE_UPLOAD'\n"); bmc_finish_firmware_upload(request, response); break; case CMD_GET_UPGRADE_STATUS: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_GET_UPGRADE_STATUS'\n"); bmc_get_upgrade_status(request, response); break; case CMD_ACTIVATE_FIRMWARE: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_ACTIVATE_FIRMWARE'\n"); bmc_activate_firmware(request, response); break; case CMD_QUERY_SELFTEST_RESULTS: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_QUERY_SELFTEST_RESULTS'\n"); bmc_query_selftest_results(request, response); break; case CMD_QUERY_ROLLBACK_STATUS: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_QUERY_ROLLBACK_STATUS'\n"); bmc_query_rollback_status(request, response); break; case CMD_INIT_MANUAL_ROLLBACK: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_INIT_MANUAL_ROLLBACK'\n"); bmc_init_manual_rollback(request, response); break; default: debug_uart_printf(DBG_GRP_BMC, 3, "ERR: %s: Unknown cmd 0x%02x netFN 0x%02x\n", __func__, request->cmd, request->netFN); bmc_unknown_command(request, response); break; } break; #ifndef CFG_MCMC /* NetFN = 0x2D (Group Extension -> PICMG) */ case NETFN_PICMG_RS: switch (request->cmd) { case CMD_GET_SHELF_ADDRESS_INFO: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_response_handle : 'CMD_GET_SHELF_ADDRESS_INFO'\n"); bmc_get_shelf_address_response(request); break; /* Unknown command, respond with "invalid command" */ default: debug_uart_printf(DBG_GRP_BMC, 3, "ERR: %s: Unknown rsp 0x%02x netFN 0x%02x\n", __func__, request->cmd, request->netFN); break; } break; #endif /* NetFN = 0x2E (OEM / Group) */ case NETFN_OEM_RQ: switch (request->cmd) { case ADV_OEM_GET_HW_REVISION: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_OEM_GET_HW_REVISION'\n"); bmc_oem_get_hw_revision(request, response); break; case ADV_OEM_WRITE_CONF: debug_uart_printf(DBG_GRP_BMC, 3, "bmc_respond: 'CMD_OEM_WRITE_CONFIGURATION'\n"); bmc_oem_write_config_setting(request, response); break; default: debug_uart_printf(DBG_GRP_BMC, 3, "ERR: %s: Unknown cmd 0x%02x netFN 0x%02x\n", __func__, request->cmd, request->netFN); bmc_unknown_command(request, response); break; } break; /* Unknown netFN, respond with "invalid command" */ default: debug_uart_printf(DBG_GRP_BMC, 3, "ERR: %s: Unknown NetFn 0x%02x cmd %02x dest chan %02x\n", __func__, request->netFN, request->cmd, request->dest_channel); bmc_unknown_command(request, response); break; } return ret; }