6352 /*
6353 * ql_get_target_id
6354 * Performs EXT_SC_GET_TARGET_ID subcommand. of EXT_CC_GET_DATA.
6355 *
6356 * Input:
6357 * ha: adapter state pointer.
6358 * cmd: Local EXT_IOCTL cmd struct pointer.
6359 * mode: flags.
6360 *
6361 * Returns:
6362 * None, request status indicated in cmd->Status.
6363 *
6364 * Context:
6365 * Kernel context.
6366 */
6367 static void
6368 ql_get_target_id(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
6369 {
6370 uint32_t rval;
6371 uint16_t qlnt;
6372 EXT_DEST_ADDR extdestaddr = {0};
6373 uint8_t *name;
6374 uint8_t wwpn[EXT_DEF_WWN_NAME_SIZE];
6375 ql_tgt_t *tq;
6376
6377 QL_PRINT_9(CE_CONT, "(%d): started\n", ha->instance);
6378
6379 if (ddi_copyin((void *)(uintptr_t)cmd->RequestAdr,
6380 (void*)wwpn, sizeof (EXT_DEST_ADDR), mode) != 0) {
6381 EL(ha, "failed, ddi_copyin\n");
6382 cmd->Status = EXT_STATUS_COPY_ERR;
6383 cmd->ResponseLen = 0;
6384 return;
6385 }
6386
6387 qlnt = QLNT_PORT;
6388 name = wwpn;
6389 QL_PRINT_9(CE_CONT, "(%d): wwpn=%02x%02x%02x%02x%02x%02x%02x%02x\n",
6390 ha->instance, name[0], name[1], name[2], name[3], name[4],
6391 name[5], name[6], name[7]);
6392
6812 if (ddi_getlongprop(DDI_DEV_T_ANY, ha->dip,
6813 PROP_LEN_AND_VAL_ALLOC | DDI_PROP_DONTPASS |
6814 DDI_PROP_CANSLEEP, "version", (caddr_t)&bufp,
6815 (int *)&len) == DDI_PROP_SUCCESS) {
6816
6817 (void) snprintf(fcache->verstr,
6818 FCHBA_OPTION_ROM_VERSION_LEN, "%s", bufp);
6819 kmem_free(bufp, len);
6820 }
6821
6822 *nextpos = 0xffffffff;
6823
6824 QL_PRINT_9(CE_CONT, "(%d): CFG_SBUS_CARD, done\n",
6825 ha->instance);
6826
6827 return (0);
6828 }
6829
6830 if (*nextpos == ha->flash_fw_addr << 2) {
6831
6832 pci_header_t fwh = {0};
6833 pci_data_t fwd = {0};
6834 uint8_t *buf, *bufp;
6835
6836 /*
6837 * Build a pci header for the firmware module
6838 */
6839 if ((buf = (uint8_t *)(kmem_zalloc(FBUFSIZE, KM_SLEEP))) ==
6840 NULL) {
6841 EL(ha, "failed, unable to allocate buffer\n");
6842 return (1);
6843 }
6844
6845 fwh.signature[0] = PCI_HEADER0;
6846 fwh.signature[1] = PCI_HEADER1;
6847 fwh.dataoffset[0] = LSB(sizeof (pci_header_t));
6848 fwh.dataoffset[1] = MSB(sizeof (pci_header_t));
6849
6850 fwd.signature[0] = 'P';
6851 fwd.signature[1] = 'C';
6852 fwd.signature[2] = 'I';
6853 fwd.signature[3] = 'R';
7463 * ql_port_param
7464 * Retrieves or sets the firmware port speed settings
7465 *
7466 * Input:
7467 * ha: adapter state pointer.
7468 * cmd: Local EXT_IOCTL cmd struct pointer.
7469 * mode: flags.
7470 *
7471 * Returns:
7472 * None, request status indicated in cmd->Status.
7473 *
7474 * Context:
7475 * Kernel context.
7476 *
7477 */
7478 static void
7479 ql_port_param(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
7480 {
7481 uint8_t *name;
7482 ql_tgt_t *tq;
7483 EXT_PORT_PARAM port_param = {0};
7484 uint32_t rval = QL_SUCCESS;
7485 uint32_t idma_rate;
7486
7487 QL_PRINT_9(CE_CONT, "(%d): started\n", ha->instance);
7488
7489 if (CFG_IST(ha, CFG_CTRL_242581) == 0) {
7490 EL(ha, "invalid request for this HBA\n");
7491 cmd->Status = EXT_STATUS_INVALID_REQUEST;
7492 cmd->ResponseLen = 0;
7493 return;
7494 }
7495
7496 if (LOOP_NOT_READY(ha)) {
7497 EL(ha, "failed, loop not ready\n");
7498 cmd->Status = EXT_STATUS_DEVICE_OFFLINE;
7499 cmd->ResponseLen = 0;
7500 return;
7501 }
7502
7503 if (ddi_copyin((void *)(uintptr_t)cmd->RequestAdr,
|
6352 /*
6353 * ql_get_target_id
6354 * Performs EXT_SC_GET_TARGET_ID subcommand. of EXT_CC_GET_DATA.
6355 *
6356 * Input:
6357 * ha: adapter state pointer.
6358 * cmd: Local EXT_IOCTL cmd struct pointer.
6359 * mode: flags.
6360 *
6361 * Returns:
6362 * None, request status indicated in cmd->Status.
6363 *
6364 * Context:
6365 * Kernel context.
6366 */
6367 static void
6368 ql_get_target_id(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
6369 {
6370 uint32_t rval;
6371 uint16_t qlnt;
6372 EXT_DEST_ADDR extdestaddr = {{{0}}};
6373 uint8_t *name;
6374 uint8_t wwpn[EXT_DEF_WWN_NAME_SIZE];
6375 ql_tgt_t *tq;
6376
6377 QL_PRINT_9(CE_CONT, "(%d): started\n", ha->instance);
6378
6379 if (ddi_copyin((void *)(uintptr_t)cmd->RequestAdr,
6380 (void*)wwpn, sizeof (EXT_DEST_ADDR), mode) != 0) {
6381 EL(ha, "failed, ddi_copyin\n");
6382 cmd->Status = EXT_STATUS_COPY_ERR;
6383 cmd->ResponseLen = 0;
6384 return;
6385 }
6386
6387 qlnt = QLNT_PORT;
6388 name = wwpn;
6389 QL_PRINT_9(CE_CONT, "(%d): wwpn=%02x%02x%02x%02x%02x%02x%02x%02x\n",
6390 ha->instance, name[0], name[1], name[2], name[3], name[4],
6391 name[5], name[6], name[7]);
6392
6812 if (ddi_getlongprop(DDI_DEV_T_ANY, ha->dip,
6813 PROP_LEN_AND_VAL_ALLOC | DDI_PROP_DONTPASS |
6814 DDI_PROP_CANSLEEP, "version", (caddr_t)&bufp,
6815 (int *)&len) == DDI_PROP_SUCCESS) {
6816
6817 (void) snprintf(fcache->verstr,
6818 FCHBA_OPTION_ROM_VERSION_LEN, "%s", bufp);
6819 kmem_free(bufp, len);
6820 }
6821
6822 *nextpos = 0xffffffff;
6823
6824 QL_PRINT_9(CE_CONT, "(%d): CFG_SBUS_CARD, done\n",
6825 ha->instance);
6826
6827 return (0);
6828 }
6829
6830 if (*nextpos == ha->flash_fw_addr << 2) {
6831
6832 pci_header_t fwh = {{0}};
6833 pci_data_t fwd = {{0}};
6834 uint8_t *buf, *bufp;
6835
6836 /*
6837 * Build a pci header for the firmware module
6838 */
6839 if ((buf = (uint8_t *)(kmem_zalloc(FBUFSIZE, KM_SLEEP))) ==
6840 NULL) {
6841 EL(ha, "failed, unable to allocate buffer\n");
6842 return (1);
6843 }
6844
6845 fwh.signature[0] = PCI_HEADER0;
6846 fwh.signature[1] = PCI_HEADER1;
6847 fwh.dataoffset[0] = LSB(sizeof (pci_header_t));
6848 fwh.dataoffset[1] = MSB(sizeof (pci_header_t));
6849
6850 fwd.signature[0] = 'P';
6851 fwd.signature[1] = 'C';
6852 fwd.signature[2] = 'I';
6853 fwd.signature[3] = 'R';
7463 * ql_port_param
7464 * Retrieves or sets the firmware port speed settings
7465 *
7466 * Input:
7467 * ha: adapter state pointer.
7468 * cmd: Local EXT_IOCTL cmd struct pointer.
7469 * mode: flags.
7470 *
7471 * Returns:
7472 * None, request status indicated in cmd->Status.
7473 *
7474 * Context:
7475 * Kernel context.
7476 *
7477 */
7478 static void
7479 ql_port_param(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
7480 {
7481 uint8_t *name;
7482 ql_tgt_t *tq;
7483 EXT_PORT_PARAM port_param = {{{{0}}}};
7484 uint32_t rval = QL_SUCCESS;
7485 uint32_t idma_rate;
7486
7487 QL_PRINT_9(CE_CONT, "(%d): started\n", ha->instance);
7488
7489 if (CFG_IST(ha, CFG_CTRL_242581) == 0) {
7490 EL(ha, "invalid request for this HBA\n");
7491 cmd->Status = EXT_STATUS_INVALID_REQUEST;
7492 cmd->ResponseLen = 0;
7493 return;
7494 }
7495
7496 if (LOOP_NOT_READY(ha)) {
7497 EL(ha, "failed, loop not ready\n");
7498 cmd->Status = EXT_STATUS_DEVICE_OFFLINE;
7499 cmd->ResponseLen = 0;
7500 return;
7501 }
7502
7503 if (ddi_copyin((void *)(uintptr_t)cmd->RequestAdr,
|