diff options
-rw-r--r-- | drivers/ata/libata-core.c | 29 | ||||
-rw-r--r-- | include/linux/libata.h | 46 |
2 files changed, 40 insertions, 35 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index ab84772235c..71159539099 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -454,8 +454,9 @@ int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, | |||
454 | * RETURNS: | 454 | * RETURNS: |
455 | * Packed xfer_mask. | 455 | * Packed xfer_mask. |
456 | */ | 456 | */ |
457 | unsigned int ata_pack_xfermask(unsigned int pio_mask, | 457 | unsigned long ata_pack_xfermask(unsigned long pio_mask, |
458 | unsigned int mwdma_mask, unsigned int udma_mask) | 458 | unsigned long mwdma_mask, |
459 | unsigned long udma_mask) | ||
459 | { | 460 | { |
460 | return ((pio_mask << ATA_SHIFT_PIO) & ATA_MASK_PIO) | | 461 | return ((pio_mask << ATA_SHIFT_PIO) & ATA_MASK_PIO) | |
461 | ((mwdma_mask << ATA_SHIFT_MWDMA) & ATA_MASK_MWDMA) | | 462 | ((mwdma_mask << ATA_SHIFT_MWDMA) & ATA_MASK_MWDMA) | |
@@ -472,8 +473,8 @@ unsigned int ata_pack_xfermask(unsigned int pio_mask, | |||
472 | * Unpack @xfer_mask into @pio_mask, @mwdma_mask and @udma_mask. | 473 | * Unpack @xfer_mask into @pio_mask, @mwdma_mask and @udma_mask. |
473 | * Any NULL distination masks will be ignored. | 474 | * Any NULL distination masks will be ignored. |
474 | */ | 475 | */ |
475 | void ata_unpack_xfermask(unsigned int xfer_mask, unsigned int *pio_mask, | 476 | void ata_unpack_xfermask(unsigned long xfer_mask, unsigned long *pio_mask, |
476 | unsigned int *mwdma_mask, unsigned int *udma_mask) | 477 | unsigned long *mwdma_mask, unsigned long *udma_mask) |
477 | { | 478 | { |
478 | if (pio_mask) | 479 | if (pio_mask) |
479 | *pio_mask = (xfer_mask & ATA_MASK_PIO) >> ATA_SHIFT_PIO; | 480 | *pio_mask = (xfer_mask & ATA_MASK_PIO) >> ATA_SHIFT_PIO; |
@@ -506,7 +507,7 @@ static const struct ata_xfer_ent { | |||
506 | * RETURNS: | 507 | * RETURNS: |
507 | * Matching XFER_* value, 0xff if no match found. | 508 | * Matching XFER_* value, 0xff if no match found. |
508 | */ | 509 | */ |
509 | u8 ata_xfer_mask2mode(unsigned int xfer_mask) | 510 | u8 ata_xfer_mask2mode(unsigned long xfer_mask) |
510 | { | 511 | { |
511 | int highbit = fls(xfer_mask) - 1; | 512 | int highbit = fls(xfer_mask) - 1; |
512 | const struct ata_xfer_ent *ent; | 513 | const struct ata_xfer_ent *ent; |
@@ -529,7 +530,7 @@ u8 ata_xfer_mask2mode(unsigned int xfer_mask) | |||
529 | * RETURNS: | 530 | * RETURNS: |
530 | * Matching xfer_mask, 0 if no match found. | 531 | * Matching xfer_mask, 0 if no match found. |
531 | */ | 532 | */ |
532 | unsigned int ata_xfer_mode2mask(u8 xfer_mode) | 533 | unsigned long ata_xfer_mode2mask(u8 xfer_mode) |
533 | { | 534 | { |
534 | const struct ata_xfer_ent *ent; | 535 | const struct ata_xfer_ent *ent; |
535 | 536 | ||
@@ -552,7 +553,7 @@ unsigned int ata_xfer_mode2mask(u8 xfer_mode) | |||
552 | * RETURNS: | 553 | * RETURNS: |
553 | * Matching xfer_shift, -1 if no match found. | 554 | * Matching xfer_shift, -1 if no match found. |
554 | */ | 555 | */ |
555 | int ata_xfer_mode2shift(unsigned int xfer_mode) | 556 | int ata_xfer_mode2shift(unsigned long xfer_mode) |
556 | { | 557 | { |
557 | const struct ata_xfer_ent *ent; | 558 | const struct ata_xfer_ent *ent; |
558 | 559 | ||
@@ -576,7 +577,7 @@ int ata_xfer_mode2shift(unsigned int xfer_mode) | |||
576 | * Constant C string representing highest speed listed in | 577 | * Constant C string representing highest speed listed in |
577 | * @mode_mask, or the constant C string "<n/a>". | 578 | * @mode_mask, or the constant C string "<n/a>". |
578 | */ | 579 | */ |
579 | const char *ata_mode_string(unsigned int xfer_mask) | 580 | const char *ata_mode_string(unsigned long xfer_mask) |
580 | { | 581 | { |
581 | static const char * const xfer_mode_str[] = { | 582 | static const char * const xfer_mode_str[] = { |
582 | "PIO0", | 583 | "PIO0", |
@@ -1424,9 +1425,9 @@ static inline void ata_dump_id(const u16 *id) | |||
1424 | * RETURNS: | 1425 | * RETURNS: |
1425 | * Computed xfermask | 1426 | * Computed xfermask |
1426 | */ | 1427 | */ |
1427 | unsigned int ata_id_xfermask(const u16 *id) | 1428 | unsigned long ata_id_xfermask(const u16 *id) |
1428 | { | 1429 | { |
1429 | unsigned int pio_mask, mwdma_mask, udma_mask; | 1430 | unsigned long pio_mask, mwdma_mask, udma_mask; |
1430 | 1431 | ||
1431 | /* Usual case. Word 53 indicates word 64 is valid */ | 1432 | /* Usual case. Word 53 indicates word 64 is valid */ |
1432 | if (id[ATA_ID_FIELD_VALID] & (1 << 1)) { | 1433 | if (id[ATA_ID_FIELD_VALID] & (1 << 1)) { |
@@ -2050,7 +2051,7 @@ int ata_dev_configure(struct ata_device *dev) | |||
2050 | struct ata_eh_context *ehc = &dev->link->eh_context; | 2051 | struct ata_eh_context *ehc = &dev->link->eh_context; |
2051 | int print_info = ehc->i.flags & ATA_EHI_PRINTINFO; | 2052 | int print_info = ehc->i.flags & ATA_EHI_PRINTINFO; |
2052 | const u16 *id = dev->id; | 2053 | const u16 *id = dev->id; |
2053 | unsigned int xfer_mask; | 2054 | unsigned long xfer_mask; |
2054 | char revbuf[7]; /* XYZ-99\0 */ | 2055 | char revbuf[7]; /* XYZ-99\0 */ |
2055 | char fwrevbuf[ATA_ID_FW_REV_LEN+1]; | 2056 | char fwrevbuf[ATA_ID_FW_REV_LEN+1]; |
2056 | char modelbuf[ATA_ID_PROD_LEN+1]; | 2057 | char modelbuf[ATA_ID_PROD_LEN+1]; |
@@ -2907,8 +2908,8 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed, | |||
2907 | int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel) | 2908 | int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel) |
2908 | { | 2909 | { |
2909 | char buf[32]; | 2910 | char buf[32]; |
2910 | unsigned int orig_mask, xfer_mask; | 2911 | unsigned long orig_mask, xfer_mask; |
2911 | unsigned int pio_mask, mwdma_mask, udma_mask; | 2912 | unsigned long pio_mask, mwdma_mask, udma_mask; |
2912 | int quiet, highbit; | 2913 | int quiet, highbit; |
2913 | 2914 | ||
2914 | quiet = !!(sel & ATA_DNXFER_QUIET); | 2915 | quiet = !!(sel & ATA_DNXFER_QUIET); |
@@ -3052,7 +3053,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
3052 | 3053 | ||
3053 | /* step 1: calculate xfer_mask */ | 3054 | /* step 1: calculate xfer_mask */ |
3054 | ata_link_for_each_dev(dev, link) { | 3055 | ata_link_for_each_dev(dev, link) { |
3055 | unsigned int pio_mask, dma_mask; | 3056 | unsigned long pio_mask, dma_mask; |
3056 | unsigned int mode_mask; | 3057 | unsigned int mode_mask; |
3057 | 3058 | ||
3058 | if (!ata_dev_enabled(dev)) | 3059 | if (!ata_dev_enabled(dev)) |
diff --git a/include/linux/libata.h b/include/linux/libata.h index d33702fe78f..d9eb20c67bb 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -267,7 +267,7 @@ enum { | |||
267 | PORT_DISABLED = 2, | 267 | PORT_DISABLED = 2, |
268 | 268 | ||
269 | /* encoding various smaller bitmaps into a single | 269 | /* encoding various smaller bitmaps into a single |
270 | * unsigned int bitmap | 270 | * unsigned long bitmap |
271 | */ | 271 | */ |
272 | ATA_NR_PIO_MODES = 7, | 272 | ATA_NR_PIO_MODES = 7, |
273 | ATA_NR_MWDMA_MODES = 5, | 273 | ATA_NR_MWDMA_MODES = 5, |
@@ -277,13 +277,6 @@ enum { | |||
277 | ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_NR_PIO_MODES, | 277 | ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_NR_PIO_MODES, |
278 | ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_NR_MWDMA_MODES, | 278 | ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_NR_MWDMA_MODES, |
279 | 279 | ||
280 | ATA_MASK_PIO = ((1 << ATA_NR_PIO_MODES) - 1) | ||
281 | << ATA_SHIFT_PIO, | ||
282 | ATA_MASK_MWDMA = ((1 << ATA_NR_MWDMA_MODES) - 1) | ||
283 | << ATA_SHIFT_MWDMA, | ||
284 | ATA_MASK_UDMA = ((1 << ATA_NR_UDMA_MODES) - 1) | ||
285 | << ATA_SHIFT_UDMA, | ||
286 | |||
287 | /* size of buffer to pad xfers ending on unaligned boundaries */ | 280 | /* size of buffer to pad xfers ending on unaligned boundaries */ |
288 | ATA_DMA_PAD_SZ = 4, | 281 | ATA_DMA_PAD_SZ = 4, |
289 | ATA_DMA_PAD_BUF_SZ = ATA_DMA_PAD_SZ * ATA_MAX_QUEUE, | 282 | ATA_DMA_PAD_BUF_SZ = ATA_DMA_PAD_SZ * ATA_MAX_QUEUE, |
@@ -355,6 +348,15 @@ enum { | |||
355 | ATA_DMA_MASK_CFA = (1 << 2), /* DMA on CF Card */ | 348 | ATA_DMA_MASK_CFA = (1 << 2), /* DMA on CF Card */ |
356 | }; | 349 | }; |
357 | 350 | ||
351 | enum ata_xfer_mask { | ||
352 | ATA_MASK_PIO = ((1LU << ATA_NR_PIO_MODES) - 1) | ||
353 | << ATA_SHIFT_PIO, | ||
354 | ATA_MASK_MWDMA = ((1LU << ATA_NR_MWDMA_MODES) - 1) | ||
355 | << ATA_SHIFT_MWDMA, | ||
356 | ATA_MASK_UDMA = ((1LU << ATA_NR_UDMA_MODES) - 1) | ||
357 | << ATA_SHIFT_UDMA, | ||
358 | }; | ||
359 | |||
358 | enum hsm_task_states { | 360 | enum hsm_task_states { |
359 | HSM_ST_IDLE, /* no command on going */ | 361 | HSM_ST_IDLE, /* no command on going */ |
360 | HSM_ST_FIRST, /* (waiting the device to) | 362 | HSM_ST_FIRST, /* (waiting the device to) |
@@ -526,9 +528,9 @@ struct ata_device { | |||
526 | unsigned int cdb_len; | 528 | unsigned int cdb_len; |
527 | 529 | ||
528 | /* per-dev xfer mask */ | 530 | /* per-dev xfer mask */ |
529 | unsigned int pio_mask; | 531 | unsigned long pio_mask; |
530 | unsigned int mwdma_mask; | 532 | unsigned long mwdma_mask; |
531 | unsigned int udma_mask; | 533 | unsigned long udma_mask; |
532 | 534 | ||
533 | /* for CHS addressing */ | 535 | /* for CHS addressing */ |
534 | u16 cylinders; /* Number of cylinders */ | 536 | u16 cylinders; /* Number of cylinders */ |
@@ -854,15 +856,16 @@ extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | |||
854 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, | 856 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, |
855 | u8 pmp, int is_cmd, u8 *fis); | 857 | u8 pmp, int is_cmd, u8 *fis); |
856 | extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); | 858 | extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); |
857 | extern unsigned int ata_pack_xfermask(unsigned int pio_mask, | 859 | extern unsigned long ata_pack_xfermask(unsigned long pio_mask, |
858 | unsigned int mwdma_mask, unsigned int udma_mask); | 860 | unsigned long mwdma_mask, unsigned long udma_mask); |
859 | extern void ata_unpack_xfermask(unsigned int xfer_mask, unsigned int *pio_mask, | 861 | extern void ata_unpack_xfermask(unsigned long xfer_mask, |
860 | unsigned int *mwdma_mask, unsigned int *udma_mask); | 862 | unsigned long *pio_mask, unsigned long *mwdma_mask, |
861 | extern u8 ata_xfer_mask2mode(unsigned int xfer_mask); | 863 | unsigned long *udma_mask); |
862 | extern unsigned int ata_xfer_mode2mask(u8 xfer_mode); | 864 | extern u8 ata_xfer_mask2mode(unsigned long xfer_mask); |
863 | extern int ata_xfer_mode2shift(unsigned int xfer_mode); | 865 | extern unsigned long ata_xfer_mode2mask(u8 xfer_mode); |
864 | extern const char *ata_mode_string(unsigned int xfer_mask); | 866 | extern int ata_xfer_mode2shift(unsigned long xfer_mode); |
865 | extern unsigned int ata_id_xfermask(const u16 *id); | 867 | extern const char *ata_mode_string(unsigned long xfer_mask); |
868 | extern unsigned long ata_id_xfermask(const u16 *id); | ||
866 | extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device); | 869 | extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device); |
867 | extern void ata_std_dev_select(struct ata_port *ap, unsigned int device); | 870 | extern void ata_std_dev_select(struct ata_port *ap, unsigned int device); |
868 | extern u8 ata_check_status(struct ata_port *ap); | 871 | extern u8 ata_check_status(struct ata_port *ap); |
@@ -1001,7 +1004,8 @@ extern int ata_pci_prepare_sff_host(struct pci_dev *pdev, | |||
1001 | const struct ata_port_info * const * ppi, | 1004 | const struct ata_port_info * const * ppi, |
1002 | struct ata_host **r_host); | 1005 | struct ata_host **r_host); |
1003 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); | 1006 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); |
1004 | extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long); | 1007 | extern unsigned long ata_pci_default_filter(struct ata_device *dev, |
1008 | unsigned long xfer_mask); | ||
1005 | #endif /* CONFIG_PCI */ | 1009 | #endif /* CONFIG_PCI */ |
1006 | 1010 | ||
1007 | /* | 1011 | /* |