2 * Copyright (c) 2017 Broadcom. All rights reserved.
3 * The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
15 * 3. Neither the name of the copyright holder nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
38 #include <cam/cam_sim.h>
39 #include <cam/cam_ccb.h>
40 #include <cam/cam_periph.h>
41 #include <cam/cam_xpt_sim.h>
43 #include <cam/scsi/scsi_message.h>
45 #define ccb_ocs_ptr spriv_ptr0
46 #define ccb_io_ptr spriv_ptr1
48 typedef STAILQ_HEAD(ocs_hdr_list_s, ccb_hdr) ocs_hdr_list_t;
50 typedef struct ocs_tgt_resource_s {
58 /* Common SCSI Domain structure declarations */
61 } ocs_scsi_tgt_domain_t;
64 } ocs_scsi_ini_domain_t;
66 /* Common SCSI SLI port structure declarations */
69 } ocs_scsi_tgt_sport_t;
72 } ocs_scsi_ini_sport_t;
74 /* Common IO structure declarations */
77 OCS_CAM_IO_FREE, /* IO unused (SIM) */
78 OCS_CAM_IO_COMMAND, /* ATIO returned to BE (CTL) */
79 OCS_CAM_IO_DATA, /* data phase (SIM) */
80 OCS_CAM_IO_DATA_DONE, /* CTIO returned to BE (CTL) */
81 OCS_CAM_IO_RESP, /* send response (SIM) */
87 uint64_t lun; /* target_lun */
88 void *app; /** application specific pointer */
89 ocs_cam_io_state_t state;
92 #define OCS_CAM_IO_F_DMAPPED BIT(0) /* associated buffer bus_dmamap'd */
93 #define OCS_CAM_IO_F_ABORT_RECV BIT(1) /* received ABORT TASK */
94 #define OCS_CAM_IO_F_ABORT_DEV BIT(2) /* abort WQE pending */
95 #define OCS_CAM_IO_F_ABORT_TMF BIT(3) /* TMF response sent */
96 #define OCS_CAM_IO_F_ABORT_NOTIFY BIT(4) /* XPT_NOTIFY sent to CTL */
97 #define OCS_CAM_IO_F_ABORT_CAM BIT(5) /* received ABORT or CTIO from CAM */
104 uint64_t lun; /* target_lun */
105 uint8_t crnseed; /* next command reference number */
108 /* Common NODE structure declarations */
110 struct ocs_lun_crn *lun_crn[OCS_MAX_LUN];
111 } ocs_scsi_ini_node_t;
115 } ocs_scsi_tgt_node_t;
117 extern int32_t ocs_cam_attach(ocs_t *ocs);
118 extern int32_t ocs_cam_detach(ocs_t *ocs);
120 #endif /* __OCS_CAM_H__ */