Lines Matching refs:cmd

97     u_long cmd, caddr_t arg);
112 int mrsas_issue_dcmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd);
113 int mrsas_issue_polled(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd);
120 struct mrsas_mfi_cmd *cmd);
124 void mrsas_release_mfi_cmd(struct mrsas_mfi_cmd *cmd);
125 void mrsas_wakeup(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd);
126 void mrsas_complete_aen(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd);
127 void mrsas_complete_abort(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd);
147 struct mrsas_mfi_cmd *cmd, u_int8_t status);
151 (struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd);
155 extern void mrsas_cmd_done(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd);
156 extern void mrsas_free_frame(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd);
171 void mrsas_release_mpt_cmd(struct mrsas_mpt_cmd *cmd);
173 void mrsas_map_mpt_cmd_status(struct mrsas_mpt_cmd *cmd,
529 * mrsas_alloc_evt_log_info cmd: Allocates memory to get event log information.
558 device_printf(sc->mrsas_dev, "Cannot allocate event log info cmd mem\n");
564 device_printf(sc->mrsas_dev, "Cannot load event log info cmd mem\n");
602 struct mrsas_mfi_cmd *cmd;
606 cmd = mrsas_get_mfi_cmd(sc);
608 if (!cmd) {
609 device_printf(sc->mrsas_dev, "Failed to get a free cmd\n");
612 dcmd = &cmd->frame->dcmd;
615 device_printf(sc->mrsas_dev, "Cannot allocate evt log info cmd\n");
616 mrsas_release_mfi_cmd(cmd);
621 dcmd->cmd = MFI_CMD_DCMD;
632 retcode = mrsas_issue_blocked_cmd(sc, cmd);
647 mrsas_release_mfi_cmd(cmd);
668 struct mrsas_mfi_cmd *cmd;
723 cmd = mrsas_get_mfi_cmd(sc);
724 if (!cmd)
727 dcmd = &cmd->frame->dcmd;
736 dcmd->cmd = MFI_CMD_DCMD;
751 mrsas_release_mfi_cmd(cmd);
755 * Store reference to the cmd used to register for AEN. When an
757 * cmd and re-register with a new EVENT LOCALE supplied by that app
759 sc->aen_cmd = cmd;
764 if (mrsas_issue_dcmd(sc, cmd)) {
869 uint32_t cmd, error;
915 cmd = pci_read_config(dev, PCIR_COMMAND, 2);
916 if ((cmd & PCIM_CMD_PORTEN) == 0) {
920 cmd |= PCIM_CMD_BUSMASTEREN;
921 pci_write_config(dev, PCIR_COMMAND, cmd, 2);
1444 * mrsas_get_softc_instance: Find softc instance based on cmd type
1446 * This function will return softc instance based on cmd type.
1454 mrsas_get_softc_instance(struct cdev *dev, u_long cmd, caddr_t arg)
1459 if (cmd == MRSAS_IOC_GET_PCI_INFO) {
1485 mrsas_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag,
1492 sc = mrsas_get_softc_instance(dev, cmd, arg);
1519 switch (cmd) {
1530 ret = mrsas_passthru(sc, (void *)arg, cmd);
1556 mrsas_dprint(sc, MRSAS_TRACE, "IOCTL command 0x%lx is not handled\n", cmd);
1870 mrsas_map_mpt_cmd_status(struct mrsas_mpt_cmd *cmd, union ccb *ccb_ptr, u_int8_t status,
1873 struct mrsas_softc *sc = cmd->sc;
1902 device_printf(sc->mrsas_dev, "FW cmd complete status %x\n", status);
2454 device_printf(sc->mrsas_dev, "Allocate MFI cmd failed.\n");
2574 * Prepares for the issuing of the IOC Init cmd to FW for initializing the
2628 "max fw cmd: 0x%x\n", sc->max_num_sge,
2661 * Allocates for the IOC Init cmd to FW to initialize the ROC/controller.
2686 device_printf(sc->mrsas_dev, "Cannot allocate ioc init cmd mem\n");
2693 device_printf(sc->mrsas_dev, "Cannot load ioc init cmd mem\n");
2703 * Deallocates memory of the IOC Init cmd.
2720 * Issues the IOC Init cmd to FW to initialize the ROC/controller.
2759 init_frame->cmd = MFI_CMD_INIT;
2835 * maintained in a linked list (cmd pool). SMID value range is from 1 to
2843 struct mrsas_mpt_cmd *cmd;
2889 cmd = sc->mpt_cmd_list[i];
2893 memset(cmd, 0, sizeof(struct mrsas_mpt_cmd));
2894 cmd->index = i + 1;
2895 cmd->ccb_ptr = NULL;
2896 cmd->r1_alt_dev_handle = MR_DEVHANDLE_INVALID;
2897 callout_init_mtx(&cmd->cm_callout, &sc->sim_lock, 0);
2898 cmd->sync_cmd_idx = (u_int32_t)MRSAS_ULONG_MAX;
2899 cmd->sc = sc;
2900 cmd->io_request = (MRSAS_RAID_SCSI_IO_REQUEST *) (io_req_base + offset);
2901 memset(cmd->io_request, 0, sizeof(MRSAS_RAID_SCSI_IO_REQUEST));
2902 cmd->io_request_phys_addr = io_req_base_phys + offset;
2903 cmd->chain_frame = (MPI2_SGE_IO_UNION *) (chain_frame_base + chain_offset);
2904 cmd->chain_frame_phys_addr = chain_frame_base_phys + chain_offset;
2905 cmd->sense = sense_base + sense_offset;
2906 cmd->sense_phys_addr = sense_base_phys + sense_offset;
2907 if (bus_dmamap_create(sc->data_tag, 0, &cmd->data_dmamap)) {
2910 TAILQ_INSERT_TAIL(&(sc->mrsas_mpt_cmd_list_head), cmd, next);
3076 * mrsas_get_mfi_cmd: Get a cmd from free command pool
3084 struct mrsas_mfi_cmd *cmd = NULL;
3088 cmd = TAILQ_FIRST(&sc->mrsas_mfi_cmd_list_head);
3089 TAILQ_REMOVE(&sc->mrsas_mfi_cmd_list_head, cmd, next);
3093 return cmd;
3396 "Cannot build MPT cmd.\n");
3506 if (cmd_mfi->sync_cmd && cmd_mfi->frame->hdr.cmd != MFI_CMD_ABORT) {
3583 * mrsas_release_mfi_cmd: Return a cmd to free command pool
3584 * input: Command packet for return to free cmd pool
3602 /* Get the mpt cmd from mfi cmd frame's smid value */
3632 struct mrsas_mfi_cmd *cmd;
3635 cmd = mrsas_get_mfi_cmd(sc);
3637 if (!cmd) {
3638 device_printf(sc->mrsas_dev, "Failed to get a free cmd\n");
3641 dcmd = &cmd->frame->dcmd;
3644 device_printf(sc->mrsas_dev, "Cannot allocate get ctlr info cmd\n");
3645 mrsas_release_mfi_cmd(cmd);
3650 dcmd->cmd = MFI_CMD_DCMD;
3662 retcode = mrsas_issue_blocked_cmd(sc, cmd);
3664 retcode = mrsas_issue_polled(sc, cmd);
3689 mrsas_release_mfi_cmd(cmd);
3780 device_printf(sc->mrsas_dev, "Cannot allocate ctlr info cmd mem\n");
3786 device_printf(sc->mrsas_dev, "Cannot load ctlr info cmd mem\n");
3797 * Deallocates memory of the get controller info cmd.
3820 mrsas_issue_polled(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd)
3822 struct mrsas_header *frame_hdr = &cmd->frame->hdr;
3830 if (mrsas_issue_dcmd(sc, cmd)) {
3851 cmd->frame->dcmd.opcode);
3858 * mrsas_issue_dcmd: Issues a MFI Pass thru cmd
3859 * input: Adapter soft state mfi cmd pointer
3866 mrsas_issue_dcmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd)
3870 req_desc = mrsas_build_mpt_cmd(sc, cmd);
3872 device_printf(sc->mrsas_dev, "Cannot build MPT cmd.\n");
3881 * mrsas_build_mpt_cmd: Calls helper function to build Passthru cmd
3882 * input: Adapter soft state mfi cmd to build
3888 mrsas_build_mpt_cmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd)
3893 if (mrsas_build_mptmfi_passthru(sc, cmd)) {
3894 device_printf(sc->mrsas_dev, "Cannot build MPT-MFI passthru cmd.\n");
3897 index = cmd->cmd_id.context.smid;
3913 * input: Adapter soft state mfi cmd pointer
3930 /* Save the smid. To be used for returning the cmd */
3977 mrsas_issue_blocked_cmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd)
3984 cmd->cmd_status = 0xFF;
3987 if (mrsas_issue_dcmd(sc, cmd)) {
3991 sc->chan = (void *)&cmd;
3994 if (cmd->cmd_status == 0xFF) {
3999 if (!cmd->sync_cmd) { /* cmd->sync will be set for an IOCTL
4011 if (cmd->cmd_status == 0xFF) {
4015 cmd->frame->dcmd.opcode);
4024 * @cmd: Command to be completed
4025 * @status: cmd completion status
4032 mrsas_complete_mptmfi_passthru(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd,
4035 struct mrsas_header *hdr = &cmd->frame->hdr;
4036 u_int8_t cmd_status = cmd->frame->hdr.cmd_status;
4039 cmd->retry_for_fw_reset = 0;
4041 if (cmd->ccb_ptr)
4042 cmd->ccb_ptr = NULL;
4044 switch (hdr->cmd) {
4055 if (cmd->sync_cmd) {
4056 cmd->sync_cmd = 0;
4057 mrsas_wakeup(sc, cmd);
4064 if ((cmd->frame->dcmd.opcode == MR_DCMD_LD_MAP_GET_INFO) &&
4065 (cmd->frame->dcmd.mbox.b[1] == 1)) {
4073 mrsas_release_mfi_cmd(cmd);
4079 mrsas_release_mfi_cmd(cmd);
4088 if (cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_GET_INFO ||
4089 cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_GET) {
4093 if ((cmd->frame->dcmd.opcode ==
4095 (cmd->frame->dcmd.mbox.b[0] == 1)) {
4099 mrsas_release_mfi_cmd(cmd);
4103 /* Re-register a pd sync seq num cmd */
4115 if (cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_WAIT)
4116 mrsas_complete_aen(sc, cmd);
4118 mrsas_wakeup(sc, cmd);
4121 /* Command issued to abort another cmd return */
4122 mrsas_complete_abort(sc, cmd);
4125 device_printf(sc->mrsas_dev, "Unknown command completed! [0x%X]\n", hdr->cmd);
4141 mrsas_wakeup(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd)
4143 cmd->cmd_status = cmd->frame->io.cmd_status;
4145 if (cmd->cmd_status == 0xFF)
4146 cmd->cmd_status = 0;
4148 sc->chan = (void *)&cmd;
4163 struct mrsas_mfi_cmd *cmd;
4169 cmd = mrsas_get_mfi_cmd(sc);
4170 if (!cmd) {
4171 device_printf(sc->mrsas_dev, "Cannot allocate for shutdown cmd.\n");
4181 dcmd = &cmd->frame->dcmd;
4184 dcmd->cmd = MFI_CMD_DCMD;
4195 mrsas_issue_blocked_cmd(sc, cmd);
4196 mrsas_release_mfi_cmd(cmd);
4211 struct mrsas_mfi_cmd *cmd;
4217 cmd = mrsas_get_mfi_cmd(sc);
4218 if (!cmd) {
4219 device_printf(sc->mrsas_dev, "Cannot allocate for flush cache cmd.\n");
4222 dcmd = &cmd->frame->dcmd;
4225 dcmd->cmd = MFI_CMD_DCMD;
4235 mrsas_issue_blocked_cmd(sc, cmd);
4236 mrsas_release_mfi_cmd(cmd);
4246 struct mrsas_mfi_cmd *cmd;
4256 cmd = mrsas_get_mfi_cmd(sc);
4257 if (!cmd) {
4259 "Cannot alloc for ld map info cmd.\n");
4262 dcmd = &cmd->frame->dcmd;
4269 mrsas_release_mfi_cmd(cmd);
4274 dcmd->cmd = MFI_CMD_DCMD;
4287 sc->jbod_seq_cmd = cmd;
4288 if (mrsas_issue_dcmd(sc, cmd)) {
4297 retcode = mrsas_issue_polled(sc, cmd);
4352 struct mrsas_mfi_cmd *cmd;
4357 cmd = mrsas_get_mfi_cmd(sc);
4358 if (!cmd) {
4360 "Cannot alloc for ld map info cmd.\n");
4363 dcmd = &cmd->frame->dcmd;
4370 mrsas_release_mfi_cmd(cmd);
4376 dcmd->cmd = MFI_CMD_DCMD;
4387 retcode = mrsas_issue_polled(sc, cmd);
4405 struct mrsas_mfi_cmd *cmd;
4414 cmd = mrsas_get_mfi_cmd(sc);
4415 if (!cmd) {
4416 device_printf(sc->mrsas_dev, "Cannot alloc for sync map info cmd\n");
4422 dcmd = &cmd->frame->dcmd;
4439 dcmd->cmd = MFI_CMD_DCMD;
4452 sc->map_update_cmd = cmd;
4453 if (mrsas_issue_dcmd(sc, cmd)) {
4472 struct mrsas_mfi_cmd *cmd;
4475 cmd = mrsas_get_mfi_cmd(sc);
4477 if (!cmd) {
4479 "Cannot alloc for get PD info cmd\n");
4482 dcmd = &cmd->frame->dcmd;
4488 dcmd->cmd = MFI_CMD_DCMD;
4500 retcode = mrsas_issue_blocked_cmd(sc, cmd);
4502 retcode = mrsas_issue_polled(sc, cmd);
4518 mrsas_release_mfi_cmd(cmd);
4581 struct mrsas_mfi_cmd *cmd;
4588 cmd = mrsas_get_mfi_cmd(sc);
4589 if (!cmd) {
4591 "Cannot alloc for get PD list cmd\n");
4594 dcmd = &cmd->frame->dcmd;
4600 "Cannot alloc dmamap for get PD list cmd\n");
4601 mrsas_release_mfi_cmd(cmd);
4613 dcmd->cmd = MFI_CMD_DCMD;
4625 retcode = mrsas_issue_blocked_cmd(sc, cmd);
4627 retcode = mrsas_issue_polled(sc, cmd);
4671 mrsas_release_mfi_cmd(cmd);
4689 struct mrsas_mfi_cmd *cmd;
4695 cmd = mrsas_get_mfi_cmd(sc);
4696 if (!cmd) {
4698 "Cannot alloc for get LD list cmd\n");
4701 dcmd = &cmd->frame->dcmd;
4707 "Cannot alloc dmamap for get LD list cmd\n");
4708 mrsas_release_mfi_cmd(cmd);
4721 dcmd->cmd = MFI_CMD_DCMD;
4733 retcode = mrsas_issue_blocked_cmd(sc, cmd);
4735 retcode = mrsas_issue_polled(sc, cmd);
4773 mrsas_release_mfi_cmd(cmd);
4838 * mrsas_issue_blocked_abort_cmd: Aborts previously issued cmd input:
4839 * Adapter soft state Previously issued cmd to be aborted
4850 struct mrsas_mfi_cmd *cmd;
4856 cmd = mrsas_get_mfi_cmd(sc);
4857 if (!cmd) {
4858 device_printf(sc->mrsas_dev, "Cannot alloc for abort cmd\n");
4861 abort_fr = &cmd->frame->abort;
4864 abort_fr->cmd = MFI_CMD_ABORT;
4871 cmd->sync_cmd = 1;
4872 cmd->cmd_status = 0xFF;
4874 if (mrsas_issue_dcmd(sc, cmd)) {
4878 /* Wait for this cmd to complete */
4879 sc->chan = (void *)&cmd;
4881 if (cmd->cmd_status == 0xFF) {
4887 device_printf(sc->mrsas_dev, "Abort cmd timed out after %d sec.\n", max_wait);
4893 cmd->sync_cmd = 0;
4894 mrsas_release_mfi_cmd(cmd);
4900 * Adapter soft state Cmd that was issued to abort another cmd
4907 mrsas_complete_abort(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd)
4909 if (cmd->sync_cmd) {
4910 cmd->sync_cmd = 0;
4911 cmd->cmd_status = 0;
4912 sc->chan = (void *)&cmd;
5028 * Cmd that was issued to abort another cmd
5035 mrsas_complete_aen(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd)
5041 if ((!cmd->abort_aen) && (sc->remove_in_progress == 0)) {
5050 cmd->abort_aen = 0;
5053 mrsas_release_mfi_cmd(cmd);