Commit 955c5038 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev

parents 62d3af1b 2ab540be
...@@ -370,6 +370,8 @@ static void ata_tf_read_pio(struct ata_port *ap, struct ata_taskfile *tf) ...@@ -370,6 +370,8 @@ static void ata_tf_read_pio(struct ata_port *ap, struct ata_taskfile *tf)
{ {
struct ata_ioports *ioaddr = &ap->ioaddr; struct ata_ioports *ioaddr = &ap->ioaddr;
tf->command = ata_check_status(ap);
tf->feature = ata_chk_err(ap);
tf->nsect = inb(ioaddr->nsect_addr); tf->nsect = inb(ioaddr->nsect_addr);
tf->lbal = inb(ioaddr->lbal_addr); tf->lbal = inb(ioaddr->lbal_addr);
tf->lbam = inb(ioaddr->lbam_addr); tf->lbam = inb(ioaddr->lbam_addr);
...@@ -402,6 +404,8 @@ static void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf) ...@@ -402,6 +404,8 @@ static void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf)
{ {
struct ata_ioports *ioaddr = &ap->ioaddr; struct ata_ioports *ioaddr = &ap->ioaddr;
tf->command = ata_check_status(ap);
tf->feature = ata_chk_err(ap);
tf->nsect = readb((void __iomem *)ioaddr->nsect_addr); tf->nsect = readb((void __iomem *)ioaddr->nsect_addr);
tf->lbal = readb((void __iomem *)ioaddr->lbal_addr); tf->lbal = readb((void __iomem *)ioaddr->lbal_addr);
tf->lbam = readb((void __iomem *)ioaddr->lbam_addr); tf->lbam = readb((void __iomem *)ioaddr->lbam_addr);
...@@ -4254,11 +4258,10 @@ int ata_device_add(const struct ata_probe_ent *ent) ...@@ -4254,11 +4258,10 @@ int ata_device_add(const struct ata_probe_ent *ent)
DPRINTK("ENTER\n"); DPRINTK("ENTER\n");
/* alloc a container for our list of ATA ports (buses) */ /* alloc a container for our list of ATA ports (buses) */
host_set = kmalloc(sizeof(struct ata_host_set) + host_set = kzalloc(sizeof(struct ata_host_set) +
(ent->n_ports * sizeof(void *)), GFP_KERNEL); (ent->n_ports * sizeof(void *)), GFP_KERNEL);
if (!host_set) if (!host_set)
return 0; return 0;
memset(host_set, 0, sizeof(struct ata_host_set) + (ent->n_ports * sizeof(void *)));
spin_lock_init(&host_set->lock); spin_lock_init(&host_set->lock);
host_set->dev = dev; host_set->dev = dev;
...@@ -4298,10 +4301,8 @@ int ata_device_add(const struct ata_probe_ent *ent) ...@@ -4298,10 +4301,8 @@ int ata_device_add(const struct ata_probe_ent *ent)
count++; count++;
} }
if (!count) { if (!count)
kfree(host_set); goto err_free_ret;
return 0;
}
/* obtain irq, that is shared between channels */ /* obtain irq, that is shared between channels */
if (request_irq(ent->irq, ent->port_ops->irq_handler, ent->irq_flags, if (request_irq(ent->irq, ent->port_ops->irq_handler, ent->irq_flags,
...@@ -4359,6 +4360,7 @@ int ata_device_add(const struct ata_probe_ent *ent) ...@@ -4359,6 +4360,7 @@ int ata_device_add(const struct ata_probe_ent *ent)
ata_host_remove(host_set->ports[i], 1); ata_host_remove(host_set->ports[i], 1);
scsi_host_put(host_set->ports[i]->host); scsi_host_put(host_set->ports[i]->host);
} }
err_free_ret:
kfree(host_set); kfree(host_set);
VPRINTK("EXIT, returning 0\n"); VPRINTK("EXIT, returning 0\n");
return 0; return 0;
...@@ -4468,15 +4470,13 @@ ata_probe_ent_alloc(struct device *dev, const struct ata_port_info *port) ...@@ -4468,15 +4470,13 @@ ata_probe_ent_alloc(struct device *dev, const struct ata_port_info *port)
{ {
struct ata_probe_ent *probe_ent; struct ata_probe_ent *probe_ent;
probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); probe_ent = kzalloc(sizeof(*probe_ent), GFP_KERNEL);
if (!probe_ent) { if (!probe_ent) {
printk(KERN_ERR DRV_NAME "(%s): out of memory\n", printk(KERN_ERR DRV_NAME "(%s): out of memory\n",
kobject_name(&(dev->kobj))); kobject_name(&(dev->kobj)));
return NULL; return NULL;
} }
memset(probe_ent, 0, sizeof(*probe_ent));
INIT_LIST_HEAD(&probe_ent->node); INIT_LIST_HEAD(&probe_ent->node);
probe_ent->dev = dev; probe_ent->dev = dev;
......
This diff is collapsed.
...@@ -50,13 +50,14 @@ extern void ata_dev_select(struct ata_port *ap, unsigned int device, ...@@ -50,13 +50,14 @@ extern void ata_dev_select(struct ata_port *ap, unsigned int device,
unsigned int wait, unsigned int can_sleep); unsigned int wait, unsigned int can_sleep);
extern void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf); extern void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf);
extern void swap_buf_le16(u16 *buf, unsigned int buf_words); extern void swap_buf_le16(u16 *buf, unsigned int buf_words);
extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg);
extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg);
/* libata-scsi.c */ /* libata-scsi.c */
extern void atapi_request_sense(struct ata_port *ap, struct ata_device *dev, extern void atapi_request_sense(struct ata_port *ap, struct ata_device *dev,
struct scsi_cmnd *cmd); struct scsi_cmnd *cmd);
extern void ata_scsi_scan_host(struct ata_port *ap); extern void ata_scsi_scan_host(struct ata_port *ap);
extern void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat);
extern int ata_scsi_error(struct Scsi_Host *host); extern int ata_scsi_error(struct Scsi_Host *host);
extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf, extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf,
unsigned int buflen); unsigned int buflen);
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#include <linux/libata.h> #include <linux/libata.h>
#define DRV_NAME "pdc_adma" #define DRV_NAME "pdc_adma"
#define DRV_VERSION "0.01" #define DRV_VERSION "0.03"
/* macro to calculate base address for ATA regs */ /* macro to calculate base address for ATA regs */
#define ADMA_ATA_REGS(base,port_no) ((base) + ((port_no) * 0x40)) #define ADMA_ATA_REGS(base,port_no) ((base) + ((port_no) * 0x40))
...@@ -79,7 +79,6 @@ enum { ...@@ -79,7 +79,6 @@ enum {
aNIEN = (1 << 8), /* irq mask: 1==masked */ aNIEN = (1 << 8), /* irq mask: 1==masked */
aGO = (1 << 7), /* packet trigger ("Go!") */ aGO = (1 << 7), /* packet trigger ("Go!") */
aRSTADM = (1 << 5), /* ADMA logic reset */ aRSTADM = (1 << 5), /* ADMA logic reset */
aRSTA = (1 << 2), /* ATA hard reset */
aPIOMD4 = 0x0003, /* PIO mode 4 */ aPIOMD4 = 0x0003, /* PIO mode 4 */
/* ADMA_STATUS register bits */ /* ADMA_STATUS register bits */
...@@ -452,24 +451,25 @@ static inline unsigned int adma_intr_pkt(struct ata_host_set *host_set) ...@@ -452,24 +451,25 @@ static inline unsigned int adma_intr_pkt(struct ata_host_set *host_set)
struct adma_port_priv *pp; struct adma_port_priv *pp;
struct ata_queued_cmd *qc; struct ata_queued_cmd *qc;
void __iomem *chan = ADMA_REGS(mmio_base, port_no); void __iomem *chan = ADMA_REGS(mmio_base, port_no);
u8 drv_stat, status = readb(chan + ADMA_STATUS); u8 drv_stat = 0, status = readb(chan + ADMA_STATUS);
if (status == 0) if (status == 0)
continue; continue;
handled = 1; handled = 1;
adma_enter_reg_mode(ap); adma_enter_reg_mode(ap);
if ((ap->flags & ATA_FLAG_PORT_DISABLED)) if (ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))
continue; continue;
pp = ap->private_data; pp = ap->private_data;
if (!pp || pp->state != adma_state_pkt) if (!pp || pp->state != adma_state_pkt)
continue; continue;
qc = ata_qc_from_tag(ap, ap->active_tag); qc = ata_qc_from_tag(ap, ap->active_tag);
drv_stat = 0; if (qc && (!(qc->tf.ctl & ATA_NIEN))) {
if ((status & (aPERR | aPSD | aUIRQ))) if ((status & (aPERR | aPSD | aUIRQ)))
drv_stat = ATA_ERR; drv_stat = ATA_ERR;
else if (pp->pkt[0] != cDONE) else if (pp->pkt[0] != cDONE)
drv_stat = ATA_ERR; drv_stat = ATA_ERR;
ata_qc_complete(qc, drv_stat); ata_qc_complete(qc, drv_stat);
}
} }
return handled; return handled;
} }
...@@ -490,7 +490,7 @@ static inline unsigned int adma_intr_mmio(struct ata_host_set *host_set) ...@@ -490,7 +490,7 @@ static inline unsigned int adma_intr_mmio(struct ata_host_set *host_set)
if (qc && (!(qc->tf.ctl & ATA_NIEN))) { if (qc && (!(qc->tf.ctl & ATA_NIEN))) {
/* check main status, clearing INTRQ */ /* check main status, clearing INTRQ */
u8 status = ata_chk_status(ap); u8 status = ata_check_status(ap);
if ((status & ATA_BUSY)) if ((status & ATA_BUSY))
continue; continue;
DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n", DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n",
...@@ -561,15 +561,15 @@ static int adma_port_start(struct ata_port *ap) ...@@ -561,15 +561,15 @@ static int adma_port_start(struct ata_port *ap)
if ((pp->pkt_dma & 7) != 0) { if ((pp->pkt_dma & 7) != 0) {
printk("bad alignment for pp->pkt_dma: %08x\n", printk("bad alignment for pp->pkt_dma: %08x\n",
(u32)pp->pkt_dma); (u32)pp->pkt_dma);
goto err_out_kfree2; dma_free_coherent(dev, ADMA_PKT_BYTES,
pp->pkt, pp->pkt_dma);
goto err_out_kfree;
} }
memset(pp->pkt, 0, ADMA_PKT_BYTES); memset(pp->pkt, 0, ADMA_PKT_BYTES);
ap->private_data = pp; ap->private_data = pp;
adma_reinit_engine(ap); adma_reinit_engine(ap);
return 0; return 0;
err_out_kfree2:
kfree(pp);
err_out_kfree: err_out_kfree:
kfree(pp); kfree(pp);
err_out: err_out:
......
...@@ -195,6 +195,8 @@ static struct ata_port_info pdc_port_info[] = { ...@@ -195,6 +195,8 @@ static struct ata_port_info pdc_port_info[] = {
static struct pci_device_id pdc_ata_pci_tbl[] = { static struct pci_device_id pdc_ata_pci_tbl[] = {
{ PCI_VENDOR_ID_PROMISE, 0x3371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, { PCI_VENDOR_ID_PROMISE, 0x3371, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
board_2037x }, board_2037x },
{ PCI_VENDOR_ID_PROMISE, 0x3570, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
board_2037x },
{ PCI_VENDOR_ID_PROMISE, 0x3571, PCI_ANY_ID, PCI_ANY_ID, 0, 0, { PCI_VENDOR_ID_PROMISE, 0x3571, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
board_2037x }, board_2037x },
{ PCI_VENDOR_ID_PROMISE, 0x3373, PCI_ANY_ID, PCI_ANY_ID, 0, 0, { PCI_VENDOR_ID_PROMISE, 0x3373, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
...@@ -207,6 +209,8 @@ static struct pci_device_id pdc_ata_pci_tbl[] = { ...@@ -207,6 +209,8 @@ static struct pci_device_id pdc_ata_pci_tbl[] = {
board_2037x }, board_2037x },
{ PCI_VENDOR_ID_PROMISE, 0x3d75, PCI_ANY_ID, PCI_ANY_ID, 0, 0, { PCI_VENDOR_ID_PROMISE, 0x3d75, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
board_2037x }, board_2037x },
{ PCI_VENDOR_ID_PROMISE, 0x3d73, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
board_2037x },
{ PCI_VENDOR_ID_PROMISE, 0x3318, PCI_ANY_ID, PCI_ANY_ID, 0, 0, { PCI_VENDOR_ID_PROMISE, 0x3318, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
board_20319 }, board_20319 },
......
...@@ -433,7 +433,7 @@ static inline unsigned int qs_intr_mmio(struct ata_host_set *host_set) ...@@ -433,7 +433,7 @@ static inline unsigned int qs_intr_mmio(struct ata_host_set *host_set)
if (qc && (!(qc->tf.ctl & ATA_NIEN))) { if (qc && (!(qc->tf.ctl & ATA_NIEN))) {
/* check main status, clearing INTRQ */ /* check main status, clearing INTRQ */
u8 status = ata_chk_status(ap); u8 status = ata_check_status(ap);
if ((status & ATA_BUSY)) if ((status & ATA_BUSY))
continue; continue;
DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n", DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n",
......
...@@ -84,6 +84,8 @@ ...@@ -84,6 +84,8 @@
/* Port stride */ /* Port stride */
#define K2_SATA_PORT_OFFSET 0x100 #define K2_SATA_PORT_OFFSET 0x100
static u8 k2_stat_check_status(struct ata_port *ap);
static u32 k2_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) static u32 k2_sata_scr_read (struct ata_port *ap, unsigned int sc_reg)
{ {
...@@ -136,16 +138,24 @@ static void k2_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) ...@@ -136,16 +138,24 @@ static void k2_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
static void k2_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) static void k2_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
{ {
struct ata_ioports *ioaddr = &ap->ioaddr; struct ata_ioports *ioaddr = &ap->ioaddr;
u16 nsect, lbal, lbam, lbah; u16 nsect, lbal, lbam, lbah, feature;
nsect = tf->nsect = readw(ioaddr->nsect_addr); tf->command = k2_stat_check_status(ap);
lbal = tf->lbal = readw(ioaddr->lbal_addr);
lbam = tf->lbam = readw(ioaddr->lbam_addr);
lbah = tf->lbah = readw(ioaddr->lbah_addr);
tf->device = readw(ioaddr->device_addr); tf->device = readw(ioaddr->device_addr);
feature = readw(ioaddr->error_addr);
nsect = readw(ioaddr->nsect_addr);
lbal = readw(ioaddr->lbal_addr);
lbam = readw(ioaddr->lbam_addr);
lbah = readw(ioaddr->lbah_addr);
tf->feature = feature;
tf->nsect = nsect;
tf->lbal = lbal;
tf->lbam = lbam;
tf->lbah = lbah;
if (tf->flags & ATA_TFLAG_LBA48) { if (tf->flags & ATA_TFLAG_LBA48) {
tf->hob_feature = readw(ioaddr->error_addr) >> 8; tf->hob_feature = feature >> 8;
tf->hob_nsect = nsect >> 8; tf->hob_nsect = nsect >> 8;
tf->hob_lbal = lbal >> 8; tf->hob_lbal = lbal >> 8;
tf->hob_lbam = lbam >> 8; tf->hob_lbam = lbam >> 8;
......
...@@ -153,16 +153,24 @@ static void vsc_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) ...@@ -153,16 +153,24 @@ static void vsc_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
static void vsc_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) static void vsc_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
{ {
struct ata_ioports *ioaddr = &ap->ioaddr; struct ata_ioports *ioaddr = &ap->ioaddr;
u16 nsect, lbal, lbam, lbah; u16 nsect, lbal, lbam, lbah, feature;
nsect = tf->nsect = readw(ioaddr->nsect_addr); tf->command = ata_check_status(ap);
lbal = tf->lbal = readw(ioaddr->lbal_addr);
lbam = tf->lbam = readw(ioaddr->lbam_addr);
lbah = tf->lbah = readw(ioaddr->lbah_addr);
tf->device = readw(ioaddr->device_addr); tf->device = readw(ioaddr->device_addr);
feature = readw(ioaddr->error_addr);
nsect = readw(ioaddr->nsect_addr);
lbal = readw(ioaddr->lbal_addr);
lbam = readw(ioaddr->lbam_addr);
lbah = readw(ioaddr->lbah_addr);
tf->feature = feature;
tf->nsect = nsect;
tf->lbal = lbal;
tf->lbam = lbam;
tf->lbah = lbah;
if (tf->flags & ATA_TFLAG_LBA48) { if (tf->flags & ATA_TFLAG_LBA48) {
tf->hob_feature = readb(ioaddr->error_addr); tf->hob_feature = feature >> 8;
tf->hob_nsect = nsect >> 8; tf->hob_nsect = nsect >> 8;
tf->hob_lbal = lbal >> 8; tf->hob_lbal = lbal >> 8;
tf->hob_lbam = lbam >> 8; tf->hob_lbam = lbam >> 8;
......
...@@ -116,6 +116,9 @@ extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE]; ...@@ -116,6 +116,9 @@ extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
/* values for service action in */ /* values for service action in */
#define SAI_READ_CAPACITY_16 0x10 #define SAI_READ_CAPACITY_16 0x10
/* Values for T10/04-262r7 */
#define ATA_16 0x85 /* 16-byte pass-thru */
#define ATA_12 0xa1 /* 12-byte pass-thru */
/* /*
* SCSI Architecture Model (SAM) Status codes. Taken from SAM-3 draft * SCSI Architecture Model (SAM) Status codes. Taken from SAM-3 draft
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment