diff options
Diffstat (limited to 'include/linux/ide.h')
| -rw-r--r-- | include/linux/ide.h | 95 |
1 files changed, 49 insertions, 46 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h index f0af504dfa42..32fd77bb4436 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) | 64 | struct 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,7 +163,11 @@ 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 | */ |
| 165 | typedef struct hw_regs_s { | 165 | typedef 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; |
| @@ -179,10 +183,10 @@ static inline void ide_std_init_ports(hw_regs_t *hw, | |||
| 179 | { | 183 | { |
| 180 | unsigned int i; | 184 | unsigned int i; |
| 181 | 185 | ||
| 182 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) | 186 | for (i = 0; i <= 7; i++) |
| 183 | hw->io_ports[i] = io_addr++; | 187 | hw->io_ports_array[i] = io_addr++; |
| 184 | 188 | ||
| 185 | hw->io_ports[IDE_CONTROL_OFFSET] = ctl_addr; | 189 | hw->io_ports.ctl_addr = ctl_addr; |
| 186 | } | 190 | } |
| 187 | 191 | ||
| 188 | #include <asm/ide.h> | 192 | #include <asm/ide.h> |
| @@ -328,7 +332,6 @@ typedef struct ide_drive_s { | |||
| 328 | unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ | 332 | unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ |
| 329 | unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ | 333 | unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ |
| 330 | unsigned nodma : 1; /* disallow DMA */ | 334 | unsigned nodma : 1; /* disallow DMA */ |
| 331 | unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */ | ||
| 332 | 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) */ |
| 333 | 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 */ |
| 334 | 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 */ |
| @@ -432,8 +435,8 @@ typedef struct hwif_s { | |||
| 432 | 435 | ||
| 433 | char name[6]; /* name of interface, eg. "ide0" */ | 436 | char name[6]; /* name of interface, eg. "ide0" */ |
| 434 | 437 | ||
| 435 | /* task file registers for pata and sata */ | 438 | struct ide_io_ports io_ports; |
| 436 | unsigned long io_ports[IDE_NR_PORTS]; | 439 | |
| 437 | unsigned long sata_scr[SATA_NR_PORTS]; | 440 | unsigned long sata_scr[SATA_NR_PORTS]; |
| 438 | 441 | ||
| 439 | ide_drive_t drives[MAX_DRIVES]; /* drive info */ | 442 | ide_drive_t drives[MAX_DRIVES]; /* drive info */ |
| @@ -520,7 +523,6 @@ typedef struct hwif_s { | |||
| 520 | unsigned present : 1; /* this interface exists */ | 523 | unsigned present : 1; /* this interface exists */ |
| 521 | unsigned serialized : 1; /* serialized all channel operation */ | 524 | unsigned serialized : 1; /* serialized all channel operation */ |
| 522 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ | 525 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ |
| 523 | unsigned reset : 1; /* reset after probe */ | ||
| 524 | unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ | 526 | unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ |
| 525 | unsigned mmio : 1; /* host uses MMIO */ | 527 | unsigned mmio : 1; /* host uses MMIO */ |
| 526 | 528 | ||
| @@ -703,10 +705,6 @@ void ide_add_generic_settings(ide_drive_t *); | |||
| 703 | read_proc_t proc_ide_read_capacity; | 705 | read_proc_t proc_ide_read_capacity; |
| 704 | read_proc_t proc_ide_read_geometry; | 706 | read_proc_t proc_ide_read_geometry; |
| 705 | 707 | ||
| 706 | #ifdef CONFIG_BLK_DEV_IDEPCI | ||
| 707 | void ide_pci_create_host_proc(const char *, get_info_t *); | ||
| 708 | #endif | ||
| 709 | |||
| 710 | /* | 708 | /* |
| 711 | * Standard exit stuff: | 709 | * Standard exit stuff: |
| 712 | */ | 710 | */ |
| @@ -807,8 +805,14 @@ int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsig | |||
| 807 | #ifndef _IDE_C | 805 | #ifndef _IDE_C |
| 808 | extern ide_hwif_t ide_hwifs[]; /* master data repository */ | 806 | extern ide_hwif_t ide_hwifs[]; /* master data repository */ |
| 809 | #endif | 807 | #endif |
| 808 | extern int ide_noacpi; | ||
| 809 | extern int ide_acpigtf; | ||
| 810 | extern int ide_acpionboot; | ||
| 810 | extern int noautodma; | 811 | extern int noautodma; |
| 811 | 812 | ||
| 813 | extern int ide_vlb_clk; | ||
| 814 | extern int ide_pci_clk; | ||
| 815 | |||
| 812 | ide_hwif_t *ide_find_port_slot(const struct ide_port_info *); | 816 | ide_hwif_t *ide_find_port_slot(const struct ide_port_info *); |
| 813 | 817 | ||
| 814 | static inline ide_hwif_t *ide_find_port(void) | 818 | static inline ide_hwif_t *ide_find_port(void) |
| @@ -1068,8 +1072,6 @@ enum { | |||
| 1068 | IDE_HFLAG_NO_DMA = (1 << 14), | 1072 | IDE_HFLAG_NO_DMA = (1 << 14), |
| 1069 | /* check if host is PCI IDE device before allowing DMA */ | 1073 | /* check if host is PCI IDE device before allowing DMA */ |
| 1070 | IDE_HFLAG_NO_AUTODMA = (1 << 15), | 1074 | IDE_HFLAG_NO_AUTODMA = (1 << 15), |
| 1071 | /* don't autotune PIO */ | ||
| 1072 | IDE_HFLAG_NO_AUTOTUNE = (1 << 16), | ||
| 1073 | /* host is CS5510/CS5520 */ | 1075 | /* host is CS5510/CS5520 */ |
| 1074 | IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA, | 1076 | IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA, |
| 1075 | /* no LBA48 */ | 1077 | /* no LBA48 */ |
| @@ -1215,13 +1217,15 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} | |||
| 1215 | #endif | 1217 | #endif |
| 1216 | 1218 | ||
| 1217 | void ide_remove_port_from_hwgroup(ide_hwif_t *); | 1219 | void ide_remove_port_from_hwgroup(ide_hwif_t *); |
| 1218 | void ide_unregister(unsigned int); | 1220 | void ide_unregister(ide_hwif_t *); |
| 1219 | 1221 | ||
| 1220 | void ide_register_region(struct gendisk *); | 1222 | void ide_register_region(struct gendisk *); |
| 1221 | void ide_unregister_region(struct gendisk *); | 1223 | void ide_unregister_region(struct gendisk *); |
| 1222 | 1224 | ||
| 1223 | void ide_undecoded_slave(ide_drive_t *); | 1225 | void ide_undecoded_slave(ide_drive_t *); |
| 1224 | 1226 | ||
| 1227 | void ide_port_apply_params(ide_hwif_t *); | ||
| 1228 | |||
| 1225 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); | 1229 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); |
| 1226 | int ide_device_add(u8 idx[4], const struct ide_port_info *); | 1230 | int ide_device_add(u8 idx[4], const struct ide_port_info *); |
| 1227 | int ide_legacy_device_add(const struct ide_port_info *, unsigned long); | 1231 | int ide_legacy_device_add(const struct ide_port_info *, unsigned long); |
| @@ -1333,29 +1337,28 @@ static inline void ide_set_irq(ide_drive_t *drive, int on) | |||
| 1333 | { | 1337 | { |
| 1334 | ide_hwif_t *hwif = drive->hwif; | 1338 | ide_hwif_t *hwif = drive->hwif; |
| 1335 | 1339 | ||
| 1336 | hwif->OUTB(drive->ctl | (on ? 0 : 2), | 1340 | hwif->OUTB(drive->ctl | (on ? 0 : 2), hwif->io_ports.ctl_addr); |
| 1337 | hwif->io_ports[IDE_CONTROL_OFFSET]); | ||
| 1338 | } | 1341 | } |
| 1339 | 1342 | ||
| 1340 | static inline u8 ide_read_status(ide_drive_t *drive) | 1343 | static inline u8 ide_read_status(ide_drive_t *drive) |
| 1341 | { | 1344 | { |
| 1342 | ide_hwif_t *hwif = drive->hwif; | 1345 | ide_hwif_t *hwif = drive->hwif; |
| 1343 | 1346 | ||
| 1344 | return hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]); | 1347 | return hwif->INB(hwif->io_ports.status_addr); |
| 1345 | } | 1348 | } |
| 1346 | 1349 | ||
| 1347 | static inline u8 ide_read_altstatus(ide_drive_t *drive) | 1350 | static inline u8 ide_read_altstatus(ide_drive_t *drive) |
| 1348 | { | 1351 | { |
| 1349 | ide_hwif_t *hwif = drive->hwif; | 1352 | ide_hwif_t *hwif = drive->hwif; |
| 1350 | 1353 | ||
| 1351 | return hwif->INB(hwif->io_ports[IDE_CONTROL_OFFSET]); | 1354 | return hwif->INB(hwif->io_ports.ctl_addr); |
| 1352 | } | 1355 | } |
| 1353 | 1356 | ||
| 1354 | static inline u8 ide_read_error(ide_drive_t *drive) | 1357 | static inline u8 ide_read_error(ide_drive_t *drive) |
| 1355 | { | 1358 | { |
| 1356 | ide_hwif_t *hwif = drive->hwif; | 1359 | ide_hwif_t *hwif = drive->hwif; |
| 1357 | 1360 | ||
| 1358 | return hwif->INB(hwif->io_ports[IDE_ERROR_OFFSET]); | 1361 | return hwif->INB(hwif->io_ports.error_addr); |
| 1359 | } | 1362 | } |
| 1360 | 1363 | ||
| 1361 | /* | 1364 | /* |
| @@ -1368,7 +1371,7 @@ static inline void ide_atapi_discard_data(ide_drive_t *drive, unsigned bcount) | |||
| 1368 | 1371 | ||
| 1369 | /* FIXME: use ->atapi_input_bytes */ | 1372 | /* FIXME: use ->atapi_input_bytes */ |
| 1370 | while (bcount--) | 1373 | while (bcount--) |
| 1371 | (void)hwif->INB(hwif->io_ports[IDE_DATA_OFFSET]); | 1374 | (void)hwif->INB(hwif->io_ports.data_addr); |
| 1372 | } | 1375 | } |
| 1373 | 1376 | ||
| 1374 | static inline void ide_atapi_write_zeros(ide_drive_t *drive, unsigned bcount) | 1377 | static inline void ide_atapi_write_zeros(ide_drive_t *drive, unsigned bcount) |
| @@ -1377,7 +1380,7 @@ static inline void ide_atapi_write_zeros(ide_drive_t *drive, unsigned bcount) | |||
| 1377 | 1380 | ||
| 1378 | /* FIXME: use ->atapi_output_bytes */ | 1381 | /* FIXME: use ->atapi_output_bytes */ |
| 1379 | while (bcount--) | 1382 | while (bcount--) |
| 1380 | hwif->OUTB(0, hwif->io_ports[IDE_DATA_OFFSET]); | 1383 | hwif->OUTB(0, hwif->io_ports.data_addr); |
| 1381 | } | 1384 | } |
| 1382 | 1385 | ||
| 1383 | #endif /* _IDE_H */ | 1386 | #endif /* _IDE_H */ |
