sd.c (6542e9adc0da1e23d81ff9314265a029b961906d) sd.c (e76239a3748c90a8b0e197f8f4544a8ce52f126e)
1/*
2 * sd.c Copyright (C) 1992 Drew Eckhardt
3 * Copyright (C) 1993, 1994, 1995, 1999 Eric Youngdale
4 *
5 * Linux scsi disk driver
6 * Initial versions: Drew Eckhardt
7 * Subsequent revisions: Eric Youngdale
8 * Modification history:

--- 31 unchanged lines hidden (view full) ---

40#include <linux/genhd.h>
41#include <linux/hdreg.h>
42#include <linux/errno.h>
43#include <linux/idr.h>
44#include <linux/interrupt.h>
45#include <linux/init.h>
46#include <linux/blkdev.h>
47#include <linux/blkpg.h>
1/*
2 * sd.c Copyright (C) 1992 Drew Eckhardt
3 * Copyright (C) 1993, 1994, 1995, 1999 Eric Youngdale
4 *
5 * Linux scsi disk driver
6 * Initial versions: Drew Eckhardt
7 * Subsequent revisions: Eric Youngdale
8 * Modification history:

--- 31 unchanged lines hidden (view full) ---

40#include <linux/genhd.h>
41#include <linux/hdreg.h>
42#include <linux/errno.h>
43#include <linux/idr.h>
44#include <linux/interrupt.h>
45#include <linux/init.h>
46#include <linux/blkdev.h>
47#include <linux/blkpg.h>
48#include <linux/blk-pm.h>
48#include <linux/delay.h>
49#include <linux/mutex.h>
50#include <linux/string_helpers.h>
51#include <linux/async.h>
52#include <linux/slab.h>
53#include <linux/sed-opal.h>
54#include <linux/pm_runtime.h>
55#include <linux/pr.h>

--- 1210 unchanged lines hidden (view full) ---

1266 return sd_setup_write_zeroes_cmnd(cmd);
1267 case REQ_OP_WRITE_SAME:
1268 return sd_setup_write_same_cmnd(cmd);
1269 case REQ_OP_FLUSH:
1270 return sd_setup_flush_cmnd(cmd);
1271 case REQ_OP_READ:
1272 case REQ_OP_WRITE:
1273 return sd_setup_read_write_cmnd(cmd);
49#include <linux/delay.h>
50#include <linux/mutex.h>
51#include <linux/string_helpers.h>
52#include <linux/async.h>
53#include <linux/slab.h>
54#include <linux/sed-opal.h>
55#include <linux/pm_runtime.h>
56#include <linux/pr.h>

--- 1210 unchanged lines hidden (view full) ---

1267 return sd_setup_write_zeroes_cmnd(cmd);
1268 case REQ_OP_WRITE_SAME:
1269 return sd_setup_write_same_cmnd(cmd);
1270 case REQ_OP_FLUSH:
1271 return sd_setup_flush_cmnd(cmd);
1272 case REQ_OP_READ:
1273 case REQ_OP_WRITE:
1274 return sd_setup_read_write_cmnd(cmd);
1274 case REQ_OP_ZONE_REPORT:
1275 return sd_zbc_setup_report_cmnd(cmd);
1276 case REQ_OP_ZONE_RESET:
1277 return sd_zbc_setup_reset_cmnd(cmd);
1278 default:
1279 WARN_ON_ONCE(1);
1280 return BLKPREP_KILL;
1281 }
1282}
1283

--- 512 unchanged lines hidden (view full) ---

1796 .ioctl = sd_ioctl,
1797 .getgeo = sd_getgeo,
1798#ifdef CONFIG_COMPAT
1799 .compat_ioctl = sd_compat_ioctl,
1800#endif
1801 .check_events = sd_check_events,
1802 .revalidate_disk = sd_revalidate_disk,
1803 .unlock_native_capacity = sd_unlock_native_capacity,
1275 case REQ_OP_ZONE_RESET:
1276 return sd_zbc_setup_reset_cmnd(cmd);
1277 default:
1278 WARN_ON_ONCE(1);
1279 return BLKPREP_KILL;
1280 }
1281}
1282

--- 512 unchanged lines hidden (view full) ---

1795 .ioctl = sd_ioctl,
1796 .getgeo = sd_getgeo,
1797#ifdef CONFIG_COMPAT
1798 .compat_ioctl = sd_compat_ioctl,
1799#endif
1800 .check_events = sd_check_events,
1801 .revalidate_disk = sd_revalidate_disk,
1802 .unlock_native_capacity = sd_unlock_native_capacity,
1803 .report_zones = sd_zbc_report_zones,
1804 .pr_ops = &sd_pr_ops,
1805};
1806
1807/**
1808 * sd_eh_reset - reset error handling callback
1809 * @scmd: sd-issued command that has failed
1810 *
1811 * This function is called by the SCSI midlayer before starting

--- 135 unchanged lines hidden (view full) ---

1947 if (!result) {
1948 good_bytes = blk_rq_bytes(req);
1949 scsi_set_resid(SCpnt, 0);
1950 } else {
1951 good_bytes = 0;
1952 scsi_set_resid(SCpnt, blk_rq_bytes(req));
1953 }
1954 break;
1804 .pr_ops = &sd_pr_ops,
1805};
1806
1807/**
1808 * sd_eh_reset - reset error handling callback
1809 * @scmd: sd-issued command that has failed
1810 *
1811 * This function is called by the SCSI midlayer before starting

--- 135 unchanged lines hidden (view full) ---

1947 if (!result) {
1948 good_bytes = blk_rq_bytes(req);
1949 scsi_set_resid(SCpnt, 0);
1950 } else {
1951 good_bytes = 0;
1952 scsi_set_resid(SCpnt, blk_rq_bytes(req));
1953 }
1954 break;
1955 case REQ_OP_ZONE_REPORT:
1956 if (!result) {
1957 good_bytes = scsi_bufflen(SCpnt)
1958 - scsi_get_resid(SCpnt);
1959 scsi_set_resid(SCpnt, 0);
1960 } else {
1961 good_bytes = 0;
1962 scsi_set_resid(SCpnt, blk_rq_bytes(req));
1963 }
1964 break;
1965 default:
1966 /*
1967 * In case of bogus fw or device, we could end up having
1968 * an unaligned partial completion. Check this here and force
1969 * alignment.
1970 */
1971 resid = scsi_get_resid(SCpnt);
1972 if (resid & (sector_size - 1)) {

--- 1297 unchanged lines hidden (view full) ---

3270
3271 gd->flags = GENHD_FL_EXT_DEVT;
3272 if (sdp->removable) {
3273 gd->flags |= GENHD_FL_REMOVABLE;
3274 gd->events |= DISK_EVENT_MEDIA_CHANGE;
3275 }
3276
3277 blk_pm_runtime_init(sdp->request_queue, dev);
1955 default:
1956 /*
1957 * In case of bogus fw or device, we could end up having
1958 * an unaligned partial completion. Check this here and force
1959 * alignment.
1960 */
1961 resid = scsi_get_resid(SCpnt);
1962 if (resid & (sector_size - 1)) {

--- 1297 unchanged lines hidden (view full) ---

3260
3261 gd->flags = GENHD_FL_EXT_DEVT;
3262 if (sdp->removable) {
3263 gd->flags |= GENHD_FL_REMOVABLE;
3264 gd->events |= DISK_EVENT_MEDIA_CHANGE;
3265 }
3266
3267 blk_pm_runtime_init(sdp->request_queue, dev);
3278 device_add_disk(dev, gd);
3268 device_add_disk(dev, gd, NULL);
3279 if (sdkp->capacity)
3280 sd_dif_config_host(sdkp);
3281
3282 sd_revalidate_disk(gd);
3283
3284 if (sdkp->security) {
3285 sdkp->opal_dev = init_opal_dev(sdp, &sd_sec_submit);
3286 if (sdkp->opal_dev)

--- 421 unchanged lines hidden ---
3269 if (sdkp->capacity)
3270 sd_dif_config_host(sdkp);
3271
3272 sd_revalidate_disk(gd);
3273
3274 if (sdkp->security) {
3275 sdkp->opal_dev = init_opal_dev(sdp, &sd_sec_submit);
3276 if (sdkp->opal_dev)

--- 421 unchanged lines hidden ---