diff options
Diffstat (limited to 'drivers/ide/ide-iops.c')
| -rw-r--r-- | drivers/ide/ide-iops.c | 86 |
1 files changed, 50 insertions, 36 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index e77cee0e5d65..45944219eea0 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
| @@ -158,9 +158,12 @@ EXPORT_SYMBOL(default_hwif_mmiops); | |||
| 158 | 158 | ||
| 159 | void SELECT_DRIVE (ide_drive_t *drive) | 159 | void SELECT_DRIVE (ide_drive_t *drive) |
| 160 | { | 160 | { |
| 161 | if (HWIF(drive)->selectproc) | 161 | ide_hwif_t *hwif = drive->hwif; |
| 162 | HWIF(drive)->selectproc(drive); | 162 | |
| 163 | HWIF(drive)->OUTB(drive->select.all, IDE_SELECT_REG); | 163 | if (hwif->selectproc) |
| 164 | hwif->selectproc(drive); | ||
| 165 | |||
| 166 | hwif->OUTB(drive->select.all, hwif->io_ports[IDE_SELECT_OFFSET]); | ||
| 164 | } | 167 | } |
| 165 | 168 | ||
| 166 | void SELECT_MASK (ide_drive_t *drive, int mask) | 169 | void SELECT_MASK (ide_drive_t *drive, int mask) |
| @@ -194,15 +197,18 @@ static void ata_input_data(ide_drive_t *drive, void *buffer, u32 wcount) | |||
| 194 | if (io_32bit) { | 197 | if (io_32bit) { |
| 195 | if (io_32bit & 2) { | 198 | if (io_32bit & 2) { |
| 196 | unsigned long flags; | 199 | unsigned long flags; |
| 200 | |||
| 197 | local_irq_save(flags); | 201 | local_irq_save(flags); |
| 198 | ata_vlb_sync(drive, IDE_NSECTOR_REG); | 202 | ata_vlb_sync(drive, hwif->io_ports[IDE_NSECTOR_OFFSET]); |
| 199 | hwif->INSL(IDE_DATA_REG, buffer, wcount); | 203 | hwif->INSL(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 204 | wcount); | ||
| 200 | local_irq_restore(flags); | 205 | local_irq_restore(flags); |
| 201 | } else | 206 | } else |
| 202 | hwif->INSL(IDE_DATA_REG, buffer, wcount); | 207 | hwif->INSL(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 203 | } else { | 208 | wcount); |
| 204 | hwif->INSW(IDE_DATA_REG, buffer, wcount<<1); | 209 | } else |
| 205 | } | 210 | hwif->INSW(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 211 | wcount << 1); | ||
| 206 | } | 212 | } |
| 207 | 213 | ||
| 208 | /* | 214 | /* |
| @@ -216,15 +222,18 @@ static void ata_output_data(ide_drive_t *drive, void *buffer, u32 wcount) | |||
| 216 | if (io_32bit) { | 222 | if (io_32bit) { |
| 217 | if (io_32bit & 2) { | 223 | if (io_32bit & 2) { |
| 218 | unsigned long flags; | 224 | unsigned long flags; |
| 225 | |||
| 219 | local_irq_save(flags); | 226 | local_irq_save(flags); |
| 220 | ata_vlb_sync(drive, IDE_NSECTOR_REG); | 227 | ata_vlb_sync(drive, hwif->io_ports[IDE_NSECTOR_OFFSET]); |
| 221 | hwif->OUTSL(IDE_DATA_REG, buffer, wcount); | 228 | hwif->OUTSL(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 229 | wcount); | ||
| 222 | local_irq_restore(flags); | 230 | local_irq_restore(flags); |
| 223 | } else | 231 | } else |
| 224 | hwif->OUTSL(IDE_DATA_REG, buffer, wcount); | 232 | hwif->OUTSL(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 225 | } else { | 233 | wcount); |
| 226 | hwif->OUTSW(IDE_DATA_REG, buffer, wcount<<1); | 234 | } else |
| 227 | } | 235 | hwif->OUTSW(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 236 | wcount << 1); | ||
| 228 | } | 237 | } |
| 229 | 238 | ||
| 230 | /* | 239 | /* |
| @@ -243,13 +252,15 @@ static void atapi_input_bytes(ide_drive_t *drive, void *buffer, u32 bytecount) | |||
| 243 | #if defined(CONFIG_ATARI) || defined(CONFIG_Q40) | 252 | #if defined(CONFIG_ATARI) || defined(CONFIG_Q40) |
| 244 | if (MACH_IS_ATARI || MACH_IS_Q40) { | 253 | if (MACH_IS_ATARI || MACH_IS_Q40) { |
| 245 | /* Atari has a byte-swapped IDE interface */ | 254 | /* Atari has a byte-swapped IDE interface */ |
| 246 | insw_swapw(IDE_DATA_REG, buffer, bytecount / 2); | 255 | insw_swapw(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 256 | bytecount / 2); | ||
| 247 | return; | 257 | return; |
| 248 | } | 258 | } |
| 249 | #endif /* CONFIG_ATARI || CONFIG_Q40 */ | 259 | #endif /* CONFIG_ATARI || CONFIG_Q40 */ |
| 250 | hwif->ata_input_data(drive, buffer, bytecount / 4); | 260 | hwif->ata_input_data(drive, buffer, bytecount / 4); |
| 251 | if ((bytecount & 0x03) >= 2) | 261 | if ((bytecount & 0x03) >= 2) |
| 252 | hwif->INSW(IDE_DATA_REG, ((u8 *)buffer)+(bytecount & ~0x03), 1); | 262 | hwif->INSW(hwif->io_ports[IDE_DATA_OFFSET], |
| 263 | (u8 *)buffer + (bytecount & ~0x03), 1); | ||
| 253 | } | 264 | } |
| 254 | 265 | ||
| 255 | static void atapi_output_bytes(ide_drive_t *drive, void *buffer, u32 bytecount) | 266 | static void atapi_output_bytes(ide_drive_t *drive, void *buffer, u32 bytecount) |
| @@ -260,13 +271,15 @@ static void atapi_output_bytes(ide_drive_t *drive, void *buffer, u32 bytecount) | |||
| 260 | #if defined(CONFIG_ATARI) || defined(CONFIG_Q40) | 271 | #if defined(CONFIG_ATARI) || defined(CONFIG_Q40) |
| 261 | if (MACH_IS_ATARI || MACH_IS_Q40) { | 272 | if (MACH_IS_ATARI || MACH_IS_Q40) { |
| 262 | /* Atari has a byte-swapped IDE interface */ | 273 | /* Atari has a byte-swapped IDE interface */ |
| 263 | outsw_swapw(IDE_DATA_REG, buffer, bytecount / 2); | 274 | outsw_swapw(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 275 | bytecount / 2); | ||
| 264 | return; | 276 | return; |
| 265 | } | 277 | } |
| 266 | #endif /* CONFIG_ATARI || CONFIG_Q40 */ | 278 | #endif /* CONFIG_ATARI || CONFIG_Q40 */ |
| 267 | hwif->ata_output_data(drive, buffer, bytecount / 4); | 279 | hwif->ata_output_data(drive, buffer, bytecount / 4); |
| 268 | if ((bytecount & 0x03) >= 2) | 280 | if ((bytecount & 0x03) >= 2) |
| 269 | hwif->OUTSW(IDE_DATA_REG, ((u8*)buffer)+(bytecount & ~0x03), 1); | 281 | hwif->OUTSW(hwif->io_ports[IDE_DATA_OFFSET], |
| 282 | (u8 *)buffer + (bytecount & ~0x03), 1); | ||
| 270 | } | 283 | } |
| 271 | 284 | ||
| 272 | void default_hwif_transport(ide_hwif_t *hwif) | 285 | void default_hwif_transport(ide_hwif_t *hwif) |
| @@ -429,7 +442,7 @@ int drive_is_ready (ide_drive_t *drive) | |||
| 429 | * an interrupt with another pci card/device. We make no assumptions | 442 | * an interrupt with another pci card/device. We make no assumptions |
| 430 | * about possible isa-pnp and pci-pnp issues yet. | 443 | * about possible isa-pnp and pci-pnp issues yet. |
| 431 | */ | 444 | */ |
| 432 | if (IDE_CONTROL_REG) | 445 | if (hwif->io_ports[IDE_CONTROL_OFFSET]) |
| 433 | stat = ide_read_altstatus(drive); | 446 | stat = ide_read_altstatus(drive); |
| 434 | else | 447 | else |
| 435 | /* Note: this may clear a pending IRQ!! */ | 448 | /* Note: this may clear a pending IRQ!! */ |
| @@ -631,7 +644,7 @@ int ide_driveid_update(ide_drive_t *drive) | |||
| 631 | SELECT_MASK(drive, 1); | 644 | SELECT_MASK(drive, 1); |
| 632 | ide_set_irq(drive, 1); | 645 | ide_set_irq(drive, 1); |
| 633 | msleep(50); | 646 | msleep(50); |
| 634 | hwif->OUTB(WIN_IDENTIFY, IDE_COMMAND_REG); | 647 | hwif->OUTB(WIN_IDENTIFY, hwif->io_ports[IDE_COMMAND_OFFSET]); |
| 635 | timeout = jiffies + WAIT_WORSTCASE; | 648 | timeout = jiffies + WAIT_WORSTCASE; |
| 636 | do { | 649 | do { |
| 637 | if (time_after(jiffies, timeout)) { | 650 | if (time_after(jiffies, timeout)) { |
| @@ -718,9 +731,10 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
| 718 | SELECT_MASK(drive, 0); | 731 | SELECT_MASK(drive, 0); |
| 719 | udelay(1); | 732 | udelay(1); |
| 720 | ide_set_irq(drive, 0); | 733 | ide_set_irq(drive, 0); |
| 721 | hwif->OUTB(speed, IDE_NSECTOR_REG); | 734 | hwif->OUTB(speed, hwif->io_ports[IDE_NSECTOR_OFFSET]); |
| 722 | hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG); | 735 | hwif->OUTB(SETFEATURES_XFER, hwif->io_ports[IDE_FEATURE_OFFSET]); |
| 723 | hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG); | 736 | hwif->OUTBSYNC(drive, WIN_SETFEATURES, |
| 737 | hwif->io_ports[IDE_COMMAND_OFFSET]); | ||
| 724 | if (drive->quirk_list == 2) | 738 | if (drive->quirk_list == 2) |
| 725 | ide_set_irq(drive, 1); | 739 | ide_set_irq(drive, 1); |
| 726 | 740 | ||
| @@ -828,7 +842,7 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, | |||
| 828 | 842 | ||
| 829 | spin_lock_irqsave(&ide_lock, flags); | 843 | spin_lock_irqsave(&ide_lock, flags); |
| 830 | __ide_set_handler(drive, handler, timeout, expiry); | 844 | __ide_set_handler(drive, handler, timeout, expiry); |
| 831 | hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG); | 845 | hwif->OUTBSYNC(drive, cmd, hwif->io_ports[IDE_COMMAND_OFFSET]); |
| 832 | /* | 846 | /* |
| 833 | * Drive takes 400nS to respond, we must avoid the IRQ being | 847 | * Drive takes 400nS to respond, we must avoid the IRQ being |
| 834 | * serviced before that. | 848 | * serviced before that. |
| @@ -1009,7 +1023,8 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
| 1009 | unsigned long flags; | 1023 | unsigned long flags; |
| 1010 | ide_hwif_t *hwif; | 1024 | ide_hwif_t *hwif; |
| 1011 | ide_hwgroup_t *hwgroup; | 1025 | ide_hwgroup_t *hwgroup; |
| 1012 | 1026 | u8 ctl; | |
| 1027 | |||
| 1013 | spin_lock_irqsave(&ide_lock, flags); | 1028 | spin_lock_irqsave(&ide_lock, flags); |
| 1014 | hwif = HWIF(drive); | 1029 | hwif = HWIF(drive); |
| 1015 | hwgroup = HWGROUP(drive); | 1030 | hwgroup = HWGROUP(drive); |
| @@ -1023,7 +1038,8 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
| 1023 | pre_reset(drive); | 1038 | pre_reset(drive); |
| 1024 | SELECT_DRIVE(drive); | 1039 | SELECT_DRIVE(drive); |
| 1025 | udelay (20); | 1040 | udelay (20); |
| 1026 | hwif->OUTBSYNC(drive, WIN_SRST, IDE_COMMAND_REG); | 1041 | hwif->OUTBSYNC(drive, WIN_SRST, |
| 1042 | hwif->io_ports[IDE_COMMAND_OFFSET]); | ||
| 1027 | ndelay(400); | 1043 | ndelay(400); |
| 1028 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; | 1044 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; |
| 1029 | hwgroup->polling = 1; | 1045 | hwgroup->polling = 1; |
| @@ -1039,7 +1055,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
| 1039 | for (unit = 0; unit < MAX_DRIVES; ++unit) | 1055 | for (unit = 0; unit < MAX_DRIVES; ++unit) |
| 1040 | pre_reset(&hwif->drives[unit]); | 1056 | pre_reset(&hwif->drives[unit]); |
| 1041 | 1057 | ||
| 1042 | if (!IDE_CONTROL_REG) { | 1058 | if (hwif->io_ports[IDE_CONTROL_OFFSET] == 0) { |
| 1043 | spin_unlock_irqrestore(&ide_lock, flags); | 1059 | spin_unlock_irqrestore(&ide_lock, flags); |
| 1044 | return ide_stopped; | 1060 | return ide_stopped; |
| 1045 | } | 1061 | } |
| @@ -1054,16 +1070,14 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
| 1054 | * recover from reset very quickly, saving us the first 50ms wait time. | 1070 | * recover from reset very quickly, saving us the first 50ms wait time. |
| 1055 | */ | 1071 | */ |
| 1056 | /* set SRST and nIEN */ | 1072 | /* set SRST and nIEN */ |
| 1057 | hwif->OUTBSYNC(drive, drive->ctl|6,IDE_CONTROL_REG); | 1073 | hwif->OUTBSYNC(drive, drive->ctl|6, hwif->io_ports[IDE_CONTROL_OFFSET]); |
| 1058 | /* more than enough time */ | 1074 | /* more than enough time */ |
| 1059 | udelay(10); | 1075 | udelay(10); |
| 1060 | if (drive->quirk_list == 2) { | 1076 | if (drive->quirk_list == 2) |
| 1061 | /* clear SRST and nIEN */ | 1077 | ctl = drive->ctl; /* clear SRST and nIEN */ |
| 1062 | hwif->OUTBSYNC(drive, drive->ctl, IDE_CONTROL_REG); | 1078 | else |
| 1063 | } else { | 1079 | ctl = drive->ctl | 2; /* clear SRST, leave nIEN */ |
| 1064 | /* clear SRST, leave nIEN */ | 1080 | hwif->OUTBSYNC(drive, ctl, hwif->io_ports[IDE_CONTROL_OFFSET]); |
| 1065 | hwif->OUTBSYNC(drive, drive->ctl|2, IDE_CONTROL_REG); | ||
| 1066 | } | ||
| 1067 | /* more than enough time */ | 1081 | /* more than enough time */ |
| 1068 | udelay(10); | 1082 | udelay(10); |
| 1069 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; | 1083 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; |
