Go to the documentation of this file.
17 #ifndef _MEGA_COMMON_H_
18 #define _MEGA_COMMON_H_
20 #include <linux/kernel.h>
21 #include <linux/types.h>
22 #include <linux/pci.h>
28 #include <linux/list.h>
31 #include <scsi/scsi.h>
37 #define LSI_MAX_CHANNELS 16
38 #define LSI_MAX_LOGICAL_DRIVES_64LD (64+1)
40 #define HBA_SIGNATURE_64_BIT 0x299
41 #define PCI_CONF_AMISIG64 0xa4
43 #define MEGA_SCSI_INQ_EVPD 1
44 #define MEGA_INVALID_FIELD_IN_CDB 0x24
85 #define SCB_FREE 0x0000
86 #define SCB_ACTIVE 0x0001
87 #define SCB_PENDQ 0x0002
88 #define SCB_ISSUED 0x0004
89 #define SCB_ABORT 0x0008
90 #define SCB_RESET 0x0010
95 #define MRAID_DMA_NONE 0x0000
96 #define MRAID_DMA_WSG 0x0001
97 #define MRAID_DMA_WBUF 0x0002
153 #define VERSION_SIZE 16
196 #define SCSI_FREE_LIST_LOCK(adapter) (&adapter->kscb_pool_lock)
197 #define USER_FREE_LIST_LOCK(adapter) (&adapter->uscb_pool_lock)
198 #define PENDING_LIST_LOCK(adapter) (&adapter->pend_list_lock)
199 #define COMPLETED_LIST_LOCK(adapter) (&adapter->completed_list_lock)
203 #define SCP2HOST(scp) (scp)->device->host // to host
204 #define SCP2HOSTDATA(scp) SCP2HOST(scp)->hostdata // to soft state
205 #define SCP2CHANNEL(scp) (scp)->device->channel // to channel
206 #define SCP2TARGET(scp) (scp)->device->id // to target
207 #define SCP2LUN(scp) (scp)->device->lun // to LUN
210 #define SCSIHOST2ADAP(host) (((caddr_t *)(host->hostdata))[0])
211 #define SCP2ADAPTER(scp) (adapter_t *)SCSIHOST2ADAP(SCP2HOST(scp))
214 #define MRAID_IS_LOGICAL(adp, scp) \
215 (SCP2CHANNEL(scp) == (adp)->max_channel) ? 1 : 0
217 #define MRAID_IS_LOGICAL_SDEV(adp, sdev) \
218 (sdev->channel == (adp)->max_channel) ? 1 : 0
231 #define MRAID_GET_DEVICE_MAP(adp, scp, p_chan, target, islogical) \
235 islogical = MRAID_IS_LOGICAL(adp, scp); \
243 (adp)->device_ids[(adp)->max_channel][SCP2TARGET(scp)]; \
246 p_chan = ((adp)->device_ids[SCP2CHANNEL(scp)] \
247 [SCP2TARGET(scp)] >> 8) & 0xFF; \
248 target = ((adp)->device_ids[SCP2CHANNEL(scp)] \
249 [SCP2TARGET(scp)] & 0xFF); \
255 #define LSI_DBGLVL mraid_debug_level // each LLD must define a global
259 #if defined (_ASSERT_PANIC)
260 #define ASSERT_ACTION panic
262 #define ASSERT_ACTION printk
265 #define ASSERT(expression) \
266 if (!(expression)) { \
267 ASSERT_ACTION("assertion failed:(%s), file: %s, line: %d:%s\n", \
268 #expression, __FILE__, __LINE__, __func__); \
271 #define ASSERT(expression)
288 #endif // _MEGA_COMMON_H_