这篇教程C++ tw_osl_cur_func函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tw_osl_cur_func函数的典型用法代码示例。如果您正苦于以下问题:C++ tw_osl_cur_func函数的具体用法?C++ tw_osl_cur_func怎么用?C++ tw_osl_cur_func使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tw_osl_cur_func函数的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: tw_cl_interrupt/* * Function name: twa_interrupt * Description: Interrupt handler. Determines the kind of interrupt, * and returns TW_CL_TRUE if it recognizes the interrupt. * * Input: ctlr_handle -- controller handle * Output: None * Return value: TW_CL_TRUE -- interrupt recognized * TW_CL_FALSE-- interrupt not recognized */TW_INT32tw_cl_interrupt(struct tw_cl_ctlr_handle *ctlr_handle){ struct tw_cli_ctlr_context *ctlr = (struct tw_cli_ctlr_context *)(ctlr_handle->cl_ctlr_ctxt); TW_UINT32 status_reg; TW_INT32 rc = TW_CL_FALSE; tw_cli_dbg_printf(10, ctlr_handle, tw_osl_cur_func(), "entered"); /* If we don't have controller context, bail */ if (ctlr == NULL) goto out; /* * Bail If we get an interrupt while resetting, or shutting down. */ if (ctlr->reset_in_progress || !(ctlr->active)) goto out; /* Read the status register to determine the type of interrupt. */ status_reg = TW_CLI_READ_STATUS_REGISTER(ctlr_handle); if (tw_cli_check_ctlr_state(ctlr, status_reg)) goto out; /* Clear the interrupt. */ if (status_reg & TWA_STATUS_HOST_INTERRUPT) { tw_cli_dbg_printf(6, ctlr_handle, tw_osl_cur_func(), "Host interrupt"); TW_CLI_WRITE_CONTROL_REGISTER(ctlr_handle, TWA_CONTROL_CLEAR_HOST_INTERRUPT); } if (status_reg & TWA_STATUS_ATTENTION_INTERRUPT) { tw_cli_dbg_printf(6, ctlr_handle, tw_osl_cur_func(), "Attention interrupt"); rc |= TW_CL_TRUE; /* request for a deferred isr call */ tw_cli_process_attn_intr(ctlr); TW_CLI_WRITE_CONTROL_REGISTER(ctlr_handle, TWA_CONTROL_CLEAR_ATTENTION_INTERRUPT); } if (status_reg & TWA_STATUS_COMMAND_INTERRUPT) { tw_cli_dbg_printf(6, ctlr_handle, tw_osl_cur_func(), "Command interrupt"); rc |= TW_CL_TRUE; /* request for a deferred isr call */ tw_cli_process_cmd_intr(ctlr); if ((TW_CL_Q_FIRST_ITEM(&(ctlr->req_q_head[TW_CLI_PENDING_Q]))) == TW_CL_NULL) TW_CLI_WRITE_CONTROL_REGISTER(ctlr_handle, TWA_CONTROL_MASK_COMMAND_INTERRUPT); } if (status_reg & TWA_STATUS_RESPONSE_INTERRUPT) { tw_cli_dbg_printf(10, ctlr_handle, tw_osl_cur_func(), "Response interrupt"); rc |= TW_CL_TRUE; /* request for a deferred isr call */ tw_cli_process_resp_intr(ctlr); }out: return(rc);}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:68,
示例2: tw_cli_submit_pending_queue/* * Function name: tw_cli_submit_pending_queue * Description: Kick starts any requests in the pending queue. * * Input: ctlr -- ptr to CL internal ctlr context * Output: None * Return value: 0 -- all pending requests submitted successfully * non-zero-- otherwise */TW_INT32tw_cli_submit_pending_queue(struct tw_cli_ctlr_context *ctlr){ struct tw_cli_req_context *req; TW_INT32 error = TW_OSL_ESUCCESS; tw_cli_dbg_printf(3, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); /* * Pull requests off the pending queue, and submit them. */ while ((req = tw_cli_req_q_remove_head(ctlr, TW_CLI_PENDING_Q)) != TW_CL_NULL) { if ((error = tw_cli_submit_cmd(req))) { if (error == TW_OSL_EBUSY) { tw_cli_dbg_printf(2, ctlr->ctlr_handle, tw_osl_cur_func(), "Requeueing pending request"); req->state = TW_CLI_REQ_STATE_PENDING; /* * Queue the request at the head of the pending * queue, and break away, so we don't try to * submit any more requests. */ tw_cli_req_q_insert_head(req, TW_CLI_PENDING_Q); break; } else { tw_cl_create_event(ctlr->ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_ERROR, 0x1202, 0x1, TW_CL_SEVERITY_ERROR_STRING, "Could not start request " "in pending queue", "request = %p, opcode = 0x%x, " "error = %d", req, GET_OPCODE(req->cmd_pkt-> command.cmd_pkt_9k.res__opcode), error); /* * Set the appropriate error and call the CL * internal callback if there's one. If the * request originator is polling for completion, * he should be checking req->error to * determine that the request did not go * through. The request originators are * responsible for the clean-up. */ req->error_code = error; req->state = TW_CLI_REQ_STATE_COMPLETE; if (req->tw_cli_callback) req->tw_cli_callback(req); error = TW_OSL_ESUCCESS; } } } return(error);}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:67,
示例3: tw_cli_notify_ctlr_info/* * Function name: tw_cli_notify_ctlr_info * Description: Notify OSL of controller info (fw/BIOS versions, etc.). * * Input: ctlr -- ptr to CL internal ctlr context * Output: None * Return value: None */TW_VOIDtw_cli_notify_ctlr_info(struct tw_cli_ctlr_context *ctlr){ TW_INT8 fw_ver[16]; TW_INT8 bios_ver[16]; TW_INT8 ctlr_model[16]; TW_INT32 error[3]; TW_UINT8 num_ports = 0; tw_cli_dbg_printf(5, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); /* Get the port count. */ error[0] = tw_cli_get_param(ctlr, TWA_PARAM_CONTROLLER_TABLE, TWA_PARAM_CONTROLLER_PORT_COUNT, &num_ports, 1, TW_CL_NULL); /* Get the firmware and BIOS versions. */ error[0] = tw_cli_get_param(ctlr, TWA_PARAM_VERSION_TABLE, TWA_PARAM_VERSION_FW, fw_ver, 16, TW_CL_NULL); error[1] = tw_cli_get_param(ctlr, TWA_PARAM_VERSION_TABLE, TWA_PARAM_VERSION_BIOS, bios_ver, 16, TW_CL_NULL); error[2] = tw_cli_get_param(ctlr, TWA_PARAM_VERSION_TABLE, TWA_PARAM_CTLR_MODEL, ctlr_model, 16, TW_CL_NULL); tw_cl_create_event(ctlr->ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_ERROR, 0x1300, 0x3, TW_CL_SEVERITY_INFO_STRING, "Controller details:", "Model %.16s, %d ports, Firmware %.16s, BIOS %.16s", error[2]?(TW_INT8 *)TW_CL_NULL:ctlr_model, num_ports, error[0]?(TW_INT8 *)TW_CL_NULL:fw_ver, error[1]?(TW_INT8 *)TW_CL_NULL:bios_ver);}
开发者ID:coyizumi,项目名称:cs111,代码行数:42,
示例4: tw_cli_find_response/* * Function name: tw_cli_find_response * Description: Find a particular response in the ctlr response queue. * * Input: ctlr -- ptr to per ctlr structure * req_id -- request id of the response to look for * Output: None * Return value: 0 -- success * non-zero-- failure */TW_INT32tw_cli_find_response(struct tw_cli_ctlr_context *ctlr, TW_INT32 req_id){ TW_UINT32 resp; TW_INT32 resp_id; TW_UINT32 status_reg; tw_cli_dbg_printf(4, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); for (;;) { status_reg = TW_CLI_READ_STATUS_REGISTER(ctlr->ctlr_handle); if (status_reg & TWA_STATUS_RESPONSE_QUEUE_EMPTY) return(TW_OSL_ENOTTY); /* no more response queue entries */ if (ctlr->device_id == TW_CL_DEVICE_ID_9K) { resp = TW_CLI_READ_RESPONSE_QUEUE(ctlr->ctlr_handle); resp_id = GET_RESP_ID(resp); } else { resp = TW_CLI_READ_LARGE_RESPONSE_QUEUE( ctlr->ctlr_handle); resp_id = GET_LARGE_RESP_ID(resp); } if (resp_id == req_id) return(TW_OSL_ESUCCESS); /* found the req_id */ }}
开发者ID:coyizumi,项目名称:cs111,代码行数:37,
示例5: tw_cli_disable_interrupts/* * Function name: twa_setup * Description: Disables interrupts on the controller * * Input: ctlr -- ptr to CL internal ctlr context * Output: None * Return value: None */TW_VOIDtw_cli_disable_interrupts(struct tw_cli_ctlr_context *ctlr){ tw_cli_dbg_printf(3, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); TW_CLI_WRITE_CONTROL_REGISTER(ctlr->ctlr_handle, TWA_CONTROL_DISABLE_INTERRUPTS); ctlr->interrupts_enabled = TW_CL_FALSE;}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:17,
示例6: tw_cli_param_callback/* * Function name: tw_cli_param_callback * Description: Callback for get/set_param requests. * * Input: req -- ptr to completed request pkt * Output: None * Return value: None */TW_VOIDtw_cli_param_callback(struct tw_cli_req_context *req){ struct tw_cli_ctlr_context *ctlr = req->ctlr; union tw_cl_command_7k *cmd = &(req->cmd_pkt->command.cmd_pkt_7k); TW_INT32 error; tw_cli_dbg_printf(4, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); /* * If the request was never submitted to the controller, the function * that sets req->error is responsible for calling tw_cl_create_event. */ if (! req->error_code) if (cmd->param.status) {#if 0 tw_cli_create_ctlr_event(ctlr, TW_CL_MESSAGE_SOURCE_CONTROLLER_ERROR, &(req->cmd_pkt->cmd_hdr));#endif // 0 tw_cl_create_event(ctlr->ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_ERROR, 0x1204, 0x1, TW_CL_SEVERITY_ERROR_STRING, "get/set_param failed", "status = %d", cmd->param.status); } ctlr->internal_req_busy = TW_CL_FALSE; tw_cli_req_q_insert_tail(req, TW_CLI_FREE_Q); if ((ctlr->get_more_aens) && (!(ctlr->reset_in_progress))) { ctlr->get_more_aens = TW_CL_FALSE; tw_cli_dbg_printf(4, ctlr->ctlr_handle, tw_osl_cur_func(), "Fetching more AEN's"); if ((error = tw_cli_get_aen(ctlr))) tw_cl_create_event(ctlr->ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_ERROR, 0x1205, 0x1, TW_CL_SEVERITY_ERROR_STRING, "Failed to fetch all AEN's from param_callback", "error = %d", error); }}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:51,
示例7: tw_cli_enable_interrupts/* * Function name: tw_cli_enable_interrupts * Description: Enables interrupts on the controller * * Input: ctlr -- ptr to CL internal ctlr context * Output: None * Return value: None */TW_VOIDtw_cli_enable_interrupts(struct tw_cli_ctlr_context *ctlr){ tw_cli_dbg_printf(3, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); ctlr->interrupts_enabled = TW_CL_TRUE; TW_CLI_WRITE_CONTROL_REGISTER(ctlr->ctlr_handle, TWA_CONTROL_CLEAR_ATTENTION_INTERRUPT | TWA_CONTROL_UNMASK_RESPONSE_INTERRUPT | TWA_CONTROL_ENABLE_INTERRUPTS);}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:19,
示例8: tw_cl_reset_stats/* * Function name: tw_cl_reset_stats * Description: Resets CL maintained statistics for the controller. * * Input: ctlr_handle-- controller handle * Output: None * Return value: None */TW_VOIDtw_cl_reset_stats(struct tw_cl_ctlr_handle *ctlr_handle){ struct tw_cli_ctlr_context *ctlr = (struct tw_cli_ctlr_context *)(ctlr_handle->cl_ctlr_ctxt); tw_cli_dbg_printf(7, ctlr_handle, tw_osl_cur_func(), "entered"); ctlr->q_stats[TW_CLI_FREE_Q].max_len = 0; ctlr->q_stats[TW_CLI_BUSY_Q].max_len = 0; ctlr->q_stats[TW_CLI_PENDING_Q].max_len = 0; ctlr->q_stats[TW_CLI_COMPLETE_Q].max_len = 0;}
开发者ID:coyizumi,项目名称:cs111,代码行数:20,
示例9: tw_cli_process_cmd_intr/* * Function name: tw_cli_process_cmd_intr * Description: This function gets called if we hit a queue full * condition earlier, and the fw is now ready for * new cmds. Submits any pending requests. * * Input: ctlr -- ptr to CL internal ctlr context * Output: None * Return value: None */TW_VOIDtw_cli_process_cmd_intr(struct tw_cli_ctlr_context *ctlr){ tw_cli_dbg_printf(6, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); /* Start any requests that might be in the pending queue. */ tw_cli_submit_pending_queue(ctlr); /* * If tw_cli_submit_pending_queue was unsuccessful due to a "cmd queue * full" condition, cmd_intr will already have been unmasked by * tw_cli_submit_cmd. We don't need to do it again... simply return. */}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:24,
示例10: tw_cli_process_complete_queue/* * Function name: tw_cli_process_complete_queue * Description: Calls the CL internal callback routine, if any, for * each request in the complete queue. * * Input: ctlr -- ptr to CL internal ctlr context * Output: None * Return value: None */TW_VOIDtw_cli_process_complete_queue(struct tw_cli_ctlr_context *ctlr){ struct tw_cli_req_context *req; tw_cli_dbg_printf(10, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); /* * Pull commands off the completed list, dispatch them appropriately. */ while ((req = tw_cli_req_q_remove_head(ctlr, TW_CLI_COMPLETE_Q)) != TW_CL_NULL) { /* Call the CL internal callback, if there's one. */ if (req->tw_cli_callback) req->tw_cli_callback(req); }}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:26,
示例11: tw_cli_drain_response_queue/* * Function name: tw_cli_drain_response_queue * Description: Drain the controller response queue. * * Input: ctlr -- ptr to per ctlr structure * Output: None * Return value: 0 -- success * non-zero-- failure */TW_INT32tw_cli_drain_response_queue(struct tw_cli_ctlr_context *ctlr){ TW_UINT32 resp; TW_UINT32 status_reg; tw_cli_dbg_printf(4, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); for (;;) { status_reg = TW_CLI_READ_STATUS_REGISTER(ctlr->ctlr_handle); if (status_reg & TWA_STATUS_RESPONSE_QUEUE_EMPTY) return(TW_OSL_ESUCCESS); /* no more response queue entries */ resp = TW_CLI_READ_RESPONSE_QUEUE(ctlr->ctlr_handle); }}
开发者ID:coyizumi,项目名称:cs111,代码行数:26,
示例12: tw_cli_get_request/* * Function name: tw_cli_get_request * Description: Gets a request pkt from the free queue. * * Input: ctlr -- ptr to CL internal ctlr context * req_pkt -- ptr to OSL built req_pkt, if there's one * Output: None * Return value: ptr to request pkt -- success * TW_CL_NULL -- failure */struct tw_cli_req_context *tw_cli_get_request(struct tw_cli_ctlr_context *ctlr ){ struct tw_cli_req_context *req; tw_cli_dbg_printf(4, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); { /* Get a free request packet. */ req = tw_cli_req_q_remove_head(ctlr, TW_CLI_FREE_Q); } /* Initialize some fields to their defaults. */ if (req) { req->req_handle = TW_CL_NULL; req->data = TW_CL_NULL; req->length = 0; req->data_phys = 0; req->state = TW_CLI_REQ_STATE_INIT; /* req being initialized */ req->flags = 0; req->error_code = 0; req->orig_req = TW_CL_NULL; req->tw_cli_callback = TW_CL_NULL; /* * Look at the status field in the command packet to see how * it completed the last time it was used, and zero out only * the portions that might have changed. Note that we don't * care to zero out the sglist. */ if (req->cmd_pkt->command.cmd_pkt_9k.status) tw_osl_memzero(req->cmd_pkt, sizeof(struct tw_cl_command_header) + 28 /* max bytes before sglist */); else tw_osl_memzero(&(req->cmd_pkt->command), 28 /* max bytes before sglist */); } return(req);}
开发者ID:coyizumi,项目名称:cs111,代码行数:52,
示例13: tw_cli_drain_pending_queueTW_VOIDtw_cli_drain_pending_queue(struct tw_cli_ctlr_context *ctlr){ struct tw_cli_req_context *req; struct tw_cl_req_packet *req_pkt; tw_cli_dbg_printf(3, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); /* * Pull requests off the pending queue, and complete them. */ while ((req = tw_cli_req_q_remove_head(ctlr, TW_CLI_PENDING_Q)) != TW_CL_NULL) { if (req->flags & TW_CLI_REQ_FLAGS_INTERNAL) { /* * It's an internal request. Set the appropriate * error and call the CL internal callback if there's * one. If the request originator is polling for * completion, he should be checking req->error to * determine that the request did not go through. * The request originators are responsible for the * clean-up. */ req->error_code = TW_CL_ERR_REQ_BUS_RESET; if (req->tw_cli_callback) req->tw_cli_callback(req); } else if (req->flags & TW_CLI_REQ_FLAGS_PASSTHRU) { /* It's a passthru request. Complete it. */ if ((req_pkt = req->orig_req) != TW_CL_NULL) { req_pkt->status = TW_CL_ERR_REQ_BUS_RESET; if (req_pkt->tw_osl_callback) req_pkt->tw_osl_callback(req->req_handle); } tw_cli_req_q_insert_tail(req, TW_CLI_FREE_Q); } else { /* It's an external (SCSI) request. Add it to the reset queue. */ tw_osl_untimeout(req->req_handle); tw_cli_req_q_insert_tail(req, TW_CLI_RESET_Q); } } /* End of while loop */}
开发者ID:coyizumi,项目名称:cs111,代码行数:42,
示例14: tw_cli_poll_status/* * Function name: tw_cli_poll_status * Description: Poll for a given status to show up in the firmware * status register. * * Input: ctlr -- ptr to CL internal ctlr context * status -- status to look for * timeout -- max # of seconds to wait before giving up * Output: None * Return value: 0 -- success * non-zero-- failure */TW_INT32tw_cli_poll_status(struct tw_cli_ctlr_context *ctlr, TW_UINT32 status, TW_UINT32 timeout){ TW_TIME end_time; TW_UINT32 status_reg; tw_cli_dbg_printf(4, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); end_time = tw_osl_get_local_time() + timeout; do { status_reg = TW_CLI_READ_STATUS_REGISTER(ctlr->ctlr_handle); if ((status_reg & status) == status) /* got the required bit(s) */ return(TW_OSL_ESUCCESS); tw_osl_delay(1000); } while (tw_osl_get_local_time() <= end_time); return(TW_OSL_ETIMEDOUT);}
开发者ID:coyizumi,项目名称:cs111,代码行数:33,
示例15: tw_cli_find_aen/* * Function name: tw_cli_find_aen * Description: Reports whether a given AEN ever occurred. * * Input: ctlr -- ptr to CL internal ctlr context * aen_code-- AEN to look for * Output: None * Return value: 0 -- success * non-zero-- failure */TW_INT32tw_cli_find_aen(struct tw_cli_ctlr_context *ctlr, TW_UINT16 aen_code){ TW_UINT32 last_index; TW_INT32 i; tw_cli_dbg_printf(4, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); if (ctlr->aen_q_wrapped) last_index = ctlr->aen_head; else last_index = 0; i = ctlr->aen_head; do { i = (i + ctlr->max_aens_supported - 1) % ctlr->max_aens_supported; if (ctlr->aen_queue[i].aen_code == aen_code) return(TW_OSL_ESUCCESS); } while (i != last_index); return(TW_OSL_EGENFAILURE);}
开发者ID:coyizumi,项目名称:cs111,代码行数:33,
示例16: tw_cli_process_attn_intr/* * Function name: tw_cli_process_attn_intr * Description: This function gets called if the fw posted an AEN * (Asynchronous Event Notification). It fetches * all the AEN's that the fw might have posted. * * Input: ctlr -- ptr to CL internal ctlr context * Output: None * Return value: None */TW_VOIDtw_cli_process_attn_intr(struct tw_cli_ctlr_context *ctlr){ TW_INT32 error; tw_cli_dbg_printf(6, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); if ((error = tw_cli_get_aen(ctlr))) { /* * If the driver is already in the process of retrieveing AEN's, * we will be returned TW_OSL_EBUSY. In this case, * tw_cli_param_callback or tw_cli_aen_callback will eventually * retrieve the AEN this attention interrupt is for. So, we * don't need to print the failure. */ if (error != TW_OSL_EBUSY) tw_cl_create_event(ctlr->ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_ERROR, 0x1200, 0x1, TW_CL_SEVERITY_ERROR_STRING, "Failed to fetch AEN", "error = %d", error); }}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:33,
示例17: tw_cl_start_io/* * Function name: tw_cl_start_io * Description: Interface to OS Layer for accepting SCSI requests. * * Input: ctlr_handle -- controller handle * req_pkt -- OSL built request packet * req_handle -- request handle * Output: None * Return value: 0 -- success * non-zero-- failure */TW_INT32tw_cl_start_io(struct tw_cl_ctlr_handle *ctlr_handle, struct tw_cl_req_packet *req_pkt, struct tw_cl_req_handle *req_handle){ struct tw_cli_ctlr_context *ctlr; struct tw_cli_req_context *req; struct tw_cl_command_9k *cmd; struct tw_cl_scsi_req_packet *scsi_req; TW_INT32 error = TW_CL_ERR_REQ_SUCCESS; tw_cli_dbg_printf(10, ctlr_handle, tw_osl_cur_func(), "entered"); ctlr = (struct tw_cli_ctlr_context *)(ctlr_handle->cl_ctlr_ctxt); /* * If working with a firmware version that does not support multiple * luns, and this request is directed at a non-zero lun, error it * back right away. */ if ((req_pkt->gen_req_pkt.scsi_req.lun) && (ctlr->working_srl < TWA_MULTI_LUN_FW_SRL)) { req_pkt->status |= (TW_CL_ERR_REQ_INVALID_LUN | TW_CL_ERR_REQ_SCSI_ERROR); req_pkt->tw_osl_callback(req_handle); return(TW_CL_ERR_REQ_SUCCESS); } if ((req = tw_cli_get_request(ctlr )) == TW_CL_NULL) { tw_cli_dbg_printf(2, ctlr_handle, tw_osl_cur_func(), "Out of request context packets: returning busy"); return(TW_OSL_EBUSY); } req_handle->cl_req_ctxt = req; req->req_handle = req_handle; req->orig_req = req_pkt; req->tw_cli_callback = tw_cli_complete_io; req->flags |= TW_CLI_REQ_FLAGS_EXTERNAL; req->flags |= TW_CLI_REQ_FLAGS_9K; scsi_req = &(req_pkt->gen_req_pkt.scsi_req); /* Build the cmd pkt. */ cmd = &(req->cmd_pkt->command.cmd_pkt_9k); req->cmd_pkt->cmd_hdr.header_desc.size_header = 128; cmd->res__opcode = BUILD_RES__OPCODE(0, TWA_FW_CMD_EXECUTE_SCSI); cmd->unit = (TW_UINT8)(scsi_req->unit); cmd->lun_l4__req_id = TW_CL_SWAP16( BUILD_LUN_L4__REQ_ID(scsi_req->lun, req->request_id)); cmd->status = 0; cmd->sgl_offset = 16; /* offset from end of hdr = max cdb len */ tw_osl_memcpy(cmd->cdb, scsi_req->cdb, scsi_req->cdb_len); if (req_pkt->flags & TW_CL_REQ_CALLBACK_FOR_SGLIST) { TW_UINT32 num_sgl_entries; req_pkt->tw_osl_sgl_callback(req_handle, cmd->sg_list, &num_sgl_entries); cmd->lun_h4__sgl_entries = TW_CL_SWAP16(BUILD_LUN_H4__SGL_ENTRIES(scsi_req->lun, num_sgl_entries)); } else { cmd->lun_h4__sgl_entries = TW_CL_SWAP16(BUILD_LUN_H4__SGL_ENTRIES(scsi_req->lun, scsi_req->sgl_entries)); tw_cli_fill_sg_list(ctlr, scsi_req->sg_list, cmd->sg_list, scsi_req->sgl_entries); } if (((TW_CL_Q_FIRST_ITEM(&(ctlr->req_q_head[TW_CLI_PENDING_Q]))) != TW_CL_NULL) || (ctlr->reset_in_progress)) { tw_cli_req_q_insert_tail(req, TW_CLI_PENDING_Q); TW_CLI_WRITE_CONTROL_REGISTER(ctlr_handle, TWA_CONTROL_UNMASK_COMMAND_INTERRUPT); } else if ((error = tw_cli_submit_cmd(req))) { tw_cli_dbg_printf(2, ctlr_handle, tw_osl_cur_func(), "Could not start request. request = %p, error = %d", req, error); tw_cli_req_q_insert_tail(req, TW_CLI_FREE_Q); } return(error);}
开发者ID:coyizumi,项目名称:cs111,代码行数:97,
示例18: tw_cli_manage_aen/* * Function name: tw_cli_manage_aen * Description: Handles AEN's. * * Input: ctlr -- ptr to CL internal ctlr context * req -- ptr to CL internal request context * Output: None * Return value: None */TW_UINT16tw_cli_manage_aen(struct tw_cli_ctlr_context *ctlr, struct tw_cli_req_context *req){ struct tw_cl_command_header *cmd_hdr; TW_UINT16 aen_code; TW_TIME local_time; TW_TIME sync_time; TW_UINT32 error; tw_cli_dbg_printf(4, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); cmd_hdr = (struct tw_cl_command_header *)(req->data); aen_code = cmd_hdr->status_block.error; switch (aen_code) { case TWA_AEN_SYNC_TIME_WITH_HOST: tw_cli_dbg_printf(4, ctlr->ctlr_handle, tw_osl_cur_func(), "Received AEN_SYNC_TIME"); /* * Free the internal req pkt right here, since * tw_cli_set_param will need it. */ ctlr->internal_req_busy = TW_CL_FALSE; tw_cli_req_q_insert_tail(req, TW_CLI_FREE_Q); /* * We will use a callback in tw_cli_set_param only when * interrupts are enabled and we can expect our callback * to get called. Setting the get_more_aens * flag will make the callback continue to try to retrieve * more AEN's. */ if (ctlr->interrupts_enabled) ctlr->get_more_aens = TW_CL_TRUE; /* Calculate time (in seconds) since last Sunday 12.00 AM. */ local_time = tw_osl_get_local_time(); sync_time = (local_time - (3 * 86400)) % 604800; if ((error = tw_cli_set_param(ctlr, TWA_PARAM_TIME_TABLE, TWA_PARAM_TIME_SCHED_TIME, 4, &sync_time, (ctlr->interrupts_enabled) ? tw_cli_param_callback : TW_CL_NULL))) tw_cl_create_event(ctlr->ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_ERROR, 0x1208, 0x1, TW_CL_SEVERITY_ERROR_STRING, "Unable to sync time with ctlr", "error = %d", error); break; case TWA_AEN_QUEUE_EMPTY: tw_cli_dbg_printf(4, ctlr->ctlr_handle, tw_osl_cur_func(), "AEN queue empty"); break; default: /* Queue the event. */ tw_cli_dbg_printf(4, ctlr->ctlr_handle, tw_osl_cur_func(), "Queueing AEN"); tw_cli_create_ctlr_event(ctlr, TW_CL_MESSAGE_SOURCE_CONTROLLER_EVENT, cmd_hdr); break; } /* switch */ return(aen_code);}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:79,
示例19: tw_cl_print_req_info/* * Function name: tw_cli_print_req_info * Description: Prints CL internal details of a given request. * * Input: req -- ptr to CL internal request context * Output: None * Return value: None */TW_VOIDtw_cl_print_req_info(struct tw_cl_req_handle *req_handle){ struct tw_cli_req_context *req = req_handle->cl_req_ctxt; struct tw_cli_ctlr_context *ctlr = req->ctlr; struct tw_cl_ctlr_handle *ctlr_handle = ctlr->ctlr_handle; struct tw_cl_command_packet *cmd_pkt = req->cmd_pkt; struct tw_cl_command_9k *cmd9k; union tw_cl_command_7k *cmd7k; TW_UINT8 *cdb; TW_VOID *sgl; TW_UINT32 sgl_entries; TW_UINT32 i; tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "CL details for request:"); tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "req_handle = %p, ctlr = %p,/n" "cmd_pkt = %p, cmd_pkt_phys = 0x%llx,/n" "data = %p, length = 0x%x, data_phys = 0x%llx,/n" "state = 0x%x, flags = 0x%x, error = 0x%x,/n" "orig_req = %p, callback = %p, req_id = 0x%x,/n" "next_req = %p, prev_req = %p", req_handle, ctlr, cmd_pkt, req->cmd_pkt_phys, req->data, req->length, req->data_phys, req->state, req->flags, req->error_code, req->orig_req, req->tw_cli_callback, req->request_id, req->link.next, req->link.prev); if (req->flags & TW_CLI_REQ_FLAGS_9K) { cmd9k = &(cmd_pkt->command.cmd_pkt_9k); sgl = cmd9k->sg_list; sgl_entries = TW_CL_SWAP16( GET_SGL_ENTRIES(cmd9k->lun_h4__sgl_entries)); tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "9K cmd: opcode = 0x%x, unit = 0x%x, req_id = 0x%x,/n" "status = 0x%x, sgl_offset = 0x%x, sgl_entries = 0x%x", GET_OPCODE(cmd9k->res__opcode), cmd9k->unit, TW_CL_SWAP16(GET_REQ_ID(cmd9k->lun_l4__req_id)), cmd9k->status, cmd9k->sgl_offset, sgl_entries); cdb = (TW_UINT8 *)(cmd9k->cdb); tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "CDB: %x %x %x %x %x %x %x %x" "%x %x %x %x %x %x %x %x", cdb[0], cdb[1], cdb[2], cdb[3], cdb[4], cdb[5], cdb[6], cdb[7], cdb[8], cdb[9], cdb[10], cdb[11], cdb[12], cdb[13], cdb[14], cdb[15]); } else { cmd7k = &(cmd_pkt->command.cmd_pkt_7k); sgl = cmd7k->param.sgl; sgl_entries = (cmd7k->generic.size - GET_SGL_OFF(cmd7k->generic.sgl_off__opcode)) / ((ctlr->flags & TW_CL_64BIT_ADDRESSES) ? 3 : 2); tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "7K cmd: opcode = 0x%x, sgl_offset = 0x%x,/n" "size = 0x%x, req_id = 0x%x, unit = 0x%x,/n" "status = 0x%x, flags = 0x%x, count = 0x%x", GET_OPCODE(cmd7k->generic.sgl_off__opcode), GET_SGL_OFF(cmd7k->generic.sgl_off__opcode), cmd7k->generic.size, TW_CL_SWAP16(cmd7k->generic.request_id), GET_UNIT(cmd7k->generic.host_id__unit), cmd7k->generic.status, cmd7k->generic.flags, TW_CL_SWAP16(cmd7k->generic.count)); } tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "SG entries:"); if (ctlr->flags & TW_CL_64BIT_ADDRESSES) { struct tw_cl_sg_desc64 *sgl64 = (struct tw_cl_sg_desc64 *)sgl; for (i = 0; i < sgl_entries; i++) { tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "0x%llx 0x%x", sgl64[i].address, sgl64[i].length); } } else { struct tw_cl_sg_desc32 *sgl32 = (struct tw_cl_sg_desc32 *)sgl; for (i = 0; i < sgl_entries; i++) { tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "0x%x 0x%x", sgl32[i].address, sgl32[i].length); } }//.........这里部分代码省略.........
开发者ID:coyizumi,项目名称:cs111,代码行数:101,
示例20: tw_cli_scsi_complete/* * Function name: tw_cli_scsi_complete * Description: Completion routine for SCSI requests. * * Input: req -- ptr to CL internal request context * Output: None * Return value: None */TW_VOIDtw_cli_scsi_complete(struct tw_cli_req_context *req){ struct tw_cl_req_packet *req_pkt = (struct tw_cl_req_packet *)(req->orig_req); struct tw_cl_scsi_req_packet *scsi_req = &(req_pkt->gen_req_pkt.scsi_req); struct tw_cl_command_9k *cmd = &(req->cmd_pkt->command.cmd_pkt_9k); struct tw_cl_command_header *cmd_hdr; TW_UINT16 error; TW_UINT8 *cdb; tw_cli_dbg_printf(8, req->ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); scsi_req->scsi_status = cmd->status; if (! cmd->status) return; tw_cli_dbg_printf(1, req->ctlr->ctlr_handle, tw_osl_cur_func(), "req_id = 0x%x, status = 0x%x", GET_REQ_ID(cmd->lun_l4__req_id), cmd->status); cmd_hdr = &(req->cmd_pkt->cmd_hdr); error = cmd_hdr->status_block.error; if ((error == TWA_ERROR_LOGICAL_UNIT_NOT_SUPPORTED) || (error == TWA_ERROR_UNIT_OFFLINE)) { if (GET_LUN_L4(cmd->lun_l4__req_id)) req_pkt->status |= TW_CL_ERR_REQ_INVALID_LUN; else req_pkt->status |= TW_CL_ERR_REQ_INVALID_TARGET; } else { tw_cli_dbg_printf(2, req->ctlr->ctlr_handle, tw_osl_cur_func(), "cmd = %x %x %x %x %x %x %x", GET_OPCODE(cmd->res__opcode), GET_SGL_OFF(cmd->res__opcode), cmd->unit, cmd->lun_l4__req_id, cmd->status, cmd->sgl_offset, cmd->lun_h4__sgl_entries); cdb = (TW_UINT8 *)(cmd->cdb); tw_cli_dbg_printf(2, req->ctlr->ctlr_handle, tw_osl_cur_func(), "cdb = %x %x %x %x %x %x %x %x " "%x %x %x %x %x %x %x %x", cdb[0], cdb[1], cdb[2], cdb[3], cdb[4], cdb[5], cdb[6], cdb[7], cdb[8], cdb[9], cdb[10], cdb[11], cdb[12], cdb[13], cdb[14], cdb[15]);#if 0 /* * Print the error. Firmware doesn't yet support * the 'Mode Sense' cmd. Don't print if the cmd * is 'Mode Sense', and the error is 'Invalid field * in CDB'. */ if (! ((cdb[0] == 0x1A) && (error == 0x10D))) tw_cli_create_ctlr_event(req->ctlr, TW_CL_MESSAGE_SOURCE_CONTROLLER_ERROR, cmd_hdr);#endif // 0 } if (scsi_req->sense_data) { tw_osl_memcpy(scsi_req->sense_data, cmd_hdr->sense_data, TWA_SENSE_DATA_LENGTH); scsi_req->sense_len = TWA_SENSE_DATA_LENGTH; req_pkt->status |= TW_CL_ERR_REQ_AUTO_SENSE_VALID; } req_pkt->status |= TW_CL_ERR_REQ_SCSI_ERROR;}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:84,
示例21: tw_cli_process_host_intr/* * Function name: tw_cli_process_host_intr * Description: This function gets called if we triggered an interrupt. * We don't use it as of now. * * Input: ctlr -- ptr to CL internal ctlr context * Output: None * Return value: None */TW_VOIDtw_cli_process_host_intr(struct tw_cli_ctlr_context *ctlr){ tw_cli_dbg_printf(6, ctlr->ctlr_handle, tw_osl_cur_func(), "entered");}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:14,
示例22: tw_cli_submit_cmd/* * Function name: tw_cli_submit_cmd * Description: Submits a cmd to firmware. * * Input: req -- ptr to CL internal request context * Output: None * Return value: 0 -- success * non-zero-- failure */TW_INT32tw_cli_submit_cmd(struct tw_cli_req_context *req){ struct tw_cli_ctlr_context *ctlr = req->ctlr; struct tw_cl_ctlr_handle *ctlr_handle = ctlr->ctlr_handle; TW_UINT32 status_reg; TW_INT32 error = 0; tw_cli_dbg_printf(10, ctlr_handle, tw_osl_cur_func(), "entered"); /* Serialize access to the controller cmd queue. */ tw_osl_get_lock(ctlr_handle, ctlr->io_lock); /* For 9650SE first write low 4 bytes */ if ((ctlr->device_id == TW_CL_DEVICE_ID_9K_E) || (ctlr->device_id == TW_CL_DEVICE_ID_9K_SA)) tw_osl_write_reg(ctlr_handle, TWA_COMMAND_QUEUE_OFFSET_LOW, (TW_UINT32)(req->cmd_pkt_phys + sizeof(struct tw_cl_command_header)), 4); status_reg = TW_CLI_READ_STATUS_REGISTER(ctlr_handle); if (status_reg & TWA_STATUS_COMMAND_QUEUE_FULL) { struct tw_cl_req_packet *req_pkt = (struct tw_cl_req_packet *)(req->orig_req); tw_cli_dbg_printf(7, ctlr_handle, tw_osl_cur_func(), "Cmd queue full"); if ((req->flags & TW_CLI_REQ_FLAGS_INTERNAL) || ((req_pkt) && (req_pkt->flags & TW_CL_REQ_RETRY_ON_BUSY)) ) { if (req->state != TW_CLI_REQ_STATE_PENDING) { tw_cli_dbg_printf(2, ctlr_handle, tw_osl_cur_func(), "pending internal/ioctl request"); req->state = TW_CLI_REQ_STATE_PENDING; tw_cli_req_q_insert_tail(req, TW_CLI_PENDING_Q); /* Unmask command interrupt. */ TW_CLI_WRITE_CONTROL_REGISTER(ctlr_handle, TWA_CONTROL_UNMASK_COMMAND_INTERRUPT); } else error = TW_OSL_EBUSY; } else { error = TW_OSL_EBUSY; } } else { tw_cli_dbg_printf(10, ctlr_handle, tw_osl_cur_func(), "Submitting command"); /* Insert command into busy queue */ req->state = TW_CLI_REQ_STATE_BUSY; tw_cli_req_q_insert_tail(req, TW_CLI_BUSY_Q); if ((ctlr->device_id == TW_CL_DEVICE_ID_9K_E) || (ctlr->device_id == TW_CL_DEVICE_ID_9K_SA)) { /* Now write the high 4 bytes */ tw_osl_write_reg(ctlr_handle, TWA_COMMAND_QUEUE_OFFSET_HIGH, (TW_UINT32)(((TW_UINT64)(req->cmd_pkt_phys + sizeof(struct tw_cl_command_header)))>>32), 4); } else { if (ctlr->flags & TW_CL_64BIT_ADDRESSES) {
开发者ID:coyizumi,项目名称:cs111,代码行数:71,
注:本文中的tw_osl_cur_func函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ twi_init函数代码示例 C++ tw_now函数代码示例 |