1 /*
2 * mr_sas_tbolt.c: source for mr_sas driver for New Generation.
3 * i.e. Thunderbolt and Invader
4 *
5 * Solaris MegaRAID device driver for SAS2.0 controllers
6 * Copyright (c) 2008-2012, LSI Logic Corporation.
7 * All rights reserved.
8 *
9 * Version:
10 * Author:
11 * Swaminathan K S
12 * Arun Chandrashekhar
13 * Manju R
14 * Rasheed
15 * Shakeel Bukhari
16 */
17
18
19 #include <sys/types.h>
20 #include <sys/file.h>
21 #include <sys/atomic.h>
22 #include <sys/scsi/scsi.h>
23 #include <sys/byteorder.h>
24 #include "ld_pd_map.h"
25 #include "mr_sas.h"
26 #include "fusion.h"
27
28 /*
29 * FMA header files
30 */
31 #include <sys/ddifm.h>
32 #include <sys/fm/protocol.h>
33 #include <sys/fm/util.h>
34 #include <sys/fm/io/ddi.h>
35
36
37 /* Pre-TB command size and TB command size. */
38 #define MR_COMMAND_SIZE (64*20) /* 1280 bytes */
39 MR_LD_RAID *MR_LdRaidGet(U32 ld, MR_FW_RAID_MAP_ALL *map);
40 U16 MR_TargetIdToLdGet(U32 ldTgtId, MR_FW_RAID_MAP_ALL *map);
41 U16 MR_GetLDTgtId(U32 ld, MR_FW_RAID_MAP_ALL *map);
42 U16 get_updated_dev_handle(PLD_LOAD_BALANCE_INFO, struct IO_REQUEST_INFO *);
43 extern ddi_dma_attr_t mrsas_generic_dma_attr;
44 extern uint32_t mrsas_tbolt_max_cap_maxxfer;
45 extern struct ddi_device_acc_attr endian_attr;
46 extern int debug_level_g;
47 extern unsigned int enable_fp;
48 volatile int dump_io_wait_time = 90;
49 extern void
50 io_timeout_checker(void *arg);
51 extern volatile int debug_timeout_g;
52 extern int mrsas_issue_pending_cmds(struct mrsas_instance *);
53 extern int mrsas_complete_pending_cmds(struct mrsas_instance *instance);
54 extern void push_pending_mfi_pkt(struct mrsas_instance *,
55 struct mrsas_cmd *);
56 extern U8 MR_BuildRaidContext(struct mrsas_instance *, struct IO_REQUEST_INFO *,
57 MPI2_SCSI_IO_VENDOR_UNIQUE *, MR_FW_RAID_MAP_ALL *);
58
59 /* Local static prototypes. */
60 static struct mrsas_cmd *mrsas_tbolt_build_cmd(struct mrsas_instance *,
61 struct scsi_address *, struct scsi_pkt *, uchar_t *);
62 static void mrsas_tbolt_set_pd_lba(U8 cdb[], uint8_t *cdb_len_ptr,
63 U64 start_blk, U32 num_blocks);
64 static int mrsas_tbolt_check_map_info(struct mrsas_instance *);
65 static int mrsas_tbolt_sync_map_info(struct mrsas_instance *);
66 static int mrsas_tbolt_prepare_pkt(struct scsa_cmd *);
67 static int mrsas_tbolt_ioc_init(struct mrsas_instance *, dma_obj_t *);
68 #ifdef PDSUPPORT
69 static void mrsas_tbolt_get_pd_info(struct mrsas_instance *,
70 struct mrsas_tbolt_pd_info *, int);
1865
1866
1867 con_log(CL_ANN, (CE_CONT,
1868 "tbolt_build_cmd CDB[0] =%x, TargetID =%x\n",
1869 pkt->pkt_cdbp[0], acmd->device_id));
1870 con_log(CL_DLEVEL1, (CE_CONT,
1871 "data length = %x\n",
1872 scsi_raid_io->DataLength));
1873 con_log(CL_DLEVEL1, (CE_CONT,
1874 "cdb length = %x\n",
1875 acmd->cmd_cdblen));
1876 }
1877 break;
1878 }
1879
1880 }
1881
1882 return (cmd);
1883 }
1884
1885 /*
1886 * mrsas_tbolt_tran_init_pkt - allocate & initialize a scsi_pkt structure
1887 * @ap:
1888 * @pkt:
1889 * @bp:
1890 * @cmdlen:
1891 * @statuslen:
1892 * @tgtlen:
1893 * @flags:
1894 * @callback:
1895 *
1896 * The tran_init_pkt() entry point allocates and initializes a scsi_pkt
1897 * structure and DMA resources for a target driver request. The
1898 * tran_init_pkt() entry point is called when the target driver calls the
1899 * SCSA function scsi_init_pkt(). Each call of the tran_init_pkt() entry point
1900 * is a request to perform one or more of three possible services:
1901 * - allocation and initialization of a scsi_pkt structure
1902 * - allocation of DMA resources for data transfer
1903 * - reallocation of DMA resources for the next portion of the data transfer
1904 */
1905 struct scsi_pkt *
1906 mrsas_tbolt_tran_init_pkt(struct scsi_address *ap,
1907 register struct scsi_pkt *pkt,
1908 struct buf *bp, int cmdlen, int statuslen, int tgtlen,
1909 int flags, int (*callback)(), caddr_t arg)
1910 {
1911 struct scsa_cmd *acmd;
1912 struct mrsas_instance *instance;
1913 struct scsi_pkt *new_pkt;
1914
1915 instance = ADDR2MR(ap);
1916
1917 /* step #1 : pkt allocation */
1918 if (pkt == NULL) {
1919 pkt = scsi_hba_pkt_alloc(instance->dip, ap, cmdlen, statuslen,
1920 tgtlen, sizeof (struct scsa_cmd), callback, arg);
1921 if (pkt == NULL) {
1922 return (NULL);
1923 }
1924
1925 acmd = PKT2CMD(pkt);
1926
1927 /*
1928 * Initialize the new pkt - we redundantly initialize
1929 * all the fields for illustrative purposes.
1930 */
1931 acmd->cmd_pkt = pkt;
1932 acmd->cmd_flags = 0;
1933 acmd->cmd_scblen = statuslen;
1934 acmd->cmd_cdblen = cmdlen;
1935 acmd->cmd_dmahandle = NULL;
1936 acmd->cmd_ncookies = 0;
1937 acmd->cmd_cookie = 0;
1938 acmd->cmd_cookiecnt = 0;
1939 acmd->cmd_nwin = 0;
1940
1941 pkt->pkt_address = *ap;
1942 pkt->pkt_comp = (void (*)())NULL;
1943 pkt->pkt_flags = 0;
1944 pkt->pkt_time = 0;
1945 pkt->pkt_resid = 0;
1946 pkt->pkt_state = 0;
1947 pkt->pkt_statistics = 0;
1948 pkt->pkt_reason = 0;
1949 new_pkt = pkt;
1950 } else {
1951 acmd = PKT2CMD(pkt);
1952 new_pkt = NULL;
1953 }
1954
1955 /* step #2 : dma allocation/move */
1956 if (bp && bp->b_bcount != 0) {
1957 if (acmd->cmd_dmahandle == NULL) {
1958 if (mrsas_dma_alloc(instance, pkt, bp, flags,
1959 callback) == DDI_FAILURE) {
1960 if (new_pkt) {
1961 scsi_hba_pkt_free(ap, new_pkt);
1962 }
1963 return ((struct scsi_pkt *)NULL);
1964 }
1965 } else {
1966 if (mrsas_dma_move(instance, pkt, bp) == DDI_FAILURE) {
1967 return ((struct scsi_pkt *)NULL);
1968 }
1969 }
1970 }
1971 return (pkt);
1972 }
1973
1974
1975 uint32_t
1976 tbolt_read_fw_status_reg(struct mrsas_instance *instance)
1977 {
1978 return ((uint32_t)RD_OB_SCRATCH_PAD_0(instance));
1979 }
1980
1981 void
1982 tbolt_issue_cmd(struct mrsas_cmd *cmd, struct mrsas_instance *instance)
1983 {
1984 MRSAS_REQUEST_DESCRIPTOR_UNION *req_desc = cmd->request_desc;
1985 atomic_add_16(&instance->fw_outstanding, 1);
1986
1987 struct scsi_pkt *pkt;
1988
1989 con_log(CL_ANN1,
1990 (CE_NOTE, "tbolt_issue_cmd: cmd->[SMID]=0x%X", cmd->SMID));
1991
1992 con_log(CL_DLEVEL1, (CE_CONT,
1993 " [req desc Words] %" PRIx64 " \n", req_desc->Words));
1994 con_log(CL_DLEVEL1, (CE_CONT,
3615
3616 mr_sas_tbolt_build_mfi_cmd(instance, cmd);
3617
3618 if (instance->func_ptr->issue_cmd_in_poll_mode(instance, cmd)) {
3619 con_log(CL_ANN1, (CE_WARN,
3620 "abort_ldsync_cmd: issue_cmd_in_poll_mode failed"));
3621 ret = -1;
3622 } else {
3623 ret = 0;
3624 }
3625
3626 return_raid_msg_mfi_pkt(instance, cmd);
3627
3628 atomic_add_16(&instance->fw_outstanding, (-1));
3629
3630 return (ret);
3631 }
3632
3633
3634 #ifdef PDSUPPORT
3635 int
3636 mrsas_tbolt_config_pd(struct mrsas_instance *instance, uint16_t tgt,
3637 uint8_t lun, dev_info_t **ldip)
3638 {
3639 struct scsi_device *sd;
3640 dev_info_t *child;
3641 int rval, dtype;
3642 struct mrsas_tbolt_pd_info *pds = NULL;
3643
3644 con_log(CL_ANN1, (CE_NOTE, "mrsas_tbolt_config_pd: t = %d l = %d",
3645 tgt, lun));
3646
3647 if ((child = mrsas_find_child(instance, tgt, lun)) != NULL) {
3648 if (ldip) {
3649 *ldip = child;
3650 }
3651 if (instance->mr_tbolt_pd_list[tgt].flag != MRDRV_TGT_VALID) {
3652 rval = mrsas_service_evt(instance, tgt, 1,
3653 MRSAS_EVT_UNCONFIG_TGT, NULL);
3654 con_log(CL_ANN1, (CE_WARN,
3677 sd->sd_address.a_lun = (uint8_t)lun;
3678
3679 if (scsi_hba_probe(sd, NULL) == SCSIPROBE_EXISTS) {
3680 rval = mrsas_config_scsi_device(instance, sd, ldip);
3681 con_log(CL_DLEVEL1, (CE_NOTE,
3682 "Phys. device found: tgt %d dtype %d: %s",
3683 tgt, dtype, sd->sd_inq->inq_vid));
3684 } else {
3685 rval = NDI_FAILURE;
3686 con_log(CL_DLEVEL1, (CE_NOTE, "Phys. device Not found "
3687 "scsi_hba_probe Failed: tgt %d dtype %d: %s",
3688 tgt, dtype, sd->sd_inq->inq_vid));
3689 }
3690
3691 /* sd_unprobe is blank now. Free buffer manually */
3692 if (sd->sd_inq) {
3693 kmem_free(sd->sd_inq, SUN_INQSIZE);
3694 sd->sd_inq = (struct scsi_inquiry *)NULL;
3695 }
3696 kmem_free(sd, sizeof (struct scsi_device));
3697 rval = NDI_SUCCESS;
3698 } else {
3699 con_log(CL_ANN1, (CE_NOTE,
3700 "Device not supported: tgt %d lun %d dtype %d",
3701 tgt, lun, dtype));
3702 rval = NDI_FAILURE;
3703 }
3704
3705 kmem_free(pds, sizeof (struct mrsas_tbolt_pd_info));
3706 con_log(CL_ANN1, (CE_NOTE, "mrsas_config_pd: return rval = %d",
3707 rval));
3708 return (rval);
3709 }
3710
3711 static void
3712 mrsas_tbolt_get_pd_info(struct mrsas_instance *instance,
3713 struct mrsas_tbolt_pd_info *pds, int tgt)
3714 {
3715 struct mrsas_cmd *cmd;
3716 struct mrsas_dcmd_frame *dcmd;
3717 dma_obj_t dcmd_dma_obj;
3718
3719 cmd = get_raid_msg_pkt(instance);
3720
3721 if (!cmd) {
3722 con_log(CL_ANN1,
3723 (CE_WARN, "Failed to get a cmd for get pd info"));
3724 return;
3725 }
3726
3727 /* Clear the frame buffer and assign back the context id */
3728 bzero((char *)&cmd->frame[0], sizeof (union mrsas_frame));
3729 ddi_put32(cmd->frame_dma_obj.acc_handle, &cmd->frame->hdr.context,
3730 cmd->index);
3731
3732
3733 dcmd = &cmd->frame->dcmd;
3734 dcmd_dma_obj.size = sizeof (struct mrsas_tbolt_pd_info);
3735 dcmd_dma_obj.dma_attr = mrsas_generic_dma_attr;
3736 dcmd_dma_obj.dma_attr.dma_attr_addr_hi = 0xffffffff;
3737 dcmd_dma_obj.dma_attr.dma_attr_count_max = 0xffffffff;
3738 dcmd_dma_obj.dma_attr.dma_attr_sgllen = 1;
3739 dcmd_dma_obj.dma_attr.dma_attr_align = 1;
3744 bzero(dcmd->mbox.b, 12);
3745 ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->cmd, MFI_CMD_OP_DCMD);
3746 ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->cmd_status, 0);
3747 ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->sge_count, 1);
3748 ddi_put16(cmd->frame_dma_obj.acc_handle, &dcmd->flags,
3749 MFI_FRAME_DIR_READ);
3750 ddi_put16(cmd->frame_dma_obj.acc_handle, &dcmd->timeout, 0);
3751 ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->data_xfer_len,
3752 sizeof (struct mrsas_tbolt_pd_info));
3753 ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->opcode,
3754 MR_DCMD_PD_GET_INFO);
3755 ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->mbox.w[0], tgt);
3756 ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->sgl.sge32[0].length,
3757 sizeof (struct mrsas_tbolt_pd_info));
3758 ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->sgl.sge32[0].phys_addr,
3759 dcmd_dma_obj.dma_cookie[0].dmac_address);
3760
3761 cmd->sync_cmd = MRSAS_TRUE;
3762 cmd->frame_count = 1;
3763
3764 if (instance->tbolt) {
3765 mr_sas_tbolt_build_mfi_cmd(instance, cmd);
3766 }
3767
3768 instance->func_ptr->issue_cmd_in_sync_mode(instance, cmd);
3769
3770 ddi_rep_get8(cmd->frame_dma_obj.acc_handle, (uint8_t *)pds,
3771 (uint8_t *)dcmd_dma_obj.buffer, sizeof (struct mrsas_tbolt_pd_info),
3772 DDI_DEV_AUTOINCR);
3773 (void) mrsas_free_dma_obj(instance, dcmd_dma_obj);
3774 return_raid_msg_pkt(instance, cmd);
3775 }
3776 #endif
|
1 /*
2 * mr_sas_tbolt.c: source for mr_sas driver for New Generation.
3 * i.e. Thunderbolt and Invader
4 *
5 * Solaris MegaRAID device driver for SAS2.0 controllers
6 * Copyright (c) 2008-2012, LSI Logic Corporation.
7 * All rights reserved.
8 *
9 * Version:
10 * Author:
11 * Swaminathan K S
12 * Arun Chandrashekhar
13 * Manju R
14 * Rasheed
15 * Shakeel Bukhari
16 */
17
18 /*
19 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
20 */
21
22
23 #include <sys/types.h>
24 #include <sys/file.h>
25 #include <sys/atomic.h>
26 #include <sys/scsi/scsi.h>
27 #include <sys/byteorder.h>
28 #include "ld_pd_map.h"
29 #include "mr_sas.h"
30 #include "fusion.h"
31
32 /*
33 * FMA header files
34 */
35 #include <sys/ddifm.h>
36 #include <sys/fm/protocol.h>
37 #include <sys/fm/util.h>
38 #include <sys/fm/io/ddi.h>
39
40
41 /* Pre-TB command size and TB command size. */
42 #define MR_COMMAND_SIZE (64*20) /* 1280 bytes */
43 MR_LD_RAID *MR_LdRaidGet(U32 ld, MR_FW_RAID_MAP_ALL *map);
44 U16 MR_TargetIdToLdGet(U32 ldTgtId, MR_FW_RAID_MAP_ALL *map);
45 U16 MR_GetLDTgtId(U32 ld, MR_FW_RAID_MAP_ALL *map);
46 U16 get_updated_dev_handle(PLD_LOAD_BALANCE_INFO, struct IO_REQUEST_INFO *);
47 extern ddi_dma_attr_t mrsas_generic_dma_attr;
48 extern uint32_t mrsas_tbolt_max_cap_maxxfer;
49 extern struct ddi_device_acc_attr endian_attr;
50 extern int debug_level_g;
51 extern unsigned int enable_fp;
52 volatile int dump_io_wait_time = 90;
53 extern volatile int debug_timeout_g;
54 extern int mrsas_issue_pending_cmds(struct mrsas_instance *);
55 extern int mrsas_complete_pending_cmds(struct mrsas_instance *instance);
56 extern void push_pending_mfi_pkt(struct mrsas_instance *,
57 struct mrsas_cmd *);
58 extern U8 MR_BuildRaidContext(struct mrsas_instance *, struct IO_REQUEST_INFO *,
59 MPI2_SCSI_IO_VENDOR_UNIQUE *, MR_FW_RAID_MAP_ALL *);
60
61 /* Local static prototypes. */
62 static struct mrsas_cmd *mrsas_tbolt_build_cmd(struct mrsas_instance *,
63 struct scsi_address *, struct scsi_pkt *, uchar_t *);
64 static void mrsas_tbolt_set_pd_lba(U8 cdb[], uint8_t *cdb_len_ptr,
65 U64 start_blk, U32 num_blocks);
66 static int mrsas_tbolt_check_map_info(struct mrsas_instance *);
67 static int mrsas_tbolt_sync_map_info(struct mrsas_instance *);
68 static int mrsas_tbolt_prepare_pkt(struct scsa_cmd *);
69 static int mrsas_tbolt_ioc_init(struct mrsas_instance *, dma_obj_t *);
70 #ifdef PDSUPPORT
71 static void mrsas_tbolt_get_pd_info(struct mrsas_instance *,
72 struct mrsas_tbolt_pd_info *, int);
1867
1868
1869 con_log(CL_ANN, (CE_CONT,
1870 "tbolt_build_cmd CDB[0] =%x, TargetID =%x\n",
1871 pkt->pkt_cdbp[0], acmd->device_id));
1872 con_log(CL_DLEVEL1, (CE_CONT,
1873 "data length = %x\n",
1874 scsi_raid_io->DataLength));
1875 con_log(CL_DLEVEL1, (CE_CONT,
1876 "cdb length = %x\n",
1877 acmd->cmd_cdblen));
1878 }
1879 break;
1880 }
1881
1882 }
1883
1884 return (cmd);
1885 }
1886
1887 uint32_t
1888 tbolt_read_fw_status_reg(struct mrsas_instance *instance)
1889 {
1890 return ((uint32_t)RD_OB_SCRATCH_PAD_0(instance));
1891 }
1892
1893 void
1894 tbolt_issue_cmd(struct mrsas_cmd *cmd, struct mrsas_instance *instance)
1895 {
1896 MRSAS_REQUEST_DESCRIPTOR_UNION *req_desc = cmd->request_desc;
1897 atomic_add_16(&instance->fw_outstanding, 1);
1898
1899 struct scsi_pkt *pkt;
1900
1901 con_log(CL_ANN1,
1902 (CE_NOTE, "tbolt_issue_cmd: cmd->[SMID]=0x%X", cmd->SMID));
1903
1904 con_log(CL_DLEVEL1, (CE_CONT,
1905 " [req desc Words] %" PRIx64 " \n", req_desc->Words));
1906 con_log(CL_DLEVEL1, (CE_CONT,
3527
3528 mr_sas_tbolt_build_mfi_cmd(instance, cmd);
3529
3530 if (instance->func_ptr->issue_cmd_in_poll_mode(instance, cmd)) {
3531 con_log(CL_ANN1, (CE_WARN,
3532 "abort_ldsync_cmd: issue_cmd_in_poll_mode failed"));
3533 ret = -1;
3534 } else {
3535 ret = 0;
3536 }
3537
3538 return_raid_msg_mfi_pkt(instance, cmd);
3539
3540 atomic_add_16(&instance->fw_outstanding, (-1));
3541
3542 return (ret);
3543 }
3544
3545
3546 #ifdef PDSUPPORT
3547 /*
3548 * Even though these functions were originally intended for 2208 only, it
3549 * turns out they're useful for "Skinny" support as well. In a perfect world,
3550 * these two functions would be either in mr_sas.c, or in their own new source
3551 * file. Since this driver needs some cleanup anyway, keep this portion in
3552 * mind as well.
3553 */
3554
3555 int
3556 mrsas_tbolt_config_pd(struct mrsas_instance *instance, uint16_t tgt,
3557 uint8_t lun, dev_info_t **ldip)
3558 {
3559 struct scsi_device *sd;
3560 dev_info_t *child;
3561 int rval, dtype;
3562 struct mrsas_tbolt_pd_info *pds = NULL;
3563
3564 con_log(CL_ANN1, (CE_NOTE, "mrsas_tbolt_config_pd: t = %d l = %d",
3565 tgt, lun));
3566
3567 if ((child = mrsas_find_child(instance, tgt, lun)) != NULL) {
3568 if (ldip) {
3569 *ldip = child;
3570 }
3571 if (instance->mr_tbolt_pd_list[tgt].flag != MRDRV_TGT_VALID) {
3572 rval = mrsas_service_evt(instance, tgt, 1,
3573 MRSAS_EVT_UNCONFIG_TGT, NULL);
3574 con_log(CL_ANN1, (CE_WARN,
3597 sd->sd_address.a_lun = (uint8_t)lun;
3598
3599 if (scsi_hba_probe(sd, NULL) == SCSIPROBE_EXISTS) {
3600 rval = mrsas_config_scsi_device(instance, sd, ldip);
3601 con_log(CL_DLEVEL1, (CE_NOTE,
3602 "Phys. device found: tgt %d dtype %d: %s",
3603 tgt, dtype, sd->sd_inq->inq_vid));
3604 } else {
3605 rval = NDI_FAILURE;
3606 con_log(CL_DLEVEL1, (CE_NOTE, "Phys. device Not found "
3607 "scsi_hba_probe Failed: tgt %d dtype %d: %s",
3608 tgt, dtype, sd->sd_inq->inq_vid));
3609 }
3610
3611 /* sd_unprobe is blank now. Free buffer manually */
3612 if (sd->sd_inq) {
3613 kmem_free(sd->sd_inq, SUN_INQSIZE);
3614 sd->sd_inq = (struct scsi_inquiry *)NULL;
3615 }
3616 kmem_free(sd, sizeof (struct scsi_device));
3617 } else {
3618 con_log(CL_ANN1, (CE_NOTE,
3619 "Device not supported: tgt %d lun %d dtype %d",
3620 tgt, lun, dtype));
3621 rval = NDI_FAILURE;
3622 }
3623
3624 kmem_free(pds, sizeof (struct mrsas_tbolt_pd_info));
3625 con_log(CL_ANN1, (CE_NOTE, "mrsas_config_pd: return rval = %d",
3626 rval));
3627 return (rval);
3628 }
3629
3630 static void
3631 mrsas_tbolt_get_pd_info(struct mrsas_instance *instance,
3632 struct mrsas_tbolt_pd_info *pds, int tgt)
3633 {
3634 struct mrsas_cmd *cmd;
3635 struct mrsas_dcmd_frame *dcmd;
3636 dma_obj_t dcmd_dma_obj;
3637
3638 ASSERT(instance->tbolt || instance->skinny);
3639
3640 if (instance->tbolt)
3641 cmd = get_raid_msg_pkt(instance);
3642 else
3643 cmd = mrsas_get_mfi_pkt(instance);
3644
3645 if (!cmd) {
3646 con_log(CL_ANN1,
3647 (CE_WARN, "Failed to get a cmd for get pd info"));
3648 return;
3649 }
3650
3651 /* Clear the frame buffer and assign back the context id */
3652 bzero((char *)&cmd->frame[0], sizeof (union mrsas_frame));
3653 ddi_put32(cmd->frame_dma_obj.acc_handle, &cmd->frame->hdr.context,
3654 cmd->index);
3655
3656
3657 dcmd = &cmd->frame->dcmd;
3658 dcmd_dma_obj.size = sizeof (struct mrsas_tbolt_pd_info);
3659 dcmd_dma_obj.dma_attr = mrsas_generic_dma_attr;
3660 dcmd_dma_obj.dma_attr.dma_attr_addr_hi = 0xffffffff;
3661 dcmd_dma_obj.dma_attr.dma_attr_count_max = 0xffffffff;
3662 dcmd_dma_obj.dma_attr.dma_attr_sgllen = 1;
3663 dcmd_dma_obj.dma_attr.dma_attr_align = 1;
3668 bzero(dcmd->mbox.b, 12);
3669 ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->cmd, MFI_CMD_OP_DCMD);
3670 ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->cmd_status, 0);
3671 ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->sge_count, 1);
3672 ddi_put16(cmd->frame_dma_obj.acc_handle, &dcmd->flags,
3673 MFI_FRAME_DIR_READ);
3674 ddi_put16(cmd->frame_dma_obj.acc_handle, &dcmd->timeout, 0);
3675 ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->data_xfer_len,
3676 sizeof (struct mrsas_tbolt_pd_info));
3677 ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->opcode,
3678 MR_DCMD_PD_GET_INFO);
3679 ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->mbox.w[0], tgt);
3680 ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->sgl.sge32[0].length,
3681 sizeof (struct mrsas_tbolt_pd_info));
3682 ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->sgl.sge32[0].phys_addr,
3683 dcmd_dma_obj.dma_cookie[0].dmac_address);
3684
3685 cmd->sync_cmd = MRSAS_TRUE;
3686 cmd->frame_count = 1;
3687
3688 if (instance->tbolt)
3689 mr_sas_tbolt_build_mfi_cmd(instance, cmd);
3690
3691 instance->func_ptr->issue_cmd_in_sync_mode(instance, cmd);
3692
3693 ddi_rep_get8(cmd->frame_dma_obj.acc_handle, (uint8_t *)pds,
3694 (uint8_t *)dcmd_dma_obj.buffer, sizeof (struct mrsas_tbolt_pd_info),
3695 DDI_DEV_AUTOINCR);
3696 (void) mrsas_free_dma_obj(instance, dcmd_dma_obj);
3697
3698 if (instance->tbolt)
3699 return_raid_msg_pkt(instance, cmd);
3700 else
3701 mrsas_return_mfi_pkt(instance, cmd);
3702 }
3703 #endif
|