diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-05-15 15:04:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-05-15 15:04:49 -0400 |
commit | 8c21f34126222239450717b78dda0c4962d9ebfa (patch) | |
tree | 3ed64c828f8bf8896e684a6ae471ed56b926b0d8 | |
parent | 3346857f6fab1d6d1237a3ec7cfa159ec9b52db5 (diff) | |
parent | 4bca3286433585b5f1c3e7d8ac37a2f4b3def9ca (diff) |
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of ssh://master.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
libata: Media rotation rate and form factor heuristics
libata: Report disk alignment and physical block size
sata_fsl: Fix the command description of FSL SATA controller
sata_fsl: Fix compile warnings
[libata] sata_sx4: fixup interrupt handling
[libata] sata_sx4: convert to new exception handling methods
-rw-r--r-- | drivers/ata/libata-scsi.c | 34 | ||||
-rw-r--r-- | drivers/ata/sata_fsl.c | 15 | ||||
-rw-r--r-- | drivers/ata/sata_sx4.c | 180 | ||||
-rw-r--r-- | include/linux/ata.h | 28 |
4 files changed, 191 insertions, 66 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 68d9132d8f6f..342316064e9f 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -2142,13 +2142,14 @@ static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf) | |||
2142 | 2142 | ||
2143 | static unsigned int ata_scsiop_inq_b1(struct ata_scsi_args *args, u8 *rbuf) | 2143 | static unsigned int ata_scsiop_inq_b1(struct ata_scsi_args *args, u8 *rbuf) |
2144 | { | 2144 | { |
2145 | int form_factor = ata_id_form_factor(args->id); | ||
2146 | int media_rotation_rate = ata_id_rotation_rate(args->id); | ||
2147 | |||
2145 | rbuf[1] = 0xb1; | 2148 | rbuf[1] = 0xb1; |
2146 | rbuf[3] = 0x3c; | 2149 | rbuf[3] = 0x3c; |
2147 | if (ata_id_major_version(args->id) > 7) { | 2150 | rbuf[4] = media_rotation_rate >> 8; |
2148 | rbuf[4] = args->id[217] >> 8; | 2151 | rbuf[5] = media_rotation_rate; |
2149 | rbuf[5] = args->id[217]; | 2152 | rbuf[7] = form_factor; |
2150 | rbuf[7] = args->id[168] & 0xf; | ||
2151 | } | ||
2152 | 2153 | ||
2153 | return 0; | 2154 | return 0; |
2154 | } | 2155 | } |
@@ -2376,7 +2377,23 @@ saving_not_supp: | |||
2376 | */ | 2377 | */ |
2377 | static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf) | 2378 | static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf) |
2378 | { | 2379 | { |
2379 | u64 last_lba = args->dev->n_sectors - 1; /* LBA of the last block */ | 2380 | struct ata_device *dev = args->dev; |
2381 | u64 last_lba = dev->n_sectors - 1; /* LBA of the last block */ | ||
2382 | u8 log_per_phys = 0; | ||
2383 | u16 lowest_aligned = 0; | ||
2384 | u16 word_106 = dev->id[106]; | ||
2385 | u16 word_209 = dev->id[209]; | ||
2386 | |||
2387 | if ((word_106 & 0xc000) == 0x4000) { | ||
2388 | /* Number and offset of logical sectors per physical sector */ | ||
2389 | if (word_106 & (1 << 13)) | ||
2390 | log_per_phys = word_106 & 0xf; | ||
2391 | if ((word_209 & 0xc000) == 0x4000) { | ||
2392 | u16 first = dev->id[209] & 0x3fff; | ||
2393 | if (first > 0) | ||
2394 | lowest_aligned = (1 << log_per_phys) - first; | ||
2395 | } | ||
2396 | } | ||
2380 | 2397 | ||
2381 | VPRINTK("ENTER\n"); | 2398 | VPRINTK("ENTER\n"); |
2382 | 2399 | ||
@@ -2407,6 +2424,11 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf) | |||
2407 | /* sector size */ | 2424 | /* sector size */ |
2408 | rbuf[10] = ATA_SECT_SIZE >> 8; | 2425 | rbuf[10] = ATA_SECT_SIZE >> 8; |
2409 | rbuf[11] = ATA_SECT_SIZE & 0xff; | 2426 | rbuf[11] = ATA_SECT_SIZE & 0xff; |
2427 | |||
2428 | rbuf[12] = 0; | ||
2429 | rbuf[13] = log_per_phys; | ||
2430 | rbuf[14] = (lowest_aligned >> 8) & 0x3f; | ||
2431 | rbuf[15] = lowest_aligned; | ||
2410 | } | 2432 | } |
2411 | 2433 | ||
2412 | return 0; | 2434 | return 0; |
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index c2e90e1fece0..36b8629203be 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
@@ -205,6 +205,7 @@ struct cmdhdr_tbl_entry { | |||
205 | * Description information bitdefs | 205 | * Description information bitdefs |
206 | */ | 206 | */ |
207 | enum { | 207 | enum { |
208 | CMD_DESC_RES = (1 << 11), | ||
208 | VENDOR_SPECIFIC_BIST = (1 << 10), | 209 | VENDOR_SPECIFIC_BIST = (1 << 10), |
209 | CMD_DESC_SNOOP_ENABLE = (1 << 9), | 210 | CMD_DESC_SNOOP_ENABLE = (1 << 9), |
210 | FPDMA_QUEUED_CMD = (1 << 8), | 211 | FPDMA_QUEUED_CMD = (1 << 8), |
@@ -332,13 +333,14 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, | |||
332 | dma_addr_t sg_addr = sg_dma_address(sg); | 333 | dma_addr_t sg_addr = sg_dma_address(sg); |
333 | u32 sg_len = sg_dma_len(sg); | 334 | u32 sg_len = sg_dma_len(sg); |
334 | 335 | ||
335 | VPRINTK("SATA FSL : fill_sg, sg_addr = 0x%x, sg_len = %d\n", | 336 | VPRINTK("SATA FSL : fill_sg, sg_addr = 0x%llx, sg_len = %d\n", |
336 | sg_addr, sg_len); | 337 | (unsigned long long)sg_addr, sg_len); |
337 | 338 | ||
338 | /* warn if each s/g element is not dword aligned */ | 339 | /* warn if each s/g element is not dword aligned */ |
339 | if (sg_addr & 0x03) | 340 | if (sg_addr & 0x03) |
340 | ata_port_printk(qc->ap, KERN_ERR, | 341 | ata_port_printk(qc->ap, KERN_ERR, |
341 | "s/g addr unaligned : 0x%x\n", sg_addr); | 342 | "s/g addr unaligned : 0x%llx\n", |
343 | (unsigned long long)sg_addr); | ||
342 | if (sg_len & 0x03) | 344 | if (sg_len & 0x03) |
343 | ata_port_printk(qc->ap, KERN_ERR, | 345 | ata_port_printk(qc->ap, KERN_ERR, |
344 | "s/g len unaligned : 0x%x\n", sg_len); | 346 | "s/g len unaligned : 0x%x\n", sg_len); |
@@ -387,7 +389,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc) | |||
387 | void __iomem *hcr_base = host_priv->hcr_base; | 389 | void __iomem *hcr_base = host_priv->hcr_base; |
388 | unsigned int tag = sata_fsl_tag(qc->tag, hcr_base); | 390 | unsigned int tag = sata_fsl_tag(qc->tag, hcr_base); |
389 | struct command_desc *cd; | 391 | struct command_desc *cd; |
390 | u32 desc_info = CMD_DESC_SNOOP_ENABLE; | 392 | u32 desc_info = CMD_DESC_RES | CMD_DESC_SNOOP_ENABLE; |
391 | u32 num_prde = 0; | 393 | u32 num_prde = 0; |
392 | u32 ttl_dwords = 0; | 394 | u32 ttl_dwords = 0; |
393 | dma_addr_t cd_paddr; | 395 | dma_addr_t cd_paddr; |
@@ -840,7 +842,7 @@ issue_srst: | |||
840 | 842 | ||
841 | /* device reset/SRST is a control register update FIS, uses tag0 */ | 843 | /* device reset/SRST is a control register update FIS, uses tag0 */ |
842 | sata_fsl_setup_cmd_hdr_entry(pp, 0, | 844 | sata_fsl_setup_cmd_hdr_entry(pp, 0, |
843 | SRST_CMD | CMD_DESC_SNOOP_ENABLE, 0, 0, 5); | 845 | SRST_CMD | CMD_DESC_RES | CMD_DESC_SNOOP_ENABLE, 0, 0, 5); |
844 | 846 | ||
845 | tf.ctl |= ATA_SRST; /* setup SRST bit in taskfile control reg */ | 847 | tf.ctl |= ATA_SRST; /* setup SRST bit in taskfile control reg */ |
846 | ata_tf_to_fis(&tf, pmp, 0, cfis); | 848 | ata_tf_to_fis(&tf, pmp, 0, cfis); |
@@ -886,7 +888,8 @@ issue_srst: | |||
886 | * using ATA signature D2H register FIS to the host controller. | 888 | * using ATA signature D2H register FIS to the host controller. |
887 | */ | 889 | */ |
888 | 890 | ||
889 | sata_fsl_setup_cmd_hdr_entry(pp, 0, CMD_DESC_SNOOP_ENABLE, 0, 0, 5); | 891 | sata_fsl_setup_cmd_hdr_entry(pp, 0, CMD_DESC_RES | CMD_DESC_SNOOP_ENABLE, |
892 | 0, 0, 5); | ||
890 | 893 | ||
891 | tf.ctl &= ~ATA_SRST; /* 2nd H2D Ctl. register FIS */ | 894 | tf.ctl &= ~ATA_SRST; /* 2nd H2D Ctl. register FIS */ |
892 | ata_tf_to_fis(&tf, pmp, 0, cfis); | 895 | ata_tf_to_fis(&tf, pmp, 0, cfis); |
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c index dce3dccced3f..eb05a3c82a9e 100644 --- a/drivers/ata/sata_sx4.c +++ b/drivers/ata/sata_sx4.c | |||
@@ -213,8 +213,9 @@ struct pdc_host_priv { | |||
213 | 213 | ||
214 | 214 | ||
215 | static int pdc_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); | 215 | static int pdc_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
216 | static void pdc_eng_timeout(struct ata_port *ap); | 216 | static void pdc_error_handler(struct ata_port *ap); |
217 | static void pdc_20621_phy_reset(struct ata_port *ap); | 217 | static void pdc_freeze(struct ata_port *ap); |
218 | static void pdc_thaw(struct ata_port *ap); | ||
218 | static int pdc_port_start(struct ata_port *ap); | 219 | static int pdc_port_start(struct ata_port *ap); |
219 | static void pdc20621_qc_prep(struct ata_queued_cmd *qc); | 220 | static void pdc20621_qc_prep(struct ata_queued_cmd *qc); |
220 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); | 221 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
@@ -233,6 +234,10 @@ static void pdc20621_put_to_dimm(struct ata_host *host, | |||
233 | void *psource, u32 offset, u32 size); | 234 | void *psource, u32 offset, u32 size); |
234 | static void pdc20621_irq_clear(struct ata_port *ap); | 235 | static void pdc20621_irq_clear(struct ata_port *ap); |
235 | static unsigned int pdc20621_qc_issue(struct ata_queued_cmd *qc); | 236 | static unsigned int pdc20621_qc_issue(struct ata_queued_cmd *qc); |
237 | static int pdc_softreset(struct ata_link *link, unsigned int *class, | ||
238 | unsigned long deadline); | ||
239 | static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); | ||
240 | static int pdc_check_atapi_dma(struct ata_queued_cmd *qc); | ||
236 | 241 | ||
237 | 242 | ||
238 | static struct scsi_host_template pdc_sata_sht = { | 243 | static struct scsi_host_template pdc_sata_sht = { |
@@ -243,20 +248,24 @@ static struct scsi_host_template pdc_sata_sht = { | |||
243 | 248 | ||
244 | /* TODO: inherit from base port_ops after converting to new EH */ | 249 | /* TODO: inherit from base port_ops after converting to new EH */ |
245 | static struct ata_port_operations pdc_20621_ops = { | 250 | static struct ata_port_operations pdc_20621_ops = { |
246 | .sff_tf_load = pdc_tf_load_mmio, | 251 | .inherits = &ata_sff_port_ops, |
247 | .sff_tf_read = ata_sff_tf_read, | 252 | |
248 | .sff_check_status = ata_sff_check_status, | 253 | .check_atapi_dma = pdc_check_atapi_dma, |
249 | .sff_exec_command = pdc_exec_command_mmio, | ||
250 | .sff_dev_select = ata_sff_dev_select, | ||
251 | .phy_reset = pdc_20621_phy_reset, | ||
252 | .qc_prep = pdc20621_qc_prep, | 254 | .qc_prep = pdc20621_qc_prep, |
253 | .qc_issue = pdc20621_qc_issue, | 255 | .qc_issue = pdc20621_qc_issue, |
254 | .qc_fill_rtf = ata_sff_qc_fill_rtf, | 256 | |
255 | .sff_data_xfer = ata_sff_data_xfer, | 257 | .freeze = pdc_freeze, |
256 | .eng_timeout = pdc_eng_timeout, | 258 | .thaw = pdc_thaw, |
257 | .sff_irq_clear = pdc20621_irq_clear, | 259 | .softreset = pdc_softreset, |
258 | .sff_irq_on = ata_sff_irq_on, | 260 | .error_handler = pdc_error_handler, |
261 | .lost_interrupt = ATA_OP_NULL, | ||
262 | .post_internal_cmd = pdc_post_internal_cmd, | ||
263 | |||
259 | .port_start = pdc_port_start, | 264 | .port_start = pdc_port_start, |
265 | |||
266 | .sff_tf_load = pdc_tf_load_mmio, | ||
267 | .sff_exec_command = pdc_exec_command_mmio, | ||
268 | .sff_irq_clear = pdc20621_irq_clear, | ||
260 | }; | 269 | }; |
261 | 270 | ||
262 | static const struct ata_port_info pdc_port_info[] = { | 271 | static const struct ata_port_info pdc_port_info[] = { |
@@ -310,14 +319,6 @@ static int pdc_port_start(struct ata_port *ap) | |||
310 | return 0; | 319 | return 0; |
311 | } | 320 | } |
312 | 321 | ||
313 | static void pdc_20621_phy_reset(struct ata_port *ap) | ||
314 | { | ||
315 | VPRINTK("ENTER\n"); | ||
316 | ap->cbl = ATA_CBL_SATA; | ||
317 | ata_port_probe(ap); | ||
318 | ata_bus_reset(ap); | ||
319 | } | ||
320 | |||
321 | static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf, | 322 | static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf, |
322 | unsigned int portno, | 323 | unsigned int portno, |
323 | unsigned int total_len) | 324 | unsigned int total_len) |
@@ -686,8 +687,11 @@ static void pdc20621_packet_start(struct ata_queued_cmd *qc) | |||
686 | static unsigned int pdc20621_qc_issue(struct ata_queued_cmd *qc) | 687 | static unsigned int pdc20621_qc_issue(struct ata_queued_cmd *qc) |
687 | { | 688 | { |
688 | switch (qc->tf.protocol) { | 689 | switch (qc->tf.protocol) { |
689 | case ATA_PROT_DMA: | ||
690 | case ATA_PROT_NODATA: | 690 | case ATA_PROT_NODATA: |
691 | if (qc->tf.flags & ATA_TFLAG_POLLING) | ||
692 | break; | ||
693 | /*FALLTHROUGH*/ | ||
694 | case ATA_PROT_DMA: | ||
691 | pdc20621_packet_start(qc); | 695 | pdc20621_packet_start(qc); |
692 | return 0; | 696 | return 0; |
693 | 697 | ||
@@ -786,12 +790,7 @@ static inline unsigned int pdc20621_host_intr(struct ata_port *ap, | |||
786 | 790 | ||
787 | static void pdc20621_irq_clear(struct ata_port *ap) | 791 | static void pdc20621_irq_clear(struct ata_port *ap) |
788 | { | 792 | { |
789 | struct ata_host *host = ap->host; | 793 | ioread8(ap->ioaddr.status_addr); |
790 | void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; | ||
791 | |||
792 | mmio += PDC_CHIP0_OFS; | ||
793 | |||
794 | readl(mmio + PDC_20621_SEQMASK); | ||
795 | } | 794 | } |
796 | 795 | ||
797 | static irqreturn_t pdc20621_interrupt(int irq, void *dev_instance) | 796 | static irqreturn_t pdc20621_interrupt(int irq, void *dev_instance) |
@@ -859,46 +858,119 @@ static irqreturn_t pdc20621_interrupt(int irq, void *dev_instance) | |||
859 | return IRQ_RETVAL(handled); | 858 | return IRQ_RETVAL(handled); |
860 | } | 859 | } |
861 | 860 | ||
862 | static void pdc_eng_timeout(struct ata_port *ap) | 861 | static void pdc_freeze(struct ata_port *ap) |
863 | { | 862 | { |
864 | u8 drv_stat; | 863 | void __iomem *mmio = ap->ioaddr.cmd_addr; |
865 | struct ata_host *host = ap->host; | 864 | u32 tmp; |
866 | struct ata_queued_cmd *qc; | ||
867 | unsigned long flags; | ||
868 | 865 | ||
869 | DPRINTK("ENTER\n"); | 866 | /* FIXME: if all 4 ATA engines are stopped, also stop HDMA engine */ |
870 | 867 | ||
871 | spin_lock_irqsave(&host->lock, flags); | 868 | tmp = readl(mmio + PDC_CTLSTAT); |
869 | tmp |= PDC_MASK_INT; | ||
870 | tmp &= ~PDC_DMA_ENABLE; | ||
871 | writel(tmp, mmio + PDC_CTLSTAT); | ||
872 | readl(mmio + PDC_CTLSTAT); /* flush */ | ||
873 | } | ||
872 | 874 | ||
873 | qc = ata_qc_from_tag(ap, ap->link.active_tag); | 875 | static void pdc_thaw(struct ata_port *ap) |
876 | { | ||
877 | void __iomem *mmio = ap->ioaddr.cmd_addr; | ||
878 | u32 tmp; | ||
874 | 879 | ||
875 | switch (qc->tf.protocol) { | 880 | /* FIXME: start HDMA engine, if zero ATA engines running */ |
876 | case ATA_PROT_DMA: | ||
877 | case ATA_PROT_NODATA: | ||
878 | ata_port_printk(ap, KERN_ERR, "command timeout\n"); | ||
879 | qc->err_mask |= __ac_err_mask(ata_wait_idle(ap)); | ||
880 | break; | ||
881 | 881 | ||
882 | default: | 882 | /* clear IRQ */ |
883 | drv_stat = ata_sff_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); | 883 | ioread8(ap->ioaddr.status_addr); |
884 | 884 | ||
885 | ata_port_printk(ap, KERN_ERR, | 885 | /* turn IRQ back on */ |
886 | "unknown timeout, cmd 0x%x stat 0x%x\n", | 886 | tmp = readl(mmio + PDC_CTLSTAT); |
887 | qc->tf.command, drv_stat); | 887 | tmp &= ~PDC_MASK_INT; |
888 | writel(tmp, mmio + PDC_CTLSTAT); | ||
889 | readl(mmio + PDC_CTLSTAT); /* flush */ | ||
890 | } | ||
888 | 891 | ||
889 | qc->err_mask |= ac_err_mask(drv_stat); | 892 | static void pdc_reset_port(struct ata_port *ap) |
890 | break; | 893 | { |
894 | void __iomem *mmio = ap->ioaddr.cmd_addr + PDC_CTLSTAT; | ||
895 | unsigned int i; | ||
896 | u32 tmp; | ||
897 | |||
898 | /* FIXME: handle HDMA copy engine */ | ||
899 | |||
900 | for (i = 11; i > 0; i--) { | ||
901 | tmp = readl(mmio); | ||
902 | if (tmp & PDC_RESET) | ||
903 | break; | ||
904 | |||
905 | udelay(100); | ||
906 | |||
907 | tmp |= PDC_RESET; | ||
908 | writel(tmp, mmio); | ||
891 | } | 909 | } |
892 | 910 | ||
893 | spin_unlock_irqrestore(&host->lock, flags); | 911 | tmp &= ~PDC_RESET; |
894 | ata_eh_qc_complete(qc); | 912 | writel(tmp, mmio); |
895 | DPRINTK("EXIT\n"); | 913 | readl(mmio); /* flush */ |
914 | } | ||
915 | |||
916 | static int pdc_softreset(struct ata_link *link, unsigned int *class, | ||
917 | unsigned long deadline) | ||
918 | { | ||
919 | pdc_reset_port(link->ap); | ||
920 | return ata_sff_softreset(link, class, deadline); | ||
921 | } | ||
922 | |||
923 | static void pdc_error_handler(struct ata_port *ap) | ||
924 | { | ||
925 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) | ||
926 | pdc_reset_port(ap); | ||
927 | |||
928 | ata_std_error_handler(ap); | ||
929 | } | ||
930 | |||
931 | static void pdc_post_internal_cmd(struct ata_queued_cmd *qc) | ||
932 | { | ||
933 | struct ata_port *ap = qc->ap; | ||
934 | |||
935 | /* make DMA engine forget about the failed command */ | ||
936 | if (qc->flags & ATA_QCFLAG_FAILED) | ||
937 | pdc_reset_port(ap); | ||
938 | } | ||
939 | |||
940 | static int pdc_check_atapi_dma(struct ata_queued_cmd *qc) | ||
941 | { | ||
942 | u8 *scsicmd = qc->scsicmd->cmnd; | ||
943 | int pio = 1; /* atapi dma off by default */ | ||
944 | |||
945 | /* Whitelist commands that may use DMA. */ | ||
946 | switch (scsicmd[0]) { | ||
947 | case WRITE_12: | ||
948 | case WRITE_10: | ||
949 | case WRITE_6: | ||
950 | case READ_12: | ||
951 | case READ_10: | ||
952 | case READ_6: | ||
953 | case 0xad: /* READ_DVD_STRUCTURE */ | ||
954 | case 0xbe: /* READ_CD */ | ||
955 | pio = 0; | ||
956 | } | ||
957 | /* -45150 (FFFF4FA2) to -1 (FFFFFFFF) shall use PIO mode */ | ||
958 | if (scsicmd[0] == WRITE_10) { | ||
959 | unsigned int lba = | ||
960 | (scsicmd[2] << 24) | | ||
961 | (scsicmd[3] << 16) | | ||
962 | (scsicmd[4] << 8) | | ||
963 | scsicmd[5]; | ||
964 | if (lba >= 0xFFFF4FA2) | ||
965 | pio = 1; | ||
966 | } | ||
967 | return pio; | ||
896 | } | 968 | } |
897 | 969 | ||
898 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) | 970 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) |
899 | { | 971 | { |
900 | WARN_ON(tf->protocol == ATA_PROT_DMA || | 972 | WARN_ON(tf->protocol == ATA_PROT_DMA || |
901 | tf->protocol == ATA_PROT_NODATA); | 973 | tf->protocol == ATAPI_PROT_DMA); |
902 | ata_sff_tf_load(ap, tf); | 974 | ata_sff_tf_load(ap, tf); |
903 | } | 975 | } |
904 | 976 | ||
@@ -906,7 +978,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) | |||
906 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) | 978 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) |
907 | { | 979 | { |
908 | WARN_ON(tf->protocol == ATA_PROT_DMA || | 980 | WARN_ON(tf->protocol == ATA_PROT_DMA || |
909 | tf->protocol == ATA_PROT_NODATA); | 981 | tf->protocol == ATAPI_PROT_DMA); |
910 | ata_sff_exec_command(ap, tf); | 982 | ata_sff_exec_command(ap, tf); |
911 | } | 983 | } |
912 | 984 | ||
diff --git a/include/linux/ata.h b/include/linux/ata.h index cb79b7a208e1..915da43edee1 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -730,6 +730,34 @@ static inline int ata_id_has_unload(const u16 *id) | |||
730 | return 0; | 730 | return 0; |
731 | } | 731 | } |
732 | 732 | ||
733 | static inline int ata_id_form_factor(const u16 *id) | ||
734 | { | ||
735 | u16 val = id[168]; | ||
736 | |||
737 | if (ata_id_major_version(id) < 7 || val == 0 || val == 0xffff) | ||
738 | return 0; | ||
739 | |||
740 | val &= 0xf; | ||
741 | |||
742 | if (val > 5) | ||
743 | return 0; | ||
744 | |||
745 | return val; | ||
746 | } | ||
747 | |||
748 | static inline int ata_id_rotation_rate(const u16 *id) | ||
749 | { | ||
750 | u16 val = id[217]; | ||
751 | |||
752 | if (ata_id_major_version(id) < 7 || val == 0 || val == 0xffff) | ||
753 | return 0; | ||
754 | |||
755 | if (val > 1 && val < 0x401) | ||
756 | return 0; | ||
757 | |||
758 | return val; | ||
759 | } | ||
760 | |||
733 | static inline int ata_id_has_trim(const u16 *id) | 761 | static inline int ata_id_has_trim(const u16 *id) |
734 | { | 762 | { |
735 | if (ata_id_major_version(id) >= 7 && | 763 | if (ata_id_major_version(id) >= 7 && |