aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ata.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ata.h')
-rw-r--r--include/linux/ata.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 272736e37990..edb31bfff68f 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -40,6 +40,7 @@ enum {
40 ATA_MAX_DEVICES = 2, /* per bus/port */ 40 ATA_MAX_DEVICES = 2, /* per bus/port */
41 ATA_MAX_PRD = 256, /* we could make these 256/256 */ 41 ATA_MAX_PRD = 256, /* we could make these 256/256 */
42 ATA_SECT_SIZE = 512, 42 ATA_SECT_SIZE = 512,
43 ATA_MAX_SECTORS_128 = 128,
43 ATA_MAX_SECTORS = 256, 44 ATA_MAX_SECTORS = 256,
44 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ 45 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */
45 46
@@ -158,11 +159,19 @@ enum {
158 ATA_CMD_INIT_DEV_PARAMS = 0x91, 159 ATA_CMD_INIT_DEV_PARAMS = 0x91,
159 ATA_CMD_READ_NATIVE_MAX = 0xF8, 160 ATA_CMD_READ_NATIVE_MAX = 0xF8,
160 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27, 161 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
162 ATA_CMD_SET_MAX = 0xF9,
163 ATA_CMD_SET_MAX_EXT = 0x37,
161 ATA_CMD_READ_LOG_EXT = 0x2f, 164 ATA_CMD_READ_LOG_EXT = 0x2f,
162 165
163 /* READ_LOG_EXT pages */ 166 /* READ_LOG_EXT pages */
164 ATA_LOG_SATA_NCQ = 0x10, 167 ATA_LOG_SATA_NCQ = 0x10,
165 168
169 /* READ/WRITE LONG (obsolete) */
170 ATA_CMD_READ_LONG = 0x22,
171 ATA_CMD_READ_LONG_ONCE = 0x23,
172 ATA_CMD_WRITE_LONG = 0x32,
173 ATA_CMD_WRITE_LONG_ONCE = 0x33,
174
166 /* SETFEATURES stuff */ 175 /* SETFEATURES stuff */
167 SETFEATURES_XFER = 0x03, 176 SETFEATURES_XFER = 0x03,
168 XFER_UDMA_7 = 0x47, 177 XFER_UDMA_7 = 0x47,
@@ -193,6 +202,8 @@ enum {
193 SETFEATURES_WC_ON = 0x02, /* Enable write cache */ 202 SETFEATURES_WC_ON = 0x02, /* Enable write cache */
194 SETFEATURES_WC_OFF = 0x82, /* Disable write cache */ 203 SETFEATURES_WC_OFF = 0x82, /* Disable write cache */
195 204
205 SETFEATURES_SPINUP = 0x07, /* Spin-up drive */
206
196 /* ATAPI stuff */ 207 /* ATAPI stuff */
197 ATAPI_PKT_DMA = (1 << 0), 208 ATAPI_PKT_DMA = (1 << 0),
198 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir: 209 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir:
@@ -282,7 +293,6 @@ struct ata_taskfile {
282}; 293};
283 294
284#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) 295#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0)
285#define ata_id_is_sata(id) ((id)[93] == 0)
286#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) 296#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
287#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) 297#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
288#define ata_id_hpa_enabled(id) ((id)[85] & (1 << 10)) 298#define ata_id_hpa_enabled(id) ((id)[85] & (1 << 10))
@@ -324,6 +334,11 @@ static inline unsigned int ata_id_major_version(const u16 *id)
324 return mver; 334 return mver;
325} 335}
326 336
337static inline int ata_id_is_sata(const u16 *id)
338{
339 return ata_id_major_version(id) >= 5 && id[93] == 0;
340}
341
327static inline int ata_id_current_chs_valid(const u16 *id) 342static inline int ata_id_current_chs_valid(const u16 *id)
328{ 343{
329 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 344 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
@@ -350,7 +365,7 @@ static inline int ata_id_is_cfa(const u16 *id)
350 365
351static inline int ata_drive_40wire(const u16 *dev_id) 366static inline int ata_drive_40wire(const u16 *dev_id)
352{ 367{
353 if (ata_id_major_version(dev_id) >= 5 && ata_id_is_sata(dev_id)) 368 if (ata_id_is_sata(dev_id))
354 return 0; /* SATA */ 369 return 0; /* SATA */
355 if ((dev_id[93] & 0xE000) == 0x6000) 370 if ((dev_id[93] & 0xE000) == 0x6000)
356 return 0; /* 80 wire */ 371 return 0; /* 80 wire */