diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 20:08:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 20:08:28 -0500 |
commit | 2ba14a017a4ba8d2266316f481d4ad7400073d18 (patch) | |
tree | 6e86dcbbb7898eb747f1198e33961eb68bfcdb4d /include | |
parent | 99f1c97dbdb30e958edfd1ced0ae43df62504e07 (diff) | |
parent | a984f58dd97f22f5113700322fed311a0ee29947 (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: (67 commits)
fix drivers/ata/sata_fsl.c double-decl
[libata] Prefer SCSI_SENSE_BUFFERSIZE to sizeof()
pata_legacy: Merge winbond support
ata_generic: Cenatek support
pata_winbond: error return
pata_serverworks: Fix cable types and cosmetics
pata_mpc52xx: remove un-needed assignment
libata: fix off-by-one in error categorization
ahci: factor out AHCI enabling and enable AHCI before reading CAP
ata_piix: implement SIDPR SCR access
ata_piix: convert to prepare - activate initialization
libata: factor out ata_pci_activate_sff_host() from ata_pci_one()
[libata] Prefer SCSI_SENSE_BUFFERSIZE to sizeof()
pata_legacy: resychronize with upstream changes and resubmit
[libata] pata_legacy: typo fix
[libata] pata_winbond: update for new ->data_xfer hook
pata_pcmcia: convert to new data_xfer prototype
libata annotations and fixes
libata: use dev_driver_string() instead of "libata" in libata-sff.c
ata_piix: kill unused constants and flags
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ata.h | 110 | ||||
-rw-r--r-- | include/linux/cdrom.h | 3 | ||||
-rw-r--r-- | include/linux/libata.h | 184 | ||||
-rw-r--r-- | include/linux/pci_ids.h | 3 |
4 files changed, 215 insertions, 85 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h index e672e80202a8..78bbacaed8c4 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -286,9 +286,10 @@ enum { | |||
286 | ATA_CBL_NONE = 0, | 286 | ATA_CBL_NONE = 0, |
287 | ATA_CBL_PATA40 = 1, | 287 | ATA_CBL_PATA40 = 1, |
288 | ATA_CBL_PATA80 = 2, | 288 | ATA_CBL_PATA80 = 2, |
289 | ATA_CBL_PATA40_SHORT = 3, /* 40 wire cable to high UDMA spec */ | 289 | ATA_CBL_PATA40_SHORT = 3, /* 40 wire cable to high UDMA spec */ |
290 | ATA_CBL_PATA_UNK = 4, | 290 | ATA_CBL_PATA_UNK = 4, /* don't know, maybe 80c? */ |
291 | ATA_CBL_SATA = 5, | 291 | ATA_CBL_PATA_IGN = 5, /* don't know, ignore cable handling */ |
292 | ATA_CBL_SATA = 6, | ||
292 | 293 | ||
293 | /* SATA Status and Control Registers */ | 294 | /* SATA Status and Control Registers */ |
294 | SCR_STATUS = 0, | 295 | SCR_STATUS = 0, |
@@ -324,6 +325,13 @@ enum { | |||
324 | ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ | 325 | ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ |
325 | ATA_TFLAG_FUA = (1 << 5), /* enable FUA */ | 326 | ATA_TFLAG_FUA = (1 << 5), /* enable FUA */ |
326 | ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */ | 327 | ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */ |
328 | |||
329 | /* protocol flags */ | ||
330 | ATA_PROT_FLAG_PIO = (1 << 0), /* is PIO */ | ||
331 | ATA_PROT_FLAG_DMA = (1 << 1), /* is DMA */ | ||
332 | ATA_PROT_FLAG_DATA = ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA, | ||
333 | ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */ | ||
334 | ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */ | ||
327 | }; | 335 | }; |
328 | 336 | ||
329 | enum ata_tf_protocols { | 337 | enum ata_tf_protocols { |
@@ -333,9 +341,9 @@ enum ata_tf_protocols { | |||
333 | ATA_PROT_PIO, /* PIO data xfer */ | 341 | ATA_PROT_PIO, /* PIO data xfer */ |
334 | ATA_PROT_DMA, /* DMA */ | 342 | ATA_PROT_DMA, /* DMA */ |
335 | ATA_PROT_NCQ, /* NCQ */ | 343 | ATA_PROT_NCQ, /* NCQ */ |
336 | ATA_PROT_ATAPI, /* packet command, PIO data xfer*/ | 344 | ATAPI_PROT_NODATA, /* packet command, no data */ |
337 | ATA_PROT_ATAPI_NODATA, /* packet command, no data */ | 345 | ATAPI_PROT_PIO, /* packet command, PIO data xfer*/ |
338 | ATA_PROT_ATAPI_DMA, /* packet command with special DMA sauce */ | 346 | ATAPI_PROT_DMA, /* packet command with special DMA sauce */ |
339 | }; | 347 | }; |
340 | 348 | ||
341 | enum ata_ioctls { | 349 | enum ata_ioctls { |
@@ -346,8 +354,8 @@ enum ata_ioctls { | |||
346 | /* core structures */ | 354 | /* core structures */ |
347 | 355 | ||
348 | struct ata_prd { | 356 | struct ata_prd { |
349 | u32 addr; | 357 | __le32 addr; |
350 | u32 flags_len; | 358 | __le32 flags_len; |
351 | }; | 359 | }; |
352 | 360 | ||
353 | struct ata_taskfile { | 361 | struct ata_taskfile { |
@@ -373,13 +381,69 @@ struct ata_taskfile { | |||
373 | u8 command; /* IO operation */ | 381 | u8 command; /* IO operation */ |
374 | }; | 382 | }; |
375 | 383 | ||
384 | /* | ||
385 | * protocol tests | ||
386 | */ | ||
387 | static inline unsigned int ata_prot_flags(u8 prot) | ||
388 | { | ||
389 | switch (prot) { | ||
390 | case ATA_PROT_NODATA: | ||
391 | return 0; | ||
392 | case ATA_PROT_PIO: | ||
393 | return ATA_PROT_FLAG_PIO; | ||
394 | case ATA_PROT_DMA: | ||
395 | return ATA_PROT_FLAG_DMA; | ||
396 | case ATA_PROT_NCQ: | ||
397 | return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ; | ||
398 | case ATAPI_PROT_NODATA: | ||
399 | return ATA_PROT_FLAG_ATAPI; | ||
400 | case ATAPI_PROT_PIO: | ||
401 | return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO; | ||
402 | case ATAPI_PROT_DMA: | ||
403 | return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA; | ||
404 | } | ||
405 | return 0; | ||
406 | } | ||
407 | |||
408 | static inline int ata_is_atapi(u8 prot) | ||
409 | { | ||
410 | return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI; | ||
411 | } | ||
412 | |||
413 | static inline int ata_is_nodata(u8 prot) | ||
414 | { | ||
415 | return !(ata_prot_flags(prot) & ATA_PROT_FLAG_DATA); | ||
416 | } | ||
417 | |||
418 | static inline int ata_is_pio(u8 prot) | ||
419 | { | ||
420 | return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO; | ||
421 | } | ||
422 | |||
423 | static inline int ata_is_dma(u8 prot) | ||
424 | { | ||
425 | return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA; | ||
426 | } | ||
427 | |||
428 | static inline int ata_is_ncq(u8 prot) | ||
429 | { | ||
430 | return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ; | ||
431 | } | ||
432 | |||
433 | static inline int ata_is_data(u8 prot) | ||
434 | { | ||
435 | return ata_prot_flags(prot) & ATA_PROT_FLAG_DATA; | ||
436 | } | ||
437 | |||
438 | /* | ||
439 | * id tests | ||
440 | */ | ||
376 | #define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) | 441 | #define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) |
377 | #define ata_id_has_lba(id) ((id)[49] & (1 << 9)) | 442 | #define ata_id_has_lba(id) ((id)[49] & (1 << 9)) |
378 | #define ata_id_has_dma(id) ((id)[49] & (1 << 8)) | 443 | #define ata_id_has_dma(id) ((id)[49] & (1 << 8)) |
379 | #define ata_id_has_ncq(id) ((id)[76] & (1 << 8)) | 444 | #define ata_id_has_ncq(id) ((id)[76] & (1 << 8)) |
380 | #define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1) | 445 | #define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1) |
381 | #define ata_id_removeable(id) ((id)[0] & (1 << 7)) | 446 | #define ata_id_removeable(id) ((id)[0] & (1 << 7)) |
382 | #define ata_id_has_dword_io(id) ((id)[48] & (1 << 0)) | ||
383 | #define ata_id_has_atapi_AN(id) \ | 447 | #define ata_id_has_atapi_AN(id) \ |
384 | ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \ | 448 | ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \ |
385 | ((id)[78] & (1 << 5)) ) | 449 | ((id)[78] & (1 << 5)) ) |
@@ -415,6 +479,7 @@ static inline bool ata_id_has_dipm(const u16 *id) | |||
415 | return val & (1 << 3); | 479 | return val & (1 << 3); |
416 | } | 480 | } |
417 | 481 | ||
482 | |||
418 | static inline int ata_id_has_fua(const u16 *id) | 483 | static inline int ata_id_has_fua(const u16 *id) |
419 | { | 484 | { |
420 | if ((id[84] & 0xC000) != 0x4000) | 485 | if ((id[84] & 0xC000) != 0x4000) |
@@ -519,6 +584,26 @@ static inline int ata_id_is_sata(const u16 *id) | |||
519 | return ata_id_major_version(id) >= 5 && id[93] == 0; | 584 | return ata_id_major_version(id) >= 5 && id[93] == 0; |
520 | } | 585 | } |
521 | 586 | ||
587 | static inline int ata_id_has_tpm(const u16 *id) | ||
588 | { | ||
589 | /* The TPM bits are only valid on ATA8 */ | ||
590 | if (ata_id_major_version(id) < 8) | ||
591 | return 0; | ||
592 | if ((id[48] & 0xC000) != 0x4000) | ||
593 | return 0; | ||
594 | return id[48] & (1 << 0); | ||
595 | } | ||
596 | |||
597 | static inline int ata_id_has_dword_io(const u16 *id) | ||
598 | { | ||
599 | /* ATA 8 reuses this flag for "trusted" computing */ | ||
600 | if (ata_id_major_version(id) > 7) | ||
601 | return 0; | ||
602 | if (id[48] & (1 << 0)) | ||
603 | return 1; | ||
604 | return 0; | ||
605 | } | ||
606 | |||
522 | static inline int ata_id_current_chs_valid(const u16 *id) | 607 | static inline int ata_id_current_chs_valid(const u16 *id) |
523 | { | 608 | { |
524 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command | 609 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command |
@@ -574,13 +659,6 @@ static inline int atapi_command_packet_set(const u16 *dev_id) | |||
574 | return (dev_id[0] >> 8) & 0x1f; | 659 | return (dev_id[0] >> 8) & 0x1f; |
575 | } | 660 | } |
576 | 661 | ||
577 | static inline int is_atapi_taskfile(const struct ata_taskfile *tf) | ||
578 | { | ||
579 | return (tf->protocol == ATA_PROT_ATAPI) || | ||
580 | (tf->protocol == ATA_PROT_ATAPI_NODATA) || | ||
581 | (tf->protocol == ATA_PROT_ATAPI_DMA); | ||
582 | } | ||
583 | |||
584 | static inline int is_multi_taskfile(struct ata_taskfile *tf) | 662 | static inline int is_multi_taskfile(struct ata_taskfile *tf) |
585 | { | 663 | { |
586 | return (tf->command == ATA_CMD_READ_MULTI) || | 664 | return (tf->command == ATA_CMD_READ_MULTI) || |
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index c6d3e22c0624..fcdc11b9609b 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h | |||
@@ -451,6 +451,7 @@ struct cdrom_generic_command | |||
451 | #define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e | 451 | #define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e |
452 | #define GPCMD_READ_10 0x28 | 452 | #define GPCMD_READ_10 0x28 |
453 | #define GPCMD_READ_12 0xa8 | 453 | #define GPCMD_READ_12 0xa8 |
454 | #define GPCMD_READ_BUFFER 0x3c | ||
454 | #define GPCMD_READ_BUFFER_CAPACITY 0x5c | 455 | #define GPCMD_READ_BUFFER_CAPACITY 0x5c |
455 | #define GPCMD_READ_CDVD_CAPACITY 0x25 | 456 | #define GPCMD_READ_CDVD_CAPACITY 0x25 |
456 | #define GPCMD_READ_CD 0xbe | 457 | #define GPCMD_READ_CD 0xbe |
@@ -480,7 +481,9 @@ struct cdrom_generic_command | |||
480 | #define GPCMD_TEST_UNIT_READY 0x00 | 481 | #define GPCMD_TEST_UNIT_READY 0x00 |
481 | #define GPCMD_VERIFY_10 0x2f | 482 | #define GPCMD_VERIFY_10 0x2f |
482 | #define GPCMD_WRITE_10 0x2a | 483 | #define GPCMD_WRITE_10 0x2a |
484 | #define GPCMD_WRITE_12 0xaa | ||
483 | #define GPCMD_WRITE_AND_VERIFY_10 0x2e | 485 | #define GPCMD_WRITE_AND_VERIFY_10 0x2e |
486 | #define GPCMD_WRITE_BUFFER 0x3b | ||
484 | /* This is listed as optional in ATAPI 2.6, but is (curiously) | 487 | /* This is listed as optional in ATAPI 2.6, but is (curiously) |
485 | * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji | 488 | * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji |
486 | * Table 377 as an MMC command for SCSi devices though... Most ATAPI | 489 | * Table 377 as an MMC command for SCSi devices though... Most ATAPI |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 124033cb5e9b..4374c4277780 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/workqueue.h> | 35 | #include <linux/workqueue.h> |
36 | #include <scsi/scsi_host.h> | 36 | #include <scsi/scsi_host.h> |
37 | #include <linux/acpi.h> | 37 | #include <linux/acpi.h> |
38 | #include <linux/cdrom.h> | ||
38 | 39 | ||
39 | /* | 40 | /* |
40 | * Define if arch has non-standard setup. This is a _PCI_ standard | 41 | * Define if arch has non-standard setup. This is a _PCI_ standard |
@@ -143,10 +144,11 @@ enum { | |||
143 | ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */ | 144 | ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */ |
144 | ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */ | 145 | ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */ |
145 | ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ | 146 | ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ |
146 | ATA_DFLAG_INIT_MASK = (1 << 16) - 1, | 147 | ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ |
148 | ATA_DFLAG_INIT_MASK = (1 << 24) - 1, | ||
147 | 149 | ||
148 | ATA_DFLAG_DETACH = (1 << 16), | 150 | ATA_DFLAG_DETACH = (1 << 24), |
149 | ATA_DFLAG_DETACHED = (1 << 17), | 151 | ATA_DFLAG_DETACHED = (1 << 25), |
150 | 152 | ||
151 | ATA_DEV_UNKNOWN = 0, /* unknown device */ | 153 | ATA_DEV_UNKNOWN = 0, /* unknown device */ |
152 | ATA_DEV_ATA = 1, /* ATA device */ | 154 | ATA_DEV_ATA = 1, /* ATA device */ |
@@ -217,9 +219,7 @@ enum { | |||
217 | 219 | ||
218 | /* struct ata_queued_cmd flags */ | 220 | /* struct ata_queued_cmd flags */ |
219 | ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */ | 221 | ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */ |
220 | ATA_QCFLAG_SG = (1 << 1), /* have s/g table? */ | 222 | ATA_QCFLAG_DMAMAP = (1 << 1), /* SG table is DMA mapped */ |
221 | ATA_QCFLAG_SINGLE = (1 << 2), /* no s/g, just a single buffer */ | ||
222 | ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE, | ||
223 | ATA_QCFLAG_IO = (1 << 3), /* standard IO command */ | 223 | ATA_QCFLAG_IO = (1 << 3), /* standard IO command */ |
224 | ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */ | 224 | ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */ |
225 | ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */ | 225 | ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */ |
@@ -266,19 +266,15 @@ enum { | |||
266 | PORT_DISABLED = 2, | 266 | PORT_DISABLED = 2, |
267 | 267 | ||
268 | /* encoding various smaller bitmaps into a single | 268 | /* encoding various smaller bitmaps into a single |
269 | * unsigned int bitmap | 269 | * unsigned long bitmap |
270 | */ | 270 | */ |
271 | ATA_BITS_PIO = 7, | 271 | ATA_NR_PIO_MODES = 7, |
272 | ATA_BITS_MWDMA = 5, | 272 | ATA_NR_MWDMA_MODES = 5, |
273 | ATA_BITS_UDMA = 8, | 273 | ATA_NR_UDMA_MODES = 8, |
274 | 274 | ||
275 | ATA_SHIFT_PIO = 0, | 275 | ATA_SHIFT_PIO = 0, |
276 | ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_BITS_PIO, | 276 | ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_NR_PIO_MODES, |
277 | ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_BITS_MWDMA, | 277 | ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_NR_MWDMA_MODES, |
278 | |||
279 | ATA_MASK_PIO = ((1 << ATA_BITS_PIO) - 1) << ATA_SHIFT_PIO, | ||
280 | ATA_MASK_MWDMA = ((1 << ATA_BITS_MWDMA) - 1) << ATA_SHIFT_MWDMA, | ||
281 | ATA_MASK_UDMA = ((1 << ATA_BITS_UDMA) - 1) << ATA_SHIFT_UDMA, | ||
282 | 278 | ||
283 | /* size of buffer to pad xfers ending on unaligned boundaries */ | 279 | /* size of buffer to pad xfers ending on unaligned boundaries */ |
284 | ATA_DMA_PAD_SZ = 4, | 280 | ATA_DMA_PAD_SZ = 4, |
@@ -349,6 +345,21 @@ enum { | |||
349 | ATA_DMA_MASK_ATA = (1 << 0), /* DMA on ATA Disk */ | 345 | ATA_DMA_MASK_ATA = (1 << 0), /* DMA on ATA Disk */ |
350 | ATA_DMA_MASK_ATAPI = (1 << 1), /* DMA on ATAPI */ | 346 | ATA_DMA_MASK_ATAPI = (1 << 1), /* DMA on ATAPI */ |
351 | ATA_DMA_MASK_CFA = (1 << 2), /* DMA on CF Card */ | 347 | ATA_DMA_MASK_CFA = (1 << 2), /* DMA on CF Card */ |
348 | |||
349 | /* ATAPI command types */ | ||
350 | ATAPI_READ = 0, /* READs */ | ||
351 | ATAPI_WRITE = 1, /* WRITEs */ | ||
352 | ATAPI_READ_CD = 2, /* READ CD [MSF] */ | ||
353 | ATAPI_MISC = 3, /* the rest */ | ||
354 | }; | ||
355 | |||
356 | enum ata_xfer_mask { | ||
357 | ATA_MASK_PIO = ((1LU << ATA_NR_PIO_MODES) - 1) | ||
358 | << ATA_SHIFT_PIO, | ||
359 | ATA_MASK_MWDMA = ((1LU << ATA_NR_MWDMA_MODES) - 1) | ||
360 | << ATA_SHIFT_MWDMA, | ||
361 | ATA_MASK_UDMA = ((1LU << ATA_NR_UDMA_MODES) - 1) | ||
362 | << ATA_SHIFT_UDMA, | ||
352 | }; | 363 | }; |
353 | 364 | ||
354 | enum hsm_task_states { | 365 | enum hsm_task_states { |
@@ -447,7 +458,7 @@ struct ata_queued_cmd { | |||
447 | unsigned int tag; | 458 | unsigned int tag; |
448 | unsigned int n_elem; | 459 | unsigned int n_elem; |
449 | unsigned int n_iter; | 460 | unsigned int n_iter; |
450 | unsigned int orig_n_elem; | 461 | unsigned int mapped_n_elem; |
451 | 462 | ||
452 | int dma_dir; | 463 | int dma_dir; |
453 | 464 | ||
@@ -455,17 +466,18 @@ struct ata_queued_cmd { | |||
455 | unsigned int sect_size; | 466 | unsigned int sect_size; |
456 | 467 | ||
457 | unsigned int nbytes; | 468 | unsigned int nbytes; |
469 | unsigned int raw_nbytes; | ||
458 | unsigned int curbytes; | 470 | unsigned int curbytes; |
459 | 471 | ||
460 | struct scatterlist *cursg; | 472 | struct scatterlist *cursg; |
461 | unsigned int cursg_ofs; | 473 | unsigned int cursg_ofs; |
462 | 474 | ||
475 | struct scatterlist *last_sg; | ||
476 | struct scatterlist saved_last_sg; | ||
463 | struct scatterlist sgent; | 477 | struct scatterlist sgent; |
464 | struct scatterlist pad_sgent; | 478 | struct scatterlist extra_sg[2]; |
465 | void *buf_virt; | ||
466 | 479 | ||
467 | /* DO NOT iterate over __sg manually, use ata_for_each_sg() */ | 480 | struct scatterlist *sg; |
468 | struct scatterlist *__sg; | ||
469 | 481 | ||
470 | unsigned int err_mask; | 482 | unsigned int err_mask; |
471 | struct ata_taskfile result_tf; | 483 | struct ata_taskfile result_tf; |
@@ -482,7 +494,7 @@ struct ata_port_stats { | |||
482 | }; | 494 | }; |
483 | 495 | ||
484 | struct ata_ering_entry { | 496 | struct ata_ering_entry { |
485 | int is_io; | 497 | unsigned int eflags; |
486 | unsigned int err_mask; | 498 | unsigned int err_mask; |
487 | u64 timestamp; | 499 | u64 timestamp; |
488 | }; | 500 | }; |
@@ -522,9 +534,9 @@ struct ata_device { | |||
522 | unsigned int cdb_len; | 534 | unsigned int cdb_len; |
523 | 535 | ||
524 | /* per-dev xfer mask */ | 536 | /* per-dev xfer mask */ |
525 | unsigned int pio_mask; | 537 | unsigned long pio_mask; |
526 | unsigned int mwdma_mask; | 538 | unsigned long mwdma_mask; |
527 | unsigned int udma_mask; | 539 | unsigned long udma_mask; |
528 | 540 | ||
529 | /* for CHS addressing */ | 541 | /* for CHS addressing */ |
530 | u16 cylinders; /* Number of cylinders */ | 542 | u16 cylinders; /* Number of cylinders */ |
@@ -560,6 +572,8 @@ struct ata_eh_context { | |||
560 | int tries[ATA_MAX_DEVICES]; | 572 | int tries[ATA_MAX_DEVICES]; |
561 | unsigned int classes[ATA_MAX_DEVICES]; | 573 | unsigned int classes[ATA_MAX_DEVICES]; |
562 | unsigned int did_probe_mask; | 574 | unsigned int did_probe_mask; |
575 | unsigned int saved_ncq_enabled; | ||
576 | u8 saved_xfer_mode[ATA_MAX_DEVICES]; | ||
563 | }; | 577 | }; |
564 | 578 | ||
565 | struct ata_acpi_drive | 579 | struct ata_acpi_drive |
@@ -686,7 +700,8 @@ struct ata_port_operations { | |||
686 | void (*bmdma_setup) (struct ata_queued_cmd *qc); | 700 | void (*bmdma_setup) (struct ata_queued_cmd *qc); |
687 | void (*bmdma_start) (struct ata_queued_cmd *qc); | 701 | void (*bmdma_start) (struct ata_queued_cmd *qc); |
688 | 702 | ||
689 | void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int); | 703 | unsigned int (*data_xfer) (struct ata_device *dev, unsigned char *buf, |
704 | unsigned int buflen, int rw); | ||
690 | 705 | ||
691 | int (*qc_defer) (struct ata_queued_cmd *qc); | 706 | int (*qc_defer) (struct ata_queued_cmd *qc); |
692 | void (*qc_prep) (struct ata_queued_cmd *qc); | 707 | void (*qc_prep) (struct ata_queued_cmd *qc); |
@@ -832,8 +847,6 @@ extern int ata_busy_sleep(struct ata_port *ap, | |||
832 | unsigned long timeout_pat, unsigned long timeout); | 847 | unsigned long timeout_pat, unsigned long timeout); |
833 | extern void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline); | 848 | extern void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline); |
834 | extern int ata_wait_ready(struct ata_port *ap, unsigned long deadline); | 849 | extern int ata_wait_ready(struct ata_port *ap, unsigned long deadline); |
835 | extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn, | ||
836 | void *data, unsigned long delay); | ||
837 | extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, | 850 | extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, |
838 | unsigned long interval_msec, | 851 | unsigned long interval_msec, |
839 | unsigned long timeout_msec); | 852 | unsigned long timeout_msec); |
@@ -848,6 +861,16 @@ extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | |||
848 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, | 861 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, |
849 | u8 pmp, int is_cmd, u8 *fis); | 862 | u8 pmp, int is_cmd, u8 *fis); |
850 | extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); | 863 | extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); |
864 | extern unsigned long ata_pack_xfermask(unsigned long pio_mask, | ||
865 | unsigned long mwdma_mask, unsigned long udma_mask); | ||
866 | extern void ata_unpack_xfermask(unsigned long xfer_mask, | ||
867 | unsigned long *pio_mask, unsigned long *mwdma_mask, | ||
868 | unsigned long *udma_mask); | ||
869 | extern u8 ata_xfer_mask2mode(unsigned long xfer_mask); | ||
870 | extern unsigned long ata_xfer_mode2mask(u8 xfer_mode); | ||
871 | extern int ata_xfer_mode2shift(unsigned long xfer_mode); | ||
872 | extern const char *ata_mode_string(unsigned long xfer_mask); | ||
873 | extern unsigned long ata_id_xfermask(const u16 *id); | ||
851 | extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device); | 874 | extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device); |
852 | extern void ata_std_dev_select(struct ata_port *ap, unsigned int device); | 875 | extern void ata_std_dev_select(struct ata_port *ap, unsigned int device); |
853 | extern u8 ata_check_status(struct ata_port *ap); | 876 | extern u8 ata_check_status(struct ata_port *ap); |
@@ -856,17 +879,15 @@ extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf) | |||
856 | extern int ata_port_start(struct ata_port *ap); | 879 | extern int ata_port_start(struct ata_port *ap); |
857 | extern int ata_sff_port_start(struct ata_port *ap); | 880 | extern int ata_sff_port_start(struct ata_port *ap); |
858 | extern irqreturn_t ata_interrupt(int irq, void *dev_instance); | 881 | extern irqreturn_t ata_interrupt(int irq, void *dev_instance); |
859 | extern void ata_data_xfer(struct ata_device *adev, unsigned char *buf, | 882 | extern unsigned int ata_data_xfer(struct ata_device *dev, |
860 | unsigned int buflen, int write_data); | 883 | unsigned char *buf, unsigned int buflen, int rw); |
861 | extern void ata_data_xfer_noirq(struct ata_device *adev, unsigned char *buf, | 884 | extern unsigned int ata_data_xfer_noirq(struct ata_device *dev, |
862 | unsigned int buflen, int write_data); | 885 | unsigned char *buf, unsigned int buflen, int rw); |
863 | extern int ata_std_qc_defer(struct ata_queued_cmd *qc); | 886 | extern int ata_std_qc_defer(struct ata_queued_cmd *qc); |
864 | extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc); | 887 | extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc); |
865 | extern void ata_qc_prep(struct ata_queued_cmd *qc); | 888 | extern void ata_qc_prep(struct ata_queued_cmd *qc); |
866 | extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); | 889 | extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); |
867 | extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc); | 890 | extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc); |
868 | extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, | ||
869 | unsigned int buflen); | ||
870 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, | 891 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, |
871 | unsigned int n_elem); | 892 | unsigned int n_elem); |
872 | extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); | 893 | extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); |
@@ -875,7 +896,6 @@ extern void ata_id_string(const u16 *id, unsigned char *s, | |||
875 | unsigned int ofs, unsigned int len); | 896 | unsigned int ofs, unsigned int len); |
876 | extern void ata_id_c_string(const u16 *id, unsigned char *s, | 897 | extern void ata_id_c_string(const u16 *id, unsigned char *s, |
877 | unsigned int ofs, unsigned int len); | 898 | unsigned int ofs, unsigned int len); |
878 | extern void ata_id_to_dma_mode(struct ata_device *dev, u8 unknown); | ||
879 | extern void ata_bmdma_setup(struct ata_queued_cmd *qc); | 899 | extern void ata_bmdma_setup(struct ata_queued_cmd *qc); |
880 | extern void ata_bmdma_start(struct ata_queued_cmd *qc); | 900 | extern void ata_bmdma_start(struct ata_queued_cmd *qc); |
881 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); | 901 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); |
@@ -910,6 +930,7 @@ extern u8 ata_irq_on(struct ata_port *ap); | |||
910 | extern int ata_cable_40wire(struct ata_port *ap); | 930 | extern int ata_cable_40wire(struct ata_port *ap); |
911 | extern int ata_cable_80wire(struct ata_port *ap); | 931 | extern int ata_cable_80wire(struct ata_port *ap); |
912 | extern int ata_cable_sata(struct ata_port *ap); | 932 | extern int ata_cable_sata(struct ata_port *ap); |
933 | extern int ata_cable_ignore(struct ata_port *ap); | ||
913 | extern int ata_cable_unknown(struct ata_port *ap); | 934 | extern int ata_cable_unknown(struct ata_port *ap); |
914 | 935 | ||
915 | /* | 936 | /* |
@@ -917,11 +938,13 @@ extern int ata_cable_unknown(struct ata_port *ap); | |||
917 | */ | 938 | */ |
918 | 939 | ||
919 | extern unsigned int ata_pio_need_iordy(const struct ata_device *); | 940 | extern unsigned int ata_pio_need_iordy(const struct ata_device *); |
941 | extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); | ||
920 | extern int ata_timing_compute(struct ata_device *, unsigned short, | 942 | extern int ata_timing_compute(struct ata_device *, unsigned short, |
921 | struct ata_timing *, int, int); | 943 | struct ata_timing *, int, int); |
922 | extern void ata_timing_merge(const struct ata_timing *, | 944 | extern void ata_timing_merge(const struct ata_timing *, |
923 | const struct ata_timing *, struct ata_timing *, | 945 | const struct ata_timing *, struct ata_timing *, |
924 | unsigned int); | 946 | unsigned int); |
947 | extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle); | ||
925 | 948 | ||
926 | enum { | 949 | enum { |
927 | ATA_TIMING_SETUP = (1 << 0), | 950 | ATA_TIMING_SETUP = (1 << 0), |
@@ -948,15 +971,40 @@ static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap) | |||
948 | return &ap->__acpi_init_gtm; | 971 | return &ap->__acpi_init_gtm; |
949 | return NULL; | 972 | return NULL; |
950 | } | 973 | } |
951 | extern int ata_acpi_cbl_80wire(struct ata_port *ap); | ||
952 | int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm); | 974 | int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm); |
953 | int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm); | 975 | int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm); |
976 | unsigned long ata_acpi_gtm_xfermask(struct ata_device *dev, | ||
977 | const struct ata_acpi_gtm *gtm); | ||
978 | int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm); | ||
954 | #else | 979 | #else |
955 | static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap) | 980 | static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap) |
956 | { | 981 | { |
957 | return NULL; | 982 | return NULL; |
958 | } | 983 | } |
959 | static inline int ata_acpi_cbl_80wire(struct ata_port *ap) { return 0; } | 984 | |
985 | static inline int ata_acpi_stm(const struct ata_port *ap, | ||
986 | struct ata_acpi_gtm *stm) | ||
987 | { | ||
988 | return -ENOSYS; | ||
989 | } | ||
990 | |||
991 | static inline int ata_acpi_gtm(const struct ata_port *ap, | ||
992 | struct ata_acpi_gtm *stm) | ||
993 | { | ||
994 | return -ENOSYS; | ||
995 | } | ||
996 | |||
997 | static inline unsigned int ata_acpi_gtm_xfermask(struct ata_device *dev, | ||
998 | const struct ata_acpi_gtm *gtm) | ||
999 | { | ||
1000 | return 0; | ||
1001 | } | ||
1002 | |||
1003 | static inline int ata_acpi_cbl_80wire(struct ata_port *ap, | ||
1004 | const struct ata_acpi_gtm *gtm) | ||
1005 | { | ||
1006 | return 0; | ||
1007 | } | ||
960 | #endif | 1008 | #endif |
961 | 1009 | ||
962 | #ifdef CONFIG_PCI | 1010 | #ifdef CONFIG_PCI |
@@ -985,8 +1033,12 @@ extern int ata_pci_init_bmdma(struct ata_host *host); | |||
985 | extern int ata_pci_prepare_sff_host(struct pci_dev *pdev, | 1033 | extern int ata_pci_prepare_sff_host(struct pci_dev *pdev, |
986 | const struct ata_port_info * const * ppi, | 1034 | const struct ata_port_info * const * ppi, |
987 | struct ata_host **r_host); | 1035 | struct ata_host **r_host); |
1036 | extern int ata_pci_activate_sff_host(struct ata_host *host, | ||
1037 | irq_handler_t irq_handler, | ||
1038 | struct scsi_host_template *sht); | ||
988 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); | 1039 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); |
989 | extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long); | 1040 | extern unsigned long ata_pci_default_filter(struct ata_device *dev, |
1041 | unsigned long xfer_mask); | ||
990 | #endif /* CONFIG_PCI */ | 1042 | #endif /* CONFIG_PCI */ |
991 | 1043 | ||
992 | /* | 1044 | /* |
@@ -1074,35 +1126,6 @@ extern void ata_port_pbar_desc(struct ata_port *ap, int bar, ssize_t offset, | |||
1074 | const char *name); | 1126 | const char *name); |
1075 | #endif | 1127 | #endif |
1076 | 1128 | ||
1077 | /* | ||
1078 | * qc helpers | ||
1079 | */ | ||
1080 | static inline struct scatterlist * | ||
1081 | ata_qc_first_sg(struct ata_queued_cmd *qc) | ||
1082 | { | ||
1083 | qc->n_iter = 0; | ||
1084 | if (qc->n_elem) | ||
1085 | return qc->__sg; | ||
1086 | if (qc->pad_len) | ||
1087 | return &qc->pad_sgent; | ||
1088 | return NULL; | ||
1089 | } | ||
1090 | |||
1091 | static inline struct scatterlist * | ||
1092 | ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc) | ||
1093 | { | ||
1094 | if (sg == &qc->pad_sgent) | ||
1095 | return NULL; | ||
1096 | if (++qc->n_iter < qc->n_elem) | ||
1097 | return sg_next(sg); | ||
1098 | if (qc->pad_len) | ||
1099 | return &qc->pad_sgent; | ||
1100 | return NULL; | ||
1101 | } | ||
1102 | |||
1103 | #define ata_for_each_sg(sg, qc) \ | ||
1104 | for (sg = ata_qc_first_sg(qc); sg; sg = ata_qc_next_sg(sg, qc)) | ||
1105 | |||
1106 | static inline unsigned int ata_tag_valid(unsigned int tag) | 1129 | static inline unsigned int ata_tag_valid(unsigned int tag) |
1107 | { | 1130 | { |
1108 | return (tag < ATA_MAX_QUEUE) ? 1 : 0; | 1131 | return (tag < ATA_MAX_QUEUE) ? 1 : 0; |
@@ -1337,15 +1360,17 @@ static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf) | |||
1337 | static inline void ata_qc_reinit(struct ata_queued_cmd *qc) | 1360 | static inline void ata_qc_reinit(struct ata_queued_cmd *qc) |
1338 | { | 1361 | { |
1339 | qc->dma_dir = DMA_NONE; | 1362 | qc->dma_dir = DMA_NONE; |
1340 | qc->__sg = NULL; | 1363 | qc->sg = NULL; |
1341 | qc->flags = 0; | 1364 | qc->flags = 0; |
1342 | qc->cursg = NULL; | 1365 | qc->cursg = NULL; |
1343 | qc->cursg_ofs = 0; | 1366 | qc->cursg_ofs = 0; |
1344 | qc->nbytes = qc->curbytes = 0; | 1367 | qc->nbytes = qc->raw_nbytes = qc->curbytes = 0; |
1345 | qc->n_elem = 0; | 1368 | qc->n_elem = 0; |
1369 | qc->mapped_n_elem = 0; | ||
1346 | qc->n_iter = 0; | 1370 | qc->n_iter = 0; |
1347 | qc->err_mask = 0; | 1371 | qc->err_mask = 0; |
1348 | qc->pad_len = 0; | 1372 | qc->pad_len = 0; |
1373 | qc->last_sg = NULL; | ||
1349 | qc->sect_size = ATA_SECT_SIZE; | 1374 | qc->sect_size = ATA_SECT_SIZE; |
1350 | 1375 | ||
1351 | ata_tf_init(qc->dev, &qc->tf); | 1376 | ata_tf_init(qc->dev, &qc->tf); |
@@ -1362,6 +1387,27 @@ static inline int ata_try_flush_cache(const struct ata_device *dev) | |||
1362 | ata_id_has_flush_ext(dev->id); | 1387 | ata_id_has_flush_ext(dev->id); |
1363 | } | 1388 | } |
1364 | 1389 | ||
1390 | static inline int atapi_cmd_type(u8 opcode) | ||
1391 | { | ||
1392 | switch (opcode) { | ||
1393 | case GPCMD_READ_10: | ||
1394 | case GPCMD_READ_12: | ||
1395 | return ATAPI_READ; | ||
1396 | |||
1397 | case GPCMD_WRITE_10: | ||
1398 | case GPCMD_WRITE_12: | ||
1399 | case GPCMD_WRITE_AND_VERIFY_10: | ||
1400 | return ATAPI_WRITE; | ||
1401 | |||
1402 | case GPCMD_READ_CD: | ||
1403 | case GPCMD_READ_CD_MSF: | ||
1404 | return ATAPI_READ_CD; | ||
1405 | |||
1406 | default: | ||
1407 | return ATAPI_MISC; | ||
1408 | } | ||
1409 | } | ||
1410 | |||
1365 | static inline unsigned int ac_err_mask(u8 status) | 1411 | static inline unsigned int ac_err_mask(u8 status) |
1366 | { | 1412 | { |
1367 | if (status & (ATA_BUSY | ATA_DRQ)) | 1413 | if (status & (ATA_BUSY | ATA_DRQ)) |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 7f2215139e9a..1fbd0256e86b 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -2066,6 +2066,9 @@ | |||
2066 | #define PCI_VENDOR_ID_NETCELL 0x169c | 2066 | #define PCI_VENDOR_ID_NETCELL 0x169c |
2067 | #define PCI_DEVICE_ID_REVOLUTION 0x0044 | 2067 | #define PCI_DEVICE_ID_REVOLUTION 0x0044 |
2068 | 2068 | ||
2069 | #define PCI_VENDOR_ID_CENATEK 0x16CA | ||
2070 | #define PCI_DEVICE_ID_CENATEK_IDE 0x0001 | ||
2071 | |||
2069 | #define PCI_VENDOR_ID_VITESSE 0x1725 | 2072 | #define PCI_VENDOR_ID_VITESSE 0x1725 |
2070 | #define PCI_DEVICE_ID_VITESSE_VSC7174 0x7174 | 2073 | #define PCI_DEVICE_ID_VITESSE_VSC7174 0x7174 |
2071 | 2074 | ||