aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-08 11:18:01 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-08 11:18:01 -0500
commit23eb3b64b5e44680c867e165fe1cd18e57fba255 (patch)
treed6aed2971ef647f7be2986353f830577abd1fab9 /include
parent1c496784a0d317535f846ddb2c93a08ba936266b (diff)
parent1b52f2a41c41052d2a7c78af0bd9b8b11d70f49a (diff)
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: (54 commits) Revert "pata_sis: Implement MWDMA for the UDMA 133 capable chips" libata: Clarify ata_set_lba_range_entries function libata: Report zeroed read after TRIM and max discard size pata_hpt3x2n: fix overclocked MWDMA0 timing pata_it8213: MWDMA0 is unsupported [libata] MWDMA0 is unsupported on PIIX-like PATA controllers pata_via: clear UDMA transfer mode bit for PIO and MWDMA pata_sis: Power Management fix pata_rz1000: Power Management fix pata_radisys: fix UDMA handling pata_ns87415: Power Management fix pata_marvell: fix marvell_pre_reset() documentation pata_legacy: add pointers to QDI65x0 documentation pata_legacy: fix access to control register for QDI6580 pata_legacy: fix QDI6580DP support pata_it8213: fix it8213_pre_reset() documentation pata_it8213: fix wrong MWDMA timings being programmed pata_it8213: fix PIO2 underclocking pata_it8213: fix wrong PIO timings being programmed pata_it8213: fix UDMA handling ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/ata.h44
-rw-r--r--include/linux/libata.h3
-rw-r--r--include/linux/pci_ids.h7
3 files changed, 40 insertions, 14 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 4fb357312b3b..38a6948ce0c2 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -75,6 +75,7 @@ enum {
75 ATA_ID_EIDE_DMA_TIME = 66, 75 ATA_ID_EIDE_DMA_TIME = 66,
76 ATA_ID_EIDE_PIO = 67, 76 ATA_ID_EIDE_PIO = 67,
77 ATA_ID_EIDE_PIO_IORDY = 68, 77 ATA_ID_EIDE_PIO_IORDY = 68,
78 ATA_ID_ADDITIONAL_SUPP = 69,
78 ATA_ID_QUEUE_DEPTH = 75, 79 ATA_ID_QUEUE_DEPTH = 75,
79 ATA_ID_MAJOR_VER = 80, 80 ATA_ID_MAJOR_VER = 80,
80 ATA_ID_COMMAND_SET_1 = 82, 81 ATA_ID_COMMAND_SET_1 = 82,
@@ -87,6 +88,7 @@ enum {
87 ATA_ID_HW_CONFIG = 93, 88 ATA_ID_HW_CONFIG = 93,
88 ATA_ID_SPG = 98, 89 ATA_ID_SPG = 98,
89 ATA_ID_LBA_CAPACITY_2 = 100, 90 ATA_ID_LBA_CAPACITY_2 = 100,
91 ATA_ID_SECTOR_SIZE = 106,
90 ATA_ID_LAST_LUN = 126, 92 ATA_ID_LAST_LUN = 126,
91 ATA_ID_DLF = 128, 93 ATA_ID_DLF = 128,
92 ATA_ID_CSFO = 129, 94 ATA_ID_CSFO = 129,
@@ -638,6 +640,18 @@ static inline int ata_id_flush_ext_enabled(const u16 *id)
638 return (id[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400; 640 return (id[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400;
639} 641}
640 642
643static inline int ata_id_has_large_logical_sectors(const u16 *id)
644{
645 if ((id[ATA_ID_SECTOR_SIZE] & 0xc000) != 0x4000)
646 return 0;
647 return id[ATA_ID_SECTOR_SIZE] & (1 << 13);
648}
649
650static inline u8 ata_id_logical_per_physical_sectors(const u16 *id)
651{
652 return id[ATA_ID_SECTOR_SIZE] & 0xf;
653}
654
641static inline int ata_id_has_lba48(const u16 *id) 655static inline int ata_id_has_lba48(const u16 *id)
642{ 656{
643 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) 657 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
@@ -803,6 +817,16 @@ static inline int ata_id_has_trim(const u16 *id)
803 return 0; 817 return 0;
804} 818}
805 819
820static inline int ata_id_has_zero_after_trim(const u16 *id)
821{
822 /* DSM supported, deterministic read, and read zero after trim set */
823 if (ata_id_has_trim(id) &&
824 (id[ATA_ID_ADDITIONAL_SUPP] & 0x4020) == 0x4020)
825 return 1;
826
827 return 0;
828}
829
806static inline int ata_id_current_chs_valid(const u16 *id) 830static inline int ata_id_current_chs_valid(const u16 *id)
807{ 831{
808 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 832 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
@@ -958,17 +982,17 @@ static inline void ata_id_to_hd_driveid(u16 *id)
958} 982}
959 983
960/* 984/*
961 * Write up to 'max' LBA Range Entries to the buffer that will cover the 985 * Write LBA Range Entries to the buffer that will cover the extent from
962 * extent from sector to sector + count. This is used for TRIM and for 986 * sector to sector + count. This is used for TRIM and for ADD LBA(S)
963 * ADD LBA(S) TO NV CACHE PINNED SET. 987 * TO NV CACHE PINNED SET.
964 */ 988 */
965static inline unsigned ata_set_lba_range_entries(void *_buffer, unsigned max, 989static inline unsigned ata_set_lba_range_entries(void *_buffer,
966 u64 sector, unsigned long count) 990 unsigned buf_size, u64 sector, unsigned long count)
967{ 991{
968 __le64 *buffer = _buffer; 992 __le64 *buffer = _buffer;
969 unsigned i = 0; 993 unsigned i = 0, used_bytes;
970 994
971 while (i < max) { 995 while (i < buf_size / 8 ) { /* 6-byte LBA + 2-byte range per entry */
972 u64 entry = sector | 996 u64 entry = sector |
973 ((u64)(count > 0xffff ? 0xffff : count) << 48); 997 ((u64)(count > 0xffff ? 0xffff : count) << 48);
974 buffer[i++] = __cpu_to_le64(entry); 998 buffer[i++] = __cpu_to_le64(entry);
@@ -978,9 +1002,9 @@ static inline unsigned ata_set_lba_range_entries(void *_buffer, unsigned max,
978 sector += 0xffff; 1002 sector += 0xffff;
979 } 1003 }
980 1004
981 max = ALIGN(i * 8, 512); 1005 used_bytes = ALIGN(i * 8, 512);
982 memset(buffer + i, 0, max - i * 8); 1006 memset(buffer + i, 0, used_bytes - i * 8);
983 return max; 1007 return used_bytes;
984} 1008}
985 1009
986static inline int is_multi_taskfile(struct ata_taskfile *tf) 1010static inline int is_multi_taskfile(struct ata_taskfile *tf)
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 87698640c091..a5b3dc71e819 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -365,7 +365,7 @@ enum {
365 /* This should match the actual table size of 365 /* This should match the actual table size of
366 * ata_eh_cmd_timeout_table in libata-eh.c. 366 * ata_eh_cmd_timeout_table in libata-eh.c.
367 */ 367 */
368 ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 5, 368 ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 6,
369 369
370 /* Horkage types. May be set by libata or controller on drives 370 /* Horkage types. May be set by libata or controller on drives
371 (some horkage may be drive/controller pair dependant */ 371 (some horkage may be drive/controller pair dependant */
@@ -595,6 +595,7 @@ struct ata_device {
595 unsigned int horkage; /* List of broken features */ 595 unsigned int horkage; /* List of broken features */
596 unsigned long flags; /* ATA_DFLAG_xxx */ 596 unsigned long flags; /* ATA_DFLAG_xxx */
597 struct scsi_device *sdev; /* attached SCSI device */ 597 struct scsi_device *sdev; /* attached SCSI device */
598 void *private_data;
598#ifdef CONFIG_ATA_ACPI 599#ifdef CONFIG_ATA_ACPI
599 acpi_handle acpi_handle; 600 acpi_handle acpi_handle;
600 union acpi_object *gtf_cache; 601 union acpi_object *gtf_cache;
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index daecca3c8300..cabf074b4324 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1496,9 +1496,10 @@
1496#define PCI_DEVICE_ID_SBE_WANXL400 0x0104 1496#define PCI_DEVICE_ID_SBE_WANXL400 0x0104
1497 1497
1498#define PCI_VENDOR_ID_TOSHIBA 0x1179 1498#define PCI_VENDOR_ID_TOSHIBA 0x1179
1499#define PCI_DEVICE_ID_TOSHIBA_PICCOLO 0x0102 1499#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_1 0x0101
1500#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_1 0x0103 1500#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_2 0x0102
1501#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_2 0x0105 1501#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_3 0x0103
1502#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_5 0x0105
1502#define PCI_DEVICE_ID_TOSHIBA_TOPIC95 0x060a 1503#define PCI_DEVICE_ID_TOSHIBA_TOPIC95 0x060a
1503#define PCI_DEVICE_ID_TOSHIBA_TOPIC97 0x060f 1504#define PCI_DEVICE_ID_TOSHIBA_TOPIC97 0x060f
1504#define PCI_DEVICE_ID_TOSHIBA_TOPIC100 0x0617 1505#define PCI_DEVICE_ID_TOSHIBA_TOPIC100 0x0617