diff options
Diffstat (limited to 'drivers/scsi')
89 files changed, 7393 insertions, 4465 deletions
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index 56662ae03dea..b9276d10b25c 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c | |||
@@ -216,6 +216,7 @@ | |||
216 | #include <scsi/scsi_host.h> | 216 | #include <scsi/scsi_host.h> |
217 | #include <scsi/scsi_tcq.h> | 217 | #include <scsi/scsi_tcq.h> |
218 | #include <scsi/scsi_cmnd.h> | 218 | #include <scsi/scsi_cmnd.h> |
219 | #include <scsi/scsi_eh.h> | ||
219 | #include "3w-xxxx.h" | 220 | #include "3w-xxxx.h" |
220 | 221 | ||
221 | /* Globals */ | 222 | /* Globals */ |
@@ -2009,7 +2010,8 @@ static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_c | |||
2009 | printk(KERN_NOTICE "3w-xxxx: scsi%d: Unknown scsi opcode: 0x%x\n", tw_dev->host->host_no, *command); | 2010 | printk(KERN_NOTICE "3w-xxxx: scsi%d: Unknown scsi opcode: 0x%x\n", tw_dev->host->host_no, *command); |
2010 | tw_dev->state[request_id] = TW_S_COMPLETED; | 2011 | tw_dev->state[request_id] = TW_S_COMPLETED; |
2011 | tw_state_request_finish(tw_dev, request_id); | 2012 | tw_state_request_finish(tw_dev, request_id); |
2012 | SCpnt->result = (DID_BAD_TARGET << 16); | 2013 | SCpnt->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; |
2014 | scsi_build_sense_buffer(1, SCpnt->sense_buffer, ILLEGAL_REQUEST, 0x20, 0); | ||
2013 | done(SCpnt); | 2015 | done(SCpnt); |
2014 | retval = 0; | 2016 | retval = 0; |
2015 | } | 2017 | } |
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c index 344d87599cd2..feab3a5e50b5 100644 --- a/drivers/scsi/BusLogic.c +++ b/drivers/scsi/BusLogic.c | |||
@@ -26,8 +26,8 @@ | |||
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #define BusLogic_DriverVersion "2.1.16" | 29 | #define blogic_drvr_version "2.1.16" |
30 | #define BusLogic_DriverDate "18 July 2002" | 30 | #define blogic_drvr_date "18 July 2002" |
31 | 31 | ||
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
@@ -60,24 +60,24 @@ | |||
60 | #define FAILURE (-1) | 60 | #define FAILURE (-1) |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | static struct scsi_host_template Bus_Logic_template; | 63 | static struct scsi_host_template blogic_template; |
64 | 64 | ||
65 | /* | 65 | /* |
66 | BusLogic_DriverOptionsCount is a count of the number of BusLogic Driver | 66 | blogic_drvr_options_count is a count of the number of BusLogic Driver |
67 | Options specifications provided via the Linux Kernel Command Line or via | 67 | Options specifications provided via the Linux Kernel Command Line or via |
68 | the Loadable Kernel Module Installation Facility. | 68 | the Loadable Kernel Module Installation Facility. |
69 | */ | 69 | */ |
70 | 70 | ||
71 | static int BusLogic_DriverOptionsCount; | 71 | static int blogic_drvr_options_count; |
72 | 72 | ||
73 | 73 | ||
74 | /* | 74 | /* |
75 | BusLogic_DriverOptions is an array of Driver Options structures representing | 75 | blogic_drvr_options is an array of Driver Options structures representing |
76 | BusLogic Driver Options specifications provided via the Linux Kernel Command | 76 | BusLogic Driver Options specifications provided via the Linux Kernel Command |
77 | Line or via the Loadable Kernel Module Installation Facility. | 77 | Line or via the Loadable Kernel Module Installation Facility. |
78 | */ | 78 | */ |
79 | 79 | ||
80 | static struct BusLogic_DriverOptions BusLogic_DriverOptions[BusLogic_MaxHostAdapters]; | 80 | static struct blogic_drvr_options blogic_drvr_options[BLOGIC_MAX_ADAPTERS]; |
81 | 81 | ||
82 | 82 | ||
83 | /* | 83 | /* |
@@ -92,241 +92,251 @@ module_param(BusLogic, charp, 0); | |||
92 | 92 | ||
93 | 93 | ||
94 | /* | 94 | /* |
95 | BusLogic_ProbeOptions is a set of Probe Options to be applied across | 95 | blogic_probe_options is a set of Probe Options to be applied across |
96 | all BusLogic Host Adapters. | 96 | all BusLogic Host Adapters. |
97 | */ | 97 | */ |
98 | 98 | ||
99 | static struct BusLogic_ProbeOptions BusLogic_ProbeOptions; | 99 | static struct blogic_probe_options blogic_probe_options; |
100 | 100 | ||
101 | 101 | ||
102 | /* | 102 | /* |
103 | BusLogic_GlobalOptions is a set of Global Options to be applied across | 103 | blogic_global_options is a set of Global Options to be applied across |
104 | all BusLogic Host Adapters. | 104 | all BusLogic Host Adapters. |
105 | */ | 105 | */ |
106 | 106 | ||
107 | static struct BusLogic_GlobalOptions BusLogic_GlobalOptions; | 107 | static struct blogic_global_options blogic_global_options; |
108 | 108 | ||
109 | static LIST_HEAD(BusLogic_host_list); | 109 | static LIST_HEAD(blogic_host_list); |
110 | 110 | ||
111 | /* | 111 | /* |
112 | BusLogic_ProbeInfoCount is the number of entries in BusLogic_ProbeInfoList. | 112 | blogic_probeinfo_count is the number of entries in blogic_probeinfo_list. |
113 | */ | 113 | */ |
114 | 114 | ||
115 | static int BusLogic_ProbeInfoCount; | 115 | static int blogic_probeinfo_count; |
116 | 116 | ||
117 | 117 | ||
118 | /* | 118 | /* |
119 | BusLogic_ProbeInfoList is the list of I/O Addresses and Bus Probe Information | 119 | blogic_probeinfo_list is the list of I/O Addresses and Bus Probe Information |
120 | to be checked for potential BusLogic Host Adapters. It is initialized by | 120 | to be checked for potential BusLogic Host Adapters. It is initialized by |
121 | interrogating the PCI Configuration Space on PCI machines as well as from the | 121 | interrogating the PCI Configuration Space on PCI machines as well as from the |
122 | list of standard BusLogic I/O Addresses. | 122 | list of standard BusLogic I/O Addresses. |
123 | */ | 123 | */ |
124 | 124 | ||
125 | static struct BusLogic_ProbeInfo *BusLogic_ProbeInfoList; | 125 | static struct blogic_probeinfo *blogic_probeinfo_list; |
126 | 126 | ||
127 | 127 | ||
128 | /* | 128 | /* |
129 | BusLogic_CommandFailureReason holds a string identifying the reason why a | 129 | blogic_cmd_failure_reason holds a string identifying the reason why a |
130 | call to BusLogic_Command failed. It is only non-NULL when BusLogic_Command | 130 | call to blogic_cmd failed. It is only non-NULL when blogic_cmd |
131 | returns a failure code. | 131 | returns a failure code. |
132 | */ | 132 | */ |
133 | 133 | ||
134 | static char *BusLogic_CommandFailureReason; | 134 | static char *blogic_cmd_failure_reason; |
135 | 135 | ||
136 | /* | 136 | /* |
137 | BusLogic_AnnounceDriver announces the Driver Version and Date, Author's | 137 | blogic_announce_drvr announces the Driver Version and Date, Author's |
138 | Name, Copyright Notice, and Electronic Mail Address. | 138 | Name, Copyright Notice, and Electronic Mail Address. |
139 | */ | 139 | */ |
140 | 140 | ||
141 | static void BusLogic_AnnounceDriver(struct BusLogic_HostAdapter *HostAdapter) | 141 | static void blogic_announce_drvr(struct blogic_adapter *adapter) |
142 | { | 142 | { |
143 | BusLogic_Announce("***** BusLogic SCSI Driver Version " BusLogic_DriverVersion " of " BusLogic_DriverDate " *****\n", HostAdapter); | 143 | blogic_announce("***** BusLogic SCSI Driver Version " blogic_drvr_version " of " blogic_drvr_date " *****\n", adapter); |
144 | BusLogic_Announce("Copyright 1995-1998 by Leonard N. Zubkoff " "<lnz@dandelion.com>\n", HostAdapter); | 144 | blogic_announce("Copyright 1995-1998 by Leonard N. Zubkoff " "<lnz@dandelion.com>\n", adapter); |
145 | } | 145 | } |
146 | 146 | ||
147 | 147 | ||
148 | /* | 148 | /* |
149 | BusLogic_DriverInfo returns the Host Adapter Name to identify this SCSI | 149 | blogic_drvr_info returns the Host Adapter Name to identify this SCSI |
150 | Driver and Host Adapter. | 150 | Driver and Host Adapter. |
151 | */ | 151 | */ |
152 | 152 | ||
153 | static const char *BusLogic_DriverInfo(struct Scsi_Host *Host) | 153 | static const char *blogic_drvr_info(struct Scsi_Host *host) |
154 | { | 154 | { |
155 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Host->hostdata; | 155 | struct blogic_adapter *adapter = |
156 | return HostAdapter->FullModelName; | 156 | (struct blogic_adapter *) host->hostdata; |
157 | return adapter->full_model; | ||
157 | } | 158 | } |
158 | 159 | ||
159 | /* | 160 | /* |
160 | BusLogic_InitializeCCBs initializes a group of Command Control Blocks (CCBs) | 161 | blogic_init_ccbs initializes a group of Command Control Blocks (CCBs) |
161 | for Host Adapter from the BlockSize bytes located at BlockPointer. The newly | 162 | for Host Adapter from the blk_size bytes located at blk_pointer. The newly |
162 | created CCBs are added to Host Adapter's free list. | 163 | created CCBs are added to Host Adapter's free list. |
163 | */ | 164 | */ |
164 | 165 | ||
165 | static void BusLogic_InitializeCCBs(struct BusLogic_HostAdapter *HostAdapter, void *BlockPointer, int BlockSize, dma_addr_t BlockPointerHandle) | 166 | static void blogic_init_ccbs(struct blogic_adapter *adapter, void *blk_pointer, |
167 | int blk_size, dma_addr_t blkp) | ||
166 | { | 168 | { |
167 | struct BusLogic_CCB *CCB = (struct BusLogic_CCB *) BlockPointer; | 169 | struct blogic_ccb *ccb = (struct blogic_ccb *) blk_pointer; |
168 | unsigned int offset = 0; | 170 | unsigned int offset = 0; |
169 | memset(BlockPointer, 0, BlockSize); | 171 | memset(blk_pointer, 0, blk_size); |
170 | CCB->AllocationGroupHead = BlockPointerHandle; | 172 | ccb->allocgrp_head = blkp; |
171 | CCB->AllocationGroupSize = BlockSize; | 173 | ccb->allocgrp_size = blk_size; |
172 | while ((BlockSize -= sizeof(struct BusLogic_CCB)) >= 0) { | 174 | while ((blk_size -= sizeof(struct blogic_ccb)) >= 0) { |
173 | CCB->Status = BusLogic_CCB_Free; | 175 | ccb->status = BLOGIC_CCB_FREE; |
174 | CCB->HostAdapter = HostAdapter; | 176 | ccb->adapter = adapter; |
175 | CCB->DMA_Handle = (u32) BlockPointerHandle + offset; | 177 | ccb->dma_handle = (u32) blkp + offset; |
176 | if (BusLogic_FlashPointHostAdapterP(HostAdapter)) { | 178 | if (blogic_flashpoint_type(adapter)) { |
177 | CCB->CallbackFunction = BusLogic_QueueCompletedCCB; | 179 | ccb->callback = blogic_qcompleted_ccb; |
178 | CCB->BaseAddress = HostAdapter->FlashPointInfo.BaseAddress; | 180 | ccb->base_addr = adapter->fpinfo.base_addr; |
179 | } | 181 | } |
180 | CCB->Next = HostAdapter->Free_CCBs; | 182 | ccb->next = adapter->free_ccbs; |
181 | CCB->NextAll = HostAdapter->All_CCBs; | 183 | ccb->next_all = adapter->all_ccbs; |
182 | HostAdapter->Free_CCBs = CCB; | 184 | adapter->free_ccbs = ccb; |
183 | HostAdapter->All_CCBs = CCB; | 185 | adapter->all_ccbs = ccb; |
184 | HostAdapter->AllocatedCCBs++; | 186 | adapter->alloc_ccbs++; |
185 | CCB++; | 187 | ccb++; |
186 | offset += sizeof(struct BusLogic_CCB); | 188 | offset += sizeof(struct blogic_ccb); |
187 | } | 189 | } |
188 | } | 190 | } |
189 | 191 | ||
190 | 192 | ||
191 | /* | 193 | /* |
192 | BusLogic_CreateInitialCCBs allocates the initial CCBs for Host Adapter. | 194 | blogic_create_initccbs allocates the initial CCBs for Host Adapter. |
193 | */ | 195 | */ |
194 | 196 | ||
195 | static bool __init BusLogic_CreateInitialCCBs(struct BusLogic_HostAdapter *HostAdapter) | 197 | static bool __init blogic_create_initccbs(struct blogic_adapter *adapter) |
196 | { | 198 | { |
197 | int BlockSize = BusLogic_CCB_AllocationGroupSize * sizeof(struct BusLogic_CCB); | 199 | int blk_size = BLOGIC_CCB_GRP_ALLOCSIZE * sizeof(struct blogic_ccb); |
198 | void *BlockPointer; | 200 | void *blk_pointer; |
199 | dma_addr_t BlockPointerHandle; | 201 | dma_addr_t blkp; |
200 | while (HostAdapter->AllocatedCCBs < HostAdapter->InitialCCBs) { | 202 | |
201 | BlockPointer = pci_alloc_consistent(HostAdapter->PCI_Device, BlockSize, &BlockPointerHandle); | 203 | while (adapter->alloc_ccbs < adapter->initccbs) { |
202 | if (BlockPointer == NULL) { | 204 | blk_pointer = pci_alloc_consistent(adapter->pci_device, |
203 | BusLogic_Error("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n", HostAdapter); | 205 | blk_size, &blkp); |
206 | if (blk_pointer == NULL) { | ||
207 | blogic_err("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n", | ||
208 | adapter); | ||
204 | return false; | 209 | return false; |
205 | } | 210 | } |
206 | BusLogic_InitializeCCBs(HostAdapter, BlockPointer, BlockSize, BlockPointerHandle); | 211 | blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp); |
207 | } | 212 | } |
208 | return true; | 213 | return true; |
209 | } | 214 | } |
210 | 215 | ||
211 | 216 | ||
212 | /* | 217 | /* |
213 | BusLogic_DestroyCCBs deallocates the CCBs for Host Adapter. | 218 | blogic_destroy_ccbs deallocates the CCBs for Host Adapter. |
214 | */ | 219 | */ |
215 | 220 | ||
216 | static void BusLogic_DestroyCCBs(struct BusLogic_HostAdapter *HostAdapter) | 221 | static void blogic_destroy_ccbs(struct blogic_adapter *adapter) |
217 | { | 222 | { |
218 | struct BusLogic_CCB *NextCCB = HostAdapter->All_CCBs, *CCB, *Last_CCB = NULL; | 223 | struct blogic_ccb *next_ccb = adapter->all_ccbs, *ccb, *lastccb = NULL; |
219 | HostAdapter->All_CCBs = NULL; | 224 | adapter->all_ccbs = NULL; |
220 | HostAdapter->Free_CCBs = NULL; | 225 | adapter->free_ccbs = NULL; |
221 | while ((CCB = NextCCB) != NULL) { | 226 | while ((ccb = next_ccb) != NULL) { |
222 | NextCCB = CCB->NextAll; | 227 | next_ccb = ccb->next_all; |
223 | if (CCB->AllocationGroupHead) { | 228 | if (ccb->allocgrp_head) { |
224 | if (Last_CCB) | 229 | if (lastccb) |
225 | pci_free_consistent(HostAdapter->PCI_Device, Last_CCB->AllocationGroupSize, Last_CCB, Last_CCB->AllocationGroupHead); | 230 | pci_free_consistent(adapter->pci_device, |
226 | Last_CCB = CCB; | 231 | lastccb->allocgrp_size, lastccb, |
232 | lastccb->allocgrp_head); | ||
233 | lastccb = ccb; | ||
227 | } | 234 | } |
228 | } | 235 | } |
229 | if (Last_CCB) | 236 | if (lastccb) |
230 | pci_free_consistent(HostAdapter->PCI_Device, Last_CCB->AllocationGroupSize, Last_CCB, Last_CCB->AllocationGroupHead); | 237 | pci_free_consistent(adapter->pci_device, lastccb->allocgrp_size, |
238 | lastccb, lastccb->allocgrp_head); | ||
231 | } | 239 | } |
232 | 240 | ||
233 | 241 | ||
234 | /* | 242 | /* |
235 | BusLogic_CreateAdditionalCCBs allocates Additional CCBs for Host Adapter. If | 243 | blogic_create_addlccbs allocates Additional CCBs for Host Adapter. If |
236 | allocation fails and there are no remaining CCBs available, the Driver Queue | 244 | allocation fails and there are no remaining CCBs available, the Driver Queue |
237 | Depth is decreased to a known safe value to avoid potential deadlocks when | 245 | Depth is decreased to a known safe value to avoid potential deadlocks when |
238 | multiple host adapters share the same IRQ Channel. | 246 | multiple host adapters share the same IRQ Channel. |
239 | */ | 247 | */ |
240 | 248 | ||
241 | static void BusLogic_CreateAdditionalCCBs(struct BusLogic_HostAdapter *HostAdapter, int AdditionalCCBs, bool SuccessMessageP) | 249 | static void blogic_create_addlccbs(struct blogic_adapter *adapter, |
250 | int addl_ccbs, bool print_success) | ||
242 | { | 251 | { |
243 | int BlockSize = BusLogic_CCB_AllocationGroupSize * sizeof(struct BusLogic_CCB); | 252 | int blk_size = BLOGIC_CCB_GRP_ALLOCSIZE * sizeof(struct blogic_ccb); |
244 | int PreviouslyAllocated = HostAdapter->AllocatedCCBs; | 253 | int prev_alloc = adapter->alloc_ccbs; |
245 | void *BlockPointer; | 254 | void *blk_pointer; |
246 | dma_addr_t BlockPointerHandle; | 255 | dma_addr_t blkp; |
247 | if (AdditionalCCBs <= 0) | 256 | if (addl_ccbs <= 0) |
248 | return; | 257 | return; |
249 | while (HostAdapter->AllocatedCCBs - PreviouslyAllocated < AdditionalCCBs) { | 258 | while (adapter->alloc_ccbs - prev_alloc < addl_ccbs) { |
250 | BlockPointer = pci_alloc_consistent(HostAdapter->PCI_Device, BlockSize, &BlockPointerHandle); | 259 | blk_pointer = pci_alloc_consistent(adapter->pci_device, |
251 | if (BlockPointer == NULL) | 260 | blk_size, &blkp); |
261 | if (blk_pointer == NULL) | ||
252 | break; | 262 | break; |
253 | BusLogic_InitializeCCBs(HostAdapter, BlockPointer, BlockSize, BlockPointerHandle); | 263 | blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp); |
254 | } | 264 | } |
255 | if (HostAdapter->AllocatedCCBs > PreviouslyAllocated) { | 265 | if (adapter->alloc_ccbs > prev_alloc) { |
256 | if (SuccessMessageP) | 266 | if (print_success) |
257 | BusLogic_Notice("Allocated %d additional CCBs (total now %d)\n", HostAdapter, HostAdapter->AllocatedCCBs - PreviouslyAllocated, HostAdapter->AllocatedCCBs); | 267 | blogic_notice("Allocated %d additional CCBs (total now %d)\n", adapter, adapter->alloc_ccbs - prev_alloc, adapter->alloc_ccbs); |
258 | return; | 268 | return; |
259 | } | 269 | } |
260 | BusLogic_Notice("Failed to allocate additional CCBs\n", HostAdapter); | 270 | blogic_notice("Failed to allocate additional CCBs\n", adapter); |
261 | if (HostAdapter->DriverQueueDepth > HostAdapter->AllocatedCCBs - HostAdapter->TargetDeviceCount) { | 271 | if (adapter->drvr_qdepth > adapter->alloc_ccbs - adapter->tgt_count) { |
262 | HostAdapter->DriverQueueDepth = HostAdapter->AllocatedCCBs - HostAdapter->TargetDeviceCount; | 272 | adapter->drvr_qdepth = adapter->alloc_ccbs - adapter->tgt_count; |
263 | HostAdapter->SCSI_Host->can_queue = HostAdapter->DriverQueueDepth; | 273 | adapter->scsi_host->can_queue = adapter->drvr_qdepth; |
264 | } | 274 | } |
265 | } | 275 | } |
266 | 276 | ||
267 | /* | 277 | /* |
268 | BusLogic_AllocateCCB allocates a CCB from Host Adapter's free list, | 278 | blogic_alloc_ccb allocates a CCB from Host Adapter's free list, |
269 | allocating more memory from the Kernel if necessary. The Host Adapter's | 279 | allocating more memory from the Kernel if necessary. The Host Adapter's |
270 | Lock should already have been acquired by the caller. | 280 | Lock should already have been acquired by the caller. |
271 | */ | 281 | */ |
272 | 282 | ||
273 | static struct BusLogic_CCB *BusLogic_AllocateCCB(struct BusLogic_HostAdapter | 283 | static struct blogic_ccb *blogic_alloc_ccb(struct blogic_adapter *adapter) |
274 | *HostAdapter) | ||
275 | { | 284 | { |
276 | static unsigned long SerialNumber = 0; | 285 | static unsigned long serial; |
277 | struct BusLogic_CCB *CCB; | 286 | struct blogic_ccb *ccb; |
278 | CCB = HostAdapter->Free_CCBs; | 287 | ccb = adapter->free_ccbs; |
279 | if (CCB != NULL) { | 288 | if (ccb != NULL) { |
280 | CCB->SerialNumber = ++SerialNumber; | 289 | ccb->serial = ++serial; |
281 | HostAdapter->Free_CCBs = CCB->Next; | 290 | adapter->free_ccbs = ccb->next; |
282 | CCB->Next = NULL; | 291 | ccb->next = NULL; |
283 | if (HostAdapter->Free_CCBs == NULL) | 292 | if (adapter->free_ccbs == NULL) |
284 | BusLogic_CreateAdditionalCCBs(HostAdapter, HostAdapter->IncrementalCCBs, true); | 293 | blogic_create_addlccbs(adapter, adapter->inc_ccbs, |
285 | return CCB; | 294 | true); |
286 | } | 295 | return ccb; |
287 | BusLogic_CreateAdditionalCCBs(HostAdapter, HostAdapter->IncrementalCCBs, true); | 296 | } |
288 | CCB = HostAdapter->Free_CCBs; | 297 | blogic_create_addlccbs(adapter, adapter->inc_ccbs, true); |
289 | if (CCB == NULL) | 298 | ccb = adapter->free_ccbs; |
299 | if (ccb == NULL) | ||
290 | return NULL; | 300 | return NULL; |
291 | CCB->SerialNumber = ++SerialNumber; | 301 | ccb->serial = ++serial; |
292 | HostAdapter->Free_CCBs = CCB->Next; | 302 | adapter->free_ccbs = ccb->next; |
293 | CCB->Next = NULL; | 303 | ccb->next = NULL; |
294 | return CCB; | 304 | return ccb; |
295 | } | 305 | } |
296 | 306 | ||
297 | 307 | ||
298 | /* | 308 | /* |
299 | BusLogic_DeallocateCCB deallocates a CCB, returning it to the Host Adapter's | 309 | blogic_dealloc_ccb deallocates a CCB, returning it to the Host Adapter's |
300 | free list. The Host Adapter's Lock should already have been acquired by the | 310 | free list. The Host Adapter's Lock should already have been acquired by the |
301 | caller. | 311 | caller. |
302 | */ | 312 | */ |
303 | 313 | ||
304 | static void BusLogic_DeallocateCCB(struct BusLogic_CCB *CCB) | 314 | static void blogic_dealloc_ccb(struct blogic_ccb *ccb) |
305 | { | 315 | { |
306 | struct BusLogic_HostAdapter *HostAdapter = CCB->HostAdapter; | 316 | struct blogic_adapter *adapter = ccb->adapter; |
307 | 317 | ||
308 | scsi_dma_unmap(CCB->Command); | 318 | scsi_dma_unmap(ccb->command); |
309 | pci_unmap_single(HostAdapter->PCI_Device, CCB->SenseDataPointer, | 319 | pci_unmap_single(adapter->pci_device, ccb->sensedata, |
310 | CCB->SenseDataLength, PCI_DMA_FROMDEVICE); | 320 | ccb->sense_datalen, PCI_DMA_FROMDEVICE); |
311 | 321 | ||
312 | CCB->Command = NULL; | 322 | ccb->command = NULL; |
313 | CCB->Status = BusLogic_CCB_Free; | 323 | ccb->status = BLOGIC_CCB_FREE; |
314 | CCB->Next = HostAdapter->Free_CCBs; | 324 | ccb->next = adapter->free_ccbs; |
315 | HostAdapter->Free_CCBs = CCB; | 325 | adapter->free_ccbs = ccb; |
316 | } | 326 | } |
317 | 327 | ||
318 | 328 | ||
319 | /* | 329 | /* |
320 | BusLogic_Command sends the command OperationCode to HostAdapter, optionally | 330 | blogic_cmd sends the command opcode to adapter, optionally |
321 | providing ParameterLength bytes of ParameterData and receiving at most | 331 | providing paramlen bytes of param and receiving at most |
322 | ReplyLength bytes of ReplyData; any excess reply data is received but | 332 | replylen bytes of reply; any excess reply data is received but |
323 | discarded. | 333 | discarded. |
324 | 334 | ||
325 | On success, this function returns the number of reply bytes read from | 335 | On success, this function returns the number of reply bytes read from |
326 | the Host Adapter (including any discarded data); on failure, it returns | 336 | the Host Adapter (including any discarded data); on failure, it returns |
327 | -1 if the command was invalid, or -2 if a timeout occurred. | 337 | -1 if the command was invalid, or -2 if a timeout occurred. |
328 | 338 | ||
329 | BusLogic_Command is called exclusively during host adapter detection and | 339 | blogic_cmd is called exclusively during host adapter detection and |
330 | initialization, so performance and latency are not critical, and exclusive | 340 | initialization, so performance and latency are not critical, and exclusive |
331 | access to the Host Adapter hardware is assumed. Once the host adapter and | 341 | access to the Host Adapter hardware is assumed. Once the host adapter and |
332 | driver are initialized, the only Host Adapter command that is issued is the | 342 | driver are initialized, the only Host Adapter command that is issued is the |
@@ -334,255 +344,274 @@ static void BusLogic_DeallocateCCB(struct BusLogic_CCB *CCB) | |||
334 | waiting for the Host Adapter Ready bit to be set in the Status Register. | 344 | waiting for the Host Adapter Ready bit to be set in the Status Register. |
335 | */ | 345 | */ |
336 | 346 | ||
337 | static int BusLogic_Command(struct BusLogic_HostAdapter *HostAdapter, enum BusLogic_OperationCode OperationCode, void *ParameterData, int ParameterLength, void *ReplyData, int ReplyLength) | 347 | static int blogic_cmd(struct blogic_adapter *adapter, enum blogic_opcode opcode, |
348 | void *param, int paramlen, void *reply, int replylen) | ||
338 | { | 349 | { |
339 | unsigned char *ParameterPointer = (unsigned char *) ParameterData; | 350 | unsigned char *param_p = (unsigned char *) param; |
340 | unsigned char *ReplyPointer = (unsigned char *) ReplyData; | 351 | unsigned char *reply_p = (unsigned char *) reply; |
341 | union BusLogic_StatusRegister StatusRegister; | 352 | union blogic_stat_reg statusreg; |
342 | union BusLogic_InterruptRegister InterruptRegister; | 353 | union blogic_int_reg intreg; |
343 | unsigned long ProcessorFlags = 0; | 354 | unsigned long processor_flag = 0; |
344 | int ReplyBytes = 0, Result; | 355 | int reply_b = 0, result; |
345 | long TimeoutCounter; | 356 | long timeout; |
346 | /* | 357 | /* |
347 | Clear out the Reply Data if provided. | 358 | Clear out the Reply Data if provided. |
348 | */ | 359 | */ |
349 | if (ReplyLength > 0) | 360 | if (replylen > 0) |
350 | memset(ReplyData, 0, ReplyLength); | 361 | memset(reply, 0, replylen); |
351 | /* | 362 | /* |
352 | If the IRQ Channel has not yet been acquired, then interrupts must be | 363 | If the IRQ Channel has not yet been acquired, then interrupts |
353 | disabled while issuing host adapter commands since a Command Complete | 364 | must be disabled while issuing host adapter commands since a |
354 | interrupt could occur if the IRQ Channel was previously enabled by another | 365 | Command Complete interrupt could occur if the IRQ Channel was |
355 | BusLogic Host Adapter or another driver sharing the same IRQ Channel. | 366 | previously enabled by another BusLogic Host Adapter or another |
367 | driver sharing the same IRQ Channel. | ||
356 | */ | 368 | */ |
357 | if (!HostAdapter->IRQ_ChannelAcquired) | 369 | if (!adapter->irq_acquired) |
358 | local_irq_save(ProcessorFlags); | 370 | local_irq_save(processor_flag); |
359 | /* | 371 | /* |
360 | Wait for the Host Adapter Ready bit to be set and the Command/Parameter | 372 | Wait for the Host Adapter Ready bit to be set and the |
361 | Register Busy bit to be reset in the Status Register. | 373 | Command/Parameter Register Busy bit to be reset in the Status |
374 | Register. | ||
362 | */ | 375 | */ |
363 | TimeoutCounter = 10000; | 376 | timeout = 10000; |
364 | while (--TimeoutCounter >= 0) { | 377 | while (--timeout >= 0) { |
365 | StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); | 378 | statusreg.all = blogic_rdstatus(adapter); |
366 | if (StatusRegister.sr.HostAdapterReady && !StatusRegister.sr.CommandParameterRegisterBusy) | 379 | if (statusreg.sr.adapter_ready && !statusreg.sr.cmd_param_busy) |
367 | break; | 380 | break; |
368 | udelay(100); | 381 | udelay(100); |
369 | } | 382 | } |
370 | if (TimeoutCounter < 0) { | 383 | if (timeout < 0) { |
371 | BusLogic_CommandFailureReason = "Timeout waiting for Host Adapter Ready"; | 384 | blogic_cmd_failure_reason = |
372 | Result = -2; | 385 | "Timeout waiting for Host Adapter Ready"; |
373 | goto Done; | 386 | result = -2; |
387 | goto done; | ||
374 | } | 388 | } |
375 | /* | 389 | /* |
376 | Write the OperationCode to the Command/Parameter Register. | 390 | Write the opcode to the Command/Parameter Register. |
377 | */ | 391 | */ |
378 | HostAdapter->HostAdapterCommandCompleted = false; | 392 | adapter->adapter_cmd_complete = false; |
379 | BusLogic_WriteCommandParameterRegister(HostAdapter, OperationCode); | 393 | blogic_setcmdparam(adapter, opcode); |
380 | /* | 394 | /* |
381 | Write any additional Parameter Bytes. | 395 | Write any additional Parameter Bytes. |
382 | */ | 396 | */ |
383 | TimeoutCounter = 10000; | 397 | timeout = 10000; |
384 | while (ParameterLength > 0 && --TimeoutCounter >= 0) { | 398 | while (paramlen > 0 && --timeout >= 0) { |
385 | /* | 399 | /* |
386 | Wait 100 microseconds to give the Host Adapter enough time to determine | 400 | Wait 100 microseconds to give the Host Adapter enough |
387 | whether the last value written to the Command/Parameter Register was | 401 | time to determine whether the last value written to the |
388 | valid or not. If the Command Complete bit is set in the Interrupt | 402 | Command/Parameter Register was valid or not. If the |
389 | Register, then the Command Invalid bit in the Status Register will be | 403 | Command Complete bit is set in the Interrupt Register, |
390 | reset if the Operation Code or Parameter was valid and the command | 404 | then the Command Invalid bit in the Status Register will |
391 | has completed, or set if the Operation Code or Parameter was invalid. | 405 | be reset if the Operation Code or Parameter was valid |
392 | If the Data In Register Ready bit is set in the Status Register, then | 406 | and the command has completed, or set if the Operation |
393 | the Operation Code was valid, and data is waiting to be read back | 407 | Code or Parameter was invalid. If the Data In Register |
394 | from the Host Adapter. Otherwise, wait for the Command/Parameter | 408 | Ready bit is set in the Status Register, then the |
395 | Register Busy bit in the Status Register to be reset. | 409 | Operation Code was valid, and data is waiting to be read |
410 | back from the Host Adapter. Otherwise, wait for the | ||
411 | Command/Parameter Register Busy bit in the Status | ||
412 | Register to be reset. | ||
396 | */ | 413 | */ |
397 | udelay(100); | 414 | udelay(100); |
398 | InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter); | 415 | intreg.all = blogic_rdint(adapter); |
399 | StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); | 416 | statusreg.all = blogic_rdstatus(adapter); |
400 | if (InterruptRegister.ir.CommandComplete) | 417 | if (intreg.ir.cmd_complete) |
401 | break; | 418 | break; |
402 | if (HostAdapter->HostAdapterCommandCompleted) | 419 | if (adapter->adapter_cmd_complete) |
403 | break; | 420 | break; |
404 | if (StatusRegister.sr.DataInRegisterReady) | 421 | if (statusreg.sr.datain_ready) |
405 | break; | 422 | break; |
406 | if (StatusRegister.sr.CommandParameterRegisterBusy) | 423 | if (statusreg.sr.cmd_param_busy) |
407 | continue; | 424 | continue; |
408 | BusLogic_WriteCommandParameterRegister(HostAdapter, *ParameterPointer++); | 425 | blogic_setcmdparam(adapter, *param_p++); |
409 | ParameterLength--; | 426 | paramlen--; |
410 | } | 427 | } |
411 | if (TimeoutCounter < 0) { | 428 | if (timeout < 0) { |
412 | BusLogic_CommandFailureReason = "Timeout waiting for Parameter Acceptance"; | 429 | blogic_cmd_failure_reason = |
413 | Result = -2; | 430 | "Timeout waiting for Parameter Acceptance"; |
414 | goto Done; | 431 | result = -2; |
415 | } | 432 | goto done; |
416 | /* | 433 | } |
417 | The Modify I/O Address command does not cause a Command Complete Interrupt. | 434 | /* |
418 | */ | 435 | The Modify I/O Address command does not cause a Command Complete |
419 | if (OperationCode == BusLogic_ModifyIOAddress) { | 436 | Interrupt. |
420 | StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); | 437 | */ |
421 | if (StatusRegister.sr.CommandInvalid) { | 438 | if (opcode == BLOGIC_MOD_IOADDR) { |
422 | BusLogic_CommandFailureReason = "Modify I/O Address Invalid"; | 439 | statusreg.all = blogic_rdstatus(adapter); |
423 | Result = -1; | 440 | if (statusreg.sr.cmd_invalid) { |
424 | goto Done; | 441 | blogic_cmd_failure_reason = |
442 | "Modify I/O Address Invalid"; | ||
443 | result = -1; | ||
444 | goto done; | ||
425 | } | 445 | } |
426 | if (BusLogic_GlobalOptions.TraceConfiguration) | 446 | if (blogic_global_options.trace_config) |
427 | BusLogic_Notice("BusLogic_Command(%02X) Status = %02X: " "(Modify I/O Address)\n", HostAdapter, OperationCode, StatusRegister.All); | 447 | blogic_notice("blogic_cmd(%02X) Status = %02X: " "(Modify I/O Address)\n", adapter, opcode, statusreg.all); |
428 | Result = 0; | 448 | result = 0; |
429 | goto Done; | 449 | goto done; |
430 | } | 450 | } |
431 | /* | 451 | /* |
432 | Select an appropriate timeout value for awaiting command completion. | 452 | Select an appropriate timeout value for awaiting command completion. |
433 | */ | 453 | */ |
434 | switch (OperationCode) { | 454 | switch (opcode) { |
435 | case BusLogic_InquireInstalledDevicesID0to7: | 455 | case BLOGIC_INQ_DEV0TO7: |
436 | case BusLogic_InquireInstalledDevicesID8to15: | 456 | case BLOGIC_INQ_DEV8TO15: |
437 | case BusLogic_InquireTargetDevices: | 457 | case BLOGIC_INQ_DEV: |
438 | /* Approximately 60 seconds. */ | 458 | /* Approximately 60 seconds. */ |
439 | TimeoutCounter = 60 * 10000; | 459 | timeout = 60 * 10000; |
440 | break; | 460 | break; |
441 | default: | 461 | default: |
442 | /* Approximately 1 second. */ | 462 | /* Approximately 1 second. */ |
443 | TimeoutCounter = 10000; | 463 | timeout = 10000; |
444 | break; | 464 | break; |
445 | } | 465 | } |
446 | /* | 466 | /* |
447 | Receive any Reply Bytes, waiting for either the Command Complete bit to | 467 | Receive any Reply Bytes, waiting for either the Command |
448 | be set in the Interrupt Register, or for the Interrupt Handler to set the | 468 | Complete bit to be set in the Interrupt Register, or for the |
449 | Host Adapter Command Completed bit in the Host Adapter structure. | 469 | Interrupt Handler to set the Host Adapter Command Completed |
470 | bit in the Host Adapter structure. | ||
450 | */ | 471 | */ |
451 | while (--TimeoutCounter >= 0) { | 472 | while (--timeout >= 0) { |
452 | InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter); | 473 | intreg.all = blogic_rdint(adapter); |
453 | StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); | 474 | statusreg.all = blogic_rdstatus(adapter); |
454 | if (InterruptRegister.ir.CommandComplete) | 475 | if (intreg.ir.cmd_complete) |
455 | break; | 476 | break; |
456 | if (HostAdapter->HostAdapterCommandCompleted) | 477 | if (adapter->adapter_cmd_complete) |
457 | break; | 478 | break; |
458 | if (StatusRegister.sr.DataInRegisterReady) { | 479 | if (statusreg.sr.datain_ready) { |
459 | if (++ReplyBytes <= ReplyLength) | 480 | if (++reply_b <= replylen) |
460 | *ReplyPointer++ = BusLogic_ReadDataInRegister(HostAdapter); | 481 | *reply_p++ = blogic_rddatain(adapter); |
461 | else | 482 | else |
462 | BusLogic_ReadDataInRegister(HostAdapter); | 483 | blogic_rddatain(adapter); |
463 | } | 484 | } |
464 | if (OperationCode == BusLogic_FetchHostAdapterLocalRAM && StatusRegister.sr.HostAdapterReady) | 485 | if (opcode == BLOGIC_FETCH_LOCALRAM && |
486 | statusreg.sr.adapter_ready) | ||
465 | break; | 487 | break; |
466 | udelay(100); | 488 | udelay(100); |
467 | } | 489 | } |
468 | if (TimeoutCounter < 0) { | 490 | if (timeout < 0) { |
469 | BusLogic_CommandFailureReason = "Timeout waiting for Command Complete"; | 491 | blogic_cmd_failure_reason = |
470 | Result = -2; | 492 | "Timeout waiting for Command Complete"; |
471 | goto Done; | 493 | result = -2; |
494 | goto done; | ||
472 | } | 495 | } |
473 | /* | 496 | /* |
474 | Clear any pending Command Complete Interrupt. | 497 | Clear any pending Command Complete Interrupt. |
475 | */ | 498 | */ |
476 | BusLogic_InterruptReset(HostAdapter); | 499 | blogic_intreset(adapter); |
477 | /* | 500 | /* |
478 | Provide tracing information if requested. | 501 | Provide tracing information if requested. |
479 | */ | 502 | */ |
480 | if (BusLogic_GlobalOptions.TraceConfiguration) { | 503 | if (blogic_global_options.trace_config) { |
481 | int i; | 504 | int i; |
482 | BusLogic_Notice("BusLogic_Command(%02X) Status = %02X: %2d ==> %2d:", HostAdapter, OperationCode, StatusRegister.All, ReplyLength, ReplyBytes); | 505 | blogic_notice("blogic_cmd(%02X) Status = %02X: %2d ==> %2d:", |
483 | if (ReplyLength > ReplyBytes) | 506 | adapter, opcode, statusreg.all, replylen, |
484 | ReplyLength = ReplyBytes; | 507 | reply_b); |
485 | for (i = 0; i < ReplyLength; i++) | 508 | if (replylen > reply_b) |
486 | BusLogic_Notice(" %02X", HostAdapter, ((unsigned char *) ReplyData)[i]); | 509 | replylen = reply_b; |
487 | BusLogic_Notice("\n", HostAdapter); | 510 | for (i = 0; i < replylen; i++) |
511 | blogic_notice(" %02X", adapter, | ||
512 | ((unsigned char *) reply)[i]); | ||
513 | blogic_notice("\n", adapter); | ||
488 | } | 514 | } |
489 | /* | 515 | /* |
490 | Process Command Invalid conditions. | 516 | Process Command Invalid conditions. |
491 | */ | 517 | */ |
492 | if (StatusRegister.sr.CommandInvalid) { | 518 | if (statusreg.sr.cmd_invalid) { |
493 | /* | 519 | /* |
494 | Some early BusLogic Host Adapters may not recover properly from | 520 | Some early BusLogic Host Adapters may not recover |
495 | a Command Invalid condition, so if this appears to be the case, | 521 | properly from a Command Invalid condition, so if this |
496 | a Soft Reset is issued to the Host Adapter. Potentially invalid | 522 | appears to be the case, a Soft Reset is issued to the |
497 | commands are never attempted after Mailbox Initialization is | 523 | Host Adapter. Potentially invalid commands are never |
498 | performed, so there should be no Host Adapter state lost by a | 524 | attempted after Mailbox Initialization is performed, |
525 | so there should be no Host Adapter state lost by a | ||
499 | Soft Reset in response to a Command Invalid condition. | 526 | Soft Reset in response to a Command Invalid condition. |
500 | */ | 527 | */ |
501 | udelay(1000); | 528 | udelay(1000); |
502 | StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); | 529 | statusreg.all = blogic_rdstatus(adapter); |
503 | if (StatusRegister.sr.CommandInvalid || | 530 | if (statusreg.sr.cmd_invalid || statusreg.sr.rsvd || |
504 | StatusRegister.sr.Reserved || | 531 | statusreg.sr.datain_ready || |
505 | StatusRegister.sr.DataInRegisterReady || | 532 | statusreg.sr.cmd_param_busy || |
506 | StatusRegister.sr.CommandParameterRegisterBusy || !StatusRegister.sr.HostAdapterReady || !StatusRegister.sr.InitializationRequired || StatusRegister.sr.DiagnosticActive || StatusRegister.sr.DiagnosticFailure) { | 533 | !statusreg.sr.adapter_ready || |
507 | BusLogic_SoftReset(HostAdapter); | 534 | !statusreg.sr.init_reqd || |
535 | statusreg.sr.diag_active || | ||
536 | statusreg.sr.diag_failed) { | ||
537 | blogic_softreset(adapter); | ||
508 | udelay(1000); | 538 | udelay(1000); |
509 | } | 539 | } |
510 | BusLogic_CommandFailureReason = "Command Invalid"; | 540 | blogic_cmd_failure_reason = "Command Invalid"; |
511 | Result = -1; | 541 | result = -1; |
512 | goto Done; | 542 | goto done; |
513 | } | 543 | } |
514 | /* | 544 | /* |
515 | Handle Excess Parameters Supplied conditions. | 545 | Handle Excess Parameters Supplied conditions. |
516 | */ | 546 | */ |
517 | if (ParameterLength > 0) { | 547 | if (paramlen > 0) { |
518 | BusLogic_CommandFailureReason = "Excess Parameters Supplied"; | 548 | blogic_cmd_failure_reason = "Excess Parameters Supplied"; |
519 | Result = -1; | 549 | result = -1; |
520 | goto Done; | 550 | goto done; |
521 | } | 551 | } |
522 | /* | 552 | /* |
523 | Indicate the command completed successfully. | 553 | Indicate the command completed successfully. |
524 | */ | 554 | */ |
525 | BusLogic_CommandFailureReason = NULL; | 555 | blogic_cmd_failure_reason = NULL; |
526 | Result = ReplyBytes; | 556 | result = reply_b; |
527 | /* | 557 | /* |
528 | Restore the interrupt status if necessary and return. | 558 | Restore the interrupt status if necessary and return. |
529 | */ | 559 | */ |
530 | Done: | 560 | done: |
531 | if (!HostAdapter->IRQ_ChannelAcquired) | 561 | if (!adapter->irq_acquired) |
532 | local_irq_restore(ProcessorFlags); | 562 | local_irq_restore(processor_flag); |
533 | return Result; | 563 | return result; |
534 | } | 564 | } |
535 | 565 | ||
536 | 566 | ||
537 | /* | 567 | /* |
538 | BusLogic_AppendProbeAddressISA appends a single ISA I/O Address to the list | 568 | blogic_add_probeaddr_isa appends a single ISA I/O Address to the list |
539 | of I/O Address and Bus Probe Information to be checked for potential BusLogic | 569 | of I/O Address and Bus Probe Information to be checked for potential BusLogic |
540 | Host Adapters. | 570 | Host Adapters. |
541 | */ | 571 | */ |
542 | 572 | ||
543 | static void __init BusLogic_AppendProbeAddressISA(unsigned long IO_Address) | 573 | static void __init blogic_add_probeaddr_isa(unsigned long io_addr) |
544 | { | 574 | { |
545 | struct BusLogic_ProbeInfo *ProbeInfo; | 575 | struct blogic_probeinfo *probeinfo; |
546 | if (BusLogic_ProbeInfoCount >= BusLogic_MaxHostAdapters) | 576 | if (blogic_probeinfo_count >= BLOGIC_MAX_ADAPTERS) |
547 | return; | 577 | return; |
548 | ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++]; | 578 | probeinfo = &blogic_probeinfo_list[blogic_probeinfo_count++]; |
549 | ProbeInfo->HostAdapterType = BusLogic_MultiMaster; | 579 | probeinfo->adapter_type = BLOGIC_MULTIMASTER; |
550 | ProbeInfo->HostAdapterBusType = BusLogic_ISA_Bus; | 580 | probeinfo->adapter_bus_type = BLOGIC_ISA_BUS; |
551 | ProbeInfo->IO_Address = IO_Address; | 581 | probeinfo->io_addr = io_addr; |
552 | ProbeInfo->PCI_Device = NULL; | 582 | probeinfo->pci_device = NULL; |
553 | } | 583 | } |
554 | 584 | ||
555 | 585 | ||
556 | /* | 586 | /* |
557 | BusLogic_InitializeProbeInfoListISA initializes the list of I/O Address and | 587 | blogic_init_probeinfo_isa initializes the list of I/O Address and |
558 | Bus Probe Information to be checked for potential BusLogic SCSI Host Adapters | 588 | Bus Probe Information to be checked for potential BusLogic SCSI Host Adapters |
559 | only from the list of standard BusLogic MultiMaster ISA I/O Addresses. | 589 | only from the list of standard BusLogic MultiMaster ISA I/O Addresses. |
560 | */ | 590 | */ |
561 | 591 | ||
562 | static void __init BusLogic_InitializeProbeInfoListISA(struct BusLogic_HostAdapter | 592 | static void __init blogic_init_probeinfo_isa(struct blogic_adapter *adapter) |
563 | *PrototypeHostAdapter) | ||
564 | { | 593 | { |
565 | /* | 594 | /* |
566 | If BusLogic Driver Options specifications requested that ISA Bus Probes | 595 | If BusLogic Driver Options specifications requested that ISA |
567 | be inhibited, do not proceed further. | 596 | Bus Probes be inhibited, do not proceed further. |
568 | */ | 597 | */ |
569 | if (BusLogic_ProbeOptions.NoProbeISA) | 598 | if (blogic_probe_options.noprobe_isa) |
570 | return; | 599 | return; |
571 | /* | 600 | /* |
572 | Append the list of standard BusLogic MultiMaster ISA I/O Addresses. | 601 | Append the list of standard BusLogic MultiMaster ISA I/O Addresses. |
573 | */ | 602 | */ |
574 | if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe330) | 603 | if (!blogic_probe_options.limited_isa || blogic_probe_options.probe330) |
575 | BusLogic_AppendProbeAddressISA(0x330); | 604 | blogic_add_probeaddr_isa(0x330); |
576 | if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe334) | 605 | if (!blogic_probe_options.limited_isa || blogic_probe_options.probe334) |
577 | BusLogic_AppendProbeAddressISA(0x334); | 606 | blogic_add_probeaddr_isa(0x334); |
578 | if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe230) | 607 | if (!blogic_probe_options.limited_isa || blogic_probe_options.probe230) |
579 | BusLogic_AppendProbeAddressISA(0x230); | 608 | blogic_add_probeaddr_isa(0x230); |
580 | if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe234) | 609 | if (!blogic_probe_options.limited_isa || blogic_probe_options.probe234) |
581 | BusLogic_AppendProbeAddressISA(0x234); | 610 | blogic_add_probeaddr_isa(0x234); |
582 | if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe130) | 611 | if (!blogic_probe_options.limited_isa || blogic_probe_options.probe130) |
583 | BusLogic_AppendProbeAddressISA(0x130); | 612 | blogic_add_probeaddr_isa(0x130); |
584 | if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe134) | 613 | if (!blogic_probe_options.limited_isa || blogic_probe_options.probe134) |
585 | BusLogic_AppendProbeAddressISA(0x134); | 614 | blogic_add_probeaddr_isa(0x134); |
586 | } | 615 | } |
587 | 616 | ||
588 | 617 | ||
@@ -590,25 +619,35 @@ static void __init BusLogic_InitializeProbeInfoListISA(struct BusLogic_HostAdapt | |||
590 | 619 | ||
591 | 620 | ||
592 | /* | 621 | /* |
593 | BusLogic_SortProbeInfo sorts a section of BusLogic_ProbeInfoList in order | 622 | blogic_sort_probeinfo sorts a section of blogic_probeinfo_list in order |
594 | of increasing PCI Bus and Device Number. | 623 | of increasing PCI Bus and Device Number. |
595 | */ | 624 | */ |
596 | 625 | ||
597 | static void __init BusLogic_SortProbeInfo(struct BusLogic_ProbeInfo *ProbeInfoList, int ProbeInfoCount) | 626 | static void __init blogic_sort_probeinfo(struct blogic_probeinfo |
627 | *probeinfo_list, int probeinfo_cnt) | ||
598 | { | 628 | { |
599 | int LastInterchange = ProbeInfoCount - 1, Bound, j; | 629 | int last_exchange = probeinfo_cnt - 1, bound, j; |
600 | while (LastInterchange > 0) { | 630 | |
601 | Bound = LastInterchange; | 631 | while (last_exchange > 0) { |
602 | LastInterchange = 0; | 632 | bound = last_exchange; |
603 | for (j = 0; j < Bound; j++) { | 633 | last_exchange = 0; |
604 | struct BusLogic_ProbeInfo *ProbeInfo1 = &ProbeInfoList[j]; | 634 | for (j = 0; j < bound; j++) { |
605 | struct BusLogic_ProbeInfo *ProbeInfo2 = &ProbeInfoList[j + 1]; | 635 | struct blogic_probeinfo *probeinfo1 = |
606 | if (ProbeInfo1->Bus > ProbeInfo2->Bus || (ProbeInfo1->Bus == ProbeInfo2->Bus && (ProbeInfo1->Device > ProbeInfo2->Device))) { | 636 | &probeinfo_list[j]; |
607 | struct BusLogic_ProbeInfo TempProbeInfo; | 637 | struct blogic_probeinfo *probeinfo2 = |
608 | memcpy(&TempProbeInfo, ProbeInfo1, sizeof(struct BusLogic_ProbeInfo)); | 638 | &probeinfo_list[j + 1]; |
609 | memcpy(ProbeInfo1, ProbeInfo2, sizeof(struct BusLogic_ProbeInfo)); | 639 | if (probeinfo1->bus > probeinfo2->bus || |
610 | memcpy(ProbeInfo2, &TempProbeInfo, sizeof(struct BusLogic_ProbeInfo)); | 640 | (probeinfo1->bus == probeinfo2->bus && |
611 | LastInterchange = j; | 641 | (probeinfo1->dev > probeinfo2->dev))) { |
642 | struct blogic_probeinfo tmp_probeinfo; | ||
643 | |||
644 | memcpy(&tmp_probeinfo, probeinfo1, | ||
645 | sizeof(struct blogic_probeinfo)); | ||
646 | memcpy(probeinfo1, probeinfo2, | ||
647 | sizeof(struct blogic_probeinfo)); | ||
648 | memcpy(probeinfo2, &tmp_probeinfo, | ||
649 | sizeof(struct blogic_probeinfo)); | ||
650 | last_exchange = j; | ||
612 | } | 651 | } |
613 | } | 652 | } |
614 | } | 653 | } |
@@ -616,84 +655,88 @@ static void __init BusLogic_SortProbeInfo(struct BusLogic_ProbeInfo *ProbeInfoLi | |||
616 | 655 | ||
617 | 656 | ||
618 | /* | 657 | /* |
619 | BusLogic_InitializeMultiMasterProbeInfo initializes the list of I/O Address | 658 | blogic_init_mm_probeinfo initializes the list of I/O Address |
620 | and Bus Probe Information to be checked for potential BusLogic MultiMaster | 659 | and Bus Probe Information to be checked for potential BusLogic MultiMaster |
621 | SCSI Host Adapters by interrogating the PCI Configuration Space on PCI | 660 | SCSI Host Adapters by interrogating the PCI Configuration Space on PCI |
622 | machines as well as from the list of standard BusLogic MultiMaster ISA | 661 | machines as well as from the list of standard BusLogic MultiMaster ISA |
623 | I/O Addresses. It returns the number of PCI MultiMaster Host Adapters found. | 662 | I/O Addresses. It returns the number of PCI MultiMaster Host Adapters found. |
624 | */ | 663 | */ |
625 | 664 | ||
626 | static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAdapter | 665 | static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter) |
627 | *PrototypeHostAdapter) | ||
628 | { | 666 | { |
629 | struct BusLogic_ProbeInfo *PrimaryProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount]; | 667 | struct blogic_probeinfo *pr_probeinfo = |
630 | int NonPrimaryPCIMultiMasterIndex = BusLogic_ProbeInfoCount + 1; | 668 | &blogic_probeinfo_list[blogic_probeinfo_count]; |
631 | int NonPrimaryPCIMultiMasterCount = 0, PCIMultiMasterCount = 0; | 669 | int nonpr_mmindex = blogic_probeinfo_count + 1; |
632 | bool ForceBusDeviceScanningOrder = false; | 670 | int nonpr_mmcount = 0, mmcount = 0; |
633 | bool ForceBusDeviceScanningOrderChecked = false; | 671 | bool force_scan_order = false; |
634 | bool StandardAddressSeen[6]; | 672 | bool force_scan_order_checked = false; |
635 | struct pci_dev *PCI_Device = NULL; | 673 | bool addr_seen[6]; |
674 | struct pci_dev *pci_device = NULL; | ||
636 | int i; | 675 | int i; |
637 | if (BusLogic_ProbeInfoCount >= BusLogic_MaxHostAdapters) | 676 | if (blogic_probeinfo_count >= BLOGIC_MAX_ADAPTERS) |
638 | return 0; | 677 | return 0; |
639 | BusLogic_ProbeInfoCount++; | 678 | blogic_probeinfo_count++; |
640 | for (i = 0; i < 6; i++) | 679 | for (i = 0; i < 6; i++) |
641 | StandardAddressSeen[i] = false; | 680 | addr_seen[i] = false; |
642 | /* | 681 | /* |
643 | Iterate over the MultiMaster PCI Host Adapters. For each enumerated host | 682 | Iterate over the MultiMaster PCI Host Adapters. For each |
644 | adapter, determine whether its ISA Compatible I/O Port is enabled and if | 683 | enumerated host adapter, determine whether its ISA Compatible |
645 | so, whether it is assigned the Primary I/O Address. A host adapter that is | 684 | I/O Port is enabled and if so, whether it is assigned the |
646 | assigned the Primary I/O Address will always be the preferred boot device. | 685 | Primary I/O Address. A host adapter that is assigned the |
647 | The MultiMaster BIOS will first recognize a host adapter at the Primary I/O | 686 | Primary I/O Address will always be the preferred boot device. |
648 | Address, then any other PCI host adapters, and finally any host adapters | 687 | The MultiMaster BIOS will first recognize a host adapter at |
649 | located at the remaining standard ISA I/O Addresses. When a PCI host | 688 | the Primary I/O Address, then any other PCI host adapters, |
650 | adapter is found with its ISA Compatible I/O Port enabled, a command is | 689 | and finally any host adapters located at the remaining |
651 | issued to disable the ISA Compatible I/O Port, and it is noted that the | 690 | standard ISA I/O Addresses. When a PCI host adapter is found |
691 | with its ISA Compatible I/O Port enabled, a command is issued | ||
692 | to disable the ISA Compatible I/O Port, and it is noted that the | ||
652 | particular standard ISA I/O Address need not be probed. | 693 | particular standard ISA I/O Address need not be probed. |
653 | */ | 694 | */ |
654 | PrimaryProbeInfo->IO_Address = 0; | 695 | pr_probeinfo->io_addr = 0; |
655 | while ((PCI_Device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, PCI_Device)) != NULL) { | 696 | while ((pci_device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, |
656 | struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter; | 697 | PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, |
657 | struct BusLogic_PCIHostAdapterInformation PCIHostAdapterInformation; | 698 | pci_device)) != NULL) { |
658 | enum BusLogic_ISACompatibleIOPort ModifyIOAddressRequest; | 699 | struct blogic_adapter *adapter = adapter; |
659 | unsigned char Bus; | 700 | struct blogic_adapter_info adapter_info; |
660 | unsigned char Device; | 701 | enum blogic_isa_ioport mod_ioaddr_req; |
661 | unsigned int IRQ_Channel; | 702 | unsigned char bus; |
662 | unsigned long BaseAddress0; | 703 | unsigned char device; |
663 | unsigned long BaseAddress1; | 704 | unsigned int irq_ch; |
664 | unsigned long IO_Address; | 705 | unsigned long base_addr0; |
665 | unsigned long PCI_Address; | 706 | unsigned long base_addr1; |
666 | 707 | unsigned long io_addr; | |
667 | if (pci_enable_device(PCI_Device)) | 708 | unsigned long pci_addr; |
709 | |||
710 | if (pci_enable_device(pci_device)) | ||
668 | continue; | 711 | continue; |
669 | 712 | ||
670 | if (pci_set_dma_mask(PCI_Device, DMA_BIT_MASK(32) )) | 713 | if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32))) |
671 | continue; | 714 | continue; |
672 | 715 | ||
673 | Bus = PCI_Device->bus->number; | 716 | bus = pci_device->bus->number; |
674 | Device = PCI_Device->devfn >> 3; | 717 | device = pci_device->devfn >> 3; |
675 | IRQ_Channel = PCI_Device->irq; | 718 | irq_ch = pci_device->irq; |
676 | IO_Address = BaseAddress0 = pci_resource_start(PCI_Device, 0); | 719 | io_addr = base_addr0 = pci_resource_start(pci_device, 0); |
677 | PCI_Address = BaseAddress1 = pci_resource_start(PCI_Device, 1); | 720 | pci_addr = base_addr1 = pci_resource_start(pci_device, 1); |
678 | 721 | ||
679 | if (pci_resource_flags(PCI_Device, 0) & IORESOURCE_MEM) { | 722 | if (pci_resource_flags(pci_device, 0) & IORESOURCE_MEM) { |
680 | BusLogic_Error("BusLogic: Base Address0 0x%X not I/O for " "MultiMaster Host Adapter\n", NULL, BaseAddress0); | 723 | blogic_err("BusLogic: Base Address0 0x%X not I/O for " "MultiMaster Host Adapter\n", NULL, base_addr0); |
681 | BusLogic_Error("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, Bus, Device, IO_Address); | 724 | blogic_err("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, bus, device, io_addr); |
682 | continue; | 725 | continue; |
683 | } | 726 | } |
684 | if (pci_resource_flags(PCI_Device, 1) & IORESOURCE_IO) { | 727 | if (pci_resource_flags(pci_device, 1) & IORESOURCE_IO) { |
685 | BusLogic_Error("BusLogic: Base Address1 0x%X not Memory for " "MultiMaster Host Adapter\n", NULL, BaseAddress1); | 728 | blogic_err("BusLogic: Base Address1 0x%X not Memory for " "MultiMaster Host Adapter\n", NULL, base_addr1); |
686 | BusLogic_Error("at PCI Bus %d Device %d PCI Address 0x%X\n", NULL, Bus, Device, PCI_Address); | 729 | blogic_err("at PCI Bus %d Device %d PCI Address 0x%X\n", NULL, bus, device, pci_addr); |
687 | continue; | 730 | continue; |
688 | } | 731 | } |
689 | if (IRQ_Channel == 0) { | 732 | if (irq_ch == 0) { |
690 | BusLogic_Error("BusLogic: IRQ Channel %d invalid for " "MultiMaster Host Adapter\n", NULL, IRQ_Channel); | 733 | blogic_err("BusLogic: IRQ Channel %d invalid for " "MultiMaster Host Adapter\n", NULL, irq_ch); |
691 | BusLogic_Error("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, Bus, Device, IO_Address); | 734 | blogic_err("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, bus, device, io_addr); |
692 | continue; | 735 | continue; |
693 | } | 736 | } |
694 | if (BusLogic_GlobalOptions.TraceProbe) { | 737 | if (blogic_global_options.trace_probe) { |
695 | BusLogic_Notice("BusLogic: PCI MultiMaster Host Adapter " "detected at\n", NULL); | 738 | blogic_notice("BusLogic: PCI MultiMaster Host Adapter " "detected at\n", NULL); |
696 | BusLogic_Notice("BusLogic: PCI Bus %d Device %d I/O Address " "0x%X PCI Address 0x%X\n", NULL, Bus, Device, IO_Address, PCI_Address); | 739 | blogic_notice("BusLogic: PCI Bus %d Device %d I/O Address " "0x%X PCI Address 0x%X\n", NULL, bus, device, io_addr, pci_addr); |
697 | } | 740 | } |
698 | /* | 741 | /* |
699 | Issue the Inquire PCI Host Adapter Information command to determine | 742 | Issue the Inquire PCI Host Adapter Information command to determine |
@@ -701,238 +744,258 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd | |||
701 | known and enabled, note that the particular Standard ISA I/O | 744 | known and enabled, note that the particular Standard ISA I/O |
702 | Address should not be probed. | 745 | Address should not be probed. |
703 | */ | 746 | */ |
704 | HostAdapter->IO_Address = IO_Address; | 747 | adapter->io_addr = io_addr; |
705 | BusLogic_InterruptReset(HostAdapter); | 748 | blogic_intreset(adapter); |
706 | if (BusLogic_Command(HostAdapter, BusLogic_InquirePCIHostAdapterInformation, NULL, 0, &PCIHostAdapterInformation, sizeof(PCIHostAdapterInformation)) | 749 | if (blogic_cmd(adapter, BLOGIC_INQ_PCI_INFO, NULL, 0, |
707 | == sizeof(PCIHostAdapterInformation)) { | 750 | &adapter_info, sizeof(adapter_info)) == |
708 | if (PCIHostAdapterInformation.ISACompatibleIOPort < 6) | 751 | sizeof(adapter_info)) { |
709 | StandardAddressSeen[PCIHostAdapterInformation.ISACompatibleIOPort] = true; | 752 | if (adapter_info.isa_port < 6) |
753 | addr_seen[adapter_info.isa_port] = true; | ||
710 | } else | 754 | } else |
711 | PCIHostAdapterInformation.ISACompatibleIOPort = BusLogic_IO_Disable; | 755 | adapter_info.isa_port = BLOGIC_IO_DISABLE; |
712 | /* | 756 | /* |
713 | * Issue the Modify I/O Address command to disable the ISA Compatible | 757 | Issue the Modify I/O Address command to disable the |
714 | * I/O Port. On PCI Host Adapters, the Modify I/O Address command | 758 | ISA Compatible I/O Port. On PCI Host Adapters, the |
715 | * allows modification of the ISA compatible I/O Address that the Host | 759 | Modify I/O Address command allows modification of the |
716 | * Adapter responds to; it does not affect the PCI compliant I/O Address | 760 | ISA compatible I/O Address that the Host Adapter |
717 | * assigned at system initialization. | 761 | responds to; it does not affect the PCI compliant |
762 | I/O Address assigned at system initialization. | ||
718 | */ | 763 | */ |
719 | ModifyIOAddressRequest = BusLogic_IO_Disable; | 764 | mod_ioaddr_req = BLOGIC_IO_DISABLE; |
720 | BusLogic_Command(HostAdapter, BusLogic_ModifyIOAddress, &ModifyIOAddressRequest, sizeof(ModifyIOAddressRequest), NULL, 0); | 765 | blogic_cmd(adapter, BLOGIC_MOD_IOADDR, &mod_ioaddr_req, |
766 | sizeof(mod_ioaddr_req), NULL, 0); | ||
721 | /* | 767 | /* |
722 | For the first MultiMaster Host Adapter enumerated, issue the Fetch | 768 | For the first MultiMaster Host Adapter enumerated, |
723 | Host Adapter Local RAM command to read byte 45 of the AutoSCSI area, | 769 | issue the Fetch Host Adapter Local RAM command to read |
724 | for the setting of the "Use Bus And Device # For PCI Scanning Seq." | 770 | byte 45 of the AutoSCSI area, for the setting of the |
725 | option. Issue the Inquire Board ID command since this option is | 771 | "Use Bus And Device # For PCI Scanning Seq." option. |
772 | Issue the Inquire Board ID command since this option is | ||
726 | only valid for the BT-948/958/958D. | 773 | only valid for the BT-948/958/958D. |
727 | */ | 774 | */ |
728 | if (!ForceBusDeviceScanningOrderChecked) { | 775 | if (!force_scan_order_checked) { |
729 | struct BusLogic_FetchHostAdapterLocalRAMRequest FetchHostAdapterLocalRAMRequest; | 776 | struct blogic_fetch_localram fetch_localram; |
730 | struct BusLogic_AutoSCSIByte45 AutoSCSIByte45; | 777 | struct blogic_autoscsi_byte45 autoscsi_byte45; |
731 | struct BusLogic_BoardID BoardID; | 778 | struct blogic_board_id id; |
732 | FetchHostAdapterLocalRAMRequest.ByteOffset = BusLogic_AutoSCSI_BaseOffset + 45; | 779 | |
733 | FetchHostAdapterLocalRAMRequest.ByteCount = sizeof(AutoSCSIByte45); | 780 | fetch_localram.offset = BLOGIC_AUTOSCSI_BASE + 45; |
734 | BusLogic_Command(HostAdapter, BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest, sizeof(FetchHostAdapterLocalRAMRequest), &AutoSCSIByte45, sizeof(AutoSCSIByte45)); | 781 | fetch_localram.count = sizeof(autoscsi_byte45); |
735 | BusLogic_Command(HostAdapter, BusLogic_InquireBoardID, NULL, 0, &BoardID, sizeof(BoardID)); | 782 | blogic_cmd(adapter, BLOGIC_FETCH_LOCALRAM, |
736 | if (BoardID.FirmwareVersion1stDigit == '5') | 783 | &fetch_localram, sizeof(fetch_localram), |
737 | ForceBusDeviceScanningOrder = AutoSCSIByte45.ForceBusDeviceScanningOrder; | 784 | &autoscsi_byte45, |
738 | ForceBusDeviceScanningOrderChecked = true; | 785 | sizeof(autoscsi_byte45)); |
786 | blogic_cmd(adapter, BLOGIC_GET_BOARD_ID, NULL, 0, &id, | ||
787 | sizeof(id)); | ||
788 | if (id.fw_ver_digit1 == '5') | ||
789 | force_scan_order = | ||
790 | autoscsi_byte45.force_scan_order; | ||
791 | force_scan_order_checked = true; | ||
739 | } | 792 | } |
740 | /* | 793 | /* |
741 | Determine whether this MultiMaster Host Adapter has its ISA | 794 | Determine whether this MultiMaster Host Adapter has its |
742 | Compatible I/O Port enabled and is assigned the Primary I/O Address. | 795 | ISA Compatible I/O Port enabled and is assigned the |
743 | If it does, then it is the Primary MultiMaster Host Adapter and must | 796 | Primary I/O Address. If it does, then it is the Primary |
744 | be recognized first. If it does not, then it is added to the list | 797 | MultiMaster Host Adapter and must be recognized first. |
745 | for probing after any Primary MultiMaster Host Adapter is probed. | 798 | If it does not, then it is added to the list for probing |
799 | after any Primary MultiMaster Host Adapter is probed. | ||
746 | */ | 800 | */ |
747 | if (PCIHostAdapterInformation.ISACompatibleIOPort == BusLogic_IO_330) { | 801 | if (adapter_info.isa_port == BLOGIC_IO_330) { |
748 | PrimaryProbeInfo->HostAdapterType = BusLogic_MultiMaster; | 802 | pr_probeinfo->adapter_type = BLOGIC_MULTIMASTER; |
749 | PrimaryProbeInfo->HostAdapterBusType = BusLogic_PCI_Bus; | 803 | pr_probeinfo->adapter_bus_type = BLOGIC_PCI_BUS; |
750 | PrimaryProbeInfo->IO_Address = IO_Address; | 804 | pr_probeinfo->io_addr = io_addr; |
751 | PrimaryProbeInfo->PCI_Address = PCI_Address; | 805 | pr_probeinfo->pci_addr = pci_addr; |
752 | PrimaryProbeInfo->Bus = Bus; | 806 | pr_probeinfo->bus = bus; |
753 | PrimaryProbeInfo->Device = Device; | 807 | pr_probeinfo->dev = device; |
754 | PrimaryProbeInfo->IRQ_Channel = IRQ_Channel; | 808 | pr_probeinfo->irq_ch = irq_ch; |
755 | PrimaryProbeInfo->PCI_Device = pci_dev_get(PCI_Device); | 809 | pr_probeinfo->pci_device = pci_dev_get(pci_device); |
756 | PCIMultiMasterCount++; | 810 | mmcount++; |
757 | } else if (BusLogic_ProbeInfoCount < BusLogic_MaxHostAdapters) { | 811 | } else if (blogic_probeinfo_count < BLOGIC_MAX_ADAPTERS) { |
758 | struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++]; | 812 | struct blogic_probeinfo *probeinfo = |
759 | ProbeInfo->HostAdapterType = BusLogic_MultiMaster; | 813 | &blogic_probeinfo_list[blogic_probeinfo_count++]; |
760 | ProbeInfo->HostAdapterBusType = BusLogic_PCI_Bus; | 814 | probeinfo->adapter_type = BLOGIC_MULTIMASTER; |
761 | ProbeInfo->IO_Address = IO_Address; | 815 | probeinfo->adapter_bus_type = BLOGIC_PCI_BUS; |
762 | ProbeInfo->PCI_Address = PCI_Address; | 816 | probeinfo->io_addr = io_addr; |
763 | ProbeInfo->Bus = Bus; | 817 | probeinfo->pci_addr = pci_addr; |
764 | ProbeInfo->Device = Device; | 818 | probeinfo->bus = bus; |
765 | ProbeInfo->IRQ_Channel = IRQ_Channel; | 819 | probeinfo->dev = device; |
766 | ProbeInfo->PCI_Device = pci_dev_get(PCI_Device); | 820 | probeinfo->irq_ch = irq_ch; |
767 | NonPrimaryPCIMultiMasterCount++; | 821 | probeinfo->pci_device = pci_dev_get(pci_device); |
768 | PCIMultiMasterCount++; | 822 | nonpr_mmcount++; |
823 | mmcount++; | ||
769 | } else | 824 | } else |
770 | BusLogic_Warning("BusLogic: Too many Host Adapters " "detected\n", NULL); | 825 | blogic_warn("BusLogic: Too many Host Adapters " "detected\n", NULL); |
771 | } | 826 | } |
772 | /* | 827 | /* |
773 | If the AutoSCSI "Use Bus And Device # For PCI Scanning Seq." option is ON | 828 | If the AutoSCSI "Use Bus And Device # For PCI Scanning Seq." |
774 | for the first enumerated MultiMaster Host Adapter, and if that host adapter | 829 | option is ON for the first enumerated MultiMaster Host Adapter, |
775 | is a BT-948/958/958D, then the MultiMaster BIOS will recognize MultiMaster | 830 | and if that host adapter is a BT-948/958/958D, then the |
776 | Host Adapters in the order of increasing PCI Bus and Device Number. In | 831 | MultiMaster BIOS will recognize MultiMaster Host Adapters in |
777 | that case, sort the probe information into the same order the BIOS uses. | 832 | the order of increasing PCI Bus and Device Number. In that case, |
778 | If this option is OFF, then the MultiMaster BIOS will recognize MultiMaster | 833 | sort the probe information into the same order the BIOS uses. |
779 | Host Adapters in the order they are enumerated by the PCI BIOS, and hence | 834 | If this option is OFF, then the MultiMaster BIOS will recognize |
780 | no sorting is necessary. | 835 | MultiMaster Host Adapters in the order they are enumerated by |
781 | */ | 836 | the PCI BIOS, and hence no sorting is necessary. |
782 | if (ForceBusDeviceScanningOrder) | 837 | */ |
783 | BusLogic_SortProbeInfo(&BusLogic_ProbeInfoList[NonPrimaryPCIMultiMasterIndex], NonPrimaryPCIMultiMasterCount); | 838 | if (force_scan_order) |
784 | /* | 839 | blogic_sort_probeinfo(&blogic_probeinfo_list[nonpr_mmindex], |
785 | If no PCI MultiMaster Host Adapter is assigned the Primary I/O Address, | 840 | nonpr_mmcount); |
786 | then the Primary I/O Address must be probed explicitly before any PCI | 841 | /* |
787 | host adapters are probed. | 842 | If no PCI MultiMaster Host Adapter is assigned the Primary |
788 | */ | 843 | I/O Address, then the Primary I/O Address must be probed |
789 | if (!BusLogic_ProbeOptions.NoProbeISA) | 844 | explicitly before any PCI host adapters are probed. |
790 | if (PrimaryProbeInfo->IO_Address == 0 && | 845 | */ |
791 | (!BusLogic_ProbeOptions.LimitedProbeISA || | 846 | if (!blogic_probe_options.noprobe_isa) |
792 | BusLogic_ProbeOptions.Probe330)) { | 847 | if (pr_probeinfo->io_addr == 0 && |
793 | PrimaryProbeInfo->HostAdapterType = BusLogic_MultiMaster; | 848 | (!blogic_probe_options.limited_isa || |
794 | PrimaryProbeInfo->HostAdapterBusType = BusLogic_ISA_Bus; | 849 | blogic_probe_options.probe330)) { |
795 | PrimaryProbeInfo->IO_Address = 0x330; | 850 | pr_probeinfo->adapter_type = BLOGIC_MULTIMASTER; |
851 | pr_probeinfo->adapter_bus_type = BLOGIC_ISA_BUS; | ||
852 | pr_probeinfo->io_addr = 0x330; | ||
796 | } | 853 | } |
797 | /* | 854 | /* |
798 | Append the list of standard BusLogic MultiMaster ISA I/O Addresses, | 855 | Append the list of standard BusLogic MultiMaster ISA I/O Addresses, |
799 | omitting the Primary I/O Address which has already been handled. | 856 | omitting the Primary I/O Address which has already been handled. |
800 | */ | 857 | */ |
801 | if (!BusLogic_ProbeOptions.NoProbeISA) { | 858 | if (!blogic_probe_options.noprobe_isa) { |
802 | if (!StandardAddressSeen[1] && | 859 | if (!addr_seen[1] && |
803 | (!BusLogic_ProbeOptions.LimitedProbeISA || | 860 | (!blogic_probe_options.limited_isa || |
804 | BusLogic_ProbeOptions.Probe334)) | 861 | blogic_probe_options.probe334)) |
805 | BusLogic_AppendProbeAddressISA(0x334); | 862 | blogic_add_probeaddr_isa(0x334); |
806 | if (!StandardAddressSeen[2] && | 863 | if (!addr_seen[2] && |
807 | (!BusLogic_ProbeOptions.LimitedProbeISA || | 864 | (!blogic_probe_options.limited_isa || |
808 | BusLogic_ProbeOptions.Probe230)) | 865 | blogic_probe_options.probe230)) |
809 | BusLogic_AppendProbeAddressISA(0x230); | 866 | blogic_add_probeaddr_isa(0x230); |
810 | if (!StandardAddressSeen[3] && | 867 | if (!addr_seen[3] && |
811 | (!BusLogic_ProbeOptions.LimitedProbeISA || | 868 | (!blogic_probe_options.limited_isa || |
812 | BusLogic_ProbeOptions.Probe234)) | 869 | blogic_probe_options.probe234)) |
813 | BusLogic_AppendProbeAddressISA(0x234); | 870 | blogic_add_probeaddr_isa(0x234); |
814 | if (!StandardAddressSeen[4] && | 871 | if (!addr_seen[4] && |
815 | (!BusLogic_ProbeOptions.LimitedProbeISA || | 872 | (!blogic_probe_options.limited_isa || |
816 | BusLogic_ProbeOptions.Probe130)) | 873 | blogic_probe_options.probe130)) |
817 | BusLogic_AppendProbeAddressISA(0x130); | 874 | blogic_add_probeaddr_isa(0x130); |
818 | if (!StandardAddressSeen[5] && | 875 | if (!addr_seen[5] && |
819 | (!BusLogic_ProbeOptions.LimitedProbeISA || | 876 | (!blogic_probe_options.limited_isa || |
820 | BusLogic_ProbeOptions.Probe134)) | 877 | blogic_probe_options.probe134)) |
821 | BusLogic_AppendProbeAddressISA(0x134); | 878 | blogic_add_probeaddr_isa(0x134); |
822 | } | 879 | } |
823 | /* | 880 | /* |
824 | Iterate over the older non-compliant MultiMaster PCI Host Adapters, | 881 | Iterate over the older non-compliant MultiMaster PCI Host Adapters, |
825 | noting the PCI bus location and assigned IRQ Channel. | 882 | noting the PCI bus location and assigned IRQ Channel. |
826 | */ | 883 | */ |
827 | PCI_Device = NULL; | 884 | pci_device = NULL; |
828 | while ((PCI_Device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, PCI_Device)) != NULL) { | 885 | while ((pci_device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, |
829 | unsigned char Bus; | 886 | PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, |
830 | unsigned char Device; | 887 | pci_device)) != NULL) { |
831 | unsigned int IRQ_Channel; | 888 | unsigned char bus; |
832 | unsigned long IO_Address; | 889 | unsigned char device; |
890 | unsigned int irq_ch; | ||
891 | unsigned long io_addr; | ||
833 | 892 | ||
834 | if (pci_enable_device(PCI_Device)) | 893 | if (pci_enable_device(pci_device)) |
835 | continue; | 894 | continue; |
836 | 895 | ||
837 | if (pci_set_dma_mask(PCI_Device, DMA_BIT_MASK(32))) | 896 | if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32))) |
838 | continue; | 897 | continue; |
839 | 898 | ||
840 | Bus = PCI_Device->bus->number; | 899 | bus = pci_device->bus->number; |
841 | Device = PCI_Device->devfn >> 3; | 900 | device = pci_device->devfn >> 3; |
842 | IRQ_Channel = PCI_Device->irq; | 901 | irq_ch = pci_device->irq; |
843 | IO_Address = pci_resource_start(PCI_Device, 0); | 902 | io_addr = pci_resource_start(pci_device, 0); |
844 | 903 | ||
845 | if (IO_Address == 0 || IRQ_Channel == 0) | 904 | if (io_addr == 0 || irq_ch == 0) |
846 | continue; | 905 | continue; |
847 | for (i = 0; i < BusLogic_ProbeInfoCount; i++) { | 906 | for (i = 0; i < blogic_probeinfo_count; i++) { |
848 | struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[i]; | 907 | struct blogic_probeinfo *probeinfo = |
849 | if (ProbeInfo->IO_Address == IO_Address && ProbeInfo->HostAdapterType == BusLogic_MultiMaster) { | 908 | &blogic_probeinfo_list[i]; |
850 | ProbeInfo->HostAdapterBusType = BusLogic_PCI_Bus; | 909 | if (probeinfo->io_addr == io_addr && |
851 | ProbeInfo->PCI_Address = 0; | 910 | probeinfo->adapter_type == BLOGIC_MULTIMASTER) { |
852 | ProbeInfo->Bus = Bus; | 911 | probeinfo->adapter_bus_type = BLOGIC_PCI_BUS; |
853 | ProbeInfo->Device = Device; | 912 | probeinfo->pci_addr = 0; |
854 | ProbeInfo->IRQ_Channel = IRQ_Channel; | 913 | probeinfo->bus = bus; |
855 | ProbeInfo->PCI_Device = pci_dev_get(PCI_Device); | 914 | probeinfo->dev = device; |
915 | probeinfo->irq_ch = irq_ch; | ||
916 | probeinfo->pci_device = pci_dev_get(pci_device); | ||
856 | break; | 917 | break; |
857 | } | 918 | } |
858 | } | 919 | } |
859 | } | 920 | } |
860 | return PCIMultiMasterCount; | 921 | return mmcount; |
861 | } | 922 | } |
862 | 923 | ||
863 | 924 | ||
864 | /* | 925 | /* |
865 | BusLogic_InitializeFlashPointProbeInfo initializes the list of I/O Address | 926 | blogic_init_fp_probeinfo initializes the list of I/O Address |
866 | and Bus Probe Information to be checked for potential BusLogic FlashPoint | 927 | and Bus Probe Information to be checked for potential BusLogic FlashPoint |
867 | Host Adapters by interrogating the PCI Configuration Space. It returns the | 928 | Host Adapters by interrogating the PCI Configuration Space. It returns the |
868 | number of FlashPoint Host Adapters found. | 929 | number of FlashPoint Host Adapters found. |
869 | */ | 930 | */ |
870 | 931 | ||
871 | static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAdapter | 932 | static int __init blogic_init_fp_probeinfo(struct blogic_adapter *adapter) |
872 | *PrototypeHostAdapter) | ||
873 | { | 933 | { |
874 | int FlashPointIndex = BusLogic_ProbeInfoCount, FlashPointCount = 0; | 934 | int fpindex = blogic_probeinfo_count, fpcount = 0; |
875 | struct pci_dev *PCI_Device = NULL; | 935 | struct pci_dev *pci_device = NULL; |
876 | /* | 936 | /* |
877 | Interrogate PCI Configuration Space for any FlashPoint Host Adapters. | 937 | Interrogate PCI Configuration Space for any FlashPoint Host Adapters. |
878 | */ | 938 | */ |
879 | while ((PCI_Device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT, PCI_Device)) != NULL) { | 939 | while ((pci_device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, |
880 | unsigned char Bus; | 940 | PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT, |
881 | unsigned char Device; | 941 | pci_device)) != NULL) { |
882 | unsigned int IRQ_Channel; | 942 | unsigned char bus; |
883 | unsigned long BaseAddress0; | 943 | unsigned char device; |
884 | unsigned long BaseAddress1; | 944 | unsigned int irq_ch; |
885 | unsigned long IO_Address; | 945 | unsigned long base_addr0; |
886 | unsigned long PCI_Address; | 946 | unsigned long base_addr1; |
887 | 947 | unsigned long io_addr; | |
888 | if (pci_enable_device(PCI_Device)) | 948 | unsigned long pci_addr; |
949 | |||
950 | if (pci_enable_device(pci_device)) | ||
889 | continue; | 951 | continue; |
890 | 952 | ||
891 | if (pci_set_dma_mask(PCI_Device, DMA_BIT_MASK(32))) | 953 | if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32))) |
892 | continue; | 954 | continue; |
893 | 955 | ||
894 | Bus = PCI_Device->bus->number; | 956 | bus = pci_device->bus->number; |
895 | Device = PCI_Device->devfn >> 3; | 957 | device = pci_device->devfn >> 3; |
896 | IRQ_Channel = PCI_Device->irq; | 958 | irq_ch = pci_device->irq; |
897 | IO_Address = BaseAddress0 = pci_resource_start(PCI_Device, 0); | 959 | io_addr = base_addr0 = pci_resource_start(pci_device, 0); |
898 | PCI_Address = BaseAddress1 = pci_resource_start(PCI_Device, 1); | 960 | pci_addr = base_addr1 = pci_resource_start(pci_device, 1); |
899 | #ifdef CONFIG_SCSI_FLASHPOINT | 961 | #ifdef CONFIG_SCSI_FLASHPOINT |
900 | if (pci_resource_flags(PCI_Device, 0) & IORESOURCE_MEM) { | 962 | if (pci_resource_flags(pci_device, 0) & IORESOURCE_MEM) { |
901 | BusLogic_Error("BusLogic: Base Address0 0x%X not I/O for " "FlashPoint Host Adapter\n", NULL, BaseAddress0); | 963 | blogic_err("BusLogic: Base Address0 0x%X not I/O for " "FlashPoint Host Adapter\n", NULL, base_addr0); |
902 | BusLogic_Error("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, Bus, Device, IO_Address); | 964 | blogic_err("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, bus, device, io_addr); |
903 | continue; | 965 | continue; |
904 | } | 966 | } |
905 | if (pci_resource_flags(PCI_Device, 1) & IORESOURCE_IO) { | 967 | if (pci_resource_flags(pci_device, 1) & IORESOURCE_IO) { |
906 | BusLogic_Error("BusLogic: Base Address1 0x%X not Memory for " "FlashPoint Host Adapter\n", NULL, BaseAddress1); | 968 | blogic_err("BusLogic: Base Address1 0x%X not Memory for " "FlashPoint Host Adapter\n", NULL, base_addr1); |
907 | BusLogic_Error("at PCI Bus %d Device %d PCI Address 0x%X\n", NULL, Bus, Device, PCI_Address); | 969 | blogic_err("at PCI Bus %d Device %d PCI Address 0x%X\n", NULL, bus, device, pci_addr); |
908 | continue; | 970 | continue; |
909 | } | 971 | } |
910 | if (IRQ_Channel == 0) { | 972 | if (irq_ch == 0) { |
911 | BusLogic_Error("BusLogic: IRQ Channel %d invalid for " "FlashPoint Host Adapter\n", NULL, IRQ_Channel); | 973 | blogic_err("BusLogic: IRQ Channel %d invalid for " "FlashPoint Host Adapter\n", NULL, irq_ch); |
912 | BusLogic_Error("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, Bus, Device, IO_Address); | 974 | blogic_err("at PCI Bus %d Device %d I/O Address 0x%X\n", NULL, bus, device, io_addr); |
913 | continue; | 975 | continue; |
914 | } | 976 | } |
915 | if (BusLogic_GlobalOptions.TraceProbe) { | 977 | if (blogic_global_options.trace_probe) { |
916 | BusLogic_Notice("BusLogic: FlashPoint Host Adapter " "detected at\n", NULL); | 978 | blogic_notice("BusLogic: FlashPoint Host Adapter " "detected at\n", NULL); |
917 | BusLogic_Notice("BusLogic: PCI Bus %d Device %d I/O Address " "0x%X PCI Address 0x%X\n", NULL, Bus, Device, IO_Address, PCI_Address); | 979 | blogic_notice("BusLogic: PCI Bus %d Device %d I/O Address " "0x%X PCI Address 0x%X\n", NULL, bus, device, io_addr, pci_addr); |
918 | } | 980 | } |
919 | if (BusLogic_ProbeInfoCount < BusLogic_MaxHostAdapters) { | 981 | if (blogic_probeinfo_count < BLOGIC_MAX_ADAPTERS) { |
920 | struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++]; | 982 | struct blogic_probeinfo *probeinfo = |
921 | ProbeInfo->HostAdapterType = BusLogic_FlashPoint; | 983 | &blogic_probeinfo_list[blogic_probeinfo_count++]; |
922 | ProbeInfo->HostAdapterBusType = BusLogic_PCI_Bus; | 984 | probeinfo->adapter_type = BLOGIC_FLASHPOINT; |
923 | ProbeInfo->IO_Address = IO_Address; | 985 | probeinfo->adapter_bus_type = BLOGIC_PCI_BUS; |
924 | ProbeInfo->PCI_Address = PCI_Address; | 986 | probeinfo->io_addr = io_addr; |
925 | ProbeInfo->Bus = Bus; | 987 | probeinfo->pci_addr = pci_addr; |
926 | ProbeInfo->Device = Device; | 988 | probeinfo->bus = bus; |
927 | ProbeInfo->IRQ_Channel = IRQ_Channel; | 989 | probeinfo->dev = device; |
928 | ProbeInfo->PCI_Device = pci_dev_get(PCI_Device); | 990 | probeinfo->irq_ch = irq_ch; |
929 | FlashPointCount++; | 991 | probeinfo->pci_device = pci_dev_get(pci_device); |
992 | fpcount++; | ||
930 | } else | 993 | } else |
931 | BusLogic_Warning("BusLogic: Too many Host Adapters " "detected\n", NULL); | 994 | blogic_warn("BusLogic: Too many Host Adapters " "detected\n", NULL); |
932 | #else | 995 | #else |
933 | BusLogic_Error("BusLogic: FlashPoint Host Adapter detected at " "PCI Bus %d Device %d\n", NULL, Bus, Device); | 996 | blogic_err("BusLogic: FlashPoint Host Adapter detected at " "PCI Bus %d Device %d\n", NULL, bus, device); |
934 | BusLogic_Error("BusLogic: I/O Address 0x%X PCI Address 0x%X, irq %d, " "but FlashPoint\n", NULL, IO_Address, PCI_Address, IRQ_Channel); | 997 | blogic_err("BusLogic: I/O Address 0x%X PCI Address 0x%X, irq %d, " "but FlashPoint\n", NULL, io_addr, pci_addr, irq_ch); |
935 | BusLogic_Error("BusLogic: support was omitted in this kernel " "configuration.\n", NULL); | 998 | blogic_err("BusLogic: support was omitted in this kernel " "configuration.\n", NULL); |
936 | #endif | 999 | #endif |
937 | } | 1000 | } |
938 | /* | 1001 | /* |
@@ -940,13 +1003,13 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda | |||
940 | increasing PCI Bus and Device Number, so sort the probe information into | 1003 | increasing PCI Bus and Device Number, so sort the probe information into |
941 | the same order the BIOS uses. | 1004 | the same order the BIOS uses. |
942 | */ | 1005 | */ |
943 | BusLogic_SortProbeInfo(&BusLogic_ProbeInfoList[FlashPointIndex], FlashPointCount); | 1006 | blogic_sort_probeinfo(&blogic_probeinfo_list[fpindex], fpcount); |
944 | return FlashPointCount; | 1007 | return fpcount; |
945 | } | 1008 | } |
946 | 1009 | ||
947 | 1010 | ||
948 | /* | 1011 | /* |
949 | BusLogic_InitializeProbeInfoList initializes the list of I/O Address and Bus | 1012 | blogic_init_probeinfo_list initializes the list of I/O Address and Bus |
950 | Probe Information to be checked for potential BusLogic SCSI Host Adapters by | 1013 | Probe Information to be checked for potential BusLogic SCSI Host Adapters by |
951 | interrogating the PCI Configuration Space on PCI machines as well as from the | 1014 | interrogating the PCI Configuration Space on PCI machines as well as from the |
952 | list of standard BusLogic MultiMaster ISA I/O Addresses. By default, if both | 1015 | list of standard BusLogic MultiMaster ISA I/O Addresses. By default, if both |
@@ -958,104 +1021,125 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda | |||
958 | a particular probe order. | 1021 | a particular probe order. |
959 | */ | 1022 | */ |
960 | 1023 | ||
961 | static void __init BusLogic_InitializeProbeInfoList(struct BusLogic_HostAdapter | 1024 | static void __init blogic_init_probeinfo_list(struct blogic_adapter *adapter) |
962 | *PrototypeHostAdapter) | ||
963 | { | 1025 | { |
964 | /* | 1026 | /* |
965 | If a PCI BIOS is present, interrogate it for MultiMaster and FlashPoint | 1027 | If a PCI BIOS is present, interrogate it for MultiMaster and |
966 | Host Adapters; otherwise, default to the standard ISA MultiMaster probe. | 1028 | FlashPoint Host Adapters; otherwise, default to the standard |
967 | */ | 1029 | ISA MultiMaster probe. |
968 | if (!BusLogic_ProbeOptions.NoProbePCI) { | 1030 | */ |
969 | if (BusLogic_ProbeOptions.MultiMasterFirst) { | 1031 | if (!blogic_probe_options.noprobe_pci) { |
970 | BusLogic_InitializeMultiMasterProbeInfo(PrototypeHostAdapter); | 1032 | if (blogic_probe_options.multimaster_first) { |
971 | BusLogic_InitializeFlashPointProbeInfo(PrototypeHostAdapter); | 1033 | blogic_init_mm_probeinfo(adapter); |
972 | } else if (BusLogic_ProbeOptions.FlashPointFirst) { | 1034 | blogic_init_fp_probeinfo(adapter); |
973 | BusLogic_InitializeFlashPointProbeInfo(PrototypeHostAdapter); | 1035 | } else if (blogic_probe_options.flashpoint_first) { |
974 | BusLogic_InitializeMultiMasterProbeInfo(PrototypeHostAdapter); | 1036 | blogic_init_fp_probeinfo(adapter); |
1037 | blogic_init_mm_probeinfo(adapter); | ||
975 | } else { | 1038 | } else { |
976 | int FlashPointCount = BusLogic_InitializeFlashPointProbeInfo(PrototypeHostAdapter); | 1039 | int fpcount = blogic_init_fp_probeinfo(adapter); |
977 | int PCIMultiMasterCount = BusLogic_InitializeMultiMasterProbeInfo(PrototypeHostAdapter); | 1040 | int mmcount = blogic_init_mm_probeinfo(adapter); |
978 | if (FlashPointCount > 0 && PCIMultiMasterCount > 0) { | 1041 | if (fpcount > 0 && mmcount > 0) { |
979 | struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[FlashPointCount]; | 1042 | struct blogic_probeinfo *probeinfo = |
980 | struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter; | 1043 | &blogic_probeinfo_list[fpcount]; |
981 | struct BusLogic_FetchHostAdapterLocalRAMRequest FetchHostAdapterLocalRAMRequest; | 1044 | struct blogic_adapter *myadapter = adapter; |
982 | struct BusLogic_BIOSDriveMapByte Drive0MapByte; | 1045 | struct blogic_fetch_localram fetch_localram; |
983 | while (ProbeInfo->HostAdapterBusType != BusLogic_PCI_Bus) | 1046 | struct blogic_bios_drvmap d0_mapbyte; |
984 | ProbeInfo++; | 1047 | |
985 | HostAdapter->IO_Address = ProbeInfo->IO_Address; | 1048 | while (probeinfo->adapter_bus_type != |
986 | FetchHostAdapterLocalRAMRequest.ByteOffset = BusLogic_BIOS_BaseOffset + BusLogic_BIOS_DriveMapOffset + 0; | 1049 | BLOGIC_PCI_BUS) |
987 | FetchHostAdapterLocalRAMRequest.ByteCount = sizeof(Drive0MapByte); | 1050 | probeinfo++; |
988 | BusLogic_Command(HostAdapter, BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest, sizeof(FetchHostAdapterLocalRAMRequest), &Drive0MapByte, sizeof(Drive0MapByte)); | 1051 | myadapter->io_addr = probeinfo->io_addr; |
1052 | fetch_localram.offset = | ||
1053 | BLOGIC_BIOS_BASE + BLOGIC_BIOS_DRVMAP; | ||
1054 | fetch_localram.count = sizeof(d0_mapbyte); | ||
1055 | blogic_cmd(myadapter, BLOGIC_FETCH_LOCALRAM, | ||
1056 | &fetch_localram, | ||
1057 | sizeof(fetch_localram), | ||
1058 | &d0_mapbyte, | ||
1059 | sizeof(d0_mapbyte)); | ||
989 | /* | 1060 | /* |
990 | If the Map Byte for BIOS Drive 0 indicates that BIOS Drive 0 | 1061 | If the Map Byte for BIOS Drive 0 indicates |
991 | is controlled by this PCI MultiMaster Host Adapter, then | 1062 | that BIOS Drive 0 is controlled by this |
992 | reverse the probe order so that MultiMaster Host Adapters are | 1063 | PCI MultiMaster Host Adapter, then reverse |
993 | probed before FlashPoint Host Adapters. | 1064 | the probe order so that MultiMaster Host |
1065 | Adapters are probed before FlashPoint Host | ||
1066 | Adapters. | ||
994 | */ | 1067 | */ |
995 | if (Drive0MapByte.DiskGeometry != BusLogic_BIOS_Disk_Not_Installed) { | 1068 | if (d0_mapbyte.diskgeom != BLOGIC_BIOS_NODISK) { |
996 | struct BusLogic_ProbeInfo SavedProbeInfo[BusLogic_MaxHostAdapters]; | 1069 | struct blogic_probeinfo saved_probeinfo[BLOGIC_MAX_ADAPTERS]; |
997 | int MultiMasterCount = BusLogic_ProbeInfoCount - FlashPointCount; | 1070 | int mmcount = blogic_probeinfo_count - fpcount; |
998 | memcpy(SavedProbeInfo, BusLogic_ProbeInfoList, BusLogic_ProbeInfoCount * sizeof(struct BusLogic_ProbeInfo)); | 1071 | |
999 | memcpy(&BusLogic_ProbeInfoList[0], &SavedProbeInfo[FlashPointCount], MultiMasterCount * sizeof(struct BusLogic_ProbeInfo)); | 1072 | memcpy(saved_probeinfo, |
1000 | memcpy(&BusLogic_ProbeInfoList[MultiMasterCount], &SavedProbeInfo[0], FlashPointCount * sizeof(struct BusLogic_ProbeInfo)); | 1073 | blogic_probeinfo_list, |
1074 | blogic_probeinfo_count * sizeof(struct blogic_probeinfo)); | ||
1075 | memcpy(&blogic_probeinfo_list[0], | ||
1076 | &saved_probeinfo[fpcount], | ||
1077 | mmcount * sizeof(struct blogic_probeinfo)); | ||
1078 | memcpy(&blogic_probeinfo_list[mmcount], | ||
1079 | &saved_probeinfo[0], | ||
1080 | fpcount * sizeof(struct blogic_probeinfo)); | ||
1001 | } | 1081 | } |
1002 | } | 1082 | } |
1003 | } | 1083 | } |
1004 | } else | 1084 | } else { |
1005 | BusLogic_InitializeProbeInfoListISA(PrototypeHostAdapter); | 1085 | blogic_init_probeinfo_isa(adapter); |
1086 | } | ||
1006 | } | 1087 | } |
1007 | 1088 | ||
1008 | 1089 | ||
1009 | #else | 1090 | #else |
1010 | #define BusLogic_InitializeProbeInfoList(adapter) \ | 1091 | #define blogic_init_probeinfo_list(adapter) \ |
1011 | BusLogic_InitializeProbeInfoListISA(adapter) | 1092 | blogic_init_probeinfo_isa(adapter) |
1012 | #endif /* CONFIG_PCI */ | 1093 | #endif /* CONFIG_PCI */ |
1013 | 1094 | ||
1014 | 1095 | ||
1015 | /* | 1096 | /* |
1016 | BusLogic_Failure prints a standardized error message, and then returns false. | 1097 | blogic_failure prints a standardized error message, and then returns false. |
1017 | */ | 1098 | */ |
1018 | 1099 | ||
1019 | static bool BusLogic_Failure(struct BusLogic_HostAdapter *HostAdapter, char *ErrorMessage) | 1100 | static bool blogic_failure(struct blogic_adapter *adapter, char *msg) |
1020 | { | 1101 | { |
1021 | BusLogic_AnnounceDriver(HostAdapter); | 1102 | blogic_announce_drvr(adapter); |
1022 | if (HostAdapter->HostAdapterBusType == BusLogic_PCI_Bus) { | 1103 | if (adapter->adapter_bus_type == BLOGIC_PCI_BUS) { |
1023 | BusLogic_Error("While configuring BusLogic PCI Host Adapter at\n", HostAdapter); | 1104 | blogic_err("While configuring BusLogic PCI Host Adapter at\n", |
1024 | BusLogic_Error("Bus %d Device %d I/O Address 0x%X PCI Address 0x%X:\n", HostAdapter, HostAdapter->Bus, HostAdapter->Device, HostAdapter->IO_Address, HostAdapter->PCI_Address); | 1105 | adapter); |
1106 | blogic_err("Bus %d Device %d I/O Address 0x%X PCI Address 0x%X:\n", adapter, adapter->bus, adapter->dev, adapter->io_addr, adapter->pci_addr); | ||
1025 | } else | 1107 | } else |
1026 | BusLogic_Error("While configuring BusLogic Host Adapter at " "I/O Address 0x%X:\n", HostAdapter, HostAdapter->IO_Address); | 1108 | blogic_err("While configuring BusLogic Host Adapter at " "I/O Address 0x%X:\n", adapter, adapter->io_addr); |
1027 | BusLogic_Error("%s FAILED - DETACHING\n", HostAdapter, ErrorMessage); | 1109 | blogic_err("%s FAILED - DETACHING\n", adapter, msg); |
1028 | if (BusLogic_CommandFailureReason != NULL) | 1110 | if (blogic_cmd_failure_reason != NULL) |
1029 | BusLogic_Error("ADDITIONAL FAILURE INFO - %s\n", HostAdapter, BusLogic_CommandFailureReason); | 1111 | blogic_err("ADDITIONAL FAILURE INFO - %s\n", adapter, |
1112 | blogic_cmd_failure_reason); | ||
1030 | return false; | 1113 | return false; |
1031 | } | 1114 | } |
1032 | 1115 | ||
1033 | 1116 | ||
1034 | /* | 1117 | /* |
1035 | BusLogic_ProbeHostAdapter probes for a BusLogic Host Adapter. | 1118 | blogic_probe probes for a BusLogic Host Adapter. |
1036 | */ | 1119 | */ |
1037 | 1120 | ||
1038 | static bool __init BusLogic_ProbeHostAdapter(struct BusLogic_HostAdapter *HostAdapter) | 1121 | static bool __init blogic_probe(struct blogic_adapter *adapter) |
1039 | { | 1122 | { |
1040 | union BusLogic_StatusRegister StatusRegister; | 1123 | union blogic_stat_reg statusreg; |
1041 | union BusLogic_InterruptRegister InterruptRegister; | 1124 | union blogic_int_reg intreg; |
1042 | union BusLogic_GeometryRegister GeometryRegister; | 1125 | union blogic_geo_reg georeg; |
1043 | /* | 1126 | /* |
1044 | FlashPoint Host Adapters are Probed by the FlashPoint SCCB Manager. | 1127 | FlashPoint Host Adapters are Probed by the FlashPoint SCCB Manager. |
1045 | */ | 1128 | */ |
1046 | if (BusLogic_FlashPointHostAdapterP(HostAdapter)) { | 1129 | if (blogic_flashpoint_type(adapter)) { |
1047 | struct FlashPoint_Info *FlashPointInfo = &HostAdapter->FlashPointInfo; | 1130 | struct fpoint_info *fpinfo = &adapter->fpinfo; |
1048 | FlashPointInfo->BaseAddress = (u32) HostAdapter->IO_Address; | 1131 | fpinfo->base_addr = (u32) adapter->io_addr; |
1049 | FlashPointInfo->IRQ_Channel = HostAdapter->IRQ_Channel; | 1132 | fpinfo->irq_ch = adapter->irq_ch; |
1050 | FlashPointInfo->Present = false; | 1133 | fpinfo->present = false; |
1051 | if (!(FlashPoint_ProbeHostAdapter(FlashPointInfo) == 0 && FlashPointInfo->Present)) { | 1134 | if (!(FlashPoint_ProbeHostAdapter(fpinfo) == 0 && |
1052 | BusLogic_Error("BusLogic: FlashPoint Host Adapter detected at " "PCI Bus %d Device %d\n", HostAdapter, HostAdapter->Bus, HostAdapter->Device); | 1135 | fpinfo->present)) { |
1053 | BusLogic_Error("BusLogic: I/O Address 0x%X PCI Address 0x%X, " "but FlashPoint\n", HostAdapter, HostAdapter->IO_Address, HostAdapter->PCI_Address); | 1136 | blogic_err("BusLogic: FlashPoint Host Adapter detected at " "PCI Bus %d Device %d\n", adapter, adapter->bus, adapter->dev); |
1054 | BusLogic_Error("BusLogic: Probe Function failed to validate it.\n", HostAdapter); | 1137 | blogic_err("BusLogic: I/O Address 0x%X PCI Address 0x%X, " "but FlashPoint\n", adapter, adapter->io_addr, adapter->pci_addr); |
1138 | blogic_err("BusLogic: Probe Function failed to validate it.\n", adapter); | ||
1055 | return false; | 1139 | return false; |
1056 | } | 1140 | } |
1057 | if (BusLogic_GlobalOptions.TraceProbe) | 1141 | if (blogic_global_options.trace_probe) |
1058 | BusLogic_Notice("BusLogic_Probe(0x%X): FlashPoint Found\n", HostAdapter, HostAdapter->IO_Address); | 1142 | blogic_notice("BusLogic_Probe(0x%X): FlashPoint Found\n", adapter, adapter->io_addr); |
1059 | /* | 1143 | /* |
1060 | Indicate the Host Adapter Probe completed successfully. | 1144 | Indicate the Host Adapter Probe completed successfully. |
1061 | */ | 1145 | */ |
@@ -1068,28 +1152,32 @@ static bool __init BusLogic_ProbeHostAdapter(struct BusLogic_HostAdapter *HostAd | |||
1068 | case there is definitely no BusLogic Host Adapter at this base I/O Address. | 1152 | case there is definitely no BusLogic Host Adapter at this base I/O Address. |
1069 | The test here is a subset of that used by the BusLogic Host Adapter BIOS. | 1153 | The test here is a subset of that used by the BusLogic Host Adapter BIOS. |
1070 | */ | 1154 | */ |
1071 | StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); | 1155 | statusreg.all = blogic_rdstatus(adapter); |
1072 | InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter); | 1156 | intreg.all = blogic_rdint(adapter); |
1073 | GeometryRegister.All = BusLogic_ReadGeometryRegister(HostAdapter); | 1157 | georeg.all = blogic_rdgeom(adapter); |
1074 | if (BusLogic_GlobalOptions.TraceProbe) | 1158 | if (blogic_global_options.trace_probe) |
1075 | BusLogic_Notice("BusLogic_Probe(0x%X): Status 0x%02X, Interrupt 0x%02X, " "Geometry 0x%02X\n", HostAdapter, HostAdapter->IO_Address, StatusRegister.All, InterruptRegister.All, GeometryRegister.All); | 1159 | blogic_notice("BusLogic_Probe(0x%X): Status 0x%02X, Interrupt 0x%02X, " "Geometry 0x%02X\n", adapter, adapter->io_addr, statusreg.all, intreg.all, georeg.all); |
1076 | if (StatusRegister.All == 0 || StatusRegister.sr.DiagnosticActive || StatusRegister.sr.CommandParameterRegisterBusy || StatusRegister.sr.Reserved || StatusRegister.sr.CommandInvalid || InterruptRegister.ir.Reserved != 0) | 1160 | if (statusreg.all == 0 || statusreg.sr.diag_active || |
1161 | statusreg.sr.cmd_param_busy || statusreg.sr.rsvd || | ||
1162 | statusreg.sr.cmd_invalid || intreg.ir.rsvd != 0) | ||
1077 | return false; | 1163 | return false; |
1078 | /* | 1164 | /* |
1079 | Check the undocumented Geometry Register to test if there is an I/O port | 1165 | Check the undocumented Geometry Register to test if there is |
1080 | that responded. Adaptec Host Adapters do not implement the Geometry | 1166 | an I/O port that responded. Adaptec Host Adapters do not |
1081 | Register, so this test helps serve to avoid incorrectly recognizing an | 1167 | implement the Geometry Register, so this test helps serve to |
1082 | Adaptec 1542A or 1542B as a BusLogic. Unfortunately, the Adaptec 1542C | 1168 | avoid incorrectly recognizing an Adaptec 1542A or 1542B as a |
1083 | series does respond to the Geometry Register I/O port, but it will be | 1169 | BusLogic. Unfortunately, the Adaptec 1542C series does respond |
1084 | rejected later when the Inquire Extended Setup Information command is | 1170 | to the Geometry Register I/O port, but it will be rejected |
1085 | issued in BusLogic_CheckHostAdapter. The AMI FastDisk Host Adapter is a | 1171 | later when the Inquire Extended Setup Information command is |
1086 | BusLogic clone that implements the same interface as earlier BusLogic | 1172 | issued in blogic_checkadapter. The AMI FastDisk Host Adapter |
1087 | Host Adapters, including the undocumented commands, and is therefore | 1173 | is a BusLogic clone that implements the same interface as |
1088 | supported by this driver. However, the AMI FastDisk always returns 0x00 | 1174 | earlier BusLogic Host Adapters, including the undocumented |
1089 | upon reading the Geometry Register, so the extended translation option | 1175 | commands, and is therefore supported by this driver. However, |
1090 | should always be left disabled on the AMI FastDisk. | 1176 | the AMI FastDisk always returns 0x00 upon reading the Geometry |
1091 | */ | 1177 | Register, so the extended translation option should always be |
1092 | if (GeometryRegister.All == 0xFF) | 1178 | left disabled on the AMI FastDisk. |
1179 | */ | ||
1180 | if (georeg.all == 0xFF) | ||
1093 | return false; | 1181 | return false; |
1094 | /* | 1182 | /* |
1095 | Indicate the Host Adapter Probe completed successfully. | 1183 | Indicate the Host Adapter Probe completed successfully. |
@@ -1099,27 +1187,28 @@ static bool __init BusLogic_ProbeHostAdapter(struct BusLogic_HostAdapter *HostAd | |||
1099 | 1187 | ||
1100 | 1188 | ||
1101 | /* | 1189 | /* |
1102 | BusLogic_HardwareResetHostAdapter issues a Hardware Reset to the Host Adapter | 1190 | blogic_hwreset issues a Hardware Reset to the Host Adapter |
1103 | and waits for Host Adapter Diagnostics to complete. If HardReset is true, a | 1191 | and waits for Host Adapter Diagnostics to complete. If hard_reset is true, a |
1104 | Hard Reset is performed which also initiates a SCSI Bus Reset. Otherwise, a | 1192 | Hard Reset is performed which also initiates a SCSI Bus Reset. Otherwise, a |
1105 | Soft Reset is performed which only resets the Host Adapter without forcing a | 1193 | Soft Reset is performed which only resets the Host Adapter without forcing a |
1106 | SCSI Bus Reset. | 1194 | SCSI Bus Reset. |
1107 | */ | 1195 | */ |
1108 | 1196 | ||
1109 | static bool BusLogic_HardwareResetHostAdapter(struct BusLogic_HostAdapter | 1197 | static bool blogic_hwreset(struct blogic_adapter *adapter, bool hard_reset) |
1110 | *HostAdapter, bool HardReset) | ||
1111 | { | 1198 | { |
1112 | union BusLogic_StatusRegister StatusRegister; | 1199 | union blogic_stat_reg statusreg; |
1113 | int TimeoutCounter; | 1200 | int timeout; |
1114 | /* | 1201 | /* |
1115 | FlashPoint Host Adapters are Hard Reset by the FlashPoint SCCB Manager. | 1202 | FlashPoint Host Adapters are Hard Reset by the FlashPoint |
1203 | SCCB Manager. | ||
1116 | */ | 1204 | */ |
1117 | if (BusLogic_FlashPointHostAdapterP(HostAdapter)) { | 1205 | if (blogic_flashpoint_type(adapter)) { |
1118 | struct FlashPoint_Info *FlashPointInfo = &HostAdapter->FlashPointInfo; | 1206 | struct fpoint_info *fpinfo = &adapter->fpinfo; |
1119 | FlashPointInfo->HostSoftReset = !HardReset; | 1207 | fpinfo->softreset = !hard_reset; |
1120 | FlashPointInfo->ReportDataUnderrun = true; | 1208 | fpinfo->report_underrun = true; |
1121 | HostAdapter->CardHandle = FlashPoint_HardwareResetHostAdapter(FlashPointInfo); | 1209 | adapter->cardhandle = |
1122 | if (HostAdapter->CardHandle == FlashPoint_BadCardHandle) | 1210 | FlashPoint_HardwareResetHostAdapter(fpinfo); |
1211 | if (adapter->cardhandle == (void *)FPOINT_BADCARD_HANDLE) | ||
1123 | return false; | 1212 | return false; |
1124 | /* | 1213 | /* |
1125 | Indicate the Host Adapter Hard Reset completed successfully. | 1214 | Indicate the Host Adapter Hard Reset completed successfully. |
@@ -1127,26 +1216,27 @@ static bool BusLogic_HardwareResetHostAdapter(struct BusLogic_HostAdapter | |||
1127 | return true; | 1216 | return true; |
1128 | } | 1217 | } |
1129 | /* | 1218 | /* |
1130 | Issue a Hard Reset or Soft Reset Command to the Host Adapter. The Host | 1219 | Issue a Hard Reset or Soft Reset Command to the Host Adapter. |
1131 | Adapter should respond by setting Diagnostic Active in the Status Register. | 1220 | The Host Adapter should respond by setting Diagnostic Active in |
1221 | the Status Register. | ||
1132 | */ | 1222 | */ |
1133 | if (HardReset) | 1223 | if (hard_reset) |
1134 | BusLogic_HardReset(HostAdapter); | 1224 | blogic_hardreset(adapter); |
1135 | else | 1225 | else |
1136 | BusLogic_SoftReset(HostAdapter); | 1226 | blogic_softreset(adapter); |
1137 | /* | 1227 | /* |
1138 | Wait until Diagnostic Active is set in the Status Register. | 1228 | Wait until Diagnostic Active is set in the Status Register. |
1139 | */ | 1229 | */ |
1140 | TimeoutCounter = 5 * 10000; | 1230 | timeout = 5 * 10000; |
1141 | while (--TimeoutCounter >= 0) { | 1231 | while (--timeout >= 0) { |
1142 | StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); | 1232 | statusreg.all = blogic_rdstatus(adapter); |
1143 | if (StatusRegister.sr.DiagnosticActive) | 1233 | if (statusreg.sr.diag_active) |
1144 | break; | 1234 | break; |
1145 | udelay(100); | 1235 | udelay(100); |
1146 | } | 1236 | } |
1147 | if (BusLogic_GlobalOptions.TraceHardwareReset) | 1237 | if (blogic_global_options.trace_hw_reset) |
1148 | BusLogic_Notice("BusLogic_HardwareReset(0x%X): Diagnostic Active, " "Status 0x%02X\n", HostAdapter, HostAdapter->IO_Address, StatusRegister.All); | 1238 | blogic_notice("BusLogic_HardwareReset(0x%X): Diagnostic Active, " "Status 0x%02X\n", adapter, adapter->io_addr, statusreg.all); |
1149 | if (TimeoutCounter < 0) | 1239 | if (timeout < 0) |
1150 | return false; | 1240 | return false; |
1151 | /* | 1241 | /* |
1152 | Wait 100 microseconds to allow completion of any initial diagnostic | 1242 | Wait 100 microseconds to allow completion of any initial diagnostic |
@@ -1157,45 +1247,47 @@ static bool BusLogic_HardwareResetHostAdapter(struct BusLogic_HostAdapter | |||
1157 | /* | 1247 | /* |
1158 | Wait until Diagnostic Active is reset in the Status Register. | 1248 | Wait until Diagnostic Active is reset in the Status Register. |
1159 | */ | 1249 | */ |
1160 | TimeoutCounter = 10 * 10000; | 1250 | timeout = 10 * 10000; |
1161 | while (--TimeoutCounter >= 0) { | 1251 | while (--timeout >= 0) { |
1162 | StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); | 1252 | statusreg.all = blogic_rdstatus(adapter); |
1163 | if (!StatusRegister.sr.DiagnosticActive) | 1253 | if (!statusreg.sr.diag_active) |
1164 | break; | 1254 | break; |
1165 | udelay(100); | 1255 | udelay(100); |
1166 | } | 1256 | } |
1167 | if (BusLogic_GlobalOptions.TraceHardwareReset) | 1257 | if (blogic_global_options.trace_hw_reset) |
1168 | BusLogic_Notice("BusLogic_HardwareReset(0x%X): Diagnostic Completed, " "Status 0x%02X\n", HostAdapter, HostAdapter->IO_Address, StatusRegister.All); | 1258 | blogic_notice("BusLogic_HardwareReset(0x%X): Diagnostic Completed, " "Status 0x%02X\n", adapter, adapter->io_addr, statusreg.all); |
1169 | if (TimeoutCounter < 0) | 1259 | if (timeout < 0) |
1170 | return false; | 1260 | return false; |
1171 | /* | 1261 | /* |
1172 | Wait until at least one of the Diagnostic Failure, Host Adapter Ready, | 1262 | Wait until at least one of the Diagnostic Failure, Host Adapter |
1173 | or Data In Register Ready bits is set in the Status Register. | 1263 | Ready, or Data In Register Ready bits is set in the Status Register. |
1174 | */ | 1264 | */ |
1175 | TimeoutCounter = 10000; | 1265 | timeout = 10000; |
1176 | while (--TimeoutCounter >= 0) { | 1266 | while (--timeout >= 0) { |
1177 | StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter); | 1267 | statusreg.all = blogic_rdstatus(adapter); |
1178 | if (StatusRegister.sr.DiagnosticFailure || StatusRegister.sr.HostAdapterReady || StatusRegister.sr.DataInRegisterReady) | 1268 | if (statusreg.sr.diag_failed || statusreg.sr.adapter_ready || |
1269 | statusreg.sr.datain_ready) | ||
1179 | break; | 1270 | break; |
1180 | udelay(100); | 1271 | udelay(100); |
1181 | } | 1272 | } |
1182 | if (BusLogic_GlobalOptions.TraceHardwareReset) | 1273 | if (blogic_global_options.trace_hw_reset) |
1183 | BusLogic_Notice("BusLogic_HardwareReset(0x%X): Host Adapter Ready, " "Status 0x%02X\n", HostAdapter, HostAdapter->IO_Address, StatusRegister.All); | 1274 | blogic_notice("BusLogic_HardwareReset(0x%X): Host Adapter Ready, " "Status 0x%02X\n", adapter, adapter->io_addr, statusreg.all); |
1184 | if (TimeoutCounter < 0) | 1275 | if (timeout < 0) |
1185 | return false; | 1276 | return false; |
1186 | /* | 1277 | /* |
1187 | If Diagnostic Failure is set or Host Adapter Ready is reset, then an | 1278 | If Diagnostic Failure is set or Host Adapter Ready is reset, |
1188 | error occurred during the Host Adapter diagnostics. If Data In Register | 1279 | then an error occurred during the Host Adapter diagnostics. |
1189 | Ready is set, then there is an Error Code available. | 1280 | If Data In Register Ready is set, then there is an Error Code |
1190 | */ | 1281 | available. |
1191 | if (StatusRegister.sr.DiagnosticFailure || !StatusRegister.sr.HostAdapterReady) { | 1282 | */ |
1192 | BusLogic_CommandFailureReason = NULL; | 1283 | if (statusreg.sr.diag_failed || !statusreg.sr.adapter_ready) { |
1193 | BusLogic_Failure(HostAdapter, "HARD RESET DIAGNOSTICS"); | 1284 | blogic_cmd_failure_reason = NULL; |
1194 | BusLogic_Error("HOST ADAPTER STATUS REGISTER = %02X\n", HostAdapter, StatusRegister.All); | 1285 | blogic_failure(adapter, "HARD RESET DIAGNOSTICS"); |
1195 | if (StatusRegister.sr.DataInRegisterReady) { | 1286 | blogic_err("HOST ADAPTER STATUS REGISTER = %02X\n", adapter, |
1196 | unsigned char ErrorCode = BusLogic_ReadDataInRegister(HostAdapter); | 1287 | statusreg.all); |
1197 | BusLogic_Error("HOST ADAPTER ERROR CODE = %d\n", HostAdapter, ErrorCode); | 1288 | if (statusreg.sr.datain_ready) |
1198 | } | 1289 | blogic_err("HOST ADAPTER ERROR CODE = %d\n", adapter, |
1290 | blogic_rddatain(adapter)); | ||
1199 | return false; | 1291 | return false; |
1200 | } | 1292 | } |
1201 | /* | 1293 | /* |
@@ -1206,161 +1298,175 @@ static bool BusLogic_HardwareResetHostAdapter(struct BusLogic_HostAdapter | |||
1206 | 1298 | ||
1207 | 1299 | ||
1208 | /* | 1300 | /* |
1209 | BusLogic_CheckHostAdapter checks to be sure this really is a BusLogic | 1301 | blogic_checkadapter checks to be sure this really is a BusLogic |
1210 | Host Adapter. | 1302 | Host Adapter. |
1211 | */ | 1303 | */ |
1212 | 1304 | ||
1213 | static bool __init BusLogic_CheckHostAdapter(struct BusLogic_HostAdapter *HostAdapter) | 1305 | static bool __init blogic_checkadapter(struct blogic_adapter *adapter) |
1214 | { | 1306 | { |
1215 | struct BusLogic_ExtendedSetupInformation ExtendedSetupInformation; | 1307 | struct blogic_ext_setup ext_setupinfo; |
1216 | unsigned char RequestedReplyLength; | 1308 | unsigned char req_replylen; |
1217 | bool Result = true; | 1309 | bool result = true; |
1218 | /* | 1310 | /* |
1219 | FlashPoint Host Adapters do not require this protection. | 1311 | FlashPoint Host Adapters do not require this protection. |
1220 | */ | 1312 | */ |
1221 | if (BusLogic_FlashPointHostAdapterP(HostAdapter)) | 1313 | if (blogic_flashpoint_type(adapter)) |
1222 | return true; | 1314 | return true; |
1223 | /* | 1315 | /* |
1224 | Issue the Inquire Extended Setup Information command. Only genuine | 1316 | Issue the Inquire Extended Setup Information command. Only genuine |
1225 | BusLogic Host Adapters and true clones support this command. Adaptec 1542C | 1317 | BusLogic Host Adapters and true clones support this command. |
1226 | series Host Adapters that respond to the Geometry Register I/O port will | 1318 | Adaptec 1542C series Host Adapters that respond to the Geometry |
1227 | fail this command. | 1319 | Register I/O port will fail this command. |
1228 | */ | 1320 | */ |
1229 | RequestedReplyLength = sizeof(ExtendedSetupInformation); | 1321 | req_replylen = sizeof(ext_setupinfo); |
1230 | if (BusLogic_Command(HostAdapter, BusLogic_InquireExtendedSetupInformation, &RequestedReplyLength, sizeof(RequestedReplyLength), &ExtendedSetupInformation, sizeof(ExtendedSetupInformation)) | 1322 | if (blogic_cmd(adapter, BLOGIC_INQ_EXTSETUP, &req_replylen, |
1231 | != sizeof(ExtendedSetupInformation)) | 1323 | sizeof(req_replylen), &ext_setupinfo, |
1232 | Result = false; | 1324 | sizeof(ext_setupinfo)) != sizeof(ext_setupinfo)) |
1325 | result = false; | ||
1233 | /* | 1326 | /* |
1234 | Provide tracing information if requested and return. | 1327 | Provide tracing information if requested and return. |
1235 | */ | 1328 | */ |
1236 | if (BusLogic_GlobalOptions.TraceProbe) | 1329 | if (blogic_global_options.trace_probe) |
1237 | BusLogic_Notice("BusLogic_Check(0x%X): MultiMaster %s\n", HostAdapter, HostAdapter->IO_Address, (Result ? "Found" : "Not Found")); | 1330 | blogic_notice("BusLogic_Check(0x%X): MultiMaster %s\n", adapter, |
1238 | return Result; | 1331 | adapter->io_addr, |
1332 | (result ? "Found" : "Not Found")); | ||
1333 | return result; | ||
1239 | } | 1334 | } |
1240 | 1335 | ||
1241 | 1336 | ||
1242 | /* | 1337 | /* |
1243 | BusLogic_ReadHostAdapterConfiguration reads the Configuration Information | 1338 | blogic_rdconfig reads the Configuration Information |
1244 | from Host Adapter and initializes the Host Adapter structure. | 1339 | from Host Adapter and initializes the Host Adapter structure. |
1245 | */ | 1340 | */ |
1246 | 1341 | ||
1247 | static bool __init BusLogic_ReadHostAdapterConfiguration(struct BusLogic_HostAdapter | 1342 | static bool __init blogic_rdconfig(struct blogic_adapter *adapter) |
1248 | *HostAdapter) | ||
1249 | { | 1343 | { |
1250 | struct BusLogic_BoardID BoardID; | 1344 | struct blogic_board_id id; |
1251 | struct BusLogic_Configuration Configuration; | 1345 | struct blogic_config config; |
1252 | struct BusLogic_SetupInformation SetupInformation; | 1346 | struct blogic_setup_info setupinfo; |
1253 | struct BusLogic_ExtendedSetupInformation ExtendedSetupInformation; | 1347 | struct blogic_ext_setup ext_setupinfo; |
1254 | unsigned char HostAdapterModelNumber[5]; | 1348 | unsigned char model[5]; |
1255 | unsigned char FirmwareVersion3rdDigit; | 1349 | unsigned char fw_ver_digit3; |
1256 | unsigned char FirmwareVersionLetter; | 1350 | unsigned char fw_ver_letter; |
1257 | struct BusLogic_PCIHostAdapterInformation PCIHostAdapterInformation; | 1351 | struct blogic_adapter_info adapter_info; |
1258 | struct BusLogic_FetchHostAdapterLocalRAMRequest FetchHostAdapterLocalRAMRequest; | 1352 | struct blogic_fetch_localram fetch_localram; |
1259 | struct BusLogic_AutoSCSIData AutoSCSIData; | 1353 | struct blogic_autoscsi autoscsi; |
1260 | union BusLogic_GeometryRegister GeometryRegister; | 1354 | union blogic_geo_reg georeg; |
1261 | unsigned char RequestedReplyLength; | 1355 | unsigned char req_replylen; |
1262 | unsigned char *TargetPointer, Character; | 1356 | unsigned char *tgt, ch; |
1263 | int TargetID, i; | 1357 | int tgt_id, i; |
1264 | /* | 1358 | /* |
1265 | Configuration Information for FlashPoint Host Adapters is provided in the | 1359 | Configuration Information for FlashPoint Host Adapters is |
1266 | FlashPoint_Info structure by the FlashPoint SCCB Manager's Probe Function. | 1360 | provided in the fpoint_info structure by the FlashPoint |
1267 | Initialize fields in the Host Adapter structure from the FlashPoint_Info | 1361 | SCCB Manager's Probe Function. Initialize fields in the |
1268 | structure. | 1362 | Host Adapter structure from the fpoint_info structure. |
1269 | */ | 1363 | */ |
1270 | if (BusLogic_FlashPointHostAdapterP(HostAdapter)) { | 1364 | if (blogic_flashpoint_type(adapter)) { |
1271 | struct FlashPoint_Info *FlashPointInfo = &HostAdapter->FlashPointInfo; | 1365 | struct fpoint_info *fpinfo = &adapter->fpinfo; |
1272 | TargetPointer = HostAdapter->ModelName; | 1366 | tgt = adapter->model; |
1273 | *TargetPointer++ = 'B'; | 1367 | *tgt++ = 'B'; |
1274 | *TargetPointer++ = 'T'; | 1368 | *tgt++ = 'T'; |
1275 | *TargetPointer++ = '-'; | 1369 | *tgt++ = '-'; |
1276 | for (i = 0; i < sizeof(FlashPointInfo->ModelNumber); i++) | 1370 | for (i = 0; i < sizeof(fpinfo->model); i++) |
1277 | *TargetPointer++ = FlashPointInfo->ModelNumber[i]; | 1371 | *tgt++ = fpinfo->model[i]; |
1278 | *TargetPointer++ = '\0'; | 1372 | *tgt++ = '\0'; |
1279 | strcpy(HostAdapter->FirmwareVersion, FlashPoint_FirmwareVersion); | 1373 | strcpy(adapter->fw_ver, FLASHPOINT_FW_VER); |
1280 | HostAdapter->SCSI_ID = FlashPointInfo->SCSI_ID; | 1374 | adapter->scsi_id = fpinfo->scsi_id; |
1281 | HostAdapter->ExtendedTranslationEnabled = FlashPointInfo->ExtendedTranslationEnabled; | 1375 | adapter->ext_trans_enable = fpinfo->ext_trans_enable; |
1282 | HostAdapter->ParityCheckingEnabled = FlashPointInfo->ParityCheckingEnabled; | 1376 | adapter->parity = fpinfo->parity; |
1283 | HostAdapter->BusResetEnabled = !FlashPointInfo->HostSoftReset; | 1377 | adapter->reset_enabled = !fpinfo->softreset; |
1284 | HostAdapter->LevelSensitiveInterrupt = true; | 1378 | adapter->level_int = true; |
1285 | HostAdapter->HostWideSCSI = FlashPointInfo->HostWideSCSI; | 1379 | adapter->wide = fpinfo->wide; |
1286 | HostAdapter->HostDifferentialSCSI = false; | 1380 | adapter->differential = false; |
1287 | HostAdapter->HostSupportsSCAM = true; | 1381 | adapter->scam = true; |
1288 | HostAdapter->HostUltraSCSI = true; | 1382 | adapter->ultra = true; |
1289 | HostAdapter->ExtendedLUNSupport = true; | 1383 | adapter->ext_lun = true; |
1290 | HostAdapter->TerminationInfoValid = true; | 1384 | adapter->terminfo_valid = true; |
1291 | HostAdapter->LowByteTerminated = FlashPointInfo->LowByteTerminated; | 1385 | adapter->low_term = fpinfo->low_term; |
1292 | HostAdapter->HighByteTerminated = FlashPointInfo->HighByteTerminated; | 1386 | adapter->high_term = fpinfo->high_term; |
1293 | HostAdapter->SCAM_Enabled = FlashPointInfo->SCAM_Enabled; | 1387 | adapter->scam_enabled = fpinfo->scam_enabled; |
1294 | HostAdapter->SCAM_Level2 = FlashPointInfo->SCAM_Level2; | 1388 | adapter->scam_lev2 = fpinfo->scam_lev2; |
1295 | HostAdapter->DriverScatterGatherLimit = BusLogic_ScatterGatherLimit; | 1389 | adapter->drvr_sglimit = BLOGIC_SG_LIMIT; |
1296 | HostAdapter->MaxTargetDevices = (HostAdapter->HostWideSCSI ? 16 : 8); | 1390 | adapter->maxdev = (adapter->wide ? 16 : 8); |
1297 | HostAdapter->MaxLogicalUnits = 32; | 1391 | adapter->maxlun = 32; |
1298 | HostAdapter->InitialCCBs = 4 * BusLogic_CCB_AllocationGroupSize; | 1392 | adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE; |
1299 | HostAdapter->IncrementalCCBs = BusLogic_CCB_AllocationGroupSize; | 1393 | adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE; |
1300 | HostAdapter->DriverQueueDepth = 255; | 1394 | adapter->drvr_qdepth = 255; |
1301 | HostAdapter->HostAdapterQueueDepth = HostAdapter->DriverQueueDepth; | 1395 | adapter->adapter_qdepth = adapter->drvr_qdepth; |
1302 | HostAdapter->SynchronousPermitted = FlashPointInfo->SynchronousPermitted; | 1396 | adapter->sync_ok = fpinfo->sync_ok; |
1303 | HostAdapter->FastPermitted = FlashPointInfo->FastPermitted; | 1397 | adapter->fast_ok = fpinfo->fast_ok; |
1304 | HostAdapter->UltraPermitted = FlashPointInfo->UltraPermitted; | 1398 | adapter->ultra_ok = fpinfo->ultra_ok; |
1305 | HostAdapter->WidePermitted = FlashPointInfo->WidePermitted; | 1399 | adapter->wide_ok = fpinfo->wide_ok; |
1306 | HostAdapter->DisconnectPermitted = FlashPointInfo->DisconnectPermitted; | 1400 | adapter->discon_ok = fpinfo->discon_ok; |
1307 | HostAdapter->TaggedQueuingPermitted = 0xFFFF; | 1401 | adapter->tagq_ok = 0xFFFF; |
1308 | goto Common; | 1402 | goto common; |
1309 | } | 1403 | } |
1310 | /* | 1404 | /* |
1311 | Issue the Inquire Board ID command. | 1405 | Issue the Inquire Board ID command. |
1312 | */ | 1406 | */ |
1313 | if (BusLogic_Command(HostAdapter, BusLogic_InquireBoardID, NULL, 0, &BoardID, sizeof(BoardID)) != sizeof(BoardID)) | 1407 | if (blogic_cmd(adapter, BLOGIC_GET_BOARD_ID, NULL, 0, &id, |
1314 | return BusLogic_Failure(HostAdapter, "INQUIRE BOARD ID"); | 1408 | sizeof(id)) != sizeof(id)) |
1409 | return blogic_failure(adapter, "INQUIRE BOARD ID"); | ||
1315 | /* | 1410 | /* |
1316 | Issue the Inquire Configuration command. | 1411 | Issue the Inquire Configuration command. |
1317 | */ | 1412 | */ |
1318 | if (BusLogic_Command(HostAdapter, BusLogic_InquireConfiguration, NULL, 0, &Configuration, sizeof(Configuration)) | 1413 | if (blogic_cmd(adapter, BLOGIC_INQ_CONFIG, NULL, 0, &config, |
1319 | != sizeof(Configuration)) | 1414 | sizeof(config)) |
1320 | return BusLogic_Failure(HostAdapter, "INQUIRE CONFIGURATION"); | 1415 | != sizeof(config)) |
1416 | return blogic_failure(adapter, "INQUIRE CONFIGURATION"); | ||
1321 | /* | 1417 | /* |
1322 | Issue the Inquire Setup Information command. | 1418 | Issue the Inquire Setup Information command. |
1323 | */ | 1419 | */ |
1324 | RequestedReplyLength = sizeof(SetupInformation); | 1420 | req_replylen = sizeof(setupinfo); |
1325 | if (BusLogic_Command(HostAdapter, BusLogic_InquireSetupInformation, &RequestedReplyLength, sizeof(RequestedReplyLength), &SetupInformation, sizeof(SetupInformation)) | 1421 | if (blogic_cmd(adapter, BLOGIC_INQ_SETUPINFO, &req_replylen, |
1326 | != sizeof(SetupInformation)) | 1422 | sizeof(req_replylen), &setupinfo, |
1327 | return BusLogic_Failure(HostAdapter, "INQUIRE SETUP INFORMATION"); | 1423 | sizeof(setupinfo)) != sizeof(setupinfo)) |
1424 | return blogic_failure(adapter, "INQUIRE SETUP INFORMATION"); | ||
1328 | /* | 1425 | /* |
1329 | Issue the Inquire Extended Setup Information command. | 1426 | Issue the Inquire Extended Setup Information command. |
1330 | */ | 1427 | */ |
1331 | RequestedReplyLength = sizeof(ExtendedSetupInformation); | 1428 | req_replylen = sizeof(ext_setupinfo); |
1332 | if (BusLogic_Command(HostAdapter, BusLogic_InquireExtendedSetupInformation, &RequestedReplyLength, sizeof(RequestedReplyLength), &ExtendedSetupInformation, sizeof(ExtendedSetupInformation)) | 1429 | if (blogic_cmd(adapter, BLOGIC_INQ_EXTSETUP, &req_replylen, |
1333 | != sizeof(ExtendedSetupInformation)) | 1430 | sizeof(req_replylen), &ext_setupinfo, |
1334 | return BusLogic_Failure(HostAdapter, "INQUIRE EXTENDED SETUP INFORMATION"); | 1431 | sizeof(ext_setupinfo)) != sizeof(ext_setupinfo)) |
1432 | return blogic_failure(adapter, | ||
1433 | "INQUIRE EXTENDED SETUP INFORMATION"); | ||
1335 | /* | 1434 | /* |
1336 | Issue the Inquire Firmware Version 3rd Digit command. | 1435 | Issue the Inquire Firmware Version 3rd Digit command. |
1337 | */ | 1436 | */ |
1338 | FirmwareVersion3rdDigit = '\0'; | 1437 | fw_ver_digit3 = '\0'; |
1339 | if (BoardID.FirmwareVersion1stDigit > '0') | 1438 | if (id.fw_ver_digit1 > '0') |
1340 | if (BusLogic_Command(HostAdapter, BusLogic_InquireFirmwareVersion3rdDigit, NULL, 0, &FirmwareVersion3rdDigit, sizeof(FirmwareVersion3rdDigit)) | 1439 | if (blogic_cmd(adapter, BLOGIC_INQ_FWVER_D3, NULL, 0, |
1341 | != sizeof(FirmwareVersion3rdDigit)) | 1440 | &fw_ver_digit3, |
1342 | return BusLogic_Failure(HostAdapter, "INQUIRE FIRMWARE 3RD DIGIT"); | 1441 | sizeof(fw_ver_digit3)) != sizeof(fw_ver_digit3)) |
1442 | return blogic_failure(adapter, | ||
1443 | "INQUIRE FIRMWARE 3RD DIGIT"); | ||
1343 | /* | 1444 | /* |
1344 | Issue the Inquire Host Adapter Model Number command. | 1445 | Issue the Inquire Host Adapter Model Number command. |
1345 | */ | 1446 | */ |
1346 | if (ExtendedSetupInformation.BusType == 'A' && BoardID.FirmwareVersion1stDigit == '2') | 1447 | if (ext_setupinfo.bus_type == 'A' && id.fw_ver_digit1 == '2') |
1347 | /* BusLogic BT-542B ISA 2.xx */ | 1448 | /* BusLogic BT-542B ISA 2.xx */ |
1348 | strcpy(HostAdapterModelNumber, "542B"); | 1449 | strcpy(model, "542B"); |
1349 | else if (ExtendedSetupInformation.BusType == 'E' && BoardID.FirmwareVersion1stDigit == '2' && (BoardID.FirmwareVersion2ndDigit <= '1' || (BoardID.FirmwareVersion2ndDigit == '2' && FirmwareVersion3rdDigit == '0'))) | 1450 | else if (ext_setupinfo.bus_type == 'E' && id.fw_ver_digit1 == '2' && |
1451 | (id.fw_ver_digit2 <= '1' || (id.fw_ver_digit2 == '2' && | ||
1452 | fw_ver_digit3 == '0'))) | ||
1350 | /* BusLogic BT-742A EISA 2.1x or 2.20 */ | 1453 | /* BusLogic BT-742A EISA 2.1x or 2.20 */ |
1351 | strcpy(HostAdapterModelNumber, "742A"); | 1454 | strcpy(model, "742A"); |
1352 | else if (ExtendedSetupInformation.BusType == 'E' && BoardID.FirmwareVersion1stDigit == '0') | 1455 | else if (ext_setupinfo.bus_type == 'E' && id.fw_ver_digit1 == '0') |
1353 | /* AMI FastDisk EISA Series 441 0.x */ | 1456 | /* AMI FastDisk EISA Series 441 0.x */ |
1354 | strcpy(HostAdapterModelNumber, "747A"); | 1457 | strcpy(model, "747A"); |
1355 | else { | 1458 | else { |
1356 | RequestedReplyLength = sizeof(HostAdapterModelNumber); | 1459 | req_replylen = sizeof(model); |
1357 | if (BusLogic_Command(HostAdapter, BusLogic_InquireHostAdapterModelNumber, &RequestedReplyLength, sizeof(RequestedReplyLength), &HostAdapterModelNumber, sizeof(HostAdapterModelNumber)) | 1460 | if (blogic_cmd(adapter, BLOGIC_INQ_MODELNO, &req_replylen, |
1358 | != sizeof(HostAdapterModelNumber)) | 1461 | sizeof(req_replylen), &model, |
1359 | return BusLogic_Failure(HostAdapter, "INQUIRE HOST ADAPTER MODEL NUMBER"); | 1462 | sizeof(model)) != sizeof(model)) |
1463 | return blogic_failure(adapter, | ||
1464 | "INQUIRE HOST ADAPTER MODEL NUMBER"); | ||
1360 | } | 1465 | } |
1361 | /* | 1466 | /* |
1362 | BusLogic MultiMaster Host Adapters can be identified by their model number | 1467 | BusLogic MultiMaster Host Adapters can be identified by their |
1363 | and the major version number of their firmware as follows: | 1468 | model number and the major version number of their firmware |
1469 | as follows: | ||
1364 | 1470 | ||
1365 | 5.xx BusLogic "W" Series Host Adapters: | 1471 | 5.xx BusLogic "W" Series Host Adapters: |
1366 | BT-948/958/958D | 1472 | BT-948/958/958D |
@@ -1374,497 +1480,535 @@ static bool __init BusLogic_ReadHostAdapterConfiguration(struct BusLogic_HostAda | |||
1374 | 0.xx AMI FastDisk VLB/EISA BusLogic Clone Host Adapter | 1480 | 0.xx AMI FastDisk VLB/EISA BusLogic Clone Host Adapter |
1375 | */ | 1481 | */ |
1376 | /* | 1482 | /* |
1377 | Save the Model Name and Host Adapter Name in the Host Adapter structure. | 1483 | Save the Model Name and Host Adapter Name in the Host Adapter |
1484 | structure. | ||
1378 | */ | 1485 | */ |
1379 | TargetPointer = HostAdapter->ModelName; | 1486 | tgt = adapter->model; |
1380 | *TargetPointer++ = 'B'; | 1487 | *tgt++ = 'B'; |
1381 | *TargetPointer++ = 'T'; | 1488 | *tgt++ = 'T'; |
1382 | *TargetPointer++ = '-'; | 1489 | *tgt++ = '-'; |
1383 | for (i = 0; i < sizeof(HostAdapterModelNumber); i++) { | 1490 | for (i = 0; i < sizeof(model); i++) { |
1384 | Character = HostAdapterModelNumber[i]; | 1491 | ch = model[i]; |
1385 | if (Character == ' ' || Character == '\0') | 1492 | if (ch == ' ' || ch == '\0') |
1386 | break; | 1493 | break; |
1387 | *TargetPointer++ = Character; | 1494 | *tgt++ = ch; |
1388 | } | 1495 | } |
1389 | *TargetPointer++ = '\0'; | 1496 | *tgt++ = '\0'; |
1390 | /* | 1497 | /* |
1391 | Save the Firmware Version in the Host Adapter structure. | 1498 | Save the Firmware Version in the Host Adapter structure. |
1392 | */ | 1499 | */ |
1393 | TargetPointer = HostAdapter->FirmwareVersion; | 1500 | tgt = adapter->fw_ver; |
1394 | *TargetPointer++ = BoardID.FirmwareVersion1stDigit; | 1501 | *tgt++ = id.fw_ver_digit1; |
1395 | *TargetPointer++ = '.'; | 1502 | *tgt++ = '.'; |
1396 | *TargetPointer++ = BoardID.FirmwareVersion2ndDigit; | 1503 | *tgt++ = id.fw_ver_digit2; |
1397 | if (FirmwareVersion3rdDigit != ' ' && FirmwareVersion3rdDigit != '\0') | 1504 | if (fw_ver_digit3 != ' ' && fw_ver_digit3 != '\0') |
1398 | *TargetPointer++ = FirmwareVersion3rdDigit; | 1505 | *tgt++ = fw_ver_digit3; |
1399 | *TargetPointer = '\0'; | 1506 | *tgt = '\0'; |
1400 | /* | 1507 | /* |
1401 | Issue the Inquire Firmware Version Letter command. | 1508 | Issue the Inquire Firmware Version Letter command. |
1402 | */ | 1509 | */ |
1403 | if (strcmp(HostAdapter->FirmwareVersion, "3.3") >= 0) { | 1510 | if (strcmp(adapter->fw_ver, "3.3") >= 0) { |
1404 | if (BusLogic_Command(HostAdapter, BusLogic_InquireFirmwareVersionLetter, NULL, 0, &FirmwareVersionLetter, sizeof(FirmwareVersionLetter)) | 1511 | if (blogic_cmd(adapter, BLOGIC_INQ_FWVER_LETTER, NULL, 0, |
1405 | != sizeof(FirmwareVersionLetter)) | 1512 | &fw_ver_letter, |
1406 | return BusLogic_Failure(HostAdapter, "INQUIRE FIRMWARE VERSION LETTER"); | 1513 | sizeof(fw_ver_letter)) != sizeof(fw_ver_letter)) |
1407 | if (FirmwareVersionLetter != ' ' && FirmwareVersionLetter != '\0') | 1514 | return blogic_failure(adapter, |
1408 | *TargetPointer++ = FirmwareVersionLetter; | 1515 | "INQUIRE FIRMWARE VERSION LETTER"); |
1409 | *TargetPointer = '\0'; | 1516 | if (fw_ver_letter != ' ' && fw_ver_letter != '\0') |
1517 | *tgt++ = fw_ver_letter; | ||
1518 | *tgt = '\0'; | ||
1410 | } | 1519 | } |
1411 | /* | 1520 | /* |
1412 | Save the Host Adapter SCSI ID in the Host Adapter structure. | 1521 | Save the Host Adapter SCSI ID in the Host Adapter structure. |
1413 | */ | 1522 | */ |
1414 | HostAdapter->SCSI_ID = Configuration.HostAdapterID; | 1523 | adapter->scsi_id = config.id; |
1415 | /* | 1524 | /* |
1416 | Determine the Bus Type and save it in the Host Adapter structure, determine | 1525 | Determine the Bus Type and save it in the Host Adapter structure, |
1417 | and save the IRQ Channel if necessary, and determine and save the DMA | 1526 | determine and save the IRQ Channel if necessary, and determine |
1418 | Channel for ISA Host Adapters. | 1527 | and save the DMA Channel for ISA Host Adapters. |
1419 | */ | 1528 | */ |
1420 | HostAdapter->HostAdapterBusType = BusLogic_HostAdapterBusTypes[HostAdapter->ModelName[3] - '4']; | 1529 | adapter->adapter_bus_type = |
1421 | if (HostAdapter->IRQ_Channel == 0) { | 1530 | blogic_adater_bus_types[adapter->model[3] - '4']; |
1422 | if (Configuration.IRQ_Channel9) | 1531 | if (adapter->irq_ch == 0) { |
1423 | HostAdapter->IRQ_Channel = 9; | 1532 | if (config.irq_ch9) |
1424 | else if (Configuration.IRQ_Channel10) | 1533 | adapter->irq_ch = 9; |
1425 | HostAdapter->IRQ_Channel = 10; | 1534 | else if (config.irq_ch10) |
1426 | else if (Configuration.IRQ_Channel11) | 1535 | adapter->irq_ch = 10; |
1427 | HostAdapter->IRQ_Channel = 11; | 1536 | else if (config.irq_ch11) |
1428 | else if (Configuration.IRQ_Channel12) | 1537 | adapter->irq_ch = 11; |
1429 | HostAdapter->IRQ_Channel = 12; | 1538 | else if (config.irq_ch12) |
1430 | else if (Configuration.IRQ_Channel14) | 1539 | adapter->irq_ch = 12; |
1431 | HostAdapter->IRQ_Channel = 14; | 1540 | else if (config.irq_ch14) |
1432 | else if (Configuration.IRQ_Channel15) | 1541 | adapter->irq_ch = 14; |
1433 | HostAdapter->IRQ_Channel = 15; | 1542 | else if (config.irq_ch15) |
1434 | } | 1543 | adapter->irq_ch = 15; |
1435 | if (HostAdapter->HostAdapterBusType == BusLogic_ISA_Bus) { | 1544 | } |
1436 | if (Configuration.DMA_Channel5) | 1545 | if (adapter->adapter_bus_type == BLOGIC_ISA_BUS) { |
1437 | HostAdapter->DMA_Channel = 5; | 1546 | if (config.dma_ch5) |
1438 | else if (Configuration.DMA_Channel6) | 1547 | adapter->dma_ch = 5; |
1439 | HostAdapter->DMA_Channel = 6; | 1548 | else if (config.dma_ch6) |
1440 | else if (Configuration.DMA_Channel7) | 1549 | adapter->dma_ch = 6; |
1441 | HostAdapter->DMA_Channel = 7; | 1550 | else if (config.dma_ch7) |
1551 | adapter->dma_ch = 7; | ||
1442 | } | 1552 | } |
1443 | /* | 1553 | /* |
1444 | Determine whether Extended Translation is enabled and save it in | 1554 | Determine whether Extended Translation is enabled and save it in |
1445 | the Host Adapter structure. | 1555 | the Host Adapter structure. |
1446 | */ | 1556 | */ |
1447 | GeometryRegister.All = BusLogic_ReadGeometryRegister(HostAdapter); | 1557 | georeg.all = blogic_rdgeom(adapter); |
1448 | HostAdapter->ExtendedTranslationEnabled = GeometryRegister.gr.ExtendedTranslationEnabled; | 1558 | adapter->ext_trans_enable = georeg.gr.ext_trans_enable; |
1449 | /* | 1559 | /* |
1450 | Save the Scatter Gather Limits, Level Sensitive Interrupt flag, Wide | 1560 | Save the Scatter Gather Limits, Level Sensitive Interrupt flag, Wide |
1451 | SCSI flag, Differential SCSI flag, SCAM Supported flag, and | 1561 | SCSI flag, Differential SCSI flag, SCAM Supported flag, and |
1452 | Ultra SCSI flag in the Host Adapter structure. | 1562 | Ultra SCSI flag in the Host Adapter structure. |
1453 | */ | 1563 | */ |
1454 | HostAdapter->HostAdapterScatterGatherLimit = ExtendedSetupInformation.ScatterGatherLimit; | 1564 | adapter->adapter_sglimit = ext_setupinfo.sg_limit; |
1455 | HostAdapter->DriverScatterGatherLimit = HostAdapter->HostAdapterScatterGatherLimit; | 1565 | adapter->drvr_sglimit = adapter->adapter_sglimit; |
1456 | if (HostAdapter->HostAdapterScatterGatherLimit > BusLogic_ScatterGatherLimit) | 1566 | if (adapter->adapter_sglimit > BLOGIC_SG_LIMIT) |
1457 | HostAdapter->DriverScatterGatherLimit = BusLogic_ScatterGatherLimit; | 1567 | adapter->drvr_sglimit = BLOGIC_SG_LIMIT; |
1458 | if (ExtendedSetupInformation.Misc.LevelSensitiveInterrupt) | 1568 | if (ext_setupinfo.misc.level_int) |
1459 | HostAdapter->LevelSensitiveInterrupt = true; | 1569 | adapter->level_int = true; |
1460 | HostAdapter->HostWideSCSI = ExtendedSetupInformation.HostWideSCSI; | 1570 | adapter->wide = ext_setupinfo.wide; |
1461 | HostAdapter->HostDifferentialSCSI = ExtendedSetupInformation.HostDifferentialSCSI; | 1571 | adapter->differential = ext_setupinfo.differential; |
1462 | HostAdapter->HostSupportsSCAM = ExtendedSetupInformation.HostSupportsSCAM; | 1572 | adapter->scam = ext_setupinfo.scam; |
1463 | HostAdapter->HostUltraSCSI = ExtendedSetupInformation.HostUltraSCSI; | 1573 | adapter->ultra = ext_setupinfo.ultra; |
1464 | /* | 1574 | /* |
1465 | Determine whether Extended LUN Format CCBs are supported and save the | 1575 | Determine whether Extended LUN Format CCBs are supported and save the |
1466 | information in the Host Adapter structure. | 1576 | information in the Host Adapter structure. |
1467 | */ | 1577 | */ |
1468 | if (HostAdapter->FirmwareVersion[0] == '5' || (HostAdapter->FirmwareVersion[0] == '4' && HostAdapter->HostWideSCSI)) | 1578 | if (adapter->fw_ver[0] == '5' || (adapter->fw_ver[0] == '4' && |
1469 | HostAdapter->ExtendedLUNSupport = true; | 1579 | adapter->wide)) |
1580 | adapter->ext_lun = true; | ||
1470 | /* | 1581 | /* |
1471 | Issue the Inquire PCI Host Adapter Information command to read the | 1582 | Issue the Inquire PCI Host Adapter Information command to read the |
1472 | Termination Information from "W" series MultiMaster Host Adapters. | 1583 | Termination Information from "W" series MultiMaster Host Adapters. |
1473 | */ | 1584 | */ |
1474 | if (HostAdapter->FirmwareVersion[0] == '5') { | 1585 | if (adapter->fw_ver[0] == '5') { |
1475 | if (BusLogic_Command(HostAdapter, BusLogic_InquirePCIHostAdapterInformation, NULL, 0, &PCIHostAdapterInformation, sizeof(PCIHostAdapterInformation)) | 1586 | if (blogic_cmd(adapter, BLOGIC_INQ_PCI_INFO, NULL, 0, |
1476 | != sizeof(PCIHostAdapterInformation)) | 1587 | &adapter_info, |
1477 | return BusLogic_Failure(HostAdapter, "INQUIRE PCI HOST ADAPTER INFORMATION"); | 1588 | sizeof(adapter_info)) != sizeof(adapter_info)) |
1589 | return blogic_failure(adapter, | ||
1590 | "INQUIRE PCI HOST ADAPTER INFORMATION"); | ||
1478 | /* | 1591 | /* |
1479 | Save the Termination Information in the Host Adapter structure. | 1592 | Save the Termination Information in the Host Adapter |
1593 | structure. | ||
1480 | */ | 1594 | */ |
1481 | if (PCIHostAdapterInformation.GenericInfoValid) { | 1595 | if (adapter_info.genericinfo_valid) { |
1482 | HostAdapter->TerminationInfoValid = true; | 1596 | adapter->terminfo_valid = true; |
1483 | HostAdapter->LowByteTerminated = PCIHostAdapterInformation.LowByteTerminated; | 1597 | adapter->low_term = adapter_info.low_term; |
1484 | HostAdapter->HighByteTerminated = PCIHostAdapterInformation.HighByteTerminated; | 1598 | adapter->high_term = adapter_info.high_term; |
1485 | } | 1599 | } |
1486 | } | 1600 | } |
1487 | /* | 1601 | /* |
1488 | Issue the Fetch Host Adapter Local RAM command to read the AutoSCSI data | 1602 | Issue the Fetch Host Adapter Local RAM command to read the |
1489 | from "W" and "C" series MultiMaster Host Adapters. | 1603 | AutoSCSI data from "W" and "C" series MultiMaster Host Adapters. |
1490 | */ | 1604 | */ |
1491 | if (HostAdapter->FirmwareVersion[0] >= '4') { | 1605 | if (adapter->fw_ver[0] >= '4') { |
1492 | FetchHostAdapterLocalRAMRequest.ByteOffset = BusLogic_AutoSCSI_BaseOffset; | 1606 | fetch_localram.offset = BLOGIC_AUTOSCSI_BASE; |
1493 | FetchHostAdapterLocalRAMRequest.ByteCount = sizeof(AutoSCSIData); | 1607 | fetch_localram.count = sizeof(autoscsi); |
1494 | if (BusLogic_Command(HostAdapter, BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest, sizeof(FetchHostAdapterLocalRAMRequest), &AutoSCSIData, sizeof(AutoSCSIData)) | 1608 | if (blogic_cmd(adapter, BLOGIC_FETCH_LOCALRAM, &fetch_localram, |
1495 | != sizeof(AutoSCSIData)) | 1609 | sizeof(fetch_localram), &autoscsi, |
1496 | return BusLogic_Failure(HostAdapter, "FETCH HOST ADAPTER LOCAL RAM"); | 1610 | sizeof(autoscsi)) != sizeof(autoscsi)) |
1611 | return blogic_failure(adapter, | ||
1612 | "FETCH HOST ADAPTER LOCAL RAM"); | ||
1497 | /* | 1613 | /* |
1498 | Save the Parity Checking Enabled, Bus Reset Enabled, and Termination | 1614 | Save the Parity Checking Enabled, Bus Reset Enabled, |
1499 | Information in the Host Adapter structure. | 1615 | and Termination Information in the Host Adapter structure. |
1500 | */ | 1616 | */ |
1501 | HostAdapter->ParityCheckingEnabled = AutoSCSIData.ParityCheckingEnabled; | 1617 | adapter->parity = autoscsi.parity; |
1502 | HostAdapter->BusResetEnabled = AutoSCSIData.BusResetEnabled; | 1618 | adapter->reset_enabled = autoscsi.reset_enabled; |
1503 | if (HostAdapter->FirmwareVersion[0] == '4') { | 1619 | if (adapter->fw_ver[0] == '4') { |
1504 | HostAdapter->TerminationInfoValid = true; | 1620 | adapter->terminfo_valid = true; |
1505 | HostAdapter->LowByteTerminated = AutoSCSIData.LowByteTerminated; | 1621 | adapter->low_term = autoscsi.low_term; |
1506 | HostAdapter->HighByteTerminated = AutoSCSIData.HighByteTerminated; | 1622 | adapter->high_term = autoscsi.high_term; |
1507 | } | 1623 | } |
1508 | /* | 1624 | /* |
1509 | Save the Wide Permitted, Fast Permitted, Synchronous Permitted, | 1625 | Save the Wide Permitted, Fast Permitted, Synchronous |
1510 | Disconnect Permitted, Ultra Permitted, and SCAM Information in the | 1626 | Permitted, Disconnect Permitted, Ultra Permitted, and |
1511 | Host Adapter structure. | 1627 | SCAM Information in the Host Adapter structure. |
1512 | */ | 1628 | */ |
1513 | HostAdapter->WidePermitted = AutoSCSIData.WidePermitted; | 1629 | adapter->wide_ok = autoscsi.wide_ok; |
1514 | HostAdapter->FastPermitted = AutoSCSIData.FastPermitted; | 1630 | adapter->fast_ok = autoscsi.fast_ok; |
1515 | HostAdapter->SynchronousPermitted = AutoSCSIData.SynchronousPermitted; | 1631 | adapter->sync_ok = autoscsi.sync_ok; |
1516 | HostAdapter->DisconnectPermitted = AutoSCSIData.DisconnectPermitted; | 1632 | adapter->discon_ok = autoscsi.discon_ok; |
1517 | if (HostAdapter->HostUltraSCSI) | 1633 | if (adapter->ultra) |
1518 | HostAdapter->UltraPermitted = AutoSCSIData.UltraPermitted; | 1634 | adapter->ultra_ok = autoscsi.ultra_ok; |
1519 | if (HostAdapter->HostSupportsSCAM) { | 1635 | if (adapter->scam) { |
1520 | HostAdapter->SCAM_Enabled = AutoSCSIData.SCAM_Enabled; | 1636 | adapter->scam_enabled = autoscsi.scam_enabled; |
1521 | HostAdapter->SCAM_Level2 = AutoSCSIData.SCAM_Level2; | 1637 | adapter->scam_lev2 = autoscsi.scam_lev2; |
1522 | } | 1638 | } |
1523 | } | 1639 | } |
1524 | /* | 1640 | /* |
1525 | Initialize fields in the Host Adapter structure for "S" and "A" series | 1641 | Initialize fields in the Host Adapter structure for "S" and "A" |
1526 | MultiMaster Host Adapters. | 1642 | series MultiMaster Host Adapters. |
1527 | */ | 1643 | */ |
1528 | if (HostAdapter->FirmwareVersion[0] < '4') { | 1644 | if (adapter->fw_ver[0] < '4') { |
1529 | if (SetupInformation.SynchronousInitiationEnabled) { | 1645 | if (setupinfo.sync) { |
1530 | HostAdapter->SynchronousPermitted = 0xFF; | 1646 | adapter->sync_ok = 0xFF; |
1531 | if (HostAdapter->HostAdapterBusType == BusLogic_EISA_Bus) { | 1647 | if (adapter->adapter_bus_type == BLOGIC_EISA_BUS) { |
1532 | if (ExtendedSetupInformation.Misc.FastOnEISA) | 1648 | if (ext_setupinfo.misc.fast_on_eisa) |
1533 | HostAdapter->FastPermitted = 0xFF; | 1649 | adapter->fast_ok = 0xFF; |
1534 | if (strcmp(HostAdapter->ModelName, "BT-757") == 0) | 1650 | if (strcmp(adapter->model, "BT-757") == 0) |
1535 | HostAdapter->WidePermitted = 0xFF; | 1651 | adapter->wide_ok = 0xFF; |
1536 | } | 1652 | } |
1537 | } | 1653 | } |
1538 | HostAdapter->DisconnectPermitted = 0xFF; | 1654 | adapter->discon_ok = 0xFF; |
1539 | HostAdapter->ParityCheckingEnabled = SetupInformation.ParityCheckingEnabled; | 1655 | adapter->parity = setupinfo.parity; |
1540 | HostAdapter->BusResetEnabled = true; | 1656 | adapter->reset_enabled = true; |
1541 | } | 1657 | } |
1542 | /* | 1658 | /* |
1543 | Determine the maximum number of Target IDs and Logical Units supported by | 1659 | Determine the maximum number of Target IDs and Logical Units |
1544 | this driver for Wide and Narrow Host Adapters. | 1660 | supported by this driver for Wide and Narrow Host Adapters. |
1545 | */ | 1661 | */ |
1546 | HostAdapter->MaxTargetDevices = (HostAdapter->HostWideSCSI ? 16 : 8); | 1662 | adapter->maxdev = (adapter->wide ? 16 : 8); |
1547 | HostAdapter->MaxLogicalUnits = (HostAdapter->ExtendedLUNSupport ? 32 : 8); | 1663 | adapter->maxlun = (adapter->ext_lun ? 32 : 8); |
1548 | /* | 1664 | /* |
1549 | Select appropriate values for the Mailbox Count, Driver Queue Depth, | 1665 | Select appropriate values for the Mailbox Count, Driver Queue Depth, |
1550 | Initial CCBs, and Incremental CCBs variables based on whether or not Strict | 1666 | Initial CCBs, and Incremental CCBs variables based on whether |
1551 | Round Robin Mode is supported. If Strict Round Robin Mode is supported, | 1667 | or not Strict Round Robin Mode is supported. If Strict Round |
1552 | then there is no performance degradation in using the maximum possible | 1668 | Robin Mode is supported, then there is no performance degradation |
1553 | number of Outgoing and Incoming Mailboxes and allowing the Tagged and | 1669 | in using the maximum possible number of Outgoing and Incoming |
1554 | Untagged Queue Depths to determine the actual utilization. If Strict Round | 1670 | Mailboxes and allowing the Tagged and Untagged Queue Depths to |
1555 | Robin Mode is not supported, then the Host Adapter must scan all the | 1671 | determine the actual utilization. If Strict Round Robin Mode is |
1556 | Outgoing Mailboxes whenever an Outgoing Mailbox entry is made, which can | 1672 | not supported, then the Host Adapter must scan all the Outgoing |
1557 | cause a substantial performance penalty. The host adapters actually have | 1673 | Mailboxes whenever an Outgoing Mailbox entry is made, which can |
1558 | room to store the following number of CCBs internally; that is, they can | 1674 | cause a substantial performance penalty. The host adapters |
1559 | internally queue and manage this many active commands on the SCSI bus | 1675 | actually have room to store the following number of CCBs |
1560 | simultaneously. Performance measurements demonstrate that the Driver Queue | 1676 | internally; that is, they can internally queue and manage this |
1561 | Depth should be set to the Mailbox Count, rather than the Host Adapter | 1677 | many active commands on the SCSI bus simultaneously. Performance |
1562 | Queue Depth (internal CCB capacity), as it is more efficient to have the | 1678 | measurements demonstrate that the Driver Queue Depth should be |
1563 | queued commands waiting in Outgoing Mailboxes if necessary than to block | 1679 | set to the Mailbox Count, rather than the Host Adapter Queue |
1564 | the process in the higher levels of the SCSI Subsystem. | 1680 | Depth (internal CCB capacity), as it is more efficient to have the |
1681 | queued commands waiting in Outgoing Mailboxes if necessary than | ||
1682 | to block the process in the higher levels of the SCSI Subsystem. | ||
1565 | 1683 | ||
1566 | 192 BT-948/958/958D | 1684 | 192 BT-948/958/958D |
1567 | 100 BT-946C/956C/956CD/747C/757C/757CD/445C | 1685 | 100 BT-946C/956C/956CD/747C/757C/757CD/445C |
1568 | 50 BT-545C/540CF | 1686 | 50 BT-545C/540CF |
1569 | 30 BT-747S/747D/757S/757D/445S/545S/542D/542B/742A | 1687 | 30 BT-747S/747D/757S/757D/445S/545S/542D/542B/742A |
1570 | */ | 1688 | */ |
1571 | if (HostAdapter->FirmwareVersion[0] == '5') | 1689 | if (adapter->fw_ver[0] == '5') |
1572 | HostAdapter->HostAdapterQueueDepth = 192; | 1690 | adapter->adapter_qdepth = 192; |
1573 | else if (HostAdapter->FirmwareVersion[0] == '4') | 1691 | else if (adapter->fw_ver[0] == '4') |
1574 | HostAdapter->HostAdapterQueueDepth = (HostAdapter->HostAdapterBusType != BusLogic_ISA_Bus ? 100 : 50); | 1692 | adapter->adapter_qdepth = (adapter->adapter_bus_type != |
1693 | BLOGIC_ISA_BUS ? 100 : 50); | ||
1575 | else | 1694 | else |
1576 | HostAdapter->HostAdapterQueueDepth = 30; | 1695 | adapter->adapter_qdepth = 30; |
1577 | if (strcmp(HostAdapter->FirmwareVersion, "3.31") >= 0) { | 1696 | if (strcmp(adapter->fw_ver, "3.31") >= 0) { |
1578 | HostAdapter->StrictRoundRobinModeSupport = true; | 1697 | adapter->strict_rr = true; |
1579 | HostAdapter->MailboxCount = BusLogic_MaxMailboxes; | 1698 | adapter->mbox_count = BLOGIC_MAX_MAILBOX; |
1580 | } else { | 1699 | } else { |
1581 | HostAdapter->StrictRoundRobinModeSupport = false; | 1700 | adapter->strict_rr = false; |
1582 | HostAdapter->MailboxCount = 32; | 1701 | adapter->mbox_count = 32; |
1583 | } | 1702 | } |
1584 | HostAdapter->DriverQueueDepth = HostAdapter->MailboxCount; | 1703 | adapter->drvr_qdepth = adapter->mbox_count; |
1585 | HostAdapter->InitialCCBs = 4 * BusLogic_CCB_AllocationGroupSize; | 1704 | adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE; |
1586 | HostAdapter->IncrementalCCBs = BusLogic_CCB_AllocationGroupSize; | 1705 | adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE; |
1587 | /* | 1706 | /* |
1588 | Tagged Queuing support is available and operates properly on all "W" series | 1707 | Tagged Queuing support is available and operates properly on |
1589 | MultiMaster Host Adapters, on "C" series MultiMaster Host Adapters with | 1708 | all "W" series MultiMaster Host Adapters, on "C" series |
1590 | firmware version 4.22 and above, and on "S" series MultiMaster Host | 1709 | MultiMaster Host Adapters with firmware version 4.22 and above, |
1591 | Adapters with firmware version 3.35 and above. | 1710 | and on "S" series MultiMaster Host Adapters with firmware version |
1711 | 3.35 and above. | ||
1592 | */ | 1712 | */ |
1593 | HostAdapter->TaggedQueuingPermitted = 0; | 1713 | adapter->tagq_ok = 0; |
1594 | switch (HostAdapter->FirmwareVersion[0]) { | 1714 | switch (adapter->fw_ver[0]) { |
1595 | case '5': | 1715 | case '5': |
1596 | HostAdapter->TaggedQueuingPermitted = 0xFFFF; | 1716 | adapter->tagq_ok = 0xFFFF; |
1597 | break; | 1717 | break; |
1598 | case '4': | 1718 | case '4': |
1599 | if (strcmp(HostAdapter->FirmwareVersion, "4.22") >= 0) | 1719 | if (strcmp(adapter->fw_ver, "4.22") >= 0) |
1600 | HostAdapter->TaggedQueuingPermitted = 0xFFFF; | 1720 | adapter->tagq_ok = 0xFFFF; |
1601 | break; | 1721 | break; |
1602 | case '3': | 1722 | case '3': |
1603 | if (strcmp(HostAdapter->FirmwareVersion, "3.35") >= 0) | 1723 | if (strcmp(adapter->fw_ver, "3.35") >= 0) |
1604 | HostAdapter->TaggedQueuingPermitted = 0xFFFF; | 1724 | adapter->tagq_ok = 0xFFFF; |
1605 | break; | 1725 | break; |
1606 | } | 1726 | } |
1607 | /* | 1727 | /* |
1608 | Determine the Host Adapter BIOS Address if the BIOS is enabled and | 1728 | Determine the Host Adapter BIOS Address if the BIOS is enabled and |
1609 | save it in the Host Adapter structure. The BIOS is disabled if the | 1729 | save it in the Host Adapter structure. The BIOS is disabled if the |
1610 | BIOS_Address is 0. | 1730 | bios_addr is 0. |
1611 | */ | 1731 | */ |
1612 | HostAdapter->BIOS_Address = ExtendedSetupInformation.BIOS_Address << 12; | 1732 | adapter->bios_addr = ext_setupinfo.bios_addr << 12; |
1613 | /* | 1733 | /* |
1614 | ISA Host Adapters require Bounce Buffers if there is more than 16MB memory. | 1734 | ISA Host Adapters require Bounce Buffers if there is more than |
1735 | 16MB memory. | ||
1615 | */ | 1736 | */ |
1616 | if (HostAdapter->HostAdapterBusType == BusLogic_ISA_Bus && (void *) high_memory > (void *) MAX_DMA_ADDRESS) | 1737 | if (adapter->adapter_bus_type == BLOGIC_ISA_BUS && |
1617 | HostAdapter->BounceBuffersRequired = true; | 1738 | (void *) high_memory > (void *) MAX_DMA_ADDRESS) |
1739 | adapter->need_bouncebuf = true; | ||
1618 | /* | 1740 | /* |
1619 | BusLogic BT-445S Host Adapters prior to board revision E have a hardware | 1741 | BusLogic BT-445S Host Adapters prior to board revision E have a |
1620 | bug whereby when the BIOS is enabled, transfers to/from the same address | 1742 | hardware bug whereby when the BIOS is enabled, transfers to/from |
1621 | range the BIOS occupies modulo 16MB are handled incorrectly. Only properly | 1743 | the same address range the BIOS occupies modulo 16MB are handled |
1622 | functioning BT-445S Host Adapters have firmware version 3.37, so require | 1744 | incorrectly. Only properly functioning BT-445S Host Adapters |
1623 | that ISA Bounce Buffers be used for the buggy BT-445S models if there is | 1745 | have firmware version 3.37, so require that ISA Bounce Buffers |
1624 | more than 16MB memory. | 1746 | be used for the buggy BT-445S models if there is more than 16MB |
1747 | memory. | ||
1625 | */ | 1748 | */ |
1626 | if (HostAdapter->BIOS_Address > 0 && strcmp(HostAdapter->ModelName, "BT-445S") == 0 && strcmp(HostAdapter->FirmwareVersion, "3.37") < 0 && (void *) high_memory > (void *) MAX_DMA_ADDRESS) | 1749 | if (adapter->bios_addr > 0 && strcmp(adapter->model, "BT-445S") == 0 && |
1627 | HostAdapter->BounceBuffersRequired = true; | 1750 | strcmp(adapter->fw_ver, "3.37") < 0 && |
1751 | (void *) high_memory > (void *) MAX_DMA_ADDRESS) | ||
1752 | adapter->need_bouncebuf = true; | ||
1628 | /* | 1753 | /* |
1629 | Initialize parameters common to MultiMaster and FlashPoint Host Adapters. | 1754 | Initialize parameters common to MultiMaster and FlashPoint |
1755 | Host Adapters. | ||
1630 | */ | 1756 | */ |
1631 | Common: | 1757 | common: |
1632 | /* | 1758 | /* |
1633 | Initialize the Host Adapter Full Model Name from the Model Name. | 1759 | Initialize the Host Adapter Full Model Name from the Model Name. |
1634 | */ | 1760 | */ |
1635 | strcpy(HostAdapter->FullModelName, "BusLogic "); | 1761 | strcpy(adapter->full_model, "BusLogic "); |
1636 | strcat(HostAdapter->FullModelName, HostAdapter->ModelName); | 1762 | strcat(adapter->full_model, adapter->model); |
1637 | /* | 1763 | /* |
1638 | Select an appropriate value for the Tagged Queue Depth either from a | 1764 | Select an appropriate value for the Tagged Queue Depth either from a |
1639 | BusLogic Driver Options specification, or based on whether this Host | 1765 | BusLogic Driver Options specification, or based on whether this Host |
1640 | Adapter requires that ISA Bounce Buffers be used. The Tagged Queue Depth | 1766 | Adapter requires that ISA Bounce Buffers be used. The Tagged Queue |
1641 | is left at 0 for automatic determination in BusLogic_SelectQueueDepths. | 1767 | Depth is left at 0 for automatic determination in |
1642 | Initialize the Untagged Queue Depth. | 1768 | BusLogic_SelectQueueDepths. Initialize the Untagged Queue Depth. |
1643 | */ | 1769 | */ |
1644 | for (TargetID = 0; TargetID < BusLogic_MaxTargetDevices; TargetID++) { | 1770 | for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++) { |
1645 | unsigned char QueueDepth = 0; | 1771 | unsigned char qdepth = 0; |
1646 | if (HostAdapter->DriverOptions != NULL && HostAdapter->DriverOptions->QueueDepth[TargetID] > 0) | 1772 | if (adapter->drvr_opts != NULL && |
1647 | QueueDepth = HostAdapter->DriverOptions->QueueDepth[TargetID]; | 1773 | adapter->drvr_opts->qdepth[tgt_id] > 0) |
1648 | else if (HostAdapter->BounceBuffersRequired) | 1774 | qdepth = adapter->drvr_opts->qdepth[tgt_id]; |
1649 | QueueDepth = BusLogic_TaggedQueueDepthBB; | 1775 | else if (adapter->need_bouncebuf) |
1650 | HostAdapter->QueueDepth[TargetID] = QueueDepth; | 1776 | qdepth = BLOGIC_TAG_DEPTH_BB; |
1651 | } | 1777 | adapter->qdepth[tgt_id] = qdepth; |
1652 | if (HostAdapter->BounceBuffersRequired) | 1778 | } |
1653 | HostAdapter->UntaggedQueueDepth = BusLogic_UntaggedQueueDepthBB; | 1779 | if (adapter->need_bouncebuf) |
1780 | adapter->untag_qdepth = BLOGIC_UNTAG_DEPTH_BB; | ||
1654 | else | 1781 | else |
1655 | HostAdapter->UntaggedQueueDepth = BusLogic_UntaggedQueueDepth; | 1782 | adapter->untag_qdepth = BLOGIC_UNTAG_DEPTH; |
1656 | if (HostAdapter->DriverOptions != NULL) | 1783 | if (adapter->drvr_opts != NULL) |
1657 | HostAdapter->CommonQueueDepth = HostAdapter->DriverOptions->CommonQueueDepth; | 1784 | adapter->common_qdepth = adapter->drvr_opts->common_qdepth; |
1658 | if (HostAdapter->CommonQueueDepth > 0 && HostAdapter->CommonQueueDepth < HostAdapter->UntaggedQueueDepth) | 1785 | if (adapter->common_qdepth > 0 && |
1659 | HostAdapter->UntaggedQueueDepth = HostAdapter->CommonQueueDepth; | 1786 | adapter->common_qdepth < adapter->untag_qdepth) |
1787 | adapter->untag_qdepth = adapter->common_qdepth; | ||
1660 | /* | 1788 | /* |
1661 | Tagged Queuing is only allowed if Disconnect/Reconnect is permitted. | 1789 | Tagged Queuing is only allowed if Disconnect/Reconnect is permitted. |
1662 | Therefore, mask the Tagged Queuing Permitted Default bits with the | 1790 | Therefore, mask the Tagged Queuing Permitted Default bits with the |
1663 | Disconnect/Reconnect Permitted bits. | 1791 | Disconnect/Reconnect Permitted bits. |
1664 | */ | 1792 | */ |
1665 | HostAdapter->TaggedQueuingPermitted &= HostAdapter->DisconnectPermitted; | 1793 | adapter->tagq_ok &= adapter->discon_ok; |
1666 | /* | 1794 | /* |
1667 | Combine the default Tagged Queuing Permitted bits with any BusLogic Driver | 1795 | Combine the default Tagged Queuing Permitted bits with any |
1668 | Options Tagged Queuing specification. | 1796 | BusLogic Driver Options Tagged Queuing specification. |
1669 | */ | 1797 | */ |
1670 | if (HostAdapter->DriverOptions != NULL) | 1798 | if (adapter->drvr_opts != NULL) |
1671 | HostAdapter->TaggedQueuingPermitted = | 1799 | adapter->tagq_ok = (adapter->drvr_opts->tagq_ok & |
1672 | (HostAdapter->DriverOptions->TaggedQueuingPermitted & HostAdapter->DriverOptions->TaggedQueuingPermittedMask) | (HostAdapter->TaggedQueuingPermitted & ~HostAdapter->DriverOptions->TaggedQueuingPermittedMask); | 1800 | adapter->drvr_opts->tagq_ok_mask) | |
1801 | (adapter->tagq_ok & ~adapter->drvr_opts->tagq_ok_mask); | ||
1673 | 1802 | ||
1674 | /* | 1803 | /* |
1675 | Select an appropriate value for Bus Settle Time either from a BusLogic | 1804 | Select an appropriate value for Bus Settle Time either from a |
1676 | Driver Options specification, or from BusLogic_DefaultBusSettleTime. | 1805 | BusLogic Driver Options specification, or from |
1806 | BLOGIC_BUS_SETTLE_TIME. | ||
1677 | */ | 1807 | */ |
1678 | if (HostAdapter->DriverOptions != NULL && HostAdapter->DriverOptions->BusSettleTime > 0) | 1808 | if (adapter->drvr_opts != NULL && |
1679 | HostAdapter->BusSettleTime = HostAdapter->DriverOptions->BusSettleTime; | 1809 | adapter->drvr_opts->bus_settle_time > 0) |
1810 | adapter->bus_settle_time = adapter->drvr_opts->bus_settle_time; | ||
1680 | else | 1811 | else |
1681 | HostAdapter->BusSettleTime = BusLogic_DefaultBusSettleTime; | 1812 | adapter->bus_settle_time = BLOGIC_BUS_SETTLE_TIME; |
1682 | /* | 1813 | /* |
1683 | Indicate reading the Host Adapter Configuration completed successfully. | 1814 | Indicate reading the Host Adapter Configuration completed |
1815 | successfully. | ||
1684 | */ | 1816 | */ |
1685 | return true; | 1817 | return true; |
1686 | } | 1818 | } |
1687 | 1819 | ||
1688 | 1820 | ||
1689 | /* | 1821 | /* |
1690 | BusLogic_ReportHostAdapterConfiguration reports the configuration of | 1822 | blogic_reportconfig reports the configuration of Host Adapter. |
1691 | Host Adapter. | ||
1692 | */ | 1823 | */ |
1693 | 1824 | ||
1694 | static bool __init BusLogic_ReportHostAdapterConfiguration(struct BusLogic_HostAdapter | 1825 | static bool __init blogic_reportconfig(struct blogic_adapter *adapter) |
1695 | *HostAdapter) | ||
1696 | { | 1826 | { |
1697 | unsigned short AllTargetsMask = (1 << HostAdapter->MaxTargetDevices) - 1; | 1827 | unsigned short alltgt_mask = (1 << adapter->maxdev) - 1; |
1698 | unsigned short SynchronousPermitted, FastPermitted; | 1828 | unsigned short sync_ok, fast_ok; |
1699 | unsigned short UltraPermitted, WidePermitted; | 1829 | unsigned short ultra_ok, wide_ok; |
1700 | unsigned short DisconnectPermitted, TaggedQueuingPermitted; | 1830 | unsigned short discon_ok, tagq_ok; |
1701 | bool CommonSynchronousNegotiation, CommonTaggedQueueDepth; | 1831 | bool common_syncneg, common_tagq_depth; |
1702 | char SynchronousString[BusLogic_MaxTargetDevices + 1]; | 1832 | char syncstr[BLOGIC_MAXDEV + 1]; |
1703 | char WideString[BusLogic_MaxTargetDevices + 1]; | 1833 | char widestr[BLOGIC_MAXDEV + 1]; |
1704 | char DisconnectString[BusLogic_MaxTargetDevices + 1]; | 1834 | char discon_str[BLOGIC_MAXDEV + 1]; |
1705 | char TaggedQueuingString[BusLogic_MaxTargetDevices + 1]; | 1835 | char tagq_str[BLOGIC_MAXDEV + 1]; |
1706 | char *SynchronousMessage = SynchronousString; | 1836 | char *syncmsg = syncstr; |
1707 | char *WideMessage = WideString; | 1837 | char *widemsg = widestr; |
1708 | char *DisconnectMessage = DisconnectString; | 1838 | char *discon_msg = discon_str; |
1709 | char *TaggedQueuingMessage = TaggedQueuingString; | 1839 | char *tagq_msg = tagq_str; |
1710 | int TargetID; | 1840 | int tgt_id; |
1711 | BusLogic_Info("Configuring BusLogic Model %s %s%s%s%s SCSI Host Adapter\n", | 1841 | |
1712 | HostAdapter, HostAdapter->ModelName, | 1842 | blogic_info("Configuring BusLogic Model %s %s%s%s%s SCSI Host Adapter\n", adapter, adapter->model, blogic_adapter_busnames[adapter->adapter_bus_type], (adapter->wide ? " Wide" : ""), (adapter->differential ? " Differential" : ""), (adapter->ultra ? " Ultra" : "")); |
1713 | BusLogic_HostAdapterBusNames[HostAdapter->HostAdapterBusType], (HostAdapter->HostWideSCSI ? " Wide" : ""), (HostAdapter->HostDifferentialSCSI ? " Differential" : ""), (HostAdapter->HostUltraSCSI ? " Ultra" : "")); | 1843 | blogic_info(" Firmware Version: %s, I/O Address: 0x%X, " "IRQ Channel: %d/%s\n", adapter, adapter->fw_ver, adapter->io_addr, adapter->irq_ch, (adapter->level_int ? "Level" : "Edge")); |
1714 | BusLogic_Info(" Firmware Version: %s, I/O Address: 0x%X, " "IRQ Channel: %d/%s\n", HostAdapter, HostAdapter->FirmwareVersion, HostAdapter->IO_Address, HostAdapter->IRQ_Channel, (HostAdapter->LevelSensitiveInterrupt ? "Level" : "Edge")); | 1844 | if (adapter->adapter_bus_type != BLOGIC_PCI_BUS) { |
1715 | if (HostAdapter->HostAdapterBusType != BusLogic_PCI_Bus) { | 1845 | blogic_info(" DMA Channel: ", adapter); |
1716 | BusLogic_Info(" DMA Channel: ", HostAdapter); | 1846 | if (adapter->dma_ch > 0) |
1717 | if (HostAdapter->DMA_Channel > 0) | 1847 | blogic_info("%d, ", adapter, adapter->dma_ch); |
1718 | BusLogic_Info("%d, ", HostAdapter, HostAdapter->DMA_Channel); | ||
1719 | else | 1848 | else |
1720 | BusLogic_Info("None, ", HostAdapter); | 1849 | blogic_info("None, ", adapter); |
1721 | if (HostAdapter->BIOS_Address > 0) | 1850 | if (adapter->bios_addr > 0) |
1722 | BusLogic_Info("BIOS Address: 0x%X, ", HostAdapter, HostAdapter->BIOS_Address); | 1851 | blogic_info("BIOS Address: 0x%X, ", adapter, |
1852 | adapter->bios_addr); | ||
1723 | else | 1853 | else |
1724 | BusLogic_Info("BIOS Address: None, ", HostAdapter); | 1854 | blogic_info("BIOS Address: None, ", adapter); |
1725 | } else { | 1855 | } else { |
1726 | BusLogic_Info(" PCI Bus: %d, Device: %d, Address: ", HostAdapter, HostAdapter->Bus, HostAdapter->Device); | 1856 | blogic_info(" PCI Bus: %d, Device: %d, Address: ", adapter, |
1727 | if (HostAdapter->PCI_Address > 0) | 1857 | adapter->bus, adapter->dev); |
1728 | BusLogic_Info("0x%X, ", HostAdapter, HostAdapter->PCI_Address); | 1858 | if (adapter->pci_addr > 0) |
1859 | blogic_info("0x%X, ", adapter, adapter->pci_addr); | ||
1729 | else | 1860 | else |
1730 | BusLogic_Info("Unassigned, ", HostAdapter); | 1861 | blogic_info("Unassigned, ", adapter); |
1731 | } | 1862 | } |
1732 | BusLogic_Info("Host Adapter SCSI ID: %d\n", HostAdapter, HostAdapter->SCSI_ID); | 1863 | blogic_info("Host Adapter SCSI ID: %d\n", adapter, adapter->scsi_id); |
1733 | BusLogic_Info(" Parity Checking: %s, Extended Translation: %s\n", HostAdapter, (HostAdapter->ParityCheckingEnabled ? "Enabled" : "Disabled"), (HostAdapter->ExtendedTranslationEnabled ? "Enabled" : "Disabled")); | 1864 | blogic_info(" Parity Checking: %s, Extended Translation: %s\n", |
1734 | AllTargetsMask &= ~(1 << HostAdapter->SCSI_ID); | 1865 | adapter, (adapter->parity ? "Enabled" : "Disabled"), |
1735 | SynchronousPermitted = HostAdapter->SynchronousPermitted & AllTargetsMask; | 1866 | (adapter->ext_trans_enable ? "Enabled" : "Disabled")); |
1736 | FastPermitted = HostAdapter->FastPermitted & AllTargetsMask; | 1867 | alltgt_mask &= ~(1 << adapter->scsi_id); |
1737 | UltraPermitted = HostAdapter->UltraPermitted & AllTargetsMask; | 1868 | sync_ok = adapter->sync_ok & alltgt_mask; |
1738 | if ((BusLogic_MultiMasterHostAdapterP(HostAdapter) && (HostAdapter->FirmwareVersion[0] >= '4' || HostAdapter->HostAdapterBusType == BusLogic_EISA_Bus)) || BusLogic_FlashPointHostAdapterP(HostAdapter)) { | 1869 | fast_ok = adapter->fast_ok & alltgt_mask; |
1739 | CommonSynchronousNegotiation = false; | 1870 | ultra_ok = adapter->ultra_ok & alltgt_mask; |
1740 | if (SynchronousPermitted == 0) { | 1871 | if ((blogic_multimaster_type(adapter) && |
1741 | SynchronousMessage = "Disabled"; | 1872 | (adapter->fw_ver[0] >= '4' || |
1742 | CommonSynchronousNegotiation = true; | 1873 | adapter->adapter_bus_type == BLOGIC_EISA_BUS)) || |
1743 | } else if (SynchronousPermitted == AllTargetsMask) { | 1874 | blogic_flashpoint_type(adapter)) { |
1744 | if (FastPermitted == 0) { | 1875 | common_syncneg = false; |
1745 | SynchronousMessage = "Slow"; | 1876 | if (sync_ok == 0) { |
1746 | CommonSynchronousNegotiation = true; | 1877 | syncmsg = "Disabled"; |
1747 | } else if (FastPermitted == AllTargetsMask) { | 1878 | common_syncneg = true; |
1748 | if (UltraPermitted == 0) { | 1879 | } else if (sync_ok == alltgt_mask) { |
1749 | SynchronousMessage = "Fast"; | 1880 | if (fast_ok == 0) { |
1750 | CommonSynchronousNegotiation = true; | 1881 | syncmsg = "Slow"; |
1751 | } else if (UltraPermitted == AllTargetsMask) { | 1882 | common_syncneg = true; |
1752 | SynchronousMessage = "Ultra"; | 1883 | } else if (fast_ok == alltgt_mask) { |
1753 | CommonSynchronousNegotiation = true; | 1884 | if (ultra_ok == 0) { |
1885 | syncmsg = "Fast"; | ||
1886 | common_syncneg = true; | ||
1887 | } else if (ultra_ok == alltgt_mask) { | ||
1888 | syncmsg = "Ultra"; | ||
1889 | common_syncneg = true; | ||
1754 | } | 1890 | } |
1755 | } | 1891 | } |
1756 | } | 1892 | } |
1757 | if (!CommonSynchronousNegotiation) { | 1893 | if (!common_syncneg) { |
1758 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) | 1894 | for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) |
1759 | SynchronousString[TargetID] = ((!(SynchronousPermitted & (1 << TargetID))) ? 'N' : (!(FastPermitted & (1 << TargetID)) ? 'S' : (!(UltraPermitted & (1 << TargetID)) ? 'F' : 'U'))); | 1895 | syncstr[tgt_id] = ((!(sync_ok & (1 << tgt_id))) ? 'N' : (!(fast_ok & (1 << tgt_id)) ? 'S' : (!(ultra_ok & (1 << tgt_id)) ? 'F' : 'U'))); |
1760 | SynchronousString[HostAdapter->SCSI_ID] = '#'; | 1896 | syncstr[adapter->scsi_id] = '#'; |
1761 | SynchronousString[HostAdapter->MaxTargetDevices] = '\0'; | 1897 | syncstr[adapter->maxdev] = '\0'; |
1762 | } | 1898 | } |
1763 | } else | 1899 | } else |
1764 | SynchronousMessage = (SynchronousPermitted == 0 ? "Disabled" : "Enabled"); | 1900 | syncmsg = (sync_ok == 0 ? "Disabled" : "Enabled"); |
1765 | WidePermitted = HostAdapter->WidePermitted & AllTargetsMask; | 1901 | wide_ok = adapter->wide_ok & alltgt_mask; |
1766 | if (WidePermitted == 0) | 1902 | if (wide_ok == 0) |
1767 | WideMessage = "Disabled"; | 1903 | widemsg = "Disabled"; |
1768 | else if (WidePermitted == AllTargetsMask) | 1904 | else if (wide_ok == alltgt_mask) |
1769 | WideMessage = "Enabled"; | 1905 | widemsg = "Enabled"; |
1770 | else { | 1906 | else { |
1771 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) | 1907 | for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) |
1772 | WideString[TargetID] = ((WidePermitted & (1 << TargetID)) ? 'Y' : 'N'); | 1908 | widestr[tgt_id] = ((wide_ok & (1 << tgt_id)) ? 'Y' : 'N'); |
1773 | WideString[HostAdapter->SCSI_ID] = '#'; | 1909 | widestr[adapter->scsi_id] = '#'; |
1774 | WideString[HostAdapter->MaxTargetDevices] = '\0'; | 1910 | widestr[adapter->maxdev] = '\0'; |
1775 | } | 1911 | } |
1776 | DisconnectPermitted = HostAdapter->DisconnectPermitted & AllTargetsMask; | 1912 | discon_ok = adapter->discon_ok & alltgt_mask; |
1777 | if (DisconnectPermitted == 0) | 1913 | if (discon_ok == 0) |
1778 | DisconnectMessage = "Disabled"; | 1914 | discon_msg = "Disabled"; |
1779 | else if (DisconnectPermitted == AllTargetsMask) | 1915 | else if (discon_ok == alltgt_mask) |
1780 | DisconnectMessage = "Enabled"; | 1916 | discon_msg = "Enabled"; |
1781 | else { | 1917 | else { |
1782 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) | 1918 | for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) |
1783 | DisconnectString[TargetID] = ((DisconnectPermitted & (1 << TargetID)) ? 'Y' : 'N'); | 1919 | discon_str[tgt_id] = ((discon_ok & (1 << tgt_id)) ? 'Y' : 'N'); |
1784 | DisconnectString[HostAdapter->SCSI_ID] = '#'; | 1920 | discon_str[adapter->scsi_id] = '#'; |
1785 | DisconnectString[HostAdapter->MaxTargetDevices] = '\0'; | 1921 | discon_str[adapter->maxdev] = '\0'; |
1786 | } | 1922 | } |
1787 | TaggedQueuingPermitted = HostAdapter->TaggedQueuingPermitted & AllTargetsMask; | 1923 | tagq_ok = adapter->tagq_ok & alltgt_mask; |
1788 | if (TaggedQueuingPermitted == 0) | 1924 | if (tagq_ok == 0) |
1789 | TaggedQueuingMessage = "Disabled"; | 1925 | tagq_msg = "Disabled"; |
1790 | else if (TaggedQueuingPermitted == AllTargetsMask) | 1926 | else if (tagq_ok == alltgt_mask) |
1791 | TaggedQueuingMessage = "Enabled"; | 1927 | tagq_msg = "Enabled"; |
1792 | else { | 1928 | else { |
1793 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) | 1929 | for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) |
1794 | TaggedQueuingString[TargetID] = ((TaggedQueuingPermitted & (1 << TargetID)) ? 'Y' : 'N'); | 1930 | tagq_str[tgt_id] = ((tagq_ok & (1 << tgt_id)) ? 'Y' : 'N'); |
1795 | TaggedQueuingString[HostAdapter->SCSI_ID] = '#'; | 1931 | tagq_str[adapter->scsi_id] = '#'; |
1796 | TaggedQueuingString[HostAdapter->MaxTargetDevices] = '\0'; | 1932 | tagq_str[adapter->maxdev] = '\0'; |
1797 | } | 1933 | } |
1798 | BusLogic_Info(" Synchronous Negotiation: %s, Wide Negotiation: %s\n", HostAdapter, SynchronousMessage, WideMessage); | 1934 | blogic_info(" Synchronous Negotiation: %s, Wide Negotiation: %s\n", |
1799 | BusLogic_Info(" Disconnect/Reconnect: %s, Tagged Queuing: %s\n", HostAdapter, DisconnectMessage, TaggedQueuingMessage); | 1935 | adapter, syncmsg, widemsg); |
1800 | if (BusLogic_MultiMasterHostAdapterP(HostAdapter)) { | 1936 | blogic_info(" Disconnect/Reconnect: %s, Tagged Queuing: %s\n", adapter, |
1801 | BusLogic_Info(" Scatter/Gather Limit: %d of %d segments, " "Mailboxes: %d\n", HostAdapter, HostAdapter->DriverScatterGatherLimit, HostAdapter->HostAdapterScatterGatherLimit, HostAdapter->MailboxCount); | 1937 | discon_msg, tagq_msg); |
1802 | BusLogic_Info(" Driver Queue Depth: %d, " "Host Adapter Queue Depth: %d\n", HostAdapter, HostAdapter->DriverQueueDepth, HostAdapter->HostAdapterQueueDepth); | 1938 | if (blogic_multimaster_type(adapter)) { |
1939 | blogic_info(" Scatter/Gather Limit: %d of %d segments, " "Mailboxes: %d\n", adapter, adapter->drvr_sglimit, adapter->adapter_sglimit, adapter->mbox_count); | ||
1940 | blogic_info(" Driver Queue Depth: %d, " "Host Adapter Queue Depth: %d\n", adapter, adapter->drvr_qdepth, adapter->adapter_qdepth); | ||
1803 | } else | 1941 | } else |
1804 | BusLogic_Info(" Driver Queue Depth: %d, " "Scatter/Gather Limit: %d segments\n", HostAdapter, HostAdapter->DriverQueueDepth, HostAdapter->DriverScatterGatherLimit); | 1942 | blogic_info(" Driver Queue Depth: %d, " "Scatter/Gather Limit: %d segments\n", adapter, adapter->drvr_qdepth, adapter->drvr_sglimit); |
1805 | BusLogic_Info(" Tagged Queue Depth: ", HostAdapter); | 1943 | blogic_info(" Tagged Queue Depth: ", adapter); |
1806 | CommonTaggedQueueDepth = true; | 1944 | common_tagq_depth = true; |
1807 | for (TargetID = 1; TargetID < HostAdapter->MaxTargetDevices; TargetID++) | 1945 | for (tgt_id = 1; tgt_id < adapter->maxdev; tgt_id++) |
1808 | if (HostAdapter->QueueDepth[TargetID] != HostAdapter->QueueDepth[0]) { | 1946 | if (adapter->qdepth[tgt_id] != adapter->qdepth[0]) { |
1809 | CommonTaggedQueueDepth = false; | 1947 | common_tagq_depth = false; |
1810 | break; | 1948 | break; |
1811 | } | 1949 | } |
1812 | if (CommonTaggedQueueDepth) { | 1950 | if (common_tagq_depth) { |
1813 | if (HostAdapter->QueueDepth[0] > 0) | 1951 | if (adapter->qdepth[0] > 0) |
1814 | BusLogic_Info("%d", HostAdapter, HostAdapter->QueueDepth[0]); | 1952 | blogic_info("%d", adapter, adapter->qdepth[0]); |
1815 | else | 1953 | else |
1816 | BusLogic_Info("Automatic", HostAdapter); | 1954 | blogic_info("Automatic", adapter); |
1817 | } else | 1955 | } else |
1818 | BusLogic_Info("Individual", HostAdapter); | 1956 | blogic_info("Individual", adapter); |
1819 | BusLogic_Info(", Untagged Queue Depth: %d\n", HostAdapter, HostAdapter->UntaggedQueueDepth); | 1957 | blogic_info(", Untagged Queue Depth: %d\n", adapter, |
1820 | if (HostAdapter->TerminationInfoValid) { | 1958 | adapter->untag_qdepth); |
1821 | if (HostAdapter->HostWideSCSI) | 1959 | if (adapter->terminfo_valid) { |
1822 | BusLogic_Info(" SCSI Bus Termination: %s", HostAdapter, (HostAdapter->LowByteTerminated ? (HostAdapter->HighByteTerminated ? "Both Enabled" : "Low Enabled") | 1960 | if (adapter->wide) |
1823 | : (HostAdapter->HighByteTerminated ? "High Enabled" : "Both Disabled"))); | 1961 | blogic_info(" SCSI Bus Termination: %s", adapter, |
1962 | (adapter->low_term ? (adapter->high_term ? "Both Enabled" : "Low Enabled") : (adapter->high_term ? "High Enabled" : "Both Disabled"))); | ||
1824 | else | 1963 | else |
1825 | BusLogic_Info(" SCSI Bus Termination: %s", HostAdapter, (HostAdapter->LowByteTerminated ? "Enabled" : "Disabled")); | 1964 | blogic_info(" SCSI Bus Termination: %s", adapter, |
1826 | if (HostAdapter->HostSupportsSCAM) | 1965 | (adapter->low_term ? "Enabled" : "Disabled")); |
1827 | BusLogic_Info(", SCAM: %s", HostAdapter, (HostAdapter->SCAM_Enabled ? (HostAdapter->SCAM_Level2 ? "Enabled, Level 2" : "Enabled, Level 1") | 1966 | if (adapter->scam) |
1828 | : "Disabled")); | 1967 | blogic_info(", SCAM: %s", adapter, |
1829 | BusLogic_Info("\n", HostAdapter); | 1968 | (adapter->scam_enabled ? (adapter->scam_lev2 ? "Enabled, Level 2" : "Enabled, Level 1") : "Disabled")); |
1969 | blogic_info("\n", adapter); | ||
1830 | } | 1970 | } |
1831 | /* | 1971 | /* |
1832 | Indicate reporting the Host Adapter configuration completed successfully. | 1972 | Indicate reporting the Host Adapter configuration completed |
1973 | successfully. | ||
1833 | */ | 1974 | */ |
1834 | return true; | 1975 | return true; |
1835 | } | 1976 | } |
1836 | 1977 | ||
1837 | 1978 | ||
1838 | /* | 1979 | /* |
1839 | BusLogic_AcquireResources acquires the system resources necessary to use | 1980 | blogic_getres acquires the system resources necessary to use |
1840 | Host Adapter. | 1981 | Host Adapter. |
1841 | */ | 1982 | */ |
1842 | 1983 | ||
1843 | static bool __init BusLogic_AcquireResources(struct BusLogic_HostAdapter *HostAdapter) | 1984 | static bool __init blogic_getres(struct blogic_adapter *adapter) |
1844 | { | 1985 | { |
1845 | if (HostAdapter->IRQ_Channel == 0) { | 1986 | if (adapter->irq_ch == 0) { |
1846 | BusLogic_Error("NO LEGAL INTERRUPT CHANNEL ASSIGNED - DETACHING\n", HostAdapter); | 1987 | blogic_err("NO LEGAL INTERRUPT CHANNEL ASSIGNED - DETACHING\n", |
1988 | adapter); | ||
1847 | return false; | 1989 | return false; |
1848 | } | 1990 | } |
1849 | /* | 1991 | /* |
1850 | Acquire shared access to the IRQ Channel. | 1992 | Acquire shared access to the IRQ Channel. |
1851 | */ | 1993 | */ |
1852 | if (request_irq(HostAdapter->IRQ_Channel, BusLogic_InterruptHandler, IRQF_SHARED, HostAdapter->FullModelName, HostAdapter) < 0) { | 1994 | if (request_irq(adapter->irq_ch, blogic_inthandler, IRQF_SHARED, |
1853 | BusLogic_Error("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n", HostAdapter, HostAdapter->IRQ_Channel); | 1995 | adapter->full_model, adapter) < 0) { |
1996 | blogic_err("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n", | ||
1997 | adapter, adapter->irq_ch); | ||
1854 | return false; | 1998 | return false; |
1855 | } | 1999 | } |
1856 | HostAdapter->IRQ_ChannelAcquired = true; | 2000 | adapter->irq_acquired = true; |
1857 | /* | 2001 | /* |
1858 | Acquire exclusive access to the DMA Channel. | 2002 | Acquire exclusive access to the DMA Channel. |
1859 | */ | 2003 | */ |
1860 | if (HostAdapter->DMA_Channel > 0) { | 2004 | if (adapter->dma_ch > 0) { |
1861 | if (request_dma(HostAdapter->DMA_Channel, HostAdapter->FullModelName) < 0) { | 2005 | if (request_dma(adapter->dma_ch, adapter->full_model) < 0) { |
1862 | BusLogic_Error("UNABLE TO ACQUIRE DMA CHANNEL %d - DETACHING\n", HostAdapter, HostAdapter->DMA_Channel); | 2006 | blogic_err("UNABLE TO ACQUIRE DMA CHANNEL %d - DETACHING\n", adapter, adapter->dma_ch); |
1863 | return false; | 2007 | return false; |
1864 | } | 2008 | } |
1865 | set_dma_mode(HostAdapter->DMA_Channel, DMA_MODE_CASCADE); | 2009 | set_dma_mode(adapter->dma_ch, DMA_MODE_CASCADE); |
1866 | enable_dma(HostAdapter->DMA_Channel); | 2010 | enable_dma(adapter->dma_ch); |
1867 | HostAdapter->DMA_ChannelAcquired = true; | 2011 | adapter->dma_chan_acquired = true; |
1868 | } | 2012 | } |
1869 | /* | 2013 | /* |
1870 | Indicate the System Resource Acquisition completed successfully, | 2014 | Indicate the System Resource Acquisition completed successfully, |
@@ -1874,127 +2018,146 @@ static bool __init BusLogic_AcquireResources(struct BusLogic_HostAdapter *HostAd | |||
1874 | 2018 | ||
1875 | 2019 | ||
1876 | /* | 2020 | /* |
1877 | BusLogic_ReleaseResources releases any system resources previously acquired | 2021 | blogic_relres releases any system resources previously acquired |
1878 | by BusLogic_AcquireResources. | 2022 | by blogic_getres. |
1879 | */ | 2023 | */ |
1880 | 2024 | ||
1881 | static void BusLogic_ReleaseResources(struct BusLogic_HostAdapter *HostAdapter) | 2025 | static void blogic_relres(struct blogic_adapter *adapter) |
1882 | { | 2026 | { |
1883 | /* | 2027 | /* |
1884 | Release shared access to the IRQ Channel. | 2028 | Release shared access to the IRQ Channel. |
1885 | */ | 2029 | */ |
1886 | if (HostAdapter->IRQ_ChannelAcquired) | 2030 | if (adapter->irq_acquired) |
1887 | free_irq(HostAdapter->IRQ_Channel, HostAdapter); | 2031 | free_irq(adapter->irq_ch, adapter); |
1888 | /* | 2032 | /* |
1889 | Release exclusive access to the DMA Channel. | 2033 | Release exclusive access to the DMA Channel. |
1890 | */ | 2034 | */ |
1891 | if (HostAdapter->DMA_ChannelAcquired) | 2035 | if (adapter->dma_chan_acquired) |
1892 | free_dma(HostAdapter->DMA_Channel); | 2036 | free_dma(adapter->dma_ch); |
1893 | /* | 2037 | /* |
1894 | Release any allocated memory structs not released elsewhere | 2038 | Release any allocated memory structs not released elsewhere |
1895 | */ | 2039 | */ |
1896 | if (HostAdapter->MailboxSpace) | 2040 | if (adapter->mbox_space) |
1897 | pci_free_consistent(HostAdapter->PCI_Device, HostAdapter->MailboxSize, HostAdapter->MailboxSpace, HostAdapter->MailboxSpaceHandle); | 2041 | pci_free_consistent(adapter->pci_device, adapter->mbox_sz, |
1898 | pci_dev_put(HostAdapter->PCI_Device); | 2042 | adapter->mbox_space, adapter->mbox_space_handle); |
1899 | HostAdapter->MailboxSpace = NULL; | 2043 | pci_dev_put(adapter->pci_device); |
1900 | HostAdapter->MailboxSpaceHandle = 0; | 2044 | adapter->mbox_space = NULL; |
1901 | HostAdapter->MailboxSize = 0; | 2045 | adapter->mbox_space_handle = 0; |
2046 | adapter->mbox_sz = 0; | ||
1902 | } | 2047 | } |
1903 | 2048 | ||
1904 | 2049 | ||
1905 | /* | 2050 | /* |
1906 | BusLogic_InitializeHostAdapter initializes Host Adapter. This is the only | 2051 | blogic_initadapter initializes Host Adapter. This is the only |
1907 | function called during SCSI Host Adapter detection which modifies the state | 2052 | function called during SCSI Host Adapter detection which modifies the state |
1908 | of the Host Adapter from its initial power on or hard reset state. | 2053 | of the Host Adapter from its initial power on or hard reset state. |
1909 | */ | 2054 | */ |
1910 | 2055 | ||
1911 | static bool BusLogic_InitializeHostAdapter(struct BusLogic_HostAdapter | 2056 | static bool blogic_initadapter(struct blogic_adapter *adapter) |
1912 | *HostAdapter) | ||
1913 | { | 2057 | { |
1914 | struct BusLogic_ExtendedMailboxRequest ExtendedMailboxRequest; | 2058 | struct blogic_extmbox_req extmbox_req; |
1915 | enum BusLogic_RoundRobinModeRequest RoundRobinModeRequest; | 2059 | enum blogic_rr_req rr_req; |
1916 | enum BusLogic_SetCCBFormatRequest SetCCBFormatRequest; | 2060 | enum blogic_setccb_fmt setccb_fmt; |
1917 | int TargetID; | 2061 | int tgt_id; |
2062 | |||
1918 | /* | 2063 | /* |
1919 | Initialize the pointers to the first and last CCBs that are queued for | 2064 | Initialize the pointers to the first and last CCBs that are |
1920 | completion processing. | 2065 | queued for completion processing. |
1921 | */ | 2066 | */ |
1922 | HostAdapter->FirstCompletedCCB = NULL; | 2067 | adapter->firstccb = NULL; |
1923 | HostAdapter->LastCompletedCCB = NULL; | 2068 | adapter->lastccb = NULL; |
2069 | |||
1924 | /* | 2070 | /* |
1925 | Initialize the Bus Device Reset Pending CCB, Tagged Queuing Active, | 2071 | Initialize the Bus Device Reset Pending CCB, Tagged Queuing Active, |
1926 | Command Successful Flag, Active Commands, and Commands Since Reset | 2072 | Command Successful Flag, Active Commands, and Commands Since Reset |
1927 | for each Target Device. | 2073 | for each Target Device. |
1928 | */ | 2074 | */ |
1929 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { | 2075 | for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) { |
1930 | HostAdapter->BusDeviceResetPendingCCB[TargetID] = NULL; | 2076 | adapter->bdr_pend[tgt_id] = NULL; |
1931 | HostAdapter->TargetFlags[TargetID].TaggedQueuingActive = false; | 2077 | adapter->tgt_flags[tgt_id].tagq_active = false; |
1932 | HostAdapter->TargetFlags[TargetID].CommandSuccessfulFlag = false; | 2078 | adapter->tgt_flags[tgt_id].cmd_good = false; |
1933 | HostAdapter->ActiveCommands[TargetID] = 0; | 2079 | adapter->active_cmds[tgt_id] = 0; |
1934 | HostAdapter->CommandsSinceReset[TargetID] = 0; | 2080 | adapter->cmds_since_rst[tgt_id] = 0; |
1935 | } | 2081 | } |
2082 | |||
1936 | /* | 2083 | /* |
1937 | FlashPoint Host Adapters do not use Outgoing and Incoming Mailboxes. | 2084 | FlashPoint Host Adapters do not use Outgoing and Incoming Mailboxes. |
1938 | */ | 2085 | */ |
1939 | if (BusLogic_FlashPointHostAdapterP(HostAdapter)) | 2086 | if (blogic_flashpoint_type(adapter)) |
1940 | goto Done; | 2087 | goto done; |
2088 | |||
1941 | /* | 2089 | /* |
1942 | Initialize the Outgoing and Incoming Mailbox pointers. | 2090 | Initialize the Outgoing and Incoming Mailbox pointers. |
1943 | */ | 2091 | */ |
1944 | HostAdapter->MailboxSize = HostAdapter->MailboxCount * (sizeof(struct BusLogic_OutgoingMailbox) + sizeof(struct BusLogic_IncomingMailbox)); | 2092 | adapter->mbox_sz = adapter->mbox_count * (sizeof(struct blogic_outbox) + sizeof(struct blogic_inbox)); |
1945 | HostAdapter->MailboxSpace = pci_alloc_consistent(HostAdapter->PCI_Device, HostAdapter->MailboxSize, &HostAdapter->MailboxSpaceHandle); | 2093 | adapter->mbox_space = pci_alloc_consistent(adapter->pci_device, |
1946 | if (HostAdapter->MailboxSpace == NULL) | 2094 | adapter->mbox_sz, &adapter->mbox_space_handle); |
1947 | return BusLogic_Failure(HostAdapter, "MAILBOX ALLOCATION"); | 2095 | if (adapter->mbox_space == NULL) |
1948 | HostAdapter->FirstOutgoingMailbox = (struct BusLogic_OutgoingMailbox *) HostAdapter->MailboxSpace; | 2096 | return blogic_failure(adapter, "MAILBOX ALLOCATION"); |
1949 | HostAdapter->LastOutgoingMailbox = HostAdapter->FirstOutgoingMailbox + HostAdapter->MailboxCount - 1; | 2097 | adapter->first_outbox = (struct blogic_outbox *) adapter->mbox_space; |
1950 | HostAdapter->NextOutgoingMailbox = HostAdapter->FirstOutgoingMailbox; | 2098 | adapter->last_outbox = adapter->first_outbox + adapter->mbox_count - 1; |
1951 | HostAdapter->FirstIncomingMailbox = (struct BusLogic_IncomingMailbox *) (HostAdapter->LastOutgoingMailbox + 1); | 2099 | adapter->next_outbox = adapter->first_outbox; |
1952 | HostAdapter->LastIncomingMailbox = HostAdapter->FirstIncomingMailbox + HostAdapter->MailboxCount - 1; | 2100 | adapter->first_inbox = (struct blogic_inbox *) (adapter->last_outbox + 1); |
1953 | HostAdapter->NextIncomingMailbox = HostAdapter->FirstIncomingMailbox; | 2101 | adapter->last_inbox = adapter->first_inbox + adapter->mbox_count - 1; |
2102 | adapter->next_inbox = adapter->first_inbox; | ||
1954 | 2103 | ||
1955 | /* | 2104 | /* |
1956 | Initialize the Outgoing and Incoming Mailbox structures. | 2105 | Initialize the Outgoing and Incoming Mailbox structures. |
1957 | */ | 2106 | */ |
1958 | memset(HostAdapter->FirstOutgoingMailbox, 0, HostAdapter->MailboxCount * sizeof(struct BusLogic_OutgoingMailbox)); | 2107 | memset(adapter->first_outbox, 0, |
1959 | memset(HostAdapter->FirstIncomingMailbox, 0, HostAdapter->MailboxCount * sizeof(struct BusLogic_IncomingMailbox)); | 2108 | adapter->mbox_count * sizeof(struct blogic_outbox)); |
2109 | memset(adapter->first_inbox, 0, | ||
2110 | adapter->mbox_count * sizeof(struct blogic_inbox)); | ||
2111 | |||
1960 | /* | 2112 | /* |
1961 | Initialize the Host Adapter's Pointer to the Outgoing/Incoming Mailboxes. | 2113 | Initialize the Host Adapter's Pointer to the Outgoing/Incoming |
2114 | Mailboxes. | ||
1962 | */ | 2115 | */ |
1963 | ExtendedMailboxRequest.MailboxCount = HostAdapter->MailboxCount; | 2116 | extmbox_req.mbox_count = adapter->mbox_count; |
1964 | ExtendedMailboxRequest.BaseMailboxAddress = (u32) HostAdapter->MailboxSpaceHandle; | 2117 | extmbox_req.base_mbox_addr = (u32) adapter->mbox_space_handle; |
1965 | if (BusLogic_Command(HostAdapter, BusLogic_InitializeExtendedMailbox, &ExtendedMailboxRequest, sizeof(ExtendedMailboxRequest), NULL, 0) < 0) | 2118 | if (blogic_cmd(adapter, BLOGIC_INIT_EXT_MBOX, &extmbox_req, |
1966 | return BusLogic_Failure(HostAdapter, "MAILBOX INITIALIZATION"); | 2119 | sizeof(extmbox_req), NULL, 0) < 0) |
2120 | return blogic_failure(adapter, "MAILBOX INITIALIZATION"); | ||
1967 | /* | 2121 | /* |
1968 | Enable Strict Round Robin Mode if supported by the Host Adapter. In | 2122 | Enable Strict Round Robin Mode if supported by the Host Adapter. In |
1969 | Strict Round Robin Mode, the Host Adapter only looks at the next Outgoing | 2123 | Strict Round Robin Mode, the Host Adapter only looks at the next |
1970 | Mailbox for each new command, rather than scanning through all the | 2124 | Outgoing Mailbox for each new command, rather than scanning |
1971 | Outgoing Mailboxes to find any that have new commands in them. Strict | 2125 | through all the Outgoing Mailboxes to find any that have new |
1972 | Round Robin Mode is significantly more efficient. | 2126 | commands in them. Strict Round Robin Mode is significantly more |
2127 | efficient. | ||
1973 | */ | 2128 | */ |
1974 | if (HostAdapter->StrictRoundRobinModeSupport) { | 2129 | if (adapter->strict_rr) { |
1975 | RoundRobinModeRequest = BusLogic_StrictRoundRobinMode; | 2130 | rr_req = BLOGIC_STRICT_RR_MODE; |
1976 | if (BusLogic_Command(HostAdapter, BusLogic_EnableStrictRoundRobinMode, &RoundRobinModeRequest, sizeof(RoundRobinModeRequest), NULL, 0) < 0) | 2131 | if (blogic_cmd(adapter, BLOGIC_STRICT_RR, &rr_req, |
1977 | return BusLogic_Failure(HostAdapter, "ENABLE STRICT ROUND ROBIN MODE"); | 2132 | sizeof(rr_req), NULL, 0) < 0) |
2133 | return blogic_failure(adapter, | ||
2134 | "ENABLE STRICT ROUND ROBIN MODE"); | ||
1978 | } | 2135 | } |
2136 | |||
1979 | /* | 2137 | /* |
1980 | For Host Adapters that support Extended LUN Format CCBs, issue the Set CCB | 2138 | For Host Adapters that support Extended LUN Format CCBs, issue the |
1981 | Format command to allow 32 Logical Units per Target Device. | 2139 | Set CCB Format command to allow 32 Logical Units per Target Device. |
1982 | */ | 2140 | */ |
1983 | if (HostAdapter->ExtendedLUNSupport) { | 2141 | if (adapter->ext_lun) { |
1984 | SetCCBFormatRequest = BusLogic_ExtendedLUNFormatCCB; | 2142 | setccb_fmt = BLOGIC_EXT_LUN_CCB; |
1985 | if (BusLogic_Command(HostAdapter, BusLogic_SetCCBFormat, &SetCCBFormatRequest, sizeof(SetCCBFormatRequest), NULL, 0) < 0) | 2143 | if (blogic_cmd(adapter, BLOGIC_SETCCB_FMT, &setccb_fmt, |
1986 | return BusLogic_Failure(HostAdapter, "SET CCB FORMAT"); | 2144 | sizeof(setccb_fmt), NULL, 0) < 0) |
2145 | return blogic_failure(adapter, "SET CCB FORMAT"); | ||
1987 | } | 2146 | } |
2147 | |||
1988 | /* | 2148 | /* |
1989 | Announce Successful Initialization. | 2149 | Announce Successful Initialization. |
1990 | */ | 2150 | */ |
1991 | Done: | 2151 | done: |
1992 | if (!HostAdapter->HostAdapterInitialized) { | 2152 | if (!adapter->adapter_initd) { |
1993 | BusLogic_Info("*** %s Initialized Successfully ***\n", HostAdapter, HostAdapter->FullModelName); | 2153 | blogic_info("*** %s Initialized Successfully ***\n", adapter, |
1994 | BusLogic_Info("\n", HostAdapter); | 2154 | adapter->full_model); |
2155 | blogic_info("\n", adapter); | ||
1995 | } else | 2156 | } else |
1996 | BusLogic_Warning("*** %s Initialized Successfully ***\n", HostAdapter, HostAdapter->FullModelName); | 2157 | blogic_warn("*** %s Initialized Successfully ***\n", adapter, |
1997 | HostAdapter->HostAdapterInitialized = true; | 2158 | adapter->full_model); |
2159 | adapter->adapter_initd = true; | ||
2160 | |||
1998 | /* | 2161 | /* |
1999 | Indicate the Host Adapter Initialization completed successfully. | 2162 | Indicate the Host Adapter Initialization completed successfully. |
2000 | */ | 2163 | */ |
@@ -2003,109 +2166,116 @@ static bool BusLogic_InitializeHostAdapter(struct BusLogic_HostAdapter | |||
2003 | 2166 | ||
2004 | 2167 | ||
2005 | /* | 2168 | /* |
2006 | BusLogic_TargetDeviceInquiry inquires about the Target Devices accessible | 2169 | blogic_inquiry inquires about the Target Devices accessible |
2007 | through Host Adapter. | 2170 | through Host Adapter. |
2008 | */ | 2171 | */ |
2009 | 2172 | ||
2010 | static bool __init BusLogic_TargetDeviceInquiry(struct BusLogic_HostAdapter | 2173 | static bool __init blogic_inquiry(struct blogic_adapter *adapter) |
2011 | *HostAdapter) | ||
2012 | { | 2174 | { |
2013 | u16 InstalledDevices; | 2175 | u16 installed_devs; |
2014 | u8 InstalledDevicesID0to7[8]; | 2176 | u8 installed_devs0to7[8]; |
2015 | struct BusLogic_SetupInformation SetupInformation; | 2177 | struct blogic_setup_info setupinfo; |
2016 | u8 SynchronousPeriod[BusLogic_MaxTargetDevices]; | 2178 | u8 sync_period[BLOGIC_MAXDEV]; |
2017 | unsigned char RequestedReplyLength; | 2179 | unsigned char req_replylen; |
2018 | int TargetID; | 2180 | int tgt_id; |
2181 | |||
2019 | /* | 2182 | /* |
2020 | Wait a few seconds between the Host Adapter Hard Reset which initiates | 2183 | Wait a few seconds between the Host Adapter Hard Reset which |
2021 | a SCSI Bus Reset and issuing any SCSI Commands. Some SCSI devices get | 2184 | initiates a SCSI Bus Reset and issuing any SCSI Commands. Some |
2022 | confused if they receive SCSI Commands too soon after a SCSI Bus Reset. | 2185 | SCSI devices get confused if they receive SCSI Commands too soon |
2186 | after a SCSI Bus Reset. | ||
2023 | */ | 2187 | */ |
2024 | BusLogic_Delay(HostAdapter->BusSettleTime); | 2188 | blogic_delay(adapter->bus_settle_time); |
2025 | /* | 2189 | /* |
2026 | FlashPoint Host Adapters do not provide for Target Device Inquiry. | 2190 | FlashPoint Host Adapters do not provide for Target Device Inquiry. |
2027 | */ | 2191 | */ |
2028 | if (BusLogic_FlashPointHostAdapterP(HostAdapter)) | 2192 | if (blogic_flashpoint_type(adapter)) |
2029 | return true; | 2193 | return true; |
2030 | /* | 2194 | /* |
2031 | Inhibit the Target Device Inquiry if requested. | 2195 | Inhibit the Target Device Inquiry if requested. |
2032 | */ | 2196 | */ |
2033 | if (HostAdapter->DriverOptions != NULL && HostAdapter->DriverOptions->LocalOptions.InhibitTargetInquiry) | 2197 | if (adapter->drvr_opts != NULL && adapter->drvr_opts->stop_tgt_inquiry) |
2034 | return true; | 2198 | return true; |
2035 | /* | 2199 | /* |
2036 | Issue the Inquire Target Devices command for host adapters with firmware | 2200 | Issue the Inquire Target Devices command for host adapters with |
2037 | version 4.25 or later, or the Inquire Installed Devices ID 0 to 7 command | 2201 | firmware version 4.25 or later, or the Inquire Installed Devices |
2038 | for older host adapters. This is necessary to force Synchronous Transfer | 2202 | ID 0 to 7 command for older host adapters. This is necessary to |
2039 | Negotiation so that the Inquire Setup Information and Inquire Synchronous | 2203 | force Synchronous Transfer Negotiation so that the Inquire Setup |
2040 | Period commands will return valid data. The Inquire Target Devices command | 2204 | Information and Inquire Synchronous Period commands will return |
2041 | is preferable to Inquire Installed Devices ID 0 to 7 since it only probes | 2205 | valid data. The Inquire Target Devices command is preferable to |
2042 | Logical Unit 0 of each Target Device. | 2206 | Inquire Installed Devices ID 0 to 7 since it only probes Logical |
2207 | Unit 0 of each Target Device. | ||
2043 | */ | 2208 | */ |
2044 | if (strcmp(HostAdapter->FirmwareVersion, "4.25") >= 0) { | 2209 | if (strcmp(adapter->fw_ver, "4.25") >= 0) { |
2045 | 2210 | ||
2046 | /* | 2211 | /* |
2047 | * Issue a Inquire Target Devices command. Inquire Target Devices only | 2212 | Issue a Inquire Target Devices command. Inquire Target |
2048 | * tests Logical Unit 0 of each Target Device unlike the Inquire Installed | 2213 | Devices only tests Logical Unit 0 of each Target Device |
2049 | * Devices commands which test Logical Units 0 - 7. Two bytes are | 2214 | unlike the Inquire Installed Devices commands which test |
2050 | * returned, where byte 0 bit 0 set indicates that Target Device 0 exists, | 2215 | Logical Units 0 - 7. Two bytes are returned, where byte |
2051 | * and so on. | 2216 | 0 bit 0 set indicates that Target Device 0 exists, and so on. |
2052 | */ | 2217 | */ |
2053 | 2218 | ||
2054 | if (BusLogic_Command(HostAdapter, BusLogic_InquireTargetDevices, NULL, 0, &InstalledDevices, sizeof(InstalledDevices)) | 2219 | if (blogic_cmd(adapter, BLOGIC_INQ_DEV, NULL, 0, |
2055 | != sizeof(InstalledDevices)) | 2220 | &installed_devs, sizeof(installed_devs)) |
2056 | return BusLogic_Failure(HostAdapter, "INQUIRE TARGET DEVICES"); | 2221 | != sizeof(installed_devs)) |
2057 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) | 2222 | return blogic_failure(adapter, "INQUIRE TARGET DEVICES"); |
2058 | HostAdapter->TargetFlags[TargetID].TargetExists = (InstalledDevices & (1 << TargetID) ? true : false); | 2223 | for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) |
2224 | adapter->tgt_flags[tgt_id].tgt_exists = | ||
2225 | (installed_devs & (1 << tgt_id) ? true : false); | ||
2059 | } else { | 2226 | } else { |
2060 | 2227 | ||
2061 | /* | 2228 | /* |
2062 | * Issue an Inquire Installed Devices command. For each Target Device, | 2229 | Issue an Inquire Installed Devices command. For each |
2063 | * a byte is returned where bit 0 set indicates that Logical Unit 0 | 2230 | Target Device, a byte is returned where bit 0 set |
2064 | * exists, bit 1 set indicates that Logical Unit 1 exists, and so on. | 2231 | indicates that Logical Unit 0 * exists, bit 1 set |
2232 | indicates that Logical Unit 1 exists, and so on. | ||
2065 | */ | 2233 | */ |
2066 | 2234 | ||
2067 | if (BusLogic_Command(HostAdapter, BusLogic_InquireInstalledDevicesID0to7, NULL, 0, &InstalledDevicesID0to7, sizeof(InstalledDevicesID0to7)) | 2235 | if (blogic_cmd(adapter, BLOGIC_INQ_DEV0TO7, NULL, 0, |
2068 | != sizeof(InstalledDevicesID0to7)) | 2236 | &installed_devs0to7, sizeof(installed_devs0to7)) |
2069 | return BusLogic_Failure(HostAdapter, "INQUIRE INSTALLED DEVICES ID 0 TO 7"); | 2237 | != sizeof(installed_devs0to7)) |
2070 | for (TargetID = 0; TargetID < 8; TargetID++) | 2238 | return blogic_failure(adapter, |
2071 | HostAdapter->TargetFlags[TargetID].TargetExists = (InstalledDevicesID0to7[TargetID] != 0 ? true : false); | 2239 | "INQUIRE INSTALLED DEVICES ID 0 TO 7"); |
2240 | for (tgt_id = 0; tgt_id < 8; tgt_id++) | ||
2241 | adapter->tgt_flags[tgt_id].tgt_exists = | ||
2242 | (installed_devs0to7[tgt_id] != 0 ? true : false); | ||
2072 | } | 2243 | } |
2073 | /* | 2244 | /* |
2074 | Issue the Inquire Setup Information command. | 2245 | Issue the Inquire Setup Information command. |
2075 | */ | 2246 | */ |
2076 | RequestedReplyLength = sizeof(SetupInformation); | 2247 | req_replylen = sizeof(setupinfo); |
2077 | if (BusLogic_Command(HostAdapter, BusLogic_InquireSetupInformation, &RequestedReplyLength, sizeof(RequestedReplyLength), &SetupInformation, sizeof(SetupInformation)) | 2248 | if (blogic_cmd(adapter, BLOGIC_INQ_SETUPINFO, &req_replylen, |
2078 | != sizeof(SetupInformation)) | 2249 | sizeof(req_replylen), &setupinfo, sizeof(setupinfo)) |
2079 | return BusLogic_Failure(HostAdapter, "INQUIRE SETUP INFORMATION"); | 2250 | != sizeof(setupinfo)) |
2080 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) | 2251 | return blogic_failure(adapter, "INQUIRE SETUP INFORMATION"); |
2081 | HostAdapter->SynchronousOffset[TargetID] = (TargetID < 8 ? SetupInformation.SynchronousValuesID0to7[TargetID].Offset : SetupInformation.SynchronousValuesID8to15[TargetID - 8].Offset); | 2252 | for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) |
2082 | if (strcmp(HostAdapter->FirmwareVersion, "5.06L") >= 0) | 2253 | adapter->sync_offset[tgt_id] = (tgt_id < 8 ? setupinfo.sync0to7[tgt_id].offset : setupinfo.sync8to15[tgt_id - 8].offset); |
2083 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) | 2254 | if (strcmp(adapter->fw_ver, "5.06L") >= 0) |
2084 | HostAdapter->TargetFlags[TargetID].WideTransfersActive = (TargetID < 8 ? (SetupInformation.WideTransfersActiveID0to7 & (1 << TargetID) | 2255 | for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) |
2085 | ? true : false) | 2256 | adapter->tgt_flags[tgt_id].wide_active = (tgt_id < 8 ? (setupinfo.wide_tx_active0to7 & (1 << tgt_id) ? true : false) : (setupinfo.wide_tx_active8to15 & (1 << (tgt_id - 8)) ? true : false)); |
2086 | : (SetupInformation.WideTransfersActiveID8to15 & (1 << (TargetID - 8)) | ||
2087 | ? true : false)); | ||
2088 | /* | 2257 | /* |
2089 | Issue the Inquire Synchronous Period command. | 2258 | Issue the Inquire Synchronous Period command. |
2090 | */ | 2259 | */ |
2091 | if (HostAdapter->FirmwareVersion[0] >= '3') { | 2260 | if (adapter->fw_ver[0] >= '3') { |
2092 | 2261 | ||
2093 | /* Issue a Inquire Synchronous Period command. For each Target Device, | 2262 | /* Issue a Inquire Synchronous Period command. For each |
2094 | * a byte is returned which represents the Synchronous Transfer Period | 2263 | Target Device, a byte is returned which represents the |
2095 | * in units of 10 nanoseconds. | 2264 | Synchronous Transfer Period in units of 10 nanoseconds. |
2096 | */ | 2265 | */ |
2097 | 2266 | ||
2098 | RequestedReplyLength = sizeof(SynchronousPeriod); | 2267 | req_replylen = sizeof(sync_period); |
2099 | if (BusLogic_Command(HostAdapter, BusLogic_InquireSynchronousPeriod, &RequestedReplyLength, sizeof(RequestedReplyLength), &SynchronousPeriod, sizeof(SynchronousPeriod)) | 2268 | if (blogic_cmd(adapter, BLOGIC_INQ_SYNC_PERIOD, &req_replylen, |
2100 | != sizeof(SynchronousPeriod)) | 2269 | sizeof(req_replylen), &sync_period, |
2101 | return BusLogic_Failure(HostAdapter, "INQUIRE SYNCHRONOUS PERIOD"); | 2270 | sizeof(sync_period)) != sizeof(sync_period)) |
2102 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) | 2271 | return blogic_failure(adapter, |
2103 | HostAdapter->SynchronousPeriod[TargetID] = SynchronousPeriod[TargetID]; | 2272 | "INQUIRE SYNCHRONOUS PERIOD"); |
2273 | for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) | ||
2274 | adapter->sync_period[tgt_id] = sync_period[tgt_id]; | ||
2104 | } else | 2275 | } else |
2105 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) | 2276 | for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) |
2106 | if (SetupInformation.SynchronousValuesID0to7[TargetID].Offset > 0) | 2277 | if (setupinfo.sync0to7[tgt_id].offset > 0) |
2107 | HostAdapter->SynchronousPeriod[TargetID] = 20 + 5 * SetupInformation.SynchronousValuesID0to7[TargetID] | 2278 | adapter->sync_period[tgt_id] = 20 + 5 * setupinfo.sync0to7[tgt_id].tx_period; |
2108 | .TransferPeriod; | ||
2109 | /* | 2279 | /* |
2110 | Indicate the Target Device Inquiry completed successfully. | 2280 | Indicate the Target Device Inquiry completed successfully. |
2111 | */ | 2281 | */ |
@@ -2113,7 +2283,7 @@ static bool __init BusLogic_TargetDeviceInquiry(struct BusLogic_HostAdapter | |||
2113 | } | 2283 | } |
2114 | 2284 | ||
2115 | /* | 2285 | /* |
2116 | BusLogic_InitializeHostStructure initializes the fields in the SCSI Host | 2286 | blogic_inithoststruct initializes the fields in the SCSI Host |
2117 | structure. The base, io_port, n_io_ports, irq, and dma_channel fields in the | 2287 | structure. The base, io_port, n_io_ports, irq, and dma_channel fields in the |
2118 | SCSI Host structure are intentionally left uninitialized, as this driver | 2288 | SCSI Host structure are intentionally left uninitialized, as this driver |
2119 | handles acquisition and release of these resources explicitly, as well as | 2289 | handles acquisition and release of these resources explicitly, as well as |
@@ -2121,517 +2291,555 @@ static bool __init BusLogic_TargetDeviceInquiry(struct BusLogic_HostAdapter | |||
2121 | through explicit acquisition and release of the Host Adapter's Lock. | 2291 | through explicit acquisition and release of the Host Adapter's Lock. |
2122 | */ | 2292 | */ |
2123 | 2293 | ||
2124 | static void __init BusLogic_InitializeHostStructure(struct BusLogic_HostAdapter | 2294 | static void __init blogic_inithoststruct(struct blogic_adapter *adapter, |
2125 | *HostAdapter, struct Scsi_Host *Host) | 2295 | struct Scsi_Host *host) |
2126 | { | 2296 | { |
2127 | Host->max_id = HostAdapter->MaxTargetDevices; | 2297 | host->max_id = adapter->maxdev; |
2128 | Host->max_lun = HostAdapter->MaxLogicalUnits; | 2298 | host->max_lun = adapter->maxlun; |
2129 | Host->max_channel = 0; | 2299 | host->max_channel = 0; |
2130 | Host->unique_id = HostAdapter->IO_Address; | 2300 | host->unique_id = adapter->io_addr; |
2131 | Host->this_id = HostAdapter->SCSI_ID; | 2301 | host->this_id = adapter->scsi_id; |
2132 | Host->can_queue = HostAdapter->DriverQueueDepth; | 2302 | host->can_queue = adapter->drvr_qdepth; |
2133 | Host->sg_tablesize = HostAdapter->DriverScatterGatherLimit; | 2303 | host->sg_tablesize = adapter->drvr_sglimit; |
2134 | Host->unchecked_isa_dma = HostAdapter->BounceBuffersRequired; | 2304 | host->unchecked_isa_dma = adapter->need_bouncebuf; |
2135 | Host->cmd_per_lun = HostAdapter->UntaggedQueueDepth; | 2305 | host->cmd_per_lun = adapter->untag_qdepth; |
2136 | } | 2306 | } |
2137 | 2307 | ||
2138 | /* | 2308 | /* |
2139 | BusLogic_SlaveConfigure will actually set the queue depth on individual | 2309 | blogic_slaveconfig will actually set the queue depth on individual |
2140 | scsi devices as they are permanently added to the device chain. We | 2310 | scsi devices as they are permanently added to the device chain. We |
2141 | shamelessly rip off the SelectQueueDepths code to make this work mostly | 2311 | shamelessly rip off the SelectQueueDepths code to make this work mostly |
2142 | like it used to. Since we don't get called once at the end of the scan | 2312 | like it used to. Since we don't get called once at the end of the scan |
2143 | but instead get called for each device, we have to do things a bit | 2313 | but instead get called for each device, we have to do things a bit |
2144 | differently. | 2314 | differently. |
2145 | */ | 2315 | */ |
2146 | static int BusLogic_SlaveConfigure(struct scsi_device *Device) | 2316 | static int blogic_slaveconfig(struct scsi_device *dev) |
2147 | { | 2317 | { |
2148 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Device->host->hostdata; | 2318 | struct blogic_adapter *adapter = |
2149 | int TargetID = Device->id; | 2319 | (struct blogic_adapter *) dev->host->hostdata; |
2150 | int QueueDepth = HostAdapter->QueueDepth[TargetID]; | 2320 | int tgt_id = dev->id; |
2151 | 2321 | int qdepth = adapter->qdepth[tgt_id]; | |
2152 | if (HostAdapter->TargetFlags[TargetID].TaggedQueuingSupported && (HostAdapter->TaggedQueuingPermitted & (1 << TargetID))) { | 2322 | |
2153 | if (QueueDepth == 0) | 2323 | if (adapter->tgt_flags[tgt_id].tagq_ok && |
2154 | QueueDepth = BusLogic_MaxAutomaticTaggedQueueDepth; | 2324 | (adapter->tagq_ok & (1 << tgt_id))) { |
2155 | HostAdapter->QueueDepth[TargetID] = QueueDepth; | 2325 | if (qdepth == 0) |
2156 | scsi_adjust_queue_depth(Device, MSG_SIMPLE_TAG, QueueDepth); | 2326 | qdepth = BLOGIC_MAX_AUTO_TAG_DEPTH; |
2327 | adapter->qdepth[tgt_id] = qdepth; | ||
2328 | scsi_adjust_queue_depth(dev, MSG_SIMPLE_TAG, qdepth); | ||
2157 | } else { | 2329 | } else { |
2158 | HostAdapter->TaggedQueuingPermitted &= ~(1 << TargetID); | 2330 | adapter->tagq_ok &= ~(1 << tgt_id); |
2159 | QueueDepth = HostAdapter->UntaggedQueueDepth; | 2331 | qdepth = adapter->untag_qdepth; |
2160 | HostAdapter->QueueDepth[TargetID] = QueueDepth; | 2332 | adapter->qdepth[tgt_id] = qdepth; |
2161 | scsi_adjust_queue_depth(Device, 0, QueueDepth); | 2333 | scsi_adjust_queue_depth(dev, 0, qdepth); |
2162 | } | 2334 | } |
2163 | QueueDepth = 0; | 2335 | qdepth = 0; |
2164 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) | 2336 | for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) |
2165 | if (HostAdapter->TargetFlags[TargetID].TargetExists) { | 2337 | if (adapter->tgt_flags[tgt_id].tgt_exists) |
2166 | QueueDepth += HostAdapter->QueueDepth[TargetID]; | 2338 | qdepth += adapter->qdepth[tgt_id]; |
2167 | } | 2339 | if (qdepth > adapter->alloc_ccbs) |
2168 | if (QueueDepth > HostAdapter->AllocatedCCBs) | 2340 | blogic_create_addlccbs(adapter, qdepth - adapter->alloc_ccbs, |
2169 | BusLogic_CreateAdditionalCCBs(HostAdapter, QueueDepth - HostAdapter->AllocatedCCBs, false); | 2341 | false); |
2170 | return 0; | 2342 | return 0; |
2171 | } | 2343 | } |
2172 | 2344 | ||
2173 | /* | 2345 | /* |
2174 | BusLogic_DetectHostAdapter probes for BusLogic Host Adapters at the standard | 2346 | blogic_init probes for BusLogic Host Adapters at the standard |
2175 | I/O Addresses where they may be located, initializing, registering, and | 2347 | I/O Addresses where they may be located, initializing, registering, and |
2176 | reporting the configuration of each BusLogic Host Adapter it finds. It | 2348 | reporting the configuration of each BusLogic Host Adapter it finds. It |
2177 | returns the number of BusLogic Host Adapters successfully initialized and | 2349 | returns the number of BusLogic Host Adapters successfully initialized and |
2178 | registered. | 2350 | registered. |
2179 | */ | 2351 | */ |
2180 | 2352 | ||
2181 | static int __init BusLogic_init(void) | 2353 | static int __init blogic_init(void) |
2182 | { | 2354 | { |
2183 | int BusLogicHostAdapterCount = 0, DriverOptionsIndex = 0, ProbeIndex; | 2355 | int adapter_count = 0, drvr_optindex = 0, probeindex; |
2184 | struct BusLogic_HostAdapter *PrototypeHostAdapter; | 2356 | struct blogic_adapter *adapter; |
2185 | int ret = 0; | 2357 | int ret = 0; |
2186 | 2358 | ||
2187 | #ifdef MODULE | 2359 | #ifdef MODULE |
2188 | if (BusLogic) | 2360 | if (BusLogic) |
2189 | BusLogic_Setup(BusLogic); | 2361 | blogic_setup(BusLogic); |
2190 | #endif | 2362 | #endif |
2191 | 2363 | ||
2192 | if (BusLogic_ProbeOptions.NoProbe) | 2364 | if (blogic_probe_options.noprobe) |
2193 | return -ENODEV; | 2365 | return -ENODEV; |
2194 | BusLogic_ProbeInfoList = | 2366 | blogic_probeinfo_list = |
2195 | kzalloc(BusLogic_MaxHostAdapters * sizeof(struct BusLogic_ProbeInfo), GFP_KERNEL); | 2367 | kzalloc(BLOGIC_MAX_ADAPTERS * sizeof(struct blogic_probeinfo), |
2196 | if (BusLogic_ProbeInfoList == NULL) { | 2368 | GFP_KERNEL); |
2197 | BusLogic_Error("BusLogic: Unable to allocate Probe Info List\n", NULL); | 2369 | if (blogic_probeinfo_list == NULL) { |
2370 | blogic_err("BusLogic: Unable to allocate Probe Info List\n", | ||
2371 | NULL); | ||
2198 | return -ENOMEM; | 2372 | return -ENOMEM; |
2199 | } | 2373 | } |
2200 | 2374 | ||
2201 | PrototypeHostAdapter = | 2375 | adapter = kzalloc(sizeof(struct blogic_adapter), GFP_KERNEL); |
2202 | kzalloc(sizeof(struct BusLogic_HostAdapter), GFP_KERNEL); | 2376 | if (adapter == NULL) { |
2203 | if (PrototypeHostAdapter == NULL) { | 2377 | kfree(blogic_probeinfo_list); |
2204 | kfree(BusLogic_ProbeInfoList); | 2378 | blogic_err("BusLogic: Unable to allocate Prototype Host Adapter\n", NULL); |
2205 | BusLogic_Error("BusLogic: Unable to allocate Prototype " "Host Adapter\n", NULL); | ||
2206 | return -ENOMEM; | 2379 | return -ENOMEM; |
2207 | } | 2380 | } |
2208 | 2381 | ||
2209 | #ifdef MODULE | 2382 | #ifdef MODULE |
2210 | if (BusLogic != NULL) | 2383 | if (BusLogic != NULL) |
2211 | BusLogic_Setup(BusLogic); | 2384 | blogic_setup(BusLogic); |
2212 | #endif | 2385 | #endif |
2213 | BusLogic_InitializeProbeInfoList(PrototypeHostAdapter); | 2386 | blogic_init_probeinfo_list(adapter); |
2214 | for (ProbeIndex = 0; ProbeIndex < BusLogic_ProbeInfoCount; ProbeIndex++) { | 2387 | for (probeindex = 0; probeindex < blogic_probeinfo_count; probeindex++) { |
2215 | struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[ProbeIndex]; | 2388 | struct blogic_probeinfo *probeinfo = |
2216 | struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter; | 2389 | &blogic_probeinfo_list[probeindex]; |
2217 | struct Scsi_Host *Host; | 2390 | struct blogic_adapter *myadapter = adapter; |
2218 | if (ProbeInfo->IO_Address == 0) | 2391 | struct Scsi_Host *host; |
2392 | |||
2393 | if (probeinfo->io_addr == 0) | ||
2219 | continue; | 2394 | continue; |
2220 | memset(HostAdapter, 0, sizeof(struct BusLogic_HostAdapter)); | 2395 | memset(myadapter, 0, sizeof(struct blogic_adapter)); |
2221 | HostAdapter->HostAdapterType = ProbeInfo->HostAdapterType; | 2396 | myadapter->adapter_type = probeinfo->adapter_type; |
2222 | HostAdapter->HostAdapterBusType = ProbeInfo->HostAdapterBusType; | 2397 | myadapter->adapter_bus_type = probeinfo->adapter_bus_type; |
2223 | HostAdapter->IO_Address = ProbeInfo->IO_Address; | 2398 | myadapter->io_addr = probeinfo->io_addr; |
2224 | HostAdapter->PCI_Address = ProbeInfo->PCI_Address; | 2399 | myadapter->pci_addr = probeinfo->pci_addr; |
2225 | HostAdapter->Bus = ProbeInfo->Bus; | 2400 | myadapter->bus = probeinfo->bus; |
2226 | HostAdapter->Device = ProbeInfo->Device; | 2401 | myadapter->dev = probeinfo->dev; |
2227 | HostAdapter->PCI_Device = ProbeInfo->PCI_Device; | 2402 | myadapter->pci_device = probeinfo->pci_device; |
2228 | HostAdapter->IRQ_Channel = ProbeInfo->IRQ_Channel; | 2403 | myadapter->irq_ch = probeinfo->irq_ch; |
2229 | HostAdapter->AddressCount = BusLogic_HostAdapterAddressCount[HostAdapter->HostAdapterType]; | 2404 | myadapter->addr_count = |
2405 | blogic_adapter_addr_count[myadapter->adapter_type]; | ||
2230 | 2406 | ||
2231 | /* | 2407 | /* |
2232 | Make sure region is free prior to probing. | 2408 | Make sure region is free prior to probing. |
2233 | */ | 2409 | */ |
2234 | if (!request_region(HostAdapter->IO_Address, HostAdapter->AddressCount, | 2410 | if (!request_region(myadapter->io_addr, myadapter->addr_count, |
2235 | "BusLogic")) | 2411 | "BusLogic")) |
2236 | continue; | 2412 | continue; |
2237 | /* | 2413 | /* |
2238 | Probe the Host Adapter. If unsuccessful, abort further initialization. | 2414 | Probe the Host Adapter. If unsuccessful, abort further |
2415 | initialization. | ||
2239 | */ | 2416 | */ |
2240 | if (!BusLogic_ProbeHostAdapter(HostAdapter)) { | 2417 | if (!blogic_probe(myadapter)) { |
2241 | release_region(HostAdapter->IO_Address, HostAdapter->AddressCount); | 2418 | release_region(myadapter->io_addr, |
2419 | myadapter->addr_count); | ||
2242 | continue; | 2420 | continue; |
2243 | } | 2421 | } |
2244 | /* | 2422 | /* |
2245 | Hard Reset the Host Adapter. If unsuccessful, abort further | 2423 | Hard Reset the Host Adapter. If unsuccessful, abort further |
2246 | initialization. | 2424 | initialization. |
2247 | */ | 2425 | */ |
2248 | if (!BusLogic_HardwareResetHostAdapter(HostAdapter, true)) { | 2426 | if (!blogic_hwreset(myadapter, true)) { |
2249 | release_region(HostAdapter->IO_Address, HostAdapter->AddressCount); | 2427 | release_region(myadapter->io_addr, |
2428 | myadapter->addr_count); | ||
2250 | continue; | 2429 | continue; |
2251 | } | 2430 | } |
2252 | /* | 2431 | /* |
2253 | Check the Host Adapter. If unsuccessful, abort further initialization. | 2432 | Check the Host Adapter. If unsuccessful, abort further |
2433 | initialization. | ||
2254 | */ | 2434 | */ |
2255 | if (!BusLogic_CheckHostAdapter(HostAdapter)) { | 2435 | if (!blogic_checkadapter(myadapter)) { |
2256 | release_region(HostAdapter->IO_Address, HostAdapter->AddressCount); | 2436 | release_region(myadapter->io_addr, |
2437 | myadapter->addr_count); | ||
2257 | continue; | 2438 | continue; |
2258 | } | 2439 | } |
2259 | /* | 2440 | /* |
2260 | Initialize the Driver Options field if provided. | 2441 | Initialize the Driver Options field if provided. |
2261 | */ | 2442 | */ |
2262 | if (DriverOptionsIndex < BusLogic_DriverOptionsCount) | 2443 | if (drvr_optindex < blogic_drvr_options_count) |
2263 | HostAdapter->DriverOptions = &BusLogic_DriverOptions[DriverOptionsIndex++]; | 2444 | myadapter->drvr_opts = |
2445 | &blogic_drvr_options[drvr_optindex++]; | ||
2264 | /* | 2446 | /* |
2265 | Announce the Driver Version and Date, Author's Name, Copyright Notice, | 2447 | Announce the Driver Version and Date, Author's Name, |
2266 | and Electronic Mail Address. | 2448 | Copyright Notice, and Electronic Mail Address. |
2267 | */ | 2449 | */ |
2268 | BusLogic_AnnounceDriver(HostAdapter); | 2450 | blogic_announce_drvr(myadapter); |
2269 | /* | 2451 | /* |
2270 | Register the SCSI Host structure. | 2452 | Register the SCSI Host structure. |
2271 | */ | 2453 | */ |
2272 | 2454 | ||
2273 | Host = scsi_host_alloc(&Bus_Logic_template, sizeof(struct BusLogic_HostAdapter)); | 2455 | host = scsi_host_alloc(&blogic_template, |
2274 | if (Host == NULL) { | 2456 | sizeof(struct blogic_adapter)); |
2275 | release_region(HostAdapter->IO_Address, HostAdapter->AddressCount); | 2457 | if (host == NULL) { |
2458 | release_region(myadapter->io_addr, | ||
2459 | myadapter->addr_count); | ||
2276 | continue; | 2460 | continue; |
2277 | } | 2461 | } |
2278 | HostAdapter = (struct BusLogic_HostAdapter *) Host->hostdata; | 2462 | myadapter = (struct blogic_adapter *) host->hostdata; |
2279 | memcpy(HostAdapter, PrototypeHostAdapter, sizeof(struct BusLogic_HostAdapter)); | 2463 | memcpy(myadapter, adapter, sizeof(struct blogic_adapter)); |
2280 | HostAdapter->SCSI_Host = Host; | 2464 | myadapter->scsi_host = host; |
2281 | HostAdapter->HostNumber = Host->host_no; | 2465 | myadapter->host_no = host->host_no; |
2282 | /* | 2466 | /* |
2283 | Add Host Adapter to the end of the list of registered BusLogic | 2467 | Add Host Adapter to the end of the list of registered |
2284 | Host Adapters. | 2468 | BusLogic Host Adapters. |
2285 | */ | 2469 | */ |
2286 | list_add_tail(&HostAdapter->host_list, &BusLogic_host_list); | 2470 | list_add_tail(&myadapter->host_list, &blogic_host_list); |
2287 | 2471 | ||
2288 | /* | 2472 | /* |
2289 | Read the Host Adapter Configuration, Configure the Host Adapter, | 2473 | Read the Host Adapter Configuration, Configure the Host |
2290 | Acquire the System Resources necessary to use the Host Adapter, then | 2474 | Adapter, Acquire the System Resources necessary to use |
2291 | Create the Initial CCBs, Initialize the Host Adapter, and finally | 2475 | the Host Adapter, then Create the Initial CCBs, Initialize |
2292 | perform Target Device Inquiry. | 2476 | the Host Adapter, and finally perform Target Device |
2293 | 2477 | Inquiry. From this point onward, any failure will be | |
2294 | From this point onward, any failure will be assumed to be due to a | 2478 | assumed to be due to a problem with the Host Adapter, |
2295 | problem with the Host Adapter, rather than due to having mistakenly | 2479 | rather than due to having mistakenly identified this port |
2296 | identified this port as belonging to a BusLogic Host Adapter. The | 2480 | as belonging to a BusLogic Host Adapter. The I/O Address |
2297 | I/O Address range will not be released, thereby preventing it from | 2481 | range will not be released, thereby preventing it from |
2298 | being incorrectly identified as any other type of Host Adapter. | 2482 | being incorrectly identified as any other type of Host |
2483 | Adapter. | ||
2299 | */ | 2484 | */ |
2300 | if (BusLogic_ReadHostAdapterConfiguration(HostAdapter) && | 2485 | if (blogic_rdconfig(myadapter) && |
2301 | BusLogic_ReportHostAdapterConfiguration(HostAdapter) && | 2486 | blogic_reportconfig(myadapter) && |
2302 | BusLogic_AcquireResources(HostAdapter) && | 2487 | blogic_getres(myadapter) && |
2303 | BusLogic_CreateInitialCCBs(HostAdapter) && | 2488 | blogic_create_initccbs(myadapter) && |
2304 | BusLogic_InitializeHostAdapter(HostAdapter) && | 2489 | blogic_initadapter(myadapter) && |
2305 | BusLogic_TargetDeviceInquiry(HostAdapter)) { | 2490 | blogic_inquiry(myadapter)) { |
2306 | /* | 2491 | /* |
2307 | Initialization has been completed successfully. Release and | 2492 | Initialization has been completed successfully. |
2308 | re-register usage of the I/O Address range so that the Model | 2493 | Release and re-register usage of the I/O Address |
2309 | Name of the Host Adapter will appear, and initialize the SCSI | 2494 | range so that the Model Name of the Host Adapter |
2310 | Host structure. | 2495 | will appear, and initialize the SCSI Host structure. |
2311 | */ | 2496 | */ |
2312 | release_region(HostAdapter->IO_Address, | 2497 | release_region(myadapter->io_addr, |
2313 | HostAdapter->AddressCount); | 2498 | myadapter->addr_count); |
2314 | if (!request_region(HostAdapter->IO_Address, | 2499 | if (!request_region(myadapter->io_addr, |
2315 | HostAdapter->AddressCount, | 2500 | myadapter->addr_count, |
2316 | HostAdapter->FullModelName)) { | 2501 | myadapter->full_model)) { |
2317 | printk(KERN_WARNING | 2502 | printk(KERN_WARNING |
2318 | "BusLogic: Release and re-register of " | 2503 | "BusLogic: Release and re-register of " |
2319 | "port 0x%04lx failed \n", | 2504 | "port 0x%04lx failed \n", |
2320 | (unsigned long)HostAdapter->IO_Address); | 2505 | (unsigned long)myadapter->io_addr); |
2321 | BusLogic_DestroyCCBs(HostAdapter); | 2506 | blogic_destroy_ccbs(myadapter); |
2322 | BusLogic_ReleaseResources(HostAdapter); | 2507 | blogic_relres(myadapter); |
2323 | list_del(&HostAdapter->host_list); | 2508 | list_del(&myadapter->host_list); |
2324 | scsi_host_put(Host); | 2509 | scsi_host_put(host); |
2325 | ret = -ENOMEM; | 2510 | ret = -ENOMEM; |
2326 | } else { | 2511 | } else { |
2327 | BusLogic_InitializeHostStructure(HostAdapter, | 2512 | blogic_inithoststruct(myadapter, |
2328 | Host); | 2513 | host); |
2329 | if (scsi_add_host(Host, HostAdapter->PCI_Device | 2514 | if (scsi_add_host(host, myadapter->pci_device |
2330 | ? &HostAdapter->PCI_Device->dev | 2515 | ? &myadapter->pci_device->dev |
2331 | : NULL)) { | 2516 | : NULL)) { |
2332 | printk(KERN_WARNING | 2517 | printk(KERN_WARNING |
2333 | "BusLogic: scsi_add_host()" | 2518 | "BusLogic: scsi_add_host()" |
2334 | "failed!\n"); | 2519 | "failed!\n"); |
2335 | BusLogic_DestroyCCBs(HostAdapter); | 2520 | blogic_destroy_ccbs(myadapter); |
2336 | BusLogic_ReleaseResources(HostAdapter); | 2521 | blogic_relres(myadapter); |
2337 | list_del(&HostAdapter->host_list); | 2522 | list_del(&myadapter->host_list); |
2338 | scsi_host_put(Host); | 2523 | scsi_host_put(host); |
2339 | ret = -ENODEV; | 2524 | ret = -ENODEV; |
2340 | } else { | 2525 | } else { |
2341 | scsi_scan_host(Host); | 2526 | scsi_scan_host(host); |
2342 | BusLogicHostAdapterCount++; | 2527 | adapter_count++; |
2343 | } | 2528 | } |
2344 | } | 2529 | } |
2345 | } else { | 2530 | } else { |
2346 | /* | 2531 | /* |
2347 | An error occurred during Host Adapter Configuration Querying, Host | 2532 | An error occurred during Host Adapter Configuration |
2348 | Adapter Configuration, Resource Acquisition, CCB Creation, Host | 2533 | Querying, Host Adapter Configuration, Resource |
2349 | Adapter Initialization, or Target Device Inquiry, so remove Host | 2534 | Acquisition, CCB Creation, Host Adapter |
2350 | Adapter from the list of registered BusLogic Host Adapters, destroy | 2535 | Initialization, or Target Device Inquiry, so |
2351 | the CCBs, Release the System Resources, and Unregister the SCSI | 2536 | remove Host Adapter from the list of registered |
2537 | BusLogic Host Adapters, destroy the CCBs, Release | ||
2538 | the System Resources, and Unregister the SCSI | ||
2352 | Host. | 2539 | Host. |
2353 | */ | 2540 | */ |
2354 | BusLogic_DestroyCCBs(HostAdapter); | 2541 | blogic_destroy_ccbs(myadapter); |
2355 | BusLogic_ReleaseResources(HostAdapter); | 2542 | blogic_relres(myadapter); |
2356 | list_del(&HostAdapter->host_list); | 2543 | list_del(&myadapter->host_list); |
2357 | scsi_host_put(Host); | 2544 | scsi_host_put(host); |
2358 | ret = -ENODEV; | 2545 | ret = -ENODEV; |
2359 | } | 2546 | } |
2360 | } | 2547 | } |
2361 | kfree(PrototypeHostAdapter); | 2548 | kfree(adapter); |
2362 | kfree(BusLogic_ProbeInfoList); | 2549 | kfree(blogic_probeinfo_list); |
2363 | BusLogic_ProbeInfoList = NULL; | 2550 | blogic_probeinfo_list = NULL; |
2364 | return ret; | 2551 | return ret; |
2365 | } | 2552 | } |
2366 | 2553 | ||
2367 | 2554 | ||
2368 | /* | 2555 | /* |
2369 | BusLogic_ReleaseHostAdapter releases all resources previously acquired to | 2556 | blogic_deladapter releases all resources previously acquired to |
2370 | support a specific Host Adapter, including the I/O Address range, and | 2557 | support a specific Host Adapter, including the I/O Address range, and |
2371 | unregisters the BusLogic Host Adapter. | 2558 | unregisters the BusLogic Host Adapter. |
2372 | */ | 2559 | */ |
2373 | 2560 | ||
2374 | static int __exit BusLogic_ReleaseHostAdapter(struct BusLogic_HostAdapter *HostAdapter) | 2561 | static int __exit blogic_deladapter(struct blogic_adapter *adapter) |
2375 | { | 2562 | { |
2376 | struct Scsi_Host *Host = HostAdapter->SCSI_Host; | 2563 | struct Scsi_Host *host = adapter->scsi_host; |
2377 | 2564 | ||
2378 | scsi_remove_host(Host); | 2565 | scsi_remove_host(host); |
2379 | 2566 | ||
2380 | /* | 2567 | /* |
2381 | FlashPoint Host Adapters must first be released by the FlashPoint | 2568 | FlashPoint Host Adapters must first be released by the FlashPoint |
2382 | SCCB Manager. | 2569 | SCCB Manager. |
2383 | */ | 2570 | */ |
2384 | if (BusLogic_FlashPointHostAdapterP(HostAdapter)) | 2571 | if (blogic_flashpoint_type(adapter)) |
2385 | FlashPoint_ReleaseHostAdapter(HostAdapter->CardHandle); | 2572 | FlashPoint_ReleaseHostAdapter(adapter->cardhandle); |
2386 | /* | 2573 | /* |
2387 | Destroy the CCBs and release any system resources acquired to | 2574 | Destroy the CCBs and release any system resources acquired to |
2388 | support Host Adapter. | 2575 | support Host Adapter. |
2389 | */ | 2576 | */ |
2390 | BusLogic_DestroyCCBs(HostAdapter); | 2577 | blogic_destroy_ccbs(adapter); |
2391 | BusLogic_ReleaseResources(HostAdapter); | 2578 | blogic_relres(adapter); |
2392 | /* | 2579 | /* |
2393 | Release usage of the I/O Address range. | 2580 | Release usage of the I/O Address range. |
2394 | */ | 2581 | */ |
2395 | release_region(HostAdapter->IO_Address, HostAdapter->AddressCount); | 2582 | release_region(adapter->io_addr, adapter->addr_count); |
2396 | /* | 2583 | /* |
2397 | Remove Host Adapter from the list of registered BusLogic Host Adapters. | 2584 | Remove Host Adapter from the list of registered BusLogic |
2585 | Host Adapters. | ||
2398 | */ | 2586 | */ |
2399 | list_del(&HostAdapter->host_list); | 2587 | list_del(&adapter->host_list); |
2400 | 2588 | ||
2401 | scsi_host_put(Host); | 2589 | scsi_host_put(host); |
2402 | return 0; | 2590 | return 0; |
2403 | } | 2591 | } |
2404 | 2592 | ||
2405 | 2593 | ||
2406 | /* | 2594 | /* |
2407 | BusLogic_QueueCompletedCCB queues CCB for completion processing. | 2595 | blogic_qcompleted_ccb queues CCB for completion processing. |
2408 | */ | 2596 | */ |
2409 | 2597 | ||
2410 | static void BusLogic_QueueCompletedCCB(struct BusLogic_CCB *CCB) | 2598 | static void blogic_qcompleted_ccb(struct blogic_ccb *ccb) |
2411 | { | 2599 | { |
2412 | struct BusLogic_HostAdapter *HostAdapter = CCB->HostAdapter; | 2600 | struct blogic_adapter *adapter = ccb->adapter; |
2413 | CCB->Status = BusLogic_CCB_Completed; | 2601 | |
2414 | CCB->Next = NULL; | 2602 | ccb->status = BLOGIC_CCB_COMPLETE; |
2415 | if (HostAdapter->FirstCompletedCCB == NULL) { | 2603 | ccb->next = NULL; |
2416 | HostAdapter->FirstCompletedCCB = CCB; | 2604 | if (adapter->firstccb == NULL) { |
2417 | HostAdapter->LastCompletedCCB = CCB; | 2605 | adapter->firstccb = ccb; |
2606 | adapter->lastccb = ccb; | ||
2418 | } else { | 2607 | } else { |
2419 | HostAdapter->LastCompletedCCB->Next = CCB; | 2608 | adapter->lastccb->next = ccb; |
2420 | HostAdapter->LastCompletedCCB = CCB; | 2609 | adapter->lastccb = ccb; |
2421 | } | 2610 | } |
2422 | HostAdapter->ActiveCommands[CCB->TargetID]--; | 2611 | adapter->active_cmds[ccb->tgt_id]--; |
2423 | } | 2612 | } |
2424 | 2613 | ||
2425 | 2614 | ||
2426 | /* | 2615 | /* |
2427 | BusLogic_ComputeResultCode computes a SCSI Subsystem Result Code from | 2616 | blogic_resultcode computes a SCSI Subsystem Result Code from |
2428 | the Host Adapter Status and Target Device Status. | 2617 | the Host Adapter Status and Target Device Status. |
2429 | */ | 2618 | */ |
2430 | 2619 | ||
2431 | static int BusLogic_ComputeResultCode(struct BusLogic_HostAdapter *HostAdapter, enum BusLogic_HostAdapterStatus HostAdapterStatus, enum BusLogic_TargetDeviceStatus TargetDeviceStatus) | 2620 | static int blogic_resultcode(struct blogic_adapter *adapter, |
2621 | enum blogic_adapter_status adapter_status, | ||
2622 | enum blogic_tgt_status tgt_status) | ||
2432 | { | 2623 | { |
2433 | int HostStatus; | 2624 | int hoststatus; |
2434 | switch (HostAdapterStatus) { | 2625 | |
2435 | case BusLogic_CommandCompletedNormally: | 2626 | switch (adapter_status) { |
2436 | case BusLogic_LinkedCommandCompleted: | 2627 | case BLOGIC_CMD_CMPLT_NORMAL: |
2437 | case BusLogic_LinkedCommandCompletedWithFlag: | 2628 | case BLOGIC_LINK_CMD_CMPLT: |
2438 | HostStatus = DID_OK; | 2629 | case BLOGIC_LINK_CMD_CMPLT_FLAG: |
2630 | hoststatus = DID_OK; | ||
2439 | break; | 2631 | break; |
2440 | case BusLogic_SCSISelectionTimeout: | 2632 | case BLOGIC_SELECT_TIMEOUT: |
2441 | HostStatus = DID_TIME_OUT; | 2633 | hoststatus = DID_TIME_OUT; |
2442 | break; | 2634 | break; |
2443 | case BusLogic_InvalidOutgoingMailboxActionCode: | 2635 | case BLOGIC_INVALID_OUTBOX_CODE: |
2444 | case BusLogic_InvalidCommandOperationCode: | 2636 | case BLOGIC_INVALID_CMD_CODE: |
2445 | case BusLogic_InvalidCommandParameter: | 2637 | case BLOGIC_BAD_CMD_PARAM: |
2446 | BusLogic_Warning("BusLogic Driver Protocol Error 0x%02X\n", HostAdapter, HostAdapterStatus); | 2638 | blogic_warn("BusLogic Driver Protocol Error 0x%02X\n", |
2447 | case BusLogic_DataUnderRun: | 2639 | adapter, adapter_status); |
2448 | case BusLogic_DataOverRun: | 2640 | case BLOGIC_DATA_UNDERRUN: |
2449 | case BusLogic_UnexpectedBusFree: | 2641 | case BLOGIC_DATA_OVERRUN: |
2450 | case BusLogic_LinkedCCBhasInvalidLUN: | 2642 | case BLOGIC_NOEXPECT_BUSFREE: |
2451 | case BusLogic_AutoRequestSenseFailed: | 2643 | case BLOGIC_LINKCCB_BADLUN: |
2452 | case BusLogic_TaggedQueuingMessageRejected: | 2644 | case BLOGIC_AUTOREQSENSE_FAIL: |
2453 | case BusLogic_UnsupportedMessageReceived: | 2645 | case BLOGIC_TAGQUEUE_REJECT: |
2454 | case BusLogic_HostAdapterHardwareFailed: | 2646 | case BLOGIC_BAD_MSG_RCVD: |
2455 | case BusLogic_TargetDeviceReconnectedImproperly: | 2647 | case BLOGIC_HW_FAIL: |
2456 | case BusLogic_AbortQueueGenerated: | 2648 | case BLOGIC_BAD_RECONNECT: |
2457 | case BusLogic_HostAdapterSoftwareError: | 2649 | case BLOGIC_ABRT_QUEUE: |
2458 | case BusLogic_HostAdapterHardwareTimeoutError: | 2650 | case BLOGIC_ADAPTER_SW_ERROR: |
2459 | case BusLogic_SCSIParityErrorDetected: | 2651 | case BLOGIC_HW_TIMEOUT: |
2460 | HostStatus = DID_ERROR; | 2652 | case BLOGIC_PARITY_ERR: |
2653 | hoststatus = DID_ERROR; | ||
2461 | break; | 2654 | break; |
2462 | case BusLogic_InvalidBusPhaseRequested: | 2655 | case BLOGIC_INVALID_BUSPHASE: |
2463 | case BusLogic_TargetFailedResponseToATN: | 2656 | case BLOGIC_NORESPONSE_TO_ATN: |
2464 | case BusLogic_HostAdapterAssertedRST: | 2657 | case BLOGIC_HW_RESET: |
2465 | case BusLogic_OtherDeviceAssertedRST: | 2658 | case BLOGIC_RST_FROM_OTHERDEV: |
2466 | case BusLogic_HostAdapterAssertedBusDeviceReset: | 2659 | case BLOGIC_HW_BDR: |
2467 | HostStatus = DID_RESET; | 2660 | hoststatus = DID_RESET; |
2468 | break; | 2661 | break; |
2469 | default: | 2662 | default: |
2470 | BusLogic_Warning("Unknown Host Adapter Status 0x%02X\n", HostAdapter, HostAdapterStatus); | 2663 | blogic_warn("Unknown Host Adapter Status 0x%02X\n", adapter, |
2471 | HostStatus = DID_ERROR; | 2664 | adapter_status); |
2665 | hoststatus = DID_ERROR; | ||
2472 | break; | 2666 | break; |
2473 | } | 2667 | } |
2474 | return (HostStatus << 16) | TargetDeviceStatus; | 2668 | return (hoststatus << 16) | tgt_status; |
2475 | } | 2669 | } |
2476 | 2670 | ||
2477 | 2671 | ||
2478 | /* | 2672 | /* |
2479 | BusLogic_ScanIncomingMailboxes scans the Incoming Mailboxes saving any | 2673 | blogic_scan_inbox scans the Incoming Mailboxes saving any |
2480 | Incoming Mailbox entries for completion processing. | 2674 | Incoming Mailbox entries for completion processing. |
2481 | */ | 2675 | */ |
2482 | 2676 | ||
2483 | static void BusLogic_ScanIncomingMailboxes(struct BusLogic_HostAdapter *HostAdapter) | 2677 | static void blogic_scan_inbox(struct blogic_adapter *adapter) |
2484 | { | 2678 | { |
2485 | /* | 2679 | /* |
2486 | Scan through the Incoming Mailboxes in Strict Round Robin fashion, saving | 2680 | Scan through the Incoming Mailboxes in Strict Round Robin |
2487 | any completed CCBs for further processing. It is essential that for each | 2681 | fashion, saving any completed CCBs for further processing. It |
2488 | CCB and SCSI Command issued, command completion processing is performed | 2682 | is essential that for each CCB and SCSI Command issued, command |
2489 | exactly once. Therefore, only Incoming Mailboxes with completion code | 2683 | completion processing is performed exactly once. Therefore, |
2490 | Command Completed Without Error, Command Completed With Error, or Command | 2684 | only Incoming Mailboxes with completion code Command Completed |
2491 | Aborted At Host Request are saved for completion processing. When an | 2685 | Without Error, Command Completed With Error, or Command Aborted |
2492 | Incoming Mailbox has a completion code of Aborted Command Not Found, the | 2686 | At Host Request are saved for completion processing. When an |
2493 | CCB had already completed or been aborted before the current Abort request | 2687 | Incoming Mailbox has a completion code of Aborted Command Not |
2494 | was processed, and so completion processing has already occurred and no | 2688 | Found, the CCB had already completed or been aborted before the |
2495 | further action should be taken. | 2689 | current Abort request was processed, and so completion processing |
2496 | */ | 2690 | has already occurred and no further action should be taken. |
2497 | struct BusLogic_IncomingMailbox *NextIncomingMailbox = HostAdapter->NextIncomingMailbox; | 2691 | */ |
2498 | enum BusLogic_CompletionCode CompletionCode; | 2692 | struct blogic_inbox *next_inbox = adapter->next_inbox; |
2499 | while ((CompletionCode = NextIncomingMailbox->CompletionCode) != BusLogic_IncomingMailboxFree) { | 2693 | enum blogic_cmplt_code comp_code; |
2694 | |||
2695 | while ((comp_code = next_inbox->comp_code) != BLOGIC_INBOX_FREE) { | ||
2500 | /* | 2696 | /* |
2501 | We are only allowed to do this because we limit our architectures we | 2697 | We are only allowed to do this because we limit our |
2502 | run on to machines where bus_to_virt() actually works. There *needs* | 2698 | architectures we run on to machines where bus_to_virt( |
2503 | to be a dma_addr_to_virt() in the new PCI DMA mapping interface to | 2699 | actually works. There *needs* to be a dma_addr_to_virt() |
2504 | replace bus_to_virt() or else this code is going to become very | 2700 | in the new PCI DMA mapping interface to replace |
2701 | bus_to_virt() or else this code is going to become very | ||
2505 | innefficient. | 2702 | innefficient. |
2506 | */ | 2703 | */ |
2507 | struct BusLogic_CCB *CCB = (struct BusLogic_CCB *) Bus_to_Virtual(NextIncomingMailbox->CCB); | 2704 | struct blogic_ccb *ccb = |
2508 | if (CompletionCode != BusLogic_AbortedCommandNotFound) { | 2705 | (struct blogic_ccb *) bus_to_virt(next_inbox->ccb); |
2509 | if (CCB->Status == BusLogic_CCB_Active || CCB->Status == BusLogic_CCB_Reset) { | 2706 | if (comp_code != BLOGIC_CMD_NOTFOUND) { |
2707 | if (ccb->status == BLOGIC_CCB_ACTIVE || | ||
2708 | ccb->status == BLOGIC_CCB_RESET) { | ||
2510 | /* | 2709 | /* |
2511 | Save the Completion Code for this CCB and queue the CCB | 2710 | Save the Completion Code for this CCB and |
2512 | for completion processing. | 2711 | queue the CCB for completion processing. |
2513 | */ | 2712 | */ |
2514 | CCB->CompletionCode = CompletionCode; | 2713 | ccb->comp_code = comp_code; |
2515 | BusLogic_QueueCompletedCCB(CCB); | 2714 | blogic_qcompleted_ccb(ccb); |
2516 | } else { | 2715 | } else { |
2517 | /* | 2716 | /* |
2518 | If a CCB ever appears in an Incoming Mailbox and is not marked | 2717 | If a CCB ever appears in an Incoming Mailbox |
2519 | as status Active or Reset, then there is most likely a bug in | 2718 | and is not marked as status Active or Reset, |
2719 | then there is most likely a bug in | ||
2520 | the Host Adapter firmware. | 2720 | the Host Adapter firmware. |
2521 | */ | 2721 | */ |
2522 | BusLogic_Warning("Illegal CCB #%ld status %d in " "Incoming Mailbox\n", HostAdapter, CCB->SerialNumber, CCB->Status); | 2722 | blogic_warn("Illegal CCB #%ld status %d in " "Incoming Mailbox\n", adapter, ccb->serial, ccb->status); |
2523 | } | 2723 | } |
2524 | } | 2724 | } |
2525 | NextIncomingMailbox->CompletionCode = BusLogic_IncomingMailboxFree; | 2725 | next_inbox->comp_code = BLOGIC_INBOX_FREE; |
2526 | if (++NextIncomingMailbox > HostAdapter->LastIncomingMailbox) | 2726 | if (++next_inbox > adapter->last_inbox) |
2527 | NextIncomingMailbox = HostAdapter->FirstIncomingMailbox; | 2727 | next_inbox = adapter->first_inbox; |
2528 | } | 2728 | } |
2529 | HostAdapter->NextIncomingMailbox = NextIncomingMailbox; | 2729 | adapter->next_inbox = next_inbox; |
2530 | } | 2730 | } |
2531 | 2731 | ||
2532 | 2732 | ||
2533 | /* | 2733 | /* |
2534 | BusLogic_ProcessCompletedCCBs iterates over the completed CCBs for Host | 2734 | blogic_process_ccbs iterates over the completed CCBs for Host |
2535 | Adapter setting the SCSI Command Result Codes, deallocating the CCBs, and | 2735 | Adapter setting the SCSI Command Result Codes, deallocating the CCBs, and |
2536 | calling the SCSI Subsystem Completion Routines. The Host Adapter's Lock | 2736 | calling the SCSI Subsystem Completion Routines. The Host Adapter's Lock |
2537 | should already have been acquired by the caller. | 2737 | should already have been acquired by the caller. |
2538 | */ | 2738 | */ |
2539 | 2739 | ||
2540 | static void BusLogic_ProcessCompletedCCBs(struct BusLogic_HostAdapter *HostAdapter) | 2740 | static void blogic_process_ccbs(struct blogic_adapter *adapter) |
2541 | { | 2741 | { |
2542 | if (HostAdapter->ProcessCompletedCCBsActive) | 2742 | if (adapter->processing_ccbs) |
2543 | return; | 2743 | return; |
2544 | HostAdapter->ProcessCompletedCCBsActive = true; | 2744 | adapter->processing_ccbs = true; |
2545 | while (HostAdapter->FirstCompletedCCB != NULL) { | 2745 | while (adapter->firstccb != NULL) { |
2546 | struct BusLogic_CCB *CCB = HostAdapter->FirstCompletedCCB; | 2746 | struct blogic_ccb *ccb = adapter->firstccb; |
2547 | struct scsi_cmnd *Command = CCB->Command; | 2747 | struct scsi_cmnd *command = ccb->command; |
2548 | HostAdapter->FirstCompletedCCB = CCB->Next; | 2748 | adapter->firstccb = ccb->next; |
2549 | if (HostAdapter->FirstCompletedCCB == NULL) | 2749 | if (adapter->firstccb == NULL) |
2550 | HostAdapter->LastCompletedCCB = NULL; | 2750 | adapter->lastccb = NULL; |
2551 | /* | 2751 | /* |
2552 | Process the Completed CCB. | 2752 | Process the Completed CCB. |
2553 | */ | 2753 | */ |
2554 | if (CCB->Opcode == BusLogic_BusDeviceReset) { | 2754 | if (ccb->opcode == BLOGIC_BDR) { |
2555 | int TargetID = CCB->TargetID; | 2755 | int tgt_id = ccb->tgt_id; |
2556 | BusLogic_Warning("Bus Device Reset CCB #%ld to Target " "%d Completed\n", HostAdapter, CCB->SerialNumber, TargetID); | 2756 | |
2557 | BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].BusDeviceResetsCompleted); | 2757 | blogic_warn("Bus Device Reset CCB #%ld to Target " "%d Completed\n", adapter, ccb->serial, tgt_id); |
2558 | HostAdapter->TargetFlags[TargetID].TaggedQueuingActive = false; | 2758 | blogic_inc_count(&adapter->tgt_stats[tgt_id].bdr_done); |
2559 | HostAdapter->CommandsSinceReset[TargetID] = 0; | 2759 | adapter->tgt_flags[tgt_id].tagq_active = false; |
2560 | HostAdapter->LastResetCompleted[TargetID] = jiffies; | 2760 | adapter->cmds_since_rst[tgt_id] = 0; |
2761 | adapter->last_resetdone[tgt_id] = jiffies; | ||
2561 | /* | 2762 | /* |
2562 | Place CCB back on the Host Adapter's free list. | 2763 | Place CCB back on the Host Adapter's free list. |
2563 | */ | 2764 | */ |
2564 | BusLogic_DeallocateCCB(CCB); | 2765 | blogic_dealloc_ccb(ccb); |
2565 | #if 0 /* this needs to be redone different for new EH */ | 2766 | #if 0 /* this needs to be redone different for new EH */ |
2566 | /* | 2767 | /* |
2567 | Bus Device Reset CCBs have the Command field non-NULL only when a | 2768 | Bus Device Reset CCBs have the command field |
2568 | Bus Device Reset was requested for a Command that did not have a | 2769 | non-NULL only when a Bus Device Reset was requested |
2569 | currently active CCB in the Host Adapter (i.e., a Synchronous | 2770 | for a command that did not have a currently active |
2570 | Bus Device Reset), and hence would not have its Completion Routine | 2771 | CCB in the Host Adapter (i.e., a Synchronous Bus |
2571 | called otherwise. | 2772 | Device Reset), and hence would not have its |
2773 | Completion Routine called otherwise. | ||
2572 | */ | 2774 | */ |
2573 | while (Command != NULL) { | 2775 | while (command != NULL) { |
2574 | struct scsi_cmnd *NextCommand = Command->reset_chain; | 2776 | struct scsi_cmnd *nxt_cmd = |
2575 | Command->reset_chain = NULL; | 2777 | command->reset_chain; |
2576 | Command->result = DID_RESET << 16; | 2778 | command->reset_chain = NULL; |
2577 | Command->scsi_done(Command); | 2779 | command->result = DID_RESET << 16; |
2578 | Command = NextCommand; | 2780 | command->scsi_done(command); |
2781 | command = nxt_cmd; | ||
2579 | } | 2782 | } |
2580 | #endif | 2783 | #endif |
2581 | /* | 2784 | /* |
2582 | Iterate over the CCBs for this Host Adapter performing completion | 2785 | Iterate over the CCBs for this Host Adapter |
2583 | processing for any CCBs marked as Reset for this Target. | 2786 | performing completion processing for any CCBs |
2787 | marked as Reset for this Target. | ||
2584 | */ | 2788 | */ |
2585 | for (CCB = HostAdapter->All_CCBs; CCB != NULL; CCB = CCB->NextAll) | 2789 | for (ccb = adapter->all_ccbs; ccb != NULL; |
2586 | if (CCB->Status == BusLogic_CCB_Reset && CCB->TargetID == TargetID) { | 2790 | ccb = ccb->next_all) |
2587 | Command = CCB->Command; | 2791 | if (ccb->status == BLOGIC_CCB_RESET && |
2588 | BusLogic_DeallocateCCB(CCB); | 2792 | ccb->tgt_id == tgt_id) { |
2589 | HostAdapter->ActiveCommands[TargetID]--; | 2793 | command = ccb->command; |
2590 | Command->result = DID_RESET << 16; | 2794 | blogic_dealloc_ccb(ccb); |
2591 | Command->scsi_done(Command); | 2795 | adapter->active_cmds[tgt_id]--; |
2796 | command->result = DID_RESET << 16; | ||
2797 | command->scsi_done(command); | ||
2592 | } | 2798 | } |
2593 | HostAdapter->BusDeviceResetPendingCCB[TargetID] = NULL; | 2799 | adapter->bdr_pend[tgt_id] = NULL; |
2594 | } else { | 2800 | } else { |
2595 | /* | 2801 | /* |
2596 | Translate the Completion Code, Host Adapter Status, and Target | 2802 | Translate the Completion Code, Host Adapter Status, |
2597 | Device Status into a SCSI Subsystem Result Code. | 2803 | and Target Device Status into a SCSI Subsystem |
2804 | Result Code. | ||
2598 | */ | 2805 | */ |
2599 | switch (CCB->CompletionCode) { | 2806 | switch (ccb->comp_code) { |
2600 | case BusLogic_IncomingMailboxFree: | 2807 | case BLOGIC_INBOX_FREE: |
2601 | case BusLogic_AbortedCommandNotFound: | 2808 | case BLOGIC_CMD_NOTFOUND: |
2602 | case BusLogic_InvalidCCB: | 2809 | case BLOGIC_INVALID_CCB: |
2603 | BusLogic_Warning("CCB #%ld to Target %d Impossible State\n", HostAdapter, CCB->SerialNumber, CCB->TargetID); | 2810 | blogic_warn("CCB #%ld to Target %d Impossible State\n", adapter, ccb->serial, ccb->tgt_id); |
2604 | break; | 2811 | break; |
2605 | case BusLogic_CommandCompletedWithoutError: | 2812 | case BLOGIC_CMD_COMPLETE_GOOD: |
2606 | HostAdapter->TargetStatistics[CCB->TargetID] | 2813 | adapter->tgt_stats[ccb->tgt_id] |
2607 | .CommandsCompleted++; | 2814 | .cmds_complete++; |
2608 | HostAdapter->TargetFlags[CCB->TargetID] | 2815 | adapter->tgt_flags[ccb->tgt_id] |
2609 | .CommandSuccessfulFlag = true; | 2816 | .cmd_good = true; |
2610 | Command->result = DID_OK << 16; | 2817 | command->result = DID_OK << 16; |
2611 | break; | 2818 | break; |
2612 | case BusLogic_CommandAbortedAtHostRequest: | 2819 | case BLOGIC_CMD_ABORT_BY_HOST: |
2613 | BusLogic_Warning("CCB #%ld to Target %d Aborted\n", HostAdapter, CCB->SerialNumber, CCB->TargetID); | 2820 | blogic_warn("CCB #%ld to Target %d Aborted\n", |
2614 | BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[CCB->TargetID] | 2821 | adapter, ccb->serial, ccb->tgt_id); |
2615 | .CommandAbortsCompleted); | 2822 | blogic_inc_count(&adapter->tgt_stats[ccb->tgt_id].aborts_done); |
2616 | Command->result = DID_ABORT << 16; | 2823 | command->result = DID_ABORT << 16; |
2617 | break; | 2824 | break; |
2618 | case BusLogic_CommandCompletedWithError: | 2825 | case BLOGIC_CMD_COMPLETE_ERROR: |
2619 | Command->result = BusLogic_ComputeResultCode(HostAdapter, CCB->HostAdapterStatus, CCB->TargetDeviceStatus); | 2826 | command->result = blogic_resultcode(adapter, |
2620 | if (CCB->HostAdapterStatus != BusLogic_SCSISelectionTimeout) { | 2827 | ccb->adapter_status, ccb->tgt_status); |
2621 | HostAdapter->TargetStatistics[CCB->TargetID] | 2828 | if (ccb->adapter_status != BLOGIC_SELECT_TIMEOUT) { |
2622 | .CommandsCompleted++; | 2829 | adapter->tgt_stats[ccb->tgt_id] |
2623 | if (BusLogic_GlobalOptions.TraceErrors) { | 2830 | .cmds_complete++; |
2831 | if (blogic_global_options.trace_err) { | ||
2624 | int i; | 2832 | int i; |
2625 | BusLogic_Notice("CCB #%ld Target %d: Result %X Host " | 2833 | blogic_notice("CCB #%ld Target %d: Result %X Host " |
2626 | "Adapter Status %02X " "Target Status %02X\n", HostAdapter, CCB->SerialNumber, CCB->TargetID, Command->result, CCB->HostAdapterStatus, CCB->TargetDeviceStatus); | 2834 | "Adapter Status %02X " "Target Status %02X\n", adapter, ccb->serial, ccb->tgt_id, command->result, ccb->adapter_status, ccb->tgt_status); |
2627 | BusLogic_Notice("CDB ", HostAdapter); | 2835 | blogic_notice("CDB ", adapter); |
2628 | for (i = 0; i < CCB->CDB_Length; i++) | 2836 | for (i = 0; i < ccb->cdblen; i++) |
2629 | BusLogic_Notice(" %02X", HostAdapter, CCB->CDB[i]); | 2837 | blogic_notice(" %02X", adapter, ccb->cdb[i]); |
2630 | BusLogic_Notice("\n", HostAdapter); | 2838 | blogic_notice("\n", adapter); |
2631 | BusLogic_Notice("Sense ", HostAdapter); | 2839 | blogic_notice("Sense ", adapter); |
2632 | for (i = 0; i < CCB->SenseDataLength; i++) | 2840 | for (i = 0; i < ccb->sense_datalen; i++) |
2633 | BusLogic_Notice(" %02X", HostAdapter, Command->sense_buffer[i]); | 2841 | blogic_notice(" %02X", adapter, command->sense_buffer[i]); |
2634 | BusLogic_Notice("\n", HostAdapter); | 2842 | blogic_notice("\n", adapter); |
2635 | } | 2843 | } |
2636 | } | 2844 | } |
2637 | break; | 2845 | break; |
@@ -2641,141 +2849,145 @@ static void BusLogic_ProcessCompletedCCBs(struct BusLogic_HostAdapter *HostAdapt | |||
2641 | CmdQue (Tagged Queuing Supported) and WBus16 (16 Bit | 2849 | CmdQue (Tagged Queuing Supported) and WBus16 (16 Bit |
2642 | Wide Data Transfers Supported) bits. | 2850 | Wide Data Transfers Supported) bits. |
2643 | */ | 2851 | */ |
2644 | if (CCB->CDB[0] == INQUIRY && CCB->CDB[1] == 0 && CCB->HostAdapterStatus == BusLogic_CommandCompletedNormally) { | 2852 | if (ccb->cdb[0] == INQUIRY && ccb->cdb[1] == 0 && |
2645 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[CCB->TargetID]; | 2853 | ccb->adapter_status == BLOGIC_CMD_CMPLT_NORMAL) { |
2646 | struct SCSI_Inquiry *InquiryResult = | 2854 | struct blogic_tgt_flags *tgt_flags = |
2647 | (struct SCSI_Inquiry *) scsi_sglist(Command); | 2855 | &adapter->tgt_flags[ccb->tgt_id]; |
2648 | TargetFlags->TargetExists = true; | 2856 | struct scsi_inquiry *inquiry = |
2649 | TargetFlags->TaggedQueuingSupported = InquiryResult->CmdQue; | 2857 | (struct scsi_inquiry *) scsi_sglist(command); |
2650 | TargetFlags->WideTransfersSupported = InquiryResult->WBus16; | 2858 | tgt_flags->tgt_exists = true; |
2859 | tgt_flags->tagq_ok = inquiry->CmdQue; | ||
2860 | tgt_flags->wide_ok = inquiry->WBus16; | ||
2651 | } | 2861 | } |
2652 | /* | 2862 | /* |
2653 | Place CCB back on the Host Adapter's free list. | 2863 | Place CCB back on the Host Adapter's free list. |
2654 | */ | 2864 | */ |
2655 | BusLogic_DeallocateCCB(CCB); | 2865 | blogic_dealloc_ccb(ccb); |
2656 | /* | 2866 | /* |
2657 | Call the SCSI Command Completion Routine. | 2867 | Call the SCSI Command Completion Routine. |
2658 | */ | 2868 | */ |
2659 | Command->scsi_done(Command); | 2869 | command->scsi_done(command); |
2660 | } | 2870 | } |
2661 | } | 2871 | } |
2662 | HostAdapter->ProcessCompletedCCBsActive = false; | 2872 | adapter->processing_ccbs = false; |
2663 | } | 2873 | } |
2664 | 2874 | ||
2665 | 2875 | ||
2666 | /* | 2876 | /* |
2667 | BusLogic_InterruptHandler handles hardware interrupts from BusLogic Host | 2877 | blogic_inthandler handles hardware interrupts from BusLogic Host |
2668 | Adapters. | 2878 | Adapters. |
2669 | */ | 2879 | */ |
2670 | 2880 | ||
2671 | static irqreturn_t BusLogic_InterruptHandler(int IRQ_Channel, void *DeviceIdentifier) | 2881 | static irqreturn_t blogic_inthandler(int irq_ch, void *devid) |
2672 | { | 2882 | { |
2673 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) DeviceIdentifier; | 2883 | struct blogic_adapter *adapter = (struct blogic_adapter *) devid; |
2674 | unsigned long ProcessorFlags; | 2884 | unsigned long processor_flag; |
2675 | /* | 2885 | /* |
2676 | Acquire exclusive access to Host Adapter. | 2886 | Acquire exclusive access to Host Adapter. |
2677 | */ | 2887 | */ |
2678 | spin_lock_irqsave(HostAdapter->SCSI_Host->host_lock, ProcessorFlags); | 2888 | spin_lock_irqsave(adapter->scsi_host->host_lock, processor_flag); |
2679 | /* | 2889 | /* |
2680 | Handle Interrupts appropriately for each Host Adapter type. | 2890 | Handle Interrupts appropriately for each Host Adapter type. |
2681 | */ | 2891 | */ |
2682 | if (BusLogic_MultiMasterHostAdapterP(HostAdapter)) { | 2892 | if (blogic_multimaster_type(adapter)) { |
2683 | union BusLogic_InterruptRegister InterruptRegister; | 2893 | union blogic_int_reg intreg; |
2684 | /* | 2894 | /* |
2685 | Read the Host Adapter Interrupt Register. | 2895 | Read the Host Adapter Interrupt Register. |
2686 | */ | 2896 | */ |
2687 | InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter); | 2897 | intreg.all = blogic_rdint(adapter); |
2688 | if (InterruptRegister.ir.InterruptValid) { | 2898 | if (intreg.ir.int_valid) { |
2689 | /* | 2899 | /* |
2690 | Acknowledge the interrupt and reset the Host Adapter | 2900 | Acknowledge the interrupt and reset the Host Adapter |
2691 | Interrupt Register. | 2901 | Interrupt Register. |
2692 | */ | 2902 | */ |
2693 | BusLogic_InterruptReset(HostAdapter); | 2903 | blogic_intreset(adapter); |
2694 | /* | 2904 | /* |
2695 | Process valid External SCSI Bus Reset and Incoming Mailbox | 2905 | Process valid External SCSI Bus Reset and Incoming |
2696 | Loaded Interrupts. Command Complete Interrupts are noted, | 2906 | Mailbox Loaded Interrupts. Command Complete |
2697 | and Outgoing Mailbox Available Interrupts are ignored, as | 2907 | Interrupts are noted, and Outgoing Mailbox Available |
2698 | they are never enabled. | 2908 | Interrupts are ignored, as they are never enabled. |
2699 | */ | 2909 | */ |
2700 | if (InterruptRegister.ir.ExternalBusReset) | 2910 | if (intreg.ir.ext_busreset) |
2701 | HostAdapter->HostAdapterExternalReset = true; | 2911 | adapter->adapter_extreset = true; |
2702 | else if (InterruptRegister.ir.IncomingMailboxLoaded) | 2912 | else if (intreg.ir.mailin_loaded) |
2703 | BusLogic_ScanIncomingMailboxes(HostAdapter); | 2913 | blogic_scan_inbox(adapter); |
2704 | else if (InterruptRegister.ir.CommandComplete) | 2914 | else if (intreg.ir.cmd_complete) |
2705 | HostAdapter->HostAdapterCommandCompleted = true; | 2915 | adapter->adapter_cmd_complete = true; |
2706 | } | 2916 | } |
2707 | } else { | 2917 | } else { |
2708 | /* | 2918 | /* |
2709 | Check if there is a pending interrupt for this Host Adapter. | 2919 | Check if there is a pending interrupt for this Host Adapter. |
2710 | */ | 2920 | */ |
2711 | if (FlashPoint_InterruptPending(HostAdapter->CardHandle)) | 2921 | if (FlashPoint_InterruptPending(adapter->cardhandle)) |
2712 | switch (FlashPoint_HandleInterrupt(HostAdapter->CardHandle)) { | 2922 | switch (FlashPoint_HandleInterrupt(adapter->cardhandle)) { |
2713 | case FlashPoint_NormalInterrupt: | 2923 | case FPOINT_NORMAL_INT: |
2714 | break; | 2924 | break; |
2715 | case FlashPoint_ExternalBusReset: | 2925 | case FPOINT_EXT_RESET: |
2716 | HostAdapter->HostAdapterExternalReset = true; | 2926 | adapter->adapter_extreset = true; |
2717 | break; | 2927 | break; |
2718 | case FlashPoint_InternalError: | 2928 | case FPOINT_INTERN_ERR: |
2719 | BusLogic_Warning("Internal FlashPoint Error detected" " - Resetting Host Adapter\n", HostAdapter); | 2929 | blogic_warn("Internal FlashPoint Error detected - Resetting Host Adapter\n", adapter); |
2720 | HostAdapter->HostAdapterInternalError = true; | 2930 | adapter->adapter_intern_err = true; |
2721 | break; | 2931 | break; |
2722 | } | 2932 | } |
2723 | } | 2933 | } |
2724 | /* | 2934 | /* |
2725 | Process any completed CCBs. | 2935 | Process any completed CCBs. |
2726 | */ | 2936 | */ |
2727 | if (HostAdapter->FirstCompletedCCB != NULL) | 2937 | if (adapter->firstccb != NULL) |
2728 | BusLogic_ProcessCompletedCCBs(HostAdapter); | 2938 | blogic_process_ccbs(adapter); |
2729 | /* | 2939 | /* |
2730 | Reset the Host Adapter if requested. | 2940 | Reset the Host Adapter if requested. |
2731 | */ | 2941 | */ |
2732 | if (HostAdapter->HostAdapterExternalReset) { | 2942 | if (adapter->adapter_extreset) { |
2733 | BusLogic_Warning("Resetting %s due to External SCSI Bus Reset\n", HostAdapter, HostAdapter->FullModelName); | 2943 | blogic_warn("Resetting %s due to External SCSI Bus Reset\n", adapter, adapter->full_model); |
2734 | BusLogic_IncrementErrorCounter(&HostAdapter->ExternalHostAdapterResets); | 2944 | blogic_inc_count(&adapter->ext_resets); |
2735 | BusLogic_ResetHostAdapter(HostAdapter, false); | 2945 | blogic_resetadapter(adapter, false); |
2736 | HostAdapter->HostAdapterExternalReset = false; | 2946 | adapter->adapter_extreset = false; |
2737 | } else if (HostAdapter->HostAdapterInternalError) { | 2947 | } else if (adapter->adapter_intern_err) { |
2738 | BusLogic_Warning("Resetting %s due to Host Adapter Internal Error\n", HostAdapter, HostAdapter->FullModelName); | 2948 | blogic_warn("Resetting %s due to Host Adapter Internal Error\n", adapter, adapter->full_model); |
2739 | BusLogic_IncrementErrorCounter(&HostAdapter->HostAdapterInternalErrors); | 2949 | blogic_inc_count(&adapter->adapter_intern_errors); |
2740 | BusLogic_ResetHostAdapter(HostAdapter, true); | 2950 | blogic_resetadapter(adapter, true); |
2741 | HostAdapter->HostAdapterInternalError = false; | 2951 | adapter->adapter_intern_err = false; |
2742 | } | 2952 | } |
2743 | /* | 2953 | /* |
2744 | Release exclusive access to Host Adapter. | 2954 | Release exclusive access to Host Adapter. |
2745 | */ | 2955 | */ |
2746 | spin_unlock_irqrestore(HostAdapter->SCSI_Host->host_lock, ProcessorFlags); | 2956 | spin_unlock_irqrestore(adapter->scsi_host->host_lock, processor_flag); |
2747 | return IRQ_HANDLED; | 2957 | return IRQ_HANDLED; |
2748 | } | 2958 | } |
2749 | 2959 | ||
2750 | 2960 | ||
2751 | /* | 2961 | /* |
2752 | BusLogic_WriteOutgoingMailbox places CCB and Action Code into an Outgoing | 2962 | blogic_write_outbox places CCB and Action Code into an Outgoing |
2753 | Mailbox for execution by Host Adapter. The Host Adapter's Lock should | 2963 | Mailbox for execution by Host Adapter. The Host Adapter's Lock should |
2754 | already have been acquired by the caller. | 2964 | already have been acquired by the caller. |
2755 | */ | 2965 | */ |
2756 | 2966 | ||
2757 | static bool BusLogic_WriteOutgoingMailbox(struct BusLogic_HostAdapter | 2967 | static bool blogic_write_outbox(struct blogic_adapter *adapter, |
2758 | *HostAdapter, enum BusLogic_ActionCode ActionCode, struct BusLogic_CCB *CCB) | 2968 | enum blogic_action action, struct blogic_ccb *ccb) |
2759 | { | 2969 | { |
2760 | struct BusLogic_OutgoingMailbox *NextOutgoingMailbox; | 2970 | struct blogic_outbox *next_outbox; |
2761 | NextOutgoingMailbox = HostAdapter->NextOutgoingMailbox; | 2971 | |
2762 | if (NextOutgoingMailbox->ActionCode == BusLogic_OutgoingMailboxFree) { | 2972 | next_outbox = adapter->next_outbox; |
2763 | CCB->Status = BusLogic_CCB_Active; | 2973 | if (next_outbox->action == BLOGIC_OUTBOX_FREE) { |
2974 | ccb->status = BLOGIC_CCB_ACTIVE; | ||
2764 | /* | 2975 | /* |
2765 | The CCB field must be written before the Action Code field since | 2976 | The CCB field must be written before the Action Code field |
2766 | the Host Adapter is operating asynchronously and the locking code | 2977 | since the Host Adapter is operating asynchronously and the |
2767 | does not protect against simultaneous access by the Host Adapter. | 2978 | locking code does not protect against simultaneous access |
2979 | by the Host Adapter. | ||
2768 | */ | 2980 | */ |
2769 | NextOutgoingMailbox->CCB = CCB->DMA_Handle; | 2981 | next_outbox->ccb = ccb->dma_handle; |
2770 | NextOutgoingMailbox->ActionCode = ActionCode; | 2982 | next_outbox->action = action; |
2771 | BusLogic_StartMailboxCommand(HostAdapter); | 2983 | blogic_execmbox(adapter); |
2772 | if (++NextOutgoingMailbox > HostAdapter->LastOutgoingMailbox) | 2984 | if (++next_outbox > adapter->last_outbox) |
2773 | NextOutgoingMailbox = HostAdapter->FirstOutgoingMailbox; | 2985 | next_outbox = adapter->first_outbox; |
2774 | HostAdapter->NextOutgoingMailbox = NextOutgoingMailbox; | 2986 | adapter->next_outbox = next_outbox; |
2775 | if (ActionCode == BusLogic_MailboxStartCommand) { | 2987 | if (action == BLOGIC_MBOX_START) { |
2776 | HostAdapter->ActiveCommands[CCB->TargetID]++; | 2988 | adapter->active_cmds[ccb->tgt_id]++; |
2777 | if (CCB->Opcode != BusLogic_BusDeviceReset) | 2989 | if (ccb->opcode != BLOGIC_BDR) |
2778 | HostAdapter->TargetStatistics[CCB->TargetID].CommandsAttempted++; | 2990 | adapter->tgt_stats[ccb->tgt_id].cmds_tried++; |
2779 | } | 2991 | } |
2780 | return true; | 2992 | return true; |
2781 | } | 2993 | } |
@@ -2784,65 +2996,72 @@ static bool BusLogic_WriteOutgoingMailbox(struct BusLogic_HostAdapter | |||
2784 | 2996 | ||
2785 | /* Error Handling (EH) support */ | 2997 | /* Error Handling (EH) support */ |
2786 | 2998 | ||
2787 | static int BusLogic_host_reset(struct scsi_cmnd * SCpnt) | 2999 | static int blogic_hostreset(struct scsi_cmnd *SCpnt) |
2788 | { | 3000 | { |
2789 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) SCpnt->device->host->hostdata; | 3001 | struct blogic_adapter *adapter = |
3002 | (struct blogic_adapter *) SCpnt->device->host->hostdata; | ||
2790 | 3003 | ||
2791 | unsigned int id = SCpnt->device->id; | 3004 | unsigned int id = SCpnt->device->id; |
2792 | struct BusLogic_TargetStatistics *stats = &HostAdapter->TargetStatistics[id]; | 3005 | struct blogic_tgt_stats *stats = &adapter->tgt_stats[id]; |
2793 | int rc; | 3006 | int rc; |
2794 | 3007 | ||
2795 | spin_lock_irq(SCpnt->device->host->host_lock); | 3008 | spin_lock_irq(SCpnt->device->host->host_lock); |
2796 | 3009 | ||
2797 | BusLogic_IncrementErrorCounter(&stats->HostAdapterResetsRequested); | 3010 | blogic_inc_count(&stats->adatper_reset_req); |
2798 | 3011 | ||
2799 | rc = BusLogic_ResetHostAdapter(HostAdapter, false); | 3012 | rc = blogic_resetadapter(adapter, false); |
2800 | spin_unlock_irq(SCpnt->device->host->host_lock); | 3013 | spin_unlock_irq(SCpnt->device->host->host_lock); |
2801 | return rc; | 3014 | return rc; |
2802 | } | 3015 | } |
2803 | 3016 | ||
2804 | /* | 3017 | /* |
2805 | BusLogic_QueueCommand creates a CCB for Command and places it into an | 3018 | blogic_qcmd creates a CCB for Command and places it into an |
2806 | Outgoing Mailbox for execution by the associated Host Adapter. | 3019 | Outgoing Mailbox for execution by the associated Host Adapter. |
2807 | */ | 3020 | */ |
2808 | 3021 | ||
2809 | static int BusLogic_QueueCommand_lck(struct scsi_cmnd *Command, void (*CompletionRoutine) (struct scsi_cmnd *)) | 3022 | static int blogic_qcmd_lck(struct scsi_cmnd *command, |
3023 | void (*comp_cb) (struct scsi_cmnd *)) | ||
2810 | { | 3024 | { |
2811 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Command->device->host->hostdata; | 3025 | struct blogic_adapter *adapter = |
2812 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[Command->device->id]; | 3026 | (struct blogic_adapter *) command->device->host->hostdata; |
2813 | struct BusLogic_TargetStatistics *TargetStatistics = HostAdapter->TargetStatistics; | 3027 | struct blogic_tgt_flags *tgt_flags = |
2814 | unsigned char *CDB = Command->cmnd; | 3028 | &adapter->tgt_flags[command->device->id]; |
2815 | int CDB_Length = Command->cmd_len; | 3029 | struct blogic_tgt_stats *tgt_stats = adapter->tgt_stats; |
2816 | int TargetID = Command->device->id; | 3030 | unsigned char *cdb = command->cmnd; |
2817 | int LogicalUnit = Command->device->lun; | 3031 | int cdblen = command->cmd_len; |
2818 | int BufferLength = scsi_bufflen(Command); | 3032 | int tgt_id = command->device->id; |
2819 | int Count; | 3033 | int lun = command->device->lun; |
2820 | struct BusLogic_CCB *CCB; | 3034 | int buflen = scsi_bufflen(command); |
2821 | /* | 3035 | int count; |
2822 | SCSI REQUEST_SENSE commands will be executed automatically by the Host | 3036 | struct blogic_ccb *ccb; |
2823 | Adapter for any errors, so they should not be executed explicitly unless | 3037 | |
2824 | the Sense Data is zero indicating that no error occurred. | 3038 | /* |
2825 | */ | 3039 | SCSI REQUEST_SENSE commands will be executed automatically by the |
2826 | if (CDB[0] == REQUEST_SENSE && Command->sense_buffer[0] != 0) { | 3040 | Host Adapter for any errors, so they should not be executed |
2827 | Command->result = DID_OK << 16; | 3041 | explicitly unless the Sense Data is zero indicating that no error |
2828 | CompletionRoutine(Command); | 3042 | occurred. |
3043 | */ | ||
3044 | if (cdb[0] == REQUEST_SENSE && command->sense_buffer[0] != 0) { | ||
3045 | command->result = DID_OK << 16; | ||
3046 | comp_cb(command); | ||
2829 | return 0; | 3047 | return 0; |
2830 | } | 3048 | } |
2831 | /* | 3049 | /* |
2832 | Allocate a CCB from the Host Adapter's free list. In the unlikely event | 3050 | Allocate a CCB from the Host Adapter's free list. In the unlikely |
2833 | that there are none available and memory allocation fails, wait 1 second | 3051 | event that there are none available and memory allocation fails, |
2834 | and try again. If that fails, the Host Adapter is probably hung so signal | 3052 | wait 1 second and try again. If that fails, the Host Adapter is |
2835 | an error as a Host Adapter Hard Reset should be initiated soon. | 3053 | probably hung so signal an error as a Host Adapter Hard Reset |
2836 | */ | 3054 | should be initiated soon. |
2837 | CCB = BusLogic_AllocateCCB(HostAdapter); | 3055 | */ |
2838 | if (CCB == NULL) { | 3056 | ccb = blogic_alloc_ccb(adapter); |
2839 | spin_unlock_irq(HostAdapter->SCSI_Host->host_lock); | 3057 | if (ccb == NULL) { |
2840 | BusLogic_Delay(1); | 3058 | spin_unlock_irq(adapter->scsi_host->host_lock); |
2841 | spin_lock_irq(HostAdapter->SCSI_Host->host_lock); | 3059 | blogic_delay(1); |
2842 | CCB = BusLogic_AllocateCCB(HostAdapter); | 3060 | spin_lock_irq(adapter->scsi_host->host_lock); |
2843 | if (CCB == NULL) { | 3061 | ccb = blogic_alloc_ccb(adapter); |
2844 | Command->result = DID_ERROR << 16; | 3062 | if (ccb == NULL) { |
2845 | CompletionRoutine(Command); | 3063 | command->result = DID_ERROR << 16; |
3064 | comp_cb(command); | ||
2846 | return 0; | 3065 | return 0; |
2847 | } | 3066 | } |
2848 | } | 3067 | } |
@@ -2850,217 +3069,241 @@ static int BusLogic_QueueCommand_lck(struct scsi_cmnd *Command, void (*Completio | |||
2850 | /* | 3069 | /* |
2851 | Initialize the fields in the BusLogic Command Control Block (CCB). | 3070 | Initialize the fields in the BusLogic Command Control Block (CCB). |
2852 | */ | 3071 | */ |
2853 | Count = scsi_dma_map(Command); | 3072 | count = scsi_dma_map(command); |
2854 | BUG_ON(Count < 0); | 3073 | BUG_ON(count < 0); |
2855 | if (Count) { | 3074 | if (count) { |
2856 | struct scatterlist *sg; | 3075 | struct scatterlist *sg; |
2857 | int i; | 3076 | int i; |
2858 | 3077 | ||
2859 | CCB->Opcode = BusLogic_InitiatorCCB_ScatterGather; | 3078 | ccb->opcode = BLOGIC_INITIATOR_CCB_SG; |
2860 | CCB->DataLength = Count * sizeof(struct BusLogic_ScatterGatherSegment); | 3079 | ccb->datalen = count * sizeof(struct blogic_sg_seg); |
2861 | if (BusLogic_MultiMasterHostAdapterP(HostAdapter)) | 3080 | if (blogic_multimaster_type(adapter)) |
2862 | CCB->DataPointer = (unsigned int) CCB->DMA_Handle + ((unsigned long) &CCB->ScatterGatherList - (unsigned long) CCB); | 3081 | ccb->data = (void *)((unsigned int) ccb->dma_handle + |
3082 | ((unsigned long) &ccb->sglist - | ||
3083 | (unsigned long) ccb)); | ||
2863 | else | 3084 | else |
2864 | CCB->DataPointer = Virtual_to_32Bit_Virtual(CCB->ScatterGatherList); | 3085 | ccb->data = ccb->sglist; |
2865 | 3086 | ||
2866 | scsi_for_each_sg(Command, sg, Count, i) { | 3087 | scsi_for_each_sg(command, sg, count, i) { |
2867 | CCB->ScatterGatherList[i].SegmentByteCount = | 3088 | ccb->sglist[i].segbytes = sg_dma_len(sg); |
2868 | sg_dma_len(sg); | 3089 | ccb->sglist[i].segdata = sg_dma_address(sg); |
2869 | CCB->ScatterGatherList[i].SegmentDataPointer = | ||
2870 | sg_dma_address(sg); | ||
2871 | } | 3090 | } |
2872 | } else if (!Count) { | 3091 | } else if (!count) { |
2873 | CCB->Opcode = BusLogic_InitiatorCCB; | 3092 | ccb->opcode = BLOGIC_INITIATOR_CCB; |
2874 | CCB->DataLength = BufferLength; | 3093 | ccb->datalen = buflen; |
2875 | CCB->DataPointer = 0; | 3094 | ccb->data = 0; |
2876 | } | 3095 | } |
2877 | 3096 | ||
2878 | switch (CDB[0]) { | 3097 | switch (cdb[0]) { |
2879 | case READ_6: | 3098 | case READ_6: |
2880 | case READ_10: | 3099 | case READ_10: |
2881 | CCB->DataDirection = BusLogic_DataInLengthChecked; | 3100 | ccb->datadir = BLOGIC_DATAIN_CHECKED; |
2882 | TargetStatistics[TargetID].ReadCommands++; | 3101 | tgt_stats[tgt_id].read_cmds++; |
2883 | BusLogic_IncrementByteCounter(&TargetStatistics[TargetID].TotalBytesRead, BufferLength); | 3102 | blogic_addcount(&tgt_stats[tgt_id].bytesread, buflen); |
2884 | BusLogic_IncrementSizeBucket(TargetStatistics[TargetID].ReadCommandSizeBuckets, BufferLength); | 3103 | blogic_incszbucket(tgt_stats[tgt_id].read_sz_buckets, buflen); |
2885 | break; | 3104 | break; |
2886 | case WRITE_6: | 3105 | case WRITE_6: |
2887 | case WRITE_10: | 3106 | case WRITE_10: |
2888 | CCB->DataDirection = BusLogic_DataOutLengthChecked; | 3107 | ccb->datadir = BLOGIC_DATAOUT_CHECKED; |
2889 | TargetStatistics[TargetID].WriteCommands++; | 3108 | tgt_stats[tgt_id].write_cmds++; |
2890 | BusLogic_IncrementByteCounter(&TargetStatistics[TargetID].TotalBytesWritten, BufferLength); | 3109 | blogic_addcount(&tgt_stats[tgt_id].byteswritten, buflen); |
2891 | BusLogic_IncrementSizeBucket(TargetStatistics[TargetID].WriteCommandSizeBuckets, BufferLength); | 3110 | blogic_incszbucket(tgt_stats[tgt_id].write_sz_buckets, buflen); |
2892 | break; | 3111 | break; |
2893 | default: | 3112 | default: |
2894 | CCB->DataDirection = BusLogic_UncheckedDataTransfer; | 3113 | ccb->datadir = BLOGIC_UNCHECKED_TX; |
2895 | break; | 3114 | break; |
2896 | } | 3115 | } |
2897 | CCB->CDB_Length = CDB_Length; | 3116 | ccb->cdblen = cdblen; |
2898 | CCB->HostAdapterStatus = 0; | 3117 | ccb->adapter_status = 0; |
2899 | CCB->TargetDeviceStatus = 0; | 3118 | ccb->tgt_status = 0; |
2900 | CCB->TargetID = TargetID; | 3119 | ccb->tgt_id = tgt_id; |
2901 | CCB->LogicalUnit = LogicalUnit; | 3120 | ccb->lun = lun; |
2902 | CCB->TagEnable = false; | 3121 | ccb->tag_enable = false; |
2903 | CCB->LegacyTagEnable = false; | 3122 | ccb->legacytag_enable = false; |
2904 | /* | 3123 | /* |
2905 | BusLogic recommends that after a Reset the first couple of commands that | 3124 | BusLogic recommends that after a Reset the first couple of |
2906 | are sent to a Target Device be sent in a non Tagged Queue fashion so that | 3125 | commands that are sent to a Target Device be sent in a non |
2907 | the Host Adapter and Target Device can establish Synchronous and Wide | 3126 | Tagged Queue fashion so that the Host Adapter and Target Device |
2908 | Transfer before Queue Tag messages can interfere with the Synchronous and | 3127 | can establish Synchronous and Wide Transfer before Queue Tag |
2909 | Wide Negotiation messages. By waiting to enable Tagged Queuing until after | 3128 | messages can interfere with the Synchronous and Wide Negotiation |
2910 | the first BusLogic_MaxTaggedQueueDepth commands have been queued, it is | 3129 | messages. By waiting to enable Tagged Queuing until after the |
2911 | assured that after a Reset any pending commands are requeued before Tagged | 3130 | first BLOGIC_MAX_TAG_DEPTH commands have been queued, it is |
2912 | Queuing is enabled and that the Tagged Queuing message will not occur while | 3131 | assured that after a Reset any pending commands are requeued |
2913 | the partition table is being printed. In addition, some devices do not | 3132 | before Tagged Queuing is enabled and that the Tagged Queuing |
2914 | properly handle the transition from non-tagged to tagged commands, so it is | 3133 | message will not occur while the partition table is being printed. |
2915 | necessary to wait until there are no pending commands for a target device | 3134 | In addition, some devices do not properly handle the transition |
3135 | from non-tagged to tagged commands, so it is necessary to wait | ||
3136 | until there are no pending commands for a target device | ||
2916 | before queuing tagged commands. | 3137 | before queuing tagged commands. |
2917 | */ | 3138 | */ |
2918 | if (HostAdapter->CommandsSinceReset[TargetID]++ >= | 3139 | if (adapter->cmds_since_rst[tgt_id]++ >= BLOGIC_MAX_TAG_DEPTH && |
2919 | BusLogic_MaxTaggedQueueDepth && !TargetFlags->TaggedQueuingActive && HostAdapter->ActiveCommands[TargetID] == 0 && TargetFlags->TaggedQueuingSupported && (HostAdapter->TaggedQueuingPermitted & (1 << TargetID))) { | 3140 | !tgt_flags->tagq_active && |
2920 | TargetFlags->TaggedQueuingActive = true; | 3141 | adapter->active_cmds[tgt_id] == 0 |
2921 | BusLogic_Notice("Tagged Queuing now active for Target %d\n", HostAdapter, TargetID); | 3142 | && tgt_flags->tagq_ok && |
2922 | } | 3143 | (adapter->tagq_ok & (1 << tgt_id))) { |
2923 | if (TargetFlags->TaggedQueuingActive) { | 3144 | tgt_flags->tagq_active = true; |
2924 | enum BusLogic_QueueTag QueueTag = BusLogic_SimpleQueueTag; | 3145 | blogic_notice("Tagged Queuing now active for Target %d\n", |
3146 | adapter, tgt_id); | ||
3147 | } | ||
3148 | if (tgt_flags->tagq_active) { | ||
3149 | enum blogic_queuetag queuetag = BLOGIC_SIMPLETAG; | ||
2925 | /* | 3150 | /* |
2926 | When using Tagged Queuing with Simple Queue Tags, it appears that disk | 3151 | When using Tagged Queuing with Simple Queue Tags, it |
2927 | drive controllers do not guarantee that a queued command will not | 3152 | appears that disk drive controllers do not guarantee that |
2928 | remain in a disconnected state indefinitely if commands that read or | 3153 | a queued command will not remain in a disconnected state |
2929 | write nearer the head position continue to arrive without interruption. | 3154 | indefinitely if commands that read or write nearer the |
2930 | Therefore, for each Target Device this driver keeps track of the last | 3155 | head position continue to arrive without interruption. |
2931 | time either the queue was empty or an Ordered Queue Tag was issued. If | 3156 | Therefore, for each Target Device this driver keeps track |
2932 | more than 4 seconds (one fifth of the 20 second disk timeout) have | 3157 | of the last time either the queue was empty or an Ordered |
2933 | elapsed since this last sequence point, this command will be issued | 3158 | Queue Tag was issued. If more than 4 seconds (one fifth |
2934 | with an Ordered Queue Tag rather than a Simple Queue Tag, which forces | 3159 | of the 20 second disk timeout) have elapsed since this |
2935 | the Target Device to complete all previously queued commands before | 3160 | last sequence point, this command will be issued with an |
2936 | this command may be executed. | 3161 | Ordered Queue Tag rather than a Simple Queue Tag, which |
3162 | forces the Target Device to complete all previously | ||
3163 | queued commands before this command may be executed. | ||
2937 | */ | 3164 | */ |
2938 | if (HostAdapter->ActiveCommands[TargetID] == 0) | 3165 | if (adapter->active_cmds[tgt_id] == 0) |
2939 | HostAdapter->LastSequencePoint[TargetID] = jiffies; | 3166 | adapter->last_seqpoint[tgt_id] = jiffies; |
2940 | else if (time_after(jiffies, HostAdapter->LastSequencePoint[TargetID] + 4 * HZ)) { | 3167 | else if (time_after(jiffies, |
2941 | HostAdapter->LastSequencePoint[TargetID] = jiffies; | 3168 | adapter->last_seqpoint[tgt_id] + 4 * HZ)) { |
2942 | QueueTag = BusLogic_OrderedQueueTag; | 3169 | adapter->last_seqpoint[tgt_id] = jiffies; |
3170 | queuetag = BLOGIC_ORDEREDTAG; | ||
2943 | } | 3171 | } |
2944 | if (HostAdapter->ExtendedLUNSupport) { | 3172 | if (adapter->ext_lun) { |
2945 | CCB->TagEnable = true; | 3173 | ccb->tag_enable = true; |
2946 | CCB->QueueTag = QueueTag; | 3174 | ccb->queuetag = queuetag; |
2947 | } else { | 3175 | } else { |
2948 | CCB->LegacyTagEnable = true; | 3176 | ccb->legacytag_enable = true; |
2949 | CCB->LegacyQueueTag = QueueTag; | 3177 | ccb->legacy_tag = queuetag; |
2950 | } | 3178 | } |
2951 | } | 3179 | } |
2952 | memcpy(CCB->CDB, CDB, CDB_Length); | 3180 | memcpy(ccb->cdb, cdb, cdblen); |
2953 | CCB->SenseDataLength = SCSI_SENSE_BUFFERSIZE; | 3181 | ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE; |
2954 | CCB->SenseDataPointer = pci_map_single(HostAdapter->PCI_Device, Command->sense_buffer, CCB->SenseDataLength, PCI_DMA_FROMDEVICE); | 3182 | ccb->sensedata = pci_map_single(adapter->pci_device, |
2955 | CCB->Command = Command; | 3183 | command->sense_buffer, ccb->sense_datalen, |
2956 | Command->scsi_done = CompletionRoutine; | 3184 | PCI_DMA_FROMDEVICE); |
2957 | if (BusLogic_MultiMasterHostAdapterP(HostAdapter)) { | 3185 | ccb->command = command; |
3186 | command->scsi_done = comp_cb; | ||
3187 | if (blogic_multimaster_type(adapter)) { | ||
2958 | /* | 3188 | /* |
2959 | Place the CCB in an Outgoing Mailbox. The higher levels of the SCSI | 3189 | Place the CCB in an Outgoing Mailbox. The higher levels |
2960 | Subsystem should not attempt to queue more commands than can be placed | 3190 | of the SCSI Subsystem should not attempt to queue more |
2961 | in Outgoing Mailboxes, so there should always be one free. In the | 3191 | commands than can be placed in Outgoing Mailboxes, so |
2962 | unlikely event that there are none available, wait 1 second and try | 3192 | there should always be one free. In the unlikely event |
2963 | again. If that fails, the Host Adapter is probably hung so signal an | 3193 | that there are none available, wait 1 second and try |
2964 | error as a Host Adapter Hard Reset should be initiated soon. | 3194 | again. If that fails, the Host Adapter is probably hung |
3195 | so signal an error as a Host Adapter Hard Reset should | ||
3196 | be initiated soon. | ||
2965 | */ | 3197 | */ |
2966 | if (!BusLogic_WriteOutgoingMailbox(HostAdapter, BusLogic_MailboxStartCommand, CCB)) { | 3198 | if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, ccb)) { |
2967 | spin_unlock_irq(HostAdapter->SCSI_Host->host_lock); | 3199 | spin_unlock_irq(adapter->scsi_host->host_lock); |
2968 | BusLogic_Warning("Unable to write Outgoing Mailbox - " "Pausing for 1 second\n", HostAdapter); | 3200 | blogic_warn("Unable to write Outgoing Mailbox - " "Pausing for 1 second\n", adapter); |
2969 | BusLogic_Delay(1); | 3201 | blogic_delay(1); |
2970 | spin_lock_irq(HostAdapter->SCSI_Host->host_lock); | 3202 | spin_lock_irq(adapter->scsi_host->host_lock); |
2971 | if (!BusLogic_WriteOutgoingMailbox(HostAdapter, BusLogic_MailboxStartCommand, CCB)) { | 3203 | if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, |
2972 | BusLogic_Warning("Still unable to write Outgoing Mailbox - " "Host Adapter Dead?\n", HostAdapter); | 3204 | ccb)) { |
2973 | BusLogic_DeallocateCCB(CCB); | 3205 | blogic_warn("Still unable to write Outgoing Mailbox - " "Host Adapter Dead?\n", adapter); |
2974 | Command->result = DID_ERROR << 16; | 3206 | blogic_dealloc_ccb(ccb); |
2975 | Command->scsi_done(Command); | 3207 | command->result = DID_ERROR << 16; |
3208 | command->scsi_done(command); | ||
2976 | } | 3209 | } |
2977 | } | 3210 | } |
2978 | } else { | 3211 | } else { |
2979 | /* | 3212 | /* |
2980 | Call the FlashPoint SCCB Manager to start execution of the CCB. | 3213 | Call the FlashPoint SCCB Manager to start execution of |
3214 | the CCB. | ||
2981 | */ | 3215 | */ |
2982 | CCB->Status = BusLogic_CCB_Active; | 3216 | ccb->status = BLOGIC_CCB_ACTIVE; |
2983 | HostAdapter->ActiveCommands[TargetID]++; | 3217 | adapter->active_cmds[tgt_id]++; |
2984 | TargetStatistics[TargetID].CommandsAttempted++; | 3218 | tgt_stats[tgt_id].cmds_tried++; |
2985 | FlashPoint_StartCCB(HostAdapter->CardHandle, CCB); | 3219 | FlashPoint_StartCCB(adapter->cardhandle, ccb); |
2986 | /* | 3220 | /* |
2987 | The Command may have already completed and BusLogic_QueueCompletedCCB | 3221 | The Command may have already completed and |
2988 | been called, or it may still be pending. | 3222 | blogic_qcompleted_ccb been called, or it may still be |
3223 | pending. | ||
2989 | */ | 3224 | */ |
2990 | if (CCB->Status == BusLogic_CCB_Completed) | 3225 | if (ccb->status == BLOGIC_CCB_COMPLETE) |
2991 | BusLogic_ProcessCompletedCCBs(HostAdapter); | 3226 | blogic_process_ccbs(adapter); |
2992 | } | 3227 | } |
2993 | return 0; | 3228 | return 0; |
2994 | } | 3229 | } |
2995 | 3230 | ||
2996 | static DEF_SCSI_QCMD(BusLogic_QueueCommand) | 3231 | static DEF_SCSI_QCMD(blogic_qcmd) |
2997 | 3232 | ||
2998 | #if 0 | 3233 | #if 0 |
2999 | /* | 3234 | /* |
3000 | BusLogic_AbortCommand aborts Command if possible. | 3235 | blogic_abort aborts Command if possible. |
3001 | */ | 3236 | */ |
3002 | 3237 | ||
3003 | static int BusLogic_AbortCommand(struct scsi_cmnd *Command) | 3238 | static int blogic_abort(struct scsi_cmnd *command) |
3004 | { | 3239 | { |
3005 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Command->device->host->hostdata; | 3240 | struct blogic_adapter *adapter = |
3241 | (struct blogic_adapter *) command->device->host->hostdata; | ||
3242 | |||
3243 | int tgt_id = command->device->id; | ||
3244 | struct blogic_ccb *ccb; | ||
3245 | blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_request); | ||
3006 | 3246 | ||
3007 | int TargetID = Command->device->id; | ||
3008 | struct BusLogic_CCB *CCB; | ||
3009 | BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].CommandAbortsRequested); | ||
3010 | /* | 3247 | /* |
3011 | Attempt to find an Active CCB for this Command. If no Active CCB for this | 3248 | Attempt to find an Active CCB for this Command. If no Active |
3012 | Command is found, then no Abort is necessary. | 3249 | CCB for this Command is found, then no Abort is necessary. |
3013 | */ | 3250 | */ |
3014 | for (CCB = HostAdapter->All_CCBs; CCB != NULL; CCB = CCB->NextAll) | 3251 | for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all) |
3015 | if (CCB->Command == Command) | 3252 | if (ccb->command == command) |
3016 | break; | 3253 | break; |
3017 | if (CCB == NULL) { | 3254 | if (ccb == NULL) { |
3018 | BusLogic_Warning("Unable to Abort Command to Target %d - " "No CCB Found\n", HostAdapter, TargetID); | 3255 | blogic_warn("Unable to Abort Command to Target %d - No CCB Found\n", adapter, tgt_id); |
3019 | return SUCCESS; | 3256 | return SUCCESS; |
3020 | } else if (CCB->Status == BusLogic_CCB_Completed) { | 3257 | } else if (ccb->status == BLOGIC_CCB_COMPLETE) { |
3021 | BusLogic_Warning("Unable to Abort Command to Target %d - " "CCB Completed\n", HostAdapter, TargetID); | 3258 | blogic_warn("Unable to Abort Command to Target %d - CCB Completed\n", adapter, tgt_id); |
3022 | return SUCCESS; | 3259 | return SUCCESS; |
3023 | } else if (CCB->Status == BusLogic_CCB_Reset) { | 3260 | } else if (ccb->status == BLOGIC_CCB_RESET) { |
3024 | BusLogic_Warning("Unable to Abort Command to Target %d - " "CCB Reset\n", HostAdapter, TargetID); | 3261 | blogic_warn("Unable to Abort Command to Target %d - CCB Reset\n", adapter, tgt_id); |
3025 | return SUCCESS; | 3262 | return SUCCESS; |
3026 | } | 3263 | } |
3027 | if (BusLogic_MultiMasterHostAdapterP(HostAdapter)) { | 3264 | if (blogic_multimaster_type(adapter)) { |
3028 | /* | 3265 | /* |
3029 | Attempt to Abort this CCB. MultiMaster Firmware versions prior to 5.xx | 3266 | Attempt to Abort this CCB. MultiMaster Firmware versions |
3030 | do not generate Abort Tag messages, but only generate the non-tagged | 3267 | prior to 5.xx do not generate Abort Tag messages, but only |
3031 | Abort message. Since non-tagged commands are not sent by the Host | 3268 | generate the non-tagged Abort message. Since non-tagged |
3032 | Adapter until the queue of outstanding tagged commands has completed, | 3269 | commands are not sent by the Host Adapter until the queue |
3033 | and the Abort message is treated as a non-tagged command, it is | 3270 | of outstanding tagged commands has completed, and the |
3034 | effectively impossible to abort commands when Tagged Queuing is active. | 3271 | Abort message is treated as a non-tagged command, it is |
3035 | Firmware version 5.xx does generate Abort Tag messages, so it is | 3272 | effectively impossible to abort commands when Tagged |
3036 | possible to abort commands when Tagged Queuing is active. | 3273 | Queuing is active. Firmware version 5.xx does generate |
3274 | Abort Tag messages, so it is possible to abort commands | ||
3275 | when Tagged Queuing is active. | ||
3037 | */ | 3276 | */ |
3038 | if (HostAdapter->TargetFlags[TargetID].TaggedQueuingActive && HostAdapter->FirmwareVersion[0] < '5') { | 3277 | if (adapter->tgt_flags[tgt_id].tagq_active && |
3039 | BusLogic_Warning("Unable to Abort CCB #%ld to Target %d - " "Abort Tag Not Supported\n", HostAdapter, CCB->SerialNumber, TargetID); | 3278 | adapter->fw_ver[0] < '5') { |
3279 | blogic_warn("Unable to Abort CCB #%ld to Target %d - Abort Tag Not Supported\n", adapter, ccb->serial, tgt_id); | ||
3040 | return FAILURE; | 3280 | return FAILURE; |
3041 | } else if (BusLogic_WriteOutgoingMailbox(HostAdapter, BusLogic_MailboxAbortCommand, CCB)) { | 3281 | } else if (blogic_write_outbox(adapter, BLOGIC_MBOX_ABORT, |
3042 | BusLogic_Warning("Aborting CCB #%ld to Target %d\n", HostAdapter, CCB->SerialNumber, TargetID); | 3282 | ccb)) { |
3043 | BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].CommandAbortsAttempted); | 3283 | blogic_warn("Aborting CCB #%ld to Target %d\n", |
3284 | adapter, ccb->serial, tgt_id); | ||
3285 | blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried); | ||
3044 | return SUCCESS; | 3286 | return SUCCESS; |
3045 | } else { | 3287 | } else { |
3046 | BusLogic_Warning("Unable to Abort CCB #%ld to Target %d - " "No Outgoing Mailboxes\n", HostAdapter, CCB->SerialNumber, TargetID); | 3288 | blogic_warn("Unable to Abort CCB #%ld to Target %d - No Outgoing Mailboxes\n", adapter, ccb->serial, tgt_id); |
3047 | return FAILURE; | 3289 | return FAILURE; |
3048 | } | 3290 | } |
3049 | } else { | 3291 | } else { |
3050 | /* | 3292 | /* |
3051 | Call the FlashPoint SCCB Manager to abort execution of the CCB. | 3293 | Call the FlashPoint SCCB Manager to abort execution of |
3294 | the CCB. | ||
3052 | */ | 3295 | */ |
3053 | BusLogic_Warning("Aborting CCB #%ld to Target %d\n", HostAdapter, CCB->SerialNumber, TargetID); | 3296 | blogic_warn("Aborting CCB #%ld to Target %d\n", adapter, |
3054 | BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].CommandAbortsAttempted); | 3297 | ccb->serial, tgt_id); |
3055 | FlashPoint_AbortCCB(HostAdapter->CardHandle, CCB); | 3298 | blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried); |
3299 | FlashPoint_AbortCCB(adapter->cardhandle, ccb); | ||
3056 | /* | 3300 | /* |
3057 | The Abort may have already been completed and | 3301 | The Abort may have already been completed and |
3058 | BusLogic_QueueCompletedCCB been called, or it | 3302 | blogic_qcompleted_ccb been called, or it |
3059 | may still be pending. | 3303 | may still be pending. |
3060 | */ | 3304 | */ |
3061 | if (CCB->Status == BusLogic_CCB_Completed) { | 3305 | if (ccb->status == BLOGIC_CCB_COMPLETE) |
3062 | BusLogic_ProcessCompletedCCBs(HostAdapter); | 3306 | blogic_process_ccbs(adapter); |
3063 | } | ||
3064 | return SUCCESS; | 3307 | return SUCCESS; |
3065 | } | 3308 | } |
3066 | return SUCCESS; | 3309 | return SUCCESS; |
@@ -3068,21 +3311,23 @@ static int BusLogic_AbortCommand(struct scsi_cmnd *Command) | |||
3068 | 3311 | ||
3069 | #endif | 3312 | #endif |
3070 | /* | 3313 | /* |
3071 | BusLogic_ResetHostAdapter resets Host Adapter if possible, marking all | 3314 | blogic_resetadapter resets Host Adapter if possible, marking all |
3072 | currently executing SCSI Commands as having been Reset. | 3315 | currently executing SCSI Commands as having been Reset. |
3073 | */ | 3316 | */ |
3074 | 3317 | ||
3075 | static int BusLogic_ResetHostAdapter(struct BusLogic_HostAdapter *HostAdapter, bool HardReset) | 3318 | static int blogic_resetadapter(struct blogic_adapter *adapter, bool hard_reset) |
3076 | { | 3319 | { |
3077 | struct BusLogic_CCB *CCB; | 3320 | struct blogic_ccb *ccb; |
3078 | int TargetID; | 3321 | int tgt_id; |
3079 | 3322 | ||
3080 | /* | 3323 | /* |
3081 | * Attempt to Reset and Reinitialize the Host Adapter. | 3324 | * Attempt to Reset and Reinitialize the Host Adapter. |
3082 | */ | 3325 | */ |
3083 | 3326 | ||
3084 | if (!(BusLogic_HardwareResetHostAdapter(HostAdapter, HardReset) && BusLogic_InitializeHostAdapter(HostAdapter))) { | 3327 | if (!(blogic_hwreset(adapter, hard_reset) && |
3085 | BusLogic_Error("Resetting %s Failed\n", HostAdapter, HostAdapter->FullModelName); | 3328 | blogic_initadapter(adapter))) { |
3329 | blogic_err("Resetting %s Failed\n", adapter, | ||
3330 | adapter->full_model); | ||
3086 | return FAILURE; | 3331 | return FAILURE; |
3087 | } | 3332 | } |
3088 | 3333 | ||
@@ -3090,9 +3335,9 @@ static int BusLogic_ResetHostAdapter(struct BusLogic_HostAdapter *HostAdapter, b | |||
3090 | * Deallocate all currently executing CCBs. | 3335 | * Deallocate all currently executing CCBs. |
3091 | */ | 3336 | */ |
3092 | 3337 | ||
3093 | for (CCB = HostAdapter->All_CCBs; CCB != NULL; CCB = CCB->NextAll) | 3338 | for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all) |
3094 | if (CCB->Status == BusLogic_CCB_Active) | 3339 | if (ccb->status == BLOGIC_CCB_ACTIVE) |
3095 | BusLogic_DeallocateCCB(CCB); | 3340 | blogic_dealloc_ccb(ccb); |
3096 | /* | 3341 | /* |
3097 | * Wait a few seconds between the Host Adapter Hard Reset which | 3342 | * Wait a few seconds between the Host Adapter Hard Reset which |
3098 | * initiates a SCSI Bus Reset and issuing any SCSI Commands. Some | 3343 | * initiates a SCSI Bus Reset and issuing any SCSI Commands. Some |
@@ -3100,21 +3345,21 @@ static int BusLogic_ResetHostAdapter(struct BusLogic_HostAdapter *HostAdapter, b | |||
3100 | * after a SCSI Bus Reset. | 3345 | * after a SCSI Bus Reset. |
3101 | */ | 3346 | */ |
3102 | 3347 | ||
3103 | if (HardReset) { | 3348 | if (hard_reset) { |
3104 | spin_unlock_irq(HostAdapter->SCSI_Host->host_lock); | 3349 | spin_unlock_irq(adapter->scsi_host->host_lock); |
3105 | BusLogic_Delay(HostAdapter->BusSettleTime); | 3350 | blogic_delay(adapter->bus_settle_time); |
3106 | spin_lock_irq(HostAdapter->SCSI_Host->host_lock); | 3351 | spin_lock_irq(adapter->scsi_host->host_lock); |
3107 | } | 3352 | } |
3108 | 3353 | ||
3109 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { | 3354 | for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) { |
3110 | HostAdapter->LastResetAttempted[TargetID] = jiffies; | 3355 | adapter->last_resettried[tgt_id] = jiffies; |
3111 | HostAdapter->LastResetCompleted[TargetID] = jiffies; | 3356 | adapter->last_resetdone[tgt_id] = jiffies; |
3112 | } | 3357 | } |
3113 | return SUCCESS; | 3358 | return SUCCESS; |
3114 | } | 3359 | } |
3115 | 3360 | ||
3116 | /* | 3361 | /* |
3117 | BusLogic_BIOSDiskParameters returns the Heads/Sectors/Cylinders BIOS Disk | 3362 | blogic_diskparam returns the Heads/Sectors/Cylinders BIOS Disk |
3118 | Parameters for Disk. The default disk geometry is 64 heads, 32 sectors, and | 3363 | Parameters for Disk. The default disk geometry is 64 heads, 32 sectors, and |
3119 | the appropriate number of cylinders so as not to exceed drive capacity. In | 3364 | the appropriate number of cylinders so as not to exceed drive capacity. In |
3120 | order for disks equal to or larger than 1 GB to be addressable by the BIOS | 3365 | order for disks equal to or larger than 1 GB to be addressable by the BIOS |
@@ -3130,66 +3375,70 @@ static int BusLogic_ResetHostAdapter(struct BusLogic_HostAdapter *HostAdapter, b | |||
3130 | the BIOS, and a warning may be displayed. | 3375 | the BIOS, and a warning may be displayed. |
3131 | */ | 3376 | */ |
3132 | 3377 | ||
3133 | static int BusLogic_BIOSDiskParameters(struct scsi_device *sdev, struct block_device *Device, sector_t capacity, int *Parameters) | 3378 | static int blogic_diskparam(struct scsi_device *sdev, struct block_device *dev, |
3379 | sector_t capacity, int *params) | ||
3134 | { | 3380 | { |
3135 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) sdev->host->hostdata; | 3381 | struct blogic_adapter *adapter = |
3136 | struct BIOS_DiskParameters *DiskParameters = (struct BIOS_DiskParameters *) Parameters; | 3382 | (struct blogic_adapter *) sdev->host->hostdata; |
3383 | struct bios_diskparam *diskparam = (struct bios_diskparam *) params; | ||
3137 | unsigned char *buf; | 3384 | unsigned char *buf; |
3138 | if (HostAdapter->ExtendedTranslationEnabled && capacity >= 2 * 1024 * 1024 /* 1 GB in 512 byte sectors */ ) { | 3385 | |
3139 | if (capacity >= 4 * 1024 * 1024 /* 2 GB in 512 byte sectors */ ) { | 3386 | if (adapter->ext_trans_enable && capacity >= 2 * 1024 * 1024 /* 1 GB in 512 byte sectors */) { |
3140 | DiskParameters->Heads = 255; | 3387 | if (capacity >= 4 * 1024 * 1024 /* 2 GB in 512 byte sectors */) { |
3141 | DiskParameters->Sectors = 63; | 3388 | diskparam->heads = 255; |
3389 | diskparam->sectors = 63; | ||
3142 | } else { | 3390 | } else { |
3143 | DiskParameters->Heads = 128; | 3391 | diskparam->heads = 128; |
3144 | DiskParameters->Sectors = 32; | 3392 | diskparam->sectors = 32; |
3145 | } | 3393 | } |
3146 | } else { | 3394 | } else { |
3147 | DiskParameters->Heads = 64; | 3395 | diskparam->heads = 64; |
3148 | DiskParameters->Sectors = 32; | 3396 | diskparam->sectors = 32; |
3149 | } | 3397 | } |
3150 | DiskParameters->Cylinders = (unsigned long) capacity / (DiskParameters->Heads * DiskParameters->Sectors); | 3398 | diskparam->cylinders = (unsigned long) capacity / (diskparam->heads * diskparam->sectors); |
3151 | buf = scsi_bios_ptable(Device); | 3399 | buf = scsi_bios_ptable(dev); |
3152 | if (buf == NULL) | 3400 | if (buf == NULL) |
3153 | return 0; | 3401 | return 0; |
3154 | /* | 3402 | /* |
3155 | If the boot sector partition table flag is valid, search for a partition | 3403 | If the boot sector partition table flag is valid, search for |
3156 | table entry whose end_head matches one of the standard BusLogic geometry | 3404 | a partition table entry whose end_head matches one of the |
3157 | translations (64/32, 128/32, or 255/63). | 3405 | standard BusLogic geometry translations (64/32, 128/32, or 255/63). |
3158 | */ | 3406 | */ |
3159 | if (*(unsigned short *) (buf + 64) == 0xAA55) { | 3407 | if (*(unsigned short *) (buf + 64) == 0xAA55) { |
3160 | struct partition *FirstPartitionEntry = (struct partition *) buf; | 3408 | struct partition *part1_entry = (struct partition *) buf; |
3161 | struct partition *PartitionEntry = FirstPartitionEntry; | 3409 | struct partition *part_entry = part1_entry; |
3162 | int SavedCylinders = DiskParameters->Cylinders, PartitionNumber; | 3410 | int saved_cyl = diskparam->cylinders, part_no; |
3163 | unsigned char PartitionEntryEndHead = 0, PartitionEntryEndSector = 0; | 3411 | unsigned char part_end_head = 0, part_end_sector = 0; |
3164 | for (PartitionNumber = 0; PartitionNumber < 4; PartitionNumber++) { | 3412 | |
3165 | PartitionEntryEndHead = PartitionEntry->end_head; | 3413 | for (part_no = 0; part_no < 4; part_no++) { |
3166 | PartitionEntryEndSector = PartitionEntry->end_sector & 0x3F; | 3414 | part_end_head = part_entry->end_head; |
3167 | if (PartitionEntryEndHead == 64 - 1) { | 3415 | part_end_sector = part_entry->end_sector & 0x3F; |
3168 | DiskParameters->Heads = 64; | 3416 | if (part_end_head == 64 - 1) { |
3169 | DiskParameters->Sectors = 32; | 3417 | diskparam->heads = 64; |
3418 | diskparam->sectors = 32; | ||
3170 | break; | 3419 | break; |
3171 | } else if (PartitionEntryEndHead == 128 - 1) { | 3420 | } else if (part_end_head == 128 - 1) { |
3172 | DiskParameters->Heads = 128; | 3421 | diskparam->heads = 128; |
3173 | DiskParameters->Sectors = 32; | 3422 | diskparam->sectors = 32; |
3174 | break; | 3423 | break; |
3175 | } else if (PartitionEntryEndHead == 255 - 1) { | 3424 | } else if (part_end_head == 255 - 1) { |
3176 | DiskParameters->Heads = 255; | 3425 | diskparam->heads = 255; |
3177 | DiskParameters->Sectors = 63; | 3426 | diskparam->sectors = 63; |
3178 | break; | 3427 | break; |
3179 | } | 3428 | } |
3180 | PartitionEntry++; | 3429 | part_entry++; |
3181 | } | 3430 | } |
3182 | if (PartitionNumber == 4) { | 3431 | if (part_no == 4) { |
3183 | PartitionEntryEndHead = FirstPartitionEntry->end_head; | 3432 | part_end_head = part1_entry->end_head; |
3184 | PartitionEntryEndSector = FirstPartitionEntry->end_sector & 0x3F; | 3433 | part_end_sector = part1_entry->end_sector & 0x3F; |
3185 | } | 3434 | } |
3186 | DiskParameters->Cylinders = (unsigned long) capacity / (DiskParameters->Heads * DiskParameters->Sectors); | 3435 | diskparam->cylinders = (unsigned long) capacity / (diskparam->heads * diskparam->sectors); |
3187 | if (PartitionNumber < 4 && PartitionEntryEndSector == DiskParameters->Sectors) { | 3436 | if (part_no < 4 && part_end_sector == diskparam->sectors) { |
3188 | if (DiskParameters->Cylinders != SavedCylinders) | 3437 | if (diskparam->cylinders != saved_cyl) |
3189 | BusLogic_Warning("Adopting Geometry %d/%d from Partition Table\n", HostAdapter, DiskParameters->Heads, DiskParameters->Sectors); | 3438 | blogic_warn("Adopting Geometry %d/%d from Partition Table\n", adapter, diskparam->heads, diskparam->sectors); |
3190 | } else if (PartitionEntryEndHead > 0 || PartitionEntryEndSector > 0) { | 3439 | } else if (part_end_head > 0 || part_end_sector > 0) { |
3191 | BusLogic_Warning("Warning: Partition Table appears to " "have Geometry %d/%d which is\n", HostAdapter, PartitionEntryEndHead + 1, PartitionEntryEndSector); | 3440 | blogic_warn("Warning: Partition Table appears to " "have Geometry %d/%d which is\n", adapter, part_end_head + 1, part_end_sector); |
3192 | BusLogic_Warning("not compatible with current BusLogic " "Host Adapter Geometry %d/%d\n", HostAdapter, DiskParameters->Heads, DiskParameters->Sectors); | 3441 | blogic_warn("not compatible with current BusLogic " "Host Adapter Geometry %d/%d\n", adapter, diskparam->heads, diskparam->sectors); |
3193 | } | 3442 | } |
3194 | } | 3443 | } |
3195 | kfree(buf); | 3444 | kfree(buf); |
@@ -3201,92 +3450,94 @@ static int BusLogic_BIOSDiskParameters(struct scsi_device *sdev, struct block_de | |||
3201 | BugLogic_ProcDirectoryInfo implements /proc/scsi/BusLogic/<N>. | 3450 | BugLogic_ProcDirectoryInfo implements /proc/scsi/BusLogic/<N>. |
3202 | */ | 3451 | */ |
3203 | 3452 | ||
3204 | static int BusLogic_write_info(struct Scsi_Host *shost, char *ProcBuffer, int BytesAvailable) | 3453 | static int blogic_write_info(struct Scsi_Host *shost, char *procbuf, |
3454 | int bytes_avail) | ||
3205 | { | 3455 | { |
3206 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata; | 3456 | struct blogic_adapter *adapter = |
3207 | struct BusLogic_TargetStatistics *TargetStatistics; | 3457 | (struct blogic_adapter *) shost->hostdata; |
3208 | 3458 | struct blogic_tgt_stats *tgt_stats; | |
3209 | TargetStatistics = HostAdapter->TargetStatistics; | 3459 | |
3210 | HostAdapter->ExternalHostAdapterResets = 0; | 3460 | tgt_stats = adapter->tgt_stats; |
3211 | HostAdapter->HostAdapterInternalErrors = 0; | 3461 | adapter->ext_resets = 0; |
3212 | memset(TargetStatistics, 0, BusLogic_MaxTargetDevices * sizeof(struct BusLogic_TargetStatistics)); | 3462 | adapter->adapter_intern_errors = 0; |
3463 | memset(tgt_stats, 0, BLOGIC_MAXDEV * sizeof(struct blogic_tgt_stats)); | ||
3213 | return 0; | 3464 | return 0; |
3214 | } | 3465 | } |
3215 | 3466 | ||
3216 | static int BusLogic_show_info(struct seq_file *m, struct Scsi_Host *shost) | 3467 | static int blogic_show_info(struct seq_file *m, struct Scsi_Host *shost) |
3217 | { | 3468 | { |
3218 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata; | 3469 | struct blogic_adapter *adapter = (struct blogic_adapter *) shost->hostdata; |
3219 | struct BusLogic_TargetStatistics *TargetStatistics; | 3470 | struct blogic_tgt_stats *tgt_stats; |
3220 | int TargetID; | 3471 | int tgt; |
3221 | 3472 | ||
3222 | TargetStatistics = HostAdapter->TargetStatistics; | 3473 | tgt_stats = adapter->tgt_stats; |
3223 | seq_write(m, HostAdapter->MessageBuffer, HostAdapter->MessageBufferLength); | 3474 | seq_write(m, adapter->msgbuf, adapter->msgbuflen); |
3224 | seq_printf(m, "\n\ | 3475 | seq_printf(m, "\n\ |
3225 | Current Driver Queue Depth: %d\n\ | 3476 | Current Driver Queue Depth: %d\n\ |
3226 | Currently Allocated CCBs: %d\n", HostAdapter->DriverQueueDepth, HostAdapter->AllocatedCCBs); | 3477 | Currently Allocated CCBs: %d\n", adapter->drvr_qdepth, adapter->alloc_ccbs); |
3227 | seq_printf(m, "\n\n\ | 3478 | seq_printf(m, "\n\n\ |
3228 | DATA TRANSFER STATISTICS\n\ | 3479 | DATA TRANSFER STATISTICS\n\ |
3229 | \n\ | 3480 | \n\ |
3230 | Target Tagged Queuing Queue Depth Active Attempted Completed\n\ | 3481 | Target Tagged Queuing Queue Depth Active Attempted Completed\n\ |
3231 | ====== ============== =========== ====== ========= =========\n"); | 3482 | ====== ============== =========== ====== ========= =========\n"); |
3232 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { | 3483 | for (tgt = 0; tgt < adapter->maxdev; tgt++) { |
3233 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; | 3484 | struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; |
3234 | if (!TargetFlags->TargetExists) | 3485 | if (!tgt_flags->tgt_exists) |
3235 | continue; | 3486 | continue; |
3236 | seq_printf(m, " %2d %s", TargetID, (TargetFlags->TaggedQueuingSupported ? (TargetFlags->TaggedQueuingActive ? " Active" : (HostAdapter->TaggedQueuingPermitted & (1 << TargetID) | 3487 | seq_printf(m, " %2d %s", tgt, (tgt_flags->tagq_ok ? (tgt_flags->tagq_active ? " Active" : (adapter->tagq_ok & (1 << tgt) |
3237 | ? " Permitted" : " Disabled")) | 3488 | ? " Permitted" : " Disabled")) |
3238 | : "Not Supported")); | 3489 | : "Not Supported")); |
3239 | seq_printf(m, | 3490 | seq_printf(m, |
3240 | " %3d %3u %9u %9u\n", HostAdapter->QueueDepth[TargetID], HostAdapter->ActiveCommands[TargetID], TargetStatistics[TargetID].CommandsAttempted, TargetStatistics[TargetID].CommandsCompleted); | 3491 | " %3d %3u %9u %9u\n", adapter->qdepth[tgt], adapter->active_cmds[tgt], tgt_stats[tgt].cmds_tried, tgt_stats[tgt].cmds_complete); |
3241 | } | 3492 | } |
3242 | seq_printf(m, "\n\ | 3493 | seq_printf(m, "\n\ |
3243 | Target Read Commands Write Commands Total Bytes Read Total Bytes Written\n\ | 3494 | Target Read Commands Write Commands Total Bytes Read Total Bytes Written\n\ |
3244 | ====== ============= ============== =================== ===================\n"); | 3495 | ====== ============= ============== =================== ===================\n"); |
3245 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { | 3496 | for (tgt = 0; tgt < adapter->maxdev; tgt++) { |
3246 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; | 3497 | struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; |
3247 | if (!TargetFlags->TargetExists) | 3498 | if (!tgt_flags->tgt_exists) |
3248 | continue; | 3499 | continue; |
3249 | seq_printf(m, " %2d %9u %9u", TargetID, TargetStatistics[TargetID].ReadCommands, TargetStatistics[TargetID].WriteCommands); | 3500 | seq_printf(m, " %2d %9u %9u", tgt, tgt_stats[tgt].read_cmds, tgt_stats[tgt].write_cmds); |
3250 | if (TargetStatistics[TargetID].TotalBytesRead.Billions > 0) | 3501 | if (tgt_stats[tgt].bytesread.billions > 0) |
3251 | seq_printf(m, " %9u%09u", TargetStatistics[TargetID].TotalBytesRead.Billions, TargetStatistics[TargetID].TotalBytesRead.Units); | 3502 | seq_printf(m, " %9u%09u", tgt_stats[tgt].bytesread.billions, tgt_stats[tgt].bytesread.units); |
3252 | else | 3503 | else |
3253 | seq_printf(m, " %9u", TargetStatistics[TargetID].TotalBytesRead.Units); | 3504 | seq_printf(m, " %9u", tgt_stats[tgt].bytesread.units); |
3254 | if (TargetStatistics[TargetID].TotalBytesWritten.Billions > 0) | 3505 | if (tgt_stats[tgt].byteswritten.billions > 0) |
3255 | seq_printf(m, " %9u%09u\n", TargetStatistics[TargetID].TotalBytesWritten.Billions, TargetStatistics[TargetID].TotalBytesWritten.Units); | 3506 | seq_printf(m, " %9u%09u\n", tgt_stats[tgt].byteswritten.billions, tgt_stats[tgt].byteswritten.units); |
3256 | else | 3507 | else |
3257 | seq_printf(m, " %9u\n", TargetStatistics[TargetID].TotalBytesWritten.Units); | 3508 | seq_printf(m, " %9u\n", tgt_stats[tgt].byteswritten.units); |
3258 | } | 3509 | } |
3259 | seq_printf(m, "\n\ | 3510 | seq_printf(m, "\n\ |
3260 | Target Command 0-1KB 1-2KB 2-4KB 4-8KB 8-16KB\n\ | 3511 | Target Command 0-1KB 1-2KB 2-4KB 4-8KB 8-16KB\n\ |
3261 | ====== ======= ========= ========= ========= ========= =========\n"); | 3512 | ====== ======= ========= ========= ========= ========= =========\n"); |
3262 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { | 3513 | for (tgt = 0; tgt < adapter->maxdev; tgt++) { |
3263 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; | 3514 | struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; |
3264 | if (!TargetFlags->TargetExists) | 3515 | if (!tgt_flags->tgt_exists) |
3265 | continue; | 3516 | continue; |
3266 | seq_printf(m, | 3517 | seq_printf(m, |
3267 | " %2d Read %9u %9u %9u %9u %9u\n", TargetID, | 3518 | " %2d Read %9u %9u %9u %9u %9u\n", tgt, |
3268 | TargetStatistics[TargetID].ReadCommandSizeBuckets[0], | 3519 | tgt_stats[tgt].read_sz_buckets[0], |
3269 | TargetStatistics[TargetID].ReadCommandSizeBuckets[1], TargetStatistics[TargetID].ReadCommandSizeBuckets[2], TargetStatistics[TargetID].ReadCommandSizeBuckets[3], TargetStatistics[TargetID].ReadCommandSizeBuckets[4]); | 3520 | tgt_stats[tgt].read_sz_buckets[1], tgt_stats[tgt].read_sz_buckets[2], tgt_stats[tgt].read_sz_buckets[3], tgt_stats[tgt].read_sz_buckets[4]); |
3270 | seq_printf(m, | 3521 | seq_printf(m, |
3271 | " %2d Write %9u %9u %9u %9u %9u\n", TargetID, | 3522 | " %2d Write %9u %9u %9u %9u %9u\n", tgt, |
3272 | TargetStatistics[TargetID].WriteCommandSizeBuckets[0], | 3523 | tgt_stats[tgt].write_sz_buckets[0], |
3273 | TargetStatistics[TargetID].WriteCommandSizeBuckets[1], TargetStatistics[TargetID].WriteCommandSizeBuckets[2], TargetStatistics[TargetID].WriteCommandSizeBuckets[3], TargetStatistics[TargetID].WriteCommandSizeBuckets[4]); | 3524 | tgt_stats[tgt].write_sz_buckets[1], tgt_stats[tgt].write_sz_buckets[2], tgt_stats[tgt].write_sz_buckets[3], tgt_stats[tgt].write_sz_buckets[4]); |
3274 | } | 3525 | } |
3275 | seq_printf(m, "\n\ | 3526 | seq_printf(m, "\n\ |
3276 | Target Command 16-32KB 32-64KB 64-128KB 128-256KB 256KB+\n\ | 3527 | Target Command 16-32KB 32-64KB 64-128KB 128-256KB 256KB+\n\ |
3277 | ====== ======= ========= ========= ========= ========= =========\n"); | 3528 | ====== ======= ========= ========= ========= ========= =========\n"); |
3278 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { | 3529 | for (tgt = 0; tgt < adapter->maxdev; tgt++) { |
3279 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; | 3530 | struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; |
3280 | if (!TargetFlags->TargetExists) | 3531 | if (!tgt_flags->tgt_exists) |
3281 | continue; | 3532 | continue; |
3282 | seq_printf(m, | 3533 | seq_printf(m, |
3283 | " %2d Read %9u %9u %9u %9u %9u\n", TargetID, | 3534 | " %2d Read %9u %9u %9u %9u %9u\n", tgt, |
3284 | TargetStatistics[TargetID].ReadCommandSizeBuckets[5], | 3535 | tgt_stats[tgt].read_sz_buckets[5], |
3285 | TargetStatistics[TargetID].ReadCommandSizeBuckets[6], TargetStatistics[TargetID].ReadCommandSizeBuckets[7], TargetStatistics[TargetID].ReadCommandSizeBuckets[8], TargetStatistics[TargetID].ReadCommandSizeBuckets[9]); | 3536 | tgt_stats[tgt].read_sz_buckets[6], tgt_stats[tgt].read_sz_buckets[7], tgt_stats[tgt].read_sz_buckets[8], tgt_stats[tgt].read_sz_buckets[9]); |
3286 | seq_printf(m, | 3537 | seq_printf(m, |
3287 | " %2d Write %9u %9u %9u %9u %9u\n", TargetID, | 3538 | " %2d Write %9u %9u %9u %9u %9u\n", tgt, |
3288 | TargetStatistics[TargetID].WriteCommandSizeBuckets[5], | 3539 | tgt_stats[tgt].write_sz_buckets[5], |
3289 | TargetStatistics[TargetID].WriteCommandSizeBuckets[6], TargetStatistics[TargetID].WriteCommandSizeBuckets[7], TargetStatistics[TargetID].WriteCommandSizeBuckets[8], TargetStatistics[TargetID].WriteCommandSizeBuckets[9]); | 3540 | tgt_stats[tgt].write_sz_buckets[6], tgt_stats[tgt].write_sz_buckets[7], tgt_stats[tgt].write_sz_buckets[8], tgt_stats[tgt].write_sz_buckets[9]); |
3290 | } | 3541 | } |
3291 | seq_printf(m, "\n\n\ | 3542 | seq_printf(m, "\n\n\ |
3292 | ERROR RECOVERY STATISTICS\n\ | 3543 | ERROR RECOVERY STATISTICS\n\ |
@@ -3295,84 +3546,86 @@ Target Command 16-32KB 32-64KB 64-128KB 128-256KB 256KB+\n\ | |||
3295 | Target Requested Completed Requested Completed Requested Completed\n\ | 3546 | Target Requested Completed Requested Completed Requested Completed\n\ |
3296 | ID \\\\\\\\ Attempted //// \\\\\\\\ Attempted //// \\\\\\\\ Attempted ////\n\ | 3547 | ID \\\\\\\\ Attempted //// \\\\\\\\ Attempted //// \\\\\\\\ Attempted ////\n\ |
3297 | ====== ===== ===== ===== ===== ===== ===== ===== ===== =====\n"); | 3548 | ====== ===== ===== ===== ===== ===== ===== ===== ===== =====\n"); |
3298 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { | 3549 | for (tgt = 0; tgt < adapter->maxdev; tgt++) { |
3299 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; | 3550 | struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; |
3300 | if (!TargetFlags->TargetExists) | 3551 | if (!tgt_flags->tgt_exists) |
3301 | continue; | 3552 | continue; |
3302 | seq_printf(m, "\ | 3553 | seq_printf(m, "\ |
3303 | %2d %5d %5d %5d %5d %5d %5d %5d %5d %5d\n", TargetID, TargetStatistics[TargetID].CommandAbortsRequested, TargetStatistics[TargetID].CommandAbortsAttempted, TargetStatistics[TargetID].CommandAbortsCompleted, TargetStatistics[TargetID].BusDeviceResetsRequested, TargetStatistics[TargetID].BusDeviceResetsAttempted, TargetStatistics[TargetID].BusDeviceResetsCompleted, TargetStatistics[TargetID].HostAdapterResetsRequested, TargetStatistics[TargetID].HostAdapterResetsAttempted, TargetStatistics[TargetID].HostAdapterResetsCompleted); | 3554 | %2d %5d %5d %5d %5d %5d %5d %5d %5d %5d\n", tgt, tgt_stats[tgt].aborts_request, tgt_stats[tgt].aborts_tried, tgt_stats[tgt].aborts_done, tgt_stats[tgt].bdr_request, tgt_stats[tgt].bdr_tried, tgt_stats[tgt].bdr_done, tgt_stats[tgt].adatper_reset_req, tgt_stats[tgt].adapter_reset_attempt, tgt_stats[tgt].adapter_reset_done); |
3304 | } | 3555 | } |
3305 | seq_printf(m, "\nExternal Host Adapter Resets: %d\n", HostAdapter->ExternalHostAdapterResets); | 3556 | seq_printf(m, "\nExternal Host Adapter Resets: %d\n", adapter->ext_resets); |
3306 | seq_printf(m, "Host Adapter Internal Errors: %d\n", HostAdapter->HostAdapterInternalErrors); | 3557 | seq_printf(m, "Host Adapter Internal Errors: %d\n", adapter->adapter_intern_errors); |
3307 | return 0; | 3558 | return 0; |
3308 | } | 3559 | } |
3309 | 3560 | ||
3310 | 3561 | ||
3311 | /* | 3562 | /* |
3312 | BusLogic_Message prints Driver Messages. | 3563 | blogic_msg prints Driver Messages. |
3313 | */ | 3564 | */ |
3314 | 3565 | ||
3315 | static void BusLogic_Message(enum BusLogic_MessageLevel MessageLevel, char *Format, struct BusLogic_HostAdapter *HostAdapter, ...) | 3566 | static void blogic_msg(enum blogic_msglevel msglevel, char *fmt, |
3567 | struct blogic_adapter *adapter, ...) | ||
3316 | { | 3568 | { |
3317 | static char Buffer[BusLogic_LineBufferSize]; | 3569 | static char buf[BLOGIC_LINEBUF_SIZE]; |
3318 | static bool BeginningOfLine = true; | 3570 | static bool begin = true; |
3319 | va_list Arguments; | 3571 | va_list args; |
3320 | int Length = 0; | 3572 | int len = 0; |
3321 | va_start(Arguments, HostAdapter); | 3573 | |
3322 | Length = vsprintf(Buffer, Format, Arguments); | 3574 | va_start(args, adapter); |
3323 | va_end(Arguments); | 3575 | len = vsprintf(buf, fmt, args); |
3324 | if (MessageLevel == BusLogic_AnnounceLevel) { | 3576 | va_end(args); |
3325 | static int AnnouncementLines = 0; | 3577 | if (msglevel == BLOGIC_ANNOUNCE_LEVEL) { |
3326 | strcpy(&HostAdapter->MessageBuffer[HostAdapter->MessageBufferLength], Buffer); | 3578 | static int msglines = 0; |
3327 | HostAdapter->MessageBufferLength += Length; | 3579 | strcpy(&adapter->msgbuf[adapter->msgbuflen], buf); |
3328 | if (++AnnouncementLines <= 2) | 3580 | adapter->msgbuflen += len; |
3329 | printk("%sscsi: %s", BusLogic_MessageLevelMap[MessageLevel], Buffer); | 3581 | if (++msglines <= 2) |
3330 | } else if (MessageLevel == BusLogic_InfoLevel) { | 3582 | printk("%sscsi: %s", blogic_msglevelmap[msglevel], buf); |
3331 | strcpy(&HostAdapter->MessageBuffer[HostAdapter->MessageBufferLength], Buffer); | 3583 | } else if (msglevel == BLOGIC_INFO_LEVEL) { |
3332 | HostAdapter->MessageBufferLength += Length; | 3584 | strcpy(&adapter->msgbuf[adapter->msgbuflen], buf); |
3333 | if (BeginningOfLine) { | 3585 | adapter->msgbuflen += len; |
3334 | if (Buffer[0] != '\n' || Length > 1) | 3586 | if (begin) { |
3335 | printk("%sscsi%d: %s", BusLogic_MessageLevelMap[MessageLevel], HostAdapter->HostNumber, Buffer); | 3587 | if (buf[0] != '\n' || len > 1) |
3588 | printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf); | ||
3336 | } else | 3589 | } else |
3337 | printk("%s", Buffer); | 3590 | printk("%s", buf); |
3338 | } else { | 3591 | } else { |
3339 | if (BeginningOfLine) { | 3592 | if (begin) { |
3340 | if (HostAdapter != NULL && HostAdapter->HostAdapterInitialized) | 3593 | if (adapter != NULL && adapter->adapter_initd) |
3341 | printk("%sscsi%d: %s", BusLogic_MessageLevelMap[MessageLevel], HostAdapter->HostNumber, Buffer); | 3594 | printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf); |
3342 | else | 3595 | else |
3343 | printk("%s%s", BusLogic_MessageLevelMap[MessageLevel], Buffer); | 3596 | printk("%s%s", blogic_msglevelmap[msglevel], buf); |
3344 | } else | 3597 | } else |
3345 | printk("%s", Buffer); | 3598 | printk("%s", buf); |
3346 | } | 3599 | } |
3347 | BeginningOfLine = (Buffer[Length - 1] == '\n'); | 3600 | begin = (buf[len - 1] == '\n'); |
3348 | } | 3601 | } |
3349 | 3602 | ||
3350 | 3603 | ||
3351 | /* | 3604 | /* |
3352 | BusLogic_ParseKeyword parses an individual option keyword. It returns true | 3605 | blogic_parse parses an individual option keyword. It returns true |
3353 | and updates the pointer if the keyword is recognized and false otherwise. | 3606 | and updates the pointer if the keyword is recognized and false otherwise. |
3354 | */ | 3607 | */ |
3355 | 3608 | ||
3356 | static bool __init BusLogic_ParseKeyword(char **StringPointer, char *Keyword) | 3609 | static bool __init blogic_parse(char **str, char *keyword) |
3357 | { | 3610 | { |
3358 | char *Pointer = *StringPointer; | 3611 | char *pointer = *str; |
3359 | while (*Keyword != '\0') { | 3612 | while (*keyword != '\0') { |
3360 | char StringChar = *Pointer++; | 3613 | char strch = *pointer++; |
3361 | char KeywordChar = *Keyword++; | 3614 | char keywordch = *keyword++; |
3362 | if (StringChar >= 'A' && StringChar <= 'Z') | 3615 | if (strch >= 'A' && strch <= 'Z') |
3363 | StringChar += 'a' - 'Z'; | 3616 | strch += 'a' - 'Z'; |
3364 | if (KeywordChar >= 'A' && KeywordChar <= 'Z') | 3617 | if (keywordch >= 'A' && keywordch <= 'Z') |
3365 | KeywordChar += 'a' - 'Z'; | 3618 | keywordch += 'a' - 'Z'; |
3366 | if (StringChar != KeywordChar) | 3619 | if (strch != keywordch) |
3367 | return false; | 3620 | return false; |
3368 | } | 3621 | } |
3369 | *StringPointer = Pointer; | 3622 | *str = pointer; |
3370 | return true; | 3623 | return true; |
3371 | } | 3624 | } |
3372 | 3625 | ||
3373 | 3626 | ||
3374 | /* | 3627 | /* |
3375 | BusLogic_ParseDriverOptions handles processing of BusLogic Driver Options | 3628 | blogic_parseopts handles processing of BusLogic Driver Options |
3376 | specifications. | 3629 | specifications. |
3377 | 3630 | ||
3378 | BusLogic Driver Options may be specified either via the Linux Kernel Command | 3631 | BusLogic Driver Options may be specified either via the Linux Kernel Command |
@@ -3388,164 +3641,177 @@ static bool __init BusLogic_ParseKeyword(char **StringPointer, char *Keyword) | |||
3388 | <file:Documentation/scsi/BusLogic.txt>. | 3641 | <file:Documentation/scsi/BusLogic.txt>. |
3389 | */ | 3642 | */ |
3390 | 3643 | ||
3391 | static int __init BusLogic_ParseDriverOptions(char *OptionsString) | 3644 | static int __init blogic_parseopts(char *options) |
3392 | { | 3645 | { |
3393 | while (true) { | 3646 | while (true) { |
3394 | struct BusLogic_DriverOptions *DriverOptions = &BusLogic_DriverOptions[BusLogic_DriverOptionsCount++]; | 3647 | struct blogic_drvr_options *drvr_opts = |
3395 | int TargetID; | 3648 | &blogic_drvr_options[blogic_drvr_options_count++]; |
3396 | memset(DriverOptions, 0, sizeof(struct BusLogic_DriverOptions)); | 3649 | int tgt_id; |
3397 | while (*OptionsString != '\0' && *OptionsString != ';') { | 3650 | |
3651 | memset(drvr_opts, 0, sizeof(struct blogic_drvr_options)); | ||
3652 | while (*options != '\0' && *options != ';') { | ||
3398 | /* Probing Options. */ | 3653 | /* Probing Options. */ |
3399 | if (BusLogic_ParseKeyword(&OptionsString, "IO:")) { | 3654 | if (blogic_parse(&options, "IO:")) { |
3400 | unsigned long IO_Address = simple_strtoul(OptionsString, &OptionsString, 0); | 3655 | unsigned long io_addr = simple_strtoul(options, |
3401 | BusLogic_ProbeOptions.LimitedProbeISA = true; | 3656 | &options, 0); |
3402 | switch (IO_Address) { | 3657 | blogic_probe_options.limited_isa = true; |
3658 | switch (io_addr) { | ||
3403 | case 0x330: | 3659 | case 0x330: |
3404 | BusLogic_ProbeOptions.Probe330 = true; | 3660 | blogic_probe_options.probe330 = true; |
3405 | break; | 3661 | break; |
3406 | case 0x334: | 3662 | case 0x334: |
3407 | BusLogic_ProbeOptions.Probe334 = true; | 3663 | blogic_probe_options.probe334 = true; |
3408 | break; | 3664 | break; |
3409 | case 0x230: | 3665 | case 0x230: |
3410 | BusLogic_ProbeOptions.Probe230 = true; | 3666 | blogic_probe_options.probe230 = true; |
3411 | break; | 3667 | break; |
3412 | case 0x234: | 3668 | case 0x234: |
3413 | BusLogic_ProbeOptions.Probe234 = true; | 3669 | blogic_probe_options.probe234 = true; |
3414 | break; | 3670 | break; |
3415 | case 0x130: | 3671 | case 0x130: |
3416 | BusLogic_ProbeOptions.Probe130 = true; | 3672 | blogic_probe_options.probe130 = true; |
3417 | break; | 3673 | break; |
3418 | case 0x134: | 3674 | case 0x134: |
3419 | BusLogic_ProbeOptions.Probe134 = true; | 3675 | blogic_probe_options.probe134 = true; |
3420 | break; | 3676 | break; |
3421 | default: | 3677 | default: |
3422 | BusLogic_Error("BusLogic: Invalid Driver Options " "(invalid I/O Address 0x%X)\n", NULL, IO_Address); | 3678 | blogic_err("BusLogic: Invalid Driver Options " "(invalid I/O Address 0x%X)\n", NULL, io_addr); |
3423 | return 0; | 3679 | return 0; |
3424 | } | 3680 | } |
3425 | } else if (BusLogic_ParseKeyword(&OptionsString, "NoProbeISA")) | 3681 | } else if (blogic_parse(&options, "NoProbeISA")) |
3426 | BusLogic_ProbeOptions.NoProbeISA = true; | 3682 | blogic_probe_options.noprobe_isa = true; |
3427 | else if (BusLogic_ParseKeyword(&OptionsString, "NoProbePCI")) | 3683 | else if (blogic_parse(&options, "NoProbePCI")) |
3428 | BusLogic_ProbeOptions.NoProbePCI = true; | 3684 | blogic_probe_options.noprobe_pci = true; |
3429 | else if (BusLogic_ParseKeyword(&OptionsString, "NoProbe")) | 3685 | else if (blogic_parse(&options, "NoProbe")) |
3430 | BusLogic_ProbeOptions.NoProbe = true; | 3686 | blogic_probe_options.noprobe = true; |
3431 | else if (BusLogic_ParseKeyword(&OptionsString, "NoSortPCI")) | 3687 | else if (blogic_parse(&options, "NoSortPCI")) |
3432 | BusLogic_ProbeOptions.NoSortPCI = true; | 3688 | blogic_probe_options.nosort_pci = true; |
3433 | else if (BusLogic_ParseKeyword(&OptionsString, "MultiMasterFirst")) | 3689 | else if (blogic_parse(&options, "MultiMasterFirst")) |
3434 | BusLogic_ProbeOptions.MultiMasterFirst = true; | 3690 | blogic_probe_options.multimaster_first = true; |
3435 | else if (BusLogic_ParseKeyword(&OptionsString, "FlashPointFirst")) | 3691 | else if (blogic_parse(&options, "FlashPointFirst")) |
3436 | BusLogic_ProbeOptions.FlashPointFirst = true; | 3692 | blogic_probe_options.flashpoint_first = true; |
3437 | /* Tagged Queuing Options. */ | 3693 | /* Tagged Queuing Options. */ |
3438 | else if (BusLogic_ParseKeyword(&OptionsString, "QueueDepth:[") || BusLogic_ParseKeyword(&OptionsString, "QD:[")) { | 3694 | else if (blogic_parse(&options, "QueueDepth:[") || |
3439 | for (TargetID = 0; TargetID < BusLogic_MaxTargetDevices; TargetID++) { | 3695 | blogic_parse(&options, "QD:[")) { |
3440 | unsigned short QueueDepth = simple_strtoul(OptionsString, &OptionsString, 0); | 3696 | for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++) { |
3441 | if (QueueDepth > BusLogic_MaxTaggedQueueDepth) { | 3697 | unsigned short qdepth = simple_strtoul(options, &options, 0); |
3442 | BusLogic_Error("BusLogic: Invalid Driver Options " "(invalid Queue Depth %d)\n", NULL, QueueDepth); | 3698 | if (qdepth > BLOGIC_MAX_TAG_DEPTH) { |
3699 | blogic_err("BusLogic: Invalid Driver Options " "(invalid Queue Depth %d)\n", NULL, qdepth); | ||
3443 | return 0; | 3700 | return 0; |
3444 | } | 3701 | } |
3445 | DriverOptions->QueueDepth[TargetID] = QueueDepth; | 3702 | drvr_opts->qdepth[tgt_id] = qdepth; |
3446 | if (*OptionsString == ',') | 3703 | if (*options == ',') |
3447 | OptionsString++; | 3704 | options++; |
3448 | else if (*OptionsString == ']') | 3705 | else if (*options == ']') |
3449 | break; | 3706 | break; |
3450 | else { | 3707 | else { |
3451 | BusLogic_Error("BusLogic: Invalid Driver Options " "(',' or ']' expected at '%s')\n", NULL, OptionsString); | 3708 | blogic_err("BusLogic: Invalid Driver Options " "(',' or ']' expected at '%s')\n", NULL, options); |
3452 | return 0; | 3709 | return 0; |
3453 | } | 3710 | } |
3454 | } | 3711 | } |
3455 | if (*OptionsString != ']') { | 3712 | if (*options != ']') { |
3456 | BusLogic_Error("BusLogic: Invalid Driver Options " "(']' expected at '%s')\n", NULL, OptionsString); | 3713 | blogic_err("BusLogic: Invalid Driver Options " "(']' expected at '%s')\n", NULL, options); |
3457 | return 0; | 3714 | return 0; |
3458 | } else | 3715 | } else |
3459 | OptionsString++; | 3716 | options++; |
3460 | } else if (BusLogic_ParseKeyword(&OptionsString, "QueueDepth:") || BusLogic_ParseKeyword(&OptionsString, "QD:")) { | 3717 | } else if (blogic_parse(&options, "QueueDepth:") || blogic_parse(&options, "QD:")) { |
3461 | unsigned short QueueDepth = simple_strtoul(OptionsString, &OptionsString, 0); | 3718 | unsigned short qdepth = simple_strtoul(options, &options, 0); |
3462 | if (QueueDepth == 0 || QueueDepth > BusLogic_MaxTaggedQueueDepth) { | 3719 | if (qdepth == 0 || |
3463 | BusLogic_Error("BusLogic: Invalid Driver Options " "(invalid Queue Depth %d)\n", NULL, QueueDepth); | 3720 | qdepth > BLOGIC_MAX_TAG_DEPTH) { |
3721 | blogic_err("BusLogic: Invalid Driver Options " "(invalid Queue Depth %d)\n", NULL, qdepth); | ||
3464 | return 0; | 3722 | return 0; |
3465 | } | 3723 | } |
3466 | DriverOptions->CommonQueueDepth = QueueDepth; | 3724 | drvr_opts->common_qdepth = qdepth; |
3467 | for (TargetID = 0; TargetID < BusLogic_MaxTargetDevices; TargetID++) | 3725 | for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++) |
3468 | DriverOptions->QueueDepth[TargetID] = QueueDepth; | 3726 | drvr_opts->qdepth[tgt_id] = qdepth; |
3469 | } else if (BusLogic_ParseKeyword(&OptionsString, "TaggedQueuing:") || BusLogic_ParseKeyword(&OptionsString, "TQ:")) { | 3727 | } else if (blogic_parse(&options, "TaggedQueuing:") || |
3470 | if (BusLogic_ParseKeyword(&OptionsString, "Default")) { | 3728 | blogic_parse(&options, "TQ:")) { |
3471 | DriverOptions->TaggedQueuingPermitted = 0x0000; | 3729 | if (blogic_parse(&options, "Default")) { |
3472 | DriverOptions->TaggedQueuingPermittedMask = 0x0000; | 3730 | drvr_opts->tagq_ok = 0x0000; |
3473 | } else if (BusLogic_ParseKeyword(&OptionsString, "Enable")) { | 3731 | drvr_opts->tagq_ok_mask = 0x0000; |
3474 | DriverOptions->TaggedQueuingPermitted = 0xFFFF; | 3732 | } else if (blogic_parse(&options, "Enable")) { |
3475 | DriverOptions->TaggedQueuingPermittedMask = 0xFFFF; | 3733 | drvr_opts->tagq_ok = 0xFFFF; |
3476 | } else if (BusLogic_ParseKeyword(&OptionsString, "Disable")) { | 3734 | drvr_opts->tagq_ok_mask = 0xFFFF; |
3477 | DriverOptions->TaggedQueuingPermitted = 0x0000; | 3735 | } else if (blogic_parse(&options, "Disable")) { |
3478 | DriverOptions->TaggedQueuingPermittedMask = 0xFFFF; | 3736 | drvr_opts->tagq_ok = 0x0000; |
3737 | drvr_opts->tagq_ok_mask = 0xFFFF; | ||
3479 | } else { | 3738 | } else { |
3480 | unsigned short TargetBit; | 3739 | unsigned short tgt_bit; |
3481 | for (TargetID = 0, TargetBit = 1; TargetID < BusLogic_MaxTargetDevices; TargetID++, TargetBit <<= 1) | 3740 | for (tgt_id = 0, tgt_bit = 1; |
3482 | switch (*OptionsString++) { | 3741 | tgt_id < BLOGIC_MAXDEV; |
3742 | tgt_id++, tgt_bit <<= 1) | ||
3743 | switch (*options++) { | ||
3483 | case 'Y': | 3744 | case 'Y': |
3484 | DriverOptions->TaggedQueuingPermitted |= TargetBit; | 3745 | drvr_opts->tagq_ok |= tgt_bit; |
3485 | DriverOptions->TaggedQueuingPermittedMask |= TargetBit; | 3746 | drvr_opts->tagq_ok_mask |= tgt_bit; |
3486 | break; | 3747 | break; |
3487 | case 'N': | 3748 | case 'N': |
3488 | DriverOptions->TaggedQueuingPermitted &= ~TargetBit; | 3749 | drvr_opts->tagq_ok &= ~tgt_bit; |
3489 | DriverOptions->TaggedQueuingPermittedMask |= TargetBit; | 3750 | drvr_opts->tagq_ok_mask |= tgt_bit; |
3490 | break; | 3751 | break; |
3491 | case 'X': | 3752 | case 'X': |
3492 | break; | 3753 | break; |
3493 | default: | 3754 | default: |
3494 | OptionsString--; | 3755 | options--; |
3495 | TargetID = BusLogic_MaxTargetDevices; | 3756 | tgt_id = BLOGIC_MAXDEV; |
3496 | break; | 3757 | break; |
3497 | } | 3758 | } |
3498 | } | 3759 | } |
3499 | } | 3760 | } |
3500 | /* Miscellaneous Options. */ | 3761 | /* Miscellaneous Options. */ |
3501 | else if (BusLogic_ParseKeyword(&OptionsString, "BusSettleTime:") || BusLogic_ParseKeyword(&OptionsString, "BST:")) { | 3762 | else if (blogic_parse(&options, "BusSettleTime:") || |
3502 | unsigned short BusSettleTime = simple_strtoul(OptionsString, &OptionsString, 0); | 3763 | blogic_parse(&options, "BST:")) { |
3503 | if (BusSettleTime > 5 * 60) { | 3764 | unsigned short bus_settle_time = |
3504 | BusLogic_Error("BusLogic: Invalid Driver Options " "(invalid Bus Settle Time %d)\n", NULL, BusSettleTime); | 3765 | simple_strtoul(options, &options, 0); |
3766 | if (bus_settle_time > 5 * 60) { | ||
3767 | blogic_err("BusLogic: Invalid Driver Options " "(invalid Bus Settle Time %d)\n", NULL, bus_settle_time); | ||
3505 | return 0; | 3768 | return 0; |
3506 | } | 3769 | } |
3507 | DriverOptions->BusSettleTime = BusSettleTime; | 3770 | drvr_opts->bus_settle_time = bus_settle_time; |
3508 | } else if (BusLogic_ParseKeyword(&OptionsString, "InhibitTargetInquiry")) | 3771 | } else if (blogic_parse(&options, |
3509 | DriverOptions->LocalOptions.InhibitTargetInquiry = true; | 3772 | "InhibitTargetInquiry")) |
3773 | drvr_opts->stop_tgt_inquiry = true; | ||
3510 | /* Debugging Options. */ | 3774 | /* Debugging Options. */ |
3511 | else if (BusLogic_ParseKeyword(&OptionsString, "TraceProbe")) | 3775 | else if (blogic_parse(&options, "TraceProbe")) |
3512 | BusLogic_GlobalOptions.TraceProbe = true; | 3776 | blogic_global_options.trace_probe = true; |
3513 | else if (BusLogic_ParseKeyword(&OptionsString, "TraceHardwareReset")) | 3777 | else if (blogic_parse(&options, "TraceHardwareReset")) |
3514 | BusLogic_GlobalOptions.TraceHardwareReset = true; | 3778 | blogic_global_options.trace_hw_reset = true; |
3515 | else if (BusLogic_ParseKeyword(&OptionsString, "TraceConfiguration")) | 3779 | else if (blogic_parse(&options, "TraceConfiguration")) |
3516 | BusLogic_GlobalOptions.TraceConfiguration = true; | 3780 | blogic_global_options.trace_config = true; |
3517 | else if (BusLogic_ParseKeyword(&OptionsString, "TraceErrors")) | 3781 | else if (blogic_parse(&options, "TraceErrors")) |
3518 | BusLogic_GlobalOptions.TraceErrors = true; | 3782 | blogic_global_options.trace_err = true; |
3519 | else if (BusLogic_ParseKeyword(&OptionsString, "Debug")) { | 3783 | else if (blogic_parse(&options, "Debug")) { |
3520 | BusLogic_GlobalOptions.TraceProbe = true; | 3784 | blogic_global_options.trace_probe = true; |
3521 | BusLogic_GlobalOptions.TraceHardwareReset = true; | 3785 | blogic_global_options.trace_hw_reset = true; |
3522 | BusLogic_GlobalOptions.TraceConfiguration = true; | 3786 | blogic_global_options.trace_config = true; |
3523 | BusLogic_GlobalOptions.TraceErrors = true; | 3787 | blogic_global_options.trace_err = true; |
3524 | } | 3788 | } |
3525 | if (*OptionsString == ',') | 3789 | if (*options == ',') |
3526 | OptionsString++; | 3790 | options++; |
3527 | else if (*OptionsString != ';' && *OptionsString != '\0') { | 3791 | else if (*options != ';' && *options != '\0') { |
3528 | BusLogic_Error("BusLogic: Unexpected Driver Option '%s' " "ignored\n", NULL, OptionsString); | 3792 | blogic_err("BusLogic: Unexpected Driver Option '%s' " "ignored\n", NULL, options); |
3529 | *OptionsString = '\0'; | 3793 | *options = '\0'; |
3530 | } | 3794 | } |
3531 | } | 3795 | } |
3532 | if (!(BusLogic_DriverOptionsCount == 0 || BusLogic_ProbeInfoCount == 0 || BusLogic_DriverOptionsCount == BusLogic_ProbeInfoCount)) { | 3796 | if (!(blogic_drvr_options_count == 0 || |
3533 | BusLogic_Error("BusLogic: Invalid Driver Options " "(all or no I/O Addresses must be specified)\n", NULL); | 3797 | blogic_probeinfo_count == 0 || |
3798 | blogic_drvr_options_count == blogic_probeinfo_count)) { | ||
3799 | blogic_err("BusLogic: Invalid Driver Options " "(all or no I/O Addresses must be specified)\n", NULL); | ||
3534 | return 0; | 3800 | return 0; |
3535 | } | 3801 | } |
3536 | /* | 3802 | /* |
3537 | Tagged Queuing is disabled when the Queue Depth is 1 since queuing | 3803 | Tagged Queuing is disabled when the Queue Depth is 1 since queuing |
3538 | multiple commands is not possible. | 3804 | multiple commands is not possible. |
3539 | */ | 3805 | */ |
3540 | for (TargetID = 0; TargetID < BusLogic_MaxTargetDevices; TargetID++) | 3806 | for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++) |
3541 | if (DriverOptions->QueueDepth[TargetID] == 1) { | 3807 | if (drvr_opts->qdepth[tgt_id] == 1) { |
3542 | unsigned short TargetBit = 1 << TargetID; | 3808 | unsigned short tgt_bit = 1 << tgt_id; |
3543 | DriverOptions->TaggedQueuingPermitted &= ~TargetBit; | 3809 | drvr_opts->tagq_ok &= ~tgt_bit; |
3544 | DriverOptions->TaggedQueuingPermittedMask |= TargetBit; | 3810 | drvr_opts->tagq_ok_mask |= tgt_bit; |
3545 | } | 3811 | } |
3546 | if (*OptionsString == ';') | 3812 | if (*options == ';') |
3547 | OptionsString++; | 3813 | options++; |
3548 | if (*OptionsString == '\0') | 3814 | if (*options == '\0') |
3549 | return 0; | 3815 | return 0; |
3550 | } | 3816 | } |
3551 | return 1; | 3817 | return 1; |
@@ -3555,19 +3821,19 @@ static int __init BusLogic_ParseDriverOptions(char *OptionsString) | |||
3555 | Get it all started | 3821 | Get it all started |
3556 | */ | 3822 | */ |
3557 | 3823 | ||
3558 | static struct scsi_host_template Bus_Logic_template = { | 3824 | static struct scsi_host_template blogic_template = { |
3559 | .module = THIS_MODULE, | 3825 | .module = THIS_MODULE, |
3560 | .proc_name = "BusLogic", | 3826 | .proc_name = "BusLogic", |
3561 | .write_info = BusLogic_write_info, | 3827 | .write_info = blogic_write_info, |
3562 | .show_info = BusLogic_show_info, | 3828 | .show_info = blogic_show_info, |
3563 | .name = "BusLogic", | 3829 | .name = "BusLogic", |
3564 | .info = BusLogic_DriverInfo, | 3830 | .info = blogic_drvr_info, |
3565 | .queuecommand = BusLogic_QueueCommand, | 3831 | .queuecommand = blogic_qcmd, |
3566 | .slave_configure = BusLogic_SlaveConfigure, | 3832 | .slave_configure = blogic_slaveconfig, |
3567 | .bios_param = BusLogic_BIOSDiskParameters, | 3833 | .bios_param = blogic_diskparam, |
3568 | .eh_host_reset_handler = BusLogic_host_reset, | 3834 | .eh_host_reset_handler = blogic_hostreset, |
3569 | #if 0 | 3835 | #if 0 |
3570 | .eh_abort_handler = BusLogic_AbortCommand, | 3836 | .eh_abort_handler = blogic_abort, |
3571 | #endif | 3837 | #endif |
3572 | .unchecked_isa_dma = 1, | 3838 | .unchecked_isa_dma = 1, |
3573 | .max_sectors = 128, | 3839 | .max_sectors = 128, |
@@ -3575,40 +3841,40 @@ static struct scsi_host_template Bus_Logic_template = { | |||
3575 | }; | 3841 | }; |
3576 | 3842 | ||
3577 | /* | 3843 | /* |
3578 | BusLogic_Setup handles processing of Kernel Command Line Arguments. | 3844 | blogic_setup handles processing of Kernel Command Line Arguments. |
3579 | */ | 3845 | */ |
3580 | 3846 | ||
3581 | static int __init BusLogic_Setup(char *str) | 3847 | static int __init blogic_setup(char *str) |
3582 | { | 3848 | { |
3583 | int ints[3]; | 3849 | int ints[3]; |
3584 | 3850 | ||
3585 | (void) get_options(str, ARRAY_SIZE(ints), ints); | 3851 | (void) get_options(str, ARRAY_SIZE(ints), ints); |
3586 | 3852 | ||
3587 | if (ints[0] != 0) { | 3853 | if (ints[0] != 0) { |
3588 | BusLogic_Error("BusLogic: Obsolete Command Line Entry " "Format Ignored\n", NULL); | 3854 | blogic_err("BusLogic: Obsolete Command Line Entry " "Format Ignored\n", NULL); |
3589 | return 0; | 3855 | return 0; |
3590 | } | 3856 | } |
3591 | if (str == NULL || *str == '\0') | 3857 | if (str == NULL || *str == '\0') |
3592 | return 0; | 3858 | return 0; |
3593 | return BusLogic_ParseDriverOptions(str); | 3859 | return blogic_parseopts(str); |
3594 | } | 3860 | } |
3595 | 3861 | ||
3596 | /* | 3862 | /* |
3597 | * Exit function. Deletes all hosts associated with this driver. | 3863 | * Exit function. Deletes all hosts associated with this driver. |
3598 | */ | 3864 | */ |
3599 | 3865 | ||
3600 | static void __exit BusLogic_exit(void) | 3866 | static void __exit blogic_exit(void) |
3601 | { | 3867 | { |
3602 | struct BusLogic_HostAdapter *ha, *next; | 3868 | struct blogic_adapter *ha, *next; |
3603 | 3869 | ||
3604 | list_for_each_entry_safe(ha, next, &BusLogic_host_list, host_list) | 3870 | list_for_each_entry_safe(ha, next, &blogic_host_list, host_list) |
3605 | BusLogic_ReleaseHostAdapter(ha); | 3871 | blogic_deladapter(ha); |
3606 | } | 3872 | } |
3607 | 3873 | ||
3608 | __setup("BusLogic=", BusLogic_Setup); | 3874 | __setup("BusLogic=", blogic_setup); |
3609 | 3875 | ||
3610 | #ifdef MODULE | 3876 | #ifdef MODULE |
3611 | static struct pci_device_id BusLogic_pci_tbl[] = { | 3877 | /*static struct pci_device_id blogic_pci_tbl[] = { |
3612 | { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, | 3878 | { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, |
3613 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 3879 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
3614 | { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, | 3880 | { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, |
@@ -3616,9 +3882,15 @@ static struct pci_device_id BusLogic_pci_tbl[] = { | |||
3616 | { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT, | 3882 | { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT, |
3617 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 3883 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
3618 | { } | 3884 | { } |
3885 | };*/ | ||
3886 | static DEFINE_PCI_DEVICE_TABLE(blogic_pci_tbl) = { | ||
3887 | {PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER)}, | ||
3888 | {PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC)}, | ||
3889 | {PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT)}, | ||
3890 | {0, }, | ||
3619 | }; | 3891 | }; |
3620 | #endif | 3892 | #endif |
3621 | MODULE_DEVICE_TABLE(pci, BusLogic_pci_tbl); | 3893 | MODULE_DEVICE_TABLE(pci, blogic_pci_tbl); |
3622 | 3894 | ||
3623 | module_init(BusLogic_init); | 3895 | module_init(blogic_init); |
3624 | module_exit(BusLogic_exit); | 3896 | module_exit(blogic_exit); |
diff --git a/drivers/scsi/BusLogic.h b/drivers/scsi/BusLogic.h index 6c6c13c3be1b..b53ec2f1e8cd 100644 --- a/drivers/scsi/BusLogic.h +++ b/drivers/scsi/BusLogic.h | |||
@@ -37,14 +37,14 @@ | |||
37 | Define the maximum number of BusLogic Host Adapters supported by this driver. | 37 | Define the maximum number of BusLogic Host Adapters supported by this driver. |
38 | */ | 38 | */ |
39 | 39 | ||
40 | #define BusLogic_MaxHostAdapters 16 | 40 | #define BLOGIC_MAX_ADAPTERS 16 |
41 | 41 | ||
42 | 42 | ||
43 | /* | 43 | /* |
44 | Define the maximum number of Target Devices supported by this driver. | 44 | Define the maximum number of Target Devices supported by this driver. |
45 | */ | 45 | */ |
46 | 46 | ||
47 | #define BusLogic_MaxTargetDevices 16 | 47 | #define BLOGIC_MAXDEV 16 |
48 | 48 | ||
49 | 49 | ||
50 | /* | 50 | /* |
@@ -53,7 +53,7 @@ | |||
53 | large as the largest single request generated by the I/O Subsystem. | 53 | large as the largest single request generated by the I/O Subsystem. |
54 | */ | 54 | */ |
55 | 55 | ||
56 | #define BusLogic_ScatterGatherLimit 128 | 56 | #define BLOGIC_SG_LIMIT 128 |
57 | 57 | ||
58 | 58 | ||
59 | /* | 59 | /* |
@@ -62,12 +62,12 @@ | |||
62 | Tagged Queuing and whether or not ISA Bounce Buffers are required. | 62 | Tagged Queuing and whether or not ISA Bounce Buffers are required. |
63 | */ | 63 | */ |
64 | 64 | ||
65 | #define BusLogic_MaxTaggedQueueDepth 64 | 65 | #define BLOGIC_MAX_TAG_DEPTH 64 |
66 | #define BusLogic_MaxAutomaticTaggedQueueDepth 28 | 66 | #define BLOGIC_MAX_AUTO_TAG_DEPTH 28 |
67 | #define BusLogic_MinAutomaticTaggedQueueDepth 7 | 67 | #define BLOGIC_MIN_AUTO_TAG_DEPTH 7 |
68 | #define BusLogic_TaggedQueueDepthBB 3 | 68 | #define BLOGIC_TAG_DEPTH_BB 3 |
69 | #define BusLogic_UntaggedQueueDepth 3 | 69 | #define BLOGIC_UNTAG_DEPTH 3 |
70 | #define BusLogic_UntaggedQueueDepthBB 2 | 70 | #define BLOGIC_UNTAG_DEPTH_BB 2 |
71 | 71 | ||
72 | 72 | ||
73 | /* | 73 | /* |
@@ -77,7 +77,7 @@ | |||
77 | a SCSI Bus Reset. | 77 | a SCSI Bus Reset. |
78 | */ | 78 | */ |
79 | 79 | ||
80 | #define BusLogic_DefaultBusSettleTime 2 | 80 | #define BLOGIC_BUS_SETTLE_TIME 2 |
81 | 81 | ||
82 | 82 | ||
83 | /* | 83 | /* |
@@ -87,7 +87,7 @@ | |||
87 | does not cross an allocation block size boundary. | 87 | does not cross an allocation block size boundary. |
88 | */ | 88 | */ |
89 | 89 | ||
90 | #define BusLogic_MaxMailboxes 211 | 90 | #define BLOGIC_MAX_MAILBOX 211 |
91 | 91 | ||
92 | 92 | ||
93 | /* | 93 | /* |
@@ -95,50 +95,50 @@ | |||
95 | Kernel memory allocation. | 95 | Kernel memory allocation. |
96 | */ | 96 | */ |
97 | 97 | ||
98 | #define BusLogic_CCB_AllocationGroupSize 7 | 98 | #define BLOGIC_CCB_GRP_ALLOCSIZE 7 |
99 | 99 | ||
100 | 100 | ||
101 | /* | 101 | /* |
102 | Define the Host Adapter Line and Message Buffer Sizes. | 102 | Define the Host Adapter Line and Message Buffer Sizes. |
103 | */ | 103 | */ |
104 | 104 | ||
105 | #define BusLogic_LineBufferSize 100 | 105 | #define BLOGIC_LINEBUF_SIZE 100 |
106 | #define BusLogic_MessageBufferSize 9700 | 106 | #define BLOGIC_MSGBUF_SIZE 9700 |
107 | 107 | ||
108 | 108 | ||
109 | /* | 109 | /* |
110 | Define the Driver Message Levels. | 110 | Define the Driver Message Levels. |
111 | */ | 111 | */ |
112 | 112 | ||
113 | enum BusLogic_MessageLevel { | 113 | enum blogic_msglevel { |
114 | BusLogic_AnnounceLevel = 0, | 114 | BLOGIC_ANNOUNCE_LEVEL = 0, |
115 | BusLogic_InfoLevel = 1, | 115 | BLOGIC_INFO_LEVEL = 1, |
116 | BusLogic_NoticeLevel = 2, | 116 | BLOGIC_NOTICE_LEVEL = 2, |
117 | BusLogic_WarningLevel = 3, | 117 | BLOGIC_WARN_LEVEL = 3, |
118 | BusLogic_ErrorLevel = 4 | 118 | BLOGIC_ERR_LEVEL = 4 |
119 | }; | 119 | }; |
120 | 120 | ||
121 | static char *BusLogic_MessageLevelMap[] = { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING, KERN_ERR }; | 121 | static char *blogic_msglevelmap[] = { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING, KERN_ERR }; |
122 | 122 | ||
123 | 123 | ||
124 | /* | 124 | /* |
125 | Define Driver Message macros. | 125 | Define Driver Message macros. |
126 | */ | 126 | */ |
127 | 127 | ||
128 | #define BusLogic_Announce(Format, Arguments...) \ | 128 | #define blogic_announce(format, args...) \ |
129 | BusLogic_Message(BusLogic_AnnounceLevel, Format, ##Arguments) | 129 | blogic_msg(BLOGIC_ANNOUNCE_LEVEL, format, ##args) |
130 | 130 | ||
131 | #define BusLogic_Info(Format, Arguments...) \ | 131 | #define blogic_info(format, args...) \ |
132 | BusLogic_Message(BusLogic_InfoLevel, Format, ##Arguments) | 132 | blogic_msg(BLOGIC_INFO_LEVEL, format, ##args) |
133 | 133 | ||
134 | #define BusLogic_Notice(Format, Arguments...) \ | 134 | #define blogic_notice(format, args...) \ |
135 | BusLogic_Message(BusLogic_NoticeLevel, Format, ##Arguments) | 135 | blogic_msg(BLOGIC_NOTICE_LEVEL, format, ##args) |
136 | 136 | ||
137 | #define BusLogic_Warning(Format, Arguments...) \ | 137 | #define blogic_warn(format, args...) \ |
138 | BusLogic_Message(BusLogic_WarningLevel, Format, ##Arguments) | 138 | blogic_msg(BLOGIC_WARN_LEVEL, format, ##args) |
139 | 139 | ||
140 | #define BusLogic_Error(Format, Arguments...) \ | 140 | #define blogic_err(format, args...) \ |
141 | BusLogic_Message(BusLogic_ErrorLevel, Format, ##Arguments) | 141 | blogic_msg(BLOGIC_ERR_LEVEL, format, ##args) |
142 | 142 | ||
143 | 143 | ||
144 | /* | 144 | /* |
@@ -146,15 +146,15 @@ static char *BusLogic_MessageLevelMap[] = { KERN_NOTICE, KERN_NOTICE, KERN_NOTIC | |||
146 | of I/O Addresses required by each type. | 146 | of I/O Addresses required by each type. |
147 | */ | 147 | */ |
148 | 148 | ||
149 | enum BusLogic_HostAdapterType { | 149 | enum blogic_adapter_type { |
150 | BusLogic_MultiMaster = 1, | 150 | BLOGIC_MULTIMASTER = 1, |
151 | BusLogic_FlashPoint = 2 | 151 | BLOGIC_FLASHPOINT = 2 |
152 | } PACKED; | 152 | } PACKED; |
153 | 153 | ||
154 | #define BusLogic_MultiMasterAddressCount 4 | 154 | #define BLOGIC_MULTIMASTER_ADDR_COUNT 4 |
155 | #define BusLogic_FlashPointAddressCount 256 | 155 | #define BLOGIC_FLASHPOINT_ADDR_COUNT 256 |
156 | 156 | ||
157 | static int BusLogic_HostAdapterAddressCount[3] = { 0, BusLogic_MultiMasterAddressCount, BusLogic_FlashPointAddressCount }; | 157 | static int blogic_adapter_addr_count[3] = { 0, BLOGIC_MULTIMASTER_ADDR_COUNT, BLOGIC_FLASHPOINT_ADDR_COUNT }; |
158 | 158 | ||
159 | 159 | ||
160 | /* | 160 | /* |
@@ -163,19 +163,16 @@ static int BusLogic_HostAdapterAddressCount[3] = { 0, BusLogic_MultiMasterAddres | |||
163 | 163 | ||
164 | #ifdef CONFIG_SCSI_FLASHPOINT | 164 | #ifdef CONFIG_SCSI_FLASHPOINT |
165 | 165 | ||
166 | #define BusLogic_MultiMasterHostAdapterP(HostAdapter) \ | 166 | #define blogic_multimaster_type(adapter) \ |
167 | (HostAdapter->HostAdapterType == BusLogic_MultiMaster) | 167 | (adapter->adapter_type == BLOGIC_MULTIMASTER) |
168 | 168 | ||
169 | #define BusLogic_FlashPointHostAdapterP(HostAdapter) \ | 169 | #define blogic_flashpoint_type(adapter) \ |
170 | (HostAdapter->HostAdapterType == BusLogic_FlashPoint) | 170 | (adapter->adapter_type == BLOGIC_FLASHPOINT) |
171 | 171 | ||
172 | #else | 172 | #else |
173 | 173 | ||
174 | #define BusLogic_MultiMasterHostAdapterP(HostAdapter) \ | 174 | #define blogic_multimaster_type(adapter) (true) |
175 | (true) | 175 | #define blogic_flashpoint_type(adapter) (false) |
176 | |||
177 | #define BusLogic_FlashPointHostAdapterP(HostAdapter) \ | ||
178 | (false) | ||
179 | 176 | ||
180 | #endif | 177 | #endif |
181 | 178 | ||
@@ -184,35 +181,35 @@ static int BusLogic_HostAdapterAddressCount[3] = { 0, BusLogic_MultiMasterAddres | |||
184 | Define the possible Host Adapter Bus Types. | 181 | Define the possible Host Adapter Bus Types. |
185 | */ | 182 | */ |
186 | 183 | ||
187 | enum BusLogic_HostAdapterBusType { | 184 | enum blogic_adapter_bus_type { |
188 | BusLogic_Unknown_Bus = 0, | 185 | BLOGIC_UNKNOWN_BUS = 0, |
189 | BusLogic_ISA_Bus = 1, | 186 | BLOGIC_ISA_BUS = 1, |
190 | BusLogic_EISA_Bus = 2, | 187 | BLOGIC_EISA_BUS = 2, |
191 | BusLogic_PCI_Bus = 3, | 188 | BLOGIC_PCI_BUS = 3, |
192 | BusLogic_VESA_Bus = 4, | 189 | BLOGIC_VESA_BUS = 4, |
193 | BusLogic_MCA_Bus = 5 | 190 | BLOGIC_MCA_BUS = 5 |
194 | } PACKED; | 191 | } PACKED; |
195 | 192 | ||
196 | static char *BusLogic_HostAdapterBusNames[] = { "Unknown", "ISA", "EISA", "PCI", "VESA", "MCA" }; | 193 | static char *blogic_adapter_busnames[] = { "Unknown", "ISA", "EISA", "PCI", "VESA", "MCA" }; |
197 | 194 | ||
198 | static enum BusLogic_HostAdapterBusType BusLogic_HostAdapterBusTypes[] = { | 195 | static enum blogic_adapter_bus_type blogic_adater_bus_types[] = { |
199 | BusLogic_VESA_Bus, /* BT-4xx */ | 196 | BLOGIC_VESA_BUS, /* BT-4xx */ |
200 | BusLogic_ISA_Bus, /* BT-5xx */ | 197 | BLOGIC_ISA_BUS, /* BT-5xx */ |
201 | BusLogic_MCA_Bus, /* BT-6xx */ | 198 | BLOGIC_MCA_BUS, /* BT-6xx */ |
202 | BusLogic_EISA_Bus, /* BT-7xx */ | 199 | BLOGIC_EISA_BUS, /* BT-7xx */ |
203 | BusLogic_Unknown_Bus, /* BT-8xx */ | 200 | BLOGIC_UNKNOWN_BUS, /* BT-8xx */ |
204 | BusLogic_PCI_Bus /* BT-9xx */ | 201 | BLOGIC_PCI_BUS /* BT-9xx */ |
205 | }; | 202 | }; |
206 | 203 | ||
207 | /* | 204 | /* |
208 | Define the possible Host Adapter BIOS Disk Geometry Translations. | 205 | Define the possible Host Adapter BIOS Disk Geometry Translations. |
209 | */ | 206 | */ |
210 | 207 | ||
211 | enum BusLogic_BIOS_DiskGeometryTranslation { | 208 | enum blogic_bios_diskgeometry { |
212 | BusLogic_BIOS_Disk_Not_Installed = 0, | 209 | BLOGIC_BIOS_NODISK = 0, |
213 | BusLogic_BIOS_Disk_Installed_64x32 = 1, | 210 | BLOGIC_BIOS_DISK64x32 = 1, |
214 | BusLogic_BIOS_Disk_Installed_128x32 = 2, | 211 | BLOGIC_BIOS_DISK128x32 = 2, |
215 | BusLogic_BIOS_Disk_Installed_255x63 = 3 | 212 | BLOGIC_BIOS_DISK255x63 = 3 |
216 | } PACKED; | 213 | } PACKED; |
217 | 214 | ||
218 | 215 | ||
@@ -220,9 +217,9 @@ enum BusLogic_BIOS_DiskGeometryTranslation { | |||
220 | Define a 10^18 Statistics Byte Counter data type. | 217 | Define a 10^18 Statistics Byte Counter data type. |
221 | */ | 218 | */ |
222 | 219 | ||
223 | struct BusLogic_ByteCounter { | 220 | struct blogic_byte_count { |
224 | unsigned int Units; | 221 | unsigned int units; |
225 | unsigned int Billions; | 222 | unsigned int billions; |
226 | }; | 223 | }; |
227 | 224 | ||
228 | 225 | ||
@@ -230,79 +227,71 @@ struct BusLogic_ByteCounter { | |||
230 | Define the structure for I/O Address and Bus Probing Information. | 227 | Define the structure for I/O Address and Bus Probing Information. |
231 | */ | 228 | */ |
232 | 229 | ||
233 | struct BusLogic_ProbeInfo { | 230 | struct blogic_probeinfo { |
234 | enum BusLogic_HostAdapterType HostAdapterType; | 231 | enum blogic_adapter_type adapter_type; |
235 | enum BusLogic_HostAdapterBusType HostAdapterBusType; | 232 | enum blogic_adapter_bus_type adapter_bus_type; |
236 | unsigned long IO_Address; | 233 | unsigned long io_addr; |
237 | unsigned long PCI_Address; | 234 | unsigned long pci_addr; |
238 | struct pci_dev *PCI_Device; | 235 | struct pci_dev *pci_device; |
239 | unsigned char Bus; | 236 | unsigned char bus; |
240 | unsigned char Device; | 237 | unsigned char dev; |
241 | unsigned char IRQ_Channel; | 238 | unsigned char irq_ch; |
242 | }; | 239 | }; |
243 | 240 | ||
244 | /* | 241 | /* |
245 | Define the Probe Options. | 242 | Define the Probe Options. |
246 | */ | 243 | */ |
247 | 244 | ||
248 | struct BusLogic_ProbeOptions { | 245 | struct blogic_probe_options { |
249 | bool NoProbe:1; /* Bit 0 */ | 246 | bool noprobe:1; /* Bit 0 */ |
250 | bool NoProbeISA:1; /* Bit 1 */ | 247 | bool noprobe_isa:1; /* Bit 1 */ |
251 | bool NoProbePCI:1; /* Bit 2 */ | 248 | bool noprobe_pci:1; /* Bit 2 */ |
252 | bool NoSortPCI:1; /* Bit 3 */ | 249 | bool nosort_pci:1; /* Bit 3 */ |
253 | bool MultiMasterFirst:1;/* Bit 4 */ | 250 | bool multimaster_first:1; /* Bit 4 */ |
254 | bool FlashPointFirst:1; /* Bit 5 */ | 251 | bool flashpoint_first:1; /* Bit 5 */ |
255 | bool LimitedProbeISA:1; /* Bit 6 */ | 252 | bool limited_isa:1; /* Bit 6 */ |
256 | bool Probe330:1; /* Bit 7 */ | 253 | bool probe330:1; /* Bit 7 */ |
257 | bool Probe334:1; /* Bit 8 */ | 254 | bool probe334:1; /* Bit 8 */ |
258 | bool Probe230:1; /* Bit 9 */ | 255 | bool probe230:1; /* Bit 9 */ |
259 | bool Probe234:1; /* Bit 10 */ | 256 | bool probe234:1; /* Bit 10 */ |
260 | bool Probe130:1; /* Bit 11 */ | 257 | bool probe130:1; /* Bit 11 */ |
261 | bool Probe134:1; /* Bit 12 */ | 258 | bool probe134:1; /* Bit 12 */ |
262 | }; | 259 | }; |
263 | 260 | ||
264 | /* | 261 | /* |
265 | Define the Global Options. | 262 | Define the Global Options. |
266 | */ | 263 | */ |
267 | 264 | ||
268 | struct BusLogic_GlobalOptions { | 265 | struct blogic_global_options { |
269 | bool TraceProbe:1; /* Bit 0 */ | 266 | bool trace_probe:1; /* Bit 0 */ |
270 | bool TraceHardwareReset:1; /* Bit 1 */ | 267 | bool trace_hw_reset:1; /* Bit 1 */ |
271 | bool TraceConfiguration:1; /* Bit 2 */ | 268 | bool trace_config:1; /* Bit 2 */ |
272 | bool TraceErrors:1; /* Bit 3 */ | 269 | bool trace_err:1; /* Bit 3 */ |
273 | }; | ||
274 | |||
275 | /* | ||
276 | Define the Local Options. | ||
277 | */ | ||
278 | |||
279 | struct BusLogic_LocalOptions { | ||
280 | bool InhibitTargetInquiry:1; /* Bit 0 */ | ||
281 | }; | 270 | }; |
282 | 271 | ||
283 | /* | 272 | /* |
284 | Define the BusLogic SCSI Host Adapter I/O Register Offsets. | 273 | Define the BusLogic SCSI Host Adapter I/O Register Offsets. |
285 | */ | 274 | */ |
286 | 275 | ||
287 | #define BusLogic_ControlRegisterOffset 0 /* WO register */ | 276 | #define BLOGIC_CNTRL_REG 0 /* WO register */ |
288 | #define BusLogic_StatusRegisterOffset 0 /* RO register */ | 277 | #define BLOGIC_STATUS_REG 0 /* RO register */ |
289 | #define BusLogic_CommandParameterRegisterOffset 1 /* WO register */ | 278 | #define BLOGIC_CMD_PARM_REG 1 /* WO register */ |
290 | #define BusLogic_DataInRegisterOffset 1 /* RO register */ | 279 | #define BLOGIC_DATAIN_REG 1 /* RO register */ |
291 | #define BusLogic_InterruptRegisterOffset 2 /* RO register */ | 280 | #define BLOGIC_INT_REG 2 /* RO register */ |
292 | #define BusLogic_GeometryRegisterOffset 3 /* RO register */ | 281 | #define BLOGIC_GEOMETRY_REG 3 /* RO register */ |
293 | 282 | ||
294 | /* | 283 | /* |
295 | Define the structure of the write-only Control Register. | 284 | Define the structure of the write-only Control Register. |
296 | */ | 285 | */ |
297 | 286 | ||
298 | union BusLogic_ControlRegister { | 287 | union blogic_cntrl_reg { |
299 | unsigned char All; | 288 | unsigned char all; |
300 | struct { | 289 | struct { |
301 | unsigned char:4; /* Bits 0-3 */ | 290 | unsigned char:4; /* Bits 0-3 */ |
302 | bool SCSIBusReset:1; /* Bit 4 */ | 291 | bool bus_reset:1; /* Bit 4 */ |
303 | bool InterruptReset:1; /* Bit 5 */ | 292 | bool int_reset:1; /* Bit 5 */ |
304 | bool SoftReset:1; /* Bit 6 */ | 293 | bool soft_reset:1; /* Bit 6 */ |
305 | bool HardReset:1; /* Bit 7 */ | 294 | bool hard_reset:1; /* Bit 7 */ |
306 | } cr; | 295 | } cr; |
307 | }; | 296 | }; |
308 | 297 | ||
@@ -310,17 +299,17 @@ union BusLogic_ControlRegister { | |||
310 | Define the structure of the read-only Status Register. | 299 | Define the structure of the read-only Status Register. |
311 | */ | 300 | */ |
312 | 301 | ||
313 | union BusLogic_StatusRegister { | 302 | union blogic_stat_reg { |
314 | unsigned char All; | 303 | unsigned char all; |
315 | struct { | 304 | struct { |
316 | bool CommandInvalid:1; /* Bit 0 */ | 305 | bool cmd_invalid:1; /* Bit 0 */ |
317 | bool Reserved:1; /* Bit 1 */ | 306 | bool rsvd:1; /* Bit 1 */ |
318 | bool DataInRegisterReady:1; /* Bit 2 */ | 307 | bool datain_ready:1; /* Bit 2 */ |
319 | bool CommandParameterRegisterBusy:1; /* Bit 3 */ | 308 | bool cmd_param_busy:1; /* Bit 3 */ |
320 | bool HostAdapterReady:1; /* Bit 4 */ | 309 | bool adapter_ready:1; /* Bit 4 */ |
321 | bool InitializationRequired:1; /* Bit 5 */ | 310 | bool init_reqd:1; /* Bit 5 */ |
322 | bool DiagnosticFailure:1; /* Bit 6 */ | 311 | bool diag_failed:1; /* Bit 6 */ |
323 | bool DiagnosticActive:1; /* Bit 7 */ | 312 | bool diag_active:1; /* Bit 7 */ |
324 | } sr; | 313 | } sr; |
325 | }; | 314 | }; |
326 | 315 | ||
@@ -328,15 +317,15 @@ union BusLogic_StatusRegister { | |||
328 | Define the structure of the read-only Interrupt Register. | 317 | Define the structure of the read-only Interrupt Register. |
329 | */ | 318 | */ |
330 | 319 | ||
331 | union BusLogic_InterruptRegister { | 320 | union blogic_int_reg { |
332 | unsigned char All; | 321 | unsigned char all; |
333 | struct { | 322 | struct { |
334 | bool IncomingMailboxLoaded:1; /* Bit 0 */ | 323 | bool mailin_loaded:1; /* Bit 0 */ |
335 | bool OutgoingMailboxAvailable:1;/* Bit 1 */ | 324 | bool mailout_avail:1; /* Bit 1 */ |
336 | bool CommandComplete:1; /* Bit 2 */ | 325 | bool cmd_complete:1; /* Bit 2 */ |
337 | bool ExternalBusReset:1; /* Bit 3 */ | 326 | bool ext_busreset:1; /* Bit 3 */ |
338 | unsigned char Reserved:3; /* Bits 4-6 */ | 327 | unsigned char rsvd:3; /* Bits 4-6 */ |
339 | bool InterruptValid:1; /* Bit 7 */ | 328 | bool int_valid:1; /* Bit 7 */ |
340 | } ir; | 329 | } ir; |
341 | }; | 330 | }; |
342 | 331 | ||
@@ -344,13 +333,13 @@ union BusLogic_InterruptRegister { | |||
344 | Define the structure of the read-only Geometry Register. | 333 | Define the structure of the read-only Geometry Register. |
345 | */ | 334 | */ |
346 | 335 | ||
347 | union BusLogic_GeometryRegister { | 336 | union blogic_geo_reg { |
348 | unsigned char All; | 337 | unsigned char all; |
349 | struct { | 338 | struct { |
350 | enum BusLogic_BIOS_DiskGeometryTranslation Drive0Geometry:2; /* Bits 0-1 */ | 339 | enum blogic_bios_diskgeometry d0_geo:2; /* Bits 0-1 */ |
351 | enum BusLogic_BIOS_DiskGeometryTranslation Drive1Geometry:2; /* Bits 2-3 */ | 340 | enum blogic_bios_diskgeometry d1_geo:2; /* Bits 2-3 */ |
352 | unsigned char:3; /* Bits 4-6 */ | 341 | unsigned char:3; /* Bits 4-6 */ |
353 | bool ExtendedTranslationEnabled:1; /* Bit 7 */ | 342 | bool ext_trans_enable:1; /* Bit 7 */ |
354 | } gr; | 343 | } gr; |
355 | }; | 344 | }; |
356 | 345 | ||
@@ -358,82 +347,82 @@ union BusLogic_GeometryRegister { | |||
358 | Define the BusLogic SCSI Host Adapter Command Register Operation Codes. | 347 | Define the BusLogic SCSI Host Adapter Command Register Operation Codes. |
359 | */ | 348 | */ |
360 | 349 | ||
361 | enum BusLogic_OperationCode { | 350 | enum blogic_opcode { |
362 | BusLogic_TestCommandCompleteInterrupt = 0x00, | 351 | BLOGIC_TEST_CMP_COMPLETE = 0x00, |
363 | BusLogic_InitializeMailbox = 0x01, | 352 | BLOGIC_INIT_MBOX = 0x01, |
364 | BusLogic_ExecuteMailboxCommand = 0x02, | 353 | BLOGIC_EXEC_MBOX_CMD = 0x02, |
365 | BusLogic_ExecuteBIOSCommand = 0x03, | 354 | BLOGIC_EXEC_BIOS_CMD = 0x03, |
366 | BusLogic_InquireBoardID = 0x04, | 355 | BLOGIC_GET_BOARD_ID = 0x04, |
367 | BusLogic_EnableOutgoingMailboxAvailableInt = 0x05, | 356 | BLOGIC_ENABLE_OUTBOX_AVAIL_INT = 0x05, |
368 | BusLogic_SetSCSISelectionTimeout = 0x06, | 357 | BLOGIC_SET_SELECT_TIMEOUT = 0x06, |
369 | BusLogic_SetPreemptTimeOnBus = 0x07, | 358 | BLOGIC_SET_PREEMPT_TIME = 0x07, |
370 | BusLogic_SetTimeOffBus = 0x08, | 359 | BLOGIC_SET_TIMEOFF_BUS = 0x08, |
371 | BusLogic_SetBusTransferRate = 0x09, | 360 | BLOGIC_SET_TXRATE = 0x09, |
372 | BusLogic_InquireInstalledDevicesID0to7 = 0x0A, | 361 | BLOGIC_INQ_DEV0TO7 = 0x0A, |
373 | BusLogic_InquireConfiguration = 0x0B, | 362 | BLOGIC_INQ_CONFIG = 0x0B, |
374 | BusLogic_EnableTargetMode = 0x0C, | 363 | BLOGIC_TGT_MODE = 0x0C, |
375 | BusLogic_InquireSetupInformation = 0x0D, | 364 | BLOGIC_INQ_SETUPINFO = 0x0D, |
376 | BusLogic_WriteAdapterLocalRAM = 0x1A, | 365 | BLOGIC_WRITE_LOCALRAM = 0x1A, |
377 | BusLogic_ReadAdapterLocalRAM = 0x1B, | 366 | BLOGIC_READ_LOCALRAM = 0x1B, |
378 | BusLogic_WriteBusMasterChipFIFO = 0x1C, | 367 | BLOGIC_WRITE_BUSMASTER_FIFO = 0x1C, |
379 | BusLogic_ReadBusMasterChipFIFO = 0x1D, | 368 | BLOGIC_READ_BUSMASTER_FIFO = 0x1D, |
380 | BusLogic_EchoCommandData = 0x1F, | 369 | BLOGIC_ECHO_CMDDATA = 0x1F, |
381 | BusLogic_HostAdapterDiagnostic = 0x20, | 370 | BLOGIC_ADAPTER_DIAG = 0x20, |
382 | BusLogic_SetAdapterOptions = 0x21, | 371 | BLOGIC_SET_OPTIONS = 0x21, |
383 | BusLogic_InquireInstalledDevicesID8to15 = 0x23, | 372 | BLOGIC_INQ_DEV8TO15 = 0x23, |
384 | BusLogic_InquireTargetDevices = 0x24, | 373 | BLOGIC_INQ_DEV = 0x24, |
385 | BusLogic_DisableHostAdapterInterrupt = 0x25, | 374 | BLOGIC_DISABLE_INT = 0x25, |
386 | BusLogic_InitializeExtendedMailbox = 0x81, | 375 | BLOGIC_INIT_EXT_MBOX = 0x81, |
387 | BusLogic_ExecuteSCSICommand = 0x83, | 376 | BLOGIC_EXEC_SCS_CMD = 0x83, |
388 | BusLogic_InquireFirmwareVersion3rdDigit = 0x84, | 377 | BLOGIC_INQ_FWVER_D3 = 0x84, |
389 | BusLogic_InquireFirmwareVersionLetter = 0x85, | 378 | BLOGIC_INQ_FWVER_LETTER = 0x85, |
390 | BusLogic_InquirePCIHostAdapterInformation = 0x86, | 379 | BLOGIC_INQ_PCI_INFO = 0x86, |
391 | BusLogic_InquireHostAdapterModelNumber = 0x8B, | 380 | BLOGIC_INQ_MODELNO = 0x8B, |
392 | BusLogic_InquireSynchronousPeriod = 0x8C, | 381 | BLOGIC_INQ_SYNC_PERIOD = 0x8C, |
393 | BusLogic_InquireExtendedSetupInformation = 0x8D, | 382 | BLOGIC_INQ_EXTSETUP = 0x8D, |
394 | BusLogic_EnableStrictRoundRobinMode = 0x8F, | 383 | BLOGIC_STRICT_RR = 0x8F, |
395 | BusLogic_StoreHostAdapterLocalRAM = 0x90, | 384 | BLOGIC_STORE_LOCALRAM = 0x90, |
396 | BusLogic_FetchHostAdapterLocalRAM = 0x91, | 385 | BLOGIC_FETCH_LOCALRAM = 0x91, |
397 | BusLogic_StoreLocalDataInEEPROM = 0x92, | 386 | BLOGIC_STORE_TO_EEPROM = 0x92, |
398 | BusLogic_UploadAutoSCSICode = 0x94, | 387 | BLOGIC_LOAD_AUTOSCSICODE = 0x94, |
399 | BusLogic_ModifyIOAddress = 0x95, | 388 | BLOGIC_MOD_IOADDR = 0x95, |
400 | BusLogic_SetCCBFormat = 0x96, | 389 | BLOGIC_SETCCB_FMT = 0x96, |
401 | BusLogic_WriteInquiryBuffer = 0x9A, | 390 | BLOGIC_WRITE_INQBUF = 0x9A, |
402 | BusLogic_ReadInquiryBuffer = 0x9B, | 391 | BLOGIC_READ_INQBUF = 0x9B, |
403 | BusLogic_FlashROMUploadDownload = 0xA7, | 392 | BLOGIC_FLASH_LOAD = 0xA7, |
404 | BusLogic_ReadSCAMData = 0xA8, | 393 | BLOGIC_READ_SCAMDATA = 0xA8, |
405 | BusLogic_WriteSCAMData = 0xA9 | 394 | BLOGIC_WRITE_SCAMDATA = 0xA9 |
406 | }; | 395 | }; |
407 | 396 | ||
408 | /* | 397 | /* |
409 | Define the Inquire Board ID reply structure. | 398 | Define the Inquire Board ID reply structure. |
410 | */ | 399 | */ |
411 | 400 | ||
412 | struct BusLogic_BoardID { | 401 | struct blogic_board_id { |
413 | unsigned char BoardType; /* Byte 0 */ | 402 | unsigned char type; /* Byte 0 */ |
414 | unsigned char CustomFeatures; /* Byte 1 */ | 403 | unsigned char custom_features; /* Byte 1 */ |
415 | unsigned char FirmwareVersion1stDigit; /* Byte 2 */ | 404 | unsigned char fw_ver_digit1; /* Byte 2 */ |
416 | unsigned char FirmwareVersion2ndDigit; /* Byte 3 */ | 405 | unsigned char fw_ver_digit2; /* Byte 3 */ |
417 | }; | 406 | }; |
418 | 407 | ||
419 | /* | 408 | /* |
420 | Define the Inquire Configuration reply structure. | 409 | Define the Inquire Configuration reply structure. |
421 | */ | 410 | */ |
422 | 411 | ||
423 | struct BusLogic_Configuration { | 412 | struct blogic_config { |
424 | unsigned char:5; /* Byte 0 Bits 0-4 */ | 413 | unsigned char:5; /* Byte 0 Bits 0-4 */ |
425 | bool DMA_Channel5:1; /* Byte 0 Bit 5 */ | 414 | bool dma_ch5:1; /* Byte 0 Bit 5 */ |
426 | bool DMA_Channel6:1; /* Byte 0 Bit 6 */ | 415 | bool dma_ch6:1; /* Byte 0 Bit 6 */ |
427 | bool DMA_Channel7:1; /* Byte 0 Bit 7 */ | 416 | bool dma_ch7:1; /* Byte 0 Bit 7 */ |
428 | bool IRQ_Channel9:1; /* Byte 1 Bit 0 */ | 417 | bool irq_ch9:1; /* Byte 1 Bit 0 */ |
429 | bool IRQ_Channel10:1; /* Byte 1 Bit 1 */ | 418 | bool irq_ch10:1; /* Byte 1 Bit 1 */ |
430 | bool IRQ_Channel11:1; /* Byte 1 Bit 2 */ | 419 | bool irq_ch11:1; /* Byte 1 Bit 2 */ |
431 | bool IRQ_Channel12:1; /* Byte 1 Bit 3 */ | 420 | bool irq_ch12:1; /* Byte 1 Bit 3 */ |
432 | unsigned char:1; /* Byte 1 Bit 4 */ | 421 | unsigned char:1; /* Byte 1 Bit 4 */ |
433 | bool IRQ_Channel14:1; /* Byte 1 Bit 5 */ | 422 | bool irq_ch14:1; /* Byte 1 Bit 5 */ |
434 | bool IRQ_Channel15:1; /* Byte 1 Bit 6 */ | 423 | bool irq_ch15:1; /* Byte 1 Bit 6 */ |
435 | unsigned char:1; /* Byte 1 Bit 7 */ | 424 | unsigned char:1; /* Byte 1 Bit 7 */ |
436 | unsigned char HostAdapterID:4; /* Byte 2 Bits 0-3 */ | 425 | unsigned char id:4; /* Byte 2 Bits 0-3 */ |
437 | unsigned char:4; /* Byte 2 Bits 4-7 */ | 426 | unsigned char:4; /* Byte 2 Bits 4-7 */ |
438 | }; | 427 | }; |
439 | 428 | ||
@@ -441,42 +430,42 @@ struct BusLogic_Configuration { | |||
441 | Define the Inquire Setup Information reply structure. | 430 | Define the Inquire Setup Information reply structure. |
442 | */ | 431 | */ |
443 | 432 | ||
444 | struct BusLogic_SynchronousValue { | 433 | struct blogic_syncval { |
445 | unsigned char Offset:4; /* Bits 0-3 */ | 434 | unsigned char offset:4; /* Bits 0-3 */ |
446 | unsigned char TransferPeriod:3; /* Bits 4-6 */ | 435 | unsigned char tx_period:3; /* Bits 4-6 */ |
447 | bool Synchronous:1; /* Bit 7 */ | 436 | bool sync:1; /* Bit 7 */ |
448 | }; | 437 | }; |
449 | 438 | ||
450 | struct BusLogic_SetupInformation { | 439 | struct blogic_setup_info { |
451 | bool SynchronousInitiationEnabled:1; /* Byte 0 Bit 0 */ | 440 | bool sync:1; /* Byte 0 Bit 0 */ |
452 | bool ParityCheckingEnabled:1; /* Byte 0 Bit 1 */ | 441 | bool parity:1; /* Byte 0 Bit 1 */ |
453 | unsigned char:6; /* Byte 0 Bits 2-7 */ | 442 | unsigned char:6; /* Byte 0 Bits 2-7 */ |
454 | unsigned char BusTransferRate; /* Byte 1 */ | 443 | unsigned char tx_rate; /* Byte 1 */ |
455 | unsigned char PreemptTimeOnBus; /* Byte 2 */ | 444 | unsigned char preempt_time; /* Byte 2 */ |
456 | unsigned char TimeOffBus; /* Byte 3 */ | 445 | unsigned char timeoff_bus; /* Byte 3 */ |
457 | unsigned char MailboxCount; /* Byte 4 */ | 446 | unsigned char mbox_count; /* Byte 4 */ |
458 | unsigned char MailboxAddress[3]; /* Bytes 5-7 */ | 447 | unsigned char mbox_addr[3]; /* Bytes 5-7 */ |
459 | struct BusLogic_SynchronousValue SynchronousValuesID0to7[8]; /* Bytes 8-15 */ | 448 | struct blogic_syncval sync0to7[8]; /* Bytes 8-15 */ |
460 | unsigned char DisconnectPermittedID0to7; /* Byte 16 */ | 449 | unsigned char disconnect_ok0to7; /* Byte 16 */ |
461 | unsigned char Signature; /* Byte 17 */ | 450 | unsigned char sig; /* Byte 17 */ |
462 | unsigned char CharacterD; /* Byte 18 */ | 451 | unsigned char char_d; /* Byte 18 */ |
463 | unsigned char HostBusType; /* Byte 19 */ | 452 | unsigned char bus_type; /* Byte 19 */ |
464 | unsigned char WideTransfersPermittedID0to7; /* Byte 20 */ | 453 | unsigned char wide_tx_ok0to7; /* Byte 20 */ |
465 | unsigned char WideTransfersActiveID0to7; /* Byte 21 */ | 454 | unsigned char wide_tx_active0to7; /* Byte 21 */ |
466 | struct BusLogic_SynchronousValue SynchronousValuesID8to15[8]; /* Bytes 22-29 */ | 455 | struct blogic_syncval sync8to15[8]; /* Bytes 22-29 */ |
467 | unsigned char DisconnectPermittedID8to15; /* Byte 30 */ | 456 | unsigned char disconnect_ok8to15; /* Byte 30 */ |
468 | unsigned char:8; /* Byte 31 */ | 457 | unsigned char:8; /* Byte 31 */ |
469 | unsigned char WideTransfersPermittedID8to15; /* Byte 32 */ | 458 | unsigned char wide_tx_ok8to15; /* Byte 32 */ |
470 | unsigned char WideTransfersActiveID8to15; /* Byte 33 */ | 459 | unsigned char wide_tx_active8to15; /* Byte 33 */ |
471 | }; | 460 | }; |
472 | 461 | ||
473 | /* | 462 | /* |
474 | Define the Initialize Extended Mailbox request structure. | 463 | Define the Initialize Extended Mailbox request structure. |
475 | */ | 464 | */ |
476 | 465 | ||
477 | struct BusLogic_ExtendedMailboxRequest { | 466 | struct blogic_extmbox_req { |
478 | unsigned char MailboxCount; /* Byte 0 */ | 467 | unsigned char mbox_count; /* Byte 0 */ |
479 | u32 BaseMailboxAddress; /* Bytes 1-4 */ | 468 | u32 base_mbox_addr; /* Bytes 1-4 */ |
480 | } PACKED; | 469 | } PACKED; |
481 | 470 | ||
482 | 471 | ||
@@ -486,63 +475,63 @@ struct BusLogic_ExtendedMailboxRequest { | |||
486 | the Modify I/O Address command. | 475 | the Modify I/O Address command. |
487 | */ | 476 | */ |
488 | 477 | ||
489 | enum BusLogic_ISACompatibleIOPort { | 478 | enum blogic_isa_ioport { |
490 | BusLogic_IO_330 = 0, | 479 | BLOGIC_IO_330 = 0, |
491 | BusLogic_IO_334 = 1, | 480 | BLOGIC_IO_334 = 1, |
492 | BusLogic_IO_230 = 2, | 481 | BLOGIC_IO_230 = 2, |
493 | BusLogic_IO_234 = 3, | 482 | BLOGIC_IO_234 = 3, |
494 | BusLogic_IO_130 = 4, | 483 | BLOGIC_IO_130 = 4, |
495 | BusLogic_IO_134 = 5, | 484 | BLOGIC_IO_134 = 5, |
496 | BusLogic_IO_Disable = 6, | 485 | BLOGIC_IO_DISABLE = 6, |
497 | BusLogic_IO_Disable2 = 7 | 486 | BLOGIC_IO_DISABLE2 = 7 |
498 | } PACKED; | 487 | } PACKED; |
499 | 488 | ||
500 | struct BusLogic_PCIHostAdapterInformation { | 489 | struct blogic_adapter_info { |
501 | enum BusLogic_ISACompatibleIOPort ISACompatibleIOPort; /* Byte 0 */ | 490 | enum blogic_isa_ioport isa_port; /* Byte 0 */ |
502 | unsigned char PCIAssignedIRQChannel; /* Byte 1 */ | 491 | unsigned char irq_ch; /* Byte 1 */ |
503 | bool LowByteTerminated:1; /* Byte 2 Bit 0 */ | 492 | bool low_term:1; /* Byte 2 Bit 0 */ |
504 | bool HighByteTerminated:1; /* Byte 2 Bit 1 */ | 493 | bool high_term:1; /* Byte 2 Bit 1 */ |
505 | unsigned char:2; /* Byte 2 Bits 2-3 */ | 494 | unsigned char:2; /* Byte 2 Bits 2-3 */ |
506 | bool JP1:1; /* Byte 2 Bit 4 */ | 495 | bool JP1:1; /* Byte 2 Bit 4 */ |
507 | bool JP2:1; /* Byte 2 Bit 5 */ | 496 | bool JP2:1; /* Byte 2 Bit 5 */ |
508 | bool JP3:1; /* Byte 2 Bit 6 */ | 497 | bool JP3:1; /* Byte 2 Bit 6 */ |
509 | bool GenericInfoValid:1;/* Byte 2 Bit 7 */ | 498 | bool genericinfo_valid:1; /* Byte 2 Bit 7 */ |
510 | unsigned char:8; /* Byte 3 */ | 499 | unsigned char:8; /* Byte 3 */ |
511 | }; | 500 | }; |
512 | 501 | ||
513 | /* | 502 | /* |
514 | Define the Inquire Extended Setup Information reply structure. | 503 | Define the Inquire Extended Setup Information reply structure. |
515 | */ | 504 | */ |
516 | 505 | ||
517 | struct BusLogic_ExtendedSetupInformation { | 506 | struct blogic_ext_setup { |
518 | unsigned char BusType; /* Byte 0 */ | 507 | unsigned char bus_type; /* Byte 0 */ |
519 | unsigned char BIOS_Address; /* Byte 1 */ | 508 | unsigned char bios_addr; /* Byte 1 */ |
520 | unsigned short ScatterGatherLimit; /* Bytes 2-3 */ | 509 | unsigned short sg_limit; /* Bytes 2-3 */ |
521 | unsigned char MailboxCount; /* Byte 4 */ | 510 | unsigned char mbox_count; /* Byte 4 */ |
522 | u32 BaseMailboxAddress; /* Bytes 5-8 */ | 511 | u32 base_mbox_addr; /* Bytes 5-8 */ |
523 | struct { | 512 | struct { |
524 | unsigned char:2; /* Byte 9 Bits 0-1 */ | 513 | unsigned char:2; /* Byte 9 Bits 0-1 */ |
525 | bool FastOnEISA:1; /* Byte 9 Bit 2 */ | 514 | bool fast_on_eisa:1; /* Byte 9 Bit 2 */ |
526 | unsigned char:3; /* Byte 9 Bits 3-5 */ | 515 | unsigned char:3; /* Byte 9 Bits 3-5 */ |
527 | bool LevelSensitiveInterrupt:1; /* Byte 9 Bit 6 */ | 516 | bool level_int:1; /* Byte 9 Bit 6 */ |
528 | unsigned char:1; /* Byte 9 Bit 7 */ | 517 | unsigned char:1; /* Byte 9 Bit 7 */ |
529 | } Misc; | 518 | } misc; |
530 | unsigned char FirmwareRevision[3]; /* Bytes 10-12 */ | 519 | unsigned char fw_rev[3]; /* Bytes 10-12 */ |
531 | bool HostWideSCSI:1; /* Byte 13 Bit 0 */ | 520 | bool wide:1; /* Byte 13 Bit 0 */ |
532 | bool HostDifferentialSCSI:1; /* Byte 13 Bit 1 */ | 521 | bool differential:1; /* Byte 13 Bit 1 */ |
533 | bool HostSupportsSCAM:1; /* Byte 13 Bit 2 */ | 522 | bool scam:1; /* Byte 13 Bit 2 */ |
534 | bool HostUltraSCSI:1; /* Byte 13 Bit 3 */ | 523 | bool ultra:1; /* Byte 13 Bit 3 */ |
535 | bool HostSmartTermination:1; /* Byte 13 Bit 4 */ | 524 | bool smart_term:1; /* Byte 13 Bit 4 */ |
536 | unsigned char:3; /* Byte 13 Bits 5-7 */ | 525 | unsigned char:3; /* Byte 13 Bits 5-7 */ |
537 | } PACKED; | 526 | } PACKED; |
538 | 527 | ||
539 | /* | 528 | /* |
540 | Define the Enable Strict Round Robin Mode request type. | 529 | Define the Enable Strict Round Robin Mode request type. |
541 | */ | 530 | */ |
542 | 531 | ||
543 | enum BusLogic_RoundRobinModeRequest { | 532 | enum blogic_rr_req { |
544 | BusLogic_AggressiveRoundRobinMode = 0, | 533 | BLOGIC_AGGRESSIVE_RR = 0, |
545 | BusLogic_StrictRoundRobinMode = 1 | 534 | BLOGIC_STRICT_RR_MODE = 1 |
546 | } PACKED; | 535 | } PACKED; |
547 | 536 | ||
548 | 537 | ||
@@ -550,95 +539,95 @@ enum BusLogic_RoundRobinModeRequest { | |||
550 | Define the Fetch Host Adapter Local RAM request type. | 539 | Define the Fetch Host Adapter Local RAM request type. |
551 | */ | 540 | */ |
552 | 541 | ||
553 | #define BusLogic_BIOS_BaseOffset 0 | 542 | #define BLOGIC_BIOS_BASE 0 |
554 | #define BusLogic_AutoSCSI_BaseOffset 64 | 543 | #define BLOGIC_AUTOSCSI_BASE 64 |
555 | 544 | ||
556 | struct BusLogic_FetchHostAdapterLocalRAMRequest { | 545 | struct blogic_fetch_localram { |
557 | unsigned char ByteOffset; /* Byte 0 */ | 546 | unsigned char offset; /* Byte 0 */ |
558 | unsigned char ByteCount; /* Byte 1 */ | 547 | unsigned char count; /* Byte 1 */ |
559 | }; | 548 | }; |
560 | 549 | ||
561 | /* | 550 | /* |
562 | Define the Host Adapter Local RAM AutoSCSI structure. | 551 | Define the Host Adapter Local RAM AutoSCSI structure. |
563 | */ | 552 | */ |
564 | 553 | ||
565 | struct BusLogic_AutoSCSIData { | 554 | struct blogic_autoscsi { |
566 | unsigned char InternalFactorySignature[2]; /* Bytes 0-1 */ | 555 | unsigned char factory_sig[2]; /* Bytes 0-1 */ |
567 | unsigned char InformationByteCount; /* Byte 2 */ | 556 | unsigned char info_bytes; /* Byte 2 */ |
568 | unsigned char HostAdapterType[6]; /* Bytes 3-8 */ | 557 | unsigned char adapter_type[6]; /* Bytes 3-8 */ |
569 | unsigned char:8; /* Byte 9 */ | 558 | unsigned char:8; /* Byte 9 */ |
570 | bool FloppyEnabled:1; /* Byte 10 Bit 0 */ | 559 | bool floppy:1; /* Byte 10 Bit 0 */ |
571 | bool FloppySecondary:1; /* Byte 10 Bit 1 */ | 560 | bool floppy_sec:1; /* Byte 10 Bit 1 */ |
572 | bool LevelSensitiveInterrupt:1; /* Byte 10 Bit 2 */ | 561 | bool level_int:1; /* Byte 10 Bit 2 */ |
573 | unsigned char:2; /* Byte 10 Bits 3-4 */ | 562 | unsigned char:2; /* Byte 10 Bits 3-4 */ |
574 | unsigned char SystemRAMAreaForBIOS:3; /* Byte 10 Bits 5-7 */ | 563 | unsigned char systemram_bios:3; /* Byte 10 Bits 5-7 */ |
575 | unsigned char DMA_Channel:7; /* Byte 11 Bits 0-6 */ | 564 | unsigned char dma_ch:7; /* Byte 11 Bits 0-6 */ |
576 | bool DMA_AutoConfiguration:1; /* Byte 11 Bit 7 */ | 565 | bool dma_autoconf:1; /* Byte 11 Bit 7 */ |
577 | unsigned char IRQ_Channel:7; /* Byte 12 Bits 0-6 */ | 566 | unsigned char irq_ch:7; /* Byte 12 Bits 0-6 */ |
578 | bool IRQ_AutoConfiguration:1; /* Byte 12 Bit 7 */ | 567 | bool irq_autoconf:1; /* Byte 12 Bit 7 */ |
579 | unsigned char DMA_TransferRate; /* Byte 13 */ | 568 | unsigned char dma_tx_rate; /* Byte 13 */ |
580 | unsigned char SCSI_ID; /* Byte 14 */ | 569 | unsigned char scsi_id; /* Byte 14 */ |
581 | bool LowByteTerminated:1; /* Byte 15 Bit 0 */ | 570 | bool low_term:1; /* Byte 15 Bit 0 */ |
582 | bool ParityCheckingEnabled:1; /* Byte 15 Bit 1 */ | 571 | bool parity:1; /* Byte 15 Bit 1 */ |
583 | bool HighByteTerminated:1; /* Byte 15 Bit 2 */ | 572 | bool high_term:1; /* Byte 15 Bit 2 */ |
584 | bool NoisyCablingEnvironment:1; /* Byte 15 Bit 3 */ | 573 | bool noisy_cable:1; /* Byte 15 Bit 3 */ |
585 | bool FastSynchronousNegotiation:1; /* Byte 15 Bit 4 */ | 574 | bool fast_sync_neg:1; /* Byte 15 Bit 4 */ |
586 | bool BusResetEnabled:1; /* Byte 15 Bit 5 */ | 575 | bool reset_enabled:1; /* Byte 15 Bit 5 */ |
587 | bool:1; /* Byte 15 Bit 6 */ | 576 | bool:1; /* Byte 15 Bit 6 */ |
588 | bool ActiveNegationEnabled:1; /* Byte 15 Bit 7 */ | 577 | bool active_negation:1; /* Byte 15 Bit 7 */ |
589 | unsigned char BusOnDelay; /* Byte 16 */ | 578 | unsigned char bus_on_delay; /* Byte 16 */ |
590 | unsigned char BusOffDelay; /* Byte 17 */ | 579 | unsigned char bus_off_delay; /* Byte 17 */ |
591 | bool HostAdapterBIOSEnabled:1; /* Byte 18 Bit 0 */ | 580 | bool bios_enabled:1; /* Byte 18 Bit 0 */ |
592 | bool BIOSRedirectionOfINT19Enabled:1; /* Byte 18 Bit 1 */ | 581 | bool int19_redir_enabled:1; /* Byte 18 Bit 1 */ |
593 | bool ExtendedTranslationEnabled:1; /* Byte 18 Bit 2 */ | 582 | bool ext_trans_enable:1; /* Byte 18 Bit 2 */ |
594 | bool MapRemovableAsFixedEnabled:1; /* Byte 18 Bit 3 */ | 583 | bool removable_as_fixed:1; /* Byte 18 Bit 3 */ |
595 | bool:1; /* Byte 18 Bit 4 */ | 584 | bool:1; /* Byte 18 Bit 4 */ |
596 | bool BIOSSupportsMoreThan2DrivesEnabled:1; /* Byte 18 Bit 5 */ | 585 | bool morethan2_drives:1; /* Byte 18 Bit 5 */ |
597 | bool BIOSInterruptModeEnabled:1; /* Byte 18 Bit 6 */ | 586 | bool bios_int:1; /* Byte 18 Bit 6 */ |
598 | bool FlopticalSupportEnabled:1; /* Byte 19 Bit 7 */ | 587 | bool floptical:1; /* Byte 19 Bit 7 */ |
599 | unsigned short DeviceEnabled; /* Bytes 19-20 */ | 588 | unsigned short dev_enabled; /* Bytes 19-20 */ |
600 | unsigned short WidePermitted; /* Bytes 21-22 */ | 589 | unsigned short wide_ok; /* Bytes 21-22 */ |
601 | unsigned short FastPermitted; /* Bytes 23-24 */ | 590 | unsigned short fast_ok; /* Bytes 23-24 */ |
602 | unsigned short SynchronousPermitted; /* Bytes 25-26 */ | 591 | unsigned short sync_ok; /* Bytes 25-26 */ |
603 | unsigned short DisconnectPermitted; /* Bytes 27-28 */ | 592 | unsigned short discon_ok; /* Bytes 27-28 */ |
604 | unsigned short SendStartUnitCommand; /* Bytes 29-30 */ | 593 | unsigned short send_start_unit; /* Bytes 29-30 */ |
605 | unsigned short IgnoreInBIOSScan; /* Bytes 31-32 */ | 594 | unsigned short ignore_bios_scan; /* Bytes 31-32 */ |
606 | unsigned char PCIInterruptPin:2; /* Byte 33 Bits 0-1 */ | 595 | unsigned char pci_int_pin:2; /* Byte 33 Bits 0-1 */ |
607 | unsigned char HostAdapterIOPortAddress:2; /* Byte 33 Bits 2-3 */ | 596 | unsigned char adapter_ioport:2; /* Byte 33 Bits 2-3 */ |
608 | bool StrictRoundRobinModeEnabled:1; /* Byte 33 Bit 4 */ | 597 | bool strict_rr_enabled:1; /* Byte 33 Bit 4 */ |
609 | bool VESABusSpeedGreaterThan33MHz:1; /* Byte 33 Bit 5 */ | 598 | bool vesabus_33mhzplus:1; /* Byte 33 Bit 5 */ |
610 | bool VESABurstWriteEnabled:1; /* Byte 33 Bit 6 */ | 599 | bool vesa_burst_write:1; /* Byte 33 Bit 6 */ |
611 | bool VESABurstReadEnabled:1; /* Byte 33 Bit 7 */ | 600 | bool vesa_burst_read:1; /* Byte 33 Bit 7 */ |
612 | unsigned short UltraPermitted; /* Bytes 34-35 */ | 601 | unsigned short ultra_ok; /* Bytes 34-35 */ |
613 | unsigned int:32; /* Bytes 36-39 */ | 602 | unsigned int:32; /* Bytes 36-39 */ |
614 | unsigned char:8; /* Byte 40 */ | 603 | unsigned char:8; /* Byte 40 */ |
615 | unsigned char AutoSCSIMaximumLUN; /* Byte 41 */ | 604 | unsigned char autoscsi_maxlun; /* Byte 41 */ |
616 | bool:1; /* Byte 42 Bit 0 */ | 605 | bool:1; /* Byte 42 Bit 0 */ |
617 | bool SCAM_Dominant:1; /* Byte 42 Bit 1 */ | 606 | bool scam_dominant:1; /* Byte 42 Bit 1 */ |
618 | bool SCAM_Enabled:1; /* Byte 42 Bit 2 */ | 607 | bool scam_enabled:1; /* Byte 42 Bit 2 */ |
619 | bool SCAM_Level2:1; /* Byte 42 Bit 3 */ | 608 | bool scam_lev2:1; /* Byte 42 Bit 3 */ |
620 | unsigned char:4; /* Byte 42 Bits 4-7 */ | 609 | unsigned char:4; /* Byte 42 Bits 4-7 */ |
621 | bool INT13ExtensionEnabled:1; /* Byte 43 Bit 0 */ | 610 | bool int13_exten:1; /* Byte 43 Bit 0 */ |
622 | bool:1; /* Byte 43 Bit 1 */ | 611 | bool:1; /* Byte 43 Bit 1 */ |
623 | bool CDROMBootEnabled:1; /* Byte 43 Bit 2 */ | 612 | bool cd_boot:1; /* Byte 43 Bit 2 */ |
624 | unsigned char:5; /* Byte 43 Bits 3-7 */ | 613 | unsigned char:5; /* Byte 43 Bits 3-7 */ |
625 | unsigned char BootTargetID:4; /* Byte 44 Bits 0-3 */ | 614 | unsigned char boot_id:4; /* Byte 44 Bits 0-3 */ |
626 | unsigned char BootChannel:4; /* Byte 44 Bits 4-7 */ | 615 | unsigned char boot_ch:4; /* Byte 44 Bits 4-7 */ |
627 | unsigned char ForceBusDeviceScanningOrder:1; /* Byte 45 Bit 0 */ | 616 | unsigned char force_scan_order:1; /* Byte 45 Bit 0 */ |
628 | unsigned char:7; /* Byte 45 Bits 1-7 */ | 617 | unsigned char:7; /* Byte 45 Bits 1-7 */ |
629 | unsigned short NonTaggedToAlternateLUNPermitted; /* Bytes 46-47 */ | 618 | unsigned short nontagged_to_alt_ok; /* Bytes 46-47 */ |
630 | unsigned short RenegotiateSyncAfterCheckCondition; /* Bytes 48-49 */ | 619 | unsigned short reneg_sync_on_check; /* Bytes 48-49 */ |
631 | unsigned char Reserved[10]; /* Bytes 50-59 */ | 620 | unsigned char rsvd[10]; /* Bytes 50-59 */ |
632 | unsigned char ManufacturingDiagnostic[2]; /* Bytes 60-61 */ | 621 | unsigned char manuf_diag[2]; /* Bytes 60-61 */ |
633 | unsigned short Checksum; /* Bytes 62-63 */ | 622 | unsigned short cksum; /* Bytes 62-63 */ |
634 | } PACKED; | 623 | } PACKED; |
635 | 624 | ||
636 | /* | 625 | /* |
637 | Define the Host Adapter Local RAM Auto SCSI Byte 45 structure. | 626 | Define the Host Adapter Local RAM Auto SCSI Byte 45 structure. |
638 | */ | 627 | */ |
639 | 628 | ||
640 | struct BusLogic_AutoSCSIByte45 { | 629 | struct blogic_autoscsi_byte45 { |
641 | unsigned char ForceBusDeviceScanningOrder:1; /* Bit 0 */ | 630 | unsigned char force_scan_order:1; /* Bit 0 */ |
642 | unsigned char:7; /* Bits 1-7 */ | 631 | unsigned char:7; /* Bits 1-7 */ |
643 | }; | 632 | }; |
644 | 633 | ||
@@ -646,13 +635,13 @@ struct BusLogic_AutoSCSIByte45 { | |||
646 | Define the Host Adapter Local RAM BIOS Drive Map Byte structure. | 635 | Define the Host Adapter Local RAM BIOS Drive Map Byte structure. |
647 | */ | 636 | */ |
648 | 637 | ||
649 | #define BusLogic_BIOS_DriveMapOffset 17 | 638 | #define BLOGIC_BIOS_DRVMAP 17 |
650 | 639 | ||
651 | struct BusLogic_BIOSDriveMapByte { | 640 | struct blogic_bios_drvmap { |
652 | unsigned char TargetIDBit3:1; /* Bit 0 */ | 641 | unsigned char tgt_idbit3:1; /* Bit 0 */ |
653 | unsigned char:2; /* Bits 1-2 */ | 642 | unsigned char:2; /* Bits 1-2 */ |
654 | enum BusLogic_BIOS_DiskGeometryTranslation DiskGeometry:2; /* Bits 3-4 */ | 643 | enum blogic_bios_diskgeometry diskgeom:2; /* Bits 3-4 */ |
655 | unsigned char TargetID:3; /* Bits 5-7 */ | 644 | unsigned char tgt_id:3; /* Bits 5-7 */ |
656 | }; | 645 | }; |
657 | 646 | ||
658 | /* | 647 | /* |
@@ -660,19 +649,19 @@ struct BusLogic_BIOSDriveMapByte { | |||
660 | necessary to support more than 8 Logical Units per Target Device. | 649 | necessary to support more than 8 Logical Units per Target Device. |
661 | */ | 650 | */ |
662 | 651 | ||
663 | enum BusLogic_SetCCBFormatRequest { | 652 | enum blogic_setccb_fmt { |
664 | BusLogic_LegacyLUNFormatCCB = 0, | 653 | BLOGIC_LEGACY_LUN_CCB = 0, |
665 | BusLogic_ExtendedLUNFormatCCB = 1 | 654 | BLOGIC_EXT_LUN_CCB = 1 |
666 | } PACKED; | 655 | } PACKED; |
667 | 656 | ||
668 | /* | 657 | /* |
669 | Define the Outgoing Mailbox Action Codes. | 658 | Define the Outgoing Mailbox Action Codes. |
670 | */ | 659 | */ |
671 | 660 | ||
672 | enum BusLogic_ActionCode { | 661 | enum blogic_action { |
673 | BusLogic_OutgoingMailboxFree = 0x00, | 662 | BLOGIC_OUTBOX_FREE = 0x00, |
674 | BusLogic_MailboxStartCommand = 0x01, | 663 | BLOGIC_MBOX_START = 0x01, |
675 | BusLogic_MailboxAbortCommand = 0x02 | 664 | BLOGIC_MBOX_ABORT = 0x02 |
676 | } PACKED; | 665 | } PACKED; |
677 | 666 | ||
678 | 667 | ||
@@ -682,26 +671,26 @@ enum BusLogic_ActionCode { | |||
682 | completion codes are stored in the CCB; it only uses codes 1, 2, 4, and 5. | 671 | completion codes are stored in the CCB; it only uses codes 1, 2, 4, and 5. |
683 | */ | 672 | */ |
684 | 673 | ||
685 | enum BusLogic_CompletionCode { | 674 | enum blogic_cmplt_code { |
686 | BusLogic_IncomingMailboxFree = 0x00, | 675 | BLOGIC_INBOX_FREE = 0x00, |
687 | BusLogic_CommandCompletedWithoutError = 0x01, | 676 | BLOGIC_CMD_COMPLETE_GOOD = 0x01, |
688 | BusLogic_CommandAbortedAtHostRequest = 0x02, | 677 | BLOGIC_CMD_ABORT_BY_HOST = 0x02, |
689 | BusLogic_AbortedCommandNotFound = 0x03, | 678 | BLOGIC_CMD_NOTFOUND = 0x03, |
690 | BusLogic_CommandCompletedWithError = 0x04, | 679 | BLOGIC_CMD_COMPLETE_ERROR = 0x04, |
691 | BusLogic_InvalidCCB = 0x05 | 680 | BLOGIC_INVALID_CCB = 0x05 |
692 | } PACKED; | 681 | } PACKED; |
693 | 682 | ||
694 | /* | 683 | /* |
695 | Define the Command Control Block (CCB) Opcodes. | 684 | Define the Command Control Block (CCB) Opcodes. |
696 | */ | 685 | */ |
697 | 686 | ||
698 | enum BusLogic_CCB_Opcode { | 687 | enum blogic_ccb_opcode { |
699 | BusLogic_InitiatorCCB = 0x00, | 688 | BLOGIC_INITIATOR_CCB = 0x00, |
700 | BusLogic_TargetCCB = 0x01, | 689 | BLOGIC_TGT_CCB = 0x01, |
701 | BusLogic_InitiatorCCB_ScatterGather = 0x02, | 690 | BLOGIC_INITIATOR_CCB_SG = 0x02, |
702 | BusLogic_InitiatorCCB_ResidualDataLength = 0x03, | 691 | BLOGIC_INITIATOR_CCBB_RESIDUAL = 0x03, |
703 | BusLogic_InitiatorCCB_ScatterGatherResidual = 0x04, | 692 | BLOGIC_INITIATOR_CCB_SG_RESIDUAL = 0x04, |
704 | BusLogic_BusDeviceReset = 0x81 | 693 | BLOGIC_BDR = 0x81 |
705 | } PACKED; | 694 | } PACKED; |
706 | 695 | ||
707 | 696 | ||
@@ -709,11 +698,11 @@ enum BusLogic_CCB_Opcode { | |||
709 | Define the CCB Data Direction Codes. | 698 | Define the CCB Data Direction Codes. |
710 | */ | 699 | */ |
711 | 700 | ||
712 | enum BusLogic_DataDirection { | 701 | enum blogic_datadir { |
713 | BusLogic_UncheckedDataTransfer = 0, | 702 | BLOGIC_UNCHECKED_TX = 0, |
714 | BusLogic_DataInLengthChecked = 1, | 703 | BLOGIC_DATAIN_CHECKED = 1, |
715 | BusLogic_DataOutLengthChecked = 2, | 704 | BLOGIC_DATAOUT_CHECKED = 2, |
716 | BusLogic_NoDataTransfer = 3 | 705 | BLOGIC_NOTX = 3 |
717 | }; | 706 | }; |
718 | 707 | ||
719 | 708 | ||
@@ -722,32 +711,32 @@ enum BusLogic_DataDirection { | |||
722 | return status code 0x0C; it uses 0x12 for both overruns and underruns. | 711 | return status code 0x0C; it uses 0x12 for both overruns and underruns. |
723 | */ | 712 | */ |
724 | 713 | ||
725 | enum BusLogic_HostAdapterStatus { | 714 | enum blogic_adapter_status { |
726 | BusLogic_CommandCompletedNormally = 0x00, | 715 | BLOGIC_CMD_CMPLT_NORMAL = 0x00, |
727 | BusLogic_LinkedCommandCompleted = 0x0A, | 716 | BLOGIC_LINK_CMD_CMPLT = 0x0A, |
728 | BusLogic_LinkedCommandCompletedWithFlag = 0x0B, | 717 | BLOGIC_LINK_CMD_CMPLT_FLAG = 0x0B, |
729 | BusLogic_DataUnderRun = 0x0C, | 718 | BLOGIC_DATA_UNDERRUN = 0x0C, |
730 | BusLogic_SCSISelectionTimeout = 0x11, | 719 | BLOGIC_SELECT_TIMEOUT = 0x11, |
731 | BusLogic_DataOverRun = 0x12, | 720 | BLOGIC_DATA_OVERRUN = 0x12, |
732 | BusLogic_UnexpectedBusFree = 0x13, | 721 | BLOGIC_NOEXPECT_BUSFREE = 0x13, |
733 | BusLogic_InvalidBusPhaseRequested = 0x14, | 722 | BLOGIC_INVALID_BUSPHASE = 0x14, |
734 | BusLogic_InvalidOutgoingMailboxActionCode = 0x15, | 723 | BLOGIC_INVALID_OUTBOX_CODE = 0x15, |
735 | BusLogic_InvalidCommandOperationCode = 0x16, | 724 | BLOGIC_INVALID_CMD_CODE = 0x16, |
736 | BusLogic_LinkedCCBhasInvalidLUN = 0x17, | 725 | BLOGIC_LINKCCB_BADLUN = 0x17, |
737 | BusLogic_InvalidCommandParameter = 0x1A, | 726 | BLOGIC_BAD_CMD_PARAM = 0x1A, |
738 | BusLogic_AutoRequestSenseFailed = 0x1B, | 727 | BLOGIC_AUTOREQSENSE_FAIL = 0x1B, |
739 | BusLogic_TaggedQueuingMessageRejected = 0x1C, | 728 | BLOGIC_TAGQUEUE_REJECT = 0x1C, |
740 | BusLogic_UnsupportedMessageReceived = 0x1D, | 729 | BLOGIC_BAD_MSG_RCVD = 0x1D, |
741 | BusLogic_HostAdapterHardwareFailed = 0x20, | 730 | BLOGIC_HW_FAIL = 0x20, |
742 | BusLogic_TargetFailedResponseToATN = 0x21, | 731 | BLOGIC_NORESPONSE_TO_ATN = 0x21, |
743 | BusLogic_HostAdapterAssertedRST = 0x22, | 732 | BLOGIC_HW_RESET = 0x22, |
744 | BusLogic_OtherDeviceAssertedRST = 0x23, | 733 | BLOGIC_RST_FROM_OTHERDEV = 0x23, |
745 | BusLogic_TargetDeviceReconnectedImproperly = 0x24, | 734 | BLOGIC_BAD_RECONNECT = 0x24, |
746 | BusLogic_HostAdapterAssertedBusDeviceReset = 0x25, | 735 | BLOGIC_HW_BDR = 0x25, |
747 | BusLogic_AbortQueueGenerated = 0x26, | 736 | BLOGIC_ABRT_QUEUE = 0x26, |
748 | BusLogic_HostAdapterSoftwareError = 0x27, | 737 | BLOGIC_ADAPTER_SW_ERROR = 0x27, |
749 | BusLogic_HostAdapterHardwareTimeoutError = 0x30, | 738 | BLOGIC_HW_TIMEOUT = 0x30, |
750 | BusLogic_SCSIParityErrorDetected = 0x34 | 739 | BLOGIC_PARITY_ERR = 0x34 |
751 | } PACKED; | 740 | } PACKED; |
752 | 741 | ||
753 | 742 | ||
@@ -755,30 +744,28 @@ enum BusLogic_HostAdapterStatus { | |||
755 | Define the SCSI Target Device Status Codes. | 744 | Define the SCSI Target Device Status Codes. |
756 | */ | 745 | */ |
757 | 746 | ||
758 | enum BusLogic_TargetDeviceStatus { | 747 | enum blogic_tgt_status { |
759 | BusLogic_OperationGood = 0x00, | 748 | BLOGIC_OP_GOOD = 0x00, |
760 | BusLogic_CheckCondition = 0x02, | 749 | BLOGIC_CHECKCONDITION = 0x02, |
761 | BusLogic_DeviceBusy = 0x08 | 750 | BLOGIC_DEVBUSY = 0x08 |
762 | } PACKED; | 751 | } PACKED; |
763 | 752 | ||
764 | /* | 753 | /* |
765 | Define the Queue Tag Codes. | 754 | Define the Queue Tag Codes. |
766 | */ | 755 | */ |
767 | 756 | ||
768 | enum BusLogic_QueueTag { | 757 | enum blogic_queuetag { |
769 | BusLogic_SimpleQueueTag = 0, | 758 | BLOGIC_SIMPLETAG = 0, |
770 | BusLogic_HeadOfQueueTag = 1, | 759 | BLOGIC_HEADTAG = 1, |
771 | BusLogic_OrderedQueueTag = 2, | 760 | BLOGIC_ORDEREDTAG = 2, |
772 | BusLogic_ReservedQT = 3 | 761 | BLOGIC_RSVDTAG = 3 |
773 | }; | 762 | }; |
774 | 763 | ||
775 | /* | 764 | /* |
776 | Define the SCSI Command Descriptor Block (CDB). | 765 | Define the SCSI Command Descriptor Block (CDB). |
777 | */ | 766 | */ |
778 | 767 | ||
779 | #define BusLogic_CDB_MaxLength 12 | 768 | #define BLOGIC_CDB_MAXLEN 12 |
780 | |||
781 | typedef unsigned char SCSI_CDB_T[BusLogic_CDB_MaxLength]; | ||
782 | 769 | ||
783 | 770 | ||
784 | /* | 771 | /* |
@@ -786,20 +773,20 @@ typedef unsigned char SCSI_CDB_T[BusLogic_CDB_MaxLength]; | |||
786 | Firmware Interface and the FlashPoint SCCB Manager. | 773 | Firmware Interface and the FlashPoint SCCB Manager. |
787 | */ | 774 | */ |
788 | 775 | ||
789 | struct BusLogic_ScatterGatherSegment { | 776 | struct blogic_sg_seg { |
790 | u32 SegmentByteCount; /* Bytes 0-3 */ | 777 | u32 segbytes; /* Bytes 0-3 */ |
791 | u32 SegmentDataPointer; /* Bytes 4-7 */ | 778 | u32 segdata; /* Bytes 4-7 */ |
792 | }; | 779 | }; |
793 | 780 | ||
794 | /* | 781 | /* |
795 | Define the Driver CCB Status Codes. | 782 | Define the Driver CCB Status Codes. |
796 | */ | 783 | */ |
797 | 784 | ||
798 | enum BusLogic_CCB_Status { | 785 | enum blogic_ccb_status { |
799 | BusLogic_CCB_Free = 0, | 786 | BLOGIC_CCB_FREE = 0, |
800 | BusLogic_CCB_Active = 1, | 787 | BLOGIC_CCB_ACTIVE = 1, |
801 | BusLogic_CCB_Completed = 2, | 788 | BLOGIC_CCB_COMPLETE = 2, |
802 | BusLogic_CCB_Reset = 3 | 789 | BLOGIC_CCB_RESET = 3 |
803 | } PACKED; | 790 | } PACKED; |
804 | 791 | ||
805 | 792 | ||
@@ -822,79 +809,81 @@ enum BusLogic_CCB_Status { | |||
822 | 32 Logical Units per Target Device. | 809 | 32 Logical Units per Target Device. |
823 | */ | 810 | */ |
824 | 811 | ||
825 | struct BusLogic_CCB { | 812 | struct blogic_ccb { |
826 | /* | 813 | /* |
827 | MultiMaster Firmware and FlashPoint SCCB Manager Common Portion. | 814 | MultiMaster Firmware and FlashPoint SCCB Manager Common Portion. |
828 | */ | 815 | */ |
829 | enum BusLogic_CCB_Opcode Opcode; /* Byte 0 */ | 816 | enum blogic_ccb_opcode opcode; /* Byte 0 */ |
830 | unsigned char:3; /* Byte 1 Bits 0-2 */ | 817 | unsigned char:3; /* Byte 1 Bits 0-2 */ |
831 | enum BusLogic_DataDirection DataDirection:2; /* Byte 1 Bits 3-4 */ | 818 | enum blogic_datadir datadir:2; /* Byte 1 Bits 3-4 */ |
832 | bool TagEnable:1; /* Byte 1 Bit 5 */ | 819 | bool tag_enable:1; /* Byte 1 Bit 5 */ |
833 | enum BusLogic_QueueTag QueueTag:2; /* Byte 1 Bits 6-7 */ | 820 | enum blogic_queuetag queuetag:2; /* Byte 1 Bits 6-7 */ |
834 | unsigned char CDB_Length; /* Byte 2 */ | 821 | unsigned char cdblen; /* Byte 2 */ |
835 | unsigned char SenseDataLength; /* Byte 3 */ | 822 | unsigned char sense_datalen; /* Byte 3 */ |
836 | u32 DataLength; /* Bytes 4-7 */ | 823 | u32 datalen; /* Bytes 4-7 */ |
837 | u32 DataPointer; /* Bytes 8-11 */ | 824 | void *data; /* Bytes 8-11 */ |
838 | unsigned char:8; /* Byte 12 */ | 825 | unsigned char:8; /* Byte 12 */ |
839 | unsigned char:8; /* Byte 13 */ | 826 | unsigned char:8; /* Byte 13 */ |
840 | enum BusLogic_HostAdapterStatus HostAdapterStatus; /* Byte 14 */ | 827 | enum blogic_adapter_status adapter_status; /* Byte 14 */ |
841 | enum BusLogic_TargetDeviceStatus TargetDeviceStatus; /* Byte 15 */ | 828 | enum blogic_tgt_status tgt_status; /* Byte 15 */ |
842 | unsigned char TargetID; /* Byte 16 */ | 829 | unsigned char tgt_id; /* Byte 16 */ |
843 | unsigned char LogicalUnit:5; /* Byte 17 Bits 0-4 */ | 830 | unsigned char lun:5; /* Byte 17 Bits 0-4 */ |
844 | bool LegacyTagEnable:1; /* Byte 17 Bit 5 */ | 831 | bool legacytag_enable:1; /* Byte 17 Bit 5 */ |
845 | enum BusLogic_QueueTag LegacyQueueTag:2; /* Byte 17 Bits 6-7 */ | 832 | enum blogic_queuetag legacy_tag:2; /* Byte 17 Bits 6-7 */ |
846 | SCSI_CDB_T CDB; /* Bytes 18-29 */ | 833 | unsigned char cdb[BLOGIC_CDB_MAXLEN]; /* Bytes 18-29 */ |
847 | unsigned char:8; /* Byte 30 */ | 834 | unsigned char:8; /* Byte 30 */ |
848 | unsigned char:8; /* Byte 31 */ | 835 | unsigned char:8; /* Byte 31 */ |
849 | unsigned int:32; /* Bytes 32-35 */ | 836 | u32 rsvd_int; /* Bytes 32-35 */ |
850 | u32 SenseDataPointer; /* Bytes 36-39 */ | 837 | u32 sensedata; /* Bytes 36-39 */ |
851 | /* | 838 | /* |
852 | FlashPoint SCCB Manager Defined Portion. | 839 | FlashPoint SCCB Manager Defined Portion. |
853 | */ | 840 | */ |
854 | void (*CallbackFunction) (struct BusLogic_CCB *); /* Bytes 40-43 */ | 841 | void (*callback) (struct blogic_ccb *); /* Bytes 40-43 */ |
855 | u32 BaseAddress; /* Bytes 44-47 */ | 842 | u32 base_addr; /* Bytes 44-47 */ |
856 | enum BusLogic_CompletionCode CompletionCode; /* Byte 48 */ | 843 | enum blogic_cmplt_code comp_code; /* Byte 48 */ |
857 | #ifdef CONFIG_SCSI_FLASHPOINT | 844 | #ifdef CONFIG_SCSI_FLASHPOINT |
858 | unsigned char:8; /* Byte 49 */ | 845 | unsigned char:8; /* Byte 49 */ |
859 | unsigned short OS_Flags; /* Bytes 50-51 */ | 846 | u16 os_flags; /* Bytes 50-51 */ |
860 | unsigned char Private[48]; /* Bytes 52-99 */ | 847 | unsigned char private[24]; /* Bytes 52-99 */ |
848 | void *rsvd1; | ||
849 | void *rsvd2; | ||
850 | unsigned char private2[16]; | ||
861 | #endif | 851 | #endif |
862 | /* | 852 | /* |
863 | BusLogic Linux Driver Defined Portion. | 853 | BusLogic Linux Driver Defined Portion. |
864 | */ | 854 | */ |
865 | dma_addr_t AllocationGroupHead; | 855 | dma_addr_t allocgrp_head; |
866 | unsigned int AllocationGroupSize; | 856 | unsigned int allocgrp_size; |
867 | u32 DMA_Handle; | 857 | u32 dma_handle; |
868 | enum BusLogic_CCB_Status Status; | 858 | enum blogic_ccb_status status; |
869 | unsigned long SerialNumber; | 859 | unsigned long serial; |
870 | struct scsi_cmnd *Command; | 860 | struct scsi_cmnd *command; |
871 | struct BusLogic_HostAdapter *HostAdapter; | 861 | struct blogic_adapter *adapter; |
872 | struct BusLogic_CCB *Next; | 862 | struct blogic_ccb *next; |
873 | struct BusLogic_CCB *NextAll; | 863 | struct blogic_ccb *next_all; |
874 | struct BusLogic_ScatterGatherSegment | 864 | struct blogic_sg_seg sglist[BLOGIC_SG_LIMIT]; |
875 | ScatterGatherList[BusLogic_ScatterGatherLimit]; | ||
876 | }; | 865 | }; |
877 | 866 | ||
878 | /* | 867 | /* |
879 | Define the 32 Bit Mode Outgoing Mailbox structure. | 868 | Define the 32 Bit Mode Outgoing Mailbox structure. |
880 | */ | 869 | */ |
881 | 870 | ||
882 | struct BusLogic_OutgoingMailbox { | 871 | struct blogic_outbox { |
883 | u32 CCB; /* Bytes 0-3 */ | 872 | u32 ccb; /* Bytes 0-3 */ |
884 | unsigned int:24; /* Bytes 4-6 */ | 873 | u32:24; /* Bytes 4-6 */ |
885 | enum BusLogic_ActionCode ActionCode; /* Byte 7 */ | 874 | enum blogic_action action; /* Byte 7 */ |
886 | }; | 875 | }; |
887 | 876 | ||
888 | /* | 877 | /* |
889 | Define the 32 Bit Mode Incoming Mailbox structure. | 878 | Define the 32 Bit Mode Incoming Mailbox structure. |
890 | */ | 879 | */ |
891 | 880 | ||
892 | struct BusLogic_IncomingMailbox { | 881 | struct blogic_inbox { |
893 | u32 CCB; /* Bytes 0-3 */ | 882 | u32 ccb; /* Bytes 0-3 */ |
894 | enum BusLogic_HostAdapterStatus HostAdapterStatus; /* Byte 4 */ | 883 | enum blogic_adapter_status adapter_status; /* Byte 4 */ |
895 | enum BusLogic_TargetDeviceStatus TargetDeviceStatus; /* Byte 5 */ | 884 | enum blogic_tgt_status tgt_status; /* Byte 5 */ |
896 | unsigned char:8; /* Byte 6 */ | 885 | unsigned char:8; /* Byte 6 */ |
897 | enum BusLogic_CompletionCode CompletionCode; /* Byte 7 */ | 886 | enum blogic_cmplt_code comp_code; /* Byte 7 */ |
898 | }; | 887 | }; |
899 | 888 | ||
900 | 889 | ||
@@ -902,64 +891,60 @@ struct BusLogic_IncomingMailbox { | |||
902 | Define the BusLogic Driver Options structure. | 891 | Define the BusLogic Driver Options structure. |
903 | */ | 892 | */ |
904 | 893 | ||
905 | struct BusLogic_DriverOptions { | 894 | struct blogic_drvr_options { |
906 | unsigned short TaggedQueuingPermitted; | 895 | unsigned short tagq_ok; |
907 | unsigned short TaggedQueuingPermittedMask; | 896 | unsigned short tagq_ok_mask; |
908 | unsigned short BusSettleTime; | 897 | unsigned short bus_settle_time; |
909 | struct BusLogic_LocalOptions LocalOptions; | 898 | unsigned short stop_tgt_inquiry; |
910 | unsigned char CommonQueueDepth; | 899 | unsigned char common_qdepth; |
911 | unsigned char QueueDepth[BusLogic_MaxTargetDevices]; | 900 | unsigned char qdepth[BLOGIC_MAXDEV]; |
912 | }; | 901 | }; |
913 | 902 | ||
914 | /* | 903 | /* |
915 | Define the Host Adapter Target Flags structure. | 904 | Define the Host Adapter Target Flags structure. |
916 | */ | 905 | */ |
917 | 906 | ||
918 | struct BusLogic_TargetFlags { | 907 | struct blogic_tgt_flags { |
919 | bool TargetExists:1; | 908 | bool tgt_exists:1; |
920 | bool TaggedQueuingSupported:1; | 909 | bool tagq_ok:1; |
921 | bool WideTransfersSupported:1; | 910 | bool wide_ok:1; |
922 | bool TaggedQueuingActive:1; | 911 | bool tagq_active:1; |
923 | bool WideTransfersActive:1; | 912 | bool wide_active:1; |
924 | bool CommandSuccessfulFlag:1; | 913 | bool cmd_good:1; |
925 | bool TargetInfoReported:1; | 914 | bool tgt_info_in:1; |
926 | }; | 915 | }; |
927 | 916 | ||
928 | /* | 917 | /* |
929 | Define the Host Adapter Target Statistics structure. | 918 | Define the Host Adapter Target Statistics structure. |
930 | */ | 919 | */ |
931 | 920 | ||
932 | #define BusLogic_SizeBuckets 10 | 921 | #define BLOGIC_SZ_BUCKETS 10 |
933 | 922 | ||
934 | typedef unsigned int BusLogic_CommandSizeBuckets_T[BusLogic_SizeBuckets]; | 923 | struct blogic_tgt_stats { |
935 | 924 | unsigned int cmds_tried; | |
936 | struct BusLogic_TargetStatistics { | 925 | unsigned int cmds_complete; |
937 | unsigned int CommandsAttempted; | 926 | unsigned int read_cmds; |
938 | unsigned int CommandsCompleted; | 927 | unsigned int write_cmds; |
939 | unsigned int ReadCommands; | 928 | struct blogic_byte_count bytesread; |
940 | unsigned int WriteCommands; | 929 | struct blogic_byte_count byteswritten; |
941 | struct BusLogic_ByteCounter TotalBytesRead; | 930 | unsigned int read_sz_buckets[BLOGIC_SZ_BUCKETS]; |
942 | struct BusLogic_ByteCounter TotalBytesWritten; | 931 | unsigned int write_sz_buckets[BLOGIC_SZ_BUCKETS]; |
943 | BusLogic_CommandSizeBuckets_T ReadCommandSizeBuckets; | 932 | unsigned short aborts_request; |
944 | BusLogic_CommandSizeBuckets_T WriteCommandSizeBuckets; | 933 | unsigned short aborts_tried; |
945 | unsigned short CommandAbortsRequested; | 934 | unsigned short aborts_done; |
946 | unsigned short CommandAbortsAttempted; | 935 | unsigned short bdr_request; |
947 | unsigned short CommandAbortsCompleted; | 936 | unsigned short bdr_tried; |
948 | unsigned short BusDeviceResetsRequested; | 937 | unsigned short bdr_done; |
949 | unsigned short BusDeviceResetsAttempted; | 938 | unsigned short adatper_reset_req; |
950 | unsigned short BusDeviceResetsCompleted; | 939 | unsigned short adapter_reset_attempt; |
951 | unsigned short HostAdapterResetsRequested; | 940 | unsigned short adapter_reset_done; |
952 | unsigned short HostAdapterResetsAttempted; | ||
953 | unsigned short HostAdapterResetsCompleted; | ||
954 | }; | 941 | }; |
955 | 942 | ||
956 | /* | 943 | /* |
957 | Define the FlashPoint Card Handle data type. | 944 | Define the FlashPoint Card Handle data type. |
958 | */ | 945 | */ |
959 | 946 | ||
960 | #define FlashPoint_BadCardHandle 0xFFFFFFFF | 947 | #define FPOINT_BADCARD_HANDLE 0xFFFFFFFFL |
961 | |||
962 | typedef unsigned int FlashPoint_CardHandle_T; | ||
963 | 948 | ||
964 | 949 | ||
965 | /* | 950 | /* |
@@ -967,179 +952,179 @@ typedef unsigned int FlashPoint_CardHandle_T; | |||
967 | by the FlashPoint SCCB Manager. | 952 | by the FlashPoint SCCB Manager. |
968 | */ | 953 | */ |
969 | 954 | ||
970 | struct FlashPoint_Info { | 955 | struct fpoint_info { |
971 | u32 BaseAddress; /* Bytes 0-3 */ | 956 | u32 base_addr; /* Bytes 0-3 */ |
972 | bool Present; /* Byte 4 */ | 957 | bool present; /* Byte 4 */ |
973 | unsigned char IRQ_Channel; /* Byte 5 */ | 958 | unsigned char irq_ch; /* Byte 5 */ |
974 | unsigned char SCSI_ID; /* Byte 6 */ | 959 | unsigned char scsi_id; /* Byte 6 */ |
975 | unsigned char SCSI_LUN; /* Byte 7 */ | 960 | unsigned char scsi_lun; /* Byte 7 */ |
976 | unsigned short FirmwareRevision; /* Bytes 8-9 */ | 961 | u16 fw_rev; /* Bytes 8-9 */ |
977 | unsigned short SynchronousPermitted; /* Bytes 10-11 */ | 962 | u16 sync_ok; /* Bytes 10-11 */ |
978 | unsigned short FastPermitted; /* Bytes 12-13 */ | 963 | u16 fast_ok; /* Bytes 12-13 */ |
979 | unsigned short UltraPermitted; /* Bytes 14-15 */ | 964 | u16 ultra_ok; /* Bytes 14-15 */ |
980 | unsigned short DisconnectPermitted; /* Bytes 16-17 */ | 965 | u16 discon_ok; /* Bytes 16-17 */ |
981 | unsigned short WidePermitted; /* Bytes 18-19 */ | 966 | u16 wide_ok; /* Bytes 18-19 */ |
982 | bool ParityCheckingEnabled:1; /* Byte 20 Bit 0 */ | 967 | bool parity:1; /* Byte 20 Bit 0 */ |
983 | bool HostWideSCSI:1; /* Byte 20 Bit 1 */ | 968 | bool wide:1; /* Byte 20 Bit 1 */ |
984 | bool HostSoftReset:1; /* Byte 20 Bit 2 */ | 969 | bool softreset:1; /* Byte 20 Bit 2 */ |
985 | bool ExtendedTranslationEnabled:1; /* Byte 20 Bit 3 */ | 970 | bool ext_trans_enable:1; /* Byte 20 Bit 3 */ |
986 | bool LowByteTerminated:1; /* Byte 20 Bit 4 */ | 971 | bool low_term:1; /* Byte 20 Bit 4 */ |
987 | bool HighByteTerminated:1; /* Byte 20 Bit 5 */ | 972 | bool high_term:1; /* Byte 20 Bit 5 */ |
988 | bool ReportDataUnderrun:1; /* Byte 20 Bit 6 */ | 973 | bool report_underrun:1; /* Byte 20 Bit 6 */ |
989 | bool SCAM_Enabled:1; /* Byte 20 Bit 7 */ | 974 | bool scam_enabled:1; /* Byte 20 Bit 7 */ |
990 | bool SCAM_Level2:1; /* Byte 21 Bit 0 */ | 975 | bool scam_lev2:1; /* Byte 21 Bit 0 */ |
991 | unsigned char:7; /* Byte 21 Bits 1-7 */ | 976 | unsigned char:7; /* Byte 21 Bits 1-7 */ |
992 | unsigned char Family; /* Byte 22 */ | 977 | unsigned char family; /* Byte 22 */ |
993 | unsigned char BusType; /* Byte 23 */ | 978 | unsigned char bus_type; /* Byte 23 */ |
994 | unsigned char ModelNumber[3]; /* Bytes 24-26 */ | 979 | unsigned char model[3]; /* Bytes 24-26 */ |
995 | unsigned char RelativeCardNumber; /* Byte 27 */ | 980 | unsigned char relative_cardnum; /* Byte 27 */ |
996 | unsigned char Reserved[4]; /* Bytes 28-31 */ | 981 | unsigned char rsvd[4]; /* Bytes 28-31 */ |
997 | unsigned int OS_Reserved; /* Bytes 32-35 */ | 982 | u32 os_rsvd; /* Bytes 32-35 */ |
998 | unsigned char TranslationInfo[4]; /* Bytes 36-39 */ | 983 | unsigned char translation_info[4]; /* Bytes 36-39 */ |
999 | unsigned int Reserved2[5]; /* Bytes 40-59 */ | 984 | u32 rsvd2[5]; /* Bytes 40-59 */ |
1000 | unsigned int SecondaryRange; /* Bytes 60-63 */ | 985 | u32 sec_range; /* Bytes 60-63 */ |
1001 | }; | 986 | }; |
1002 | 987 | ||
1003 | /* | 988 | /* |
1004 | Define the BusLogic Driver Host Adapter structure. | 989 | Define the BusLogic Driver Host Adapter structure. |
1005 | */ | 990 | */ |
1006 | 991 | ||
1007 | struct BusLogic_HostAdapter { | 992 | struct blogic_adapter { |
1008 | struct Scsi_Host *SCSI_Host; | 993 | struct Scsi_Host *scsi_host; |
1009 | struct pci_dev *PCI_Device; | 994 | struct pci_dev *pci_device; |
1010 | enum BusLogic_HostAdapterType HostAdapterType; | 995 | enum blogic_adapter_type adapter_type; |
1011 | enum BusLogic_HostAdapterBusType HostAdapterBusType; | 996 | enum blogic_adapter_bus_type adapter_bus_type; |
1012 | unsigned long IO_Address; | 997 | unsigned long io_addr; |
1013 | unsigned long PCI_Address; | 998 | unsigned long pci_addr; |
1014 | unsigned short AddressCount; | 999 | unsigned short addr_count; |
1015 | unsigned char HostNumber; | 1000 | unsigned char host_no; |
1016 | unsigned char ModelName[9]; | 1001 | unsigned char model[9]; |
1017 | unsigned char FirmwareVersion[6]; | 1002 | unsigned char fw_ver[6]; |
1018 | unsigned char FullModelName[18]; | 1003 | unsigned char full_model[18]; |
1019 | unsigned char Bus; | 1004 | unsigned char bus; |
1020 | unsigned char Device; | 1005 | unsigned char dev; |
1021 | unsigned char IRQ_Channel; | 1006 | unsigned char irq_ch; |
1022 | unsigned char DMA_Channel; | 1007 | unsigned char dma_ch; |
1023 | unsigned char SCSI_ID; | 1008 | unsigned char scsi_id; |
1024 | bool IRQ_ChannelAcquired:1; | 1009 | bool irq_acquired:1; |
1025 | bool DMA_ChannelAcquired:1; | 1010 | bool dma_chan_acquired:1; |
1026 | bool ExtendedTranslationEnabled:1; | 1011 | bool ext_trans_enable:1; |
1027 | bool ParityCheckingEnabled:1; | 1012 | bool parity:1; |
1028 | bool BusResetEnabled:1; | 1013 | bool reset_enabled:1; |
1029 | bool LevelSensitiveInterrupt:1; | 1014 | bool level_int:1; |
1030 | bool HostWideSCSI:1; | 1015 | bool wide:1; |
1031 | bool HostDifferentialSCSI:1; | 1016 | bool differential:1; |
1032 | bool HostSupportsSCAM:1; | 1017 | bool scam:1; |
1033 | bool HostUltraSCSI:1; | 1018 | bool ultra:1; |
1034 | bool ExtendedLUNSupport:1; | 1019 | bool ext_lun:1; |
1035 | bool TerminationInfoValid:1; | 1020 | bool terminfo_valid:1; |
1036 | bool LowByteTerminated:1; | 1021 | bool low_term:1; |
1037 | bool HighByteTerminated:1; | 1022 | bool high_term:1; |
1038 | bool BounceBuffersRequired:1; | 1023 | bool need_bouncebuf:1; |
1039 | bool StrictRoundRobinModeSupport:1; | 1024 | bool strict_rr:1; |
1040 | bool SCAM_Enabled:1; | 1025 | bool scam_enabled:1; |
1041 | bool SCAM_Level2:1; | 1026 | bool scam_lev2:1; |
1042 | bool HostAdapterInitialized:1; | 1027 | bool adapter_initd:1; |
1043 | bool HostAdapterExternalReset:1; | 1028 | bool adapter_extreset:1; |
1044 | bool HostAdapterInternalError:1; | 1029 | bool adapter_intern_err:1; |
1045 | bool ProcessCompletedCCBsActive; | 1030 | bool processing_ccbs; |
1046 | volatile bool HostAdapterCommandCompleted; | 1031 | volatile bool adapter_cmd_complete; |
1047 | unsigned short HostAdapterScatterGatherLimit; | 1032 | unsigned short adapter_sglimit; |
1048 | unsigned short DriverScatterGatherLimit; | 1033 | unsigned short drvr_sglimit; |
1049 | unsigned short MaxTargetDevices; | 1034 | unsigned short maxdev; |
1050 | unsigned short MaxLogicalUnits; | 1035 | unsigned short maxlun; |
1051 | unsigned short MailboxCount; | 1036 | unsigned short mbox_count; |
1052 | unsigned short InitialCCBs; | 1037 | unsigned short initccbs; |
1053 | unsigned short IncrementalCCBs; | 1038 | unsigned short inc_ccbs; |
1054 | unsigned short AllocatedCCBs; | 1039 | unsigned short alloc_ccbs; |
1055 | unsigned short DriverQueueDepth; | 1040 | unsigned short drvr_qdepth; |
1056 | unsigned short HostAdapterQueueDepth; | 1041 | unsigned short adapter_qdepth; |
1057 | unsigned short UntaggedQueueDepth; | 1042 | unsigned short untag_qdepth; |
1058 | unsigned short CommonQueueDepth; | 1043 | unsigned short common_qdepth; |
1059 | unsigned short BusSettleTime; | 1044 | unsigned short bus_settle_time; |
1060 | unsigned short SynchronousPermitted; | 1045 | unsigned short sync_ok; |
1061 | unsigned short FastPermitted; | 1046 | unsigned short fast_ok; |
1062 | unsigned short UltraPermitted; | 1047 | unsigned short ultra_ok; |
1063 | unsigned short WidePermitted; | 1048 | unsigned short wide_ok; |
1064 | unsigned short DisconnectPermitted; | 1049 | unsigned short discon_ok; |
1065 | unsigned short TaggedQueuingPermitted; | 1050 | unsigned short tagq_ok; |
1066 | unsigned short ExternalHostAdapterResets; | 1051 | unsigned short ext_resets; |
1067 | unsigned short HostAdapterInternalErrors; | 1052 | unsigned short adapter_intern_errors; |
1068 | unsigned short TargetDeviceCount; | 1053 | unsigned short tgt_count; |
1069 | unsigned short MessageBufferLength; | 1054 | unsigned short msgbuflen; |
1070 | u32 BIOS_Address; | 1055 | u32 bios_addr; |
1071 | struct BusLogic_DriverOptions *DriverOptions; | 1056 | struct blogic_drvr_options *drvr_opts; |
1072 | struct FlashPoint_Info FlashPointInfo; | 1057 | struct fpoint_info fpinfo; |
1073 | FlashPoint_CardHandle_T CardHandle; | 1058 | void *cardhandle; |
1074 | struct list_head host_list; | 1059 | struct list_head host_list; |
1075 | struct BusLogic_CCB *All_CCBs; | 1060 | struct blogic_ccb *all_ccbs; |
1076 | struct BusLogic_CCB *Free_CCBs; | 1061 | struct blogic_ccb *free_ccbs; |
1077 | struct BusLogic_CCB *FirstCompletedCCB; | 1062 | struct blogic_ccb *firstccb; |
1078 | struct BusLogic_CCB *LastCompletedCCB; | 1063 | struct blogic_ccb *lastccb; |
1079 | struct BusLogic_CCB *BusDeviceResetPendingCCB[BusLogic_MaxTargetDevices]; | 1064 | struct blogic_ccb *bdr_pend[BLOGIC_MAXDEV]; |
1080 | struct BusLogic_TargetFlags TargetFlags[BusLogic_MaxTargetDevices]; | 1065 | struct blogic_tgt_flags tgt_flags[BLOGIC_MAXDEV]; |
1081 | unsigned char QueueDepth[BusLogic_MaxTargetDevices]; | 1066 | unsigned char qdepth[BLOGIC_MAXDEV]; |
1082 | unsigned char SynchronousPeriod[BusLogic_MaxTargetDevices]; | 1067 | unsigned char sync_period[BLOGIC_MAXDEV]; |
1083 | unsigned char SynchronousOffset[BusLogic_MaxTargetDevices]; | 1068 | unsigned char sync_offset[BLOGIC_MAXDEV]; |
1084 | unsigned char ActiveCommands[BusLogic_MaxTargetDevices]; | 1069 | unsigned char active_cmds[BLOGIC_MAXDEV]; |
1085 | unsigned int CommandsSinceReset[BusLogic_MaxTargetDevices]; | 1070 | unsigned int cmds_since_rst[BLOGIC_MAXDEV]; |
1086 | unsigned long LastSequencePoint[BusLogic_MaxTargetDevices]; | 1071 | unsigned long last_seqpoint[BLOGIC_MAXDEV]; |
1087 | unsigned long LastResetAttempted[BusLogic_MaxTargetDevices]; | 1072 | unsigned long last_resettried[BLOGIC_MAXDEV]; |
1088 | unsigned long LastResetCompleted[BusLogic_MaxTargetDevices]; | 1073 | unsigned long last_resetdone[BLOGIC_MAXDEV]; |
1089 | struct BusLogic_OutgoingMailbox *FirstOutgoingMailbox; | 1074 | struct blogic_outbox *first_outbox; |
1090 | struct BusLogic_OutgoingMailbox *LastOutgoingMailbox; | 1075 | struct blogic_outbox *last_outbox; |
1091 | struct BusLogic_OutgoingMailbox *NextOutgoingMailbox; | 1076 | struct blogic_outbox *next_outbox; |
1092 | struct BusLogic_IncomingMailbox *FirstIncomingMailbox; | 1077 | struct blogic_inbox *first_inbox; |
1093 | struct BusLogic_IncomingMailbox *LastIncomingMailbox; | 1078 | struct blogic_inbox *last_inbox; |
1094 | struct BusLogic_IncomingMailbox *NextIncomingMailbox; | 1079 | struct blogic_inbox *next_inbox; |
1095 | struct BusLogic_TargetStatistics TargetStatistics[BusLogic_MaxTargetDevices]; | 1080 | struct blogic_tgt_stats tgt_stats[BLOGIC_MAXDEV]; |
1096 | unsigned char *MailboxSpace; | 1081 | unsigned char *mbox_space; |
1097 | dma_addr_t MailboxSpaceHandle; | 1082 | dma_addr_t mbox_space_handle; |
1098 | unsigned int MailboxSize; | 1083 | unsigned int mbox_sz; |
1099 | unsigned long CCB_Offset; | 1084 | unsigned long ccb_offset; |
1100 | char MessageBuffer[BusLogic_MessageBufferSize]; | 1085 | char msgbuf[BLOGIC_MSGBUF_SIZE]; |
1101 | }; | 1086 | }; |
1102 | 1087 | ||
1103 | /* | 1088 | /* |
1104 | Define a structure for the BIOS Disk Parameters. | 1089 | Define a structure for the BIOS Disk Parameters. |
1105 | */ | 1090 | */ |
1106 | 1091 | ||
1107 | struct BIOS_DiskParameters { | 1092 | struct bios_diskparam { |
1108 | int Heads; | 1093 | int heads; |
1109 | int Sectors; | 1094 | int sectors; |
1110 | int Cylinders; | 1095 | int cylinders; |
1111 | }; | 1096 | }; |
1112 | 1097 | ||
1113 | /* | 1098 | /* |
1114 | Define a structure for the SCSI Inquiry command results. | 1099 | Define a structure for the SCSI Inquiry command results. |
1115 | */ | 1100 | */ |
1116 | 1101 | ||
1117 | struct SCSI_Inquiry { | 1102 | struct scsi_inquiry { |
1118 | unsigned char PeripheralDeviceType:5; /* Byte 0 Bits 0-4 */ | 1103 | unsigned char devtype:5; /* Byte 0 Bits 0-4 */ |
1119 | unsigned char PeripheralQualifier:3; /* Byte 0 Bits 5-7 */ | 1104 | unsigned char dev_qual:3; /* Byte 0 Bits 5-7 */ |
1120 | unsigned char DeviceTypeModifier:7; /* Byte 1 Bits 0-6 */ | 1105 | unsigned char dev_modifier:7; /* Byte 1 Bits 0-6 */ |
1121 | bool RMB:1; /* Byte 1 Bit 7 */ | 1106 | bool rmb:1; /* Byte 1 Bit 7 */ |
1122 | unsigned char ANSI_ApprovedVersion:3; /* Byte 2 Bits 0-2 */ | 1107 | unsigned char ansi_ver:3; /* Byte 2 Bits 0-2 */ |
1123 | unsigned char ECMA_Version:3; /* Byte 2 Bits 3-5 */ | 1108 | unsigned char ecma_ver:3; /* Byte 2 Bits 3-5 */ |
1124 | unsigned char ISO_Version:2; /* Byte 2 Bits 6-7 */ | 1109 | unsigned char iso_ver:2; /* Byte 2 Bits 6-7 */ |
1125 | unsigned char ResponseDataFormat:4; /* Byte 3 Bits 0-3 */ | 1110 | unsigned char resp_fmt:4; /* Byte 3 Bits 0-3 */ |
1126 | unsigned char:2; /* Byte 3 Bits 4-5 */ | 1111 | unsigned char:2; /* Byte 3 Bits 4-5 */ |
1127 | bool TrmIOP:1; /* Byte 3 Bit 6 */ | 1112 | bool TrmIOP:1; /* Byte 3 Bit 6 */ |
1128 | bool AENC:1; /* Byte 3 Bit 7 */ | 1113 | bool AENC:1; /* Byte 3 Bit 7 */ |
1129 | unsigned char AdditionalLength; /* Byte 4 */ | 1114 | unsigned char addl_len; /* Byte 4 */ |
1130 | unsigned char:8; /* Byte 5 */ | 1115 | unsigned char:8; /* Byte 5 */ |
1131 | unsigned char:8; /* Byte 6 */ | 1116 | unsigned char:8; /* Byte 6 */ |
1132 | bool SftRe:1; /* Byte 7 Bit 0 */ | 1117 | bool SftRe:1; /* Byte 7 Bit 0 */ |
1133 | bool CmdQue:1; /* Byte 7 Bit 1 */ | 1118 | bool CmdQue:1; /* Byte 7 Bit 1 */ |
1134 | bool:1; /* Byte 7 Bit 2 */ | 1119 | bool:1; /* Byte 7 Bit 2 */ |
1135 | bool Linked:1; /* Byte 7 Bit 3 */ | 1120 | bool linked:1; /* Byte 7 Bit 3 */ |
1136 | bool Sync:1; /* Byte 7 Bit 4 */ | 1121 | bool sync:1; /* Byte 7 Bit 4 */ |
1137 | bool WBus16:1; /* Byte 7 Bit 5 */ | 1122 | bool WBus16:1; /* Byte 7 Bit 5 */ |
1138 | bool WBus32:1; /* Byte 7 Bit 6 */ | 1123 | bool WBus32:1; /* Byte 7 Bit 6 */ |
1139 | bool RelAdr:1; /* Byte 7 Bit 7 */ | 1124 | bool RelAdr:1; /* Byte 7 Bit 7 */ |
1140 | unsigned char VendorIdentification[8]; /* Bytes 8-15 */ | 1125 | unsigned char vendor[8]; /* Bytes 8-15 */ |
1141 | unsigned char ProductIdentification[16]; /* Bytes 16-31 */ | 1126 | unsigned char product[16]; /* Bytes 16-31 */ |
1142 | unsigned char ProductRevisionLevel[4]; /* Bytes 32-35 */ | 1127 | unsigned char product_rev[4]; /* Bytes 32-35 */ |
1143 | }; | 1128 | }; |
1144 | 1129 | ||
1145 | 1130 | ||
@@ -1148,184 +1133,170 @@ struct SCSI_Inquiry { | |||
1148 | Host Adapter I/O Registers. | 1133 | Host Adapter I/O Registers. |
1149 | */ | 1134 | */ |
1150 | 1135 | ||
1151 | static inline void BusLogic_SCSIBusReset(struct BusLogic_HostAdapter *HostAdapter) | 1136 | static inline void blogic_busreset(struct blogic_adapter *adapter) |
1152 | { | 1137 | { |
1153 | union BusLogic_ControlRegister ControlRegister; | 1138 | union blogic_cntrl_reg cr; |
1154 | ControlRegister.All = 0; | 1139 | cr.all = 0; |
1155 | ControlRegister.cr.SCSIBusReset = true; | 1140 | cr.cr.bus_reset = true; |
1156 | outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset); | 1141 | outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG); |
1157 | } | 1142 | } |
1158 | 1143 | ||
1159 | static inline void BusLogic_InterruptReset(struct BusLogic_HostAdapter *HostAdapter) | 1144 | static inline void blogic_intreset(struct blogic_adapter *adapter) |
1160 | { | 1145 | { |
1161 | union BusLogic_ControlRegister ControlRegister; | 1146 | union blogic_cntrl_reg cr; |
1162 | ControlRegister.All = 0; | 1147 | cr.all = 0; |
1163 | ControlRegister.cr.InterruptReset = true; | 1148 | cr.cr.int_reset = true; |
1164 | outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset); | 1149 | outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG); |
1165 | } | 1150 | } |
1166 | 1151 | ||
1167 | static inline void BusLogic_SoftReset(struct BusLogic_HostAdapter *HostAdapter) | 1152 | static inline void blogic_softreset(struct blogic_adapter *adapter) |
1168 | { | 1153 | { |
1169 | union BusLogic_ControlRegister ControlRegister; | 1154 | union blogic_cntrl_reg cr; |
1170 | ControlRegister.All = 0; | 1155 | cr.all = 0; |
1171 | ControlRegister.cr.SoftReset = true; | 1156 | cr.cr.soft_reset = true; |
1172 | outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset); | 1157 | outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG); |
1173 | } | 1158 | } |
1174 | 1159 | ||
1175 | static inline void BusLogic_HardReset(struct BusLogic_HostAdapter *HostAdapter) | 1160 | static inline void blogic_hardreset(struct blogic_adapter *adapter) |
1176 | { | 1161 | { |
1177 | union BusLogic_ControlRegister ControlRegister; | 1162 | union blogic_cntrl_reg cr; |
1178 | ControlRegister.All = 0; | 1163 | cr.all = 0; |
1179 | ControlRegister.cr.HardReset = true; | 1164 | cr.cr.hard_reset = true; |
1180 | outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset); | 1165 | outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG); |
1181 | } | 1166 | } |
1182 | 1167 | ||
1183 | static inline unsigned char BusLogic_ReadStatusRegister(struct BusLogic_HostAdapter *HostAdapter) | 1168 | static inline unsigned char blogic_rdstatus(struct blogic_adapter *adapter) |
1184 | { | 1169 | { |
1185 | return inb(HostAdapter->IO_Address + BusLogic_StatusRegisterOffset); | 1170 | return inb(adapter->io_addr + BLOGIC_STATUS_REG); |
1186 | } | 1171 | } |
1187 | 1172 | ||
1188 | static inline void BusLogic_WriteCommandParameterRegister(struct BusLogic_HostAdapter | 1173 | static inline void blogic_setcmdparam(struct blogic_adapter *adapter, |
1189 | *HostAdapter, unsigned char Value) | 1174 | unsigned char value) |
1190 | { | 1175 | { |
1191 | outb(Value, HostAdapter->IO_Address + BusLogic_CommandParameterRegisterOffset); | 1176 | outb(value, adapter->io_addr + BLOGIC_CMD_PARM_REG); |
1192 | } | 1177 | } |
1193 | 1178 | ||
1194 | static inline unsigned char BusLogic_ReadDataInRegister(struct BusLogic_HostAdapter *HostAdapter) | 1179 | static inline unsigned char blogic_rddatain(struct blogic_adapter *adapter) |
1195 | { | 1180 | { |
1196 | return inb(HostAdapter->IO_Address + BusLogic_DataInRegisterOffset); | 1181 | return inb(adapter->io_addr + BLOGIC_DATAIN_REG); |
1197 | } | 1182 | } |
1198 | 1183 | ||
1199 | static inline unsigned char BusLogic_ReadInterruptRegister(struct BusLogic_HostAdapter *HostAdapter) | 1184 | static inline unsigned char blogic_rdint(struct blogic_adapter *adapter) |
1200 | { | 1185 | { |
1201 | return inb(HostAdapter->IO_Address + BusLogic_InterruptRegisterOffset); | 1186 | return inb(adapter->io_addr + BLOGIC_INT_REG); |
1202 | } | 1187 | } |
1203 | 1188 | ||
1204 | static inline unsigned char BusLogic_ReadGeometryRegister(struct BusLogic_HostAdapter *HostAdapter) | 1189 | static inline unsigned char blogic_rdgeom(struct blogic_adapter *adapter) |
1205 | { | 1190 | { |
1206 | return inb(HostAdapter->IO_Address + BusLogic_GeometryRegisterOffset); | 1191 | return inb(adapter->io_addr + BLOGIC_GEOMETRY_REG); |
1207 | } | 1192 | } |
1208 | 1193 | ||
1209 | /* | 1194 | /* |
1210 | BusLogic_StartMailboxCommand issues an Execute Mailbox Command, which | 1195 | blogic_execmbox issues an Execute Mailbox Command, which |
1211 | notifies the Host Adapter that an entry has been made in an Outgoing | 1196 | notifies the Host Adapter that an entry has been made in an Outgoing |
1212 | Mailbox. | 1197 | Mailbox. |
1213 | */ | 1198 | */ |
1214 | 1199 | ||
1215 | static inline void BusLogic_StartMailboxCommand(struct BusLogic_HostAdapter *HostAdapter) | 1200 | static inline void blogic_execmbox(struct blogic_adapter *adapter) |
1216 | { | 1201 | { |
1217 | BusLogic_WriteCommandParameterRegister(HostAdapter, BusLogic_ExecuteMailboxCommand); | 1202 | blogic_setcmdparam(adapter, BLOGIC_EXEC_MBOX_CMD); |
1218 | } | 1203 | } |
1219 | 1204 | ||
1220 | /* | 1205 | /* |
1221 | BusLogic_Delay waits for Seconds to elapse. | 1206 | blogic_delay waits for Seconds to elapse. |
1222 | */ | 1207 | */ |
1223 | 1208 | ||
1224 | static inline void BusLogic_Delay(int Seconds) | 1209 | static inline void blogic_delay(int seconds) |
1225 | { | ||
1226 | mdelay(1000 * Seconds); | ||
1227 | } | ||
1228 | |||
1229 | /* | ||
1230 | Virtual_to_Bus and Bus_to_Virtual map between Kernel Virtual Addresses | ||
1231 | and PCI/VLB/EISA/ISA Bus Addresses. | ||
1232 | */ | ||
1233 | |||
1234 | static inline u32 Virtual_to_Bus(void *VirtualAddress) | ||
1235 | { | ||
1236 | return (u32) virt_to_bus(VirtualAddress); | ||
1237 | } | ||
1238 | |||
1239 | static inline void *Bus_to_Virtual(u32 BusAddress) | ||
1240 | { | 1210 | { |
1241 | return (void *) bus_to_virt(BusAddress); | 1211 | mdelay(1000 * seconds); |
1242 | } | 1212 | } |
1243 | 1213 | ||
1244 | /* | 1214 | /* |
1245 | Virtual_to_32Bit_Virtual maps between Kernel Virtual Addresses and | 1215 | virt_to_32bit_virt maps between Kernel Virtual Addresses and |
1246 | 32 bit Kernel Virtual Addresses. This avoids compilation warnings | 1216 | 32 bit Kernel Virtual Addresses. This avoids compilation warnings |
1247 | on 64 bit architectures. | 1217 | on 64 bit architectures. |
1248 | */ | 1218 | */ |
1249 | 1219 | ||
1250 | static inline u32 Virtual_to_32Bit_Virtual(void *VirtualAddress) | 1220 | static inline u32 virt_to_32bit_virt(void *virt_addr) |
1251 | { | 1221 | { |
1252 | return (u32) (unsigned long) VirtualAddress; | 1222 | return (u32) (unsigned long) virt_addr; |
1253 | } | 1223 | } |
1254 | 1224 | ||
1255 | /* | 1225 | /* |
1256 | BusLogic_IncrementErrorCounter increments Error Counter by 1, stopping at | 1226 | blogic_inc_count increments counter by 1, stopping at |
1257 | 65535 rather than wrapping around to 0. | 1227 | 65535 rather than wrapping around to 0. |
1258 | */ | 1228 | */ |
1259 | 1229 | ||
1260 | static inline void BusLogic_IncrementErrorCounter(unsigned short *ErrorCounter) | 1230 | static inline void blogic_inc_count(unsigned short *count) |
1261 | { | 1231 | { |
1262 | if (*ErrorCounter < 65535) | 1232 | if (*count < 65535) |
1263 | (*ErrorCounter)++; | 1233 | (*count)++; |
1264 | } | 1234 | } |
1265 | 1235 | ||
1266 | /* | 1236 | /* |
1267 | BusLogic_IncrementByteCounter increments Byte Counter by Amount. | 1237 | blogic_addcount increments Byte Counter by Amount. |
1268 | */ | 1238 | */ |
1269 | 1239 | ||
1270 | static inline void BusLogic_IncrementByteCounter(struct BusLogic_ByteCounter | 1240 | static inline void blogic_addcount(struct blogic_byte_count *bytecount, |
1271 | *ByteCounter, unsigned int Amount) | 1241 | unsigned int amount) |
1272 | { | 1242 | { |
1273 | ByteCounter->Units += Amount; | 1243 | bytecount->units += amount; |
1274 | if (ByteCounter->Units > 999999999) { | 1244 | if (bytecount->units > 999999999) { |
1275 | ByteCounter->Units -= 1000000000; | 1245 | bytecount->units -= 1000000000; |
1276 | ByteCounter->Billions++; | 1246 | bytecount->billions++; |
1277 | } | 1247 | } |
1278 | } | 1248 | } |
1279 | 1249 | ||
1280 | /* | 1250 | /* |
1281 | BusLogic_IncrementSizeBucket increments the Bucket for Amount. | 1251 | blogic_incszbucket increments the Bucket for Amount. |
1282 | */ | 1252 | */ |
1283 | 1253 | ||
1284 | static inline void BusLogic_IncrementSizeBucket(BusLogic_CommandSizeBuckets_T CommandSizeBuckets, unsigned int Amount) | 1254 | static inline void blogic_incszbucket(unsigned int *cmdsz_buckets, |
1255 | unsigned int amount) | ||
1285 | { | 1256 | { |
1286 | int Index = 0; | 1257 | int index = 0; |
1287 | if (Amount < 8 * 1024) { | 1258 | if (amount < 8 * 1024) { |
1288 | if (Amount < 2 * 1024) | 1259 | if (amount < 2 * 1024) |
1289 | Index = (Amount < 1 * 1024 ? 0 : 1); | 1260 | index = (amount < 1 * 1024 ? 0 : 1); |
1290 | else | 1261 | else |
1291 | Index = (Amount < 4 * 1024 ? 2 : 3); | 1262 | index = (amount < 4 * 1024 ? 2 : 3); |
1292 | } else if (Amount < 128 * 1024) { | 1263 | } else if (amount < 128 * 1024) { |
1293 | if (Amount < 32 * 1024) | 1264 | if (amount < 32 * 1024) |
1294 | Index = (Amount < 16 * 1024 ? 4 : 5); | 1265 | index = (amount < 16 * 1024 ? 4 : 5); |
1295 | else | 1266 | else |
1296 | Index = (Amount < 64 * 1024 ? 6 : 7); | 1267 | index = (amount < 64 * 1024 ? 6 : 7); |
1297 | } else | 1268 | } else |
1298 | Index = (Amount < 256 * 1024 ? 8 : 9); | 1269 | index = (amount < 256 * 1024 ? 8 : 9); |
1299 | CommandSizeBuckets[Index]++; | 1270 | cmdsz_buckets[index]++; |
1300 | } | 1271 | } |
1301 | 1272 | ||
1302 | /* | 1273 | /* |
1303 | Define the version number of the FlashPoint Firmware (SCCB Manager). | 1274 | Define the version number of the FlashPoint Firmware (SCCB Manager). |
1304 | */ | 1275 | */ |
1305 | 1276 | ||
1306 | #define FlashPoint_FirmwareVersion "5.02" | 1277 | #define FLASHPOINT_FW_VER "5.02" |
1307 | 1278 | ||
1308 | /* | 1279 | /* |
1309 | Define the possible return values from FlashPoint_HandleInterrupt. | 1280 | Define the possible return values from FlashPoint_HandleInterrupt. |
1310 | */ | 1281 | */ |
1311 | 1282 | ||
1312 | #define FlashPoint_NormalInterrupt 0x00 | 1283 | #define FPOINT_NORMAL_INT 0x00 |
1313 | #define FlashPoint_InternalError 0xFE | 1284 | #define FPOINT_INTERN_ERR 0xFE |
1314 | #define FlashPoint_ExternalBusReset 0xFF | 1285 | #define FPOINT_EXT_RESET 0xFF |
1315 | 1286 | ||
1316 | /* | 1287 | /* |
1317 | Define prototypes for the forward referenced BusLogic Driver | 1288 | Define prototypes for the forward referenced BusLogic Driver |
1318 | Internal Functions. | 1289 | Internal Functions. |
1319 | */ | 1290 | */ |
1320 | 1291 | ||
1321 | static const char *BusLogic_DriverInfo(struct Scsi_Host *); | 1292 | static const char *blogic_drvr_info(struct Scsi_Host *); |
1322 | static int BusLogic_QueueCommand(struct Scsi_Host *h, struct scsi_cmnd *); | 1293 | static int blogic_qcmd(struct Scsi_Host *h, struct scsi_cmnd *); |
1323 | static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *); | 1294 | static int blogic_diskparam(struct scsi_device *, struct block_device *, sector_t, int *); |
1324 | static int BusLogic_SlaveConfigure(struct scsi_device *); | 1295 | static int blogic_slaveconfig(struct scsi_device *); |
1325 | static void BusLogic_QueueCompletedCCB(struct BusLogic_CCB *); | 1296 | static void blogic_qcompleted_ccb(struct blogic_ccb *); |
1326 | static irqreturn_t BusLogic_InterruptHandler(int, void *); | 1297 | static irqreturn_t blogic_inthandler(int, void *); |
1327 | static int BusLogic_ResetHostAdapter(struct BusLogic_HostAdapter *, bool HardReset); | 1298 | static int blogic_resetadapter(struct blogic_adapter *, bool hard_reset); |
1328 | static void BusLogic_Message(enum BusLogic_MessageLevel, char *, struct BusLogic_HostAdapter *, ...); | 1299 | static void blogic_msg(enum blogic_msglevel, char *, struct blogic_adapter *, ...); |
1329 | static int __init BusLogic_Setup(char *); | 1300 | static int __init blogic_setup(char *); |
1330 | 1301 | ||
1331 | #endif /* _BUSLOGIC_H */ | 1302 | #endif /* _BUSLOGIC_H */ |
diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c index dcd716d68600..5c74e4c52fe4 100644 --- a/drivers/scsi/FlashPoint.c +++ b/drivers/scsi/FlashPoint.c | |||
@@ -29,27 +29,27 @@ struct sccb; | |||
29 | typedef void (*CALL_BK_FN) (struct sccb *); | 29 | typedef void (*CALL_BK_FN) (struct sccb *); |
30 | 30 | ||
31 | struct sccb_mgr_info { | 31 | struct sccb_mgr_info { |
32 | unsigned long si_baseaddr; | 32 | u32 si_baseaddr; |
33 | unsigned char si_present; | 33 | unsigned char si_present; |
34 | unsigned char si_intvect; | 34 | unsigned char si_intvect; |
35 | unsigned char si_id; | 35 | unsigned char si_id; |
36 | unsigned char si_lun; | 36 | unsigned char si_lun; |
37 | unsigned short si_fw_revision; | 37 | u16 si_fw_revision; |
38 | unsigned short si_per_targ_init_sync; | 38 | u16 si_per_targ_init_sync; |
39 | unsigned short si_per_targ_fast_nego; | 39 | u16 si_per_targ_fast_nego; |
40 | unsigned short si_per_targ_ultra_nego; | 40 | u16 si_per_targ_ultra_nego; |
41 | unsigned short si_per_targ_no_disc; | 41 | u16 si_per_targ_no_disc; |
42 | unsigned short si_per_targ_wide_nego; | 42 | u16 si_per_targ_wide_nego; |
43 | unsigned short si_flags; | 43 | u16 si_flags; |
44 | unsigned char si_card_family; | 44 | unsigned char si_card_family; |
45 | unsigned char si_bustype; | 45 | unsigned char si_bustype; |
46 | unsigned char si_card_model[3]; | 46 | unsigned char si_card_model[3]; |
47 | unsigned char si_relative_cardnum; | 47 | unsigned char si_relative_cardnum; |
48 | unsigned char si_reserved[4]; | 48 | unsigned char si_reserved[4]; |
49 | unsigned long si_OS_reserved; | 49 | u32 si_OS_reserved; |
50 | unsigned char si_XlatInfo[4]; | 50 | unsigned char si_XlatInfo[4]; |
51 | unsigned long si_reserved2[5]; | 51 | u32 si_reserved2[5]; |
52 | unsigned long si_secondary_range; | 52 | u32 si_secondary_range; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | #define SCSI_PARITY_ENA 0x0001 | 55 | #define SCSI_PARITY_ENA 0x0001 |
@@ -70,14 +70,14 @@ struct sccb_mgr_info { | |||
70 | * The UCB Manager treats the SCCB as it's 'native hardware structure' | 70 | * The UCB Manager treats the SCCB as it's 'native hardware structure' |
71 | */ | 71 | */ |
72 | 72 | ||
73 | #pragma pack(1) | 73 | /*#pragma pack(1)*/ |
74 | struct sccb { | 74 | struct sccb { |
75 | unsigned char OperationCode; | 75 | unsigned char OperationCode; |
76 | unsigned char ControlByte; | 76 | unsigned char ControlByte; |
77 | unsigned char CdbLength; | 77 | unsigned char CdbLength; |
78 | unsigned char RequestSenseLength; | 78 | unsigned char RequestSenseLength; |
79 | unsigned long DataLength; | 79 | u32 DataLength; |
80 | unsigned long DataPointer; | 80 | void *DataPointer; |
81 | unsigned char CcbRes[2]; | 81 | unsigned char CcbRes[2]; |
82 | unsigned char HostStatus; | 82 | unsigned char HostStatus; |
83 | unsigned char TargetStatus; | 83 | unsigned char TargetStatus; |
@@ -86,32 +86,32 @@ struct sccb { | |||
86 | unsigned char Cdb[12]; | 86 | unsigned char Cdb[12]; |
87 | unsigned char CcbRes1; | 87 | unsigned char CcbRes1; |
88 | unsigned char Reserved1; | 88 | unsigned char Reserved1; |
89 | unsigned long Reserved2; | 89 | u32 Reserved2; |
90 | unsigned long SensePointer; | 90 | u32 SensePointer; |
91 | 91 | ||
92 | CALL_BK_FN SccbCallback; /* VOID (*SccbCallback)(); */ | 92 | CALL_BK_FN SccbCallback; /* VOID (*SccbCallback)(); */ |
93 | unsigned long SccbIOPort; /* Identifies board base port */ | 93 | u32 SccbIOPort; /* Identifies board base port */ |
94 | unsigned char SccbStatus; | 94 | unsigned char SccbStatus; |
95 | unsigned char SCCBRes2; | 95 | unsigned char SCCBRes2; |
96 | unsigned short SccbOSFlags; | 96 | u16 SccbOSFlags; |
97 | 97 | ||
98 | unsigned long Sccb_XferCnt; /* actual transfer count */ | 98 | u32 Sccb_XferCnt; /* actual transfer count */ |
99 | unsigned long Sccb_ATC; | 99 | u32 Sccb_ATC; |
100 | unsigned long SccbVirtDataPtr; /* virtual addr for OS/2 */ | 100 | u32 SccbVirtDataPtr; /* virtual addr for OS/2 */ |
101 | unsigned long Sccb_res1; | 101 | u32 Sccb_res1; |
102 | unsigned short Sccb_MGRFlags; | 102 | u16 Sccb_MGRFlags; |
103 | unsigned short Sccb_sgseg; | 103 | u16 Sccb_sgseg; |
104 | unsigned char Sccb_scsimsg; /* identify msg for selection */ | 104 | unsigned char Sccb_scsimsg; /* identify msg for selection */ |
105 | unsigned char Sccb_tag; | 105 | unsigned char Sccb_tag; |
106 | unsigned char Sccb_scsistat; | 106 | unsigned char Sccb_scsistat; |
107 | unsigned char Sccb_idmsg; /* image of last msg in */ | 107 | unsigned char Sccb_idmsg; /* image of last msg in */ |
108 | struct sccb *Sccb_forwardlink; | 108 | struct sccb *Sccb_forwardlink; |
109 | struct sccb *Sccb_backlink; | 109 | struct sccb *Sccb_backlink; |
110 | unsigned long Sccb_savedATC; | 110 | u32 Sccb_savedATC; |
111 | unsigned char Save_Cdb[6]; | 111 | unsigned char Save_Cdb[6]; |
112 | unsigned char Save_CdbLen; | 112 | unsigned char Save_CdbLen; |
113 | unsigned char Sccb_XferState; | 113 | unsigned char Sccb_XferState; |
114 | unsigned long Sccb_SGoffset; | 114 | u32 Sccb_SGoffset; |
115 | }; | 115 | }; |
116 | 116 | ||
117 | #pragma pack() | 117 | #pragma pack() |
@@ -223,15 +223,21 @@ struct sccb_mgr_tar_info { | |||
223 | }; | 223 | }; |
224 | 224 | ||
225 | struct nvram_info { | 225 | struct nvram_info { |
226 | unsigned char niModel; /* Model No. of card */ | 226 | unsigned char niModel; /* Model No. of card */ |
227 | unsigned char niCardNo; /* Card no. */ | 227 | unsigned char niCardNo; /* Card no. */ |
228 | unsigned long niBaseAddr; /* Port Address of card */ | 228 | u32 niBaseAddr; /* Port Address of card */ |
229 | unsigned char niSysConf; /* Adapter Configuration byte - Byte 16 of eeprom map */ | 229 | unsigned char niSysConf; /* Adapter Configuration byte - |
230 | unsigned char niScsiConf; /* SCSI Configuration byte - Byte 17 of eeprom map */ | 230 | Byte 16 of eeprom map */ |
231 | unsigned char niScamConf; /* SCAM Configuration byte - Byte 20 of eeprom map */ | 231 | unsigned char niScsiConf; /* SCSI Configuration byte - |
232 | unsigned char niAdapId; /* Host Adapter ID - Byte 24 of eerpom map */ | 232 | Byte 17 of eeprom map */ |
233 | unsigned char niSyncTbl[MAX_SCSI_TAR / 2]; /* Sync/Wide byte of targets */ | 233 | unsigned char niScamConf; /* SCAM Configuration byte - |
234 | unsigned char niScamTbl[MAX_SCSI_TAR][4]; /* Compressed Scam name string of Targets */ | 234 | Byte 20 of eeprom map */ |
235 | unsigned char niAdapId; /* Host Adapter ID - | ||
236 | Byte 24 of eerpom map */ | ||
237 | unsigned char niSyncTbl[MAX_SCSI_TAR / 2]; /* Sync/Wide byte | ||
238 | of targets */ | ||
239 | unsigned char niScamTbl[MAX_SCSI_TAR][4]; /* Compressed Scam name | ||
240 | string of Targets */ | ||
235 | }; | 241 | }; |
236 | 242 | ||
237 | #define MODEL_LT 1 | 243 | #define MODEL_LT 1 |
@@ -243,7 +249,7 @@ struct sccb_card { | |||
243 | struct sccb *currentSCCB; | 249 | struct sccb *currentSCCB; |
244 | struct sccb_mgr_info *cardInfo; | 250 | struct sccb_mgr_info *cardInfo; |
245 | 251 | ||
246 | unsigned long ioPort; | 252 | u32 ioPort; |
247 | 253 | ||
248 | unsigned short cmdCounter; | 254 | unsigned short cmdCounter; |
249 | unsigned char discQCount; | 255 | unsigned char discQCount; |
@@ -780,37 +786,37 @@ typedef struct SCCBscam_info { | |||
780 | #define MENABLE_INT(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \ | 786 | #define MENABLE_INT(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \ |
781 | (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE))) | 787 | (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE))) |
782 | 788 | ||
783 | static unsigned char FPT_sisyncn(unsigned long port, unsigned char p_card, | 789 | static unsigned char FPT_sisyncn(u32 port, unsigned char p_card, |
784 | unsigned char syncFlag); | 790 | unsigned char syncFlag); |
785 | static void FPT_ssel(unsigned long port, unsigned char p_card); | 791 | static void FPT_ssel(u32 port, unsigned char p_card); |
786 | static void FPT_sres(unsigned long port, unsigned char p_card, | 792 | static void FPT_sres(u32 port, unsigned char p_card, |
787 | struct sccb_card *pCurrCard); | 793 | struct sccb_card *pCurrCard); |
788 | static void FPT_shandem(unsigned long port, unsigned char p_card, | 794 | static void FPT_shandem(u32 port, unsigned char p_card, |
789 | struct sccb *pCurrSCCB); | 795 | struct sccb *pCurrSCCB); |
790 | static void FPT_stsyncn(unsigned long port, unsigned char p_card); | 796 | static void FPT_stsyncn(u32 port, unsigned char p_card); |
791 | static void FPT_sisyncr(unsigned long port, unsigned char sync_pulse, | 797 | static void FPT_sisyncr(u32 port, unsigned char sync_pulse, |
792 | unsigned char offset); | 798 | unsigned char offset); |
793 | static void FPT_sssyncv(unsigned long p_port, unsigned char p_id, | 799 | static void FPT_sssyncv(u32 p_port, unsigned char p_id, |
794 | unsigned char p_sync_value, | 800 | unsigned char p_sync_value, |
795 | struct sccb_mgr_tar_info *currTar_Info); | 801 | struct sccb_mgr_tar_info *currTar_Info); |
796 | static void FPT_sresb(unsigned long port, unsigned char p_card); | 802 | static void FPT_sresb(u32 port, unsigned char p_card); |
797 | static void FPT_sxfrp(unsigned long p_port, unsigned char p_card); | 803 | static void FPT_sxfrp(u32 p_port, unsigned char p_card); |
798 | static void FPT_schkdd(unsigned long port, unsigned char p_card); | 804 | static void FPT_schkdd(u32 port, unsigned char p_card); |
799 | static unsigned char FPT_RdStack(unsigned long port, unsigned char index); | 805 | static unsigned char FPT_RdStack(u32 port, unsigned char index); |
800 | static void FPT_WrStack(unsigned long portBase, unsigned char index, | 806 | static void FPT_WrStack(u32 portBase, unsigned char index, |
801 | unsigned char data); | 807 | unsigned char data); |
802 | static unsigned char FPT_ChkIfChipInitialized(unsigned long ioPort); | 808 | static unsigned char FPT_ChkIfChipInitialized(u32 ioPort); |
803 | 809 | ||
804 | static void FPT_SendMsg(unsigned long port, unsigned char message); | 810 | static void FPT_SendMsg(u32 port, unsigned char message); |
805 | static void FPT_queueFlushTargSccb(unsigned char p_card, unsigned char thisTarg, | 811 | static void FPT_queueFlushTargSccb(unsigned char p_card, unsigned char thisTarg, |
806 | unsigned char error_code); | 812 | unsigned char error_code); |
807 | 813 | ||
808 | static void FPT_sinits(struct sccb *p_sccb, unsigned char p_card); | 814 | static void FPT_sinits(struct sccb *p_sccb, unsigned char p_card); |
809 | static void FPT_RNVRamData(struct nvram_info *pNvRamInfo); | 815 | static void FPT_RNVRamData(struct nvram_info *pNvRamInfo); |
810 | 816 | ||
811 | static unsigned char FPT_siwidn(unsigned long port, unsigned char p_card); | 817 | static unsigned char FPT_siwidn(u32 port, unsigned char p_card); |
812 | static void FPT_stwidn(unsigned long port, unsigned char p_card); | 818 | static void FPT_stwidn(u32 port, unsigned char p_card); |
813 | static void FPT_siwidr(unsigned long port, unsigned char width); | 819 | static void FPT_siwidr(u32 port, unsigned char width); |
814 | 820 | ||
815 | static void FPT_queueSelectFail(struct sccb_card *pCurrCard, | 821 | static void FPT_queueSelectFail(struct sccb_card *pCurrCard, |
816 | unsigned char p_card); | 822 | unsigned char p_card); |
@@ -827,45 +833,45 @@ static void FPT_utilUpdateResidual(struct sccb *p_SCCB); | |||
827 | static unsigned short FPT_CalcCrc16(unsigned char buffer[]); | 833 | static unsigned short FPT_CalcCrc16(unsigned char buffer[]); |
828 | static unsigned char FPT_CalcLrc(unsigned char buffer[]); | 834 | static unsigned char FPT_CalcLrc(unsigned char buffer[]); |
829 | 835 | ||
830 | static void FPT_Wait1Second(unsigned long p_port); | 836 | static void FPT_Wait1Second(u32 p_port); |
831 | static void FPT_Wait(unsigned long p_port, unsigned char p_delay); | 837 | static void FPT_Wait(u32 p_port, unsigned char p_delay); |
832 | static void FPT_utilEEWriteOnOff(unsigned long p_port, unsigned char p_mode); | 838 | static void FPT_utilEEWriteOnOff(u32 p_port, unsigned char p_mode); |
833 | static void FPT_utilEEWrite(unsigned long p_port, unsigned short ee_data, | 839 | static void FPT_utilEEWrite(u32 p_port, unsigned short ee_data, |
834 | unsigned short ee_addr); | 840 | unsigned short ee_addr); |
835 | static unsigned short FPT_utilEERead(unsigned long p_port, | 841 | static unsigned short FPT_utilEERead(u32 p_port, |
836 | unsigned short ee_addr); | 842 | unsigned short ee_addr); |
837 | static unsigned short FPT_utilEEReadOrg(unsigned long p_port, | 843 | static unsigned short FPT_utilEEReadOrg(u32 p_port, |
838 | unsigned short ee_addr); | 844 | unsigned short ee_addr); |
839 | static void FPT_utilEESendCmdAddr(unsigned long p_port, unsigned char ee_cmd, | 845 | static void FPT_utilEESendCmdAddr(u32 p_port, unsigned char ee_cmd, |
840 | unsigned short ee_addr); | 846 | unsigned short ee_addr); |
841 | 847 | ||
842 | static void FPT_phaseDataOut(unsigned long port, unsigned char p_card); | 848 | static void FPT_phaseDataOut(u32 port, unsigned char p_card); |
843 | static void FPT_phaseDataIn(unsigned long port, unsigned char p_card); | 849 | static void FPT_phaseDataIn(u32 port, unsigned char p_card); |
844 | static void FPT_phaseCommand(unsigned long port, unsigned char p_card); | 850 | static void FPT_phaseCommand(u32 port, unsigned char p_card); |
845 | static void FPT_phaseStatus(unsigned long port, unsigned char p_card); | 851 | static void FPT_phaseStatus(u32 port, unsigned char p_card); |
846 | static void FPT_phaseMsgOut(unsigned long port, unsigned char p_card); | 852 | static void FPT_phaseMsgOut(u32 port, unsigned char p_card); |
847 | static void FPT_phaseMsgIn(unsigned long port, unsigned char p_card); | 853 | static void FPT_phaseMsgIn(u32 port, unsigned char p_card); |
848 | static void FPT_phaseIllegal(unsigned long port, unsigned char p_card); | 854 | static void FPT_phaseIllegal(u32 port, unsigned char p_card); |
849 | 855 | ||
850 | static void FPT_phaseDecode(unsigned long port, unsigned char p_card); | 856 | static void FPT_phaseDecode(u32 port, unsigned char p_card); |
851 | static void FPT_phaseChkFifo(unsigned long port, unsigned char p_card); | 857 | static void FPT_phaseChkFifo(u32 port, unsigned char p_card); |
852 | static void FPT_phaseBusFree(unsigned long p_port, unsigned char p_card); | 858 | static void FPT_phaseBusFree(u32 p_port, unsigned char p_card); |
853 | 859 | ||
854 | static void FPT_XbowInit(unsigned long port, unsigned char scamFlg); | 860 | static void FPT_XbowInit(u32 port, unsigned char scamFlg); |
855 | static void FPT_BusMasterInit(unsigned long p_port); | 861 | static void FPT_BusMasterInit(u32 p_port); |
856 | static void FPT_DiagEEPROM(unsigned long p_port); | 862 | static void FPT_DiagEEPROM(u32 p_port); |
857 | 863 | ||
858 | static void FPT_dataXferProcessor(unsigned long port, | 864 | static void FPT_dataXferProcessor(u32 port, |
859 | struct sccb_card *pCurrCard); | 865 | struct sccb_card *pCurrCard); |
860 | static void FPT_busMstrSGDataXferStart(unsigned long port, | 866 | static void FPT_busMstrSGDataXferStart(u32 port, |
861 | struct sccb *pCurrSCCB); | 867 | struct sccb *pCurrSCCB); |
862 | static void FPT_busMstrDataXferStart(unsigned long port, | 868 | static void FPT_busMstrDataXferStart(u32 port, |
863 | struct sccb *pCurrSCCB); | 869 | struct sccb *pCurrSCCB); |
864 | static void FPT_hostDataXferAbort(unsigned long port, unsigned char p_card, | 870 | static void FPT_hostDataXferAbort(u32 port, unsigned char p_card, |
865 | struct sccb *pCurrSCCB); | 871 | struct sccb *pCurrSCCB); |
866 | static void FPT_hostDataXferRestart(struct sccb *currSCCB); | 872 | static void FPT_hostDataXferRestart(struct sccb *currSCCB); |
867 | 873 | ||
868 | static unsigned char FPT_SccbMgr_bad_isr(unsigned long p_port, | 874 | static unsigned char FPT_SccbMgr_bad_isr(u32 p_port, |
869 | unsigned char p_card, | 875 | unsigned char p_card, |
870 | struct sccb_card *pCurrCard, | 876 | struct sccb_card *pCurrCard, |
871 | unsigned short p_int); | 877 | unsigned short p_int); |
@@ -879,28 +885,28 @@ static void FPT_SccbMgrTableInitTarget(unsigned char p_card, | |||
879 | static void FPT_scini(unsigned char p_card, unsigned char p_our_id, | 885 | static void FPT_scini(unsigned char p_card, unsigned char p_our_id, |
880 | unsigned char p_power_up); | 886 | unsigned char p_power_up); |
881 | 887 | ||
882 | static int FPT_scarb(unsigned long p_port, unsigned char p_sel_type); | 888 | static int FPT_scarb(u32 p_port, unsigned char p_sel_type); |
883 | static void FPT_scbusf(unsigned long p_port); | 889 | static void FPT_scbusf(u32 p_port); |
884 | static void FPT_scsel(unsigned long p_port); | 890 | static void FPT_scsel(u32 p_port); |
885 | static void FPT_scasid(unsigned char p_card, unsigned long p_port); | 891 | static void FPT_scasid(unsigned char p_card, u32 p_port); |
886 | static unsigned char FPT_scxferc(unsigned long p_port, unsigned char p_data); | 892 | static unsigned char FPT_scxferc(u32 p_port, unsigned char p_data); |
887 | static unsigned char FPT_scsendi(unsigned long p_port, | 893 | static unsigned char FPT_scsendi(u32 p_port, |
888 | unsigned char p_id_string[]); | 894 | unsigned char p_id_string[]); |
889 | static unsigned char FPT_sciso(unsigned long p_port, | 895 | static unsigned char FPT_sciso(u32 p_port, |
890 | unsigned char p_id_string[]); | 896 | unsigned char p_id_string[]); |
891 | static void FPT_scwirod(unsigned long p_port, unsigned char p_data_bit); | 897 | static void FPT_scwirod(u32 p_port, unsigned char p_data_bit); |
892 | static void FPT_scwiros(unsigned long p_port, unsigned char p_data_bit); | 898 | static void FPT_scwiros(u32 p_port, unsigned char p_data_bit); |
893 | static unsigned char FPT_scvalq(unsigned char p_quintet); | 899 | static unsigned char FPT_scvalq(unsigned char p_quintet); |
894 | static unsigned char FPT_scsell(unsigned long p_port, unsigned char targ_id); | 900 | static unsigned char FPT_scsell(u32 p_port, unsigned char targ_id); |
895 | static void FPT_scwtsel(unsigned long p_port); | 901 | static void FPT_scwtsel(u32 p_port); |
896 | static void FPT_inisci(unsigned char p_card, unsigned long p_port, | 902 | static void FPT_inisci(unsigned char p_card, u32 p_port, |
897 | unsigned char p_our_id); | 903 | unsigned char p_our_id); |
898 | static void FPT_scsavdi(unsigned char p_card, unsigned long p_port); | 904 | static void FPT_scsavdi(unsigned char p_card, u32 p_port); |
899 | static unsigned char FPT_scmachid(unsigned char p_card, | 905 | static unsigned char FPT_scmachid(unsigned char p_card, |
900 | unsigned char p_id_string[]); | 906 | unsigned char p_id_string[]); |
901 | 907 | ||
902 | static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card); | 908 | static void FPT_autoCmdCmplt(u32 p_port, unsigned char p_card); |
903 | static void FPT_autoLoadDefaultMap(unsigned long p_port); | 909 | static void FPT_autoLoadDefaultMap(u32 p_port); |
904 | 910 | ||
905 | static struct sccb_mgr_tar_info FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] = | 911 | static struct sccb_mgr_tar_info FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] = |
906 | { {{0}} }; | 912 | { {{0}} }; |
@@ -918,7 +924,7 @@ static unsigned char FPT_scamHAString[] = | |||
918 | 924 | ||
919 | static unsigned short FPT_default_intena = 0; | 925 | static unsigned short FPT_default_intena = 0; |
920 | 926 | ||
921 | static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char) = { | 927 | static void (*FPT_s_PhaseTbl[8]) (u32, unsigned char) = { |
922 | 0}; | 928 | 0}; |
923 | 929 | ||
924 | /*--------------------------------------------------------------------- | 930 | /*--------------------------------------------------------------------- |
@@ -935,7 +941,7 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo) | |||
935 | 941 | ||
936 | unsigned char i, j, id, ScamFlg; | 942 | unsigned char i, j, id, ScamFlg; |
937 | unsigned short temp, temp2, temp3, temp4, temp5, temp6; | 943 | unsigned short temp, temp2, temp3, temp4, temp5, temp6; |
938 | unsigned long ioport; | 944 | u32 ioport; |
939 | struct nvram_info *pCurrNvRam; | 945 | struct nvram_info *pCurrNvRam; |
940 | 946 | ||
941 | ioport = pCardInfo->si_baseaddr; | 947 | ioport = pCardInfo->si_baseaddr; |
@@ -1201,23 +1207,21 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo) | |||
1201 | * | 1207 | * |
1202 | *---------------------------------------------------------------------*/ | 1208 | *---------------------------------------------------------------------*/ |
1203 | 1209 | ||
1204 | static unsigned long FlashPoint_HardwareResetHostAdapter(struct sccb_mgr_info | 1210 | static void *FlashPoint_HardwareResetHostAdapter(struct sccb_mgr_info |
1205 | *pCardInfo) | 1211 | *pCardInfo) |
1206 | { | 1212 | { |
1207 | struct sccb_card *CurrCard = NULL; | 1213 | struct sccb_card *CurrCard = NULL; |
1208 | struct nvram_info *pCurrNvRam; | 1214 | struct nvram_info *pCurrNvRam; |
1209 | unsigned char i, j, thisCard, ScamFlg; | 1215 | unsigned char i, j, thisCard, ScamFlg; |
1210 | unsigned short temp, sync_bit_map, id; | 1216 | unsigned short temp, sync_bit_map, id; |
1211 | unsigned long ioport; | 1217 | u32 ioport; |
1212 | 1218 | ||
1213 | ioport = pCardInfo->si_baseaddr; | 1219 | ioport = pCardInfo->si_baseaddr; |
1214 | 1220 | ||
1215 | for (thisCard = 0; thisCard <= MAX_CARDS; thisCard++) { | 1221 | for (thisCard = 0; thisCard <= MAX_CARDS; thisCard++) { |
1216 | 1222 | ||
1217 | if (thisCard == MAX_CARDS) { | 1223 | if (thisCard == MAX_CARDS) |
1218 | 1224 | return (void *)FAILURE; | |
1219 | return FAILURE; | ||
1220 | } | ||
1221 | 1225 | ||
1222 | if (FPT_BL_Card[thisCard].ioPort == ioport) { | 1226 | if (FPT_BL_Card[thisCard].ioPort == ioport) { |
1223 | 1227 | ||
@@ -1384,16 +1388,16 @@ static unsigned long FlashPoint_HardwareResetHostAdapter(struct sccb_mgr_info | |||
1384 | (unsigned char)(RD_HARPOON((ioport + hp_semaphore)) | | 1388 | (unsigned char)(RD_HARPOON((ioport + hp_semaphore)) | |
1385 | SCCB_MGR_PRESENT)); | 1389 | SCCB_MGR_PRESENT)); |
1386 | 1390 | ||
1387 | return (unsigned long)CurrCard; | 1391 | return (void *)CurrCard; |
1388 | } | 1392 | } |
1389 | 1393 | ||
1390 | static void FlashPoint_ReleaseHostAdapter(unsigned long pCurrCard) | 1394 | static void FlashPoint_ReleaseHostAdapter(void *pCurrCard) |
1391 | { | 1395 | { |
1392 | unsigned char i; | 1396 | unsigned char i; |
1393 | unsigned long portBase; | 1397 | u32 portBase; |
1394 | unsigned long regOffset; | 1398 | u32 regOffset; |
1395 | unsigned long scamData; | 1399 | u32 scamData; |
1396 | unsigned long *pScamTbl; | 1400 | u32 *pScamTbl; |
1397 | struct nvram_info *pCurrNvRam; | 1401 | struct nvram_info *pCurrNvRam; |
1398 | 1402 | ||
1399 | pCurrNvRam = ((struct sccb_card *)pCurrCard)->pNvRamInfo; | 1403 | pCurrNvRam = ((struct sccb_card *)pCurrCard)->pNvRamInfo; |
@@ -1414,7 +1418,7 @@ static void FlashPoint_ReleaseHostAdapter(unsigned long pCurrCard) | |||
1414 | 1418 | ||
1415 | for (i = 0; i < MAX_SCSI_TAR; i++) { | 1419 | for (i = 0; i < MAX_SCSI_TAR; i++) { |
1416 | regOffset = hp_aramBase + 64 + i * 4; | 1420 | regOffset = hp_aramBase + 64 + i * 4; |
1417 | pScamTbl = (unsigned long *)&pCurrNvRam->niScamTbl[i]; | 1421 | pScamTbl = (u32 *)&pCurrNvRam->niScamTbl[i]; |
1418 | scamData = *pScamTbl; | 1422 | scamData = *pScamTbl; |
1419 | WR_HARP32(portBase, regOffset, scamData); | 1423 | WR_HARP32(portBase, regOffset, scamData); |
1420 | } | 1424 | } |
@@ -1427,10 +1431,10 @@ static void FlashPoint_ReleaseHostAdapter(unsigned long pCurrCard) | |||
1427 | static void FPT_RNVRamData(struct nvram_info *pNvRamInfo) | 1431 | static void FPT_RNVRamData(struct nvram_info *pNvRamInfo) |
1428 | { | 1432 | { |
1429 | unsigned char i; | 1433 | unsigned char i; |
1430 | unsigned long portBase; | 1434 | u32 portBase; |
1431 | unsigned long regOffset; | 1435 | u32 regOffset; |
1432 | unsigned long scamData; | 1436 | u32 scamData; |
1433 | unsigned long *pScamTbl; | 1437 | u32 *pScamTbl; |
1434 | 1438 | ||
1435 | pNvRamInfo->niModel = FPT_RdStack(pNvRamInfo->niBaseAddr, 0); | 1439 | pNvRamInfo->niModel = FPT_RdStack(pNvRamInfo->niBaseAddr, 0); |
1436 | pNvRamInfo->niSysConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 1); | 1440 | pNvRamInfo->niSysConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 1); |
@@ -1447,26 +1451,25 @@ static void FPT_RNVRamData(struct nvram_info *pNvRamInfo) | |||
1447 | for (i = 0; i < MAX_SCSI_TAR; i++) { | 1451 | for (i = 0; i < MAX_SCSI_TAR; i++) { |
1448 | regOffset = hp_aramBase + 64 + i * 4; | 1452 | regOffset = hp_aramBase + 64 + i * 4; |
1449 | RD_HARP32(portBase, regOffset, scamData); | 1453 | RD_HARP32(portBase, regOffset, scamData); |
1450 | pScamTbl = (unsigned long *)&pNvRamInfo->niScamTbl[i]; | 1454 | pScamTbl = (u32 *)&pNvRamInfo->niScamTbl[i]; |
1451 | *pScamTbl = scamData; | 1455 | *pScamTbl = scamData; |
1452 | } | 1456 | } |
1453 | 1457 | ||
1454 | } | 1458 | } |
1455 | 1459 | ||
1456 | static unsigned char FPT_RdStack(unsigned long portBase, unsigned char index) | 1460 | static unsigned char FPT_RdStack(u32 portBase, unsigned char index) |
1457 | { | 1461 | { |
1458 | WR_HARPOON(portBase + hp_stack_addr, index); | 1462 | WR_HARPOON(portBase + hp_stack_addr, index); |
1459 | return RD_HARPOON(portBase + hp_stack_data); | 1463 | return RD_HARPOON(portBase + hp_stack_data); |
1460 | } | 1464 | } |
1461 | 1465 | ||
1462 | static void FPT_WrStack(unsigned long portBase, unsigned char index, | 1466 | static void FPT_WrStack(u32 portBase, unsigned char index, unsigned char data) |
1463 | unsigned char data) | ||
1464 | { | 1467 | { |
1465 | WR_HARPOON(portBase + hp_stack_addr, index); | 1468 | WR_HARPOON(portBase + hp_stack_addr, index); |
1466 | WR_HARPOON(portBase + hp_stack_data, data); | 1469 | WR_HARPOON(portBase + hp_stack_data, data); |
1467 | } | 1470 | } |
1468 | 1471 | ||
1469 | static unsigned char FPT_ChkIfChipInitialized(unsigned long ioPort) | 1472 | static unsigned char FPT_ChkIfChipInitialized(u32 ioPort) |
1470 | { | 1473 | { |
1471 | if ((RD_HARPOON(ioPort + hp_arb_id) & 0x0f) != FPT_RdStack(ioPort, 4)) | 1474 | if ((RD_HARPOON(ioPort + hp_arb_id) & 0x0f) != FPT_RdStack(ioPort, 4)) |
1472 | return 0; | 1475 | return 0; |
@@ -1489,15 +1492,16 @@ static unsigned char FPT_ChkIfChipInitialized(unsigned long ioPort) | |||
1489 | * callback function. | 1492 | * callback function. |
1490 | * | 1493 | * |
1491 | *---------------------------------------------------------------------*/ | 1494 | *---------------------------------------------------------------------*/ |
1492 | static void FlashPoint_StartCCB(unsigned long pCurrCard, struct sccb *p_Sccb) | 1495 | static void FlashPoint_StartCCB(void *curr_card, struct sccb *p_Sccb) |
1493 | { | 1496 | { |
1494 | unsigned long ioport; | 1497 | u32 ioport; |
1495 | unsigned char thisCard, lun; | 1498 | unsigned char thisCard, lun; |
1496 | struct sccb *pSaveSccb; | 1499 | struct sccb *pSaveSccb; |
1497 | CALL_BK_FN callback; | 1500 | CALL_BK_FN callback; |
1501 | struct sccb_card *pCurrCard = curr_card; | ||
1498 | 1502 | ||
1499 | thisCard = ((struct sccb_card *)pCurrCard)->cardIndex; | 1503 | thisCard = pCurrCard->cardIndex; |
1500 | ioport = ((struct sccb_card *)pCurrCard)->ioPort; | 1504 | ioport = pCurrCard->ioPort; |
1501 | 1505 | ||
1502 | if ((p_Sccb->TargID >= MAX_SCSI_TAR) || (p_Sccb->Lun >= MAX_LUN)) { | 1506 | if ((p_Sccb->TargID >= MAX_SCSI_TAR) || (p_Sccb->Lun >= MAX_LUN)) { |
1503 | 1507 | ||
@@ -1512,18 +1516,18 @@ static void FlashPoint_StartCCB(unsigned long pCurrCard, struct sccb *p_Sccb) | |||
1512 | 1516 | ||
1513 | FPT_sinits(p_Sccb, thisCard); | 1517 | FPT_sinits(p_Sccb, thisCard); |
1514 | 1518 | ||
1515 | if (!((struct sccb_card *)pCurrCard)->cmdCounter) { | 1519 | if (!pCurrCard->cmdCounter) { |
1516 | WR_HARPOON(ioport + hp_semaphore, | 1520 | WR_HARPOON(ioport + hp_semaphore, |
1517 | (RD_HARPOON(ioport + hp_semaphore) | 1521 | (RD_HARPOON(ioport + hp_semaphore) |
1518 | | SCCB_MGR_ACTIVE)); | 1522 | | SCCB_MGR_ACTIVE)); |
1519 | 1523 | ||
1520 | if (((struct sccb_card *)pCurrCard)->globalFlags & F_GREEN_PC) { | 1524 | if (pCurrCard->globalFlags & F_GREEN_PC) { |
1521 | WR_HARPOON(ioport + hp_clkctrl_0, CLKCTRL_DEFAULT); | 1525 | WR_HARPOON(ioport + hp_clkctrl_0, CLKCTRL_DEFAULT); |
1522 | WR_HARPOON(ioport + hp_sys_ctrl, 0x00); | 1526 | WR_HARPOON(ioport + hp_sys_ctrl, 0x00); |
1523 | } | 1527 | } |
1524 | } | 1528 | } |
1525 | 1529 | ||
1526 | ((struct sccb_card *)pCurrCard)->cmdCounter++; | 1530 | pCurrCard->cmdCounter++; |
1527 | 1531 | ||
1528 | if (RD_HARPOON(ioport + hp_semaphore) & BIOS_IN_USE) { | 1532 | if (RD_HARPOON(ioport + hp_semaphore) & BIOS_IN_USE) { |
1529 | 1533 | ||
@@ -1532,10 +1536,10 @@ static void FlashPoint_StartCCB(unsigned long pCurrCard, struct sccb *p_Sccb) | |||
1532 | | TICKLE_ME)); | 1536 | | TICKLE_ME)); |
1533 | if (p_Sccb->OperationCode == RESET_COMMAND) { | 1537 | if (p_Sccb->OperationCode == RESET_COMMAND) { |
1534 | pSaveSccb = | 1538 | pSaveSccb = |
1535 | ((struct sccb_card *)pCurrCard)->currentSCCB; | 1539 | pCurrCard->currentSCCB; |
1536 | ((struct sccb_card *)pCurrCard)->currentSCCB = p_Sccb; | 1540 | pCurrCard->currentSCCB = p_Sccb; |
1537 | FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard); | 1541 | FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard); |
1538 | ((struct sccb_card *)pCurrCard)->currentSCCB = | 1542 | pCurrCard->currentSCCB = |
1539 | pSaveSccb; | 1543 | pSaveSccb; |
1540 | } else { | 1544 | } else { |
1541 | FPT_queueAddSccb(p_Sccb, thisCard); | 1545 | FPT_queueAddSccb(p_Sccb, thisCard); |
@@ -1546,10 +1550,10 @@ static void FlashPoint_StartCCB(unsigned long pCurrCard, struct sccb *p_Sccb) | |||
1546 | 1550 | ||
1547 | if (p_Sccb->OperationCode == RESET_COMMAND) { | 1551 | if (p_Sccb->OperationCode == RESET_COMMAND) { |
1548 | pSaveSccb = | 1552 | pSaveSccb = |
1549 | ((struct sccb_card *)pCurrCard)->currentSCCB; | 1553 | pCurrCard->currentSCCB; |
1550 | ((struct sccb_card *)pCurrCard)->currentSCCB = p_Sccb; | 1554 | pCurrCard->currentSCCB = p_Sccb; |
1551 | FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard); | 1555 | FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard); |
1552 | ((struct sccb_card *)pCurrCard)->currentSCCB = | 1556 | pCurrCard->currentSCCB = |
1553 | pSaveSccb; | 1557 | pSaveSccb; |
1554 | } else { | 1558 | } else { |
1555 | FPT_queueAddSccb(p_Sccb, thisCard); | 1559 | FPT_queueAddSccb(p_Sccb, thisCard); |
@@ -1560,34 +1564,29 @@ static void FlashPoint_StartCCB(unsigned long pCurrCard, struct sccb *p_Sccb) | |||
1560 | 1564 | ||
1561 | MDISABLE_INT(ioport); | 1565 | MDISABLE_INT(ioport); |
1562 | 1566 | ||
1563 | if ((((struct sccb_card *)pCurrCard)->globalFlags & F_CONLUN_IO) | 1567 | if ((pCurrCard->globalFlags & F_CONLUN_IO) && |
1564 | && | ||
1565 | ((FPT_sccbMgrTbl[thisCard][p_Sccb->TargID]. | 1568 | ((FPT_sccbMgrTbl[thisCard][p_Sccb->TargID]. |
1566 | TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 1569 | TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) |
1567 | lun = p_Sccb->Lun; | 1570 | lun = p_Sccb->Lun; |
1568 | else | 1571 | else |
1569 | lun = 0; | 1572 | lun = 0; |
1570 | if ((((struct sccb_card *)pCurrCard)->currentSCCB == NULL) && | 1573 | if ((pCurrCard->currentSCCB == NULL) && |
1571 | (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarSelQ_Cnt == 0) | 1574 | (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarSelQ_Cnt == 0) |
1572 | && (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarLUNBusy[lun] | 1575 | && (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarLUNBusy[lun] |
1573 | == 0)) { | 1576 | == 0)) { |
1574 | 1577 | ||
1575 | ((struct sccb_card *)pCurrCard)->currentSCCB = p_Sccb; | 1578 | pCurrCard->currentSCCB = p_Sccb; |
1576 | FPT_ssel(p_Sccb->SccbIOPort, thisCard); | 1579 | FPT_ssel(p_Sccb->SccbIOPort, thisCard); |
1577 | } | 1580 | } |
1578 | 1581 | ||
1579 | else { | 1582 | else { |
1580 | 1583 | ||
1581 | if (p_Sccb->OperationCode == RESET_COMMAND) { | 1584 | if (p_Sccb->OperationCode == RESET_COMMAND) { |
1582 | pSaveSccb = | 1585 | pSaveSccb = pCurrCard->currentSCCB; |
1583 | ((struct sccb_card *)pCurrCard)-> | 1586 | pCurrCard->currentSCCB = p_Sccb; |
1584 | currentSCCB; | ||
1585 | ((struct sccb_card *)pCurrCard)->currentSCCB = | ||
1586 | p_Sccb; | ||
1587 | FPT_queueSelectFail(&FPT_BL_Card[thisCard], | 1587 | FPT_queueSelectFail(&FPT_BL_Card[thisCard], |
1588 | thisCard); | 1588 | thisCard); |
1589 | ((struct sccb_card *)pCurrCard)->currentSCCB = | 1589 | pCurrCard->currentSCCB = pSaveSccb; |
1590 | pSaveSccb; | ||
1591 | } else { | 1590 | } else { |
1592 | FPT_queueAddSccb(p_Sccb, thisCard); | 1591 | FPT_queueAddSccb(p_Sccb, thisCard); |
1593 | } | 1592 | } |
@@ -1607,9 +1606,9 @@ static void FlashPoint_StartCCB(unsigned long pCurrCard, struct sccb *p_Sccb) | |||
1607 | * callback function. | 1606 | * callback function. |
1608 | * | 1607 | * |
1609 | *---------------------------------------------------------------------*/ | 1608 | *---------------------------------------------------------------------*/ |
1610 | static int FlashPoint_AbortCCB(unsigned long pCurrCard, struct sccb *p_Sccb) | 1609 | static int FlashPoint_AbortCCB(void *pCurrCard, struct sccb *p_Sccb) |
1611 | { | 1610 | { |
1612 | unsigned long ioport; | 1611 | u32 ioport; |
1613 | 1612 | ||
1614 | unsigned char thisCard; | 1613 | unsigned char thisCard; |
1615 | CALL_BK_FN callback; | 1614 | CALL_BK_FN callback; |
@@ -1715,9 +1714,9 @@ static int FlashPoint_AbortCCB(unsigned long pCurrCard, struct sccb *p_Sccb) | |||
1715 | * interrupt for this card and disable the IRQ Pin if so. | 1714 | * interrupt for this card and disable the IRQ Pin if so. |
1716 | * | 1715 | * |
1717 | *---------------------------------------------------------------------*/ | 1716 | *---------------------------------------------------------------------*/ |
1718 | static unsigned char FlashPoint_InterruptPending(unsigned long pCurrCard) | 1717 | static unsigned char FlashPoint_InterruptPending(void *pCurrCard) |
1719 | { | 1718 | { |
1720 | unsigned long ioport; | 1719 | u32 ioport; |
1721 | 1720 | ||
1722 | ioport = ((struct sccb_card *)pCurrCard)->ioPort; | 1721 | ioport = ((struct sccb_card *)pCurrCard)->ioPort; |
1723 | 1722 | ||
@@ -1739,38 +1738,36 @@ static unsigned char FlashPoint_InterruptPending(unsigned long pCurrCard) | |||
1739 | * us. | 1738 | * us. |
1740 | * | 1739 | * |
1741 | *---------------------------------------------------------------------*/ | 1740 | *---------------------------------------------------------------------*/ |
1742 | static int FlashPoint_HandleInterrupt(unsigned long pCurrCard) | 1741 | static int FlashPoint_HandleInterrupt(void *pcard) |
1743 | { | 1742 | { |
1744 | struct sccb *currSCCB; | 1743 | struct sccb *currSCCB; |
1745 | unsigned char thisCard, result, bm_status, bm_int_st; | 1744 | unsigned char thisCard, result, bm_status, bm_int_st; |
1746 | unsigned short hp_int; | 1745 | unsigned short hp_int; |
1747 | unsigned char i, target; | 1746 | unsigned char i, target; |
1748 | unsigned long ioport; | 1747 | struct sccb_card *pCurrCard = pcard; |
1748 | u32 ioport; | ||
1749 | 1749 | ||
1750 | thisCard = ((struct sccb_card *)pCurrCard)->cardIndex; | 1750 | thisCard = pCurrCard->cardIndex; |
1751 | ioport = ((struct sccb_card *)pCurrCard)->ioPort; | 1751 | ioport = pCurrCard->ioPort; |
1752 | 1752 | ||
1753 | MDISABLE_INT(ioport); | 1753 | MDISABLE_INT(ioport); |
1754 | 1754 | ||
1755 | if ((bm_int_st = RD_HARPOON(ioport + hp_int_status)) & EXT_STATUS_ON) | 1755 | if ((bm_int_st = RD_HARPOON(ioport + hp_int_status)) & EXT_STATUS_ON) |
1756 | bm_status = | 1756 | bm_status = RD_HARPOON(ioport + hp_ext_status) & |
1757 | RD_HARPOON(ioport + | 1757 | (unsigned char)BAD_EXT_STATUS; |
1758 | hp_ext_status) & (unsigned char)BAD_EXT_STATUS; | ||
1759 | else | 1758 | else |
1760 | bm_status = 0; | 1759 | bm_status = 0; |
1761 | 1760 | ||
1762 | WR_HARPOON(ioport + hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT)); | 1761 | WR_HARPOON(ioport + hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT)); |
1763 | 1762 | ||
1764 | while ((hp_int = | 1763 | while ((hp_int = RDW_HARPOON((ioport + hp_intstat)) & |
1765 | RDW_HARPOON((ioport + | 1764 | FPT_default_intena) | bm_status) { |
1766 | hp_intstat)) & FPT_default_intena) | bm_status) { | ||
1767 | 1765 | ||
1768 | currSCCB = ((struct sccb_card *)pCurrCard)->currentSCCB; | 1766 | currSCCB = pCurrCard->currentSCCB; |
1769 | 1767 | ||
1770 | if (hp_int & (FIFO | TIMEOUT | RESET | SCAM_SEL) || bm_status) { | 1768 | if (hp_int & (FIFO | TIMEOUT | RESET | SCAM_SEL) || bm_status) { |
1771 | result = | 1769 | result = |
1772 | FPT_SccbMgr_bad_isr(ioport, thisCard, | 1770 | FPT_SccbMgr_bad_isr(ioport, thisCard, pCurrCard, |
1773 | ((struct sccb_card *)pCurrCard), | ||
1774 | hp_int); | 1771 | hp_int); |
1775 | WRW_HARPOON((ioport + hp_intstat), | 1772 | WRW_HARPOON((ioport + hp_intstat), |
1776 | (FIFO | TIMEOUT | RESET | SCAM_SEL)); | 1773 | (FIFO | TIMEOUT | RESET | SCAM_SEL)); |
@@ -1796,8 +1793,7 @@ static int FlashPoint_HandleInterrupt(unsigned long pCurrCard) | |||
1796 | (BUS_FREE | RSEL))) ; | 1793 | (BUS_FREE | RSEL))) ; |
1797 | } | 1794 | } |
1798 | 1795 | ||
1799 | if (((struct sccb_card *)pCurrCard)-> | 1796 | if (pCurrCard->globalFlags & F_HOST_XFER_ACT) |
1800 | globalFlags & F_HOST_XFER_ACT) | ||
1801 | 1797 | ||
1802 | FPT_phaseChkFifo(ioport, thisCard); | 1798 | FPT_phaseChkFifo(ioport, thisCard); |
1803 | 1799 | ||
@@ -1813,14 +1809,11 @@ static int FlashPoint_HandleInterrupt(unsigned long pCurrCard) | |||
1813 | 1809 | ||
1814 | else if (hp_int & ITAR_DISC) { | 1810 | else if (hp_int & ITAR_DISC) { |
1815 | 1811 | ||
1816 | if (((struct sccb_card *)pCurrCard)-> | 1812 | if (pCurrCard->globalFlags & F_HOST_XFER_ACT) |
1817 | globalFlags & F_HOST_XFER_ACT) { | ||
1818 | |||
1819 | FPT_phaseChkFifo(ioport, thisCard); | 1813 | FPT_phaseChkFifo(ioport, thisCard); |
1820 | 1814 | ||
1821 | } | 1815 | if (RD_HARPOON(ioport + hp_gp_reg_1) == |
1822 | 1816 | SMSAVE_DATA_PTR) { | |
1823 | if (RD_HARPOON(ioport + hp_gp_reg_1) == SMSAVE_DATA_PTR) { | ||
1824 | 1817 | ||
1825 | WR_HARPOON(ioport + hp_gp_reg_1, 0x00); | 1818 | WR_HARPOON(ioport + hp_gp_reg_1, 0x00); |
1826 | currSCCB->Sccb_XferState |= F_NO_DATA_YET; | 1819 | currSCCB->Sccb_XferState |= F_NO_DATA_YET; |
@@ -1859,8 +1852,7 @@ static int FlashPoint_HandleInterrupt(unsigned long pCurrCard) | |||
1859 | WRW_HARPOON((ioport + hp_intstat), | 1852 | WRW_HARPOON((ioport + hp_intstat), |
1860 | (BUS_FREE | ITAR_DISC)); | 1853 | (BUS_FREE | ITAR_DISC)); |
1861 | 1854 | ||
1862 | ((struct sccb_card *)pCurrCard)->globalFlags |= | 1855 | pCurrCard->globalFlags |= F_NEW_SCCB_CMD; |
1863 | F_NEW_SCCB_CMD; | ||
1864 | 1856 | ||
1865 | } | 1857 | } |
1866 | 1858 | ||
@@ -1870,10 +1862,8 @@ static int FlashPoint_HandleInterrupt(unsigned long pCurrCard) | |||
1870 | (PROG_HLT | RSEL | PHASE | BUS_FREE)); | 1862 | (PROG_HLT | RSEL | PHASE | BUS_FREE)); |
1871 | 1863 | ||
1872 | if (RDW_HARPOON((ioport + hp_intstat)) & ITAR_DISC) { | 1864 | if (RDW_HARPOON((ioport + hp_intstat)) & ITAR_DISC) { |
1873 | if (((struct sccb_card *)pCurrCard)-> | 1865 | if (pCurrCard->globalFlags & F_HOST_XFER_ACT) |
1874 | globalFlags & F_HOST_XFER_ACT) { | ||
1875 | FPT_phaseChkFifo(ioport, thisCard); | 1866 | FPT_phaseChkFifo(ioport, thisCard); |
1876 | } | ||
1877 | 1867 | ||
1878 | if (RD_HARPOON(ioport + hp_gp_reg_1) == | 1868 | if (RD_HARPOON(ioport + hp_gp_reg_1) == |
1879 | SMSAVE_DATA_PTR) { | 1869 | SMSAVE_DATA_PTR) { |
@@ -1890,8 +1880,7 @@ static int FlashPoint_HandleInterrupt(unsigned long pCurrCard) | |||
1890 | FPT_queueDisconnect(currSCCB, thisCard); | 1880 | FPT_queueDisconnect(currSCCB, thisCard); |
1891 | } | 1881 | } |
1892 | 1882 | ||
1893 | FPT_sres(ioport, thisCard, | 1883 | FPT_sres(ioport, thisCard, pCurrCard); |
1894 | ((struct sccb_card *)pCurrCard)); | ||
1895 | FPT_phaseDecode(ioport, thisCard); | 1884 | FPT_phaseDecode(ioport, thisCard); |
1896 | 1885 | ||
1897 | } | 1886 | } |
@@ -1948,8 +1937,7 @@ static int FlashPoint_HandleInterrupt(unsigned long pCurrCard) | |||
1948 | 1937 | ||
1949 | WRW_HARPOON((ioport + hp_intstat), BUS_FREE); | 1938 | WRW_HARPOON((ioport + hp_intstat), BUS_FREE); |
1950 | 1939 | ||
1951 | if (((struct sccb_card *)pCurrCard)-> | 1940 | if (pCurrCard->globalFlags & F_HOST_XFER_ACT) { |
1952 | globalFlags & F_HOST_XFER_ACT) { | ||
1953 | 1941 | ||
1954 | FPT_hostDataXferAbort(ioport, thisCard, | 1942 | FPT_hostDataXferAbort(ioport, thisCard, |
1955 | currSCCB); | 1943 | currSCCB); |
@@ -1961,27 +1949,19 @@ static int FlashPoint_HandleInterrupt(unsigned long pCurrCard) | |||
1961 | else if (hp_int & ITICKLE) { | 1949 | else if (hp_int & ITICKLE) { |
1962 | 1950 | ||
1963 | WRW_HARPOON((ioport + hp_intstat), ITICKLE); | 1951 | WRW_HARPOON((ioport + hp_intstat), ITICKLE); |
1964 | ((struct sccb_card *)pCurrCard)->globalFlags |= | 1952 | pCurrCard->globalFlags |= F_NEW_SCCB_CMD; |
1965 | F_NEW_SCCB_CMD; | ||
1966 | } | 1953 | } |
1967 | 1954 | ||
1968 | if (((struct sccb_card *)pCurrCard)-> | 1955 | if (((struct sccb_card *)pCurrCard)-> |
1969 | globalFlags & F_NEW_SCCB_CMD) { | 1956 | globalFlags & F_NEW_SCCB_CMD) { |
1970 | 1957 | ||
1971 | ((struct sccb_card *)pCurrCard)->globalFlags &= | 1958 | pCurrCard->globalFlags &= ~F_NEW_SCCB_CMD; |
1972 | ~F_NEW_SCCB_CMD; | ||
1973 | 1959 | ||
1974 | if (((struct sccb_card *)pCurrCard)->currentSCCB == | 1960 | if (pCurrCard->currentSCCB == NULL) |
1975 | NULL) { | 1961 | FPT_queueSearchSelect(pCurrCard, thisCard); |
1976 | |||
1977 | FPT_queueSearchSelect(((struct sccb_card *) | ||
1978 | pCurrCard), thisCard); | ||
1979 | } | ||
1980 | 1962 | ||
1981 | if (((struct sccb_card *)pCurrCard)->currentSCCB != | 1963 | if (pCurrCard->currentSCCB != NULL) { |
1982 | NULL) { | 1964 | pCurrCard->globalFlags &= ~F_NEW_SCCB_CMD; |
1983 | ((struct sccb_card *)pCurrCard)->globalFlags &= | ||
1984 | ~F_NEW_SCCB_CMD; | ||
1985 | FPT_ssel(ioport, thisCard); | 1965 | FPT_ssel(ioport, thisCard); |
1986 | } | 1966 | } |
1987 | 1967 | ||
@@ -2006,8 +1986,7 @@ static int FlashPoint_HandleInterrupt(unsigned long pCurrCard) | |||
2006 | * processing time. | 1986 | * processing time. |
2007 | * | 1987 | * |
2008 | *---------------------------------------------------------------------*/ | 1988 | *---------------------------------------------------------------------*/ |
2009 | static unsigned char FPT_SccbMgr_bad_isr(unsigned long p_port, | 1989 | static unsigned char FPT_SccbMgr_bad_isr(u32 p_port, unsigned char p_card, |
2010 | unsigned char p_card, | ||
2011 | struct sccb_card *pCurrCard, | 1990 | struct sccb_card *pCurrCard, |
2012 | unsigned short p_int) | 1991 | unsigned short p_int) |
2013 | { | 1992 | { |
@@ -2254,7 +2233,7 @@ static void FPT_SccbMgrTableInitTarget(unsigned char p_card, | |||
2254 | * | 2233 | * |
2255 | *---------------------------------------------------------------------*/ | 2234 | *---------------------------------------------------------------------*/ |
2256 | 2235 | ||
2257 | static unsigned char FPT_sfm(unsigned long port, struct sccb *pCurrSCCB) | 2236 | static unsigned char FPT_sfm(u32 port, struct sccb *pCurrSCCB) |
2258 | { | 2237 | { |
2259 | unsigned char message; | 2238 | unsigned char message; |
2260 | unsigned short TimeOutLoop; | 2239 | unsigned short TimeOutLoop; |
@@ -2322,12 +2301,12 @@ static unsigned char FPT_sfm(unsigned long port, struct sccb *pCurrSCCB) | |||
2322 | * | 2301 | * |
2323 | *---------------------------------------------------------------------*/ | 2302 | *---------------------------------------------------------------------*/ |
2324 | 2303 | ||
2325 | static void FPT_ssel(unsigned long port, unsigned char p_card) | 2304 | static void FPT_ssel(u32 port, unsigned char p_card) |
2326 | { | 2305 | { |
2327 | 2306 | ||
2328 | unsigned char auto_loaded, i, target, *theCCB; | 2307 | unsigned char auto_loaded, i, target, *theCCB; |
2329 | 2308 | ||
2330 | unsigned long cdb_reg; | 2309 | u32 cdb_reg; |
2331 | struct sccb_card *CurrCard; | 2310 | struct sccb_card *CurrCard; |
2332 | struct sccb *currSCCB; | 2311 | struct sccb *currSCCB; |
2333 | struct sccb_mgr_tar_info *currTar_Info; | 2312 | struct sccb_mgr_tar_info *currTar_Info; |
@@ -2621,7 +2600,7 @@ static void FPT_ssel(unsigned long port, unsigned char p_card) | |||
2621 | * | 2600 | * |
2622 | *---------------------------------------------------------------------*/ | 2601 | *---------------------------------------------------------------------*/ |
2623 | 2602 | ||
2624 | static void FPT_sres(unsigned long port, unsigned char p_card, | 2603 | static void FPT_sres(u32 port, unsigned char p_card, |
2625 | struct sccb_card *pCurrCard) | 2604 | struct sccb_card *pCurrCard) |
2626 | { | 2605 | { |
2627 | 2606 | ||
@@ -2857,7 +2836,7 @@ static void FPT_sres(unsigned long port, unsigned char p_card, | |||
2857 | (RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) ; | 2836 | (RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) ; |
2858 | } | 2837 | } |
2859 | 2838 | ||
2860 | static void FPT_SendMsg(unsigned long port, unsigned char message) | 2839 | static void FPT_SendMsg(u32 port, unsigned char message) |
2861 | { | 2840 | { |
2862 | while (!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) { | 2841 | while (!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) { |
2863 | if (!(RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) { | 2842 | if (!(RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) { |
@@ -2904,8 +2883,7 @@ static void FPT_SendMsg(unsigned long port, unsigned char message) | |||
2904 | * target device. | 2883 | * target device. |
2905 | * | 2884 | * |
2906 | *---------------------------------------------------------------------*/ | 2885 | *---------------------------------------------------------------------*/ |
2907 | static void FPT_sdecm(unsigned char message, unsigned long port, | 2886 | static void FPT_sdecm(unsigned char message, u32 port, unsigned char p_card) |
2908 | unsigned char p_card) | ||
2909 | { | 2887 | { |
2910 | struct sccb *currSCCB; | 2888 | struct sccb *currSCCB; |
2911 | struct sccb_card *CurrCard; | 2889 | struct sccb_card *CurrCard; |
@@ -3085,8 +3063,7 @@ static void FPT_sdecm(unsigned char message, unsigned long port, | |||
3085 | * Description: Decide what to do with the extended message. | 3063 | * Description: Decide what to do with the extended message. |
3086 | * | 3064 | * |
3087 | *---------------------------------------------------------------------*/ | 3065 | *---------------------------------------------------------------------*/ |
3088 | static void FPT_shandem(unsigned long port, unsigned char p_card, | 3066 | static void FPT_shandem(u32 port, unsigned char p_card, struct sccb *pCurrSCCB) |
3089 | struct sccb *pCurrSCCB) | ||
3090 | { | 3067 | { |
3091 | unsigned char length, message; | 3068 | unsigned char length, message; |
3092 | 3069 | ||
@@ -3153,7 +3130,7 @@ static void FPT_shandem(unsigned long port, unsigned char p_card, | |||
3153 | * | 3130 | * |
3154 | *---------------------------------------------------------------------*/ | 3131 | *---------------------------------------------------------------------*/ |
3155 | 3132 | ||
3156 | static unsigned char FPT_sisyncn(unsigned long port, unsigned char p_card, | 3133 | static unsigned char FPT_sisyncn(u32 port, unsigned char p_card, |
3157 | unsigned char syncFlag) | 3134 | unsigned char syncFlag) |
3158 | { | 3135 | { |
3159 | struct sccb *currSCCB; | 3136 | struct sccb *currSCCB; |
@@ -3234,7 +3211,7 @@ static unsigned char FPT_sisyncn(unsigned long port, unsigned char p_card, | |||
3234 | * necessary. | 3211 | * necessary. |
3235 | * | 3212 | * |
3236 | *---------------------------------------------------------------------*/ | 3213 | *---------------------------------------------------------------------*/ |
3237 | static void FPT_stsyncn(unsigned long port, unsigned char p_card) | 3214 | static void FPT_stsyncn(u32 port, unsigned char p_card) |
3238 | { | 3215 | { |
3239 | unsigned char sync_msg, offset, sync_reg, our_sync_msg; | 3216 | unsigned char sync_msg, offset, sync_reg, our_sync_msg; |
3240 | struct sccb *currSCCB; | 3217 | struct sccb *currSCCB; |
@@ -3363,7 +3340,7 @@ static void FPT_stsyncn(unsigned long port, unsigned char p_card) | |||
3363 | * Description: Answer the targets sync message. | 3340 | * Description: Answer the targets sync message. |
3364 | * | 3341 | * |
3365 | *---------------------------------------------------------------------*/ | 3342 | *---------------------------------------------------------------------*/ |
3366 | static void FPT_sisyncr(unsigned long port, unsigned char sync_pulse, | 3343 | static void FPT_sisyncr(u32 port, unsigned char sync_pulse, |
3367 | unsigned char offset) | 3344 | unsigned char offset) |
3368 | { | 3345 | { |
3369 | ARAM_ACCESS(port); | 3346 | ARAM_ACCESS(port); |
@@ -3394,7 +3371,7 @@ static void FPT_sisyncr(unsigned long port, unsigned char sync_pulse, | |||
3394 | * | 3371 | * |
3395 | *---------------------------------------------------------------------*/ | 3372 | *---------------------------------------------------------------------*/ |
3396 | 3373 | ||
3397 | static unsigned char FPT_siwidn(unsigned long port, unsigned char p_card) | 3374 | static unsigned char FPT_siwidn(u32 port, unsigned char p_card) |
3398 | { | 3375 | { |
3399 | struct sccb *currSCCB; | 3376 | struct sccb *currSCCB; |
3400 | struct sccb_mgr_tar_info *currTar_Info; | 3377 | struct sccb_mgr_tar_info *currTar_Info; |
@@ -3449,7 +3426,7 @@ static unsigned char FPT_siwidn(unsigned long port, unsigned char p_card) | |||
3449 | * necessary. | 3426 | * necessary. |
3450 | * | 3427 | * |
3451 | *---------------------------------------------------------------------*/ | 3428 | *---------------------------------------------------------------------*/ |
3452 | static void FPT_stwidn(unsigned long port, unsigned char p_card) | 3429 | static void FPT_stwidn(u32 port, unsigned char p_card) |
3453 | { | 3430 | { |
3454 | unsigned char width; | 3431 | unsigned char width; |
3455 | struct sccb *currSCCB; | 3432 | struct sccb *currSCCB; |
@@ -3520,7 +3497,7 @@ static void FPT_stwidn(unsigned long port, unsigned char p_card) | |||
3520 | * Description: Answer the targets Wide nego message. | 3497 | * Description: Answer the targets Wide nego message. |
3521 | * | 3498 | * |
3522 | *---------------------------------------------------------------------*/ | 3499 | *---------------------------------------------------------------------*/ |
3523 | static void FPT_siwidr(unsigned long port, unsigned char width) | 3500 | static void FPT_siwidr(u32 port, unsigned char width) |
3524 | { | 3501 | { |
3525 | ARAM_ACCESS(port); | 3502 | ARAM_ACCESS(port); |
3526 | WRW_HARPOON((port + SYNC_MSGS + 0), (MPM_OP + AMSG_OUT + SMEXT)); | 3503 | WRW_HARPOON((port + SYNC_MSGS + 0), (MPM_OP + AMSG_OUT + SMEXT)); |
@@ -3548,7 +3525,7 @@ static void FPT_siwidr(unsigned long port, unsigned char width) | |||
3548 | * ID specified. | 3525 | * ID specified. |
3549 | * | 3526 | * |
3550 | *---------------------------------------------------------------------*/ | 3527 | *---------------------------------------------------------------------*/ |
3551 | static void FPT_sssyncv(unsigned long p_port, unsigned char p_id, | 3528 | static void FPT_sssyncv(u32 p_port, unsigned char p_id, |
3552 | unsigned char p_sync_value, | 3529 | unsigned char p_sync_value, |
3553 | struct sccb_mgr_tar_info *currTar_Info) | 3530 | struct sccb_mgr_tar_info *currTar_Info) |
3554 | { | 3531 | { |
@@ -3620,7 +3597,7 @@ static void FPT_sssyncv(unsigned long p_port, unsigned char p_id, | |||
3620 | * Description: Reset the desired card's SCSI bus. | 3597 | * Description: Reset the desired card's SCSI bus. |
3621 | * | 3598 | * |
3622 | *---------------------------------------------------------------------*/ | 3599 | *---------------------------------------------------------------------*/ |
3623 | static void FPT_sresb(unsigned long port, unsigned char p_card) | 3600 | static void FPT_sresb(u32 port, unsigned char p_card) |
3624 | { | 3601 | { |
3625 | unsigned char scsiID, i; | 3602 | unsigned char scsiID, i; |
3626 | 3603 | ||
@@ -3713,7 +3690,7 @@ static void FPT_ssenss(struct sccb_card *pCurrCard) | |||
3713 | currSCCB->Cdb[4] = currSCCB->RequestSenseLength; | 3690 | currSCCB->Cdb[4] = currSCCB->RequestSenseLength; |
3714 | currSCCB->Cdb[5] = 0x00; | 3691 | currSCCB->Cdb[5] = 0x00; |
3715 | 3692 | ||
3716 | currSCCB->Sccb_XferCnt = (unsigned long)currSCCB->RequestSenseLength; | 3693 | currSCCB->Sccb_XferCnt = (u32)currSCCB->RequestSenseLength; |
3717 | 3694 | ||
3718 | currSCCB->Sccb_ATC = 0x00; | 3695 | currSCCB->Sccb_ATC = 0x00; |
3719 | 3696 | ||
@@ -3737,7 +3714,7 @@ static void FPT_ssenss(struct sccb_card *pCurrCard) | |||
3737 | * | 3714 | * |
3738 | *---------------------------------------------------------------------*/ | 3715 | *---------------------------------------------------------------------*/ |
3739 | 3716 | ||
3740 | static void FPT_sxfrp(unsigned long p_port, unsigned char p_card) | 3717 | static void FPT_sxfrp(u32 p_port, unsigned char p_card) |
3741 | { | 3718 | { |
3742 | unsigned char curr_phz; | 3719 | unsigned char curr_phz; |
3743 | 3720 | ||
@@ -3819,7 +3796,7 @@ static void FPT_sxfrp(unsigned long p_port, unsigned char p_card) | |||
3819 | * | 3796 | * |
3820 | *---------------------------------------------------------------------*/ | 3797 | *---------------------------------------------------------------------*/ |
3821 | 3798 | ||
3822 | static void FPT_schkdd(unsigned long port, unsigned char p_card) | 3799 | static void FPT_schkdd(u32 port, unsigned char p_card) |
3823 | { | 3800 | { |
3824 | unsigned short TimeOutLoop; | 3801 | unsigned short TimeOutLoop; |
3825 | unsigned char sPhase; | 3802 | unsigned char sPhase; |
@@ -3998,10 +3975,10 @@ static void FPT_sinits(struct sccb *p_sccb, unsigned char p_card) | |||
3998 | * | 3975 | * |
3999 | *---------------------------------------------------------------------*/ | 3976 | *---------------------------------------------------------------------*/ |
4000 | 3977 | ||
4001 | static void FPT_phaseDecode(unsigned long p_port, unsigned char p_card) | 3978 | static void FPT_phaseDecode(u32 p_port, unsigned char p_card) |
4002 | { | 3979 | { |
4003 | unsigned char phase_ref; | 3980 | unsigned char phase_ref; |
4004 | void (*phase) (unsigned long, unsigned char); | 3981 | void (*phase) (u32, unsigned char); |
4005 | 3982 | ||
4006 | DISABLE_AUTO(p_port); | 3983 | DISABLE_AUTO(p_port); |
4007 | 3984 | ||
@@ -4021,7 +3998,7 @@ static void FPT_phaseDecode(unsigned long p_port, unsigned char p_card) | |||
4021 | * | 3998 | * |
4022 | *---------------------------------------------------------------------*/ | 3999 | *---------------------------------------------------------------------*/ |
4023 | 4000 | ||
4024 | static void FPT_phaseDataOut(unsigned long port, unsigned char p_card) | 4001 | static void FPT_phaseDataOut(u32 port, unsigned char p_card) |
4025 | { | 4002 | { |
4026 | 4003 | ||
4027 | struct sccb *currSCCB; | 4004 | struct sccb *currSCCB; |
@@ -4062,7 +4039,7 @@ static void FPT_phaseDataOut(unsigned long port, unsigned char p_card) | |||
4062 | * | 4039 | * |
4063 | *---------------------------------------------------------------------*/ | 4040 | *---------------------------------------------------------------------*/ |
4064 | 4041 | ||
4065 | static void FPT_phaseDataIn(unsigned long port, unsigned char p_card) | 4042 | static void FPT_phaseDataIn(u32 port, unsigned char p_card) |
4066 | { | 4043 | { |
4067 | 4044 | ||
4068 | struct sccb *currSCCB; | 4045 | struct sccb *currSCCB; |
@@ -4106,10 +4083,10 @@ static void FPT_phaseDataIn(unsigned long port, unsigned char p_card) | |||
4106 | * | 4083 | * |
4107 | *---------------------------------------------------------------------*/ | 4084 | *---------------------------------------------------------------------*/ |
4108 | 4085 | ||
4109 | static void FPT_phaseCommand(unsigned long p_port, unsigned char p_card) | 4086 | static void FPT_phaseCommand(u32 p_port, unsigned char p_card) |
4110 | { | 4087 | { |
4111 | struct sccb *currSCCB; | 4088 | struct sccb *currSCCB; |
4112 | unsigned long cdb_reg; | 4089 | u32 cdb_reg; |
4113 | unsigned char i; | 4090 | unsigned char i; |
4114 | 4091 | ||
4115 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | 4092 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
@@ -4157,7 +4134,7 @@ static void FPT_phaseCommand(unsigned long p_port, unsigned char p_card) | |||
4157 | * | 4134 | * |
4158 | *---------------------------------------------------------------------*/ | 4135 | *---------------------------------------------------------------------*/ |
4159 | 4136 | ||
4160 | static void FPT_phaseStatus(unsigned long port, unsigned char p_card) | 4137 | static void FPT_phaseStatus(u32 port, unsigned char p_card) |
4161 | { | 4138 | { |
4162 | /* Start-up the automation to finish off this command and let the | 4139 | /* Start-up the automation to finish off this command and let the |
4163 | isr handle the interrupt for command complete when it comes in. | 4140 | isr handle the interrupt for command complete when it comes in. |
@@ -4178,7 +4155,7 @@ static void FPT_phaseStatus(unsigned long port, unsigned char p_card) | |||
4178 | * | 4155 | * |
4179 | *---------------------------------------------------------------------*/ | 4156 | *---------------------------------------------------------------------*/ |
4180 | 4157 | ||
4181 | static void FPT_phaseMsgOut(unsigned long port, unsigned char p_card) | 4158 | static void FPT_phaseMsgOut(u32 port, unsigned char p_card) |
4182 | { | 4159 | { |
4183 | unsigned char message, scsiID; | 4160 | unsigned char message, scsiID; |
4184 | struct sccb *currSCCB; | 4161 | struct sccb *currSCCB; |
@@ -4317,7 +4294,7 @@ static void FPT_phaseMsgOut(unsigned long port, unsigned char p_card) | |||
4317 | * | 4294 | * |
4318 | *---------------------------------------------------------------------*/ | 4295 | *---------------------------------------------------------------------*/ |
4319 | 4296 | ||
4320 | static void FPT_phaseMsgIn(unsigned long port, unsigned char p_card) | 4297 | static void FPT_phaseMsgIn(u32 port, unsigned char p_card) |
4321 | { | 4298 | { |
4322 | unsigned char message; | 4299 | unsigned char message; |
4323 | struct sccb *currSCCB; | 4300 | struct sccb *currSCCB; |
@@ -4364,7 +4341,7 @@ static void FPT_phaseMsgIn(unsigned long port, unsigned char p_card) | |||
4364 | * | 4341 | * |
4365 | *---------------------------------------------------------------------*/ | 4342 | *---------------------------------------------------------------------*/ |
4366 | 4343 | ||
4367 | static void FPT_phaseIllegal(unsigned long port, unsigned char p_card) | 4344 | static void FPT_phaseIllegal(u32 port, unsigned char p_card) |
4368 | { | 4345 | { |
4369 | struct sccb *currSCCB; | 4346 | struct sccb *currSCCB; |
4370 | 4347 | ||
@@ -4390,9 +4367,9 @@ static void FPT_phaseIllegal(unsigned long port, unsigned char p_card) | |||
4390 | * | 4367 | * |
4391 | *---------------------------------------------------------------------*/ | 4368 | *---------------------------------------------------------------------*/ |
4392 | 4369 | ||
4393 | static void FPT_phaseChkFifo(unsigned long port, unsigned char p_card) | 4370 | static void FPT_phaseChkFifo(u32 port, unsigned char p_card) |
4394 | { | 4371 | { |
4395 | unsigned long xfercnt; | 4372 | u32 xfercnt; |
4396 | struct sccb *currSCCB; | 4373 | struct sccb *currSCCB; |
4397 | 4374 | ||
4398 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | 4375 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
@@ -4461,7 +4438,7 @@ static void FPT_phaseChkFifo(unsigned long port, unsigned char p_card) | |||
4461 | * because of command complete or from a disconnect. | 4438 | * because of command complete or from a disconnect. |
4462 | * | 4439 | * |
4463 | *---------------------------------------------------------------------*/ | 4440 | *---------------------------------------------------------------------*/ |
4464 | static void FPT_phaseBusFree(unsigned long port, unsigned char p_card) | 4441 | static void FPT_phaseBusFree(u32 port, unsigned char p_card) |
4465 | { | 4442 | { |
4466 | struct sccb *currSCCB; | 4443 | struct sccb *currSCCB; |
4467 | 4444 | ||
@@ -4557,9 +4534,9 @@ static void FPT_phaseBusFree(unsigned long port, unsigned char p_card) | |||
4557 | * Description: Load the Automation RAM with the defualt map values. | 4534 | * Description: Load the Automation RAM with the defualt map values. |
4558 | * | 4535 | * |
4559 | *---------------------------------------------------------------------*/ | 4536 | *---------------------------------------------------------------------*/ |
4560 | static void FPT_autoLoadDefaultMap(unsigned long p_port) | 4537 | static void FPT_autoLoadDefaultMap(u32 p_port) |
4561 | { | 4538 | { |
4562 | unsigned long map_addr; | 4539 | u32 map_addr; |
4563 | 4540 | ||
4564 | ARAM_ACCESS(p_port); | 4541 | ARAM_ACCESS(p_port); |
4565 | map_addr = p_port + hp_aramBase; | 4542 | map_addr = p_port + hp_aramBase; |
@@ -4663,7 +4640,7 @@ static void FPT_autoLoadDefaultMap(unsigned long p_port) | |||
4663 | * | 4640 | * |
4664 | *---------------------------------------------------------------------*/ | 4641 | *---------------------------------------------------------------------*/ |
4665 | 4642 | ||
4666 | static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card) | 4643 | static void FPT_autoCmdCmplt(u32 p_port, unsigned char p_card) |
4667 | { | 4644 | { |
4668 | struct sccb *currSCCB; | 4645 | struct sccb *currSCCB; |
4669 | unsigned char status_byte; | 4646 | unsigned char status_byte; |
@@ -4936,8 +4913,7 @@ static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card) | |||
4936 | * | 4913 | * |
4937 | *---------------------------------------------------------------------*/ | 4914 | *---------------------------------------------------------------------*/ |
4938 | 4915 | ||
4939 | static void FPT_dataXferProcessor(unsigned long port, | 4916 | static void FPT_dataXferProcessor(u32 port, struct sccb_card *pCurrCard) |
4940 | struct sccb_card *pCurrCard) | ||
4941 | { | 4917 | { |
4942 | struct sccb *currSCCB; | 4918 | struct sccb *currSCCB; |
4943 | 4919 | ||
@@ -4970,22 +4946,18 @@ static void FPT_dataXferProcessor(unsigned long port, | |||
4970 | * Description: | 4946 | * Description: |
4971 | * | 4947 | * |
4972 | *---------------------------------------------------------------------*/ | 4948 | *---------------------------------------------------------------------*/ |
4973 | static void FPT_busMstrSGDataXferStart(unsigned long p_port, | 4949 | static void FPT_busMstrSGDataXferStart(u32 p_port, struct sccb *pcurrSCCB) |
4974 | struct sccb *pcurrSCCB) | ||
4975 | { | 4950 | { |
4976 | unsigned long count, addr, tmpSGCnt; | 4951 | u32 count, addr, tmpSGCnt; |
4977 | unsigned int sg_index; | 4952 | unsigned int sg_index; |
4978 | unsigned char sg_count, i; | 4953 | unsigned char sg_count, i; |
4979 | unsigned long reg_offset; | 4954 | u32 reg_offset; |
4980 | 4955 | struct blogic_sg_seg *segp; | |
4981 | if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) { | ||
4982 | 4956 | ||
4983 | count = ((unsigned long)HOST_RD_CMD) << 24; | 4957 | if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) |
4984 | } | 4958 | count = ((u32)HOST_RD_CMD) << 24; |
4985 | 4959 | else | |
4986 | else { | 4960 | count = ((u32)HOST_WRT_CMD) << 24; |
4987 | count = ((unsigned long)HOST_WRT_CMD) << 24; | ||
4988 | } | ||
4989 | 4961 | ||
4990 | sg_count = 0; | 4962 | sg_count = 0; |
4991 | tmpSGCnt = 0; | 4963 | tmpSGCnt = 0; |
@@ -4998,25 +4970,20 @@ static void FPT_busMstrSGDataXferStart(unsigned long p_port, | |||
4998 | WR_HARPOON(p_port + hp_page_ctrl, i); | 4970 | WR_HARPOON(p_port + hp_page_ctrl, i); |
4999 | 4971 | ||
5000 | while ((sg_count < (unsigned char)SG_BUF_CNT) && | 4972 | while ((sg_count < (unsigned char)SG_BUF_CNT) && |
5001 | ((unsigned long)(sg_index * (unsigned int)SG_ELEMENT_SIZE) < | 4973 | ((sg_index * (unsigned int)SG_ELEMENT_SIZE) < |
5002 | pcurrSCCB->DataLength)) { | 4974 | pcurrSCCB->DataLength)) { |
5003 | |||
5004 | tmpSGCnt += *(((unsigned long *)pcurrSCCB->DataPointer) + | ||
5005 | (sg_index * 2)); | ||
5006 | |||
5007 | count |= *(((unsigned long *)pcurrSCCB->DataPointer) + | ||
5008 | (sg_index * 2)); | ||
5009 | 4975 | ||
5010 | addr = *(((unsigned long *)pcurrSCCB->DataPointer) + | 4976 | segp = (struct blogic_sg_seg *)(pcurrSCCB->DataPointer) + |
5011 | ((sg_index * 2) + 1)); | 4977 | sg_index; |
4978 | tmpSGCnt += segp->segbytes; | ||
4979 | count |= segp->segbytes; | ||
4980 | addr = segp->segdata; | ||
5012 | 4981 | ||
5013 | if ((!sg_count) && (pcurrSCCB->Sccb_SGoffset)) { | 4982 | if ((!sg_count) && (pcurrSCCB->Sccb_SGoffset)) { |
5014 | |||
5015 | addr += | 4983 | addr += |
5016 | ((count & 0x00FFFFFFL) - pcurrSCCB->Sccb_SGoffset); | 4984 | ((count & 0x00FFFFFFL) - pcurrSCCB->Sccb_SGoffset); |
5017 | count = | 4985 | count = |
5018 | (count & 0xFF000000L) | pcurrSCCB->Sccb_SGoffset; | 4986 | (count & 0xFF000000L) | pcurrSCCB->Sccb_SGoffset; |
5019 | |||
5020 | tmpSGCnt = count & 0x00FFFFFFL; | 4987 | tmpSGCnt = count & 0x00FFFFFFL; |
5021 | } | 4988 | } |
5022 | 4989 | ||
@@ -5072,17 +5039,15 @@ static void FPT_busMstrSGDataXferStart(unsigned long p_port, | |||
5072 | * Description: | 5039 | * Description: |
5073 | * | 5040 | * |
5074 | *---------------------------------------------------------------------*/ | 5041 | *---------------------------------------------------------------------*/ |
5075 | static void FPT_busMstrDataXferStart(unsigned long p_port, | 5042 | static void FPT_busMstrDataXferStart(u32 p_port, struct sccb *pcurrSCCB) |
5076 | struct sccb *pcurrSCCB) | ||
5077 | { | 5043 | { |
5078 | unsigned long addr, count; | 5044 | u32 addr, count; |
5079 | 5045 | ||
5080 | if (!(pcurrSCCB->Sccb_XferState & F_AUTO_SENSE)) { | 5046 | if (!(pcurrSCCB->Sccb_XferState & F_AUTO_SENSE)) { |
5081 | 5047 | ||
5082 | count = pcurrSCCB->Sccb_XferCnt; | 5048 | count = pcurrSCCB->Sccb_XferCnt; |
5083 | 5049 | ||
5084 | addr = | 5050 | addr = (u32)(unsigned long)pcurrSCCB->DataPointer + pcurrSCCB->Sccb_ATC; |
5085 | (unsigned long)pcurrSCCB->DataPointer + pcurrSCCB->Sccb_ATC; | ||
5086 | } | 5051 | } |
5087 | 5052 | ||
5088 | else { | 5053 | else { |
@@ -5127,7 +5092,7 @@ static void FPT_busMstrDataXferStart(unsigned long p_port, | |||
5127 | * command busy is also time out, it'll just give up. | 5092 | * command busy is also time out, it'll just give up. |
5128 | * | 5093 | * |
5129 | *---------------------------------------------------------------------*/ | 5094 | *---------------------------------------------------------------------*/ |
5130 | static unsigned char FPT_busMstrTimeOut(unsigned long p_port) | 5095 | static unsigned char FPT_busMstrTimeOut(u32 p_port) |
5131 | { | 5096 | { |
5132 | unsigned long timeout; | 5097 | unsigned long timeout; |
5133 | 5098 | ||
@@ -5166,13 +5131,14 @@ static unsigned char FPT_busMstrTimeOut(unsigned long p_port) | |||
5166 | * Description: Abort any in progress transfer. | 5131 | * Description: Abort any in progress transfer. |
5167 | * | 5132 | * |
5168 | *---------------------------------------------------------------------*/ | 5133 | *---------------------------------------------------------------------*/ |
5169 | static void FPT_hostDataXferAbort(unsigned long port, unsigned char p_card, | 5134 | static void FPT_hostDataXferAbort(u32 port, unsigned char p_card, |
5170 | struct sccb *pCurrSCCB) | 5135 | struct sccb *pCurrSCCB) |
5171 | { | 5136 | { |
5172 | 5137 | ||
5173 | unsigned long timeout; | 5138 | unsigned long timeout; |
5174 | unsigned long remain_cnt; | 5139 | unsigned long remain_cnt; |
5175 | unsigned int sg_ptr; | 5140 | u32 sg_ptr; |
5141 | struct blogic_sg_seg *segp; | ||
5176 | 5142 | ||
5177 | FPT_BL_Card[p_card].globalFlags &= ~F_HOST_XFER_ACT; | 5143 | FPT_BL_Card[p_card].globalFlags &= ~F_HOST_XFER_ACT; |
5178 | 5144 | ||
@@ -5236,9 +5202,8 @@ static void FPT_hostDataXferAbort(unsigned long port, unsigned char p_card, | |||
5236 | (unsigned int)(pCurrSCCB->DataLength / | 5202 | (unsigned int)(pCurrSCCB->DataLength / |
5237 | SG_ELEMENT_SIZE)) { | 5203 | SG_ELEMENT_SIZE)) { |
5238 | 5204 | ||
5239 | sg_ptr = | 5205 | sg_ptr = (u32)(pCurrSCCB->DataLength / |
5240 | (unsigned int)(pCurrSCCB->DataLength / | 5206 | SG_ELEMENT_SIZE); |
5241 | SG_ELEMENT_SIZE); | ||
5242 | } | 5207 | } |
5243 | 5208 | ||
5244 | remain_cnt = pCurrSCCB->Sccb_XferCnt; | 5209 | remain_cnt = pCurrSCCB->Sccb_XferCnt; |
@@ -5246,23 +5211,13 @@ static void FPT_hostDataXferAbort(unsigned long port, unsigned char p_card, | |||
5246 | while (remain_cnt < 0x01000000L) { | 5211 | while (remain_cnt < 0x01000000L) { |
5247 | 5212 | ||
5248 | sg_ptr--; | 5213 | sg_ptr--; |
5249 | 5214 | segp = (struct blogic_sg_seg *)(pCurrSCCB-> | |
5250 | if (remain_cnt > | 5215 | DataPointer) + (sg_ptr * 2); |
5251 | (unsigned | 5216 | if (remain_cnt > (unsigned long)segp->segbytes) |
5252 | long)(*(((unsigned long *)pCurrSCCB-> | ||
5253 | DataPointer) + (sg_ptr * 2)))) { | ||
5254 | |||
5255 | remain_cnt -= | 5217 | remain_cnt -= |
5256 | (unsigned | 5218 | (unsigned long)segp->segbytes; |
5257 | long)(*(((unsigned long *) | 5219 | else |
5258 | pCurrSCCB->DataPointer) + | ||
5259 | (sg_ptr * 2))); | ||
5260 | } | ||
5261 | |||
5262 | else { | ||
5263 | |||
5264 | break; | 5220 | break; |
5265 | } | ||
5266 | } | 5221 | } |
5267 | 5222 | ||
5268 | if (remain_cnt < 0x01000000L) { | 5223 | if (remain_cnt < 0x01000000L) { |
@@ -5418,23 +5373,18 @@ static void FPT_hostDataXferAbort(unsigned long port, unsigned char p_card, | |||
5418 | 5373 | ||
5419 | pCurrSCCB->Sccb_SGoffset = 0x00; | 5374 | pCurrSCCB->Sccb_SGoffset = 0x00; |
5420 | 5375 | ||
5421 | if ((unsigned long)(pCurrSCCB->Sccb_sgseg * | 5376 | if ((u32)(pCurrSCCB->Sccb_sgseg * SG_ELEMENT_SIZE) >= |
5422 | SG_ELEMENT_SIZE) >= | 5377 | pCurrSCCB->DataLength) { |
5423 | pCurrSCCB->DataLength) { | ||
5424 | 5378 | ||
5425 | pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED; | 5379 | pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED; |
5426 | |||
5427 | pCurrSCCB->Sccb_sgseg = | 5380 | pCurrSCCB->Sccb_sgseg = |
5428 | (unsigned short)(pCurrSCCB->DataLength / | 5381 | (unsigned short)(pCurrSCCB->DataLength / |
5429 | SG_ELEMENT_SIZE); | 5382 | SG_ELEMENT_SIZE); |
5430 | |||
5431 | } | 5383 | } |
5432 | } | 5384 | } |
5433 | 5385 | ||
5434 | else { | 5386 | else { |
5435 | |||
5436 | if (!(pCurrSCCB->Sccb_XferState & F_AUTO_SENSE)) | 5387 | if (!(pCurrSCCB->Sccb_XferState & F_AUTO_SENSE)) |
5437 | |||
5438 | pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED; | 5388 | pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED; |
5439 | } | 5389 | } |
5440 | } | 5390 | } |
@@ -5454,21 +5404,22 @@ static void FPT_hostDataXferRestart(struct sccb *currSCCB) | |||
5454 | { | 5404 | { |
5455 | unsigned long data_count; | 5405 | unsigned long data_count; |
5456 | unsigned int sg_index; | 5406 | unsigned int sg_index; |
5457 | unsigned long *sg_ptr; | 5407 | struct blogic_sg_seg *segp; |
5458 | 5408 | ||
5459 | if (currSCCB->Sccb_XferState & F_SG_XFER) { | 5409 | if (currSCCB->Sccb_XferState & F_SG_XFER) { |
5460 | 5410 | ||
5461 | currSCCB->Sccb_XferCnt = 0; | 5411 | currSCCB->Sccb_XferCnt = 0; |
5462 | 5412 | ||
5463 | sg_index = 0xffff; /*Index by long words into sg list. */ | 5413 | sg_index = 0xffff; /*Index by long words into sg list. */ |
5464 | data_count = 0; /*Running count of SG xfer counts. */ | 5414 | data_count = 0; /*Running count of SG xfer counts. */ |
5465 | 5415 | ||
5466 | sg_ptr = (unsigned long *)currSCCB->DataPointer; | ||
5467 | 5416 | ||
5468 | while (data_count < currSCCB->Sccb_ATC) { | 5417 | while (data_count < currSCCB->Sccb_ATC) { |
5469 | 5418 | ||
5470 | sg_index++; | 5419 | sg_index++; |
5471 | data_count += *(sg_ptr + (sg_index * 2)); | 5420 | segp = (struct blogic_sg_seg *)(currSCCB->DataPointer) + |
5421 | (sg_index * 2); | ||
5422 | data_count += segp->segbytes; | ||
5472 | } | 5423 | } |
5473 | 5424 | ||
5474 | if (data_count == currSCCB->Sccb_ATC) { | 5425 | if (data_count == currSCCB->Sccb_ATC) { |
@@ -5504,7 +5455,7 @@ static void FPT_scini(unsigned char p_card, unsigned char p_our_id, | |||
5504 | { | 5455 | { |
5505 | 5456 | ||
5506 | unsigned char loser, assigned_id; | 5457 | unsigned char loser, assigned_id; |
5507 | unsigned long p_port; | 5458 | u32 p_port; |
5508 | 5459 | ||
5509 | unsigned char i, k, ScamFlg; | 5460 | unsigned char i, k, ScamFlg; |
5510 | struct sccb_card *currCard; | 5461 | struct sccb_card *currCard; |
@@ -5709,7 +5660,7 @@ static void FPT_scini(unsigned char p_card, unsigned char p_our_id, | |||
5709 | * | 5660 | * |
5710 | *---------------------------------------------------------------------*/ | 5661 | *---------------------------------------------------------------------*/ |
5711 | 5662 | ||
5712 | static int FPT_scarb(unsigned long p_port, unsigned char p_sel_type) | 5663 | static int FPT_scarb(u32 p_port, unsigned char p_sel_type) |
5713 | { | 5664 | { |
5714 | if (p_sel_type == INIT_SELTD) { | 5665 | if (p_sel_type == INIT_SELTD) { |
5715 | 5666 | ||
@@ -5771,7 +5722,7 @@ static int FPT_scarb(unsigned long p_port, unsigned char p_sel_type) | |||
5771 | * | 5722 | * |
5772 | *---------------------------------------------------------------------*/ | 5723 | *---------------------------------------------------------------------*/ |
5773 | 5724 | ||
5774 | static void FPT_scbusf(unsigned long p_port) | 5725 | static void FPT_scbusf(u32 p_port) |
5775 | { | 5726 | { |
5776 | WR_HARPOON(p_port + hp_page_ctrl, | 5727 | WR_HARPOON(p_port + hp_page_ctrl, |
5777 | (RD_HARPOON(p_port + hp_page_ctrl) | G_INT_DISABLE)); | 5728 | (RD_HARPOON(p_port + hp_page_ctrl) | G_INT_DISABLE)); |
@@ -5803,7 +5754,7 @@ static void FPT_scbusf(unsigned long p_port) | |||
5803 | * | 5754 | * |
5804 | *---------------------------------------------------------------------*/ | 5755 | *---------------------------------------------------------------------*/ |
5805 | 5756 | ||
5806 | static void FPT_scasid(unsigned char p_card, unsigned long p_port) | 5757 | static void FPT_scasid(unsigned char p_card, u32 p_port) |
5807 | { | 5758 | { |
5808 | unsigned char temp_id_string[ID_STRING_LENGTH]; | 5759 | unsigned char temp_id_string[ID_STRING_LENGTH]; |
5809 | 5760 | ||
@@ -5880,7 +5831,7 @@ static void FPT_scasid(unsigned char p_card, unsigned long p_port) | |||
5880 | * | 5831 | * |
5881 | *---------------------------------------------------------------------*/ | 5832 | *---------------------------------------------------------------------*/ |
5882 | 5833 | ||
5883 | static void FPT_scsel(unsigned long p_port) | 5834 | static void FPT_scsel(u32 p_port) |
5884 | { | 5835 | { |
5885 | 5836 | ||
5886 | WR_HARPOON(p_port + hp_scsisig, SCSI_SEL); | 5837 | WR_HARPOON(p_port + hp_scsisig, SCSI_SEL); |
@@ -5914,7 +5865,7 @@ static void FPT_scsel(unsigned long p_port) | |||
5914 | * | 5865 | * |
5915 | *---------------------------------------------------------------------*/ | 5866 | *---------------------------------------------------------------------*/ |
5916 | 5867 | ||
5917 | static unsigned char FPT_scxferc(unsigned long p_port, unsigned char p_data) | 5868 | static unsigned char FPT_scxferc(u32 p_port, unsigned char p_data) |
5918 | { | 5869 | { |
5919 | unsigned char curr_data, ret_data; | 5870 | unsigned char curr_data, ret_data; |
5920 | 5871 | ||
@@ -5964,8 +5915,7 @@ static unsigned char FPT_scxferc(unsigned long p_port, unsigned char p_data) | |||
5964 | * | 5915 | * |
5965 | *---------------------------------------------------------------------*/ | 5916 | *---------------------------------------------------------------------*/ |
5966 | 5917 | ||
5967 | static unsigned char FPT_scsendi(unsigned long p_port, | 5918 | static unsigned char FPT_scsendi(u32 p_port, unsigned char p_id_string[]) |
5968 | unsigned char p_id_string[]) | ||
5969 | { | 5919 | { |
5970 | unsigned char ret_data, byte_cnt, bit_cnt, defer; | 5920 | unsigned char ret_data, byte_cnt, bit_cnt, defer; |
5971 | 5921 | ||
@@ -6016,8 +5966,7 @@ static unsigned char FPT_scsendi(unsigned long p_port, | |||
6016 | * | 5966 | * |
6017 | *---------------------------------------------------------------------*/ | 5967 | *---------------------------------------------------------------------*/ |
6018 | 5968 | ||
6019 | static unsigned char FPT_sciso(unsigned long p_port, | 5969 | static unsigned char FPT_sciso(u32 p_port, unsigned char p_id_string[]) |
6020 | unsigned char p_id_string[]) | ||
6021 | { | 5970 | { |
6022 | unsigned char ret_data, the_data, byte_cnt, bit_cnt; | 5971 | unsigned char ret_data, the_data, byte_cnt, bit_cnt; |
6023 | 5972 | ||
@@ -6075,7 +6024,7 @@ static unsigned char FPT_sciso(unsigned long p_port, | |||
6075 | * | 6024 | * |
6076 | *---------------------------------------------------------------------*/ | 6025 | *---------------------------------------------------------------------*/ |
6077 | 6026 | ||
6078 | static void FPT_scwirod(unsigned long p_port, unsigned char p_data_bit) | 6027 | static void FPT_scwirod(u32 p_port, unsigned char p_data_bit) |
6079 | { | 6028 | { |
6080 | unsigned char i; | 6029 | unsigned char i; |
6081 | 6030 | ||
@@ -6102,7 +6051,7 @@ static void FPT_scwirod(unsigned long p_port, unsigned char p_data_bit) | |||
6102 | * | 6051 | * |
6103 | *---------------------------------------------------------------------*/ | 6052 | *---------------------------------------------------------------------*/ |
6104 | 6053 | ||
6105 | static void FPT_scwiros(unsigned long p_port, unsigned char p_data_bit) | 6054 | static void FPT_scwiros(u32 p_port, unsigned char p_data_bit) |
6106 | { | 6055 | { |
6107 | unsigned char i; | 6056 | unsigned char i; |
6108 | 6057 | ||
@@ -6154,7 +6103,7 @@ static unsigned char FPT_scvalq(unsigned char p_quintet) | |||
6154 | * | 6103 | * |
6155 | *---------------------------------------------------------------------*/ | 6104 | *---------------------------------------------------------------------*/ |
6156 | 6105 | ||
6157 | static unsigned char FPT_scsell(unsigned long p_port, unsigned char targ_id) | 6106 | static unsigned char FPT_scsell(u32 p_port, unsigned char targ_id) |
6158 | { | 6107 | { |
6159 | unsigned long i; | 6108 | unsigned long i; |
6160 | 6109 | ||
@@ -6236,7 +6185,7 @@ static unsigned char FPT_scsell(unsigned long p_port, unsigned char targ_id) | |||
6236 | * | 6185 | * |
6237 | *---------------------------------------------------------------------*/ | 6186 | *---------------------------------------------------------------------*/ |
6238 | 6187 | ||
6239 | static void FPT_scwtsel(unsigned long p_port) | 6188 | static void FPT_scwtsel(u32 p_port) |
6240 | { | 6189 | { |
6241 | while (!(RDW_HARPOON((p_port + hp_intstat)) & SCAM_SEL)) { | 6190 | while (!(RDW_HARPOON((p_port + hp_intstat)) & SCAM_SEL)) { |
6242 | } | 6191 | } |
@@ -6250,8 +6199,7 @@ static void FPT_scwtsel(unsigned long p_port) | |||
6250 | * | 6199 | * |
6251 | *---------------------------------------------------------------------*/ | 6200 | *---------------------------------------------------------------------*/ |
6252 | 6201 | ||
6253 | static void FPT_inisci(unsigned char p_card, unsigned long p_port, | 6202 | static void FPT_inisci(unsigned char p_card, u32 p_port, unsigned char p_our_id) |
6254 | unsigned char p_our_id) | ||
6255 | { | 6203 | { |
6256 | unsigned char i, k, max_id; | 6204 | unsigned char i, k, max_id; |
6257 | unsigned short ee_data; | 6205 | unsigned short ee_data; |
@@ -6437,7 +6385,7 @@ static unsigned char FPT_scmachid(unsigned char p_card, | |||
6437 | * | 6385 | * |
6438 | *---------------------------------------------------------------------*/ | 6386 | *---------------------------------------------------------------------*/ |
6439 | 6387 | ||
6440 | static void FPT_scsavdi(unsigned char p_card, unsigned long p_port) | 6388 | static void FPT_scsavdi(unsigned char p_card, u32 p_port) |
6441 | { | 6389 | { |
6442 | unsigned char i, k, max_id; | 6390 | unsigned char i, k, max_id; |
6443 | unsigned short ee_data, sum_data; | 6391 | unsigned short ee_data, sum_data; |
@@ -6482,7 +6430,7 @@ static void FPT_scsavdi(unsigned char p_card, unsigned long p_port) | |||
6482 | * | 6430 | * |
6483 | *---------------------------------------------------------------------*/ | 6431 | *---------------------------------------------------------------------*/ |
6484 | 6432 | ||
6485 | static void FPT_XbowInit(unsigned long port, unsigned char ScamFlg) | 6433 | static void FPT_XbowInit(u32 port, unsigned char ScamFlg) |
6486 | { | 6434 | { |
6487 | unsigned char i; | 6435 | unsigned char i; |
6488 | 6436 | ||
@@ -6531,7 +6479,7 @@ static void FPT_XbowInit(unsigned long port, unsigned char ScamFlg) | |||
6531 | * | 6479 | * |
6532 | *---------------------------------------------------------------------*/ | 6480 | *---------------------------------------------------------------------*/ |
6533 | 6481 | ||
6534 | static void FPT_BusMasterInit(unsigned long p_port) | 6482 | static void FPT_BusMasterInit(u32 p_port) |
6535 | { | 6483 | { |
6536 | 6484 | ||
6537 | WR_HARPOON(p_port + hp_sys_ctrl, DRVR_RST); | 6485 | WR_HARPOON(p_port + hp_sys_ctrl, DRVR_RST); |
@@ -6558,7 +6506,7 @@ static void FPT_BusMasterInit(unsigned long p_port) | |||
6558 | * | 6506 | * |
6559 | *---------------------------------------------------------------------*/ | 6507 | *---------------------------------------------------------------------*/ |
6560 | 6508 | ||
6561 | static void FPT_DiagEEPROM(unsigned long p_port) | 6509 | static void FPT_DiagEEPROM(u32 p_port) |
6562 | { | 6510 | { |
6563 | unsigned short index, temp, max_wd_cnt; | 6511 | unsigned short index, temp, max_wd_cnt; |
6564 | 6512 | ||
@@ -7206,7 +7154,7 @@ static void FPT_utilUpdateResidual(struct sccb *p_SCCB) | |||
7206 | { | 7154 | { |
7207 | unsigned long partial_cnt; | 7155 | unsigned long partial_cnt; |
7208 | unsigned int sg_index; | 7156 | unsigned int sg_index; |
7209 | unsigned long *sg_ptr; | 7157 | struct blogic_sg_seg *segp; |
7210 | 7158 | ||
7211 | if (p_SCCB->Sccb_XferState & F_ALL_XFERRED) { | 7159 | if (p_SCCB->Sccb_XferState & F_ALL_XFERRED) { |
7212 | 7160 | ||
@@ -7219,7 +7167,6 @@ static void FPT_utilUpdateResidual(struct sccb *p_SCCB) | |||
7219 | 7167 | ||
7220 | sg_index = p_SCCB->Sccb_sgseg; | 7168 | sg_index = p_SCCB->Sccb_sgseg; |
7221 | 7169 | ||
7222 | sg_ptr = (unsigned long *)p_SCCB->DataPointer; | ||
7223 | 7170 | ||
7224 | if (p_SCCB->Sccb_SGoffset) { | 7171 | if (p_SCCB->Sccb_SGoffset) { |
7225 | 7172 | ||
@@ -7229,8 +7176,9 @@ static void FPT_utilUpdateResidual(struct sccb *p_SCCB) | |||
7229 | 7176 | ||
7230 | while (((unsigned long)sg_index * | 7177 | while (((unsigned long)sg_index * |
7231 | (unsigned long)SG_ELEMENT_SIZE) < p_SCCB->DataLength) { | 7178 | (unsigned long)SG_ELEMENT_SIZE) < p_SCCB->DataLength) { |
7232 | 7179 | segp = (struct blogic_sg_seg *)(p_SCCB->DataPointer) + | |
7233 | partial_cnt += *(sg_ptr + (sg_index * 2)); | 7180 | (sg_index * 2); |
7181 | partial_cnt += segp->segbytes; | ||
7234 | sg_index++; | 7182 | sg_index++; |
7235 | } | 7183 | } |
7236 | 7184 | ||
@@ -7251,7 +7199,7 @@ static void FPT_utilUpdateResidual(struct sccb *p_SCCB) | |||
7251 | * | 7199 | * |
7252 | *---------------------------------------------------------------------*/ | 7200 | *---------------------------------------------------------------------*/ |
7253 | 7201 | ||
7254 | static void FPT_Wait1Second(unsigned long p_port) | 7202 | static void FPT_Wait1Second(u32 p_port) |
7255 | { | 7203 | { |
7256 | unsigned char i; | 7204 | unsigned char i; |
7257 | 7205 | ||
@@ -7275,7 +7223,7 @@ static void FPT_Wait1Second(unsigned long p_port) | |||
7275 | * | 7223 | * |
7276 | *---------------------------------------------------------------------*/ | 7224 | *---------------------------------------------------------------------*/ |
7277 | 7225 | ||
7278 | static void FPT_Wait(unsigned long p_port, unsigned char p_delay) | 7226 | static void FPT_Wait(u32 p_port, unsigned char p_delay) |
7279 | { | 7227 | { |
7280 | unsigned char old_timer; | 7228 | unsigned char old_timer; |
7281 | unsigned char green_flag; | 7229 | unsigned char green_flag; |
@@ -7321,7 +7269,7 @@ static void FPT_Wait(unsigned long p_port, unsigned char p_delay) | |||
7321 | * | 7269 | * |
7322 | *---------------------------------------------------------------------*/ | 7270 | *---------------------------------------------------------------------*/ |
7323 | 7271 | ||
7324 | static void FPT_utilEEWriteOnOff(unsigned long p_port, unsigned char p_mode) | 7272 | static void FPT_utilEEWriteOnOff(u32 p_port, unsigned char p_mode) |
7325 | { | 7273 | { |
7326 | unsigned char ee_value; | 7274 | unsigned char ee_value; |
7327 | 7275 | ||
@@ -7350,7 +7298,7 @@ static void FPT_utilEEWriteOnOff(unsigned long p_port, unsigned char p_mode) | |||
7350 | * | 7298 | * |
7351 | *---------------------------------------------------------------------*/ | 7299 | *---------------------------------------------------------------------*/ |
7352 | 7300 | ||
7353 | static void FPT_utilEEWrite(unsigned long p_port, unsigned short ee_data, | 7301 | static void FPT_utilEEWrite(u32 p_port, unsigned short ee_data, |
7354 | unsigned short ee_addr) | 7302 | unsigned short ee_addr) |
7355 | { | 7303 | { |
7356 | 7304 | ||
@@ -7401,7 +7349,7 @@ static void FPT_utilEEWrite(unsigned long p_port, unsigned short ee_data, | |||
7401 | * | 7349 | * |
7402 | *---------------------------------------------------------------------*/ | 7350 | *---------------------------------------------------------------------*/ |
7403 | 7351 | ||
7404 | static unsigned short FPT_utilEERead(unsigned long p_port, | 7352 | static unsigned short FPT_utilEERead(u32 p_port, |
7405 | unsigned short ee_addr) | 7353 | unsigned short ee_addr) |
7406 | { | 7354 | { |
7407 | unsigned short i, ee_data1, ee_data2; | 7355 | unsigned short i, ee_data1, ee_data2; |
@@ -7431,8 +7379,7 @@ static unsigned short FPT_utilEERead(unsigned long p_port, | |||
7431 | * | 7379 | * |
7432 | *---------------------------------------------------------------------*/ | 7380 | *---------------------------------------------------------------------*/ |
7433 | 7381 | ||
7434 | static unsigned short FPT_utilEEReadOrg(unsigned long p_port, | 7382 | static unsigned short FPT_utilEEReadOrg(u32 p_port, unsigned short ee_addr) |
7435 | unsigned short ee_addr) | ||
7436 | { | 7383 | { |
7437 | 7384 | ||
7438 | unsigned char ee_value; | 7385 | unsigned char ee_value; |
@@ -7479,7 +7426,7 @@ static unsigned short FPT_utilEEReadOrg(unsigned long p_port, | |||
7479 | * | 7426 | * |
7480 | *---------------------------------------------------------------------*/ | 7427 | *---------------------------------------------------------------------*/ |
7481 | 7428 | ||
7482 | static void FPT_utilEESendCmdAddr(unsigned long p_port, unsigned char ee_cmd, | 7429 | static void FPT_utilEESendCmdAddr(u32 p_port, unsigned char ee_cmd, |
7483 | unsigned short ee_addr) | 7430 | unsigned short ee_addr) |
7484 | { | 7431 | { |
7485 | unsigned char ee_value; | 7432 | unsigned char ee_value; |
@@ -7573,47 +7520,45 @@ static unsigned char FPT_CalcLrc(unsigned char buffer[]) | |||
7573 | */ | 7520 | */ |
7574 | 7521 | ||
7575 | static inline unsigned char | 7522 | static inline unsigned char |
7576 | FlashPoint__ProbeHostAdapter(struct FlashPoint_Info *FlashPointInfo) | 7523 | FlashPoint__ProbeHostAdapter(struct fpoint_info *FlashPointInfo) |
7577 | { | 7524 | { |
7578 | return FlashPoint_ProbeHostAdapter((struct sccb_mgr_info *) | 7525 | return FlashPoint_ProbeHostAdapter((struct sccb_mgr_info *) |
7579 | FlashPointInfo); | 7526 | FlashPointInfo); |
7580 | } | 7527 | } |
7581 | 7528 | ||
7582 | static inline FlashPoint_CardHandle_T | 7529 | static inline void * |
7583 | FlashPoint__HardwareResetHostAdapter(struct FlashPoint_Info *FlashPointInfo) | 7530 | FlashPoint__HardwareResetHostAdapter(struct fpoint_info *FlashPointInfo) |
7584 | { | 7531 | { |
7585 | return FlashPoint_HardwareResetHostAdapter((struct sccb_mgr_info *) | 7532 | return FlashPoint_HardwareResetHostAdapter((struct sccb_mgr_info *) |
7586 | FlashPointInfo); | 7533 | FlashPointInfo); |
7587 | } | 7534 | } |
7588 | 7535 | ||
7589 | static inline void | 7536 | static inline void |
7590 | FlashPoint__ReleaseHostAdapter(FlashPoint_CardHandle_T CardHandle) | 7537 | FlashPoint__ReleaseHostAdapter(void *CardHandle) |
7591 | { | 7538 | { |
7592 | FlashPoint_ReleaseHostAdapter(CardHandle); | 7539 | FlashPoint_ReleaseHostAdapter(CardHandle); |
7593 | } | 7540 | } |
7594 | 7541 | ||
7595 | static inline void | 7542 | static inline void |
7596 | FlashPoint__StartCCB(FlashPoint_CardHandle_T CardHandle, | 7543 | FlashPoint__StartCCB(void *CardHandle, struct blogic_ccb *CCB) |
7597 | struct BusLogic_CCB *CCB) | ||
7598 | { | 7544 | { |
7599 | FlashPoint_StartCCB(CardHandle, (struct sccb *)CCB); | 7545 | FlashPoint_StartCCB(CardHandle, (struct sccb *)CCB); |
7600 | } | 7546 | } |
7601 | 7547 | ||
7602 | static inline void | 7548 | static inline void |
7603 | FlashPoint__AbortCCB(FlashPoint_CardHandle_T CardHandle, | 7549 | FlashPoint__AbortCCB(void *CardHandle, struct blogic_ccb *CCB) |
7604 | struct BusLogic_CCB *CCB) | ||
7605 | { | 7550 | { |
7606 | FlashPoint_AbortCCB(CardHandle, (struct sccb *)CCB); | 7551 | FlashPoint_AbortCCB(CardHandle, (struct sccb *)CCB); |
7607 | } | 7552 | } |
7608 | 7553 | ||
7609 | static inline bool | 7554 | static inline bool |
7610 | FlashPoint__InterruptPending(FlashPoint_CardHandle_T CardHandle) | 7555 | FlashPoint__InterruptPending(void *CardHandle) |
7611 | { | 7556 | { |
7612 | return FlashPoint_InterruptPending(CardHandle); | 7557 | return FlashPoint_InterruptPending(CardHandle); |
7613 | } | 7558 | } |
7614 | 7559 | ||
7615 | static inline int | 7560 | static inline int |
7616 | FlashPoint__HandleInterrupt(FlashPoint_CardHandle_T CardHandle) | 7561 | FlashPoint__HandleInterrupt(void *CardHandle) |
7617 | { | 7562 | { |
7618 | return FlashPoint_HandleInterrupt(CardHandle); | 7563 | return FlashPoint_HandleInterrupt(CardHandle); |
7619 | } | 7564 | } |
@@ -7632,13 +7577,12 @@ FlashPoint__HandleInterrupt(FlashPoint_CardHandle_T CardHandle) | |||
7632 | Define prototypes for the FlashPoint SCCB Manager Functions. | 7577 | Define prototypes for the FlashPoint SCCB Manager Functions. |
7633 | */ | 7578 | */ |
7634 | 7579 | ||
7635 | extern unsigned char FlashPoint_ProbeHostAdapter(struct FlashPoint_Info *); | 7580 | extern unsigned char FlashPoint_ProbeHostAdapter(struct fpoint_info *); |
7636 | extern FlashPoint_CardHandle_T | 7581 | extern void *FlashPoint_HardwareResetHostAdapter(struct fpoint_info *); |
7637 | FlashPoint_HardwareResetHostAdapter(struct FlashPoint_Info *); | 7582 | extern void FlashPoint_StartCCB(void *, struct blogic_ccb *); |
7638 | extern void FlashPoint_StartCCB(FlashPoint_CardHandle_T, struct BusLogic_CCB *); | 7583 | extern int FlashPoint_AbortCCB(void *, struct blogic_ccb *); |
7639 | extern int FlashPoint_AbortCCB(FlashPoint_CardHandle_T, struct BusLogic_CCB *); | 7584 | extern bool FlashPoint_InterruptPending(void *); |
7640 | extern bool FlashPoint_InterruptPending(FlashPoint_CardHandle_T); | 7585 | extern int FlashPoint_HandleInterrupt(void *); |
7641 | extern int FlashPoint_HandleInterrupt(FlashPoint_CardHandle_T); | 7586 | extern void FlashPoint_ReleaseHostAdapter(void *); |
7642 | extern void FlashPoint_ReleaseHostAdapter(FlashPoint_CardHandle_T); | ||
7643 | 7587 | ||
7644 | #endif /* CONFIG_SCSI_FLASHPOINT */ | 7588 | #endif /* CONFIG_SCSI_FLASHPOINT */ |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 86af29f53bbe..48b2918e0d65 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -633,7 +633,7 @@ config SCSI_BUSLOGIC | |||
633 | 633 | ||
634 | config SCSI_FLASHPOINT | 634 | config SCSI_FLASHPOINT |
635 | bool "FlashPoint support" | 635 | bool "FlashPoint support" |
636 | depends on SCSI_BUSLOGIC && PCI && X86_32 | 636 | depends on SCSI_BUSLOGIC && PCI |
637 | help | 637 | help |
638 | This option allows you to add FlashPoint support to the | 638 | This option allows you to add FlashPoint support to the |
639 | BusLogic SCSI driver. The FlashPoint SCCB Manager code is | 639 | BusLogic SCSI driver. The FlashPoint SCCB Manager code is |
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index 0f56d8d7524f..7e17107643d4 100644 --- a/drivers/scsi/aacraid/src.c +++ b/drivers/scsi/aacraid/src.c | |||
@@ -93,6 +93,9 @@ static irqreturn_t aac_src_intr_message(int irq, void *dev_id) | |||
93 | int send_it = 0; | 93 | int send_it = 0; |
94 | extern int aac_sync_mode; | 94 | extern int aac_sync_mode; |
95 | 95 | ||
96 | src_writel(dev, MUnit.ODR_C, bellbits); | ||
97 | src_readl(dev, MUnit.ODR_C); | ||
98 | |||
96 | if (!aac_sync_mode) { | 99 | if (!aac_sync_mode) { |
97 | src_writel(dev, MUnit.ODR_C, bellbits); | 100 | src_writel(dev, MUnit.ODR_C, bellbits); |
98 | src_readl(dev, MUnit.ODR_C); | 101 | src_readl(dev, MUnit.ODR_C); |
diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c index 393e7ce8e95a..59b86e260ce9 100644 --- a/drivers/scsi/aic94xx/aic94xx_task.c +++ b/drivers/scsi/aic94xx/aic94xx_task.c | |||
@@ -505,7 +505,8 @@ static int asd_build_ssp_ascb(struct asd_ascb *ascb, struct sas_task *task, | |||
505 | scb->ssp_task.ssp_cmd.efb_prio_attr |= EFB_MASK; | 505 | scb->ssp_task.ssp_cmd.efb_prio_attr |= EFB_MASK; |
506 | scb->ssp_task.ssp_cmd.efb_prio_attr |= (task->ssp_task.task_prio << 3); | 506 | scb->ssp_task.ssp_cmd.efb_prio_attr |= (task->ssp_task.task_prio << 3); |
507 | scb->ssp_task.ssp_cmd.efb_prio_attr |= (task->ssp_task.task_attr & 7); | 507 | scb->ssp_task.ssp_cmd.efb_prio_attr |= (task->ssp_task.task_attr & 7); |
508 | memcpy(scb->ssp_task.ssp_cmd.cdb, task->ssp_task.cdb, 16); | 508 | memcpy(scb->ssp_task.ssp_cmd.cdb, task->ssp_task.cmd->cmnd, |
509 | task->ssp_task.cmd->cmd_len); | ||
509 | 510 | ||
510 | scb->ssp_task.sister_scb = cpu_to_le16(0xFFFF); | 511 | scb->ssp_task.sister_scb = cpu_to_le16(0xFFFF); |
511 | scb->ssp_task.conn_handle = cpu_to_le16( | 512 | scb->ssp_task.conn_handle = cpu_to_le16( |
diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c index 342d7d9c0997..520540a5fef6 100644 --- a/drivers/scsi/bfa/bfa_core.c +++ b/drivers/scsi/bfa/bfa_core.c | |||
@@ -1432,6 +1432,7 @@ bfa_iocfc_disable_cbfn(void *bfa_arg) | |||
1432 | { | 1432 | { |
1433 | struct bfa_s *bfa = bfa_arg; | 1433 | struct bfa_s *bfa = bfa_arg; |
1434 | 1434 | ||
1435 | bfa->queue_process = BFA_FALSE; | ||
1435 | bfa_fsm_send_event(&bfa->iocfc, IOCFC_E_IOC_DISABLED); | 1436 | bfa_fsm_send_event(&bfa->iocfc, IOCFC_E_IOC_DISABLED); |
1436 | } | 1437 | } |
1437 | 1438 | ||
@@ -1567,7 +1568,6 @@ bfa_iocfc_start(struct bfa_s *bfa) | |||
1567 | void | 1568 | void |
1568 | bfa_iocfc_stop(struct bfa_s *bfa) | 1569 | bfa_iocfc_stop(struct bfa_s *bfa) |
1569 | { | 1570 | { |
1570 | bfa->queue_process = BFA_FALSE; | ||
1571 | bfa_fsm_send_event(&bfa->iocfc, IOCFC_E_STOP); | 1571 | bfa_fsm_send_event(&bfa->iocfc, IOCFC_E_STOP); |
1572 | } | 1572 | } |
1573 | 1573 | ||
@@ -1674,7 +1674,6 @@ bfa_iocfc_disable(struct bfa_s *bfa) | |||
1674 | bfa_plog_str(bfa->plog, BFA_PL_MID_HAL, BFA_PL_EID_MISC, 0, | 1674 | bfa_plog_str(bfa->plog, BFA_PL_MID_HAL, BFA_PL_EID_MISC, 0, |
1675 | "IOC Disable"); | 1675 | "IOC Disable"); |
1676 | 1676 | ||
1677 | bfa->queue_process = BFA_FALSE; | ||
1678 | bfa_fsm_send_event(&bfa->iocfc, IOCFC_E_DISABLE); | 1677 | bfa_fsm_send_event(&bfa->iocfc, IOCFC_E_DISABLE); |
1679 | } | 1678 | } |
1680 | 1679 | ||
diff --git a/drivers/scsi/bfa/bfa_defs.h b/drivers/scsi/bfa/bfa_defs.h index 0efdf312b42c..d40a79f5265f 100644 --- a/drivers/scsi/bfa/bfa_defs.h +++ b/drivers/scsi/bfa/bfa_defs.h | |||
@@ -45,6 +45,7 @@ enum { | |||
45 | BFA_MFG_TYPE_PROWLER_C = 1710, /* Prowler CNA only cards */ | 45 | BFA_MFG_TYPE_PROWLER_C = 1710, /* Prowler CNA only cards */ |
46 | BFA_MFG_TYPE_PROWLER_D = 1860, /* Prowler Dual cards */ | 46 | BFA_MFG_TYPE_PROWLER_D = 1860, /* Prowler Dual cards */ |
47 | BFA_MFG_TYPE_CHINOOK = 1867, /* Chinook cards */ | 47 | BFA_MFG_TYPE_CHINOOK = 1867, /* Chinook cards */ |
48 | BFA_MFG_TYPE_CHINOOK2 = 1869, /*!< Chinook2 cards */ | ||
48 | BFA_MFG_TYPE_INVALID = 0, /* Invalid card type */ | 49 | BFA_MFG_TYPE_INVALID = 0, /* Invalid card type */ |
49 | }; | 50 | }; |
50 | 51 | ||
@@ -59,7 +60,8 @@ enum { | |||
59 | (type) == BFA_MFG_TYPE_ASTRA || \ | 60 | (type) == BFA_MFG_TYPE_ASTRA || \ |
60 | (type) == BFA_MFG_TYPE_LIGHTNING_P0 || \ | 61 | (type) == BFA_MFG_TYPE_LIGHTNING_P0 || \ |
61 | (type) == BFA_MFG_TYPE_LIGHTNING || \ | 62 | (type) == BFA_MFG_TYPE_LIGHTNING || \ |
62 | (type) == BFA_MFG_TYPE_CHINOOK)) | 63 | (type) == BFA_MFG_TYPE_CHINOOK || \ |
64 | (type) == BFA_MFG_TYPE_CHINOOK2)) | ||
63 | 65 | ||
64 | /* | 66 | /* |
65 | * Check if the card having old wwn/mac handling | 67 | * Check if the card having old wwn/mac handling |
@@ -185,6 +187,8 @@ enum bfa_status { | |||
185 | BFA_STATUS_FAA_DISABLED = 198, /* FAA is already disabled */ | 187 | BFA_STATUS_FAA_DISABLED = 198, /* FAA is already disabled */ |
186 | BFA_STATUS_FAA_ACQUIRED = 199, /* FAA is already acquired */ | 188 | BFA_STATUS_FAA_ACQUIRED = 199, /* FAA is already acquired */ |
187 | BFA_STATUS_FAA_ACQ_ADDR = 200, /* Acquiring addr */ | 189 | BFA_STATUS_FAA_ACQ_ADDR = 200, /* Acquiring addr */ |
190 | BFA_STATUS_BBCR_FC_ONLY = 201, /*!< BBCredit Recovery is supported for * | ||
191 | * FC mode only */ | ||
188 | BFA_STATUS_ERROR_TRUNK_ENABLED = 203, /* Trunk enabled on adapter */ | 192 | BFA_STATUS_ERROR_TRUNK_ENABLED = 203, /* Trunk enabled on adapter */ |
189 | BFA_STATUS_MAX_ENTRY_REACHED = 212, /* MAX entry reached */ | 193 | BFA_STATUS_MAX_ENTRY_REACHED = 212, /* MAX entry reached */ |
190 | BFA_STATUS_TOPOLOGY_LOOP = 230, /* Topology is set to Loop */ | 194 | BFA_STATUS_TOPOLOGY_LOOP = 230, /* Topology is set to Loop */ |
@@ -197,7 +201,34 @@ enum bfa_status { | |||
197 | BFA_STATUS_DPORT_DISABLED = 236, /* D-port mode is already disabled */ | 201 | BFA_STATUS_DPORT_DISABLED = 236, /* D-port mode is already disabled */ |
198 | BFA_STATUS_CMD_NOTSUPP_MEZZ = 239, /* Cmd not supported for MEZZ card */ | 202 | BFA_STATUS_CMD_NOTSUPP_MEZZ = 239, /* Cmd not supported for MEZZ card */ |
199 | BFA_STATUS_FRU_NOT_PRESENT = 240, /* fru module not present */ | 203 | BFA_STATUS_FRU_NOT_PRESENT = 240, /* fru module not present */ |
204 | BFA_STATUS_DPORT_NO_SFP = 243, /* SFP is not present.\n D-port will be | ||
205 | * enabled but it will be operational | ||
206 | * only after inserting a valid SFP. */ | ||
200 | BFA_STATUS_DPORT_ERR = 245, /* D-port mode is enabled */ | 207 | BFA_STATUS_DPORT_ERR = 245, /* D-port mode is enabled */ |
208 | BFA_STATUS_DPORT_ENOSYS = 254, /* Switch has no D_Port functionality */ | ||
209 | BFA_STATUS_DPORT_CANT_PERF = 255, /* Switch port is not D_Port capable | ||
210 | * or D_Port is disabled */ | ||
211 | BFA_STATUS_DPORT_LOGICALERR = 256, /* Switch D_Port fail */ | ||
212 | BFA_STATUS_DPORT_SWBUSY = 257, /* Switch port busy */ | ||
213 | BFA_STATUS_ERR_BBCR_SPEED_UNSUPPORT = 258, /*!< BB credit recovery is | ||
214 | * supported at max port speed alone */ | ||
215 | BFA_STATUS_ERROR_BBCR_ENABLED = 259, /*!< BB credit recovery | ||
216 | * is enabled */ | ||
217 | BFA_STATUS_INVALID_BBSCN = 260, /*!< Invalid BBSCN value. | ||
218 | * Valid range is [1-15] */ | ||
219 | BFA_STATUS_DDPORT_ERR = 261, /* Dynamic D_Port mode is active.\n To | ||
220 | * exit dynamic mode, disable D_Port on | ||
221 | * the remote port */ | ||
222 | BFA_STATUS_DPORT_SFPWRAP_ERR = 262, /* Clear e/o_wrap fail, check or | ||
223 | * replace SFP */ | ||
224 | BFA_STATUS_BBCR_CFG_NO_CHANGE = 265, /*!< BBCR is operational. | ||
225 | * Disable BBCR and try this operation again. */ | ||
226 | BFA_STATUS_DPORT_SW_NOTREADY = 268, /* Remote port is not ready to | ||
227 | * start dport test. Check remote | ||
228 | * port status. */ | ||
229 | BFA_STATUS_DPORT_INV_SFP = 271, /* Invalid SFP for D-PORT mode. */ | ||
230 | BFA_STATUS_DPORT_CMD_NOTSUPP = 273, /* Dport is not supported by | ||
231 | * remote port */ | ||
201 | BFA_STATUS_MAX_VAL /* Unknown error code */ | 232 | BFA_STATUS_MAX_VAL /* Unknown error code */ |
202 | }; | 233 | }; |
203 | #define bfa_status_t enum bfa_status | 234 | #define bfa_status_t enum bfa_status |
@@ -234,6 +265,7 @@ enum { | |||
234 | BFA_ADAPTER_MFG_NAME_LEN = 8, /* manufacturer name length */ | 265 | BFA_ADAPTER_MFG_NAME_LEN = 8, /* manufacturer name length */ |
235 | BFA_ADAPTER_SYM_NAME_LEN = 64, /* adapter symbolic name length */ | 266 | BFA_ADAPTER_SYM_NAME_LEN = 64, /* adapter symbolic name length */ |
236 | BFA_ADAPTER_OS_TYPE_LEN = 64, /* adapter os type length */ | 267 | BFA_ADAPTER_OS_TYPE_LEN = 64, /* adapter os type length */ |
268 | BFA_ADAPTER_UUID_LEN = 16, /* adapter uuid length */ | ||
237 | }; | 269 | }; |
238 | 270 | ||
239 | struct bfa_adapter_attr_s { | 271 | struct bfa_adapter_attr_s { |
@@ -267,6 +299,7 @@ struct bfa_adapter_attr_s { | |||
267 | u8 mfg_month; /* manufacturing month */ | 299 | u8 mfg_month; /* manufacturing month */ |
268 | u16 mfg_year; /* manufacturing year */ | 300 | u16 mfg_year; /* manufacturing year */ |
269 | u16 rsvd; | 301 | u16 rsvd; |
302 | u8 uuid[BFA_ADAPTER_UUID_LEN]; | ||
270 | }; | 303 | }; |
271 | 304 | ||
272 | /* | 305 | /* |
@@ -380,7 +413,8 @@ struct bfa_ioc_attr_s { | |||
380 | u8 port_mode; /* bfa_mode_s */ | 413 | u8 port_mode; /* bfa_mode_s */ |
381 | u8 cap_bm; /* capability */ | 414 | u8 cap_bm; /* capability */ |
382 | u8 port_mode_cfg; /* bfa_mode_s */ | 415 | u8 port_mode_cfg; /* bfa_mode_s */ |
383 | u8 rsvd[4]; /* 64bit align */ | 416 | u8 def_fn; /* 1 if default fn */ |
417 | u8 rsvd[3]; /* 64bit align */ | ||
384 | }; | 418 | }; |
385 | 419 | ||
386 | /* | 420 | /* |
@@ -517,17 +551,6 @@ struct bfa_ioc_aen_data_s { | |||
517 | }; | 551 | }; |
518 | 552 | ||
519 | /* | 553 | /* |
520 | * D-port states | ||
521 | * | ||
522 | */ | ||
523 | enum bfa_dport_state { | ||
524 | BFA_DPORT_ST_DISABLED = 0, /* D-port is Disabled */ | ||
525 | BFA_DPORT_ST_DISABLING = 1, /* D-port is Disabling */ | ||
526 | BFA_DPORT_ST_ENABLING = 2, /* D-port is Enabling */ | ||
527 | BFA_DPORT_ST_ENABLED = 3, /* D-port is Enabled */ | ||
528 | }; | ||
529 | |||
530 | /* | ||
531 | * ---------------------- mfg definitions ------------ | 554 | * ---------------------- mfg definitions ------------ |
532 | */ | 555 | */ |
533 | 556 | ||
@@ -614,6 +637,7 @@ enum { | |||
614 | BFA_PCI_DEVICE_ID_CT = 0x14, | 637 | BFA_PCI_DEVICE_ID_CT = 0x14, |
615 | BFA_PCI_DEVICE_ID_CT_FC = 0x21, | 638 | BFA_PCI_DEVICE_ID_CT_FC = 0x21, |
616 | BFA_PCI_DEVICE_ID_CT2 = 0x22, | 639 | BFA_PCI_DEVICE_ID_CT2 = 0x22, |
640 | BFA_PCI_DEVICE_ID_CT2_QUAD = 0x23, | ||
617 | }; | 641 | }; |
618 | 642 | ||
619 | #define bfa_asic_id_cb(__d) \ | 643 | #define bfa_asic_id_cb(__d) \ |
@@ -622,7 +646,9 @@ enum { | |||
622 | #define bfa_asic_id_ct(__d) \ | 646 | #define bfa_asic_id_ct(__d) \ |
623 | ((__d) == BFA_PCI_DEVICE_ID_CT || \ | 647 | ((__d) == BFA_PCI_DEVICE_ID_CT || \ |
624 | (__d) == BFA_PCI_DEVICE_ID_CT_FC) | 648 | (__d) == BFA_PCI_DEVICE_ID_CT_FC) |
625 | #define bfa_asic_id_ct2(__d) ((__d) == BFA_PCI_DEVICE_ID_CT2) | 649 | #define bfa_asic_id_ct2(__d) \ |
650 | ((__d) == BFA_PCI_DEVICE_ID_CT2 || \ | ||
651 | (__d) == BFA_PCI_DEVICE_ID_CT2_QUAD) | ||
626 | #define bfa_asic_id_ctc(__d) \ | 652 | #define bfa_asic_id_ctc(__d) \ |
627 | (bfa_asic_id_ct(__d) || bfa_asic_id_ct2(__d)) | 653 | (bfa_asic_id_ct(__d) || bfa_asic_id_ct2(__d)) |
628 | 654 | ||
@@ -1126,6 +1152,7 @@ struct bfa_flash_attr_s { | |||
1126 | #define LB_PATTERN_DEFAULT 0xB5B5B5B5 | 1152 | #define LB_PATTERN_DEFAULT 0xB5B5B5B5 |
1127 | #define QTEST_CNT_DEFAULT 10 | 1153 | #define QTEST_CNT_DEFAULT 10 |
1128 | #define QTEST_PAT_DEFAULT LB_PATTERN_DEFAULT | 1154 | #define QTEST_PAT_DEFAULT LB_PATTERN_DEFAULT |
1155 | #define DPORT_ENABLE_LOOPCNT_DEFAULT (1024 * 1024) | ||
1129 | 1156 | ||
1130 | struct bfa_diag_memtest_s { | 1157 | struct bfa_diag_memtest_s { |
1131 | u8 algo; | 1158 | u8 algo; |
@@ -1154,6 +1181,54 @@ struct bfa_diag_loopback_result_s { | |||
1154 | u8 rsvd[3]; | 1181 | u8 rsvd[3]; |
1155 | }; | 1182 | }; |
1156 | 1183 | ||
1184 | enum bfa_diag_dport_test_status { | ||
1185 | DPORT_TEST_ST_IDLE = 0, /* the test has not started yet. */ | ||
1186 | DPORT_TEST_ST_FINAL = 1, /* the test done successfully */ | ||
1187 | DPORT_TEST_ST_SKIP = 2, /* the test skipped */ | ||
1188 | DPORT_TEST_ST_FAIL = 3, /* the test failed */ | ||
1189 | DPORT_TEST_ST_INPRG = 4, /* the testing is in progress */ | ||
1190 | DPORT_TEST_ST_RESPONDER = 5, /* test triggered from remote port */ | ||
1191 | DPORT_TEST_ST_STOPPED = 6, /* the test stopped by user. */ | ||
1192 | DPORT_TEST_ST_MAX | ||
1193 | }; | ||
1194 | |||
1195 | enum bfa_diag_dport_test_type { | ||
1196 | DPORT_TEST_ELOOP = 0, | ||
1197 | DPORT_TEST_OLOOP = 1, | ||
1198 | DPORT_TEST_ROLOOP = 2, | ||
1199 | DPORT_TEST_LINK = 3, | ||
1200 | DPORT_TEST_MAX | ||
1201 | }; | ||
1202 | |||
1203 | enum bfa_diag_dport_test_opmode { | ||
1204 | BFA_DPORT_OPMODE_AUTO = 0, | ||
1205 | BFA_DPORT_OPMODE_MANU = 1, | ||
1206 | }; | ||
1207 | |||
1208 | struct bfa_diag_dport_subtest_result_s { | ||
1209 | u8 status; /* bfa_diag_dport_test_status */ | ||
1210 | u8 rsvd[7]; /* 64bit align */ | ||
1211 | u64 start_time; /* timestamp */ | ||
1212 | }; | ||
1213 | |||
1214 | struct bfa_diag_dport_result_s { | ||
1215 | wwn_t rp_pwwn; /* switch port wwn */ | ||
1216 | wwn_t rp_nwwn; /* switch node wwn */ | ||
1217 | u64 start_time; /* user/sw start time */ | ||
1218 | u64 end_time; /* timestamp */ | ||
1219 | u8 status; /* bfa_diag_dport_test_status */ | ||
1220 | u8 mode; /* bfa_diag_dport_test_opmode */ | ||
1221 | u8 rsvd; /* 64bit align */ | ||
1222 | u8 speed; /* link speed for buf_reqd */ | ||
1223 | u16 buffer_required; | ||
1224 | u16 frmsz; /* frame size for buf_reqd */ | ||
1225 | u32 lpcnt; /* Frame count */ | ||
1226 | u32 pat; /* Pattern */ | ||
1227 | u32 roundtrip_latency; /* in nano sec */ | ||
1228 | u32 est_cable_distance; /* in meter */ | ||
1229 | struct bfa_diag_dport_subtest_result_s subtest[DPORT_TEST_MAX]; | ||
1230 | }; | ||
1231 | |||
1157 | struct bfa_diag_ledtest_s { | 1232 | struct bfa_diag_ledtest_s { |
1158 | u32 cmd; /* bfa_led_op_t */ | 1233 | u32 cmd; /* bfa_led_op_t */ |
1159 | u32 color; /* bfa_led_color_t */ | 1234 | u32 color; /* bfa_led_color_t */ |
diff --git a/drivers/scsi/bfa/bfa_defs_svc.h b/drivers/scsi/bfa/bfa_defs_svc.h index ec03c8cd8dac..638f441ffc38 100644 --- a/drivers/scsi/bfa/bfa_defs_svc.h +++ b/drivers/scsi/bfa/bfa_defs_svc.h | |||
@@ -105,6 +105,9 @@ struct bfa_fw_ioim_stats_s { | |||
105 | * an error condition*/ | 105 | * an error condition*/ |
106 | u32 wait_for_si; /* FW wait for SI */ | 106 | u32 wait_for_si; /* FW wait for SI */ |
107 | u32 rec_rsp_inval; /* REC rsp invalid */ | 107 | u32 rec_rsp_inval; /* REC rsp invalid */ |
108 | u32 rec_rsp_xchg_comp; /* REC rsp xchg complete */ | ||
109 | u32 rec_rsp_rd_si_ownd; /* REC rsp read si owned */ | ||
110 | |||
108 | u32 seqr_io_abort; /* target does not know cmd so abort */ | 111 | u32 seqr_io_abort; /* target does not know cmd so abort */ |
109 | u32 seqr_io_retry; /* SEQR failed so retry IO */ | 112 | u32 seqr_io_retry; /* SEQR failed so retry IO */ |
110 | 113 | ||
@@ -257,8 +260,6 @@ struct bfa_fw_port_lksm_stats_s { | |||
257 | u32 nos_tx; /* No. of times NOS tx started */ | 260 | u32 nos_tx; /* No. of times NOS tx started */ |
258 | u32 hwsm_lrr_rx; /* No. of times LRR rx-ed by HWSM */ | 261 | u32 hwsm_lrr_rx; /* No. of times LRR rx-ed by HWSM */ |
259 | u32 hwsm_lr_rx; /* No. of times LR rx-ed by HWSM */ | 262 | u32 hwsm_lr_rx; /* No. of times LR rx-ed by HWSM */ |
260 | u32 bbsc_lr; /* LKSM LR tx for credit recovery */ | ||
261 | u32 rsvd; | ||
262 | }; | 263 | }; |
263 | 264 | ||
264 | struct bfa_fw_port_snsm_stats_s { | 265 | struct bfa_fw_port_snsm_stats_s { |
@@ -409,7 +410,7 @@ struct bfa_fw_trunk_stats_s { | |||
409 | u32 rsvd; /* padding for 64 bit alignment */ | 410 | u32 rsvd; /* padding for 64 bit alignment */ |
410 | }; | 411 | }; |
411 | 412 | ||
412 | struct bfa_fw_advsm_stats_s { | 413 | struct bfa_fw_aport_stats_s { |
413 | u32 flogi_sent; /* Flogi sent */ | 414 | u32 flogi_sent; /* Flogi sent */ |
414 | u32 flogi_acc_recvd; /* Flogi Acc received */ | 415 | u32 flogi_acc_recvd; /* Flogi Acc received */ |
415 | u32 flogi_rjt_recvd; /* Flogi rejects received */ | 416 | u32 flogi_rjt_recvd; /* Flogi rejects received */ |
@@ -419,6 +420,12 @@ struct bfa_fw_advsm_stats_s { | |||
419 | u32 elp_accepted; /* ELP Accepted */ | 420 | u32 elp_accepted; /* ELP Accepted */ |
420 | u32 elp_rejected; /* ELP rejected */ | 421 | u32 elp_rejected; /* ELP rejected */ |
421 | u32 elp_dropped; /* ELP dropped */ | 422 | u32 elp_dropped; /* ELP dropped */ |
423 | |||
424 | u32 bbcr_lr_count; /*!< BBCR Link Resets */ | ||
425 | u32 frame_lost_intrs; /*!< BBCR Frame loss intrs */ | ||
426 | u32 rrdy_lost_intrs; /*!< BBCR Rrdy loss intrs */ | ||
427 | |||
428 | u32 rsvd; | ||
422 | }; | 429 | }; |
423 | 430 | ||
424 | /* | 431 | /* |
@@ -479,6 +486,14 @@ struct bfa_fw_ct_mod_stats_s { | |||
479 | }; | 486 | }; |
480 | 487 | ||
481 | /* | 488 | /* |
489 | * RDS mod stats | ||
490 | */ | ||
491 | struct bfa_fw_rds_stats_s { | ||
492 | u32 no_fid_drop_err; /* RDS no fid drop error */ | ||
493 | u32 rsvd; /* 64bit align */ | ||
494 | }; | ||
495 | |||
496 | /* | ||
482 | * IOC firmware stats | 497 | * IOC firmware stats |
483 | */ | 498 | */ |
484 | struct bfa_fw_stats_s { | 499 | struct bfa_fw_stats_s { |
@@ -489,10 +504,11 @@ struct bfa_fw_stats_s { | |||
489 | struct bfa_fw_fcxchg_stats_s fcxchg_stats; | 504 | struct bfa_fw_fcxchg_stats_s fcxchg_stats; |
490 | struct bfa_fw_lps_stats_s lps_stats; | 505 | struct bfa_fw_lps_stats_s lps_stats; |
491 | struct bfa_fw_trunk_stats_s trunk_stats; | 506 | struct bfa_fw_trunk_stats_s trunk_stats; |
492 | struct bfa_fw_advsm_stats_s advsm_stats; | 507 | struct bfa_fw_aport_stats_s aport_stats; |
493 | struct bfa_fw_mac_mod_stats_s macmod_stats; | 508 | struct bfa_fw_mac_mod_stats_s macmod_stats; |
494 | struct bfa_fw_ct_mod_stats_s ctmod_stats; | 509 | struct bfa_fw_ct_mod_stats_s ctmod_stats; |
495 | struct bfa_fw_eth_sndrcv_stats_s ethsndrcv_stats; | 510 | struct bfa_fw_eth_sndrcv_stats_s ethsndrcv_stats; |
511 | struct bfa_fw_rds_stats_s rds_stats; | ||
496 | }; | 512 | }; |
497 | 513 | ||
498 | #define BFA_IOCFC_PATHTOV_MAX 60 | 514 | #define BFA_IOCFC_PATHTOV_MAX 60 |
@@ -545,6 +561,27 @@ struct bfa_qos_attr_s { | |||
545 | struct bfa_qos_bw_s qos_bw_op; /* QOS bw operational */ | 561 | struct bfa_qos_bw_s qos_bw_op; /* QOS bw operational */ |
546 | }; | 562 | }; |
547 | 563 | ||
564 | enum bfa_bbcr_state { | ||
565 | BFA_BBCR_DISABLED, /*!< BBCR is disable */ | ||
566 | BFA_BBCR_ONLINE, /*!< BBCR is online */ | ||
567 | BFA_BBCR_OFFLINE, /*!< BBCR is offline */ | ||
568 | }; | ||
569 | |||
570 | enum bfa_bbcr_err_reason { | ||
571 | BFA_BBCR_ERR_REASON_NONE, /*!< Unknown */ | ||
572 | BFA_BBCR_ERR_REASON_SPEED_UNSUP, /*!< Port speed < max sup_speed */ | ||
573 | BFA_BBCR_ERR_REASON_PEER_UNSUP, /*!< BBCR is disable on peer port */ | ||
574 | BFA_BBCR_ERR_REASON_NON_BRCD_SW, /*!< Connected to non BRCD switch */ | ||
575 | BFA_BBCR_ERR_REASON_FLOGI_RJT, /*!< Login rejected by the switch */ | ||
576 | }; | ||
577 | |||
578 | struct bfa_bbcr_attr_s { | ||
579 | u8 state; | ||
580 | u8 peer_bb_scn; | ||
581 | u8 reason; | ||
582 | u8 rsvd; | ||
583 | }; | ||
584 | |||
548 | /* | 585 | /* |
549 | * These fields should be displayed only from the CLI. | 586 | * These fields should be displayed only from the CLI. |
550 | * There will be a separate BFAL API (get_qos_vc_attr ?) | 587 | * There will be a separate BFAL API (get_qos_vc_attr ?) |
@@ -736,6 +773,7 @@ enum bfa_port_states { | |||
736 | BFA_PORT_ST_TOGGLING_QWAIT = 14, | 773 | BFA_PORT_ST_TOGGLING_QWAIT = 14, |
737 | BFA_PORT_ST_FAA_MISCONFIG = 15, | 774 | BFA_PORT_ST_FAA_MISCONFIG = 15, |
738 | BFA_PORT_ST_DPORT = 16, | 775 | BFA_PORT_ST_DPORT = 16, |
776 | BFA_PORT_ST_DDPORT = 17, | ||
739 | BFA_PORT_ST_MAX_STATE, | 777 | BFA_PORT_ST_MAX_STATE, |
740 | }; | 778 | }; |
741 | 779 | ||
@@ -857,6 +895,15 @@ enum bfa_lunmask_state_s { | |||
857 | BFA_LUNMASK_UNINITIALIZED = 0xff, | 895 | BFA_LUNMASK_UNINITIALIZED = 0xff, |
858 | }; | 896 | }; |
859 | 897 | ||
898 | /** | ||
899 | * FEC states | ||
900 | */ | ||
901 | enum bfa_fec_state_s { | ||
902 | BFA_FEC_ONLINE = 1, /*!< FEC is online */ | ||
903 | BFA_FEC_OFFLINE = 2, /*!< FEC is offline */ | ||
904 | BFA_FEC_OFFLINE_NOT_16G = 3, /*!< FEC is offline (speed not 16Gig) */ | ||
905 | }; | ||
906 | |||
860 | #pragma pack(1) | 907 | #pragma pack(1) |
861 | /* | 908 | /* |
862 | * LUN mask configuration | 909 | * LUN mask configuration |
@@ -892,6 +939,9 @@ struct bfa_defs_fcpim_throttle_s { | |||
892 | u16 rsvd; | 939 | u16 rsvd; |
893 | }; | 940 | }; |
894 | 941 | ||
942 | #define BFA_BB_SCN_DEF 3 | ||
943 | #define BFA_BB_SCN_MAX 0x0F | ||
944 | |||
895 | /* | 945 | /* |
896 | * Physical port configuration | 946 | * Physical port configuration |
897 | */ | 947 | */ |
@@ -907,8 +957,8 @@ struct bfa_port_cfg_s { | |||
907 | u8 tx_bbcredit; /* transmit buffer credits */ | 957 | u8 tx_bbcredit; /* transmit buffer credits */ |
908 | u8 ratelimit; /* ratelimit enabled or not */ | 958 | u8 ratelimit; /* ratelimit enabled or not */ |
909 | u8 trl_def_speed; /* ratelimit default speed */ | 959 | u8 trl_def_speed; /* ratelimit default speed */ |
910 | u8 bb_scn; /* BB_SCN value from FLOGI Exchg */ | 960 | u8 bb_cr_enabled; /*!< Config state of BB_SCN */ |
911 | u8 bb_scn_state; /* Config state of BB_SCN */ | 961 | u8 bb_scn; /*!< BB_SCN value for FLOGI Exchg */ |
912 | u8 faa_state; /* FAA enabled/disabled */ | 962 | u8 faa_state; /* FAA enabled/disabled */ |
913 | u8 rsvd1; | 963 | u8 rsvd1; |
914 | u16 path_tov; /* device path timeout */ | 964 | u16 path_tov; /* device path timeout */ |
@@ -950,6 +1000,7 @@ struct bfa_port_attr_s { | |||
950 | bfa_boolean_t link_e2e_beacon; /* link beacon is on */ | 1000 | bfa_boolean_t link_e2e_beacon; /* link beacon is on */ |
951 | bfa_boolean_t bbsc_op_status; /* fc credit recovery oper | 1001 | bfa_boolean_t bbsc_op_status; /* fc credit recovery oper |
952 | * state */ | 1002 | * state */ |
1003 | enum bfa_fec_state_s fec_state; /*!< current FEC state */ | ||
953 | 1004 | ||
954 | /* | 1005 | /* |
955 | * Dynamic field - info from FCS | 1006 | * Dynamic field - info from FCS |
@@ -961,7 +1012,7 @@ struct bfa_port_attr_s { | |||
961 | 1012 | ||
962 | /* FCoE specific */ | 1013 | /* FCoE specific */ |
963 | u16 fcoe_vlan; | 1014 | u16 fcoe_vlan; |
964 | u8 rsvd1[6]; | 1015 | u8 rsvd1[2]; |
965 | }; | 1016 | }; |
966 | 1017 | ||
967 | /* | 1018 | /* |
@@ -1048,10 +1099,12 @@ struct bfa_port_link_s { | |||
1048 | u8 speed; /* Link speed (1/2/4/8 G) */ | 1099 | u8 speed; /* Link speed (1/2/4/8 G) */ |
1049 | u32 linkstate_opt; /* Linkstate optional data (debug) */ | 1100 | u32 linkstate_opt; /* Linkstate optional data (debug) */ |
1050 | u8 trunked; /* Trunked or not (1 or 0) */ | 1101 | u8 trunked; /* Trunked or not (1 or 0) */ |
1051 | u8 resvd[7]; | 1102 | u8 fec_state; /*!< State of FEC */ |
1103 | u8 resvd[6]; | ||
1052 | struct bfa_qos_attr_s qos_attr; /* QoS Attributes */ | 1104 | struct bfa_qos_attr_s qos_attr; /* QoS Attributes */ |
1053 | union { | 1105 | union { |
1054 | struct bfa_fcport_loop_info_s loop_info; | 1106 | struct bfa_fcport_loop_info_s loop_info; |
1107 | struct bfa_bbcr_attr_s bbcr_attr; | ||
1055 | union { | 1108 | union { |
1056 | struct bfa_qos_vc_attr_s qos_vc_attr; | 1109 | struct bfa_qos_vc_attr_s qos_vc_attr; |
1057 | /* VC info from ELP */ | 1110 | /* VC info from ELP */ |
@@ -1215,9 +1268,11 @@ struct bfa_port_fc_stats_s { | |||
1215 | u64 bad_os_count; /* Invalid ordered sets */ | 1268 | u64 bad_os_count; /* Invalid ordered sets */ |
1216 | u64 err_enc_out; /* Encoding err nonframe_8b10b */ | 1269 | u64 err_enc_out; /* Encoding err nonframe_8b10b */ |
1217 | u64 err_enc; /* Encoding err frame_8b10b */ | 1270 | u64 err_enc; /* Encoding err frame_8b10b */ |
1218 | u64 bbsc_frames_lost; /* Credit Recovery-Frames Lost */ | 1271 | u64 bbcr_frames_lost; /*!< BBCR Frames Lost */ |
1219 | u64 bbsc_credits_lost; /* Credit Recovery-Credits Lost */ | 1272 | u64 bbcr_rrdys_lost; /*!< BBCR RRDYs Lost */ |
1220 | u64 bbsc_link_resets; /* Credit Recovery-Link Resets */ | 1273 | u64 bbcr_link_resets; /*!< BBCR Link Resets */ |
1274 | u64 bbcr_frame_lost_intrs; /*!< BBCR Frame loss intrs */ | ||
1275 | u64 bbcr_rrdy_lost_intrs; /*!< BBCR Rrdy loss intrs */ | ||
1221 | u64 loop_timeouts; /* Loop timeouts */ | 1276 | u64 loop_timeouts; /* Loop timeouts */ |
1222 | }; | 1277 | }; |
1223 | 1278 | ||
diff --git a/drivers/scsi/bfa/bfa_fc.h b/drivers/scsi/bfa/bfa_fc.h index bea821b98030..562ef739b0bc 100644 --- a/drivers/scsi/bfa/bfa_fc.h +++ b/drivers/scsi/bfa/bfa_fc.h | |||
@@ -1531,6 +1531,12 @@ enum fdmi_hba_attribute_type { | |||
1531 | FDMI_HBA_ATTRIB_FW_VERSION, /* 0x0009 */ | 1531 | FDMI_HBA_ATTRIB_FW_VERSION, /* 0x0009 */ |
1532 | FDMI_HBA_ATTRIB_OS_NAME, /* 0x000A */ | 1532 | FDMI_HBA_ATTRIB_OS_NAME, /* 0x000A */ |
1533 | FDMI_HBA_ATTRIB_MAX_CT, /* 0x000B */ | 1533 | FDMI_HBA_ATTRIB_MAX_CT, /* 0x000B */ |
1534 | FDMI_HBA_ATTRIB_NODE_SYM_NAME, /* 0x000C */ | ||
1535 | FDMI_HBA_ATTRIB_VENDOR_INFO, /* 0x000D */ | ||
1536 | FDMI_HBA_ATTRIB_NUM_PORTS, /* 0x000E */ | ||
1537 | FDMI_HBA_ATTRIB_FABRIC_NAME, /* 0x000F */ | ||
1538 | FDMI_HBA_ATTRIB_BIOS_VER, /* 0x0010 */ | ||
1539 | FDMI_HBA_ATTRIB_VENDOR_ID = 0x00E0, | ||
1534 | 1540 | ||
1535 | FDMI_HBA_ATTRIB_MAX_TYPE | 1541 | FDMI_HBA_ATTRIB_MAX_TYPE |
1536 | }; | 1542 | }; |
@@ -1545,6 +1551,15 @@ enum fdmi_port_attribute_type { | |||
1545 | FDMI_PORT_ATTRIB_FRAME_SIZE, /* 0x0004 */ | 1551 | FDMI_PORT_ATTRIB_FRAME_SIZE, /* 0x0004 */ |
1546 | FDMI_PORT_ATTRIB_DEV_NAME, /* 0x0005 */ | 1552 | FDMI_PORT_ATTRIB_DEV_NAME, /* 0x0005 */ |
1547 | FDMI_PORT_ATTRIB_HOST_NAME, /* 0x0006 */ | 1553 | FDMI_PORT_ATTRIB_HOST_NAME, /* 0x0006 */ |
1554 | FDMI_PORT_ATTRIB_NODE_NAME, /* 0x0007 */ | ||
1555 | FDMI_PORT_ATTRIB_PORT_NAME, /* 0x0008 */ | ||
1556 | FDMI_PORT_ATTRIB_PORT_SYM_NAME, /* 0x0009 */ | ||
1557 | FDMI_PORT_ATTRIB_PORT_TYPE, /* 0x000A */ | ||
1558 | FDMI_PORT_ATTRIB_SUPP_COS, /* 0x000B */ | ||
1559 | FDMI_PORT_ATTRIB_PORT_FAB_NAME, /* 0x000C */ | ||
1560 | FDMI_PORT_ATTRIB_PORT_FC4_TYPE, /* 0x000D */ | ||
1561 | FDMI_PORT_ATTRIB_PORT_STATE = 0x101, /* 0x0101 */ | ||
1562 | FDMI_PORT_ATTRIB_PORT_NUM_RPRT = 0x102, /* 0x0102 */ | ||
1548 | 1563 | ||
1549 | FDMI_PORT_ATTR_MAX_TYPE | 1564 | FDMI_PORT_ATTR_MAX_TYPE |
1550 | }; | 1565 | }; |
diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c index 27b560962357..d7385d1d9c5a 100644 --- a/drivers/scsi/bfa/bfa_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcpim.c | |||
@@ -2882,7 +2882,7 @@ bfa_ioim_good_comp_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
2882 | iotag = be16_to_cpu(rsp->io_tag); | 2882 | iotag = be16_to_cpu(rsp->io_tag); |
2883 | 2883 | ||
2884 | ioim = BFA_IOIM_FROM_TAG(fcpim, iotag); | 2884 | ioim = BFA_IOIM_FROM_TAG(fcpim, iotag); |
2885 | WARN_ON(BFA_IOIM_TAG_2_ID(ioim->iotag) != iotag); | 2885 | WARN_ON(ioim->iotag != iotag); |
2886 | 2886 | ||
2887 | bfa_ioim_cb_profile_comp(fcpim, ioim); | 2887 | bfa_ioim_cb_profile_comp(fcpim, ioim); |
2888 | 2888 | ||
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c index d428808fb37e..a3ab5cce4208 100644 --- a/drivers/scsi/bfa/bfa_fcs.c +++ b/drivers/scsi/bfa/bfa_fcs.c | |||
@@ -240,9 +240,6 @@ static void bfa_fcs_fabric_flogiacc_comp(void *fcsarg, | |||
240 | u32 rsp_len, | 240 | u32 rsp_len, |
241 | u32 resid_len, | 241 | u32 resid_len, |
242 | struct fchs_s *rspfchs); | 242 | struct fchs_s *rspfchs); |
243 | static u8 bfa_fcs_fabric_oper_bbscn(struct bfa_fcs_fabric_s *fabric); | ||
244 | static bfa_boolean_t bfa_fcs_fabric_is_bbscn_enabled( | ||
245 | struct bfa_fcs_fabric_s *fabric); | ||
246 | 243 | ||
247 | static void bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric, | 244 | static void bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric, |
248 | enum bfa_fcs_fabric_event event); | 245 | enum bfa_fcs_fabric_event event); |
@@ -404,8 +401,7 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric, | |||
404 | case BFA_FCS_FABRIC_SM_CONT_OP: | 401 | case BFA_FCS_FABRIC_SM_CONT_OP: |
405 | 402 | ||
406 | bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, | 403 | bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, |
407 | fabric->bb_credit, | 404 | fabric->bb_credit); |
408 | bfa_fcs_fabric_oper_bbscn(fabric)); | ||
409 | fabric->fab_type = BFA_FCS_FABRIC_SWITCHED; | 405 | fabric->fab_type = BFA_FCS_FABRIC_SWITCHED; |
410 | 406 | ||
411 | if (fabric->auth_reqd && fabric->is_auth) { | 407 | if (fabric->auth_reqd && fabric->is_auth) { |
@@ -433,8 +429,7 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric, | |||
433 | case BFA_FCS_FABRIC_SM_NO_FABRIC: | 429 | case BFA_FCS_FABRIC_SM_NO_FABRIC: |
434 | fabric->fab_type = BFA_FCS_FABRIC_N2N; | 430 | fabric->fab_type = BFA_FCS_FABRIC_N2N; |
435 | bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, | 431 | bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, |
436 | fabric->bb_credit, | 432 | fabric->bb_credit); |
437 | bfa_fcs_fabric_oper_bbscn(fabric)); | ||
438 | bfa_fcs_fabric_notify_online(fabric); | 433 | bfa_fcs_fabric_notify_online(fabric); |
439 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_nofabric); | 434 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_nofabric); |
440 | break; | 435 | break; |
@@ -602,8 +597,7 @@ bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric, | |||
602 | case BFA_FCS_FABRIC_SM_NO_FABRIC: | 597 | case BFA_FCS_FABRIC_SM_NO_FABRIC: |
603 | bfa_trc(fabric->fcs, fabric->bb_credit); | 598 | bfa_trc(fabric->fcs, fabric->bb_credit); |
604 | bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, | 599 | bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, |
605 | fabric->bb_credit, | 600 | fabric->bb_credit); |
606 | bfa_fcs_fabric_oper_bbscn(fabric)); | ||
607 | break; | 601 | break; |
608 | 602 | ||
609 | case BFA_FCS_FABRIC_SM_RETRY_OP: | 603 | case BFA_FCS_FABRIC_SM_RETRY_OP: |
@@ -965,10 +959,6 @@ bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status) | |||
965 | 959 | ||
966 | case BFA_STATUS_FABRIC_RJT: | 960 | case BFA_STATUS_FABRIC_RJT: |
967 | fabric->stats.flogi_rejects++; | 961 | fabric->stats.flogi_rejects++; |
968 | if (fabric->lps->lsrjt_rsn == FC_LS_RJT_RSN_LOGICAL_ERROR && | ||
969 | fabric->lps->lsrjt_expl == FC_LS_RJT_EXP_NO_ADDL_INFO) | ||
970 | fabric->fcs->bbscn_flogi_rjt = BFA_TRUE; | ||
971 | |||
972 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_RETRY_OP); | 962 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_RETRY_OP); |
973 | return; | 963 | return; |
974 | 964 | ||
@@ -1014,14 +1004,11 @@ bfa_fcs_fabric_login(struct bfa_fcs_fabric_s *fabric) | |||
1014 | { | 1004 | { |
1015 | struct bfa_s *bfa = fabric->fcs->bfa; | 1005 | struct bfa_s *bfa = fabric->fcs->bfa; |
1016 | struct bfa_lport_cfg_s *pcfg = &fabric->bport.port_cfg; | 1006 | struct bfa_lport_cfg_s *pcfg = &fabric->bport.port_cfg; |
1017 | u8 alpa = 0, bb_scn = 0; | 1007 | u8 alpa = 0; |
1018 | 1008 | ||
1019 | if (bfa_fcs_fabric_is_bbscn_enabled(fabric) && | ||
1020 | (!fabric->fcs->bbscn_flogi_rjt)) | ||
1021 | bb_scn = BFA_FCS_PORT_DEF_BB_SCN; | ||
1022 | 1009 | ||
1023 | bfa_lps_flogi(fabric->lps, fabric, alpa, bfa_fcport_get_maxfrsize(bfa), | 1010 | bfa_lps_flogi(fabric->lps, fabric, alpa, bfa_fcport_get_maxfrsize(bfa), |
1024 | pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd, bb_scn); | 1011 | pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd); |
1025 | 1012 | ||
1026 | fabric->stats.flogi_sent++; | 1013 | fabric->stats.flogi_sent++; |
1027 | } | 1014 | } |
@@ -1102,40 +1089,6 @@ bfa_fcs_fabric_stop(struct bfa_fcs_fabric_s *fabric) | |||
1102 | } | 1089 | } |
1103 | 1090 | ||
1104 | /* | 1091 | /* |
1105 | * Computes operating BB_SCN value | ||
1106 | */ | ||
1107 | static u8 | ||
1108 | bfa_fcs_fabric_oper_bbscn(struct bfa_fcs_fabric_s *fabric) | ||
1109 | { | ||
1110 | u8 pr_bbscn = fabric->lps->pr_bbscn; | ||
1111 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(fabric->fcs->bfa); | ||
1112 | |||
1113 | if (!(fcport->cfg.bb_scn_state && pr_bbscn)) | ||
1114 | return 0; | ||
1115 | |||
1116 | /* return max of local/remote bb_scn values */ | ||
1117 | return ((pr_bbscn > BFA_FCS_PORT_DEF_BB_SCN) ? | ||
1118 | pr_bbscn : BFA_FCS_PORT_DEF_BB_SCN); | ||
1119 | } | ||
1120 | |||
1121 | /* | ||
1122 | * Check if BB_SCN can be enabled. | ||
1123 | */ | ||
1124 | static bfa_boolean_t | ||
1125 | bfa_fcs_fabric_is_bbscn_enabled(struct bfa_fcs_fabric_s *fabric) | ||
1126 | { | ||
1127 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(fabric->fcs->bfa); | ||
1128 | |||
1129 | if (bfa_ioc_get_fcmode(&fabric->fcs->bfa->ioc) && | ||
1130 | fcport->cfg.bb_scn_state && | ||
1131 | !bfa_fcport_is_qos_enabled(fabric->fcs->bfa) && | ||
1132 | !bfa_fcport_is_trunk_enabled(fabric->fcs->bfa)) | ||
1133 | return BFA_TRUE; | ||
1134 | else | ||
1135 | return BFA_FALSE; | ||
1136 | } | ||
1137 | |||
1138 | /* | ||
1139 | * Delete all vports and wait for vport delete completions. | 1092 | * Delete all vports and wait for vport delete completions. |
1140 | */ | 1093 | */ |
1141 | static void | 1094 | static void |
@@ -1273,7 +1226,6 @@ void | |||
1273 | bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric) | 1226 | bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric) |
1274 | { | 1227 | { |
1275 | bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); | 1228 | bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); |
1276 | fabric->fcs->bbscn_flogi_rjt = BFA_FALSE; | ||
1277 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_DOWN); | 1229 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_DOWN); |
1278 | } | 1230 | } |
1279 | 1231 | ||
@@ -1480,7 +1432,6 @@ bfa_fcs_fabric_process_flogi(struct bfa_fcs_fabric_s *fabric, | |||
1480 | } | 1432 | } |
1481 | 1433 | ||
1482 | fabric->bb_credit = be16_to_cpu(flogi->csp.bbcred); | 1434 | fabric->bb_credit = be16_to_cpu(flogi->csp.bbcred); |
1483 | fabric->lps->pr_bbscn = (be16_to_cpu(flogi->csp.rxsz) >> 12); | ||
1484 | bport->port_topo.pn2n.rem_port_wwn = flogi->port_name; | 1435 | bport->port_topo.pn2n.rem_port_wwn = flogi->port_name; |
1485 | bport->port_topo.pn2n.reply_oxid = fchs->ox_id; | 1436 | bport->port_topo.pn2n.reply_oxid = fchs->ox_id; |
1486 | 1437 | ||
@@ -1513,8 +1464,7 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric) | |||
1513 | n2n_port->reply_oxid, pcfg->pwwn, | 1464 | n2n_port->reply_oxid, pcfg->pwwn, |
1514 | pcfg->nwwn, | 1465 | pcfg->nwwn, |
1515 | bfa_fcport_get_maxfrsize(bfa), | 1466 | bfa_fcport_get_maxfrsize(bfa), |
1516 | bfa_fcport_get_rx_bbcredit(bfa), | 1467 | bfa_fcport_get_rx_bbcredit(bfa), 0); |
1517 | bfa_fcs_fabric_oper_bbscn(fabric)); | ||
1518 | 1468 | ||
1519 | bfa_fcxp_send(fcxp, NULL, fabric->vf_id, fabric->lps->bfa_tag, | 1469 | bfa_fcxp_send(fcxp, NULL, fabric->vf_id, fabric->lps->bfa_tag, |
1520 | BFA_FALSE, FC_CLASS_3, | 1470 | BFA_FALSE, FC_CLASS_3, |
diff --git a/drivers/scsi/bfa/bfa_fcs.h b/drivers/scsi/bfa/bfa_fcs.h index a449706c6bc0..94d5d0102f7d 100644 --- a/drivers/scsi/bfa/bfa_fcs.h +++ b/drivers/scsi/bfa/bfa_fcs.h | |||
@@ -243,24 +243,21 @@ struct bfa_fcs_fabric_s; | |||
243 | * Symbolic Name. | 243 | * Symbolic Name. |
244 | * | 244 | * |
245 | * Physical Port's symbolic name Format : (Total 128 bytes) | 245 | * Physical Port's symbolic name Format : (Total 128 bytes) |
246 | * Adapter Model number/name : 12 bytes | 246 | * Adapter Model number/name : 16 bytes |
247 | * Driver Version : 10 bytes | 247 | * Driver Version : 10 bytes |
248 | * Host Machine Name : 30 bytes | 248 | * Host Machine Name : 30 bytes |
249 | * Host OS Info : 48 bytes | 249 | * Host OS Info : 44 bytes |
250 | * Host OS PATCH Info : 16 bytes | 250 | * Host OS PATCH Info : 16 bytes |
251 | * ( remaining 12 bytes reserved to be used for separator) | 251 | * ( remaining 12 bytes reserved to be used for separator) |
252 | */ | 252 | */ |
253 | #define BFA_FCS_PORT_SYMBNAME_SEPARATOR " | " | 253 | #define BFA_FCS_PORT_SYMBNAME_SEPARATOR " | " |
254 | 254 | ||
255 | #define BFA_FCS_PORT_SYMBNAME_MODEL_SZ 12 | 255 | #define BFA_FCS_PORT_SYMBNAME_MODEL_SZ 16 |
256 | #define BFA_FCS_PORT_SYMBNAME_VERSION_SZ 10 | 256 | #define BFA_FCS_PORT_SYMBNAME_VERSION_SZ 10 |
257 | #define BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ 30 | 257 | #define BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ 30 |
258 | #define BFA_FCS_PORT_SYMBNAME_OSINFO_SZ 48 | 258 | #define BFA_FCS_PORT_SYMBNAME_OSINFO_SZ 44 |
259 | #define BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ 16 | 259 | #define BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ 16 |
260 | 260 | ||
261 | /* bb_scn value in 2^bb_scn */ | ||
262 | #define BFA_FCS_PORT_DEF_BB_SCN 3 | ||
263 | |||
264 | /* | 261 | /* |
265 | * Get FC port ID for a logical port. | 262 | * Get FC port ID for a logical port. |
266 | */ | 263 | */ |
@@ -630,6 +627,9 @@ void bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim, | |||
630 | 627 | ||
631 | #define BFA_FCS_FDMI_SUPP_SPEEDS_10G FDMI_TRANS_SPEED_10G | 628 | #define BFA_FCS_FDMI_SUPP_SPEEDS_10G FDMI_TRANS_SPEED_10G |
632 | 629 | ||
630 | #define BFA_FCS_FDMI_VENDOR_INFO_LEN 8 | ||
631 | #define BFA_FCS_FDMI_FC4_TYPE_LEN 32 | ||
632 | |||
633 | /* | 633 | /* |
634 | * HBA Attribute Block : BFA internal representation. Note : Some variable | 634 | * HBA Attribute Block : BFA internal representation. Note : Some variable |
635 | * sizes have been trimmed to suit BFA For Ex : Model will be "Brocade". Based | 635 | * sizes have been trimmed to suit BFA For Ex : Model will be "Brocade". Based |
@@ -640,25 +640,39 @@ struct bfa_fcs_fdmi_hba_attr_s { | |||
640 | u8 manufacturer[64]; | 640 | u8 manufacturer[64]; |
641 | u8 serial_num[64]; | 641 | u8 serial_num[64]; |
642 | u8 model[16]; | 642 | u8 model[16]; |
643 | u8 model_desc[256]; | 643 | u8 model_desc[128]; |
644 | u8 hw_version[8]; | 644 | u8 hw_version[8]; |
645 | u8 driver_version[BFA_VERSION_LEN]; | 645 | u8 driver_version[BFA_VERSION_LEN]; |
646 | u8 option_rom_ver[BFA_VERSION_LEN]; | 646 | u8 option_rom_ver[BFA_VERSION_LEN]; |
647 | u8 fw_version[BFA_VERSION_LEN]; | 647 | u8 fw_version[BFA_VERSION_LEN]; |
648 | u8 os_name[256]; | 648 | u8 os_name[256]; |
649 | __be32 max_ct_pyld; | 649 | __be32 max_ct_pyld; |
650 | struct bfa_lport_symname_s node_sym_name; | ||
651 | u8 vendor_info[BFA_FCS_FDMI_VENDOR_INFO_LEN]; | ||
652 | __be32 num_ports; | ||
653 | wwn_t fabric_name; | ||
654 | u8 bios_ver[BFA_VERSION_LEN]; | ||
650 | }; | 655 | }; |
651 | 656 | ||
652 | /* | 657 | /* |
653 | * Port Attribute Block | 658 | * Port Attribute Block |
654 | */ | 659 | */ |
655 | struct bfa_fcs_fdmi_port_attr_s { | 660 | struct bfa_fcs_fdmi_port_attr_s { |
656 | u8 supp_fc4_types[32]; /* supported FC4 types */ | 661 | u8 supp_fc4_types[BFA_FCS_FDMI_FC4_TYPE_LEN]; |
657 | __be32 supp_speed; /* supported speed */ | 662 | __be32 supp_speed; /* supported speed */ |
658 | __be32 curr_speed; /* current Speed */ | 663 | __be32 curr_speed; /* current Speed */ |
659 | __be32 max_frm_size; /* max frame size */ | 664 | __be32 max_frm_size; /* max frame size */ |
660 | u8 os_device_name[256]; /* OS device Name */ | 665 | u8 os_device_name[256]; /* OS device Name */ |
661 | u8 host_name[256]; /* host name */ | 666 | u8 host_name[256]; /* host name */ |
667 | wwn_t port_name; | ||
668 | wwn_t node_name; | ||
669 | struct bfa_lport_symname_s port_sym_name; | ||
670 | __be32 port_type; | ||
671 | enum fc_cos scos; | ||
672 | wwn_t port_fabric_name; | ||
673 | u8 port_act_fc4_type[BFA_FCS_FDMI_FC4_TYPE_LEN]; | ||
674 | __be32 port_state; | ||
675 | __be32 num_ports; | ||
662 | }; | 676 | }; |
663 | 677 | ||
664 | struct bfa_fcs_stats_s { | 678 | struct bfa_fcs_stats_s { |
@@ -683,8 +697,6 @@ struct bfa_fcs_s { | |||
683 | struct bfa_trc_mod_s *trcmod; /* tracing module */ | 697 | struct bfa_trc_mod_s *trcmod; /* tracing module */ |
684 | bfa_boolean_t vf_enabled; /* VF mode is enabled */ | 698 | bfa_boolean_t vf_enabled; /* VF mode is enabled */ |
685 | bfa_boolean_t fdmi_enabled; /* FDMI is enabled */ | 699 | bfa_boolean_t fdmi_enabled; /* FDMI is enabled */ |
686 | bfa_boolean_t bbscn_enabled; /* Driver Config Parameter */ | ||
687 | bfa_boolean_t bbscn_flogi_rjt;/* FLOGI reject due to BB_SCN */ | ||
688 | bfa_boolean_t min_cfg; /* min cfg enabled/disabled */ | 700 | bfa_boolean_t min_cfg; /* min cfg enabled/disabled */ |
689 | u16 port_vfid; /* port default VF ID */ | 701 | u16 port_vfid; /* port default VF ID */ |
690 | struct bfa_fcs_driver_info_s driver_info; | 702 | struct bfa_fcs_driver_info_s driver_info; |
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c index 1224d0462a49..2f61a5af3658 100644 --- a/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/drivers/scsi/bfa/bfa_fcs_lport.c | |||
@@ -2048,10 +2048,71 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
2048 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MAX_CT); | 2048 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MAX_CT); |
2049 | templen = sizeof(fcs_hba_attr->max_ct_pyld); | 2049 | templen = sizeof(fcs_hba_attr->max_ct_pyld); |
2050 | memcpy(attr->value, &fcs_hba_attr->max_ct_pyld, templen); | 2050 | memcpy(attr->value, &fcs_hba_attr->max_ct_pyld, templen); |
2051 | templen = fc_roundup(templen, sizeof(u32)); | ||
2052 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; | ||
2051 | len += templen; | 2053 | len += templen; |
2052 | count++; | 2054 | count++; |
2053 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + | 2055 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
2054 | sizeof(templen)); | 2056 | sizeof(templen)); |
2057 | /* | ||
2058 | * Send extended attributes ( FOS 7.1 support ) | ||
2059 | */ | ||
2060 | if (fdmi->retry_cnt == 0) { | ||
2061 | attr = (struct fdmi_attr_s *) curr_ptr; | ||
2062 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_NODE_SYM_NAME); | ||
2063 | templen = sizeof(fcs_hba_attr->node_sym_name); | ||
2064 | memcpy(attr->value, &fcs_hba_attr->node_sym_name, templen); | ||
2065 | templen = fc_roundup(templen, sizeof(u32)); | ||
2066 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; | ||
2067 | len += templen; | ||
2068 | count++; | ||
2069 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + | ||
2070 | sizeof(templen)); | ||
2071 | |||
2072 | attr = (struct fdmi_attr_s *) curr_ptr; | ||
2073 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_VENDOR_ID); | ||
2074 | templen = sizeof(fcs_hba_attr->vendor_info); | ||
2075 | memcpy(attr->value, &fcs_hba_attr->vendor_info, templen); | ||
2076 | templen = fc_roundup(templen, sizeof(u32)); | ||
2077 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; | ||
2078 | len += templen; | ||
2079 | count++; | ||
2080 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + | ||
2081 | sizeof(templen)); | ||
2082 | |||
2083 | attr = (struct fdmi_attr_s *) curr_ptr; | ||
2084 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_NUM_PORTS); | ||
2085 | templen = sizeof(fcs_hba_attr->num_ports); | ||
2086 | memcpy(attr->value, &fcs_hba_attr->num_ports, templen); | ||
2087 | templen = fc_roundup(templen, sizeof(u32)); | ||
2088 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; | ||
2089 | len += templen; | ||
2090 | count++; | ||
2091 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + | ||
2092 | sizeof(templen)); | ||
2093 | |||
2094 | attr = (struct fdmi_attr_s *) curr_ptr; | ||
2095 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_FABRIC_NAME); | ||
2096 | templen = sizeof(fcs_hba_attr->fabric_name); | ||
2097 | memcpy(attr->value, &fcs_hba_attr->fabric_name, templen); | ||
2098 | templen = fc_roundup(templen, sizeof(u32)); | ||
2099 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; | ||
2100 | len += templen; | ||
2101 | count++; | ||
2102 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + | ||
2103 | sizeof(templen)); | ||
2104 | |||
2105 | attr = (struct fdmi_attr_s *) curr_ptr; | ||
2106 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_BIOS_VER); | ||
2107 | templen = sizeof(fcs_hba_attr->bios_ver); | ||
2108 | memcpy(attr->value, &fcs_hba_attr->bios_ver, templen); | ||
2109 | templen = fc_roundup(attr->len, sizeof(u32)); | ||
2110 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; | ||
2111 | len += templen; | ||
2112 | count++; | ||
2113 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + | ||
2114 | sizeof(templen)); | ||
2115 | } | ||
2055 | 2116 | ||
2056 | /* | 2117 | /* |
2057 | * Update size of payload | 2118 | * Update size of payload |
@@ -2252,6 +2313,113 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
2252 | sizeof(templen)); | 2313 | sizeof(templen)); |
2253 | } | 2314 | } |
2254 | 2315 | ||
2316 | if (fdmi->retry_cnt == 0) { | ||
2317 | attr = (struct fdmi_attr_s *) curr_ptr; | ||
2318 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_NODE_NAME); | ||
2319 | templen = sizeof(fcs_port_attr.node_name); | ||
2320 | memcpy(attr->value, &fcs_port_attr.node_name, templen); | ||
2321 | templen = fc_roundup(templen, sizeof(u32)); | ||
2322 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; | ||
2323 | len += templen; | ||
2324 | ++count; | ||
2325 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + | ||
2326 | sizeof(templen)); | ||
2327 | |||
2328 | attr = (struct fdmi_attr_s *) curr_ptr; | ||
2329 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_NAME); | ||
2330 | templen = sizeof(fcs_port_attr.port_name); | ||
2331 | memcpy(attr->value, &fcs_port_attr.port_name, templen); | ||
2332 | templen = fc_roundup(templen, sizeof(u32)); | ||
2333 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + templen; | ||
2334 | len += templen; | ||
2335 | ++count; | ||
2336 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + | ||
2337 | sizeof(templen)); | ||
2338 | |||
2339 | if (fcs_port_attr.port_sym_name.symname[0] != '\0') { | ||
2340 | attr = (struct fdmi_attr_s *) curr_ptr; | ||
2341 | attr->type = | ||
2342 | cpu_to_be16(FDMI_PORT_ATTRIB_PORT_SYM_NAME); | ||
2343 | templen = sizeof(fcs_port_attr.port_sym_name); | ||
2344 | memcpy(attr->value, | ||
2345 | &fcs_port_attr.port_sym_name, templen); | ||
2346 | templen = fc_roundup(templen, sizeof(u32)); | ||
2347 | curr_ptr += sizeof(attr->type) + | ||
2348 | sizeof(templen) + templen; | ||
2349 | len += templen; | ||
2350 | ++count; | ||
2351 | attr->len = cpu_to_be16(templen + | ||
2352 | sizeof(attr->type) + sizeof(templen)); | ||
2353 | } | ||
2354 | |||
2355 | attr = (struct fdmi_attr_s *) curr_ptr; | ||
2356 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_TYPE); | ||
2357 | templen = sizeof(fcs_port_attr.port_type); | ||
2358 | memcpy(attr->value, &fcs_port_attr.port_type, templen); | ||
2359 | templen = fc_roundup(templen, sizeof(u32)); | ||
2360 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; | ||
2361 | len += templen; | ||
2362 | ++count; | ||
2363 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + | ||
2364 | sizeof(templen)); | ||
2365 | |||
2366 | attr = (struct fdmi_attr_s *) curr_ptr; | ||
2367 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_SUPP_COS); | ||
2368 | templen = sizeof(fcs_port_attr.scos); | ||
2369 | memcpy(attr->value, &fcs_port_attr.scos, templen); | ||
2370 | templen = fc_roundup(templen, sizeof(u32)); | ||
2371 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; | ||
2372 | len += templen; | ||
2373 | ++count; | ||
2374 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + | ||
2375 | sizeof(templen)); | ||
2376 | |||
2377 | attr = (struct fdmi_attr_s *) curr_ptr; | ||
2378 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_FAB_NAME); | ||
2379 | templen = sizeof(fcs_port_attr.port_fabric_name); | ||
2380 | memcpy(attr->value, &fcs_port_attr.port_fabric_name, templen); | ||
2381 | templen = fc_roundup(templen, sizeof(u32)); | ||
2382 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; | ||
2383 | len += templen; | ||
2384 | ++count; | ||
2385 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + | ||
2386 | sizeof(templen)); | ||
2387 | |||
2388 | attr = (struct fdmi_attr_s *) curr_ptr; | ||
2389 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_FC4_TYPE); | ||
2390 | templen = sizeof(fcs_port_attr.port_act_fc4_type); | ||
2391 | memcpy(attr->value, fcs_port_attr.port_act_fc4_type, | ||
2392 | templen); | ||
2393 | templen = fc_roundup(templen, sizeof(u32)); | ||
2394 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; | ||
2395 | len += templen; | ||
2396 | ++count; | ||
2397 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + | ||
2398 | sizeof(templen)); | ||
2399 | |||
2400 | attr = (struct fdmi_attr_s *) curr_ptr; | ||
2401 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_STATE); | ||
2402 | templen = sizeof(fcs_port_attr.port_state); | ||
2403 | memcpy(attr->value, &fcs_port_attr.port_state, templen); | ||
2404 | templen = fc_roundup(templen, sizeof(u32)); | ||
2405 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; | ||
2406 | len += templen; | ||
2407 | ++count; | ||
2408 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + | ||
2409 | sizeof(templen)); | ||
2410 | |||
2411 | attr = (struct fdmi_attr_s *) curr_ptr; | ||
2412 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_NUM_RPRT); | ||
2413 | templen = sizeof(fcs_port_attr.num_ports); | ||
2414 | memcpy(attr->value, &fcs_port_attr.num_ports, templen); | ||
2415 | templen = fc_roundup(templen, sizeof(u32)); | ||
2416 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; | ||
2417 | len += templen; | ||
2418 | ++count; | ||
2419 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + | ||
2420 | sizeof(templen)); | ||
2421 | } | ||
2422 | |||
2255 | /* | 2423 | /* |
2256 | * Update size of payload | 2424 | * Update size of payload |
2257 | */ | 2425 | */ |
@@ -2458,6 +2626,15 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
2458 | /* Retrieve the max frame size from the port attr */ | 2626 | /* Retrieve the max frame size from the port attr */ |
2459 | bfa_fcs_fdmi_get_portattr(fdmi, &fcs_port_attr); | 2627 | bfa_fcs_fdmi_get_portattr(fdmi, &fcs_port_attr); |
2460 | hba_attr->max_ct_pyld = fcs_port_attr.max_frm_size; | 2628 | hba_attr->max_ct_pyld = fcs_port_attr.max_frm_size; |
2629 | |||
2630 | strncpy(hba_attr->node_sym_name.symname, | ||
2631 | port->port_cfg.node_sym_name.symname, BFA_SYMNAME_MAXLEN); | ||
2632 | strcpy(hba_attr->vendor_info, "BROCADE"); | ||
2633 | hba_attr->num_ports = | ||
2634 | cpu_to_be32(bfa_ioc_get_nports(&port->fcs->bfa->ioc)); | ||
2635 | hba_attr->fabric_name = port->fabric->lps->pr_nwwn; | ||
2636 | strncpy(hba_attr->bios_ver, hba_attr->option_rom_ver, BFA_VERSION_LEN); | ||
2637 | |||
2461 | } | 2638 | } |
2462 | 2639 | ||
2463 | static void | 2640 | static void |
@@ -2467,6 +2644,7 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
2467 | struct bfa_fcs_lport_s *port = fdmi->ms->port; | 2644 | struct bfa_fcs_lport_s *port = fdmi->ms->port; |
2468 | struct bfa_fcs_driver_info_s *driver_info = &port->fcs->driver_info; | 2645 | struct bfa_fcs_driver_info_s *driver_info = &port->fcs->driver_info; |
2469 | struct bfa_port_attr_s pport_attr; | 2646 | struct bfa_port_attr_s pport_attr; |
2647 | struct bfa_lport_attr_s lport_attr; | ||
2470 | 2648 | ||
2471 | memset(port_attr, 0, sizeof(struct bfa_fcs_fdmi_port_attr_s)); | 2649 | memset(port_attr, 0, sizeof(struct bfa_fcs_fdmi_port_attr_s)); |
2472 | 2650 | ||
@@ -2531,6 +2709,18 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
2531 | strncpy(port_attr->host_name, (char *)driver_info->host_machine_name, | 2709 | strncpy(port_attr->host_name, (char *)driver_info->host_machine_name, |
2532 | sizeof(port_attr->host_name)); | 2710 | sizeof(port_attr->host_name)); |
2533 | 2711 | ||
2712 | port_attr->node_name = bfa_fcs_lport_get_nwwn(port); | ||
2713 | port_attr->port_name = bfa_fcs_lport_get_pwwn(port); | ||
2714 | |||
2715 | strncpy(port_attr->port_sym_name.symname, | ||
2716 | (char *)&bfa_fcs_lport_get_psym_name(port), BFA_SYMNAME_MAXLEN); | ||
2717 | bfa_fcs_lport_get_attr(port, &lport_attr); | ||
2718 | port_attr->port_type = cpu_to_be32(lport_attr.port_type); | ||
2719 | port_attr->scos = pport_attr.cos_supported; | ||
2720 | port_attr->port_fabric_name = port->fabric->lps->pr_nwwn; | ||
2721 | fc_get_fc4type_bitmask(FC_TYPE_FCP, port_attr->port_act_fc4_type); | ||
2722 | port_attr->port_state = cpu_to_be32(pport_attr.port_state); | ||
2723 | port_attr->num_ports = cpu_to_be32(port->num_rports); | ||
2534 | } | 2724 | } |
2535 | 2725 | ||
2536 | /* | 2726 | /* |
@@ -5798,6 +5988,7 @@ enum bfa_fcs_vport_event { | |||
5798 | BFA_FCS_VPORT_SM_RSP_DUP_WWN = 12, /* Dup wnn error*/ | 5988 | BFA_FCS_VPORT_SM_RSP_DUP_WWN = 12, /* Dup wnn error*/ |
5799 | BFA_FCS_VPORT_SM_RSP_FAILED = 13, /* non-retryable failure */ | 5989 | BFA_FCS_VPORT_SM_RSP_FAILED = 13, /* non-retryable failure */ |
5800 | BFA_FCS_VPORT_SM_STOPCOMP = 14, /* vport delete completion */ | 5990 | BFA_FCS_VPORT_SM_STOPCOMP = 14, /* vport delete completion */ |
5991 | BFA_FCS_VPORT_SM_FABRIC_MAX = 15, /* max vports on fabric */ | ||
5801 | }; | 5992 | }; |
5802 | 5993 | ||
5803 | static void bfa_fcs_vport_sm_uninit(struct bfa_fcs_vport_s *vport, | 5994 | static void bfa_fcs_vport_sm_uninit(struct bfa_fcs_vport_s *vport, |
@@ -5983,6 +6174,7 @@ bfa_fcs_vport_sm_fdisc(struct bfa_fcs_vport_s *vport, | |||
5983 | break; | 6174 | break; |
5984 | 6175 | ||
5985 | case BFA_FCS_VPORT_SM_RSP_FAILED: | 6176 | case BFA_FCS_VPORT_SM_RSP_FAILED: |
6177 | case BFA_FCS_VPORT_SM_FABRIC_MAX: | ||
5986 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_offline); | 6178 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_offline); |
5987 | break; | 6179 | break; |
5988 | 6180 | ||
@@ -6053,6 +6245,7 @@ bfa_fcs_vport_sm_fdisc_rsp_wait(struct bfa_fcs_vport_s *vport, | |||
6053 | case BFA_FCS_VPORT_SM_OFFLINE: | 6245 | case BFA_FCS_VPORT_SM_OFFLINE: |
6054 | case BFA_FCS_VPORT_SM_RSP_ERROR: | 6246 | case BFA_FCS_VPORT_SM_RSP_ERROR: |
6055 | case BFA_FCS_VPORT_SM_RSP_FAILED: | 6247 | case BFA_FCS_VPORT_SM_RSP_FAILED: |
6248 | case BFA_FCS_VPORT_SM_FABRIC_MAX: | ||
6056 | case BFA_FCS_VPORT_SM_RSP_DUP_WWN: | 6249 | case BFA_FCS_VPORT_SM_RSP_DUP_WWN: |
6057 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_cleanup); | 6250 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_cleanup); |
6058 | bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE); | 6251 | bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE); |
@@ -6338,7 +6531,7 @@ bfa_fcs_vport_fdisc_rejected(struct bfa_fcs_vport_s *vport) | |||
6338 | else { | 6531 | else { |
6339 | bfa_fcs_vport_aen_post(&vport->lport, | 6532 | bfa_fcs_vport_aen_post(&vport->lport, |
6340 | BFA_LPORT_AEN_NPIV_FABRIC_MAX); | 6533 | BFA_LPORT_AEN_NPIV_FABRIC_MAX); |
6341 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_FAILED); | 6534 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_FABRIC_MAX); |
6342 | } | 6535 | } |
6343 | break; | 6536 | break; |
6344 | 6537 | ||
@@ -6724,7 +6917,19 @@ bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status) | |||
6724 | break; | 6917 | break; |
6725 | } | 6918 | } |
6726 | 6919 | ||
6727 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_ERROR); | 6920 | if (vport->fdisc_retries < BFA_FCS_VPORT_MAX_RETRIES) |
6921 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_ERROR); | ||
6922 | else | ||
6923 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_FAILED); | ||
6924 | |||
6925 | break; | ||
6926 | |||
6927 | case BFA_STATUS_ETIMER: | ||
6928 | vport->vport_stats.fdisc_timeouts++; | ||
6929 | if (vport->fdisc_retries < BFA_FCS_VPORT_MAX_RETRIES) | ||
6930 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_ERROR); | ||
6931 | else | ||
6932 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_FAILED); | ||
6728 | break; | 6933 | break; |
6729 | 6934 | ||
6730 | case BFA_STATUS_FABRIC_RJT: | 6935 | case BFA_STATUS_FABRIC_RJT: |
diff --git a/drivers/scsi/bfa/bfa_fcs_rport.c b/drivers/scsi/bfa/bfa_fcs_rport.c index 58ac643ba9f3..2035b0d64351 100644 --- a/drivers/scsi/bfa/bfa_fcs_rport.c +++ b/drivers/scsi/bfa/bfa_fcs_rport.c | |||
@@ -189,8 +189,8 @@ bfa_fcs_rport_sm_uninit(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
189 | break; | 189 | break; |
190 | 190 | ||
191 | case RPSM_EVENT_PLOGI_RCVD: | 191 | case RPSM_EVENT_PLOGI_RCVD: |
192 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online); | 192 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending); |
193 | bfa_fcs_rport_fcs_online_action(rport); | 193 | bfa_fcs_rport_send_plogiacc(rport, NULL); |
194 | break; | 194 | break; |
195 | 195 | ||
196 | case RPSM_EVENT_PLOGI_COMP: | 196 | case RPSM_EVENT_PLOGI_COMP: |
@@ -2577,7 +2577,7 @@ bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport, struct fc_logi_s *plogi) | |||
2577 | 2577 | ||
2578 | port->fabric->bb_credit = be16_to_cpu(plogi->csp.bbcred); | 2578 | port->fabric->bb_credit = be16_to_cpu(plogi->csp.bbcred); |
2579 | bfa_fcport_set_tx_bbcredit(port->fcs->bfa, | 2579 | bfa_fcport_set_tx_bbcredit(port->fcs->bfa, |
2580 | port->fabric->bb_credit, 0); | 2580 | port->fabric->bb_credit); |
2581 | } | 2581 | } |
2582 | 2582 | ||
2583 | } | 2583 | } |
@@ -3430,9 +3430,10 @@ bfa_fcs_rpf_rpsc2_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg, | |||
3430 | num_ents = be16_to_cpu(rpsc2_acc->num_pids); | 3430 | num_ents = be16_to_cpu(rpsc2_acc->num_pids); |
3431 | bfa_trc(rport->fcs, num_ents); | 3431 | bfa_trc(rport->fcs, num_ents); |
3432 | if (num_ents > 0) { | 3432 | if (num_ents > 0) { |
3433 | WARN_ON(rpsc2_acc->port_info[0].pid == rport->pid); | 3433 | WARN_ON(be32_to_cpu(rpsc2_acc->port_info[0].pid) != |
3434 | bfa_ntoh3b(rport->pid)); | ||
3434 | bfa_trc(rport->fcs, | 3435 | bfa_trc(rport->fcs, |
3435 | be16_to_cpu(rpsc2_acc->port_info[0].pid)); | 3436 | be32_to_cpu(rpsc2_acc->port_info[0].pid)); |
3436 | bfa_trc(rport->fcs, | 3437 | bfa_trc(rport->fcs, |
3437 | be16_to_cpu(rpsc2_acc->port_info[0].speed)); | 3438 | be16_to_cpu(rpsc2_acc->port_info[0].speed)); |
3438 | bfa_trc(rport->fcs, | 3439 | bfa_trc(rport->fcs, |
diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index 0116c1032e25..f78bcb6696b2 100644 --- a/drivers/scsi/bfa/bfa_ioc.c +++ b/drivers/scsi/bfa/bfa_ioc.c | |||
@@ -67,6 +67,14 @@ BFA_TRC_FILE(CNA, IOC); | |||
67 | ((__ioc)->ioc_hwif->ioc_sync_ack(__ioc)) | 67 | ((__ioc)->ioc_hwif->ioc_sync_ack(__ioc)) |
68 | #define bfa_ioc_sync_complete(__ioc) \ | 68 | #define bfa_ioc_sync_complete(__ioc) \ |
69 | ((__ioc)->ioc_hwif->ioc_sync_complete(__ioc)) | 69 | ((__ioc)->ioc_hwif->ioc_sync_complete(__ioc)) |
70 | #define bfa_ioc_set_cur_ioc_fwstate(__ioc, __fwstate) \ | ||
71 | ((__ioc)->ioc_hwif->ioc_set_fwstate(__ioc, __fwstate)) | ||
72 | #define bfa_ioc_get_cur_ioc_fwstate(__ioc) \ | ||
73 | ((__ioc)->ioc_hwif->ioc_get_fwstate(__ioc)) | ||
74 | #define bfa_ioc_set_alt_ioc_fwstate(__ioc, __fwstate) \ | ||
75 | ((__ioc)->ioc_hwif->ioc_set_alt_fwstate(__ioc, __fwstate)) | ||
76 | #define bfa_ioc_get_alt_ioc_fwstate(__ioc) \ | ||
77 | ((__ioc)->ioc_hwif->ioc_get_alt_fwstate(__ioc)) | ||
70 | 78 | ||
71 | #define bfa_ioc_mbox_cmd_pending(__ioc) \ | 79 | #define bfa_ioc_mbox_cmd_pending(__ioc) \ |
72 | (!list_empty(&((__ioc)->mbox_mod.cmd_q)) || \ | 80 | (!list_empty(&((__ioc)->mbox_mod.cmd_q)) || \ |
@@ -698,7 +706,7 @@ bfa_iocpf_sm_fwcheck_entry(struct bfa_iocpf_s *iocpf) | |||
698 | } | 706 | } |
699 | 707 | ||
700 | /* h/w sem init */ | 708 | /* h/w sem init */ |
701 | fwstate = readl(iocpf->ioc->ioc_regs.ioc_fwstate); | 709 | fwstate = bfa_ioc_get_cur_ioc_fwstate(iocpf->ioc); |
702 | if (fwstate == BFI_IOC_UNINIT) { | 710 | if (fwstate == BFI_IOC_UNINIT) { |
703 | writel(1, iocpf->ioc->ioc_regs.ioc_init_sem_reg); | 711 | writel(1, iocpf->ioc->ioc_regs.ioc_init_sem_reg); |
704 | goto sem_get; | 712 | goto sem_get; |
@@ -725,8 +733,8 @@ bfa_iocpf_sm_fwcheck_entry(struct bfa_iocpf_s *iocpf) | |||
725 | 733 | ||
726 | bfa_trc(iocpf->ioc, fwstate); | 734 | bfa_trc(iocpf->ioc, fwstate); |
727 | bfa_trc(iocpf->ioc, swab32(fwhdr.exec)); | 735 | bfa_trc(iocpf->ioc, swab32(fwhdr.exec)); |
728 | writel(BFI_IOC_UNINIT, iocpf->ioc->ioc_regs.ioc_fwstate); | 736 | bfa_ioc_set_cur_ioc_fwstate(iocpf->ioc, BFI_IOC_UNINIT); |
729 | writel(BFI_IOC_UNINIT, iocpf->ioc->ioc_regs.alt_ioc_fwstate); | 737 | bfa_ioc_set_alt_ioc_fwstate(iocpf->ioc, BFI_IOC_UNINIT); |
730 | 738 | ||
731 | /* | 739 | /* |
732 | * Unlock the hw semaphore. Should be here only once per boot. | 740 | * Unlock the hw semaphore. Should be here only once per boot. |
@@ -1037,7 +1045,7 @@ bfa_iocpf_sm_disabling(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
1037 | */ | 1045 | */ |
1038 | 1046 | ||
1039 | case IOCPF_E_TIMEOUT: | 1047 | case IOCPF_E_TIMEOUT: |
1040 | writel(BFI_IOC_FAIL, ioc->ioc_regs.ioc_fwstate); | 1048 | bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_FAIL); |
1041 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabling_sync); | 1049 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabling_sync); |
1042 | break; | 1050 | break; |
1043 | 1051 | ||
@@ -1138,7 +1146,7 @@ bfa_iocpf_sm_initfail_sync(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
1138 | case IOCPF_E_SEMLOCKED: | 1146 | case IOCPF_E_SEMLOCKED: |
1139 | bfa_ioc_notify_fail(ioc); | 1147 | bfa_ioc_notify_fail(ioc); |
1140 | bfa_ioc_sync_leave(ioc); | 1148 | bfa_ioc_sync_leave(ioc); |
1141 | writel(BFI_IOC_FAIL, ioc->ioc_regs.ioc_fwstate); | 1149 | bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_FAIL); |
1142 | writel(1, ioc->ioc_regs.ioc_sem_reg); | 1150 | writel(1, ioc->ioc_regs.ioc_sem_reg); |
1143 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_initfail); | 1151 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_initfail); |
1144 | break; | 1152 | break; |
@@ -1227,7 +1235,7 @@ bfa_iocpf_sm_fail_sync(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
1227 | bfa_ioc_notify_fail(ioc); | 1235 | bfa_ioc_notify_fail(ioc); |
1228 | if (!iocpf->auto_recover) { | 1236 | if (!iocpf->auto_recover) { |
1229 | bfa_ioc_sync_leave(ioc); | 1237 | bfa_ioc_sync_leave(ioc); |
1230 | writel(BFI_IOC_FAIL, ioc->ioc_regs.ioc_fwstate); | 1238 | bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_FAIL); |
1231 | writel(1, ioc->ioc_regs.ioc_sem_reg); | 1239 | writel(1, ioc->ioc_regs.ioc_sem_reg); |
1232 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_fail); | 1240 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_fail); |
1233 | } else { | 1241 | } else { |
@@ -1519,7 +1527,7 @@ bfa_ioc_hwinit(struct bfa_ioc_s *ioc, bfa_boolean_t force) | |||
1519 | u32 boot_type; | 1527 | u32 boot_type; |
1520 | u32 boot_env; | 1528 | u32 boot_env; |
1521 | 1529 | ||
1522 | ioc_fwstate = readl(ioc->ioc_regs.ioc_fwstate); | 1530 | ioc_fwstate = bfa_ioc_get_cur_ioc_fwstate(ioc); |
1523 | 1531 | ||
1524 | if (force) | 1532 | if (force) |
1525 | ioc_fwstate = BFI_IOC_UNINIT; | 1533 | ioc_fwstate = BFI_IOC_UNINIT; |
@@ -1850,7 +1858,7 @@ bfa_ioc_smem_read(struct bfa_ioc_s *ioc, void *tbuf, u32 soff, u32 sz) | |||
1850 | bfa_trc(ioc, len); | 1858 | bfa_trc(ioc, len); |
1851 | for (i = 0; i < len; i++) { | 1859 | for (i = 0; i < len; i++) { |
1852 | r32 = bfa_mem_read(ioc->ioc_regs.smem_page_start, loff); | 1860 | r32 = bfa_mem_read(ioc->ioc_regs.smem_page_start, loff); |
1853 | buf[i] = be32_to_cpu(r32); | 1861 | buf[i] = swab32(r32); |
1854 | loff += sizeof(u32); | 1862 | loff += sizeof(u32); |
1855 | 1863 | ||
1856 | /* | 1864 | /* |
@@ -2006,11 +2014,11 @@ bfa_ioc_boot(struct bfa_ioc_s *ioc, u32 boot_type, u32 boot_env) | |||
2006 | * Initialize IOC state of all functions on a chip reset. | 2014 | * Initialize IOC state of all functions on a chip reset. |
2007 | */ | 2015 | */ |
2008 | if (boot_type == BFI_FWBOOT_TYPE_MEMTEST) { | 2016 | if (boot_type == BFI_FWBOOT_TYPE_MEMTEST) { |
2009 | writel(BFI_IOC_MEMTEST, ioc->ioc_regs.ioc_fwstate); | 2017 | bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_MEMTEST); |
2010 | writel(BFI_IOC_MEMTEST, ioc->ioc_regs.alt_ioc_fwstate); | 2018 | bfa_ioc_set_alt_ioc_fwstate(ioc, BFI_IOC_MEMTEST); |
2011 | } else { | 2019 | } else { |
2012 | writel(BFI_IOC_INITING, ioc->ioc_regs.ioc_fwstate); | 2020 | bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_INITING); |
2013 | writel(BFI_IOC_INITING, ioc->ioc_regs.alt_ioc_fwstate); | 2021 | bfa_ioc_set_alt_ioc_fwstate(ioc, BFI_IOC_INITING); |
2014 | } | 2022 | } |
2015 | 2023 | ||
2016 | bfa_ioc_msgflush(ioc); | 2024 | bfa_ioc_msgflush(ioc); |
@@ -2038,7 +2046,7 @@ bfa_ioc_is_operational(struct bfa_ioc_s *ioc) | |||
2038 | bfa_boolean_t | 2046 | bfa_boolean_t |
2039 | bfa_ioc_is_initialized(struct bfa_ioc_s *ioc) | 2047 | bfa_ioc_is_initialized(struct bfa_ioc_s *ioc) |
2040 | { | 2048 | { |
2041 | u32 r32 = readl(ioc->ioc_regs.ioc_fwstate); | 2049 | u32 r32 = bfa_ioc_get_cur_ioc_fwstate(ioc); |
2042 | 2050 | ||
2043 | return ((r32 != BFI_IOC_UNINIT) && | 2051 | return ((r32 != BFI_IOC_UNINIT) && |
2044 | (r32 != BFI_IOC_INITING) && | 2052 | (r32 != BFI_IOC_INITING) && |
@@ -2188,6 +2196,7 @@ bfa_ioc_pci_init(struct bfa_ioc_s *ioc, struct bfa_pcidev_s *pcidev, | |||
2188 | break; | 2196 | break; |
2189 | 2197 | ||
2190 | case BFA_PCI_DEVICE_ID_CT2: | 2198 | case BFA_PCI_DEVICE_ID_CT2: |
2199 | case BFA_PCI_DEVICE_ID_CT2_QUAD: | ||
2191 | ioc->asic_gen = BFI_ASIC_GEN_CT2; | 2200 | ioc->asic_gen = BFI_ASIC_GEN_CT2; |
2192 | if (clscode == BFI_PCIFN_CLASS_FC && | 2201 | if (clscode == BFI_PCIFN_CLASS_FC && |
2193 | pcidev->ssid == BFA_PCI_CT2_SSID_FC) { | 2202 | pcidev->ssid == BFA_PCI_CT2_SSID_FC) { |
@@ -2430,12 +2439,12 @@ bfa_ioc_adapter_is_disabled(struct bfa_ioc_s *ioc) | |||
2430 | if (!bfa_fsm_cmp_state(ioc, bfa_ioc_sm_disabled)) | 2439 | if (!bfa_fsm_cmp_state(ioc, bfa_ioc_sm_disabled)) |
2431 | return BFA_FALSE; | 2440 | return BFA_FALSE; |
2432 | 2441 | ||
2433 | ioc_state = readl(ioc->ioc_regs.ioc_fwstate); | 2442 | ioc_state = bfa_ioc_get_cur_ioc_fwstate(ioc); |
2434 | if (!bfa_ioc_state_disabled(ioc_state)) | 2443 | if (!bfa_ioc_state_disabled(ioc_state)) |
2435 | return BFA_FALSE; | 2444 | return BFA_FALSE; |
2436 | 2445 | ||
2437 | if (ioc->pcidev.device_id != BFA_PCI_DEVICE_ID_FC_8G1P) { | 2446 | if (ioc->pcidev.device_id != BFA_PCI_DEVICE_ID_FC_8G1P) { |
2438 | ioc_state = readl(ioc->ioc_regs.alt_ioc_fwstate); | 2447 | ioc_state = bfa_ioc_get_cur_ioc_fwstate(ioc); |
2439 | if (!bfa_ioc_state_disabled(ioc_state)) | 2448 | if (!bfa_ioc_state_disabled(ioc_state)) |
2440 | return BFA_FALSE; | 2449 | return BFA_FALSE; |
2441 | } | 2450 | } |
@@ -2449,8 +2458,8 @@ bfa_ioc_adapter_is_disabled(struct bfa_ioc_s *ioc) | |||
2449 | void | 2458 | void |
2450 | bfa_ioc_reset_fwstate(struct bfa_ioc_s *ioc) | 2459 | bfa_ioc_reset_fwstate(struct bfa_ioc_s *ioc) |
2451 | { | 2460 | { |
2452 | writel(BFI_IOC_UNINIT, ioc->ioc_regs.ioc_fwstate); | 2461 | bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_UNINIT); |
2453 | writel(BFI_IOC_UNINIT, ioc->ioc_regs.alt_ioc_fwstate); | 2462 | bfa_ioc_set_alt_ioc_fwstate(ioc, BFI_IOC_UNINIT); |
2454 | } | 2463 | } |
2455 | 2464 | ||
2456 | #define BFA_MFG_NAME "Brocade" | 2465 | #define BFA_MFG_NAME "Brocade" |
@@ -2500,6 +2509,7 @@ bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc, | |||
2500 | ad_attr->mfg_day = ioc_attr->mfg_day; | 2509 | ad_attr->mfg_day = ioc_attr->mfg_day; |
2501 | ad_attr->mfg_month = ioc_attr->mfg_month; | 2510 | ad_attr->mfg_month = ioc_attr->mfg_month; |
2502 | ad_attr->mfg_year = ioc_attr->mfg_year; | 2511 | ad_attr->mfg_year = ioc_attr->mfg_year; |
2512 | memcpy(ad_attr->uuid, ioc_attr->uuid, BFA_ADAPTER_UUID_LEN); | ||
2503 | } | 2513 | } |
2504 | 2514 | ||
2505 | enum bfa_ioc_type_e | 2515 | enum bfa_ioc_type_e |
@@ -2564,13 +2574,19 @@ void | |||
2564 | bfa_ioc_get_adapter_model(struct bfa_ioc_s *ioc, char *model) | 2574 | bfa_ioc_get_adapter_model(struct bfa_ioc_s *ioc, char *model) |
2565 | { | 2575 | { |
2566 | struct bfi_ioc_attr_s *ioc_attr; | 2576 | struct bfi_ioc_attr_s *ioc_attr; |
2577 | u8 nports = bfa_ioc_get_nports(ioc); | ||
2567 | 2578 | ||
2568 | WARN_ON(!model); | 2579 | WARN_ON(!model); |
2569 | memset((void *)model, 0, BFA_ADAPTER_MODEL_NAME_LEN); | 2580 | memset((void *)model, 0, BFA_ADAPTER_MODEL_NAME_LEN); |
2570 | 2581 | ||
2571 | ioc_attr = ioc->attr; | 2582 | ioc_attr = ioc->attr; |
2572 | 2583 | ||
2573 | snprintf(model, BFA_ADAPTER_MODEL_NAME_LEN, "%s-%u", | 2584 | if (bfa_asic_id_ct2(ioc->pcidev.device_id) && |
2585 | (!bfa_mfg_is_mezz(ioc_attr->card_type))) | ||
2586 | snprintf(model, BFA_ADAPTER_MODEL_NAME_LEN, "%s-%u-%u%s", | ||
2587 | BFA_MFG_NAME, ioc_attr->card_type, nports, "p"); | ||
2588 | else | ||
2589 | snprintf(model, BFA_ADAPTER_MODEL_NAME_LEN, "%s-%u", | ||
2574 | BFA_MFG_NAME, ioc_attr->card_type); | 2590 | BFA_MFG_NAME, ioc_attr->card_type); |
2575 | } | 2591 | } |
2576 | 2592 | ||
@@ -2620,7 +2636,7 @@ bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr) | |||
2620 | memset((void *)ioc_attr, 0, sizeof(struct bfa_ioc_attr_s)); | 2636 | memset((void *)ioc_attr, 0, sizeof(struct bfa_ioc_attr_s)); |
2621 | 2637 | ||
2622 | ioc_attr->state = bfa_ioc_get_state(ioc); | 2638 | ioc_attr->state = bfa_ioc_get_state(ioc); |
2623 | ioc_attr->port_id = ioc->port_id; | 2639 | ioc_attr->port_id = bfa_ioc_portid(ioc); |
2624 | ioc_attr->port_mode = ioc->port_mode; | 2640 | ioc_attr->port_mode = ioc->port_mode; |
2625 | ioc_attr->port_mode_cfg = ioc->port_mode_cfg; | 2641 | ioc_attr->port_mode_cfg = ioc->port_mode_cfg; |
2626 | ioc_attr->cap_bm = ioc->ad_cap_bm; | 2642 | ioc_attr->cap_bm = ioc->ad_cap_bm; |
@@ -2629,8 +2645,9 @@ bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr) | |||
2629 | 2645 | ||
2630 | bfa_ioc_get_adapter_attr(ioc, &ioc_attr->adapter_attr); | 2646 | bfa_ioc_get_adapter_attr(ioc, &ioc_attr->adapter_attr); |
2631 | 2647 | ||
2632 | ioc_attr->pci_attr.device_id = ioc->pcidev.device_id; | 2648 | ioc_attr->pci_attr.device_id = bfa_ioc_devid(ioc); |
2633 | ioc_attr->pci_attr.pcifn = ioc->pcidev.pci_func; | 2649 | ioc_attr->pci_attr.pcifn = bfa_ioc_pcifn(ioc); |
2650 | ioc_attr->def_fn = (bfa_ioc_pcifn(ioc) == bfa_ioc_portid(ioc)); | ||
2634 | bfa_ioc_get_pci_chip_rev(ioc, ioc_attr->pci_attr.chip_rev); | 2651 | bfa_ioc_get_pci_chip_rev(ioc, ioc_attr->pci_attr.chip_rev); |
2635 | } | 2652 | } |
2636 | 2653 | ||
@@ -2917,7 +2934,7 @@ bfa_iocpf_sem_timeout(void *ioc_arg) | |||
2917 | static void | 2934 | static void |
2918 | bfa_ioc_poll_fwinit(struct bfa_ioc_s *ioc) | 2935 | bfa_ioc_poll_fwinit(struct bfa_ioc_s *ioc) |
2919 | { | 2936 | { |
2920 | u32 fwstate = readl(ioc->ioc_regs.ioc_fwstate); | 2937 | u32 fwstate = bfa_ioc_get_cur_ioc_fwstate(ioc); |
2921 | 2938 | ||
2922 | bfa_trc(ioc, fwstate); | 2939 | bfa_trc(ioc, fwstate); |
2923 | 2940 | ||
@@ -6010,6 +6027,7 @@ bfa_fru_write_send(void *cbarg, enum bfi_fru_h2i_msgs msg_type) | |||
6010 | */ | 6027 | */ |
6011 | msg->last = (len == fru->residue) ? 1 : 0; | 6028 | msg->last = (len == fru->residue) ? 1 : 0; |
6012 | 6029 | ||
6030 | msg->trfr_cmpl = (len == fru->residue) ? fru->trfr_cmpl : 0; | ||
6013 | bfi_h2i_set(msg->mh, BFI_MC_FRU, msg_type, bfa_ioc_portid(fru->ioc)); | 6031 | bfi_h2i_set(msg->mh, BFI_MC_FRU, msg_type, bfa_ioc_portid(fru->ioc)); |
6014 | bfa_alen_set(&msg->alen, len, fru->dbuf_pa); | 6032 | bfa_alen_set(&msg->alen, len, fru->dbuf_pa); |
6015 | 6033 | ||
@@ -6124,13 +6142,14 @@ bfa_fru_memclaim(struct bfa_fru_s *fru, u8 *dm_kva, u64 dm_pa, | |||
6124 | */ | 6142 | */ |
6125 | bfa_status_t | 6143 | bfa_status_t |
6126 | bfa_fruvpd_update(struct bfa_fru_s *fru, void *buf, u32 len, u32 offset, | 6144 | bfa_fruvpd_update(struct bfa_fru_s *fru, void *buf, u32 len, u32 offset, |
6127 | bfa_cb_fru_t cbfn, void *cbarg) | 6145 | bfa_cb_fru_t cbfn, void *cbarg, u8 trfr_cmpl) |
6128 | { | 6146 | { |
6129 | bfa_trc(fru, BFI_FRUVPD_H2I_WRITE_REQ); | 6147 | bfa_trc(fru, BFI_FRUVPD_H2I_WRITE_REQ); |
6130 | bfa_trc(fru, len); | 6148 | bfa_trc(fru, len); |
6131 | bfa_trc(fru, offset); | 6149 | bfa_trc(fru, offset); |
6132 | 6150 | ||
6133 | if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) | 6151 | if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2 && |
6152 | fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK2) | ||
6134 | return BFA_STATUS_FRU_NOT_PRESENT; | 6153 | return BFA_STATUS_FRU_NOT_PRESENT; |
6135 | 6154 | ||
6136 | if (fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK) | 6155 | if (fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK) |
@@ -6152,6 +6171,7 @@ bfa_fruvpd_update(struct bfa_fru_s *fru, void *buf, u32 len, u32 offset, | |||
6152 | fru->offset = 0; | 6171 | fru->offset = 0; |
6153 | fru->addr_off = offset; | 6172 | fru->addr_off = offset; |
6154 | fru->ubuf = buf; | 6173 | fru->ubuf = buf; |
6174 | fru->trfr_cmpl = trfr_cmpl; | ||
6155 | 6175 | ||
6156 | bfa_fru_write_send(fru, BFI_FRUVPD_H2I_WRITE_REQ); | 6176 | bfa_fru_write_send(fru, BFI_FRUVPD_H2I_WRITE_REQ); |
6157 | 6177 | ||
@@ -6181,7 +6201,8 @@ bfa_fruvpd_read(struct bfa_fru_s *fru, void *buf, u32 len, u32 offset, | |||
6181 | if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) | 6201 | if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) |
6182 | return BFA_STATUS_FRU_NOT_PRESENT; | 6202 | return BFA_STATUS_FRU_NOT_PRESENT; |
6183 | 6203 | ||
6184 | if (fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK) | 6204 | if (fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK && |
6205 | fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK2) | ||
6185 | return BFA_STATUS_CMD_NOTSUPP; | 6206 | return BFA_STATUS_CMD_NOTSUPP; |
6186 | 6207 | ||
6187 | if (!bfa_ioc_is_operational(fru->ioc)) | 6208 | if (!bfa_ioc_is_operational(fru->ioc)) |
@@ -6222,7 +6243,8 @@ bfa_fruvpd_get_max_size(struct bfa_fru_s *fru, u32 *max_size) | |||
6222 | if (!bfa_ioc_is_operational(fru->ioc)) | 6243 | if (!bfa_ioc_is_operational(fru->ioc)) |
6223 | return BFA_STATUS_IOC_NON_OP; | 6244 | return BFA_STATUS_IOC_NON_OP; |
6224 | 6245 | ||
6225 | if (fru->ioc->attr->card_type == BFA_MFG_TYPE_CHINOOK) | 6246 | if (fru->ioc->attr->card_type == BFA_MFG_TYPE_CHINOOK || |
6247 | fru->ioc->attr->card_type == BFA_MFG_TYPE_CHINOOK2) | ||
6226 | *max_size = BFA_FRU_CHINOOK_MAX_SIZE; | 6248 | *max_size = BFA_FRU_CHINOOK_MAX_SIZE; |
6227 | else | 6249 | else |
6228 | return BFA_STATUS_CMD_NOTSUPP; | 6250 | return BFA_STATUS_CMD_NOTSUPP; |
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h index 23a90e7b7107..90814fe85ac1 100644 --- a/drivers/scsi/bfa/bfa_ioc.h +++ b/drivers/scsi/bfa/bfa_ioc.h | |||
@@ -346,6 +346,12 @@ struct bfa_ioc_hwif_s { | |||
346 | void (*ioc_sync_ack) (struct bfa_ioc_s *ioc); | 346 | void (*ioc_sync_ack) (struct bfa_ioc_s *ioc); |
347 | bfa_boolean_t (*ioc_sync_complete) (struct bfa_ioc_s *ioc); | 347 | bfa_boolean_t (*ioc_sync_complete) (struct bfa_ioc_s *ioc); |
348 | bfa_boolean_t (*ioc_lpu_read_stat) (struct bfa_ioc_s *ioc); | 348 | bfa_boolean_t (*ioc_lpu_read_stat) (struct bfa_ioc_s *ioc); |
349 | void (*ioc_set_fwstate) (struct bfa_ioc_s *ioc, | ||
350 | enum bfi_ioc_state fwstate); | ||
351 | enum bfi_ioc_state (*ioc_get_fwstate) (struct bfa_ioc_s *ioc); | ||
352 | void (*ioc_set_alt_fwstate) (struct bfa_ioc_s *ioc, | ||
353 | enum bfi_ioc_state fwstate); | ||
354 | enum bfi_ioc_state (*ioc_get_alt_fwstate) (struct bfa_ioc_s *ioc); | ||
349 | }; | 355 | }; |
350 | 356 | ||
351 | /* | 357 | /* |
@@ -725,6 +731,7 @@ struct bfa_fru_s { | |||
725 | struct bfa_mbox_cmd_s mb; /* mailbox */ | 731 | struct bfa_mbox_cmd_s mb; /* mailbox */ |
726 | struct bfa_ioc_notify_s ioc_notify; /* ioc event notify */ | 732 | struct bfa_ioc_notify_s ioc_notify; /* ioc event notify */ |
727 | struct bfa_mem_dma_s fru_dma; | 733 | struct bfa_mem_dma_s fru_dma; |
734 | u8 trfr_cmpl; | ||
728 | }; | 735 | }; |
729 | 736 | ||
730 | #define BFA_FRU(__bfa) (&(__bfa)->modules.fru) | 737 | #define BFA_FRU(__bfa) (&(__bfa)->modules.fru) |
@@ -732,7 +739,7 @@ struct bfa_fru_s { | |||
732 | 739 | ||
733 | bfa_status_t bfa_fruvpd_update(struct bfa_fru_s *fru, | 740 | bfa_status_t bfa_fruvpd_update(struct bfa_fru_s *fru, |
734 | void *buf, u32 len, u32 offset, | 741 | void *buf, u32 len, u32 offset, |
735 | bfa_cb_fru_t cbfn, void *cbarg); | 742 | bfa_cb_fru_t cbfn, void *cbarg, u8 trfr_cmpl); |
736 | bfa_status_t bfa_fruvpd_read(struct bfa_fru_s *fru, | 743 | bfa_status_t bfa_fruvpd_read(struct bfa_fru_s *fru, |
737 | void *buf, u32 len, u32 offset, | 744 | void *buf, u32 len, u32 offset, |
738 | bfa_cb_fru_t cbfn, void *cbarg); | 745 | bfa_cb_fru_t cbfn, void *cbarg); |
diff --git a/drivers/scsi/bfa/bfa_ioc_cb.c b/drivers/scsi/bfa/bfa_ioc_cb.c index 30df8a284715..e3b928746674 100644 --- a/drivers/scsi/bfa/bfa_ioc_cb.c +++ b/drivers/scsi/bfa/bfa_ioc_cb.c | |||
@@ -22,6 +22,8 @@ | |||
22 | 22 | ||
23 | BFA_TRC_FILE(CNA, IOC_CB); | 23 | BFA_TRC_FILE(CNA, IOC_CB); |
24 | 24 | ||
25 | #define bfa_ioc_cb_join_pos(__ioc) ((u32) (1 << BFA_IOC_CB_JOIN_SH)) | ||
26 | |||
25 | /* | 27 | /* |
26 | * forward declarations | 28 | * forward declarations |
27 | */ | 29 | */ |
@@ -37,6 +39,12 @@ static void bfa_ioc_cb_sync_join(struct bfa_ioc_s *ioc); | |||
37 | static void bfa_ioc_cb_sync_leave(struct bfa_ioc_s *ioc); | 39 | static void bfa_ioc_cb_sync_leave(struct bfa_ioc_s *ioc); |
38 | static void bfa_ioc_cb_sync_ack(struct bfa_ioc_s *ioc); | 40 | static void bfa_ioc_cb_sync_ack(struct bfa_ioc_s *ioc); |
39 | static bfa_boolean_t bfa_ioc_cb_sync_complete(struct bfa_ioc_s *ioc); | 41 | static bfa_boolean_t bfa_ioc_cb_sync_complete(struct bfa_ioc_s *ioc); |
42 | static void bfa_ioc_cb_set_cur_ioc_fwstate( | ||
43 | struct bfa_ioc_s *ioc, enum bfi_ioc_state fwstate); | ||
44 | static enum bfi_ioc_state bfa_ioc_cb_get_cur_ioc_fwstate(struct bfa_ioc_s *ioc); | ||
45 | static void bfa_ioc_cb_set_alt_ioc_fwstate( | ||
46 | struct bfa_ioc_s *ioc, enum bfi_ioc_state fwstate); | ||
47 | static enum bfi_ioc_state bfa_ioc_cb_get_alt_ioc_fwstate(struct bfa_ioc_s *ioc); | ||
40 | 48 | ||
41 | static struct bfa_ioc_hwif_s hwif_cb; | 49 | static struct bfa_ioc_hwif_s hwif_cb; |
42 | 50 | ||
@@ -59,6 +67,10 @@ bfa_ioc_set_cb_hwif(struct bfa_ioc_s *ioc) | |||
59 | hwif_cb.ioc_sync_leave = bfa_ioc_cb_sync_leave; | 67 | hwif_cb.ioc_sync_leave = bfa_ioc_cb_sync_leave; |
60 | hwif_cb.ioc_sync_ack = bfa_ioc_cb_sync_ack; | 68 | hwif_cb.ioc_sync_ack = bfa_ioc_cb_sync_ack; |
61 | hwif_cb.ioc_sync_complete = bfa_ioc_cb_sync_complete; | 69 | hwif_cb.ioc_sync_complete = bfa_ioc_cb_sync_complete; |
70 | hwif_cb.ioc_set_fwstate = bfa_ioc_cb_set_cur_ioc_fwstate; | ||
71 | hwif_cb.ioc_get_fwstate = bfa_ioc_cb_get_cur_ioc_fwstate; | ||
72 | hwif_cb.ioc_set_alt_fwstate = bfa_ioc_cb_set_alt_ioc_fwstate; | ||
73 | hwif_cb.ioc_get_alt_fwstate = bfa_ioc_cb_get_alt_ioc_fwstate; | ||
62 | 74 | ||
63 | ioc->ioc_hwif = &hwif_cb; | 75 | ioc->ioc_hwif = &hwif_cb; |
64 | } | 76 | } |
@@ -187,6 +199,20 @@ bfa_ioc_cb_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix) | |||
187 | static bfa_boolean_t | 199 | static bfa_boolean_t |
188 | bfa_ioc_cb_sync_start(struct bfa_ioc_s *ioc) | 200 | bfa_ioc_cb_sync_start(struct bfa_ioc_s *ioc) |
189 | { | 201 | { |
202 | u32 ioc_fwstate = readl(ioc->ioc_regs.ioc_fwstate); | ||
203 | |||
204 | /** | ||
205 | * Driver load time. If the join bit is set, | ||
206 | * it is due to an unclean exit by the driver for this | ||
207 | * PCI fn in the previous incarnation. Whoever comes here first | ||
208 | * should clean it up, no matter which PCI fn. | ||
209 | */ | ||
210 | if (ioc_fwstate & BFA_IOC_CB_JOIN_MASK) { | ||
211 | writel(BFI_IOC_UNINIT, ioc->ioc_regs.ioc_fwstate); | ||
212 | writel(BFI_IOC_UNINIT, ioc->ioc_regs.alt_ioc_fwstate); | ||
213 | return BFA_TRUE; | ||
214 | } | ||
215 | |||
190 | return bfa_ioc_cb_sync_complete(ioc); | 216 | return bfa_ioc_cb_sync_complete(ioc); |
191 | } | 217 | } |
192 | 218 | ||
@@ -212,24 +238,66 @@ bfa_ioc_cb_ownership_reset(struct bfa_ioc_s *ioc) | |||
212 | static void | 238 | static void |
213 | bfa_ioc_cb_sync_join(struct bfa_ioc_s *ioc) | 239 | bfa_ioc_cb_sync_join(struct bfa_ioc_s *ioc) |
214 | { | 240 | { |
241 | u32 r32 = readl(ioc->ioc_regs.ioc_fwstate); | ||
242 | u32 join_pos = bfa_ioc_cb_join_pos(ioc); | ||
243 | |||
244 | writel((r32 | join_pos), ioc->ioc_regs.ioc_fwstate); | ||
215 | } | 245 | } |
216 | 246 | ||
217 | static void | 247 | static void |
218 | bfa_ioc_cb_sync_leave(struct bfa_ioc_s *ioc) | 248 | bfa_ioc_cb_sync_leave(struct bfa_ioc_s *ioc) |
219 | { | 249 | { |
250 | u32 r32 = readl(ioc->ioc_regs.ioc_fwstate); | ||
251 | u32 join_pos = bfa_ioc_cb_join_pos(ioc); | ||
252 | |||
253 | writel((r32 & ~join_pos), ioc->ioc_regs.ioc_fwstate); | ||
254 | } | ||
255 | |||
256 | static void | ||
257 | bfa_ioc_cb_set_cur_ioc_fwstate(struct bfa_ioc_s *ioc, | ||
258 | enum bfi_ioc_state fwstate) | ||
259 | { | ||
260 | u32 r32 = readl(ioc->ioc_regs.ioc_fwstate); | ||
261 | |||
262 | writel((fwstate | (r32 & BFA_IOC_CB_JOIN_MASK)), | ||
263 | ioc->ioc_regs.ioc_fwstate); | ||
264 | } | ||
265 | |||
266 | static enum bfi_ioc_state | ||
267 | bfa_ioc_cb_get_cur_ioc_fwstate(struct bfa_ioc_s *ioc) | ||
268 | { | ||
269 | return (enum bfi_ioc_state)(readl(ioc->ioc_regs.ioc_fwstate) & | ||
270 | BFA_IOC_CB_FWSTATE_MASK); | ||
271 | } | ||
272 | |||
273 | static void | ||
274 | bfa_ioc_cb_set_alt_ioc_fwstate(struct bfa_ioc_s *ioc, | ||
275 | enum bfi_ioc_state fwstate) | ||
276 | { | ||
277 | u32 r32 = readl(ioc->ioc_regs.alt_ioc_fwstate); | ||
278 | |||
279 | writel((fwstate | (r32 & BFA_IOC_CB_JOIN_MASK)), | ||
280 | ioc->ioc_regs.alt_ioc_fwstate); | ||
281 | } | ||
282 | |||
283 | static enum bfi_ioc_state | ||
284 | bfa_ioc_cb_get_alt_ioc_fwstate(struct bfa_ioc_s *ioc) | ||
285 | { | ||
286 | return (enum bfi_ioc_state)(readl(ioc->ioc_regs.alt_ioc_fwstate) & | ||
287 | BFA_IOC_CB_FWSTATE_MASK); | ||
220 | } | 288 | } |
221 | 289 | ||
222 | static void | 290 | static void |
223 | bfa_ioc_cb_sync_ack(struct bfa_ioc_s *ioc) | 291 | bfa_ioc_cb_sync_ack(struct bfa_ioc_s *ioc) |
224 | { | 292 | { |
225 | writel(BFI_IOC_FAIL, ioc->ioc_regs.ioc_fwstate); | 293 | bfa_ioc_cb_set_cur_ioc_fwstate(ioc, BFI_IOC_FAIL); |
226 | } | 294 | } |
227 | 295 | ||
228 | static bfa_boolean_t | 296 | static bfa_boolean_t |
229 | bfa_ioc_cb_sync_complete(struct bfa_ioc_s *ioc) | 297 | bfa_ioc_cb_sync_complete(struct bfa_ioc_s *ioc) |
230 | { | 298 | { |
231 | uint32_t fwstate, alt_fwstate; | 299 | u32 fwstate, alt_fwstate; |
232 | fwstate = readl(ioc->ioc_regs.ioc_fwstate); | 300 | fwstate = bfa_ioc_cb_get_cur_ioc_fwstate(ioc); |
233 | 301 | ||
234 | /* | 302 | /* |
235 | * At this point, this IOC is hoding the hw sem in the | 303 | * At this point, this IOC is hoding the hw sem in the |
@@ -257,7 +325,7 @@ bfa_ioc_cb_sync_complete(struct bfa_ioc_s *ioc) | |||
257 | fwstate == BFI_IOC_OP) | 325 | fwstate == BFI_IOC_OP) |
258 | return BFA_TRUE; | 326 | return BFA_TRUE; |
259 | else { | 327 | else { |
260 | alt_fwstate = readl(ioc->ioc_regs.alt_ioc_fwstate); | 328 | alt_fwstate = bfa_ioc_cb_get_alt_ioc_fwstate(ioc); |
261 | if (alt_fwstate == BFI_IOC_FAIL || | 329 | if (alt_fwstate == BFI_IOC_FAIL || |
262 | alt_fwstate == BFI_IOC_DISABLED || | 330 | alt_fwstate == BFI_IOC_DISABLED || |
263 | alt_fwstate == BFI_IOC_UNINIT || | 331 | alt_fwstate == BFI_IOC_UNINIT || |
@@ -272,7 +340,7 @@ bfa_ioc_cb_sync_complete(struct bfa_ioc_s *ioc) | |||
272 | bfa_status_t | 340 | bfa_status_t |
273 | bfa_ioc_cb_pll_init(void __iomem *rb, enum bfi_asic_mode fcmode) | 341 | bfa_ioc_cb_pll_init(void __iomem *rb, enum bfi_asic_mode fcmode) |
274 | { | 342 | { |
275 | u32 pll_sclk, pll_fclk; | 343 | u32 pll_sclk, pll_fclk, join_bits; |
276 | 344 | ||
277 | pll_sclk = __APP_PLL_SCLK_ENABLE | __APP_PLL_SCLK_LRESETN | | 345 | pll_sclk = __APP_PLL_SCLK_ENABLE | __APP_PLL_SCLK_LRESETN | |
278 | __APP_PLL_SCLK_P0_1(3U) | | 346 | __APP_PLL_SCLK_P0_1(3U) | |
@@ -282,8 +350,12 @@ bfa_ioc_cb_pll_init(void __iomem *rb, enum bfi_asic_mode fcmode) | |||
282 | __APP_PLL_LCLK_RSEL200500 | __APP_PLL_LCLK_P0_1(3U) | | 350 | __APP_PLL_LCLK_RSEL200500 | __APP_PLL_LCLK_P0_1(3U) | |
283 | __APP_PLL_LCLK_JITLMT0_1(3U) | | 351 | __APP_PLL_LCLK_JITLMT0_1(3U) | |
284 | __APP_PLL_LCLK_CNTLMT0_1(3U); | 352 | __APP_PLL_LCLK_CNTLMT0_1(3U); |
285 | writel(BFI_IOC_UNINIT, (rb + BFA_IOC0_STATE_REG)); | 353 | join_bits = readl(rb + BFA_IOC0_STATE_REG) & |
286 | writel(BFI_IOC_UNINIT, (rb + BFA_IOC1_STATE_REG)); | 354 | BFA_IOC_CB_JOIN_MASK; |
355 | writel((BFI_IOC_UNINIT | join_bits), (rb + BFA_IOC0_STATE_REG)); | ||
356 | join_bits = readl(rb + BFA_IOC1_STATE_REG) & | ||
357 | BFA_IOC_CB_JOIN_MASK; | ||
358 | writel((BFI_IOC_UNINIT | join_bits), (rb + BFA_IOC1_STATE_REG)); | ||
287 | writel(0xffffffffU, (rb + HOSTFN0_INT_MSK)); | 359 | writel(0xffffffffU, (rb + HOSTFN0_INT_MSK)); |
288 | writel(0xffffffffU, (rb + HOSTFN1_INT_MSK)); | 360 | writel(0xffffffffU, (rb + HOSTFN1_INT_MSK)); |
289 | writel(0xffffffffU, (rb + HOSTFN0_INT_STATUS)); | 361 | writel(0xffffffffU, (rb + HOSTFN0_INT_STATUS)); |
diff --git a/drivers/scsi/bfa/bfa_ioc_ct.c b/drivers/scsi/bfa/bfa_ioc_ct.c index de4e726a1263..bd53150e4ee0 100644 --- a/drivers/scsi/bfa/bfa_ioc_ct.c +++ b/drivers/scsi/bfa/bfa_ioc_ct.c | |||
@@ -43,6 +43,12 @@ static void bfa_ioc_ct_sync_join(struct bfa_ioc_s *ioc); | |||
43 | static void bfa_ioc_ct_sync_leave(struct bfa_ioc_s *ioc); | 43 | static void bfa_ioc_ct_sync_leave(struct bfa_ioc_s *ioc); |
44 | static void bfa_ioc_ct_sync_ack(struct bfa_ioc_s *ioc); | 44 | static void bfa_ioc_ct_sync_ack(struct bfa_ioc_s *ioc); |
45 | static bfa_boolean_t bfa_ioc_ct_sync_complete(struct bfa_ioc_s *ioc); | 45 | static bfa_boolean_t bfa_ioc_ct_sync_complete(struct bfa_ioc_s *ioc); |
46 | static void bfa_ioc_ct_set_cur_ioc_fwstate( | ||
47 | struct bfa_ioc_s *ioc, enum bfi_ioc_state fwstate); | ||
48 | static enum bfi_ioc_state bfa_ioc_ct_get_cur_ioc_fwstate(struct bfa_ioc_s *ioc); | ||
49 | static void bfa_ioc_ct_set_alt_ioc_fwstate( | ||
50 | struct bfa_ioc_s *ioc, enum bfi_ioc_state fwstate); | ||
51 | static enum bfi_ioc_state bfa_ioc_ct_get_alt_ioc_fwstate(struct bfa_ioc_s *ioc); | ||
46 | 52 | ||
47 | static struct bfa_ioc_hwif_s hwif_ct; | 53 | static struct bfa_ioc_hwif_s hwif_ct; |
48 | static struct bfa_ioc_hwif_s hwif_ct2; | 54 | static struct bfa_ioc_hwif_s hwif_ct2; |
@@ -512,6 +518,10 @@ bfa_ioc_set_ctx_hwif(struct bfa_ioc_s *ioc, struct bfa_ioc_hwif_s *hwif) | |||
512 | hwif->ioc_sync_leave = bfa_ioc_ct_sync_leave; | 518 | hwif->ioc_sync_leave = bfa_ioc_ct_sync_leave; |
513 | hwif->ioc_sync_ack = bfa_ioc_ct_sync_ack; | 519 | hwif->ioc_sync_ack = bfa_ioc_ct_sync_ack; |
514 | hwif->ioc_sync_complete = bfa_ioc_ct_sync_complete; | 520 | hwif->ioc_sync_complete = bfa_ioc_ct_sync_complete; |
521 | hwif->ioc_set_fwstate = bfa_ioc_ct_set_cur_ioc_fwstate; | ||
522 | hwif->ioc_get_fwstate = bfa_ioc_ct_get_cur_ioc_fwstate; | ||
523 | hwif->ioc_set_alt_fwstate = bfa_ioc_ct_set_alt_ioc_fwstate; | ||
524 | hwif->ioc_get_alt_fwstate = bfa_ioc_ct_get_alt_ioc_fwstate; | ||
515 | } | 525 | } |
516 | 526 | ||
517 | /** | 527 | /** |
@@ -918,6 +928,16 @@ bfa_ioc_ct2_pll_init(void __iomem *rb, enum bfi_asic_mode mode) | |||
918 | 928 | ||
919 | } | 929 | } |
920 | } | 930 | } |
931 | /* | ||
932 | * The very first PCIe DMA Read done by LPU fails with a fatal error, | ||
933 | * when Address Translation Cache (ATC) has been enabled by system BIOS. | ||
934 | * | ||
935 | * Workaround: | ||
936 | * Disable Invalidated Tag Match Enable capability by setting the bit 26 | ||
937 | * of CHIP_MISC_PRG to 0, by default it is set to 1. | ||
938 | */ | ||
939 | r32 = readl(rb + CT2_CHIP_MISC_PRG); | ||
940 | writel((r32 & 0xfbffffff), (rb + CT2_CHIP_MISC_PRG)); | ||
921 | 941 | ||
922 | /* | 942 | /* |
923 | * Mask the interrupts and clear any | 943 | * Mask the interrupts and clear any |
@@ -949,3 +969,29 @@ bfa_ioc_ct2_pll_init(void __iomem *rb, enum bfi_asic_mode mode) | |||
949 | 969 | ||
950 | return BFA_STATUS_OK; | 970 | return BFA_STATUS_OK; |
951 | } | 971 | } |
972 | |||
973 | static void | ||
974 | bfa_ioc_ct_set_cur_ioc_fwstate(struct bfa_ioc_s *ioc, | ||
975 | enum bfi_ioc_state fwstate) | ||
976 | { | ||
977 | writel(fwstate, ioc->ioc_regs.ioc_fwstate); | ||
978 | } | ||
979 | |||
980 | static enum bfi_ioc_state | ||
981 | bfa_ioc_ct_get_cur_ioc_fwstate(struct bfa_ioc_s *ioc) | ||
982 | { | ||
983 | return (enum bfi_ioc_state)readl(ioc->ioc_regs.ioc_fwstate); | ||
984 | } | ||
985 | |||
986 | static void | ||
987 | bfa_ioc_ct_set_alt_ioc_fwstate(struct bfa_ioc_s *ioc, | ||
988 | enum bfi_ioc_state fwstate) | ||
989 | { | ||
990 | writel(fwstate, ioc->ioc_regs.alt_ioc_fwstate); | ||
991 | } | ||
992 | |||
993 | static enum bfi_ioc_state | ||
994 | bfa_ioc_ct_get_alt_ioc_fwstate(struct bfa_ioc_s *ioc) | ||
995 | { | ||
996 | return (enum bfi_ioc_state) readl(ioc->ioc_regs.alt_ioc_fwstate); | ||
997 | } | ||
diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c index 299c1c889b33..6c41e57fd752 100644 --- a/drivers/scsi/bfa/bfa_svc.c +++ b/drivers/scsi/bfa/bfa_svc.c | |||
@@ -70,6 +70,8 @@ enum bfa_fcport_sm_event { | |||
70 | BFA_FCPORT_SM_DPORTENABLE = 10, /* enable dport */ | 70 | BFA_FCPORT_SM_DPORTENABLE = 10, /* enable dport */ |
71 | BFA_FCPORT_SM_DPORTDISABLE = 11,/* disable dport */ | 71 | BFA_FCPORT_SM_DPORTDISABLE = 11,/* disable dport */ |
72 | BFA_FCPORT_SM_FAA_MISCONFIG = 12, /* FAA misconfiguratin */ | 72 | BFA_FCPORT_SM_FAA_MISCONFIG = 12, /* FAA misconfiguratin */ |
73 | BFA_FCPORT_SM_DDPORTENABLE = 13, /* enable ddport */ | ||
74 | BFA_FCPORT_SM_DDPORTDISABLE = 14, /* disable ddport */ | ||
73 | }; | 75 | }; |
74 | 76 | ||
75 | /* | 77 | /* |
@@ -202,6 +204,8 @@ static void bfa_fcport_sm_iocfail(struct bfa_fcport_s *fcport, | |||
202 | enum bfa_fcport_sm_event event); | 204 | enum bfa_fcport_sm_event event); |
203 | static void bfa_fcport_sm_dport(struct bfa_fcport_s *fcport, | 205 | static void bfa_fcport_sm_dport(struct bfa_fcport_s *fcport, |
204 | enum bfa_fcport_sm_event event); | 206 | enum bfa_fcport_sm_event event); |
207 | static void bfa_fcport_sm_ddport(struct bfa_fcport_s *fcport, | ||
208 | enum bfa_fcport_sm_event event); | ||
205 | static void bfa_fcport_sm_faa_misconfig(struct bfa_fcport_s *fcport, | 209 | static void bfa_fcport_sm_faa_misconfig(struct bfa_fcport_s *fcport, |
206 | enum bfa_fcport_sm_event event); | 210 | enum bfa_fcport_sm_event event); |
207 | 211 | ||
@@ -234,6 +238,7 @@ static struct bfa_sm_table_s hal_port_sm_table[] = { | |||
234 | {BFA_SM(bfa_fcport_sm_iocdown), BFA_PORT_ST_IOCDOWN}, | 238 | {BFA_SM(bfa_fcport_sm_iocdown), BFA_PORT_ST_IOCDOWN}, |
235 | {BFA_SM(bfa_fcport_sm_iocfail), BFA_PORT_ST_IOCDOWN}, | 239 | {BFA_SM(bfa_fcport_sm_iocfail), BFA_PORT_ST_IOCDOWN}, |
236 | {BFA_SM(bfa_fcport_sm_dport), BFA_PORT_ST_DPORT}, | 240 | {BFA_SM(bfa_fcport_sm_dport), BFA_PORT_ST_DPORT}, |
241 | {BFA_SM(bfa_fcport_sm_ddport), BFA_PORT_ST_DDPORT}, | ||
237 | {BFA_SM(bfa_fcport_sm_faa_misconfig), BFA_PORT_ST_FAA_MISCONFIG}, | 242 | {BFA_SM(bfa_fcport_sm_faa_misconfig), BFA_PORT_ST_FAA_MISCONFIG}, |
238 | }; | 243 | }; |
239 | 244 | ||
@@ -1276,7 +1281,6 @@ bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
1276 | 1281 | ||
1277 | switch (event) { | 1282 | switch (event) { |
1278 | case BFA_LPS_SM_FWRSP: | 1283 | case BFA_LPS_SM_FWRSP: |
1279 | case BFA_LPS_SM_OFFLINE: | ||
1280 | if (lps->status == BFA_STATUS_OK) { | 1284 | if (lps->status == BFA_STATUS_OK) { |
1281 | bfa_sm_set_state(lps, bfa_lps_sm_online); | 1285 | bfa_sm_set_state(lps, bfa_lps_sm_online); |
1282 | if (lps->fdisc) | 1286 | if (lps->fdisc) |
@@ -1305,6 +1309,7 @@ bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
1305 | bfa_lps_login_comp(lps); | 1309 | bfa_lps_login_comp(lps); |
1306 | break; | 1310 | break; |
1307 | 1311 | ||
1312 | case BFA_LPS_SM_OFFLINE: | ||
1308 | case BFA_LPS_SM_DELETE: | 1313 | case BFA_LPS_SM_DELETE: |
1309 | bfa_sm_set_state(lps, bfa_lps_sm_init); | 1314 | bfa_sm_set_state(lps, bfa_lps_sm_init); |
1310 | break; | 1315 | break; |
@@ -1614,7 +1619,6 @@ bfa_lps_login_rsp(struct bfa_s *bfa, struct bfi_lps_login_rsp_s *rsp) | |||
1614 | lps->lp_mac = rsp->lp_mac; | 1619 | lps->lp_mac = rsp->lp_mac; |
1615 | lps->brcd_switch = rsp->brcd_switch; | 1620 | lps->brcd_switch = rsp->brcd_switch; |
1616 | lps->fcf_mac = rsp->fcf_mac; | 1621 | lps->fcf_mac = rsp->fcf_mac; |
1617 | lps->pr_bbscn = rsp->bb_scn; | ||
1618 | 1622 | ||
1619 | break; | 1623 | break; |
1620 | 1624 | ||
@@ -1744,7 +1748,6 @@ bfa_lps_send_login(struct bfa_lps_s *lps) | |||
1744 | m->nwwn = lps->nwwn; | 1748 | m->nwwn = lps->nwwn; |
1745 | m->fdisc = lps->fdisc; | 1749 | m->fdisc = lps->fdisc; |
1746 | m->auth_en = lps->auth_en; | 1750 | m->auth_en = lps->auth_en; |
1747 | m->bb_scn = lps->bb_scn; | ||
1748 | 1751 | ||
1749 | bfa_reqq_produce(lps->bfa, lps->reqq, m->mh); | 1752 | bfa_reqq_produce(lps->bfa, lps->reqq, m->mh); |
1750 | list_del(&lps->qe); | 1753 | list_del(&lps->qe); |
@@ -1940,7 +1943,7 @@ bfa_lps_delete(struct bfa_lps_s *lps) | |||
1940 | */ | 1943 | */ |
1941 | void | 1944 | void |
1942 | bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa, u16 pdusz, | 1945 | bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa, u16 pdusz, |
1943 | wwn_t pwwn, wwn_t nwwn, bfa_boolean_t auth_en, uint8_t bb_scn) | 1946 | wwn_t pwwn, wwn_t nwwn, bfa_boolean_t auth_en) |
1944 | { | 1947 | { |
1945 | lps->uarg = uarg; | 1948 | lps->uarg = uarg; |
1946 | lps->alpa = alpa; | 1949 | lps->alpa = alpa; |
@@ -1949,7 +1952,6 @@ bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa, u16 pdusz, | |||
1949 | lps->nwwn = nwwn; | 1952 | lps->nwwn = nwwn; |
1950 | lps->fdisc = BFA_FALSE; | 1953 | lps->fdisc = BFA_FALSE; |
1951 | lps->auth_en = auth_en; | 1954 | lps->auth_en = auth_en; |
1952 | lps->bb_scn = bb_scn; | ||
1953 | bfa_sm_send_event(lps, BFA_LPS_SM_LOGIN); | 1955 | bfa_sm_send_event(lps, BFA_LPS_SM_LOGIN); |
1954 | } | 1956 | } |
1955 | 1957 | ||
@@ -2649,6 +2651,10 @@ bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport, | |||
2649 | bfa_sm_set_state(fcport, bfa_fcport_sm_dport); | 2651 | bfa_sm_set_state(fcport, bfa_fcport_sm_dport); |
2650 | break; | 2652 | break; |
2651 | 2653 | ||
2654 | case BFA_FCPORT_SM_DDPORTENABLE: | ||
2655 | bfa_sm_set_state(fcport, bfa_fcport_sm_ddport); | ||
2656 | break; | ||
2657 | |||
2652 | default: | 2658 | default: |
2653 | bfa_sm_fault(fcport->bfa, event); | 2659 | bfa_sm_fault(fcport->bfa, event); |
2654 | } | 2660 | } |
@@ -2762,6 +2768,40 @@ bfa_fcport_sm_dport(struct bfa_fcport_s *fcport, enum bfa_fcport_sm_event event) | |||
2762 | } | 2768 | } |
2763 | 2769 | ||
2764 | static void | 2770 | static void |
2771 | bfa_fcport_sm_ddport(struct bfa_fcport_s *fcport, | ||
2772 | enum bfa_fcport_sm_event event) | ||
2773 | { | ||
2774 | bfa_trc(fcport->bfa, event); | ||
2775 | |||
2776 | switch (event) { | ||
2777 | case BFA_FCPORT_SM_DISABLE: | ||
2778 | case BFA_FCPORT_SM_DDPORTDISABLE: | ||
2779 | bfa_sm_set_state(fcport, bfa_fcport_sm_disabled); | ||
2780 | break; | ||
2781 | |||
2782 | case BFA_FCPORT_SM_DPORTENABLE: | ||
2783 | case BFA_FCPORT_SM_DPORTDISABLE: | ||
2784 | case BFA_FCPORT_SM_ENABLE: | ||
2785 | case BFA_FCPORT_SM_START: | ||
2786 | /** | ||
2787 | * Ignore event for a port that is ddport | ||
2788 | */ | ||
2789 | break; | ||
2790 | |||
2791 | case BFA_FCPORT_SM_STOP: | ||
2792 | bfa_sm_set_state(fcport, bfa_fcport_sm_stopped); | ||
2793 | break; | ||
2794 | |||
2795 | case BFA_FCPORT_SM_HWFAIL: | ||
2796 | bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail); | ||
2797 | break; | ||
2798 | |||
2799 | default: | ||
2800 | bfa_sm_fault(fcport->bfa, event); | ||
2801 | } | ||
2802 | } | ||
2803 | |||
2804 | static void | ||
2765 | bfa_fcport_sm_faa_misconfig(struct bfa_fcport_s *fcport, | 2805 | bfa_fcport_sm_faa_misconfig(struct bfa_fcport_s *fcport, |
2766 | enum bfa_fcport_sm_event event) | 2806 | enum bfa_fcport_sm_event event) |
2767 | { | 2807 | { |
@@ -3082,6 +3122,8 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
3082 | port_cfg->qos_bw.med = BFA_QOS_BW_MED; | 3122 | port_cfg->qos_bw.med = BFA_QOS_BW_MED; |
3083 | port_cfg->qos_bw.low = BFA_QOS_BW_LOW; | 3123 | port_cfg->qos_bw.low = BFA_QOS_BW_LOW; |
3084 | 3124 | ||
3125 | fcport->fec_state = BFA_FEC_OFFLINE; | ||
3126 | |||
3085 | INIT_LIST_HEAD(&fcport->stats_pending_q); | 3127 | INIT_LIST_HEAD(&fcport->stats_pending_q); |
3086 | INIT_LIST_HEAD(&fcport->statsclr_pending_q); | 3128 | INIT_LIST_HEAD(&fcport->statsclr_pending_q); |
3087 | 3129 | ||
@@ -3158,6 +3200,11 @@ bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport) | |||
3158 | fcport->qos_attr = pevent->link_state.qos_attr; | 3200 | fcport->qos_attr = pevent->link_state.qos_attr; |
3159 | fcport->qos_vc_attr = pevent->link_state.attr.vc_fcf.qos_vc_attr; | 3201 | fcport->qos_vc_attr = pevent->link_state.attr.vc_fcf.qos_vc_attr; |
3160 | 3202 | ||
3203 | if (fcport->cfg.bb_cr_enabled) | ||
3204 | fcport->bbcr_attr = pevent->link_state.attr.bbcr_attr; | ||
3205 | |||
3206 | fcport->fec_state = pevent->link_state.fec_state; | ||
3207 | |||
3161 | /* | 3208 | /* |
3162 | * update trunk state if applicable | 3209 | * update trunk state if applicable |
3163 | */ | 3210 | */ |
@@ -3177,7 +3224,7 @@ bfa_fcport_reset_linkinfo(struct bfa_fcport_s *fcport) | |||
3177 | { | 3224 | { |
3178 | fcport->speed = BFA_PORT_SPEED_UNKNOWN; | 3225 | fcport->speed = BFA_PORT_SPEED_UNKNOWN; |
3179 | fcport->topology = BFA_PORT_TOPOLOGY_NONE; | 3226 | fcport->topology = BFA_PORT_TOPOLOGY_NONE; |
3180 | fcport->bbsc_op_state = BFA_FALSE; | 3227 | fcport->fec_state = BFA_FEC_OFFLINE; |
3181 | } | 3228 | } |
3182 | 3229 | ||
3183 | /* | 3230 | /* |
@@ -3629,6 +3676,11 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) | |||
3629 | fcport->qos_attr.qos_bw_op = | 3676 | fcport->qos_attr.qos_bw_op = |
3630 | i2hmsg.penable_rsp->port_cfg.qos_bw; | 3677 | i2hmsg.penable_rsp->port_cfg.qos_bw; |
3631 | 3678 | ||
3679 | if (fcport->cfg.bb_cr_enabled) | ||
3680 | fcport->bbcr_attr.state = BFA_BBCR_OFFLINE; | ||
3681 | else | ||
3682 | fcport->bbcr_attr.state = BFA_BBCR_DISABLED; | ||
3683 | |||
3632 | bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP); | 3684 | bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP); |
3633 | } | 3685 | } |
3634 | break; | 3686 | break; |
@@ -3639,6 +3691,11 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) | |||
3639 | break; | 3691 | break; |
3640 | 3692 | ||
3641 | case BFI_FCPORT_I2H_EVENT: | 3693 | case BFI_FCPORT_I2H_EVENT: |
3694 | if (fcport->cfg.bb_cr_enabled) | ||
3695 | fcport->bbcr_attr.state = BFA_BBCR_OFFLINE; | ||
3696 | else | ||
3697 | fcport->bbcr_attr.state = BFA_BBCR_DISABLED; | ||
3698 | |||
3642 | if (i2hmsg.event->link_state.linkstate == BFA_PORT_LINKUP) | 3699 | if (i2hmsg.event->link_state.linkstate == BFA_PORT_LINKUP) |
3643 | bfa_sm_send_event(fcport, BFA_FCPORT_SM_LINKUP); | 3700 | bfa_sm_send_event(fcport, BFA_FCPORT_SM_LINKUP); |
3644 | else { | 3701 | else { |
@@ -3846,6 +3903,8 @@ bfa_fcport_cfg_topology(struct bfa_s *bfa, enum bfa_port_topology topology) | |||
3846 | return BFA_STATUS_LOOP_UNSUPP_MEZZ; | 3903 | return BFA_STATUS_LOOP_UNSUPP_MEZZ; |
3847 | if (bfa_fcport_is_dport(bfa) != BFA_FALSE) | 3904 | if (bfa_fcport_is_dport(bfa) != BFA_FALSE) |
3848 | return BFA_STATUS_DPORT_ERR; | 3905 | return BFA_STATUS_DPORT_ERR; |
3906 | if (bfa_fcport_is_ddport(bfa) != BFA_FALSE) | ||
3907 | return BFA_STATUS_DPORT_ERR; | ||
3849 | break; | 3908 | break; |
3850 | 3909 | ||
3851 | case BFA_PORT_TOPOLOGY_AUTO: | 3910 | case BFA_PORT_TOPOLOGY_AUTO: |
@@ -3964,14 +4023,11 @@ bfa_fcport_get_rx_bbcredit(struct bfa_s *bfa) | |||
3964 | } | 4023 | } |
3965 | 4024 | ||
3966 | void | 4025 | void |
3967 | bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit, u8 bb_scn) | 4026 | bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit) |
3968 | { | 4027 | { |
3969 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | 4028 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
3970 | 4029 | ||
3971 | fcport->cfg.tx_bbcredit = (u8)tx_bbcredit; | 4030 | fcport->cfg.tx_bbcredit = (u8)tx_bbcredit; |
3972 | fcport->cfg.bb_scn = bb_scn; | ||
3973 | if (bb_scn) | ||
3974 | fcport->bbsc_op_state = BFA_TRUE; | ||
3975 | } | 4031 | } |
3976 | 4032 | ||
3977 | /* | 4033 | /* |
@@ -4021,7 +4077,8 @@ bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr) | |||
4021 | attr->pport_cfg.path_tov = bfa_fcpim_path_tov_get(bfa); | 4077 | attr->pport_cfg.path_tov = bfa_fcpim_path_tov_get(bfa); |
4022 | attr->pport_cfg.q_depth = bfa_fcpim_qdepth_get(bfa); | 4078 | attr->pport_cfg.q_depth = bfa_fcpim_qdepth_get(bfa); |
4023 | attr->port_state = bfa_sm_to_state(hal_port_sm_table, fcport->sm); | 4079 | attr->port_state = bfa_sm_to_state(hal_port_sm_table, fcport->sm); |
4024 | attr->bbsc_op_status = fcport->bbsc_op_state; | 4080 | |
4081 | attr->fec_state = fcport->fec_state; | ||
4025 | 4082 | ||
4026 | /* PBC Disabled State */ | 4083 | /* PBC Disabled State */ |
4027 | if (bfa_fcport_is_pbcdisabled(bfa)) | 4084 | if (bfa_fcport_is_pbcdisabled(bfa)) |
@@ -4115,6 +4172,15 @@ bfa_fcport_is_dport(struct bfa_s *bfa) | |||
4115 | BFA_PORT_ST_DPORT); | 4172 | BFA_PORT_ST_DPORT); |
4116 | } | 4173 | } |
4117 | 4174 | ||
4175 | bfa_boolean_t | ||
4176 | bfa_fcport_is_ddport(struct bfa_s *bfa) | ||
4177 | { | ||
4178 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | ||
4179 | |||
4180 | return (bfa_sm_to_state(hal_port_sm_table, fcport->sm) == | ||
4181 | BFA_PORT_ST_DDPORT); | ||
4182 | } | ||
4183 | |||
4118 | bfa_status_t | 4184 | bfa_status_t |
4119 | bfa_fcport_set_qos_bw(struct bfa_s *bfa, struct bfa_qos_bw_s *qos_bw) | 4185 | bfa_fcport_set_qos_bw(struct bfa_s *bfa, struct bfa_qos_bw_s *qos_bw) |
4120 | { | 4186 | { |
@@ -4217,6 +4283,77 @@ bfa_fcport_is_trunk_enabled(struct bfa_s *bfa) | |||
4217 | return fcport->cfg.trunked; | 4283 | return fcport->cfg.trunked; |
4218 | } | 4284 | } |
4219 | 4285 | ||
4286 | bfa_status_t | ||
4287 | bfa_fcport_cfg_bbcr(struct bfa_s *bfa, bfa_boolean_t on_off, u8 bb_scn) | ||
4288 | { | ||
4289 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | ||
4290 | |||
4291 | bfa_trc(bfa, on_off); | ||
4292 | |||
4293 | if (bfa_ioc_get_type(&fcport->bfa->ioc) != BFA_IOC_TYPE_FC) | ||
4294 | return BFA_STATUS_BBCR_FC_ONLY; | ||
4295 | |||
4296 | if (bfa_mfg_is_mezz(bfa->ioc.attr->card_type) && | ||
4297 | (bfa->ioc.attr->card_type != BFA_MFG_TYPE_CHINOOK)) | ||
4298 | return BFA_STATUS_CMD_NOTSUPP_MEZZ; | ||
4299 | |||
4300 | if (on_off) { | ||
4301 | if (fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) | ||
4302 | return BFA_STATUS_TOPOLOGY_LOOP; | ||
4303 | |||
4304 | if (fcport->cfg.qos_enabled) | ||
4305 | return BFA_STATUS_ERROR_QOS_ENABLED; | ||
4306 | |||
4307 | if (fcport->cfg.trunked) | ||
4308 | return BFA_STATUS_TRUNK_ENABLED; | ||
4309 | |||
4310 | if ((fcport->cfg.speed != BFA_PORT_SPEED_AUTO) && | ||
4311 | (fcport->cfg.speed < bfa_ioc_speed_sup(&bfa->ioc))) | ||
4312 | return BFA_STATUS_ERR_BBCR_SPEED_UNSUPPORT; | ||
4313 | |||
4314 | if (bfa_ioc_speed_sup(&bfa->ioc) < BFA_PORT_SPEED_8GBPS) | ||
4315 | return BFA_STATUS_FEATURE_NOT_SUPPORTED; | ||
4316 | |||
4317 | if (fcport->cfg.bb_cr_enabled) { | ||
4318 | if (bb_scn != fcport->cfg.bb_scn) | ||
4319 | return BFA_STATUS_BBCR_CFG_NO_CHANGE; | ||
4320 | else | ||
4321 | return BFA_STATUS_NO_CHANGE; | ||
4322 | } | ||
4323 | |||
4324 | if ((bb_scn == 0) || (bb_scn > BFA_BB_SCN_MAX)) | ||
4325 | bb_scn = BFA_BB_SCN_DEF; | ||
4326 | |||
4327 | fcport->cfg.bb_cr_enabled = on_off; | ||
4328 | fcport->cfg.bb_scn = bb_scn; | ||
4329 | } else { | ||
4330 | if (!fcport->cfg.bb_cr_enabled) | ||
4331 | return BFA_STATUS_NO_CHANGE; | ||
4332 | |||
4333 | fcport->cfg.bb_cr_enabled = on_off; | ||
4334 | fcport->cfg.bb_scn = 0; | ||
4335 | } | ||
4336 | |||
4337 | return BFA_STATUS_OK; | ||
4338 | } | ||
4339 | |||
4340 | bfa_status_t | ||
4341 | bfa_fcport_get_bbcr_attr(struct bfa_s *bfa, | ||
4342 | struct bfa_bbcr_attr_s *bbcr_attr) | ||
4343 | { | ||
4344 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | ||
4345 | |||
4346 | if (bfa_ioc_get_type(&fcport->bfa->ioc) != BFA_IOC_TYPE_FC) | ||
4347 | return BFA_STATUS_BBCR_FC_ONLY; | ||
4348 | |||
4349 | if (fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) | ||
4350 | return BFA_STATUS_TOPOLOGY_LOOP; | ||
4351 | |||
4352 | *bbcr_attr = fcport->bbcr_attr; | ||
4353 | |||
4354 | return BFA_STATUS_OK; | ||
4355 | } | ||
4356 | |||
4220 | void | 4357 | void |
4221 | bfa_fcport_dportenable(struct bfa_s *bfa) | 4358 | bfa_fcport_dportenable(struct bfa_s *bfa) |
4222 | { | 4359 | { |
@@ -4237,6 +4374,24 @@ bfa_fcport_dportdisable(struct bfa_s *bfa) | |||
4237 | bfa_port_set_dportenabled(&bfa->modules.port, BFA_FALSE); | 4374 | bfa_port_set_dportenabled(&bfa->modules.port, BFA_FALSE); |
4238 | } | 4375 | } |
4239 | 4376 | ||
4377 | void | ||
4378 | bfa_fcport_ddportenable(struct bfa_s *bfa) | ||
4379 | { | ||
4380 | /* | ||
4381 | * Assume caller check for port is in disable state | ||
4382 | */ | ||
4383 | bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_DDPORTENABLE); | ||
4384 | } | ||
4385 | |||
4386 | void | ||
4387 | bfa_fcport_ddportdisable(struct bfa_s *bfa) | ||
4388 | { | ||
4389 | /* | ||
4390 | * Assume caller check for port is in disable state | ||
4391 | */ | ||
4392 | bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_DDPORTDISABLE); | ||
4393 | } | ||
4394 | |||
4240 | /* | 4395 | /* |
4241 | * Rport State machine functions | 4396 | * Rport State machine functions |
4242 | */ | 4397 | */ |
@@ -5622,6 +5777,14 @@ bfa_uf_res_recfg(struct bfa_s *bfa, u16 num_uf_fw) | |||
5622 | * Dport forward declaration | 5777 | * Dport forward declaration |
5623 | */ | 5778 | */ |
5624 | 5779 | ||
5780 | enum bfa_dport_test_state_e { | ||
5781 | BFA_DPORT_ST_DISABLED = 0, /*!< dport is disabled */ | ||
5782 | BFA_DPORT_ST_INP = 1, /*!< test in progress */ | ||
5783 | BFA_DPORT_ST_COMP = 2, /*!< test complete successfully */ | ||
5784 | BFA_DPORT_ST_NO_SFP = 3, /*!< sfp is not present */ | ||
5785 | BFA_DPORT_ST_NOTSTART = 4, /*!< test not start dport is enabled */ | ||
5786 | }; | ||
5787 | |||
5625 | /* | 5788 | /* |
5626 | * BFA DPORT state machine events | 5789 | * BFA DPORT state machine events |
5627 | */ | 5790 | */ |
@@ -5631,6 +5794,9 @@ enum bfa_dport_sm_event { | |||
5631 | BFA_DPORT_SM_FWRSP = 3, /* fw enable/disable rsp */ | 5794 | BFA_DPORT_SM_FWRSP = 3, /* fw enable/disable rsp */ |
5632 | BFA_DPORT_SM_QRESUME = 4, /* CQ space available */ | 5795 | BFA_DPORT_SM_QRESUME = 4, /* CQ space available */ |
5633 | BFA_DPORT_SM_HWFAIL = 5, /* IOC h/w failure */ | 5796 | BFA_DPORT_SM_HWFAIL = 5, /* IOC h/w failure */ |
5797 | BFA_DPORT_SM_START = 6, /* re-start dport test */ | ||
5798 | BFA_DPORT_SM_REQFAIL = 7, /* request failure */ | ||
5799 | BFA_DPORT_SM_SCN = 8, /* state change notify frm fw */ | ||
5634 | }; | 5800 | }; |
5635 | 5801 | ||
5636 | static void bfa_dport_sm_disabled(struct bfa_dport_s *dport, | 5802 | static void bfa_dport_sm_disabled(struct bfa_dport_s *dport, |
@@ -5645,9 +5811,19 @@ static void bfa_dport_sm_disabling_qwait(struct bfa_dport_s *dport, | |||
5645 | enum bfa_dport_sm_event event); | 5811 | enum bfa_dport_sm_event event); |
5646 | static void bfa_dport_sm_disabling(struct bfa_dport_s *dport, | 5812 | static void bfa_dport_sm_disabling(struct bfa_dport_s *dport, |
5647 | enum bfa_dport_sm_event event); | 5813 | enum bfa_dport_sm_event event); |
5814 | static void bfa_dport_sm_starting_qwait(struct bfa_dport_s *dport, | ||
5815 | enum bfa_dport_sm_event event); | ||
5816 | static void bfa_dport_sm_starting(struct bfa_dport_s *dport, | ||
5817 | enum bfa_dport_sm_event event); | ||
5818 | static void bfa_dport_sm_dynamic_disabling(struct bfa_dport_s *dport, | ||
5819 | enum bfa_dport_sm_event event); | ||
5820 | static void bfa_dport_sm_dynamic_disabling_qwait(struct bfa_dport_s *dport, | ||
5821 | enum bfa_dport_sm_event event); | ||
5648 | static void bfa_dport_qresume(void *cbarg); | 5822 | static void bfa_dport_qresume(void *cbarg); |
5649 | static void bfa_dport_req_comp(struct bfa_dport_s *dport, | 5823 | static void bfa_dport_req_comp(struct bfa_dport_s *dport, |
5650 | bfi_diag_dport_rsp_t *msg); | 5824 | struct bfi_diag_dport_rsp_s *msg); |
5825 | static void bfa_dport_scn(struct bfa_dport_s *dport, | ||
5826 | struct bfi_diag_dport_scn_s *msg); | ||
5651 | 5827 | ||
5652 | /* | 5828 | /* |
5653 | * BFA fcdiag module | 5829 | * BFA fcdiag module |
@@ -5689,6 +5865,8 @@ bfa_fcdiag_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
5689 | bfa_reqq_winit(&dport->reqq_wait, bfa_dport_qresume, dport); | 5865 | bfa_reqq_winit(&dport->reqq_wait, bfa_dport_qresume, dport); |
5690 | dport->cbfn = NULL; | 5866 | dport->cbfn = NULL; |
5691 | dport->cbarg = NULL; | 5867 | dport->cbarg = NULL; |
5868 | dport->test_state = BFA_DPORT_ST_DISABLED; | ||
5869 | memset(&dport->result, 0, sizeof(struct bfa_diag_dport_result_s)); | ||
5692 | } | 5870 | } |
5693 | 5871 | ||
5694 | static void | 5872 | static void |
@@ -5891,7 +6069,12 @@ bfa_fcdiag_intr(struct bfa_s *bfa, struct bfi_msg_s *msg) | |||
5891 | bfa_fcdiag_queuetest_comp(fcdiag, (bfi_diag_qtest_rsp_t *)msg); | 6069 | bfa_fcdiag_queuetest_comp(fcdiag, (bfi_diag_qtest_rsp_t *)msg); |
5892 | break; | 6070 | break; |
5893 | case BFI_DIAG_I2H_DPORT: | 6071 | case BFI_DIAG_I2H_DPORT: |
5894 | bfa_dport_req_comp(&fcdiag->dport, (bfi_diag_dport_rsp_t *)msg); | 6072 | bfa_dport_req_comp(&fcdiag->dport, |
6073 | (struct bfi_diag_dport_rsp_s *)msg); | ||
6074 | break; | ||
6075 | case BFI_DIAG_I2H_DPORT_SCN: | ||
6076 | bfa_dport_scn(&fcdiag->dport, | ||
6077 | (struct bfi_diag_dport_scn_s *)msg); | ||
5895 | break; | 6078 | break; |
5896 | default: | 6079 | default: |
5897 | bfa_trc(fcdiag, msg->mhdr.msg_id); | 6080 | bfa_trc(fcdiag, msg->mhdr.msg_id); |
@@ -5986,7 +6169,11 @@ bfa_fcdiag_loopback(struct bfa_s *bfa, enum bfa_port_opmode opmode, | |||
5986 | return BFA_STATUS_UNSUPP_SPEED; | 6169 | return BFA_STATUS_UNSUPP_SPEED; |
5987 | } | 6170 | } |
5988 | } | 6171 | } |
5989 | 6172 | /* check to see if fcport is dport */ | |
6173 | if (bfa_fcport_is_dport(bfa)) { | ||
6174 | bfa_trc(fcdiag, fcdiag->lb.lock); | ||
6175 | return BFA_STATUS_DPORT_ENABLED; | ||
6176 | } | ||
5990 | /* check to see if there is another destructive diag cmd running */ | 6177 | /* check to see if there is another destructive diag cmd running */ |
5991 | if (fcdiag->lb.lock) { | 6178 | if (fcdiag->lb.lock) { |
5992 | bfa_trc(fcdiag, fcdiag->lb.lock); | 6179 | bfa_trc(fcdiag, fcdiag->lb.lock); |
@@ -6090,6 +6277,15 @@ bfa_fcdiag_lb_is_running(struct bfa_s *bfa) | |||
6090 | /* | 6277 | /* |
6091 | * D-port | 6278 | * D-port |
6092 | */ | 6279 | */ |
6280 | #define bfa_dport_result_start(__dport, __mode) do { \ | ||
6281 | (__dport)->result.start_time = bfa_get_log_time(); \ | ||
6282 | (__dport)->result.status = DPORT_TEST_ST_INPRG; \ | ||
6283 | (__dport)->result.mode = (__mode); \ | ||
6284 | (__dport)->result.rp_pwwn = (__dport)->rp_pwwn; \ | ||
6285 | (__dport)->result.rp_nwwn = (__dport)->rp_nwwn; \ | ||
6286 | (__dport)->result.lpcnt = (__dport)->lpcnt; \ | ||
6287 | } while (0) | ||
6288 | |||
6093 | static bfa_boolean_t bfa_dport_send_req(struct bfa_dport_s *dport, | 6289 | static bfa_boolean_t bfa_dport_send_req(struct bfa_dport_s *dport, |
6094 | enum bfi_dport_req req); | 6290 | enum bfi_dport_req req); |
6095 | static void | 6291 | static void |
@@ -6124,6 +6320,18 @@ bfa_dport_sm_disabled(struct bfa_dport_s *dport, enum bfa_dport_sm_event event) | |||
6124 | /* ignore */ | 6320 | /* ignore */ |
6125 | break; | 6321 | break; |
6126 | 6322 | ||
6323 | case BFA_DPORT_SM_SCN: | ||
6324 | if (dport->i2hmsg.scn.state == BFI_DPORT_SCN_DDPORT_ENABLE) { | ||
6325 | bfa_fcport_ddportenable(dport->bfa); | ||
6326 | dport->dynamic = BFA_TRUE; | ||
6327 | dport->test_state = BFA_DPORT_ST_NOTSTART; | ||
6328 | bfa_sm_set_state(dport, bfa_dport_sm_enabled); | ||
6329 | } else { | ||
6330 | bfa_trc(dport->bfa, dport->i2hmsg.scn.state); | ||
6331 | WARN_ON(1); | ||
6332 | } | ||
6333 | break; | ||
6334 | |||
6127 | default: | 6335 | default: |
6128 | bfa_sm_fault(dport->bfa, event); | 6336 | bfa_sm_fault(dport->bfa, event); |
6129 | } | 6337 | } |
@@ -6159,9 +6367,23 @@ bfa_dport_sm_enabling(struct bfa_dport_s *dport, enum bfa_dport_sm_event event) | |||
6159 | 6367 | ||
6160 | switch (event) { | 6368 | switch (event) { |
6161 | case BFA_DPORT_SM_FWRSP: | 6369 | case BFA_DPORT_SM_FWRSP: |
6370 | memset(&dport->result, 0, | ||
6371 | sizeof(struct bfa_diag_dport_result_s)); | ||
6372 | if (dport->i2hmsg.rsp.status == BFA_STATUS_DPORT_INV_SFP) { | ||
6373 | dport->test_state = BFA_DPORT_ST_NO_SFP; | ||
6374 | } else { | ||
6375 | dport->test_state = BFA_DPORT_ST_INP; | ||
6376 | bfa_dport_result_start(dport, BFA_DPORT_OPMODE_AUTO); | ||
6377 | } | ||
6162 | bfa_sm_set_state(dport, bfa_dport_sm_enabled); | 6378 | bfa_sm_set_state(dport, bfa_dport_sm_enabled); |
6163 | break; | 6379 | break; |
6164 | 6380 | ||
6381 | case BFA_DPORT_SM_REQFAIL: | ||
6382 | dport->test_state = BFA_DPORT_ST_DISABLED; | ||
6383 | bfa_fcport_dportdisable(dport->bfa); | ||
6384 | bfa_sm_set_state(dport, bfa_dport_sm_disabled); | ||
6385 | break; | ||
6386 | |||
6165 | case BFA_DPORT_SM_HWFAIL: | 6387 | case BFA_DPORT_SM_HWFAIL: |
6166 | bfa_sm_set_state(dport, bfa_dport_sm_disabled); | 6388 | bfa_sm_set_state(dport, bfa_dport_sm_disabled); |
6167 | bfa_cb_fcdiag_dport(dport, BFA_STATUS_FAILED); | 6389 | bfa_cb_fcdiag_dport(dport, BFA_STATUS_FAILED); |
@@ -6178,8 +6400,11 @@ bfa_dport_sm_enabled(struct bfa_dport_s *dport, enum bfa_dport_sm_event event) | |||
6178 | bfa_trc(dport->bfa, event); | 6400 | bfa_trc(dport->bfa, event); |
6179 | 6401 | ||
6180 | switch (event) { | 6402 | switch (event) { |
6181 | case BFA_DPORT_SM_ENABLE: | 6403 | case BFA_DPORT_SM_START: |
6182 | /* Already enabled */ | 6404 | if (bfa_dport_send_req(dport, BFI_DPORT_START)) |
6405 | bfa_sm_set_state(dport, bfa_dport_sm_starting); | ||
6406 | else | ||
6407 | bfa_sm_set_state(dport, bfa_dport_sm_starting_qwait); | ||
6183 | break; | 6408 | break; |
6184 | 6409 | ||
6185 | case BFA_DPORT_SM_DISABLE: | 6410 | case BFA_DPORT_SM_DISABLE: |
@@ -6194,6 +6419,48 @@ bfa_dport_sm_enabled(struct bfa_dport_s *dport, enum bfa_dport_sm_event event) | |||
6194 | bfa_sm_set_state(dport, bfa_dport_sm_disabled); | 6419 | bfa_sm_set_state(dport, bfa_dport_sm_disabled); |
6195 | break; | 6420 | break; |
6196 | 6421 | ||
6422 | case BFA_DPORT_SM_SCN: | ||
6423 | switch (dport->i2hmsg.scn.state) { | ||
6424 | case BFI_DPORT_SCN_TESTCOMP: | ||
6425 | dport->test_state = BFA_DPORT_ST_COMP; | ||
6426 | break; | ||
6427 | |||
6428 | case BFI_DPORT_SCN_TESTSTART: | ||
6429 | dport->test_state = BFA_DPORT_ST_INP; | ||
6430 | break; | ||
6431 | |||
6432 | case BFI_DPORT_SCN_TESTSKIP: | ||
6433 | case BFI_DPORT_SCN_SUBTESTSTART: | ||
6434 | /* no state change */ | ||
6435 | break; | ||
6436 | |||
6437 | case BFI_DPORT_SCN_SFP_REMOVED: | ||
6438 | dport->test_state = BFA_DPORT_ST_NO_SFP; | ||
6439 | break; | ||
6440 | |||
6441 | case BFI_DPORT_SCN_DDPORT_DISABLE: | ||
6442 | bfa_fcport_ddportdisable(dport->bfa); | ||
6443 | |||
6444 | if (bfa_dport_send_req(dport, BFI_DPORT_DYN_DISABLE)) | ||
6445 | bfa_sm_set_state(dport, | ||
6446 | bfa_dport_sm_dynamic_disabling); | ||
6447 | else | ||
6448 | bfa_sm_set_state(dport, | ||
6449 | bfa_dport_sm_dynamic_disabling_qwait); | ||
6450 | break; | ||
6451 | |||
6452 | case BFI_DPORT_SCN_FCPORT_DISABLE: | ||
6453 | bfa_fcport_ddportdisable(dport->bfa); | ||
6454 | |||
6455 | bfa_sm_set_state(dport, bfa_dport_sm_disabled); | ||
6456 | dport->dynamic = BFA_FALSE; | ||
6457 | break; | ||
6458 | |||
6459 | default: | ||
6460 | bfa_trc(dport->bfa, dport->i2hmsg.scn.state); | ||
6461 | bfa_sm_fault(dport->bfa, event); | ||
6462 | } | ||
6463 | break; | ||
6197 | default: | 6464 | default: |
6198 | bfa_sm_fault(dport->bfa, event); | 6465 | bfa_sm_fault(dport->bfa, event); |
6199 | } | 6466 | } |
@@ -6217,6 +6484,10 @@ bfa_dport_sm_disabling_qwait(struct bfa_dport_s *dport, | |||
6217 | bfa_cb_fcdiag_dport(dport, BFA_STATUS_OK); | 6484 | bfa_cb_fcdiag_dport(dport, BFA_STATUS_OK); |
6218 | break; | 6485 | break; |
6219 | 6486 | ||
6487 | case BFA_DPORT_SM_SCN: | ||
6488 | /* ignore */ | ||
6489 | break; | ||
6490 | |||
6220 | default: | 6491 | default: |
6221 | bfa_sm_fault(dport->bfa, event); | 6492 | bfa_sm_fault(dport->bfa, event); |
6222 | } | 6493 | } |
@@ -6229,7 +6500,98 @@ bfa_dport_sm_disabling(struct bfa_dport_s *dport, enum bfa_dport_sm_event event) | |||
6229 | 6500 | ||
6230 | switch (event) { | 6501 | switch (event) { |
6231 | case BFA_DPORT_SM_FWRSP: | 6502 | case BFA_DPORT_SM_FWRSP: |
6503 | dport->test_state = BFA_DPORT_ST_DISABLED; | ||
6504 | bfa_sm_set_state(dport, bfa_dport_sm_disabled); | ||
6505 | break; | ||
6506 | |||
6507 | case BFA_DPORT_SM_HWFAIL: | ||
6508 | bfa_sm_set_state(dport, bfa_dport_sm_disabled); | ||
6509 | bfa_cb_fcdiag_dport(dport, BFA_STATUS_OK); | ||
6510 | break; | ||
6511 | |||
6512 | case BFA_DPORT_SM_SCN: | ||
6513 | /* no state change */ | ||
6514 | break; | ||
6515 | |||
6516 | default: | ||
6517 | bfa_sm_fault(dport->bfa, event); | ||
6518 | } | ||
6519 | } | ||
6520 | |||
6521 | static void | ||
6522 | bfa_dport_sm_starting_qwait(struct bfa_dport_s *dport, | ||
6523 | enum bfa_dport_sm_event event) | ||
6524 | { | ||
6525 | bfa_trc(dport->bfa, event); | ||
6526 | |||
6527 | switch (event) { | ||
6528 | case BFA_DPORT_SM_QRESUME: | ||
6529 | bfa_sm_set_state(dport, bfa_dport_sm_starting); | ||
6530 | bfa_dport_send_req(dport, BFI_DPORT_START); | ||
6531 | break; | ||
6532 | |||
6533 | case BFA_DPORT_SM_HWFAIL: | ||
6534 | bfa_reqq_wcancel(&dport->reqq_wait); | ||
6535 | bfa_sm_set_state(dport, bfa_dport_sm_disabled); | ||
6536 | bfa_cb_fcdiag_dport(dport, BFA_STATUS_FAILED); | ||
6537 | break; | ||
6538 | |||
6539 | default: | ||
6540 | bfa_sm_fault(dport->bfa, event); | ||
6541 | } | ||
6542 | } | ||
6543 | |||
6544 | static void | ||
6545 | bfa_dport_sm_starting(struct bfa_dport_s *dport, enum bfa_dport_sm_event event) | ||
6546 | { | ||
6547 | bfa_trc(dport->bfa, event); | ||
6548 | |||
6549 | switch (event) { | ||
6550 | case BFA_DPORT_SM_FWRSP: | ||
6551 | memset(&dport->result, 0, | ||
6552 | sizeof(struct bfa_diag_dport_result_s)); | ||
6553 | if (dport->i2hmsg.rsp.status == BFA_STATUS_DPORT_INV_SFP) { | ||
6554 | dport->test_state = BFA_DPORT_ST_NO_SFP; | ||
6555 | } else { | ||
6556 | dport->test_state = BFA_DPORT_ST_INP; | ||
6557 | bfa_dport_result_start(dport, BFA_DPORT_OPMODE_MANU); | ||
6558 | } | ||
6559 | /* fall thru */ | ||
6560 | |||
6561 | case BFA_DPORT_SM_REQFAIL: | ||
6562 | bfa_sm_set_state(dport, bfa_dport_sm_enabled); | ||
6563 | break; | ||
6564 | |||
6565 | case BFA_DPORT_SM_HWFAIL: | ||
6232 | bfa_sm_set_state(dport, bfa_dport_sm_disabled); | 6566 | bfa_sm_set_state(dport, bfa_dport_sm_disabled); |
6567 | bfa_cb_fcdiag_dport(dport, BFA_STATUS_FAILED); | ||
6568 | break; | ||
6569 | |||
6570 | default: | ||
6571 | bfa_sm_fault(dport->bfa, event); | ||
6572 | } | ||
6573 | } | ||
6574 | |||
6575 | static void | ||
6576 | bfa_dport_sm_dynamic_disabling(struct bfa_dport_s *dport, | ||
6577 | enum bfa_dport_sm_event event) | ||
6578 | { | ||
6579 | bfa_trc(dport->bfa, event); | ||
6580 | |||
6581 | switch (event) { | ||
6582 | case BFA_DPORT_SM_SCN: | ||
6583 | switch (dport->i2hmsg.scn.state) { | ||
6584 | case BFI_DPORT_SCN_DDPORT_DISABLED: | ||
6585 | bfa_sm_set_state(dport, bfa_dport_sm_disabled); | ||
6586 | dport->dynamic = BFA_FALSE; | ||
6587 | bfa_fcport_enable(dport->bfa); | ||
6588 | break; | ||
6589 | |||
6590 | default: | ||
6591 | bfa_trc(dport->bfa, dport->i2hmsg.scn.state); | ||
6592 | bfa_sm_fault(dport->bfa, event); | ||
6593 | |||
6594 | } | ||
6233 | break; | 6595 | break; |
6234 | 6596 | ||
6235 | case BFA_DPORT_SM_HWFAIL: | 6597 | case BFA_DPORT_SM_HWFAIL: |
@@ -6242,6 +6604,32 @@ bfa_dport_sm_disabling(struct bfa_dport_s *dport, enum bfa_dport_sm_event event) | |||
6242 | } | 6604 | } |
6243 | } | 6605 | } |
6244 | 6606 | ||
6607 | static void | ||
6608 | bfa_dport_sm_dynamic_disabling_qwait(struct bfa_dport_s *dport, | ||
6609 | enum bfa_dport_sm_event event) | ||
6610 | { | ||
6611 | bfa_trc(dport->bfa, event); | ||
6612 | |||
6613 | switch (event) { | ||
6614 | case BFA_DPORT_SM_QRESUME: | ||
6615 | bfa_sm_set_state(dport, bfa_dport_sm_dynamic_disabling); | ||
6616 | bfa_dport_send_req(dport, BFI_DPORT_DYN_DISABLE); | ||
6617 | break; | ||
6618 | |||
6619 | case BFA_DPORT_SM_HWFAIL: | ||
6620 | bfa_sm_set_state(dport, bfa_dport_sm_disabled); | ||
6621 | bfa_reqq_wcancel(&dport->reqq_wait); | ||
6622 | bfa_cb_fcdiag_dport(dport, BFA_STATUS_OK); | ||
6623 | break; | ||
6624 | |||
6625 | case BFA_DPORT_SM_SCN: | ||
6626 | /* ignore */ | ||
6627 | break; | ||
6628 | |||
6629 | default: | ||
6630 | bfa_sm_fault(dport->bfa, event); | ||
6631 | } | ||
6632 | } | ||
6245 | 6633 | ||
6246 | static bfa_boolean_t | 6634 | static bfa_boolean_t |
6247 | bfa_dport_send_req(struct bfa_dport_s *dport, enum bfi_dport_req req) | 6635 | bfa_dport_send_req(struct bfa_dport_s *dport, enum bfi_dport_req req) |
@@ -6249,12 +6637,6 @@ bfa_dport_send_req(struct bfa_dport_s *dport, enum bfi_dport_req req) | |||
6249 | struct bfi_diag_dport_req_s *m; | 6637 | struct bfi_diag_dport_req_s *m; |
6250 | 6638 | ||
6251 | /* | 6639 | /* |
6252 | * Increment message tag before queue check, so that responses to old | ||
6253 | * requests are discarded. | ||
6254 | */ | ||
6255 | dport->msgtag++; | ||
6256 | |||
6257 | /* | ||
6258 | * check for room in queue to send request now | 6640 | * check for room in queue to send request now |
6259 | */ | 6641 | */ |
6260 | m = bfa_reqq_next(dport->bfa, BFA_REQQ_DIAG); | 6642 | m = bfa_reqq_next(dport->bfa, BFA_REQQ_DIAG); |
@@ -6266,7 +6648,10 @@ bfa_dport_send_req(struct bfa_dport_s *dport, enum bfi_dport_req req) | |||
6266 | bfi_h2i_set(m->mh, BFI_MC_DIAG, BFI_DIAG_H2I_DPORT, | 6648 | bfi_h2i_set(m->mh, BFI_MC_DIAG, BFI_DIAG_H2I_DPORT, |
6267 | bfa_fn_lpu(dport->bfa)); | 6649 | bfa_fn_lpu(dport->bfa)); |
6268 | m->req = req; | 6650 | m->req = req; |
6269 | m->msgtag = dport->msgtag; | 6651 | if ((req == BFI_DPORT_ENABLE) || (req == BFI_DPORT_START)) { |
6652 | m->lpcnt = cpu_to_be32(dport->lpcnt); | ||
6653 | m->payload = cpu_to_be32(dport->payload); | ||
6654 | } | ||
6270 | 6655 | ||
6271 | /* | 6656 | /* |
6272 | * queue I/O message to firmware | 6657 | * queue I/O message to firmware |
@@ -6285,19 +6670,131 @@ bfa_dport_qresume(void *cbarg) | |||
6285 | } | 6670 | } |
6286 | 6671 | ||
6287 | static void | 6672 | static void |
6288 | bfa_dport_req_comp(struct bfa_dport_s *dport, bfi_diag_dport_rsp_t *msg) | 6673 | bfa_dport_req_comp(struct bfa_dport_s *dport, struct bfi_diag_dport_rsp_s *msg) |
6289 | { | 6674 | { |
6290 | bfa_sm_send_event(dport, BFA_DPORT_SM_FWRSP); | 6675 | msg->status = cpu_to_be32(msg->status); |
6676 | dport->i2hmsg.rsp.status = msg->status; | ||
6677 | dport->rp_pwwn = msg->pwwn; | ||
6678 | dport->rp_nwwn = msg->nwwn; | ||
6679 | |||
6680 | if ((msg->status == BFA_STATUS_OK) || | ||
6681 | (msg->status == BFA_STATUS_DPORT_NO_SFP)) { | ||
6682 | bfa_trc(dport->bfa, msg->status); | ||
6683 | bfa_trc(dport->bfa, dport->rp_pwwn); | ||
6684 | bfa_trc(dport->bfa, dport->rp_nwwn); | ||
6685 | bfa_sm_send_event(dport, BFA_DPORT_SM_FWRSP); | ||
6686 | |||
6687 | } else { | ||
6688 | bfa_trc(dport->bfa, msg->status); | ||
6689 | bfa_sm_send_event(dport, BFA_DPORT_SM_REQFAIL); | ||
6690 | } | ||
6291 | bfa_cb_fcdiag_dport(dport, msg->status); | 6691 | bfa_cb_fcdiag_dport(dport, msg->status); |
6292 | } | 6692 | } |
6293 | 6693 | ||
6694 | static bfa_boolean_t | ||
6695 | bfa_dport_is_sending_req(struct bfa_dport_s *dport) | ||
6696 | { | ||
6697 | if (bfa_sm_cmp_state(dport, bfa_dport_sm_enabling) || | ||
6698 | bfa_sm_cmp_state(dport, bfa_dport_sm_enabling_qwait) || | ||
6699 | bfa_sm_cmp_state(dport, bfa_dport_sm_disabling) || | ||
6700 | bfa_sm_cmp_state(dport, bfa_dport_sm_disabling_qwait) || | ||
6701 | bfa_sm_cmp_state(dport, bfa_dport_sm_starting) || | ||
6702 | bfa_sm_cmp_state(dport, bfa_dport_sm_starting_qwait)) { | ||
6703 | return BFA_TRUE; | ||
6704 | } else { | ||
6705 | return BFA_FALSE; | ||
6706 | } | ||
6707 | } | ||
6708 | |||
6709 | static void | ||
6710 | bfa_dport_scn(struct bfa_dport_s *dport, struct bfi_diag_dport_scn_s *msg) | ||
6711 | { | ||
6712 | int i; | ||
6713 | uint8_t subtesttype; | ||
6714 | |||
6715 | bfa_trc(dport->bfa, msg->state); | ||
6716 | dport->i2hmsg.scn.state = msg->state; | ||
6717 | |||
6718 | switch (dport->i2hmsg.scn.state) { | ||
6719 | case BFI_DPORT_SCN_TESTCOMP: | ||
6720 | dport->result.end_time = bfa_get_log_time(); | ||
6721 | bfa_trc(dport->bfa, dport->result.end_time); | ||
6722 | |||
6723 | dport->result.status = msg->info.testcomp.status; | ||
6724 | bfa_trc(dport->bfa, dport->result.status); | ||
6725 | |||
6726 | dport->result.roundtrip_latency = | ||
6727 | cpu_to_be32(msg->info.testcomp.latency); | ||
6728 | dport->result.est_cable_distance = | ||
6729 | cpu_to_be32(msg->info.testcomp.distance); | ||
6730 | dport->result.buffer_required = | ||
6731 | be16_to_cpu(msg->info.testcomp.numbuffer); | ||
6732 | |||
6733 | dport->result.frmsz = be16_to_cpu(msg->info.testcomp.frm_sz); | ||
6734 | dport->result.speed = msg->info.testcomp.speed; | ||
6735 | |||
6736 | bfa_trc(dport->bfa, dport->result.roundtrip_latency); | ||
6737 | bfa_trc(dport->bfa, dport->result.est_cable_distance); | ||
6738 | bfa_trc(dport->bfa, dport->result.buffer_required); | ||
6739 | bfa_trc(dport->bfa, dport->result.frmsz); | ||
6740 | bfa_trc(dport->bfa, dport->result.speed); | ||
6741 | |||
6742 | for (i = DPORT_TEST_ELOOP; i < DPORT_TEST_MAX; i++) { | ||
6743 | dport->result.subtest[i].status = | ||
6744 | msg->info.testcomp.subtest_status[i]; | ||
6745 | bfa_trc(dport->bfa, dport->result.subtest[i].status); | ||
6746 | } | ||
6747 | break; | ||
6748 | |||
6749 | case BFI_DPORT_SCN_TESTSKIP: | ||
6750 | case BFI_DPORT_SCN_DDPORT_ENABLE: | ||
6751 | memset(&dport->result, 0, | ||
6752 | sizeof(struct bfa_diag_dport_result_s)); | ||
6753 | break; | ||
6754 | |||
6755 | case BFI_DPORT_SCN_TESTSTART: | ||
6756 | memset(&dport->result, 0, | ||
6757 | sizeof(struct bfa_diag_dport_result_s)); | ||
6758 | dport->rp_pwwn = msg->info.teststart.pwwn; | ||
6759 | dport->rp_nwwn = msg->info.teststart.nwwn; | ||
6760 | dport->lpcnt = cpu_to_be32(msg->info.teststart.numfrm); | ||
6761 | bfa_dport_result_start(dport, BFA_DPORT_OPMODE_AUTO); | ||
6762 | break; | ||
6763 | |||
6764 | case BFI_DPORT_SCN_SUBTESTSTART: | ||
6765 | subtesttype = msg->info.teststart.type; | ||
6766 | dport->result.subtest[subtesttype].start_time = | ||
6767 | bfa_get_log_time(); | ||
6768 | dport->result.subtest[subtesttype].status = | ||
6769 | DPORT_TEST_ST_INPRG; | ||
6770 | |||
6771 | bfa_trc(dport->bfa, subtesttype); | ||
6772 | bfa_trc(dport->bfa, | ||
6773 | dport->result.subtest[subtesttype].start_time); | ||
6774 | break; | ||
6775 | |||
6776 | case BFI_DPORT_SCN_SFP_REMOVED: | ||
6777 | case BFI_DPORT_SCN_DDPORT_DISABLED: | ||
6778 | case BFI_DPORT_SCN_DDPORT_DISABLE: | ||
6779 | case BFI_DPORT_SCN_FCPORT_DISABLE: | ||
6780 | dport->result.status = DPORT_TEST_ST_IDLE; | ||
6781 | break; | ||
6782 | |||
6783 | default: | ||
6784 | bfa_sm_fault(dport->bfa, msg->state); | ||
6785 | } | ||
6786 | |||
6787 | bfa_sm_send_event(dport, BFA_DPORT_SM_SCN); | ||
6788 | } | ||
6789 | |||
6294 | /* | 6790 | /* |
6295 | * Dport enable | 6791 | * Dport enable |
6296 | * | 6792 | * |
6297 | * @param[in] *bfa - bfa data struct | 6793 | * @param[in] *bfa - bfa data struct |
6298 | */ | 6794 | */ |
6299 | bfa_status_t | 6795 | bfa_status_t |
6300 | bfa_dport_enable(struct bfa_s *bfa, bfa_cb_diag_t cbfn, void *cbarg) | 6796 | bfa_dport_enable(struct bfa_s *bfa, u32 lpcnt, u32 pat, |
6797 | bfa_cb_diag_t cbfn, void *cbarg) | ||
6301 | { | 6798 | { |
6302 | struct bfa_fcdiag_s *fcdiag = BFA_FCDIAG_MOD(bfa); | 6799 | struct bfa_fcdiag_s *fcdiag = BFA_FCDIAG_MOD(bfa); |
6303 | struct bfa_dport_s *dport = &fcdiag->dport; | 6800 | struct bfa_dport_s *dport = &fcdiag->dport; |
@@ -6311,6 +6808,14 @@ bfa_dport_enable(struct bfa_s *bfa, bfa_cb_diag_t cbfn, void *cbarg) | |||
6311 | } | 6808 | } |
6312 | 6809 | ||
6313 | /* | 6810 | /* |
6811 | * Dport is supported in CT2 or above | ||
6812 | */ | ||
6813 | if (!(bfa_asic_id_ct2(dport->bfa->ioc.pcidev.device_id))) { | ||
6814 | bfa_trc(dport->bfa, dport->bfa->ioc.pcidev.device_id); | ||
6815 | return BFA_STATUS_FEATURE_NOT_SUPPORTED; | ||
6816 | } | ||
6817 | |||
6818 | /* | ||
6314 | * Check to see if IOC is down | 6819 | * Check to see if IOC is down |
6315 | */ | 6820 | */ |
6316 | if (!bfa_iocfc_is_operational(bfa)) | 6821 | if (!bfa_iocfc_is_operational(bfa)) |
@@ -6348,6 +6853,14 @@ bfa_dport_enable(struct bfa_s *bfa, bfa_cb_diag_t cbfn, void *cbarg) | |||
6348 | } | 6853 | } |
6349 | 6854 | ||
6350 | /* | 6855 | /* |
6856 | * Check if diag loopback is running | ||
6857 | */ | ||
6858 | if (bfa_fcdiag_lb_is_running(bfa)) { | ||
6859 | bfa_trc(dport->bfa, 0); | ||
6860 | return BFA_STATUS_DIAG_BUSY; | ||
6861 | } | ||
6862 | |||
6863 | /* | ||
6351 | * Check to see if port is disable or in dport state | 6864 | * Check to see if port is disable or in dport state |
6352 | */ | 6865 | */ |
6353 | if ((bfa_fcport_is_disabled(bfa) == BFA_FALSE) && | 6866 | if ((bfa_fcport_is_disabled(bfa) == BFA_FALSE) && |
@@ -6357,14 +6870,16 @@ bfa_dport_enable(struct bfa_s *bfa, bfa_cb_diag_t cbfn, void *cbarg) | |||
6357 | } | 6870 | } |
6358 | 6871 | ||
6359 | /* | 6872 | /* |
6873 | * Check if dport is in dynamic mode | ||
6874 | */ | ||
6875 | if (dport->dynamic) | ||
6876 | return BFA_STATUS_DDPORT_ERR; | ||
6877 | |||
6878 | /* | ||
6360 | * Check if dport is busy | 6879 | * Check if dport is busy |
6361 | */ | 6880 | */ |
6362 | if (bfa_sm_cmp_state(dport, bfa_dport_sm_enabling) || | 6881 | if (bfa_dport_is_sending_req(dport)) |
6363 | bfa_sm_cmp_state(dport, bfa_dport_sm_enabling_qwait) || | ||
6364 | bfa_sm_cmp_state(dport, bfa_dport_sm_disabling) || | ||
6365 | bfa_sm_cmp_state(dport, bfa_dport_sm_disabling_qwait)) { | ||
6366 | return BFA_STATUS_DEVBUSY; | 6882 | return BFA_STATUS_DEVBUSY; |
6367 | } | ||
6368 | 6883 | ||
6369 | /* | 6884 | /* |
6370 | * Check if dport is already enabled | 6885 | * Check if dport is already enabled |
@@ -6374,6 +6889,10 @@ bfa_dport_enable(struct bfa_s *bfa, bfa_cb_diag_t cbfn, void *cbarg) | |||
6374 | return BFA_STATUS_DPORT_ENABLED; | 6889 | return BFA_STATUS_DPORT_ENABLED; |
6375 | } | 6890 | } |
6376 | 6891 | ||
6892 | bfa_trc(dport->bfa, lpcnt); | ||
6893 | bfa_trc(dport->bfa, pat); | ||
6894 | dport->lpcnt = (lpcnt) ? lpcnt : DPORT_ENABLE_LOOPCNT_DEFAULT; | ||
6895 | dport->payload = (pat) ? pat : LB_PATTERN_DEFAULT; | ||
6377 | dport->cbfn = cbfn; | 6896 | dport->cbfn = cbfn; |
6378 | dport->cbarg = cbarg; | 6897 | dport->cbarg = cbarg; |
6379 | 6898 | ||
@@ -6402,6 +6921,13 @@ bfa_dport_disable(struct bfa_s *bfa, bfa_cb_diag_t cbfn, void *cbarg) | |||
6402 | } | 6921 | } |
6403 | 6922 | ||
6404 | /* | 6923 | /* |
6924 | * Check if dport is in dynamic mode | ||
6925 | */ | ||
6926 | if (dport->dynamic) { | ||
6927 | return BFA_STATUS_DDPORT_ERR; | ||
6928 | } | ||
6929 | |||
6930 | /* | ||
6405 | * Check to see if port is disable or in dport state | 6931 | * Check to see if port is disable or in dport state |
6406 | */ | 6932 | */ |
6407 | if ((bfa_fcport_is_disabled(bfa) == BFA_FALSE) && | 6933 | if ((bfa_fcport_is_disabled(bfa) == BFA_FALSE) && |
@@ -6413,10 +6939,7 @@ bfa_dport_disable(struct bfa_s *bfa, bfa_cb_diag_t cbfn, void *cbarg) | |||
6413 | /* | 6939 | /* |
6414 | * Check if dport is busy | 6940 | * Check if dport is busy |
6415 | */ | 6941 | */ |
6416 | if (bfa_sm_cmp_state(dport, bfa_dport_sm_enabling) || | 6942 | if (bfa_dport_is_sending_req(dport)) |
6417 | bfa_sm_cmp_state(dport, bfa_dport_sm_enabling_qwait) || | ||
6418 | bfa_sm_cmp_state(dport, bfa_dport_sm_disabling) || | ||
6419 | bfa_sm_cmp_state(dport, bfa_dport_sm_disabling_qwait)) | ||
6420 | return BFA_STATUS_DEVBUSY; | 6943 | return BFA_STATUS_DEVBUSY; |
6421 | 6944 | ||
6422 | /* | 6945 | /* |
@@ -6435,30 +6958,105 @@ bfa_dport_disable(struct bfa_s *bfa, bfa_cb_diag_t cbfn, void *cbarg) | |||
6435 | } | 6958 | } |
6436 | 6959 | ||
6437 | /* | 6960 | /* |
6438 | * Get D-port state | 6961 | * Dport start -- restart dport test |
6439 | * | 6962 | * |
6440 | * @param[in] *bfa - bfa data struct | 6963 | * @param[in] *bfa - bfa data struct |
6441 | */ | 6964 | */ |
6965 | bfa_status_t | ||
6966 | bfa_dport_start(struct bfa_s *bfa, u32 lpcnt, u32 pat, | ||
6967 | bfa_cb_diag_t cbfn, void *cbarg) | ||
6968 | { | ||
6969 | struct bfa_fcdiag_s *fcdiag = BFA_FCDIAG_MOD(bfa); | ||
6970 | struct bfa_dport_s *dport = &fcdiag->dport; | ||
6971 | |||
6972 | /* | ||
6973 | * Check to see if IOC is down | ||
6974 | */ | ||
6975 | if (!bfa_iocfc_is_operational(bfa)) | ||
6976 | return BFA_STATUS_IOC_NON_OP; | ||
6977 | |||
6978 | /* | ||
6979 | * Check if dport is in dynamic mode | ||
6980 | */ | ||
6981 | if (dport->dynamic) | ||
6982 | return BFA_STATUS_DDPORT_ERR; | ||
6983 | |||
6984 | /* | ||
6985 | * Check if dport is busy | ||
6986 | */ | ||
6987 | if (bfa_dport_is_sending_req(dport)) | ||
6988 | return BFA_STATUS_DEVBUSY; | ||
6442 | 6989 | ||
6990 | /* | ||
6991 | * Check if dport is in enabled state. | ||
6992 | * Test can only be restart when previous test has completed | ||
6993 | */ | ||
6994 | if (!bfa_sm_cmp_state(dport, bfa_dport_sm_enabled)) { | ||
6995 | bfa_trc(dport->bfa, 0); | ||
6996 | return BFA_STATUS_DPORT_DISABLED; | ||
6997 | |||
6998 | } else { | ||
6999 | if (dport->test_state == BFA_DPORT_ST_NO_SFP) | ||
7000 | return BFA_STATUS_DPORT_INV_SFP; | ||
7001 | |||
7002 | if (dport->test_state == BFA_DPORT_ST_INP) | ||
7003 | return BFA_STATUS_DEVBUSY; | ||
7004 | |||
7005 | WARN_ON(dport->test_state != BFA_DPORT_ST_COMP); | ||
7006 | } | ||
7007 | |||
7008 | bfa_trc(dport->bfa, lpcnt); | ||
7009 | bfa_trc(dport->bfa, pat); | ||
7010 | |||
7011 | dport->lpcnt = (lpcnt) ? lpcnt : DPORT_ENABLE_LOOPCNT_DEFAULT; | ||
7012 | dport->payload = (pat) ? pat : LB_PATTERN_DEFAULT; | ||
7013 | |||
7014 | dport->cbfn = cbfn; | ||
7015 | dport->cbarg = cbarg; | ||
7016 | |||
7017 | bfa_sm_send_event(dport, BFA_DPORT_SM_START); | ||
7018 | return BFA_STATUS_OK; | ||
7019 | } | ||
7020 | |||
7021 | /* | ||
7022 | * Dport show -- return dport test result | ||
7023 | * | ||
7024 | * @param[in] *bfa - bfa data struct | ||
7025 | */ | ||
6443 | bfa_status_t | 7026 | bfa_status_t |
6444 | bfa_dport_get_state(struct bfa_s *bfa, enum bfa_dport_state *state) | 7027 | bfa_dport_show(struct bfa_s *bfa, struct bfa_diag_dport_result_s *result) |
6445 | { | 7028 | { |
6446 | struct bfa_fcdiag_s *fcdiag = BFA_FCDIAG_MOD(bfa); | 7029 | struct bfa_fcdiag_s *fcdiag = BFA_FCDIAG_MOD(bfa); |
6447 | struct bfa_dport_s *dport = &fcdiag->dport; | 7030 | struct bfa_dport_s *dport = &fcdiag->dport; |
6448 | 7031 | ||
6449 | if (bfa_sm_cmp_state(dport, bfa_dport_sm_enabled)) | 7032 | /* |
6450 | *state = BFA_DPORT_ST_ENABLED; | 7033 | * Check to see if IOC is down |
6451 | else if (bfa_sm_cmp_state(dport, bfa_dport_sm_enabling) || | 7034 | */ |
6452 | bfa_sm_cmp_state(dport, bfa_dport_sm_enabling_qwait)) | 7035 | if (!bfa_iocfc_is_operational(bfa)) |
6453 | *state = BFA_DPORT_ST_ENABLING; | 7036 | return BFA_STATUS_IOC_NON_OP; |
6454 | else if (bfa_sm_cmp_state(dport, bfa_dport_sm_disabled)) | 7037 | |
6455 | *state = BFA_DPORT_ST_DISABLED; | 7038 | /* |
6456 | else if (bfa_sm_cmp_state(dport, bfa_dport_sm_disabling) || | 7039 | * Check if dport is busy |
6457 | bfa_sm_cmp_state(dport, bfa_dport_sm_disabling_qwait)) | 7040 | */ |
6458 | *state = BFA_DPORT_ST_DISABLING; | 7041 | if (bfa_dport_is_sending_req(dport)) |
6459 | else { | 7042 | return BFA_STATUS_DEVBUSY; |
6460 | bfa_trc(dport->bfa, BFA_STATUS_EINVAL); | 7043 | |
6461 | return BFA_STATUS_EINVAL; | 7044 | /* |
7045 | * Check if dport is in enabled state. | ||
7046 | */ | ||
7047 | if (!bfa_sm_cmp_state(dport, bfa_dport_sm_enabled)) { | ||
7048 | bfa_trc(dport->bfa, 0); | ||
7049 | return BFA_STATUS_DPORT_DISABLED; | ||
7050 | |||
6462 | } | 7051 | } |
7052 | |||
7053 | /* | ||
7054 | * Check if there is SFP | ||
7055 | */ | ||
7056 | if (dport->test_state == BFA_DPORT_ST_NO_SFP) | ||
7057 | return BFA_STATUS_DPORT_INV_SFP; | ||
7058 | |||
7059 | memcpy(result, &dport->result, sizeof(struct bfa_diag_dport_result_s)); | ||
7060 | |||
6463 | return BFA_STATUS_OK; | 7061 | return BFA_STATUS_OK; |
6464 | } | 7062 | } |
diff --git a/drivers/scsi/bfa/bfa_svc.h b/drivers/scsi/bfa/bfa_svc.h index 8d7fbecfcb22..ef07365991e7 100644 --- a/drivers/scsi/bfa/bfa_svc.h +++ b/drivers/scsi/bfa/bfa_svc.h | |||
@@ -405,8 +405,6 @@ struct bfa_lps_s { | |||
405 | bfa_status_t status; /* login status */ | 405 | bfa_status_t status; /* login status */ |
406 | u16 pdusz; /* max receive PDU size */ | 406 | u16 pdusz; /* max receive PDU size */ |
407 | u16 pr_bbcred; /* BB_CREDIT from peer */ | 407 | u16 pr_bbcred; /* BB_CREDIT from peer */ |
408 | u8 pr_bbscn; /* BB_SCN from peer */ | ||
409 | u8 bb_scn; /* local BB_SCN */ | ||
410 | u8 lsrjt_rsn; /* LSRJT reason */ | 408 | u8 lsrjt_rsn; /* LSRJT reason */ |
411 | u8 lsrjt_expl; /* LSRJT explanation */ | 409 | u8 lsrjt_expl; /* LSRJT explanation */ |
412 | u8 lun_mask; /* LUN mask flag */ | 410 | u8 lun_mask; /* LUN mask flag */ |
@@ -510,11 +508,12 @@ struct bfa_fcport_s { | |||
510 | bfa_boolean_t diag_busy; /* diag busy status */ | 508 | bfa_boolean_t diag_busy; /* diag busy status */ |
511 | bfa_boolean_t beacon; /* port beacon status */ | 509 | bfa_boolean_t beacon; /* port beacon status */ |
512 | bfa_boolean_t link_e2e_beacon; /* link beacon status */ | 510 | bfa_boolean_t link_e2e_beacon; /* link beacon status */ |
513 | bfa_boolean_t bbsc_op_state; /* Cred recov Oper State */ | ||
514 | struct bfa_fcport_trunk_s trunk; | 511 | struct bfa_fcport_trunk_s trunk; |
515 | u16 fcoe_vlan; | 512 | u16 fcoe_vlan; |
516 | struct bfa_mem_dma_s fcport_dma; | 513 | struct bfa_mem_dma_s fcport_dma; |
517 | bfa_boolean_t stats_dma_ready; | 514 | bfa_boolean_t stats_dma_ready; |
515 | struct bfa_bbcr_attr_s bbcr_attr; | ||
516 | enum bfa_fec_state_s fec_state; | ||
518 | }; | 517 | }; |
519 | 518 | ||
520 | #define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport) | 519 | #define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport) |
@@ -552,11 +551,12 @@ void bfa_fcport_event_register(struct bfa_s *bfa, | |||
552 | enum bfa_port_linkstate event), void *event_cbarg); | 551 | enum bfa_port_linkstate event), void *event_cbarg); |
553 | bfa_boolean_t bfa_fcport_is_disabled(struct bfa_s *bfa); | 552 | bfa_boolean_t bfa_fcport_is_disabled(struct bfa_s *bfa); |
554 | bfa_boolean_t bfa_fcport_is_dport(struct bfa_s *bfa); | 553 | bfa_boolean_t bfa_fcport_is_dport(struct bfa_s *bfa); |
554 | bfa_boolean_t bfa_fcport_is_ddport(struct bfa_s *bfa); | ||
555 | bfa_status_t bfa_fcport_set_qos_bw(struct bfa_s *bfa, | 555 | bfa_status_t bfa_fcport_set_qos_bw(struct bfa_s *bfa, |
556 | struct bfa_qos_bw_s *qos_bw); | 556 | struct bfa_qos_bw_s *qos_bw); |
557 | enum bfa_port_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa); | 557 | enum bfa_port_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa); |
558 | 558 | ||
559 | void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit, u8 bb_scn); | 559 | void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit); |
560 | bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa); | 560 | bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa); |
561 | void bfa_fcport_beacon(void *dev, bfa_boolean_t beacon, | 561 | void bfa_fcport_beacon(void *dev, bfa_boolean_t beacon, |
562 | bfa_boolean_t link_e2e_beacon); | 562 | bfa_boolean_t link_e2e_beacon); |
@@ -571,6 +571,10 @@ void bfa_fcport_dportenable(struct bfa_s *bfa); | |||
571 | void bfa_fcport_dportdisable(struct bfa_s *bfa); | 571 | void bfa_fcport_dportdisable(struct bfa_s *bfa); |
572 | bfa_status_t bfa_fcport_is_pbcdisabled(struct bfa_s *bfa); | 572 | bfa_status_t bfa_fcport_is_pbcdisabled(struct bfa_s *bfa); |
573 | void bfa_fcport_cfg_faa(struct bfa_s *bfa, u8 state); | 573 | void bfa_fcport_cfg_faa(struct bfa_s *bfa, u8 state); |
574 | bfa_status_t bfa_fcport_cfg_bbcr(struct bfa_s *bfa, | ||
575 | bfa_boolean_t on_off, u8 bb_scn); | ||
576 | bfa_status_t bfa_fcport_get_bbcr_attr(struct bfa_s *bfa, | ||
577 | struct bfa_bbcr_attr_s *bbcr_attr); | ||
574 | 578 | ||
575 | /* | 579 | /* |
576 | * bfa rport API functions | 580 | * bfa rport API functions |
@@ -667,7 +671,7 @@ struct bfa_lps_s *bfa_lps_alloc(struct bfa_s *bfa); | |||
667 | void bfa_lps_delete(struct bfa_lps_s *lps); | 671 | void bfa_lps_delete(struct bfa_lps_s *lps); |
668 | void bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa, | 672 | void bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa, |
669 | u16 pdusz, wwn_t pwwn, wwn_t nwwn, | 673 | u16 pdusz, wwn_t pwwn, wwn_t nwwn, |
670 | bfa_boolean_t auth_en, u8 bb_scn); | 674 | bfa_boolean_t auth_en); |
671 | void bfa_lps_fdisc(struct bfa_lps_s *lps, void *uarg, u16 pdusz, | 675 | void bfa_lps_fdisc(struct bfa_lps_s *lps, void *uarg, u16 pdusz, |
672 | wwn_t pwwn, wwn_t nwwn); | 676 | wwn_t pwwn, wwn_t nwwn); |
673 | void bfa_lps_fdisclogo(struct bfa_lps_s *lps); | 677 | void bfa_lps_fdisclogo(struct bfa_lps_s *lps); |
@@ -712,10 +716,18 @@ struct bfa_fcdiag_lb_s { | |||
712 | struct bfa_dport_s { | 716 | struct bfa_dport_s { |
713 | struct bfa_s *bfa; /* Back pointer to BFA */ | 717 | struct bfa_s *bfa; /* Back pointer to BFA */ |
714 | bfa_sm_t sm; /* finite state machine */ | 718 | bfa_sm_t sm; /* finite state machine */ |
715 | u32 msgtag; /* firmware msg tag for reply */ | ||
716 | struct bfa_reqq_wait_s reqq_wait; | 719 | struct bfa_reqq_wait_s reqq_wait; |
717 | bfa_cb_diag_t cbfn; | 720 | bfa_cb_diag_t cbfn; |
718 | void *cbarg; | 721 | void *cbarg; |
722 | union bfi_diag_dport_msg_u i2hmsg; | ||
723 | u8 test_state; /* enum dport_test_state */ | ||
724 | u8 dynamic; /* boolean_t */ | ||
725 | u8 rsvd[2]; | ||
726 | u32 lpcnt; | ||
727 | u32 payload; /* user defined payload pattern */ | ||
728 | wwn_t rp_pwwn; | ||
729 | wwn_t rp_nwwn; | ||
730 | struct bfa_diag_dport_result_s result; | ||
719 | }; | 731 | }; |
720 | 732 | ||
721 | struct bfa_fcdiag_s { | 733 | struct bfa_fcdiag_s { |
@@ -739,11 +751,13 @@ bfa_status_t bfa_fcdiag_queuetest(struct bfa_s *bfa, u32 ignore, | |||
739 | u32 queue, struct bfa_diag_qtest_result_s *result, | 751 | u32 queue, struct bfa_diag_qtest_result_s *result, |
740 | bfa_cb_diag_t cbfn, void *cbarg); | 752 | bfa_cb_diag_t cbfn, void *cbarg); |
741 | bfa_status_t bfa_fcdiag_lb_is_running(struct bfa_s *bfa); | 753 | bfa_status_t bfa_fcdiag_lb_is_running(struct bfa_s *bfa); |
742 | bfa_status_t bfa_dport_enable(struct bfa_s *bfa, bfa_cb_diag_t cbfn, | 754 | bfa_status_t bfa_dport_enable(struct bfa_s *bfa, u32 lpcnt, u32 pat, |
743 | void *cbarg); | 755 | bfa_cb_diag_t cbfn, void *cbarg); |
744 | bfa_status_t bfa_dport_disable(struct bfa_s *bfa, bfa_cb_diag_t cbfn, | 756 | bfa_status_t bfa_dport_disable(struct bfa_s *bfa, bfa_cb_diag_t cbfn, |
745 | void *cbarg); | 757 | void *cbarg); |
746 | bfa_status_t bfa_dport_get_state(struct bfa_s *bfa, | 758 | bfa_status_t bfa_dport_start(struct bfa_s *bfa, u32 lpcnt, u32 pat, |
747 | enum bfa_dport_state *state); | 759 | bfa_cb_diag_t cbfn, void *cbarg); |
760 | bfa_status_t bfa_dport_show(struct bfa_s *bfa, | ||
761 | struct bfa_diag_dport_result_s *result); | ||
748 | 762 | ||
749 | #endif /* __BFA_SVC_H__ */ | 763 | #endif /* __BFA_SVC_H__ */ |
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index a5f7690e819e..9611195d6703 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c | |||
@@ -63,9 +63,9 @@ int max_rport_logins = BFA_FCS_MAX_RPORT_LOGINS; | |||
63 | u32 bfi_image_cb_size, bfi_image_ct_size, bfi_image_ct2_size; | 63 | u32 bfi_image_cb_size, bfi_image_ct_size, bfi_image_ct2_size; |
64 | u32 *bfi_image_cb, *bfi_image_ct, *bfi_image_ct2; | 64 | u32 *bfi_image_cb, *bfi_image_ct, *bfi_image_ct2; |
65 | 65 | ||
66 | #define BFAD_FW_FILE_CB "cbfw-3.1.0.0.bin" | 66 | #define BFAD_FW_FILE_CB "cbfw-3.2.1.0.bin" |
67 | #define BFAD_FW_FILE_CT "ctfw-3.1.0.0.bin" | 67 | #define BFAD_FW_FILE_CT "ctfw-3.2.1.0.bin" |
68 | #define BFAD_FW_FILE_CT2 "ct2fw-3.1.0.0.bin" | 68 | #define BFAD_FW_FILE_CT2 "ct2fw-3.2.1.0.bin" |
69 | 69 | ||
70 | static u32 *bfad_load_fwimg(struct pci_dev *pdev); | 70 | static u32 *bfad_load_fwimg(struct pci_dev *pdev); |
71 | static void bfad_free_fwimg(void); | 71 | static void bfad_free_fwimg(void); |
@@ -1720,6 +1720,14 @@ struct pci_device_id bfad_id_table[] = { | |||
1720 | .class_mask = ~0, | 1720 | .class_mask = ~0, |
1721 | }, | 1721 | }, |
1722 | 1722 | ||
1723 | { | ||
1724 | .vendor = BFA_PCI_VENDOR_ID_BROCADE, | ||
1725 | .device = BFA_PCI_DEVICE_ID_CT2_QUAD, | ||
1726 | .subvendor = PCI_ANY_ID, | ||
1727 | .subdevice = PCI_ANY_ID, | ||
1728 | .class = (PCI_CLASS_SERIAL_FIBER << 8), | ||
1729 | .class_mask = ~0, | ||
1730 | }, | ||
1723 | {0, 0}, | 1731 | {0, 0}, |
1724 | }; | 1732 | }; |
1725 | 1733 | ||
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c index 72f5dc32cc12..e9a681d31223 100644 --- a/drivers/scsi/bfa/bfad_attr.c +++ b/drivers/scsi/bfa/bfad_attr.c | |||
@@ -335,23 +335,10 @@ bfad_im_reset_stats(struct Scsi_Host *shost) | |||
335 | } | 335 | } |
336 | 336 | ||
337 | /* | 337 | /* |
338 | * FC transport template entry, get rport loss timeout. | ||
339 | */ | ||
340 | static void | ||
341 | bfad_im_get_rport_loss_tmo(struct fc_rport *rport) | ||
342 | { | ||
343 | struct bfad_itnim_data_s *itnim_data = rport->dd_data; | ||
344 | struct bfad_itnim_s *itnim = itnim_data->itnim; | ||
345 | struct bfad_s *bfad = itnim->im->bfad; | ||
346 | unsigned long flags; | ||
347 | |||
348 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
349 | rport->dev_loss_tmo = bfa_fcpim_path_tov_get(&bfad->bfa); | ||
350 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
351 | } | ||
352 | |||
353 | /* | ||
354 | * FC transport template entry, set rport loss timeout. | 338 | * FC transport template entry, set rport loss timeout. |
339 | * Update dev_loss_tmo based on the value pushed down by the stack | ||
340 | * In case it is lesser than path_tov of driver, set it to path_tov + 1 | ||
341 | * to ensure that the driver times out before the application | ||
355 | */ | 342 | */ |
356 | static void | 343 | static void |
357 | bfad_im_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout) | 344 | bfad_im_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout) |
@@ -359,15 +346,11 @@ bfad_im_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout) | |||
359 | struct bfad_itnim_data_s *itnim_data = rport->dd_data; | 346 | struct bfad_itnim_data_s *itnim_data = rport->dd_data; |
360 | struct bfad_itnim_s *itnim = itnim_data->itnim; | 347 | struct bfad_itnim_s *itnim = itnim_data->itnim; |
361 | struct bfad_s *bfad = itnim->im->bfad; | 348 | struct bfad_s *bfad = itnim->im->bfad; |
362 | unsigned long flags; | 349 | uint16_t path_tov = bfa_fcpim_path_tov_get(&bfad->bfa); |
363 | |||
364 | if (timeout > 0) { | ||
365 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
366 | bfa_fcpim_path_tov_set(&bfad->bfa, timeout); | ||
367 | rport->dev_loss_tmo = bfa_fcpim_path_tov_get(&bfad->bfa); | ||
368 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
369 | } | ||
370 | 350 | ||
351 | rport->dev_loss_tmo = timeout; | ||
352 | if (timeout < path_tov) | ||
353 | rport->dev_loss_tmo = path_tov + 1; | ||
371 | } | 354 | } |
372 | 355 | ||
373 | static int | 356 | static int |
@@ -665,7 +648,6 @@ struct fc_function_template bfad_im_fc_function_template = { | |||
665 | .show_rport_maxframe_size = 1, | 648 | .show_rport_maxframe_size = 1, |
666 | .show_rport_supported_classes = 1, | 649 | .show_rport_supported_classes = 1, |
667 | .show_rport_dev_loss_tmo = 1, | 650 | .show_rport_dev_loss_tmo = 1, |
668 | .get_rport_dev_loss_tmo = bfad_im_get_rport_loss_tmo, | ||
669 | .set_rport_dev_loss_tmo = bfad_im_set_rport_loss_tmo, | 651 | .set_rport_dev_loss_tmo = bfad_im_set_rport_loss_tmo, |
670 | .issue_fc_host_lip = bfad_im_issue_fc_host_lip, | 652 | .issue_fc_host_lip = bfad_im_issue_fc_host_lip, |
671 | .vport_create = bfad_im_vport_create, | 653 | .vport_create = bfad_im_vport_create, |
@@ -723,7 +705,6 @@ struct fc_function_template bfad_im_vport_fc_function_template = { | |||
723 | .show_rport_maxframe_size = 1, | 705 | .show_rport_maxframe_size = 1, |
724 | .show_rport_supported_classes = 1, | 706 | .show_rport_supported_classes = 1, |
725 | .show_rport_dev_loss_tmo = 1, | 707 | .show_rport_dev_loss_tmo = 1, |
726 | .get_rport_dev_loss_tmo = bfad_im_get_rport_loss_tmo, | ||
727 | .set_rport_dev_loss_tmo = bfad_im_set_rport_loss_tmo, | 708 | .set_rport_dev_loss_tmo = bfad_im_set_rport_loss_tmo, |
728 | }; | 709 | }; |
729 | 710 | ||
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c index 555e7db94a1c..0467c349251a 100644 --- a/drivers/scsi/bfa/bfad_bsg.c +++ b/drivers/scsi/bfa/bfad_bsg.c | |||
@@ -402,25 +402,43 @@ bfad_iocmd_port_cfg_maxfrsize(struct bfad_s *bfad, void *cmd) | |||
402 | } | 402 | } |
403 | 403 | ||
404 | int | 404 | int |
405 | bfad_iocmd_port_cfg_bbsc(struct bfad_s *bfad, void *cmd, unsigned int v_cmd) | 405 | bfad_iocmd_port_cfg_bbcr(struct bfad_s *bfad, unsigned int cmd, void *pcmd) |
406 | { | 406 | { |
407 | struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; | 407 | struct bfa_bsg_bbcr_enable_s *iocmd = |
408 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(&bfad->bfa); | 408 | (struct bfa_bsg_bbcr_enable_s *)pcmd; |
409 | unsigned long flags; | 409 | unsigned long flags; |
410 | int rc; | ||
410 | 411 | ||
411 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 412 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
412 | if (bfa_ioc_get_type(&bfad->bfa.ioc) == BFA_IOC_TYPE_FC) { | 413 | if (cmd == IOCMD_PORT_BBCR_ENABLE) |
413 | if (v_cmd == IOCMD_PORT_BBSC_ENABLE) | 414 | rc = bfa_fcport_cfg_bbcr(&bfad->bfa, BFA_TRUE, iocmd->bb_scn); |
414 | fcport->cfg.bb_scn_state = BFA_TRUE; | 415 | else if (cmd == IOCMD_PORT_BBCR_DISABLE) |
415 | else if (v_cmd == IOCMD_PORT_BBSC_DISABLE) | 416 | rc = bfa_fcport_cfg_bbcr(&bfad->bfa, BFA_FALSE, 0); |
416 | fcport->cfg.bb_scn_state = BFA_FALSE; | 417 | else { |
418 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
419 | return -EINVAL; | ||
417 | } | 420 | } |
418 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 421 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
419 | 422 | ||
420 | iocmd->status = BFA_STATUS_OK; | 423 | iocmd->status = rc; |
424 | return 0; | ||
425 | } | ||
426 | |||
427 | int | ||
428 | bfad_iocmd_port_get_bbcr_attr(struct bfad_s *bfad, void *pcmd) | ||
429 | { | ||
430 | struct bfa_bsg_bbcr_attr_s *iocmd = (struct bfa_bsg_bbcr_attr_s *) pcmd; | ||
431 | unsigned long flags; | ||
432 | |||
433 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
434 | iocmd->status = | ||
435 | bfa_fcport_get_bbcr_attr(&bfad->bfa, &iocmd->attr); | ||
436 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
437 | |||
421 | return 0; | 438 | return 0; |
422 | } | 439 | } |
423 | 440 | ||
441 | |||
424 | static int | 442 | static int |
425 | bfad_iocmd_lport_get_attr(struct bfad_s *bfad, void *cmd) | 443 | bfad_iocmd_lport_get_attr(struct bfad_s *bfad, void *cmd) |
426 | { | 444 | { |
@@ -1767,51 +1785,87 @@ bfad_iocmd_diag_lb_stat(struct bfad_s *bfad, void *cmd) | |||
1767 | } | 1785 | } |
1768 | 1786 | ||
1769 | int | 1787 | int |
1770 | bfad_iocmd_diag_cfg_dport(struct bfad_s *bfad, unsigned int cmd, void *pcmd) | 1788 | bfad_iocmd_diag_dport_enable(struct bfad_s *bfad, void *pcmd) |
1771 | { | 1789 | { |
1772 | struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)pcmd; | 1790 | struct bfa_bsg_dport_enable_s *iocmd = |
1791 | (struct bfa_bsg_dport_enable_s *)pcmd; | ||
1773 | unsigned long flags; | 1792 | unsigned long flags; |
1774 | struct bfad_hal_comp fcomp; | 1793 | struct bfad_hal_comp fcomp; |
1775 | 1794 | ||
1776 | init_completion(&fcomp.comp); | 1795 | init_completion(&fcomp.comp); |
1777 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 1796 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
1778 | if (cmd == IOCMD_DIAG_DPORT_ENABLE) | 1797 | iocmd->status = bfa_dport_enable(&bfad->bfa, iocmd->lpcnt, |
1779 | iocmd->status = bfa_dport_enable(&bfad->bfa, | 1798 | iocmd->pat, bfad_hcb_comp, &fcomp); |
1780 | bfad_hcb_comp, &fcomp); | 1799 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
1781 | else if (cmd == IOCMD_DIAG_DPORT_DISABLE) | 1800 | if (iocmd->status != BFA_STATUS_OK) |
1782 | iocmd->status = bfa_dport_disable(&bfad->bfa, | 1801 | bfa_trc(bfad, iocmd->status); |
1783 | bfad_hcb_comp, &fcomp); | ||
1784 | else { | 1802 | else { |
1785 | bfa_trc(bfad, 0); | 1803 | wait_for_completion(&fcomp.comp); |
1786 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 1804 | iocmd->status = fcomp.status; |
1787 | return -EINVAL; | ||
1788 | } | 1805 | } |
1789 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 1806 | return 0; |
1807 | } | ||
1790 | 1808 | ||
1809 | int | ||
1810 | bfad_iocmd_diag_dport_disable(struct bfad_s *bfad, void *pcmd) | ||
1811 | { | ||
1812 | struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)pcmd; | ||
1813 | unsigned long flags; | ||
1814 | struct bfad_hal_comp fcomp; | ||
1815 | |||
1816 | init_completion(&fcomp.comp); | ||
1817 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
1818 | iocmd->status = bfa_dport_disable(&bfad->bfa, bfad_hcb_comp, &fcomp); | ||
1819 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
1791 | if (iocmd->status != BFA_STATUS_OK) | 1820 | if (iocmd->status != BFA_STATUS_OK) |
1792 | bfa_trc(bfad, iocmd->status); | 1821 | bfa_trc(bfad, iocmd->status); |
1793 | else { | 1822 | else { |
1794 | wait_for_completion(&fcomp.comp); | 1823 | wait_for_completion(&fcomp.comp); |
1795 | iocmd->status = fcomp.status; | 1824 | iocmd->status = fcomp.status; |
1796 | } | 1825 | } |
1826 | return 0; | ||
1827 | } | ||
1828 | |||
1829 | int | ||
1830 | bfad_iocmd_diag_dport_start(struct bfad_s *bfad, void *pcmd) | ||
1831 | { | ||
1832 | struct bfa_bsg_dport_enable_s *iocmd = | ||
1833 | (struct bfa_bsg_dport_enable_s *)pcmd; | ||
1834 | unsigned long flags; | ||
1835 | struct bfad_hal_comp fcomp; | ||
1836 | |||
1837 | init_completion(&fcomp.comp); | ||
1838 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
1839 | iocmd->status = bfa_dport_start(&bfad->bfa, iocmd->lpcnt, | ||
1840 | iocmd->pat, bfad_hcb_comp, | ||
1841 | &fcomp); | ||
1842 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
1843 | |||
1844 | if (iocmd->status != BFA_STATUS_OK) { | ||
1845 | bfa_trc(bfad, iocmd->status); | ||
1846 | } else { | ||
1847 | wait_for_completion(&fcomp.comp); | ||
1848 | iocmd->status = fcomp.status; | ||
1849 | } | ||
1797 | 1850 | ||
1798 | return 0; | 1851 | return 0; |
1799 | } | 1852 | } |
1800 | 1853 | ||
1801 | int | 1854 | int |
1802 | bfad_iocmd_diag_dport_get_state(struct bfad_s *bfad, void *pcmd) | 1855 | bfad_iocmd_diag_dport_show(struct bfad_s *bfad, void *pcmd) |
1803 | { | 1856 | { |
1804 | struct bfa_bsg_diag_dport_get_state_s *iocmd = | 1857 | struct bfa_bsg_diag_dport_show_s *iocmd = |
1805 | (struct bfa_bsg_diag_dport_get_state_s *)pcmd; | 1858 | (struct bfa_bsg_diag_dport_show_s *)pcmd; |
1806 | unsigned long flags; | 1859 | unsigned long flags; |
1807 | 1860 | ||
1808 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 1861 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
1809 | iocmd->status = bfa_dport_get_state(&bfad->bfa, &iocmd->state); | 1862 | iocmd->status = bfa_dport_show(&bfad->bfa, &iocmd->result); |
1810 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 1863 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
1811 | 1864 | ||
1812 | return 0; | 1865 | return 0; |
1813 | } | 1866 | } |
1814 | 1867 | ||
1868 | |||
1815 | int | 1869 | int |
1816 | bfad_iocmd_phy_get_attr(struct bfad_s *bfad, void *cmd) | 1870 | bfad_iocmd_phy_get_attr(struct bfad_s *bfad, void *cmd) |
1817 | { | 1871 | { |
@@ -2662,7 +2716,7 @@ bfad_iocmd_fruvpd_update(struct bfad_s *bfad, void *cmd) | |||
2662 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 2716 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
2663 | iocmd->status = bfa_fruvpd_update(BFA_FRU(&bfad->bfa), | 2717 | iocmd->status = bfa_fruvpd_update(BFA_FRU(&bfad->bfa), |
2664 | &iocmd->data, iocmd->len, iocmd->offset, | 2718 | &iocmd->data, iocmd->len, iocmd->offset, |
2665 | bfad_hcb_comp, &fcomp); | 2719 | bfad_hcb_comp, &fcomp, iocmd->trfr_cmpl); |
2666 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 2720 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
2667 | if (iocmd->status == BFA_STATUS_OK) { | 2721 | if (iocmd->status == BFA_STATUS_OK) { |
2668 | wait_for_completion(&fcomp.comp); | 2722 | wait_for_completion(&fcomp.comp); |
@@ -2750,9 +2804,12 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, | |||
2750 | case IOCMD_PORT_CFG_MAXFRSZ: | 2804 | case IOCMD_PORT_CFG_MAXFRSZ: |
2751 | rc = bfad_iocmd_port_cfg_maxfrsize(bfad, iocmd); | 2805 | rc = bfad_iocmd_port_cfg_maxfrsize(bfad, iocmd); |
2752 | break; | 2806 | break; |
2753 | case IOCMD_PORT_BBSC_ENABLE: | 2807 | case IOCMD_PORT_BBCR_ENABLE: |
2754 | case IOCMD_PORT_BBSC_DISABLE: | 2808 | case IOCMD_PORT_BBCR_DISABLE: |
2755 | rc = bfad_iocmd_port_cfg_bbsc(bfad, iocmd, cmd); | 2809 | rc = bfad_iocmd_port_cfg_bbcr(bfad, cmd, iocmd); |
2810 | break; | ||
2811 | case IOCMD_PORT_BBCR_GET_ATTR: | ||
2812 | rc = bfad_iocmd_port_get_bbcr_attr(bfad, iocmd); | ||
2756 | break; | 2813 | break; |
2757 | case IOCMD_LPORT_GET_ATTR: | 2814 | case IOCMD_LPORT_GET_ATTR: |
2758 | rc = bfad_iocmd_lport_get_attr(bfad, iocmd); | 2815 | rc = bfad_iocmd_lport_get_attr(bfad, iocmd); |
@@ -2913,11 +2970,16 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, | |||
2913 | rc = bfad_iocmd_diag_lb_stat(bfad, iocmd); | 2970 | rc = bfad_iocmd_diag_lb_stat(bfad, iocmd); |
2914 | break; | 2971 | break; |
2915 | case IOCMD_DIAG_DPORT_ENABLE: | 2972 | case IOCMD_DIAG_DPORT_ENABLE: |
2973 | rc = bfad_iocmd_diag_dport_enable(bfad, iocmd); | ||
2974 | break; | ||
2916 | case IOCMD_DIAG_DPORT_DISABLE: | 2975 | case IOCMD_DIAG_DPORT_DISABLE: |
2917 | rc = bfad_iocmd_diag_cfg_dport(bfad, cmd, iocmd); | 2976 | rc = bfad_iocmd_diag_dport_disable(bfad, iocmd); |
2977 | break; | ||
2978 | case IOCMD_DIAG_DPORT_SHOW: | ||
2979 | rc = bfad_iocmd_diag_dport_show(bfad, iocmd); | ||
2918 | break; | 2980 | break; |
2919 | case IOCMD_DIAG_DPORT_GET_STATE: | 2981 | case IOCMD_DIAG_DPORT_START: |
2920 | rc = bfad_iocmd_diag_dport_get_state(bfad, iocmd); | 2982 | rc = bfad_iocmd_diag_dport_start(bfad, iocmd); |
2921 | break; | 2983 | break; |
2922 | case IOCMD_PHY_GET_ATTR: | 2984 | case IOCMD_PHY_GET_ATTR: |
2923 | rc = bfad_iocmd_phy_get_attr(bfad, iocmd); | 2985 | rc = bfad_iocmd_phy_get_attr(bfad, iocmd); |
@@ -3309,7 +3371,8 @@ bfad_im_bsg_els_ct_request(struct fc_bsg_job *job) | |||
3309 | goto out; | 3371 | goto out; |
3310 | } | 3372 | } |
3311 | 3373 | ||
3312 | if (copy_from_user((uint8_t *)bsg_fcpt, bsg_data->payload, | 3374 | if (copy_from_user((uint8_t *)bsg_fcpt, |
3375 | (void *)(unsigned long)bsg_data->payload, | ||
3313 | bsg_data->payload_len)) { | 3376 | bsg_data->payload_len)) { |
3314 | kfree(bsg_fcpt); | 3377 | kfree(bsg_fcpt); |
3315 | rc = -EIO; | 3378 | rc = -EIO; |
@@ -3463,8 +3526,8 @@ out_free_mem: | |||
3463 | kfree(rsp_kbuf); | 3526 | kfree(rsp_kbuf); |
3464 | 3527 | ||
3465 | /* Need a copy to user op */ | 3528 | /* Need a copy to user op */ |
3466 | if (copy_to_user(bsg_data->payload, (void *) bsg_fcpt, | 3529 | if (copy_to_user((void *)(unsigned long)bsg_data->payload, |
3467 | bsg_data->payload_len)) | 3530 | (void *)bsg_fcpt, bsg_data->payload_len)) |
3468 | rc = -EIO; | 3531 | rc = -EIO; |
3469 | 3532 | ||
3470 | kfree(bsg_fcpt); | 3533 | kfree(bsg_fcpt); |
diff --git a/drivers/scsi/bfa/bfad_bsg.h b/drivers/scsi/bfa/bfad_bsg.h index 15e1fc8e796b..05f0fc9cf063 100644 --- a/drivers/scsi/bfa/bfad_bsg.h +++ b/drivers/scsi/bfa/bfad_bsg.h | |||
@@ -46,8 +46,9 @@ enum { | |||
46 | IOCMD_PORT_CFG_ALPA, | 46 | IOCMD_PORT_CFG_ALPA, |
47 | IOCMD_PORT_CFG_MAXFRSZ, | 47 | IOCMD_PORT_CFG_MAXFRSZ, |
48 | IOCMD_PORT_CLR_ALPA, | 48 | IOCMD_PORT_CLR_ALPA, |
49 | IOCMD_PORT_BBSC_ENABLE, | 49 | IOCMD_PORT_BBCR_ENABLE, |
50 | IOCMD_PORT_BBSC_DISABLE, | 50 | IOCMD_PORT_BBCR_DISABLE, |
51 | IOCMD_PORT_BBCR_GET_ATTR, | ||
51 | IOCMD_LPORT_GET_ATTR, | 52 | IOCMD_LPORT_GET_ATTR, |
52 | IOCMD_LPORT_GET_RPORTS, | 53 | IOCMD_LPORT_GET_RPORTS, |
53 | IOCMD_LPORT_GET_STATS, | 54 | IOCMD_LPORT_GET_STATS, |
@@ -143,7 +144,6 @@ enum { | |||
143 | IOCMD_FCPIM_LUNMASK_DELETE, | 144 | IOCMD_FCPIM_LUNMASK_DELETE, |
144 | IOCMD_DIAG_DPORT_ENABLE, | 145 | IOCMD_DIAG_DPORT_ENABLE, |
145 | IOCMD_DIAG_DPORT_DISABLE, | 146 | IOCMD_DIAG_DPORT_DISABLE, |
146 | IOCMD_DIAG_DPORT_GET_STATE, | ||
147 | IOCMD_QOS_SET_BW, | 147 | IOCMD_QOS_SET_BW, |
148 | IOCMD_FCPIM_THROTTLE_QUERY, | 148 | IOCMD_FCPIM_THROTTLE_QUERY, |
149 | IOCMD_FCPIM_THROTTLE_SET, | 149 | IOCMD_FCPIM_THROTTLE_SET, |
@@ -152,6 +152,8 @@ enum { | |||
152 | IOCMD_FRUVPD_READ, | 152 | IOCMD_FRUVPD_READ, |
153 | IOCMD_FRUVPD_UPDATE, | 153 | IOCMD_FRUVPD_UPDATE, |
154 | IOCMD_FRUVPD_GET_MAX_SIZE, | 154 | IOCMD_FRUVPD_GET_MAX_SIZE, |
155 | IOCMD_DIAG_DPORT_SHOW, | ||
156 | IOCMD_DIAG_DPORT_START, | ||
155 | }; | 157 | }; |
156 | 158 | ||
157 | struct bfa_bsg_gen_s { | 159 | struct bfa_bsg_gen_s { |
@@ -495,6 +497,20 @@ struct bfa_bsg_port_cfg_mode_s { | |||
495 | struct bfa_port_cfg_mode_s cfg; | 497 | struct bfa_port_cfg_mode_s cfg; |
496 | }; | 498 | }; |
497 | 499 | ||
500 | struct bfa_bsg_bbcr_enable_s { | ||
501 | bfa_status_t status; | ||
502 | u16 bfad_num; | ||
503 | u8 bb_scn; | ||
504 | u8 rsvd; | ||
505 | }; | ||
506 | |||
507 | struct bfa_bsg_bbcr_attr_s { | ||
508 | bfa_status_t status; | ||
509 | u16 bfad_num; | ||
510 | u16 rsvd; | ||
511 | struct bfa_bbcr_attr_s attr; | ||
512 | }; | ||
513 | |||
498 | struct bfa_bsg_faa_attr_s { | 514 | struct bfa_bsg_faa_attr_s { |
499 | bfa_status_t status; | 515 | bfa_status_t status; |
500 | u16 bfad_num; | 516 | u16 bfad_num; |
@@ -578,6 +594,21 @@ struct bfa_bsg_diag_loopback_s { | |||
578 | struct bfa_diag_loopback_result_s result; | 594 | struct bfa_diag_loopback_result_s result; |
579 | }; | 595 | }; |
580 | 596 | ||
597 | struct bfa_bsg_diag_dport_show_s { | ||
598 | bfa_status_t status; | ||
599 | u16 bfad_num; | ||
600 | u16 rsvd; | ||
601 | struct bfa_diag_dport_result_s result; | ||
602 | }; | ||
603 | |||
604 | struct bfa_bsg_dport_enable_s { | ||
605 | bfa_status_t status; | ||
606 | u16 bfad_num; | ||
607 | u16 rsvd; | ||
608 | u16 lpcnt; | ||
609 | u16 pat; | ||
610 | }; | ||
611 | |||
581 | struct bfa_bsg_diag_fwping_s { | 612 | struct bfa_bsg_diag_fwping_s { |
582 | bfa_status_t status; | 613 | bfa_status_t status; |
583 | u16 bfad_num; | 614 | u16 bfad_num; |
@@ -625,13 +656,6 @@ struct bfa_bsg_diag_lb_stat_s { | |||
625 | u16 rsvd; | 656 | u16 rsvd; |
626 | }; | 657 | }; |
627 | 658 | ||
628 | struct bfa_bsg_diag_dport_get_state_s { | ||
629 | bfa_status_t status; | ||
630 | u16 bfad_num; | ||
631 | u16 rsvd; | ||
632 | enum bfa_dport_state state; | ||
633 | }; | ||
634 | |||
635 | struct bfa_bsg_phy_attr_s { | 659 | struct bfa_bsg_phy_attr_s { |
636 | bfa_status_t status; | 660 | bfa_status_t status; |
637 | u16 bfad_num; | 661 | u16 bfad_num; |
@@ -770,10 +794,12 @@ struct bfa_bsg_tfru_s { | |||
770 | struct bfa_bsg_fruvpd_s { | 794 | struct bfa_bsg_fruvpd_s { |
771 | bfa_status_t status; | 795 | bfa_status_t status; |
772 | u16 bfad_num; | 796 | u16 bfad_num; |
773 | u16 rsvd; | 797 | u16 rsvd1; |
774 | u32 offset; | 798 | u32 offset; |
775 | u32 len; | 799 | u32 len; |
776 | u8 data[BFA_MAX_FRUVPD_TRANSFER_SIZE]; | 800 | u8 data[BFA_MAX_FRUVPD_TRANSFER_SIZE]; |
801 | u8 trfr_cmpl; | ||
802 | u8 rsvd2[3]; | ||
777 | }; | 803 | }; |
778 | 804 | ||
779 | struct bfa_bsg_fruvpd_max_size_s { | 805 | struct bfa_bsg_fruvpd_max_size_s { |
@@ -795,10 +821,12 @@ struct bfa_bsg_fcpt_s { | |||
795 | }; | 821 | }; |
796 | #define bfa_bsg_fcpt_t struct bfa_bsg_fcpt_s | 822 | #define bfa_bsg_fcpt_t struct bfa_bsg_fcpt_s |
797 | 823 | ||
824 | #pragma pack(1) | ||
798 | struct bfa_bsg_data { | 825 | struct bfa_bsg_data { |
799 | int payload_len; | 826 | int payload_len; |
800 | void *payload; | 827 | u64 payload; |
801 | }; | 828 | }; |
829 | #pragma pack() | ||
802 | 830 | ||
803 | #define bfad_chk_iocmd_sz(__payload_len, __hdrsz, __bufsz) \ | 831 | #define bfad_chk_iocmd_sz(__payload_len, __hdrsz, __bufsz) \ |
804 | (((__payload_len) != ((__hdrsz) + (__bufsz))) ? \ | 832 | (((__payload_len) != ((__hdrsz) + (__bufsz))) ? \ |
diff --git a/drivers/scsi/bfa/bfad_drv.h b/drivers/scsi/bfa/bfad_drv.h index 0c64a04f01fa..78d3401bc16b 100644 --- a/drivers/scsi/bfa/bfad_drv.h +++ b/drivers/scsi/bfa/bfad_drv.h | |||
@@ -57,7 +57,7 @@ | |||
57 | #ifdef BFA_DRIVER_VERSION | 57 | #ifdef BFA_DRIVER_VERSION |
58 | #define BFAD_DRIVER_VERSION BFA_DRIVER_VERSION | 58 | #define BFAD_DRIVER_VERSION BFA_DRIVER_VERSION |
59 | #else | 59 | #else |
60 | #define BFAD_DRIVER_VERSION "3.1.2.1" | 60 | #define BFAD_DRIVER_VERSION "3.2.21.1" |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | #define BFAD_PROTO_NAME FCPI_NAME | 63 | #define BFAD_PROTO_NAME FCPI_NAME |
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index 5864f987f206..9796284512a9 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c | |||
@@ -944,13 +944,15 @@ static int | |||
944 | bfad_im_slave_alloc(struct scsi_device *sdev) | 944 | bfad_im_slave_alloc(struct scsi_device *sdev) |
945 | { | 945 | { |
946 | struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); | 946 | struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); |
947 | struct bfad_itnim_data_s *itnim_data = | 947 | struct bfad_itnim_data_s *itnim_data; |
948 | (struct bfad_itnim_data_s *) rport->dd_data; | 948 | struct bfa_s *bfa; |
949 | struct bfa_s *bfa = itnim_data->itnim->bfa_itnim->bfa; | ||
950 | 949 | ||
951 | if (!rport || fc_remote_port_chkready(rport)) | 950 | if (!rport || fc_remote_port_chkready(rport)) |
952 | return -ENXIO; | 951 | return -ENXIO; |
953 | 952 | ||
953 | itnim_data = (struct bfad_itnim_data_s *) rport->dd_data; | ||
954 | bfa = itnim_data->itnim->bfa_itnim->bfa; | ||
955 | |||
954 | if (bfa_get_lun_mask_status(bfa) == BFA_LUNMASK_ENABLED) { | 956 | if (bfa_get_lun_mask_status(bfa) == BFA_LUNMASK_ENABLED) { |
955 | /* | 957 | /* |
956 | * We should not mask LUN 0 - since this will translate | 958 | * We should not mask LUN 0 - since this will translate |
@@ -1035,7 +1037,7 @@ bfad_fc_host_init(struct bfad_im_port_s *im_port) | |||
1035 | /* For fibre channel services type 0x20 */ | 1037 | /* For fibre channel services type 0x20 */ |
1036 | fc_host_supported_fc4s(host)[7] = 1; | 1038 | fc_host_supported_fc4s(host)[7] = 1; |
1037 | 1039 | ||
1038 | strncpy(symname, bfad->bfa_fcs.fabric.bport.port_cfg.sym_name.symname, | 1040 | strlcpy(symname, bfad->bfa_fcs.fabric.bport.port_cfg.sym_name.symname, |
1039 | BFA_SYMNAME_MAXLEN); | 1041 | BFA_SYMNAME_MAXLEN); |
1040 | sprintf(fc_host_symbolic_name(host), "%s", symname); | 1042 | sprintf(fc_host_symbolic_name(host), "%s", symname); |
1041 | 1043 | ||
diff --git a/drivers/scsi/bfa/bfi.h b/drivers/scsi/bfa/bfi.h index 57b146bca18c..37bd2564e83b 100644 --- a/drivers/scsi/bfa/bfi.h +++ b/drivers/scsi/bfa/bfi.h | |||
@@ -264,6 +264,7 @@ struct bfi_ioc_getattr_req_s { | |||
264 | union bfi_addr_u attr_addr; | 264 | union bfi_addr_u attr_addr; |
265 | }; | 265 | }; |
266 | 266 | ||
267 | #define BFI_IOC_ATTR_UUID_SZ 16 | ||
267 | struct bfi_ioc_attr_s { | 268 | struct bfi_ioc_attr_s { |
268 | wwn_t mfg_pwwn; /* Mfg port wwn */ | 269 | wwn_t mfg_pwwn; /* Mfg port wwn */ |
269 | wwn_t mfg_nwwn; /* Mfg node wwn */ | 270 | wwn_t mfg_nwwn; /* Mfg node wwn */ |
@@ -292,6 +293,7 @@ struct bfi_ioc_attr_s { | |||
292 | u8 mfg_day; /* manufacturing day */ | 293 | u8 mfg_day; /* manufacturing day */ |
293 | u8 mfg_month; /* manufacturing month */ | 294 | u8 mfg_month; /* manufacturing month */ |
294 | u16 mfg_year; /* manufacturing year */ | 295 | u16 mfg_year; /* manufacturing year */ |
296 | u8 uuid[BFI_IOC_ATTR_UUID_SZ]; /*!< chinook uuid */ | ||
295 | }; | 297 | }; |
296 | 298 | ||
297 | /* | 299 | /* |
@@ -374,6 +376,10 @@ enum bfi_ioc_state { | |||
374 | BFI_IOC_MEMTEST = 9, /* IOC is doing memtest */ | 376 | BFI_IOC_MEMTEST = 9, /* IOC is doing memtest */ |
375 | }; | 377 | }; |
376 | 378 | ||
379 | #define BFA_IOC_CB_JOIN_SH 16 | ||
380 | #define BFA_IOC_CB_FWSTATE_MASK 0x0000ffff | ||
381 | #define BFA_IOC_CB_JOIN_MASK 0xffff0000 | ||
382 | |||
377 | #define BFI_IOC_ENDIAN_SIG 0x12345678 | 383 | #define BFI_IOC_ENDIAN_SIG 0x12345678 |
378 | 384 | ||
379 | enum { | 385 | enum { |
@@ -973,6 +979,7 @@ enum bfi_diag_i2h { | |||
973 | BFI_DIAG_I2H_LEDTEST = BFA_I2HM(BFI_DIAG_H2I_LEDTEST), | 979 | BFI_DIAG_I2H_LEDTEST = BFA_I2HM(BFI_DIAG_H2I_LEDTEST), |
974 | BFI_DIAG_I2H_QTEST = BFA_I2HM(BFI_DIAG_H2I_QTEST), | 980 | BFI_DIAG_I2H_QTEST = BFA_I2HM(BFI_DIAG_H2I_QTEST), |
975 | BFI_DIAG_I2H_DPORT = BFA_I2HM(BFI_DIAG_H2I_DPORT), | 981 | BFI_DIAG_I2H_DPORT = BFA_I2HM(BFI_DIAG_H2I_DPORT), |
982 | BFI_DIAG_I2H_DPORT_SCN = BFA_I2HM(8), | ||
976 | }; | 983 | }; |
977 | 984 | ||
978 | #define BFI_DIAG_MAX_SGES 2 | 985 | #define BFI_DIAG_MAX_SGES 2 |
@@ -1064,16 +1071,73 @@ struct bfi_diag_qtest_req_s { | |||
1064 | enum bfi_dport_req { | 1071 | enum bfi_dport_req { |
1065 | BFI_DPORT_DISABLE = 0, /* disable dport request */ | 1072 | BFI_DPORT_DISABLE = 0, /* disable dport request */ |
1066 | BFI_DPORT_ENABLE = 1, /* enable dport request */ | 1073 | BFI_DPORT_ENABLE = 1, /* enable dport request */ |
1074 | BFI_DPORT_START = 2, /* start dport request */ | ||
1075 | BFI_DPORT_SHOW = 3, /* show dport request */ | ||
1076 | BFI_DPORT_DYN_DISABLE = 4, /* disable dynamic dport request */ | ||
1077 | }; | ||
1078 | |||
1079 | enum bfi_dport_scn { | ||
1080 | BFI_DPORT_SCN_TESTSTART = 1, | ||
1081 | BFI_DPORT_SCN_TESTCOMP = 2, | ||
1082 | BFI_DPORT_SCN_SFP_REMOVED = 3, | ||
1083 | BFI_DPORT_SCN_DDPORT_ENABLE = 4, | ||
1084 | BFI_DPORT_SCN_DDPORT_DISABLE = 5, | ||
1085 | BFI_DPORT_SCN_FCPORT_DISABLE = 6, | ||
1086 | BFI_DPORT_SCN_SUBTESTSTART = 7, | ||
1087 | BFI_DPORT_SCN_TESTSKIP = 8, | ||
1088 | BFI_DPORT_SCN_DDPORT_DISABLED = 9, | ||
1067 | }; | 1089 | }; |
1068 | 1090 | ||
1069 | struct bfi_diag_dport_req_s { | 1091 | struct bfi_diag_dport_req_s { |
1070 | struct bfi_mhdr_s mh; /* 4 bytes */ | 1092 | struct bfi_mhdr_s mh; /* 4 bytes */ |
1071 | u8 req; /* request 1: enable 0: disable */ | 1093 | u8 req; /* request 1: enable 0: disable */ |
1072 | u8 status; /* reply status */ | 1094 | u8 rsvd[3]; |
1073 | u8 rsvd[2]; | 1095 | u32 lpcnt; |
1074 | u32 msgtag; /* msgtag for reply */ | 1096 | u32 payload; |
1097 | }; | ||
1098 | |||
1099 | struct bfi_diag_dport_rsp_s { | ||
1100 | struct bfi_mhdr_s mh; /* header 4 bytes */ | ||
1101 | bfa_status_t status; /* reply status */ | ||
1102 | wwn_t pwwn; /* switch port wwn. 8 bytes */ | ||
1103 | wwn_t nwwn; /* switch node wwn. 8 bytes */ | ||
1104 | }; | ||
1105 | |||
1106 | struct bfi_diag_dport_scn_teststart_s { | ||
1107 | wwn_t pwwn; /* switch port wwn. 8 bytes */ | ||
1108 | wwn_t nwwn; /* switch node wwn. 8 bytes */ | ||
1109 | u8 type; /* bfa_diag_dport_test_type_e */ | ||
1110 | u8 rsvd[3]; | ||
1111 | u32 numfrm; /* from switch uint in 1M */ | ||
1112 | }; | ||
1113 | |||
1114 | struct bfi_diag_dport_scn_testcomp_s { | ||
1115 | u8 status; /* bfa_diag_dport_test_status_e */ | ||
1116 | u8 speed; /* bfa_port_speed_t */ | ||
1117 | u16 numbuffer; /* from switch */ | ||
1118 | u8 subtest_status[DPORT_TEST_MAX]; /* 4 bytes */ | ||
1119 | u32 latency; /* from switch */ | ||
1120 | u32 distance; /* from swtich unit in meters */ | ||
1121 | /* Buffers required to saturate the link */ | ||
1122 | u16 frm_sz; /* from switch for buf_reqd */ | ||
1123 | u8 rsvd[2]; | ||
1124 | }; | ||
1125 | |||
1126 | struct bfi_diag_dport_scn_s { /* max size == RDS_RMESZ */ | ||
1127 | struct bfi_mhdr_s mh; /* header 4 bytes */ | ||
1128 | u8 state; /* new state */ | ||
1129 | u8 rsvd[3]; | ||
1130 | union { | ||
1131 | struct bfi_diag_dport_scn_teststart_s teststart; | ||
1132 | struct bfi_diag_dport_scn_testcomp_s testcomp; | ||
1133 | } info; | ||
1134 | }; | ||
1135 | |||
1136 | union bfi_diag_dport_msg_u { | ||
1137 | struct bfi_diag_dport_req_s req; | ||
1138 | struct bfi_diag_dport_rsp_s rsp; | ||
1139 | struct bfi_diag_dport_scn_s scn; | ||
1075 | }; | 1140 | }; |
1076 | #define bfi_diag_dport_rsp_t struct bfi_diag_dport_req_s | ||
1077 | 1141 | ||
1078 | /* | 1142 | /* |
1079 | * PHY module specific | 1143 | * PHY module specific |
@@ -1191,7 +1255,9 @@ enum bfi_fru_i2h_msgs { | |||
1191 | struct bfi_fru_write_req_s { | 1255 | struct bfi_fru_write_req_s { |
1192 | struct bfi_mhdr_s mh; /* Common msg header */ | 1256 | struct bfi_mhdr_s mh; /* Common msg header */ |
1193 | u8 last; | 1257 | u8 last; |
1194 | u8 rsv[3]; | 1258 | u8 rsv_1[3]; |
1259 | u8 trfr_cmpl; | ||
1260 | u8 rsv_2[3]; | ||
1195 | u32 offset; | 1261 | u32 offset; |
1196 | u32 length; | 1262 | u32 length; |
1197 | struct bfi_alen_s alen; | 1263 | struct bfi_alen_s alen; |
diff --git a/drivers/scsi/bfa/bfi_ms.h b/drivers/scsi/bfa/bfi_ms.h index 5ae2c167b2c8..1a3fe5ad58fa 100644 --- a/drivers/scsi/bfa/bfi_ms.h +++ b/drivers/scsi/bfa/bfi_ms.h | |||
@@ -276,8 +276,7 @@ struct bfi_fcport_enable_req_s { | |||
276 | struct bfi_fcport_set_svc_params_req_s { | 276 | struct bfi_fcport_set_svc_params_req_s { |
277 | struct bfi_mhdr_s mh; /* msg header */ | 277 | struct bfi_mhdr_s mh; /* msg header */ |
278 | __be16 tx_bbcredit; /* Tx credits */ | 278 | __be16 tx_bbcredit; /* Tx credits */ |
279 | u8 bb_scn; /* BB_SC FC credit recovery */ | 279 | u8 rsvd[2]; |
280 | u8 rsvd; | ||
281 | }; | 280 | }; |
282 | 281 | ||
283 | /* | 282 | /* |
@@ -446,8 +445,8 @@ struct bfi_lps_login_rsp_s { | |||
446 | mac_t fcf_mac; | 445 | mac_t fcf_mac; |
447 | u8 ext_status; | 446 | u8 ext_status; |
448 | u8 brcd_switch; /* attached peer is brcd switch */ | 447 | u8 brcd_switch; /* attached peer is brcd switch */ |
449 | u8 bb_scn; /* atatched port's bb_scn */ | ||
450 | u8 bfa_tag; | 448 | u8 bfa_tag; |
449 | u8 rsvd; | ||
451 | }; | 450 | }; |
452 | 451 | ||
453 | struct bfi_lps_logout_req_s { | 452 | struct bfi_lps_logout_req_s { |
diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c index 193605519361..0eb35b9b3784 100644 --- a/drivers/scsi/csiostor/csio_hw.c +++ b/drivers/scsi/csiostor/csio_hw.c | |||
@@ -1597,87 +1597,6 @@ out: | |||
1597 | return rv; | 1597 | return rv; |
1598 | } | 1598 | } |
1599 | 1599 | ||
1600 | static int | ||
1601 | csio_config_global_rss(struct csio_hw *hw) | ||
1602 | { | ||
1603 | struct csio_mb *mbp; | ||
1604 | enum fw_retval retval; | ||
1605 | |||
1606 | mbp = mempool_alloc(hw->mb_mempool, GFP_ATOMIC); | ||
1607 | if (!mbp) { | ||
1608 | CSIO_INC_STATS(hw, n_err_nomem); | ||
1609 | return -ENOMEM; | ||
1610 | } | ||
1611 | |||
1612 | csio_rss_glb_config(hw, mbp, CSIO_MB_DEFAULT_TMO, | ||
1613 | FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL, | ||
1614 | FW_RSS_GLB_CONFIG_CMD_TNLMAPEN | | ||
1615 | FW_RSS_GLB_CONFIG_CMD_HASHTOEPLITZ | | ||
1616 | FW_RSS_GLB_CONFIG_CMD_TNLALLLKP, | ||
1617 | NULL); | ||
1618 | |||
1619 | if (csio_mb_issue(hw, mbp)) { | ||
1620 | csio_err(hw, "Issue of FW_RSS_GLB_CONFIG_CMD failed!\n"); | ||
1621 | mempool_free(mbp, hw->mb_mempool); | ||
1622 | return -EINVAL; | ||
1623 | } | ||
1624 | |||
1625 | retval = csio_mb_fw_retval(mbp); | ||
1626 | if (retval != FW_SUCCESS) { | ||
1627 | csio_err(hw, "FW_RSS_GLB_CONFIG_CMD returned 0x%x!\n", retval); | ||
1628 | mempool_free(mbp, hw->mb_mempool); | ||
1629 | return -EINVAL; | ||
1630 | } | ||
1631 | |||
1632 | mempool_free(mbp, hw->mb_mempool); | ||
1633 | |||
1634 | return 0; | ||
1635 | } | ||
1636 | |||
1637 | /* | ||
1638 | * csio_config_pfvf - Configure Physical/Virtual functions settings. | ||
1639 | * @hw: HW module | ||
1640 | * | ||
1641 | */ | ||
1642 | static int | ||
1643 | csio_config_pfvf(struct csio_hw *hw) | ||
1644 | { | ||
1645 | struct csio_mb *mbp; | ||
1646 | enum fw_retval retval; | ||
1647 | |||
1648 | mbp = mempool_alloc(hw->mb_mempool, GFP_ATOMIC); | ||
1649 | if (!mbp) { | ||
1650 | CSIO_INC_STATS(hw, n_err_nomem); | ||
1651 | return -ENOMEM; | ||
1652 | } | ||
1653 | |||
1654 | /* | ||
1655 | * For now, allow all PFs to access to all ports using a pmask | ||
1656 | * value of 0xF (M_FW_PFVF_CMD_PMASK). Once we have VFs, we will | ||
1657 | * need to provide access based on some rule. | ||
1658 | */ | ||
1659 | csio_mb_pfvf(hw, mbp, CSIO_MB_DEFAULT_TMO, hw->pfn, 0, CSIO_NEQ, | ||
1660 | CSIO_NETH_CTRL, CSIO_NIQ_FLINT, 0, 0, CSIO_NVI, CSIO_CMASK, | ||
1661 | CSIO_PMASK, CSIO_NEXACTF, CSIO_R_CAPS, CSIO_WX_CAPS, NULL); | ||
1662 | |||
1663 | if (csio_mb_issue(hw, mbp)) { | ||
1664 | csio_err(hw, "Issue of FW_PFVF_CMD failed!\n"); | ||
1665 | mempool_free(mbp, hw->mb_mempool); | ||
1666 | return -EINVAL; | ||
1667 | } | ||
1668 | |||
1669 | retval = csio_mb_fw_retval(mbp); | ||
1670 | if (retval != FW_SUCCESS) { | ||
1671 | csio_err(hw, "FW_PFVF_CMD returned 0x%x!\n", retval); | ||
1672 | mempool_free(mbp, hw->mb_mempool); | ||
1673 | return -EINVAL; | ||
1674 | } | ||
1675 | |||
1676 | mempool_free(mbp, hw->mb_mempool); | ||
1677 | |||
1678 | return 0; | ||
1679 | } | ||
1680 | |||
1681 | /* | 1600 | /* |
1682 | * csio_enable_ports - Bring up all available ports. | 1601 | * csio_enable_ports - Bring up all available ports. |
1683 | * @hw: HW module. | 1602 | * @hw: HW module. |
@@ -2056,16 +1975,6 @@ csio_hw_no_fwconfig(struct csio_hw *hw, int reset) | |||
2056 | if (rv != 0) | 1975 | if (rv != 0) |
2057 | goto out; | 1976 | goto out; |
2058 | 1977 | ||
2059 | /* Config Global RSS command */ | ||
2060 | rv = csio_config_global_rss(hw); | ||
2061 | if (rv != 0) | ||
2062 | goto out; | ||
2063 | |||
2064 | /* Configure PF/VF capabilities of device */ | ||
2065 | rv = csio_config_pfvf(hw); | ||
2066 | if (rv != 0) | ||
2067 | goto out; | ||
2068 | |||
2069 | /* device parameters */ | 1978 | /* device parameters */ |
2070 | rv = csio_get_device_params(hw); | 1979 | rv = csio_get_device_params(hw); |
2071 | if (rv != 0) | 1980 | if (rv != 0) |
diff --git a/drivers/scsi/csiostor/csio_hw.h b/drivers/scsi/csiostor/csio_hw.h index 489fc095cb03..49b1daa4476e 100644 --- a/drivers/scsi/csiostor/csio_hw.h +++ b/drivers/scsi/csiostor/csio_hw.h | |||
@@ -153,17 +153,6 @@ enum { | |||
153 | CSIO_SGE_INT_CNT_VAL_1 = 4, | 153 | CSIO_SGE_INT_CNT_VAL_1 = 4, |
154 | CSIO_SGE_INT_CNT_VAL_2 = 8, | 154 | CSIO_SGE_INT_CNT_VAL_2 = 8, |
155 | CSIO_SGE_INT_CNT_VAL_3 = 16, | 155 | CSIO_SGE_INT_CNT_VAL_3 = 16, |
156 | |||
157 | /* Storage specific - used by FW_PFVF_CMD */ | ||
158 | CSIO_WX_CAPS = FW_CMD_CAP_PF, /* w/x all */ | ||
159 | CSIO_R_CAPS = FW_CMD_CAP_PF, /* r all */ | ||
160 | CSIO_NVI = 4, | ||
161 | CSIO_NIQ_FLINT = 34, | ||
162 | CSIO_NETH_CTRL = 32, | ||
163 | CSIO_NEQ = 66, | ||
164 | CSIO_NEXACTF = 32, | ||
165 | CSIO_CMASK = FW_PFVF_CMD_CMASK_MASK, | ||
166 | CSIO_PMASK = FW_PFVF_CMD_PMASK_MASK, | ||
167 | }; | 156 | }; |
168 | 157 | ||
169 | /* Slowpath events */ | 158 | /* Slowpath events */ |
diff --git a/drivers/scsi/csiostor/csio_mb.c b/drivers/scsi/csiostor/csio_mb.c index f5d9ee1fda62..15b635142546 100644 --- a/drivers/scsi/csiostor/csio_mb.c +++ b/drivers/scsi/csiostor/csio_mb.c | |||
@@ -326,83 +326,6 @@ csio_mb_caps_config(struct csio_hw *hw, struct csio_mb *mbp, uint32_t tmo, | |||
326 | cmdp->fcoecaps |= htons(FW_CAPS_CONFIG_FCOE_TARGET); | 326 | cmdp->fcoecaps |= htons(FW_CAPS_CONFIG_FCOE_TARGET); |
327 | } | 327 | } |
328 | 328 | ||
329 | void | ||
330 | csio_rss_glb_config(struct csio_hw *hw, struct csio_mb *mbp, | ||
331 | uint32_t tmo, uint8_t mode, unsigned int flags, | ||
332 | void (*cbfn)(struct csio_hw *, struct csio_mb *)) | ||
333 | { | ||
334 | struct fw_rss_glb_config_cmd *cmdp = | ||
335 | (struct fw_rss_glb_config_cmd *)(mbp->mb); | ||
336 | |||
337 | CSIO_INIT_MBP(mbp, cmdp, tmo, hw, cbfn, 1); | ||
338 | |||
339 | cmdp->op_to_write = htonl(FW_CMD_OP(FW_RSS_GLB_CONFIG_CMD) | | ||
340 | FW_CMD_REQUEST | FW_CMD_WRITE); | ||
341 | cmdp->retval_len16 = htonl(FW_CMD_LEN16(sizeof(*cmdp) / 16)); | ||
342 | |||
343 | if (mode == FW_RSS_GLB_CONFIG_CMD_MODE_MANUAL) { | ||
344 | cmdp->u.manual.mode_pkd = | ||
345 | htonl(FW_RSS_GLB_CONFIG_CMD_MODE(mode)); | ||
346 | } else if (mode == FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL) { | ||
347 | cmdp->u.basicvirtual.mode_pkd = | ||
348 | htonl(FW_RSS_GLB_CONFIG_CMD_MODE(mode)); | ||
349 | cmdp->u.basicvirtual.synmapen_to_hashtoeplitz = htonl(flags); | ||
350 | } | ||
351 | } | ||
352 | |||
353 | |||
354 | /* | ||
355 | * csio_mb_pfvf - FW Write PF/VF capabilities command helper. | ||
356 | * @hw: The HW structure | ||
357 | * @mbp: Mailbox structure | ||
358 | * @pf: | ||
359 | * @vf: | ||
360 | * @txq: | ||
361 | * @txq_eht_ctrl: | ||
362 | * @rxqi: | ||
363 | * @rxq: | ||
364 | * @tc: | ||
365 | * @vi: | ||
366 | * @pmask: | ||
367 | * @rcaps: | ||
368 | * @wxcaps: | ||
369 | * @cbfn: Callback, if any. | ||
370 | * | ||
371 | */ | ||
372 | void | ||
373 | csio_mb_pfvf(struct csio_hw *hw, struct csio_mb *mbp, uint32_t tmo, | ||
374 | unsigned int pf, unsigned int vf, unsigned int txq, | ||
375 | unsigned int txq_eth_ctrl, unsigned int rxqi, | ||
376 | unsigned int rxq, unsigned int tc, unsigned int vi, | ||
377 | unsigned int cmask, unsigned int pmask, unsigned int nexactf, | ||
378 | unsigned int rcaps, unsigned int wxcaps, | ||
379 | void (*cbfn) (struct csio_hw *, struct csio_mb *)) | ||
380 | { | ||
381 | struct fw_pfvf_cmd *cmdp = (struct fw_pfvf_cmd *)(mbp->mb); | ||
382 | |||
383 | CSIO_INIT_MBP(mbp, cmdp, tmo, hw, cbfn, 1); | ||
384 | |||
385 | cmdp->op_to_vfn = htonl(FW_CMD_OP(FW_PFVF_CMD) | | ||
386 | FW_CMD_REQUEST | | ||
387 | FW_CMD_WRITE | | ||
388 | FW_PFVF_CMD_PFN(pf) | | ||
389 | FW_PFVF_CMD_VFN(vf)); | ||
390 | cmdp->retval_len16 = htonl(FW_CMD_LEN16(sizeof(*cmdp) / 16)); | ||
391 | cmdp->niqflint_niq = htonl(FW_PFVF_CMD_NIQFLINT(rxqi) | | ||
392 | FW_PFVF_CMD_NIQ(rxq)); | ||
393 | |||
394 | cmdp->type_to_neq = htonl(FW_PFVF_CMD_TYPE | | ||
395 | FW_PFVF_CMD_CMASK(cmask) | | ||
396 | FW_PFVF_CMD_PMASK(pmask) | | ||
397 | FW_PFVF_CMD_NEQ(txq)); | ||
398 | cmdp->tc_to_nexactf = htonl(FW_PFVF_CMD_TC(tc) | | ||
399 | FW_PFVF_CMD_NVI(vi) | | ||
400 | FW_PFVF_CMD_NEXACTF(nexactf)); | ||
401 | cmdp->r_caps_to_nethctrl = htonl(FW_PFVF_CMD_R_CAPS(rcaps) | | ||
402 | FW_PFVF_CMD_WX_CAPS(wxcaps) | | ||
403 | FW_PFVF_CMD_NETHCTRL(txq_eth_ctrl)); | ||
404 | } | ||
405 | |||
406 | #define CSIO_ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ | 329 | #define CSIO_ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ |
407 | FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_ANEG) | 330 | FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_ANEG) |
408 | 331 | ||
diff --git a/drivers/scsi/csiostor/csio_mb.h b/drivers/scsi/csiostor/csio_mb.h index 1788ea506f39..a84179e54ab9 100644 --- a/drivers/scsi/csiostor/csio_mb.h +++ b/drivers/scsi/csiostor/csio_mb.h | |||
@@ -183,17 +183,6 @@ void csio_mb_caps_config(struct csio_hw *, struct csio_mb *, uint32_t, | |||
183 | bool, bool, bool, bool, | 183 | bool, bool, bool, bool, |
184 | void (*)(struct csio_hw *, struct csio_mb *)); | 184 | void (*)(struct csio_hw *, struct csio_mb *)); |
185 | 185 | ||
186 | void csio_rss_glb_config(struct csio_hw *, struct csio_mb *, | ||
187 | uint32_t, uint8_t, unsigned int, | ||
188 | void (*)(struct csio_hw *, struct csio_mb *)); | ||
189 | |||
190 | void csio_mb_pfvf(struct csio_hw *, struct csio_mb *, uint32_t, | ||
191 | unsigned int, unsigned int, unsigned int, | ||
192 | unsigned int, unsigned int, unsigned int, | ||
193 | unsigned int, unsigned int, unsigned int, | ||
194 | unsigned int, unsigned int, unsigned int, | ||
195 | unsigned int, void (*) (struct csio_hw *, struct csio_mb *)); | ||
196 | |||
197 | void csio_mb_port(struct csio_hw *, struct csio_mb *, uint32_t, | 186 | void csio_mb_port(struct csio_hw *, struct csio_mb *, uint32_t, |
198 | uint8_t, bool, uint32_t, uint16_t, | 187 | uint8_t, bool, uint32_t, uint16_t, |
199 | void (*) (struct csio_hw *, struct csio_mb *)); | 188 | void (*) (struct csio_hw *, struct csio_mb *)); |
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c index ddd38e5eb0e7..7494e4bc69cc 100644 --- a/drivers/scsi/csiostor/csio_scsi.c +++ b/drivers/scsi/csiostor/csio_scsi.c | |||
@@ -1479,8 +1479,8 @@ csio_store_dbg_level(struct device *dev, | |||
1479 | } | 1479 | } |
1480 | 1480 | ||
1481 | static DEVICE_ATTR(hw_state, S_IRUGO, csio_show_hw_state, NULL); | 1481 | static DEVICE_ATTR(hw_state, S_IRUGO, csio_show_hw_state, NULL); |
1482 | static DEVICE_ATTR(device_reset, S_IRUGO | S_IWUSR, NULL, csio_device_reset); | 1482 | static DEVICE_ATTR(device_reset, S_IWUSR, NULL, csio_device_reset); |
1483 | static DEVICE_ATTR(disable_port, S_IRUGO | S_IWUSR, NULL, csio_disable_port); | 1483 | static DEVICE_ATTR(disable_port, S_IWUSR, NULL, csio_disable_port); |
1484 | static DEVICE_ATTR(dbg_level, S_IRUGO | S_IWUSR, csio_show_dbg_level, | 1484 | static DEVICE_ATTR(dbg_level, S_IRUGO | S_IWUSR, csio_show_dbg_level, |
1485 | csio_store_dbg_level); | 1485 | csio_store_dbg_level); |
1486 | 1486 | ||
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c index 3fecf35ba292..e659febaedcb 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <net/dst.h> | 20 | #include <net/dst.h> |
21 | #include <linux/netdevice.h> | 21 | #include <linux/netdevice.h> |
22 | 22 | ||
23 | #include "t4_regs.h" | ||
23 | #include "t4_msg.h" | 24 | #include "t4_msg.h" |
24 | #include "cxgb4.h" | 25 | #include "cxgb4.h" |
25 | #include "cxgb4_uld.h" | 26 | #include "cxgb4_uld.h" |
@@ -32,13 +33,12 @@ static unsigned int dbg_level; | |||
32 | #include "../libcxgbi.h" | 33 | #include "../libcxgbi.h" |
33 | 34 | ||
34 | #define DRV_MODULE_NAME "cxgb4i" | 35 | #define DRV_MODULE_NAME "cxgb4i" |
35 | #define DRV_MODULE_DESC "Chelsio T4 iSCSI Driver" | 36 | #define DRV_MODULE_DESC "Chelsio T4/T5 iSCSI Driver" |
36 | #define DRV_MODULE_VERSION "0.9.1" | 37 | #define DRV_MODULE_VERSION "0.9.4" |
37 | #define DRV_MODULE_RELDATE "Aug. 2010" | ||
38 | 38 | ||
39 | static char version[] = | 39 | static char version[] = |
40 | DRV_MODULE_DESC " " DRV_MODULE_NAME | 40 | DRV_MODULE_DESC " " DRV_MODULE_NAME |
41 | " v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; | 41 | " v" DRV_MODULE_VERSION "\n"; |
42 | 42 | ||
43 | MODULE_AUTHOR("Chelsio Communications, Inc."); | 43 | MODULE_AUTHOR("Chelsio Communications, Inc."); |
44 | MODULE_DESCRIPTION(DRV_MODULE_DESC); | 44 | MODULE_DESCRIPTION(DRV_MODULE_DESC); |
@@ -175,10 +175,56 @@ static inline int is_ofld_imm(const struct sk_buff *skb) | |||
175 | sizeof(struct fw_ofld_tx_data_wr)); | 175 | sizeof(struct fw_ofld_tx_data_wr)); |
176 | } | 176 | } |
177 | 177 | ||
178 | |||
179 | #define VLAN_NONE 0xfff | ||
180 | #define FILTER_SEL_VLAN_NONE 0xffff | ||
181 | #define FILTER_SEL_WIDTH_P_FC (3+1) /* port uses 3 bits, FCoE one bit */ | ||
182 | #define FILTER_SEL_WIDTH_VIN_P_FC \ | ||
183 | (6 + 7 + FILTER_SEL_WIDTH_P_FC) /* 6 bits are unused, VF uses 7 bits*/ | ||
184 | #define FILTER_SEL_WIDTH_TAG_P_FC \ | ||
185 | (3 + FILTER_SEL_WIDTH_VIN_P_FC) /* PF uses 3 bits */ | ||
186 | #define FILTER_SEL_WIDTH_VLD_TAG_P_FC (1 + FILTER_SEL_WIDTH_TAG_P_FC) | ||
187 | |||
188 | static unsigned int select_ntuple(struct cxgbi_device *cdev, | ||
189 | struct l2t_entry *l2t) | ||
190 | { | ||
191 | struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(cdev); | ||
192 | unsigned int ntuple = 0; | ||
193 | u32 viid; | ||
194 | |||
195 | switch (lldi->filt_mode) { | ||
196 | |||
197 | /* default filter mode */ | ||
198 | case HW_TPL_FR_MT_PR_IV_P_FC: | ||
199 | if (l2t->vlan == VLAN_NONE) | ||
200 | ntuple |= FILTER_SEL_VLAN_NONE << FILTER_SEL_WIDTH_P_FC; | ||
201 | else { | ||
202 | ntuple |= l2t->vlan << FILTER_SEL_WIDTH_P_FC; | ||
203 | ntuple |= 1 << FILTER_SEL_WIDTH_VLD_TAG_P_FC; | ||
204 | } | ||
205 | ntuple |= l2t->lport << S_PORT | IPPROTO_TCP << | ||
206 | FILTER_SEL_WIDTH_VLD_TAG_P_FC; | ||
207 | break; | ||
208 | case HW_TPL_FR_MT_PR_OV_P_FC: { | ||
209 | viid = cxgb4_port_viid(l2t->neigh->dev); | ||
210 | |||
211 | ntuple |= FW_VIID_VIN_GET(viid) << FILTER_SEL_WIDTH_P_FC; | ||
212 | ntuple |= FW_VIID_PFN_GET(viid) << FILTER_SEL_WIDTH_VIN_P_FC; | ||
213 | ntuple |= FW_VIID_VIVLD_GET(viid) << FILTER_SEL_WIDTH_TAG_P_FC; | ||
214 | ntuple |= l2t->lport << S_PORT | IPPROTO_TCP << | ||
215 | FILTER_SEL_WIDTH_VLD_TAG_P_FC; | ||
216 | break; | ||
217 | } | ||
218 | default: | ||
219 | break; | ||
220 | } | ||
221 | return ntuple; | ||
222 | } | ||
223 | |||
178 | static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb, | 224 | static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb, |
179 | struct l2t_entry *e) | 225 | struct l2t_entry *e) |
180 | { | 226 | { |
181 | struct cpl_act_open_req *req; | 227 | struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(csk->cdev); |
182 | int wscale = cxgbi_sock_compute_wscale(csk->mss_idx); | 228 | int wscale = cxgbi_sock_compute_wscale(csk->mss_idx); |
183 | unsigned long long opt0; | 229 | unsigned long long opt0; |
184 | unsigned int opt2; | 230 | unsigned int opt2; |
@@ -195,29 +241,58 @@ static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb, | |||
195 | RCV_BUFSIZ(cxgb4i_rcv_win >> 10); | 241 | RCV_BUFSIZ(cxgb4i_rcv_win >> 10); |
196 | opt2 = RX_CHANNEL(0) | | 242 | opt2 = RX_CHANNEL(0) | |
197 | RSS_QUEUE_VALID | | 243 | RSS_QUEUE_VALID | |
198 | (1 << 20) | (1 << 22) | | 244 | (1 << 20) | |
199 | RSS_QUEUE(csk->rss_qid); | 245 | RSS_QUEUE(csk->rss_qid); |
200 | 246 | ||
201 | set_wr_txq(skb, CPL_PRIORITY_SETUP, csk->port_id); | 247 | if (is_t4(lldi->adapter_type)) { |
202 | req = (struct cpl_act_open_req *)skb->head; | 248 | struct cpl_act_open_req *req = |
249 | (struct cpl_act_open_req *)skb->head; | ||
203 | 250 | ||
204 | INIT_TP_WR(req, 0); | 251 | req = (struct cpl_act_open_req *)skb->head; |
205 | OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, | 252 | |
253 | INIT_TP_WR(req, 0); | ||
254 | OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, | ||
206 | qid_atid)); | 255 | qid_atid)); |
207 | req->local_port = csk->saddr.sin_port; | 256 | req->local_port = csk->saddr.sin_port; |
208 | req->peer_port = csk->daddr.sin_port; | 257 | req->peer_port = csk->daddr.sin_port; |
209 | req->local_ip = csk->saddr.sin_addr.s_addr; | 258 | req->local_ip = csk->saddr.sin_addr.s_addr; |
210 | req->peer_ip = csk->daddr.sin_addr.s_addr; | 259 | req->peer_ip = csk->daddr.sin_addr.s_addr; |
211 | req->opt0 = cpu_to_be64(opt0); | 260 | req->opt0 = cpu_to_be64(opt0); |
212 | req->params = 0; | 261 | req->params = cpu_to_be32(select_ntuple(csk->cdev, csk->l2t)); |
213 | req->opt2 = cpu_to_be32(opt2); | 262 | opt2 |= 1 << 22; |
263 | req->opt2 = cpu_to_be32(opt2); | ||
214 | 264 | ||
215 | log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, | 265 | log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, |
216 | "csk 0x%p, %pI4:%u-%pI4:%u, atid %d, qid %u.\n", | 266 | "csk t4 0x%p, %pI4:%u-%pI4:%u, atid %d, qid %u.\n", |
217 | csk, &req->local_ip, ntohs(req->local_port), | 267 | csk, &req->local_ip, ntohs(req->local_port), |
218 | &req->peer_ip, ntohs(req->peer_port), | 268 | &req->peer_ip, ntohs(req->peer_port), |
219 | csk->atid, csk->rss_qid); | 269 | csk->atid, csk->rss_qid); |
270 | } else { | ||
271 | struct cpl_t5_act_open_req *req = | ||
272 | (struct cpl_t5_act_open_req *)skb->head; | ||
273 | |||
274 | req = (struct cpl_t5_act_open_req *)skb->head; | ||
275 | |||
276 | INIT_TP_WR(req, 0); | ||
277 | OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, | ||
278 | qid_atid)); | ||
279 | req->local_port = csk->saddr.sin_port; | ||
280 | req->peer_port = csk->daddr.sin_port; | ||
281 | req->local_ip = csk->saddr.sin_addr.s_addr; | ||
282 | req->peer_ip = csk->daddr.sin_addr.s_addr; | ||
283 | req->opt0 = cpu_to_be64(opt0); | ||
284 | req->params = cpu_to_be32(select_ntuple(csk->cdev, csk->l2t)); | ||
285 | opt2 |= 1 << 31; | ||
286 | req->opt2 = cpu_to_be32(opt2); | ||
220 | 287 | ||
288 | log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, | ||
289 | "csk t5 0x%p, %pI4:%u-%pI4:%u, atid %d, qid %u.\n", | ||
290 | csk, &req->local_ip, ntohs(req->local_port), | ||
291 | &req->peer_ip, ntohs(req->peer_port), | ||
292 | csk->atid, csk->rss_qid); | ||
293 | } | ||
294 | |||
295 | set_wr_txq(skb, CPL_PRIORITY_SETUP, csk->port_id); | ||
221 | cxgb4_l2t_send(csk->cdev->ports[csk->port_id], skb, csk->l2t); | 296 | cxgb4_l2t_send(csk->cdev->ports[csk->port_id], skb, csk->l2t); |
222 | } | 297 | } |
223 | 298 | ||
@@ -632,6 +707,7 @@ static void csk_act_open_retry_timer(unsigned long data) | |||
632 | { | 707 | { |
633 | struct sk_buff *skb; | 708 | struct sk_buff *skb; |
634 | struct cxgbi_sock *csk = (struct cxgbi_sock *)data; | 709 | struct cxgbi_sock *csk = (struct cxgbi_sock *)data; |
710 | struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(csk->cdev); | ||
635 | 711 | ||
636 | log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, | 712 | log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, |
637 | "csk 0x%p,%u,0x%lx,%u.\n", | 713 | "csk 0x%p,%u,0x%lx,%u.\n", |
@@ -639,7 +715,10 @@ static void csk_act_open_retry_timer(unsigned long data) | |||
639 | 715 | ||
640 | cxgbi_sock_get(csk); | 716 | cxgbi_sock_get(csk); |
641 | spin_lock_bh(&csk->lock); | 717 | spin_lock_bh(&csk->lock); |
642 | skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_ATOMIC); | 718 | skb = alloc_wr(is_t4(lldi->adapter_type) ? |
719 | sizeof(struct cpl_act_open_req) : | ||
720 | sizeof(struct cpl_t5_act_open_req), | ||
721 | 0, GFP_ATOMIC); | ||
643 | if (!skb) | 722 | if (!skb) |
644 | cxgbi_sock_fail_act_open(csk, -ENOMEM); | 723 | cxgbi_sock_fail_act_open(csk, -ENOMEM); |
645 | else { | 724 | else { |
@@ -871,7 +950,7 @@ static void do_rx_iscsi_hdr(struct cxgbi_device *cdev, struct sk_buff *skb) | |||
871 | 950 | ||
872 | if (!csk->skb_ulp_lhdr) { | 951 | if (!csk->skb_ulp_lhdr) { |
873 | unsigned char *bhs; | 952 | unsigned char *bhs; |
874 | unsigned int hlen, dlen; | 953 | unsigned int hlen, dlen, plen; |
875 | 954 | ||
876 | log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_PDU_RX, | 955 | log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_PDU_RX, |
877 | "csk 0x%p,%u,0x%lx, tid %u, skb 0x%p header.\n", | 956 | "csk 0x%p,%u,0x%lx, tid %u, skb 0x%p header.\n", |
@@ -890,11 +969,15 @@ static void do_rx_iscsi_hdr(struct cxgbi_device *cdev, struct sk_buff *skb) | |||
890 | hlen = ntohs(cpl->len); | 969 | hlen = ntohs(cpl->len); |
891 | dlen = ntohl(*(unsigned int *)(bhs + 4)) & 0xFFFFFF; | 970 | dlen = ntohl(*(unsigned int *)(bhs + 4)) & 0xFFFFFF; |
892 | 971 | ||
893 | if ((hlen + dlen) != ISCSI_PDU_LEN(pdu_len_ddp) - 40) { | 972 | plen = ISCSI_PDU_LEN(pdu_len_ddp); |
973 | if (is_t4(lldi->adapter_type)) | ||
974 | plen -= 40; | ||
975 | |||
976 | if ((hlen + dlen) != plen) { | ||
894 | pr_info("tid 0x%x, CPL_ISCSI_HDR, pdu len " | 977 | pr_info("tid 0x%x, CPL_ISCSI_HDR, pdu len " |
895 | "mismatch %u != %u + %u, seq 0x%x.\n", | 978 | "mismatch %u != %u + %u, seq 0x%x.\n", |
896 | csk->tid, ISCSI_PDU_LEN(pdu_len_ddp) - 40, | 979 | csk->tid, plen, hlen, dlen, |
897 | hlen, dlen, cxgbi_skcb_tcp_seq(skb)); | 980 | cxgbi_skcb_tcp_seq(skb)); |
898 | goto abort_conn; | 981 | goto abort_conn; |
899 | } | 982 | } |
900 | 983 | ||
@@ -1154,7 +1237,10 @@ static int init_act_open(struct cxgbi_sock *csk) | |||
1154 | } | 1237 | } |
1155 | cxgbi_sock_get(csk); | 1238 | cxgbi_sock_get(csk); |
1156 | 1239 | ||
1157 | skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_KERNEL); | 1240 | skb = alloc_wr(is_t4(lldi->adapter_type) ? |
1241 | sizeof(struct cpl_act_open_req) : | ||
1242 | sizeof(struct cpl_t5_act_open_req), | ||
1243 | 0, GFP_ATOMIC); | ||
1158 | if (!skb) | 1244 | if (!skb) |
1159 | goto rel_resource; | 1245 | goto rel_resource; |
1160 | skb->sk = (struct sock *)csk; | 1246 | skb->sk = (struct sock *)csk; |
@@ -1193,6 +1279,8 @@ rel_resource: | |||
1193 | return -EINVAL; | 1279 | return -EINVAL; |
1194 | } | 1280 | } |
1195 | 1281 | ||
1282 | #define CPL_ISCSI_DATA 0xB2 | ||
1283 | #define CPL_RX_ISCSI_DDP 0x49 | ||
1196 | cxgb4i_cplhandler_func cxgb4i_cplhandlers[NUM_CPL_CMDS] = { | 1284 | cxgb4i_cplhandler_func cxgb4i_cplhandlers[NUM_CPL_CMDS] = { |
1197 | [CPL_ACT_ESTABLISH] = do_act_establish, | 1285 | [CPL_ACT_ESTABLISH] = do_act_establish, |
1198 | [CPL_ACT_OPEN_RPL] = do_act_open_rpl, | 1286 | [CPL_ACT_OPEN_RPL] = do_act_open_rpl, |
@@ -1202,8 +1290,10 @@ cxgb4i_cplhandler_func cxgb4i_cplhandlers[NUM_CPL_CMDS] = { | |||
1202 | [CPL_CLOSE_CON_RPL] = do_close_con_rpl, | 1290 | [CPL_CLOSE_CON_RPL] = do_close_con_rpl, |
1203 | [CPL_FW4_ACK] = do_fw4_ack, | 1291 | [CPL_FW4_ACK] = do_fw4_ack, |
1204 | [CPL_ISCSI_HDR] = do_rx_iscsi_hdr, | 1292 | [CPL_ISCSI_HDR] = do_rx_iscsi_hdr, |
1293 | [CPL_ISCSI_DATA] = do_rx_iscsi_hdr, | ||
1205 | [CPL_SET_TCB_RPL] = do_set_tcb_rpl, | 1294 | [CPL_SET_TCB_RPL] = do_set_tcb_rpl, |
1206 | [CPL_RX_DATA_DDP] = do_rx_data_ddp, | 1295 | [CPL_RX_DATA_DDP] = do_rx_data_ddp, |
1296 | [CPL_RX_ISCSI_DDP] = do_rx_data_ddp, | ||
1207 | }; | 1297 | }; |
1208 | 1298 | ||
1209 | int cxgb4i_ofld_init(struct cxgbi_device *cdev) | 1299 | int cxgb4i_ofld_init(struct cxgbi_device *cdev) |
@@ -1234,14 +1324,20 @@ int cxgb4i_ofld_init(struct cxgbi_device *cdev) | |||
1234 | * functions to program the pagepod in h/w | 1324 | * functions to program the pagepod in h/w |
1235 | */ | 1325 | */ |
1236 | #define ULPMEM_IDATA_MAX_NPPODS 4 /* 256/PPOD_SIZE */ | 1326 | #define ULPMEM_IDATA_MAX_NPPODS 4 /* 256/PPOD_SIZE */ |
1237 | static inline void ulp_mem_io_set_hdr(struct ulp_mem_io *req, | 1327 | static inline void ulp_mem_io_set_hdr(struct cxgb4_lld_info *lldi, |
1328 | struct ulp_mem_io *req, | ||
1238 | unsigned int wr_len, unsigned int dlen, | 1329 | unsigned int wr_len, unsigned int dlen, |
1239 | unsigned int pm_addr) | 1330 | unsigned int pm_addr) |
1240 | { | 1331 | { |
1241 | struct ulptx_idata *idata = (struct ulptx_idata *)(req + 1); | 1332 | struct ulptx_idata *idata = (struct ulptx_idata *)(req + 1); |
1242 | 1333 | ||
1243 | INIT_ULPTX_WR(req, wr_len, 0, 0); | 1334 | INIT_ULPTX_WR(req, wr_len, 0, 0); |
1244 | req->cmd = htonl(ULPTX_CMD(ULP_TX_MEM_WRITE) | (1 << 23)); | 1335 | if (is_t4(lldi->adapter_type)) |
1336 | req->cmd = htonl(ULPTX_CMD(ULP_TX_MEM_WRITE) | | ||
1337 | (ULP_MEMIO_ORDER(1))); | ||
1338 | else | ||
1339 | req->cmd = htonl(ULPTX_CMD(ULP_TX_MEM_WRITE) | | ||
1340 | (V_T5_ULP_MEMIO_IMM(1))); | ||
1245 | req->dlen = htonl(ULP_MEMIO_DATA_LEN(dlen >> 5)); | 1341 | req->dlen = htonl(ULP_MEMIO_DATA_LEN(dlen >> 5)); |
1246 | req->lock_addr = htonl(ULP_MEMIO_ADDR(pm_addr >> 5)); | 1342 | req->lock_addr = htonl(ULP_MEMIO_ADDR(pm_addr >> 5)); |
1247 | req->len16 = htonl(DIV_ROUND_UP(wr_len - sizeof(req->wr), 16)); | 1343 | req->len16 = htonl(DIV_ROUND_UP(wr_len - sizeof(req->wr), 16)); |
@@ -1257,6 +1353,7 @@ static int ddp_ppod_write_idata(struct cxgbi_device *cdev, unsigned int port_id, | |||
1257 | unsigned int gl_pidx) | 1353 | unsigned int gl_pidx) |
1258 | { | 1354 | { |
1259 | struct cxgbi_ddp_info *ddp = cdev->ddp; | 1355 | struct cxgbi_ddp_info *ddp = cdev->ddp; |
1356 | struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(cdev); | ||
1260 | struct sk_buff *skb; | 1357 | struct sk_buff *skb; |
1261 | struct ulp_mem_io *req; | 1358 | struct ulp_mem_io *req; |
1262 | struct ulptx_idata *idata; | 1359 | struct ulptx_idata *idata; |
@@ -1276,7 +1373,7 @@ static int ddp_ppod_write_idata(struct cxgbi_device *cdev, unsigned int port_id, | |||
1276 | req = (struct ulp_mem_io *)skb->head; | 1373 | req = (struct ulp_mem_io *)skb->head; |
1277 | set_queue(skb, CPL_PRIORITY_CONTROL, NULL); | 1374 | set_queue(skb, CPL_PRIORITY_CONTROL, NULL); |
1278 | 1375 | ||
1279 | ulp_mem_io_set_hdr(req, wr_len, dlen, pm_addr); | 1376 | ulp_mem_io_set_hdr(lldi, req, wr_len, dlen, pm_addr); |
1280 | idata = (struct ulptx_idata *)(req + 1); | 1377 | idata = (struct ulptx_idata *)(req + 1); |
1281 | ppod = (struct cxgbi_pagepod *)(idata + 1); | 1378 | ppod = (struct cxgbi_pagepod *)(idata + 1); |
1282 | 1379 | ||
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index be99e7549d89..a97e6e584f8c 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c | |||
@@ -2432,11 +2432,9 @@ int fnic_is_abts_pending(struct fnic *fnic, struct scsi_cmnd *lr_sc) | |||
2432 | "Found IO in %s on lun\n", | 2432 | "Found IO in %s on lun\n", |
2433 | fnic_ioreq_state_to_str(CMD_STATE(sc))); | 2433 | fnic_ioreq_state_to_str(CMD_STATE(sc))); |
2434 | 2434 | ||
2435 | if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) { | 2435 | if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) |
2436 | spin_unlock_irqrestore(io_lock, flags); | ||
2437 | ret = 1; | 2436 | ret = 1; |
2438 | continue; | 2437 | spin_unlock_irqrestore(io_lock, flags); |
2439 | } | ||
2440 | } | 2438 | } |
2441 | 2439 | ||
2442 | return ret; | 2440 | return ret; |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 168bc7b9f057..6601e03520cc 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -281,12 +281,22 @@ struct ipr_error_table_t ipr_error_table[] = { | |||
281 | "FFF6: Failure prediction threshold exceeded"}, | 281 | "FFF6: Failure prediction threshold exceeded"}, |
282 | {0x015D9200, 0, IPR_DEFAULT_LOG_LEVEL, | 282 | {0x015D9200, 0, IPR_DEFAULT_LOG_LEVEL, |
283 | "8009: Impending cache battery pack failure"}, | 283 | "8009: Impending cache battery pack failure"}, |
284 | {0x02040100, 0, 0, | ||
285 | "Logical Unit in process of becoming ready"}, | ||
286 | {0x02040200, 0, 0, | ||
287 | "Initializing command required"}, | ||
284 | {0x02040400, 0, 0, | 288 | {0x02040400, 0, 0, |
285 | "34FF: Disk device format in progress"}, | 289 | "34FF: Disk device format in progress"}, |
290 | {0x02040C00, 0, 0, | ||
291 | "Logical unit not accessible, target port in unavailable state"}, | ||
286 | {0x02048000, 0, IPR_DEFAULT_LOG_LEVEL, | 292 | {0x02048000, 0, IPR_DEFAULT_LOG_LEVEL, |
287 | "9070: IOA requested reset"}, | 293 | "9070: IOA requested reset"}, |
288 | {0x023F0000, 0, 0, | 294 | {0x023F0000, 0, 0, |
289 | "Synchronization required"}, | 295 | "Synchronization required"}, |
296 | {0x02408500, 0, 0, | ||
297 | "IOA microcode download required"}, | ||
298 | {0x02408600, 0, 0, | ||
299 | "Device bus connection is prohibited by host"}, | ||
290 | {0x024E0000, 0, 0, | 300 | {0x024E0000, 0, 0, |
291 | "No ready, IOA shutdown"}, | 301 | "No ready, IOA shutdown"}, |
292 | {0x025A0000, 0, 0, | 302 | {0x025A0000, 0, 0, |
@@ -385,6 +395,8 @@ struct ipr_error_table_t ipr_error_table[] = { | |||
385 | "4030: Incorrect multipath connection"}, | 395 | "4030: Incorrect multipath connection"}, |
386 | {0x04679000, 0, IPR_DEFAULT_LOG_LEVEL, | 396 | {0x04679000, 0, IPR_DEFAULT_LOG_LEVEL, |
387 | "4110: Unsupported enclosure function"}, | 397 | "4110: Unsupported enclosure function"}, |
398 | {0x04679800, 0, IPR_DEFAULT_LOG_LEVEL, | ||
399 | "4120: SAS cable VPD cannot be read"}, | ||
388 | {0x046E0000, 0, IPR_DEFAULT_LOG_LEVEL, | 400 | {0x046E0000, 0, IPR_DEFAULT_LOG_LEVEL, |
389 | "FFF4: Command to logical unit failed"}, | 401 | "FFF4: Command to logical unit failed"}, |
390 | {0x05240000, 1, 0, | 402 | {0x05240000, 1, 0, |
@@ -407,10 +419,18 @@ struct ipr_error_table_t ipr_error_table[] = { | |||
407 | "Illegal request, command sequence error"}, | 419 | "Illegal request, command sequence error"}, |
408 | {0x052C8000, 1, 0, | 420 | {0x052C8000, 1, 0, |
409 | "Illegal request, dual adapter support not enabled"}, | 421 | "Illegal request, dual adapter support not enabled"}, |
422 | {0x052C8100, 1, 0, | ||
423 | "Illegal request, another cable connector was physically disabled"}, | ||
424 | {0x054E8000, 1, 0, | ||
425 | "Illegal request, inconsistent group id/group count"}, | ||
410 | {0x06040500, 0, IPR_DEFAULT_LOG_LEVEL, | 426 | {0x06040500, 0, IPR_DEFAULT_LOG_LEVEL, |
411 | "9031: Array protection temporarily suspended, protection resuming"}, | 427 | "9031: Array protection temporarily suspended, protection resuming"}, |
412 | {0x06040600, 0, IPR_DEFAULT_LOG_LEVEL, | 428 | {0x06040600, 0, IPR_DEFAULT_LOG_LEVEL, |
413 | "9040: Array protection temporarily suspended, protection resuming"}, | 429 | "9040: Array protection temporarily suspended, protection resuming"}, |
430 | {0x060B0100, 0, IPR_DEFAULT_LOG_LEVEL, | ||
431 | "4080: IOA exceeded maximum operating temperature"}, | ||
432 | {0x060B8000, 0, IPR_DEFAULT_LOG_LEVEL, | ||
433 | "4085: Service required"}, | ||
414 | {0x06288000, 0, IPR_DEFAULT_LOG_LEVEL, | 434 | {0x06288000, 0, IPR_DEFAULT_LOG_LEVEL, |
415 | "3140: Device bus not ready to ready transition"}, | 435 | "3140: Device bus not ready to ready transition"}, |
416 | {0x06290000, 0, IPR_DEFAULT_LOG_LEVEL, | 436 | {0x06290000, 0, IPR_DEFAULT_LOG_LEVEL, |
@@ -423,6 +443,8 @@ struct ipr_error_table_t ipr_error_table[] = { | |||
423 | "FFFB: SCSI bus was reset by another initiator"}, | 443 | "FFFB: SCSI bus was reset by another initiator"}, |
424 | {0x063F0300, 0, IPR_DEFAULT_LOG_LEVEL, | 444 | {0x063F0300, 0, IPR_DEFAULT_LOG_LEVEL, |
425 | "3029: A device replacement has occurred"}, | 445 | "3029: A device replacement has occurred"}, |
446 | {0x063F8300, 0, IPR_DEFAULT_LOG_LEVEL, | ||
447 | "4102: Device bus fabric performance degradation"}, | ||
426 | {0x064C8000, 0, IPR_DEFAULT_LOG_LEVEL, | 448 | {0x064C8000, 0, IPR_DEFAULT_LOG_LEVEL, |
427 | "9051: IOA cache data exists for a missing or failed device"}, | 449 | "9051: IOA cache data exists for a missing or failed device"}, |
428 | {0x064C8100, 0, IPR_DEFAULT_LOG_LEVEL, | 450 | {0x064C8100, 0, IPR_DEFAULT_LOG_LEVEL, |
@@ -445,6 +467,14 @@ struct ipr_error_table_t ipr_error_table[] = { | |||
445 | "9076: Configuration error, missing remote IOA"}, | 467 | "9076: Configuration error, missing remote IOA"}, |
446 | {0x06679100, 0, IPR_DEFAULT_LOG_LEVEL, | 468 | {0x06679100, 0, IPR_DEFAULT_LOG_LEVEL, |
447 | "4050: Enclosure does not support a required multipath function"}, | 469 | "4050: Enclosure does not support a required multipath function"}, |
470 | {0x06679800, 0, IPR_DEFAULT_LOG_LEVEL, | ||
471 | "4121: Configuration error, required cable is missing"}, | ||
472 | {0x06679900, 0, IPR_DEFAULT_LOG_LEVEL, | ||
473 | "4122: Cable is not plugged into the correct location on remote IOA"}, | ||
474 | {0x06679A00, 0, IPR_DEFAULT_LOG_LEVEL, | ||
475 | "4123: Configuration error, invalid cable vital product data"}, | ||
476 | {0x06679B00, 0, IPR_DEFAULT_LOG_LEVEL, | ||
477 | "4124: Configuration error, both cable ends are plugged into the same IOA"}, | ||
448 | {0x06690000, 0, IPR_DEFAULT_LOG_LEVEL, | 478 | {0x06690000, 0, IPR_DEFAULT_LOG_LEVEL, |
449 | "4070: Logically bad block written on device"}, | 479 | "4070: Logically bad block written on device"}, |
450 | {0x06690200, 0, IPR_DEFAULT_LOG_LEVEL, | 480 | {0x06690200, 0, IPR_DEFAULT_LOG_LEVEL, |
@@ -507,10 +537,18 @@ struct ipr_error_table_t ipr_error_table[] = { | |||
507 | "9062: One or more disks are missing from an array"}, | 537 | "9062: One or more disks are missing from an array"}, |
508 | {0x07279900, 0, IPR_DEFAULT_LOG_LEVEL, | 538 | {0x07279900, 0, IPR_DEFAULT_LOG_LEVEL, |
509 | "9063: Maximum number of functional arrays has been exceeded"}, | 539 | "9063: Maximum number of functional arrays has been exceeded"}, |
540 | {0x07279A00, 0, 0, | ||
541 | "Data protect, other volume set problem"}, | ||
510 | {0x0B260000, 0, 0, | 542 | {0x0B260000, 0, 0, |
511 | "Aborted command, invalid descriptor"}, | 543 | "Aborted command, invalid descriptor"}, |
544 | {0x0B3F9000, 0, 0, | ||
545 | "Target operating conditions have changed, dual adapter takeover"}, | ||
546 | {0x0B530200, 0, 0, | ||
547 | "Aborted command, medium removal prevented"}, | ||
512 | {0x0B5A0000, 0, 0, | 548 | {0x0B5A0000, 0, 0, |
513 | "Command terminated by host"} | 549 | "Command terminated by host"}, |
550 | {0x0B5B8000, 0, 0, | ||
551 | "Aborted command, command terminated by host"} | ||
514 | }; | 552 | }; |
515 | 553 | ||
516 | static const struct ipr_ses_table_entry ipr_ses_table[] = { | 554 | static const struct ipr_ses_table_entry ipr_ses_table[] = { |
@@ -9391,7 +9429,7 @@ static int ipr_probe_ioa(struct pci_dev *pdev, | |||
9391 | void __iomem *ipr_regs; | 9429 | void __iomem *ipr_regs; |
9392 | int rc = PCIBIOS_SUCCESSFUL; | 9430 | int rc = PCIBIOS_SUCCESSFUL; |
9393 | volatile u32 mask, uproc, interrupts; | 9431 | volatile u32 mask, uproc, interrupts; |
9394 | unsigned long lock_flags; | 9432 | unsigned long lock_flags, driver_lock_flags; |
9395 | 9433 | ||
9396 | ENTER; | 9434 | ENTER; |
9397 | 9435 | ||
@@ -9614,9 +9652,9 @@ static int ipr_probe_ioa(struct pci_dev *pdev, | |||
9614 | } else | 9652 | } else |
9615 | ioa_cfg->reset = ipr_reset_start_bist; | 9653 | ioa_cfg->reset = ipr_reset_start_bist; |
9616 | 9654 | ||
9617 | spin_lock(&ipr_driver_lock); | 9655 | spin_lock_irqsave(&ipr_driver_lock, driver_lock_flags); |
9618 | list_add_tail(&ioa_cfg->queue, &ipr_ioa_head); | 9656 | list_add_tail(&ioa_cfg->queue, &ipr_ioa_head); |
9619 | spin_unlock(&ipr_driver_lock); | 9657 | spin_unlock_irqrestore(&ipr_driver_lock, driver_lock_flags); |
9620 | 9658 | ||
9621 | LEAVE; | 9659 | LEAVE; |
9622 | out: | 9660 | out: |
@@ -9699,6 +9737,7 @@ static void __ipr_remove(struct pci_dev *pdev) | |||
9699 | unsigned long host_lock_flags = 0; | 9737 | unsigned long host_lock_flags = 0; |
9700 | struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(pdev); | 9738 | struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(pdev); |
9701 | int i; | 9739 | int i; |
9740 | unsigned long driver_lock_flags; | ||
9702 | ENTER; | 9741 | ENTER; |
9703 | 9742 | ||
9704 | spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags); | 9743 | spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags); |
@@ -9722,9 +9761,9 @@ static void __ipr_remove(struct pci_dev *pdev) | |||
9722 | INIT_LIST_HEAD(&ioa_cfg->used_res_q); | 9761 | INIT_LIST_HEAD(&ioa_cfg->used_res_q); |
9723 | spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags); | 9762 | spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags); |
9724 | 9763 | ||
9725 | spin_lock(&ipr_driver_lock); | 9764 | spin_lock_irqsave(&ipr_driver_lock, driver_lock_flags); |
9726 | list_del(&ioa_cfg->queue); | 9765 | list_del(&ioa_cfg->queue); |
9727 | spin_unlock(&ipr_driver_lock); | 9766 | spin_unlock_irqrestore(&ipr_driver_lock, driver_lock_flags); |
9728 | 9767 | ||
9729 | if (ioa_cfg->sdt_state == ABORT_DUMP) | 9768 | if (ioa_cfg->sdt_state == ABORT_DUMP) |
9730 | ioa_cfg->sdt_state = WAIT_FOR_DUMP; | 9769 | ioa_cfg->sdt_state = WAIT_FOR_DUMP; |
@@ -9990,12 +10029,12 @@ static int ipr_halt(struct notifier_block *nb, ulong event, void *buf) | |||
9990 | { | 10029 | { |
9991 | struct ipr_cmnd *ipr_cmd; | 10030 | struct ipr_cmnd *ipr_cmd; |
9992 | struct ipr_ioa_cfg *ioa_cfg; | 10031 | struct ipr_ioa_cfg *ioa_cfg; |
9993 | unsigned long flags = 0; | 10032 | unsigned long flags = 0, driver_lock_flags; |
9994 | 10033 | ||
9995 | if (event != SYS_RESTART && event != SYS_HALT && event != SYS_POWER_OFF) | 10034 | if (event != SYS_RESTART && event != SYS_HALT && event != SYS_POWER_OFF) |
9996 | return NOTIFY_DONE; | 10035 | return NOTIFY_DONE; |
9997 | 10036 | ||
9998 | spin_lock(&ipr_driver_lock); | 10037 | spin_lock_irqsave(&ipr_driver_lock, driver_lock_flags); |
9999 | 10038 | ||
10000 | list_for_each_entry(ioa_cfg, &ipr_ioa_head, queue) { | 10039 | list_for_each_entry(ioa_cfg, &ipr_ioa_head, queue) { |
10001 | spin_lock_irqsave(ioa_cfg->host->host_lock, flags); | 10040 | spin_lock_irqsave(ioa_cfg->host->host_lock, flags); |
@@ -10013,7 +10052,7 @@ static int ipr_halt(struct notifier_block *nb, ulong event, void *buf) | |||
10013 | ipr_do_req(ipr_cmd, ipr_halt_done, ipr_timeout, IPR_DEVICE_RESET_TIMEOUT); | 10052 | ipr_do_req(ipr_cmd, ipr_halt_done, ipr_timeout, IPR_DEVICE_RESET_TIMEOUT); |
10014 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, flags); | 10053 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, flags); |
10015 | } | 10054 | } |
10016 | spin_unlock(&ipr_driver_lock); | 10055 | spin_unlock_irqrestore(&ipr_driver_lock, driver_lock_flags); |
10017 | 10056 | ||
10018 | return NOTIFY_OK; | 10057 | return NOTIFY_OK; |
10019 | } | 10058 | } |
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index e3e3bcbd5a9f..7b082157eb79 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c | |||
@@ -184,8 +184,8 @@ static void sci_io_request_build_ssp_command_iu(struct isci_request *ireq) | |||
184 | cmd_iu->task_attr = task->ssp_task.task_attr; | 184 | cmd_iu->task_attr = task->ssp_task.task_attr; |
185 | cmd_iu->_r_c = 0; | 185 | cmd_iu->_r_c = 0; |
186 | 186 | ||
187 | sci_swab32_cpy(&cmd_iu->cdb, task->ssp_task.cdb, | 187 | sci_swab32_cpy(&cmd_iu->cdb, task->ssp_task.cmd->cmnd, |
188 | sizeof(task->ssp_task.cdb) / sizeof(u32)); | 188 | task->ssp_task.cmd->cmd_len / sizeof(u32)); |
189 | } | 189 | } |
190 | 190 | ||
191 | static void sci_task_request_build_ssp_task_iu(struct isci_request *ireq) | 191 | static void sci_task_request_build_ssp_task_iu(struct isci_request *ireq) |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 5de946984500..ae69dfcc7834 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -2808,6 +2808,9 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session) | |||
2808 | kfree(session->targetname); | 2808 | kfree(session->targetname); |
2809 | kfree(session->targetalias); | 2809 | kfree(session->targetalias); |
2810 | kfree(session->initiatorname); | 2810 | kfree(session->initiatorname); |
2811 | kfree(session->boot_root); | ||
2812 | kfree(session->boot_nic); | ||
2813 | kfree(session->boot_target); | ||
2811 | kfree(session->ifacename); | 2814 | kfree(session->ifacename); |
2812 | 2815 | ||
2813 | iscsi_destroy_session(cls_session); | 2816 | iscsi_destroy_session(cls_session); |
@@ -3248,6 +3251,12 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn, | |||
3248 | return iscsi_switch_str_param(&session->ifacename, buf); | 3251 | return iscsi_switch_str_param(&session->ifacename, buf); |
3249 | case ISCSI_PARAM_INITIATOR_NAME: | 3252 | case ISCSI_PARAM_INITIATOR_NAME: |
3250 | return iscsi_switch_str_param(&session->initiatorname, buf); | 3253 | return iscsi_switch_str_param(&session->initiatorname, buf); |
3254 | case ISCSI_PARAM_BOOT_ROOT: | ||
3255 | return iscsi_switch_str_param(&session->boot_root, buf); | ||
3256 | case ISCSI_PARAM_BOOT_NIC: | ||
3257 | return iscsi_switch_str_param(&session->boot_nic, buf); | ||
3258 | case ISCSI_PARAM_BOOT_TARGET: | ||
3259 | return iscsi_switch_str_param(&session->boot_target, buf); | ||
3251 | default: | 3260 | default: |
3252 | return -ENOSYS; | 3261 | return -ENOSYS; |
3253 | } | 3262 | } |
@@ -3326,6 +3335,15 @@ int iscsi_session_get_param(struct iscsi_cls_session *cls_session, | |||
3326 | case ISCSI_PARAM_INITIATOR_NAME: | 3335 | case ISCSI_PARAM_INITIATOR_NAME: |
3327 | len = sprintf(buf, "%s\n", session->initiatorname); | 3336 | len = sprintf(buf, "%s\n", session->initiatorname); |
3328 | break; | 3337 | break; |
3338 | case ISCSI_PARAM_BOOT_ROOT: | ||
3339 | len = sprintf(buf, "%s\n", session->boot_root); | ||
3340 | break; | ||
3341 | case ISCSI_PARAM_BOOT_NIC: | ||
3342 | len = sprintf(buf, "%s\n", session->boot_nic); | ||
3343 | break; | ||
3344 | case ISCSI_PARAM_BOOT_TARGET: | ||
3345 | len = sprintf(buf, "%s\n", session->boot_target); | ||
3346 | break; | ||
3329 | default: | 3347 | default: |
3330 | return -ENOSYS; | 3348 | return -ENOSYS; |
3331 | } | 3349 | } |
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 6e795a174a12..da3aee17faa5 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c | |||
@@ -167,7 +167,7 @@ static struct sas_task *sas_create_task(struct scsi_cmnd *cmd, | |||
167 | int_to_scsilun(cmd->device->lun, &lun); | 167 | int_to_scsilun(cmd->device->lun, &lun); |
168 | memcpy(task->ssp_task.LUN, &lun.scsi_lun, 8); | 168 | memcpy(task->ssp_task.LUN, &lun.scsi_lun, 8); |
169 | task->ssp_task.task_attr = TASK_ATTR_SIMPLE; | 169 | task->ssp_task.task_attr = TASK_ATTR_SIMPLE; |
170 | memcpy(task->ssp_task.cdb, cmd->cmnd, 16); | 170 | task->ssp_task.cmd = cmd; |
171 | 171 | ||
172 | task->scatter = scsi_sglist(cmd); | 172 | task->scatter = scsi_sglist(cmd); |
173 | task->num_scatter = scsi_sg_count(cmd); | 173 | task->num_scatter = scsi_sg_count(cmd); |
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index bcc56cac4fd8..93f222d66716 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2012 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 3c5625b8b1f4..5cb08ae3e8c2 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2012 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -4070,11 +4070,28 @@ LPFC_VPORT_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands " | |||
4070 | "during discovery"); | 4070 | "during discovery"); |
4071 | 4071 | ||
4072 | /* | 4072 | /* |
4073 | # lpfc_max_luns: maximum allowed LUN. | 4073 | # lpfc_max_luns: maximum allowed LUN ID. This is the highest LUN ID that |
4074 | # will be scanned by the SCSI midlayer when sequential scanning is | ||
4075 | # used; and is also the highest LUN ID allowed when the SCSI midlayer | ||
4076 | # parses REPORT_LUN responses. The lpfc driver has no LUN count or | ||
4077 | # LUN ID limit, but the SCSI midlayer requires this field for the uses | ||
4078 | # above. The lpfc driver limits the default value to 255 for two reasons. | ||
4079 | # As it bounds the sequential scan loop, scanning for thousands of luns | ||
4080 | # on a target can take minutes of wall clock time. Additionally, | ||
4081 | # there are FC targets, such as JBODs, that only recognize 8-bits of | ||
4082 | # LUN ID. When they receive a value greater than 8 bits, they chop off | ||
4083 | # the high order bits. In other words, they see LUN IDs 0, 256, 512, | ||
4084 | # and so on all as LUN ID 0. This causes the linux kernel, which sees | ||
4085 | # valid responses at each of the LUN IDs, to believe there are multiple | ||
4086 | # devices present, when in fact, there is only 1. | ||
4087 | # A customer that is aware of their target behaviors, and the results as | ||
4088 | # indicated above, is welcome to increase the lpfc_max_luns value. | ||
4089 | # As mentioned, this value is not used by the lpfc driver, only the | ||
4090 | # SCSI midlayer. | ||
4074 | # Value range is [0,65535]. Default value is 255. | 4091 | # Value range is [0,65535]. Default value is 255. |
4075 | # NOTE: The SCSI layer might probe all allowed LUN on some old targets. | 4092 | # NOTE: The SCSI layer might probe all allowed LUN on some old targets. |
4076 | */ | 4093 | */ |
4077 | LPFC_VPORT_ATTR_R(max_luns, 255, 0, 65535, "Maximum allowed LUN"); | 4094 | LPFC_VPORT_ATTR_R(max_luns, 255, 0, 65535, "Maximum allowed LUN ID"); |
4078 | 4095 | ||
4079 | /* | 4096 | /* |
4080 | # lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring. | 4097 | # lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring. |
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c index 094be2cad65b..6630520d295c 100644 --- a/drivers/scsi/lpfc/lpfc_bsg.c +++ b/drivers/scsi/lpfc/lpfc_bsg.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2009-2012 Emulex. All rights reserved. * | 4 | * Copyright (C) 2009-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * * | 7 | * * |
@@ -3392,6 +3392,7 @@ static int lpfc_bsg_check_cmd_access(struct lpfc_hba *phba, | |||
3392 | case MBX_DOWN_LOAD: | 3392 | case MBX_DOWN_LOAD: |
3393 | case MBX_UPDATE_CFG: | 3393 | case MBX_UPDATE_CFG: |
3394 | case MBX_KILL_BOARD: | 3394 | case MBX_KILL_BOARD: |
3395 | case MBX_READ_TOPOLOGY: | ||
3395 | case MBX_LOAD_AREA: | 3396 | case MBX_LOAD_AREA: |
3396 | case MBX_LOAD_EXP_ROM: | 3397 | case MBX_LOAD_EXP_ROM: |
3397 | case MBX_BEACON: | 3398 | case MBX_BEACON: |
@@ -3422,7 +3423,6 @@ static int lpfc_bsg_check_cmd_access(struct lpfc_hba *phba, | |||
3422 | } | 3423 | } |
3423 | break; | 3424 | break; |
3424 | case MBX_READ_SPARM64: | 3425 | case MBX_READ_SPARM64: |
3425 | case MBX_READ_TOPOLOGY: | ||
3426 | case MBX_REG_LOGIN: | 3426 | case MBX_REG_LOGIN: |
3427 | case MBX_REG_LOGIN64: | 3427 | case MBX_REG_LOGIN64: |
3428 | case MBX_CONFIG_PORT: | 3428 | case MBX_CONFIG_PORT: |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index d41456e5f814..cda076a84239 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2011 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * * | 7 | * * |
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index ae1a07c57cae..68391177432b 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2010 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * * | 7 | * * |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 3cae0a92e8bd..6b8ee7449f16 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2012 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 0f6e2548f35d..60d6ca2f68c2 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2012 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -6158,12 +6158,44 @@ lpfc_read_fcf_conn_tbl(struct lpfc_hba *phba, | |||
6158 | memcpy(&conn_entry->conn_rec, &conn_rec[i], | 6158 | memcpy(&conn_entry->conn_rec, &conn_rec[i], |
6159 | sizeof(struct lpfc_fcf_conn_rec)); | 6159 | sizeof(struct lpfc_fcf_conn_rec)); |
6160 | conn_entry->conn_rec.vlan_tag = | 6160 | conn_entry->conn_rec.vlan_tag = |
6161 | le16_to_cpu(conn_entry->conn_rec.vlan_tag) & 0xFFF; | 6161 | conn_entry->conn_rec.vlan_tag; |
6162 | conn_entry->conn_rec.flags = | 6162 | conn_entry->conn_rec.flags = |
6163 | le16_to_cpu(conn_entry->conn_rec.flags); | 6163 | conn_entry->conn_rec.flags; |
6164 | list_add_tail(&conn_entry->list, | 6164 | list_add_tail(&conn_entry->list, |
6165 | &phba->fcf_conn_rec_list); | 6165 | &phba->fcf_conn_rec_list); |
6166 | } | 6166 | } |
6167 | |||
6168 | if (!list_empty(&phba->fcf_conn_rec_list)) { | ||
6169 | i = 0; | ||
6170 | list_for_each_entry(conn_entry, &phba->fcf_conn_rec_list, | ||
6171 | list) { | ||
6172 | conn_rec = &conn_entry->conn_rec; | ||
6173 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | ||
6174 | "3345 FCF connection list rec[%02d]: " | ||
6175 | "flags:x%04x, vtag:x%04x, " | ||
6176 | "fabric_name:x%02x:%02x:%02x:%02x:" | ||
6177 | "%02x:%02x:%02x:%02x, " | ||
6178 | "switch_name:x%02x:%02x:%02x:%02x:" | ||
6179 | "%02x:%02x:%02x:%02x\n", i++, | ||
6180 | conn_rec->flags, conn_rec->vlan_tag, | ||
6181 | conn_rec->fabric_name[0], | ||
6182 | conn_rec->fabric_name[1], | ||
6183 | conn_rec->fabric_name[2], | ||
6184 | conn_rec->fabric_name[3], | ||
6185 | conn_rec->fabric_name[4], | ||
6186 | conn_rec->fabric_name[5], | ||
6187 | conn_rec->fabric_name[6], | ||
6188 | conn_rec->fabric_name[7], | ||
6189 | conn_rec->switch_name[0], | ||
6190 | conn_rec->switch_name[1], | ||
6191 | conn_rec->switch_name[2], | ||
6192 | conn_rec->switch_name[3], | ||
6193 | conn_rec->switch_name[4], | ||
6194 | conn_rec->switch_name[5], | ||
6195 | conn_rec->switch_name[6], | ||
6196 | conn_rec->switch_name[7]); | ||
6197 | } | ||
6198 | } | ||
6167 | } | 6199 | } |
6168 | 6200 | ||
6169 | /** | 6201 | /** |
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index 83700c18f468..6f927d30ca69 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2011 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * * | 7 | * * |
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index 713a4613ec3a..4ec3d7c044c2 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2009-2012 Emulex. All rights reserved. * | 4 | * Copyright (C) 2009-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * * | 7 | * * |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index cb465b253910..e0b20fad8502 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2012 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -60,7 +60,8 @@ unsigned long _dump_buf_dif_order; | |||
60 | spinlock_t _dump_buf_lock; | 60 | spinlock_t _dump_buf_lock; |
61 | 61 | ||
62 | /* Used when mapping IRQ vectors in a driver centric manner */ | 62 | /* Used when mapping IRQ vectors in a driver centric manner */ |
63 | uint16_t lpfc_used_cpu[LPFC_MAX_CPU]; | 63 | uint16_t *lpfc_used_cpu; |
64 | uint32_t lpfc_present_cpu; | ||
64 | 65 | ||
65 | static void lpfc_get_hba_model_desc(struct lpfc_hba *, uint8_t *, uint8_t *); | 66 | static void lpfc_get_hba_model_desc(struct lpfc_hba *, uint8_t *, uint8_t *); |
66 | static int lpfc_post_rcv_buf(struct lpfc_hba *); | 67 | static int lpfc_post_rcv_buf(struct lpfc_hba *); |
@@ -4049,52 +4050,6 @@ lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba) | |||
4049 | } | 4050 | } |
4050 | 4051 | ||
4051 | /** | 4052 | /** |
4052 | * lpfc_sli4_perform_inuse_fcf_recovery - Perform inuse fcf recovery | ||
4053 | * @vport: pointer to lpfc hba data structure. | ||
4054 | * | ||
4055 | * This routine is to perform FCF recovery when the in-use FCF either dead or | ||
4056 | * got modified. | ||
4057 | **/ | ||
4058 | static void | ||
4059 | lpfc_sli4_perform_inuse_fcf_recovery(struct lpfc_hba *phba, | ||
4060 | struct lpfc_acqe_fip *acqe_fip) | ||
4061 | { | ||
4062 | int rc; | ||
4063 | |||
4064 | spin_lock_irq(&phba->hbalock); | ||
4065 | /* Mark the fast failover process in progress */ | ||
4066 | phba->fcf.fcf_flag |= FCF_DEAD_DISC; | ||
4067 | spin_unlock_irq(&phba->hbalock); | ||
4068 | |||
4069 | lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, | ||
4070 | "2771 Start FCF fast failover process due to in-use " | ||
4071 | "FCF DEAD/MODIFIED event: evt_tag:x%x, index:x%x\n", | ||
4072 | acqe_fip->event_tag, acqe_fip->index); | ||
4073 | rc = lpfc_sli4_redisc_fcf_table(phba); | ||
4074 | if (rc) { | ||
4075 | lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, | ||
4076 | "2772 Issue FCF rediscover mabilbox command " | ||
4077 | "failed, fail through to FCF dead event\n"); | ||
4078 | spin_lock_irq(&phba->hbalock); | ||
4079 | phba->fcf.fcf_flag &= ~FCF_DEAD_DISC; | ||
4080 | spin_unlock_irq(&phba->hbalock); | ||
4081 | /* | ||
4082 | * Last resort will fail over by treating this as a link | ||
4083 | * down to FCF registration. | ||
4084 | */ | ||
4085 | lpfc_sli4_fcf_dead_failthrough(phba); | ||
4086 | } else { | ||
4087 | /* Reset FCF roundrobin bmask for new discovery */ | ||
4088 | lpfc_sli4_clear_fcf_rr_bmask(phba); | ||
4089 | /* | ||
4090 | * Handling fast FCF failover to a DEAD FCF event is | ||
4091 | * considered equalivant to receiving CVL to all vports. | ||
4092 | */ | ||
4093 | lpfc_sli4_perform_all_vport_cvl(phba); | ||
4094 | } | ||
4095 | } | ||
4096 | |||
4097 | /** | ||
4098 | * lpfc_sli4_async_fip_evt - Process the asynchronous FCoE FIP event | 4053 | * lpfc_sli4_async_fip_evt - Process the asynchronous FCoE FIP event |
4099 | * @phba: pointer to lpfc hba data structure. | 4054 | * @phba: pointer to lpfc hba data structure. |
4100 | * @acqe_link: pointer to the async fcoe completion queue entry. | 4055 | * @acqe_link: pointer to the async fcoe completion queue entry. |
@@ -4159,22 +4114,9 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba, | |||
4159 | break; | 4114 | break; |
4160 | } | 4115 | } |
4161 | 4116 | ||
4162 | /* If FCF has been in discovered state, perform rediscovery | 4117 | /* If the FCF has been in discovered state, do nothing. */ |
4163 | * only if the FCF with the same index of the in-use FCF got | 4118 | if (phba->fcf.fcf_flag & FCF_SCAN_DONE) { |
4164 | * modified during normal operation. Otherwise, do nothing. | ||
4165 | */ | ||
4166 | if (phba->pport->port_state > LPFC_FLOGI) { | ||
4167 | spin_unlock_irq(&phba->hbalock); | 4119 | spin_unlock_irq(&phba->hbalock); |
4168 | if (phba->fcf.current_rec.fcf_indx == | ||
4169 | acqe_fip->index) { | ||
4170 | lpfc_printf_log(phba, KERN_ERR, LOG_FIP, | ||
4171 | "3300 In-use FCF (%d) " | ||
4172 | "modified, perform FCF " | ||
4173 | "rediscovery\n", | ||
4174 | acqe_fip->index); | ||
4175 | lpfc_sli4_perform_inuse_fcf_recovery(phba, | ||
4176 | acqe_fip); | ||
4177 | } | ||
4178 | break; | 4120 | break; |
4179 | } | 4121 | } |
4180 | spin_unlock_irq(&phba->hbalock); | 4122 | spin_unlock_irq(&phba->hbalock); |
@@ -4227,7 +4169,39 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba, | |||
4227 | * is no longer valid as we are not in the middle of FCF | 4169 | * is no longer valid as we are not in the middle of FCF |
4228 | * failover process already. | 4170 | * failover process already. |
4229 | */ | 4171 | */ |
4230 | lpfc_sli4_perform_inuse_fcf_recovery(phba, acqe_fip); | 4172 | spin_lock_irq(&phba->hbalock); |
4173 | /* Mark the fast failover process in progress */ | ||
4174 | phba->fcf.fcf_flag |= FCF_DEAD_DISC; | ||
4175 | spin_unlock_irq(&phba->hbalock); | ||
4176 | |||
4177 | lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, | ||
4178 | "2771 Start FCF fast failover process due to " | ||
4179 | "FCF DEAD event: evt_tag:x%x, fcf_index:x%x " | ||
4180 | "\n", acqe_fip->event_tag, acqe_fip->index); | ||
4181 | rc = lpfc_sli4_redisc_fcf_table(phba); | ||
4182 | if (rc) { | ||
4183 | lpfc_printf_log(phba, KERN_ERR, LOG_FIP | | ||
4184 | LOG_DISCOVERY, | ||
4185 | "2772 Issue FCF rediscover mabilbox " | ||
4186 | "command failed, fail through to FCF " | ||
4187 | "dead event\n"); | ||
4188 | spin_lock_irq(&phba->hbalock); | ||
4189 | phba->fcf.fcf_flag &= ~FCF_DEAD_DISC; | ||
4190 | spin_unlock_irq(&phba->hbalock); | ||
4191 | /* | ||
4192 | * Last resort will fail over by treating this | ||
4193 | * as a link down to FCF registration. | ||
4194 | */ | ||
4195 | lpfc_sli4_fcf_dead_failthrough(phba); | ||
4196 | } else { | ||
4197 | /* Reset FCF roundrobin bmask for new discovery */ | ||
4198 | lpfc_sli4_clear_fcf_rr_bmask(phba); | ||
4199 | /* | ||
4200 | * Handling fast FCF failover to a DEAD FCF event is | ||
4201 | * considered equalivant to receiving CVL to all vports. | ||
4202 | */ | ||
4203 | lpfc_sli4_perform_all_vport_cvl(phba); | ||
4204 | } | ||
4231 | break; | 4205 | break; |
4232 | case LPFC_FIP_EVENT_TYPE_CVL: | 4206 | case LPFC_FIP_EVENT_TYPE_CVL: |
4233 | phba->fcoe_cvl_eventtag = acqe_fip->event_tag; | 4207 | phba->fcoe_cvl_eventtag = acqe_fip->event_tag; |
@@ -5213,6 +5187,21 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) | |||
5213 | rc = -ENOMEM; | 5187 | rc = -ENOMEM; |
5214 | goto out_free_msix; | 5188 | goto out_free_msix; |
5215 | } | 5189 | } |
5190 | if (lpfc_used_cpu == NULL) { | ||
5191 | lpfc_used_cpu = kzalloc((sizeof(uint16_t) * lpfc_present_cpu), | ||
5192 | GFP_KERNEL); | ||
5193 | if (!lpfc_used_cpu) { | ||
5194 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
5195 | "3335 Failed allocate memory for msi-x " | ||
5196 | "interrupt vector mapping\n"); | ||
5197 | kfree(phba->sli4_hba.cpu_map); | ||
5198 | rc = -ENOMEM; | ||
5199 | goto out_free_msix; | ||
5200 | } | ||
5201 | for (i = 0; i < lpfc_present_cpu; i++) | ||
5202 | lpfc_used_cpu[i] = LPFC_VECTOR_MAP_EMPTY; | ||
5203 | } | ||
5204 | |||
5216 | /* Initialize io channels for round robin */ | 5205 | /* Initialize io channels for round robin */ |
5217 | cpup = phba->sli4_hba.cpu_map; | 5206 | cpup = phba->sli4_hba.cpu_map; |
5218 | rc = 0; | 5207 | rc = 0; |
@@ -6824,8 +6813,6 @@ lpfc_sli4_queue_verify(struct lpfc_hba *phba) | |||
6824 | int cfg_fcp_io_channel; | 6813 | int cfg_fcp_io_channel; |
6825 | uint32_t cpu; | 6814 | uint32_t cpu; |
6826 | uint32_t i = 0; | 6815 | uint32_t i = 0; |
6827 | uint32_t j = 0; | ||
6828 | |||
6829 | 6816 | ||
6830 | /* | 6817 | /* |
6831 | * Sanity check for configured queue parameters against the run-time | 6818 | * Sanity check for configured queue parameters against the run-time |
@@ -6839,10 +6826,9 @@ lpfc_sli4_queue_verify(struct lpfc_hba *phba) | |||
6839 | for_each_present_cpu(cpu) { | 6826 | for_each_present_cpu(cpu) { |
6840 | if (cpu_online(cpu)) | 6827 | if (cpu_online(cpu)) |
6841 | i++; | 6828 | i++; |
6842 | j++; | ||
6843 | } | 6829 | } |
6844 | phba->sli4_hba.num_online_cpu = i; | 6830 | phba->sli4_hba.num_online_cpu = i; |
6845 | phba->sli4_hba.num_present_cpu = j; | 6831 | phba->sli4_hba.num_present_cpu = lpfc_present_cpu; |
6846 | 6832 | ||
6847 | if (i < cfg_fcp_io_channel) { | 6833 | if (i < cfg_fcp_io_channel) { |
6848 | lpfc_printf_log(phba, | 6834 | lpfc_printf_log(phba, |
@@ -10967,8 +10953,10 @@ lpfc_init(void) | |||
10967 | } | 10953 | } |
10968 | 10954 | ||
10969 | /* Initialize in case vector mapping is needed */ | 10955 | /* Initialize in case vector mapping is needed */ |
10970 | for (cpu = 0; cpu < LPFC_MAX_CPU; cpu++) | 10956 | lpfc_used_cpu = NULL; |
10971 | lpfc_used_cpu[cpu] = LPFC_VECTOR_MAP_EMPTY; | 10957 | lpfc_present_cpu = 0; |
10958 | for_each_present_cpu(cpu) | ||
10959 | lpfc_present_cpu++; | ||
10972 | 10960 | ||
10973 | error = pci_register_driver(&lpfc_driver); | 10961 | error = pci_register_driver(&lpfc_driver); |
10974 | if (error) { | 10962 | if (error) { |
@@ -11008,6 +10996,7 @@ lpfc_exit(void) | |||
11008 | (1L << _dump_buf_dif_order), _dump_buf_dif); | 10996 | (1L << _dump_buf_dif_order), _dump_buf_dif); |
11009 | free_pages((unsigned long)_dump_buf_dif, _dump_buf_dif_order); | 10997 | free_pages((unsigned long)_dump_buf_dif, _dump_buf_dif_order); |
11010 | } | 10998 | } |
10999 | kfree(lpfc_used_cpu); | ||
11011 | } | 11000 | } |
11012 | 11001 | ||
11013 | module_init(lpfc_init); | 11002 | module_init(lpfc_init); |
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index 41363db7d426..b1c510f6b8f0 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2009 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 31e9b92f5a9b..6aaf39a1f1c5 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2012 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 8523b278ec9d..243de1d324b7 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2012 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -68,14 +68,12 @@ struct scsi_dif_tuple { | |||
68 | __be32 ref_tag; /* Target LBA or indirect LBA */ | 68 | __be32 ref_tag; /* Target LBA or indirect LBA */ |
69 | }; | 69 | }; |
70 | 70 | ||
71 | #if !defined(SCSI_PROT_GUARD_CHECK) || !defined(SCSI_PROT_REF_CHECK) | ||
72 | #define scsi_prot_flagged(sc, flg) sc | ||
73 | #endif | ||
74 | |||
75 | static void | 71 | static void |
76 | lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb); | 72 | lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb); |
77 | static void | 73 | static void |
78 | lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb); | 74 | lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb); |
75 | static int | ||
76 | lpfc_prot_group_type(struct lpfc_hba *phba, struct scsi_cmnd *sc); | ||
79 | 77 | ||
80 | static void | 78 | static void |
81 | lpfc_debug_save_data(struct lpfc_hba *phba, struct scsi_cmnd *cmnd) | 79 | lpfc_debug_save_data(struct lpfc_hba *phba, struct scsi_cmnd *cmnd) |
@@ -134,6 +132,30 @@ lpfc_debug_save_dif(struct lpfc_hba *phba, struct scsi_cmnd *cmnd) | |||
134 | } | 132 | } |
135 | } | 133 | } |
136 | 134 | ||
135 | static inline unsigned | ||
136 | lpfc_cmd_blksize(struct scsi_cmnd *sc) | ||
137 | { | ||
138 | return sc->device->sector_size; | ||
139 | } | ||
140 | |||
141 | #define LPFC_CHECK_PROTECT_GUARD 1 | ||
142 | #define LPFC_CHECK_PROTECT_REF 2 | ||
143 | static inline unsigned | ||
144 | lpfc_cmd_protect(struct scsi_cmnd *sc, int flag) | ||
145 | { | ||
146 | return 1; | ||
147 | } | ||
148 | |||
149 | static inline unsigned | ||
150 | lpfc_cmd_guard_csum(struct scsi_cmnd *sc) | ||
151 | { | ||
152 | if (lpfc_prot_group_type(NULL, sc) == LPFC_PG_TYPE_NO_DIF) | ||
153 | return 0; | ||
154 | if (scsi_host_get_guard(sc->device->host) == SHOST_DIX_GUARD_IP) | ||
155 | return 1; | ||
156 | return 0; | ||
157 | } | ||
158 | |||
137 | /** | 159 | /** |
138 | * lpfc_sli4_set_rsp_sgl_last - Set the last bit in the response sge. | 160 | * lpfc_sli4_set_rsp_sgl_last - Set the last bit in the response sge. |
139 | * @phba: Pointer to HBA object. | 161 | * @phba: Pointer to HBA object. |
@@ -1144,13 +1166,14 @@ lpfc_get_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | |||
1144 | static struct lpfc_scsi_buf* | 1166 | static struct lpfc_scsi_buf* |
1145 | lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | 1167 | lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) |
1146 | { | 1168 | { |
1147 | struct lpfc_scsi_buf *lpfc_cmd ; | 1169 | struct lpfc_scsi_buf *lpfc_cmd, *lpfc_cmd_next; |
1148 | unsigned long gflag = 0; | 1170 | unsigned long gflag = 0; |
1149 | unsigned long pflag = 0; | 1171 | unsigned long pflag = 0; |
1150 | int found = 0; | 1172 | int found = 0; |
1151 | 1173 | ||
1152 | spin_lock_irqsave(&phba->scsi_buf_list_get_lock, gflag); | 1174 | spin_lock_irqsave(&phba->scsi_buf_list_get_lock, gflag); |
1153 | list_for_each_entry(lpfc_cmd, &phba->lpfc_scsi_buf_list_get, list) { | 1175 | list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next, |
1176 | &phba->lpfc_scsi_buf_list_get, list) { | ||
1154 | if (lpfc_test_rrq_active(phba, ndlp, | 1177 | if (lpfc_test_rrq_active(phba, ndlp, |
1155 | lpfc_cmd->cur_iocbq.sli4_lxritag)) | 1178 | lpfc_cmd->cur_iocbq.sli4_lxritag)) |
1156 | continue; | 1179 | continue; |
@@ -1164,8 +1187,8 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | |||
1164 | &phba->lpfc_scsi_buf_list_get); | 1187 | &phba->lpfc_scsi_buf_list_get); |
1165 | INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); | 1188 | INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); |
1166 | spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, pflag); | 1189 | spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, pflag); |
1167 | list_for_each_entry(lpfc_cmd, &phba->lpfc_scsi_buf_list_get, | 1190 | list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next, |
1168 | list) { | 1191 | &phba->lpfc_scsi_buf_list_get, list) { |
1169 | if (lpfc_test_rrq_active( | 1192 | if (lpfc_test_rrq_active( |
1170 | phba, ndlp, lpfc_cmd->cur_iocbq.sli4_lxritag)) | 1193 | phba, ndlp, lpfc_cmd->cur_iocbq.sli4_lxritag)) |
1171 | continue; | 1194 | continue; |
@@ -1409,12 +1432,6 @@ lpfc_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | |||
1409 | return 0; | 1432 | return 0; |
1410 | } | 1433 | } |
1411 | 1434 | ||
1412 | static inline unsigned | ||
1413 | lpfc_cmd_blksize(struct scsi_cmnd *sc) | ||
1414 | { | ||
1415 | return sc->device->sector_size; | ||
1416 | } | ||
1417 | |||
1418 | #ifdef CONFIG_SCSI_LPFC_DEBUG_FS | 1435 | #ifdef CONFIG_SCSI_LPFC_DEBUG_FS |
1419 | 1436 | ||
1420 | /* Return if if error injection is detected by Initiator */ | 1437 | /* Return if if error injection is detected by Initiator */ |
@@ -1847,10 +1864,9 @@ static int | |||
1847 | lpfc_sc_to_bg_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, | 1864 | lpfc_sc_to_bg_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, |
1848 | uint8_t *txop, uint8_t *rxop) | 1865 | uint8_t *txop, uint8_t *rxop) |
1849 | { | 1866 | { |
1850 | uint8_t guard_type = scsi_host_get_guard(sc->device->host); | ||
1851 | uint8_t ret = 0; | 1867 | uint8_t ret = 0; |
1852 | 1868 | ||
1853 | if (guard_type == SHOST_DIX_GUARD_IP) { | 1869 | if (lpfc_cmd_guard_csum(sc)) { |
1854 | switch (scsi_get_prot_op(sc)) { | 1870 | switch (scsi_get_prot_op(sc)) { |
1855 | case SCSI_PROT_READ_INSERT: | 1871 | case SCSI_PROT_READ_INSERT: |
1856 | case SCSI_PROT_WRITE_STRIP: | 1872 | case SCSI_PROT_WRITE_STRIP: |
@@ -1928,10 +1944,9 @@ static int | |||
1928 | lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, | 1944 | lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, |
1929 | uint8_t *txop, uint8_t *rxop) | 1945 | uint8_t *txop, uint8_t *rxop) |
1930 | { | 1946 | { |
1931 | uint8_t guard_type = scsi_host_get_guard(sc->device->host); | ||
1932 | uint8_t ret = 0; | 1947 | uint8_t ret = 0; |
1933 | 1948 | ||
1934 | if (guard_type == SHOST_DIX_GUARD_IP) { | 1949 | if (lpfc_cmd_guard_csum(sc)) { |
1935 | switch (scsi_get_prot_op(sc)) { | 1950 | switch (scsi_get_prot_op(sc)) { |
1936 | case SCSI_PROT_READ_INSERT: | 1951 | case SCSI_PROT_READ_INSERT: |
1937 | case SCSI_PROT_WRITE_STRIP: | 1952 | case SCSI_PROT_WRITE_STRIP: |
@@ -2078,12 +2093,12 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc, | |||
2078 | * protection data is automatically generated, not checked. | 2093 | * protection data is automatically generated, not checked. |
2079 | */ | 2094 | */ |
2080 | if (datadir == DMA_FROM_DEVICE) { | 2095 | if (datadir == DMA_FROM_DEVICE) { |
2081 | if (scsi_prot_flagged(sc, SCSI_PROT_GUARD_CHECK)) | 2096 | if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_GUARD)) |
2082 | bf_set(pde6_ce, pde6, checking); | 2097 | bf_set(pde6_ce, pde6, checking); |
2083 | else | 2098 | else |
2084 | bf_set(pde6_ce, pde6, 0); | 2099 | bf_set(pde6_ce, pde6, 0); |
2085 | 2100 | ||
2086 | if (scsi_prot_flagged(sc, SCSI_PROT_REF_CHECK)) | 2101 | if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_REF)) |
2087 | bf_set(pde6_re, pde6, checking); | 2102 | bf_set(pde6_re, pde6, checking); |
2088 | else | 2103 | else |
2089 | bf_set(pde6_re, pde6, 0); | 2104 | bf_set(pde6_re, pde6, 0); |
@@ -2240,12 +2255,12 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, | |||
2240 | bf_set(pde6_optx, pde6, txop); | 2255 | bf_set(pde6_optx, pde6, txop); |
2241 | bf_set(pde6_oprx, pde6, rxop); | 2256 | bf_set(pde6_oprx, pde6, rxop); |
2242 | 2257 | ||
2243 | if (scsi_prot_flagged(sc, SCSI_PROT_GUARD_CHECK)) | 2258 | if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_GUARD)) |
2244 | bf_set(pde6_ce, pde6, checking); | 2259 | bf_set(pde6_ce, pde6, checking); |
2245 | else | 2260 | else |
2246 | bf_set(pde6_ce, pde6, 0); | 2261 | bf_set(pde6_ce, pde6, 0); |
2247 | 2262 | ||
2248 | if (scsi_prot_flagged(sc, SCSI_PROT_REF_CHECK)) | 2263 | if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_REF)) |
2249 | bf_set(pde6_re, pde6, checking); | 2264 | bf_set(pde6_re, pde6, checking); |
2250 | else | 2265 | else |
2251 | bf_set(pde6_re, pde6, 0); | 2266 | bf_set(pde6_re, pde6, 0); |
@@ -2454,12 +2469,12 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc, | |||
2454 | * protection data is automatically generated, not checked. | 2469 | * protection data is automatically generated, not checked. |
2455 | */ | 2470 | */ |
2456 | if (sc->sc_data_direction == DMA_FROM_DEVICE) { | 2471 | if (sc->sc_data_direction == DMA_FROM_DEVICE) { |
2457 | if (scsi_prot_flagged(sc, SCSI_PROT_GUARD_CHECK)) | 2472 | if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_GUARD)) |
2458 | bf_set(lpfc_sli4_sge_dif_ce, diseed, checking); | 2473 | bf_set(lpfc_sli4_sge_dif_ce, diseed, checking); |
2459 | else | 2474 | else |
2460 | bf_set(lpfc_sli4_sge_dif_ce, diseed, 0); | 2475 | bf_set(lpfc_sli4_sge_dif_ce, diseed, 0); |
2461 | 2476 | ||
2462 | if (scsi_prot_flagged(sc, SCSI_PROT_REF_CHECK)) | 2477 | if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_REF)) |
2463 | bf_set(lpfc_sli4_sge_dif_re, diseed, checking); | 2478 | bf_set(lpfc_sli4_sge_dif_re, diseed, checking); |
2464 | else | 2479 | else |
2465 | bf_set(lpfc_sli4_sge_dif_re, diseed, 0); | 2480 | bf_set(lpfc_sli4_sge_dif_re, diseed, 0); |
@@ -2610,7 +2625,7 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, | |||
2610 | diseed->ref_tag = cpu_to_le32(reftag); | 2625 | diseed->ref_tag = cpu_to_le32(reftag); |
2611 | diseed->ref_tag_tran = diseed->ref_tag; | 2626 | diseed->ref_tag_tran = diseed->ref_tag; |
2612 | 2627 | ||
2613 | if (scsi_prot_flagged(sc, SCSI_PROT_GUARD_CHECK)) { | 2628 | if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_GUARD)) { |
2614 | bf_set(lpfc_sli4_sge_dif_ce, diseed, checking); | 2629 | bf_set(lpfc_sli4_sge_dif_ce, diseed, checking); |
2615 | 2630 | ||
2616 | } else { | 2631 | } else { |
@@ -2629,7 +2644,7 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, | |||
2629 | } | 2644 | } |
2630 | 2645 | ||
2631 | 2646 | ||
2632 | if (scsi_prot_flagged(sc, SCSI_PROT_REF_CHECK)) | 2647 | if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_REF)) |
2633 | bf_set(lpfc_sli4_sge_dif_re, diseed, checking); | 2648 | bf_set(lpfc_sli4_sge_dif_re, diseed, checking); |
2634 | else | 2649 | else |
2635 | bf_set(lpfc_sli4_sge_dif_re, diseed, 0); | 2650 | bf_set(lpfc_sli4_sge_dif_re, diseed, 0); |
@@ -2792,11 +2807,12 @@ lpfc_prot_group_type(struct lpfc_hba *phba, struct scsi_cmnd *sc) | |||
2792 | ret = LPFC_PG_TYPE_DIF_BUF; | 2807 | ret = LPFC_PG_TYPE_DIF_BUF; |
2793 | break; | 2808 | break; |
2794 | default: | 2809 | default: |
2795 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 2810 | if (phba) |
2796 | "9021 Unsupported protection op:%d\n", op); | 2811 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, |
2812 | "9021 Unsupported protection op:%d\n", | ||
2813 | op); | ||
2797 | break; | 2814 | break; |
2798 | } | 2815 | } |
2799 | |||
2800 | return ret; | 2816 | return ret; |
2801 | } | 2817 | } |
2802 | 2818 | ||
@@ -2821,22 +2837,22 @@ lpfc_bg_scsi_adjust_dl(struct lpfc_hba *phba, | |||
2821 | 2837 | ||
2822 | /* Check if there is protection data on the wire */ | 2838 | /* Check if there is protection data on the wire */ |
2823 | if (sc->sc_data_direction == DMA_FROM_DEVICE) { | 2839 | if (sc->sc_data_direction == DMA_FROM_DEVICE) { |
2824 | /* Read */ | 2840 | /* Read check for protection data */ |
2825 | if (scsi_get_prot_op(sc) == SCSI_PROT_READ_INSERT) | 2841 | if (scsi_get_prot_op(sc) == SCSI_PROT_READ_INSERT) |
2826 | return fcpdl; | 2842 | return fcpdl; |
2827 | 2843 | ||
2828 | } else { | 2844 | } else { |
2829 | /* Write */ | 2845 | /* Write check for protection data */ |
2830 | if (scsi_get_prot_op(sc) == SCSI_PROT_WRITE_STRIP) | 2846 | if (scsi_get_prot_op(sc) == SCSI_PROT_WRITE_STRIP) |
2831 | return fcpdl; | 2847 | return fcpdl; |
2832 | } | 2848 | } |
2833 | 2849 | ||
2834 | /* | 2850 | /* |
2835 | * If we are in DIF Type 1 mode every data block has a 8 byte | 2851 | * If we are in DIF Type 1 mode every data block has a 8 byte |
2836 | * DIF (trailer) attached to it. Must ajust FCP data length. | 2852 | * DIF (trailer) attached to it. Must ajust FCP data length |
2853 | * to account for the protection data. | ||
2837 | */ | 2854 | */ |
2838 | if (scsi_prot_flagged(sc, SCSI_PROT_TRANSFER_PI)) | 2855 | fcpdl += (fcpdl / lpfc_cmd_blksize(sc)) * 8; |
2839 | fcpdl += (fcpdl / lpfc_cmd_blksize(sc)) * 8; | ||
2840 | 2856 | ||
2841 | return fcpdl; | 2857 | return fcpdl; |
2842 | } | 2858 | } |
@@ -3073,9 +3089,9 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | |||
3073 | chk_guard = 1; | 3089 | chk_guard = 1; |
3074 | guard_type = scsi_host_get_guard(cmd->device->host); | 3090 | guard_type = scsi_host_get_guard(cmd->device->host); |
3075 | 3091 | ||
3092 | src = (struct scsi_dif_tuple *)sg_virt(sgpe); | ||
3076 | start_ref_tag = (uint32_t)scsi_get_lba(cmd); /* Truncate LBA */ | 3093 | start_ref_tag = (uint32_t)scsi_get_lba(cmd); /* Truncate LBA */ |
3077 | start_app_tag = src->app_tag; | 3094 | start_app_tag = src->app_tag; |
3078 | src = (struct scsi_dif_tuple *)sg_virt(sgpe); | ||
3079 | len = sgpe->length; | 3095 | len = sgpe->length; |
3080 | while (src && protsegcnt) { | 3096 | while (src && protsegcnt) { |
3081 | while (len) { | 3097 | while (len) { |
@@ -3090,25 +3106,10 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | |||
3090 | goto skipit; | 3106 | goto skipit; |
3091 | } | 3107 | } |
3092 | 3108 | ||
3093 | /* App Tag checking */ | 3109 | /* First Guard Tag checking */ |
3094 | app_tag = src->app_tag; | ||
3095 | if (chk_app && (app_tag != start_app_tag)) { | ||
3096 | err_type = BGS_APPTAG_ERR_MASK; | ||
3097 | goto out; | ||
3098 | } | ||
3099 | |||
3100 | /* Reference Tag checking */ | ||
3101 | ref_tag = be32_to_cpu(src->ref_tag); | ||
3102 | if (chk_ref && (ref_tag != start_ref_tag)) { | ||
3103 | err_type = BGS_REFTAG_ERR_MASK; | ||
3104 | goto out; | ||
3105 | } | ||
3106 | start_ref_tag++; | ||
3107 | |||
3108 | /* Guard Tag checking */ | ||
3109 | if (chk_guard) { | 3110 | if (chk_guard) { |
3110 | guard_tag = src->guard_tag; | 3111 | guard_tag = src->guard_tag; |
3111 | if (guard_type == SHOST_DIX_GUARD_IP) | 3112 | if (lpfc_cmd_guard_csum(cmd)) |
3112 | sum = lpfc_bg_csum(data_src, | 3113 | sum = lpfc_bg_csum(data_src, |
3113 | blksize); | 3114 | blksize); |
3114 | else | 3115 | else |
@@ -3119,6 +3120,21 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | |||
3119 | goto out; | 3120 | goto out; |
3120 | } | 3121 | } |
3121 | } | 3122 | } |
3123 | |||
3124 | /* Reference Tag checking */ | ||
3125 | ref_tag = be32_to_cpu(src->ref_tag); | ||
3126 | if (chk_ref && (ref_tag != start_ref_tag)) { | ||
3127 | err_type = BGS_REFTAG_ERR_MASK; | ||
3128 | goto out; | ||
3129 | } | ||
3130 | start_ref_tag++; | ||
3131 | |||
3132 | /* App Tag checking */ | ||
3133 | app_tag = src->app_tag; | ||
3134 | if (chk_app && (app_tag != start_app_tag)) { | ||
3135 | err_type = BGS_APPTAG_ERR_MASK; | ||
3136 | goto out; | ||
3137 | } | ||
3122 | skipit: | 3138 | skipit: |
3123 | len -= sizeof(struct scsi_dif_tuple); | 3139 | len -= sizeof(struct scsi_dif_tuple); |
3124 | if (len < 0) | 3140 | if (len < 0) |
@@ -4074,7 +4090,8 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
4074 | cmd->device ? cmd->device->id : 0xffff, | 4090 | cmd->device ? cmd->device->id : 0xffff, |
4075 | cmd->device ? cmd->device->lun : 0xffff, | 4091 | cmd->device ? cmd->device->lun : 0xffff, |
4076 | lpfc_cmd->status, lpfc_cmd->result, | 4092 | lpfc_cmd->status, lpfc_cmd->result, |
4077 | vport->fc_myDID, pnode->nlp_DID, | 4093 | vport->fc_myDID, |
4094 | (pnode) ? pnode->nlp_DID : 0, | ||
4078 | phba->sli_rev == LPFC_SLI_REV4 ? | 4095 | phba->sli_rev == LPFC_SLI_REV4 ? |
4079 | lpfc_cmd->cur_iocbq.sli4_xritag : 0xffff, | 4096 | lpfc_cmd->cur_iocbq.sli4_xritag : 0xffff, |
4080 | pIocbOut->iocb.ulpContext, | 4097 | pIocbOut->iocb.ulpContext, |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.h b/drivers/scsi/lpfc/lpfc_scsi.h index 21a2ffe67eac..b1d9f7fcb911 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.h +++ b/drivers/scsi/lpfc/lpfc_scsi.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2012 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * * | 7 | * * |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 572579f87de4..43440ca16f46 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2012 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -1011,17 +1011,6 @@ __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) | |||
1011 | else | 1011 | else |
1012 | sglq = __lpfc_clear_active_sglq(phba, iocbq->sli4_lxritag); | 1012 | sglq = __lpfc_clear_active_sglq(phba, iocbq->sli4_lxritag); |
1013 | 1013 | ||
1014 | /* | ||
1015 | ** This should have been removed from the txcmplq before calling | ||
1016 | ** iocbq_release. The normal completion | ||
1017 | ** path should have already done the list_del_init. | ||
1018 | */ | ||
1019 | if (unlikely(!list_empty(&iocbq->list))) { | ||
1020 | if (iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ) | ||
1021 | iocbq->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ; | ||
1022 | list_del_init(&iocbq->list); | ||
1023 | } | ||
1024 | |||
1025 | 1014 | ||
1026 | if (sglq) { | 1015 | if (sglq) { |
1027 | if ((iocbq->iocb_flag & LPFC_EXCHANGE_BUSY) && | 1016 | if ((iocbq->iocb_flag & LPFC_EXCHANGE_BUSY) && |
@@ -1070,13 +1059,6 @@ __lpfc_sli_release_iocbq_s3(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) | |||
1070 | { | 1059 | { |
1071 | size_t start_clean = offsetof(struct lpfc_iocbq, iocb); | 1060 | size_t start_clean = offsetof(struct lpfc_iocbq, iocb); |
1072 | 1061 | ||
1073 | /* | ||
1074 | ** This should have been removed from the txcmplq before calling | ||
1075 | ** iocbq_release. The normal completion | ||
1076 | ** path should have already done the list_del_init. | ||
1077 | */ | ||
1078 | if (unlikely(!list_empty(&iocbq->list))) | ||
1079 | list_del_init(&iocbq->list); | ||
1080 | 1062 | ||
1081 | /* | 1063 | /* |
1082 | * Clean all volatile data fields, preserve iotag and node struct. | 1064 | * Clean all volatile data fields, preserve iotag and node struct. |
@@ -3279,7 +3261,7 @@ lpfc_sli_sp_handle_rspiocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3279 | if (free_saveq) { | 3261 | if (free_saveq) { |
3280 | list_for_each_entry_safe(rspiocbp, next_iocb, | 3262 | list_for_each_entry_safe(rspiocbp, next_iocb, |
3281 | &saveq->list, list) { | 3263 | &saveq->list, list) { |
3282 | list_del(&rspiocbp->list); | 3264 | list_del_init(&rspiocbp->list); |
3283 | __lpfc_sli_release_iocbq(phba, rspiocbp); | 3265 | __lpfc_sli_release_iocbq(phba, rspiocbp); |
3284 | } | 3266 | } |
3285 | __lpfc_sli_release_iocbq(phba, saveq); | 3267 | __lpfc_sli_release_iocbq(phba, saveq); |
@@ -4584,7 +4566,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) | |||
4584 | } else { | 4566 | } else { |
4585 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 4567 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
4586 | "2708 This device does not support " | 4568 | "2708 This device does not support " |
4587 | "Advanced Error Reporting (AER)\n"); | 4569 | "Advanced Error Reporting (AER): %d\n", |
4570 | rc); | ||
4588 | phba->cfg_aer_support = 0; | 4571 | phba->cfg_aer_support = 0; |
4589 | } | 4572 | } |
4590 | } | 4573 | } |
@@ -8731,7 +8714,7 @@ lpfc_sli4_abts_err_handler(struct lpfc_hba *phba, | |||
8731 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | 8714 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, |
8732 | "3116 Port generated FCP XRI ABORT event on " | 8715 | "3116 Port generated FCP XRI ABORT event on " |
8733 | "vpi %d rpi %d xri x%x status 0x%x parameter x%x\n", | 8716 | "vpi %d rpi %d xri x%x status 0x%x parameter x%x\n", |
8734 | ndlp->vport->vpi, ndlp->nlp_rpi, | 8717 | ndlp->vport->vpi, phba->sli4_hba.rpi_ids[ndlp->nlp_rpi], |
8735 | bf_get(lpfc_wcqe_xa_xri, axri), | 8718 | bf_get(lpfc_wcqe_xa_xri, axri), |
8736 | bf_get(lpfc_wcqe_xa_status, axri), | 8719 | bf_get(lpfc_wcqe_xa_status, axri), |
8737 | axri->parameter); | 8720 | axri->parameter); |
@@ -9787,7 +9770,7 @@ lpfc_sli_abort_fcp_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
9787 | struct lpfc_iocbq *rspiocb) | 9770 | struct lpfc_iocbq *rspiocb) |
9788 | { | 9771 | { |
9789 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 9772 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
9790 | "3096 ABORT_XRI_CN completing on xri x%x " | 9773 | "3096 ABORT_XRI_CN completing on rpi x%x " |
9791 | "original iotag x%x, abort cmd iotag x%x " | 9774 | "original iotag x%x, abort cmd iotag x%x " |
9792 | "status 0x%x, reason 0x%x\n", | 9775 | "status 0x%x, reason 0x%x\n", |
9793 | cmdiocb->iocb.un.acxri.abortContextTag, | 9776 | cmdiocb->iocb.un.acxri.abortContextTag, |
@@ -10109,12 +10092,13 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq, | |||
10109 | uint32_t timeout) | 10092 | uint32_t timeout) |
10110 | { | 10093 | { |
10111 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(done_q); | 10094 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(done_q); |
10095 | MAILBOX_t *mb = NULL; | ||
10112 | int retval; | 10096 | int retval; |
10113 | unsigned long flag; | 10097 | unsigned long flag; |
10114 | 10098 | ||
10115 | /* The caller must leave context1 empty. */ | 10099 | /* The caller might set context1 for extended buffer */ |
10116 | if (pmboxq->context1) | 10100 | if (pmboxq->context1) |
10117 | return MBX_NOT_FINISHED; | 10101 | mb = (MAILBOX_t *)pmboxq->context1; |
10118 | 10102 | ||
10119 | pmboxq->mbox_flag &= ~LPFC_MBX_WAKE; | 10103 | pmboxq->mbox_flag &= ~LPFC_MBX_WAKE; |
10120 | /* setup wake call as IOCB callback */ | 10104 | /* setup wake call as IOCB callback */ |
@@ -10130,7 +10114,8 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq, | |||
10130 | msecs_to_jiffies(timeout * 1000)); | 10114 | msecs_to_jiffies(timeout * 1000)); |
10131 | 10115 | ||
10132 | spin_lock_irqsave(&phba->hbalock, flag); | 10116 | spin_lock_irqsave(&phba->hbalock, flag); |
10133 | pmboxq->context1 = NULL; | 10117 | /* restore the possible extended buffer for free resource */ |
10118 | pmboxq->context1 = (uint8_t *)mb; | ||
10134 | /* | 10119 | /* |
10135 | * if LPFC_MBX_WAKE flag is set the mailbox is completed | 10120 | * if LPFC_MBX_WAKE flag is set the mailbox is completed |
10136 | * else do not free the resources. | 10121 | * else do not free the resources. |
@@ -10143,6 +10128,9 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq, | |||
10143 | pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 10128 | pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
10144 | } | 10129 | } |
10145 | spin_unlock_irqrestore(&phba->hbalock, flag); | 10130 | spin_unlock_irqrestore(&phba->hbalock, flag); |
10131 | } else { | ||
10132 | /* restore the possible extended buffer for free resource */ | ||
10133 | pmboxq->context1 = (uint8_t *)mb; | ||
10146 | } | 10134 | } |
10147 | 10135 | ||
10148 | return retval; | 10136 | return retval; |
@@ -16304,7 +16292,7 @@ lpfc_drain_txq(struct lpfc_hba *phba) | |||
16304 | union lpfc_wqe wqe; | 16292 | union lpfc_wqe wqe; |
16305 | int txq_cnt = 0; | 16293 | int txq_cnt = 0; |
16306 | 16294 | ||
16307 | spin_lock_irqsave(&phba->hbalock, iflags); | 16295 | spin_lock_irqsave(&pring->ring_lock, iflags); |
16308 | list_for_each_entry(piocbq, &pring->txq, list) { | 16296 | list_for_each_entry(piocbq, &pring->txq, list) { |
16309 | txq_cnt++; | 16297 | txq_cnt++; |
16310 | } | 16298 | } |
@@ -16312,14 +16300,14 @@ lpfc_drain_txq(struct lpfc_hba *phba) | |||
16312 | if (txq_cnt > pring->txq_max) | 16300 | if (txq_cnt > pring->txq_max) |
16313 | pring->txq_max = txq_cnt; | 16301 | pring->txq_max = txq_cnt; |
16314 | 16302 | ||
16315 | spin_unlock_irqrestore(&phba->hbalock, iflags); | 16303 | spin_unlock_irqrestore(&pring->ring_lock, iflags); |
16316 | 16304 | ||
16317 | while (!list_empty(&pring->txq)) { | 16305 | while (!list_empty(&pring->txq)) { |
16318 | spin_lock_irqsave(&phba->hbalock, iflags); | 16306 | spin_lock_irqsave(&pring->ring_lock, iflags); |
16319 | 16307 | ||
16320 | piocbq = lpfc_sli_ringtx_get(phba, pring); | 16308 | piocbq = lpfc_sli_ringtx_get(phba, pring); |
16321 | if (!piocbq) { | 16309 | if (!piocbq) { |
16322 | spin_unlock_irqrestore(&phba->hbalock, iflags); | 16310 | spin_unlock_irqrestore(&pring->ring_lock, iflags); |
16323 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 16311 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
16324 | "2823 txq empty and txq_cnt is %d\n ", | 16312 | "2823 txq empty and txq_cnt is %d\n ", |
16325 | txq_cnt); | 16313 | txq_cnt); |
@@ -16328,7 +16316,7 @@ lpfc_drain_txq(struct lpfc_hba *phba) | |||
16328 | sglq = __lpfc_sli_get_sglq(phba, piocbq); | 16316 | sglq = __lpfc_sli_get_sglq(phba, piocbq); |
16329 | if (!sglq) { | 16317 | if (!sglq) { |
16330 | __lpfc_sli_ringtx_put(phba, pring, piocbq); | 16318 | __lpfc_sli_ringtx_put(phba, pring, piocbq); |
16331 | spin_unlock_irqrestore(&phba->hbalock, iflags); | 16319 | spin_unlock_irqrestore(&pring->ring_lock, iflags); |
16332 | break; | 16320 | break; |
16333 | } | 16321 | } |
16334 | txq_cnt--; | 16322 | txq_cnt--; |
@@ -16356,7 +16344,7 @@ lpfc_drain_txq(struct lpfc_hba *phba) | |||
16356 | piocbq->iotag, piocbq->sli4_xritag); | 16344 | piocbq->iotag, piocbq->sli4_xritag); |
16357 | list_add_tail(&piocbq->list, &completions); | 16345 | list_add_tail(&piocbq->list, &completions); |
16358 | } | 16346 | } |
16359 | spin_unlock_irqrestore(&phba->hbalock, iflags); | 16347 | spin_unlock_irqrestore(&pring->ring_lock, iflags); |
16360 | } | 16348 | } |
16361 | 16349 | ||
16362 | /* Cancel all the IOCBs that cannot be issued */ | 16350 | /* Cancel all the IOCBs that cannot be issued */ |
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h index 67af460184ba..d710b87a4417 100644 --- a/drivers/scsi/lpfc/lpfc_sli4.h +++ b/drivers/scsi/lpfc/lpfc_sli4.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2009-2011 Emulex. All rights reserved. * | 4 | * Copyright (C) 2009-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * * | 7 | * * |
@@ -444,7 +444,6 @@ struct lpfc_vector_map_info { | |||
444 | struct cpumask maskbits; | 444 | struct cpumask maskbits; |
445 | }; | 445 | }; |
446 | #define LPFC_VECTOR_MAP_EMPTY 0xffff | 446 | #define LPFC_VECTOR_MAP_EMPTY 0xffff |
447 | #define LPFC_MAX_CPU 256 | ||
448 | 447 | ||
449 | /* SLI4 HBA data structure entries */ | 448 | /* SLI4 HBA data structure entries */ |
450 | struct lpfc_sli4_hba { | 449 | struct lpfc_sli4_hba { |
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index a38dc3b16969..c6c32eebf3dd 100644 --- a/drivers/scsi/lpfc/lpfc_version.h +++ b/drivers/scsi/lpfc/lpfc_version.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2012 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2013 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * * | 7 | * * |
@@ -18,7 +18,7 @@ | |||
18 | * included with this package. * | 18 | * included with this package. * |
19 | *******************************************************************/ | 19 | *******************************************************************/ |
20 | 20 | ||
21 | #define LPFC_DRIVER_VERSION "8.3.39" | 21 | #define LPFC_DRIVER_VERSION "8.3.40" |
22 | #define LPFC_DRIVER_NAME "lpfc" | 22 | #define LPFC_DRIVER_NAME "lpfc" |
23 | 23 | ||
24 | /* Used for SLI 2/3 */ | 24 | /* Used for SLI 2/3 */ |
@@ -30,4 +30,4 @@ | |||
30 | 30 | ||
31 | #define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \ | 31 | #define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \ |
32 | LPFC_DRIVER_VERSION | 32 | LPFC_DRIVER_VERSION |
33 | #define LPFC_COPYRIGHT "Copyright(c) 2004-2009 Emulex. All rights reserved." | 33 | #define LPFC_COPYRIGHT "Copyright(c) 2004-2013 Emulex. All rights reserved." |
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 684cc343cf09..04a42a505852 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h | |||
@@ -33,9 +33,9 @@ | |||
33 | /* | 33 | /* |
34 | * MegaRAID SAS Driver meta data | 34 | * MegaRAID SAS Driver meta data |
35 | */ | 35 | */ |
36 | #define MEGASAS_VERSION "06.506.00.00-rc1" | 36 | #define MEGASAS_VERSION "06.600.18.00-rc1" |
37 | #define MEGASAS_RELDATE "Feb. 9, 2013" | 37 | #define MEGASAS_RELDATE "May. 15, 2013" |
38 | #define MEGASAS_EXT_VERSION "Sat. Feb. 9 17:00:00 PDT 2013" | 38 | #define MEGASAS_EXT_VERSION "Wed. May. 15 17:00:00 PDT 2013" |
39 | 39 | ||
40 | /* | 40 | /* |
41 | * Device IDs | 41 | * Device IDs |
@@ -49,6 +49,33 @@ | |||
49 | #define PCI_DEVICE_ID_LSI_SAS0071SKINNY 0x0071 | 49 | #define PCI_DEVICE_ID_LSI_SAS0071SKINNY 0x0071 |
50 | #define PCI_DEVICE_ID_LSI_FUSION 0x005b | 50 | #define PCI_DEVICE_ID_LSI_FUSION 0x005b |
51 | #define PCI_DEVICE_ID_LSI_INVADER 0x005d | 51 | #define PCI_DEVICE_ID_LSI_INVADER 0x005d |
52 | #define PCI_DEVICE_ID_LSI_FURY 0x005f | ||
53 | |||
54 | /* | ||
55 | * Intel HBA SSDIDs | ||
56 | */ | ||
57 | #define MEGARAID_INTEL_RS3DC080_SSDID 0x9360 | ||
58 | #define MEGARAID_INTEL_RS3DC040_SSDID 0x9362 | ||
59 | #define MEGARAID_INTEL_RS3SC008_SSDID 0x9380 | ||
60 | #define MEGARAID_INTEL_RS3MC044_SSDID 0x9381 | ||
61 | #define MEGARAID_INTEL_RS3WC080_SSDID 0x9341 | ||
62 | #define MEGARAID_INTEL_RS3WC040_SSDID 0x9343 | ||
63 | |||
64 | /* | ||
65 | * Intel HBA branding | ||
66 | */ | ||
67 | #define MEGARAID_INTEL_RS3DC080_BRANDING \ | ||
68 | "Intel(R) RAID Controller RS3DC080" | ||
69 | #define MEGARAID_INTEL_RS3DC040_BRANDING \ | ||
70 | "Intel(R) RAID Controller RS3DC040" | ||
71 | #define MEGARAID_INTEL_RS3SC008_BRANDING \ | ||
72 | "Intel(R) RAID Controller RS3SC008" | ||
73 | #define MEGARAID_INTEL_RS3MC044_BRANDING \ | ||
74 | "Intel(R) RAID Controller RS3MC044" | ||
75 | #define MEGARAID_INTEL_RS3WC080_BRANDING \ | ||
76 | "Intel(R) RAID Controller RS3WC080" | ||
77 | #define MEGARAID_INTEL_RS3WC040_BRANDING \ | ||
78 | "Intel(R) RAID Controller RS3WC040" | ||
52 | 79 | ||
53 | /* | 80 | /* |
54 | * ===================================== | 81 | * ===================================== |
@@ -163,6 +190,12 @@ | |||
163 | #define MR_DCMD_PD_LIST_QUERY 0x02010100 | 190 | #define MR_DCMD_PD_LIST_QUERY 0x02010100 |
164 | 191 | ||
165 | /* | 192 | /* |
193 | * Global functions | ||
194 | */ | ||
195 | extern u8 MR_ValidateMapInfo(struct megasas_instance *instance); | ||
196 | |||
197 | |||
198 | /* | ||
166 | * MFI command completion codes | 199 | * MFI command completion codes |
167 | */ | 200 | */ |
168 | enum MFI_STAT { | 201 | enum MFI_STAT { |
@@ -702,8 +735,126 @@ struct megasas_ctrl_info { | |||
702 | */ | 735 | */ |
703 | char package_version[0x60]; | 736 | char package_version[0x60]; |
704 | 737 | ||
705 | u8 pad[0x800 - 0x6a0]; | ||
706 | 738 | ||
739 | /* | ||
740 | * If adapterOperations.supportMoreThan8Phys is set, | ||
741 | * and deviceInterface.portCount is greater than 8, | ||
742 | * SAS Addrs for first 8 ports shall be populated in | ||
743 | * deviceInterface.portAddr, and the rest shall be | ||
744 | * populated in deviceInterfacePortAddr2. | ||
745 | */ | ||
746 | u64 deviceInterfacePortAddr2[8]; /*6a0h */ | ||
747 | u8 reserved3[128]; /*6e0h */ | ||
748 | |||
749 | struct { /*760h */ | ||
750 | u16 minPdRaidLevel_0:4; | ||
751 | u16 maxPdRaidLevel_0:12; | ||
752 | |||
753 | u16 minPdRaidLevel_1:4; | ||
754 | u16 maxPdRaidLevel_1:12; | ||
755 | |||
756 | u16 minPdRaidLevel_5:4; | ||
757 | u16 maxPdRaidLevel_5:12; | ||
758 | |||
759 | u16 minPdRaidLevel_1E:4; | ||
760 | u16 maxPdRaidLevel_1E:12; | ||
761 | |||
762 | u16 minPdRaidLevel_6:4; | ||
763 | u16 maxPdRaidLevel_6:12; | ||
764 | |||
765 | u16 minPdRaidLevel_10:4; | ||
766 | u16 maxPdRaidLevel_10:12; | ||
767 | |||
768 | u16 minPdRaidLevel_50:4; | ||
769 | u16 maxPdRaidLevel_50:12; | ||
770 | |||
771 | u16 minPdRaidLevel_60:4; | ||
772 | u16 maxPdRaidLevel_60:12; | ||
773 | |||
774 | u16 minPdRaidLevel_1E_RLQ0:4; | ||
775 | u16 maxPdRaidLevel_1E_RLQ0:12; | ||
776 | |||
777 | u16 minPdRaidLevel_1E0_RLQ0:4; | ||
778 | u16 maxPdRaidLevel_1E0_RLQ0:12; | ||
779 | |||
780 | u16 reserved[6]; | ||
781 | } pdsForRaidLevels; | ||
782 | |||
783 | u16 maxPds; /*780h */ | ||
784 | u16 maxDedHSPs; /*782h */ | ||
785 | u16 maxGlobalHSPs; /*784h */ | ||
786 | u16 ddfSize; /*786h */ | ||
787 | u8 maxLdsPerArray; /*788h */ | ||
788 | u8 partitionsInDDF; /*789h */ | ||
789 | u8 lockKeyBinding; /*78ah */ | ||
790 | u8 maxPITsPerLd; /*78bh */ | ||
791 | u8 maxViewsPerLd; /*78ch */ | ||
792 | u8 maxTargetId; /*78dh */ | ||
793 | u16 maxBvlVdSize; /*78eh */ | ||
794 | |||
795 | u16 maxConfigurableSSCSize; /*790h */ | ||
796 | u16 currentSSCsize; /*792h */ | ||
797 | |||
798 | char expanderFwVersion[12]; /*794h */ | ||
799 | |||
800 | u16 PFKTrialTimeRemaining; /*7A0h */ | ||
801 | |||
802 | u16 cacheMemorySize; /*7A2h */ | ||
803 | |||
804 | struct { /*7A4h */ | ||
805 | u32 supportPIcontroller:1; | ||
806 | u32 supportLdPIType1:1; | ||
807 | u32 supportLdPIType2:1; | ||
808 | u32 supportLdPIType3:1; | ||
809 | u32 supportLdBBMInfo:1; | ||
810 | u32 supportShieldState:1; | ||
811 | u32 blockSSDWriteCacheChange:1; | ||
812 | u32 supportSuspendResumeBGops:1; | ||
813 | u32 supportEmergencySpares:1; | ||
814 | u32 supportSetLinkSpeed:1; | ||
815 | u32 supportBootTimePFKChange:1; | ||
816 | u32 supportJBOD:1; | ||
817 | u32 disableOnlinePFKChange:1; | ||
818 | u32 supportPerfTuning:1; | ||
819 | u32 supportSSDPatrolRead:1; | ||
820 | u32 realTimeScheduler:1; | ||
821 | |||
822 | u32 supportResetNow:1; | ||
823 | u32 supportEmulatedDrives:1; | ||
824 | u32 headlessMode:1; | ||
825 | u32 dedicatedHotSparesLimited:1; | ||
826 | |||
827 | |||
828 | u32 supportUnevenSpans:1; | ||
829 | u32 reserved:11; | ||
830 | } adapterOperations2; | ||
831 | |||
832 | u8 driverVersion[32]; /*7A8h */ | ||
833 | u8 maxDAPdCountSpinup60; /*7C8h */ | ||
834 | u8 temperatureROC; /*7C9h */ | ||
835 | u8 temperatureCtrl; /*7CAh */ | ||
836 | u8 reserved4; /*7CBh */ | ||
837 | u16 maxConfigurablePds; /*7CCh */ | ||
838 | |||
839 | |||
840 | u8 reserved5[2]; /*0x7CDh */ | ||
841 | |||
842 | /* | ||
843 | * HA cluster information | ||
844 | */ | ||
845 | struct { | ||
846 | u32 peerIsPresent:1; | ||
847 | u32 peerIsIncompatible:1; | ||
848 | u32 hwIncompatible:1; | ||
849 | u32 fwVersionMismatch:1; | ||
850 | u32 ctrlPropIncompatible:1; | ||
851 | u32 premiumFeatureMismatch:1; | ||
852 | u32 reserved:26; | ||
853 | } cluster; | ||
854 | |||
855 | char clusterId[16]; /*7D4h */ | ||
856 | |||
857 | u8 pad[0x800-0x7E4]; /*7E4 */ | ||
707 | } __packed; | 858 | } __packed; |
708 | 859 | ||
709 | /* | 860 | /* |
@@ -759,7 +910,7 @@ struct megasas_ctrl_info { | |||
759 | #define MEGASAS_INT_CMDS 32 | 910 | #define MEGASAS_INT_CMDS 32 |
760 | #define MEGASAS_SKINNY_INT_CMDS 5 | 911 | #define MEGASAS_SKINNY_INT_CMDS 5 |
761 | 912 | ||
762 | #define MEGASAS_MAX_MSIX_QUEUES 16 | 913 | #define MEGASAS_MAX_MSIX_QUEUES 128 |
763 | /* | 914 | /* |
764 | * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit | 915 | * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit |
765 | * SGLs based on the size of dma_addr_t | 916 | * SGLs based on the size of dma_addr_t |
@@ -784,6 +935,11 @@ struct megasas_ctrl_info { | |||
784 | #define MFI_1068_PCSR_OFFSET 0x84 | 935 | #define MFI_1068_PCSR_OFFSET 0x84 |
785 | #define MFI_1068_FW_HANDSHAKE_OFFSET 0x64 | 936 | #define MFI_1068_FW_HANDSHAKE_OFFSET 0x64 |
786 | #define MFI_1068_FW_READY 0xDDDD0000 | 937 | #define MFI_1068_FW_READY 0xDDDD0000 |
938 | |||
939 | #define MR_MAX_REPLY_QUEUES_OFFSET 0X0000001F | ||
940 | #define MR_MAX_REPLY_QUEUES_EXT_OFFSET 0X003FC000 | ||
941 | #define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14 | ||
942 | #define MR_MAX_MSIX_REG_ARRAY 16 | ||
787 | /* | 943 | /* |
788 | * register set for both 1068 and 1078 controllers | 944 | * register set for both 1068 and 1078 controllers |
789 | * structure extended for 1078 registers | 945 | * structure extended for 1078 registers |
@@ -893,6 +1049,15 @@ union megasas_sgl_frame { | |||
893 | 1049 | ||
894 | } __attribute__ ((packed)); | 1050 | } __attribute__ ((packed)); |
895 | 1051 | ||
1052 | typedef union _MFI_CAPABILITIES { | ||
1053 | struct { | ||
1054 | u32 support_fp_remote_lun:1; | ||
1055 | u32 support_additional_msix:1; | ||
1056 | u32 reserved:30; | ||
1057 | } mfi_capabilities; | ||
1058 | u32 reg; | ||
1059 | } MFI_CAPABILITIES; | ||
1060 | |||
896 | struct megasas_init_frame { | 1061 | struct megasas_init_frame { |
897 | 1062 | ||
898 | u8 cmd; /*00h */ | 1063 | u8 cmd; /*00h */ |
@@ -900,7 +1065,7 @@ struct megasas_init_frame { | |||
900 | u8 cmd_status; /*02h */ | 1065 | u8 cmd_status; /*02h */ |
901 | 1066 | ||
902 | u8 reserved_1; /*03h */ | 1067 | u8 reserved_1; /*03h */ |
903 | u32 reserved_2; /*04h */ | 1068 | MFI_CAPABILITIES driver_operations; /*04h*/ |
904 | 1069 | ||
905 | u32 context; /*08h */ | 1070 | u32 context; /*08h */ |
906 | u32 pad_0; /*0Ch */ | 1071 | u32 pad_0; /*0Ch */ |
@@ -1297,7 +1462,7 @@ struct megasas_instance { | |||
1297 | 1462 | ||
1298 | unsigned long base_addr; | 1463 | unsigned long base_addr; |
1299 | struct megasas_register_set __iomem *reg_set; | 1464 | struct megasas_register_set __iomem *reg_set; |
1300 | 1465 | u32 *reply_post_host_index_addr[MR_MAX_MSIX_REG_ARRAY]; | |
1301 | struct megasas_pd_list pd_list[MEGASAS_MAX_PD]; | 1466 | struct megasas_pd_list pd_list[MEGASAS_MAX_PD]; |
1302 | u8 ld_ids[MEGASAS_MAX_LD_IDS]; | 1467 | u8 ld_ids[MEGASAS_MAX_LD_IDS]; |
1303 | s8 init_id; | 1468 | s8 init_id; |
@@ -1348,6 +1513,7 @@ struct megasas_instance { | |||
1348 | u8 flag_ieee; | 1513 | u8 flag_ieee; |
1349 | u8 issuepend_done; | 1514 | u8 issuepend_done; |
1350 | u8 disableOnlineCtrlReset; | 1515 | u8 disableOnlineCtrlReset; |
1516 | u8 UnevenSpanSupport; | ||
1351 | u8 adprecovery; | 1517 | u8 adprecovery; |
1352 | unsigned long last_time; | 1518 | unsigned long last_time; |
1353 | u32 mfiStatus; | 1519 | u32 mfiStatus; |
@@ -1366,6 +1532,8 @@ struct megasas_instance { | |||
1366 | long reset_flags; | 1532 | long reset_flags; |
1367 | struct mutex reset_mutex; | 1533 | struct mutex reset_mutex; |
1368 | int throttlequeuedepth; | 1534 | int throttlequeuedepth; |
1535 | u8 mask_interrupts; | ||
1536 | u8 is_imr; | ||
1369 | }; | 1537 | }; |
1370 | 1538 | ||
1371 | enum { | 1539 | enum { |
@@ -1381,8 +1549,8 @@ struct megasas_instance_template { | |||
1381 | void (*fire_cmd)(struct megasas_instance *, dma_addr_t, \ | 1549 | void (*fire_cmd)(struct megasas_instance *, dma_addr_t, \ |
1382 | u32, struct megasas_register_set __iomem *); | 1550 | u32, struct megasas_register_set __iomem *); |
1383 | 1551 | ||
1384 | void (*enable_intr)(struct megasas_register_set __iomem *) ; | 1552 | void (*enable_intr)(struct megasas_instance *); |
1385 | void (*disable_intr)(struct megasas_register_set __iomem *); | 1553 | void (*disable_intr)(struct megasas_instance *); |
1386 | 1554 | ||
1387 | int (*clear_intr)(struct megasas_register_set __iomem *); | 1555 | int (*clear_intr)(struct megasas_register_set __iomem *); |
1388 | 1556 | ||
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 3a9ddae86f1f..6002d363c637 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c | |||
@@ -18,7 +18,7 @@ | |||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | * | 19 | * |
20 | * FILE: megaraid_sas_base.c | 20 | * FILE: megaraid_sas_base.c |
21 | * Version : v06.506.00.00-rc1 | 21 | * Version : 06.600.18.00-rc1 |
22 | * | 22 | * |
23 | * Authors: LSI Corporation | 23 | * Authors: LSI Corporation |
24 | * Sreenivas Bagalkote | 24 | * Sreenivas Bagalkote |
@@ -122,6 +122,8 @@ static struct pci_device_id megasas_pci_table[] = { | |||
122 | /* Fusion */ | 122 | /* Fusion */ |
123 | {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_INVADER)}, | 123 | {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_INVADER)}, |
124 | /* Invader */ | 124 | /* Invader */ |
125 | {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FURY)}, | ||
126 | /* Fury */ | ||
125 | {} | 127 | {} |
126 | }; | 128 | }; |
127 | 129 | ||
@@ -169,8 +171,6 @@ megasas_sync_map_info(struct megasas_instance *instance); | |||
169 | int | 171 | int |
170 | wait_and_poll(struct megasas_instance *instance, struct megasas_cmd *cmd); | 172 | wait_and_poll(struct megasas_instance *instance, struct megasas_cmd *cmd); |
171 | void megasas_reset_reply_desc(struct megasas_instance *instance); | 173 | void megasas_reset_reply_desc(struct megasas_instance *instance); |
172 | u8 MR_ValidateMapInfo(struct MR_FW_RAID_MAP_ALL *map, | ||
173 | struct LD_LOAD_BALANCE_INFO *lbInfo); | ||
174 | int megasas_reset_fusion(struct Scsi_Host *shost); | 174 | int megasas_reset_fusion(struct Scsi_Host *shost); |
175 | void megasas_fusion_ocr_wq(struct work_struct *work); | 175 | void megasas_fusion_ocr_wq(struct work_struct *work); |
176 | 176 | ||
@@ -223,6 +223,7 @@ megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd) | |||
223 | cmd->frame_count = 0; | 223 | cmd->frame_count = 0; |
224 | if ((instance->pdev->device != PCI_DEVICE_ID_LSI_FUSION) && | 224 | if ((instance->pdev->device != PCI_DEVICE_ID_LSI_FUSION) && |
225 | (instance->pdev->device != PCI_DEVICE_ID_LSI_INVADER) && | 225 | (instance->pdev->device != PCI_DEVICE_ID_LSI_INVADER) && |
226 | (instance->pdev->device != PCI_DEVICE_ID_LSI_FURY) && | ||
226 | (reset_devices)) | 227 | (reset_devices)) |
227 | cmd->frame->hdr.cmd = MFI_CMD_INVALID; | 228 | cmd->frame->hdr.cmd = MFI_CMD_INVALID; |
228 | list_add_tail(&cmd->list, &instance->cmd_pool); | 229 | list_add_tail(&cmd->list, &instance->cmd_pool); |
@@ -241,8 +242,10 @@ megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd) | |||
241 | * @regs: MFI register set | 242 | * @regs: MFI register set |
242 | */ | 243 | */ |
243 | static inline void | 244 | static inline void |
244 | megasas_enable_intr_xscale(struct megasas_register_set __iomem * regs) | 245 | megasas_enable_intr_xscale(struct megasas_instance *instance) |
245 | { | 246 | { |
247 | struct megasas_register_set __iomem *regs; | ||
248 | regs = instance->reg_set; | ||
246 | writel(0, &(regs)->outbound_intr_mask); | 249 | writel(0, &(regs)->outbound_intr_mask); |
247 | 250 | ||
248 | /* Dummy readl to force pci flush */ | 251 | /* Dummy readl to force pci flush */ |
@@ -254,9 +257,11 @@ megasas_enable_intr_xscale(struct megasas_register_set __iomem * regs) | |||
254 | * @regs: MFI register set | 257 | * @regs: MFI register set |
255 | */ | 258 | */ |
256 | static inline void | 259 | static inline void |
257 | megasas_disable_intr_xscale(struct megasas_register_set __iomem * regs) | 260 | megasas_disable_intr_xscale(struct megasas_instance *instance) |
258 | { | 261 | { |
262 | struct megasas_register_set __iomem *regs; | ||
259 | u32 mask = 0x1f; | 263 | u32 mask = 0x1f; |
264 | regs = instance->reg_set; | ||
260 | writel(mask, ®s->outbound_intr_mask); | 265 | writel(mask, ®s->outbound_intr_mask); |
261 | /* Dummy readl to force pci flush */ | 266 | /* Dummy readl to force pci flush */ |
262 | readl(®s->outbound_intr_mask); | 267 | readl(®s->outbound_intr_mask); |
@@ -410,8 +415,10 @@ static struct megasas_instance_template megasas_instance_template_xscale = { | |||
410 | * @regs: MFI register set | 415 | * @regs: MFI register set |
411 | */ | 416 | */ |
412 | static inline void | 417 | static inline void |
413 | megasas_enable_intr_ppc(struct megasas_register_set __iomem * regs) | 418 | megasas_enable_intr_ppc(struct megasas_instance *instance) |
414 | { | 419 | { |
420 | struct megasas_register_set __iomem *regs; | ||
421 | regs = instance->reg_set; | ||
415 | writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear); | 422 | writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear); |
416 | 423 | ||
417 | writel(~0x80000000, &(regs)->outbound_intr_mask); | 424 | writel(~0x80000000, &(regs)->outbound_intr_mask); |
@@ -425,9 +432,11 @@ megasas_enable_intr_ppc(struct megasas_register_set __iomem * regs) | |||
425 | * @regs: MFI register set | 432 | * @regs: MFI register set |
426 | */ | 433 | */ |
427 | static inline void | 434 | static inline void |
428 | megasas_disable_intr_ppc(struct megasas_register_set __iomem * regs) | 435 | megasas_disable_intr_ppc(struct megasas_instance *instance) |
429 | { | 436 | { |
437 | struct megasas_register_set __iomem *regs; | ||
430 | u32 mask = 0xFFFFFFFF; | 438 | u32 mask = 0xFFFFFFFF; |
439 | regs = instance->reg_set; | ||
431 | writel(mask, ®s->outbound_intr_mask); | 440 | writel(mask, ®s->outbound_intr_mask); |
432 | /* Dummy readl to force pci flush */ | 441 | /* Dummy readl to force pci flush */ |
433 | readl(®s->outbound_intr_mask); | 442 | readl(®s->outbound_intr_mask); |
@@ -528,8 +537,10 @@ static struct megasas_instance_template megasas_instance_template_ppc = { | |||
528 | * @regs: MFI register set | 537 | * @regs: MFI register set |
529 | */ | 538 | */ |
530 | static inline void | 539 | static inline void |
531 | megasas_enable_intr_skinny(struct megasas_register_set __iomem *regs) | 540 | megasas_enable_intr_skinny(struct megasas_instance *instance) |
532 | { | 541 | { |
542 | struct megasas_register_set __iomem *regs; | ||
543 | regs = instance->reg_set; | ||
533 | writel(0xFFFFFFFF, &(regs)->outbound_intr_mask); | 544 | writel(0xFFFFFFFF, &(regs)->outbound_intr_mask); |
534 | 545 | ||
535 | writel(~MFI_SKINNY_ENABLE_INTERRUPT_MASK, &(regs)->outbound_intr_mask); | 546 | writel(~MFI_SKINNY_ENABLE_INTERRUPT_MASK, &(regs)->outbound_intr_mask); |
@@ -543,9 +554,11 @@ megasas_enable_intr_skinny(struct megasas_register_set __iomem *regs) | |||
543 | * @regs: MFI register set | 554 | * @regs: MFI register set |
544 | */ | 555 | */ |
545 | static inline void | 556 | static inline void |
546 | megasas_disable_intr_skinny(struct megasas_register_set __iomem *regs) | 557 | megasas_disable_intr_skinny(struct megasas_instance *instance) |
547 | { | 558 | { |
559 | struct megasas_register_set __iomem *regs; | ||
548 | u32 mask = 0xFFFFFFFF; | 560 | u32 mask = 0xFFFFFFFF; |
561 | regs = instance->reg_set; | ||
549 | writel(mask, ®s->outbound_intr_mask); | 562 | writel(mask, ®s->outbound_intr_mask); |
550 | /* Dummy readl to force pci flush */ | 563 | /* Dummy readl to force pci flush */ |
551 | readl(®s->outbound_intr_mask); | 564 | readl(®s->outbound_intr_mask); |
@@ -583,7 +596,7 @@ megasas_clear_intr_skinny(struct megasas_register_set __iomem *regs) | |||
583 | /* | 596 | /* |
584 | * Check if it is our interrupt | 597 | * Check if it is our interrupt |
585 | */ | 598 | */ |
586 | if ((megasas_read_fw_status_reg_gen2(regs) & MFI_STATE_MASK) == | 599 | if ((megasas_read_fw_status_reg_skinny(regs) & MFI_STATE_MASK) == |
587 | MFI_STATE_FAULT) { | 600 | MFI_STATE_FAULT) { |
588 | mfiStatus = MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE; | 601 | mfiStatus = MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE; |
589 | } else | 602 | } else |
@@ -663,8 +676,10 @@ static struct megasas_instance_template megasas_instance_template_skinny = { | |||
663 | * @regs: MFI register set | 676 | * @regs: MFI register set |
664 | */ | 677 | */ |
665 | static inline void | 678 | static inline void |
666 | megasas_enable_intr_gen2(struct megasas_register_set __iomem *regs) | 679 | megasas_enable_intr_gen2(struct megasas_instance *instance) |
667 | { | 680 | { |
681 | struct megasas_register_set __iomem *regs; | ||
682 | regs = instance->reg_set; | ||
668 | writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear); | 683 | writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear); |
669 | 684 | ||
670 | /* write ~0x00000005 (4 & 1) to the intr mask*/ | 685 | /* write ~0x00000005 (4 & 1) to the intr mask*/ |
@@ -679,9 +694,11 @@ megasas_enable_intr_gen2(struct megasas_register_set __iomem *regs) | |||
679 | * @regs: MFI register set | 694 | * @regs: MFI register set |
680 | */ | 695 | */ |
681 | static inline void | 696 | static inline void |
682 | megasas_disable_intr_gen2(struct megasas_register_set __iomem *regs) | 697 | megasas_disable_intr_gen2(struct megasas_instance *instance) |
683 | { | 698 | { |
699 | struct megasas_register_set __iomem *regs; | ||
684 | u32 mask = 0xFFFFFFFF; | 700 | u32 mask = 0xFFFFFFFF; |
701 | regs = instance->reg_set; | ||
685 | writel(mask, ®s->outbound_intr_mask); | 702 | writel(mask, ®s->outbound_intr_mask); |
686 | /* Dummy readl to force pci flush */ | 703 | /* Dummy readl to force pci flush */ |
687 | readl(®s->outbound_intr_mask); | 704 | readl(®s->outbound_intr_mask); |
@@ -711,7 +728,7 @@ megasas_clear_intr_gen2(struct megasas_register_set __iomem *regs) | |||
711 | */ | 728 | */ |
712 | status = readl(®s->outbound_intr_status); | 729 | status = readl(®s->outbound_intr_status); |
713 | 730 | ||
714 | if (status & MFI_GEN2_ENABLE_INTERRUPT_MASK) { | 731 | if (status & MFI_INTR_FLAG_REPLY_MESSAGE) { |
715 | mfiStatus = MFI_INTR_FLAG_REPLY_MESSAGE; | 732 | mfiStatus = MFI_INTR_FLAG_REPLY_MESSAGE; |
716 | } | 733 | } |
717 | if (status & MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT) { | 734 | if (status & MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT) { |
@@ -1471,6 +1488,14 @@ megasas_queue_command_lck(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd | |||
1471 | return SCSI_MLQUEUE_HOST_BUSY; | 1488 | return SCSI_MLQUEUE_HOST_BUSY; |
1472 | 1489 | ||
1473 | spin_lock_irqsave(&instance->hba_lock, flags); | 1490 | spin_lock_irqsave(&instance->hba_lock, flags); |
1491 | |||
1492 | if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) { | ||
1493 | spin_unlock_irqrestore(&instance->hba_lock, flags); | ||
1494 | scmd->result = DID_ERROR << 16; | ||
1495 | done(scmd); | ||
1496 | return 0; | ||
1497 | } | ||
1498 | |||
1474 | if (instance->adprecovery != MEGASAS_HBA_OPERATIONAL) { | 1499 | if (instance->adprecovery != MEGASAS_HBA_OPERATIONAL) { |
1475 | spin_unlock_irqrestore(&instance->hba_lock, flags); | 1500 | spin_unlock_irqrestore(&instance->hba_lock, flags); |
1476 | return SCSI_MLQUEUE_HOST_BUSY; | 1501 | return SCSI_MLQUEUE_HOST_BUSY; |
@@ -1591,7 +1616,8 @@ void megaraid_sas_kill_hba(struct megasas_instance *instance) | |||
1591 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) || | 1616 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) || |
1592 | (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY) || | 1617 | (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY) || |
1593 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) || | 1618 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) || |
1594 | (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER)) { | 1619 | (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || |
1620 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) { | ||
1595 | writel(MFI_STOP_ADP, &instance->reg_set->doorbell); | 1621 | writel(MFI_STOP_ADP, &instance->reg_set->doorbell); |
1596 | } else { | 1622 | } else { |
1597 | writel(MFI_STOP_ADP, &instance->reg_set->inbound_doorbell); | 1623 | writel(MFI_STOP_ADP, &instance->reg_set->inbound_doorbell); |
@@ -1615,10 +1641,7 @@ megasas_check_and_restore_queue_depth(struct megasas_instance *instance) | |||
1615 | 1641 | ||
1616 | spin_lock_irqsave(instance->host->host_lock, flags); | 1642 | spin_lock_irqsave(instance->host->host_lock, flags); |
1617 | instance->flag &= ~MEGASAS_FW_BUSY; | 1643 | instance->flag &= ~MEGASAS_FW_BUSY; |
1618 | if ((instance->pdev->device == | 1644 | if (instance->is_imr) { |
1619 | PCI_DEVICE_ID_LSI_SAS0073SKINNY) || | ||
1620 | (instance->pdev->device == | ||
1621 | PCI_DEVICE_ID_LSI_SAS0071SKINNY)) { | ||
1622 | instance->host->can_queue = | 1645 | instance->host->can_queue = |
1623 | instance->max_fw_cmds - MEGASAS_SKINNY_INT_CMDS; | 1646 | instance->max_fw_cmds - MEGASAS_SKINNY_INT_CMDS; |
1624 | } else | 1647 | } else |
@@ -1695,7 +1718,7 @@ void megasas_do_ocr(struct megasas_instance *instance) | |||
1695 | (instance->pdev->device == PCI_DEVICE_ID_LSI_VERDE_ZCR)) { | 1718 | (instance->pdev->device == PCI_DEVICE_ID_LSI_VERDE_ZCR)) { |
1696 | *instance->consumer = MEGASAS_ADPRESET_INPROG_SIGN; | 1719 | *instance->consumer = MEGASAS_ADPRESET_INPROG_SIGN; |
1697 | } | 1720 | } |
1698 | instance->instancet->disable_intr(instance->reg_set); | 1721 | instance->instancet->disable_intr(instance); |
1699 | instance->adprecovery = MEGASAS_ADPRESET_SM_INFAULT; | 1722 | instance->adprecovery = MEGASAS_ADPRESET_SM_INFAULT; |
1700 | instance->issuepend_done = 0; | 1723 | instance->issuepend_done = 0; |
1701 | 1724 | ||
@@ -1966,7 +1989,8 @@ static int megasas_reset_bus_host(struct scsi_cmnd *scmd) | |||
1966 | * First wait for all commands to complete | 1989 | * First wait for all commands to complete |
1967 | */ | 1990 | */ |
1968 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) || | 1991 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) || |
1969 | (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER)) | 1992 | (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || |
1993 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) | ||
1970 | ret = megasas_reset_fusion(scmd->device->host); | 1994 | ret = megasas_reset_fusion(scmd->device->host); |
1971 | else | 1995 | else |
1972 | ret = megasas_generic_reset(scmd); | 1996 | ret = megasas_generic_reset(scmd); |
@@ -2266,6 +2290,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, | |||
2266 | /* Check for LD map update */ | 2290 | /* Check for LD map update */ |
2267 | if ((cmd->frame->dcmd.opcode == MR_DCMD_LD_MAP_GET_INFO) && | 2291 | if ((cmd->frame->dcmd.opcode == MR_DCMD_LD_MAP_GET_INFO) && |
2268 | (cmd->frame->dcmd.mbox.b[1] == 1)) { | 2292 | (cmd->frame->dcmd.mbox.b[1] == 1)) { |
2293 | fusion->fast_path_io = 0; | ||
2269 | spin_lock_irqsave(instance->host->host_lock, flags); | 2294 | spin_lock_irqsave(instance->host->host_lock, flags); |
2270 | if (cmd->frame->hdr.cmd_status != 0) { | 2295 | if (cmd->frame->hdr.cmd_status != 0) { |
2271 | if (cmd->frame->hdr.cmd_status != | 2296 | if (cmd->frame->hdr.cmd_status != |
@@ -2283,9 +2308,13 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, | |||
2283 | } else | 2308 | } else |
2284 | instance->map_id++; | 2309 | instance->map_id++; |
2285 | megasas_return_cmd(instance, cmd); | 2310 | megasas_return_cmd(instance, cmd); |
2286 | if (MR_ValidateMapInfo( | 2311 | |
2287 | fusion->ld_map[(instance->map_id & 1)], | 2312 | /* |
2288 | fusion->load_balance_info)) | 2313 | * Set fast path IO to ZERO. |
2314 | * Validate Map will set proper value. | ||
2315 | * Meanwhile all IOs will go as LD IO. | ||
2316 | */ | ||
2317 | if (MR_ValidateMapInfo(instance)) | ||
2289 | fusion->fast_path_io = 1; | 2318 | fusion->fast_path_io = 1; |
2290 | else | 2319 | else |
2291 | fusion->fast_path_io = 0; | 2320 | fusion->fast_path_io = 0; |
@@ -2477,7 +2506,7 @@ process_fw_state_change_wq(struct work_struct *work) | |||
2477 | printk(KERN_NOTICE "megaraid_sas: FW detected to be in fault" | 2506 | printk(KERN_NOTICE "megaraid_sas: FW detected to be in fault" |
2478 | "state, restarting it...\n"); | 2507 | "state, restarting it...\n"); |
2479 | 2508 | ||
2480 | instance->instancet->disable_intr(instance->reg_set); | 2509 | instance->instancet->disable_intr(instance); |
2481 | atomic_set(&instance->fw_outstanding, 0); | 2510 | atomic_set(&instance->fw_outstanding, 0); |
2482 | 2511 | ||
2483 | atomic_set(&instance->fw_reset_no_pci_access, 1); | 2512 | atomic_set(&instance->fw_reset_no_pci_access, 1); |
@@ -2518,7 +2547,7 @@ process_fw_state_change_wq(struct work_struct *work) | |||
2518 | spin_lock_irqsave(&instance->hba_lock, flags); | 2547 | spin_lock_irqsave(&instance->hba_lock, flags); |
2519 | instance->adprecovery = MEGASAS_HBA_OPERATIONAL; | 2548 | instance->adprecovery = MEGASAS_HBA_OPERATIONAL; |
2520 | spin_unlock_irqrestore(&instance->hba_lock, flags); | 2549 | spin_unlock_irqrestore(&instance->hba_lock, flags); |
2521 | instance->instancet->enable_intr(instance->reg_set); | 2550 | instance->instancet->enable_intr(instance); |
2522 | 2551 | ||
2523 | megasas_issue_pending_cmds_again(instance); | 2552 | megasas_issue_pending_cmds_again(instance); |
2524 | instance->issuepend_done = 1; | 2553 | instance->issuepend_done = 1; |
@@ -2581,7 +2610,7 @@ megasas_deplete_reply_queue(struct megasas_instance *instance, | |||
2581 | } | 2610 | } |
2582 | 2611 | ||
2583 | 2612 | ||
2584 | instance->instancet->disable_intr(instance->reg_set); | 2613 | instance->instancet->disable_intr(instance); |
2585 | instance->adprecovery = MEGASAS_ADPRESET_SM_INFAULT; | 2614 | instance->adprecovery = MEGASAS_ADPRESET_SM_INFAULT; |
2586 | instance->issuepend_done = 0; | 2615 | instance->issuepend_done = 0; |
2587 | 2616 | ||
@@ -2672,9 +2701,11 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) | |||
2672 | (instance->pdev->device == | 2701 | (instance->pdev->device == |
2673 | PCI_DEVICE_ID_LSI_SAS0071SKINNY) || | 2702 | PCI_DEVICE_ID_LSI_SAS0071SKINNY) || |
2674 | (instance->pdev->device == | 2703 | (instance->pdev->device == |
2675 | PCI_DEVICE_ID_LSI_FUSION) || | 2704 | PCI_DEVICE_ID_LSI_FUSION) || |
2676 | (instance->pdev->device == | 2705 | (instance->pdev->device == |
2677 | PCI_DEVICE_ID_LSI_INVADER)) { | 2706 | PCI_DEVICE_ID_LSI_INVADER) || |
2707 | (instance->pdev->device == | ||
2708 | PCI_DEVICE_ID_LSI_FURY)) { | ||
2678 | writel( | 2709 | writel( |
2679 | MFI_INIT_CLEAR_HANDSHAKE|MFI_INIT_HOTPLUG, | 2710 | MFI_INIT_CLEAR_HANDSHAKE|MFI_INIT_HOTPLUG, |
2680 | &instance->reg_set->doorbell); | 2711 | &instance->reg_set->doorbell); |
@@ -2696,7 +2727,9 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) | |||
2696 | (instance->pdev->device == | 2727 | (instance->pdev->device == |
2697 | PCI_DEVICE_ID_LSI_FUSION) || | 2728 | PCI_DEVICE_ID_LSI_FUSION) || |
2698 | (instance->pdev->device == | 2729 | (instance->pdev->device == |
2699 | PCI_DEVICE_ID_LSI_INVADER)) { | 2730 | PCI_DEVICE_ID_LSI_INVADER) || |
2731 | (instance->pdev->device == | ||
2732 | PCI_DEVICE_ID_LSI_FURY)) { | ||
2700 | writel(MFI_INIT_HOTPLUG, | 2733 | writel(MFI_INIT_HOTPLUG, |
2701 | &instance->reg_set->doorbell); | 2734 | &instance->reg_set->doorbell); |
2702 | } else | 2735 | } else |
@@ -2711,7 +2744,7 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) | |||
2711 | /* | 2744 | /* |
2712 | * Bring it to READY state; assuming max wait 10 secs | 2745 | * Bring it to READY state; assuming max wait 10 secs |
2713 | */ | 2746 | */ |
2714 | instance->instancet->disable_intr(instance->reg_set); | 2747 | instance->instancet->disable_intr(instance); |
2715 | if ((instance->pdev->device == | 2748 | if ((instance->pdev->device == |
2716 | PCI_DEVICE_ID_LSI_SAS0073SKINNY) || | 2749 | PCI_DEVICE_ID_LSI_SAS0073SKINNY) || |
2717 | (instance->pdev->device == | 2750 | (instance->pdev->device == |
@@ -2719,13 +2752,17 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) | |||
2719 | (instance->pdev->device | 2752 | (instance->pdev->device |
2720 | == PCI_DEVICE_ID_LSI_FUSION) || | 2753 | == PCI_DEVICE_ID_LSI_FUSION) || |
2721 | (instance->pdev->device | 2754 | (instance->pdev->device |
2722 | == PCI_DEVICE_ID_LSI_INVADER)) { | 2755 | == PCI_DEVICE_ID_LSI_INVADER) || |
2756 | (instance->pdev->device | ||
2757 | == PCI_DEVICE_ID_LSI_FURY)) { | ||
2723 | writel(MFI_RESET_FLAGS, | 2758 | writel(MFI_RESET_FLAGS, |
2724 | &instance->reg_set->doorbell); | 2759 | &instance->reg_set->doorbell); |
2725 | if ((instance->pdev->device == | 2760 | if ((instance->pdev->device == |
2726 | PCI_DEVICE_ID_LSI_FUSION) || | 2761 | PCI_DEVICE_ID_LSI_FUSION) || |
2727 | (instance->pdev->device == | 2762 | (instance->pdev->device == |
2728 | PCI_DEVICE_ID_LSI_INVADER)) { | 2763 | PCI_DEVICE_ID_LSI_INVADER) || |
2764 | (instance->pdev->device == | ||
2765 | PCI_DEVICE_ID_LSI_FURY)) { | ||
2729 | for (i = 0; i < (10 * 1000); i += 20) { | 2766 | for (i = 0; i < (10 * 1000); i += 20) { |
2730 | if (readl( | 2767 | if (readl( |
2731 | &instance-> | 2768 | &instance-> |
@@ -2950,6 +2987,7 @@ static int megasas_create_frame_pool(struct megasas_instance *instance) | |||
2950 | cmd->frame->io.pad_0 = 0; | 2987 | cmd->frame->io.pad_0 = 0; |
2951 | if ((instance->pdev->device != PCI_DEVICE_ID_LSI_FUSION) && | 2988 | if ((instance->pdev->device != PCI_DEVICE_ID_LSI_FUSION) && |
2952 | (instance->pdev->device != PCI_DEVICE_ID_LSI_INVADER) && | 2989 | (instance->pdev->device != PCI_DEVICE_ID_LSI_INVADER) && |
2990 | (instance->pdev->device != PCI_DEVICE_ID_LSI_FURY) && | ||
2953 | (reset_devices)) | 2991 | (reset_devices)) |
2954 | cmd->frame->hdr.cmd = MFI_CMD_INVALID; | 2992 | cmd->frame->hdr.cmd = MFI_CMD_INVALID; |
2955 | } | 2993 | } |
@@ -3352,7 +3390,7 @@ megasas_issue_init_mfi(struct megasas_instance *instance) | |||
3352 | /* | 3390 | /* |
3353 | * disable the intr before firing the init frame to FW | 3391 | * disable the intr before firing the init frame to FW |
3354 | */ | 3392 | */ |
3355 | instance->instancet->disable_intr(instance->reg_set); | 3393 | instance->instancet->disable_intr(instance); |
3356 | 3394 | ||
3357 | /* | 3395 | /* |
3358 | * Issue the init frame in polled mode | 3396 | * Issue the init frame in polled mode |
@@ -3459,11 +3497,11 @@ static int megasas_init_fw(struct megasas_instance *instance) | |||
3459 | { | 3497 | { |
3460 | u32 max_sectors_1; | 3498 | u32 max_sectors_1; |
3461 | u32 max_sectors_2; | 3499 | u32 max_sectors_2; |
3462 | u32 tmp_sectors, msix_enable; | 3500 | u32 tmp_sectors, msix_enable, scratch_pad_2; |
3463 | struct megasas_register_set __iomem *reg_set; | 3501 | struct megasas_register_set __iomem *reg_set; |
3464 | struct megasas_ctrl_info *ctrl_info; | 3502 | struct megasas_ctrl_info *ctrl_info; |
3465 | unsigned long bar_list; | 3503 | unsigned long bar_list; |
3466 | int i; | 3504 | int i, loop, fw_msix_count = 0; |
3467 | 3505 | ||
3468 | /* Find first memory bar */ | 3506 | /* Find first memory bar */ |
3469 | bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM); | 3507 | bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM); |
@@ -3487,6 +3525,7 @@ static int megasas_init_fw(struct megasas_instance *instance) | |||
3487 | switch (instance->pdev->device) { | 3525 | switch (instance->pdev->device) { |
3488 | case PCI_DEVICE_ID_LSI_FUSION: | 3526 | case PCI_DEVICE_ID_LSI_FUSION: |
3489 | case PCI_DEVICE_ID_LSI_INVADER: | 3527 | case PCI_DEVICE_ID_LSI_INVADER: |
3528 | case PCI_DEVICE_ID_LSI_FURY: | ||
3490 | instance->instancet = &megasas_instance_template_fusion; | 3529 | instance->instancet = &megasas_instance_template_fusion; |
3491 | break; | 3530 | break; |
3492 | case PCI_DEVICE_ID_LSI_SAS1078R: | 3531 | case PCI_DEVICE_ID_LSI_SAS1078R: |
@@ -3514,20 +3553,49 @@ static int megasas_init_fw(struct megasas_instance *instance) | |||
3514 | if (megasas_transition_to_ready(instance, 0)) | 3553 | if (megasas_transition_to_ready(instance, 0)) |
3515 | goto fail_ready_state; | 3554 | goto fail_ready_state; |
3516 | 3555 | ||
3556 | /* | ||
3557 | * MSI-X host index 0 is common for all adapter. | ||
3558 | * It is used for all MPT based Adapters. | ||
3559 | */ | ||
3560 | instance->reply_post_host_index_addr[0] = | ||
3561 | (u32 *)((u8 *)instance->reg_set + | ||
3562 | MPI2_REPLY_POST_HOST_INDEX_OFFSET); | ||
3563 | |||
3517 | /* Check if MSI-X is supported while in ready state */ | 3564 | /* Check if MSI-X is supported while in ready state */ |
3518 | msix_enable = (instance->instancet->read_fw_status_reg(reg_set) & | 3565 | msix_enable = (instance->instancet->read_fw_status_reg(reg_set) & |
3519 | 0x4000000) >> 0x1a; | 3566 | 0x4000000) >> 0x1a; |
3520 | if (msix_enable && !msix_disable) { | 3567 | if (msix_enable && !msix_disable) { |
3568 | scratch_pad_2 = readl | ||
3569 | (&instance->reg_set->outbound_scratch_pad_2); | ||
3521 | /* Check max MSI-X vectors */ | 3570 | /* Check max MSI-X vectors */ |
3522 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) || | 3571 | if (instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) { |
3523 | (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER)) { | 3572 | instance->msix_vectors = (scratch_pad_2 |
3524 | instance->msix_vectors = (readl(&instance->reg_set-> | 3573 | & MR_MAX_REPLY_QUEUES_OFFSET) + 1; |
3525 | outbound_scratch_pad_2 | 3574 | fw_msix_count = instance->msix_vectors; |
3526 | ) & 0x1F) + 1; | ||
3527 | if (msix_vectors) | 3575 | if (msix_vectors) |
3528 | instance->msix_vectors = | 3576 | instance->msix_vectors = |
3529 | min(msix_vectors, | 3577 | min(msix_vectors, |
3530 | instance->msix_vectors); | 3578 | instance->msix_vectors); |
3579 | } else if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) | ||
3580 | || (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) { | ||
3581 | /* Invader/Fury supports more than 8 MSI-X */ | ||
3582 | instance->msix_vectors = ((scratch_pad_2 | ||
3583 | & MR_MAX_REPLY_QUEUES_EXT_OFFSET) | ||
3584 | >> MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT) + 1; | ||
3585 | fw_msix_count = instance->msix_vectors; | ||
3586 | /* Save 1-15 reply post index address to local memory | ||
3587 | * Index 0 is already saved from reg offset | ||
3588 | * MPI2_REPLY_POST_HOST_INDEX_OFFSET | ||
3589 | */ | ||
3590 | for (loop = 1; loop < MR_MAX_MSIX_REG_ARRAY; loop++) { | ||
3591 | instance->reply_post_host_index_addr[loop] = | ||
3592 | (u32 *)((u8 *)instance->reg_set + | ||
3593 | MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET | ||
3594 | + (loop * 0x10)); | ||
3595 | } | ||
3596 | if (msix_vectors) | ||
3597 | instance->msix_vectors = min(msix_vectors, | ||
3598 | instance->msix_vectors); | ||
3531 | } else | 3599 | } else |
3532 | instance->msix_vectors = 1; | 3600 | instance->msix_vectors = 1; |
3533 | /* Don't bother allocating more MSI-X vectors than cpus */ | 3601 | /* Don't bother allocating more MSI-X vectors than cpus */ |
@@ -3547,6 +3615,12 @@ static int megasas_init_fw(struct megasas_instance *instance) | |||
3547 | } | 3615 | } |
3548 | } else | 3616 | } else |
3549 | instance->msix_vectors = 0; | 3617 | instance->msix_vectors = 0; |
3618 | |||
3619 | dev_info(&instance->pdev->dev, "[scsi%d]: FW supports" | ||
3620 | "<%d> MSIX vector,Online CPUs: <%d>," | ||
3621 | "Current MSIX <%d>\n", instance->host->host_no, | ||
3622 | fw_msix_count, (unsigned int)num_online_cpus(), | ||
3623 | instance->msix_vectors); | ||
3550 | } | 3624 | } |
3551 | 3625 | ||
3552 | /* Get operational params, sge flags, send init cmd to controller */ | 3626 | /* Get operational params, sge flags, send init cmd to controller */ |
@@ -3585,8 +3659,32 @@ static int megasas_init_fw(struct megasas_instance *instance) | |||
3585 | max_sectors_2 = ctrl_info->max_request_size; | 3659 | max_sectors_2 = ctrl_info->max_request_size; |
3586 | 3660 | ||
3587 | tmp_sectors = min_t(u32, max_sectors_1 , max_sectors_2); | 3661 | tmp_sectors = min_t(u32, max_sectors_1 , max_sectors_2); |
3662 | |||
3663 | /*Check whether controller is iMR or MR */ | ||
3664 | if (ctrl_info->memory_size) { | ||
3665 | instance->is_imr = 0; | ||
3666 | dev_info(&instance->pdev->dev, "Controller type: MR," | ||
3667 | "Memory size is: %dMB\n", | ||
3668 | ctrl_info->memory_size); | ||
3669 | } else { | ||
3670 | instance->is_imr = 1; | ||
3671 | dev_info(&instance->pdev->dev, | ||
3672 | "Controller type: iMR\n"); | ||
3673 | } | ||
3588 | instance->disableOnlineCtrlReset = | 3674 | instance->disableOnlineCtrlReset = |
3589 | ctrl_info->properties.OnOffProperties.disableOnlineCtrlReset; | 3675 | ctrl_info->properties.OnOffProperties.disableOnlineCtrlReset; |
3676 | instance->UnevenSpanSupport = | ||
3677 | ctrl_info->adapterOperations2.supportUnevenSpans; | ||
3678 | if (instance->UnevenSpanSupport) { | ||
3679 | struct fusion_context *fusion = instance->ctrl_context; | ||
3680 | dev_info(&instance->pdev->dev, "FW supports: " | ||
3681 | "UnevenSpanSupport=%x\n", instance->UnevenSpanSupport); | ||
3682 | if (MR_ValidateMapInfo(instance)) | ||
3683 | fusion->fast_path_io = 1; | ||
3684 | else | ||
3685 | fusion->fast_path_io = 0; | ||
3686 | |||
3687 | } | ||
3590 | } | 3688 | } |
3591 | 3689 | ||
3592 | instance->max_sectors_per_req = instance->max_num_sge * | 3690 | instance->max_sectors_per_req = instance->max_num_sge * |
@@ -3597,8 +3695,7 @@ static int megasas_init_fw(struct megasas_instance *instance) | |||
3597 | kfree(ctrl_info); | 3695 | kfree(ctrl_info); |
3598 | 3696 | ||
3599 | /* Check for valid throttlequeuedepth module parameter */ | 3697 | /* Check for valid throttlequeuedepth module parameter */ |
3600 | if (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY || | 3698 | if (instance->is_imr) { |
3601 | instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY) { | ||
3602 | if (throttlequeuedepth > (instance->max_fw_cmds - | 3699 | if (throttlequeuedepth > (instance->max_fw_cmds - |
3603 | MEGASAS_SKINNY_INT_CMDS)) | 3700 | MEGASAS_SKINNY_INT_CMDS)) |
3604 | instance->throttlequeuedepth = | 3701 | instance->throttlequeuedepth = |
@@ -3882,8 +3979,7 @@ static int megasas_io_attach(struct megasas_instance *instance) | |||
3882 | */ | 3979 | */ |
3883 | host->irq = instance->pdev->irq; | 3980 | host->irq = instance->pdev->irq; |
3884 | host->unique_id = instance->unique_id; | 3981 | host->unique_id = instance->unique_id; |
3885 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) || | 3982 | if (instance->is_imr) { |
3886 | (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY)) { | ||
3887 | host->can_queue = | 3983 | host->can_queue = |
3888 | instance->max_fw_cmds - MEGASAS_SKINNY_INT_CMDS; | 3984 | instance->max_fw_cmds - MEGASAS_SKINNY_INT_CMDS; |
3889 | } else | 3985 | } else |
@@ -3925,7 +4021,8 @@ static int megasas_io_attach(struct megasas_instance *instance) | |||
3925 | 4021 | ||
3926 | /* Fusion only supports host reset */ | 4022 | /* Fusion only supports host reset */ |
3927 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) || | 4023 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) || |
3928 | (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER)) { | 4024 | (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || |
4025 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) { | ||
3929 | host->hostt->eh_device_reset_handler = NULL; | 4026 | host->hostt->eh_device_reset_handler = NULL; |
3930 | host->hostt->eh_bus_reset_handler = NULL; | 4027 | host->hostt->eh_bus_reset_handler = NULL; |
3931 | } | 4028 | } |
@@ -4036,6 +4133,7 @@ static int megasas_probe_one(struct pci_dev *pdev, | |||
4036 | switch (instance->pdev->device) { | 4133 | switch (instance->pdev->device) { |
4037 | case PCI_DEVICE_ID_LSI_FUSION: | 4134 | case PCI_DEVICE_ID_LSI_FUSION: |
4038 | case PCI_DEVICE_ID_LSI_INVADER: | 4135 | case PCI_DEVICE_ID_LSI_INVADER: |
4136 | case PCI_DEVICE_ID_LSI_FURY: | ||
4039 | { | 4137 | { |
4040 | struct fusion_context *fusion; | 4138 | struct fusion_context *fusion; |
4041 | 4139 | ||
@@ -4076,6 +4174,7 @@ static int megasas_probe_one(struct pci_dev *pdev, | |||
4076 | instance->ev = NULL; | 4174 | instance->ev = NULL; |
4077 | instance->issuepend_done = 1; | 4175 | instance->issuepend_done = 1; |
4078 | instance->adprecovery = MEGASAS_HBA_OPERATIONAL; | 4176 | instance->adprecovery = MEGASAS_HBA_OPERATIONAL; |
4177 | instance->is_imr = 0; | ||
4079 | megasas_poll_wait_aen = 0; | 4178 | megasas_poll_wait_aen = 0; |
4080 | 4179 | ||
4081 | instance->evt_detail = pci_alloc_consistent(pdev, | 4180 | instance->evt_detail = pci_alloc_consistent(pdev, |
@@ -4126,9 +4225,11 @@ static int megasas_probe_one(struct pci_dev *pdev, | |||
4126 | instance->unload = 1; | 4225 | instance->unload = 1; |
4127 | instance->last_time = 0; | 4226 | instance->last_time = 0; |
4128 | instance->disableOnlineCtrlReset = 1; | 4227 | instance->disableOnlineCtrlReset = 1; |
4228 | instance->UnevenSpanSupport = 0; | ||
4129 | 4229 | ||
4130 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) || | 4230 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) || |
4131 | (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER)) | 4231 | (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || |
4232 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) | ||
4132 | INIT_WORK(&instance->work_init, megasas_fusion_ocr_wq); | 4233 | INIT_WORK(&instance->work_init, megasas_fusion_ocr_wq); |
4133 | else | 4234 | else |
4134 | INIT_WORK(&instance->work_init, process_fw_state_change_wq); | 4235 | INIT_WORK(&instance->work_init, process_fw_state_change_wq); |
@@ -4139,6 +4240,7 @@ static int megasas_probe_one(struct pci_dev *pdev, | |||
4139 | if (megasas_init_fw(instance)) | 4240 | if (megasas_init_fw(instance)) |
4140 | goto fail_init_mfi; | 4241 | goto fail_init_mfi; |
4141 | 4242 | ||
4243 | retry_irq_register: | ||
4142 | /* | 4244 | /* |
4143 | * Register IRQ | 4245 | * Register IRQ |
4144 | */ | 4246 | */ |
@@ -4156,7 +4258,9 @@ static int megasas_probe_one(struct pci_dev *pdev, | |||
4156 | free_irq( | 4258 | free_irq( |
4157 | instance->msixentry[j].vector, | 4259 | instance->msixentry[j].vector, |
4158 | &instance->irq_context[j]); | 4260 | &instance->irq_context[j]); |
4159 | goto fail_irq; | 4261 | /* Retry irq register for IO_APIC */ |
4262 | instance->msix_vectors = 0; | ||
4263 | goto retry_irq_register; | ||
4160 | } | 4264 | } |
4161 | } | 4265 | } |
4162 | } else { | 4266 | } else { |
@@ -4170,7 +4274,7 @@ static int megasas_probe_one(struct pci_dev *pdev, | |||
4170 | } | 4274 | } |
4171 | } | 4275 | } |
4172 | 4276 | ||
4173 | instance->instancet->enable_intr(instance->reg_set); | 4277 | instance->instancet->enable_intr(instance); |
4174 | 4278 | ||
4175 | /* | 4279 | /* |
4176 | * Store instance in PCI softstate | 4280 | * Store instance in PCI softstate |
@@ -4210,7 +4314,7 @@ static int megasas_probe_one(struct pci_dev *pdev, | |||
4210 | megasas_mgmt_info.max_index--; | 4314 | megasas_mgmt_info.max_index--; |
4211 | 4315 | ||
4212 | pci_set_drvdata(pdev, NULL); | 4316 | pci_set_drvdata(pdev, NULL); |
4213 | instance->instancet->disable_intr(instance->reg_set); | 4317 | instance->instancet->disable_intr(instance); |
4214 | if (instance->msix_vectors) | 4318 | if (instance->msix_vectors) |
4215 | for (i = 0 ; i < instance->msix_vectors; i++) | 4319 | for (i = 0 ; i < instance->msix_vectors; i++) |
4216 | free_irq(instance->msixentry[i].vector, | 4320 | free_irq(instance->msixentry[i].vector, |
@@ -4219,7 +4323,8 @@ static int megasas_probe_one(struct pci_dev *pdev, | |||
4219 | free_irq(instance->pdev->irq, &instance->irq_context[0]); | 4323 | free_irq(instance->pdev->irq, &instance->irq_context[0]); |
4220 | fail_irq: | 4324 | fail_irq: |
4221 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) || | 4325 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) || |
4222 | (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER)) | 4326 | (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || |
4327 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) | ||
4223 | megasas_release_fusion(instance); | 4328 | megasas_release_fusion(instance); |
4224 | else | 4329 | else |
4225 | megasas_release_mfi(instance); | 4330 | megasas_release_mfi(instance); |
@@ -4359,7 +4464,7 @@ megasas_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4359 | tasklet_kill(&instance->isr_tasklet); | 4464 | tasklet_kill(&instance->isr_tasklet); |
4360 | 4465 | ||
4361 | pci_set_drvdata(instance->pdev, instance); | 4466 | pci_set_drvdata(instance->pdev, instance); |
4362 | instance->instancet->disable_intr(instance->reg_set); | 4467 | instance->instancet->disable_intr(instance); |
4363 | 4468 | ||
4364 | if (instance->msix_vectors) | 4469 | if (instance->msix_vectors) |
4365 | for (i = 0 ; i < instance->msix_vectors; i++) | 4470 | for (i = 0 ; i < instance->msix_vectors; i++) |
@@ -4430,6 +4535,7 @@ megasas_resume(struct pci_dev *pdev) | |||
4430 | switch (instance->pdev->device) { | 4535 | switch (instance->pdev->device) { |
4431 | case PCI_DEVICE_ID_LSI_FUSION: | 4536 | case PCI_DEVICE_ID_LSI_FUSION: |
4432 | case PCI_DEVICE_ID_LSI_INVADER: | 4537 | case PCI_DEVICE_ID_LSI_INVADER: |
4538 | case PCI_DEVICE_ID_LSI_FURY: | ||
4433 | { | 4539 | { |
4434 | megasas_reset_reply_desc(instance); | 4540 | megasas_reset_reply_desc(instance); |
4435 | if (megasas_ioc_init_fusion(instance)) { | 4541 | if (megasas_ioc_init_fusion(instance)) { |
@@ -4483,7 +4589,7 @@ megasas_resume(struct pci_dev *pdev) | |||
4483 | } | 4589 | } |
4484 | } | 4590 | } |
4485 | 4591 | ||
4486 | instance->instancet->enable_intr(instance->reg_set); | 4592 | instance->instancet->enable_intr(instance); |
4487 | instance->unload = 0; | 4593 | instance->unload = 0; |
4488 | 4594 | ||
4489 | /* | 4595 | /* |
@@ -4565,7 +4671,7 @@ static void megasas_detach_one(struct pci_dev *pdev) | |||
4565 | 4671 | ||
4566 | pci_set_drvdata(instance->pdev, NULL); | 4672 | pci_set_drvdata(instance->pdev, NULL); |
4567 | 4673 | ||
4568 | instance->instancet->disable_intr(instance->reg_set); | 4674 | instance->instancet->disable_intr(instance); |
4569 | 4675 | ||
4570 | if (instance->msix_vectors) | 4676 | if (instance->msix_vectors) |
4571 | for (i = 0 ; i < instance->msix_vectors; i++) | 4677 | for (i = 0 ; i < instance->msix_vectors; i++) |
@@ -4579,6 +4685,7 @@ static void megasas_detach_one(struct pci_dev *pdev) | |||
4579 | switch (instance->pdev->device) { | 4685 | switch (instance->pdev->device) { |
4580 | case PCI_DEVICE_ID_LSI_FUSION: | 4686 | case PCI_DEVICE_ID_LSI_FUSION: |
4581 | case PCI_DEVICE_ID_LSI_INVADER: | 4687 | case PCI_DEVICE_ID_LSI_INVADER: |
4688 | case PCI_DEVICE_ID_LSI_FURY: | ||
4582 | megasas_release_fusion(instance); | 4689 | megasas_release_fusion(instance); |
4583 | for (i = 0; i < 2 ; i++) | 4690 | for (i = 0; i < 2 ; i++) |
4584 | if (fusion->ld_map[i]) | 4691 | if (fusion->ld_map[i]) |
@@ -4591,10 +4698,6 @@ static void megasas_detach_one(struct pci_dev *pdev) | |||
4591 | break; | 4698 | break; |
4592 | default: | 4699 | default: |
4593 | megasas_release_mfi(instance); | 4700 | megasas_release_mfi(instance); |
4594 | pci_free_consistent(pdev, | ||
4595 | sizeof(struct megasas_evt_detail), | ||
4596 | instance->evt_detail, | ||
4597 | instance->evt_detail_h); | ||
4598 | pci_free_consistent(pdev, sizeof(u32), | 4701 | pci_free_consistent(pdev, sizeof(u32), |
4599 | instance->producer, | 4702 | instance->producer, |
4600 | instance->producer_h); | 4703 | instance->producer_h); |
@@ -4604,6 +4707,9 @@ static void megasas_detach_one(struct pci_dev *pdev) | |||
4604 | break; | 4707 | break; |
4605 | } | 4708 | } |
4606 | 4709 | ||
4710 | if (instance->evt_detail) | ||
4711 | pci_free_consistent(pdev, sizeof(struct megasas_evt_detail), | ||
4712 | instance->evt_detail, instance->evt_detail_h); | ||
4607 | scsi_host_put(host); | 4713 | scsi_host_put(host); |
4608 | 4714 | ||
4609 | pci_set_drvdata(pdev, NULL); | 4715 | pci_set_drvdata(pdev, NULL); |
@@ -4625,7 +4731,7 @@ static void megasas_shutdown(struct pci_dev *pdev) | |||
4625 | instance->unload = 1; | 4731 | instance->unload = 1; |
4626 | megasas_flush_cache(instance); | 4732 | megasas_flush_cache(instance); |
4627 | megasas_shutdown_controller(instance, MR_DCMD_CTRL_SHUTDOWN); | 4733 | megasas_shutdown_controller(instance, MR_DCMD_CTRL_SHUTDOWN); |
4628 | instance->instancet->disable_intr(instance->reg_set); | 4734 | instance->instancet->disable_intr(instance); |
4629 | if (instance->msix_vectors) | 4735 | if (instance->msix_vectors) |
4630 | for (i = 0 ; i < instance->msix_vectors; i++) | 4736 | for (i = 0 ; i < instance->msix_vectors; i++) |
4631 | free_irq(instance->msixentry[i].vector, | 4737 | free_irq(instance->msixentry[i].vector, |
diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c index a11df82474ef..8056eacba758 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fp.c +++ b/drivers/scsi/megaraid/megaraid_sas_fp.c | |||
@@ -60,10 +60,22 @@ | |||
60 | #define FALSE 0 | 60 | #define FALSE 0 |
61 | #define TRUE 1 | 61 | #define TRUE 1 |
62 | 62 | ||
63 | #define SPAN_DEBUG 0 | ||
64 | #define SPAN_ROW_SIZE(map, ld, index_) (MR_LdSpanPtrGet(ld, index_, map)->spanRowSize) | ||
65 | #define SPAN_ROW_DATA_SIZE(map_, ld, index_) (MR_LdSpanPtrGet(ld, index_, map)->spanRowDataSize) | ||
66 | #define SPAN_INVALID 0xff | ||
67 | |||
63 | /* Prototypes */ | 68 | /* Prototypes */ |
64 | void | 69 | void mr_update_load_balance_params(struct MR_FW_RAID_MAP_ALL *map, |
65 | mr_update_load_balance_params(struct MR_FW_RAID_MAP_ALL *map, | 70 | struct LD_LOAD_BALANCE_INFO *lbInfo); |
66 | struct LD_LOAD_BALANCE_INFO *lbInfo); | 71 | |
72 | static void mr_update_span_set(struct MR_FW_RAID_MAP_ALL *map, | ||
73 | PLD_SPAN_INFO ldSpanInfo); | ||
74 | static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld, | ||
75 | u64 stripRow, u16 stripRef, struct IO_REQUEST_INFO *io_info, | ||
76 | struct RAID_CONTEXT *pRAID_Context, struct MR_FW_RAID_MAP_ALL *map); | ||
77 | static u64 get_row_from_strip(struct megasas_instance *instance, u32 ld, | ||
78 | u64 strip, struct MR_FW_RAID_MAP_ALL *map); | ||
67 | 79 | ||
68 | u32 mega_mod64(u64 dividend, u32 divisor) | 80 | u32 mega_mod64(u64 dividend, u32 divisor) |
69 | { | 81 | { |
@@ -148,9 +160,12 @@ static struct MR_LD_SPAN *MR_LdSpanPtrGet(u32 ld, u32 span, | |||
148 | /* | 160 | /* |
149 | * This function will validate Map info data provided by FW | 161 | * This function will validate Map info data provided by FW |
150 | */ | 162 | */ |
151 | u8 MR_ValidateMapInfo(struct MR_FW_RAID_MAP_ALL *map, | 163 | u8 MR_ValidateMapInfo(struct megasas_instance *instance) |
152 | struct LD_LOAD_BALANCE_INFO *lbInfo) | ||
153 | { | 164 | { |
165 | struct fusion_context *fusion = instance->ctrl_context; | ||
166 | struct MR_FW_RAID_MAP_ALL *map = fusion->ld_map[(instance->map_id & 1)]; | ||
167 | struct LD_LOAD_BALANCE_INFO *lbInfo = fusion->load_balance_info; | ||
168 | PLD_SPAN_INFO ldSpanInfo = fusion->log_to_span; | ||
154 | struct MR_FW_RAID_MAP *pFwRaidMap = &map->raidMap; | 169 | struct MR_FW_RAID_MAP *pFwRaidMap = &map->raidMap; |
155 | 170 | ||
156 | if (pFwRaidMap->totalSize != | 171 | if (pFwRaidMap->totalSize != |
@@ -167,13 +182,16 @@ u8 MR_ValidateMapInfo(struct MR_FW_RAID_MAP_ALL *map, | |||
167 | return 0; | 182 | return 0; |
168 | } | 183 | } |
169 | 184 | ||
185 | if (instance->UnevenSpanSupport) | ||
186 | mr_update_span_set(map, ldSpanInfo); | ||
187 | |||
170 | mr_update_load_balance_params(map, lbInfo); | 188 | mr_update_load_balance_params(map, lbInfo); |
171 | 189 | ||
172 | return 1; | 190 | return 1; |
173 | } | 191 | } |
174 | 192 | ||
175 | u32 MR_GetSpanBlock(u32 ld, u64 row, u64 *span_blk, | 193 | u32 MR_GetSpanBlock(u32 ld, u64 row, u64 *span_blk, |
176 | struct MR_FW_RAID_MAP_ALL *map, int *div_error) | 194 | struct MR_FW_RAID_MAP_ALL *map) |
177 | { | 195 | { |
178 | struct MR_SPAN_BLOCK_INFO *pSpanBlock = MR_LdSpanInfoGet(ld, map); | 196 | struct MR_SPAN_BLOCK_INFO *pSpanBlock = MR_LdSpanInfoGet(ld, map); |
179 | struct MR_QUAD_ELEMENT *quad; | 197 | struct MR_QUAD_ELEMENT *quad; |
@@ -185,10 +203,8 @@ u32 MR_GetSpanBlock(u32 ld, u64 row, u64 *span_blk, | |||
185 | for (j = 0; j < pSpanBlock->block_span_info.noElements; j++) { | 203 | for (j = 0; j < pSpanBlock->block_span_info.noElements; j++) { |
186 | quad = &pSpanBlock->block_span_info.quad[j]; | 204 | quad = &pSpanBlock->block_span_info.quad[j]; |
187 | 205 | ||
188 | if (quad->diff == 0) { | 206 | if (quad->diff == 0) |
189 | *div_error = 1; | 207 | return SPAN_INVALID; |
190 | return span; | ||
191 | } | ||
192 | if (quad->logStart <= row && row <= quad->logEnd && | 208 | if (quad->logStart <= row && row <= quad->logEnd && |
193 | (mega_mod64(row-quad->logStart, quad->diff)) == 0) { | 209 | (mega_mod64(row-quad->logStart, quad->diff)) == 0) { |
194 | if (span_blk != NULL) { | 210 | if (span_blk != NULL) { |
@@ -207,7 +223,456 @@ u32 MR_GetSpanBlock(u32 ld, u64 row, u64 *span_blk, | |||
207 | } | 223 | } |
208 | } | 224 | } |
209 | } | 225 | } |
210 | return span; | 226 | return SPAN_INVALID; |
227 | } | ||
228 | |||
229 | /* | ||
230 | ****************************************************************************** | ||
231 | * | ||
232 | * Function to print info about span set created in driver from FW raid map | ||
233 | * | ||
234 | * Inputs : | ||
235 | * map - LD map | ||
236 | * ldSpanInfo - ldSpanInfo per HBA instance | ||
237 | */ | ||
238 | #if SPAN_DEBUG | ||
239 | static int getSpanInfo(struct MR_FW_RAID_MAP_ALL *map, PLD_SPAN_INFO ldSpanInfo) | ||
240 | { | ||
241 | |||
242 | u8 span; | ||
243 | u32 element; | ||
244 | struct MR_LD_RAID *raid; | ||
245 | LD_SPAN_SET *span_set; | ||
246 | struct MR_QUAD_ELEMENT *quad; | ||
247 | int ldCount; | ||
248 | u16 ld; | ||
249 | |||
250 | for (ldCount = 0; ldCount < MAX_LOGICAL_DRIVES; ldCount++) { | ||
251 | ld = MR_TargetIdToLdGet(ldCount, map); | ||
252 | if (ld >= MAX_LOGICAL_DRIVES) | ||
253 | continue; | ||
254 | raid = MR_LdRaidGet(ld, map); | ||
255 | dev_dbg(&instance->pdev->dev, "LD %x: span_depth=%x\n", | ||
256 | ld, raid->spanDepth); | ||
257 | for (span = 0; span < raid->spanDepth; span++) | ||
258 | dev_dbg(&instance->pdev->dev, "Span=%x," | ||
259 | " number of quads=%x\n", span, | ||
260 | map->raidMap.ldSpanMap[ld].spanBlock[span]. | ||
261 | block_span_info.noElements); | ||
262 | for (element = 0; element < MAX_QUAD_DEPTH; element++) { | ||
263 | span_set = &(ldSpanInfo[ld].span_set[element]); | ||
264 | if (span_set->span_row_data_width == 0) | ||
265 | break; | ||
266 | |||
267 | dev_dbg(&instance->pdev->dev, "Span Set %x:" | ||
268 | "width=%x, diff=%x\n", element, | ||
269 | (unsigned int)span_set->span_row_data_width, | ||
270 | (unsigned int)span_set->diff); | ||
271 | dev_dbg(&instance->pdev->dev, "logical LBA" | ||
272 | "start=0x%08lx, end=0x%08lx\n", | ||
273 | (long unsigned int)span_set->log_start_lba, | ||
274 | (long unsigned int)span_set->log_end_lba); | ||
275 | dev_dbg(&instance->pdev->dev, "span row start=0x%08lx," | ||
276 | " end=0x%08lx\n", | ||
277 | (long unsigned int)span_set->span_row_start, | ||
278 | (long unsigned int)span_set->span_row_end); | ||
279 | dev_dbg(&instance->pdev->dev, "data row start=0x%08lx," | ||
280 | " end=0x%08lx\n", | ||
281 | (long unsigned int)span_set->data_row_start, | ||
282 | (long unsigned int)span_set->data_row_end); | ||
283 | dev_dbg(&instance->pdev->dev, "data strip start=0x%08lx," | ||
284 | " end=0x%08lx\n", | ||
285 | (long unsigned int)span_set->data_strip_start, | ||
286 | (long unsigned int)span_set->data_strip_end); | ||
287 | |||
288 | for (span = 0; span < raid->spanDepth; span++) { | ||
289 | if (map->raidMap.ldSpanMap[ld].spanBlock[span]. | ||
290 | block_span_info.noElements >= | ||
291 | element + 1) { | ||
292 | quad = &map->raidMap.ldSpanMap[ld]. | ||
293 | spanBlock[span].block_span_info. | ||
294 | quad[element]; | ||
295 | dev_dbg(&instance->pdev->dev, "Span=%x," | ||
296 | "Quad=%x, diff=%x\n", span, | ||
297 | element, quad->diff); | ||
298 | dev_dbg(&instance->pdev->dev, | ||
299 | "offset_in_span=0x%08lx\n", | ||
300 | (long unsigned int)quad->offsetInSpan); | ||
301 | dev_dbg(&instance->pdev->dev, | ||
302 | "logical start=0x%08lx, end=0x%08lx\n", | ||
303 | (long unsigned int)quad->logStart, | ||
304 | (long unsigned int)quad->logEnd); | ||
305 | } | ||
306 | } | ||
307 | } | ||
308 | } | ||
309 | return 0; | ||
310 | } | ||
311 | #endif | ||
312 | |||
313 | /* | ||
314 | ****************************************************************************** | ||
315 | * | ||
316 | * This routine calculates the Span block for given row using spanset. | ||
317 | * | ||
318 | * Inputs : | ||
319 | * instance - HBA instance | ||
320 | * ld - Logical drive number | ||
321 | * row - Row number | ||
322 | * map - LD map | ||
323 | * | ||
324 | * Outputs : | ||
325 | * | ||
326 | * span - Span number | ||
327 | * block - Absolute Block number in the physical disk | ||
328 | * div_error - Devide error code. | ||
329 | */ | ||
330 | |||
331 | u32 mr_spanset_get_span_block(struct megasas_instance *instance, | ||
332 | u32 ld, u64 row, u64 *span_blk, struct MR_FW_RAID_MAP_ALL *map) | ||
333 | { | ||
334 | struct fusion_context *fusion = instance->ctrl_context; | ||
335 | struct MR_LD_RAID *raid = MR_LdRaidGet(ld, map); | ||
336 | LD_SPAN_SET *span_set; | ||
337 | struct MR_QUAD_ELEMENT *quad; | ||
338 | u32 span, info; | ||
339 | PLD_SPAN_INFO ldSpanInfo = fusion->log_to_span; | ||
340 | |||
341 | for (info = 0; info < MAX_QUAD_DEPTH; info++) { | ||
342 | span_set = &(ldSpanInfo[ld].span_set[info]); | ||
343 | |||
344 | if (span_set->span_row_data_width == 0) | ||
345 | break; | ||
346 | |||
347 | if (row > span_set->data_row_end) | ||
348 | continue; | ||
349 | |||
350 | for (span = 0; span < raid->spanDepth; span++) | ||
351 | if (map->raidMap.ldSpanMap[ld].spanBlock[span]. | ||
352 | block_span_info.noElements >= info+1) { | ||
353 | quad = &map->raidMap.ldSpanMap[ld]. | ||
354 | spanBlock[span]. | ||
355 | block_span_info.quad[info]; | ||
356 | if (quad->diff == 0) | ||
357 | return SPAN_INVALID; | ||
358 | if (quad->logStart <= row && | ||
359 | row <= quad->logEnd && | ||
360 | (mega_mod64(row - quad->logStart, | ||
361 | quad->diff)) == 0) { | ||
362 | if (span_blk != NULL) { | ||
363 | u64 blk; | ||
364 | blk = mega_div64_32 | ||
365 | ((row - quad->logStart), | ||
366 | quad->diff); | ||
367 | blk = (blk + quad->offsetInSpan) | ||
368 | << raid->stripeShift; | ||
369 | *span_blk = blk; | ||
370 | } | ||
371 | return span; | ||
372 | } | ||
373 | } | ||
374 | } | ||
375 | return SPAN_INVALID; | ||
376 | } | ||
377 | |||
378 | /* | ||
379 | ****************************************************************************** | ||
380 | * | ||
381 | * This routine calculates the row for given strip using spanset. | ||
382 | * | ||
383 | * Inputs : | ||
384 | * instance - HBA instance | ||
385 | * ld - Logical drive number | ||
386 | * Strip - Strip | ||
387 | * map - LD map | ||
388 | * | ||
389 | * Outputs : | ||
390 | * | ||
391 | * row - row associated with strip | ||
392 | */ | ||
393 | |||
394 | static u64 get_row_from_strip(struct megasas_instance *instance, | ||
395 | u32 ld, u64 strip, struct MR_FW_RAID_MAP_ALL *map) | ||
396 | { | ||
397 | struct fusion_context *fusion = instance->ctrl_context; | ||
398 | struct MR_LD_RAID *raid = MR_LdRaidGet(ld, map); | ||
399 | LD_SPAN_SET *span_set; | ||
400 | PLD_SPAN_INFO ldSpanInfo = fusion->log_to_span; | ||
401 | u32 info, strip_offset, span, span_offset; | ||
402 | u64 span_set_Strip, span_set_Row, retval; | ||
403 | |||
404 | for (info = 0; info < MAX_QUAD_DEPTH; info++) { | ||
405 | span_set = &(ldSpanInfo[ld].span_set[info]); | ||
406 | |||
407 | if (span_set->span_row_data_width == 0) | ||
408 | break; | ||
409 | if (strip > span_set->data_strip_end) | ||
410 | continue; | ||
411 | |||
412 | span_set_Strip = strip - span_set->data_strip_start; | ||
413 | strip_offset = mega_mod64(span_set_Strip, | ||
414 | span_set->span_row_data_width); | ||
415 | span_set_Row = mega_div64_32(span_set_Strip, | ||
416 | span_set->span_row_data_width) * span_set->diff; | ||
417 | for (span = 0, span_offset = 0; span < raid->spanDepth; span++) | ||
418 | if (map->raidMap.ldSpanMap[ld].spanBlock[span]. | ||
419 | block_span_info.noElements >= info+1) { | ||
420 | if (strip_offset >= | ||
421 | span_set->strip_offset[span]) | ||
422 | span_offset++; | ||
423 | else | ||
424 | break; | ||
425 | } | ||
426 | #if SPAN_DEBUG | ||
427 | dev_info(&instance->pdev->dev, "Strip 0x%llx," | ||
428 | "span_set_Strip 0x%llx, span_set_Row 0x%llx" | ||
429 | "data width 0x%llx span offset 0x%x\n", strip, | ||
430 | (unsigned long long)span_set_Strip, | ||
431 | (unsigned long long)span_set_Row, | ||
432 | (unsigned long long)span_set->span_row_data_width, | ||
433 | span_offset); | ||
434 | dev_info(&instance->pdev->dev, "For strip 0x%llx" | ||
435 | "row is 0x%llx\n", strip, | ||
436 | (unsigned long long) span_set->data_row_start + | ||
437 | (unsigned long long) span_set_Row + (span_offset - 1)); | ||
438 | #endif | ||
439 | retval = (span_set->data_row_start + span_set_Row + | ||
440 | (span_offset - 1)); | ||
441 | return retval; | ||
442 | } | ||
443 | return -1LLU; | ||
444 | } | ||
445 | |||
446 | |||
447 | /* | ||
448 | ****************************************************************************** | ||
449 | * | ||
450 | * This routine calculates the Start Strip for given row using spanset. | ||
451 | * | ||
452 | * Inputs : | ||
453 | * instance - HBA instance | ||
454 | * ld - Logical drive number | ||
455 | * row - Row number | ||
456 | * map - LD map | ||
457 | * | ||
458 | * Outputs : | ||
459 | * | ||
460 | * Strip - Start strip associated with row | ||
461 | */ | ||
462 | |||
463 | static u64 get_strip_from_row(struct megasas_instance *instance, | ||
464 | u32 ld, u64 row, struct MR_FW_RAID_MAP_ALL *map) | ||
465 | { | ||
466 | struct fusion_context *fusion = instance->ctrl_context; | ||
467 | struct MR_LD_RAID *raid = MR_LdRaidGet(ld, map); | ||
468 | LD_SPAN_SET *span_set; | ||
469 | struct MR_QUAD_ELEMENT *quad; | ||
470 | PLD_SPAN_INFO ldSpanInfo = fusion->log_to_span; | ||
471 | u32 span, info; | ||
472 | u64 strip; | ||
473 | |||
474 | for (info = 0; info < MAX_QUAD_DEPTH; info++) { | ||
475 | span_set = &(ldSpanInfo[ld].span_set[info]); | ||
476 | |||
477 | if (span_set->span_row_data_width == 0) | ||
478 | break; | ||
479 | if (row > span_set->data_row_end) | ||
480 | continue; | ||
481 | |||
482 | for (span = 0; span < raid->spanDepth; span++) | ||
483 | if (map->raidMap.ldSpanMap[ld].spanBlock[span]. | ||
484 | block_span_info.noElements >= info+1) { | ||
485 | quad = &map->raidMap.ldSpanMap[ld]. | ||
486 | spanBlock[span].block_span_info.quad[info]; | ||
487 | if (quad->logStart <= row && | ||
488 | row <= quad->logEnd && | ||
489 | mega_mod64((row - quad->logStart), | ||
490 | quad->diff) == 0) { | ||
491 | strip = mega_div64_32 | ||
492 | (((row - span_set->data_row_start) | ||
493 | - quad->logStart), | ||
494 | quad->diff); | ||
495 | strip *= span_set->span_row_data_width; | ||
496 | strip += span_set->data_strip_start; | ||
497 | strip += span_set->strip_offset[span]; | ||
498 | return strip; | ||
499 | } | ||
500 | } | ||
501 | } | ||
502 | dev_err(&instance->pdev->dev, "get_strip_from_row" | ||
503 | "returns invalid strip for ld=%x, row=%lx\n", | ||
504 | ld, (long unsigned int)row); | ||
505 | return -1; | ||
506 | } | ||
507 | |||
508 | /* | ||
509 | ****************************************************************************** | ||
510 | * | ||
511 | * This routine calculates the Physical Arm for given strip using spanset. | ||
512 | * | ||
513 | * Inputs : | ||
514 | * instance - HBA instance | ||
515 | * ld - Logical drive number | ||
516 | * strip - Strip | ||
517 | * map - LD map | ||
518 | * | ||
519 | * Outputs : | ||
520 | * | ||
521 | * Phys Arm - Phys Arm associated with strip | ||
522 | */ | ||
523 | |||
524 | static u32 get_arm_from_strip(struct megasas_instance *instance, | ||
525 | u32 ld, u64 strip, struct MR_FW_RAID_MAP_ALL *map) | ||
526 | { | ||
527 | struct fusion_context *fusion = instance->ctrl_context; | ||
528 | struct MR_LD_RAID *raid = MR_LdRaidGet(ld, map); | ||
529 | LD_SPAN_SET *span_set; | ||
530 | PLD_SPAN_INFO ldSpanInfo = fusion->log_to_span; | ||
531 | u32 info, strip_offset, span, span_offset, retval; | ||
532 | |||
533 | for (info = 0 ; info < MAX_QUAD_DEPTH; info++) { | ||
534 | span_set = &(ldSpanInfo[ld].span_set[info]); | ||
535 | |||
536 | if (span_set->span_row_data_width == 0) | ||
537 | break; | ||
538 | if (strip > span_set->data_strip_end) | ||
539 | continue; | ||
540 | |||
541 | strip_offset = (uint)mega_mod64 | ||
542 | ((strip - span_set->data_strip_start), | ||
543 | span_set->span_row_data_width); | ||
544 | |||
545 | for (span = 0, span_offset = 0; span < raid->spanDepth; span++) | ||
546 | if (map->raidMap.ldSpanMap[ld].spanBlock[span]. | ||
547 | block_span_info.noElements >= info+1) { | ||
548 | if (strip_offset >= | ||
549 | span_set->strip_offset[span]) | ||
550 | span_offset = | ||
551 | span_set->strip_offset[span]; | ||
552 | else | ||
553 | break; | ||
554 | } | ||
555 | #if SPAN_DEBUG | ||
556 | dev_info(&instance->pdev->dev, "get_arm_from_strip:" | ||
557 | "for ld=0x%x strip=0x%lx arm is 0x%x\n", ld, | ||
558 | (long unsigned int)strip, (strip_offset - span_offset)); | ||
559 | #endif | ||
560 | retval = (strip_offset - span_offset); | ||
561 | return retval; | ||
562 | } | ||
563 | |||
564 | dev_err(&instance->pdev->dev, "get_arm_from_strip" | ||
565 | "returns invalid arm for ld=%x strip=%lx\n", | ||
566 | ld, (long unsigned int)strip); | ||
567 | |||
568 | return -1; | ||
569 | } | ||
570 | |||
571 | /* This Function will return Phys arm */ | ||
572 | u8 get_arm(struct megasas_instance *instance, u32 ld, u8 span, u64 stripe, | ||
573 | struct MR_FW_RAID_MAP_ALL *map) | ||
574 | { | ||
575 | struct MR_LD_RAID *raid = MR_LdRaidGet(ld, map); | ||
576 | /* Need to check correct default value */ | ||
577 | u32 arm = 0; | ||
578 | |||
579 | switch (raid->level) { | ||
580 | case 0: | ||
581 | case 5: | ||
582 | case 6: | ||
583 | arm = mega_mod64(stripe, SPAN_ROW_SIZE(map, ld, span)); | ||
584 | break; | ||
585 | case 1: | ||
586 | /* start with logical arm */ | ||
587 | arm = get_arm_from_strip(instance, ld, stripe, map); | ||
588 | if (arm != -1UL) | ||
589 | arm *= 2; | ||
590 | break; | ||
591 | } | ||
592 | |||
593 | return arm; | ||
594 | } | ||
595 | |||
596 | |||
597 | /* | ||
598 | ****************************************************************************** | ||
599 | * | ||
600 | * This routine calculates the arm, span and block for the specified stripe and | ||
601 | * reference in stripe using spanset | ||
602 | * | ||
603 | * Inputs : | ||
604 | * | ||
605 | * ld - Logical drive number | ||
606 | * stripRow - Stripe number | ||
607 | * stripRef - Reference in stripe | ||
608 | * | ||
609 | * Outputs : | ||
610 | * | ||
611 | * span - Span number | ||
612 | * block - Absolute Block number in the physical disk | ||
613 | */ | ||
614 | static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld, | ||
615 | u64 stripRow, u16 stripRef, struct IO_REQUEST_INFO *io_info, | ||
616 | struct RAID_CONTEXT *pRAID_Context, | ||
617 | struct MR_FW_RAID_MAP_ALL *map) | ||
618 | { | ||
619 | struct MR_LD_RAID *raid = MR_LdRaidGet(ld, map); | ||
620 | u32 pd, arRef; | ||
621 | u8 physArm, span; | ||
622 | u64 row; | ||
623 | u8 retval = TRUE; | ||
624 | u8 do_invader = 0; | ||
625 | u64 *pdBlock = &io_info->pdBlock; | ||
626 | u16 *pDevHandle = &io_info->devHandle; | ||
627 | u32 logArm, rowMod, armQ, arm; | ||
628 | |||
629 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER || | ||
630 | instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) | ||
631 | do_invader = 1; | ||
632 | |||
633 | /*Get row and span from io_info for Uneven Span IO.*/ | ||
634 | row = io_info->start_row; | ||
635 | span = io_info->start_span; | ||
636 | |||
637 | |||
638 | if (raid->level == 6) { | ||
639 | logArm = get_arm_from_strip(instance, ld, stripRow, map); | ||
640 | if (logArm == -1UL) | ||
641 | return FALSE; | ||
642 | rowMod = mega_mod64(row, SPAN_ROW_SIZE(map, ld, span)); | ||
643 | armQ = SPAN_ROW_SIZE(map, ld, span) - 1 - rowMod; | ||
644 | arm = armQ + 1 + logArm; | ||
645 | if (arm >= SPAN_ROW_SIZE(map, ld, span)) | ||
646 | arm -= SPAN_ROW_SIZE(map, ld, span); | ||
647 | physArm = (u8)arm; | ||
648 | } else | ||
649 | /* Calculate the arm */ | ||
650 | physArm = get_arm(instance, ld, span, stripRow, map); | ||
651 | if (physArm == 0xFF) | ||
652 | return FALSE; | ||
653 | |||
654 | arRef = MR_LdSpanArrayGet(ld, span, map); | ||
655 | pd = MR_ArPdGet(arRef, physArm, map); | ||
656 | |||
657 | if (pd != MR_PD_INVALID) | ||
658 | *pDevHandle = MR_PdDevHandleGet(pd, map); | ||
659 | else { | ||
660 | *pDevHandle = MR_PD_INVALID; | ||
661 | if ((raid->level >= 5) && | ||
662 | (!do_invader || (do_invader && | ||
663 | (raid->regTypeReqOnRead != REGION_TYPE_UNUSED)))) | ||
664 | pRAID_Context->regLockFlags = REGION_TYPE_EXCLUSIVE; | ||
665 | else if (raid->level == 1) { | ||
666 | pd = MR_ArPdGet(arRef, physArm + 1, map); | ||
667 | if (pd != MR_PD_INVALID) | ||
668 | *pDevHandle = MR_PdDevHandleGet(pd, map); | ||
669 | } | ||
670 | } | ||
671 | |||
672 | *pdBlock += stripRef + MR_LdSpanPtrGet(ld, span, map)->startBlk; | ||
673 | pRAID_Context->spanArm = (span << RAID_CTX_SPANARM_SPAN_SHIFT) | | ||
674 | physArm; | ||
675 | return retval; | ||
211 | } | 676 | } |
212 | 677 | ||
213 | /* | 678 | /* |
@@ -228,16 +693,22 @@ u32 MR_GetSpanBlock(u32 ld, u64 row, u64 *span_blk, | |||
228 | * block - Absolute Block number in the physical disk | 693 | * block - Absolute Block number in the physical disk |
229 | */ | 694 | */ |
230 | u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow, | 695 | u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow, |
231 | u16 stripRef, u64 *pdBlock, u16 *pDevHandle, | 696 | u16 stripRef, struct IO_REQUEST_INFO *io_info, |
232 | struct RAID_CONTEXT *pRAID_Context, | 697 | struct RAID_CONTEXT *pRAID_Context, |
233 | struct MR_FW_RAID_MAP_ALL *map) | 698 | struct MR_FW_RAID_MAP_ALL *map) |
234 | { | 699 | { |
235 | struct MR_LD_RAID *raid = MR_LdRaidGet(ld, map); | 700 | struct MR_LD_RAID *raid = MR_LdRaidGet(ld, map); |
236 | u32 pd, arRef; | 701 | u32 pd, arRef; |
237 | u8 physArm, span; | 702 | u8 physArm, span; |
238 | u64 row; | 703 | u64 row; |
239 | u8 retval = TRUE; | 704 | u8 retval = TRUE; |
240 | int error_code = 0; | 705 | u8 do_invader = 0; |
706 | u64 *pdBlock = &io_info->pdBlock; | ||
707 | u16 *pDevHandle = &io_info->devHandle; | ||
708 | |||
709 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER || | ||
710 | instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) | ||
711 | do_invader = 1; | ||
241 | 712 | ||
242 | row = mega_div64_32(stripRow, raid->rowDataSize); | 713 | row = mega_div64_32(stripRow, raid->rowDataSize); |
243 | 714 | ||
@@ -267,8 +738,8 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow, | |||
267 | span = 0; | 738 | span = 0; |
268 | *pdBlock = row << raid->stripeShift; | 739 | *pdBlock = row << raid->stripeShift; |
269 | } else { | 740 | } else { |
270 | span = (u8)MR_GetSpanBlock(ld, row, pdBlock, map, &error_code); | 741 | span = (u8)MR_GetSpanBlock(ld, row, pdBlock, map); |
271 | if (error_code == 1) | 742 | if (span == SPAN_INVALID) |
272 | return FALSE; | 743 | return FALSE; |
273 | } | 744 | } |
274 | 745 | ||
@@ -282,9 +753,8 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow, | |||
282 | else { | 753 | else { |
283 | *pDevHandle = MR_PD_INVALID; /* set dev handle as invalid. */ | 754 | *pDevHandle = MR_PD_INVALID; /* set dev handle as invalid. */ |
284 | if ((raid->level >= 5) && | 755 | if ((raid->level >= 5) && |
285 | ((instance->pdev->device != PCI_DEVICE_ID_LSI_INVADER) || | 756 | (!do_invader || (do_invader && |
286 | (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER && | 757 | (raid->regTypeReqOnRead != REGION_TYPE_UNUSED)))) |
287 | raid->regTypeReqOnRead != REGION_TYPE_UNUSED))) | ||
288 | pRAID_Context->regLockFlags = REGION_TYPE_EXCLUSIVE; | 758 | pRAID_Context->regLockFlags = REGION_TYPE_EXCLUSIVE; |
289 | else if (raid->level == 1) { | 759 | else if (raid->level == 1) { |
290 | /* Get alternate Pd. */ | 760 | /* Get alternate Pd. */ |
@@ -327,17 +797,42 @@ MR_BuildRaidContext(struct megasas_instance *instance, | |||
327 | u32 numBlocks, ldTgtId; | 797 | u32 numBlocks, ldTgtId; |
328 | u8 isRead; | 798 | u8 isRead; |
329 | u8 retval = 0; | 799 | u8 retval = 0; |
800 | u8 startlba_span = SPAN_INVALID; | ||
801 | u64 *pdBlock = &io_info->pdBlock; | ||
330 | 802 | ||
331 | ldStartBlock = io_info->ldStartBlock; | 803 | ldStartBlock = io_info->ldStartBlock; |
332 | numBlocks = io_info->numBlocks; | 804 | numBlocks = io_info->numBlocks; |
333 | ldTgtId = io_info->ldTgtId; | 805 | ldTgtId = io_info->ldTgtId; |
334 | isRead = io_info->isRead; | 806 | isRead = io_info->isRead; |
807 | io_info->IoforUnevenSpan = 0; | ||
808 | io_info->start_span = SPAN_INVALID; | ||
335 | 809 | ||
336 | ld = MR_TargetIdToLdGet(ldTgtId, map); | 810 | ld = MR_TargetIdToLdGet(ldTgtId, map); |
337 | raid = MR_LdRaidGet(ld, map); | 811 | raid = MR_LdRaidGet(ld, map); |
338 | 812 | ||
813 | /* | ||
814 | * if rowDataSize @RAID map and spanRowDataSize @SPAN INFO are zero | ||
815 | * return FALSE | ||
816 | */ | ||
817 | if (raid->rowDataSize == 0) { | ||
818 | if (MR_LdSpanPtrGet(ld, 0, map)->spanRowDataSize == 0) | ||
819 | return FALSE; | ||
820 | else if (instance->UnevenSpanSupport) { | ||
821 | io_info->IoforUnevenSpan = 1; | ||
822 | } else { | ||
823 | dev_info(&instance->pdev->dev, | ||
824 | "raid->rowDataSize is 0, but has SPAN[0]" | ||
825 | "rowDataSize = 0x%0x," | ||
826 | "but there is _NO_ UnevenSpanSupport\n", | ||
827 | MR_LdSpanPtrGet(ld, 0, map)->spanRowDataSize); | ||
828 | return FALSE; | ||
829 | } | ||
830 | } | ||
831 | |||
339 | stripSize = 1 << raid->stripeShift; | 832 | stripSize = 1 << raid->stripeShift; |
340 | stripe_mask = stripSize-1; | 833 | stripe_mask = stripSize-1; |
834 | |||
835 | |||
341 | /* | 836 | /* |
342 | * calculate starting row and stripe, and number of strips and rows | 837 | * calculate starting row and stripe, and number of strips and rows |
343 | */ | 838 | */ |
@@ -347,11 +842,50 @@ MR_BuildRaidContext(struct megasas_instance *instance, | |||
347 | ref_in_end_stripe = (u16)(endLba & stripe_mask); | 842 | ref_in_end_stripe = (u16)(endLba & stripe_mask); |
348 | endStrip = endLba >> raid->stripeShift; | 843 | endStrip = endLba >> raid->stripeShift; |
349 | num_strips = (u8)(endStrip - start_strip + 1); /* End strip */ | 844 | num_strips = (u8)(endStrip - start_strip + 1); /* End strip */ |
350 | if (raid->rowDataSize == 0) | 845 | |
351 | return FALSE; | 846 | if (io_info->IoforUnevenSpan) { |
352 | start_row = mega_div64_32(start_strip, raid->rowDataSize); | 847 | start_row = get_row_from_strip(instance, ld, start_strip, map); |
353 | endRow = mega_div64_32(endStrip, raid->rowDataSize); | 848 | endRow = get_row_from_strip(instance, ld, endStrip, map); |
354 | numRows = (u8)(endRow - start_row + 1); | 849 | if (start_row == -1ULL || endRow == -1ULL) { |
850 | dev_info(&instance->pdev->dev, "return from %s %d." | ||
851 | "Send IO w/o region lock.\n", | ||
852 | __func__, __LINE__); | ||
853 | return FALSE; | ||
854 | } | ||
855 | |||
856 | if (raid->spanDepth == 1) { | ||
857 | startlba_span = 0; | ||
858 | *pdBlock = start_row << raid->stripeShift; | ||
859 | } else | ||
860 | startlba_span = (u8)mr_spanset_get_span_block(instance, | ||
861 | ld, start_row, pdBlock, map); | ||
862 | if (startlba_span == SPAN_INVALID) { | ||
863 | dev_info(&instance->pdev->dev, "return from %s %d" | ||
864 | "for row 0x%llx,start strip %llx" | ||
865 | "endSrip %llx\n", __func__, __LINE__, | ||
866 | (unsigned long long)start_row, | ||
867 | (unsigned long long)start_strip, | ||
868 | (unsigned long long)endStrip); | ||
869 | return FALSE; | ||
870 | } | ||
871 | io_info->start_span = startlba_span; | ||
872 | io_info->start_row = start_row; | ||
873 | #if SPAN_DEBUG | ||
874 | dev_dbg(&instance->pdev->dev, "Check Span number from %s %d" | ||
875 | "for row 0x%llx, start strip 0x%llx end strip 0x%llx" | ||
876 | " span 0x%x\n", __func__, __LINE__, | ||
877 | (unsigned long long)start_row, | ||
878 | (unsigned long long)start_strip, | ||
879 | (unsigned long long)endStrip, startlba_span); | ||
880 | dev_dbg(&instance->pdev->dev, "start_row 0x%llx endRow 0x%llx" | ||
881 | "Start span 0x%x\n", (unsigned long long)start_row, | ||
882 | (unsigned long long)endRow, startlba_span); | ||
883 | #endif | ||
884 | } else { | ||
885 | start_row = mega_div64_32(start_strip, raid->rowDataSize); | ||
886 | endRow = mega_div64_32(endStrip, raid->rowDataSize); | ||
887 | } | ||
888 | numRows = (u8)(endRow - start_row + 1); | ||
355 | 889 | ||
356 | /* | 890 | /* |
357 | * calculate region info. | 891 | * calculate region info. |
@@ -384,28 +918,56 @@ MR_BuildRaidContext(struct megasas_instance *instance, | |||
384 | regSize = numBlocks; | 918 | regSize = numBlocks; |
385 | } | 919 | } |
386 | /* multi-strip IOs always need to full stripe locked */ | 920 | /* multi-strip IOs always need to full stripe locked */ |
387 | } else { | 921 | } else if (io_info->IoforUnevenSpan == 0) { |
922 | /* | ||
923 | * For Even span region lock optimization. | ||
924 | * If the start strip is the last in the start row | ||
925 | */ | ||
388 | if (start_strip == (start_row + 1) * raid->rowDataSize - 1) { | 926 | if (start_strip == (start_row + 1) * raid->rowDataSize - 1) { |
389 | /* If the start strip is the last in the start row */ | ||
390 | regStart += ref_in_start_stripe; | 927 | regStart += ref_in_start_stripe; |
391 | regSize = stripSize - ref_in_start_stripe; | ||
392 | /* initialize count to sectors from startref to end | 928 | /* initialize count to sectors from startref to end |
393 | of strip */ | 929 | of strip */ |
930 | regSize = stripSize - ref_in_start_stripe; | ||
394 | } | 931 | } |
395 | 932 | ||
933 | /* add complete rows in the middle of the transfer */ | ||
396 | if (numRows > 2) | 934 | if (numRows > 2) |
397 | /* Add complete rows in the middle of the transfer */ | ||
398 | regSize += (numRows-2) << raid->stripeShift; | 935 | regSize += (numRows-2) << raid->stripeShift; |
399 | 936 | ||
400 | /* if IO ends within first strip of last row */ | 937 | /* if IO ends within first strip of last row*/ |
401 | if (endStrip == endRow*raid->rowDataSize) | 938 | if (endStrip == endRow*raid->rowDataSize) |
402 | regSize += ref_in_end_stripe+1; | 939 | regSize += ref_in_end_stripe+1; |
403 | else | 940 | else |
404 | regSize += stripSize; | 941 | regSize += stripSize; |
942 | } else { | ||
943 | /* | ||
944 | * For Uneven span region lock optimization. | ||
945 | * If the start strip is the last in the start row | ||
946 | */ | ||
947 | if (start_strip == (get_strip_from_row(instance, ld, start_row, map) + | ||
948 | SPAN_ROW_DATA_SIZE(map, ld, startlba_span) - 1)) { | ||
949 | regStart += ref_in_start_stripe; | ||
950 | /* initialize count to sectors from | ||
951 | * startRef to end of strip | ||
952 | */ | ||
953 | regSize = stripSize - ref_in_start_stripe; | ||
954 | } | ||
955 | /* Add complete rows in the middle of the transfer*/ | ||
956 | |||
957 | if (numRows > 2) | ||
958 | /* Add complete rows in the middle of the transfer*/ | ||
959 | regSize += (numRows-2) << raid->stripeShift; | ||
960 | |||
961 | /* if IO ends within first strip of last row */ | ||
962 | if (endStrip == get_strip_from_row(instance, ld, endRow, map)) | ||
963 | regSize += ref_in_end_stripe + 1; | ||
964 | else | ||
965 | regSize += stripSize; | ||
405 | } | 966 | } |
406 | 967 | ||
407 | pRAID_Context->timeoutValue = map->raidMap.fpPdIoTimeoutSec; | 968 | pRAID_Context->timeoutValue = map->raidMap.fpPdIoTimeoutSec; |
408 | if (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) | 969 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || |
970 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) | ||
409 | pRAID_Context->regLockFlags = (isRead) ? | 971 | pRAID_Context->regLockFlags = (isRead) ? |
410 | raid->regTypeReqOnRead : raid->regTypeReqOnWrite; | 972 | raid->regTypeReqOnRead : raid->regTypeReqOnWrite; |
411 | else | 973 | else |
@@ -419,30 +981,161 @@ MR_BuildRaidContext(struct megasas_instance *instance, | |||
419 | /*Get Phy Params only if FP capable, or else leave it to MR firmware | 981 | /*Get Phy Params only if FP capable, or else leave it to MR firmware |
420 | to do the calculation.*/ | 982 | to do the calculation.*/ |
421 | if (io_info->fpOkForIo) { | 983 | if (io_info->fpOkForIo) { |
422 | retval = MR_GetPhyParams(instance, ld, start_strip, | 984 | retval = io_info->IoforUnevenSpan ? |
423 | ref_in_start_stripe, | 985 | mr_spanset_get_phy_params(instance, ld, |
424 | &io_info->pdBlock, | 986 | start_strip, ref_in_start_stripe, |
425 | &io_info->devHandle, pRAID_Context, | 987 | io_info, pRAID_Context, map) : |
426 | map); | 988 | MR_GetPhyParams(instance, ld, start_strip, |
427 | /* If IO on an invalid Pd, then FP i snot possible */ | 989 | ref_in_start_stripe, io_info, |
990 | pRAID_Context, map); | ||
991 | /* If IO on an invalid Pd, then FP is not possible.*/ | ||
428 | if (io_info->devHandle == MR_PD_INVALID) | 992 | if (io_info->devHandle == MR_PD_INVALID) |
429 | io_info->fpOkForIo = FALSE; | 993 | io_info->fpOkForIo = FALSE; |
430 | return retval; | 994 | return retval; |
431 | } else if (isRead) { | 995 | } else if (isRead) { |
432 | uint stripIdx; | 996 | uint stripIdx; |
433 | for (stripIdx = 0; stripIdx < num_strips; stripIdx++) { | 997 | for (stripIdx = 0; stripIdx < num_strips; stripIdx++) { |
434 | if (!MR_GetPhyParams(instance, ld, | 998 | retval = io_info->IoforUnevenSpan ? |
435 | start_strip + stripIdx, | 999 | mr_spanset_get_phy_params(instance, ld, |
436 | ref_in_start_stripe, | 1000 | start_strip + stripIdx, |
437 | &io_info->pdBlock, | 1001 | ref_in_start_stripe, io_info, |
438 | &io_info->devHandle, | 1002 | pRAID_Context, map) : |
439 | pRAID_Context, map)) | 1003 | MR_GetPhyParams(instance, ld, |
1004 | start_strip + stripIdx, ref_in_start_stripe, | ||
1005 | io_info, pRAID_Context, map); | ||
1006 | if (!retval) | ||
440 | return TRUE; | 1007 | return TRUE; |
441 | } | 1008 | } |
442 | } | 1009 | } |
1010 | |||
1011 | #if SPAN_DEBUG | ||
1012 | /* Just for testing what arm we get for strip.*/ | ||
1013 | if (io_info->IoforUnevenSpan) | ||
1014 | get_arm_from_strip(instance, ld, start_strip, map); | ||
1015 | #endif | ||
443 | return TRUE; | 1016 | return TRUE; |
444 | } | 1017 | } |
445 | 1018 | ||
1019 | /* | ||
1020 | ****************************************************************************** | ||
1021 | * | ||
1022 | * This routine pepare spanset info from Valid Raid map and store it into | ||
1023 | * local copy of ldSpanInfo per instance data structure. | ||
1024 | * | ||
1025 | * Inputs : | ||
1026 | * map - LD map | ||
1027 | * ldSpanInfo - ldSpanInfo per HBA instance | ||
1028 | * | ||
1029 | */ | ||
1030 | void mr_update_span_set(struct MR_FW_RAID_MAP_ALL *map, | ||
1031 | PLD_SPAN_INFO ldSpanInfo) | ||
1032 | { | ||
1033 | u8 span, count; | ||
1034 | u32 element, span_row_width; | ||
1035 | u64 span_row; | ||
1036 | struct MR_LD_RAID *raid; | ||
1037 | LD_SPAN_SET *span_set, *span_set_prev; | ||
1038 | struct MR_QUAD_ELEMENT *quad; | ||
1039 | int ldCount; | ||
1040 | u16 ld; | ||
1041 | |||
1042 | |||
1043 | for (ldCount = 0; ldCount < MAX_LOGICAL_DRIVES; ldCount++) { | ||
1044 | ld = MR_TargetIdToLdGet(ldCount, map); | ||
1045 | if (ld >= MAX_LOGICAL_DRIVES) | ||
1046 | continue; | ||
1047 | raid = MR_LdRaidGet(ld, map); | ||
1048 | for (element = 0; element < MAX_QUAD_DEPTH; element++) { | ||
1049 | for (span = 0; span < raid->spanDepth; span++) { | ||
1050 | if (map->raidMap.ldSpanMap[ld].spanBlock[span]. | ||
1051 | block_span_info.noElements < | ||
1052 | element + 1) | ||
1053 | continue; | ||
1054 | span_set = &(ldSpanInfo[ld].span_set[element]); | ||
1055 | quad = &map->raidMap.ldSpanMap[ld]. | ||
1056 | spanBlock[span].block_span_info. | ||
1057 | quad[element]; | ||
1058 | |||
1059 | span_set->diff = quad->diff; | ||
1060 | |||
1061 | for (count = 0, span_row_width = 0; | ||
1062 | count < raid->spanDepth; count++) { | ||
1063 | if (map->raidMap.ldSpanMap[ld]. | ||
1064 | spanBlock[count]. | ||
1065 | block_span_info. | ||
1066 | noElements >= element + 1) { | ||
1067 | span_set->strip_offset[count] = | ||
1068 | span_row_width; | ||
1069 | span_row_width += | ||
1070 | MR_LdSpanPtrGet | ||
1071 | (ld, count, map)->spanRowDataSize; | ||
1072 | printk(KERN_INFO "megasas:" | ||
1073 | "span %x rowDataSize %x\n", | ||
1074 | count, MR_LdSpanPtrGet | ||
1075 | (ld, count, map)->spanRowDataSize); | ||
1076 | } | ||
1077 | } | ||
1078 | |||
1079 | span_set->span_row_data_width = span_row_width; | ||
1080 | span_row = mega_div64_32(((quad->logEnd - | ||
1081 | quad->logStart) + quad->diff), | ||
1082 | quad->diff); | ||
1083 | |||
1084 | if (element == 0) { | ||
1085 | span_set->log_start_lba = 0; | ||
1086 | span_set->log_end_lba = | ||
1087 | ((span_row << raid->stripeShift) | ||
1088 | * span_row_width) - 1; | ||
1089 | |||
1090 | span_set->span_row_start = 0; | ||
1091 | span_set->span_row_end = span_row - 1; | ||
1092 | |||
1093 | span_set->data_strip_start = 0; | ||
1094 | span_set->data_strip_end = | ||
1095 | (span_row * span_row_width) - 1; | ||
1096 | |||
1097 | span_set->data_row_start = 0; | ||
1098 | span_set->data_row_end = | ||
1099 | (span_row * quad->diff) - 1; | ||
1100 | } else { | ||
1101 | span_set_prev = &(ldSpanInfo[ld]. | ||
1102 | span_set[element - 1]); | ||
1103 | span_set->log_start_lba = | ||
1104 | span_set_prev->log_end_lba + 1; | ||
1105 | span_set->log_end_lba = | ||
1106 | span_set->log_start_lba + | ||
1107 | ((span_row << raid->stripeShift) | ||
1108 | * span_row_width) - 1; | ||
1109 | |||
1110 | span_set->span_row_start = | ||
1111 | span_set_prev->span_row_end + 1; | ||
1112 | span_set->span_row_end = | ||
1113 | span_set->span_row_start + span_row - 1; | ||
1114 | |||
1115 | span_set->data_strip_start = | ||
1116 | span_set_prev->data_strip_end + 1; | ||
1117 | span_set->data_strip_end = | ||
1118 | span_set->data_strip_start + | ||
1119 | (span_row * span_row_width) - 1; | ||
1120 | |||
1121 | span_set->data_row_start = | ||
1122 | span_set_prev->data_row_end + 1; | ||
1123 | span_set->data_row_end = | ||
1124 | span_set->data_row_start + | ||
1125 | (span_row * quad->diff) - 1; | ||
1126 | } | ||
1127 | break; | ||
1128 | } | ||
1129 | if (span == raid->spanDepth) | ||
1130 | break; | ||
1131 | } | ||
1132 | } | ||
1133 | #if SPAN_DEBUG | ||
1134 | getSpanInfo(map, ldSpanInfo); | ||
1135 | #endif | ||
1136 | |||
1137 | } | ||
1138 | |||
446 | void | 1139 | void |
447 | mr_update_load_balance_params(struct MR_FW_RAID_MAP_ALL *map, | 1140 | mr_update_load_balance_params(struct MR_FW_RAID_MAP_ALL *map, |
448 | struct LD_LOAD_BALANCE_INFO *lbInfo) | 1141 | struct LD_LOAD_BALANCE_INFO *lbInfo) |
@@ -503,8 +1196,9 @@ u8 megasas_get_best_arm(struct LD_LOAD_BALANCE_INFO *lbInfo, u8 arm, u64 block, | |||
503 | diff1 = ABS_DIFF(block, lbInfo->last_accessed_block[1]); | 1196 | diff1 = ABS_DIFF(block, lbInfo->last_accessed_block[1]); |
504 | bestArm = (diff0 <= diff1 ? 0 : 1); | 1197 | bestArm = (diff0 <= diff1 ? 0 : 1); |
505 | 1198 | ||
506 | if ((bestArm == arm && pend0 > pend1 + 16) || | 1199 | /*Make balance count from 16 to 4 to keep driver in sync with Firmware*/ |
507 | (bestArm != arm && pend1 > pend0 + 16)) | 1200 | if ((bestArm == arm && pend0 > pend1 + 4) || |
1201 | (bestArm != arm && pend1 > pend0 + 4)) | ||
508 | bestArm ^= 1; | 1202 | bestArm ^= 1; |
509 | 1203 | ||
510 | /* Update the last accessed block on the correct pd */ | 1204 | /* Update the last accessed block on the correct pd */ |
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index a7d56687bfca..417d5f167aa2 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c | |||
@@ -86,8 +86,6 @@ u16 MR_GetLDTgtId(u32 ld, struct MR_FW_RAID_MAP_ALL *map); | |||
86 | void | 86 | void |
87 | megasas_check_and_restore_queue_depth(struct megasas_instance *instance); | 87 | megasas_check_and_restore_queue_depth(struct megasas_instance *instance); |
88 | 88 | ||
89 | u8 MR_ValidateMapInfo(struct MR_FW_RAID_MAP_ALL *map, | ||
90 | struct LD_LOAD_BALANCE_INFO *lbInfo); | ||
91 | u16 get_updated_dev_handle(struct LD_LOAD_BALANCE_INFO *lbInfo, | 89 | u16 get_updated_dev_handle(struct LD_LOAD_BALANCE_INFO *lbInfo, |
92 | struct IO_REQUEST_INFO *in_info); | 90 | struct IO_REQUEST_INFO *in_info); |
93 | int megasas_transition_to_ready(struct megasas_instance *instance, int ocr); | 91 | int megasas_transition_to_ready(struct megasas_instance *instance, int ocr); |
@@ -101,8 +99,10 @@ extern int resetwaittime; | |||
101 | * @regs: MFI register set | 99 | * @regs: MFI register set |
102 | */ | 100 | */ |
103 | void | 101 | void |
104 | megasas_enable_intr_fusion(struct megasas_register_set __iomem *regs) | 102 | megasas_enable_intr_fusion(struct megasas_instance *instance) |
105 | { | 103 | { |
104 | struct megasas_register_set __iomem *regs; | ||
105 | regs = instance->reg_set; | ||
106 | /* For Thunderbolt/Invader also clear intr on enable */ | 106 | /* For Thunderbolt/Invader also clear intr on enable */ |
107 | writel(~0, ®s->outbound_intr_status); | 107 | writel(~0, ®s->outbound_intr_status); |
108 | readl(®s->outbound_intr_status); | 108 | readl(®s->outbound_intr_status); |
@@ -111,6 +111,7 @@ megasas_enable_intr_fusion(struct megasas_register_set __iomem *regs) | |||
111 | 111 | ||
112 | /* Dummy readl to force pci flush */ | 112 | /* Dummy readl to force pci flush */ |
113 | readl(®s->outbound_intr_mask); | 113 | readl(®s->outbound_intr_mask); |
114 | instance->mask_interrupts = 0; | ||
114 | } | 115 | } |
115 | 116 | ||
116 | /** | 117 | /** |
@@ -118,10 +119,13 @@ megasas_enable_intr_fusion(struct megasas_register_set __iomem *regs) | |||
118 | * @regs: MFI register set | 119 | * @regs: MFI register set |
119 | */ | 120 | */ |
120 | void | 121 | void |
121 | megasas_disable_intr_fusion(struct megasas_register_set __iomem *regs) | 122 | megasas_disable_intr_fusion(struct megasas_instance *instance) |
122 | { | 123 | { |
123 | u32 mask = 0xFFFFFFFF; | 124 | u32 mask = 0xFFFFFFFF; |
124 | u32 status; | 125 | u32 status; |
126 | struct megasas_register_set __iomem *regs; | ||
127 | regs = instance->reg_set; | ||
128 | instance->mask_interrupts = 1; | ||
125 | 129 | ||
126 | writel(mask, ®s->outbound_intr_mask); | 130 | writel(mask, ®s->outbound_intr_mask); |
127 | /* Dummy readl to force pci flush */ | 131 | /* Dummy readl to force pci flush */ |
@@ -643,6 +647,12 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) | |||
643 | init_frame->cmd = MFI_CMD_INIT; | 647 | init_frame->cmd = MFI_CMD_INIT; |
644 | init_frame->cmd_status = 0xFF; | 648 | init_frame->cmd_status = 0xFF; |
645 | 649 | ||
650 | /* driver support Extended MSIX */ | ||
651 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || | ||
652 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) | ||
653 | init_frame->driver_operations. | ||
654 | mfi_capabilities.support_additional_msix = 1; | ||
655 | |||
646 | init_frame->queue_info_new_phys_addr_lo = ioc_init_handle; | 656 | init_frame->queue_info_new_phys_addr_lo = ioc_init_handle; |
647 | init_frame->data_xfer_len = sizeof(struct MPI2_IOC_INIT_REQUEST); | 657 | init_frame->data_xfer_len = sizeof(struct MPI2_IOC_INIT_REQUEST); |
648 | 658 | ||
@@ -657,7 +667,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) | |||
657 | /* | 667 | /* |
658 | * disable the intr before firing the init frame | 668 | * disable the intr before firing the init frame |
659 | */ | 669 | */ |
660 | instance->instancet->disable_intr(instance->reg_set); | 670 | instance->instancet->disable_intr(instance); |
661 | 671 | ||
662 | for (i = 0; i < (10 * 1000); i += 20) { | 672 | for (i = 0; i < (10 * 1000); i += 20) { |
663 | if (readl(&instance->reg_set->doorbell) & 1) | 673 | if (readl(&instance->reg_set->doorbell) & 1) |
@@ -770,8 +780,7 @@ megasas_get_map_info(struct megasas_instance *instance) | |||
770 | 780 | ||
771 | fusion->fast_path_io = 0; | 781 | fusion->fast_path_io = 0; |
772 | if (!megasas_get_ld_map_info(instance)) { | 782 | if (!megasas_get_ld_map_info(instance)) { |
773 | if (MR_ValidateMapInfo(fusion->ld_map[(instance->map_id & 1)], | 783 | if (MR_ValidateMapInfo(instance)) { |
774 | fusion->load_balance_info)) { | ||
775 | fusion->fast_path_io = 1; | 784 | fusion->fast_path_io = 1; |
776 | return 0; | 785 | return 0; |
777 | } | 786 | } |
@@ -864,6 +873,66 @@ megasas_sync_map_info(struct megasas_instance *instance) | |||
864 | return ret; | 873 | return ret; |
865 | } | 874 | } |
866 | 875 | ||
876 | /* | ||
877 | * meagasas_display_intel_branding - Display branding string | ||
878 | * @instance: per adapter object | ||
879 | * | ||
880 | * Return nothing. | ||
881 | */ | ||
882 | static void | ||
883 | megasas_display_intel_branding(struct megasas_instance *instance) | ||
884 | { | ||
885 | if (instance->pdev->subsystem_vendor != PCI_VENDOR_ID_INTEL) | ||
886 | return; | ||
887 | |||
888 | switch (instance->pdev->device) { | ||
889 | case PCI_DEVICE_ID_LSI_INVADER: | ||
890 | switch (instance->pdev->subsystem_device) { | ||
891 | case MEGARAID_INTEL_RS3DC080_SSDID: | ||
892 | dev_info(&instance->pdev->dev, "scsi host %d: %s\n", | ||
893 | instance->host->host_no, | ||
894 | MEGARAID_INTEL_RS3DC080_BRANDING); | ||
895 | break; | ||
896 | case MEGARAID_INTEL_RS3DC040_SSDID: | ||
897 | dev_info(&instance->pdev->dev, "scsi host %d: %s\n", | ||
898 | instance->host->host_no, | ||
899 | MEGARAID_INTEL_RS3DC040_BRANDING); | ||
900 | break; | ||
901 | case MEGARAID_INTEL_RS3SC008_SSDID: | ||
902 | dev_info(&instance->pdev->dev, "scsi host %d: %s\n", | ||
903 | instance->host->host_no, | ||
904 | MEGARAID_INTEL_RS3SC008_BRANDING); | ||
905 | break; | ||
906 | case MEGARAID_INTEL_RS3MC044_SSDID: | ||
907 | dev_info(&instance->pdev->dev, "scsi host %d: %s\n", | ||
908 | instance->host->host_no, | ||
909 | MEGARAID_INTEL_RS3MC044_BRANDING); | ||
910 | break; | ||
911 | default: | ||
912 | break; | ||
913 | } | ||
914 | break; | ||
915 | case PCI_DEVICE_ID_LSI_FURY: | ||
916 | switch (instance->pdev->subsystem_device) { | ||
917 | case MEGARAID_INTEL_RS3WC080_SSDID: | ||
918 | dev_info(&instance->pdev->dev, "scsi host %d: %s\n", | ||
919 | instance->host->host_no, | ||
920 | MEGARAID_INTEL_RS3WC080_BRANDING); | ||
921 | break; | ||
922 | case MEGARAID_INTEL_RS3WC040_SSDID: | ||
923 | dev_info(&instance->pdev->dev, "scsi host %d: %s\n", | ||
924 | instance->host->host_no, | ||
925 | MEGARAID_INTEL_RS3WC040_BRANDING); | ||
926 | break; | ||
927 | default: | ||
928 | break; | ||
929 | } | ||
930 | break; | ||
931 | default: | ||
932 | break; | ||
933 | } | ||
934 | } | ||
935 | |||
867 | /** | 936 | /** |
868 | * megasas_init_adapter_fusion - Initializes the FW | 937 | * megasas_init_adapter_fusion - Initializes the FW |
869 | * @instance: Adapter soft state | 938 | * @instance: Adapter soft state |
@@ -944,6 +1013,8 @@ megasas_init_adapter_fusion(struct megasas_instance *instance) | |||
944 | if (megasas_ioc_init_fusion(instance)) | 1013 | if (megasas_ioc_init_fusion(instance)) |
945 | goto fail_ioc_init; | 1014 | goto fail_ioc_init; |
946 | 1015 | ||
1016 | megasas_display_intel_branding(instance); | ||
1017 | |||
947 | instance->flag_ieee = 1; | 1018 | instance->flag_ieee = 1; |
948 | 1019 | ||
949 | fusion->map_sz = sizeof(struct MR_FW_RAID_MAP) + | 1020 | fusion->map_sz = sizeof(struct MR_FW_RAID_MAP) + |
@@ -1071,7 +1142,8 @@ megasas_make_sgl_fusion(struct megasas_instance *instance, | |||
1071 | 1142 | ||
1072 | fusion = instance->ctrl_context; | 1143 | fusion = instance->ctrl_context; |
1073 | 1144 | ||
1074 | if (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) { | 1145 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || |
1146 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) { | ||
1075 | struct MPI25_IEEE_SGE_CHAIN64 *sgl_ptr_end = sgl_ptr; | 1147 | struct MPI25_IEEE_SGE_CHAIN64 *sgl_ptr_end = sgl_ptr; |
1076 | sgl_ptr_end += fusion->max_sge_in_main_msg - 1; | 1148 | sgl_ptr_end += fusion->max_sge_in_main_msg - 1; |
1077 | sgl_ptr_end->Flags = 0; | 1149 | sgl_ptr_end->Flags = 0; |
@@ -1088,7 +1160,8 @@ megasas_make_sgl_fusion(struct megasas_instance *instance, | |||
1088 | sgl_ptr->Length = sg_dma_len(os_sgl); | 1160 | sgl_ptr->Length = sg_dma_len(os_sgl); |
1089 | sgl_ptr->Address = sg_dma_address(os_sgl); | 1161 | sgl_ptr->Address = sg_dma_address(os_sgl); |
1090 | sgl_ptr->Flags = 0; | 1162 | sgl_ptr->Flags = 0; |
1091 | if (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) { | 1163 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || |
1164 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) { | ||
1092 | if (i == sge_count - 1) | 1165 | if (i == sge_count - 1) |
1093 | sgl_ptr->Flags = IEEE_SGE_FLAGS_END_OF_LIST; | 1166 | sgl_ptr->Flags = IEEE_SGE_FLAGS_END_OF_LIST; |
1094 | } | 1167 | } |
@@ -1100,8 +1173,10 @@ megasas_make_sgl_fusion(struct megasas_instance *instance, | |||
1100 | (sge_count > fusion->max_sge_in_main_msg)) { | 1173 | (sge_count > fusion->max_sge_in_main_msg)) { |
1101 | 1174 | ||
1102 | struct MPI25_IEEE_SGE_CHAIN64 *sg_chain; | 1175 | struct MPI25_IEEE_SGE_CHAIN64 *sg_chain; |
1103 | if (instance->pdev->device == | 1176 | if ((instance->pdev->device == |
1104 | PCI_DEVICE_ID_LSI_INVADER) { | 1177 | PCI_DEVICE_ID_LSI_INVADER) || |
1178 | (instance->pdev->device == | ||
1179 | PCI_DEVICE_ID_LSI_FURY)) { | ||
1105 | if ((cmd->io_request->IoFlags & | 1180 | if ((cmd->io_request->IoFlags & |
1106 | MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) != | 1181 | MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) != |
1107 | MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) | 1182 | MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) |
@@ -1117,8 +1192,10 @@ megasas_make_sgl_fusion(struct megasas_instance *instance, | |||
1117 | sg_chain = sgl_ptr; | 1192 | sg_chain = sgl_ptr; |
1118 | /* Prepare chain element */ | 1193 | /* Prepare chain element */ |
1119 | sg_chain->NextChainOffset = 0; | 1194 | sg_chain->NextChainOffset = 0; |
1120 | if (instance->pdev->device == | 1195 | if ((instance->pdev->device == |
1121 | PCI_DEVICE_ID_LSI_INVADER) | 1196 | PCI_DEVICE_ID_LSI_INVADER) || |
1197 | (instance->pdev->device == | ||
1198 | PCI_DEVICE_ID_LSI_FURY)) | ||
1122 | sg_chain->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT; | 1199 | sg_chain->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT; |
1123 | else | 1200 | else |
1124 | sg_chain->Flags = | 1201 | sg_chain->Flags = |
@@ -1434,7 +1511,8 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, | |||
1434 | cmd->request_desc->SCSIIO.RequestFlags = | 1511 | cmd->request_desc->SCSIIO.RequestFlags = |
1435 | (MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY | 1512 | (MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY |
1436 | << MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); | 1513 | << MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); |
1437 | if (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) { | 1514 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || |
1515 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) { | ||
1438 | if (io_request->RaidContext.regLockFlags == | 1516 | if (io_request->RaidContext.regLockFlags == |
1439 | REGION_TYPE_UNUSED) | 1517 | REGION_TYPE_UNUSED) |
1440 | cmd->request_desc->SCSIIO.RequestFlags = | 1518 | cmd->request_desc->SCSIIO.RequestFlags = |
@@ -1465,7 +1543,8 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, | |||
1465 | cmd->request_desc->SCSIIO.RequestFlags = | 1543 | cmd->request_desc->SCSIIO.RequestFlags = |
1466 | (MEGASAS_REQ_DESCRIPT_FLAGS_LD_IO | 1544 | (MEGASAS_REQ_DESCRIPT_FLAGS_LD_IO |
1467 | << MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); | 1545 | << MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); |
1468 | if (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) { | 1546 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || |
1547 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) { | ||
1469 | if (io_request->RaidContext.regLockFlags == | 1548 | if (io_request->RaidContext.regLockFlags == |
1470 | REGION_TYPE_UNUSED) | 1549 | REGION_TYPE_UNUSED) |
1471 | cmd->request_desc->SCSIIO.RequestFlags = | 1550 | cmd->request_desc->SCSIIO.RequestFlags = |
@@ -1522,11 +1601,27 @@ megasas_build_dcdb_fusion(struct megasas_instance *instance, | |||
1522 | io_request->RaidContext.RAIDFlags = | 1601 | io_request->RaidContext.RAIDFlags = |
1523 | MR_RAID_FLAGS_IO_SUB_TYPE_SYSTEM_PD << | 1602 | MR_RAID_FLAGS_IO_SUB_TYPE_SYSTEM_PD << |
1524 | MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT; | 1603 | MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT; |
1604 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || | ||
1605 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) | ||
1606 | io_request->IoFlags |= | ||
1607 | MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH; | ||
1525 | cmd->request_desc->SCSIIO.RequestFlags = | 1608 | cmd->request_desc->SCSIIO.RequestFlags = |
1526 | (MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY << | 1609 | (MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY << |
1527 | MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); | 1610 | MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); |
1528 | cmd->request_desc->SCSIIO.DevHandle = | 1611 | cmd->request_desc->SCSIIO.DevHandle = |
1529 | local_map_ptr->raidMap.devHndlInfo[device_id].curDevHdl; | 1612 | local_map_ptr->raidMap.devHndlInfo[device_id].curDevHdl; |
1613 | /* | ||
1614 | * If the command is for the tape device, set the | ||
1615 | * FP timeout to the os layer timeout value. | ||
1616 | */ | ||
1617 | if (scmd->device->type == TYPE_TAPE) { | ||
1618 | if ((scmd->request->timeout / HZ) > 0xFFFF) | ||
1619 | io_request->RaidContext.timeoutValue = | ||
1620 | 0xFFFF; | ||
1621 | else | ||
1622 | io_request->RaidContext.timeoutValue = | ||
1623 | scmd->request->timeout / HZ; | ||
1624 | } | ||
1530 | } else { | 1625 | } else { |
1531 | io_request->Function = MEGASAS_MPI2_FUNCTION_LD_IO_REQUEST; | 1626 | io_request->Function = MEGASAS_MPI2_FUNCTION_LD_IO_REQUEST; |
1532 | io_request->DevHandle = device_id; | 1627 | io_request->DevHandle = device_id; |
@@ -1825,8 +1920,15 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex) | |||
1825 | return IRQ_NONE; | 1920 | return IRQ_NONE; |
1826 | 1921 | ||
1827 | wmb(); | 1922 | wmb(); |
1828 | writel((MSIxIndex << 24) | fusion->last_reply_idx[MSIxIndex], | 1923 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || |
1829 | &instance->reg_set->reply_post_host_index); | 1924 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) |
1925 | writel(((MSIxIndex & 0x7) << 24) | | ||
1926 | fusion->last_reply_idx[MSIxIndex], | ||
1927 | instance->reply_post_host_index_addr[MSIxIndex/8]); | ||
1928 | else | ||
1929 | writel((MSIxIndex << 24) | | ||
1930 | fusion->last_reply_idx[MSIxIndex], | ||
1931 | instance->reply_post_host_index_addr[0]); | ||
1830 | megasas_check_and_restore_queue_depth(instance); | 1932 | megasas_check_and_restore_queue_depth(instance); |
1831 | return IRQ_HANDLED; | 1933 | return IRQ_HANDLED; |
1832 | } | 1934 | } |
@@ -1868,6 +1970,9 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp) | |||
1868 | struct megasas_instance *instance = irq_context->instance; | 1970 | struct megasas_instance *instance = irq_context->instance; |
1869 | u32 mfiStatus, fw_state; | 1971 | u32 mfiStatus, fw_state; |
1870 | 1972 | ||
1973 | if (instance->mask_interrupts) | ||
1974 | return IRQ_NONE; | ||
1975 | |||
1871 | if (!instance->msix_vectors) { | 1976 | if (!instance->msix_vectors) { |
1872 | mfiStatus = instance->instancet->clear_intr(instance->reg_set); | 1977 | mfiStatus = instance->instancet->clear_intr(instance->reg_set); |
1873 | if (!mfiStatus) | 1978 | if (!mfiStatus) |
@@ -1929,7 +2034,8 @@ build_mpt_mfi_pass_thru(struct megasas_instance *instance, | |||
1929 | fusion = instance->ctrl_context; | 2034 | fusion = instance->ctrl_context; |
1930 | io_req = cmd->io_request; | 2035 | io_req = cmd->io_request; |
1931 | 2036 | ||
1932 | if (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) { | 2037 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || |
2038 | (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) { | ||
1933 | struct MPI25_IEEE_SGE_CHAIN64 *sgl_ptr_end = | 2039 | struct MPI25_IEEE_SGE_CHAIN64 *sgl_ptr_end = |
1934 | (struct MPI25_IEEE_SGE_CHAIN64 *)&io_req->SGL; | 2040 | (struct MPI25_IEEE_SGE_CHAIN64 *)&io_req->SGL; |
1935 | sgl_ptr_end += fusion->max_sge_in_main_msg - 1; | 2041 | sgl_ptr_end += fusion->max_sge_in_main_msg - 1; |
@@ -2132,7 +2238,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost) | |||
2132 | mutex_lock(&instance->reset_mutex); | 2238 | mutex_lock(&instance->reset_mutex); |
2133 | set_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); | 2239 | set_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); |
2134 | instance->adprecovery = MEGASAS_ADPRESET_SM_INFAULT; | 2240 | instance->adprecovery = MEGASAS_ADPRESET_SM_INFAULT; |
2135 | instance->instancet->disable_intr(instance->reg_set); | 2241 | instance->instancet->disable_intr(instance); |
2136 | msleep(1000); | 2242 | msleep(1000); |
2137 | 2243 | ||
2138 | /* First try waiting for commands to complete */ | 2244 | /* First try waiting for commands to complete */ |
@@ -2256,7 +2362,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost) | |||
2256 | 2362 | ||
2257 | clear_bit(MEGASAS_FUSION_IN_RESET, | 2363 | clear_bit(MEGASAS_FUSION_IN_RESET, |
2258 | &instance->reset_flags); | 2364 | &instance->reset_flags); |
2259 | instance->instancet->enable_intr(instance->reg_set); | 2365 | instance->instancet->enable_intr(instance); |
2260 | instance->adprecovery = MEGASAS_HBA_OPERATIONAL; | 2366 | instance->adprecovery = MEGASAS_HBA_OPERATIONAL; |
2261 | 2367 | ||
2262 | /* Re-fire management commands */ | 2368 | /* Re-fire management commands */ |
@@ -2318,7 +2424,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost) | |||
2318 | retval = FAILED; | 2424 | retval = FAILED; |
2319 | } else { | 2425 | } else { |
2320 | clear_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); | 2426 | clear_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); |
2321 | instance->instancet->enable_intr(instance->reg_set); | 2427 | instance->instancet->enable_intr(instance); |
2322 | instance->adprecovery = MEGASAS_HBA_OPERATIONAL; | 2428 | instance->adprecovery = MEGASAS_HBA_OPERATIONAL; |
2323 | } | 2429 | } |
2324 | out: | 2430 | out: |
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h b/drivers/scsi/megaraid/megaraid_sas_fusion.h index f68a3cd11d5d..12ff01cf6799 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.h +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h | |||
@@ -43,7 +43,7 @@ | |||
43 | #define HOST_DIAG_WRITE_ENABLE 0x80 | 43 | #define HOST_DIAG_WRITE_ENABLE 0x80 |
44 | #define HOST_DIAG_RESET_ADAPTER 0x4 | 44 | #define HOST_DIAG_RESET_ADAPTER 0x4 |
45 | #define MEGASAS_FUSION_MAX_RESET_TRIES 3 | 45 | #define MEGASAS_FUSION_MAX_RESET_TRIES 3 |
46 | #define MAX_MSIX_QUEUES_FUSION 16 | 46 | #define MAX_MSIX_QUEUES_FUSION 128 |
47 | 47 | ||
48 | /* Invader defines */ | 48 | /* Invader defines */ |
49 | #define MPI2_TYPE_CUDA 0x2 | 49 | #define MPI2_TYPE_CUDA 0x2 |
@@ -62,6 +62,9 @@ | |||
62 | #define MEGASAS_RD_WR_PROTECT_CHECK_ALL 0x20 | 62 | #define MEGASAS_RD_WR_PROTECT_CHECK_ALL 0x20 |
63 | #define MEGASAS_RD_WR_PROTECT_CHECK_NONE 0x60 | 63 | #define MEGASAS_RD_WR_PROTECT_CHECK_NONE 0x60 |
64 | 64 | ||
65 | #define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C) | ||
66 | #define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) | ||
67 | |||
65 | /* | 68 | /* |
66 | * Raid context flags | 69 | * Raid context flags |
67 | */ | 70 | */ |
@@ -460,6 +463,7 @@ struct MPI2_IOC_INIT_REQUEST { | |||
460 | /* mrpriv defines */ | 463 | /* mrpriv defines */ |
461 | #define MR_PD_INVALID 0xFFFF | 464 | #define MR_PD_INVALID 0xFFFF |
462 | #define MAX_SPAN_DEPTH 8 | 465 | #define MAX_SPAN_DEPTH 8 |
466 | #define MAX_QUAD_DEPTH MAX_SPAN_DEPTH | ||
463 | #define MAX_RAIDMAP_SPAN_DEPTH (MAX_SPAN_DEPTH) | 467 | #define MAX_RAIDMAP_SPAN_DEPTH (MAX_SPAN_DEPTH) |
464 | #define MAX_ROW_SIZE 32 | 468 | #define MAX_ROW_SIZE 32 |
465 | #define MAX_RAIDMAP_ROW_SIZE (MAX_ROW_SIZE) | 469 | #define MAX_RAIDMAP_ROW_SIZE (MAX_ROW_SIZE) |
@@ -501,7 +505,9 @@ struct MR_LD_SPAN { | |||
501 | u64 startBlk; | 505 | u64 startBlk; |
502 | u64 numBlks; | 506 | u64 numBlks; |
503 | u16 arrayRef; | 507 | u16 arrayRef; |
504 | u8 reserved[6]; | 508 | u8 spanRowSize; |
509 | u8 spanRowDataSize; | ||
510 | u8 reserved[4]; | ||
505 | }; | 511 | }; |
506 | 512 | ||
507 | struct MR_SPAN_BLOCK_INFO { | 513 | struct MR_SPAN_BLOCK_INFO { |
@@ -587,6 +593,10 @@ struct IO_REQUEST_INFO { | |||
587 | u16 devHandle; | 593 | u16 devHandle; |
588 | u64 pdBlock; | 594 | u64 pdBlock; |
589 | u8 fpOkForIo; | 595 | u8 fpOkForIo; |
596 | u8 IoforUnevenSpan; | ||
597 | u8 start_span; | ||
598 | u8 reserved; | ||
599 | u64 start_row; | ||
590 | }; | 600 | }; |
591 | 601 | ||
592 | struct MR_LD_TARGET_SYNC { | 602 | struct MR_LD_TARGET_SYNC { |
@@ -648,6 +658,26 @@ struct LD_LOAD_BALANCE_INFO { | |||
648 | u64 last_accessed_block[2]; | 658 | u64 last_accessed_block[2]; |
649 | }; | 659 | }; |
650 | 660 | ||
661 | /* SPAN_SET is info caclulated from span info from Raid map per LD */ | ||
662 | typedef struct _LD_SPAN_SET { | ||
663 | u64 log_start_lba; | ||
664 | u64 log_end_lba; | ||
665 | u64 span_row_start; | ||
666 | u64 span_row_end; | ||
667 | u64 data_strip_start; | ||
668 | u64 data_strip_end; | ||
669 | u64 data_row_start; | ||
670 | u64 data_row_end; | ||
671 | u8 strip_offset[MAX_SPAN_DEPTH]; | ||
672 | u32 span_row_data_width; | ||
673 | u32 diff; | ||
674 | u32 reserved[2]; | ||
675 | } LD_SPAN_SET, *PLD_SPAN_SET; | ||
676 | |||
677 | typedef struct LOG_BLOCK_SPAN_INFO { | ||
678 | LD_SPAN_SET span_set[MAX_SPAN_DEPTH]; | ||
679 | } LD_SPAN_INFO, *PLD_SPAN_INFO; | ||
680 | |||
651 | struct MR_FW_RAID_MAP_ALL { | 681 | struct MR_FW_RAID_MAP_ALL { |
652 | struct MR_FW_RAID_MAP raidMap; | 682 | struct MR_FW_RAID_MAP raidMap; |
653 | struct MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES - 1]; | 683 | struct MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES - 1]; |
@@ -692,6 +722,7 @@ struct fusion_context { | |||
692 | u32 map_sz; | 722 | u32 map_sz; |
693 | u8 fast_path_io; | 723 | u8 fast_path_io; |
694 | struct LD_LOAD_BALANCE_INFO load_balance_info[MAX_LOGICAL_DRIVES]; | 724 | struct LD_LOAD_BALANCE_INFO load_balance_info[MAX_LOGICAL_DRIVES]; |
725 | LD_SPAN_INFO log_to_span[MAX_LOGICAL_DRIVES]; | ||
695 | }; | 726 | }; |
696 | 727 | ||
697 | union desc_value { | 728 | union desc_value { |
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2.h b/drivers/scsi/mpt2sas/mpi/mpi2.h index e960f9625c78..31b5b15a4726 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2.h | |||
@@ -8,7 +8,7 @@ | |||
8 | * scatter/gather formats. | 8 | * scatter/gather formats. |
9 | * Creation Date: June 21, 2006 | 9 | * Creation Date: June 21, 2006 |
10 | * | 10 | * |
11 | * mpi2.h Version: 02.00.25 | 11 | * mpi2.h Version: 02.00.27 |
12 | * | 12 | * |
13 | * Version History | 13 | * Version History |
14 | * --------------- | 14 | * --------------- |
@@ -75,6 +75,8 @@ | |||
75 | * 02-06-12 02.00.24 Bumped MPI2_HEADER_VERSION_UNIT. | 75 | * 02-06-12 02.00.24 Bumped MPI2_HEADER_VERSION_UNIT. |
76 | * 03-29-12 02.00.25 Bumped MPI2_HEADER_VERSION_UNIT. | 76 | * 03-29-12 02.00.25 Bumped MPI2_HEADER_VERSION_UNIT. |
77 | * Added Hard Reset delay timings. | 77 | * Added Hard Reset delay timings. |
78 | * 07-10-12 02.00.26 Bumped MPI2_HEADER_VERSION_UNIT. | ||
79 | * 07-26-12 02.00.27 Bumped MPI2_HEADER_VERSION_UNIT. | ||
78 | * -------------------------------------------------------------------------- | 80 | * -------------------------------------------------------------------------- |
79 | */ | 81 | */ |
80 | 82 | ||
@@ -100,7 +102,7 @@ | |||
100 | #define MPI2_VERSION_02_00 (0x0200) | 102 | #define MPI2_VERSION_02_00 (0x0200) |
101 | 103 | ||
102 | /* versioning for this MPI header set */ | 104 | /* versioning for this MPI header set */ |
103 | #define MPI2_HEADER_VERSION_UNIT (0x19) | 105 | #define MPI2_HEADER_VERSION_UNIT (0x1B) |
104 | #define MPI2_HEADER_VERSION_DEV (0x00) | 106 | #define MPI2_HEADER_VERSION_DEV (0x00) |
105 | #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) | 107 | #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) |
106 | #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) | 108 | #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) |
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_init.h b/drivers/scsi/mpt2sas/mpi/mpi2_init.h index 38c5da398143..963761fb8462 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2_init.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2_init.h | |||
@@ -6,7 +6,7 @@ | |||
6 | * Title: MPI SCSI initiator mode messages and structures | 6 | * Title: MPI SCSI initiator mode messages and structures |
7 | * Creation Date: June 23, 2006 | 7 | * Creation Date: June 23, 2006 |
8 | * | 8 | * |
9 | * mpi2_init.h Version: 02.00.13 | 9 | * mpi2_init.h Version: 02.00.14 |
10 | * | 10 | * |
11 | * Version History | 11 | * Version History |
12 | * --------------- | 12 | * --------------- |
@@ -36,6 +36,7 @@ | |||
36 | * 11-10-10 02.00.11 Added MPI2_SCSIIO_NUM_SGLOFFSETS define. | 36 | * 11-10-10 02.00.11 Added MPI2_SCSIIO_NUM_SGLOFFSETS define. |
37 | * 02-06-12 02.00.13 Added alternate defines for Task Priority / Command | 37 | * 02-06-12 02.00.13 Added alternate defines for Task Priority / Command |
38 | * Priority to match SAM-4. | 38 | * Priority to match SAM-4. |
39 | * 07-10-12 02.00.14 Added MPI2_SCSIIO_CONTROL_SHIFT_DATADIRECTION. | ||
39 | * -------------------------------------------------------------------------- | 40 | * -------------------------------------------------------------------------- |
40 | */ | 41 | */ |
41 | 42 | ||
@@ -189,6 +190,7 @@ typedef struct _MPI2_SCSI_IO_REQUEST | |||
189 | #define MPI2_SCSIIO_CONTROL_ADDCDBLEN_SHIFT (26) | 190 | #define MPI2_SCSIIO_CONTROL_ADDCDBLEN_SHIFT (26) |
190 | 191 | ||
191 | #define MPI2_SCSIIO_CONTROL_DATADIRECTION_MASK (0x03000000) | 192 | #define MPI2_SCSIIO_CONTROL_DATADIRECTION_MASK (0x03000000) |
193 | #define MPI2_SCSIIO_CONTROL_SHIFT_DATADIRECTION (24) | ||
192 | #define MPI2_SCSIIO_CONTROL_NODATATRANSFER (0x00000000) | 194 | #define MPI2_SCSIIO_CONTROL_NODATATRANSFER (0x00000000) |
193 | #define MPI2_SCSIIO_CONTROL_WRITE (0x01000000) | 195 | #define MPI2_SCSIIO_CONTROL_WRITE (0x01000000) |
194 | #define MPI2_SCSIIO_CONTROL_READ (0x02000000) | 196 | #define MPI2_SCSIIO_CONTROL_READ (0x02000000) |
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_ioc.h b/drivers/scsi/mpt2sas/mpi/mpi2_ioc.h index b0d4760bb17d..e93f8f53adf9 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2_ioc.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2_ioc.h | |||
@@ -6,7 +6,7 @@ | |||
6 | * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages | 6 | * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages |
7 | * Creation Date: October 11, 2006 | 7 | * Creation Date: October 11, 2006 |
8 | * | 8 | * |
9 | * mpi2_ioc.h Version: 02.00.21 | 9 | * mpi2_ioc.h Version: 02.00.22 |
10 | * | 10 | * |
11 | * Version History | 11 | * Version History |
12 | * --------------- | 12 | * --------------- |
@@ -118,6 +118,9 @@ | |||
118 | * MPI2_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE structure. | 118 | * MPI2_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE structure. |
119 | * Marked MPI2_PM_CONTROL_FEATURE_PCIE_LINK as obsolete. | 119 | * Marked MPI2_PM_CONTROL_FEATURE_PCIE_LINK as obsolete. |
120 | * 03-29-12 02.00.21 Added a product specific range to event values. | 120 | * 03-29-12 02.00.21 Added a product specific range to event values. |
121 | * 07-26-12 02.00.22 Added MPI2_IOCFACTS_EXCEPT_PARTIAL_MEMORY_FAILURE. | ||
122 | * Added ElapsedSeconds field to | ||
123 | * MPI2_EVENT_DATA_IR_OPERATION_STATUS. | ||
121 | * -------------------------------------------------------------------------- | 124 | * -------------------------------------------------------------------------- |
122 | */ | 125 | */ |
123 | 126 | ||
@@ -284,6 +287,7 @@ typedef struct _MPI2_IOC_FACTS_REPLY | |||
284 | #define MPI2_IOCFACTS_HDRVERSION_DEV_SHIFT (0) | 287 | #define MPI2_IOCFACTS_HDRVERSION_DEV_SHIFT (0) |
285 | 288 | ||
286 | /* IOCExceptions */ | 289 | /* IOCExceptions */ |
290 | #define MPI2_IOCFACTS_EXCEPT_PARTIAL_MEMORY_FAILURE (0x0200) | ||
287 | #define MPI2_IOCFACTS_EXCEPT_IR_FOREIGN_CONFIG_MAX (0x0100) | 291 | #define MPI2_IOCFACTS_EXCEPT_IR_FOREIGN_CONFIG_MAX (0x0100) |
288 | 292 | ||
289 | #define MPI2_IOCFACTS_EXCEPT_BOOTSTAT_MASK (0x00E0) | 293 | #define MPI2_IOCFACTS_EXCEPT_BOOTSTAT_MASK (0x00E0) |
@@ -624,7 +628,7 @@ typedef struct _MPI2_EVENT_DATA_IR_OPERATION_STATUS | |||
624 | U8 RAIDOperation; /* 0x04 */ | 628 | U8 RAIDOperation; /* 0x04 */ |
625 | U8 PercentComplete; /* 0x05 */ | 629 | U8 PercentComplete; /* 0x05 */ |
626 | U16 Reserved2; /* 0x06 */ | 630 | U16 Reserved2; /* 0x06 */ |
627 | U32 Resereved3; /* 0x08 */ | 631 | U32 ElapsedSeconds; /* 0x08 */ |
628 | } MPI2_EVENT_DATA_IR_OPERATION_STATUS, | 632 | } MPI2_EVENT_DATA_IR_OPERATION_STATUS, |
629 | MPI2_POINTER PTR_MPI2_EVENT_DATA_IR_OPERATION_STATUS, | 633 | MPI2_POINTER PTR_MPI2_EVENT_DATA_IR_OPERATION_STATUS, |
630 | Mpi2EventDataIrOperationStatus_t, | 634 | Mpi2EventDataIrOperationStatus_t, |
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_raid.h b/drivers/scsi/mpt2sas/mpi/mpi2_raid.h index 2b38af213beb..255b0ca219a4 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2_raid.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2_raid.h | |||
@@ -6,7 +6,7 @@ | |||
6 | * Title: MPI Integrated RAID messages and structures | 6 | * Title: MPI Integrated RAID messages and structures |
7 | * Creation Date: April 26, 2007 | 7 | * Creation Date: April 26, 2007 |
8 | * | 8 | * |
9 | * mpi2_raid.h Version: 02.00.08 | 9 | * mpi2_raid.h Version: 02.00.09 |
10 | * | 10 | * |
11 | * Version History | 11 | * Version History |
12 | * --------------- | 12 | * --------------- |
@@ -27,6 +27,8 @@ | |||
27 | * related structures and defines. | 27 | * related structures and defines. |
28 | * Added product-specific range to RAID Action values. | 28 | * Added product-specific range to RAID Action values. |
29 | * 02-06-12 02.00.08 Added MPI2_RAID_ACTION_PHYSDISK_HIDDEN. | 29 | * 02-06-12 02.00.08 Added MPI2_RAID_ACTION_PHYSDISK_HIDDEN. |
30 | * 07-26-12 02.00.09 Added ElapsedSeconds field to MPI2_RAID_VOL_INDICATOR. | ||
31 | * Added MPI2_RAID_VOL_FLAGS_ELAPSED_SECONDS_VALID define. | ||
30 | * -------------------------------------------------------------------------- | 32 | * -------------------------------------------------------------------------- |
31 | */ | 33 | */ |
32 | 34 | ||
@@ -276,10 +278,13 @@ typedef struct _MPI2_RAID_VOL_INDICATOR | |||
276 | U64 TotalBlocks; /* 0x00 */ | 278 | U64 TotalBlocks; /* 0x00 */ |
277 | U64 BlocksRemaining; /* 0x08 */ | 279 | U64 BlocksRemaining; /* 0x08 */ |
278 | U32 Flags; /* 0x10 */ | 280 | U32 Flags; /* 0x10 */ |
281 | U32 ElapsedSeconds; /* 0x14 */ | ||
279 | } MPI2_RAID_VOL_INDICATOR, MPI2_POINTER PTR_MPI2_RAID_VOL_INDICATOR, | 282 | } MPI2_RAID_VOL_INDICATOR, MPI2_POINTER PTR_MPI2_RAID_VOL_INDICATOR, |
280 | Mpi2RaidVolIndicator_t, MPI2_POINTER pMpi2RaidVolIndicator_t; | 283 | Mpi2RaidVolIndicator_t, MPI2_POINTER pMpi2RaidVolIndicator_t; |
281 | 284 | ||
282 | /* defines for RAID Volume Indicator Flags field */ | 285 | /* defines for RAID Volume Indicator Flags field */ |
286 | #define MPI2_RAID_VOL_FLAGS_ELAPSED_SECONDS_VALID (0x80000000) | ||
287 | |||
283 | #define MPI2_RAID_VOL_FLAGS_OP_MASK (0x0000000F) | 288 | #define MPI2_RAID_VOL_FLAGS_OP_MASK (0x0000000F) |
284 | #define MPI2_RAID_VOL_FLAGS_OP_BACKGROUND_INIT (0x00000000) | 289 | #define MPI2_RAID_VOL_FLAGS_OP_BACKGROUND_INIT (0x00000000) |
285 | #define MPI2_RAID_VOL_FLAGS_OP_ONLINE_CAP_EXPANSION (0x00000001) | 290 | #define MPI2_RAID_VOL_FLAGS_OP_ONLINE_CAP_EXPANSION (0x00000001) |
@@ -320,7 +325,7 @@ MPI2_POINTER pMpi2RaidCompatibilityResultStruct_t; | |||
320 | /* RAID Action Reply ActionData union */ | 325 | /* RAID Action Reply ActionData union */ |
321 | typedef union _MPI2_RAID_ACTION_REPLY_DATA | 326 | typedef union _MPI2_RAID_ACTION_REPLY_DATA |
322 | { | 327 | { |
323 | U32 Word[5]; | 328 | U32 Word[6]; |
324 | MPI2_RAID_VOL_INDICATOR RaidVolumeIndicator; | 329 | MPI2_RAID_VOL_INDICATOR RaidVolumeIndicator; |
325 | U16 VolDevHandle; | 330 | U16 VolDevHandle; |
326 | U8 VolumeState; | 331 | U8 VolumeState; |
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_tool.h b/drivers/scsi/mpt2sas/mpi/mpi2_tool.h index 3cbe677c6886..67c387f10e59 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2_tool.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2_tool.h | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2010 LSI Corporation. | 2 | * Copyright (c) 2000-2012 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi2_tool.h | 5 | * Name: mpi2_tool.h |
6 | * Title: MPI diagnostic tool structures and definitions | 6 | * Title: MPI diagnostic tool structures and definitions |
7 | * Creation Date: March 26, 2007 | 7 | * Creation Date: March 26, 2007 |
8 | * | 8 | * |
9 | * mpi2_tool.h Version: 02.00.07 | 9 | * mpi2_tool.h Version: 02.00.10 |
10 | * | 10 | * |
11 | * Version History | 11 | * Version History |
12 | * --------------- | 12 | * --------------- |
@@ -27,6 +27,8 @@ | |||
27 | * Post Request. | 27 | * Post Request. |
28 | * 05-25-11 02.00.07 Added Flags field and related defines to | 28 | * 05-25-11 02.00.07 Added Flags field and related defines to |
29 | * MPI2_TOOLBOX_ISTWI_READ_WRITE_REQUEST. | 29 | * MPI2_TOOLBOX_ISTWI_READ_WRITE_REQUEST. |
30 | * 07-26-12 02.00.10 Modified MPI2_TOOLBOX_DIAGNOSTIC_CLI_REQUEST so that | ||
31 | * it uses MPI Chain SGE as well as MPI Simple SGE. | ||
30 | * -------------------------------------------------------------------------- | 32 | * -------------------------------------------------------------------------- |
31 | */ | 33 | */ |
32 | 34 | ||
@@ -270,7 +272,7 @@ typedef struct _MPI2_TOOLBOX_BEACON_REQUEST | |||
270 | 272 | ||
271 | #define MPI2_TOOLBOX_DIAG_CLI_CMD_LENGTH (0x5C) | 273 | #define MPI2_TOOLBOX_DIAG_CLI_CMD_LENGTH (0x5C) |
272 | 274 | ||
273 | /* Toolbox Diagnostic CLI Tool request message */ | 275 | /* MPI v2.0 Toolbox Diagnostic CLI Tool request message */ |
274 | typedef struct _MPI2_TOOLBOX_DIAGNOSTIC_CLI_REQUEST { | 276 | typedef struct _MPI2_TOOLBOX_DIAGNOSTIC_CLI_REQUEST { |
275 | U8 Tool; /* 0x00 */ | 277 | U8 Tool; /* 0x00 */ |
276 | U8 Reserved1; /* 0x01 */ | 278 | U8 Reserved1; /* 0x01 */ |
@@ -288,7 +290,7 @@ typedef struct _MPI2_TOOLBOX_DIAGNOSTIC_CLI_REQUEST { | |||
288 | U32 DataLength; /* 0x10 */ | 290 | U32 DataLength; /* 0x10 */ |
289 | U8 DiagnosticCliCommand | 291 | U8 DiagnosticCliCommand |
290 | [MPI2_TOOLBOX_DIAG_CLI_CMD_LENGTH]; /* 0x14 */ | 292 | [MPI2_TOOLBOX_DIAG_CLI_CMD_LENGTH]; /* 0x14 */ |
291 | MPI2_SGE_SIMPLE_UNION SGL; /* 0x70 */ | 293 | MPI2_MPI_SGE_IO_UNION SGL; /* 0x70 */ |
292 | } MPI2_TOOLBOX_DIAGNOSTIC_CLI_REQUEST, | 294 | } MPI2_TOOLBOX_DIAGNOSTIC_CLI_REQUEST, |
293 | MPI2_POINTER PTR_MPI2_TOOLBOX_DIAGNOSTIC_CLI_REQUEST, | 295 | MPI2_POINTER PTR_MPI2_TOOLBOX_DIAGNOSTIC_CLI_REQUEST, |
294 | Mpi2ToolboxDiagnosticCliRequest_t, | 296 | Mpi2ToolboxDiagnosticCliRequest_t, |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index bcb23d28b3e8..ccd6d5a97ec3 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c | |||
@@ -80,10 +80,6 @@ static int msix_disable = -1; | |||
80 | module_param(msix_disable, int, 0); | 80 | module_param(msix_disable, int, 0); |
81 | MODULE_PARM_DESC(msix_disable, " disable msix routed interrupts (default=0)"); | 81 | MODULE_PARM_DESC(msix_disable, " disable msix routed interrupts (default=0)"); |
82 | 82 | ||
83 | static int missing_delay[2] = {-1, -1}; | ||
84 | module_param_array(missing_delay, int, NULL, 0); | ||
85 | MODULE_PARM_DESC(missing_delay, " device missing delay , io missing delay"); | ||
86 | |||
87 | static int mpt2sas_fwfault_debug; | 83 | static int mpt2sas_fwfault_debug; |
88 | MODULE_PARM_DESC(mpt2sas_fwfault_debug, " enable detection of firmware fault " | 84 | MODULE_PARM_DESC(mpt2sas_fwfault_debug, " enable detection of firmware fault " |
89 | "and halt firmware - (default=0)"); | 85 | "and halt firmware - (default=0)"); |
@@ -2199,7 +2195,7 @@ _base_display_ioc_capabilities(struct MPT2SAS_ADAPTER *ioc) | |||
2199 | } | 2195 | } |
2200 | 2196 | ||
2201 | /** | 2197 | /** |
2202 | * _base_update_missing_delay - change the missing delay timers | 2198 | * mpt2sas_base_update_missing_delay - change the missing delay timers |
2203 | * @ioc: per adapter object | 2199 | * @ioc: per adapter object |
2204 | * @device_missing_delay: amount of time till device is reported missing | 2200 | * @device_missing_delay: amount of time till device is reported missing |
2205 | * @io_missing_delay: interval IO is returned when there is a missing device | 2201 | * @io_missing_delay: interval IO is returned when there is a missing device |
@@ -2210,8 +2206,8 @@ _base_display_ioc_capabilities(struct MPT2SAS_ADAPTER *ioc) | |||
2210 | * delay, as well as the io missing delay. This should be called at driver | 2206 | * delay, as well as the io missing delay. This should be called at driver |
2211 | * load time. | 2207 | * load time. |
2212 | */ | 2208 | */ |
2213 | static void | 2209 | void |
2214 | _base_update_missing_delay(struct MPT2SAS_ADAPTER *ioc, | 2210 | mpt2sas_base_update_missing_delay(struct MPT2SAS_ADAPTER *ioc, |
2215 | u16 device_missing_delay, u8 io_missing_delay) | 2211 | u16 device_missing_delay, u8 io_missing_delay) |
2216 | { | 2212 | { |
2217 | u16 dmd, dmd_new, dmd_orignal; | 2213 | u16 dmd, dmd_new, dmd_orignal; |
@@ -2507,23 +2503,25 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
2507 | /* reply free queue sizing - taking into account for 64 FW events */ | 2503 | /* reply free queue sizing - taking into account for 64 FW events */ |
2508 | ioc->reply_free_queue_depth = ioc->hba_queue_depth + 64; | 2504 | ioc->reply_free_queue_depth = ioc->hba_queue_depth + 64; |
2509 | 2505 | ||
2506 | /* calculate reply descriptor post queue depth */ | ||
2507 | ioc->reply_post_queue_depth = ioc->hba_queue_depth + | ||
2508 | ioc->reply_free_queue_depth + 1; | ||
2510 | /* align the reply post queue on the next 16 count boundary */ | 2509 | /* align the reply post queue on the next 16 count boundary */ |
2511 | if (!ioc->reply_free_queue_depth % 16) | 2510 | if (ioc->reply_post_queue_depth % 16) |
2512 | ioc->reply_post_queue_depth = ioc->reply_free_queue_depth + 16; | 2511 | ioc->reply_post_queue_depth += 16 - |
2513 | else | 2512 | (ioc->reply_post_queue_depth % 16); |
2514 | ioc->reply_post_queue_depth = ioc->reply_free_queue_depth + | 2513 | |
2515 | 32 - (ioc->reply_free_queue_depth % 16); | 2514 | |
2516 | if (ioc->reply_post_queue_depth > | 2515 | if (ioc->reply_post_queue_depth > |
2517 | facts->MaxReplyDescriptorPostQueueDepth) { | 2516 | facts->MaxReplyDescriptorPostQueueDepth) { |
2518 | ioc->reply_post_queue_depth = min_t(u16, | 2517 | ioc->reply_post_queue_depth = |
2519 | (facts->MaxReplyDescriptorPostQueueDepth - | 2518 | facts->MaxReplyDescriptorPostQueueDepth - |
2520 | (facts->MaxReplyDescriptorPostQueueDepth % 16)), | 2519 | (facts->MaxReplyDescriptorPostQueueDepth % 16); |
2521 | (ioc->hba_queue_depth - (ioc->hba_queue_depth % 16))); | 2520 | ioc->hba_queue_depth = |
2522 | ioc->reply_free_queue_depth = ioc->reply_post_queue_depth - 16; | 2521 | ((ioc->reply_post_queue_depth - 64) / 2) - 1; |
2523 | ioc->hba_queue_depth = ioc->reply_free_queue_depth - 64; | 2522 | ioc->reply_free_queue_depth = ioc->hba_queue_depth + 64; |
2524 | } | 2523 | } |
2525 | 2524 | ||
2526 | |||
2527 | dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "scatter gather: " | 2525 | dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "scatter gather: " |
2528 | "sge_in_main_msg(%d), sge_per_chain(%d), sge_per_io(%d), " | 2526 | "sge_in_main_msg(%d), sge_per_chain(%d), sge_per_io(%d), " |
2529 | "chains_per_io(%d)\n", ioc->name, ioc->max_sges_in_main_message, | 2527 | "chains_per_io(%d)\n", ioc->name, ioc->max_sges_in_main_message, |
@@ -3940,11 +3938,15 @@ _base_diag_reset(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
3940 | writel(host_diagnostic | MPI2_DIAG_RESET_ADAPTER, | 3938 | writel(host_diagnostic | MPI2_DIAG_RESET_ADAPTER, |
3941 | &ioc->chip->HostDiagnostic); | 3939 | &ioc->chip->HostDiagnostic); |
3942 | 3940 | ||
3943 | /* don't access any registers for 50 milliseconds */ | 3941 | /* This delay allows the chip PCIe hardware time to finish reset tasks*/ |
3944 | msleep(50); | 3942 | if (sleep_flag == CAN_SLEEP) |
3943 | msleep(MPI2_HARD_RESET_PCIE_FIRST_READ_DELAY_MICRO_SEC/1000); | ||
3944 | else | ||
3945 | mdelay(MPI2_HARD_RESET_PCIE_FIRST_READ_DELAY_MICRO_SEC/1000); | ||
3945 | 3946 | ||
3946 | /* 300 second max wait */ | 3947 | /* Approximately 300 second max wait */ |
3947 | for (count = 0; count < 3000000 ; count++) { | 3948 | for (count = 0; count < (300000000 / |
3949 | MPI2_HARD_RESET_PCIE_SECOND_READ_DELAY_MICRO_SEC); count++) { | ||
3948 | 3950 | ||
3949 | host_diagnostic = readl(&ioc->chip->HostDiagnostic); | 3951 | host_diagnostic = readl(&ioc->chip->HostDiagnostic); |
3950 | 3952 | ||
@@ -3953,11 +3955,13 @@ _base_diag_reset(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
3953 | if (!(host_diagnostic & MPI2_DIAG_RESET_ADAPTER)) | 3955 | if (!(host_diagnostic & MPI2_DIAG_RESET_ADAPTER)) |
3954 | break; | 3956 | break; |
3955 | 3957 | ||
3956 | /* wait 100 msec */ | 3958 | /* Wait to pass the second read delay window */ |
3957 | if (sleep_flag == CAN_SLEEP) | 3959 | if (sleep_flag == CAN_SLEEP) |
3958 | msleep(1); | 3960 | msleep(MPI2_HARD_RESET_PCIE_SECOND_READ_DELAY_MICRO_SEC |
3961 | /1000); | ||
3959 | else | 3962 | else |
3960 | mdelay(1); | 3963 | mdelay(MPI2_HARD_RESET_PCIE_SECOND_READ_DELAY_MICRO_SEC |
3964 | /1000); | ||
3961 | } | 3965 | } |
3962 | 3966 | ||
3963 | if (host_diagnostic & MPI2_DIAG_HCB_MODE) { | 3967 | if (host_diagnostic & MPI2_DIAG_HCB_MODE) { |
@@ -4407,9 +4411,6 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) | |||
4407 | if (r) | 4411 | if (r) |
4408 | goto out_free_resources; | 4412 | goto out_free_resources; |
4409 | 4413 | ||
4410 | if (missing_delay[0] != -1 && missing_delay[1] != -1) | ||
4411 | _base_update_missing_delay(ioc, missing_delay[0], | ||
4412 | missing_delay[1]); | ||
4413 | ioc->non_operational_loop = 0; | 4414 | ioc->non_operational_loop = 0; |
4414 | 4415 | ||
4415 | return 0; | 4416 | return 0; |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h index 4caaac13682f..6fbd08417773 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h | |||
@@ -69,8 +69,8 @@ | |||
69 | #define MPT2SAS_DRIVER_NAME "mpt2sas" | 69 | #define MPT2SAS_DRIVER_NAME "mpt2sas" |
70 | #define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>" | 70 | #define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>" |
71 | #define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver" | 71 | #define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver" |
72 | #define MPT2SAS_DRIVER_VERSION "14.100.00.00" | 72 | #define MPT2SAS_DRIVER_VERSION "15.100.00.00" |
73 | #define MPT2SAS_MAJOR_VERSION 14 | 73 | #define MPT2SAS_MAJOR_VERSION 15 |
74 | #define MPT2SAS_MINOR_VERSION 100 | 74 | #define MPT2SAS_MINOR_VERSION 100 |
75 | #define MPT2SAS_BUILD_VERSION 00 | 75 | #define MPT2SAS_BUILD_VERSION 00 |
76 | #define MPT2SAS_RELEASE_VERSION 00 | 76 | #define MPT2SAS_RELEASE_VERSION 00 |
@@ -1055,6 +1055,9 @@ void mpt2sas_base_validate_event_type(struct MPT2SAS_ADAPTER *ioc, u32 *event_ty | |||
1055 | 1055 | ||
1056 | void mpt2sas_halt_firmware(struct MPT2SAS_ADAPTER *ioc); | 1056 | void mpt2sas_halt_firmware(struct MPT2SAS_ADAPTER *ioc); |
1057 | 1057 | ||
1058 | void mpt2sas_base_update_missing_delay(struct MPT2SAS_ADAPTER *ioc, | ||
1059 | u16 device_missing_delay, u8 io_missing_delay); | ||
1060 | |||
1058 | int mpt2sas_port_enable(struct MPT2SAS_ADAPTER *ioc); | 1061 | int mpt2sas_port_enable(struct MPT2SAS_ADAPTER *ioc); |
1059 | 1062 | ||
1060 | /* scsih shared API */ | 1063 | /* scsih shared API */ |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index c6bdc9267229..51004768d0f5 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c | |||
@@ -101,6 +101,10 @@ static ushort max_sectors = 0xFFFF; | |||
101 | module_param(max_sectors, ushort, 0); | 101 | module_param(max_sectors, ushort, 0); |
102 | MODULE_PARM_DESC(max_sectors, "max sectors, range 64 to 32767 default=32767"); | 102 | MODULE_PARM_DESC(max_sectors, "max sectors, range 64 to 32767 default=32767"); |
103 | 103 | ||
104 | static int missing_delay[2] = {-1, -1}; | ||
105 | module_param_array(missing_delay, int, NULL, 0); | ||
106 | MODULE_PARM_DESC(missing_delay, " device missing delay , io missing delay"); | ||
107 | |||
104 | /* scsi-mid layer global parmeter is max_report_luns, which is 511 */ | 108 | /* scsi-mid layer global parmeter is max_report_luns, which is 511 */ |
105 | #define MPT2SAS_MAX_LUN (16895) | 109 | #define MPT2SAS_MAX_LUN (16895) |
106 | static int max_lun = MPT2SAS_MAX_LUN; | 110 | static int max_lun = MPT2SAS_MAX_LUN; |
@@ -3994,11 +3998,7 @@ _scsih_qcmd_lck(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *)) | |||
3994 | else | 3998 | else |
3995 | mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ; | 3999 | mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ; |
3996 | } else | 4000 | } else |
3997 | /* MPI Revision I (UNIT = 0xA) - removed MPI2_SCSIIO_CONTROL_UNTAGGED */ | 4001 | mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ; |
3998 | /* mpi_control |= MPI2_SCSIIO_CONTROL_UNTAGGED; | ||
3999 | */ | ||
4000 | mpi_control |= (0x500); | ||
4001 | |||
4002 | } else | 4002 | } else |
4003 | mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ; | 4003 | mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ; |
4004 | /* Make sure Device is not raid volume. | 4004 | /* Make sure Device is not raid volume. |
@@ -5815,9 +5815,10 @@ _scsih_sas_broadcast_primitive_event(struct MPT2SAS_ADAPTER *ioc, | |||
5815 | u8 task_abort_retries; | 5815 | u8 task_abort_retries; |
5816 | 5816 | ||
5817 | mutex_lock(&ioc->tm_cmds.mutex); | 5817 | mutex_lock(&ioc->tm_cmds.mutex); |
5818 | dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter: phy number(%d), " | 5818 | pr_info(MPT2SAS_FMT |
5819 | "width(%d)\n", ioc->name, __func__, event_data->PhyNum, | 5819 | "%s: enter: phy number(%d), width(%d)\n", |
5820 | event_data->PortWidth)); | 5820 | ioc->name, __func__, event_data->PhyNum, |
5821 | event_data->PortWidth); | ||
5821 | 5822 | ||
5822 | _scsih_block_io_all_device(ioc); | 5823 | _scsih_block_io_all_device(ioc); |
5823 | 5824 | ||
@@ -7093,12 +7094,15 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc) | |||
7093 | struct _sas_device *sas_device; | 7094 | struct _sas_device *sas_device; |
7094 | struct _sas_node *expander_device; | 7095 | struct _sas_node *expander_device; |
7095 | static struct _raid_device *raid_device; | 7096 | static struct _raid_device *raid_device; |
7097 | u8 retry_count; | ||
7096 | unsigned long flags; | 7098 | unsigned long flags; |
7097 | 7099 | ||
7098 | printk(MPT2SAS_INFO_FMT "scan devices: start\n", ioc->name); | 7100 | printk(MPT2SAS_INFO_FMT "scan devices: start\n", ioc->name); |
7099 | 7101 | ||
7100 | _scsih_sas_host_refresh(ioc); | 7102 | _scsih_sas_host_refresh(ioc); |
7101 | 7103 | ||
7104 | printk(MPT2SAS_INFO_FMT "\tscan devices: expanders start\n", | ||
7105 | ioc->name); | ||
7102 | /* expanders */ | 7106 | /* expanders */ |
7103 | handle = 0xFFFF; | 7107 | handle = 0xFFFF; |
7104 | while (!(mpt2sas_config_get_expander_pg0(ioc, &mpi_reply, &expander_pg0, | 7108 | while (!(mpt2sas_config_get_expander_pg0(ioc, &mpi_reply, &expander_pg0, |
@@ -7107,6 +7111,13 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc) | |||
7107 | MPI2_IOCSTATUS_MASK; | 7111 | MPI2_IOCSTATUS_MASK; |
7108 | if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) | 7112 | if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) |
7109 | break; | 7113 | break; |
7114 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { | ||
7115 | printk(MPT2SAS_INFO_FMT "\tbreak from expander scan: " | ||
7116 | "ioc_status(0x%04x), loginfo(0x%08x)\n", | ||
7117 | ioc->name, ioc_status, | ||
7118 | le32_to_cpu(mpi_reply.IOCLogInfo)); | ||
7119 | break; | ||
7120 | } | ||
7110 | handle = le16_to_cpu(expander_pg0.DevHandle); | 7121 | handle = le16_to_cpu(expander_pg0.DevHandle); |
7111 | spin_lock_irqsave(&ioc->sas_node_lock, flags); | 7122 | spin_lock_irqsave(&ioc->sas_node_lock, flags); |
7112 | expander_device = mpt2sas_scsih_expander_find_by_sas_address( | 7123 | expander_device = mpt2sas_scsih_expander_find_by_sas_address( |
@@ -7115,13 +7126,26 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc) | |||
7115 | if (expander_device) | 7126 | if (expander_device) |
7116 | _scsih_refresh_expander_links(ioc, expander_device, | 7127 | _scsih_refresh_expander_links(ioc, expander_device, |
7117 | handle); | 7128 | handle); |
7118 | else | 7129 | else { |
7130 | printk(MPT2SAS_INFO_FMT "\tBEFORE adding expander: " | ||
7131 | "handle (0x%04x), sas_addr(0x%016llx)\n", | ||
7132 | ioc->name, handle, (unsigned long long) | ||
7133 | le64_to_cpu(expander_pg0.SASAddress)); | ||
7119 | _scsih_expander_add(ioc, handle); | 7134 | _scsih_expander_add(ioc, handle); |
7135 | printk(MPT2SAS_INFO_FMT "\tAFTER adding expander: " | ||
7136 | "handle (0x%04x), sas_addr(0x%016llx)\n", | ||
7137 | ioc->name, handle, (unsigned long long) | ||
7138 | le64_to_cpu(expander_pg0.SASAddress)); | ||
7139 | } | ||
7120 | } | 7140 | } |
7121 | 7141 | ||
7142 | printk(MPT2SAS_INFO_FMT "\tscan devices: expanders complete\n", | ||
7143 | ioc->name); | ||
7144 | |||
7122 | if (!ioc->ir_firmware) | 7145 | if (!ioc->ir_firmware) |
7123 | goto skip_to_sas; | 7146 | goto skip_to_sas; |
7124 | 7147 | ||
7148 | printk(MPT2SAS_INFO_FMT "\tscan devices phys disk start\n", ioc->name); | ||
7125 | /* phys disk */ | 7149 | /* phys disk */ |
7126 | phys_disk_num = 0xFF; | 7150 | phys_disk_num = 0xFF; |
7127 | while (!(mpt2sas_config_get_phys_disk_pg0(ioc, &mpi_reply, | 7151 | while (!(mpt2sas_config_get_phys_disk_pg0(ioc, &mpi_reply, |
@@ -7131,6 +7155,13 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc) | |||
7131 | MPI2_IOCSTATUS_MASK; | 7155 | MPI2_IOCSTATUS_MASK; |
7132 | if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) | 7156 | if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) |
7133 | break; | 7157 | break; |
7158 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { | ||
7159 | printk(MPT2SAS_INFO_FMT "\tbreak from phys disk scan:" | ||
7160 | "ioc_status(0x%04x), loginfo(0x%08x)\n", | ||
7161 | ioc->name, ioc_status, | ||
7162 | le32_to_cpu(mpi_reply.IOCLogInfo)); | ||
7163 | break; | ||
7164 | } | ||
7134 | phys_disk_num = pd_pg0.PhysDiskNum; | 7165 | phys_disk_num = pd_pg0.PhysDiskNum; |
7135 | handle = le16_to_cpu(pd_pg0.DevHandle); | 7166 | handle = le16_to_cpu(pd_pg0.DevHandle); |
7136 | spin_lock_irqsave(&ioc->sas_device_lock, flags); | 7167 | spin_lock_irqsave(&ioc->sas_device_lock, flags); |
@@ -7142,17 +7173,46 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc) | |||
7142 | &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, | 7173 | &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, |
7143 | handle) != 0) | 7174 | handle) != 0) |
7144 | continue; | 7175 | continue; |
7176 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & | ||
7177 | MPI2_IOCSTATUS_MASK; | ||
7178 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { | ||
7179 | printk(MPT2SAS_INFO_FMT "\tbreak from phys disk scan " | ||
7180 | "ioc_status(0x%04x), loginfo(0x%08x)\n", | ||
7181 | ioc->name, ioc_status, | ||
7182 | le32_to_cpu(mpi_reply.IOCLogInfo)); | ||
7183 | break; | ||
7184 | } | ||
7145 | parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle); | 7185 | parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle); |
7146 | if (!_scsih_get_sas_address(ioc, parent_handle, | 7186 | if (!_scsih_get_sas_address(ioc, parent_handle, |
7147 | &sas_address)) { | 7187 | &sas_address)) { |
7188 | printk(MPT2SAS_INFO_FMT "\tBEFORE adding phys disk: " | ||
7189 | " handle (0x%04x), sas_addr(0x%016llx)\n", | ||
7190 | ioc->name, handle, (unsigned long long) | ||
7191 | le64_to_cpu(sas_device_pg0.SASAddress)); | ||
7148 | mpt2sas_transport_update_links(ioc, sas_address, | 7192 | mpt2sas_transport_update_links(ioc, sas_address, |
7149 | handle, sas_device_pg0.PhyNum, | 7193 | handle, sas_device_pg0.PhyNum, |
7150 | MPI2_SAS_NEG_LINK_RATE_1_5); | 7194 | MPI2_SAS_NEG_LINK_RATE_1_5); |
7151 | set_bit(handle, ioc->pd_handles); | 7195 | set_bit(handle, ioc->pd_handles); |
7152 | _scsih_add_device(ioc, handle, 0, 1); | 7196 | retry_count = 0; |
7197 | /* This will retry adding the end device. | ||
7198 | * _scsih_add_device() will decide on retries and | ||
7199 | * return "1" when it should be retried | ||
7200 | */ | ||
7201 | while (_scsih_add_device(ioc, handle, retry_count++, | ||
7202 | 1)) { | ||
7203 | ssleep(1); | ||
7204 | } | ||
7205 | printk(MPT2SAS_INFO_FMT "\tAFTER adding phys disk: " | ||
7206 | " handle (0x%04x), sas_addr(0x%016llx)\n", | ||
7207 | ioc->name, handle, (unsigned long long) | ||
7208 | le64_to_cpu(sas_device_pg0.SASAddress)); | ||
7153 | } | 7209 | } |
7154 | } | 7210 | } |
7155 | 7211 | ||
7212 | printk(MPT2SAS_INFO_FMT "\tscan devices: phys disk complete\n", | ||
7213 | ioc->name); | ||
7214 | |||
7215 | printk(MPT2SAS_INFO_FMT "\tscan devices: volumes start\n", ioc->name); | ||
7156 | /* volumes */ | 7216 | /* volumes */ |
7157 | handle = 0xFFFF; | 7217 | handle = 0xFFFF; |
7158 | while (!(mpt2sas_config_get_raid_volume_pg1(ioc, &mpi_reply, | 7218 | while (!(mpt2sas_config_get_raid_volume_pg1(ioc, &mpi_reply, |
@@ -7161,6 +7221,13 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc) | |||
7161 | MPI2_IOCSTATUS_MASK; | 7221 | MPI2_IOCSTATUS_MASK; |
7162 | if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) | 7222 | if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) |
7163 | break; | 7223 | break; |
7224 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { | ||
7225 | printk(MPT2SAS_INFO_FMT "\tbreak from volume scan: " | ||
7226 | "ioc_status(0x%04x), loginfo(0x%08x)\n", | ||
7227 | ioc->name, ioc_status, | ||
7228 | le32_to_cpu(mpi_reply.IOCLogInfo)); | ||
7229 | break; | ||
7230 | } | ||
7164 | handle = le16_to_cpu(volume_pg1.DevHandle); | 7231 | handle = le16_to_cpu(volume_pg1.DevHandle); |
7165 | spin_lock_irqsave(&ioc->raid_device_lock, flags); | 7232 | spin_lock_irqsave(&ioc->raid_device_lock, flags); |
7166 | raid_device = _scsih_raid_device_find_by_wwid(ioc, | 7233 | raid_device = _scsih_raid_device_find_by_wwid(ioc, |
@@ -7172,18 +7239,38 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc) | |||
7172 | &volume_pg0, MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle, | 7239 | &volume_pg0, MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle, |
7173 | sizeof(Mpi2RaidVolPage0_t))) | 7240 | sizeof(Mpi2RaidVolPage0_t))) |
7174 | continue; | 7241 | continue; |
7242 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & | ||
7243 | MPI2_IOCSTATUS_MASK; | ||
7244 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { | ||
7245 | printk(MPT2SAS_INFO_FMT "\tbreak from volume scan: " | ||
7246 | "ioc_status(0x%04x), loginfo(0x%08x)\n", | ||
7247 | ioc->name, ioc_status, | ||
7248 | le32_to_cpu(mpi_reply.IOCLogInfo)); | ||
7249 | break; | ||
7250 | } | ||
7175 | if (volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_OPTIMAL || | 7251 | if (volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_OPTIMAL || |
7176 | volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_ONLINE || | 7252 | volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_ONLINE || |
7177 | volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_DEGRADED) { | 7253 | volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_DEGRADED) { |
7178 | memset(&element, 0, sizeof(Mpi2EventIrConfigElement_t)); | 7254 | memset(&element, 0, sizeof(Mpi2EventIrConfigElement_t)); |
7179 | element.ReasonCode = MPI2_EVENT_IR_CHANGE_RC_ADDED; | 7255 | element.ReasonCode = MPI2_EVENT_IR_CHANGE_RC_ADDED; |
7180 | element.VolDevHandle = volume_pg1.DevHandle; | 7256 | element.VolDevHandle = volume_pg1.DevHandle; |
7257 | printk(MPT2SAS_INFO_FMT "\tBEFORE adding volume: " | ||
7258 | " handle (0x%04x)\n", ioc->name, | ||
7259 | volume_pg1.DevHandle); | ||
7181 | _scsih_sas_volume_add(ioc, &element); | 7260 | _scsih_sas_volume_add(ioc, &element); |
7261 | printk(MPT2SAS_INFO_FMT "\tAFTER adding volume: " | ||
7262 | " handle (0x%04x)\n", ioc->name, | ||
7263 | volume_pg1.DevHandle); | ||
7182 | } | 7264 | } |
7183 | } | 7265 | } |
7184 | 7266 | ||
7267 | printk(MPT2SAS_INFO_FMT "\tscan devices: volumes complete\n", | ||
7268 | ioc->name); | ||
7269 | |||
7185 | skip_to_sas: | 7270 | skip_to_sas: |
7186 | 7271 | ||
7272 | printk(MPT2SAS_INFO_FMT "\tscan devices: end devices start\n", | ||
7273 | ioc->name); | ||
7187 | /* sas devices */ | 7274 | /* sas devices */ |
7188 | handle = 0xFFFF; | 7275 | handle = 0xFFFF; |
7189 | while (!(mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply, | 7276 | while (!(mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply, |
@@ -7193,6 +7280,13 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc) | |||
7193 | MPI2_IOCSTATUS_MASK; | 7280 | MPI2_IOCSTATUS_MASK; |
7194 | if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) | 7281 | if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) |
7195 | break; | 7282 | break; |
7283 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { | ||
7284 | printk(MPT2SAS_INFO_FMT "\tbreak from end device scan:" | ||
7285 | " ioc_status(0x%04x), loginfo(0x%08x)\n", | ||
7286 | ioc->name, ioc_status, | ||
7287 | le32_to_cpu(mpi_reply.IOCLogInfo)); | ||
7288 | break; | ||
7289 | } | ||
7196 | handle = le16_to_cpu(sas_device_pg0.DevHandle); | 7290 | handle = le16_to_cpu(sas_device_pg0.DevHandle); |
7197 | if (!(_scsih_is_end_device( | 7291 | if (!(_scsih_is_end_device( |
7198 | le32_to_cpu(sas_device_pg0.DeviceInfo)))) | 7292 | le32_to_cpu(sas_device_pg0.DeviceInfo)))) |
@@ -7205,12 +7299,31 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc) | |||
7205 | continue; | 7299 | continue; |
7206 | parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle); | 7300 | parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle); |
7207 | if (!_scsih_get_sas_address(ioc, parent_handle, &sas_address)) { | 7301 | if (!_scsih_get_sas_address(ioc, parent_handle, &sas_address)) { |
7302 | printk(MPT2SAS_INFO_FMT "\tBEFORE adding end device: " | ||
7303 | "handle (0x%04x), sas_addr(0x%016llx)\n", | ||
7304 | ioc->name, handle, (unsigned long long) | ||
7305 | le64_to_cpu(sas_device_pg0.SASAddress)); | ||
7208 | mpt2sas_transport_update_links(ioc, sas_address, handle, | 7306 | mpt2sas_transport_update_links(ioc, sas_address, handle, |
7209 | sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5); | 7307 | sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5); |
7210 | _scsih_add_device(ioc, handle, 0, 0); | 7308 | retry_count = 0; |
7309 | /* This will retry adding the end device. | ||
7310 | * _scsih_add_device() will decide on retries and | ||
7311 | * return "1" when it should be retried | ||
7312 | */ | ||
7313 | while (_scsih_add_device(ioc, handle, retry_count++, | ||
7314 | 0)) { | ||
7315 | ssleep(1); | ||
7316 | } | ||
7317 | printk(MPT2SAS_INFO_FMT "\tAFTER adding end device: " | ||
7318 | "handle (0x%04x), sas_addr(0x%016llx)\n", | ||
7319 | ioc->name, handle, (unsigned long long) | ||
7320 | le64_to_cpu(sas_device_pg0.SASAddress)); | ||
7211 | } | 7321 | } |
7212 | } | 7322 | } |
7213 | 7323 | ||
7324 | printk(MPT2SAS_INFO_FMT "\tscan devices: end devices complete\n", | ||
7325 | ioc->name); | ||
7326 | |||
7214 | printk(MPT2SAS_INFO_FMT "scan devices: complete\n", ioc->name); | 7327 | printk(MPT2SAS_INFO_FMT "scan devices: complete\n", ioc->name); |
7215 | } | 7328 | } |
7216 | 7329 | ||
@@ -7303,7 +7416,9 @@ _firmware_event_work(struct work_struct *work) | |||
7303 | case MPT2SAS_PORT_ENABLE_COMPLETE: | 7416 | case MPT2SAS_PORT_ENABLE_COMPLETE: |
7304 | ioc->start_scan = 0; | 7417 | ioc->start_scan = 0; |
7305 | 7418 | ||
7306 | 7419 | if (missing_delay[0] != -1 && missing_delay[1] != -1) | |
7420 | mpt2sas_base_update_missing_delay(ioc, missing_delay[0], | ||
7421 | missing_delay[1]); | ||
7307 | 7422 | ||
7308 | dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "port enable: complete " | 7423 | dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "port enable: complete " |
7309 | "from worker thread\n", ioc->name)); | 7424 | "from worker thread\n", ioc->name)); |
@@ -8070,8 +8185,8 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
8070 | if (max_sectors != 0xFFFF) { | 8185 | if (max_sectors != 0xFFFF) { |
8071 | if (max_sectors < 64) { | 8186 | if (max_sectors < 64) { |
8072 | shost->max_sectors = 64; | 8187 | shost->max_sectors = 64; |
8073 | printk(MPT2SAS_WARN_FMT "Invalid value %d passed "\ | 8188 | printk(MPT2SAS_WARN_FMT "Invalid value %d passed " |
8074 | "for max_sectors, range is 64 to 32767. Assigning "\ | 8189 | "for max_sectors, range is 64 to 32767. Assigning " |
8075 | "value of 64.\n", ioc->name, max_sectors); | 8190 | "value of 64.\n", ioc->name, max_sectors); |
8076 | } else if (max_sectors > 32767) { | 8191 | } else if (max_sectors > 32767) { |
8077 | shost->max_sectors = 32767; | 8192 | shost->max_sectors = 32767; |
diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c index c9e244984e30..f14665a6293d 100644 --- a/drivers/scsi/mvsas/mv_sas.c +++ b/drivers/scsi/mvsas/mv_sas.c | |||
@@ -686,7 +686,8 @@ static int mvs_task_prep_ssp(struct mvs_info *mvi, | |||
686 | if (ssp_hdr->frame_type != SSP_TASK) { | 686 | if (ssp_hdr->frame_type != SSP_TASK) { |
687 | buf_cmd[9] = fburst | task->ssp_task.task_attr | | 687 | buf_cmd[9] = fburst | task->ssp_task.task_attr | |
688 | (task->ssp_task.task_prio << 3); | 688 | (task->ssp_task.task_prio << 3); |
689 | memcpy(buf_cmd + 12, &task->ssp_task.cdb, 16); | 689 | memcpy(buf_cmd + 12, task->ssp_task.cmd->cmnd, |
690 | task->ssp_task.cmd->cmd_len); | ||
690 | } else{ | 691 | } else{ |
691 | buf_cmd[10] = tmf->tmf; | 692 | buf_cmd[10] = tmf->tmf; |
692 | switch (tmf->tmf) { | 693 | switch (tmf->tmf) { |
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 69dd49c05f1e..5456f5c73593 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c | |||
@@ -3740,7 +3740,7 @@ int pm8001_mpi_task_abort_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
3740 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 3740 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
3741 | mb(); | 3741 | mb(); |
3742 | 3742 | ||
3743 | if ((pm8001_dev->id & NCQ_ABORT_ALL_FLAG) && t) { | 3743 | if (pm8001_dev->id & NCQ_ABORT_ALL_FLAG) { |
3744 | pm8001_tag_free(pm8001_ha, tag); | 3744 | pm8001_tag_free(pm8001_ha, tag); |
3745 | sas_free_task(t); | 3745 | sas_free_task(t); |
3746 | /* clear the flag */ | 3746 | /* clear the flag */ |
@@ -4291,7 +4291,8 @@ static int pm8001_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, | |||
4291 | ssp_cmd.ssp_iu.efb_prio_attr |= 0x80; | 4291 | ssp_cmd.ssp_iu.efb_prio_attr |= 0x80; |
4292 | ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_prio << 3); | 4292 | ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_prio << 3); |
4293 | ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7); | 4293 | ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7); |
4294 | memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cdb, 16); | 4294 | memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd, |
4295 | task->ssp_task.cmd->cmd_len); | ||
4295 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; | 4296 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
4296 | 4297 | ||
4297 | /* fill in PRD (scatter/gather) table, if any */ | 4298 | /* fill in PRD (scatter/gather) table, if any */ |
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 1c5e7d233e78..7f77210f5cf3 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c | |||
@@ -3559,9 +3559,9 @@ err_out: | |||
3559 | 3559 | ||
3560 | static int check_enc_sas_cmd(struct sas_task *task) | 3560 | static int check_enc_sas_cmd(struct sas_task *task) |
3561 | { | 3561 | { |
3562 | if ((task->ssp_task.cdb[0] == READ_10) | 3562 | u8 cmd = task->ssp_task.cmd->cmnd[0]; |
3563 | || (task->ssp_task.cdb[0] == WRITE_10) | 3563 | |
3564 | || (task->ssp_task.cdb[0] == WRITE_VERIFY)) | 3564 | if (cmd == READ_10 || cmd == WRITE_10 || cmd == WRITE_VERIFY) |
3565 | return 1; | 3565 | return 1; |
3566 | else | 3566 | else |
3567 | return 0; | 3567 | return 0; |
@@ -3624,7 +3624,8 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, | |||
3624 | ssp_cmd.ssp_iu.efb_prio_attr |= 0x80; | 3624 | ssp_cmd.ssp_iu.efb_prio_attr |= 0x80; |
3625 | ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_prio << 3); | 3625 | ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_prio << 3); |
3626 | ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7); | 3626 | ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7); |
3627 | memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cdb, 16); | 3627 | memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd, |
3628 | task->ssp_task.cmd->cmd_len); | ||
3628 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; | 3629 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
3629 | 3630 | ||
3630 | /* Check if encryption is set */ | 3631 | /* Check if encryption is set */ |
@@ -3632,7 +3633,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, | |||
3632 | !(pm8001_ha->encrypt_info.status) && check_enc_sas_cmd(task)) { | 3633 | !(pm8001_ha->encrypt_info.status) && check_enc_sas_cmd(task)) { |
3633 | PM8001_IO_DBG(pm8001_ha, pm8001_printk( | 3634 | PM8001_IO_DBG(pm8001_ha, pm8001_printk( |
3634 | "Encryption enabled.Sending Encrypt SAS command 0x%x\n", | 3635 | "Encryption enabled.Sending Encrypt SAS command 0x%x\n", |
3635 | task->ssp_task.cdb[0])); | 3636 | task->ssp_task.cmd->cmnd[0])); |
3636 | opc = OPC_INB_SSP_INI_DIF_ENC_IO; | 3637 | opc = OPC_INB_SSP_INI_DIF_ENC_IO; |
3637 | /* enable encryption. 0 for SAS 1.1 and SAS 2.0 compatible TLR*/ | 3638 | /* enable encryption. 0 for SAS 1.1 and SAS 2.0 compatible TLR*/ |
3638 | ssp_cmd.dad_dir_m_tlr = cpu_to_le32 | 3639 | ssp_cmd.dad_dir_m_tlr = cpu_to_le32 |
@@ -3666,14 +3667,14 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, | |||
3666 | /* XTS mode. All other fields are 0 */ | 3667 | /* XTS mode. All other fields are 0 */ |
3667 | ssp_cmd.key_cmode = 0x6 << 4; | 3668 | ssp_cmd.key_cmode = 0x6 << 4; |
3668 | /* set tweak values. Should be the start lba */ | 3669 | /* set tweak values. Should be the start lba */ |
3669 | ssp_cmd.twk_val0 = cpu_to_le32((task->ssp_task.cdb[2] << 24) | | 3670 | ssp_cmd.twk_val0 = cpu_to_le32((task->ssp_task.cmd->cmnd[2] << 24) | |
3670 | (task->ssp_task.cdb[3] << 16) | | 3671 | (task->ssp_task.cmd->cmnd[3] << 16) | |
3671 | (task->ssp_task.cdb[4] << 8) | | 3672 | (task->ssp_task.cmd->cmnd[4] << 8) | |
3672 | (task->ssp_task.cdb[5])); | 3673 | (task->ssp_task.cmd->cmnd[5])); |
3673 | } else { | 3674 | } else { |
3674 | PM8001_IO_DBG(pm8001_ha, pm8001_printk( | 3675 | PM8001_IO_DBG(pm8001_ha, pm8001_printk( |
3675 | "Sending Normal SAS command 0x%x inb q %x\n", | 3676 | "Sending Normal SAS command 0x%x inb q %x\n", |
3676 | task->ssp_task.cdb[0], inb)); | 3677 | task->ssp_task.cmd->cmnd[0], inb)); |
3677 | /* fill in PRD (scatter/gather) table, if any */ | 3678 | /* fill in PRD (scatter/gather) table, if any */ |
3678 | if (task->num_scatter > 1) { | 3679 | if (task->num_scatter > 1) { |
3679 | pm8001_chip_make_sg(task->scatter, ccb->n_elem, | 3680 | pm8001_chip_make_sg(task->scatter, ccb->n_elem, |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 2c0d0ec8150b..3b1ea34e1f5a 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -1070,8 +1070,8 @@ EXPORT_SYMBOL_GPL(scsi_get_vpd_page); | |||
1070 | * @opcode: opcode for command to look up | 1070 | * @opcode: opcode for command to look up |
1071 | * | 1071 | * |
1072 | * Uses the REPORT SUPPORTED OPERATION CODES to look up the given | 1072 | * Uses the REPORT SUPPORTED OPERATION CODES to look up the given |
1073 | * opcode. Returns 0 if RSOC fails or if the command opcode is | 1073 | * opcode. Returns -EINVAL if RSOC fails, 0 if the command opcode is |
1074 | * unsupported. Returns 1 if the device claims to support the command. | 1074 | * unsupported and 1 if the device claims to support the command. |
1075 | */ | 1075 | */ |
1076 | int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer, | 1076 | int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer, |
1077 | unsigned int len, unsigned char opcode) | 1077 | unsigned int len, unsigned char opcode) |
@@ -1081,7 +1081,7 @@ int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer, | |||
1081 | int result; | 1081 | int result; |
1082 | 1082 | ||
1083 | if (sdev->no_report_opcodes || sdev->scsi_level < SCSI_SPC_3) | 1083 | if (sdev->no_report_opcodes || sdev->scsi_level < SCSI_SPC_3) |
1084 | return 0; | 1084 | return -EINVAL; |
1085 | 1085 | ||
1086 | memset(cmd, 0, 16); | 1086 | memset(cmd, 0, 16); |
1087 | cmd[0] = MAINTENANCE_IN; | 1087 | cmd[0] = MAINTENANCE_IN; |
@@ -1097,7 +1097,7 @@ int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer, | |||
1097 | if (result && scsi_sense_valid(&sshdr) && | 1097 | if (result && scsi_sense_valid(&sshdr) && |
1098 | sshdr.sense_key == ILLEGAL_REQUEST && | 1098 | sshdr.sense_key == ILLEGAL_REQUEST && |
1099 | (sshdr.asc == 0x20 || sshdr.asc == 0x24) && sshdr.ascq == 0x00) | 1099 | (sshdr.asc == 0x20 || sshdr.asc == 0x24) && sshdr.ascq == 0x00) |
1100 | return 0; | 1100 | return -EINVAL; |
1101 | 1101 | ||
1102 | if ((buffer[1] & 3) == 3) /* Command supported */ | 1102 | if ((buffer[1] & 3) == 3) /* Command supported */ |
1103 | return 1; | 1103 | return 1; |
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index 43fca9170bf2..f969aca0b54e 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c | |||
@@ -228,6 +228,7 @@ static struct { | |||
228 | {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN}, | 228 | {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN}, |
229 | {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */ | 229 | {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */ |
230 | {"SEAGATE", "ST3390N", "9546", BLIST_NOTQ}, | 230 | {"SEAGATE", "ST3390N", "9546", BLIST_NOTQ}, |
231 | {"SEAGATE", "ST900MM0006", NULL, BLIST_SKIP_VPD_PAGES}, | ||
231 | {"SGI", "RAID3", "*", BLIST_SPARSELUN}, | 232 | {"SGI", "RAID3", "*", BLIST_SPARSELUN}, |
232 | {"SGI", "RAID5", "*", BLIST_SPARSELUN}, | 233 | {"SGI", "RAID5", "*", BLIST_SPARSELUN}, |
233 | {"SGI", "TP9100", "*", BLIST_REPORTLUN2}, | 234 | {"SGI", "TP9100", "*", BLIST_REPORTLUN2}, |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index ade98e23fb2b..21505962f539 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -45,8 +45,6 @@ | |||
45 | 45 | ||
46 | static void scsi_eh_done(struct scsi_cmnd *scmd); | 46 | static void scsi_eh_done(struct scsi_cmnd *scmd); |
47 | 47 | ||
48 | #define SENSE_TIMEOUT (10*HZ) | ||
49 | |||
50 | /* | 48 | /* |
51 | * These should *probably* be handled by the host itself. | 49 | * These should *probably* be handled by the host itself. |
52 | * Since it is allowed to sleep, it probably should. | 50 | * Since it is allowed to sleep, it probably should. |
@@ -881,7 +879,7 @@ retry: | |||
881 | */ | 879 | */ |
882 | static int scsi_request_sense(struct scsi_cmnd *scmd) | 880 | static int scsi_request_sense(struct scsi_cmnd *scmd) |
883 | { | 881 | { |
884 | return scsi_send_eh_cmnd(scmd, NULL, 0, SENSE_TIMEOUT, ~0); | 882 | return scsi_send_eh_cmnd(scmd, NULL, 0, scmd->device->eh_timeout, ~0); |
885 | } | 883 | } |
886 | 884 | ||
887 | /** | 885 | /** |
@@ -982,7 +980,8 @@ static int scsi_eh_tur(struct scsi_cmnd *scmd) | |||
982 | int retry_cnt = 1, rtn; | 980 | int retry_cnt = 1, rtn; |
983 | 981 | ||
984 | retry_tur: | 982 | retry_tur: |
985 | rtn = scsi_send_eh_cmnd(scmd, tur_command, 6, SENSE_TIMEOUT, 0); | 983 | rtn = scsi_send_eh_cmnd(scmd, tur_command, 6, |
984 | scmd->device->eh_timeout, 0); | ||
986 | 985 | ||
987 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd %p rtn %x\n", | 986 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd %p rtn %x\n", |
988 | __func__, scmd, rtn)); | 987 | __func__, scmd, rtn)); |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 3e58b2245f1f..307a81137607 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -924,6 +924,11 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, | |||
924 | if (*bflags & BLIST_NO_DIF) | 924 | if (*bflags & BLIST_NO_DIF) |
925 | sdev->no_dif = 1; | 925 | sdev->no_dif = 1; |
926 | 926 | ||
927 | sdev->eh_timeout = SCSI_DEFAULT_EH_TIMEOUT; | ||
928 | |||
929 | if (*bflags & BLIST_SKIP_VPD_PAGES) | ||
930 | sdev->skip_vpd_pages = 1; | ||
931 | |||
927 | transport_configure_device(&sdev->sdev_gendev); | 932 | transport_configure_device(&sdev->sdev_gendev); |
928 | 933 | ||
929 | if (sdev->host->hostt->slave_configure) { | 934 | if (sdev->host->hostt->slave_configure) { |
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 931a7d954203..7e50061e9ef6 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -560,6 +560,35 @@ sdev_store_timeout (struct device *dev, struct device_attribute *attr, | |||
560 | static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout); | 560 | static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout); |
561 | 561 | ||
562 | static ssize_t | 562 | static ssize_t |
563 | sdev_show_eh_timeout(struct device *dev, struct device_attribute *attr, char *buf) | ||
564 | { | ||
565 | struct scsi_device *sdev; | ||
566 | sdev = to_scsi_device(dev); | ||
567 | return snprintf(buf, 20, "%u\n", sdev->eh_timeout / HZ); | ||
568 | } | ||
569 | |||
570 | static ssize_t | ||
571 | sdev_store_eh_timeout(struct device *dev, struct device_attribute *attr, | ||
572 | const char *buf, size_t count) | ||
573 | { | ||
574 | struct scsi_device *sdev; | ||
575 | unsigned int eh_timeout; | ||
576 | int err; | ||
577 | |||
578 | if (!capable(CAP_SYS_ADMIN)) | ||
579 | return -EACCES; | ||
580 | |||
581 | sdev = to_scsi_device(dev); | ||
582 | err = kstrtouint(buf, 10, &eh_timeout); | ||
583 | if (err) | ||
584 | return err; | ||
585 | sdev->eh_timeout = eh_timeout * HZ; | ||
586 | |||
587 | return count; | ||
588 | } | ||
589 | static DEVICE_ATTR(eh_timeout, S_IRUGO | S_IWUSR, sdev_show_eh_timeout, sdev_store_eh_timeout); | ||
590 | |||
591 | static ssize_t | ||
563 | store_rescan_field (struct device *dev, struct device_attribute *attr, | 592 | store_rescan_field (struct device *dev, struct device_attribute *attr, |
564 | const char *buf, size_t count) | 593 | const char *buf, size_t count) |
565 | { | 594 | { |
@@ -723,6 +752,7 @@ static struct attribute *scsi_sdev_attrs[] = { | |||
723 | &dev_attr_delete.attr, | 752 | &dev_attr_delete.attr, |
724 | &dev_attr_state.attr, | 753 | &dev_attr_state.attr, |
725 | &dev_attr_timeout.attr, | 754 | &dev_attr_timeout.attr, |
755 | &dev_attr_eh_timeout.attr, | ||
726 | &dev_attr_iocounterbits.attr, | 756 | &dev_attr_iocounterbits.attr, |
727 | &dev_attr_iorequest_cnt.attr, | 757 | &dev_attr_iorequest_cnt.attr, |
728 | &dev_attr_iodone_cnt.attr, | 758 | &dev_attr_iodone_cnt.attr, |
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 133926b1bb78..abf7c402e1a5 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -3473,6 +3473,9 @@ iscsi_session_attr(tgt_reset_tmo, ISCSI_PARAM_TGT_RESET_TMO, 0); | |||
3473 | iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0); | 3473 | iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0); |
3474 | iscsi_session_attr(initiatorname, ISCSI_PARAM_INITIATOR_NAME, 0); | 3474 | iscsi_session_attr(initiatorname, ISCSI_PARAM_INITIATOR_NAME, 0); |
3475 | iscsi_session_attr(targetalias, ISCSI_PARAM_TARGET_ALIAS, 0); | 3475 | iscsi_session_attr(targetalias, ISCSI_PARAM_TARGET_ALIAS, 0); |
3476 | iscsi_session_attr(boot_root, ISCSI_PARAM_BOOT_ROOT, 0); | ||
3477 | iscsi_session_attr(boot_nic, ISCSI_PARAM_BOOT_NIC, 0); | ||
3478 | iscsi_session_attr(boot_target, ISCSI_PARAM_BOOT_TARGET, 0); | ||
3476 | 3479 | ||
3477 | static ssize_t | 3480 | static ssize_t |
3478 | show_priv_session_state(struct device *dev, struct device_attribute *attr, | 3481 | show_priv_session_state(struct device *dev, struct device_attribute *attr, |
@@ -3568,6 +3571,9 @@ static struct attribute *iscsi_session_attrs[] = { | |||
3568 | &dev_attr_sess_ifacename.attr, | 3571 | &dev_attr_sess_ifacename.attr, |
3569 | &dev_attr_sess_initiatorname.attr, | 3572 | &dev_attr_sess_initiatorname.attr, |
3570 | &dev_attr_sess_targetalias.attr, | 3573 | &dev_attr_sess_targetalias.attr, |
3574 | &dev_attr_sess_boot_root.attr, | ||
3575 | &dev_attr_sess_boot_nic.attr, | ||
3576 | &dev_attr_sess_boot_target.attr, | ||
3571 | &dev_attr_priv_sess_recovery_tmo.attr, | 3577 | &dev_attr_priv_sess_recovery_tmo.attr, |
3572 | &dev_attr_priv_sess_state.attr, | 3578 | &dev_attr_priv_sess_state.attr, |
3573 | &dev_attr_priv_sess_creator.attr, | 3579 | &dev_attr_priv_sess_creator.attr, |
@@ -3631,6 +3637,12 @@ static umode_t iscsi_session_attr_is_visible(struct kobject *kobj, | |||
3631 | param = ISCSI_PARAM_INITIATOR_NAME; | 3637 | param = ISCSI_PARAM_INITIATOR_NAME; |
3632 | else if (attr == &dev_attr_sess_targetalias.attr) | 3638 | else if (attr == &dev_attr_sess_targetalias.attr) |
3633 | param = ISCSI_PARAM_TARGET_ALIAS; | 3639 | param = ISCSI_PARAM_TARGET_ALIAS; |
3640 | else if (attr == &dev_attr_sess_boot_root.attr) | ||
3641 | param = ISCSI_PARAM_BOOT_ROOT; | ||
3642 | else if (attr == &dev_attr_sess_boot_nic.attr) | ||
3643 | param = ISCSI_PARAM_BOOT_NIC; | ||
3644 | else if (attr == &dev_attr_sess_boot_target.attr) | ||
3645 | param = ISCSI_PARAM_BOOT_TARGET; | ||
3634 | else if (attr == &dev_attr_priv_sess_recovery_tmo.attr) | 3646 | else if (attr == &dev_attr_priv_sess_recovery_tmo.attr) |
3635 | return S_IRUGO | S_IWUSR; | 3647 | return S_IRUGO | S_IWUSR; |
3636 | else if (attr == &dev_attr_priv_sess_state.attr) | 3648 | else if (attr == &dev_attr_priv_sess_state.attr) |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 8fa3d0b73ad9..80f39b8b0223 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -142,7 +142,7 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr, | |||
142 | char *buffer_data; | 142 | char *buffer_data; |
143 | struct scsi_mode_data data; | 143 | struct scsi_mode_data data; |
144 | struct scsi_sense_hdr sshdr; | 144 | struct scsi_sense_hdr sshdr; |
145 | const char *temp = "temporary "; | 145 | static const char temp[] = "temporary "; |
146 | int len; | 146 | int len; |
147 | 147 | ||
148 | if (sdp->type != TYPE_DISK) | 148 | if (sdp->type != TYPE_DISK) |
@@ -442,8 +442,10 @@ sd_store_write_same_blocks(struct device *dev, struct device_attribute *attr, | |||
442 | 442 | ||
443 | if (max == 0) | 443 | if (max == 0) |
444 | sdp->no_write_same = 1; | 444 | sdp->no_write_same = 1; |
445 | else if (max <= SD_MAX_WS16_BLOCKS) | 445 | else if (max <= SD_MAX_WS16_BLOCKS) { |
446 | sdp->no_write_same = 0; | ||
446 | sdkp->max_ws_blocks = max; | 447 | sdkp->max_ws_blocks = max; |
448 | } | ||
447 | 449 | ||
448 | sd_config_write_same(sdkp); | 450 | sd_config_write_same(sdkp); |
449 | 451 | ||
@@ -504,6 +506,16 @@ static struct scsi_driver sd_template = { | |||
504 | }; | 506 | }; |
505 | 507 | ||
506 | /* | 508 | /* |
509 | * Dummy kobj_map->probe function. | ||
510 | * The default ->probe function will call modprobe, which is | ||
511 | * pointless as this module is already loaded. | ||
512 | */ | ||
513 | static struct kobject *sd_default_probe(dev_t devt, int *partno, void *data) | ||
514 | { | ||
515 | return NULL; | ||
516 | } | ||
517 | |||
518 | /* | ||
507 | * Device no to disk mapping: | 519 | * Device no to disk mapping: |
508 | * | 520 | * |
509 | * major disc2 disc p1 | 521 | * major disc2 disc p1 |
@@ -740,7 +752,6 @@ static void sd_config_write_same(struct scsi_disk *sdkp) | |||
740 | { | 752 | { |
741 | struct request_queue *q = sdkp->disk->queue; | 753 | struct request_queue *q = sdkp->disk->queue; |
742 | unsigned int logical_block_size = sdkp->device->sector_size; | 754 | unsigned int logical_block_size = sdkp->device->sector_size; |
743 | unsigned int blocks = 0; | ||
744 | 755 | ||
745 | if (sdkp->device->no_write_same) { | 756 | if (sdkp->device->no_write_same) { |
746 | sdkp->max_ws_blocks = 0; | 757 | sdkp->max_ws_blocks = 0; |
@@ -752,18 +763,20 @@ static void sd_config_write_same(struct scsi_disk *sdkp) | |||
752 | * blocks per I/O unless the device explicitly advertises a | 763 | * blocks per I/O unless the device explicitly advertises a |
753 | * bigger limit. | 764 | * bigger limit. |
754 | */ | 765 | */ |
755 | if (sdkp->max_ws_blocks == 0) | 766 | if (sdkp->max_ws_blocks > SD_MAX_WS10_BLOCKS) |
756 | sdkp->max_ws_blocks = SD_MAX_WS10_BLOCKS; | 767 | sdkp->max_ws_blocks = min_not_zero(sdkp->max_ws_blocks, |
757 | 768 | (u32)SD_MAX_WS16_BLOCKS); | |
758 | if (sdkp->ws16 || sdkp->max_ws_blocks > SD_MAX_WS10_BLOCKS) | 769 | else if (sdkp->ws16 || sdkp->ws10 || sdkp->device->no_report_opcodes) |
759 | blocks = min_not_zero(sdkp->max_ws_blocks, | 770 | sdkp->max_ws_blocks = min_not_zero(sdkp->max_ws_blocks, |
760 | (u32)SD_MAX_WS16_BLOCKS); | 771 | (u32)SD_MAX_WS10_BLOCKS); |
761 | else | 772 | else { |
762 | blocks = min_not_zero(sdkp->max_ws_blocks, | 773 | sdkp->device->no_write_same = 1; |
763 | (u32)SD_MAX_WS10_BLOCKS); | 774 | sdkp->max_ws_blocks = 0; |
775 | } | ||
764 | 776 | ||
765 | out: | 777 | out: |
766 | blk_queue_max_write_same_sectors(q, blocks * (logical_block_size >> 9)); | 778 | blk_queue_max_write_same_sectors(q, sdkp->max_ws_blocks * |
779 | (logical_block_size >> 9)); | ||
767 | } | 780 | } |
768 | 781 | ||
769 | /** | 782 | /** |
@@ -2635,9 +2648,24 @@ static void sd_read_block_provisioning(struct scsi_disk *sdkp) | |||
2635 | 2648 | ||
2636 | static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer) | 2649 | static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer) |
2637 | { | 2650 | { |
2638 | if (scsi_report_opcode(sdkp->device, buffer, SD_BUF_SIZE, | 2651 | struct scsi_device *sdev = sdkp->device; |
2639 | WRITE_SAME_16)) | 2652 | |
2653 | if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, INQUIRY) < 0) { | ||
2654 | sdev->no_report_opcodes = 1; | ||
2655 | |||
2656 | /* Disable WRITE SAME if REPORT SUPPORTED OPERATION | ||
2657 | * CODES is unsupported and the device has an ATA | ||
2658 | * Information VPD page (SAT). | ||
2659 | */ | ||
2660 | if (!scsi_get_vpd_page(sdev, 0x89, buffer, SD_BUF_SIZE)) | ||
2661 | sdev->no_write_same = 1; | ||
2662 | } | ||
2663 | |||
2664 | if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, WRITE_SAME_16) == 1) | ||
2640 | sdkp->ws16 = 1; | 2665 | sdkp->ws16 = 1; |
2666 | |||
2667 | if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, WRITE_SAME) == 1) | ||
2668 | sdkp->ws10 = 1; | ||
2641 | } | 2669 | } |
2642 | 2670 | ||
2643 | static int sd_try_extended_inquiry(struct scsi_device *sdp) | 2671 | static int sd_try_extended_inquiry(struct scsi_device *sdp) |
@@ -2970,8 +2998,10 @@ static int sd_probe(struct device *dev) | |||
2970 | static int sd_remove(struct device *dev) | 2998 | static int sd_remove(struct device *dev) |
2971 | { | 2999 | { |
2972 | struct scsi_disk *sdkp; | 3000 | struct scsi_disk *sdkp; |
3001 | dev_t devt; | ||
2973 | 3002 | ||
2974 | sdkp = dev_get_drvdata(dev); | 3003 | sdkp = dev_get_drvdata(dev); |
3004 | devt = disk_devt(sdkp->disk); | ||
2975 | scsi_autopm_get_device(sdkp->device); | 3005 | scsi_autopm_get_device(sdkp->device); |
2976 | 3006 | ||
2977 | async_synchronize_full_domain(&scsi_sd_probe_domain); | 3007 | async_synchronize_full_domain(&scsi_sd_probe_domain); |
@@ -2981,6 +3011,9 @@ static int sd_remove(struct device *dev) | |||
2981 | del_gendisk(sdkp->disk); | 3011 | del_gendisk(sdkp->disk); |
2982 | sd_shutdown(dev); | 3012 | sd_shutdown(dev); |
2983 | 3013 | ||
3014 | blk_register_region(devt, SD_MINORS, NULL, | ||
3015 | sd_default_probe, NULL, NULL); | ||
3016 | |||
2984 | mutex_lock(&sd_ref_mutex); | 3017 | mutex_lock(&sd_ref_mutex); |
2985 | dev_set_drvdata(dev, NULL); | 3018 | dev_set_drvdata(dev, NULL); |
2986 | put_device(&sdkp->dev); | 3019 | put_device(&sdkp->dev); |
@@ -3124,9 +3157,13 @@ static int __init init_sd(void) | |||
3124 | 3157 | ||
3125 | SCSI_LOG_HLQUEUE(3, printk("init_sd: sd driver entry point\n")); | 3158 | SCSI_LOG_HLQUEUE(3, printk("init_sd: sd driver entry point\n")); |
3126 | 3159 | ||
3127 | for (i = 0; i < SD_MAJORS; i++) | 3160 | for (i = 0; i < SD_MAJORS; i++) { |
3128 | if (register_blkdev(sd_major(i), "sd") == 0) | 3161 | if (register_blkdev(sd_major(i), "sd") != 0) |
3129 | majors++; | 3162 | continue; |
3163 | majors++; | ||
3164 | blk_register_region(sd_major(i), SD_MINORS, NULL, | ||
3165 | sd_default_probe, NULL, NULL); | ||
3166 | } | ||
3130 | 3167 | ||
3131 | if (!majors) | 3168 | if (!majors) |
3132 | return -ENODEV; | 3169 | return -ENODEV; |
@@ -3185,8 +3222,10 @@ static void __exit exit_sd(void) | |||
3185 | 3222 | ||
3186 | class_unregister(&sd_disk_class); | 3223 | class_unregister(&sd_disk_class); |
3187 | 3224 | ||
3188 | for (i = 0; i < SD_MAJORS; i++) | 3225 | for (i = 0; i < SD_MAJORS; i++) { |
3226 | blk_unregister_region(sd_major(i), SD_MINORS); | ||
3189 | unregister_blkdev(sd_major(i), "sd"); | 3227 | unregister_blkdev(sd_major(i), "sd"); |
3228 | } | ||
3190 | } | 3229 | } |
3191 | 3230 | ||
3192 | module_init(init_sd); | 3231 | module_init(init_sd); |
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h index 2386aeb41fe8..7a049de22051 100644 --- a/drivers/scsi/sd.h +++ b/drivers/scsi/sd.h | |||
@@ -84,6 +84,7 @@ struct scsi_disk { | |||
84 | unsigned lbpws : 1; | 84 | unsigned lbpws : 1; |
85 | unsigned lbpws10 : 1; | 85 | unsigned lbpws10 : 1; |
86 | unsigned lbpvpd : 1; | 86 | unsigned lbpvpd : 1; |
87 | unsigned ws10 : 1; | ||
87 | unsigned ws16 : 1; | 88 | unsigned ws16 : 1; |
88 | }; | 89 | }; |
89 | #define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev) | 90 | #define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev) |
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 16a3a0cc9672..945198910460 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c | |||
@@ -55,10 +55,15 @@ | |||
55 | * V1 RC < 2008/1/31: 1.0 | 55 | * V1 RC < 2008/1/31: 1.0 |
56 | * V1 RC > 2008/1/31: 2.0 | 56 | * V1 RC > 2008/1/31: 2.0 |
57 | * Win7: 4.2 | 57 | * Win7: 4.2 |
58 | * Win8: 5.1 | ||
58 | */ | 59 | */ |
59 | 60 | ||
60 | #define VMSTOR_CURRENT_MAJOR 4 | 61 | |
61 | #define VMSTOR_CURRENT_MINOR 2 | 62 | #define VMSTOR_WIN7_MAJOR 4 |
63 | #define VMSTOR_WIN7_MINOR 2 | ||
64 | |||
65 | #define VMSTOR_WIN8_MAJOR 5 | ||
66 | #define VMSTOR_WIN8_MINOR 1 | ||
62 | 67 | ||
63 | 68 | ||
64 | /* Packet structure describing virtual storage requests. */ | 69 | /* Packet structure describing virtual storage requests. */ |
@@ -74,18 +79,103 @@ enum vstor_packet_operation { | |||
74 | VSTOR_OPERATION_QUERY_PROTOCOL_VERSION = 9, | 79 | VSTOR_OPERATION_QUERY_PROTOCOL_VERSION = 9, |
75 | VSTOR_OPERATION_QUERY_PROPERTIES = 10, | 80 | VSTOR_OPERATION_QUERY_PROPERTIES = 10, |
76 | VSTOR_OPERATION_ENUMERATE_BUS = 11, | 81 | VSTOR_OPERATION_ENUMERATE_BUS = 11, |
77 | VSTOR_OPERATION_MAXIMUM = 11 | 82 | VSTOR_OPERATION_FCHBA_DATA = 12, |
83 | VSTOR_OPERATION_CREATE_SUB_CHANNELS = 13, | ||
84 | VSTOR_OPERATION_MAXIMUM = 13 | ||
85 | }; | ||
86 | |||
87 | /* | ||
88 | * WWN packet for Fibre Channel HBA | ||
89 | */ | ||
90 | |||
91 | struct hv_fc_wwn_packet { | ||
92 | bool primary_active; | ||
93 | u8 reserved1; | ||
94 | u8 reserved2; | ||
95 | u8 primary_port_wwn[8]; | ||
96 | u8 primary_node_wwn[8]; | ||
97 | u8 secondary_port_wwn[8]; | ||
98 | u8 secondary_node_wwn[8]; | ||
78 | }; | 99 | }; |
79 | 100 | ||
101 | |||
102 | |||
103 | /* | ||
104 | * SRB Flag Bits | ||
105 | */ | ||
106 | |||
107 | #define SRB_FLAGS_QUEUE_ACTION_ENABLE 0x00000002 | ||
108 | #define SRB_FLAGS_DISABLE_DISCONNECT 0x00000004 | ||
109 | #define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008 | ||
110 | #define SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x00000010 | ||
111 | #define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020 | ||
112 | #define SRB_FLAGS_DATA_IN 0x00000040 | ||
113 | #define SRB_FLAGS_DATA_OUT 0x00000080 | ||
114 | #define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000 | ||
115 | #define SRB_FLAGS_UNSPECIFIED_DIRECTION (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT) | ||
116 | #define SRB_FLAGS_NO_QUEUE_FREEZE 0x00000100 | ||
117 | #define SRB_FLAGS_ADAPTER_CACHE_ENABLE 0x00000200 | ||
118 | #define SRB_FLAGS_FREE_SENSE_BUFFER 0x00000400 | ||
119 | |||
120 | /* | ||
121 | * This flag indicates the request is part of the workflow for processing a D3. | ||
122 | */ | ||
123 | #define SRB_FLAGS_D3_PROCESSING 0x00000800 | ||
124 | #define SRB_FLAGS_IS_ACTIVE 0x00010000 | ||
125 | #define SRB_FLAGS_ALLOCATED_FROM_ZONE 0x00020000 | ||
126 | #define SRB_FLAGS_SGLIST_FROM_POOL 0x00040000 | ||
127 | #define SRB_FLAGS_BYPASS_LOCKED_QUEUE 0x00080000 | ||
128 | #define SRB_FLAGS_NO_KEEP_AWAKE 0x00100000 | ||
129 | #define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE 0x00200000 | ||
130 | #define SRB_FLAGS_PORT_DRIVER_SENSEHASPORT 0x00400000 | ||
131 | #define SRB_FLAGS_DONT_START_NEXT_PACKET 0x00800000 | ||
132 | #define SRB_FLAGS_PORT_DRIVER_RESERVED 0x0F000000 | ||
133 | #define SRB_FLAGS_CLASS_DRIVER_RESERVED 0xF0000000 | ||
134 | |||
135 | |||
80 | /* | 136 | /* |
81 | * Platform neutral description of a scsi request - | 137 | * Platform neutral description of a scsi request - |
82 | * this remains the same across the write regardless of 32/64 bit | 138 | * this remains the same across the write regardless of 32/64 bit |
83 | * note: it's patterned off the SCSI_PASS_THROUGH structure | 139 | * note: it's patterned off the SCSI_PASS_THROUGH structure |
84 | */ | 140 | */ |
85 | #define STORVSC_MAX_CMD_LEN 0x10 | 141 | #define STORVSC_MAX_CMD_LEN 0x10 |
86 | #define STORVSC_SENSE_BUFFER_SIZE 0x12 | 142 | |
143 | #define POST_WIN7_STORVSC_SENSE_BUFFER_SIZE 0x14 | ||
144 | #define PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE 0x12 | ||
145 | |||
146 | #define STORVSC_SENSE_BUFFER_SIZE 0x14 | ||
87 | #define STORVSC_MAX_BUF_LEN_WITH_PADDING 0x14 | 147 | #define STORVSC_MAX_BUF_LEN_WITH_PADDING 0x14 |
88 | 148 | ||
149 | /* | ||
150 | * Sense buffer size changed in win8; have a run-time | ||
151 | * variable to track the size we should use. | ||
152 | */ | ||
153 | static int sense_buffer_size; | ||
154 | |||
155 | /* | ||
156 | * The size of the vmscsi_request has changed in win8. The | ||
157 | * additional size is because of new elements added to the | ||
158 | * structure. These elements are valid only when we are talking | ||
159 | * to a win8 host. | ||
160 | * Track the correction to size we need to apply. | ||
161 | */ | ||
162 | |||
163 | static int vmscsi_size_delta; | ||
164 | static int vmstor_current_major; | ||
165 | static int vmstor_current_minor; | ||
166 | |||
167 | struct vmscsi_win8_extension { | ||
168 | /* | ||
169 | * The following were added in Windows 8 | ||
170 | */ | ||
171 | u16 reserve; | ||
172 | u8 queue_tag; | ||
173 | u8 queue_action; | ||
174 | u32 srb_flags; | ||
175 | u32 time_out_value; | ||
176 | u32 queue_sort_ey; | ||
177 | } __packed; | ||
178 | |||
89 | struct vmscsi_request { | 179 | struct vmscsi_request { |
90 | u16 length; | 180 | u16 length; |
91 | u8 srb_status; | 181 | u8 srb_status; |
@@ -108,6 +198,11 @@ struct vmscsi_request { | |||
108 | u8 sense_data[STORVSC_SENSE_BUFFER_SIZE]; | 198 | u8 sense_data[STORVSC_SENSE_BUFFER_SIZE]; |
109 | u8 reserved_array[STORVSC_MAX_BUF_LEN_WITH_PADDING]; | 199 | u8 reserved_array[STORVSC_MAX_BUF_LEN_WITH_PADDING]; |
110 | }; | 200 | }; |
201 | /* | ||
202 | * The following was added in win8. | ||
203 | */ | ||
204 | struct vmscsi_win8_extension win8_extension; | ||
205 | |||
111 | } __attribute((packed)); | 206 | } __attribute((packed)); |
112 | 207 | ||
113 | 208 | ||
@@ -115,22 +210,18 @@ struct vmscsi_request { | |||
115 | * This structure is sent during the intialization phase to get the different | 210 | * This structure is sent during the intialization phase to get the different |
116 | * properties of the channel. | 211 | * properties of the channel. |
117 | */ | 212 | */ |
213 | |||
214 | #define STORAGE_CHANNEL_SUPPORTS_MULTI_CHANNEL 0x1 | ||
215 | |||
118 | struct vmstorage_channel_properties { | 216 | struct vmstorage_channel_properties { |
119 | u16 protocol_version; | 217 | u32 reserved; |
120 | u8 path_id; | 218 | u16 max_channel_cnt; |
121 | u8 target_id; | 219 | u16 reserved1; |
122 | 220 | ||
123 | /* Note: port number is only really known on the client side */ | 221 | u32 flags; |
124 | u32 port_number; | ||
125 | u32 flags; | ||
126 | u32 max_transfer_bytes; | 222 | u32 max_transfer_bytes; |
127 | 223 | ||
128 | /* | 224 | u64 reserved2; |
129 | * This id is unique for each channel and will correspond with | ||
130 | * vendor specific data in the inquiry data. | ||
131 | */ | ||
132 | |||
133 | u64 unique_id; | ||
134 | } __packed; | 225 | } __packed; |
135 | 226 | ||
136 | /* This structure is sent during the storage protocol negotiations. */ | 227 | /* This structure is sent during the storage protocol negotiations. */ |
@@ -175,6 +266,15 @@ struct vstor_packet { | |||
175 | 266 | ||
176 | /* Used during version negotiations. */ | 267 | /* Used during version negotiations. */ |
177 | struct vmstorage_protocol_version version; | 268 | struct vmstorage_protocol_version version; |
269 | |||
270 | /* Fibre channel address packet */ | ||
271 | struct hv_fc_wwn_packet wwn_packet; | ||
272 | |||
273 | /* Number of sub-channels to create */ | ||
274 | u16 sub_channel_count; | ||
275 | |||
276 | /* This will be the maximum of the union members */ | ||
277 | u8 buffer[0x34]; | ||
178 | }; | 278 | }; |
179 | } __packed; | 279 | } __packed; |
180 | 280 | ||
@@ -221,6 +321,11 @@ static int storvsc_ringbuffer_size = (20 * PAGE_SIZE); | |||
221 | module_param(storvsc_ringbuffer_size, int, S_IRUGO); | 321 | module_param(storvsc_ringbuffer_size, int, S_IRUGO); |
222 | MODULE_PARM_DESC(storvsc_ringbuffer_size, "Ring buffer size (bytes)"); | 322 | MODULE_PARM_DESC(storvsc_ringbuffer_size, "Ring buffer size (bytes)"); |
223 | 323 | ||
324 | /* | ||
325 | * Timeout in seconds for all devices managed by this driver. | ||
326 | */ | ||
327 | static int storvsc_timeout = 180; | ||
328 | |||
224 | #define STORVSC_MAX_IO_REQUESTS 128 | 329 | #define STORVSC_MAX_IO_REQUESTS 128 |
225 | 330 | ||
226 | /* | 331 | /* |
@@ -674,7 +779,8 @@ static int storvsc_channel_init(struct hv_device *device) | |||
674 | vstor_packet->flags = REQUEST_COMPLETION_FLAG; | 779 | vstor_packet->flags = REQUEST_COMPLETION_FLAG; |
675 | 780 | ||
676 | ret = vmbus_sendpacket(device->channel, vstor_packet, | 781 | ret = vmbus_sendpacket(device->channel, vstor_packet, |
677 | sizeof(struct vstor_packet), | 782 | (sizeof(struct vstor_packet) - |
783 | vmscsi_size_delta), | ||
678 | (unsigned long)request, | 784 | (unsigned long)request, |
679 | VM_PKT_DATA_INBAND, | 785 | VM_PKT_DATA_INBAND, |
680 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); | 786 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); |
@@ -698,7 +804,7 @@ static int storvsc_channel_init(struct hv_device *device) | |||
698 | vstor_packet->flags = REQUEST_COMPLETION_FLAG; | 804 | vstor_packet->flags = REQUEST_COMPLETION_FLAG; |
699 | 805 | ||
700 | vstor_packet->version.major_minor = | 806 | vstor_packet->version.major_minor = |
701 | storvsc_get_version(VMSTOR_CURRENT_MAJOR, VMSTOR_CURRENT_MINOR); | 807 | storvsc_get_version(vmstor_current_major, vmstor_current_minor); |
702 | 808 | ||
703 | /* | 809 | /* |
704 | * The revision number is only used in Windows; set it to 0. | 810 | * The revision number is only used in Windows; set it to 0. |
@@ -706,7 +812,8 @@ static int storvsc_channel_init(struct hv_device *device) | |||
706 | vstor_packet->version.revision = 0; | 812 | vstor_packet->version.revision = 0; |
707 | 813 | ||
708 | ret = vmbus_sendpacket(device->channel, vstor_packet, | 814 | ret = vmbus_sendpacket(device->channel, vstor_packet, |
709 | sizeof(struct vstor_packet), | 815 | (sizeof(struct vstor_packet) - |
816 | vmscsi_size_delta), | ||
710 | (unsigned long)request, | 817 | (unsigned long)request, |
711 | VM_PKT_DATA_INBAND, | 818 | VM_PKT_DATA_INBAND, |
712 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); | 819 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); |
@@ -727,11 +834,10 @@ static int storvsc_channel_init(struct hv_device *device) | |||
727 | memset(vstor_packet, 0, sizeof(struct vstor_packet)); | 834 | memset(vstor_packet, 0, sizeof(struct vstor_packet)); |
728 | vstor_packet->operation = VSTOR_OPERATION_QUERY_PROPERTIES; | 835 | vstor_packet->operation = VSTOR_OPERATION_QUERY_PROPERTIES; |
729 | vstor_packet->flags = REQUEST_COMPLETION_FLAG; | 836 | vstor_packet->flags = REQUEST_COMPLETION_FLAG; |
730 | vstor_packet->storage_channel_properties.port_number = | ||
731 | stor_device->port_number; | ||
732 | 837 | ||
733 | ret = vmbus_sendpacket(device->channel, vstor_packet, | 838 | ret = vmbus_sendpacket(device->channel, vstor_packet, |
734 | sizeof(struct vstor_packet), | 839 | (sizeof(struct vstor_packet) - |
840 | vmscsi_size_delta), | ||
735 | (unsigned long)request, | 841 | (unsigned long)request, |
736 | VM_PKT_DATA_INBAND, | 842 | VM_PKT_DATA_INBAND, |
737 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); | 843 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); |
@@ -749,16 +855,13 @@ static int storvsc_channel_init(struct hv_device *device) | |||
749 | vstor_packet->status != 0) | 855 | vstor_packet->status != 0) |
750 | goto cleanup; | 856 | goto cleanup; |
751 | 857 | ||
752 | stor_device->path_id = vstor_packet->storage_channel_properties.path_id; | ||
753 | stor_device->target_id | ||
754 | = vstor_packet->storage_channel_properties.target_id; | ||
755 | |||
756 | memset(vstor_packet, 0, sizeof(struct vstor_packet)); | 858 | memset(vstor_packet, 0, sizeof(struct vstor_packet)); |
757 | vstor_packet->operation = VSTOR_OPERATION_END_INITIALIZATION; | 859 | vstor_packet->operation = VSTOR_OPERATION_END_INITIALIZATION; |
758 | vstor_packet->flags = REQUEST_COMPLETION_FLAG; | 860 | vstor_packet->flags = REQUEST_COMPLETION_FLAG; |
759 | 861 | ||
760 | ret = vmbus_sendpacket(device->channel, vstor_packet, | 862 | ret = vmbus_sendpacket(device->channel, vstor_packet, |
761 | sizeof(struct vstor_packet), | 863 | (sizeof(struct vstor_packet) - |
864 | vmscsi_size_delta), | ||
762 | (unsigned long)request, | 865 | (unsigned long)request, |
763 | VM_PKT_DATA_INBAND, | 866 | VM_PKT_DATA_INBAND, |
764 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); | 867 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); |
@@ -1012,7 +1115,8 @@ static void storvsc_on_channel_callback(void *context) | |||
1012 | 1115 | ||
1013 | do { | 1116 | do { |
1014 | ret = vmbus_recvpacket(device->channel, packet, | 1117 | ret = vmbus_recvpacket(device->channel, packet, |
1015 | ALIGN(sizeof(struct vstor_packet), 8), | 1118 | ALIGN((sizeof(struct vstor_packet) - |
1119 | vmscsi_size_delta), 8), | ||
1016 | &bytes_recvd, &request_id); | 1120 | &bytes_recvd, &request_id); |
1017 | if (ret == 0 && bytes_recvd > 0) { | 1121 | if (ret == 0 && bytes_recvd > 0) { |
1018 | 1122 | ||
@@ -1023,7 +1127,8 @@ static void storvsc_on_channel_callback(void *context) | |||
1023 | (request == &stor_device->reset_request)) { | 1127 | (request == &stor_device->reset_request)) { |
1024 | 1128 | ||
1025 | memcpy(&request->vstor_packet, packet, | 1129 | memcpy(&request->vstor_packet, packet, |
1026 | sizeof(struct vstor_packet)); | 1130 | (sizeof(struct vstor_packet) - |
1131 | vmscsi_size_delta)); | ||
1027 | complete(&request->wait_event); | 1132 | complete(&request->wait_event); |
1028 | } else { | 1133 | } else { |
1029 | storvsc_on_receive(device, | 1134 | storvsc_on_receive(device, |
@@ -1116,10 +1221,11 @@ static int storvsc_do_io(struct hv_device *device, | |||
1116 | 1221 | ||
1117 | vstor_packet->flags |= REQUEST_COMPLETION_FLAG; | 1222 | vstor_packet->flags |= REQUEST_COMPLETION_FLAG; |
1118 | 1223 | ||
1119 | vstor_packet->vm_srb.length = sizeof(struct vmscsi_request); | 1224 | vstor_packet->vm_srb.length = (sizeof(struct vmscsi_request) - |
1225 | vmscsi_size_delta); | ||
1120 | 1226 | ||
1121 | 1227 | ||
1122 | vstor_packet->vm_srb.sense_info_length = STORVSC_SENSE_BUFFER_SIZE; | 1228 | vstor_packet->vm_srb.sense_info_length = sense_buffer_size; |
1123 | 1229 | ||
1124 | 1230 | ||
1125 | vstor_packet->vm_srb.data_transfer_length = | 1231 | vstor_packet->vm_srb.data_transfer_length = |
@@ -1131,11 +1237,13 @@ static int storvsc_do_io(struct hv_device *device, | |||
1131 | ret = vmbus_sendpacket_multipagebuffer(device->channel, | 1237 | ret = vmbus_sendpacket_multipagebuffer(device->channel, |
1132 | &request->data_buffer, | 1238 | &request->data_buffer, |
1133 | vstor_packet, | 1239 | vstor_packet, |
1134 | sizeof(struct vstor_packet), | 1240 | (sizeof(struct vstor_packet) - |
1241 | vmscsi_size_delta), | ||
1135 | (unsigned long)request); | 1242 | (unsigned long)request); |
1136 | } else { | 1243 | } else { |
1137 | ret = vmbus_sendpacket(device->channel, vstor_packet, | 1244 | ret = vmbus_sendpacket(device->channel, vstor_packet, |
1138 | sizeof(struct vstor_packet), | 1245 | (sizeof(struct vstor_packet) - |
1246 | vmscsi_size_delta), | ||
1139 | (unsigned long)request, | 1247 | (unsigned long)request, |
1140 | VM_PKT_DATA_INBAND, | 1248 | VM_PKT_DATA_INBAND, |
1141 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); | 1249 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); |
@@ -1204,6 +1312,8 @@ static int storvsc_device_configure(struct scsi_device *sdevice) | |||
1204 | 1312 | ||
1205 | blk_queue_bounce_limit(sdevice->request_queue, BLK_BOUNCE_ANY); | 1313 | blk_queue_bounce_limit(sdevice->request_queue, BLK_BOUNCE_ANY); |
1206 | 1314 | ||
1315 | blk_queue_rq_timeout(sdevice->request_queue, (storvsc_timeout * HZ)); | ||
1316 | |||
1207 | sdevice->no_write_same = 1; | 1317 | sdevice->no_write_same = 1; |
1208 | 1318 | ||
1209 | return 0; | 1319 | return 0; |
@@ -1257,7 +1367,8 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd) | |||
1257 | vstor_packet->vm_srb.path_id = stor_device->path_id; | 1367 | vstor_packet->vm_srb.path_id = stor_device->path_id; |
1258 | 1368 | ||
1259 | ret = vmbus_sendpacket(device->channel, vstor_packet, | 1369 | ret = vmbus_sendpacket(device->channel, vstor_packet, |
1260 | sizeof(struct vstor_packet), | 1370 | (sizeof(struct vstor_packet) - |
1371 | vmscsi_size_delta), | ||
1261 | (unsigned long)&stor_device->reset_request, | 1372 | (unsigned long)&stor_device->reset_request, |
1262 | VM_PKT_DATA_INBAND, | 1373 | VM_PKT_DATA_INBAND, |
1263 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); | 1374 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); |
@@ -1342,18 +1453,28 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd) | |||
1342 | scmnd->host_scribble = (unsigned char *)cmd_request; | 1453 | scmnd->host_scribble = (unsigned char *)cmd_request; |
1343 | 1454 | ||
1344 | vm_srb = &cmd_request->vstor_packet.vm_srb; | 1455 | vm_srb = &cmd_request->vstor_packet.vm_srb; |
1456 | vm_srb->win8_extension.time_out_value = 60; | ||
1345 | 1457 | ||
1346 | 1458 | ||
1347 | /* Build the SRB */ | 1459 | /* Build the SRB */ |
1348 | switch (scmnd->sc_data_direction) { | 1460 | switch (scmnd->sc_data_direction) { |
1349 | case DMA_TO_DEVICE: | 1461 | case DMA_TO_DEVICE: |
1350 | vm_srb->data_in = WRITE_TYPE; | 1462 | vm_srb->data_in = WRITE_TYPE; |
1463 | vm_srb->win8_extension.srb_flags |= SRB_FLAGS_DATA_OUT; | ||
1464 | vm_srb->win8_extension.srb_flags |= | ||
1465 | (SRB_FLAGS_QUEUE_ACTION_ENABLE | | ||
1466 | SRB_FLAGS_DISABLE_SYNCH_TRANSFER); | ||
1351 | break; | 1467 | break; |
1352 | case DMA_FROM_DEVICE: | 1468 | case DMA_FROM_DEVICE: |
1353 | vm_srb->data_in = READ_TYPE; | 1469 | vm_srb->data_in = READ_TYPE; |
1470 | vm_srb->win8_extension.srb_flags |= SRB_FLAGS_DATA_IN; | ||
1471 | vm_srb->win8_extension.srb_flags |= | ||
1472 | (SRB_FLAGS_QUEUE_ACTION_ENABLE | | ||
1473 | SRB_FLAGS_DISABLE_SYNCH_TRANSFER); | ||
1354 | break; | 1474 | break; |
1355 | default: | 1475 | default: |
1356 | vm_srb->data_in = UNKNOWN_TYPE; | 1476 | vm_srb->data_in = UNKNOWN_TYPE; |
1477 | vm_srb->win8_extension.srb_flags = 0; | ||
1357 | break; | 1478 | break; |
1358 | } | 1479 | } |
1359 | 1480 | ||
@@ -1485,6 +1606,24 @@ static int storvsc_probe(struct hv_device *device, | |||
1485 | int target = 0; | 1606 | int target = 0; |
1486 | struct storvsc_device *stor_device; | 1607 | struct storvsc_device *stor_device; |
1487 | 1608 | ||
1609 | /* | ||
1610 | * Based on the windows host we are running on, | ||
1611 | * set state to properly communicate with the host. | ||
1612 | */ | ||
1613 | |||
1614 | if (vmbus_proto_version == VERSION_WIN8) { | ||
1615 | sense_buffer_size = POST_WIN7_STORVSC_SENSE_BUFFER_SIZE; | ||
1616 | vmscsi_size_delta = 0; | ||
1617 | vmstor_current_major = VMSTOR_WIN8_MAJOR; | ||
1618 | vmstor_current_minor = VMSTOR_WIN8_MINOR; | ||
1619 | } else { | ||
1620 | sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; | ||
1621 | vmscsi_size_delta = sizeof(struct vmscsi_win8_extension); | ||
1622 | vmstor_current_major = VMSTOR_WIN7_MAJOR; | ||
1623 | vmstor_current_minor = VMSTOR_WIN7_MINOR; | ||
1624 | } | ||
1625 | |||
1626 | |||
1488 | host = scsi_host_alloc(&scsi_driver, | 1627 | host = scsi_host_alloc(&scsi_driver, |
1489 | sizeof(struct hv_host_device)); | 1628 | sizeof(struct hv_host_device)); |
1490 | if (!host) | 1629 | if (!host) |
@@ -1594,7 +1733,8 @@ static int __init storvsc_drv_init(void) | |||
1594 | max_outstanding_req_per_channel = | 1733 | max_outstanding_req_per_channel = |
1595 | ((storvsc_ringbuffer_size - PAGE_SIZE) / | 1734 | ((storvsc_ringbuffer_size - PAGE_SIZE) / |
1596 | ALIGN(MAX_MULTIPAGE_BUFFER_PACKET + | 1735 | ALIGN(MAX_MULTIPAGE_BUFFER_PACKET + |
1597 | sizeof(struct vstor_packet) + sizeof(u64), | 1736 | sizeof(struct vstor_packet) + sizeof(u64) - |
1737 | vmscsi_size_delta, | ||
1598 | sizeof(u64))); | 1738 | sizeof(u64))); |
1599 | 1739 | ||
1600 | if (max_outstanding_req_per_channel < | 1740 | if (max_outstanding_req_per_channel < |
diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig index 35faf24c6044..f07f90179bbc 100644 --- a/drivers/scsi/ufs/Kconfig +++ b/drivers/scsi/ufs/Kconfig | |||
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | config SCSI_UFSHCD | 35 | config SCSI_UFSHCD |
36 | tristate "Universal Flash Storage Controller Driver Core" | 36 | tristate "Universal Flash Storage Controller Driver Core" |
37 | depends on SCSI | 37 | depends on SCSI && SCSI_DMA |
38 | ---help--- | 38 | ---help--- |
39 | This selects the support for UFS devices in Linux, say Y and make | 39 | This selects the support for UFS devices in Linux, say Y and make |
40 | sure that you know the name of your UFS host adapter (the card | 40 | sure that you know the name of your UFS host adapter (the card |
diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c index 5cb1d75f5868..48be39a6f6d7 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/scsi/ufs/ufshcd-pci.c | |||
@@ -92,7 +92,6 @@ static void ufshcd_pci_remove(struct pci_dev *pdev) | |||
92 | struct ufs_hba *hba = pci_get_drvdata(pdev); | 92 | struct ufs_hba *hba = pci_get_drvdata(pdev); |
93 | 93 | ||
94 | disable_irq(pdev->irq); | 94 | disable_irq(pdev->irq); |
95 | free_irq(pdev->irq, hba); | ||
96 | ufshcd_remove(hba); | 95 | ufshcd_remove(hba); |
97 | pci_release_regions(pdev); | 96 | pci_release_regions(pdev); |
98 | pci_set_drvdata(pdev, NULL); | 97 | pci_set_drvdata(pdev, NULL); |
diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 03319acd9c72..c42db40d4e51 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c | |||
@@ -33,9 +33,10 @@ | |||
33 | * this program. | 33 | * this program. |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include "ufshcd.h" | ||
37 | #include <linux/platform_device.h> | 36 | #include <linux/platform_device.h> |
38 | 37 | ||
38 | #include "ufshcd.h" | ||
39 | |||
39 | #ifdef CONFIG_PM | 40 | #ifdef CONFIG_PM |
40 | /** | 41 | /** |
41 | * ufshcd_pltfrm_suspend - suspend power management function | 42 | * ufshcd_pltfrm_suspend - suspend power management function |
@@ -97,62 +98,39 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev) | |||
97 | struct ufs_hba *hba; | 98 | struct ufs_hba *hba; |
98 | void __iomem *mmio_base; | 99 | void __iomem *mmio_base; |
99 | struct resource *mem_res; | 100 | struct resource *mem_res; |
100 | struct resource *irq_res; | 101 | int irq, err; |
101 | resource_size_t mem_size; | ||
102 | int err; | ||
103 | struct device *dev = &pdev->dev; | 102 | struct device *dev = &pdev->dev; |
104 | 103 | ||
105 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 104 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
106 | if (!mem_res) { | 105 | if (!mem_res) { |
107 | dev_err(&pdev->dev, | 106 | dev_err(dev, "Memory resource not available\n"); |
108 | "Memory resource not available\n"); | ||
109 | err = -ENODEV; | 107 | err = -ENODEV; |
110 | goto out_error; | 108 | goto out; |
111 | } | ||
112 | |||
113 | mem_size = resource_size(mem_res); | ||
114 | if (!request_mem_region(mem_res->start, mem_size, "ufshcd")) { | ||
115 | dev_err(&pdev->dev, | ||
116 | "Cannot reserve the memory resource\n"); | ||
117 | err = -EBUSY; | ||
118 | goto out_error; | ||
119 | } | 109 | } |
120 | 110 | ||
121 | mmio_base = ioremap_nocache(mem_res->start, mem_size); | 111 | mmio_base = devm_ioremap_resource(dev, mem_res); |
122 | if (!mmio_base) { | 112 | if (IS_ERR(mmio_base)) { |
123 | dev_err(&pdev->dev, "memory map failed\n"); | 113 | dev_err(dev, "memory map failed\n"); |
124 | err = -ENOMEM; | 114 | err = PTR_ERR(mmio_base); |
125 | goto out_release_regions; | 115 | goto out; |
126 | } | 116 | } |
127 | 117 | ||
128 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 118 | irq = platform_get_irq(pdev, 0); |
129 | if (!irq_res) { | 119 | if (irq < 0) { |
130 | dev_err(&pdev->dev, "IRQ resource not available\n"); | 120 | dev_err(dev, "IRQ resource not available\n"); |
131 | err = -ENODEV; | 121 | err = -ENODEV; |
132 | goto out_iounmap; | 122 | goto out; |
133 | } | ||
134 | |||
135 | err = dma_set_coherent_mask(dev, dev->coherent_dma_mask); | ||
136 | if (err) { | ||
137 | dev_err(&pdev->dev, "set dma mask failed\n"); | ||
138 | goto out_iounmap; | ||
139 | } | 123 | } |
140 | 124 | ||
141 | err = ufshcd_init(&pdev->dev, &hba, mmio_base, irq_res->start); | 125 | err = ufshcd_init(dev, &hba, mmio_base, irq); |
142 | if (err) { | 126 | if (err) { |
143 | dev_err(&pdev->dev, "Intialization failed\n"); | 127 | dev_err(dev, "Intialization failed\n"); |
144 | goto out_iounmap; | 128 | goto out; |
145 | } | 129 | } |
146 | 130 | ||
147 | platform_set_drvdata(pdev, hba); | 131 | platform_set_drvdata(pdev, hba); |
148 | 132 | ||
149 | return 0; | 133 | out: |
150 | |||
151 | out_iounmap: | ||
152 | iounmap(mmio_base); | ||
153 | out_release_regions: | ||
154 | release_mem_region(mem_res->start, mem_size); | ||
155 | out_error: | ||
156 | return err; | 134 | return err; |
157 | } | 135 | } |
158 | 136 | ||
@@ -164,32 +142,16 @@ out_error: | |||
164 | */ | 142 | */ |
165 | static int ufshcd_pltfrm_remove(struct platform_device *pdev) | 143 | static int ufshcd_pltfrm_remove(struct platform_device *pdev) |
166 | { | 144 | { |
167 | struct resource *mem_res; | ||
168 | resource_size_t mem_size; | ||
169 | struct ufs_hba *hba = platform_get_drvdata(pdev); | 145 | struct ufs_hba *hba = platform_get_drvdata(pdev); |
170 | 146 | ||
171 | disable_irq(hba->irq); | 147 | disable_irq(hba->irq); |
172 | |||
173 | /* Some buggy controllers raise interrupt after | ||
174 | * the resources are removed. So first we unregister the | ||
175 | * irq handler and then the resources used by driver | ||
176 | */ | ||
177 | |||
178 | free_irq(hba->irq, hba); | ||
179 | ufshcd_remove(hba); | 148 | ufshcd_remove(hba); |
180 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
181 | if (!mem_res) | ||
182 | dev_err(&pdev->dev, "ufshcd: Memory resource not available\n"); | ||
183 | else { | ||
184 | mem_size = resource_size(mem_res); | ||
185 | release_mem_region(mem_res->start, mem_size); | ||
186 | } | ||
187 | platform_set_drvdata(pdev, NULL); | ||
188 | return 0; | 149 | return 0; |
189 | } | 150 | } |
190 | 151 | ||
191 | static const struct of_device_id ufs_of_match[] = { | 152 | static const struct of_device_id ufs_of_match[] = { |
192 | { .compatible = "jedec,ufs-1.1"}, | 153 | { .compatible = "jedec,ufs-1.1"}, |
154 | {}, | ||
193 | }; | 155 | }; |
194 | 156 | ||
195 | static const struct dev_pm_ops ufshcd_dev_pm_ops = { | 157 | static const struct dev_pm_ops ufshcd_dev_pm_ops = { |
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c32a478df81b..b743bd6fce6b 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c | |||
@@ -33,8 +33,16 @@ | |||
33 | * this program. | 33 | * this program. |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include <linux/async.h> | ||
37 | |||
36 | #include "ufshcd.h" | 38 | #include "ufshcd.h" |
37 | 39 | ||
40 | #define UFSHCD_ENABLE_INTRS (UTP_TRANSFER_REQ_COMPL |\ | ||
41 | UTP_TASK_REQ_COMPL |\ | ||
42 | UFSHCD_ERROR_MASK) | ||
43 | /* UIC command timeout, unit: ms */ | ||
44 | #define UIC_CMD_TIMEOUT 500 | ||
45 | |||
38 | enum { | 46 | enum { |
39 | UFSHCD_MAX_CHANNEL = 0, | 47 | UFSHCD_MAX_CHANNEL = 0, |
40 | UFSHCD_MAX_ID = 1, | 48 | UFSHCD_MAX_ID = 1, |
@@ -64,6 +72,20 @@ enum { | |||
64 | }; | 72 | }; |
65 | 73 | ||
66 | /** | 74 | /** |
75 | * ufshcd_get_intr_mask - Get the interrupt bit mask | ||
76 | * @hba - Pointer to adapter instance | ||
77 | * | ||
78 | * Returns interrupt bit mask per version | ||
79 | */ | ||
80 | static inline u32 ufshcd_get_intr_mask(struct ufs_hba *hba) | ||
81 | { | ||
82 | if (hba->ufs_version == UFSHCI_VERSION_10) | ||
83 | return INTERRUPT_MASK_ALL_VER_10; | ||
84 | else | ||
85 | return INTERRUPT_MASK_ALL_VER_11; | ||
86 | } | ||
87 | |||
88 | /** | ||
67 | * ufshcd_get_ufs_version - Get the UFS version supported by the HBA | 89 | * ufshcd_get_ufs_version - Get the UFS version supported by the HBA |
68 | * @hba - Pointer to adapter instance | 90 | * @hba - Pointer to adapter instance |
69 | * | 91 | * |
@@ -71,7 +93,7 @@ enum { | |||
71 | */ | 93 | */ |
72 | static inline u32 ufshcd_get_ufs_version(struct ufs_hba *hba) | 94 | static inline u32 ufshcd_get_ufs_version(struct ufs_hba *hba) |
73 | { | 95 | { |
74 | return readl(hba->mmio_base + REG_UFS_VERSION); | 96 | return ufshcd_readl(hba, REG_UFS_VERSION); |
75 | } | 97 | } |
76 | 98 | ||
77 | /** | 99 | /** |
@@ -130,8 +152,7 @@ static inline int ufshcd_get_tm_free_slot(struct ufs_hba *hba) | |||
130 | */ | 152 | */ |
131 | static inline void ufshcd_utrl_clear(struct ufs_hba *hba, u32 pos) | 153 | static inline void ufshcd_utrl_clear(struct ufs_hba *hba, u32 pos) |
132 | { | 154 | { |
133 | writel(~(1 << pos), | 155 | ufshcd_writel(hba, ~(1 << pos), REG_UTP_TRANSFER_REQ_LIST_CLEAR); |
134 | (hba->mmio_base + REG_UTP_TRANSFER_REQ_LIST_CLEAR)); | ||
135 | } | 156 | } |
136 | 157 | ||
137 | /** | 158 | /** |
@@ -165,43 +186,11 @@ static inline int ufshcd_get_lists_status(u32 reg) | |||
165 | */ | 186 | */ |
166 | static inline int ufshcd_get_uic_cmd_result(struct ufs_hba *hba) | 187 | static inline int ufshcd_get_uic_cmd_result(struct ufs_hba *hba) |
167 | { | 188 | { |
168 | return readl(hba->mmio_base + REG_UIC_COMMAND_ARG_2) & | 189 | return ufshcd_readl(hba, REG_UIC_COMMAND_ARG_2) & |
169 | MASK_UIC_COMMAND_RESULT; | 190 | MASK_UIC_COMMAND_RESULT; |
170 | } | 191 | } |
171 | 192 | ||
172 | /** | 193 | /** |
173 | * ufshcd_free_hba_memory - Free allocated memory for LRB, request | ||
174 | * and task lists | ||
175 | * @hba: Pointer to adapter instance | ||
176 | */ | ||
177 | static inline void ufshcd_free_hba_memory(struct ufs_hba *hba) | ||
178 | { | ||
179 | size_t utmrdl_size, utrdl_size, ucdl_size; | ||
180 | |||
181 | kfree(hba->lrb); | ||
182 | |||
183 | if (hba->utmrdl_base_addr) { | ||
184 | utmrdl_size = sizeof(struct utp_task_req_desc) * hba->nutmrs; | ||
185 | dma_free_coherent(hba->dev, utmrdl_size, | ||
186 | hba->utmrdl_base_addr, hba->utmrdl_dma_addr); | ||
187 | } | ||
188 | |||
189 | if (hba->utrdl_base_addr) { | ||
190 | utrdl_size = | ||
191 | (sizeof(struct utp_transfer_req_desc) * hba->nutrs); | ||
192 | dma_free_coherent(hba->dev, utrdl_size, | ||
193 | hba->utrdl_base_addr, hba->utrdl_dma_addr); | ||
194 | } | ||
195 | |||
196 | if (hba->ucdl_base_addr) { | ||
197 | ucdl_size = | ||
198 | (sizeof(struct utp_transfer_cmd_desc) * hba->nutrs); | ||
199 | dma_free_coherent(hba->dev, ucdl_size, | ||
200 | hba->ucdl_base_addr, hba->ucdl_dma_addr); | ||
201 | } | ||
202 | } | ||
203 | |||
204 | /** | ||
205 | * ufshcd_is_valid_req_rsp - checks if controller TR response is valid | 194 | * ufshcd_is_valid_req_rsp - checks if controller TR response is valid |
206 | * @ucd_rsp_ptr: pointer to response UPIU | 195 | * @ucd_rsp_ptr: pointer to response UPIU |
207 | * | 196 | * |
@@ -243,18 +232,15 @@ ufshcd_config_int_aggr(struct ufs_hba *hba, int option) | |||
243 | { | 232 | { |
244 | switch (option) { | 233 | switch (option) { |
245 | case INT_AGGR_RESET: | 234 | case INT_AGGR_RESET: |
246 | writel((INT_AGGR_ENABLE | | 235 | ufshcd_writel(hba, INT_AGGR_ENABLE | |
247 | INT_AGGR_COUNTER_AND_TIMER_RESET), | 236 | INT_AGGR_COUNTER_AND_TIMER_RESET, |
248 | (hba->mmio_base + | 237 | REG_UTP_TRANSFER_REQ_INT_AGG_CONTROL); |
249 | REG_UTP_TRANSFER_REQ_INT_AGG_CONTROL)); | ||
250 | break; | 238 | break; |
251 | case INT_AGGR_CONFIG: | 239 | case INT_AGGR_CONFIG: |
252 | writel((INT_AGGR_ENABLE | | 240 | ufshcd_writel(hba, INT_AGGR_ENABLE | INT_AGGR_PARAM_WRITE | |
253 | INT_AGGR_PARAM_WRITE | | 241 | INT_AGGR_COUNTER_THRESHOLD_VALUE | |
254 | INT_AGGR_COUNTER_THRESHOLD_VALUE | | 242 | INT_AGGR_TIMEOUT_VALUE, |
255 | INT_AGGR_TIMEOUT_VALUE), | 243 | REG_UTP_TRANSFER_REQ_INT_AGG_CONTROL); |
256 | (hba->mmio_base + | ||
257 | REG_UTP_TRANSFER_REQ_INT_AGG_CONTROL)); | ||
258 | break; | 244 | break; |
259 | } | 245 | } |
260 | } | 246 | } |
@@ -267,12 +253,10 @@ ufshcd_config_int_aggr(struct ufs_hba *hba, int option) | |||
267 | */ | 253 | */ |
268 | static void ufshcd_enable_run_stop_reg(struct ufs_hba *hba) | 254 | static void ufshcd_enable_run_stop_reg(struct ufs_hba *hba) |
269 | { | 255 | { |
270 | writel(UTP_TASK_REQ_LIST_RUN_STOP_BIT, | 256 | ufshcd_writel(hba, UTP_TASK_REQ_LIST_RUN_STOP_BIT, |
271 | (hba->mmio_base + | 257 | REG_UTP_TASK_REQ_LIST_RUN_STOP); |
272 | REG_UTP_TASK_REQ_LIST_RUN_STOP)); | 258 | ufshcd_writel(hba, UTP_TRANSFER_REQ_LIST_RUN_STOP_BIT, |
273 | writel(UTP_TRANSFER_REQ_LIST_RUN_STOP_BIT, | 259 | REG_UTP_TRANSFER_REQ_LIST_RUN_STOP); |
274 | (hba->mmio_base + | ||
275 | REG_UTP_TRANSFER_REQ_LIST_RUN_STOP)); | ||
276 | } | 260 | } |
277 | 261 | ||
278 | /** | 262 | /** |
@@ -281,7 +265,7 @@ static void ufshcd_enable_run_stop_reg(struct ufs_hba *hba) | |||
281 | */ | 265 | */ |
282 | static inline void ufshcd_hba_start(struct ufs_hba *hba) | 266 | static inline void ufshcd_hba_start(struct ufs_hba *hba) |
283 | { | 267 | { |
284 | writel(CONTROLLER_ENABLE , (hba->mmio_base + REG_CONTROLLER_ENABLE)); | 268 | ufshcd_writel(hba, CONTROLLER_ENABLE, REG_CONTROLLER_ENABLE); |
285 | } | 269 | } |
286 | 270 | ||
287 | /** | 271 | /** |
@@ -292,7 +276,7 @@ static inline void ufshcd_hba_start(struct ufs_hba *hba) | |||
292 | */ | 276 | */ |
293 | static inline int ufshcd_is_hba_active(struct ufs_hba *hba) | 277 | static inline int ufshcd_is_hba_active(struct ufs_hba *hba) |
294 | { | 278 | { |
295 | return (readl(hba->mmio_base + REG_CONTROLLER_ENABLE) & 0x1) ? 0 : 1; | 279 | return (ufshcd_readl(hba, REG_CONTROLLER_ENABLE) & 0x1) ? 0 : 1; |
296 | } | 280 | } |
297 | 281 | ||
298 | /** | 282 | /** |
@@ -304,8 +288,7 @@ static inline | |||
304 | void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag) | 288 | void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag) |
305 | { | 289 | { |
306 | __set_bit(task_tag, &hba->outstanding_reqs); | 290 | __set_bit(task_tag, &hba->outstanding_reqs); |
307 | writel((1 << task_tag), | 291 | ufshcd_writel(hba, 1 << task_tag, REG_UTP_TRANSFER_REQ_DOOR_BELL); |
308 | (hba->mmio_base + REG_UTP_TRANSFER_REQ_DOOR_BELL)); | ||
309 | } | 292 | } |
310 | 293 | ||
311 | /** | 294 | /** |
@@ -329,8 +312,7 @@ static inline void ufshcd_copy_sense_data(struct ufshcd_lrb *lrbp) | |||
329 | */ | 312 | */ |
330 | static inline void ufshcd_hba_capabilities(struct ufs_hba *hba) | 313 | static inline void ufshcd_hba_capabilities(struct ufs_hba *hba) |
331 | { | 314 | { |
332 | hba->capabilities = | 315 | hba->capabilities = ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES); |
333 | readl(hba->mmio_base + REG_CONTROLLER_CAPABILITIES); | ||
334 | 316 | ||
335 | /* nutrs and nutmrs are 0 based values */ | 317 | /* nutrs and nutmrs are 0 based values */ |
336 | hba->nutrs = (hba->capabilities & MASK_TRANSFER_REQUESTS_SLOTS) + 1; | 318 | hba->nutrs = (hba->capabilities & MASK_TRANSFER_REQUESTS_SLOTS) + 1; |
@@ -339,24 +321,119 @@ static inline void ufshcd_hba_capabilities(struct ufs_hba *hba) | |||
339 | } | 321 | } |
340 | 322 | ||
341 | /** | 323 | /** |
342 | * ufshcd_send_uic_command - Send UIC commands to unipro layers | 324 | * ufshcd_ready_for_uic_cmd - Check if controller is ready |
325 | * to accept UIC commands | ||
343 | * @hba: per adapter instance | 326 | * @hba: per adapter instance |
344 | * @uic_command: UIC command | 327 | * Return true on success, else false |
328 | */ | ||
329 | static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba) | ||
330 | { | ||
331 | if (ufshcd_readl(hba, REG_CONTROLLER_STATUS) & UIC_COMMAND_READY) | ||
332 | return true; | ||
333 | else | ||
334 | return false; | ||
335 | } | ||
336 | |||
337 | /** | ||
338 | * ufshcd_dispatch_uic_cmd - Dispatch UIC commands to unipro layers | ||
339 | * @hba: per adapter instance | ||
340 | * @uic_cmd: UIC command | ||
341 | * | ||
342 | * Mutex must be held. | ||
345 | */ | 343 | */ |
346 | static inline void | 344 | static inline void |
347 | ufshcd_send_uic_command(struct ufs_hba *hba, struct uic_command *uic_cmnd) | 345 | ufshcd_dispatch_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) |
348 | { | 346 | { |
347 | WARN_ON(hba->active_uic_cmd); | ||
348 | |||
349 | hba->active_uic_cmd = uic_cmd; | ||
350 | |||
349 | /* Write Args */ | 351 | /* Write Args */ |
350 | writel(uic_cmnd->argument1, | 352 | ufshcd_writel(hba, uic_cmd->argument1, REG_UIC_COMMAND_ARG_1); |
351 | (hba->mmio_base + REG_UIC_COMMAND_ARG_1)); | 353 | ufshcd_writel(hba, uic_cmd->argument2, REG_UIC_COMMAND_ARG_2); |
352 | writel(uic_cmnd->argument2, | 354 | ufshcd_writel(hba, uic_cmd->argument3, REG_UIC_COMMAND_ARG_3); |
353 | (hba->mmio_base + REG_UIC_COMMAND_ARG_2)); | ||
354 | writel(uic_cmnd->argument3, | ||
355 | (hba->mmio_base + REG_UIC_COMMAND_ARG_3)); | ||
356 | 355 | ||
357 | /* Write UIC Cmd */ | 356 | /* Write UIC Cmd */ |
358 | writel((uic_cmnd->command & COMMAND_OPCODE_MASK), | 357 | ufshcd_writel(hba, uic_cmd->command & COMMAND_OPCODE_MASK, |
359 | (hba->mmio_base + REG_UIC_COMMAND)); | 358 | REG_UIC_COMMAND); |
359 | } | ||
360 | |||
361 | /** | ||
362 | * ufshcd_wait_for_uic_cmd - Wait complectioin of UIC command | ||
363 | * @hba: per adapter instance | ||
364 | * @uic_command: UIC command | ||
365 | * | ||
366 | * Must be called with mutex held. | ||
367 | * Returns 0 only if success. | ||
368 | */ | ||
369 | static int | ||
370 | ufshcd_wait_for_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) | ||
371 | { | ||
372 | int ret; | ||
373 | unsigned long flags; | ||
374 | |||
375 | if (wait_for_completion_timeout(&uic_cmd->done, | ||
376 | msecs_to_jiffies(UIC_CMD_TIMEOUT))) | ||
377 | ret = uic_cmd->argument2 & MASK_UIC_COMMAND_RESULT; | ||
378 | else | ||
379 | ret = -ETIMEDOUT; | ||
380 | |||
381 | spin_lock_irqsave(hba->host->host_lock, flags); | ||
382 | hba->active_uic_cmd = NULL; | ||
383 | spin_unlock_irqrestore(hba->host->host_lock, flags); | ||
384 | |||
385 | return ret; | ||
386 | } | ||
387 | |||
388 | /** | ||
389 | * __ufshcd_send_uic_cmd - Send UIC commands and retrieve the result | ||
390 | * @hba: per adapter instance | ||
391 | * @uic_cmd: UIC command | ||
392 | * | ||
393 | * Identical to ufshcd_send_uic_cmd() expect mutex. Must be called | ||
394 | * with mutex held. | ||
395 | * Returns 0 only if success. | ||
396 | */ | ||
397 | static int | ||
398 | __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) | ||
399 | { | ||
400 | int ret; | ||
401 | unsigned long flags; | ||
402 | |||
403 | if (!ufshcd_ready_for_uic_cmd(hba)) { | ||
404 | dev_err(hba->dev, | ||
405 | "Controller not ready to accept UIC commands\n"); | ||
406 | return -EIO; | ||
407 | } | ||
408 | |||
409 | init_completion(&uic_cmd->done); | ||
410 | |||
411 | spin_lock_irqsave(hba->host->host_lock, flags); | ||
412 | ufshcd_dispatch_uic_cmd(hba, uic_cmd); | ||
413 | spin_unlock_irqrestore(hba->host->host_lock, flags); | ||
414 | |||
415 | ret = ufshcd_wait_for_uic_cmd(hba, uic_cmd); | ||
416 | |||
417 | return ret; | ||
418 | } | ||
419 | |||
420 | /** | ||
421 | * ufshcd_send_uic_cmd - Send UIC commands and retrieve the result | ||
422 | * @hba: per adapter instance | ||
423 | * @uic_cmd: UIC command | ||
424 | * | ||
425 | * Returns 0 only if success. | ||
426 | */ | ||
427 | static int | ||
428 | ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) | ||
429 | { | ||
430 | int ret; | ||
431 | |||
432 | mutex_lock(&hba->uic_cmd_mutex); | ||
433 | ret = __ufshcd_send_uic_cmd(hba, uic_cmd); | ||
434 | mutex_unlock(&hba->uic_cmd_mutex); | ||
435 | |||
436 | return ret; | ||
360 | } | 437 | } |
361 | 438 | ||
362 | /** | 439 | /** |
@@ -400,26 +477,45 @@ static int ufshcd_map_sg(struct ufshcd_lrb *lrbp) | |||
400 | } | 477 | } |
401 | 478 | ||
402 | /** | 479 | /** |
403 | * ufshcd_int_config - enable/disable interrupts | 480 | * ufshcd_enable_intr - enable interrupts |
404 | * @hba: per adapter instance | 481 | * @hba: per adapter instance |
405 | * @option: interrupt option | 482 | * @intrs: interrupt bits |
406 | */ | 483 | */ |
407 | static void ufshcd_int_config(struct ufs_hba *hba, u32 option) | 484 | static void ufshcd_enable_intr(struct ufs_hba *hba, u32 intrs) |
408 | { | 485 | { |
409 | switch (option) { | 486 | u32 set = ufshcd_readl(hba, REG_INTERRUPT_ENABLE); |
410 | case UFSHCD_INT_ENABLE: | 487 | |
411 | writel(hba->int_enable_mask, | 488 | if (hba->ufs_version == UFSHCI_VERSION_10) { |
412 | (hba->mmio_base + REG_INTERRUPT_ENABLE)); | 489 | u32 rw; |
413 | break; | 490 | rw = set & INTERRUPT_MASK_RW_VER_10; |
414 | case UFSHCD_INT_DISABLE: | 491 | set = rw | ((set ^ intrs) & intrs); |
415 | if (hba->ufs_version == UFSHCI_VERSION_10) | 492 | } else { |
416 | writel(INTERRUPT_DISABLE_MASK_10, | 493 | set |= intrs; |
417 | (hba->mmio_base + REG_INTERRUPT_ENABLE)); | 494 | } |
418 | else | 495 | |
419 | writel(INTERRUPT_DISABLE_MASK_11, | 496 | ufshcd_writel(hba, set, REG_INTERRUPT_ENABLE); |
420 | (hba->mmio_base + REG_INTERRUPT_ENABLE)); | 497 | } |
421 | break; | 498 | |
499 | /** | ||
500 | * ufshcd_disable_intr - disable interrupts | ||
501 | * @hba: per adapter instance | ||
502 | * @intrs: interrupt bits | ||
503 | */ | ||
504 | static void ufshcd_disable_intr(struct ufs_hba *hba, u32 intrs) | ||
505 | { | ||
506 | u32 set = ufshcd_readl(hba, REG_INTERRUPT_ENABLE); | ||
507 | |||
508 | if (hba->ufs_version == UFSHCI_VERSION_10) { | ||
509 | u32 rw; | ||
510 | rw = (set & INTERRUPT_MASK_RW_VER_10) & | ||
511 | ~(intrs & INTERRUPT_MASK_RW_VER_10); | ||
512 | set = rw | ((set & intrs) & ~INTERRUPT_MASK_RW_VER_10); | ||
513 | |||
514 | } else { | ||
515 | set &= ~intrs; | ||
422 | } | 516 | } |
517 | |||
518 | ufshcd_writel(hba, set, REG_INTERRUPT_ENABLE); | ||
423 | } | 519 | } |
424 | 520 | ||
425 | /** | 521 | /** |
@@ -562,10 +658,10 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba) | |||
562 | 658 | ||
563 | /* Allocate memory for UTP command descriptors */ | 659 | /* Allocate memory for UTP command descriptors */ |
564 | ucdl_size = (sizeof(struct utp_transfer_cmd_desc) * hba->nutrs); | 660 | ucdl_size = (sizeof(struct utp_transfer_cmd_desc) * hba->nutrs); |
565 | hba->ucdl_base_addr = dma_alloc_coherent(hba->dev, | 661 | hba->ucdl_base_addr = dmam_alloc_coherent(hba->dev, |
566 | ucdl_size, | 662 | ucdl_size, |
567 | &hba->ucdl_dma_addr, | 663 | &hba->ucdl_dma_addr, |
568 | GFP_KERNEL); | 664 | GFP_KERNEL); |
569 | 665 | ||
570 | /* | 666 | /* |
571 | * UFSHCI requires UTP command descriptor to be 128 byte aligned. | 667 | * UFSHCI requires UTP command descriptor to be 128 byte aligned. |
@@ -585,10 +681,10 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba) | |||
585 | * UFSHCI requires 1024 byte alignment of UTRD | 681 | * UFSHCI requires 1024 byte alignment of UTRD |
586 | */ | 682 | */ |
587 | utrdl_size = (sizeof(struct utp_transfer_req_desc) * hba->nutrs); | 683 | utrdl_size = (sizeof(struct utp_transfer_req_desc) * hba->nutrs); |
588 | hba->utrdl_base_addr = dma_alloc_coherent(hba->dev, | 684 | hba->utrdl_base_addr = dmam_alloc_coherent(hba->dev, |
589 | utrdl_size, | 685 | utrdl_size, |
590 | &hba->utrdl_dma_addr, | 686 | &hba->utrdl_dma_addr, |
591 | GFP_KERNEL); | 687 | GFP_KERNEL); |
592 | if (!hba->utrdl_base_addr || | 688 | if (!hba->utrdl_base_addr || |
593 | WARN_ON(hba->utrdl_dma_addr & (PAGE_SIZE - 1))) { | 689 | WARN_ON(hba->utrdl_dma_addr & (PAGE_SIZE - 1))) { |
594 | dev_err(hba->dev, | 690 | dev_err(hba->dev, |
@@ -601,10 +697,10 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba) | |||
601 | * UFSHCI requires 1024 byte alignment of UTMRD | 697 | * UFSHCI requires 1024 byte alignment of UTMRD |
602 | */ | 698 | */ |
603 | utmrdl_size = sizeof(struct utp_task_req_desc) * hba->nutmrs; | 699 | utmrdl_size = sizeof(struct utp_task_req_desc) * hba->nutmrs; |
604 | hba->utmrdl_base_addr = dma_alloc_coherent(hba->dev, | 700 | hba->utmrdl_base_addr = dmam_alloc_coherent(hba->dev, |
605 | utmrdl_size, | 701 | utmrdl_size, |
606 | &hba->utmrdl_dma_addr, | 702 | &hba->utmrdl_dma_addr, |
607 | GFP_KERNEL); | 703 | GFP_KERNEL); |
608 | if (!hba->utmrdl_base_addr || | 704 | if (!hba->utmrdl_base_addr || |
609 | WARN_ON(hba->utmrdl_dma_addr & (PAGE_SIZE - 1))) { | 705 | WARN_ON(hba->utmrdl_dma_addr & (PAGE_SIZE - 1))) { |
610 | dev_err(hba->dev, | 706 | dev_err(hba->dev, |
@@ -613,14 +709,15 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba) | |||
613 | } | 709 | } |
614 | 710 | ||
615 | /* Allocate memory for local reference block */ | 711 | /* Allocate memory for local reference block */ |
616 | hba->lrb = kcalloc(hba->nutrs, sizeof(struct ufshcd_lrb), GFP_KERNEL); | 712 | hba->lrb = devm_kzalloc(hba->dev, |
713 | hba->nutrs * sizeof(struct ufshcd_lrb), | ||
714 | GFP_KERNEL); | ||
617 | if (!hba->lrb) { | 715 | if (!hba->lrb) { |
618 | dev_err(hba->dev, "LRB Memory allocation failed\n"); | 716 | dev_err(hba->dev, "LRB Memory allocation failed\n"); |
619 | goto out; | 717 | goto out; |
620 | } | 718 | } |
621 | return 0; | 719 | return 0; |
622 | out: | 720 | out: |
623 | ufshcd_free_hba_memory(hba); | ||
624 | return -ENOMEM; | 721 | return -ENOMEM; |
625 | } | 722 | } |
626 | 723 | ||
@@ -674,7 +771,7 @@ static void ufshcd_host_memory_configure(struct ufs_hba *hba) | |||
674 | utrdlp[i].prd_table_offset = | 771 | utrdlp[i].prd_table_offset = |
675 | cpu_to_le16((prdt_offset >> 2)); | 772 | cpu_to_le16((prdt_offset >> 2)); |
676 | utrdlp[i].response_upiu_length = | 773 | utrdlp[i].response_upiu_length = |
677 | cpu_to_le16(ALIGNED_UPIU_SIZE); | 774 | cpu_to_le16(ALIGNED_UPIU_SIZE >> 2); |
678 | 775 | ||
679 | hba->lrb[i].utr_descriptor_ptr = (utrdlp + i); | 776 | hba->lrb[i].utr_descriptor_ptr = (utrdlp + i); |
680 | hba->lrb[i].ucd_cmd_ptr = | 777 | hba->lrb[i].ucd_cmd_ptr = |
@@ -699,35 +796,16 @@ static void ufshcd_host_memory_configure(struct ufs_hba *hba) | |||
699 | */ | 796 | */ |
700 | static int ufshcd_dme_link_startup(struct ufs_hba *hba) | 797 | static int ufshcd_dme_link_startup(struct ufs_hba *hba) |
701 | { | 798 | { |
702 | struct uic_command *uic_cmd; | 799 | struct uic_command uic_cmd = {0}; |
703 | unsigned long flags; | 800 | int ret; |
704 | 801 | ||
705 | /* check if controller is ready to accept UIC commands */ | 802 | uic_cmd.command = UIC_CMD_DME_LINK_STARTUP; |
706 | if (((readl(hba->mmio_base + REG_CONTROLLER_STATUS)) & | ||
707 | UIC_COMMAND_READY) == 0x0) { | ||
708 | dev_err(hba->dev, | ||
709 | "Controller not ready" | ||
710 | " to accept UIC commands\n"); | ||
711 | return -EIO; | ||
712 | } | ||
713 | 803 | ||
714 | spin_lock_irqsave(hba->host->host_lock, flags); | 804 | ret = ufshcd_send_uic_cmd(hba, &uic_cmd); |
715 | 805 | if (ret) | |
716 | /* form UIC command */ | 806 | dev_err(hba->dev, |
717 | uic_cmd = &hba->active_uic_cmd; | 807 | "dme-link-startup: error code %d\n", ret); |
718 | uic_cmd->command = UIC_CMD_DME_LINK_STARTUP; | 808 | return ret; |
719 | uic_cmd->argument1 = 0; | ||
720 | uic_cmd->argument2 = 0; | ||
721 | uic_cmd->argument3 = 0; | ||
722 | |||
723 | /* enable UIC related interrupts */ | ||
724 | hba->int_enable_mask |= UIC_COMMAND_COMPL; | ||
725 | ufshcd_int_config(hba, UFSHCD_INT_ENABLE); | ||
726 | |||
727 | /* sending UIC commands to controller */ | ||
728 | ufshcd_send_uic_command(hba, uic_cmd); | ||
729 | spin_unlock_irqrestore(hba->host->host_lock, flags); | ||
730 | return 0; | ||
731 | } | 809 | } |
732 | 810 | ||
733 | /** | 811 | /** |
@@ -736,9 +814,10 @@ static int ufshcd_dme_link_startup(struct ufs_hba *hba) | |||
736 | * | 814 | * |
737 | * To bring UFS host controller to operational state, | 815 | * To bring UFS host controller to operational state, |
738 | * 1. Check if device is present | 816 | * 1. Check if device is present |
739 | * 2. Configure run-stop-registers | 817 | * 2. Enable required interrupts |
740 | * 3. Enable required interrupts | 818 | * 3. Configure interrupt aggregation |
741 | * 4. Configure interrupt aggregation | 819 | * 4. Program UTRL and UTMRL base addres |
820 | * 5. Configure run-stop-registers | ||
742 | * | 821 | * |
743 | * Returns 0 on success, non-zero value on failure | 822 | * Returns 0 on success, non-zero value on failure |
744 | */ | 823 | */ |
@@ -748,13 +827,29 @@ static int ufshcd_make_hba_operational(struct ufs_hba *hba) | |||
748 | u32 reg; | 827 | u32 reg; |
749 | 828 | ||
750 | /* check if device present */ | 829 | /* check if device present */ |
751 | reg = readl((hba->mmio_base + REG_CONTROLLER_STATUS)); | 830 | reg = ufshcd_readl(hba, REG_CONTROLLER_STATUS); |
752 | if (!ufshcd_is_device_present(reg)) { | 831 | if (!ufshcd_is_device_present(reg)) { |
753 | dev_err(hba->dev, "cc: Device not present\n"); | 832 | dev_err(hba->dev, "cc: Device not present\n"); |
754 | err = -ENXIO; | 833 | err = -ENXIO; |
755 | goto out; | 834 | goto out; |
756 | } | 835 | } |
757 | 836 | ||
837 | /* Enable required interrupts */ | ||
838 | ufshcd_enable_intr(hba, UFSHCD_ENABLE_INTRS); | ||
839 | |||
840 | /* Configure interrupt aggregation */ | ||
841 | ufshcd_config_int_aggr(hba, INT_AGGR_CONFIG); | ||
842 | |||
843 | /* Configure UTRL and UTMRL base address registers */ | ||
844 | ufshcd_writel(hba, lower_32_bits(hba->utrdl_dma_addr), | ||
845 | REG_UTP_TRANSFER_REQ_LIST_BASE_L); | ||
846 | ufshcd_writel(hba, upper_32_bits(hba->utrdl_dma_addr), | ||
847 | REG_UTP_TRANSFER_REQ_LIST_BASE_H); | ||
848 | ufshcd_writel(hba, lower_32_bits(hba->utmrdl_dma_addr), | ||
849 | REG_UTP_TASK_REQ_LIST_BASE_L); | ||
850 | ufshcd_writel(hba, upper_32_bits(hba->utmrdl_dma_addr), | ||
851 | REG_UTP_TASK_REQ_LIST_BASE_H); | ||
852 | |||
758 | /* | 853 | /* |
759 | * UCRDY, UTMRLDY and UTRLRDY bits must be 1 | 854 | * UCRDY, UTMRLDY and UTRLRDY bits must be 1 |
760 | * DEI, HEI bits must be 0 | 855 | * DEI, HEI bits must be 0 |
@@ -768,23 +863,11 @@ static int ufshcd_make_hba_operational(struct ufs_hba *hba) | |||
768 | goto out; | 863 | goto out; |
769 | } | 864 | } |
770 | 865 | ||
771 | /* Enable required interrupts */ | ||
772 | hba->int_enable_mask |= (UTP_TRANSFER_REQ_COMPL | | ||
773 | UIC_ERROR | | ||
774 | UTP_TASK_REQ_COMPL | | ||
775 | DEVICE_FATAL_ERROR | | ||
776 | CONTROLLER_FATAL_ERROR | | ||
777 | SYSTEM_BUS_FATAL_ERROR); | ||
778 | ufshcd_int_config(hba, UFSHCD_INT_ENABLE); | ||
779 | |||
780 | /* Configure interrupt aggregation */ | ||
781 | ufshcd_config_int_aggr(hba, INT_AGGR_CONFIG); | ||
782 | |||
783 | if (hba->ufshcd_state == UFSHCD_STATE_RESET) | 866 | if (hba->ufshcd_state == UFSHCD_STATE_RESET) |
784 | scsi_unblock_requests(hba->host); | 867 | scsi_unblock_requests(hba->host); |
785 | 868 | ||
786 | hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL; | 869 | hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL; |
787 | scsi_scan_host(hba->host); | 870 | |
788 | out: | 871 | out: |
789 | return err; | 872 | return err; |
790 | } | 873 | } |
@@ -853,34 +936,28 @@ static int ufshcd_hba_enable(struct ufs_hba *hba) | |||
853 | } | 936 | } |
854 | 937 | ||
855 | /** | 938 | /** |
856 | * ufshcd_initialize_hba - start the initialization process | 939 | * ufshcd_link_startup - Initialize unipro link startup |
857 | * @hba: per adapter instance | 940 | * @hba: per adapter instance |
858 | * | 941 | * |
859 | * 1. Enable the controller via ufshcd_hba_enable. | 942 | * Returns 0 for success, non-zero in case of failure |
860 | * 2. Program the Transfer Request List Address with the starting address of | ||
861 | * UTRDL. | ||
862 | * 3. Program the Task Management Request List Address with starting address | ||
863 | * of UTMRDL. | ||
864 | * | ||
865 | * Returns 0 on success, non-zero value on failure. | ||
866 | */ | 943 | */ |
867 | static int ufshcd_initialize_hba(struct ufs_hba *hba) | 944 | static int ufshcd_link_startup(struct ufs_hba *hba) |
868 | { | 945 | { |
869 | if (ufshcd_hba_enable(hba)) | 946 | int ret; |
870 | return -EIO; | ||
871 | 947 | ||
872 | /* Configure UTRL and UTMRL base address registers */ | 948 | /* enable UIC related interrupts */ |
873 | writel(lower_32_bits(hba->utrdl_dma_addr), | 949 | ufshcd_enable_intr(hba, UIC_COMMAND_COMPL); |
874 | (hba->mmio_base + REG_UTP_TRANSFER_REQ_LIST_BASE_L)); | 950 | |
875 | writel(upper_32_bits(hba->utrdl_dma_addr), | 951 | ret = ufshcd_dme_link_startup(hba); |
876 | (hba->mmio_base + REG_UTP_TRANSFER_REQ_LIST_BASE_H)); | 952 | if (ret) |
877 | writel(lower_32_bits(hba->utmrdl_dma_addr), | 953 | goto out; |
878 | (hba->mmio_base + REG_UTP_TASK_REQ_LIST_BASE_L)); | 954 | |
879 | writel(upper_32_bits(hba->utmrdl_dma_addr), | 955 | ret = ufshcd_make_hba_operational(hba); |
880 | (hba->mmio_base + REG_UTP_TASK_REQ_LIST_BASE_H)); | 956 | |
881 | 957 | out: | |
882 | /* Initialize unipro link startup procedure */ | 958 | if (ret) |
883 | return ufshcd_dme_link_startup(hba); | 959 | dev_err(hba->dev, "link startup failed %d\n", ret); |
960 | return ret; | ||
884 | } | 961 | } |
885 | 962 | ||
886 | /** | 963 | /** |
@@ -920,12 +997,19 @@ static int ufshcd_do_reset(struct ufs_hba *hba) | |||
920 | hba->outstanding_reqs = 0; | 997 | hba->outstanding_reqs = 0; |
921 | hba->outstanding_tasks = 0; | 998 | hba->outstanding_tasks = 0; |
922 | 999 | ||
923 | /* start the initialization process */ | 1000 | /* Host controller enable */ |
924 | if (ufshcd_initialize_hba(hba)) { | 1001 | if (ufshcd_hba_enable(hba)) { |
925 | dev_err(hba->dev, | 1002 | dev_err(hba->dev, |
926 | "Reset: Controller initialization failed\n"); | 1003 | "Reset: Controller initialization failed\n"); |
927 | return FAILED; | 1004 | return FAILED; |
928 | } | 1005 | } |
1006 | |||
1007 | if (ufshcd_link_startup(hba)) { | ||
1008 | dev_err(hba->dev, | ||
1009 | "Reset: Link start-up failed\n"); | ||
1010 | return FAILED; | ||
1011 | } | ||
1012 | |||
929 | return SUCCESS; | 1013 | return SUCCESS; |
930 | } | 1014 | } |
931 | 1015 | ||
@@ -1157,6 +1241,19 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) | |||
1157 | } | 1241 | } |
1158 | 1242 | ||
1159 | /** | 1243 | /** |
1244 | * ufshcd_uic_cmd_compl - handle completion of uic command | ||
1245 | * @hba: per adapter instance | ||
1246 | */ | ||
1247 | static void ufshcd_uic_cmd_compl(struct ufs_hba *hba) | ||
1248 | { | ||
1249 | if (hba->active_uic_cmd) { | ||
1250 | hba->active_uic_cmd->argument2 |= | ||
1251 | ufshcd_get_uic_cmd_result(hba); | ||
1252 | complete(&hba->active_uic_cmd->done); | ||
1253 | } | ||
1254 | } | ||
1255 | |||
1256 | /** | ||
1160 | * ufshcd_transfer_req_compl - handle SCSI and query command completion | 1257 | * ufshcd_transfer_req_compl - handle SCSI and query command completion |
1161 | * @hba: per adapter instance | 1258 | * @hba: per adapter instance |
1162 | */ | 1259 | */ |
@@ -1169,8 +1266,7 @@ static void ufshcd_transfer_req_compl(struct ufs_hba *hba) | |||
1169 | int index; | 1266 | int index; |
1170 | 1267 | ||
1171 | lrb = hba->lrb; | 1268 | lrb = hba->lrb; |
1172 | tr_doorbell = | 1269 | tr_doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL); |
1173 | readl(hba->mmio_base + REG_UTP_TRANSFER_REQ_DOOR_BELL); | ||
1174 | completed_reqs = tr_doorbell ^ hba->outstanding_reqs; | 1270 | completed_reqs = tr_doorbell ^ hba->outstanding_reqs; |
1175 | 1271 | ||
1176 | for (index = 0; index < hba->nutrs; index++) { | 1272 | for (index = 0; index < hba->nutrs; index++) { |
@@ -1197,28 +1293,6 @@ static void ufshcd_transfer_req_compl(struct ufs_hba *hba) | |||
1197 | } | 1293 | } |
1198 | 1294 | ||
1199 | /** | 1295 | /** |
1200 | * ufshcd_uic_cc_handler - handle UIC command completion | ||
1201 | * @work: pointer to a work queue structure | ||
1202 | * | ||
1203 | * Returns 0 on success, non-zero value on failure | ||
1204 | */ | ||
1205 | static void ufshcd_uic_cc_handler (struct work_struct *work) | ||
1206 | { | ||
1207 | struct ufs_hba *hba; | ||
1208 | |||
1209 | hba = container_of(work, struct ufs_hba, uic_workq); | ||
1210 | |||
1211 | if ((hba->active_uic_cmd.command == UIC_CMD_DME_LINK_STARTUP) && | ||
1212 | !(ufshcd_get_uic_cmd_result(hba))) { | ||
1213 | |||
1214 | if (ufshcd_make_hba_operational(hba)) | ||
1215 | dev_err(hba->dev, | ||
1216 | "cc: hba not operational state\n"); | ||
1217 | return; | ||
1218 | } | ||
1219 | } | ||
1220 | |||
1221 | /** | ||
1222 | * ufshcd_fatal_err_handler - handle fatal errors | 1296 | * ufshcd_fatal_err_handler - handle fatal errors |
1223 | * @hba: per adapter instance | 1297 | * @hba: per adapter instance |
1224 | */ | 1298 | */ |
@@ -1244,9 +1318,7 @@ static void ufshcd_err_handler(struct ufs_hba *hba) | |||
1244 | goto fatal_eh; | 1318 | goto fatal_eh; |
1245 | 1319 | ||
1246 | if (hba->errors & UIC_ERROR) { | 1320 | if (hba->errors & UIC_ERROR) { |
1247 | 1321 | reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_DATA_LINK_LAYER); | |
1248 | reg = readl(hba->mmio_base + | ||
1249 | REG_UIC_ERROR_CODE_PHY_ADAPTER_LAYER); | ||
1250 | if (reg & UIC_DATA_LINK_LAYER_ERROR_PA_INIT) | 1322 | if (reg & UIC_DATA_LINK_LAYER_ERROR_PA_INIT) |
1251 | goto fatal_eh; | 1323 | goto fatal_eh; |
1252 | } | 1324 | } |
@@ -1264,7 +1336,7 @@ static void ufshcd_tmc_handler(struct ufs_hba *hba) | |||
1264 | { | 1336 | { |
1265 | u32 tm_doorbell; | 1337 | u32 tm_doorbell; |
1266 | 1338 | ||
1267 | tm_doorbell = readl(hba->mmio_base + REG_UTP_TASK_REQ_DOOR_BELL); | 1339 | tm_doorbell = ufshcd_readl(hba, REG_UTP_TASK_REQ_DOOR_BELL); |
1268 | hba->tm_condition = tm_doorbell ^ hba->outstanding_tasks; | 1340 | hba->tm_condition = tm_doorbell ^ hba->outstanding_tasks; |
1269 | wake_up_interruptible(&hba->ufshcd_tm_wait_queue); | 1341 | wake_up_interruptible(&hba->ufshcd_tm_wait_queue); |
1270 | } | 1342 | } |
@@ -1281,7 +1353,7 @@ static void ufshcd_sl_intr(struct ufs_hba *hba, u32 intr_status) | |||
1281 | ufshcd_err_handler(hba); | 1353 | ufshcd_err_handler(hba); |
1282 | 1354 | ||
1283 | if (intr_status & UIC_COMMAND_COMPL) | 1355 | if (intr_status & UIC_COMMAND_COMPL) |
1284 | schedule_work(&hba->uic_workq); | 1356 | ufshcd_uic_cmd_compl(hba); |
1285 | 1357 | ||
1286 | if (intr_status & UTP_TASK_REQ_COMPL) | 1358 | if (intr_status & UTP_TASK_REQ_COMPL) |
1287 | ufshcd_tmc_handler(hba); | 1359 | ufshcd_tmc_handler(hba); |
@@ -1305,15 +1377,11 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba) | |||
1305 | struct ufs_hba *hba = __hba; | 1377 | struct ufs_hba *hba = __hba; |
1306 | 1378 | ||
1307 | spin_lock(hba->host->host_lock); | 1379 | spin_lock(hba->host->host_lock); |
1308 | intr_status = readl(hba->mmio_base + REG_INTERRUPT_STATUS); | 1380 | intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); |
1309 | 1381 | ||
1310 | if (intr_status) { | 1382 | if (intr_status) { |
1383 | ufshcd_writel(hba, intr_status, REG_INTERRUPT_STATUS); | ||
1311 | ufshcd_sl_intr(hba, intr_status); | 1384 | ufshcd_sl_intr(hba, intr_status); |
1312 | |||
1313 | /* If UFSHCI 1.0 then clear interrupt status register */ | ||
1314 | if (hba->ufs_version == UFSHCI_VERSION_10) | ||
1315 | writel(intr_status, | ||
1316 | (hba->mmio_base + REG_INTERRUPT_STATUS)); | ||
1317 | retval = IRQ_HANDLED; | 1385 | retval = IRQ_HANDLED; |
1318 | } | 1386 | } |
1319 | spin_unlock(hba->host->host_lock); | 1387 | spin_unlock(hba->host->host_lock); |
@@ -1378,8 +1446,7 @@ ufshcd_issue_tm_cmd(struct ufs_hba *hba, | |||
1378 | 1446 | ||
1379 | /* send command to the controller */ | 1447 | /* send command to the controller */ |
1380 | __set_bit(free_slot, &hba->outstanding_tasks); | 1448 | __set_bit(free_slot, &hba->outstanding_tasks); |
1381 | writel((1 << free_slot), | 1449 | ufshcd_writel(hba, 1 << free_slot, REG_UTP_TASK_REQ_DOOR_BELL); |
1382 | (hba->mmio_base + REG_UTP_TASK_REQ_DOOR_BELL)); | ||
1383 | 1450 | ||
1384 | spin_unlock_irqrestore(host->host_lock, flags); | 1451 | spin_unlock_irqrestore(host->host_lock, flags); |
1385 | 1452 | ||
@@ -1509,6 +1576,21 @@ out: | |||
1509 | return err; | 1576 | return err; |
1510 | } | 1577 | } |
1511 | 1578 | ||
1579 | /** | ||
1580 | * ufshcd_async_scan - asynchronous execution for link startup | ||
1581 | * @data: data pointer to pass to this function | ||
1582 | * @cookie: cookie data | ||
1583 | */ | ||
1584 | static void ufshcd_async_scan(void *data, async_cookie_t cookie) | ||
1585 | { | ||
1586 | struct ufs_hba *hba = (struct ufs_hba *)data; | ||
1587 | int ret; | ||
1588 | |||
1589 | ret = ufshcd_link_startup(hba); | ||
1590 | if (!ret) | ||
1591 | scsi_scan_host(hba->host); | ||
1592 | } | ||
1593 | |||
1512 | static struct scsi_host_template ufshcd_driver_template = { | 1594 | static struct scsi_host_template ufshcd_driver_template = { |
1513 | .module = THIS_MODULE, | 1595 | .module = THIS_MODULE, |
1514 | .name = UFSHCD, | 1596 | .name = UFSHCD, |
@@ -1569,17 +1651,6 @@ int ufshcd_resume(struct ufs_hba *hba) | |||
1569 | EXPORT_SYMBOL_GPL(ufshcd_resume); | 1651 | EXPORT_SYMBOL_GPL(ufshcd_resume); |
1570 | 1652 | ||
1571 | /** | 1653 | /** |
1572 | * ufshcd_hba_free - free allocated memory for | ||
1573 | * host memory space data structures | ||
1574 | * @hba: per adapter instance | ||
1575 | */ | ||
1576 | static void ufshcd_hba_free(struct ufs_hba *hba) | ||
1577 | { | ||
1578 | iounmap(hba->mmio_base); | ||
1579 | ufshcd_free_hba_memory(hba); | ||
1580 | } | ||
1581 | |||
1582 | /** | ||
1583 | * ufshcd_remove - de-allocate SCSI host and host memory space | 1654 | * ufshcd_remove - de-allocate SCSI host and host memory space |
1584 | * data structure memory | 1655 | * data structure memory |
1585 | * @hba - per adapter instance | 1656 | * @hba - per adapter instance |
@@ -1587,10 +1658,8 @@ static void ufshcd_hba_free(struct ufs_hba *hba) | |||
1587 | void ufshcd_remove(struct ufs_hba *hba) | 1658 | void ufshcd_remove(struct ufs_hba *hba) |
1588 | { | 1659 | { |
1589 | /* disable interrupts */ | 1660 | /* disable interrupts */ |
1590 | ufshcd_int_config(hba, UFSHCD_INT_DISABLE); | 1661 | ufshcd_disable_intr(hba, hba->intr_mask); |
1591 | |||
1592 | ufshcd_hba_stop(hba); | 1662 | ufshcd_hba_stop(hba); |
1593 | ufshcd_hba_free(hba); | ||
1594 | 1663 | ||
1595 | scsi_remove_host(hba->host); | 1664 | scsi_remove_host(hba->host); |
1596 | scsi_host_put(hba->host); | 1665 | scsi_host_put(hba->host); |
@@ -1645,6 +1714,9 @@ int ufshcd_init(struct device *dev, struct ufs_hba **hba_handle, | |||
1645 | /* Get UFS version supported by the controller */ | 1714 | /* Get UFS version supported by the controller */ |
1646 | hba->ufs_version = ufshcd_get_ufs_version(hba); | 1715 | hba->ufs_version = ufshcd_get_ufs_version(hba); |
1647 | 1716 | ||
1717 | /* Get Interrupt bit mask per version */ | ||
1718 | hba->intr_mask = ufshcd_get_intr_mask(hba); | ||
1719 | |||
1648 | /* Allocate memory for host memory space */ | 1720 | /* Allocate memory for host memory space */ |
1649 | err = ufshcd_memory_alloc(hba); | 1721 | err = ufshcd_memory_alloc(hba); |
1650 | if (err) { | 1722 | if (err) { |
@@ -1667,45 +1739,46 @@ int ufshcd_init(struct device *dev, struct ufs_hba **hba_handle, | |||
1667 | init_waitqueue_head(&hba->ufshcd_tm_wait_queue); | 1739 | init_waitqueue_head(&hba->ufshcd_tm_wait_queue); |
1668 | 1740 | ||
1669 | /* Initialize work queues */ | 1741 | /* Initialize work queues */ |
1670 | INIT_WORK(&hba->uic_workq, ufshcd_uic_cc_handler); | ||
1671 | INIT_WORK(&hba->feh_workq, ufshcd_fatal_err_handler); | 1742 | INIT_WORK(&hba->feh_workq, ufshcd_fatal_err_handler); |
1672 | 1743 | ||
1744 | /* Initialize UIC command mutex */ | ||
1745 | mutex_init(&hba->uic_cmd_mutex); | ||
1746 | |||
1673 | /* IRQ registration */ | 1747 | /* IRQ registration */ |
1674 | err = request_irq(irq, ufshcd_intr, IRQF_SHARED, UFSHCD, hba); | 1748 | err = devm_request_irq(dev, irq, ufshcd_intr, IRQF_SHARED, UFSHCD, hba); |
1675 | if (err) { | 1749 | if (err) { |
1676 | dev_err(hba->dev, "request irq failed\n"); | 1750 | dev_err(hba->dev, "request irq failed\n"); |
1677 | goto out_lrb_free; | 1751 | goto out_disable; |
1678 | } | 1752 | } |
1679 | 1753 | ||
1680 | /* Enable SCSI tag mapping */ | 1754 | /* Enable SCSI tag mapping */ |
1681 | err = scsi_init_shared_tag_map(host, host->can_queue); | 1755 | err = scsi_init_shared_tag_map(host, host->can_queue); |
1682 | if (err) { | 1756 | if (err) { |
1683 | dev_err(hba->dev, "init shared queue failed\n"); | 1757 | dev_err(hba->dev, "init shared queue failed\n"); |
1684 | goto out_free_irq; | 1758 | goto out_disable; |
1685 | } | 1759 | } |
1686 | 1760 | ||
1687 | err = scsi_add_host(host, hba->dev); | 1761 | err = scsi_add_host(host, hba->dev); |
1688 | if (err) { | 1762 | if (err) { |
1689 | dev_err(hba->dev, "scsi_add_host failed\n"); | 1763 | dev_err(hba->dev, "scsi_add_host failed\n"); |
1690 | goto out_free_irq; | 1764 | goto out_disable; |
1691 | } | 1765 | } |
1692 | 1766 | ||
1693 | /* Initialization routine */ | 1767 | /* Host controller enable */ |
1694 | err = ufshcd_initialize_hba(hba); | 1768 | err = ufshcd_hba_enable(hba); |
1695 | if (err) { | 1769 | if (err) { |
1696 | dev_err(hba->dev, "Initialization failed\n"); | 1770 | dev_err(hba->dev, "Host controller enable failed\n"); |
1697 | goto out_remove_scsi_host; | 1771 | goto out_remove_scsi_host; |
1698 | } | 1772 | } |
1773 | |||
1699 | *hba_handle = hba; | 1774 | *hba_handle = hba; |
1700 | 1775 | ||
1776 | async_schedule(ufshcd_async_scan, hba); | ||
1777 | |||
1701 | return 0; | 1778 | return 0; |
1702 | 1779 | ||
1703 | out_remove_scsi_host: | 1780 | out_remove_scsi_host: |
1704 | scsi_remove_host(hba->host); | 1781 | scsi_remove_host(hba->host); |
1705 | out_free_irq: | ||
1706 | free_irq(irq, hba); | ||
1707 | out_lrb_free: | ||
1708 | ufshcd_free_hba_memory(hba); | ||
1709 | out_disable: | 1782 | out_disable: |
1710 | scsi_host_put(host); | 1783 | scsi_host_put(host); |
1711 | out_error: | 1784 | out_error: |
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 6b99a42f5819..49590ee07acc 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/bitops.h> | 51 | #include <linux/bitops.h> |
52 | #include <linux/pm_runtime.h> | 52 | #include <linux/pm_runtime.h> |
53 | #include <linux/clk.h> | 53 | #include <linux/clk.h> |
54 | #include <linux/completion.h> | ||
54 | 55 | ||
55 | #include <asm/irq.h> | 56 | #include <asm/irq.h> |
56 | #include <asm/byteorder.h> | 57 | #include <asm/byteorder.h> |
@@ -75,6 +76,7 @@ | |||
75 | * @argument3: UIC command argument 3 | 76 | * @argument3: UIC command argument 3 |
76 | * @cmd_active: Indicate if UIC command is outstanding | 77 | * @cmd_active: Indicate if UIC command is outstanding |
77 | * @result: UIC command result | 78 | * @result: UIC command result |
79 | * @done: UIC command completion | ||
78 | */ | 80 | */ |
79 | struct uic_command { | 81 | struct uic_command { |
80 | u32 command; | 82 | u32 command; |
@@ -83,6 +85,7 @@ struct uic_command { | |||
83 | u32 argument3; | 85 | u32 argument3; |
84 | int cmd_active; | 86 | int cmd_active; |
85 | int result; | 87 | int result; |
88 | struct completion done; | ||
86 | }; | 89 | }; |
87 | 90 | ||
88 | /** | 91 | /** |
@@ -136,11 +139,11 @@ struct ufshcd_lrb { | |||
136 | * @ufs_version: UFS Version to which controller complies | 139 | * @ufs_version: UFS Version to which controller complies |
137 | * @irq: Irq number of the controller | 140 | * @irq: Irq number of the controller |
138 | * @active_uic_cmd: handle of active UIC command | 141 | * @active_uic_cmd: handle of active UIC command |
142 | * @uic_cmd_mutex: mutex for uic command | ||
139 | * @ufshcd_tm_wait_queue: wait queue for task management | 143 | * @ufshcd_tm_wait_queue: wait queue for task management |
140 | * @tm_condition: condition variable for task management | 144 | * @tm_condition: condition variable for task management |
141 | * @ufshcd_state: UFSHCD states | 145 | * @ufshcd_state: UFSHCD states |
142 | * @int_enable_mask: Interrupt Mask Bits | 146 | * @intr_mask: Interrupt Mask Bits |
143 | * @uic_workq: Work queue for UIC completion handling | ||
144 | * @feh_workq: Work queue for fatal controller error handling | 147 | * @feh_workq: Work queue for fatal controller error handling |
145 | * @errors: HBA errors | 148 | * @errors: HBA errors |
146 | */ | 149 | */ |
@@ -171,21 +174,27 @@ struct ufs_hba { | |||
171 | u32 ufs_version; | 174 | u32 ufs_version; |
172 | unsigned int irq; | 175 | unsigned int irq; |
173 | 176 | ||
174 | struct uic_command active_uic_cmd; | 177 | struct uic_command *active_uic_cmd; |
178 | struct mutex uic_cmd_mutex; | ||
179 | |||
175 | wait_queue_head_t ufshcd_tm_wait_queue; | 180 | wait_queue_head_t ufshcd_tm_wait_queue; |
176 | unsigned long tm_condition; | 181 | unsigned long tm_condition; |
177 | 182 | ||
178 | u32 ufshcd_state; | 183 | u32 ufshcd_state; |
179 | u32 int_enable_mask; | 184 | u32 intr_mask; |
180 | 185 | ||
181 | /* Work Queues */ | 186 | /* Work Queues */ |
182 | struct work_struct uic_workq; | ||
183 | struct work_struct feh_workq; | 187 | struct work_struct feh_workq; |
184 | 188 | ||
185 | /* HBA Errors */ | 189 | /* HBA Errors */ |
186 | u32 errors; | 190 | u32 errors; |
187 | }; | 191 | }; |
188 | 192 | ||
193 | #define ufshcd_writel(hba, val, reg) \ | ||
194 | writel((val), (hba)->mmio_base + (reg)) | ||
195 | #define ufshcd_readl(hba, reg) \ | ||
196 | readl((hba)->mmio_base + (reg)) | ||
197 | |||
189 | int ufshcd_init(struct device *, struct ufs_hba ** , void __iomem * , | 198 | int ufshcd_init(struct device *, struct ufs_hba ** , void __iomem * , |
190 | unsigned int); | 199 | unsigned int); |
191 | void ufshcd_remove(struct ufs_hba *); | 200 | void ufshcd_remove(struct ufs_hba *); |
@@ -196,7 +205,7 @@ void ufshcd_remove(struct ufs_hba *); | |||
196 | */ | 205 | */ |
197 | static inline void ufshcd_hba_stop(struct ufs_hba *hba) | 206 | static inline void ufshcd_hba_stop(struct ufs_hba *hba) |
198 | { | 207 | { |
199 | writel(CONTROLLER_DISABLE, (hba->mmio_base + REG_CONTROLLER_ENABLE)); | 208 | ufshcd_writel(hba, CONTROLLER_DISABLE, REG_CONTROLLER_ENABLE); |
200 | } | 209 | } |
201 | 210 | ||
202 | #endif /* End of Header */ | 211 | #endif /* End of Header */ |
diff --git a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h index 0c164847a3ef..d5c5f1482d7d 100644 --- a/drivers/scsi/ufs/ufshci.h +++ b/drivers/scsi/ufs/ufshci.h | |||
@@ -232,10 +232,11 @@ enum { | |||
232 | /* Interrupt disable masks */ | 232 | /* Interrupt disable masks */ |
233 | enum { | 233 | enum { |
234 | /* Interrupt disable mask for UFSHCI v1.0 */ | 234 | /* Interrupt disable mask for UFSHCI v1.0 */ |
235 | INTERRUPT_DISABLE_MASK_10 = 0xFFFF, | 235 | INTERRUPT_MASK_ALL_VER_10 = 0x30FFF, |
236 | INTERRUPT_MASK_RW_VER_10 = 0x30000, | ||
236 | 237 | ||
237 | /* Interrupt disable mask for UFSHCI v1.1 */ | 238 | /* Interrupt disable mask for UFSHCI v1.1 */ |
238 | INTERRUPT_DISABLE_MASK_11 = 0x0, | 239 | INTERRUPT_MASK_ALL_VER_11 = 0x31FFF, |
239 | }; | 240 | }; |
240 | 241 | ||
241 | /* | 242 | /* |