diff options
author | James Bottomley <jejb@titanic.(none)> | 2005-11-04 23:29:52 -0500 |
---|---|---|
committer | James Bottomley <jejb@titanic.(none)> | 2005-11-04 23:29:52 -0500 |
commit | 849a8924a6740ecbf9711e015beca69425f0c429 (patch) | |
tree | 2bae44c5fb170a655696b7253eec7ee13c6fa437 /drivers/message | |
parent | 7015faa7df829876a0f931cd18aa6d7c24a1b581 (diff) | |
parent | ee807c2d43b54183c16580857837dae8ccb2ed22 (diff) |
Merge by Hand
Conflicts in dec_esp.c (Thanks Bacchus), scsi_transport_iscsi.c and
scsi_transport_fc.h
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message')
-rw-r--r-- | drivers/message/fusion/mptbase.h | 16 | ||||
-rw-r--r-- | drivers/message/fusion/mptsas.c | 323 |
2 files changed, 263 insertions, 76 deletions
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index 75105277e22f..e7efeb7740b9 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h | |||
@@ -77,8 +77,8 @@ | |||
77 | #define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR | 77 | #define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | #define MPT_LINUX_VERSION_COMMON "3.03.03" | 80 | #define MPT_LINUX_VERSION_COMMON "3.03.04" |
81 | #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.03" | 81 | #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.04" |
82 | #define WHAT_MAGIC_STRING "@" "(" "#" ")" | 82 | #define WHAT_MAGIC_STRING "@" "(" "#" ")" |
83 | 83 | ||
84 | #define show_mptmod_ver(s,ver) \ | 84 | #define show_mptmod_ver(s,ver) \ |
@@ -421,6 +421,17 @@ typedef struct _MPT_IOCTL { | |||
421 | struct semaphore sem_ioc; | 421 | struct semaphore sem_ioc; |
422 | } MPT_IOCTL; | 422 | } MPT_IOCTL; |
423 | 423 | ||
424 | #define MPT_SAS_MGMT_STATUS_RF_VALID 0x02 /* The Reply Frame is VALID */ | ||
425 | #define MPT_SAS_MGMT_STATUS_COMMAND_GOOD 0x10 /* Command Status GOOD */ | ||
426 | #define MPT_SAS_MGMT_STATUS_TM_FAILED 0x40 /* User TM request failed */ | ||
427 | |||
428 | typedef struct _MPT_SAS_MGMT { | ||
429 | struct semaphore mutex; | ||
430 | struct completion done; | ||
431 | u8 reply[MPT_DEFAULT_FRAME_SIZE]; /* reply frame data */ | ||
432 | u8 status; /* current command status */ | ||
433 | }MPT_SAS_MGMT; | ||
434 | |||
424 | /* | 435 | /* |
425 | * Event Structure and define | 436 | * Event Structure and define |
426 | */ | 437 | */ |
@@ -604,6 +615,7 @@ typedef struct _MPT_ADAPTER | |||
604 | struct list_head list; | 615 | struct list_head list; |
605 | struct net_device *netdev; | 616 | struct net_device *netdev; |
606 | struct list_head sas_topology; | 617 | struct list_head sas_topology; |
618 | MPT_SAS_MGMT sas_mgmt; | ||
607 | } MPT_ADAPTER; | 619 | } MPT_ADAPTER; |
608 | 620 | ||
609 | /* | 621 | /* |
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 7de19a84dc74..e0a8bb8ba7d8 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
@@ -83,6 +83,7 @@ MODULE_PARM_DESC(mpt_pt_clear, | |||
83 | static int mptsasDoneCtx = -1; | 83 | static int mptsasDoneCtx = -1; |
84 | static int mptsasTaskCtx = -1; | 84 | static int mptsasTaskCtx = -1; |
85 | static int mptsasInternalCtx = -1; /* Used only for internal commands */ | 85 | static int mptsasInternalCtx = -1; /* Used only for internal commands */ |
86 | static int mptsasMgmtCtx = -1; | ||
86 | 87 | ||
87 | 88 | ||
88 | /* | 89 | /* |
@@ -123,6 +124,104 @@ struct mptsas_portinfo { | |||
123 | struct mptsas_phyinfo *phy_info; | 124 | struct mptsas_phyinfo *phy_info; |
124 | }; | 125 | }; |
125 | 126 | ||
127 | |||
128 | #ifdef SASDEBUG | ||
129 | static void mptsas_print_phy_data(MPI_SAS_IO_UNIT0_PHY_DATA *phy_data) | ||
130 | { | ||
131 | printk("---- IO UNIT PAGE 0 ------------\n"); | ||
132 | printk("Handle=0x%X\n", | ||
133 | le16_to_cpu(phy_data->AttachedDeviceHandle)); | ||
134 | printk("Controller Handle=0x%X\n", | ||
135 | le16_to_cpu(phy_data->ControllerDevHandle)); | ||
136 | printk("Port=0x%X\n", phy_data->Port); | ||
137 | printk("Port Flags=0x%X\n", phy_data->PortFlags); | ||
138 | printk("PHY Flags=0x%X\n", phy_data->PhyFlags); | ||
139 | printk("Negotiated Link Rate=0x%X\n", phy_data->NegotiatedLinkRate); | ||
140 | printk("Controller PHY Device Info=0x%X\n", | ||
141 | le32_to_cpu(phy_data->ControllerPhyDeviceInfo)); | ||
142 | printk("DiscoveryStatus=0x%X\n", | ||
143 | le32_to_cpu(phy_data->DiscoveryStatus)); | ||
144 | printk("\n"); | ||
145 | } | ||
146 | |||
147 | static void mptsas_print_phy_pg0(SasPhyPage0_t *pg0) | ||
148 | { | ||
149 | __le64 sas_address; | ||
150 | |||
151 | memcpy(&sas_address, &pg0->SASAddress, sizeof(__le64)); | ||
152 | |||
153 | printk("---- SAS PHY PAGE 0 ------------\n"); | ||
154 | printk("Attached Device Handle=0x%X\n", | ||
155 | le16_to_cpu(pg0->AttachedDevHandle)); | ||
156 | printk("SAS Address=0x%llX\n", | ||
157 | (unsigned long long)le64_to_cpu(sas_address)); | ||
158 | printk("Attached PHY Identifier=0x%X\n", pg0->AttachedPhyIdentifier); | ||
159 | printk("Attached Device Info=0x%X\n", | ||
160 | le32_to_cpu(pg0->AttachedDeviceInfo)); | ||
161 | printk("Programmed Link Rate=0x%X\n", pg0->ProgrammedLinkRate); | ||
162 | printk("Change Count=0x%X\n", pg0->ChangeCount); | ||
163 | printk("PHY Info=0x%X\n", le32_to_cpu(pg0->PhyInfo)); | ||
164 | printk("\n"); | ||
165 | } | ||
166 | |||
167 | static void mptsas_print_phy_pg1(SasPhyPage1_t *pg1) | ||
168 | { | ||
169 | printk("---- SAS PHY PAGE 1 ------------\n"); | ||
170 | printk("Invalid Dword Count=0x%x\n", pg1->InvalidDwordCount); | ||
171 | printk("Running Disparity Error Count=0x%x\n", | ||
172 | pg1->RunningDisparityErrorCount); | ||
173 | printk("Loss Dword Synch Count=0x%x\n", pg1->LossDwordSynchCount); | ||
174 | printk("PHY Reset Problem Count=0x%x\n", pg1->PhyResetProblemCount); | ||
175 | printk("\n"); | ||
176 | } | ||
177 | |||
178 | static void mptsas_print_device_pg0(SasDevicePage0_t *pg0) | ||
179 | { | ||
180 | __le64 sas_address; | ||
181 | |||
182 | memcpy(&sas_address, &pg0->SASAddress, sizeof(__le64)); | ||
183 | |||
184 | printk("---- SAS DEVICE PAGE 0 ---------\n"); | ||
185 | printk("Handle=0x%X\n" ,le16_to_cpu(pg0->DevHandle)); | ||
186 | printk("Enclosure Handle=0x%X\n", le16_to_cpu(pg0->EnclosureHandle)); | ||
187 | printk("Slot=0x%X\n", le16_to_cpu(pg0->Slot)); | ||
188 | printk("SAS Address=0x%llX\n", le64_to_cpu(sas_address)); | ||
189 | printk("Target ID=0x%X\n", pg0->TargetID); | ||
190 | printk("Bus=0x%X\n", pg0->Bus); | ||
191 | /* The PhyNum field specifies the PHY number of the parent | ||
192 | * device this device is linked to | ||
193 | */ | ||
194 | printk("Parent Phy Num=0x%X\n", pg0->PhyNum); | ||
195 | printk("Access Status=0x%X\n", le16_to_cpu(pg0->AccessStatus)); | ||
196 | printk("Device Info=0x%X\n", le32_to_cpu(pg0->DeviceInfo)); | ||
197 | printk("Flags=0x%X\n", le16_to_cpu(pg0->Flags)); | ||
198 | printk("Physical Port=0x%X\n", pg0->PhysicalPort); | ||
199 | printk("\n"); | ||
200 | } | ||
201 | |||
202 | static void mptsas_print_expander_pg1(SasExpanderPage1_t *pg1) | ||
203 | { | ||
204 | printk("---- SAS EXPANDER PAGE 1 ------------\n"); | ||
205 | |||
206 | printk("Physical Port=0x%X\n", pg1->PhysicalPort); | ||
207 | printk("PHY Identifier=0x%X\n", pg1->PhyIdentifier); | ||
208 | printk("Negotiated Link Rate=0x%X\n", pg1->NegotiatedLinkRate); | ||
209 | printk("Programmed Link Rate=0x%X\n", pg1->ProgrammedLinkRate); | ||
210 | printk("Hardware Link Rate=0x%X\n", pg1->HwLinkRate); | ||
211 | printk("Owner Device Handle=0x%X\n", | ||
212 | le16_to_cpu(pg1->OwnerDevHandle)); | ||
213 | printk("Attached Device Handle=0x%X\n", | ||
214 | le16_to_cpu(pg1->AttachedDevHandle)); | ||
215 | } | ||
216 | #else | ||
217 | #define mptsas_print_phy_data(phy_data) do { } while (0) | ||
218 | #define mptsas_print_phy_pg0(pg0) do { } while (0) | ||
219 | #define mptsas_print_phy_pg1(pg1) do { } while (0) | ||
220 | #define mptsas_print_device_pg0(pg0) do { } while (0) | ||
221 | #define mptsas_print_expander_pg1(pg1) do { } while (0) | ||
222 | #endif | ||
223 | |||
224 | |||
126 | /* | 225 | /* |
127 | * This is pretty ugly. We will be able to seriously clean it up | 226 | * This is pretty ugly. We will be able to seriously clean it up |
128 | * once the DV code in mptscsih goes away and we can properly | 227 | * once the DV code in mptscsih goes away and we can properly |
@@ -200,91 +299,159 @@ static struct scsi_host_template mptsas_driver_template = { | |||
200 | .use_clustering = ENABLE_CLUSTERING, | 299 | .use_clustering = ENABLE_CLUSTERING, |
201 | }; | 300 | }; |
202 | 301 | ||
203 | static struct sas_function_template mptsas_transport_functions = { | 302 | static inline MPT_ADAPTER *phy_to_ioc(struct sas_phy *phy) |
204 | }; | ||
205 | |||
206 | static struct scsi_transport_template *mptsas_transport_template; | ||
207 | |||
208 | #ifdef SASDEBUG | ||
209 | static void mptsas_print_phy_data(MPI_SAS_IO_UNIT0_PHY_DATA *phy_data) | ||
210 | { | 303 | { |
211 | printk("---- IO UNIT PAGE 0 ------------\n"); | 304 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); |
212 | printk("Handle=0x%X\n", | 305 | return ((MPT_SCSI_HOST *)shost->hostdata)->ioc; |
213 | le16_to_cpu(phy_data->AttachedDeviceHandle)); | ||
214 | printk("Controller Handle=0x%X\n", | ||
215 | le16_to_cpu(phy_data->ControllerDevHandle)); | ||
216 | printk("Port=0x%X\n", phy_data->Port); | ||
217 | printk("Port Flags=0x%X\n", phy_data->PortFlags); | ||
218 | printk("PHY Flags=0x%X\n", phy_data->PhyFlags); | ||
219 | printk("Negotiated Link Rate=0x%X\n", phy_data->NegotiatedLinkRate); | ||
220 | printk("Controller PHY Device Info=0x%X\n", | ||
221 | le32_to_cpu(phy_data->ControllerPhyDeviceInfo)); | ||
222 | printk("DiscoveryStatus=0x%X\n", | ||
223 | le32_to_cpu(phy_data->DiscoveryStatus)); | ||
224 | printk("\n"); | ||
225 | } | 306 | } |
226 | 307 | ||
227 | static void mptsas_print_phy_pg0(SasPhyPage0_t *pg0) | 308 | static int mptsas_get_linkerrors(struct sas_phy *phy) |
228 | { | 309 | { |
229 | __le64 sas_address; | 310 | MPT_ADAPTER *ioc = phy_to_ioc(phy); |
311 | ConfigExtendedPageHeader_t hdr; | ||
312 | CONFIGPARMS cfg; | ||
313 | SasPhyPage1_t *buffer; | ||
314 | dma_addr_t dma_handle; | ||
315 | int error; | ||
230 | 316 | ||
231 | memcpy(&sas_address, &pg0->SASAddress, sizeof(__le64)); | 317 | hdr.PageVersion = MPI_SASPHY1_PAGEVERSION; |
318 | hdr.ExtPageLength = 0; | ||
319 | hdr.PageNumber = 1 /* page number 1*/; | ||
320 | hdr.Reserved1 = 0; | ||
321 | hdr.Reserved2 = 0; | ||
322 | hdr.PageType = MPI_CONFIG_PAGETYPE_EXTENDED; | ||
323 | hdr.ExtPageType = MPI_CONFIG_EXTPAGETYPE_SAS_PHY; | ||
232 | 324 | ||
233 | printk("---- SAS PHY PAGE 0 ------------\n"); | 325 | cfg.cfghdr.ehdr = &hdr; |
234 | printk("Attached Device Handle=0x%X\n", | 326 | cfg.physAddr = -1; |
235 | le16_to_cpu(pg0->AttachedDevHandle)); | 327 | cfg.pageAddr = phy->identify.phy_identifier; |
236 | printk("SAS Address=0x%llX\n", | 328 | cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER; |
237 | (unsigned long long)le64_to_cpu(sas_address)); | 329 | cfg.dir = 0; /* read */ |
238 | printk("Attached PHY Identifier=0x%X\n", pg0->AttachedPhyIdentifier); | 330 | cfg.timeout = 10; |
239 | printk("Attached Device Info=0x%X\n", | ||
240 | le32_to_cpu(pg0->AttachedDeviceInfo)); | ||
241 | printk("Programmed Link Rate=0x%X\n", pg0->ProgrammedLinkRate); | ||
242 | printk("Change Count=0x%X\n", pg0->ChangeCount); | ||
243 | printk("PHY Info=0x%X\n", le32_to_cpu(pg0->PhyInfo)); | ||
244 | printk("\n"); | ||
245 | } | ||
246 | 331 | ||
247 | static void mptsas_print_device_pg0(SasDevicePage0_t *pg0) | 332 | error = mpt_config(ioc, &cfg); |
248 | { | 333 | if (error) |
249 | __le64 sas_address; | 334 | return error; |
335 | if (!hdr.ExtPageLength) | ||
336 | return -ENXIO; | ||
250 | 337 | ||
251 | memcpy(&sas_address, &pg0->SASAddress, sizeof(__le64)); | 338 | buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4, |
339 | &dma_handle); | ||
340 | if (!buffer) | ||
341 | return -ENOMEM; | ||
252 | 342 | ||
253 | printk("---- SAS DEVICE PAGE 0 ---------\n"); | 343 | cfg.physAddr = dma_handle; |
254 | printk("Handle=0x%X\n" ,le16_to_cpu(pg0->DevHandle)); | 344 | cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; |
255 | printk("Enclosure Handle=0x%X\n", le16_to_cpu(pg0->EnclosureHandle)); | 345 | |
256 | printk("Slot=0x%X\n", le16_to_cpu(pg0->Slot)); | 346 | error = mpt_config(ioc, &cfg); |
257 | printk("SAS Address=0x%llX\n", le64_to_cpu(sas_address)); | 347 | if (error) |
258 | printk("Target ID=0x%X\n", pg0->TargetID); | 348 | goto out_free_consistent; |
259 | printk("Bus=0x%X\n", pg0->Bus); | 349 | |
260 | printk("Parent Phy Num=0x%X\n", pg0->PhyNum); | 350 | mptsas_print_phy_pg1(buffer); |
261 | printk("Access Status=0x%X\n", le16_to_cpu(pg0->AccessStatus)); | 351 | |
262 | printk("Device Info=0x%X\n", le32_to_cpu(pg0->DeviceInfo)); | 352 | phy->invalid_dword_count = le32_to_cpu(buffer->InvalidDwordCount); |
263 | printk("Flags=0x%X\n", le16_to_cpu(pg0->Flags)); | 353 | phy->running_disparity_error_count = |
264 | printk("Physical Port=0x%X\n", pg0->PhysicalPort); | 354 | le32_to_cpu(buffer->RunningDisparityErrorCount); |
265 | printk("\n"); | 355 | phy->loss_of_dword_sync_count = |
356 | le32_to_cpu(buffer->LossDwordSynchCount); | ||
357 | phy->phy_reset_problem_count = | ||
358 | le32_to_cpu(buffer->PhyResetProblemCount); | ||
359 | |||
360 | out_free_consistent: | ||
361 | pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4, | ||
362 | buffer, dma_handle); | ||
363 | return error; | ||
266 | } | 364 | } |
267 | 365 | ||
268 | static void mptsas_print_expander_pg1(SasExpanderPage1_t *pg1) | 366 | static int mptsas_mgmt_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, |
367 | MPT_FRAME_HDR *reply) | ||
269 | { | 368 | { |
270 | printk("---- SAS EXPANDER PAGE 1 ------------\n"); | 369 | ioc->sas_mgmt.status |= MPT_SAS_MGMT_STATUS_COMMAND_GOOD; |
370 | if (reply != NULL) { | ||
371 | ioc->sas_mgmt.status |= MPT_SAS_MGMT_STATUS_RF_VALID; | ||
372 | memcpy(ioc->sas_mgmt.reply, reply, | ||
373 | min(ioc->reply_sz, 4 * reply->u.reply.MsgLength)); | ||
374 | } | ||
375 | complete(&ioc->sas_mgmt.done); | ||
376 | return 1; | ||
377 | } | ||
271 | 378 | ||
272 | printk("Physical Port=0x%X\n", pg1->PhysicalPort); | 379 | static int mptsas_phy_reset(struct sas_phy *phy, int hard_reset) |
273 | printk("PHY Identifier=0x%X\n", pg1->PhyIdentifier); | 380 | { |
274 | printk("Negotiated Link Rate=0x%X\n", pg1->NegotiatedLinkRate); | 381 | MPT_ADAPTER *ioc = phy_to_ioc(phy); |
275 | printk("Programmed Link Rate=0x%X\n", pg1->ProgrammedLinkRate); | 382 | SasIoUnitControlRequest_t *req; |
276 | printk("Hardware Link Rate=0x%X\n", pg1->HwLinkRate); | 383 | SasIoUnitControlReply_t *reply; |
277 | printk("Owner Device Handle=0x%X\n", | 384 | MPT_FRAME_HDR *mf; |
278 | le16_to_cpu(pg1->OwnerDevHandle)); | 385 | MPIHeader_t *hdr; |
279 | printk("Attached Device Handle=0x%X\n", | 386 | unsigned long timeleft; |
280 | le16_to_cpu(pg1->AttachedDevHandle)); | 387 | int error = -ERESTARTSYS; |
388 | |||
389 | /* not implemented for expanders */ | ||
390 | if (phy->identify.target_port_protocols & SAS_PROTOCOL_SMP) | ||
391 | return -ENXIO; | ||
392 | |||
393 | if (down_interruptible(&ioc->sas_mgmt.mutex)) | ||
394 | goto out; | ||
395 | |||
396 | mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc); | ||
397 | if (!mf) { | ||
398 | error = -ENOMEM; | ||
399 | goto out_unlock; | ||
400 | } | ||
401 | |||
402 | hdr = (MPIHeader_t *) mf; | ||
403 | req = (SasIoUnitControlRequest_t *)mf; | ||
404 | memset(req, 0, sizeof(SasIoUnitControlRequest_t)); | ||
405 | req->Function = MPI_FUNCTION_SAS_IO_UNIT_CONTROL; | ||
406 | req->MsgContext = hdr->MsgContext; | ||
407 | req->Operation = hard_reset ? | ||
408 | MPI_SAS_OP_PHY_HARD_RESET : MPI_SAS_OP_PHY_LINK_RESET; | ||
409 | req->PhyNum = phy->identify.phy_identifier; | ||
410 | |||
411 | mpt_put_msg_frame(mptsasMgmtCtx, ioc, mf); | ||
412 | |||
413 | timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done, | ||
414 | 10 * HZ); | ||
415 | if (!timeleft) { | ||
416 | /* On timeout reset the board */ | ||
417 | mpt_free_msg_frame(ioc, mf); | ||
418 | mpt_HardResetHandler(ioc, CAN_SLEEP); | ||
419 | error = -ETIMEDOUT; | ||
420 | goto out_unlock; | ||
421 | } | ||
422 | |||
423 | /* a reply frame is expected */ | ||
424 | if ((ioc->sas_mgmt.status & | ||
425 | MPT_IOCTL_STATUS_RF_VALID) == 0) { | ||
426 | error = -ENXIO; | ||
427 | goto out_unlock; | ||
428 | } | ||
429 | |||
430 | /* process the completed Reply Message Frame */ | ||
431 | reply = (SasIoUnitControlReply_t *)ioc->sas_mgmt.reply; | ||
432 | if (reply->IOCStatus != MPI_IOCSTATUS_SUCCESS) { | ||
433 | printk("%s: IOCStatus=0x%X IOCLogInfo=0x%X\n", | ||
434 | __FUNCTION__, | ||
435 | reply->IOCStatus, | ||
436 | reply->IOCLogInfo); | ||
437 | error = -ENXIO; | ||
438 | goto out_unlock; | ||
439 | } | ||
440 | |||
441 | error = 0; | ||
442 | |||
443 | out_unlock: | ||
444 | up(&ioc->sas_mgmt.mutex); | ||
445 | out: | ||
446 | return error; | ||
281 | } | 447 | } |
282 | #else | 448 | |
283 | #define mptsas_print_phy_data(phy_data) do { } while (0) | 449 | static struct sas_function_template mptsas_transport_functions = { |
284 | #define mptsas_print_phy_pg0(pg0) do { } while (0) | 450 | .get_linkerrors = mptsas_get_linkerrors, |
285 | #define mptsas_print_device_pg0(pg0) do { } while (0) | 451 | .phy_reset = mptsas_phy_reset, |
286 | #define mptsas_print_expander_pg1(pg1) do { } while (0) | 452 | }; |
287 | #endif | 453 | |
454 | static struct scsi_transport_template *mptsas_transport_template; | ||
288 | 455 | ||
289 | static int | 456 | static int |
290 | mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info) | 457 | mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info) |
@@ -680,7 +847,7 @@ mptsas_parse_device_info(struct sas_identify *identify, | |||
680 | } | 847 | } |
681 | 848 | ||
682 | static int mptsas_probe_one_phy(struct device *dev, | 849 | static int mptsas_probe_one_phy(struct device *dev, |
683 | struct mptsas_phyinfo *phy_info, int index) | 850 | struct mptsas_phyinfo *phy_info, int index, int local) |
684 | { | 851 | { |
685 | struct sas_phy *port; | 852 | struct sas_phy *port; |
686 | int error; | 853 | int error; |
@@ -773,6 +940,9 @@ static int mptsas_probe_one_phy(struct device *dev, | |||
773 | break; | 940 | break; |
774 | } | 941 | } |
775 | 942 | ||
943 | if (local) | ||
944 | port->local_attached = 1; | ||
945 | |||
776 | error = sas_phy_add(port); | 946 | error = sas_phy_add(port); |
777 | if (error) { | 947 | if (error) { |
778 | sas_phy_free(port); | 948 | sas_phy_free(port); |
@@ -838,7 +1008,7 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc, int *index) | |||
838 | } | 1008 | } |
839 | 1009 | ||
840 | mptsas_probe_one_phy(&ioc->sh->shost_gendev, | 1010 | mptsas_probe_one_phy(&ioc->sh->shost_gendev, |
841 | &port_info->phy_info[i], *index); | 1011 | &port_info->phy_info[i], *index, 1); |
842 | (*index)++; | 1012 | (*index)++; |
843 | } | 1013 | } |
844 | 1014 | ||
@@ -909,7 +1079,8 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle, int *index) | |||
909 | } | 1079 | } |
910 | } | 1080 | } |
911 | 1081 | ||
912 | mptsas_probe_one_phy(parent, &port_info->phy_info[i], *index); | 1082 | mptsas_probe_one_phy(parent, &port_info->phy_info[i], |
1083 | *index, 0); | ||
913 | (*index)++; | 1084 | (*index)++; |
914 | } | 1085 | } |
915 | 1086 | ||
@@ -1021,6 +1192,8 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1021 | sh->unique_id = ioc->id; | 1192 | sh->unique_id = ioc->id; |
1022 | 1193 | ||
1023 | INIT_LIST_HEAD(&ioc->sas_topology); | 1194 | INIT_LIST_HEAD(&ioc->sas_topology); |
1195 | init_MUTEX(&ioc->sas_mgmt.mutex); | ||
1196 | init_completion(&ioc->sas_mgmt.done); | ||
1024 | 1197 | ||
1025 | /* Verify that we won't exceed the maximum | 1198 | /* Verify that we won't exceed the maximum |
1026 | * number of chain buffers | 1199 | * number of chain buffers |
@@ -1207,6 +1380,7 @@ mptsas_init(void) | |||
1207 | mptsasTaskCtx = mpt_register(mptscsih_taskmgmt_complete, MPTSAS_DRIVER); | 1380 | mptsasTaskCtx = mpt_register(mptscsih_taskmgmt_complete, MPTSAS_DRIVER); |
1208 | mptsasInternalCtx = | 1381 | mptsasInternalCtx = |
1209 | mpt_register(mptscsih_scandv_complete, MPTSAS_DRIVER); | 1382 | mpt_register(mptscsih_scandv_complete, MPTSAS_DRIVER); |
1383 | mptsasMgmtCtx = mpt_register(mptsas_mgmt_done, MPTSAS_DRIVER); | ||
1210 | 1384 | ||
1211 | if (mpt_event_register(mptsasDoneCtx, mptscsih_event_process) == 0) { | 1385 | if (mpt_event_register(mptsasDoneCtx, mptscsih_event_process) == 0) { |
1212 | devtprintk((KERN_INFO MYNAM | 1386 | devtprintk((KERN_INFO MYNAM |
@@ -1230,6 +1404,7 @@ mptsas_exit(void) | |||
1230 | mpt_reset_deregister(mptsasDoneCtx); | 1404 | mpt_reset_deregister(mptsasDoneCtx); |
1231 | mpt_event_deregister(mptsasDoneCtx); | 1405 | mpt_event_deregister(mptsasDoneCtx); |
1232 | 1406 | ||
1407 | mpt_deregister(mptsasMgmtCtx); | ||
1233 | mpt_deregister(mptsasInternalCtx); | 1408 | mpt_deregister(mptsasInternalCtx); |
1234 | mpt_deregister(mptsasTaskCtx); | 1409 | mpt_deregister(mptsasTaskCtx); |
1235 | mpt_deregister(mptsasDoneCtx); | 1410 | mpt_deregister(mptsasDoneCtx); |