Lines Matching refs:scmd

1811 	sata_cmd_t *scmd;
1852 scmd = &spkt->satapkt_cmd;
1853 scmd->satacmd_features_reg = regn & 0xff;
1854 scmd->satacmd_features_reg_ext = (regn >> 8) & 0xff;
1855 scmd->satacmd_device_reg = sd->satadev_addr.pmport;
1856 scmd->satacmd_addr_type = 0; /* N/A */
1858 scmd->satacmd_flags.sata_ignore_dev_reset = B_TRUE;
1861 scmd->satacmd_cmd_reg = SATAC_READ_PORTMULT;
1862 scmd->satacmd_flags.sata_data_direction = SATA_DIR_READ;
1863 scmd->satacmd_flags.sata_special_regs = 1;
1864 scmd->satacmd_flags.sata_copy_out_lba_high_lsb = 1;
1865 scmd->satacmd_flags.sata_copy_out_lba_mid_lsb = 1;
1866 scmd->satacmd_flags.sata_copy_out_lba_low_lsb = 1;
1867 scmd->satacmd_flags.sata_copy_out_sec_count_lsb = 1;
1869 scmd->satacmd_cmd_reg = SATAC_WRITE_PORTMULT;
1870 scmd->satacmd_flags.sata_data_direction = SATA_DIR_WRITE;
1871 scmd->satacmd_sec_count_lsb = regv & 0xff;
1872 scmd->satacmd_lba_low_lsb = regv >> 8 & 0xff;
1873 scmd->satacmd_lba_mid_lsb = regv >> 16 & 0xff;
1874 scmd->satacmd_lba_high_lsb = regv >> 24 & 0xff;
3941 sata_cmd_t *scmd = &spx->txlt_sata_pkt->satapkt_cmd;
3975 sata_build_generic_cmd(scmd, SATAC_CHECK_POWER_MODE);
3976 scmd->satacmd_flags.sata_copy_out_sec_count_lsb = B_TRUE;
3977 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
3982 if (scmd->satacmd_error_reg != 0) {
3988 switch (scmd->satacmd_sec_count_lsb) {
4083 sata_cmd_t *scmd = &spx->txlt_sata_pkt->satapkt_cmd;
4104 sata_build_generic_cmd(scmd, SATAC_CHECK_POWER_MODE);
4105 scmd->satacmd_flags.sata_copy_out_sec_count_lsb = B_TRUE;
4106 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4112 if (scmd->satacmd_error_reg != 0) {
4118 power_state = scmd->satacmd_sec_count_lsb;
4193 sata_cmd_t *scmd = &spx->txlt_sata_pkt->satapkt_cmd;
4233 sata_build_read_verify_cmd(scmd, 1, 5);
4234 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4241 if (scmd->satacmd_error_reg != 0) {
4247 sata_build_generic_cmd(scmd, SATAC_FLUSH_CACHE);
4248 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4253 if (scmd->satacmd_error_reg != 0) {
4258 sata_build_generic_cmd(scmd, SATAC_STANDBY_IM);
4259 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4264 if (scmd->satacmd_error_reg != 0) {
4271 sata_build_generic_cmd(scmd, SATAC_IDLE);
4272 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4277 if (scmd->satacmd_error_reg != 0) {
4280 sata_build_read_verify_cmd(scmd, 1, 5);
4281 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4288 if (scmd->satacmd_error_reg != 0) {
4295 sata_build_generic_cmd(scmd, SATAC_FLUSH_CACHE);
4296 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4302 if (scmd->satacmd_error_reg != 0) {
4306 sata_build_generic_cmd(scmd, SATAC_IDLE);
4307 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4312 if (scmd->satacmd_error_reg != 0) {
4326 sata_build_generic_cmd(scmd, SATAC_IDLE_IM);
4327 scmd->satacmd_features_reg = 0x44;
4328 scmd->satacmd_lba_low_lsb = 0x4c;
4329 scmd->satacmd_lba_mid_lsb = 0x4e;
4330 scmd->satacmd_lba_high_lsb = 0x55;
4331 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4336 if (scmd->satacmd_error_reg != 0) {
4343 sata_build_generic_cmd(scmd, SATAC_FLUSH_CACHE);
4344 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4350 if (scmd->satacmd_error_reg != 0) {
4354 sata_build_generic_cmd(scmd, SATAC_STANDBY);
4355 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4360 if (scmd->satacmd_error_reg != 0) {
4366 sata_build_generic_cmd(scmd, SATAC_CHECK_POWER_MODE);
4367 scmd->satacmd_flags.sata_copy_out_sec_count_lsb = B_TRUE;
4368 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4373 if (scmd->satacmd_error_reg != 0) {
4376 switch (scmd->satacmd_sec_count_lsb) {
4378 sata_build_generic_cmd(scmd, SATAC_STANDBY);
4379 scmd->satacmd_sec_count_msb = sata_get_standby_timer(
4381 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4386 if (scmd->satacmd_error_reg != 0) {
4392 sata_build_generic_cmd(scmd, SATAC_IDLE);
4393 scmd->satacmd_sec_count_msb = sata_get_standby_timer(
4395 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4400 if (scmd->satacmd_error_reg != 0) {
4408 sata_build_generic_cmd(scmd, SATAC_IDLE);
4409 scmd->satacmd_sec_count_msb = sata_get_standby_timer(
4411 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4416 if (scmd->satacmd_error_reg != 0) {
4419 sata_build_read_verify_cmd(scmd, 1, 5);
4420 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4425 if (scmd->satacmd_error_reg != 0) {
4441 sata_build_generic_cmd(scmd, SATAC_FLUSH_CACHE);
4442 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4448 if (scmd->satacmd_error_reg != 0) {
4451 sata_build_generic_cmd(scmd, SATAC_STANDBY_IM);
4452 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
4457 if (scmd->satacmd_error_reg != 0) {
4805 sata_cmd_t *scmd = &spx->txlt_sata_pkt->satapkt_cmd;
4925 scmd->satacmd_flags.sata_data_direction = SATA_DIR_WRITE;
4926 scmd->satacmd_addr_type = ATA_ADDR_LBA48;
4927 scmd->satacmd_cmd_reg = SATAC_DSM;
4928 scmd->satacmd_sec_count_msb = (count >> 8) & 0xff;
4929 scmd->satacmd_sec_count_lsb = count & 0xff;
4930 scmd->satacmd_features_reg = TRIM;
4931 scmd->satacmd_device_reg = SATA_ADH_LBA;
4932 scmd->satacmd_status_reg = 0;
4933 scmd->satacmd_error_reg = 0;
5586 sata_cmd_t *scmd = &spx->txlt_sata_pkt->satapkt_cmd;
5605 scmd->satacmd_flags.sata_data_direction = SATA_DIR_READ;
5607 scmd->satacmd_flags.sata_data_direction = SATA_DIR_WRITE;
5639 scmd->satacmd_flags.sata_data_direction = SATA_DIR_NODATA_XFER;
5644 if (scmd->satacmd_flags.sata_data_direction == SATA_DIR_WRITE) {
5662 if (scmd->satacmd_flags.sata_data_direction == SATA_DIR_READ) {
5691 scmd->satacmd_device_reg = scsipkt->pkt_cdbp[13] & 0xf0;
5692 scmd->satacmd_cmd_reg = scsipkt->pkt_cdbp[9];
5713 scmd->satacmd_device_reg = scsipkt->pkt_cdbp[13];
5714 scmd->satacmd_cmd_reg = scsipkt->pkt_cdbp[14];
5725 scmd->satacmd_device_reg = scsipkt->pkt_cdbp[13] &
5727 scmd->satacmd_cmd_reg = scsipkt->pkt_cdbp[14];
5736 scmd->satacmd_flags.sata_copy_out_sec_count_msb = 1;
5737 scmd->satacmd_flags.sata_copy_out_lba_low_msb = 1;
5738 scmd->satacmd_flags.sata_copy_out_lba_mid_msb = 1;
5739 scmd->satacmd_flags.sata_copy_out_lba_high_msb = 1;
5742 scmd->satacmd_flags.sata_copy_out_sec_count_lsb = 1;
5743 scmd->satacmd_flags.sata_copy_out_lba_low_lsb = 1;
5744 scmd->satacmd_flags.sata_copy_out_lba_mid_lsb = 1;
5745 scmd->satacmd_flags.sata_copy_out_lba_high_lsb = 1;
5746 scmd->satacmd_flags.sata_copy_out_device_reg = 1;
5747 scmd->satacmd_flags.sata_copy_out_error_reg = 1;
5752 scmd->satacmd_addr_type = ATA_ADDR_LBA48;
5754 scmd->satacmd_features_reg_ext = (feature >> 8) & 0xff;
5755 scmd->satacmd_sec_count_msb = (sec_count >> 8) & 0xff;
5756 scmd->satacmd_lba_low_msb = (lba >> 8) & 0xff;
5757 scmd->satacmd_lba_mid_msb = (lba >> 8) & 0xff;
5758 scmd->satacmd_lba_high_msb = lba >> 40;
5760 scmd->satacmd_addr_type = ATA_ADDR_LBA28;
5762 scmd->satacmd_features_reg_ext = 0;
5763 scmd->satacmd_sec_count_msb = 0;
5764 scmd->satacmd_lba_low_msb = 0;
5765 scmd->satacmd_lba_mid_msb = 0;
5766 scmd->satacmd_lba_high_msb = 0;
5769 scmd->satacmd_features_reg = feature & 0xff;
5770 scmd->satacmd_sec_count_lsb = sec_count & 0xff;
5771 scmd->satacmd_lba_low_lsb = lba & 0xff;
5772 scmd->satacmd_lba_mid_lsb = (lba >> 8) & 0xff;
5773 scmd->satacmd_lba_high_lsb = (lba >> 16) & 0xff;
6121 sata_cmd_t *scmd = &spx->txlt_sata_pkt->satapkt_cmd;
6141 scmd->satacmd_flags.sata_data_direction = SATA_DIR_READ;
6221 scmd->satacmd_addr_type = ATA_ADDR_LBA;
6222 scmd->satacmd_device_reg = SATA_ADH_LBA;
6223 scmd->satacmd_cmd_reg = SATAC_READ_DMA;
6225 scmd->satacmd_addr_type = ATA_ADDR_LBA48;
6226 scmd->satacmd_cmd_reg = SATAC_READ_DMA_EXT;
6227 scmd->satacmd_sec_count_msb = sec_count >> 8;
6229 scmd->satacmd_lba_low_msb = (lba >> 24) & 0xff;
6230 scmd->satacmd_lba_mid_msb = (lba >> 32) & 0xff;
6231 scmd->satacmd_lba_high_msb = lba >> 40;
6234 scmd->satacmd_addr_type = ATA_ADDR_LBA28;
6235 scmd->satacmd_device_reg = SATA_ADH_LBA | ((lba >> 24) & 0xf);
6237 scmd->satacmd_sec_count_lsb = sec_count & 0xff;
6238 scmd->satacmd_lba_low_lsb = lba & 0xff;
6239 scmd->satacmd_lba_mid_lsb = (lba >> 8) & 0xff;
6240 scmd->satacmd_lba_high_lsb = (lba >> 16) & 0xff;
6241 scmd->satacmd_features_reg = 0;
6242 scmd->satacmd_status_reg = 0;
6243 scmd->satacmd_error_reg = 0;
6261 scmd->satacmd_cmd_reg =
6263 scmd->satacmd_features_reg_ext =
6264 scmd->satacmd_sec_count_msb;
6265 scmd->satacmd_sec_count_msb = 0;
6275 scmd->satacmd_cmd_reg =
6277 scmd->satacmd_features_reg_ext =
6278 scmd->satacmd_sec_count_msb;
6279 scmd->satacmd_sec_count_msb = 0;
6281 scmd->satacmd_cmd_reg =
6292 scmd->satacmd_features_reg =
6293 scmd->satacmd_sec_count_lsb;
6294 scmd->satacmd_sec_count_lsb = 0;
6295 scmd->satacmd_flags.sata_queued = B_TRUE;
6298 scmd->satacmd_flags.sata_max_queue_depth =
6314 scmd->satacmd_flags.sata_max_queue_depth =
6319 scmd->satacmd_flags.sata_max_queue_depth = 0;
6322 scmd->satacmd_flags.sata_max_queue_depth = 0;
6326 scmd->satacmd_cmd_reg, lba, sec_count);
6390 sata_cmd_t *scmd = &spx->txlt_sata_pkt->satapkt_cmd;
6410 scmd->satacmd_flags.sata_data_direction = SATA_DIR_WRITE;
6490 scmd->satacmd_addr_type = ATA_ADDR_LBA;
6491 scmd->satacmd_device_reg = SATA_ADH_LBA;
6492 scmd->satacmd_cmd_reg = SATAC_WRITE_DMA;
6494 scmd->satacmd_addr_type = ATA_ADDR_LBA48;
6495 scmd->satacmd_cmd_reg = SATAC_WRITE_DMA_EXT;
6496 scmd->satacmd_sec_count_msb = sec_count >> 8;
6497 scmd->satacmd_lba_low_msb = (lba >> 24) & 0xff;
6499 scmd->satacmd_lba_mid_msb = (lba >> 32) & 0xff;
6500 scmd->satacmd_lba_high_msb = lba >> 40;
6503 scmd->satacmd_addr_type = ATA_ADDR_LBA28;
6504 scmd->satacmd_device_reg = SATA_ADH_LBA | ((lba >> 24) & 0xf);
6506 scmd->satacmd_sec_count_lsb = sec_count & 0xff;
6507 scmd->satacmd_lba_low_lsb = lba & 0xff;
6508 scmd->satacmd_lba_mid_lsb = (lba >> 8) & 0xff;
6509 scmd->satacmd_lba_high_lsb = (lba >> 16) & 0xff;
6510 scmd->satacmd_features_reg = 0;
6511 scmd->satacmd_status_reg = 0;
6512 scmd->satacmd_error_reg = 0;
6530 scmd->satacmd_cmd_reg =
6532 scmd->satacmd_features_reg_ext =
6533 scmd->satacmd_sec_count_msb;
6534 scmd->satacmd_sec_count_msb = 0;
6544 scmd->satacmd_cmd_reg =
6546 scmd->satacmd_features_reg_ext =
6547 scmd->satacmd_sec_count_msb;
6548 scmd->satacmd_sec_count_msb = 0;
6550 scmd->satacmd_cmd_reg =
6557 scmd->satacmd_features_reg =
6558 scmd->satacmd_sec_count_lsb;
6559 scmd->satacmd_sec_count_lsb = 0;
6560 scmd->satacmd_flags.sata_queued = B_TRUE;
6562 scmd->satacmd_flags.sata_max_queue_depth =
6578 scmd->satacmd_flags.sata_max_queue_depth =
6583 scmd->satacmd_flags.sata_max_queue_depth = 0;
6586 scmd->satacmd_flags.sata_max_queue_depth = 0;
6590 scmd->satacmd_cmd_reg, lba, sec_count);
6635 sata_cmd_t *scmd = &spx->txlt_sata_pkt->satapkt_cmd;
6659 scmd->satacmd_flags.sata_data_direction = SATA_DIR_WRITE;
6681 scmd->satacmd_features_reg = SATA_DOWNLOAD_MCODE_TEMP;
6684 scmd->satacmd_features_reg = SATA_DOWNLOAD_MCODE_SAVE;
6692 scmd->satacmd_cmd_reg = SATAC_DOWNLOAD_MICROCODE;
6696 scmd->satacmd_sec_count_lsb = (uint8_t)sector_count;
6697 scmd->satacmd_lba_low_lsb = ((uint16_t)sector_count) >> 8;
6698 scmd->satacmd_lba_mid_lsb = 0;
6699 scmd->satacmd_lba_high_lsb = 0;
6700 scmd->satacmd_device_reg = 0;
6702 scmd->satacmd_addr_type = 0;
6888 sata_cmd_t *scmd = &spx->txlt_sata_pkt->satapkt_cmd;
6901 scmd->satacmd_addr_type = 0;
6902 scmd->satacmd_cmd_reg = SATAC_FLUSH_CACHE;
6903 scmd->satacmd_device_reg = 0;
6904 scmd->satacmd_sec_count_lsb = 0;
6905 scmd->satacmd_lba_low_lsb = 0;
6906 scmd->satacmd_lba_mid_lsb = 0;
6907 scmd->satacmd_lba_high_lsb = 0;
6908 scmd->satacmd_features_reg = 0;
6909 scmd->satacmd_status_reg = 0;
6910 scmd->satacmd_error_reg = 0;
7456 sata_cmd_t *scmd = &sata_pkt->satapkt_cmd;
7496 if ((scmd->satacmd_addr_type == ATA_ADDR_LBA48) &&
7497 (scmd->satacmd_lba_mid_msb != 0 ||
7498 scmd->satacmd_lba_high_msb != 0)) {
7535 switch (scmd->satacmd_cmd_reg) {
7562 scmd->satacmd_cmd_reg));
7641 sata_cmd_t *scmd = &sata_pkt->satapkt_cmd;
7681 if (scmd->satacmd_status_reg & SATA_STATUS_DF) {
7685 } else if (scmd->satacmd_status_reg & SATA_STATUS_ERR) {
7686 if (scmd->satacmd_error_reg & SATA_ERROR_NM) {
7691 } else if (scmd->satacmd_error_reg & SATA_ERROR_UNC) {
7695 } else if (scmd->satacmd_error_reg & SATA_ERROR_ILI) {
7699 } else if (scmd->satacmd_error_reg & SATA_ERROR_IDNF) {
7703 } else if (scmd->satacmd_error_reg & SATA_ERROR_ABORT) {
7707 } else if (scmd->satacmd_error_reg & SATA_ERROR_MC) {
7712 } else if (scmd->satacmd_error_reg & SATA_ERROR_MCR) {
7716 } else if (scmd->satacmd_error_reg & SATA_ERROR_ICRC) {
7741 sata_cmd_t *scmd = &sata_pkt->satapkt_cmd;
7771 if (scmd->satacmd_status_reg & SATA_STATUS_DF) {
7775 } else if (scmd->satacmd_status_reg & SATA_STATUS_ERR) {
7776 if (scmd->satacmd_error_reg & SATA_ERROR_NM) {
7781 } else if (scmd->satacmd_error_reg & SATA_ERROR_UNC) {
7785 } else if (scmd->satacmd_error_reg & SATA_ERROR_ILI) {
7789 } else if (scmd->satacmd_error_reg & SATA_ERROR_IDNF) {
7793 } else if (scmd->satacmd_error_reg & SATA_ERROR_ABORT) {
7797 } else if (scmd->satacmd_error_reg & SATA_ERROR_MC) {
7802 } else if (scmd->satacmd_error_reg & SATA_ERROR_MCR) {
7806 } else if (scmd->satacmd_error_reg & SATA_ERROR_ICRC) {
7834 sata_cmd_t *scmd = &sata_pkt->satapkt_cmd;
7876 ata_ret_desc->ars_error = scmd->satacmd_error_reg;
7877 ata_ret_desc->ars_sec_count_lsb = scmd->satacmd_sec_count_lsb;
7878 ata_ret_desc->ars_lba_low_lsb = scmd->satacmd_lba_low_lsb;
7879 ata_ret_desc->ars_lba_mid_lsb = scmd->satacmd_lba_mid_lsb;
7880 ata_ret_desc->ars_lba_high_lsb = scmd->satacmd_lba_high_lsb;
7881 ata_ret_desc->ars_device = scmd->satacmd_device_reg;
7882 ata_ret_desc->ars_status = scmd->satacmd_status_reg;
7886 ata_ret_desc->ars_sec_count_msb = scmd->satacmd_sec_count_msb;
7887 ata_ret_desc->ars_lba_low_msb = scmd->satacmd_lba_low_msb;
7888 ata_ret_desc->ars_lba_mid_msb = scmd->satacmd_lba_mid_msb;
7889 ata_ret_desc->ars_lba_high_msb = scmd->satacmd_lba_high_msb;
8216 sata_cmd_t *scmd = &spx->txlt_sata_pkt->satapkt_cmd;
8261 scmd->satacmd_flags.sata_data_direction = SATA_DIR_NODATA_XFER;
8262 scmd->satacmd_addr_type = 0;
8263 scmd->satacmd_device_reg = 0;
8264 scmd->satacmd_status_reg = 0;
8265 scmd->satacmd_error_reg = 0;
8266 scmd->satacmd_cmd_reg = SATAC_SET_FEATURES;
8272 scmd->satacmd_features_reg =
8276 scmd->satacmd_features_reg =
8311 scmd->satacmd_features_reg =
8315 scmd->satacmd_features_reg =
8389 sata_cmd_t *scmd = &spx->txlt_sata_pkt->satapkt_cmd;
8431 scmd->satacmd_flags.sata_data_direction = SATA_DIR_NODATA_XFER;
8434 scmd->satacmd_addr_type = 0; /* N/A */
8435 scmd->satacmd_lba_mid_lsb = SMART_MAGIC_VAL_1;
8436 scmd->satacmd_lba_high_lsb = SMART_MAGIC_VAL_2;
8437 scmd->satacmd_features_reg = page->dexcpt ?
8439 scmd->satacmd_device_reg = 0; /* Always device 0 */
8440 scmd->satacmd_cmd_reg = SATAC_SMART;
8478 sata_cmd_t *scmd = &spx->txlt_sata_pkt->satapkt_cmd;
8511 scmd->satacmd_flags.sata_data_direction = SATA_DIR_NODATA_XFER;
8512 scmd->satacmd_addr_type = 0;
8513 scmd->satacmd_device_reg = 0;
8514 scmd->satacmd_status_reg = 0;
8515 scmd->satacmd_error_reg = 0;
8516 scmd->satacmd_cmd_reg = SATAC_SET_FEATURES;
8518 scmd->satacmd_features_reg = SATAC_SF_ENABLE_ACOUSTIC;
8519 scmd->satacmd_sec_count_lsb = page->acoustic_manag_level;
8521 scmd->satacmd_features_reg = SATAC_SF_DISABLE_ACOUSTIC;
8558 sata_cmd_t *scmd = &spx->txlt_sata_pkt->satapkt_cmd;
8594 scmd->satacmd_addr_type = 0;
8595 scmd->satacmd_sec_count_lsb = ata_count;
8596 scmd->satacmd_lba_low_lsb = 0;
8597 scmd->satacmd_lba_mid_lsb = 0;
8598 scmd->satacmd_lba_high_lsb = 0;
8599 scmd->satacmd_features_reg = 0;
8600 scmd->satacmd_device_reg = 0;
8601 scmd->satacmd_status_reg = 0;
8602 scmd->satacmd_cmd_reg = SATAC_STANDBY;
8603 scmd->satacmd_flags.sata_special_regs = B_TRUE;
8604 scmd->satacmd_flags.sata_copy_out_error_reg = B_TRUE;
8610 if ((scmd->satacmd_error_reg != 0) ||
9292 sata_build_read_verify_cmd(sata_cmd_t *scmd, uint16_t sec, uint64_t lba)
9294 scmd->satacmd_cmd_reg = SATAC_RDVER;
9295 scmd->satacmd_addr_type = ATA_ADDR_LBA28;
9296 scmd->satacmd_flags.sata_special_regs = B_TRUE;
9298 scmd->satacmd_sec_count_lsb = sec & 0xff;
9299 scmd->satacmd_lba_low_lsb = lba & 0xff;
9300 scmd->satacmd_lba_mid_lsb = (lba >> 8) & 0xff;
9301 scmd->satacmd_lba_high_lsb = (lba >> 16) & 0xff;
9302 scmd->satacmd_device_reg = (SATA_ADH_LBA | (lba >> 24) & 0xf);
9303 scmd->satacmd_features_reg = 0;
9304 scmd->satacmd_status_reg = 0;
9305 scmd->satacmd_error_reg = 0;
9314 sata_build_generic_cmd(sata_cmd_t *scmd, uint8_t cmd)
9316 scmd->satacmd_addr_type = 0;
9317 scmd->satacmd_cmd_reg = cmd;
9318 scmd->satacmd_device_reg = 0;
9319 scmd->satacmd_sec_count_lsb = 0;
9320 scmd->satacmd_lba_low_lsb = 0;
9321 scmd->satacmd_lba_mid_lsb = 0;
9322 scmd->satacmd_lba_high_lsb = 0;
9323 scmd->satacmd_features_reg = 0;
9324 scmd->satacmd_status_reg = 0;
9325 scmd->satacmd_error_reg = 0;
9326 scmd->satacmd_flags.sata_special_regs = B_TRUE;
9387 sata_cmd_t *scmd = &spx->txlt_sata_pkt->satapkt_cmd;
9474 * scmd->satacmd_flags.sata_data_direction default -
9478 if (scmd->satacmd_bp) {
9479 if (scmd->satacmd_bp->b_flags & B_READ) {
9480 scmd->satacmd_flags.sata_data_direction = SATA_DIR_READ;
9482 scmd->satacmd_flags.sata_data_direction =
9491 sata_atapi_packet_cmd_setup(scmd, sdinfo);
9494 scmd->satacmd_acdb_len = sdinfo->satadrv_atapi_cdb_len;
9495 bzero(scmd->satacmd_acdb, SATA_ATAPI_MAX_CDB_LEN);
9496 bcopy(cdbp, scmd->satacmd_acdb, cdblen);
9499 if (scmd->satacmd_acdb[0] == SCMD_INQUIRY) {
9500 if (scmd->satacmd_acdb[3] != 0)
9501 scmd->satacmd_acdb[4] = 255;
9506 uint8_t *p = scmd->satacmd_acdb;
9525 bzero(scmd->satacmd_rqsense, SATA_ATAPI_RQSENSE_LEN);
9527 (struct scsi_extended_sense *)scmd->satacmd_rqsense);
9721 sata_cmd_t *scmd;
9745 scmd = &spkt->satapkt_cmd;
9746 scmd->satacmd_flags.sata_data_direction = SATA_DIR_READ;
9747 scmd->satacmd_flags.sata_ignore_dev_reset = B_TRUE;
9749 sata_atapi_packet_cmd_setup(scmd, sdinfo);
9756 scmd->satacmd_acdb_len = sdinfo->satadrv_atapi_cdb_len;
9757 bcopy(sata_rqsense_cdb, scmd->satacmd_acdb, SATA_ATAPI_RQSENSE_CDB_LEN);
9759 bzero(&scmd->satacmd_acdb[SATA_ATAPI_RQSENSE_CDB_LEN],
9766 scmd->satacmd_err_ret_buf_handle = &spx->txlt_buf_dma_handle;
9773 bzero(scmd->satacmd_rqsense, SATA_ATAPI_RQSENSE_LEN);
9775 (struct scsi_extended_sense *)scmd->satacmd_rqsense);
9777 ASSERT(scmd->satacmd_num_dma_cookies != 0);
9778 ASSERT(scmd->satacmd_dma_cookie_list != NULL);
9792 sata_atapi_packet_cmd_setup(sata_cmd_t *scmd, sata_drive_info_t *sdinfo)
9794 scmd->satacmd_addr_type = 0; /* N/A */
9795 scmd->satacmd_sec_count_lsb = 0; /* no tag */
9796 scmd->satacmd_lba_low_lsb = 0; /* N/A */
9797 scmd->satacmd_lba_mid_lsb = (uint8_t)SATA_ATAPI_MAX_BYTES_PER_DRQ;
9798 scmd->satacmd_lba_high_lsb =
9800 scmd->satacmd_cmd_reg = SATAC_PACKET; /* Command */
9809 scmd->satacmd_features_reg = SATA_ATAPI_F_DMA;
9834 if (scmd->satacmd_flags.sata_data_direction ==
9836 scmd->satacmd_features_reg |=
9939 sata_cmd_t *scmd;
9973 scmd = &spkt->satapkt_cmd;
9974 ASSERT(scmd->satacmd_num_dma_cookies != 0);
9975 ASSERT(scmd->satacmd_dma_cookie_list != NULL);
9984 scmd->satacmd_flags.sata_data_direction = SATA_DIR_READ;
9985 scmd->satacmd_flags.sata_ignore_dev_reset = B_TRUE;
9997 sata_atapi_packet_cmd_setup(scmd, sdinfo);
10002 scmd->satacmd_acdb_len = sdinfo->satadrv_atapi_cdb_len;
10003 bzero(scmd->satacmd_acdb, SATA_ATAPI_MAX_CDB_LEN);
10004 scmd->satacmd_acdb[0] = 0x12; /* Inquiry */
10005 scmd->satacmd_acdb[1] = 0x00;
10006 scmd->satacmd_acdb[2] = 0x00;
10007 scmd->satacmd_acdb[3] = 0x00;
10008 scmd->satacmd_acdb[4] = sizeof (struct scsi_inquiry);
10009 scmd->satacmd_acdb[5] = 0x00;
10012 (struct scsi_extended_sense *)scmd->satacmd_rqsense);
10065 rqsp = scmd->satacmd_rqsense;
10145 sata_cmd_t *scmd;
10188 scmd = &spkt->satapkt_cmd;
10189 ASSERT(scmd->satacmd_num_dma_cookies != 0);
10190 ASSERT(scmd->satacmd_dma_cookie_list != NULL);
10201 scmd->satacmd_flags.sata_data_direction = SATA_DIR_READ;
10202 scmd->satacmd_flags.sata_ignore_dev_reset = B_TRUE;
10204 sata_atapi_packet_cmd_setup(scmd, sdinfo);
10207 scmd->satacmd_acdb_len = sdinfo->satadrv_atapi_cdb_len;
10208 bzero(scmd->satacmd_acdb, SATA_ATAPI_MAX_CDB_LEN);
10209 scmd->satacmd_acdb[0] = 0x12; /* Inquiry */
10210 scmd->satacmd_acdb[1] = 0x00;
10211 scmd->satacmd_acdb[2] = 0x00;
10212 scmd->satacmd_acdb[3] = 0x00;
10213 scmd->satacmd_acdb[4] = sizeof (struct scsi_inquiry);
10214 scmd->satacmd_acdb[5] = 0x00;
10217 (struct scsi_extended_sense *)scmd->satacmd_rqsense);
10256 rqsp = scmd->satacmd_rqsense;
13704 sata_cmd_t *scmd;
13742 scmd = &spkt->satapkt_cmd;
13743 scmd->satacmd_bp = bp;
13744 scmd->satacmd_flags.sata_data_direction = SATA_DIR_READ;
13745 scmd->satacmd_flags.sata_ignore_dev_reset = B_TRUE;
13748 scmd->satacmd_addr_type = 0; /* N/A */
13749 scmd->satacmd_sec_count_lsb = 0; /* N/A */
13750 scmd->satacmd_lba_low_lsb = 0; /* N/A */
13751 scmd->satacmd_lba_mid_lsb = 0; /* N/A */
13752 scmd->satacmd_lba_high_lsb = 0; /* N/A */
13753 scmd->satacmd_features_reg = 0; /* N/A */
13754 scmd->satacmd_device_reg = 0; /* Always device 0 */
13757 scmd->satacmd_cmd_reg = SATAC_ID_PACKET_DEVICE;
13760 scmd->satacmd_cmd_reg = SATAC_ID_DEVICE;
13915 sata_cmd_t *scmd;
14020 scmd = &spkt->satapkt_cmd;
14021 scmd->satacmd_flags.sata_data_direction = SATA_DIR_NODATA_XFER;
14022 scmd->satacmd_flags.sata_ignore_dev_reset = B_TRUE;
14023 scmd->satacmd_addr_type = 0;
14024 scmd->satacmd_device_reg = 0;
14025 scmd->satacmd_status_reg = 0;
14026 scmd->satacmd_error_reg = 0;
14027 scmd->satacmd_cmd_reg = SATAC_SET_FEATURES;
14028 scmd->satacmd_features_reg = SATAC_SF_TRANSFER_MODE;
14029 scmd->satacmd_sec_count_lsb = subcmd | mode;
14067 sata_cmd_t *scmd;
14098 scmd = &spkt->satapkt_cmd;
14099 scmd->satacmd_flags.sata_data_direction = SATA_DIR_NODATA_XFER;
14100 scmd->satacmd_flags.sata_ignore_dev_reset = B_TRUE;
14101 scmd->satacmd_addr_type = 0;
14102 scmd->satacmd_device_reg = 0;
14103 scmd->satacmd_status_reg = 0;
14104 scmd->satacmd_error_reg = 0;
14105 scmd->satacmd_cmd_reg = SATAC_SET_FEATURES;
14106 scmd->satacmd_features_reg = cache_op;
14158 sata_cmd_t *scmd;
14183 scmd = &spkt->satapkt_cmd;
14184 scmd->satacmd_flags.sata_data_direction = SATA_DIR_NODATA_XFER;
14185 scmd->satacmd_flags.sata_ignore_dev_reset = B_TRUE;
14186 scmd->satacmd_addr_type = 0;
14187 scmd->satacmd_device_reg = 0;
14188 scmd->satacmd_status_reg = 0;
14189 scmd->satacmd_error_reg = 0;
14190 scmd->satacmd_cmd_reg = SATAC_SET_FEATURES;
14192 scmd->satacmd_features_reg = SATAC_SF_DISABLE_RMSN;
14194 scmd->satacmd_features_reg = SATAC_SF_ENABLE_RMSN;
16711 sata_cmd_t *scmd;
16735 scmd = &spkt->satapkt_cmd;
16736 scmd->satacmd_flags.sata_special_regs = B_TRUE;
16737 scmd->satacmd_flags.sata_data_direction = SATA_DIR_NODATA_XFER;
16740 scmd->satacmd_flags.sata_copy_out_lba_mid_lsb = B_TRUE;
16741 scmd->satacmd_flags.sata_copy_out_lba_high_lsb = B_TRUE;
16744 scmd->satacmd_addr_type = 0; /* N/A */
16745 scmd->satacmd_sec_count_lsb = 0; /* N/A */
16746 scmd->satacmd_lba_low_lsb = 0; /* N/A */
16747 scmd->satacmd_lba_mid_lsb = SMART_MAGIC_VAL_1;
16748 scmd->satacmd_lba_high_lsb = SMART_MAGIC_VAL_2;
16749 scmd->satacmd_features_reg = SATA_SMART_RETURN_STATUS;
16750 scmd->satacmd_device_reg = 0; /* Always device 0 */
16751 scmd->satacmd_cmd_reg = SATAC_SMART;
16769 if (scmd->satacmd_error_reg & SATA_ERROR_ABORT) {
16773 if (scmd->satacmd_status_reg & SATA_STATUS_ERR) {
16777 if ((scmd->satacmd_lba_mid_lsb == SMART_MAGIC_VAL_1) &&
16778 (scmd->satacmd_lba_high_lsb == SMART_MAGIC_VAL_2))
16780 else if ((scmd->satacmd_lba_mid_lsb == SMART_MAGIC_VAL_3) &&
16781 (scmd->satacmd_lba_high_lsb == SMART_MAGIC_VAL_4))
16810 sata_cmd_t *scmd;
16839 scmd = &spkt->satapkt_cmd;
16840 scmd->satacmd_flags.sata_data_direction = SATA_DIR_READ;
16845 scmd->satacmd_bp = sata_alloc_local_buffer(spx,
16847 if (scmd->satacmd_bp == NULL) {
16858 scmd->satacmd_addr_type = 0; /* N/A */
16859 scmd->satacmd_sec_count_lsb = 0; /* N/A */
16860 scmd->satacmd_lba_low_lsb = 0; /* N/A */
16861 scmd->satacmd_lba_mid_lsb = SMART_MAGIC_VAL_1;
16862 scmd->satacmd_lba_high_lsb = SMART_MAGIC_VAL_2;
16863 scmd->satacmd_features_reg = SATA_SMART_READ_DATA;
16864 scmd->satacmd_device_reg = 0; /* Always device 0 */
16865 scmd->satacmd_cmd_reg = SATAC_SMART;
16894 bcopy(scmd->satacmd_bp->b_un.b_addr, (uint8_t *)smart_data,
16924 sata_cmd_t *scmd;
16952 scmd = &spkt->satapkt_cmd;
16953 scmd->satacmd_flags.sata_data_direction = SATA_DIR_READ;
16958 scmd->satacmd_bp = sata_alloc_local_buffer(spx,
16960 if (scmd->satacmd_bp == NULL) {
16970 scmd->satacmd_addr_type = ATA_ADDR_LBA48;
16971 scmd->satacmd_sec_count_lsb = 1; /* One sector of selftest log */
16972 scmd->satacmd_sec_count_msb = 0; /* One sector of selftest log */
16973 scmd->satacmd_lba_low_lsb = EXT_SMART_SELFTEST_LOG_PAGE;
16974 scmd->satacmd_lba_low_msb = 0;
16975 scmd->satacmd_lba_mid_lsb = block_num & 0xff;
16976 scmd->satacmd_lba_mid_msb = block_num >> 8;
16977 scmd->satacmd_device_reg = 0; /* Always device 0 */
16978 scmd->satacmd_cmd_reg = SATAC_READ_LOG_EXT;
17010 bcopy(scmd->satacmd_bp->b_un.b_addr,
17037 sata_cmd_t *scmd;
17066 scmd = &spkt->satapkt_cmd;
17067 scmd->satacmd_flags.sata_data_direction = SATA_DIR_READ;
17072 scmd->satacmd_bp = sata_alloc_local_buffer(spx,
17074 if (scmd->satacmd_bp == NULL) {
17084 scmd->satacmd_addr_type = 0; /* N/A */
17085 scmd->satacmd_sec_count_lsb = 1; /* One sector of SMART log */
17086 scmd->satacmd_lba_low_lsb = SMART_SELFTEST_LOG_PAGE;
17087 scmd->satacmd_lba_mid_lsb = SMART_MAGIC_VAL_1;
17088 scmd->satacmd_lba_high_lsb = SMART_MAGIC_VAL_2;
17089 scmd->satacmd_features_reg = SATA_SMART_READ_LOG;
17090 scmd->satacmd_device_reg = 0; /* Always device 0 */
17091 scmd->satacmd_cmd_reg = SATAC_SMART;
17120 bcopy(scmd->satacmd_bp->b_un.b_addr, (uint8_t *)selftest_log,
17149 sata_cmd_t *scmd;
17174 scmd = &spkt->satapkt_cmd;
17175 scmd->satacmd_flags.sata_data_direction = SATA_DIR_READ;
17180 scmd->satacmd_bp = sata_alloc_local_buffer(spx, log_size * 512);
17181 if (scmd->satacmd_bp == NULL) {
17190 scmd->satacmd_addr_type = 0; /* N/A */
17191 scmd->satacmd_sec_count_lsb = log_size; /* what the caller asked for */
17192 scmd->satacmd_lba_low_lsb = which_log; /* which log page */
17193 scmd->satacmd_lba_mid_lsb = SMART_MAGIC_VAL_1;
17194 scmd->satacmd_lba_high_lsb = SMART_MAGIC_VAL_2;
17195 scmd->satacmd_features_reg = SATA_SMART_READ_LOG;
17196 scmd->satacmd_device_reg = 0; /* Always device 0 */
17197 scmd->satacmd_cmd_reg = SATAC_SMART;
17229 bcopy(scmd->satacmd_bp->b_un.b_addr, smart_log, log_size * 512);
17256 sata_cmd_t *scmd;
17281 scmd = &spkt->satapkt_cmd;
17282 scmd->satacmd_flags.sata_data_direction = SATA_DIR_READ;
17287 scmd->satacmd_bp = sata_alloc_local_buffer(spx,
17289 if (scmd->satacmd_bp == NULL) {
17299 scmd->satacmd_addr_type = ATA_ADDR_LBA48;
17300 scmd->satacmd_sec_count_lsb = 1; /* One sector of directory */
17301 scmd->satacmd_sec_count_msb = 0; /* One sector of directory */
17302 scmd->satacmd_lba_low_lsb = READ_LOG_EXT_LOG_DIRECTORY;
17303 scmd->satacmd_lba_low_msb = 0;
17304 scmd->satacmd_lba_mid_lsb = 0;
17305 scmd->satacmd_lba_mid_msb = 0;
17306 scmd->satacmd_device_reg = 0; /* Always device 0 */
17307 scmd->satacmd_cmd_reg = SATAC_READ_LOG_EXT;
17337 bcopy(scmd->satacmd_bp->b_un.b_addr, (uint8_t *)logdir,
17366 sata_cmd_t *scmd;
17376 scmd = &spkt->satapkt_cmd;
17377 bcopy(&sata_rle_cmd, scmd, sizeof (sata_cmd_t));
17378 scmd->satacmd_flags.sata_ignore_dev_reset = B_TRUE;
17391 scmd->satacmd_bp = bp;
17397 scmd->satacmd_err_ret_buf_handle = &spx->txlt_buf_dma_handle;
17399 ASSERT(scmd->satacmd_num_dma_cookies != 0);
17400 ASSERT(scmd->satacmd_dma_cookie_list != NULL);