aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-20 13:11:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-20 13:11:11 -0400
commite6423407d01168f7760cdee7270d9f51d1240301 (patch)
tree979795cfa8f6946238ab31f544159142f3e7df93 /include
parent7f8189068726492950bf1a2dcfd9b51314560abf (diff)
parent39c58f37a10198054c656c28202fb1e6d22fd505 (diff)
Merge branch 'for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* 'for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (34 commits) ide-cd: prevent null pointer deref via cdrom_newpc_intr ide: BUG() on unknown requests ide: filter out invalid DMA xfer mode changes in HDIO_DRIVE_CMD ioctl handler ide: do not access ide_drive_t 'drive_data' field directly sl82c105: implement test_irq() method siimage: implement test_irq() method pdc202xx_old: implement test_irq() method (take 2) cmd64x: implement test_irq() method cmd640: implement test_irq() method ide: move ack_intr() method into 'struct ide_port_ops' (take 2) ide: move IRQ clearing from ack_intr() method to clear_irq() method (take 2) siimage: use ide_dma_test_irq() (take 2) cmd64x: implement clear_irq() method (take 2) ide: call clear_irq() method in ide_timer_expiry() sgiioc4: coding style cleanup ide: don't enable IORDY at a probe time ide: IORDY handling fixes ata: add ata_id_pio_need_iordy() helper (v2) ide-tape: fix build issue ide: unify interrupt reason checking ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/ata.h14
-rw-r--r--include/linux/ide.h47
2 files changed, 37 insertions, 24 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 915da43edee1..9c75921f0c16 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -800,6 +800,20 @@ static inline int ata_id_is_ssd(const u16 *id)
800 return id[ATA_ID_ROT_SPEED] == 0x01; 800 return id[ATA_ID_ROT_SPEED] == 0x01;
801} 801}
802 802
803static inline int ata_id_pio_need_iordy(const u16 *id, const u8 pio)
804{
805 /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */
806 if (pio > 4 && ata_id_is_cfa(id))
807 return 0;
808 /* For PIO3 and higher it is mandatory. */
809 if (pio > 2)
810 return 1;
811 /* Turn it on when possible. */
812 if (ata_id_has_iordy(id))
813 return 1;
814 return 0;
815}
816
803static inline int ata_drive_40wire(const u16 *dev_id) 817static inline int ata_drive_40wire(const u16 *dev_id)
804{ 818{
805 if (ata_id_is_sata(dev_id)) 819 if (ata_id_is_sata(dev_id))
diff --git a/include/linux/ide.h b/include/linux/ide.h
index a6c6a2fad7c8..95c6e00a72e8 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -157,12 +157,6 @@ enum {
157#define REQ_UNPARK_HEADS 0x23 157#define REQ_UNPARK_HEADS 0x23
158 158
159/* 159/*
160 * Check for an interrupt and acknowledge the interrupt status
161 */
162struct hwif_s;
163typedef int (ide_ack_intr_t)(struct hwif_s *);
164
165/*
166 * hwif_chipset_t is used to keep track of the specific hardware 160 * hwif_chipset_t is used to keep track of the specific hardware
167 * chipset used by each IDE interface, if known. 161 * chipset used by each IDE interface, if known.
168 */ 162 */
@@ -185,7 +179,6 @@ struct ide_hw {
185 }; 179 };
186 180
187 int irq; /* our irq number */ 181 int irq; /* our irq number */
188 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */
189 struct device *dev, *parent; 182 struct device *dev, *parent;
190 unsigned long config; 183 unsigned long config;
191}; 184};
@@ -331,11 +324,6 @@ enum {
331 PC_FLAG_WRITING = (1 << 6), 324 PC_FLAG_WRITING = (1 << 6),
332}; 325};
333 326
334/*
335 * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes.
336 * This is used for several packet commands (not for READ/WRITE commands).
337 */
338#define IDE_PC_BUFFER_SIZE 64
339#define ATAPI_WAIT_PC (60 * HZ) 327#define ATAPI_WAIT_PC (60 * HZ)
340 328
341struct ide_atapi_pc { 329struct ide_atapi_pc {
@@ -347,12 +335,6 @@ struct ide_atapi_pc {
347 335
348 /* bytes to transfer */ 336 /* bytes to transfer */
349 int req_xfer; 337 int req_xfer;
350 /* bytes actually transferred */
351 int xferred;
352
353 /* data buffer */
354 u8 *buf;
355 int buf_size;
356 338
357 /* the corresponding request */ 339 /* the corresponding request */
358 struct request *rq; 340 struct request *rq;
@@ -363,8 +345,6 @@ struct ide_atapi_pc {
363 * those are more or less driver-specific and some of them are subject 345 * those are more or less driver-specific and some of them are subject
364 * to change/removal later. 346 * to change/removal later.
365 */ 347 */
366 u8 pc_buf[IDE_PC_BUFFER_SIZE];
367
368 unsigned long timeout; 348 unsigned long timeout;
369}; 349};
370 350
@@ -552,7 +532,7 @@ struct ide_drive_s {
552 532
553 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ 533 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */
554 unsigned int cyl; /* "real" number of cyls */ 534 unsigned int cyl; /* "real" number of cyls */
555 unsigned int drive_data; /* used by set_pio_mode/dev_select() */ 535 void *drive_data; /* used by set_pio_mode/dev_select() */
556 unsigned int failures; /* current failure count */ 536 unsigned int failures; /* current failure count */
557 unsigned int max_failures; /* maximum allowed failure count */ 537 unsigned int max_failures; /* maximum allowed failure count */
558 u64 probed_capacity;/* initial/native media capacity */ 538 u64 probed_capacity;/* initial/native media capacity */
@@ -649,6 +629,7 @@ struct ide_port_ops {
649 void (*maskproc)(ide_drive_t *, int); 629 void (*maskproc)(ide_drive_t *, int);
650 void (*quirkproc)(ide_drive_t *); 630 void (*quirkproc)(ide_drive_t *);
651 void (*clear_irq)(ide_drive_t *); 631 void (*clear_irq)(ide_drive_t *);
632 int (*test_irq)(struct hwif_s *);
652 633
653 u8 (*mdma_filter)(ide_drive_t *); 634 u8 (*mdma_filter)(ide_drive_t *);
654 u8 (*udma_filter)(ide_drive_t *); 635 u8 (*udma_filter)(ide_drive_t *);
@@ -674,6 +655,10 @@ struct ide_dma_ops {
674 u8 (*dma_sff_read_status)(struct hwif_s *); 655 u8 (*dma_sff_read_status)(struct hwif_s *);
675}; 656};
676 657
658enum {
659 IDE_PFLAG_PROBING = (1 << 0),
660};
661
677struct ide_host; 662struct ide_host;
678 663
679typedef struct hwif_s { 664typedef struct hwif_s {
@@ -690,6 +675,8 @@ typedef struct hwif_s {
690 675
691 ide_drive_t *devices[MAX_DRIVES + 1]; 676 ide_drive_t *devices[MAX_DRIVES + 1];
692 677
678 unsigned long port_flags;
679
693 u8 major; /* our major number */ 680 u8 major; /* our major number */
694 u8 index; /* 0 for ide0; 1 for ide1; ... */ 681 u8 index; /* 0 for ide0; 1 for ide1; ... */
695 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ 682 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */
@@ -708,8 +695,6 @@ typedef struct hwif_s {
708 695
709 struct device *dev; 696 struct device *dev;
710 697
711 ide_ack_intr_t *ack_intr;
712
713 void (*rw_disk)(ide_drive_t *, struct request *); 698 void (*rw_disk)(ide_drive_t *, struct request *);
714 699
715 const struct ide_tp_ops *tp_ops; 700 const struct ide_tp_ops *tp_ops;
@@ -1130,6 +1115,8 @@ void SELECT_MASK(ide_drive_t *, int);
1130u8 ide_read_error(ide_drive_t *); 1115u8 ide_read_error(ide_drive_t *);
1131void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *); 1116void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *);
1132 1117
1118int ide_check_ireason(ide_drive_t *, struct request *, int, int, int);
1119
1133int ide_check_atapi_device(ide_drive_t *, const char *); 1120int ide_check_atapi_device(ide_drive_t *, const char *);
1134 1121
1135void ide_init_pc(struct ide_atapi_pc *); 1122void ide_init_pc(struct ide_atapi_pc *);
@@ -1154,7 +1141,8 @@ enum {
1154 REQ_IDETAPE_WRITE = (1 << 3), 1141 REQ_IDETAPE_WRITE = (1 << 3),
1155}; 1142};
1156 1143
1157int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *); 1144int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *,
1145 void *, unsigned int);
1158 1146
1159int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *); 1147int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *);
1160int ide_do_start_stop(ide_drive_t *, struct gendisk *, int); 1148int ide_do_start_stop(ide_drive_t *, struct gendisk *, int);
@@ -1524,6 +1512,7 @@ int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int);
1524int ide_scan_pio_blacklist(char *); 1512int ide_scan_pio_blacklist(char *);
1525const char *ide_xfer_verbose(u8); 1513const char *ide_xfer_verbose(u8);
1526u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); 1514u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
1515int ide_pio_need_iordy(ide_drive_t *, const u8);
1527int ide_set_pio_mode(ide_drive_t *, u8); 1516int ide_set_pio_mode(ide_drive_t *, u8);
1528int ide_set_dma_mode(ide_drive_t *, u8); 1517int ide_set_dma_mode(ide_drive_t *, u8);
1529void ide_set_pio(ide_drive_t *, u8); 1518void ide_set_pio(ide_drive_t *, u8);
@@ -1561,6 +1550,16 @@ static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
1561 return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL; 1550 return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL;
1562} 1551}
1563 1552
1553static inline void *ide_get_drivedata(ide_drive_t *drive)
1554{
1555 return drive->drive_data;
1556}
1557
1558static inline void ide_set_drivedata(ide_drive_t *drive, void *data)
1559{
1560 drive->drive_data = data;
1561}
1562
1564#define ide_port_for_each_dev(i, dev, port) \ 1563#define ide_port_for_each_dev(i, dev, port) \
1565 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) 1564 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++)
1566 1565