diff options
Diffstat (limited to 'drivers/scsi/bfa/bfa_ioc.h')
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h index 1055ca9f6043..83c3f2fc3411 100644 --- a/drivers/scsi/bfa/bfa_ioc.h +++ b/drivers/scsi/bfa/bfa_ioc.h | |||
@@ -85,6 +85,68 @@ struct bfa_sge_s { | |||
85 | #endif | 85 | #endif |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * BFA memory resources | ||
89 | */ | ||
90 | struct bfa_mem_dma_s { | ||
91 | struct list_head qe; /* Queue of DMA elements */ | ||
92 | u32 mem_len; /* Total Length in Bytes */ | ||
93 | u8 *kva; /* kernel virtual address */ | ||
94 | u64 dma; /* dma address if DMA memory */ | ||
95 | u8 *kva_curp; /* kva allocation cursor */ | ||
96 | u64 dma_curp; /* dma allocation cursor */ | ||
97 | }; | ||
98 | #define bfa_mem_dma_t struct bfa_mem_dma_s | ||
99 | |||
100 | struct bfa_mem_kva_s { | ||
101 | struct list_head qe; /* Queue of KVA elements */ | ||
102 | u32 mem_len; /* Total Length in Bytes */ | ||
103 | u8 *kva; /* kernel virtual address */ | ||
104 | u8 *kva_curp; /* kva allocation cursor */ | ||
105 | }; | ||
106 | #define bfa_mem_kva_t struct bfa_mem_kva_s | ||
107 | |||
108 | struct bfa_meminfo_s { | ||
109 | struct bfa_mem_dma_s dma_info; | ||
110 | struct bfa_mem_kva_s kva_info; | ||
111 | }; | ||
112 | |||
113 | /* BFA memory segment setup macros */ | ||
114 | #define bfa_mem_dma_setup(_meminfo, _dm_ptr, _seg_sz) do { \ | ||
115 | ((bfa_mem_dma_t *)(_dm_ptr))->mem_len = (_seg_sz); \ | ||
116 | if (_seg_sz) \ | ||
117 | list_add_tail(&((bfa_mem_dma_t *)_dm_ptr)->qe, \ | ||
118 | &(_meminfo)->dma_info.qe); \ | ||
119 | } while (0) | ||
120 | |||
121 | #define bfa_mem_kva_setup(_meminfo, _kva_ptr, _seg_sz) do { \ | ||
122 | ((bfa_mem_kva_t *)(_kva_ptr))->mem_len = (_seg_sz); \ | ||
123 | if (_seg_sz) \ | ||
124 | list_add_tail(&((bfa_mem_kva_t *)_kva_ptr)->qe, \ | ||
125 | &(_meminfo)->kva_info.qe); \ | ||
126 | } while (0) | ||
127 | |||
128 | /* BFA dma memory segments iterator */ | ||
129 | #define bfa_mem_dma_sptr(_mod, _i) (&(_mod)->dma_seg[(_i)]) | ||
130 | #define bfa_mem_dma_seg_iter(_mod, _sptr, _nr, _i) \ | ||
131 | for (_i = 0, _sptr = bfa_mem_dma_sptr(_mod, _i); _i < (_nr); \ | ||
132 | _i++, _sptr = bfa_mem_dma_sptr(_mod, _i)) | ||
133 | |||
134 | #define bfa_mem_kva_curp(_mod) ((_mod)->kva_seg.kva_curp) | ||
135 | #define bfa_mem_dma_virt(_sptr) ((_sptr)->kva_curp) | ||
136 | #define bfa_mem_dma_phys(_sptr) ((_sptr)->dma_curp) | ||
137 | #define bfa_mem_dma_len(_sptr) ((_sptr)->mem_len) | ||
138 | |||
139 | /* Get the corresponding dma buf kva for a req - from the tag */ | ||
140 | #define bfa_mem_get_dmabuf_kva(_mod, _tag, _rqsz) \ | ||
141 | (((u8 *)(_mod)->dma_seg[BFI_MEM_SEG_FROM_TAG(_tag, _rqsz)].kva_curp) +\ | ||
142 | BFI_MEM_SEG_REQ_OFFSET(_tag, _rqsz) * (_rqsz)) | ||
143 | |||
144 | /* Get the corresponding dma buf pa for a req - from the tag */ | ||
145 | #define bfa_mem_get_dmabuf_pa(_mod, _tag, _rqsz) \ | ||
146 | ((_mod)->dma_seg[BFI_MEM_SEG_FROM_TAG(_tag, _rqsz)].dma_curp + \ | ||
147 | BFI_MEM_SEG_REQ_OFFSET(_tag, _rqsz) * (_rqsz)) | ||
148 | |||
149 | /* | ||
88 | * PCI device information required by IOC | 150 | * PCI device information required by IOC |
89 | */ | 151 | */ |
90 | struct bfa_pcidev_s { | 152 | struct bfa_pcidev_s { |
@@ -301,7 +363,9 @@ struct bfa_ablk_s { | |||
301 | bfa_ablk_cbfn_t cbfn; | 363 | bfa_ablk_cbfn_t cbfn; |
302 | void *cbarg; | 364 | void *cbarg; |
303 | struct bfa_ioc_notify_s ioc_notify; | 365 | struct bfa_ioc_notify_s ioc_notify; |
366 | struct bfa_mem_dma_s ablk_dma; | ||
304 | }; | 367 | }; |
368 | #define BFA_MEM_ABLK_DMA(__bfa) (&((__bfa)->modules.ablk.ablk_dma)) | ||
305 | 369 | ||
306 | #define bfa_ioc_pcifn(__ioc) ((__ioc)->pcidev.pci_func) | 370 | #define bfa_ioc_pcifn(__ioc) ((__ioc)->pcidev.pci_func) |
307 | #define bfa_ioc_devid(__ioc) ((__ioc)->pcidev.device_id) | 371 | #define bfa_ioc_devid(__ioc) ((__ioc)->pcidev.device_id) |