Merge branch 'for-4.2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata
Pull libata fixes from Tejun Heo: "Three minor device-specific fixes and revert of NCQ autosense added during this -rc1. It turned out that NCQ autosense as currently implemented interferes with the usual error handling behavior. It will be revisited in the near future" * 'for-4.2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: ata: ahci_brcmstb: Fix misuse of IS_ENABLED sata_sx4: Check return code from pdc20621_i2c_read() Revert "libata: Implement NCQ autosense" Revert "libata: Implement support for sense data reporting" Revert "libata-eh: Set 'information' field for autosense" ata: ahci_brcmstb: Fix warnings with CONFIG_PM_SLEEP=n
This commit is contained in:
commit
4e7fca0d0a
|
@ -92,7 +92,7 @@ static inline u32 brcm_sata_readreg(void __iomem *addr)
|
|||
* Other architectures (e.g., ARM) either do not support big endian, or
|
||||
* else leave I/O in little endian mode.
|
||||
*/
|
||||
if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN))
|
||||
if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
|
||||
return __raw_readl(addr);
|
||||
else
|
||||
return readl_relaxed(addr);
|
||||
|
@ -101,7 +101,7 @@ static inline u32 brcm_sata_readreg(void __iomem *addr)
|
|||
static inline void brcm_sata_writereg(u32 val, void __iomem *addr)
|
||||
{
|
||||
/* See brcm_sata_readreg() comments */
|
||||
if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN))
|
||||
if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
|
||||
__raw_writel(val, addr);
|
||||
else
|
||||
writel_relaxed(val, addr);
|
||||
|
@ -209,6 +209,7 @@ static void brcm_sata_init(struct brcm_ahci_priv *priv)
|
|||
priv->top_ctrl + SATA_TOP_CTRL_BUS_CTRL);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int brcm_ahci_suspend(struct device *dev)
|
||||
{
|
||||
struct ata_host *host = dev_get_drvdata(dev);
|
||||
|
@ -231,6 +232,7 @@ static int brcm_ahci_resume(struct device *dev)
|
|||
brcm_sata_phys_enable(priv);
|
||||
return ahci_platform_resume(dev);
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct scsi_host_template ahci_platform_sht = {
|
||||
AHCI_SHT(DRV_NAME),
|
||||
|
|
|
@ -694,11 +694,11 @@ static int ata_rwcmd_protocol(struct ata_taskfile *tf, struct ata_device *dev)
|
|||
* RETURNS:
|
||||
* Block address read from @tf.
|
||||
*/
|
||||
u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev)
|
||||
u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev)
|
||||
{
|
||||
u64 block = 0;
|
||||
|
||||
if (!dev || tf->flags & ATA_TFLAG_LBA) {
|
||||
if (tf->flags & ATA_TFLAG_LBA) {
|
||||
if (tf->flags & ATA_TFLAG_LBA48) {
|
||||
block |= (u64)tf->hob_lbah << 40;
|
||||
block |= (u64)tf->hob_lbam << 32;
|
||||
|
@ -2147,24 +2147,6 @@ static int ata_dev_config_ncq(struct ata_device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void ata_dev_config_sense_reporting(struct ata_device *dev)
|
||||
{
|
||||
unsigned int err_mask;
|
||||
|
||||
if (!ata_id_has_sense_reporting(dev->id))
|
||||
return;
|
||||
|
||||
if (ata_id_sense_reporting_enabled(dev->id))
|
||||
return;
|
||||
|
||||
err_mask = ata_dev_set_feature(dev, SETFEATURE_SENSE_DATA, 0x1);
|
||||
if (err_mask) {
|
||||
ata_dev_dbg(dev,
|
||||
"failed to enable Sense Data Reporting, Emask 0x%x\n",
|
||||
err_mask);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ata_dev_configure - Configure the specified ATA/ATAPI device
|
||||
* @dev: Target device to configure
|
||||
|
@ -2387,7 +2369,7 @@ int ata_dev_configure(struct ata_device *dev)
|
|||
dev->devslp_timing[i] = sata_setting[j];
|
||||
}
|
||||
}
|
||||
ata_dev_config_sense_reporting(dev);
|
||||
|
||||
dev->cdb_len = 16;
|
||||
}
|
||||
|
||||
|
|
|
@ -1592,8 +1592,6 @@ static int ata_eh_read_log_10h(struct ata_device *dev,
|
|||
tf->hob_lbah = buf[10];
|
||||
tf->nsect = buf[12];
|
||||
tf->hob_nsect = buf[13];
|
||||
if (ata_id_has_ncq_autosense(dev->id))
|
||||
tf->auxiliary = buf[14] << 16 | buf[15] << 8 | buf[16];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1629,70 +1627,6 @@ unsigned int atapi_eh_tur(struct ata_device *dev, u8 *r_sense_key)
|
|||
return err_mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* ata_eh_request_sense - perform REQUEST_SENSE_DATA_EXT
|
||||
* @dev: device to perform REQUEST_SENSE_SENSE_DATA_EXT to
|
||||
* @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long)
|
||||
* @dfl_sense_key: default sense key to use
|
||||
*
|
||||
* Perform REQUEST_SENSE_DATA_EXT after the device reported CHECK
|
||||
* SENSE. This function is EH helper.
|
||||
*
|
||||
* LOCKING:
|
||||
* Kernel thread context (may sleep).
|
||||
*
|
||||
* RETURNS:
|
||||
* encoded sense data on success, 0 on failure or if sense data
|
||||
* is not available.
|
||||
*/
|
||||
static u32 ata_eh_request_sense(struct ata_queued_cmd *qc,
|
||||
struct scsi_cmnd *cmd)
|
||||
{
|
||||
struct ata_device *dev = qc->dev;
|
||||
struct ata_taskfile tf;
|
||||
unsigned int err_mask;
|
||||
|
||||
if (!cmd)
|
||||
return 0;
|
||||
|
||||
DPRINTK("ATA request sense\n");
|
||||
ata_dev_warn(dev, "request sense\n");
|
||||
if (!ata_id_sense_reporting_enabled(dev->id)) {
|
||||
ata_dev_warn(qc->dev, "sense data reporting disabled\n");
|
||||
return 0;
|
||||
}
|
||||
ata_tf_init(dev, &tf);
|
||||
|
||||
tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
|
||||
tf.flags |= ATA_TFLAG_LBA | ATA_TFLAG_LBA48;
|
||||
tf.command = ATA_CMD_REQ_SENSE_DATA;
|
||||
tf.protocol = ATA_PROT_NODATA;
|
||||
|
||||
err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
|
||||
/*
|
||||
* ACS-4 states:
|
||||
* The device may set the SENSE DATA AVAILABLE bit to one in the
|
||||
* STATUS field and clear the ERROR bit to zero in the STATUS field
|
||||
* to indicate that the command returned completion without an error
|
||||
* and the sense data described in table 306 is available.
|
||||
*
|
||||
* IOW the 'ATA_SENSE' bit might not be set even though valid
|
||||
* sense data is available.
|
||||
* So check for both.
|
||||
*/
|
||||
if ((tf.command & ATA_SENSE) ||
|
||||
tf.lbah != 0 || tf.lbam != 0 || tf.lbal != 0) {
|
||||
ata_scsi_set_sense(cmd, tf.lbah, tf.lbam, tf.lbal);
|
||||
qc->flags |= ATA_QCFLAG_SENSE_VALID;
|
||||
ata_dev_warn(dev, "sense data %02x/%02x/%02x\n",
|
||||
tf.lbah, tf.lbam, tf.lbal);
|
||||
} else {
|
||||
ata_dev_warn(dev, "request sense failed stat %02x emask %x\n",
|
||||
tf.command, err_mask);
|
||||
}
|
||||
return err_mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* atapi_eh_request_sense - perform ATAPI REQUEST_SENSE
|
||||
* @dev: device to perform REQUEST_SENSE to
|
||||
|
@ -1855,19 +1789,6 @@ void ata_eh_analyze_ncq_error(struct ata_link *link)
|
|||
memcpy(&qc->result_tf, &tf, sizeof(tf));
|
||||
qc->result_tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_LBA | ATA_TFLAG_LBA48;
|
||||
qc->err_mask |= AC_ERR_DEV | AC_ERR_NCQ;
|
||||
if (qc->result_tf.auxiliary) {
|
||||
char sense_key, asc, ascq;
|
||||
|
||||
sense_key = (qc->result_tf.auxiliary >> 16) & 0xff;
|
||||
asc = (qc->result_tf.auxiliary >> 8) & 0xff;
|
||||
ascq = qc->result_tf.auxiliary & 0xff;
|
||||
ata_dev_dbg(dev, "NCQ Autosense %02x/%02x/%02x\n",
|
||||
sense_key, asc, ascq);
|
||||
ata_scsi_set_sense(qc->scsicmd, sense_key, asc, ascq);
|
||||
ata_scsi_set_sense_information(qc->scsicmd, &qc->result_tf);
|
||||
qc->flags |= ATA_QCFLAG_SENSE_VALID;
|
||||
}
|
||||
|
||||
ehc->i.err_mask &= ~AC_ERR_DEV;
|
||||
}
|
||||
|
||||
|
@ -1897,27 +1818,6 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc,
|
|||
return ATA_EH_RESET;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sense data reporting does not work if the
|
||||
* device fault bit is set.
|
||||
*/
|
||||
if ((stat & ATA_SENSE) && !(stat & ATA_DF) &&
|
||||
!(qc->flags & ATA_QCFLAG_SENSE_VALID)) {
|
||||
if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) {
|
||||
tmp = ata_eh_request_sense(qc, qc->scsicmd);
|
||||
if (tmp)
|
||||
qc->err_mask |= tmp;
|
||||
else
|
||||
ata_scsi_set_sense_information(qc->scsicmd, tf);
|
||||
} else {
|
||||
ata_dev_warn(qc->dev, "sense data available but port frozen\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* Set by NCQ autosense or request sense above */
|
||||
if (qc->flags & ATA_QCFLAG_SENSE_VALID)
|
||||
return 0;
|
||||
|
||||
if (stat & (ATA_ERR | ATA_DF))
|
||||
qc->err_mask |= AC_ERR_DEV;
|
||||
else
|
||||
|
@ -2661,15 +2561,14 @@ static void ata_eh_link_report(struct ata_link *link)
|
|||
|
||||
#ifdef CONFIG_ATA_VERBOSE_ERROR
|
||||
if (res->command & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ |
|
||||
ATA_SENSE | ATA_ERR)) {
|
||||
ATA_ERR)) {
|
||||
if (res->command & ATA_BUSY)
|
||||
ata_dev_err(qc->dev, "status: { Busy }\n");
|
||||
else
|
||||
ata_dev_err(qc->dev, "status: { %s%s%s%s%s}\n",
|
||||
ata_dev_err(qc->dev, "status: { %s%s%s%s}\n",
|
||||
res->command & ATA_DRDY ? "DRDY " : "",
|
||||
res->command & ATA_DF ? "DF " : "",
|
||||
res->command & ATA_DRQ ? "DRQ " : "",
|
||||
res->command & ATA_SENSE ? "SENSE " : "",
|
||||
res->command & ATA_ERR ? "ERR " : "");
|
||||
}
|
||||
|
||||
|
|
|
@ -270,28 +270,13 @@ DEVICE_ATTR(unload_heads, S_IRUGO | S_IWUSR,
|
|||
ata_scsi_park_show, ata_scsi_park_store);
|
||||
EXPORT_SYMBOL_GPL(dev_attr_unload_heads);
|
||||
|
||||
void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq)
|
||||
static void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq)
|
||||
{
|
||||
if (!cmd)
|
||||
return;
|
||||
|
||||
cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
|
||||
|
||||
scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq);
|
||||
}
|
||||
|
||||
void ata_scsi_set_sense_information(struct scsi_cmnd *cmd,
|
||||
const struct ata_taskfile *tf)
|
||||
{
|
||||
u64 information;
|
||||
|
||||
if (!cmd)
|
||||
return;
|
||||
|
||||
information = ata_tf_read_block(tf, NULL);
|
||||
scsi_set_sense_information(cmd->sense_buffer, information);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
ata_scsi_em_message_store(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
|
@ -1792,9 +1777,7 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
|
|||
((cdb[2] & 0x20) || need_sense)) {
|
||||
ata_gen_passthru_sense(qc);
|
||||
} else {
|
||||
if (qc->flags & ATA_QCFLAG_SENSE_VALID) {
|
||||
cmd->result = SAM_STAT_CHECK_CONDITION;
|
||||
} else if (!need_sense) {
|
||||
if (!need_sense) {
|
||||
cmd->result = SAM_STAT_GOOD;
|
||||
} else {
|
||||
/* TODO: decide which descriptor format to use
|
||||
|
|
|
@ -67,8 +67,7 @@ extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag);
|
|||
extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
|
||||
u64 block, u32 n_block, unsigned int tf_flags,
|
||||
unsigned int tag);
|
||||
extern u64 ata_tf_read_block(const struct ata_taskfile *tf,
|
||||
struct ata_device *dev);
|
||||
extern u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev);
|
||||
extern unsigned ata_exec_internal(struct ata_device *dev,
|
||||
struct ata_taskfile *tf, const u8 *cdb,
|
||||
int dma_dir, void *buf, unsigned int buflen,
|
||||
|
@ -138,9 +137,6 @@ extern int ata_scsi_add_hosts(struct ata_host *host,
|
|||
struct scsi_host_template *sht);
|
||||
extern void ata_scsi_scan_host(struct ata_port *ap, int sync);
|
||||
extern int ata_scsi_offline_dev(struct ata_device *dev);
|
||||
extern void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq);
|
||||
extern void ata_scsi_set_sense_information(struct scsi_cmnd *cmd,
|
||||
const struct ata_taskfile *tf);
|
||||
extern void ata_scsi_media_change_notify(struct ata_device *dev);
|
||||
extern void ata_scsi_hotplug(struct work_struct *work);
|
||||
extern void ata_schedule_scsi_eh(struct Scsi_Host *shost);
|
||||
|
|
|
@ -1238,8 +1238,12 @@ static unsigned int pdc20621_prog_dimm_global(struct ata_host *host)
|
|||
readl(mmio + PDC_SDRAM_CONTROL);
|
||||
|
||||
/* Turn on for ECC */
|
||||
pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS,
|
||||
PDC_DIMM_SPD_TYPE, &spd0);
|
||||
if (!pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS,
|
||||
PDC_DIMM_SPD_TYPE, &spd0)) {
|
||||
pr_err("Failed in i2c read: device=%#x, subaddr=%#x\n",
|
||||
PDC_DIMM0_SPD_DEV_ADDRESS, PDC_DIMM_SPD_TYPE);
|
||||
return 1;
|
||||
}
|
||||
if (spd0 == 0x02) {
|
||||
data |= (0x01 << 16);
|
||||
writel(data, mmio + PDC_SDRAM_CONTROL);
|
||||
|
@ -1380,8 +1384,12 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
|
|||
|
||||
/* ECC initiliazation. */
|
||||
|
||||
pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS,
|
||||
PDC_DIMM_SPD_TYPE, &spd0);
|
||||
if (!pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS,
|
||||
PDC_DIMM_SPD_TYPE, &spd0)) {
|
||||
pr_err("Failed in i2c read: device=%#x, subaddr=%#x\n",
|
||||
PDC_DIMM0_SPD_DEV_ADDRESS, PDC_DIMM_SPD_TYPE);
|
||||
return 1;
|
||||
}
|
||||
if (spd0 == 0x02) {
|
||||
void *buf;
|
||||
VPRINTK("Start ECC initialization\n");
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <linux/blkdev.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#include <scsi/scsi.h>
|
||||
#include <scsi/scsi_cmnd.h>
|
||||
|
@ -2523,33 +2522,3 @@ void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq)
|
|||
}
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_build_sense_buffer);
|
||||
|
||||
/**
|
||||
* scsi_set_sense_information - set the information field in a
|
||||
* formatted sense data buffer
|
||||
* @buf: Where to build sense data
|
||||
* @info: 64-bit information value to be set
|
||||
*
|
||||
**/
|
||||
void scsi_set_sense_information(u8 *buf, u64 info)
|
||||
{
|
||||
if ((buf[0] & 0x7f) == 0x72) {
|
||||
u8 *ucp, len;
|
||||
|
||||
len = buf[7];
|
||||
ucp = (char *)scsi_sense_desc_find(buf, len + 8, 0);
|
||||
if (!ucp) {
|
||||
buf[7] = len + 0xa;
|
||||
ucp = buf + 8 + len;
|
||||
}
|
||||
ucp[0] = 0;
|
||||
ucp[1] = 0xa;
|
||||
ucp[2] = 0x80; /* Valid bit */
|
||||
ucp[3] = 0;
|
||||
put_unaligned_be64(info, &ucp[4]);
|
||||
} else if ((buf[0] & 0x7f) == 0x70) {
|
||||
buf[0] |= 0x80;
|
||||
put_unaligned_be64(info, &buf[3]);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_set_sense_information);
|
||||
|
|
|
@ -385,8 +385,6 @@ enum {
|
|||
SATA_SSP = 0x06, /* Software Settings Preservation */
|
||||
SATA_DEVSLP = 0x09, /* Device Sleep */
|
||||
|
||||
SETFEATURE_SENSE_DATA = 0xC3, /* Sense Data Reporting feature */
|
||||
|
||||
/* feature values for SET_MAX */
|
||||
ATA_SET_MAX_ADDR = 0x00,
|
||||
ATA_SET_MAX_PASSWD = 0x01,
|
||||
|
@ -530,8 +528,6 @@ struct ata_bmdma_prd {
|
|||
#define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20)
|
||||
#define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4))
|
||||
#define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))
|
||||
#define ata_id_has_ncq_autosense(id) \
|
||||
((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))
|
||||
|
||||
static inline bool ata_id_has_hipm(const u16 *id)
|
||||
{
|
||||
|
@ -720,20 +716,6 @@ static inline bool ata_id_has_read_log_dma_ext(const u16 *id)
|
|||
return false;
|
||||
}
|
||||
|
||||
static inline bool ata_id_has_sense_reporting(const u16 *id)
|
||||
{
|
||||
if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
|
||||
return false;
|
||||
return id[ATA_ID_COMMAND_SET_3] & (1 << 6);
|
||||
}
|
||||
|
||||
static inline bool ata_id_sense_reporting_enabled(const u16 *id)
|
||||
{
|
||||
if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
|
||||
return false;
|
||||
return id[ATA_ID_COMMAND_SET_4] & (1 << 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* ata_id_major_version - get ATA level of drive
|
||||
* @id: Identify data
|
||||
|
|
|
@ -28,7 +28,6 @@ extern int scsi_get_sense_info_fld(const u8 * sense_buffer, int sb_len,
|
|||
u64 * info_out);
|
||||
|
||||
extern void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq);
|
||||
extern void scsi_set_sense_information(u8 *buf, u64 info);
|
||||
|
||||
extern int scsi_ioctl_reset(struct scsi_device *, int __user *);
|
||||
|
||||
|
|
Loading…
Reference in New Issue