aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ide.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ide.h')
-rw-r--r--include/linux/ide.h276
1 files changed, 136 insertions, 140 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 5f3e82ae901a..b0135b0c3a04 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -48,13 +48,6 @@ typedef unsigned char byte; /* used everywhere */
48#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ 48#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */
49 49
50/* 50/*
51 * Tune flags
52 */
53#define IDE_TUNE_NOAUTO 2
54#define IDE_TUNE_AUTO 1
55#define IDE_TUNE_DEFAULT 0
56
57/*
58 * state flags 51 * state flags
59 */ 52 */
60 53
@@ -68,23 +61,30 @@ typedef unsigned char byte; /* used everywhere */
68 */ 61 */
69#define IDE_NR_PORTS (10) 62#define IDE_NR_PORTS (10)
70 63
71#define IDE_DATA_OFFSET (0) 64struct ide_io_ports {
72#define IDE_ERROR_OFFSET (1) 65 unsigned long data_addr;
73#define IDE_NSECTOR_OFFSET (2) 66
74#define IDE_SECTOR_OFFSET (3) 67 union {
75#define IDE_LCYL_OFFSET (4) 68 unsigned long error_addr; /* read: error */
76#define IDE_HCYL_OFFSET (5) 69 unsigned long feature_addr; /* write: feature */
77#define IDE_SELECT_OFFSET (6) 70 };
78#define IDE_STATUS_OFFSET (7) 71
79#define IDE_CONTROL_OFFSET (8) 72 unsigned long nsect_addr;
80#define IDE_IRQ_OFFSET (9) 73 unsigned long lbal_addr;
81 74 unsigned long lbam_addr;
82#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET 75 unsigned long lbah_addr;
83#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET 76
84#define IDE_ALTSTATUS_OFFSET IDE_CONTROL_OFFSET 77 unsigned long device_addr;
85#define IDE_IREASON_OFFSET IDE_NSECTOR_OFFSET 78
86#define IDE_BCOUNTL_OFFSET IDE_LCYL_OFFSET 79 union {
87#define IDE_BCOUNTH_OFFSET IDE_HCYL_OFFSET 80 unsigned long status_addr; /*  read: status  */
81 unsigned long command_addr; /* write: command */
82 };
83
84 unsigned long ctl_addr;
85
86 unsigned long irq_addr;
87};
88 88
89#define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) 89#define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good))
90#define BAD_R_STAT (BUSY_STAT | ERR_STAT) 90#define BAD_R_STAT (BUSY_STAT | ERR_STAT)
@@ -163,14 +163,17 @@ typedef u8 hwif_chipset_t;
163 * Structure to hold all information about the location of this port 163 * Structure to hold all information about the location of this port
164 */ 164 */
165typedef struct hw_regs_s { 165typedef struct hw_regs_s {
166 unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */ 166 union {
167 struct ide_io_ports io_ports;
168 unsigned long io_ports_array[IDE_NR_PORTS];
169 };
170
167 int irq; /* our irq number */ 171 int irq; /* our irq number */
168 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ 172 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */
169 hwif_chipset_t chipset; 173 hwif_chipset_t chipset;
170 struct device *dev; 174 struct device *dev;
171} hw_regs_t; 175} hw_regs_t;
172 176
173struct hwif_s * ide_find_port(unsigned long);
174void ide_init_port_data(struct hwif_s *, unsigned int); 177void ide_init_port_data(struct hwif_s *, unsigned int);
175void ide_init_port_hw(struct hwif_s *, hw_regs_t *); 178void ide_init_port_hw(struct hwif_s *, hw_regs_t *);
176 179
@@ -180,10 +183,10 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
180{ 183{
181 unsigned int i; 184 unsigned int i;
182 185
183 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) 186 for (i = 0; i <= 7; i++)
184 hw->io_ports[i] = io_addr++; 187 hw->io_ports_array[i] = io_addr++;
185 188
186 hw->io_ports[IDE_CONTROL_OFFSET] = ctl_addr; 189 hw->io_ports.ctl_addr = ctl_addr;
187} 190}
188 191
189#include <asm/ide.h> 192#include <asm/ide.h>
@@ -329,7 +332,6 @@ typedef struct ide_drive_s {
329 unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ 332 unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */
330 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ 333 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */
331 unsigned nodma : 1; /* disallow DMA */ 334 unsigned nodma : 1; /* disallow DMA */
332 unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */
333 unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */ 335 unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */
334 unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */ 336 unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */
335 unsigned vdma : 1; /* 1=doing PIO over DMA 0=doing normal DMA */ 337 unsigned vdma : 1; /* 1=doing PIO over DMA 0=doing normal DMA */
@@ -388,6 +390,45 @@ typedef struct ide_drive_s {
388 390
389struct ide_port_info; 391struct ide_port_info;
390 392
393struct ide_port_ops {
394 /* host specific initialization of devices on a port */
395 void (*port_init_devs)(struct hwif_s *);
396 /* routine to program host for PIO mode */
397 void (*set_pio_mode)(ide_drive_t *, const u8);
398 /* routine to program host for DMA mode */
399 void (*set_dma_mode)(ide_drive_t *, const u8);
400 /* tweaks hardware to select drive */
401 void (*selectproc)(ide_drive_t *);
402 /* chipset polling based on hba specifics */
403 int (*reset_poll)(ide_drive_t *);
404 /* chipset specific changes to default for device-hba resets */
405 void (*pre_reset)(ide_drive_t *);
406 /* routine to reset controller after a disk reset */
407 void (*resetproc)(ide_drive_t *);
408 /* special host masking for drive selection */
409 void (*maskproc)(ide_drive_t *, int);
410 /* check host's drive quirk list */
411 void (*quirkproc)(ide_drive_t *);
412
413 u8 (*mdma_filter)(ide_drive_t *);
414 u8 (*udma_filter)(ide_drive_t *);
415
416 u8 (*cable_detect)(struct hwif_s *);
417};
418
419struct ide_dma_ops {
420 void (*dma_host_set)(struct ide_drive_s *, int);
421 int (*dma_setup)(struct ide_drive_s *);
422 void (*dma_exec_cmd)(struct ide_drive_s *, u8);
423 void (*dma_start)(struct ide_drive_s *);
424 int (*dma_end)(struct ide_drive_s *);
425 int (*dma_test_irq)(struct ide_drive_s *);
426 void (*dma_lost_irq)(struct ide_drive_s *);
427 void (*dma_timeout)(struct ide_drive_s *);
428};
429
430struct ide_task_s;
431
391typedef struct hwif_s { 432typedef struct hwif_s {
392 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ 433 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */
393 struct hwif_s *mate; /* other hwif from same PCI chip */ 434 struct hwif_s *mate; /* other hwif from same PCI chip */
@@ -396,8 +437,8 @@ typedef struct hwif_s {
396 437
397 char name[6]; /* name of interface, eg. "ide0" */ 438 char name[6]; /* name of interface, eg. "ide0" */
398 439
399 /* task file registers for pata and sata */ 440 struct ide_io_ports io_ports;
400 unsigned long io_ports[IDE_NR_PORTS]; 441
401 unsigned long sata_scr[SATA_NR_PORTS]; 442 unsigned long sata_scr[SATA_NR_PORTS];
402 443
403 ide_drive_t drives[MAX_DRIVES]; /* drive info */ 444 ide_drive_t drives[MAX_DRIVES]; /* drive info */
@@ -421,65 +462,25 @@ typedef struct hwif_s {
421 462
422 struct device *dev; 463 struct device *dev;
423 464
424 const struct ide_port_info *cds; /* chipset device struct */
425
426 ide_ack_intr_t *ack_intr; 465 ide_ack_intr_t *ack_intr;
427 466
428 void (*rw_disk)(ide_drive_t *, struct request *); 467 void (*rw_disk)(ide_drive_t *, struct request *);
429 468
430#if 0 469 const struct ide_port_ops *port_ops;
431 ide_hwif_ops_t *hwifops; 470 const struct ide_dma_ops *dma_ops;
432#else
433 /* host specific initialization of devices on a port */
434 void (*port_init_devs)(struct hwif_s *);
435 /* routine to program host for PIO mode */
436 void (*set_pio_mode)(ide_drive_t *, const u8);
437 /* routine to program host for DMA mode */
438 void (*set_dma_mode)(ide_drive_t *, const u8);
439 /* tweaks hardware to select drive */
440 void (*selectproc)(ide_drive_t *);
441 /* chipset polling based on hba specifics */
442 int (*reset_poll)(ide_drive_t *);
443 /* chipset specific changes to default for device-hba resets */
444 void (*pre_reset)(ide_drive_t *);
445 /* routine to reset controller after a disk reset */
446 void (*resetproc)(ide_drive_t *);
447 /* special host masking for drive selection */
448 void (*maskproc)(ide_drive_t *, int);
449 /* check host's drive quirk list */
450 void (*quirkproc)(ide_drive_t *);
451#endif
452 u8 (*mdma_filter)(ide_drive_t *);
453 u8 (*udma_filter)(ide_drive_t *);
454
455 u8 (*cable_detect)(struct hwif_s *);
456 471
457 void (*ata_input_data)(ide_drive_t *, void *, u32); 472 void (*tf_load)(ide_drive_t *, struct ide_task_s *);
458 void (*ata_output_data)(ide_drive_t *, void *, u32); 473 void (*tf_read)(ide_drive_t *, struct ide_task_s *);
459 474
460 void (*atapi_input_bytes)(ide_drive_t *, void *, u32); 475 void (*input_data)(ide_drive_t *, struct request *, void *, unsigned);
461 void (*atapi_output_bytes)(ide_drive_t *, void *, u32); 476 void (*output_data)(ide_drive_t *, struct request *, void *, unsigned);
462 477
463 void (*dma_host_set)(ide_drive_t *, int);
464 int (*dma_setup)(ide_drive_t *);
465 void (*dma_exec_cmd)(ide_drive_t *, u8);
466 void (*dma_start)(ide_drive_t *);
467 int (*ide_dma_end)(ide_drive_t *drive);
468 int (*ide_dma_test_irq)(ide_drive_t *drive);
469 void (*ide_dma_clear_irq)(ide_drive_t *drive); 478 void (*ide_dma_clear_irq)(ide_drive_t *drive);
470 void (*dma_lost_irq)(ide_drive_t *drive);
471 void (*dma_timeout)(ide_drive_t *drive);
472 479
473 void (*OUTB)(u8 addr, unsigned long port); 480 void (*OUTB)(u8 addr, unsigned long port);
474 void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port); 481 void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port);
475 void (*OUTW)(u16 addr, unsigned long port);
476 void (*OUTSW)(unsigned long port, void *addr, u32 count);
477 void (*OUTSL)(unsigned long port, void *addr, u32 count);
478 482
479 u8 (*INB)(unsigned long port); 483 u8 (*INB)(unsigned long port);
480 u16 (*INW)(unsigned long port);
481 void (*INSW)(unsigned long port, void *addr, u32 count);
482 void (*INSL)(unsigned long port, void *addr, u32 count);
483 484
484 /* dma physical region descriptor table (cpu view) */ 485 /* dma physical region descriptor table (cpu view) */
485 unsigned int *dmatable_cpu; 486 unsigned int *dmatable_cpu;
@@ -504,10 +505,7 @@ typedef struct hwif_s {
504 505
505 unsigned long dma_base; /* base addr for dma ports */ 506 unsigned long dma_base; /* base addr for dma ports */
506 unsigned long dma_command; /* dma command register */ 507 unsigned long dma_command; /* dma command register */
507 unsigned long dma_vendor1; /* dma vendor 1 register */
508 unsigned long dma_status; /* dma status register */ 508 unsigned long dma_status; /* dma status register */
509 unsigned long dma_vendor3; /* dma vendor 3 register */
510 unsigned long dma_prdtable; /* actual prd table address */
511 509
512 unsigned long config_data; /* for use by chipset-specific code */ 510 unsigned long config_data; /* for use by chipset-specific code */
513 unsigned long select_data; /* for use by chipset-specific code */ 511 unsigned long select_data; /* for use by chipset-specific code */
@@ -515,14 +513,11 @@ typedef struct hwif_s {
515 unsigned long extra_base; /* extra addr for dma ports */ 513 unsigned long extra_base; /* extra addr for dma ports */
516 unsigned extra_ports; /* number of extra dma ports */ 514 unsigned extra_ports; /* number of extra dma ports */
517 515
518 unsigned noprobe : 1; /* don't probe for this interface */
519 unsigned present : 1; /* this interface exists */ 516 unsigned present : 1; /* this interface exists */
520 unsigned serialized : 1; /* serialized all channel operation */ 517 unsigned serialized : 1; /* serialized all channel operation */
521 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ 518 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
522 unsigned reset : 1; /* reset after probe */
523 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 519 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
524 unsigned mmio : 1; /* host uses MMIO */ 520 unsigned mmio : 1; /* host uses MMIO */
525 unsigned straight8 : 1; /* Alan's straight 8 check */
526 521
527 struct device gendev; 522 struct device gendev;
528 struct device *portdev; 523 struct device *portdev;
@@ -545,7 +540,7 @@ typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
545typedef int (ide_expiry_t)(ide_drive_t *); 540typedef int (ide_expiry_t)(ide_drive_t *);
546 541
547/* used by ide-cd, ide-floppy, etc. */ 542/* used by ide-cd, ide-floppy, etc. */
548typedef void (xfer_func_t)(ide_drive_t *, void *, u32); 543typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned);
549 544
550typedef struct hwgroup_s { 545typedef struct hwgroup_s {
551 /* irq handler, if active */ 546 /* irq handler, if active */
@@ -703,10 +698,6 @@ void ide_add_generic_settings(ide_drive_t *);
703read_proc_t proc_ide_read_capacity; 698read_proc_t proc_ide_read_capacity;
704read_proc_t proc_ide_read_geometry; 699read_proc_t proc_ide_read_geometry;
705 700
706#ifdef CONFIG_BLK_DEV_IDEPCI
707void ide_pci_create_host_proc(const char *, get_info_t *);
708#endif
709
710/* 701/*
711 * Standard exit stuff: 702 * Standard exit stuff:
712 */ 703 */
@@ -807,8 +798,21 @@ int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsig
807#ifndef _IDE_C 798#ifndef _IDE_C
808extern ide_hwif_t ide_hwifs[]; /* master data repository */ 799extern ide_hwif_t ide_hwifs[]; /* master data repository */
809#endif 800#endif
801extern int ide_noacpi;
802extern int ide_acpigtf;
803extern int ide_acpionboot;
810extern int noautodma; 804extern int noautodma;
811 805
806extern int ide_vlb_clk;
807extern int ide_pci_clk;
808
809ide_hwif_t *ide_find_port_slot(const struct ide_port_info *);
810
811static inline ide_hwif_t *ide_find_port(void)
812{
813 return ide_find_port_slot(NULL);
814}
815
812extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); 816extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs);
813int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, 817int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
814 int uptodate, int nr_sectors); 818 int uptodate, int nr_sectors);
@@ -818,6 +822,10 @@ extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigne
818void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, 822void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int,
819 ide_expiry_t *); 823 ide_expiry_t *);
820 824
825void ide_execute_pkt_cmd(ide_drive_t *);
826
827void ide_pad_transfer(ide_drive_t *, int, int);
828
821ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); 829ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
822 830
823ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); 831ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
@@ -954,8 +962,7 @@ typedef struct ide_task_s {
954 void *special; /* valid_t generally */ 962 void *special; /* valid_t generally */
955} ide_task_t; 963} ide_task_t;
956 964
957void ide_tf_load(ide_drive_t *, ide_task_t *); 965void ide_tf_dump(const char *, struct ide_taskfile *);
958void ide_tf_read(ide_drive_t *, ide_task_t *);
959 966
960extern void SELECT_DRIVE(ide_drive_t *); 967extern void SELECT_DRIVE(ide_drive_t *);
961extern void SELECT_MASK(ide_drive_t *, int); 968extern void SELECT_MASK(ide_drive_t *, int);
@@ -1004,10 +1011,15 @@ void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8
1004void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); 1011void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1005 1012
1006#ifdef CONFIG_BLK_DEV_IDEDMA_PCI 1013#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
1007void ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *); 1014int ide_pci_set_master(struct pci_dev *, const char *);
1015unsigned long ide_pci_dma_base(ide_hwif_t *, const struct ide_port_info *);
1016int ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *);
1008#else 1017#else
1009static inline void ide_hwif_setup_dma(ide_hwif_t *hwif, 1018static inline int ide_hwif_setup_dma(ide_hwif_t *hwif,
1010 const struct ide_port_info *d) { } 1019 const struct ide_port_info *d)
1020{
1021 return -EINVAL;
1022}
1011#endif 1023#endif
1012 1024
1013extern void default_hwif_iops(ide_hwif_t *); 1025extern void default_hwif_iops(ide_hwif_t *);
@@ -1027,8 +1039,8 @@ enum {
1027 IDE_HFLAG_SINGLE = (1 << 1), 1039 IDE_HFLAG_SINGLE = (1 << 1),
1028 /* don't use legacy PIO blacklist */ 1040 /* don't use legacy PIO blacklist */
1029 IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2), 1041 IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2),
1030 /* don't use conservative PIO "downgrade" */ 1042 /* set for the second port of QD65xx */
1031 IDE_HFLAG_PIO_NO_DOWNGRADE = (1 << 3), 1043 IDE_HFLAG_QD_2ND_PORT = (1 << 3),
1032 /* use PIO8/9 for prefetch off/on */ 1044 /* use PIO8/9 for prefetch off/on */
1033 IDE_HFLAG_ABUSE_PREFETCH = (1 << 4), 1045 IDE_HFLAG_ABUSE_PREFETCH = (1 << 4),
1034 /* use PIO6/7 for fast-devsel off/on */ 1046 /* use PIO6/7 for fast-devsel off/on */
@@ -1050,14 +1062,14 @@ enum {
1050 IDE_HFLAG_VDMA = (1 << 11), 1062 IDE_HFLAG_VDMA = (1 << 11),
1051 /* ATAPI DMA is unsupported */ 1063 /* ATAPI DMA is unsupported */
1052 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), 1064 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12),
1053 /* set if host is a "bootable" controller */ 1065 /* set if host is a "non-bootable" controller */
1054 IDE_HFLAG_BOOTABLE = (1 << 13), 1066 IDE_HFLAG_NON_BOOTABLE = (1 << 13),
1055 /* host doesn't support DMA */ 1067 /* host doesn't support DMA */
1056 IDE_HFLAG_NO_DMA = (1 << 14), 1068 IDE_HFLAG_NO_DMA = (1 << 14),
1057 /* check if host is PCI IDE device before allowing DMA */ 1069 /* check if host is PCI IDE device before allowing DMA */
1058 IDE_HFLAG_NO_AUTODMA = (1 << 15), 1070 IDE_HFLAG_NO_AUTODMA = (1 << 15),
1059 /* don't autotune PIO */ 1071 /* host uses MMIO */
1060 IDE_HFLAG_NO_AUTOTUNE = (1 << 16), 1072 IDE_HFLAG_MMIO = (1 << 16),
1061 /* host is CS5510/CS5520 */ 1073 /* host is CS5510/CS5520 */
1062 IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA, 1074 IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA,
1063 /* no LBA48 */ 1075 /* no LBA48 */
@@ -1079,8 +1091,8 @@ enum {
1079 /* unmask IRQs */ 1091 /* unmask IRQs */
1080 IDE_HFLAG_UNMASK_IRQS = (1 << 25), 1092 IDE_HFLAG_UNMASK_IRQS = (1 << 25),
1081 IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26), 1093 IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26),
1082 /* host is CY82C693 */ 1094 /* serialize ports if DMA is possible (for sl82c105) */
1083 IDE_HFLAG_CY82C693 = (1 << 27), 1095 IDE_HFLAG_SERIALIZE_DMA = (1 << 27),
1084 /* force host out of "simplex" mode */ 1096 /* force host out of "simplex" mode */
1085 IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), 1097 IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28),
1086 /* DSC overlap is unsupported */ 1098 /* DSC overlap is unsupported */
@@ -1092,9 +1104,9 @@ enum {
1092}; 1104};
1093 1105
1094#ifdef CONFIG_BLK_DEV_OFFBOARD 1106#ifdef CONFIG_BLK_DEV_OFFBOARD
1095# define IDE_HFLAG_OFF_BOARD IDE_HFLAG_BOOTABLE
1096#else
1097# define IDE_HFLAG_OFF_BOARD 0 1107# define IDE_HFLAG_OFF_BOARD 0
1108#else
1109# define IDE_HFLAG_OFF_BOARD IDE_HFLAG_NON_BOOTABLE
1098#endif 1110#endif
1099 1111
1100struct ide_port_info { 1112struct ide_port_info {
@@ -1102,10 +1114,14 @@ struct ide_port_info {
1102 unsigned int (*init_chipset)(struct pci_dev *, const char *); 1114 unsigned int (*init_chipset)(struct pci_dev *, const char *);
1103 void (*init_iops)(ide_hwif_t *); 1115 void (*init_iops)(ide_hwif_t *);
1104 void (*init_hwif)(ide_hwif_t *); 1116 void (*init_hwif)(ide_hwif_t *);
1105 void (*init_dma)(ide_hwif_t *, unsigned long); 1117 int (*init_dma)(ide_hwif_t *,
1118 const struct ide_port_info *);
1119
1120 const struct ide_port_ops *port_ops;
1121 const struct ide_dma_ops *dma_ops;
1122
1106 ide_pci_enablebit_t enablebits[2]; 1123 ide_pci_enablebit_t enablebits[2];
1107 hwif_chipset_t chipset; 1124 hwif_chipset_t chipset;
1108 u8 extra;
1109 u32 host_flags; 1125 u32 host_flags;
1110 u8 pio_mask; 1126 u8 pio_mask;
1111 u8 swdma_mask; 1127 u8 swdma_mask;
@@ -1152,13 +1168,16 @@ void ide_destroy_dmatable(ide_drive_t *);
1152 1168
1153#ifdef CONFIG_BLK_DEV_IDEDMA_SFF 1169#ifdef CONFIG_BLK_DEV_IDEDMA_SFF
1154extern int ide_build_dmatable(ide_drive_t *, struct request *); 1170extern int ide_build_dmatable(ide_drive_t *, struct request *);
1155extern int ide_release_dma(ide_hwif_t *); 1171int ide_allocate_dma_engine(ide_hwif_t *);
1156extern void ide_setup_dma(ide_hwif_t *, unsigned long); 1172void ide_release_dma_engine(ide_hwif_t *);
1173void ide_setup_dma(ide_hwif_t *, unsigned long);
1157 1174
1158void ide_dma_host_set(ide_drive_t *, int); 1175void ide_dma_host_set(ide_drive_t *, int);
1159extern int ide_dma_setup(ide_drive_t *); 1176extern int ide_dma_setup(ide_drive_t *);
1177void ide_dma_exec_cmd(ide_drive_t *, u8);
1160extern void ide_dma_start(ide_drive_t *); 1178extern void ide_dma_start(ide_drive_t *);
1161extern int __ide_dma_end(ide_drive_t *); 1179extern int __ide_dma_end(ide_drive_t *);
1180int ide_dma_test_irq(ide_drive_t *);
1162extern void ide_dma_lost_irq(ide_drive_t *); 1181extern void ide_dma_lost_irq(ide_drive_t *);
1163extern void ide_dma_timeout(ide_drive_t *); 1182extern void ide_dma_timeout(ide_drive_t *);
1164#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ 1183#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */
@@ -1176,7 +1195,7 @@ static inline void ide_check_dma_crc(ide_drive_t *drive) { ; }
1176#endif /* CONFIG_BLK_DEV_IDEDMA */ 1195#endif /* CONFIG_BLK_DEV_IDEDMA */
1177 1196
1178#ifndef CONFIG_BLK_DEV_IDEDMA_SFF 1197#ifndef CONFIG_BLK_DEV_IDEDMA_SFF
1179static inline void ide_release_dma(ide_hwif_t *drive) {;} 1198static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; }
1180#endif 1199#endif
1181 1200
1182#ifdef CONFIG_BLK_DEV_IDEACPI 1201#ifdef CONFIG_BLK_DEV_IDEACPI
@@ -1196,17 +1215,18 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1196#endif 1215#endif
1197 1216
1198void ide_remove_port_from_hwgroup(ide_hwif_t *); 1217void ide_remove_port_from_hwgroup(ide_hwif_t *);
1199extern int ide_hwif_request_regions(ide_hwif_t *hwif); 1218void ide_unregister(ide_hwif_t *);
1200extern void ide_hwif_release_regions(ide_hwif_t* hwif);
1201void ide_unregister(unsigned int);
1202 1219
1203void ide_register_region(struct gendisk *); 1220void ide_register_region(struct gendisk *);
1204void ide_unregister_region(struct gendisk *); 1221void ide_unregister_region(struct gendisk *);
1205 1222
1206void ide_undecoded_slave(ide_drive_t *); 1223void ide_undecoded_slave(ide_drive_t *);
1207 1224
1225void ide_port_apply_params(ide_hwif_t *);
1226
1208int ide_device_add_all(u8 *idx, const struct ide_port_info *); 1227int ide_device_add_all(u8 *idx, const struct ide_port_info *);
1209int ide_device_add(u8 idx[4], const struct ide_port_info *); 1228int ide_device_add(u8 idx[4], const struct ide_port_info *);
1229int ide_legacy_device_add(const struct ide_port_info *, unsigned long);
1210void ide_port_unregister_devices(ide_hwif_t *); 1230void ide_port_unregister_devices(ide_hwif_t *);
1211void ide_port_scan(ide_hwif_t *); 1231void ide_port_scan(ide_hwif_t *);
1212 1232
@@ -1315,51 +1335,27 @@ static inline void ide_set_irq(ide_drive_t *drive, int on)
1315{ 1335{
1316 ide_hwif_t *hwif = drive->hwif; 1336 ide_hwif_t *hwif = drive->hwif;
1317 1337
1318 hwif->OUTB(drive->ctl | (on ? 0 : 2), 1338 hwif->OUTB(drive->ctl | (on ? 0 : 2), hwif->io_ports.ctl_addr);
1319 hwif->io_ports[IDE_CONTROL_OFFSET]);
1320} 1339}
1321 1340
1322static inline u8 ide_read_status(ide_drive_t *drive) 1341static inline u8 ide_read_status(ide_drive_t *drive)
1323{ 1342{
1324 ide_hwif_t *hwif = drive->hwif; 1343 ide_hwif_t *hwif = drive->hwif;
1325 1344
1326 return hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]); 1345 return hwif->INB(hwif->io_ports.status_addr);
1327} 1346}
1328 1347
1329static inline u8 ide_read_altstatus(ide_drive_t *drive) 1348static inline u8 ide_read_altstatus(ide_drive_t *drive)
1330{ 1349{
1331 ide_hwif_t *hwif = drive->hwif; 1350 ide_hwif_t *hwif = drive->hwif;
1332 1351
1333 return hwif->INB(hwif->io_ports[IDE_CONTROL_OFFSET]); 1352 return hwif->INB(hwif->io_ports.ctl_addr);
1334} 1353}
1335 1354
1336static inline u8 ide_read_error(ide_drive_t *drive) 1355static inline u8 ide_read_error(ide_drive_t *drive)
1337{ 1356{
1338 ide_hwif_t *hwif = drive->hwif; 1357 ide_hwif_t *hwif = drive->hwif;
1339 1358
1340 return hwif->INB(hwif->io_ports[IDE_ERROR_OFFSET]); 1359 return hwif->INB(hwif->io_ports.error_addr);
1341} 1360}
1342
1343/*
1344 * Too bad. The drive wants to send us data which we are not ready to accept.
1345 * Just throw it away.
1346 */
1347static inline void ide_atapi_discard_data(ide_drive_t *drive, unsigned bcount)
1348{
1349 ide_hwif_t *hwif = drive->hwif;
1350
1351 /* FIXME: use ->atapi_input_bytes */
1352 while (bcount--)
1353 (void)hwif->INB(hwif->io_ports[IDE_DATA_OFFSET]);
1354}
1355
1356static inline void ide_atapi_write_zeros(ide_drive_t *drive, unsigned bcount)
1357{
1358 ide_hwif_t *hwif = drive->hwif;
1359
1360 /* FIXME: use ->atapi_output_bytes */
1361 while (bcount--)
1362 hwif->OUTB(0, hwif->io_ports[IDE_DATA_OFFSET]);
1363}
1364
1365#endif /* _IDE_H */ 1361#endif /* _IDE_H */