2 * QLogic Fibre Channel HBA Driver
3 * Copyright (c) 2003-2005 QLogic Corporation
5 * See LICENSE.qla2xxx for copyright and licensing details.
9 static inline struct ct_sns_req *
10 qla2x00_prep_ct_req(struct ct_sns_req *, uint16_t, uint16_t);
12 static inline struct sns_cmd_pkt *
13 qla2x00_prep_sns_cmd(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t);
15 static int qla2x00_sns_ga_nxt(scsi_qla_host_t *, fc_port_t *);
16 static int qla2x00_sns_gid_pt(scsi_qla_host_t *, sw_info_t *);
17 static int qla2x00_sns_gpn_id(scsi_qla_host_t *, sw_info_t *);
18 static int qla2x00_sns_gnn_id(scsi_qla_host_t *, sw_info_t *);
19 static int qla2x00_sns_rft_id(scsi_qla_host_t *);
20 static int qla2x00_sns_rnn_id(scsi_qla_host_t *);
23 * qla2x00_prep_ms_iocb() - Prepare common MS/CT IOCB fields for SNS CT query.
25 * @req_size: request size in bytes
26 * @rsp_size: response size in bytes
28 * Returns a pointer to the @ha's ms_iocb.
31 qla2x00_prep_ms_iocb(scsi_qla_host_t *ha, uint32_t req_size, uint32_t rsp_size)
33 ms_iocb_entry_t *ms_pkt;
36 memset(ms_pkt, 0, sizeof(ms_iocb_entry_t));
38 ms_pkt->entry_type = MS_IOCB_TYPE;
39 ms_pkt->entry_count = 1;
40 SET_TARGET_ID(ha, ms_pkt->loop_id, SIMPLE_NAME_SERVER);
41 ms_pkt->control_flags = __constant_cpu_to_le16(CF_READ | CF_HEAD_TAG);
42 ms_pkt->timeout = __constant_cpu_to_le16(25);
43 ms_pkt->cmd_dsd_count = __constant_cpu_to_le16(1);
44 ms_pkt->total_dsd_count = __constant_cpu_to_le16(2);
45 ms_pkt->rsp_bytecount = cpu_to_le32(rsp_size);
46 ms_pkt->req_bytecount = cpu_to_le32(req_size);
48 ms_pkt->dseg_req_address[0] = cpu_to_le32(LSD(ha->ct_sns_dma));
49 ms_pkt->dseg_req_address[1] = cpu_to_le32(MSD(ha->ct_sns_dma));
50 ms_pkt->dseg_req_length = ms_pkt->req_bytecount;
52 ms_pkt->dseg_rsp_address[0] = cpu_to_le32(LSD(ha->ct_sns_dma));
53 ms_pkt->dseg_rsp_address[1] = cpu_to_le32(MSD(ha->ct_sns_dma));
54 ms_pkt->dseg_rsp_length = ms_pkt->rsp_bytecount;
60 * qla24xx_prep_ms_iocb() - Prepare common CT IOCB fields for SNS CT query.
62 * @req_size: request size in bytes
63 * @rsp_size: response size in bytes
65 * Returns a pointer to the @ha's ms_iocb.
68 qla24xx_prep_ms_iocb(scsi_qla_host_t *ha, uint32_t req_size, uint32_t rsp_size)
70 struct ct_entry_24xx *ct_pkt;
72 ct_pkt = (struct ct_entry_24xx *)ha->ms_iocb;
73 memset(ct_pkt, 0, sizeof(struct ct_entry_24xx));
75 ct_pkt->entry_type = CT_IOCB_TYPE;
76 ct_pkt->entry_count = 1;
77 ct_pkt->nport_handle = __constant_cpu_to_le16(NPH_SNS);
78 ct_pkt->timeout = __constant_cpu_to_le16(25);
79 ct_pkt->cmd_dsd_count = __constant_cpu_to_le16(1);
80 ct_pkt->rsp_dsd_count = __constant_cpu_to_le16(1);
81 ct_pkt->rsp_byte_count = cpu_to_le32(rsp_size);
82 ct_pkt->cmd_byte_count = cpu_to_le32(req_size);
84 ct_pkt->dseg_0_address[0] = cpu_to_le32(LSD(ha->ct_sns_dma));
85 ct_pkt->dseg_0_address[1] = cpu_to_le32(MSD(ha->ct_sns_dma));
86 ct_pkt->dseg_0_len = ct_pkt->cmd_byte_count;
88 ct_pkt->dseg_1_address[0] = cpu_to_le32(LSD(ha->ct_sns_dma));
89 ct_pkt->dseg_1_address[1] = cpu_to_le32(MSD(ha->ct_sns_dma));
90 ct_pkt->dseg_1_len = ct_pkt->rsp_byte_count;
91 ct_pkt->vp_index = ha->vp_idx;
97 * qla2x00_prep_ct_req() - Prepare common CT request fields for SNS query.
98 * @ct_req: CT request buffer
100 * @rsp_size: response size in bytes
102 * Returns a pointer to the intitialized @ct_req.
104 static inline struct ct_sns_req *
105 qla2x00_prep_ct_req(struct ct_sns_req *ct_req, uint16_t cmd, uint16_t rsp_size)
107 memset(ct_req, 0, sizeof(struct ct_sns_pkt));
109 ct_req->header.revision = 0x01;
110 ct_req->header.gs_type = 0xFC;
111 ct_req->header.gs_subtype = 0x02;
112 ct_req->command = cpu_to_be16(cmd);
113 ct_req->max_rsp_size = cpu_to_be16((rsp_size - 16) / 4);
119 qla2x00_chk_ms_status(scsi_qla_host_t *ha, ms_iocb_entry_t *ms_pkt,
120 struct ct_sns_rsp *ct_rsp, const char *routine)
123 uint16_t comp_status;
125 rval = QLA_FUNCTION_FAILED;
126 if (ms_pkt->entry_status != 0) {
127 DEBUG2_3(printk("scsi(%ld): %s failed, error status (%x).\n",
128 ha->host_no, routine, ms_pkt->entry_status));
130 if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
131 comp_status = le16_to_cpu(
132 ((struct ct_entry_24xx *)ms_pkt)->comp_status);
134 comp_status = le16_to_cpu(ms_pkt->status);
135 switch (comp_status) {
137 case CS_DATA_UNDERRUN:
138 case CS_DATA_OVERRUN: /* Overrun? */
139 if (ct_rsp->header.response !=
140 __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) {
141 DEBUG2_3(printk("scsi(%ld): %s failed, "
142 "rejected request:\n", ha->host_no,
144 DEBUG2_3(qla2x00_dump_buffer(
145 (uint8_t *)&ct_rsp->header,
146 sizeof(struct ct_rsp_hdr)));
147 rval = QLA_INVALID_COMMAND;
152 DEBUG2_3(printk("scsi(%ld): %s failed, completion "
153 "status (%x).\n", ha->host_no, routine,
162 * qla2x00_ga_nxt() - SNS scan for fabric devices via GA_NXT command.
164 * @fcport: fcport entry to updated
166 * Returns 0 on success.
169 qla2x00_ga_nxt(scsi_qla_host_t *ha, fc_port_t *fcport)
173 ms_iocb_entry_t *ms_pkt;
174 struct ct_sns_req *ct_req;
175 struct ct_sns_rsp *ct_rsp;
177 if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
178 return (qla2x00_sns_ga_nxt(ha, fcport));
182 /* Prepare common MS IOCB */
183 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, GA_NXT_REQ_SIZE, GA_NXT_RSP_SIZE);
185 /* Prepare CT request */
186 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, GA_NXT_CMD,
188 ct_rsp = &ha->ct_sns->p.rsp;
190 /* Prepare CT arguments -- port_id */
191 ct_req->req.port_id.port_id[0] = fcport->d_id.b.domain;
192 ct_req->req.port_id.port_id[1] = fcport->d_id.b.area;
193 ct_req->req.port_id.port_id[2] = fcport->d_id.b.al_pa;
195 /* Execute MS IOCB */
196 rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma,
197 sizeof(ms_iocb_entry_t));
198 if (rval != QLA_SUCCESS) {
200 DEBUG2_3(printk("scsi(%ld): GA_NXT issue IOCB failed (%d).\n",
202 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "GA_NXT") !=
204 rval = QLA_FUNCTION_FAILED;
206 /* Populate fc_port_t entry. */
207 fcport->d_id.b.domain = ct_rsp->rsp.ga_nxt.port_id[0];
208 fcport->d_id.b.area = ct_rsp->rsp.ga_nxt.port_id[1];
209 fcport->d_id.b.al_pa = ct_rsp->rsp.ga_nxt.port_id[2];
211 memcpy(fcport->node_name, ct_rsp->rsp.ga_nxt.node_name,
213 memcpy(fcport->port_name, ct_rsp->rsp.ga_nxt.port_name,
216 if (ct_rsp->rsp.ga_nxt.port_type != NS_N_PORT_TYPE &&
217 ct_rsp->rsp.ga_nxt.port_type != NS_NL_PORT_TYPE)
218 fcport->d_id.b.domain = 0xf0;
220 DEBUG2_3(printk("scsi(%ld): GA_NXT entry - "
221 "nn %02x%02x%02x%02x%02x%02x%02x%02x "
222 "pn %02x%02x%02x%02x%02x%02x%02x%02x "
223 "portid=%02x%02x%02x.\n",
225 fcport->node_name[0], fcport->node_name[1],
226 fcport->node_name[2], fcport->node_name[3],
227 fcport->node_name[4], fcport->node_name[5],
228 fcport->node_name[6], fcport->node_name[7],
229 fcport->port_name[0], fcport->port_name[1],
230 fcport->port_name[2], fcport->port_name[3],
231 fcport->port_name[4], fcport->port_name[5],
232 fcport->port_name[6], fcport->port_name[7],
233 fcport->d_id.b.domain, fcport->d_id.b.area,
234 fcport->d_id.b.al_pa));
241 * qla2x00_gid_pt() - SNS scan for fabric devices via GID_PT command.
243 * @list: switch info entries to populate
245 * NOTE: Non-Nx_Ports are not requested.
247 * Returns 0 on success.
250 qla2x00_gid_pt(scsi_qla_host_t *ha, sw_info_t *list)
255 ms_iocb_entry_t *ms_pkt;
256 struct ct_sns_req *ct_req;
257 struct ct_sns_rsp *ct_rsp;
259 struct ct_sns_gid_pt_data *gid_data;
261 if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
262 return (qla2x00_sns_gid_pt(ha, list));
268 /* Prepare common MS IOCB */
269 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, GID_PT_REQ_SIZE, GID_PT_RSP_SIZE);
271 /* Prepare CT request */
272 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, GID_PT_CMD,
274 ct_rsp = &ha->ct_sns->p.rsp;
276 /* Prepare CT arguments -- port_type */
277 ct_req->req.gid_pt.port_type = NS_NX_PORT_TYPE;
279 /* Execute MS IOCB */
280 rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma,
281 sizeof(ms_iocb_entry_t));
282 if (rval != QLA_SUCCESS) {
284 DEBUG2_3(printk("scsi(%ld): GID_PT issue IOCB failed (%d).\n",
286 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "GID_PT") !=
288 rval = QLA_FUNCTION_FAILED;
290 /* Set port IDs in switch info list. */
291 for (i = 0; i < MAX_FIBRE_DEVICES; i++) {
292 gid_data = &ct_rsp->rsp.gid_pt.entries[i];
293 list[i].d_id.b.domain = gid_data->port_id[0];
294 list[i].d_id.b.area = gid_data->port_id[1];
295 list[i].d_id.b.al_pa = gid_data->port_id[2];
298 if (gid_data->control_byte & BIT_7) {
299 list[i].d_id.b.rsvd_1 = gid_data->control_byte;
305 * If we've used all available slots, then the switch is
306 * reporting back more devices than we can handle with this
307 * single call. Return a failed status, and let GA_NXT handle
310 if (i == MAX_FIBRE_DEVICES)
311 rval = QLA_FUNCTION_FAILED;
318 * qla2x00_gpn_id() - SNS Get Port Name (GPN_ID) query.
320 * @list: switch info entries to populate
322 * Returns 0 on success.
325 qla2x00_gpn_id(scsi_qla_host_t *ha, sw_info_t *list)
330 ms_iocb_entry_t *ms_pkt;
331 struct ct_sns_req *ct_req;
332 struct ct_sns_rsp *ct_rsp;
334 if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
335 return (qla2x00_sns_gpn_id(ha, list));
338 for (i = 0; i < MAX_FIBRE_DEVICES; i++) {
340 /* Prepare common MS IOCB */
341 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, GPN_ID_REQ_SIZE,
344 /* Prepare CT request */
345 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, GPN_ID_CMD,
347 ct_rsp = &ha->ct_sns->p.rsp;
349 /* Prepare CT arguments -- port_id */
350 ct_req->req.port_id.port_id[0] = list[i].d_id.b.domain;
351 ct_req->req.port_id.port_id[1] = list[i].d_id.b.area;
352 ct_req->req.port_id.port_id[2] = list[i].d_id.b.al_pa;
354 /* Execute MS IOCB */
355 rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma,
356 sizeof(ms_iocb_entry_t));
357 if (rval != QLA_SUCCESS) {
359 DEBUG2_3(printk("scsi(%ld): GPN_ID issue IOCB failed "
360 "(%d).\n", ha->host_no, rval));
361 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp,
362 "GPN_ID") != QLA_SUCCESS) {
363 rval = QLA_FUNCTION_FAILED;
366 memcpy(list[i].port_name,
367 ct_rsp->rsp.gpn_id.port_name, WWN_SIZE);
370 /* Last device exit. */
371 if (list[i].d_id.b.rsvd_1 != 0)
379 * qla2x00_gnn_id() - SNS Get Node Name (GNN_ID) query.
381 * @list: switch info entries to populate
383 * Returns 0 on success.
386 qla2x00_gnn_id(scsi_qla_host_t *ha, sw_info_t *list)
391 ms_iocb_entry_t *ms_pkt;
392 struct ct_sns_req *ct_req;
393 struct ct_sns_rsp *ct_rsp;
395 if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
396 return (qla2x00_sns_gnn_id(ha, list));
399 for (i = 0; i < MAX_FIBRE_DEVICES; i++) {
401 /* Prepare common MS IOCB */
402 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, GNN_ID_REQ_SIZE,
405 /* Prepare CT request */
406 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, GNN_ID_CMD,
408 ct_rsp = &ha->ct_sns->p.rsp;
410 /* Prepare CT arguments -- port_id */
411 ct_req->req.port_id.port_id[0] = list[i].d_id.b.domain;
412 ct_req->req.port_id.port_id[1] = list[i].d_id.b.area;
413 ct_req->req.port_id.port_id[2] = list[i].d_id.b.al_pa;
415 /* Execute MS IOCB */
416 rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma,
417 sizeof(ms_iocb_entry_t));
418 if (rval != QLA_SUCCESS) {
420 DEBUG2_3(printk("scsi(%ld): GNN_ID issue IOCB failed "
421 "(%d).\n", ha->host_no, rval));
422 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp,
423 "GNN_ID") != QLA_SUCCESS) {
424 rval = QLA_FUNCTION_FAILED;
427 memcpy(list[i].node_name,
428 ct_rsp->rsp.gnn_id.node_name, WWN_SIZE);
430 DEBUG2_3(printk("scsi(%ld): GID_PT entry - "
431 "nn %02x%02x%02x%02x%02x%02x%02x%02x "
432 "pn %02x%02x%02x%02x%02x%02x%02x%02x "
433 "portid=%02x%02x%02x.\n",
435 list[i].node_name[0], list[i].node_name[1],
436 list[i].node_name[2], list[i].node_name[3],
437 list[i].node_name[4], list[i].node_name[5],
438 list[i].node_name[6], list[i].node_name[7],
439 list[i].port_name[0], list[i].port_name[1],
440 list[i].port_name[2], list[i].port_name[3],
441 list[i].port_name[4], list[i].port_name[5],
442 list[i].port_name[6], list[i].port_name[7],
443 list[i].d_id.b.domain, list[i].d_id.b.area,
444 list[i].d_id.b.al_pa));
447 /* Last device exit. */
448 if (list[i].d_id.b.rsvd_1 != 0)
456 * qla2x00_rft_id() - SNS Register FC-4 TYPEs (RFT_ID) supported by the HBA.
459 * Returns 0 on success.
462 qla2x00_rft_id(scsi_qla_host_t *ha)
466 ms_iocb_entry_t *ms_pkt;
467 struct ct_sns_req *ct_req;
468 struct ct_sns_rsp *ct_rsp;
470 if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
471 return (qla2x00_sns_rft_id(ha));
475 /* Prepare common MS IOCB */
476 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, RFT_ID_REQ_SIZE, RFT_ID_RSP_SIZE);
478 /* Prepare CT request */
479 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RFT_ID_CMD,
481 ct_rsp = &ha->ct_sns->p.rsp;
483 /* Prepare CT arguments -- port_id, FC-4 types */
484 ct_req->req.rft_id.port_id[0] = ha->d_id.b.domain;
485 ct_req->req.rft_id.port_id[1] = ha->d_id.b.area;
486 ct_req->req.rft_id.port_id[2] = ha->d_id.b.al_pa;
488 ct_req->req.rft_id.fc4_types[2] = 0x01; /* FCP-3 */
490 /* Execute MS IOCB */
491 rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma,
492 sizeof(ms_iocb_entry_t));
493 if (rval != QLA_SUCCESS) {
495 DEBUG2_3(printk("scsi(%ld): RFT_ID issue IOCB failed (%d).\n",
497 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "RFT_ID") !=
499 rval = QLA_FUNCTION_FAILED;
501 DEBUG2(printk("scsi(%ld): RFT_ID exiting normally.\n",
509 * qla2x00_rff_id() - SNS Register FC-4 Features (RFF_ID) supported by the HBA.
512 * Returns 0 on success.
515 qla2x00_rff_id(scsi_qla_host_t *ha)
519 ms_iocb_entry_t *ms_pkt;
520 struct ct_sns_req *ct_req;
521 struct ct_sns_rsp *ct_rsp;
523 if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
524 DEBUG2(printk("scsi(%ld): RFF_ID call unsupported on "
525 "ISP2100/ISP2200.\n", ha->host_no));
526 return (QLA_SUCCESS);
530 /* Prepare common MS IOCB */
531 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, RFF_ID_REQ_SIZE, RFF_ID_RSP_SIZE);
533 /* Prepare CT request */
534 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RFF_ID_CMD,
536 ct_rsp = &ha->ct_sns->p.rsp;
538 /* Prepare CT arguments -- port_id, FC-4 feature, FC-4 type */
539 ct_req->req.rff_id.port_id[0] = ha->d_id.b.domain;
540 ct_req->req.rff_id.port_id[1] = ha->d_id.b.area;
541 ct_req->req.rff_id.port_id[2] = ha->d_id.b.al_pa;
543 ct_req->req.rff_id.fc4_feature = BIT_1;
544 ct_req->req.rff_id.fc4_type = 0x08; /* SCSI - FCP */
546 /* Execute MS IOCB */
547 rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma,
548 sizeof(ms_iocb_entry_t));
549 if (rval != QLA_SUCCESS) {
551 DEBUG2_3(printk("scsi(%ld): RFF_ID issue IOCB failed (%d).\n",
553 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "RFF_ID") !=
555 rval = QLA_FUNCTION_FAILED;
557 DEBUG2(printk("scsi(%ld): RFF_ID exiting normally.\n",
565 * qla2x00_rnn_id() - SNS Register Node Name (RNN_ID) of the HBA.
568 * Returns 0 on success.
571 qla2x00_rnn_id(scsi_qla_host_t *ha)
575 ms_iocb_entry_t *ms_pkt;
576 struct ct_sns_req *ct_req;
577 struct ct_sns_rsp *ct_rsp;
579 if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
580 return (qla2x00_sns_rnn_id(ha));
584 /* Prepare common MS IOCB */
585 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, RNN_ID_REQ_SIZE, RNN_ID_RSP_SIZE);
587 /* Prepare CT request */
588 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RNN_ID_CMD,
590 ct_rsp = &ha->ct_sns->p.rsp;
592 /* Prepare CT arguments -- port_id, node_name */
593 ct_req->req.rnn_id.port_id[0] = ha->d_id.b.domain;
594 ct_req->req.rnn_id.port_id[1] = ha->d_id.b.area;
595 ct_req->req.rnn_id.port_id[2] = ha->d_id.b.al_pa;
597 memcpy(ct_req->req.rnn_id.node_name, ha->node_name, WWN_SIZE);
599 /* Execute MS IOCB */
600 rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma,
601 sizeof(ms_iocb_entry_t));
602 if (rval != QLA_SUCCESS) {
604 DEBUG2_3(printk("scsi(%ld): RNN_ID issue IOCB failed (%d).\n",
606 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "RNN_ID") !=
608 rval = QLA_FUNCTION_FAILED;
610 DEBUG2(printk("scsi(%ld): RNN_ID exiting normally.\n",
618 qla2x00_get_sym_node_name(scsi_qla_host_t *ha, uint8_t *snn)
620 sprintf(snn, "%s FW:v%d.%02d.%02d DVR:v%s",ha->model_number,
621 ha->fw_major_version, ha->fw_minor_version,
622 ha->fw_subminor_version, qla2x00_version_str);
626 * qla2x00_rsnn_nn() - SNS Register Symbolic Node Name (RSNN_NN) of the HBA.
629 * Returns 0 on success.
632 qla2x00_rsnn_nn(scsi_qla_host_t *ha)
635 ms_iocb_entry_t *ms_pkt;
636 struct ct_sns_req *ct_req;
637 struct ct_sns_rsp *ct_rsp;
639 if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
640 DEBUG2(printk("scsi(%ld): RSNN_ID call unsupported on "
641 "ISP2100/ISP2200.\n", ha->host_no));
642 return (QLA_SUCCESS);
646 /* Prepare common MS IOCB */
647 /* Request size adjusted after CT preparation */
648 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, 0, RSNN_NN_RSP_SIZE);
650 /* Prepare CT request */
651 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RSNN_NN_CMD,
653 ct_rsp = &ha->ct_sns->p.rsp;
655 /* Prepare CT arguments -- node_name, symbolic node_name, size */
656 memcpy(ct_req->req.rsnn_nn.node_name, ha->node_name, WWN_SIZE);
658 /* Prepare the Symbolic Node Name */
659 qla2x00_get_sym_node_name(ha, ct_req->req.rsnn_nn.sym_node_name);
661 /* Calculate SNN length */
662 ct_req->req.rsnn_nn.name_len =
663 (uint8_t)strlen(ct_req->req.rsnn_nn.sym_node_name);
665 /* Update MS IOCB request */
666 ms_pkt->req_bytecount =
667 cpu_to_le32(24 + 1 + ct_req->req.rsnn_nn.name_len);
668 ms_pkt->dseg_req_length = ms_pkt->req_bytecount;
670 /* Execute MS IOCB */
671 rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma,
672 sizeof(ms_iocb_entry_t));
673 if (rval != QLA_SUCCESS) {
675 DEBUG2_3(printk("scsi(%ld): RSNN_NN issue IOCB failed (%d).\n",
677 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "RSNN_NN") !=
679 rval = QLA_FUNCTION_FAILED;
681 DEBUG2(printk("scsi(%ld): RSNN_NN exiting normally.\n",
689 * qla2x00_prep_sns_cmd() - Prepare common SNS command request fields for query.
692 * @scmd_len: Subcommand length
693 * @data_size: response size in bytes
695 * Returns a pointer to the @ha's sns_cmd.
697 static inline struct sns_cmd_pkt *
698 qla2x00_prep_sns_cmd(scsi_qla_host_t *ha, uint16_t cmd, uint16_t scmd_len,
702 struct sns_cmd_pkt *sns_cmd;
704 sns_cmd = ha->sns_cmd;
705 memset(sns_cmd, 0, sizeof(struct sns_cmd_pkt));
706 wc = data_size / 2; /* Size in 16bit words. */
707 sns_cmd->p.cmd.buffer_length = cpu_to_le16(wc);
708 sns_cmd->p.cmd.buffer_address[0] = cpu_to_le32(LSD(ha->sns_cmd_dma));
709 sns_cmd->p.cmd.buffer_address[1] = cpu_to_le32(MSD(ha->sns_cmd_dma));
710 sns_cmd->p.cmd.subcommand_length = cpu_to_le16(scmd_len);
711 sns_cmd->p.cmd.subcommand = cpu_to_le16(cmd);
712 wc = (data_size - 16) / 4; /* Size in 32bit words. */
713 sns_cmd->p.cmd.size = cpu_to_le16(wc);
719 * qla2x00_sns_ga_nxt() - SNS scan for fabric devices via GA_NXT command.
721 * @fcport: fcport entry to updated
723 * This command uses the old Exectute SNS Command mailbox routine.
725 * Returns 0 on success.
728 qla2x00_sns_ga_nxt(scsi_qla_host_t *ha, fc_port_t *fcport)
732 struct sns_cmd_pkt *sns_cmd;
735 /* Prepare SNS command request. */
736 sns_cmd = qla2x00_prep_sns_cmd(ha, GA_NXT_CMD, GA_NXT_SNS_SCMD_LEN,
737 GA_NXT_SNS_DATA_SIZE);
739 /* Prepare SNS command arguments -- port_id. */
740 sns_cmd->p.cmd.param[0] = fcport->d_id.b.al_pa;
741 sns_cmd->p.cmd.param[1] = fcport->d_id.b.area;
742 sns_cmd->p.cmd.param[2] = fcport->d_id.b.domain;
744 /* Execute SNS command. */
745 rval = qla2x00_send_sns(ha, ha->sns_cmd_dma, GA_NXT_SNS_CMD_SIZE / 2,
746 sizeof(struct sns_cmd_pkt));
747 if (rval != QLA_SUCCESS) {
749 DEBUG2_3(printk("scsi(%ld): GA_NXT Send SNS failed (%d).\n",
751 } else if (sns_cmd->p.gan_data[8] != 0x80 ||
752 sns_cmd->p.gan_data[9] != 0x02) {
753 DEBUG2_3(printk("scsi(%ld): GA_NXT failed, rejected request, "
754 "ga_nxt_rsp:\n", ha->host_no));
755 DEBUG2_3(qla2x00_dump_buffer(sns_cmd->p.gan_data, 16));
756 rval = QLA_FUNCTION_FAILED;
758 /* Populate fc_port_t entry. */
759 fcport->d_id.b.domain = sns_cmd->p.gan_data[17];
760 fcport->d_id.b.area = sns_cmd->p.gan_data[18];
761 fcport->d_id.b.al_pa = sns_cmd->p.gan_data[19];
763 memcpy(fcport->node_name, &sns_cmd->p.gan_data[284], WWN_SIZE);
764 memcpy(fcport->port_name, &sns_cmd->p.gan_data[20], WWN_SIZE);
766 if (sns_cmd->p.gan_data[16] != NS_N_PORT_TYPE &&
767 sns_cmd->p.gan_data[16] != NS_NL_PORT_TYPE)
768 fcport->d_id.b.domain = 0xf0;
770 DEBUG2_3(printk("scsi(%ld): GA_NXT entry - "
771 "nn %02x%02x%02x%02x%02x%02x%02x%02x "
772 "pn %02x%02x%02x%02x%02x%02x%02x%02x "
773 "portid=%02x%02x%02x.\n",
775 fcport->node_name[0], fcport->node_name[1],
776 fcport->node_name[2], fcport->node_name[3],
777 fcport->node_name[4], fcport->node_name[5],
778 fcport->node_name[6], fcport->node_name[7],
779 fcport->port_name[0], fcport->port_name[1],
780 fcport->port_name[2], fcport->port_name[3],
781 fcport->port_name[4], fcport->port_name[5],
782 fcport->port_name[6], fcport->port_name[7],
783 fcport->d_id.b.domain, fcport->d_id.b.area,
784 fcport->d_id.b.al_pa));
791 * qla2x00_sns_gid_pt() - SNS scan for fabric devices via GID_PT command.
793 * @list: switch info entries to populate
795 * This command uses the old Exectute SNS Command mailbox routine.
797 * NOTE: Non-Nx_Ports are not requested.
799 * Returns 0 on success.
802 qla2x00_sns_gid_pt(scsi_qla_host_t *ha, sw_info_t *list)
808 struct sns_cmd_pkt *sns_cmd;
811 /* Prepare SNS command request. */
812 sns_cmd = qla2x00_prep_sns_cmd(ha, GID_PT_CMD, GID_PT_SNS_SCMD_LEN,
813 GID_PT_SNS_DATA_SIZE);
815 /* Prepare SNS command arguments -- port_type. */
816 sns_cmd->p.cmd.param[0] = NS_NX_PORT_TYPE;
818 /* Execute SNS command. */
819 rval = qla2x00_send_sns(ha, ha->sns_cmd_dma, GID_PT_SNS_CMD_SIZE / 2,
820 sizeof(struct sns_cmd_pkt));
821 if (rval != QLA_SUCCESS) {
823 DEBUG2_3(printk("scsi(%ld): GID_PT Send SNS failed (%d).\n",
825 } else if (sns_cmd->p.gid_data[8] != 0x80 ||
826 sns_cmd->p.gid_data[9] != 0x02) {
827 DEBUG2_3(printk("scsi(%ld): GID_PT failed, rejected request, "
828 "gid_rsp:\n", ha->host_no));
829 DEBUG2_3(qla2x00_dump_buffer(sns_cmd->p.gid_data, 16));
830 rval = QLA_FUNCTION_FAILED;
832 /* Set port IDs in switch info list. */
833 for (i = 0; i < MAX_FIBRE_DEVICES; i++) {
834 entry = &sns_cmd->p.gid_data[(i * 4) + 16];
835 list[i].d_id.b.domain = entry[1];
836 list[i].d_id.b.area = entry[2];
837 list[i].d_id.b.al_pa = entry[3];
840 if (entry[0] & BIT_7) {
841 list[i].d_id.b.rsvd_1 = entry[0];
847 * If we've used all available slots, then the switch is
848 * reporting back more devices that we can handle with this
849 * single call. Return a failed status, and let GA_NXT handle
852 if (i == MAX_FIBRE_DEVICES)
853 rval = QLA_FUNCTION_FAILED;
860 * qla2x00_sns_gpn_id() - SNS Get Port Name (GPN_ID) query.
862 * @list: switch info entries to populate
864 * This command uses the old Exectute SNS Command mailbox routine.
866 * Returns 0 on success.
869 qla2x00_sns_gpn_id(scsi_qla_host_t *ha, sw_info_t *list)
874 struct sns_cmd_pkt *sns_cmd;
876 for (i = 0; i < MAX_FIBRE_DEVICES; i++) {
878 /* Prepare SNS command request. */
879 sns_cmd = qla2x00_prep_sns_cmd(ha, GPN_ID_CMD,
880 GPN_ID_SNS_SCMD_LEN, GPN_ID_SNS_DATA_SIZE);
882 /* Prepare SNS command arguments -- port_id. */
883 sns_cmd->p.cmd.param[0] = list[i].d_id.b.al_pa;
884 sns_cmd->p.cmd.param[1] = list[i].d_id.b.area;
885 sns_cmd->p.cmd.param[2] = list[i].d_id.b.domain;
887 /* Execute SNS command. */
888 rval = qla2x00_send_sns(ha, ha->sns_cmd_dma,
889 GPN_ID_SNS_CMD_SIZE / 2, sizeof(struct sns_cmd_pkt));
890 if (rval != QLA_SUCCESS) {
892 DEBUG2_3(printk("scsi(%ld): GPN_ID Send SNS failed "
893 "(%d).\n", ha->host_no, rval));
894 } else if (sns_cmd->p.gpn_data[8] != 0x80 ||
895 sns_cmd->p.gpn_data[9] != 0x02) {
896 DEBUG2_3(printk("scsi(%ld): GPN_ID failed, rejected "
897 "request, gpn_rsp:\n", ha->host_no));
898 DEBUG2_3(qla2x00_dump_buffer(sns_cmd->p.gpn_data, 16));
899 rval = QLA_FUNCTION_FAILED;
902 memcpy(list[i].port_name, &sns_cmd->p.gpn_data[16],
906 /* Last device exit. */
907 if (list[i].d_id.b.rsvd_1 != 0)
915 * qla2x00_sns_gnn_id() - SNS Get Node Name (GNN_ID) query.
917 * @list: switch info entries to populate
919 * This command uses the old Exectute SNS Command mailbox routine.
921 * Returns 0 on success.
924 qla2x00_sns_gnn_id(scsi_qla_host_t *ha, sw_info_t *list)
929 struct sns_cmd_pkt *sns_cmd;
931 for (i = 0; i < MAX_FIBRE_DEVICES; i++) {
933 /* Prepare SNS command request. */
934 sns_cmd = qla2x00_prep_sns_cmd(ha, GNN_ID_CMD,
935 GNN_ID_SNS_SCMD_LEN, GNN_ID_SNS_DATA_SIZE);
937 /* Prepare SNS command arguments -- port_id. */
938 sns_cmd->p.cmd.param[0] = list[i].d_id.b.al_pa;
939 sns_cmd->p.cmd.param[1] = list[i].d_id.b.area;
940 sns_cmd->p.cmd.param[2] = list[i].d_id.b.domain;
942 /* Execute SNS command. */
943 rval = qla2x00_send_sns(ha, ha->sns_cmd_dma,
944 GNN_ID_SNS_CMD_SIZE / 2, sizeof(struct sns_cmd_pkt));
945 if (rval != QLA_SUCCESS) {
947 DEBUG2_3(printk("scsi(%ld): GNN_ID Send SNS failed "
948 "(%d).\n", ha->host_no, rval));
949 } else if (sns_cmd->p.gnn_data[8] != 0x80 ||
950 sns_cmd->p.gnn_data[9] != 0x02) {
951 DEBUG2_3(printk("scsi(%ld): GNN_ID failed, rejected "
952 "request, gnn_rsp:\n", ha->host_no));
953 DEBUG2_3(qla2x00_dump_buffer(sns_cmd->p.gnn_data, 16));
954 rval = QLA_FUNCTION_FAILED;
957 memcpy(list[i].node_name, &sns_cmd->p.gnn_data[16],
960 DEBUG2_3(printk("scsi(%ld): GID_PT entry - "
961 "nn %02x%02x%02x%02x%02x%02x%02x%02x "
962 "pn %02x%02x%02x%02x%02x%02x%02x%02x "
963 "portid=%02x%02x%02x.\n",
965 list[i].node_name[0], list[i].node_name[1],
966 list[i].node_name[2], list[i].node_name[3],
967 list[i].node_name[4], list[i].node_name[5],
968 list[i].node_name[6], list[i].node_name[7],
969 list[i].port_name[0], list[i].port_name[1],
970 list[i].port_name[2], list[i].port_name[3],
971 list[i].port_name[4], list[i].port_name[5],
972 list[i].port_name[6], list[i].port_name[7],
973 list[i].d_id.b.domain, list[i].d_id.b.area,
974 list[i].d_id.b.al_pa));
977 /* Last device exit. */
978 if (list[i].d_id.b.rsvd_1 != 0)
986 * qla2x00_snd_rft_id() - SNS Register FC-4 TYPEs (RFT_ID) supported by the HBA.
989 * This command uses the old Exectute SNS Command mailbox routine.
991 * Returns 0 on success.
994 qla2x00_sns_rft_id(scsi_qla_host_t *ha)
998 struct sns_cmd_pkt *sns_cmd;
1001 /* Prepare SNS command request. */
1002 sns_cmd = qla2x00_prep_sns_cmd(ha, RFT_ID_CMD, RFT_ID_SNS_SCMD_LEN,
1003 RFT_ID_SNS_DATA_SIZE);
1005 /* Prepare SNS command arguments -- port_id, FC-4 types */
1006 sns_cmd->p.cmd.param[0] = ha->d_id.b.al_pa;
1007 sns_cmd->p.cmd.param[1] = ha->d_id.b.area;
1008 sns_cmd->p.cmd.param[2] = ha->d_id.b.domain;
1010 sns_cmd->p.cmd.param[5] = 0x01; /* FCP-3 */
1012 /* Execute SNS command. */
1013 rval = qla2x00_send_sns(ha, ha->sns_cmd_dma, RFT_ID_SNS_CMD_SIZE / 2,
1014 sizeof(struct sns_cmd_pkt));
1015 if (rval != QLA_SUCCESS) {
1017 DEBUG2_3(printk("scsi(%ld): RFT_ID Send SNS failed (%d).\n",
1018 ha->host_no, rval));
1019 } else if (sns_cmd->p.rft_data[8] != 0x80 ||
1020 sns_cmd->p.rft_data[9] != 0x02) {
1021 DEBUG2_3(printk("scsi(%ld): RFT_ID failed, rejected request, "
1022 "rft_rsp:\n", ha->host_no));
1023 DEBUG2_3(qla2x00_dump_buffer(sns_cmd->p.rft_data, 16));
1024 rval = QLA_FUNCTION_FAILED;
1026 DEBUG2(printk("scsi(%ld): RFT_ID exiting normally.\n",
1034 * qla2x00_sns_rnn_id() - SNS Register Node Name (RNN_ID) of the HBA.
1038 * This command uses the old Exectute SNS Command mailbox routine.
1040 * Returns 0 on success.
1043 qla2x00_sns_rnn_id(scsi_qla_host_t *ha)
1047 struct sns_cmd_pkt *sns_cmd;
1050 /* Prepare SNS command request. */
1051 sns_cmd = qla2x00_prep_sns_cmd(ha, RNN_ID_CMD, RNN_ID_SNS_SCMD_LEN,
1052 RNN_ID_SNS_DATA_SIZE);
1054 /* Prepare SNS command arguments -- port_id, nodename. */
1055 sns_cmd->p.cmd.param[0] = ha->d_id.b.al_pa;
1056 sns_cmd->p.cmd.param[1] = ha->d_id.b.area;
1057 sns_cmd->p.cmd.param[2] = ha->d_id.b.domain;
1059 sns_cmd->p.cmd.param[4] = ha->node_name[7];
1060 sns_cmd->p.cmd.param[5] = ha->node_name[6];
1061 sns_cmd->p.cmd.param[6] = ha->node_name[5];
1062 sns_cmd->p.cmd.param[7] = ha->node_name[4];
1063 sns_cmd->p.cmd.param[8] = ha->node_name[3];
1064 sns_cmd->p.cmd.param[9] = ha->node_name[2];
1065 sns_cmd->p.cmd.param[10] = ha->node_name[1];
1066 sns_cmd->p.cmd.param[11] = ha->node_name[0];
1068 /* Execute SNS command. */
1069 rval = qla2x00_send_sns(ha, ha->sns_cmd_dma, RNN_ID_SNS_CMD_SIZE / 2,
1070 sizeof(struct sns_cmd_pkt));
1071 if (rval != QLA_SUCCESS) {
1073 DEBUG2_3(printk("scsi(%ld): RNN_ID Send SNS failed (%d).\n",
1074 ha->host_no, rval));
1075 } else if (sns_cmd->p.rnn_data[8] != 0x80 ||
1076 sns_cmd->p.rnn_data[9] != 0x02) {
1077 DEBUG2_3(printk("scsi(%ld): RNN_ID failed, rejected request, "
1078 "rnn_rsp:\n", ha->host_no));
1079 DEBUG2_3(qla2x00_dump_buffer(sns_cmd->p.rnn_data, 16));
1080 rval = QLA_FUNCTION_FAILED;
1082 DEBUG2(printk("scsi(%ld): RNN_ID exiting normally.\n",
1090 * qla2x00_mgmt_svr_login() - Login to fabric Managment Service.
1093 * Returns 0 on success.
1096 qla2x00_mgmt_svr_login(scsi_qla_host_t *ha)
1099 uint16_t mb[MAILBOX_REGISTER_COUNT];
1102 if (ha->flags.management_server_logged_in)
1105 ha->isp_ops.fabric_login(ha, ha->mgmt_svr_loop_id, 0xff, 0xff, 0xfa,
1107 if (mb[0] != MBS_COMMAND_COMPLETE) {
1108 DEBUG2_13(printk("%s(%ld): Failed MANAGEMENT_SERVER login: "
1109 "loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x mb[6]=%x mb[7]=%x\n",
1110 __func__, ha->host_no, ha->mgmt_svr_loop_id, mb[0], mb[1],
1111 mb[2], mb[6], mb[7]));
1112 ret = QLA_FUNCTION_FAILED;
1114 ha->flags.management_server_logged_in = 1;
1120 * qla2x00_prep_ms_fdmi_iocb() - Prepare common MS IOCB fields for FDMI query.
1122 * @req_size: request size in bytes
1123 * @rsp_size: response size in bytes
1125 * Returns a pointer to the @ha's ms_iocb.
1128 qla2x00_prep_ms_fdmi_iocb(scsi_qla_host_t *ha, uint32_t req_size,
1131 ms_iocb_entry_t *ms_pkt;
1133 ms_pkt = ha->ms_iocb;
1134 memset(ms_pkt, 0, sizeof(ms_iocb_entry_t));
1136 ms_pkt->entry_type = MS_IOCB_TYPE;
1137 ms_pkt->entry_count = 1;
1138 SET_TARGET_ID(ha, ms_pkt->loop_id, ha->mgmt_svr_loop_id);
1139 ms_pkt->control_flags = __constant_cpu_to_le16(CF_READ | CF_HEAD_TAG);
1140 ms_pkt->timeout = __constant_cpu_to_le16(59);
1141 ms_pkt->cmd_dsd_count = __constant_cpu_to_le16(1);
1142 ms_pkt->total_dsd_count = __constant_cpu_to_le16(2);
1143 ms_pkt->rsp_bytecount = cpu_to_le32(rsp_size);
1144 ms_pkt->req_bytecount = cpu_to_le32(req_size);
1146 ms_pkt->dseg_req_address[0] = cpu_to_le32(LSD(ha->ct_sns_dma));
1147 ms_pkt->dseg_req_address[1] = cpu_to_le32(MSD(ha->ct_sns_dma));
1148 ms_pkt->dseg_req_length = ms_pkt->req_bytecount;
1150 ms_pkt->dseg_rsp_address[0] = cpu_to_le32(LSD(ha->ct_sns_dma));
1151 ms_pkt->dseg_rsp_address[1] = cpu_to_le32(MSD(ha->ct_sns_dma));
1152 ms_pkt->dseg_rsp_length = ms_pkt->rsp_bytecount;
1158 * qla24xx_prep_ms_fdmi_iocb() - Prepare common MS IOCB fields for FDMI query.
1160 * @req_size: request size in bytes
1161 * @rsp_size: response size in bytes
1163 * Returns a pointer to the @ha's ms_iocb.
1166 qla24xx_prep_ms_fdmi_iocb(scsi_qla_host_t *ha, uint32_t req_size,
1169 struct ct_entry_24xx *ct_pkt;
1171 ct_pkt = (struct ct_entry_24xx *)ha->ms_iocb;
1172 memset(ct_pkt, 0, sizeof(struct ct_entry_24xx));
1174 ct_pkt->entry_type = CT_IOCB_TYPE;
1175 ct_pkt->entry_count = 1;
1176 ct_pkt->nport_handle = cpu_to_le16(ha->mgmt_svr_loop_id);
1177 ct_pkt->timeout = __constant_cpu_to_le16(59);
1178 ct_pkt->cmd_dsd_count = __constant_cpu_to_le16(1);
1179 ct_pkt->rsp_dsd_count = __constant_cpu_to_le16(1);
1180 ct_pkt->rsp_byte_count = cpu_to_le32(rsp_size);
1181 ct_pkt->cmd_byte_count = cpu_to_le32(req_size);
1183 ct_pkt->dseg_0_address[0] = cpu_to_le32(LSD(ha->ct_sns_dma));
1184 ct_pkt->dseg_0_address[1] = cpu_to_le32(MSD(ha->ct_sns_dma));
1185 ct_pkt->dseg_0_len = ct_pkt->cmd_byte_count;
1187 ct_pkt->dseg_1_address[0] = cpu_to_le32(LSD(ha->ct_sns_dma));
1188 ct_pkt->dseg_1_address[1] = cpu_to_le32(MSD(ha->ct_sns_dma));
1189 ct_pkt->dseg_1_len = ct_pkt->rsp_byte_count;
1190 ct_pkt->vp_index = ha->vp_idx;
1195 static inline ms_iocb_entry_t *
1196 qla2x00_update_ms_fdmi_iocb(scsi_qla_host_t *ha, uint32_t req_size)
1198 ms_iocb_entry_t *ms_pkt = ha->ms_iocb;
1199 struct ct_entry_24xx *ct_pkt = (struct ct_entry_24xx *)ha->ms_iocb;
1201 if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
1202 ct_pkt->cmd_byte_count = cpu_to_le32(req_size);
1203 ct_pkt->dseg_0_len = ct_pkt->cmd_byte_count;
1205 ms_pkt->req_bytecount = cpu_to_le32(req_size);
1206 ms_pkt->dseg_req_length = ms_pkt->req_bytecount;
1213 * qla2x00_prep_ct_req() - Prepare common CT request fields for SNS query.
1214 * @ct_req: CT request buffer
1216 * @rsp_size: response size in bytes
1218 * Returns a pointer to the intitialized @ct_req.
1220 static inline struct ct_sns_req *
1221 qla2x00_prep_ct_fdmi_req(struct ct_sns_req *ct_req, uint16_t cmd,
1224 memset(ct_req, 0, sizeof(struct ct_sns_pkt));
1226 ct_req->header.revision = 0x01;
1227 ct_req->header.gs_type = 0xFA;
1228 ct_req->header.gs_subtype = 0x10;
1229 ct_req->command = cpu_to_be16(cmd);
1230 ct_req->max_rsp_size = cpu_to_be16((rsp_size - 16) / 4);
1236 * qla2x00_fdmi_rhba() -
1239 * Returns 0 on success.
1242 qla2x00_fdmi_rhba(scsi_qla_host_t *ha)
1247 ms_iocb_entry_t *ms_pkt;
1248 struct ct_sns_req *ct_req;
1249 struct ct_sns_rsp *ct_rsp;
1251 struct ct_fdmi_hba_attr *eiter;
1254 /* Prepare common MS IOCB */
1255 /* Request size adjusted after CT preparation */
1256 ms_pkt = ha->isp_ops.prep_ms_fdmi_iocb(ha, 0, RHBA_RSP_SIZE);
1258 /* Prepare CT request */
1259 ct_req = qla2x00_prep_ct_fdmi_req(&ha->ct_sns->p.req, RHBA_CMD,
1261 ct_rsp = &ha->ct_sns->p.rsp;
1263 /* Prepare FDMI command arguments -- attribute block, attributes. */
1264 memcpy(ct_req->req.rhba.hba_identifier, ha->port_name, WWN_SIZE);
1265 ct_req->req.rhba.entry_count = __constant_cpu_to_be32(1);
1266 memcpy(ct_req->req.rhba.port_name, ha->port_name, WWN_SIZE);
1267 size = 2 * WWN_SIZE + 4 + 4;
1270 ct_req->req.rhba.attrs.count =
1271 __constant_cpu_to_be32(FDMI_HBA_ATTR_COUNT);
1272 entries = ct_req->req.rhba.hba_identifier;
1275 eiter = (struct ct_fdmi_hba_attr *) (entries + size);
1276 eiter->type = __constant_cpu_to_be16(FDMI_HBA_NODE_NAME);
1277 eiter->len = __constant_cpu_to_be16(4 + WWN_SIZE);
1278 memcpy(eiter->a.node_name, ha->node_name, WWN_SIZE);
1279 size += 4 + WWN_SIZE;
1281 DEBUG13(printk("%s(%ld): NODENAME=%02x%02x%02x%02x%02x%02x%02x%02x.\n",
1282 __func__, ha->host_no,
1283 eiter->a.node_name[0], eiter->a.node_name[1], eiter->a.node_name[2],
1284 eiter->a.node_name[3], eiter->a.node_name[4], eiter->a.node_name[5],
1285 eiter->a.node_name[6], eiter->a.node_name[7]));
1288 eiter = (struct ct_fdmi_hba_attr *) (entries + size);
1289 eiter->type = __constant_cpu_to_be16(FDMI_HBA_MANUFACTURER);
1290 strcpy(eiter->a.manufacturer, "QLogic Corporation");
1291 alen = strlen(eiter->a.manufacturer);
1292 alen += (alen & 3) ? (4 - (alen & 3)) : 4;
1293 eiter->len = cpu_to_be16(4 + alen);
1296 DEBUG13(printk("%s(%ld): MANUFACTURER=%s.\n", __func__, ha->host_no,
1297 eiter->a.manufacturer));
1299 /* Serial number. */
1300 eiter = (struct ct_fdmi_hba_attr *) (entries + size);
1301 eiter->type = __constant_cpu_to_be16(FDMI_HBA_SERIAL_NUMBER);
1302 sn = ((ha->serial0 & 0x1f) << 16) | (ha->serial2 << 8) | ha->serial1;
1303 sprintf(eiter->a.serial_num, "%c%05d", 'A' + sn / 100000, sn % 100000);
1304 alen = strlen(eiter->a.serial_num);
1305 alen += (alen & 3) ? (4 - (alen & 3)) : 4;
1306 eiter->len = cpu_to_be16(4 + alen);
1309 DEBUG13(printk("%s(%ld): SERIALNO=%s.\n", __func__, ha->host_no,
1310 eiter->a.serial_num));
1313 eiter = (struct ct_fdmi_hba_attr *) (entries + size);
1314 eiter->type = __constant_cpu_to_be16(FDMI_HBA_MODEL);
1315 strcpy(eiter->a.model, ha->model_number);
1316 alen = strlen(eiter->a.model);
1317 alen += (alen & 3) ? (4 - (alen & 3)) : 4;
1318 eiter->len = cpu_to_be16(4 + alen);
1321 DEBUG13(printk("%s(%ld): MODEL_NAME=%s.\n", __func__, ha->host_no,
1324 /* Model description. */
1325 eiter = (struct ct_fdmi_hba_attr *) (entries + size);
1326 eiter->type = __constant_cpu_to_be16(FDMI_HBA_MODEL_DESCRIPTION);
1328 strncpy(eiter->a.model_desc, ha->model_desc, 80);
1329 alen = strlen(eiter->a.model_desc);
1330 alen += (alen & 3) ? (4 - (alen & 3)) : 4;
1331 eiter->len = cpu_to_be16(4 + alen);
1334 DEBUG13(printk("%s(%ld): MODEL_DESC=%s.\n", __func__, ha->host_no,
1335 eiter->a.model_desc));
1337 /* Hardware version. */
1338 eiter = (struct ct_fdmi_hba_attr *) (entries + size);
1339 eiter->type = __constant_cpu_to_be16(FDMI_HBA_HARDWARE_VERSION);
1340 strcpy(eiter->a.hw_version, ha->adapter_id);
1341 alen = strlen(eiter->a.hw_version);
1342 alen += (alen & 3) ? (4 - (alen & 3)) : 4;
1343 eiter->len = cpu_to_be16(4 + alen);
1346 DEBUG13(printk("%s(%ld): HARDWAREVER=%s.\n", __func__, ha->host_no,
1347 eiter->a.hw_version));
1349 /* Driver version. */
1350 eiter = (struct ct_fdmi_hba_attr *) (entries + size);
1351 eiter->type = __constant_cpu_to_be16(FDMI_HBA_DRIVER_VERSION);
1352 strcpy(eiter->a.driver_version, qla2x00_version_str);
1353 alen = strlen(eiter->a.driver_version);
1354 alen += (alen & 3) ? (4 - (alen & 3)) : 4;
1355 eiter->len = cpu_to_be16(4 + alen);
1358 DEBUG13(printk("%s(%ld): DRIVERVER=%s.\n", __func__, ha->host_no,
1359 eiter->a.driver_version));
1361 /* Option ROM version. */
1362 eiter = (struct ct_fdmi_hba_attr *) (entries + size);
1363 eiter->type = __constant_cpu_to_be16(FDMI_HBA_OPTION_ROM_VERSION);
1364 strcpy(eiter->a.orom_version, "0.00");
1365 alen = strlen(eiter->a.orom_version);
1366 alen += (alen & 3) ? (4 - (alen & 3)) : 4;
1367 eiter->len = cpu_to_be16(4 + alen);
1370 DEBUG13(printk("%s(%ld): OPTROMVER=%s.\n", __func__, ha->host_no,
1371 eiter->a.orom_version));
1373 /* Firmware version */
1374 eiter = (struct ct_fdmi_hba_attr *) (entries + size);
1375 eiter->type = __constant_cpu_to_be16(FDMI_HBA_FIRMWARE_VERSION);
1376 ha->isp_ops.fw_version_str(ha, eiter->a.fw_version);
1377 alen = strlen(eiter->a.fw_version);
1378 alen += (alen & 3) ? (4 - (alen & 3)) : 4;
1379 eiter->len = cpu_to_be16(4 + alen);
1382 DEBUG13(printk("%s(%ld): FIRMWAREVER=%s.\n", __func__, ha->host_no,
1383 eiter->a.fw_version));
1385 /* Update MS request size. */
1386 qla2x00_update_ms_fdmi_iocb(ha, size + 16);
1388 DEBUG13(printk("%s(%ld): RHBA identifier="
1389 "%02x%02x%02x%02x%02x%02x%02x%02x size=%d.\n", __func__,
1390 ha->host_no, ct_req->req.rhba.hba_identifier[0],
1391 ct_req->req.rhba.hba_identifier[1],
1392 ct_req->req.rhba.hba_identifier[2],
1393 ct_req->req.rhba.hba_identifier[3],
1394 ct_req->req.rhba.hba_identifier[4],
1395 ct_req->req.rhba.hba_identifier[5],
1396 ct_req->req.rhba.hba_identifier[6],
1397 ct_req->req.rhba.hba_identifier[7], size));
1398 DEBUG13(qla2x00_dump_buffer(entries, size));
1400 /* Execute MS IOCB */
1401 rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma,
1402 sizeof(ms_iocb_entry_t));
1403 if (rval != QLA_SUCCESS) {
1405 DEBUG2_3(printk("scsi(%ld): RHBA issue IOCB failed (%d).\n",
1406 ha->host_no, rval));
1407 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "RHBA") !=
1409 rval = QLA_FUNCTION_FAILED;
1410 if (ct_rsp->header.reason_code == CT_REASON_CANNOT_PERFORM &&
1411 ct_rsp->header.explanation_code ==
1412 CT_EXPL_ALREADY_REGISTERED) {
1413 DEBUG2_13(printk("%s(%ld): HBA already registered.\n",
1414 __func__, ha->host_no));
1415 rval = QLA_ALREADY_REGISTERED;
1418 DEBUG2(printk("scsi(%ld): RHBA exiting normally.\n",
1426 * qla2x00_fdmi_dhba() -
1429 * Returns 0 on success.
1432 qla2x00_fdmi_dhba(scsi_qla_host_t *ha)
1436 ms_iocb_entry_t *ms_pkt;
1437 struct ct_sns_req *ct_req;
1438 struct ct_sns_rsp *ct_rsp;
1441 /* Prepare common MS IOCB */
1442 ms_pkt = ha->isp_ops.prep_ms_fdmi_iocb(ha, DHBA_REQ_SIZE,
1445 /* Prepare CT request */
1446 ct_req = qla2x00_prep_ct_fdmi_req(&ha->ct_sns->p.req, DHBA_CMD,
1448 ct_rsp = &ha->ct_sns->p.rsp;
1450 /* Prepare FDMI command arguments -- portname. */
1451 memcpy(ct_req->req.dhba.port_name, ha->port_name, WWN_SIZE);
1453 DEBUG13(printk("%s(%ld): DHBA portname="
1454 "%02x%02x%02x%02x%02x%02x%02x%02x.\n", __func__, ha->host_no,
1455 ct_req->req.dhba.port_name[0], ct_req->req.dhba.port_name[1],
1456 ct_req->req.dhba.port_name[2], ct_req->req.dhba.port_name[3],
1457 ct_req->req.dhba.port_name[4], ct_req->req.dhba.port_name[5],
1458 ct_req->req.dhba.port_name[6], ct_req->req.dhba.port_name[7]));
1460 /* Execute MS IOCB */
1461 rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma,
1462 sizeof(ms_iocb_entry_t));
1463 if (rval != QLA_SUCCESS) {
1465 DEBUG2_3(printk("scsi(%ld): DHBA issue IOCB failed (%d).\n",
1466 ha->host_no, rval));
1467 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "DHBA") !=
1469 rval = QLA_FUNCTION_FAILED;
1471 DEBUG2(printk("scsi(%ld): DHBA exiting normally.\n",
1479 * qla2x00_fdmi_rpa() -
1482 * Returns 0 on success.
1485 qla2x00_fdmi_rpa(scsi_qla_host_t *ha)
1488 uint32_t size, max_frame_size;
1490 ms_iocb_entry_t *ms_pkt;
1491 struct ct_sns_req *ct_req;
1492 struct ct_sns_rsp *ct_rsp;
1494 struct ct_fdmi_port_attr *eiter;
1495 struct init_cb_24xx *icb24 = (struct init_cb_24xx *)ha->init_cb;
1498 /* Prepare common MS IOCB */
1499 /* Request size adjusted after CT preparation */
1500 ms_pkt = ha->isp_ops.prep_ms_fdmi_iocb(ha, 0, RPA_RSP_SIZE);
1502 /* Prepare CT request */
1503 ct_req = qla2x00_prep_ct_fdmi_req(&ha->ct_sns->p.req, RPA_CMD,
1505 ct_rsp = &ha->ct_sns->p.rsp;
1507 /* Prepare FDMI command arguments -- attribute block, attributes. */
1508 memcpy(ct_req->req.rpa.port_name, ha->port_name, WWN_SIZE);
1509 size = WWN_SIZE + 4;
1512 ct_req->req.rpa.attrs.count =
1513 __constant_cpu_to_be32(FDMI_PORT_ATTR_COUNT);
1514 entries = ct_req->req.rpa.port_name;
1517 eiter = (struct ct_fdmi_port_attr *) (entries + size);
1518 eiter->type = __constant_cpu_to_be16(FDMI_PORT_FC4_TYPES);
1519 eiter->len = __constant_cpu_to_be16(4 + 32);
1520 eiter->a.fc4_types[2] = 0x01;
1523 DEBUG13(printk("%s(%ld): FC4_TYPES=%02x %02x.\n", __func__, ha->host_no,
1524 eiter->a.fc4_types[2], eiter->a.fc4_types[1]));
1526 /* Supported speed. */
1527 eiter = (struct ct_fdmi_port_attr *) (entries + size);
1528 eiter->type = __constant_cpu_to_be16(FDMI_PORT_SUPPORT_SPEED);
1529 eiter->len = __constant_cpu_to_be16(4 + 4);
1530 if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
1531 eiter->a.sup_speed = __constant_cpu_to_be32(4);
1532 else if (IS_QLA23XX(ha))
1533 eiter->a.sup_speed = __constant_cpu_to_be32(2);
1535 eiter->a.sup_speed = __constant_cpu_to_be32(1);
1538 DEBUG13(printk("%s(%ld): SUPPORTED_SPEED=%x.\n", __func__, ha->host_no,
1539 eiter->a.sup_speed));
1541 /* Current speed. */
1542 eiter = (struct ct_fdmi_port_attr *) (entries + size);
1543 eiter->type = __constant_cpu_to_be16(FDMI_PORT_CURRENT_SPEED);
1544 eiter->len = __constant_cpu_to_be16(4 + 4);
1545 switch (ha->link_data_rate) {
1547 eiter->a.cur_speed = __constant_cpu_to_be32(1);
1550 eiter->a.cur_speed = __constant_cpu_to_be32(2);
1553 eiter->a.cur_speed = __constant_cpu_to_be32(4);
1558 DEBUG13(printk("%s(%ld): CURRENT_SPEED=%x.\n", __func__, ha->host_no,
1559 eiter->a.cur_speed));
1561 /* Max frame size. */
1562 eiter = (struct ct_fdmi_port_attr *) (entries + size);
1563 eiter->type = __constant_cpu_to_be16(FDMI_PORT_MAX_FRAME_SIZE);
1564 eiter->len = __constant_cpu_to_be16(4 + 4);
1565 max_frame_size = IS_QLA24XX(ha) || IS_QLA54XX(ha) ?
1566 (uint32_t) icb24->frame_payload_size:
1567 (uint32_t) ha->init_cb->frame_payload_size;
1568 eiter->a.max_frame_size = cpu_to_be32(max_frame_size);
1571 DEBUG13(printk("%s(%ld): MAX_FRAME_SIZE=%x.\n", __func__, ha->host_no,
1572 eiter->a.max_frame_size));
1574 /* OS device name. */
1575 eiter = (struct ct_fdmi_port_attr *) (entries + size);
1576 eiter->type = __constant_cpu_to_be16(FDMI_PORT_OS_DEVICE_NAME);
1577 sprintf(eiter->a.os_dev_name, "/proc/scsi/qla2xxx/%ld", ha->host_no);
1578 alen = strlen(eiter->a.os_dev_name);
1579 alen += (alen & 3) ? (4 - (alen & 3)) : 4;
1580 eiter->len = cpu_to_be16(4 + alen);
1583 DEBUG13(printk("%s(%ld): OS_DEVICE_NAME=%s.\n", __func__, ha->host_no,
1584 eiter->a.os_dev_name));
1587 if (strlen(fc_host_system_hostname(ha->host))) {
1588 eiter = (struct ct_fdmi_port_attr *) (entries + size);
1589 eiter->type = __constant_cpu_to_be16(FDMI_PORT_HOST_NAME);
1590 snprintf(eiter->a.host_name, sizeof(eiter->a.host_name),
1591 "%s", fc_host_system_hostname(ha->host));
1592 alen = strlen(eiter->a.host_name);
1593 alen += (alen & 3) ? (4 - (alen & 3)) : 4;
1594 eiter->len = cpu_to_be16(4 + alen);
1597 DEBUG13(printk("%s(%ld): HOSTNAME=%s.\n", __func__,
1598 ha->host_no, eiter->a.host_name));
1601 /* Update MS request size. */
1602 qla2x00_update_ms_fdmi_iocb(ha, size + 16);
1604 DEBUG13(printk("%s(%ld): RPA portname="
1605 "%02x%02x%02x%02x%02x%02x%02x%02x size=%d.\n", __func__,
1606 ha->host_no, ct_req->req.rpa.port_name[0],
1607 ct_req->req.rpa.port_name[1], ct_req->req.rpa.port_name[2],
1608 ct_req->req.rpa.port_name[3], ct_req->req.rpa.port_name[4],
1609 ct_req->req.rpa.port_name[5], ct_req->req.rpa.port_name[6],
1610 ct_req->req.rpa.port_name[7], size));
1611 DEBUG13(qla2x00_dump_buffer(entries, size));
1613 /* Execute MS IOCB */
1614 rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma,
1615 sizeof(ms_iocb_entry_t));
1616 if (rval != QLA_SUCCESS) {
1618 DEBUG2_3(printk("scsi(%ld): RPA issue IOCB failed (%d).\n",
1619 ha->host_no, rval));
1620 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "RPA") !=
1622 rval = QLA_FUNCTION_FAILED;
1624 DEBUG2(printk("scsi(%ld): RPA exiting normally.\n",
1632 * qla2x00_fdmi_register() -
1635 * Returns 0 on success.
1638 qla2x00_fdmi_register(scsi_qla_host_t *ha)
1642 rval = qla2x00_mgmt_svr_login(ha);
1646 rval = qla2x00_fdmi_rhba(ha);
1648 if (rval != QLA_ALREADY_REGISTERED)
1651 rval = qla2x00_fdmi_dhba(ha);
1655 rval = qla2x00_fdmi_rhba(ha);
1659 rval = qla2x00_fdmi_rpa(ha);
1665 * qla2x00_gfpn_id() - SNS Get Fabric Port Name (GFPN_ID) query.
1667 * @list: switch info entries to populate
1669 * Returns 0 on success.
1672 qla2x00_gfpn_id(scsi_qla_host_t *ha, sw_info_t *list)
1677 ms_iocb_entry_t *ms_pkt;
1678 struct ct_sns_req *ct_req;
1679 struct ct_sns_rsp *ct_rsp;
1681 if (!IS_QLA24XX(ha) && !IS_QLA54XX(ha))
1682 return QLA_FUNCTION_FAILED;
1684 for (i = 0; i < MAX_FIBRE_DEVICES; i++) {
1686 memset(list[i].fabric_port_name, 0, WWN_SIZE);
1688 /* Prepare common MS IOCB */
1689 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, GFPN_ID_REQ_SIZE,
1692 /* Prepare CT request */
1693 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, GFPN_ID_CMD,
1695 ct_rsp = &ha->ct_sns->p.rsp;
1697 /* Prepare CT arguments -- port_id */
1698 ct_req->req.port_id.port_id[0] = list[i].d_id.b.domain;
1699 ct_req->req.port_id.port_id[1] = list[i].d_id.b.area;
1700 ct_req->req.port_id.port_id[2] = list[i].d_id.b.al_pa;
1702 /* Execute MS IOCB */
1703 rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma,
1704 sizeof(ms_iocb_entry_t));
1705 if (rval != QLA_SUCCESS) {
1707 DEBUG2_3(printk("scsi(%ld): GFPN_ID issue IOCB "
1708 "failed (%d).\n", ha->host_no, rval));
1709 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp,
1710 "GFPN_ID") != QLA_SUCCESS) {
1711 rval = QLA_FUNCTION_FAILED;
1713 /* Save fabric portname */
1714 memcpy(list[i].fabric_port_name,
1715 ct_rsp->rsp.gfpn_id.port_name, WWN_SIZE);
1718 /* Last device exit. */
1719 if (list[i].d_id.b.rsvd_1 != 0)
1726 static inline void *
1727 qla24xx_prep_ms_fm_iocb(scsi_qla_host_t *ha, uint32_t req_size,
1730 struct ct_entry_24xx *ct_pkt;
1732 ct_pkt = (struct ct_entry_24xx *)ha->ms_iocb;
1733 memset(ct_pkt, 0, sizeof(struct ct_entry_24xx));
1735 ct_pkt->entry_type = CT_IOCB_TYPE;
1736 ct_pkt->entry_count = 1;
1737 ct_pkt->nport_handle = cpu_to_le16(ha->mgmt_svr_loop_id);
1738 ct_pkt->timeout = __constant_cpu_to_le16(59);
1739 ct_pkt->cmd_dsd_count = __constant_cpu_to_le16(1);
1740 ct_pkt->rsp_dsd_count = __constant_cpu_to_le16(1);
1741 ct_pkt->rsp_byte_count = cpu_to_le32(rsp_size);
1742 ct_pkt->cmd_byte_count = cpu_to_le32(req_size);
1744 ct_pkt->dseg_0_address[0] = cpu_to_le32(LSD(ha->ct_sns_dma));
1745 ct_pkt->dseg_0_address[1] = cpu_to_le32(MSD(ha->ct_sns_dma));
1746 ct_pkt->dseg_0_len = ct_pkt->cmd_byte_count;
1748 ct_pkt->dseg_1_address[0] = cpu_to_le32(LSD(ha->ct_sns_dma));
1749 ct_pkt->dseg_1_address[1] = cpu_to_le32(MSD(ha->ct_sns_dma));
1750 ct_pkt->dseg_1_len = ct_pkt->rsp_byte_count;
1751 ct_pkt->vp_index = ha->vp_idx;
1757 static inline struct ct_sns_req *
1758 qla24xx_prep_ct_fm_req(struct ct_sns_req *ct_req, uint16_t cmd,
1761 memset(ct_req, 0, sizeof(struct ct_sns_pkt));
1763 ct_req->header.revision = 0x01;
1764 ct_req->header.gs_type = 0xFA;
1765 ct_req->header.gs_subtype = 0x01;
1766 ct_req->command = cpu_to_be16(cmd);
1767 ct_req->max_rsp_size = cpu_to_be16((rsp_size - 16) / 4);
1773 * qla2x00_gpsc() - FCS Get Port Speed Capabilities (GPSC) query.
1775 * @list: switch info entries to populate
1777 * Returns 0 on success.
1780 qla2x00_gpsc(scsi_qla_host_t *ha, sw_info_t *list)
1785 ms_iocb_entry_t *ms_pkt;
1786 struct ct_sns_req *ct_req;
1787 struct ct_sns_rsp *ct_rsp;
1789 if (!IS_QLA24XX(ha) && !IS_QLA54XX(ha))
1790 return QLA_FUNCTION_FAILED;
1791 if (!ha->flags.gpsc_supported)
1792 return QLA_FUNCTION_FAILED;
1794 rval = qla2x00_mgmt_svr_login(ha);
1798 for (i = 0; i < MAX_FIBRE_DEVICES; i++) {
1800 list[i].fp_speeds = list[i].fp_speed = 0;
1802 /* Prepare common MS IOCB */
1803 ms_pkt = qla24xx_prep_ms_fm_iocb(ha, GPSC_REQ_SIZE,
1806 /* Prepare CT request */
1807 ct_req = qla24xx_prep_ct_fm_req(&ha->ct_sns->p.req,
1808 GPSC_CMD, GPSC_RSP_SIZE);
1809 ct_rsp = &ha->ct_sns->p.rsp;
1811 /* Prepare CT arguments -- port_name */
1812 memcpy(ct_req->req.gpsc.port_name, list[i].fabric_port_name,
1815 /* Execute MS IOCB */
1816 rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma,
1817 sizeof(ms_iocb_entry_t));
1818 if (rval != QLA_SUCCESS) {
1820 DEBUG2_3(printk("scsi(%ld): GPSC issue IOCB "
1821 "failed (%d).\n", ha->host_no, rval));
1822 } else if ((rval = qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp,
1823 "GPSC")) != QLA_SUCCESS) {
1824 /* FM command unsupported? */
1825 if (rval == QLA_INVALID_COMMAND &&
1826 ct_rsp->header.reason_code ==
1827 CT_REASON_INVALID_COMMAND_CODE) {
1828 DEBUG2(printk("scsi(%ld): GPSC command "
1829 "unsupported, disabling query...\n",
1831 ha->flags.gpsc_supported = 0;
1832 rval = QLA_FUNCTION_FAILED;
1835 rval = QLA_FUNCTION_FAILED;
1838 list[i].fp_speeds = ct_rsp->rsp.gpsc.speeds;
1839 list[i].fp_speed = ct_rsp->rsp.gpsc.speed;
1841 DEBUG2_3(printk("scsi(%ld): GPSC ext entry - "
1842 "fpn %02x%02x%02x%02x%02x%02x%02x%02x speeds=%04x "
1843 "speed=%04x.\n", ha->host_no,
1844 list[i].fabric_port_name[0],
1845 list[i].fabric_port_name[1],
1846 list[i].fabric_port_name[2],
1847 list[i].fabric_port_name[3],
1848 list[i].fabric_port_name[4],
1849 list[i].fabric_port_name[5],
1850 list[i].fabric_port_name[6],
1851 list[i].fabric_port_name[7],
1852 be16_to_cpu(list[i].fp_speeds),
1853 be16_to_cpu(list[i].fp_speed)));
1856 /* Last device exit. */
1857 if (list[i].d_id.b.rsvd_1 != 0)