Lines Matching refs:sdkp
119 static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
133 static void sd_set_flush_flag(struct scsi_disk *sdkp) in sd_set_flush_flag() argument
137 if (sdkp->WCE) { in sd_set_flush_flag()
139 if (sdkp->DPOFUA) in sd_set_flush_flag()
143 blk_queue_write_cache(sdkp->disk->queue, wc, fua); in sd_set_flush_flag()
151 struct scsi_disk *sdkp = to_scsi_disk(dev); in cache_type_store() local
152 struct scsi_device *sdp = sdkp->device; in cache_type_store()
168 sdkp->cache_override = 1; in cache_type_store()
170 sdkp->cache_override = 0; in cache_type_store()
178 wce = (ct & 0x02) && !sdkp->write_prot ? 1 : 0; in cache_type_store()
180 if (sdkp->cache_override) { in cache_type_store()
181 sdkp->WCE = wce; in cache_type_store()
182 sdkp->RCD = rcd; in cache_type_store()
183 sd_set_flush_flag(sdkp); in cache_type_store()
188 sdkp->max_retries, &data, NULL)) in cache_type_store()
206 sdkp->max_retries, &data, &sshdr)) { in cache_type_store()
208 sd_print_sense_hdr(sdkp, &sshdr); in cache_type_store()
211 sd_revalidate_disk(sdkp->disk); in cache_type_store()
219 struct scsi_disk *sdkp = to_scsi_disk(dev); in manage_start_stop_show() local
220 struct scsi_device *sdp = sdkp->device; in manage_start_stop_show()
229 struct scsi_disk *sdkp = to_scsi_disk(dev); in manage_start_stop_store() local
230 struct scsi_device *sdp = sdkp->device; in manage_start_stop_store()
248 struct scsi_disk *sdkp = to_scsi_disk(dev); in allow_restart_show() local
250 return sprintf(buf, "%u\n", sdkp->device->allow_restart); in allow_restart_show()
258 struct scsi_disk *sdkp = to_scsi_disk(dev); in allow_restart_store() local
259 struct scsi_device *sdp = sdkp->device; in allow_restart_store()
279 struct scsi_disk *sdkp = to_scsi_disk(dev); in cache_type_show() local
280 int ct = sdkp->RCD + 2*sdkp->WCE; in cache_type_show()
289 struct scsi_disk *sdkp = to_scsi_disk(dev); in FUA_show() local
291 return sprintf(buf, "%u\n", sdkp->DPOFUA); in FUA_show()
299 struct scsi_disk *sdkp = to_scsi_disk(dev); in protection_type_show() local
301 return sprintf(buf, "%u\n", sdkp->protection_type); in protection_type_show()
308 struct scsi_disk *sdkp = to_scsi_disk(dev); in protection_type_store() local
321 sdkp->protection_type = val; in protection_type_store()
331 struct scsi_disk *sdkp = to_scsi_disk(dev); in protection_mode_show() local
332 struct scsi_device *sdp = sdkp->device; in protection_mode_show()
335 dif = scsi_host_dif_capable(sdp->host, sdkp->protection_type); in protection_mode_show()
336 dix = scsi_host_dix_capable(sdp->host, sdkp->protection_type); in protection_mode_show()
353 struct scsi_disk *sdkp = to_scsi_disk(dev); in app_tag_own_show() local
355 return sprintf(buf, "%u\n", sdkp->ATO); in app_tag_own_show()
363 struct scsi_disk *sdkp = to_scsi_disk(dev); in thin_provisioning_show() local
365 return sprintf(buf, "%u\n", sdkp->lbpme); in thin_provisioning_show()
383 struct scsi_disk *sdkp = to_scsi_disk(dev); in provisioning_mode_show() local
385 return sprintf(buf, "%s\n", lbp_mode[sdkp->provisioning_mode]); in provisioning_mode_show()
392 struct scsi_disk *sdkp = to_scsi_disk(dev); in provisioning_mode_store() local
393 struct scsi_device *sdp = sdkp->device; in provisioning_mode_store()
399 if (sd_is_zoned(sdkp)) { in provisioning_mode_store()
400 sd_config_discard(sdkp, SD_LBP_DISABLE); in provisioning_mode_store()
411 sd_config_discard(sdkp, mode); in provisioning_mode_store()
429 struct scsi_disk *sdkp = to_scsi_disk(dev); in zeroing_mode_show() local
431 return sprintf(buf, "%s\n", zeroing_mode[sdkp->zeroing_mode]); in zeroing_mode_show()
438 struct scsi_disk *sdkp = to_scsi_disk(dev); in zeroing_mode_store() local
448 sdkp->zeroing_mode = mode; in zeroing_mode_store()
458 struct scsi_disk *sdkp = to_scsi_disk(dev); in max_medium_access_timeouts_show() local
460 return sprintf(buf, "%u\n", sdkp->max_medium_access_timeouts); in max_medium_access_timeouts_show()
468 struct scsi_disk *sdkp = to_scsi_disk(dev); in max_medium_access_timeouts_store() local
474 err = kstrtouint(buf, 10, &sdkp->max_medium_access_timeouts); in max_medium_access_timeouts_store()
484 struct scsi_disk *sdkp = to_scsi_disk(dev); in max_write_same_blocks_show() local
486 return sprintf(buf, "%u\n", sdkp->max_ws_blocks); in max_write_same_blocks_show()
493 struct scsi_disk *sdkp = to_scsi_disk(dev); in max_write_same_blocks_store() local
494 struct scsi_device *sdp = sdkp->device; in max_write_same_blocks_store()
513 sdkp->max_ws_blocks = max; in max_write_same_blocks_store()
516 sd_config_write_same(sdkp); in max_write_same_blocks_store()
525 struct scsi_disk *sdkp = to_scsi_disk(dev); in zoned_cap_show() local
527 if (sdkp->device->type == TYPE_ZBC) in zoned_cap_show()
529 if (sdkp->zoned == 1) in zoned_cap_show()
531 if (sdkp->zoned == 2) in zoned_cap_show()
541 struct scsi_disk *sdkp = to_scsi_disk(dev); in max_retries_store() local
542 struct scsi_device *sdev = sdkp->device; in max_retries_store()
550 sdkp->max_retries = retries; in max_retries_store()
563 struct scsi_disk *sdkp = to_scsi_disk(dev); in max_retries_show() local
565 return sprintf(buf, "%d\n", sdkp->max_retries); in max_retries_show()
664 struct scsi_disk *sdkp = data; in sd_sec_submit() local
665 struct scsi_device *sdev = sdkp->device; in sd_sec_submit()
675 buffer, len, NULL, NULL, SD_TIMEOUT, sdkp->max_retries, 0, in sd_sec_submit()
782 static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode) in sd_config_discard() argument
784 struct request_queue *q = sdkp->disk->queue; in sd_config_discard()
785 unsigned int logical_block_size = sdkp->device->sector_size; in sd_config_discard()
789 sdkp->unmap_alignment * logical_block_size; in sd_config_discard()
791 max(sdkp->physical_block_size, in sd_config_discard()
792 sdkp->unmap_granularity * logical_block_size); in sd_config_discard()
793 sdkp->provisioning_mode = mode; in sd_config_discard()
803 max_blocks = min_not_zero(sdkp->max_unmap_blocks, in sd_config_discard()
808 if (sdkp->device->unmap_limit_for_ws) in sd_config_discard()
809 max_blocks = sdkp->max_unmap_blocks; in sd_config_discard()
811 max_blocks = sdkp->max_ws_blocks; in sd_config_discard()
817 if (sdkp->device->unmap_limit_for_ws) in sd_config_discard()
818 max_blocks = sdkp->max_unmap_blocks; in sd_config_discard()
820 max_blocks = sdkp->max_ws_blocks; in sd_config_discard()
826 max_blocks = min_not_zero(sdkp->max_ws_blocks, in sd_config_discard()
838 struct scsi_disk *sdkp = scsi_disk(rq->q->disk); in sd_setup_unmap_cmnd() local
862 cmd->allowed = sdkp->max_retries; in sd_setup_unmap_cmnd()
874 struct scsi_disk *sdkp = scsi_disk(rq->q->disk); in sd_setup_write_same16_cmnd() local
894 cmd->allowed = sdkp->max_retries; in sd_setup_write_same16_cmnd()
906 struct scsi_disk *sdkp = scsi_disk(rq->q->disk); in sd_setup_write_same10_cmnd() local
926 cmd->allowed = sdkp->max_retries; in sd_setup_write_same10_cmnd()
937 struct scsi_disk *sdkp = scsi_disk(rq->q->disk); in sd_setup_write_zeroes_cmnd() local
942 switch (sdkp->zeroing_mode) { in sd_setup_write_zeroes_cmnd()
955 if (sdkp->ws16 || lba > 0xffffffff || nr_blocks > 0xffff) in sd_setup_write_zeroes_cmnd()
961 static void sd_config_write_same(struct scsi_disk *sdkp) in sd_config_write_same() argument
963 struct request_queue *q = sdkp->disk->queue; in sd_config_write_same()
964 unsigned int logical_block_size = sdkp->device->sector_size; in sd_config_write_same()
966 if (sdkp->device->no_write_same) { in sd_config_write_same()
967 sdkp->max_ws_blocks = 0; in sd_config_write_same()
976 if (sdkp->max_ws_blocks > SD_MAX_WS10_BLOCKS) in sd_config_write_same()
977 sdkp->max_ws_blocks = min_not_zero(sdkp->max_ws_blocks, in sd_config_write_same()
979 else if (sdkp->ws16 || sdkp->ws10 || sdkp->device->no_report_opcodes) in sd_config_write_same()
980 sdkp->max_ws_blocks = min_not_zero(sdkp->max_ws_blocks, in sd_config_write_same()
983 sdkp->device->no_write_same = 1; in sd_config_write_same()
984 sdkp->max_ws_blocks = 0; in sd_config_write_same()
987 if (sdkp->lbprz && sdkp->lbpws) in sd_config_write_same()
988 sdkp->zeroing_mode = SD_ZERO_WS16_UNMAP; in sd_config_write_same()
989 else if (sdkp->lbprz && sdkp->lbpws10) in sd_config_write_same()
990 sdkp->zeroing_mode = SD_ZERO_WS10_UNMAP; in sd_config_write_same()
991 else if (sdkp->max_ws_blocks) in sd_config_write_same()
992 sdkp->zeroing_mode = SD_ZERO_WS; in sd_config_write_same()
994 sdkp->zeroing_mode = SD_ZERO_WRITE; in sd_config_write_same()
996 if (sdkp->max_ws_blocks && in sd_config_write_same()
997 sdkp->physical_block_size > logical_block_size) { in sd_config_write_same()
1010 sdkp->max_ws_blocks = in sd_config_write_same()
1011 round_down(sdkp->max_ws_blocks, in sd_config_write_same()
1012 bytes_to_logical(sdkp->device, in sd_config_write_same()
1013 sdkp->physical_block_size)); in sd_config_write_same()
1017 blk_queue_max_write_zeroes_sectors(q, sdkp->max_ws_blocks * in sd_config_write_same()
1024 struct scsi_disk *sdkp = scsi_disk(rq->q->disk); in sd_setup_flush_cmnd() local
1032 cmd->allowed = sdkp->max_retries; in sd_setup_flush_cmnd()
1117 struct scsi_disk *sdkp = scsi_disk(rq->q->disk); in sd_setup_read_write_cmnd() local
1152 threshold = sdkp->capacity - SD_LAST_BUGGY_SECTORS; in sd_setup_read_write_cmnd()
1172 dif = scsi_host_dif_capable(cmd->device->host, sdkp->protection_type); in sd_setup_read_write_cmnd()
1179 if (protect && sdkp->protection_type == T10_PI_TYPE2_PROTECTION) { in sd_setup_read_write_cmnd()
1204 cmd->allowed = sdkp->max_retries; in sd_setup_read_write_cmnd()
1280 struct scsi_disk *sdkp) in sd_need_revalidate() argument
1282 if (sdkp->device->removable || sdkp->write_prot) { in sd_need_revalidate()
1312 struct scsi_disk *sdkp = scsi_disk(bdev->bd_disk); in sd_open() local
1313 struct scsi_device *sdev = sdkp->device; in sd_open()
1319 SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_open\n")); in sd_open()
1329 if (sd_need_revalidate(bdev, sdkp)) in sd_open()
1336 if (sdev->removable && !sdkp->media_present && !(mode & FMODE_NDELAY)) in sd_open()
1344 if (sdkp->write_prot && (mode & FMODE_WRITE)) in sd_open()
1357 if ((atomic_inc_return(&sdkp->openers) == 1) && sdev->removable) { in sd_open()
1384 struct scsi_disk *sdkp = scsi_disk(disk); in sd_release() local
1385 struct scsi_device *sdev = sdkp->device; in sd_release()
1387 SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_release\n")); in sd_release()
1389 if (atomic_dec_return(&sdkp->openers) == 0 && sdev->removable) { in sd_release()
1399 struct scsi_disk *sdkp = scsi_disk(bdev->bd_disk); in sd_getgeo() local
1400 struct scsi_device *sdp = sdkp->device; in sd_getgeo()
1402 sector_t capacity = logical_to_sectors(sdp, sdkp->capacity); in sd_getgeo()
1440 struct scsi_disk *sdkp = scsi_disk(disk); in sd_ioctl() local
1441 struct scsi_device *sdp = sdkp->device; in sd_ioctl()
1445 SCSI_LOG_IOCTL(1, sd_printk(KERN_INFO, sdkp, "sd_ioctl: disk=%s, " in sd_ioctl()
1463 return sed_ioctl(sdkp->opal_dev, cmd, p); in sd_ioctl()
1467 static void set_media_not_present(struct scsi_disk *sdkp) in set_media_not_present() argument
1469 if (sdkp->media_present) in set_media_not_present()
1470 sdkp->device->changed = 1; in set_media_not_present()
1472 if (sdkp->device->removable) { in set_media_not_present()
1473 sdkp->media_present = 0; in set_media_not_present()
1474 sdkp->capacity = 0; in set_media_not_present()
1478 static int media_not_present(struct scsi_disk *sdkp, in media_not_present() argument
1490 set_media_not_present(sdkp); in media_not_present()
1508 struct scsi_disk *sdkp = disk->private_data; in sd_check_events() local
1513 if (!sdkp) in sd_check_events()
1516 sdp = sdkp->device; in sd_check_events()
1517 SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_check_events\n")); in sd_check_events()
1526 set_media_not_present(sdkp); in sd_check_events()
1542 retval = scsi_test_unit_ready(sdp, SD_TIMEOUT, sdkp->max_retries, in sd_check_events()
1547 set_media_not_present(sdkp); in sd_check_events()
1551 if (media_not_present(sdkp, &sshdr)) in sd_check_events()
1559 if (!sdkp->media_present) in sd_check_events()
1561 sdkp->media_present = 1; in sd_check_events()
1574 static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) in sd_sync_cache() argument
1577 struct scsi_device *sdp = sdkp->device; in sd_sync_cache()
1598 timeout, sdkp->max_retries, 0, RQF_PM, NULL); in sd_sync_cache()
1604 sd_print_result(sdkp, "Synchronize Cache(10) failed", res); in sd_sync_cache()
1611 sd_print_sense_hdr(sdkp, sshdr); in sd_sync_cache()
1641 struct scsi_disk *sdkp = dev_get_drvdata(dev); in sd_rescan() local
1643 sd_revalidate_disk(sdkp->disk); in sd_rescan()
1707 struct scsi_disk *sdkp = scsi_disk(bdev->bd_disk); in sd_pr_command() local
1708 struct scsi_device *sdev = sdkp->device; in sd_pr_command()
1724 &sshdr, SD_TIMEOUT, sdkp->max_retries, NULL); in sd_pr_command()
1780 struct scsi_disk *sdkp = scsi_disk(disk); in scsi_disk_free_disk() local
1782 put_device(&sdkp->disk_dev); in scsi_disk_free_disk()
1814 struct scsi_disk *sdkp = scsi_disk(scsi_cmd_to_rq(scmd)->q->disk); in sd_eh_reset() local
1817 sdkp->ignore_medium_access_errors = false; in sd_eh_reset()
1834 struct scsi_disk *sdkp = scsi_disk(scsi_cmd_to_rq(scmd)->q->disk); in sd_eh_action() local
1850 if (!sdkp->ignore_medium_access_errors) { in sd_eh_action()
1851 sdkp->medium_access_timed_out++; in sd_eh_action()
1852 sdkp->ignore_medium_access_errors = true; in sd_eh_action()
1860 if (sdkp->medium_access_timed_out >= sdkp->max_medium_access_timeouts) { in sd_eh_action()
1931 struct scsi_disk *sdkp = scsi_disk(req->q->disk); in sd_done() local
1959 sd_printk(KERN_INFO, sdkp, in sd_done()
1974 sdkp->medium_access_timed_out = 0; in sd_done()
2009 sd_config_discard(sdkp, SD_LBP_DISABLE); in sd_done()
2014 sd_config_discard(sdkp, SD_LBP_DISABLE); in sd_done()
2016 sdkp->device->no_write_same = 1; in sd_done()
2017 sd_config_write_same(sdkp); in sd_done()
2029 if (sd_is_zoned(sdkp)) in sd_done()
2043 sd_spinup_disk(struct scsi_disk *sdkp) in sd_spinup_disk() argument
2060 bool media_was_present = sdkp->media_present; in sd_spinup_disk()
2065 the_result = scsi_execute_req(sdkp->device, cmd, in sd_spinup_disk()
2068 sdkp->max_retries, NULL); in sd_spinup_disk()
2075 if (media_not_present(sdkp, &sshdr)) { in sd_spinup_disk()
2077 sd_printk(KERN_NOTICE, sdkp, "Media removed, stopped polling\n"); in sd_spinup_disk()
2093 sd_print_result(sdkp, "Test Unit Ready failed", in sd_spinup_disk()
2102 if (sdkp->device->no_start_on_add) in sd_spinup_disk()
2118 sd_printk(KERN_NOTICE, sdkp, "Spinning up disk..."); in sd_spinup_disk()
2123 if (sdkp->device->start_stop_pwr_cond) in sd_spinup_disk()
2125 scsi_execute_req(sdkp->device, cmd, DMA_NONE, in sd_spinup_disk()
2127 SD_TIMEOUT, sdkp->max_retries, in sd_spinup_disk()
2154 sd_printk(KERN_NOTICE, sdkp, "Unit Not Ready\n"); in sd_spinup_disk()
2155 sd_print_sense_hdr(sdkp, &sshdr); in sd_spinup_disk()
2173 static int sd_read_protection_type(struct scsi_disk *sdkp, unsigned char *buffer) in sd_read_protection_type() argument
2175 struct scsi_device *sdp = sdkp->device; in sd_read_protection_type()
2179 sdkp->protection_type = 0; in sd_read_protection_type()
2186 sd_printk(KERN_ERR, sdkp, "formatted with unsupported" \ in sd_read_protection_type()
2189 sdkp->protection_type = 0; in sd_read_protection_type()
2193 sdkp->protection_type = type; in sd_read_protection_type()
2198 static void sd_config_protection(struct scsi_disk *sdkp) in sd_config_protection() argument
2200 struct scsi_device *sdp = sdkp->device; in sd_config_protection()
2202 if (!sdkp->first_scan) in sd_config_protection()
2205 sd_dif_config_host(sdkp); in sd_config_protection()
2207 if (!sdkp->protection_type) in sd_config_protection()
2210 if (!scsi_host_dif_capable(sdp->host, sdkp->protection_type)) { in sd_config_protection()
2211 sd_printk(KERN_NOTICE, sdkp, in sd_config_protection()
2213 sdkp->protection_type); in sd_config_protection()
2214 sdkp->protection_type = 0; in sd_config_protection()
2217 sd_printk(KERN_NOTICE, sdkp, "Enabling DIF Type %u protection\n", in sd_config_protection()
2218 sdkp->protection_type); in sd_config_protection()
2221 static void read_capacity_error(struct scsi_disk *sdkp, struct scsi_device *sdp, in read_capacity_error() argument
2226 sd_print_sense_hdr(sdkp, sshdr); in read_capacity_error()
2228 sd_printk(KERN_NOTICE, sdkp, "Sense not available.\n"); in read_capacity_error()
2236 set_media_not_present(sdkp); in read_capacity_error()
2243 sdkp->capacity = 0; /* unknown mapped to zero - as usual */ in read_capacity_error()
2253 static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, in read_capacity_16() argument
2277 SD_TIMEOUT, sdkp->max_retries, NULL); in read_capacity_16()
2279 if (media_not_present(sdkp, &sshdr)) in read_capacity_16()
2305 sd_print_result(sdkp, "Read Capacity(16) failed", the_result); in read_capacity_16()
2306 read_capacity_error(sdkp, sdp, &sshdr, sense_valid, the_result); in read_capacity_16()
2313 if (sd_read_protection_type(sdkp, buffer) < 0) { in read_capacity_16()
2314 sdkp->capacity = 0; in read_capacity_16()
2319 sdkp->physical_block_size = (1 << (buffer[13] & 0xf)) * sector_size; in read_capacity_16()
2322 sdkp->rc_basis = (buffer[12] >> 4) & 0x3; in read_capacity_16()
2327 if (alignment && sdkp->first_scan) in read_capacity_16()
2328 sd_printk(KERN_NOTICE, sdkp, in read_capacity_16()
2332 sdkp->lbpme = 1; in read_capacity_16()
2335 sdkp->lbprz = 1; in read_capacity_16()
2337 sd_config_discard(sdkp, SD_LBP_WS16); in read_capacity_16()
2340 sdkp->capacity = lba + 1; in read_capacity_16()
2344 static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, in read_capacity_10() argument
2362 SD_TIMEOUT, sdkp->max_retries, NULL); in read_capacity_10()
2364 if (media_not_present(sdkp, &sshdr)) in read_capacity_10()
2382 sd_print_result(sdkp, "Read Capacity(10) failed", the_result); in read_capacity_10()
2383 read_capacity_error(sdkp, sdp, &sshdr, sense_valid, the_result); in read_capacity_10()
2394 sdkp->capacity = 0; in read_capacity_10()
2395 sdkp->physical_block_size = sector_size; in read_capacity_10()
2399 sdkp->capacity = lba + 1; in read_capacity_10()
2400 sdkp->physical_block_size = sector_size; in read_capacity_10()
2421 sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer) in sd_read_capacity() argument
2424 struct scsi_device *sdp = sdkp->device; in sd_read_capacity()
2427 sector_size = read_capacity_16(sdkp, sdp, buffer); in sd_read_capacity()
2433 sector_size = read_capacity_10(sdkp, sdp, buffer); in sd_read_capacity()
2437 sector_size = read_capacity_10(sdkp, sdp, buffer); in sd_read_capacity()
2442 if ((sizeof(sdkp->capacity) > 4) && in sd_read_capacity()
2443 (sdkp->capacity > 0xffffffffULL)) { in sd_read_capacity()
2445 sd_printk(KERN_NOTICE, sdkp, "Very big device. " in sd_read_capacity()
2447 sector_size = read_capacity_16(sdkp, sdp, buffer); in sd_read_capacity()
2449 sd_printk(KERN_NOTICE, sdkp, in sd_read_capacity()
2451 sdkp->capacity = 1 + (sector_t) 0xffffffff; in sd_read_capacity()
2471 (sdp->guess_capacity && (sdkp->capacity & 0x01))) { in sd_read_capacity()
2472 sd_printk(KERN_INFO, sdkp, "Adjusting the sector count " in sd_read_capacity()
2474 (unsigned long long) sdkp->capacity); in sd_read_capacity()
2475 --sdkp->capacity; in sd_read_capacity()
2481 sd_printk(KERN_NOTICE, sdkp, "Sector size 0 reported, " in sd_read_capacity()
2489 sd_printk(KERN_NOTICE, sdkp, "Unsupported sector size %d.\n", in sd_read_capacity()
2497 sdkp->capacity = 0; in sd_read_capacity()
2508 sdkp->physical_block_size); in sd_read_capacity()
2509 sdkp->device->sector_size = sector_size; in sd_read_capacity()
2511 if (sdkp->capacity > 0xffffffff) in sd_read_capacity()
2520 sd_print_capacity(struct scsi_disk *sdkp, in sd_print_capacity() argument
2523 int sector_size = sdkp->device->sector_size; in sd_print_capacity()
2526 if (!sdkp->first_scan && old_capacity == sdkp->capacity) in sd_print_capacity()
2529 string_get_size(sdkp->capacity, sector_size, in sd_print_capacity()
2531 string_get_size(sdkp->capacity, sector_size, in sd_print_capacity()
2534 sd_printk(KERN_NOTICE, sdkp, in sd_print_capacity()
2536 (unsigned long long)sdkp->capacity, in sd_print_capacity()
2539 if (sdkp->physical_block_size != sector_size) in sd_print_capacity()
2540 sd_printk(KERN_NOTICE, sdkp, in sd_print_capacity()
2542 sdkp->physical_block_size); in sd_print_capacity()
2547 sd_do_mode_sense(struct scsi_disk *sdkp, int dbd, int modepage, in sd_do_mode_sense() argument
2555 if (sdkp->device->use_10_for_ms && len < 8) in sd_do_mode_sense()
2558 return scsi_mode_sense(sdkp->device, dbd, modepage, buffer, len, in sd_do_mode_sense()
2559 SD_TIMEOUT, sdkp->max_retries, data, in sd_do_mode_sense()
2568 sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) in sd_read_write_protect_flag() argument
2571 struct scsi_device *sdp = sdkp->device; in sd_read_write_protect_flag()
2573 int old_wp = sdkp->write_prot; in sd_read_write_protect_flag()
2575 set_disk_ro(sdkp->disk, 0); in sd_read_write_protect_flag()
2577 sd_first_printk(KERN_NOTICE, sdkp, "Assuming Write Enabled\n"); in sd_read_write_protect_flag()
2582 res = sd_do_mode_sense(sdkp, 0, 0x3F, buffer, 192, &data, NULL); in sd_read_write_protect_flag()
2589 res = sd_do_mode_sense(sdkp, 0, 0x3F, buffer, 4, &data, NULL); in sd_read_write_protect_flag()
2598 res = sd_do_mode_sense(sdkp, 0, 0, buffer, 4, &data, NULL); in sd_read_write_protect_flag()
2604 res = sd_do_mode_sense(sdkp, 0, 0x3F, buffer, 255, in sd_read_write_protect_flag()
2609 sd_first_printk(KERN_WARNING, sdkp, in sd_read_write_protect_flag()
2612 sdkp->write_prot = ((data.device_specific & 0x80) != 0); in sd_read_write_protect_flag()
2613 set_disk_ro(sdkp->disk, sdkp->write_prot); in sd_read_write_protect_flag()
2614 if (sdkp->first_scan || old_wp != sdkp->write_prot) { in sd_read_write_protect_flag()
2615 sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n", in sd_read_write_protect_flag()
2616 sdkp->write_prot ? "on" : "off"); in sd_read_write_protect_flag()
2617 sd_printk(KERN_DEBUG, sdkp, "Mode Sense: %4ph\n", buffer); in sd_read_write_protect_flag()
2627 sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) in sd_read_cache_type() argument
2630 struct scsi_device *sdp = sdkp->device; in sd_read_cache_type()
2637 int old_wce = sdkp->WCE; in sd_read_cache_type()
2638 int old_rcd = sdkp->RCD; in sd_read_cache_type()
2639 int old_dpofua = sdkp->DPOFUA; in sd_read_cache_type()
2642 if (sdkp->cache_override) in sd_read_cache_type()
2666 res = sd_do_mode_sense(sdkp, dbd, modepage, buffer, first_len, in sd_read_cache_type()
2675 sd_first_printk(KERN_ERR, sdkp, in sd_read_cache_type()
2689 sd_first_printk(KERN_NOTICE, sdkp, "Truncating mode parameter " in sd_read_cache_type()
2698 res = sd_do_mode_sense(sdkp, dbd, modepage, buffer, len, in sd_read_cache_type()
2712 sd_first_printk(KERN_ERR, sdkp, in sd_read_cache_type()
2728 sd_first_printk(KERN_ERR, sdkp, in sd_read_cache_type()
2736 sd_first_printk(KERN_WARNING, sdkp, in sd_read_cache_type()
2742 sdkp->WCE = ((buffer[offset + 2] & 0x04) != 0); in sd_read_cache_type()
2743 sdkp->RCD = ((buffer[offset + 2] & 0x01) != 0); in sd_read_cache_type()
2745 sdkp->WCE = ((buffer[offset + 2] & 0x01) == 0); in sd_read_cache_type()
2746 sdkp->RCD = 0; in sd_read_cache_type()
2749 sdkp->DPOFUA = (data.device_specific & 0x10) != 0; in sd_read_cache_type()
2751 sd_first_printk(KERN_NOTICE, sdkp, "Disabling FUA\n"); in sd_read_cache_type()
2752 sdkp->DPOFUA = 0; in sd_read_cache_type()
2753 } else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw && in sd_read_cache_type()
2754 !sdkp->device->use_16_for_rw) { in sd_read_cache_type()
2755 sd_first_printk(KERN_NOTICE, sdkp, in sd_read_cache_type()
2757 sdkp->DPOFUA = 0; in sd_read_cache_type()
2761 if (sdkp->WCE && sdkp->write_prot) in sd_read_cache_type()
2762 sdkp->WCE = 0; in sd_read_cache_type()
2764 if (sdkp->first_scan || old_wce != sdkp->WCE || in sd_read_cache_type()
2765 old_rcd != sdkp->RCD || old_dpofua != sdkp->DPOFUA) in sd_read_cache_type()
2766 sd_printk(KERN_NOTICE, sdkp, in sd_read_cache_type()
2768 sdkp->WCE ? "enabled" : "disabled", in sd_read_cache_type()
2769 sdkp->RCD ? "disabled" : "enabled", in sd_read_cache_type()
2770 sdkp->DPOFUA ? "supports DPO and FUA" in sd_read_cache_type()
2781 sd_first_printk(KERN_NOTICE, sdkp, "Cache data unavailable\n"); in sd_read_cache_type()
2783 sd_first_printk(KERN_ERR, sdkp, in sd_read_cache_type()
2788 sd_first_printk(KERN_NOTICE, sdkp, in sd_read_cache_type()
2790 sdkp->WCE = 1; in sd_read_cache_type()
2792 sd_first_printk(KERN_WARNING, sdkp, in sd_read_cache_type()
2794 sdkp->WCE = 0; in sd_read_cache_type()
2796 sdkp->RCD = 0; in sd_read_cache_type()
2797 sdkp->DPOFUA = 0; in sd_read_cache_type()
2804 static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer) in sd_read_app_tag_own() argument
2807 struct scsi_device *sdp = sdkp->device; in sd_read_app_tag_own()
2814 if (sdkp->protection_type == 0) in sd_read_app_tag_own()
2818 sdkp->max_retries, &data, &sshdr); in sd_read_app_tag_own()
2822 sd_first_printk(KERN_WARNING, sdkp, in sd_read_app_tag_own()
2826 sd_print_sense_hdr(sdkp, &sshdr); in sd_read_app_tag_own()
2834 sd_first_printk(KERN_ERR, sdkp, "ATO Got wrong page\n"); in sd_read_app_tag_own()
2841 sdkp->ATO = 1; in sd_read_app_tag_own()
2850 static void sd_read_block_limits(struct scsi_disk *sdkp) in sd_read_block_limits() argument
2856 vpd = rcu_dereference(sdkp->device->vpd_pgb0); in sd_read_block_limits()
2860 sdkp->min_xfer_blocks = get_unaligned_be16(&vpd->data[6]); in sd_read_block_limits()
2861 sdkp->max_xfer_blocks = get_unaligned_be32(&vpd->data[8]); in sd_read_block_limits()
2862 sdkp->opt_xfer_blocks = get_unaligned_be32(&vpd->data[12]); in sd_read_block_limits()
2867 sdkp->max_ws_blocks = (u32)get_unaligned_be64(&vpd->data[36]); in sd_read_block_limits()
2869 if (!sdkp->lbpme) in sd_read_block_limits()
2876 sdkp->max_unmap_blocks = lba_count; in sd_read_block_limits()
2878 sdkp->unmap_granularity = get_unaligned_be32(&vpd->data[28]); in sd_read_block_limits()
2881 sdkp->unmap_alignment = in sd_read_block_limits()
2884 if (!sdkp->lbpvpd) { /* LBP VPD page not provided */ in sd_read_block_limits()
2886 if (sdkp->max_unmap_blocks) in sd_read_block_limits()
2887 sd_config_discard(sdkp, SD_LBP_UNMAP); in sd_read_block_limits()
2889 sd_config_discard(sdkp, SD_LBP_WS16); in sd_read_block_limits()
2892 if (sdkp->lbpu && sdkp->max_unmap_blocks) in sd_read_block_limits()
2893 sd_config_discard(sdkp, SD_LBP_UNMAP); in sd_read_block_limits()
2894 else if (sdkp->lbpws) in sd_read_block_limits()
2895 sd_config_discard(sdkp, SD_LBP_WS16); in sd_read_block_limits()
2896 else if (sdkp->lbpws10) in sd_read_block_limits()
2897 sd_config_discard(sdkp, SD_LBP_WS10); in sd_read_block_limits()
2899 sd_config_discard(sdkp, SD_LBP_DISABLE); in sd_read_block_limits()
2911 static void sd_read_block_characteristics(struct scsi_disk *sdkp) in sd_read_block_characteristics() argument
2913 struct request_queue *q = sdkp->disk->queue; in sd_read_block_characteristics()
2919 vpd = rcu_dereference(sdkp->device->vpd_pgb1); in sd_read_block_characteristics()
2935 if (sdkp->device->type == TYPE_ZBC) { in sd_read_block_characteristics()
2937 disk_set_zoned(sdkp->disk, BLK_ZONED_HM); in sd_read_block_characteristics()
2939 sdkp->zoned = zoned; in sd_read_block_characteristics()
2940 if (sdkp->zoned == 1) { in sd_read_block_characteristics()
2942 disk_set_zoned(sdkp->disk, BLK_ZONED_HA); in sd_read_block_characteristics()
2945 disk_set_zoned(sdkp->disk, BLK_ZONED_NONE); in sd_read_block_characteristics()
2949 if (!sdkp->first_scan) in sd_read_block_characteristics()
2953 sd_printk(KERN_NOTICE, sdkp, "Host-%s zoned block device\n", in sd_read_block_characteristics()
2956 if (sdkp->zoned == 1) in sd_read_block_characteristics()
2957 sd_printk(KERN_NOTICE, sdkp, in sd_read_block_characteristics()
2959 else if (sdkp->zoned == 2) in sd_read_block_characteristics()
2960 sd_printk(KERN_NOTICE, sdkp, in sd_read_block_characteristics()
2969 static void sd_read_block_provisioning(struct scsi_disk *sdkp) in sd_read_block_provisioning() argument
2973 if (sdkp->lbpme == 0) in sd_read_block_provisioning()
2977 vpd = rcu_dereference(sdkp->device->vpd_pgb2); in sd_read_block_provisioning()
2984 sdkp->lbpvpd = 1; in sd_read_block_provisioning()
2985 sdkp->lbpu = (vpd->data[5] >> 7) & 1; /* UNMAP */ in sd_read_block_provisioning()
2986 sdkp->lbpws = (vpd->data[5] >> 6) & 1; /* WRITE SAME(16) w/ UNMAP */ in sd_read_block_provisioning()
2987 sdkp->lbpws10 = (vpd->data[5] >> 5) & 1; /* WRITE SAME(10) w/ UNMAP */ in sd_read_block_provisioning()
2991 static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer) in sd_read_write_same() argument
2993 struct scsi_device *sdev = sdkp->device; in sd_read_write_same()
3018 sdkp->ws16 = 1; in sd_read_write_same()
3021 sdkp->ws10 = 1; in sd_read_write_same()
3024 static void sd_read_security(struct scsi_disk *sdkp, unsigned char *buffer) in sd_read_security() argument
3026 struct scsi_device *sdev = sdkp->device; in sd_read_security()
3035 sdkp->security = 1; in sd_read_security()
3038 static inline sector_t sd64_to_sectors(struct scsi_disk *sdkp, u8 *buf) in sd64_to_sectors() argument
3040 return logical_to_sectors(sdkp->device, get_unaligned_be64(buf)); in sd64_to_sectors()
3047 static void sd_read_cpr(struct scsi_disk *sdkp) in sd_read_cpr() argument
3059 if (sdkp->first_scan) in sd_read_cpr()
3062 if (!sdkp->capacity) in sd_read_cpr()
3071 if (!buffer || scsi_get_vpd_page(sdkp->device, 0xb9, buffer, buf_len)) in sd_read_cpr()
3077 sd_printk(KERN_ERR, sdkp, in sd_read_cpr()
3088 iars = disk_alloc_independent_access_ranges(sdkp->disk, nr_cpr); in sd_read_cpr()
3097 sd_printk(KERN_ERR, sdkp, in sd_read_cpr()
3103 iars->ia_range[i].sector = sd64_to_sectors(sdkp, desc + 8); in sd_read_cpr()
3104 iars->ia_range[i].nr_sectors = sd64_to_sectors(sdkp, desc + 16); in sd_read_cpr()
3108 disk_set_independent_access_ranges(sdkp->disk, iars); in sd_read_cpr()
3109 if (nr_cpr && sdkp->nr_actuators != nr_cpr) { in sd_read_cpr()
3110 sd_printk(KERN_NOTICE, sdkp, in sd_read_cpr()
3112 sdkp->nr_actuators = nr_cpr; in sd_read_cpr()
3118 static bool sd_validate_min_xfer_size(struct scsi_disk *sdkp) in sd_validate_min_xfer_size() argument
3120 struct scsi_device *sdp = sdkp->device; in sd_validate_min_xfer_size()
3122 logical_to_bytes(sdp, sdkp->min_xfer_blocks); in sd_validate_min_xfer_size()
3124 if (sdkp->min_xfer_blocks == 0) in sd_validate_min_xfer_size()
3127 if (min_xfer_bytes & (sdkp->physical_block_size - 1)) { in sd_validate_min_xfer_size()
3128 sd_first_printk(KERN_WARNING, sdkp, in sd_validate_min_xfer_size()
3131 min_xfer_bytes, sdkp->physical_block_size); in sd_validate_min_xfer_size()
3132 sdkp->min_xfer_blocks = 0; in sd_validate_min_xfer_size()
3136 sd_first_printk(KERN_INFO, sdkp, "Preferred minimum I/O size %u bytes\n", in sd_validate_min_xfer_size()
3146 static bool sd_validate_opt_xfer_size(struct scsi_disk *sdkp, in sd_validate_opt_xfer_size() argument
3149 struct scsi_device *sdp = sdkp->device; in sd_validate_opt_xfer_size()
3151 logical_to_bytes(sdp, sdkp->opt_xfer_blocks); in sd_validate_opt_xfer_size()
3153 logical_to_bytes(sdp, sdkp->min_xfer_blocks); in sd_validate_opt_xfer_size()
3155 if (sdkp->opt_xfer_blocks == 0) in sd_validate_opt_xfer_size()
3158 if (sdkp->opt_xfer_blocks > dev_max) { in sd_validate_opt_xfer_size()
3159 sd_first_printk(KERN_WARNING, sdkp, in sd_validate_opt_xfer_size()
3162 sdkp->opt_xfer_blocks, dev_max); in sd_validate_opt_xfer_size()
3166 if (sdkp->opt_xfer_blocks > SD_DEF_XFER_BLOCKS) { in sd_validate_opt_xfer_size()
3167 sd_first_printk(KERN_WARNING, sdkp, in sd_validate_opt_xfer_size()
3170 sdkp->opt_xfer_blocks, SD_DEF_XFER_BLOCKS); in sd_validate_opt_xfer_size()
3175 sd_first_printk(KERN_WARNING, sdkp, in sd_validate_opt_xfer_size()
3183 sd_first_printk(KERN_WARNING, sdkp, in sd_validate_opt_xfer_size()
3191 if (opt_xfer_bytes & (sdkp->physical_block_size - 1)) { in sd_validate_opt_xfer_size()
3192 sd_first_printk(KERN_WARNING, sdkp, in sd_validate_opt_xfer_size()
3195 opt_xfer_bytes, sdkp->physical_block_size); in sd_validate_opt_xfer_size()
3199 sd_first_printk(KERN_INFO, sdkp, "Optimal transfer size %u bytes\n", in sd_validate_opt_xfer_size()
3211 struct scsi_disk *sdkp = scsi_disk(disk); in sd_revalidate_disk() local
3212 struct scsi_device *sdp = sdkp->device; in sd_revalidate_disk()
3213 struct request_queue *q = sdkp->disk->queue; in sd_revalidate_disk()
3214 sector_t old_capacity = sdkp->capacity; in sd_revalidate_disk()
3218 SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, in sd_revalidate_disk()
3230 sd_printk(KERN_WARNING, sdkp, "sd_revalidate_disk: Memory " in sd_revalidate_disk()
3235 sd_spinup_disk(sdkp); in sd_revalidate_disk()
3241 if (sdkp->media_present) { in sd_revalidate_disk()
3242 sd_read_capacity(sdkp, buffer); in sd_revalidate_disk()
3254 sd_read_block_provisioning(sdkp); in sd_revalidate_disk()
3255 sd_read_block_limits(sdkp); in sd_revalidate_disk()
3256 sd_read_block_characteristics(sdkp); in sd_revalidate_disk()
3257 sd_zbc_read_zones(sdkp, buffer); in sd_revalidate_disk()
3258 sd_read_cpr(sdkp); in sd_revalidate_disk()
3261 sd_print_capacity(sdkp, old_capacity); in sd_revalidate_disk()
3263 sd_read_write_protect_flag(sdkp, buffer); in sd_revalidate_disk()
3264 sd_read_cache_type(sdkp, buffer); in sd_revalidate_disk()
3265 sd_read_app_tag_own(sdkp, buffer); in sd_revalidate_disk()
3266 sd_read_write_same(sdkp, buffer); in sd_revalidate_disk()
3267 sd_read_security(sdkp, buffer); in sd_revalidate_disk()
3268 sd_config_protection(sdkp); in sd_revalidate_disk()
3275 sd_set_flush_flag(sdkp); in sd_revalidate_disk()
3281 dev_max = min_not_zero(dev_max, sdkp->max_xfer_blocks); in sd_revalidate_disk()
3284 if (sd_validate_min_xfer_size(sdkp)) in sd_revalidate_disk()
3285 blk_queue_io_min(sdkp->disk->queue, in sd_revalidate_disk()
3286 logical_to_bytes(sdp, sdkp->min_xfer_blocks)); in sd_revalidate_disk()
3288 blk_queue_io_min(sdkp->disk->queue, 0); in sd_revalidate_disk()
3290 if (sd_validate_opt_xfer_size(sdkp, dev_max)) { in sd_revalidate_disk()
3291 q->limits.io_opt = logical_to_bytes(sdp, sdkp->opt_xfer_blocks); in sd_revalidate_disk()
3292 rw_max = logical_to_sectors(sdp, sdkp->opt_xfer_blocks); in sd_revalidate_disk()
3313 if (sdkp->first_scan || in sd_revalidate_disk()
3318 sdkp->first_scan = 0; in sd_revalidate_disk()
3320 set_capacity_and_notify(disk, logical_to_sectors(sdp, sdkp->capacity)); in sd_revalidate_disk()
3321 sd_config_write_same(sdkp); in sd_revalidate_disk()
3329 if (sd_zbc_revalidate_zones(sdkp)) in sd_revalidate_disk()
3423 struct scsi_disk *sdkp; in sd_probe() local
3446 sdkp = kzalloc(sizeof(*sdkp), GFP_KERNEL); in sd_probe()
3447 if (!sdkp) in sd_probe()
3467 sdkp->device = sdp; in sd_probe()
3468 sdkp->disk = gd; in sd_probe()
3469 sdkp->index = index; in sd_probe()
3470 sdkp->max_retries = SD_MAX_RETRIES; in sd_probe()
3471 atomic_set(&sdkp->openers, 0); in sd_probe()
3472 atomic_set(&sdkp->device->ioerr_cnt, 0); in sd_probe()
3482 device_initialize(&sdkp->disk_dev); in sd_probe()
3483 sdkp->disk_dev.parent = get_device(dev); in sd_probe()
3484 sdkp->disk_dev.class = &sd_disk_class; in sd_probe()
3485 dev_set_name(&sdkp->disk_dev, "%s", dev_name(dev)); in sd_probe()
3487 error = device_add(&sdkp->disk_dev); in sd_probe()
3489 put_device(&sdkp->disk_dev); in sd_probe()
3493 dev_set_drvdata(dev, sdkp); in sd_probe()
3500 gd->private_data = sdkp; in sd_probe()
3504 sdkp->capacity = 0; in sd_probe()
3505 sdkp->media_present = 1; in sd_probe()
3506 sdkp->write_prot = 0; in sd_probe()
3507 sdkp->cache_override = 0; in sd_probe()
3508 sdkp->WCE = 0; in sd_probe()
3509 sdkp->RCD = 0; in sd_probe()
3510 sdkp->ATO = 0; in sd_probe()
3511 sdkp->first_scan = 1; in sd_probe()
3512 sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS; in sd_probe()
3530 put_device(&sdkp->disk_dev); in sd_probe()
3535 if (sdkp->security) { in sd_probe()
3536 sdkp->opal_dev = init_opal_dev(sdkp, &sd_sec_submit); in sd_probe()
3537 if (sdkp->opal_dev) in sd_probe()
3538 sd_printk(KERN_NOTICE, sdkp, "supports TCG Opal\n"); in sd_probe()
3541 sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", in sd_probe()
3552 kfree(sdkp); in sd_probe()
3571 struct scsi_disk *sdkp = dev_get_drvdata(dev); in sd_remove() local
3573 scsi_autopm_get_device(sdkp->device); in sd_remove()
3575 device_del(&sdkp->disk_dev); in sd_remove()
3576 del_gendisk(sdkp->disk); in sd_remove()
3579 put_disk(sdkp->disk); in sd_remove()
3585 struct scsi_disk *sdkp = to_scsi_disk(dev); in scsi_disk_release() local
3587 ida_free(&sd_index_ida, sdkp->index); in scsi_disk_release()
3588 sd_zbc_free_zone_info(sdkp); in scsi_disk_release()
3589 put_device(&sdkp->device->sdev_gendev); in scsi_disk_release()
3590 free_opal_dev(sdkp->opal_dev); in scsi_disk_release()
3592 kfree(sdkp); in scsi_disk_release()
3595 static int sd_start_stop_device(struct scsi_disk *sdkp, int start) in sd_start_stop_device() argument
3599 struct scsi_device *sdp = sdkp->device; in sd_start_stop_device()
3612 SD_TIMEOUT, sdkp->max_retries, 0, RQF_PM, NULL); in sd_start_stop_device()
3614 sd_print_result(sdkp, "Start/Stop Unit failed", res); in sd_start_stop_device()
3616 sd_print_sense_hdr(sdkp, &sshdr); in sd_start_stop_device()
3637 struct scsi_disk *sdkp = dev_get_drvdata(dev); in sd_shutdown() local
3639 if (!sdkp) in sd_shutdown()
3645 if (sdkp->WCE && sdkp->media_present) { in sd_shutdown()
3646 sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); in sd_shutdown()
3647 sd_sync_cache(sdkp, NULL); in sd_shutdown()
3650 if (system_state != SYSTEM_RESTART && sdkp->device->manage_start_stop) { in sd_shutdown()
3651 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); in sd_shutdown()
3652 sd_start_stop_device(sdkp, 0); in sd_shutdown()
3658 struct scsi_disk *sdkp = dev_get_drvdata(dev); in sd_suspend_common() local
3662 if (!sdkp) /* E.g.: runtime suspend following sd_remove() */ in sd_suspend_common()
3665 if (sdkp->WCE && sdkp->media_present) { in sd_suspend_common()
3666 if (!sdkp->device->silence_suspend) in sd_suspend_common()
3667 sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); in sd_suspend_common()
3668 ret = sd_sync_cache(sdkp, &sshdr); in sd_suspend_common()
3688 if (sdkp->device->manage_start_stop) { in sd_suspend_common()
3689 if (!sdkp->device->silence_suspend) in sd_suspend_common()
3690 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); in sd_suspend_common()
3692 ret = sd_start_stop_device(sdkp, 0); in sd_suspend_common()
3715 struct scsi_disk *sdkp = dev_get_drvdata(dev); in sd_resume() local
3718 if (!sdkp) /* E.g.: runtime resume at the start of sd_probe() */ in sd_resume()
3721 if (!sdkp->device->manage_start_stop) in sd_resume()
3724 sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); in sd_resume()
3725 ret = sd_start_stop_device(sdkp, 1); in sd_resume()
3727 opal_unlock_from_suspend(sdkp->opal_dev); in sd_resume()
3741 struct scsi_disk *sdkp = dev_get_drvdata(dev); in sd_resume_runtime() local
3744 if (!sdkp) /* E.g.: runtime resume at the start of sd_probe() */ in sd_resume_runtime()
3747 sdp = sdkp->device; in sd_resume_runtime()
3756 sd_printk(KERN_NOTICE, sdkp, in sd_resume_runtime()
3847 void sd_print_sense_hdr(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) in sd_print_sense_hdr() argument
3849 scsi_print_sense_hdr(sdkp->device, in sd_print_sense_hdr()
3850 sdkp->disk ? sdkp->disk->disk_name : NULL, sshdr); in sd_print_sense_hdr()
3853 void sd_print_result(const struct scsi_disk *sdkp, const char *msg, int result) in sd_print_result() argument
3858 sd_printk(KERN_INFO, sdkp, in sd_print_result()
3863 sd_printk(KERN_INFO, sdkp, in sd_print_result()