Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (35 commits)
siimage: coding style cleanup (take 2)
ide-cd: clean up cdrom_analyze_sense_data()
ide-cd: fix test unsigned var < 0
ide: add TSSTcorp CDDVDW SH-S202H to ivb_list[]
piix: add Asus Eee 701 controller to short cable list
ARM: always select HAVE_IDE
remove the broken ETRAX_IDE driver
ide: remove ->dma_prdtable field from ide_hwif_t
ide: remove ->dma_vendor{1,3} fields from ide_hwif_t
scc_pata: add ->dma_host_set and ->dma_start methods
ide: skip "VLB sync" if host uses MMIO
ide: add ide_pad_transfer() helper
ide: remove ->INW and ->OUTW methods
ide: use IDE I/O helpers directly in ide_tf_{load,read}()
ns87415: add ->tf_read method
scc_pata: add ->tf_{load,read} methods
ide-h8300: add ->tf_{load,read} methods
ide-cris: add ->tf_{load,read} methods
ide: add ->tf_load and ->tf_read methods
ide: move ide_tf_{load,read} to ide-iops.c
...

+961 -1826
+1 -14
arch/arm/Kconfig
··· 8 8 config ARM 9 9 bool 10 10 default y 11 + select HAVE_IDE 11 12 select RTC_LIB 12 13 select SYS_SUPPORTS_APM_EMULATION 13 14 select HAVE_OPROFILE ··· 224 223 select TIMER_ACORN 225 224 select ISA 226 225 select NO_IOPORT 227 - select HAVE_IDE 228 226 help 229 227 Support for the Cirrus Logic PS7500FE system-on-a-chip. 230 228 ··· 236 236 bool "Co-EBSA285" 237 237 select FOOTBRIDGE 238 238 select FOOTBRIDGE_ADDIN 239 - select HAVE_IDE 240 239 help 241 240 Support for Intel's EBSA285 companion chip. 242 241 ··· 261 262 config ARCH_FOOTBRIDGE 262 263 bool "FootBridge" 263 264 select FOOTBRIDGE 264 - select HAVE_IDE 265 265 help 266 266 Support for systems based on the DC21285 companion chip 267 267 ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder. ··· 299 301 depends on MMU 300 302 select PLAT_IOP 301 303 select PCI 302 - select HAVE_IDE 303 304 help 304 305 Support for Intel's 80219 and IOP32X (XScale) family of 305 306 processors. ··· 308 311 depends on MMU 309 312 select PLAT_IOP 310 313 select PCI 311 - select HAVE_IDE 312 314 help 313 315 Support for Intel's IOP33X (XScale) family of processors. 314 316 315 317 config ARCH_IXP23XX 316 318 bool "IXP23XX-based" 317 319 depends on MMU 318 - select HAVE_IDE 319 320 select PCI 320 321 help 321 322 Support for Intel's IXP23xx (XScale) family of processors. ··· 331 336 select GENERIC_GPIO 332 337 select GENERIC_TIME 333 338 select GENERIC_CLOCKEVENTS 334 - select HAVE_IDE 335 339 help 336 340 Support for Intel's IXP4XX (XScale) family of processors. 337 341 338 342 config ARCH_L7200 339 343 bool "LinkUp-L7200" 340 344 select FIQ 341 - select HAVE_IDE 342 345 help 343 346 Say Y here if you intend to run this kernel on a LinkUp Systems 344 347 L7200 Software Development Board which uses an ARM720T processor. ··· 393 400 depends on MMU 394 401 select ARCH_MTD_XIP 395 402 select GENERIC_GPIO 396 - select HAVE_IDE 397 403 select HAVE_GPIO_LIB 398 404 select GENERIC_TIME 399 405 select GENERIC_CLOCKEVENTS ··· 408 416 select ARCH_MAY_HAVE_PC_FDC 409 417 select ISA_DMA_API 410 418 select NO_IOPORT 411 - select HAVE_IDE 412 419 help 413 420 On the Acorn Risc-PC, Linux can support the internal IDE disk and 414 421 CD-ROM interface, serial and parallel port, and the floppy drive. ··· 423 432 select GENERIC_TIME 424 433 select GENERIC_CLOCKEVENTS 425 434 select TICK_ONESHOT 426 - select HAVE_IDE 427 435 select HAVE_GPIO_LIB 428 436 help 429 437 Support for StrongARM 11x0 based boards. ··· 430 440 config ARCH_S3C2410 431 441 bool "Samsung S3C2410, S3C2412, S3C2413, S3C2440, S3C2442, S3C2443" 432 442 select GENERIC_GPIO 433 - select HAVE_IDE 434 443 help 435 444 Samsung S3C2410X CPU based systems, such as the Simtec Electronics 436 445 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or ··· 437 448 438 449 config ARCH_SHARK 439 450 bool "Shark" 440 - select HAVE_IDE 441 451 select ISA 442 452 select ISA_DMA 443 453 select PCI ··· 446 458 447 459 config ARCH_LH7A40X 448 460 bool "Sharp LH7A40X" 449 - select HAVE_IDE 450 461 help 451 462 Say Y here for systems based on one of the Sharp LH7A40X 452 463 System on a Chip processors. These CPUs include an ARM922T
-34
drivers/ide/Kconfig
··· 862 862 Say Y here if you want to support the onboard IDE channels on the 863 863 Simtec BAST or the Thorcom VR1000 864 864 865 - config ETRAX_IDE 866 - tristate "ETRAX IDE support" 867 - depends on CRIS && BROKEN 868 - select BLK_DEV_IDEDMA 869 - help 870 - Enables the ETRAX IDE driver. 871 - 872 - You can't use parallel ports or SCSI ports at the same time. 873 - 874 - config ETRAX_IDE_DELAY 875 - int "Delay for drives to regain consciousness" 876 - depends on ETRAX_IDE && ETRAX_ARCH_V10 877 - default 15 878 - help 879 - Number of seconds to wait for IDE drives to spin up after an IDE 880 - reset. 881 - 882 - choice 883 - prompt "IDE reset pin" 884 - depends on ETRAX_IDE && ETRAX_ARCH_V10 885 - default ETRAX_IDE_PB7_RESET 886 - 887 - config ETRAX_IDE_PB7_RESET 888 - bool "Port_PB_Bit_7" 889 - help 890 - IDE reset on pin 7 on port B 891 - 892 - config ETRAX_IDE_G27_RESET 893 - bool "Port_G_Bit_27" 894 - help 895 - IDE reset on pin 27 on port G 896 - 897 - endchoice 898 - 899 865 config IDE_H8300 900 866 tristate "H8300 IDE support" 901 867 depends on H8300
+1 -1
drivers/ide/Makefile
··· 35 35 obj-y += cmd640-core.o 36 36 endif 37 37 38 - obj-$(CONFIG_BLK_DEV_IDE) += cris/ ppc/ 38 + obj-$(CONFIG_BLK_DEV_IDE) += ppc/ 39 39 obj-$(CONFIG_IDE_H8300) += h8300/ 40 40 obj-$(CONFIG_IDE_GENERIC) += ide-generic.o 41 41 obj-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o
+1 -1
drivers/ide/arm/icside.c
··· 483 483 .init_dma = icside_dma_off_init, 484 484 .port_ops = &icside_v6_no_dma_port_ops, 485 485 .dma_ops = &icside_v6_dma_ops, 486 - .host_flags = IDE_HFLAG_SERIALIZE, 486 + .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_MMIO, 487 487 .mwdma_mask = ATA_MWDMA2, 488 488 .swdma_mask = ATA_SWDMA2, 489 489 };
+1
drivers/ide/arm/palm_bk3710.c
··· 342 342 static const struct ide_port_info __devinitdata palm_bk3710_port_info = { 343 343 .init_dma = palm_bk3710_init_dma, 344 344 .port_ops = &palm_bk3710_ports_ops, 345 + .host_flags = IDE_HFLAG_MMIO, 345 346 .pio_mask = ATA_PIO4, 346 347 .udma_mask = ATA_UDMA4, /* (input clk 99MHz) */ 347 348 .mwdma_mask = ATA_MWDMA2,
+1
drivers/ide/arm/rapide.c
··· 53 53 54 54 ide_init_port_hw(hwif, &hw); 55 55 56 + hwif->host_flags = IDE_HFLAG_MMIO; 56 57 default_hwif_mmiops(hwif); 57 58 58 59 idx[0] = hwif->index;
-3
drivers/ide/cris/Makefile
··· 1 - EXTRA_CFLAGS += -Idrivers/ide 2 - 3 - obj-$(CONFIG_IDE_ETRAX) += ide-cris.o
-1086
drivers/ide/cris/ide-cris.c
··· 1 - /* 2 - * Etrax specific IDE functions, like init and PIO-mode setting etc. 3 - * Almost the entire ide.c is used for the rest of the Etrax ATA driver. 4 - * Copyright (c) 2000-2005 Axis Communications AB 5 - * 6 - * Authors: Bjorn Wesen (initial version) 7 - * Mikael Starvik (crisv32 port) 8 - */ 9 - 10 - /* Regarding DMA: 11 - * 12 - * There are two forms of DMA - "DMA handshaking" between the interface and the drive, 13 - * and DMA between the memory and the interface. We can ALWAYS use the latter, since it's 14 - * something built-in in the Etrax. However only some drives support the DMA-mode handshaking 15 - * on the ATA-bus. The normal PC driver and Triton interface disables memory-if DMA when the 16 - * device can't do DMA handshaking for some stupid reason. We don't need to do that. 17 - */ 18 - 19 - #include <linux/types.h> 20 - #include <linux/kernel.h> 21 - #include <linux/timer.h> 22 - #include <linux/mm.h> 23 - #include <linux/interrupt.h> 24 - #include <linux/delay.h> 25 - #include <linux/blkdev.h> 26 - #include <linux/hdreg.h> 27 - #include <linux/ide.h> 28 - #include <linux/init.h> 29 - 30 - #include <asm/io.h> 31 - #include <asm/dma.h> 32 - 33 - /* number of DMA descriptors */ 34 - #define MAX_DMA_DESCRS 64 35 - 36 - /* number of times to retry busy-flags when reading/writing IDE-registers 37 - * this can't be too high because a hung harddisk might cause the watchdog 38 - * to trigger (sometimes INB and OUTB are called with irq's disabled) 39 - */ 40 - 41 - #define IDE_REGISTER_TIMEOUT 300 42 - 43 - #define LOWDB(x) 44 - #define D(x) 45 - 46 - enum /* Transfer types */ 47 - { 48 - TYPE_PIO, 49 - TYPE_DMA, 50 - TYPE_UDMA 51 - }; 52 - 53 - /* CRISv32 specifics */ 54 - #ifdef CONFIG_ETRAX_ARCH_V32 55 - #include <asm/arch/hwregs/ata_defs.h> 56 - #include <asm/arch/hwregs/dma_defs.h> 57 - #include <asm/arch/hwregs/dma.h> 58 - #include <asm/arch/pinmux.h> 59 - 60 - #define ATA_UDMA2_CYC 2 61 - #define ATA_UDMA2_DVS 3 62 - #define ATA_UDMA1_CYC 2 63 - #define ATA_UDMA1_DVS 4 64 - #define ATA_UDMA0_CYC 4 65 - #define ATA_UDMA0_DVS 6 66 - #define ATA_DMA2_STROBE 7 67 - #define ATA_DMA2_HOLD 1 68 - #define ATA_DMA1_STROBE 8 69 - #define ATA_DMA1_HOLD 3 70 - #define ATA_DMA0_STROBE 25 71 - #define ATA_DMA0_HOLD 19 72 - #define ATA_PIO4_SETUP 3 73 - #define ATA_PIO4_STROBE 7 74 - #define ATA_PIO4_HOLD 1 75 - #define ATA_PIO3_SETUP 3 76 - #define ATA_PIO3_STROBE 9 77 - #define ATA_PIO3_HOLD 3 78 - #define ATA_PIO2_SETUP 3 79 - #define ATA_PIO2_STROBE 13 80 - #define ATA_PIO2_HOLD 5 81 - #define ATA_PIO1_SETUP 5 82 - #define ATA_PIO1_STROBE 23 83 - #define ATA_PIO1_HOLD 9 84 - #define ATA_PIO0_SETUP 9 85 - #define ATA_PIO0_STROBE 39 86 - #define ATA_PIO0_HOLD 9 87 - 88 - int 89 - cris_ide_ack_intr(ide_hwif_t* hwif) 90 - { 91 - reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2, int, 92 - hwif->io_ports.data_addr); 93 - REG_WR_INT(ata, regi_ata, rw_ack_intr, 1 << ctrl2.sel); 94 - return 1; 95 - } 96 - 97 - static inline int 98 - cris_ide_busy(void) 99 - { 100 - reg_ata_rs_stat_data stat_data; 101 - stat_data = REG_RD(ata, regi_ata, rs_stat_data); 102 - return stat_data.busy; 103 - } 104 - 105 - static inline int 106 - cris_ide_ready(void) 107 - { 108 - return !cris_ide_busy(); 109 - } 110 - 111 - static inline int 112 - cris_ide_data_available(unsigned short* data) 113 - { 114 - reg_ata_rs_stat_data stat_data; 115 - stat_data = REG_RD(ata, regi_ata, rs_stat_data); 116 - *data = stat_data.data; 117 - return stat_data.dav; 118 - } 119 - 120 - static void 121 - cris_ide_write_command(unsigned long command) 122 - { 123 - REG_WR_INT(ata, regi_ata, rw_ctrl2, command); /* write data to the drive's register */ 124 - } 125 - 126 - static void 127 - cris_ide_set_speed(int type, int setup, int strobe, int hold) 128 - { 129 - reg_ata_rw_ctrl0 ctrl0 = REG_RD(ata, regi_ata, rw_ctrl0); 130 - reg_ata_rw_ctrl1 ctrl1 = REG_RD(ata, regi_ata, rw_ctrl1); 131 - 132 - if (type == TYPE_PIO) { 133 - ctrl0.pio_setup = setup; 134 - ctrl0.pio_strb = strobe; 135 - ctrl0.pio_hold = hold; 136 - } else if (type == TYPE_DMA) { 137 - ctrl0.dma_strb = strobe; 138 - ctrl0.dma_hold = hold; 139 - } else if (type == TYPE_UDMA) { 140 - ctrl1.udma_tcyc = setup; 141 - ctrl1.udma_tdvs = strobe; 142 - } 143 - REG_WR(ata, regi_ata, rw_ctrl0, ctrl0); 144 - REG_WR(ata, regi_ata, rw_ctrl1, ctrl1); 145 - } 146 - 147 - static unsigned long 148 - cris_ide_base_address(int bus) 149 - { 150 - reg_ata_rw_ctrl2 ctrl2 = {0}; 151 - ctrl2.sel = bus; 152 - return REG_TYPE_CONV(int, reg_ata_rw_ctrl2, ctrl2); 153 - } 154 - 155 - static unsigned long 156 - cris_ide_reg_addr(unsigned long addr, int cs0, int cs1) 157 - { 158 - reg_ata_rw_ctrl2 ctrl2 = {0}; 159 - ctrl2.addr = addr; 160 - ctrl2.cs1 = cs1; 161 - ctrl2.cs0 = cs0; 162 - return REG_TYPE_CONV(int, reg_ata_rw_ctrl2, ctrl2); 163 - } 164 - 165 - static __init void 166 - cris_ide_reset(unsigned val) 167 - { 168 - reg_ata_rw_ctrl0 ctrl0 = {0}; 169 - ctrl0.rst = val ? regk_ata_active : regk_ata_inactive; 170 - REG_WR(ata, regi_ata, rw_ctrl0, ctrl0); 171 - } 172 - 173 - static __init void 174 - cris_ide_init(void) 175 - { 176 - reg_ata_rw_ctrl0 ctrl0 = {0}; 177 - reg_ata_rw_intr_mask intr_mask = {0}; 178 - 179 - ctrl0.en = regk_ata_yes; 180 - REG_WR(ata, regi_ata, rw_ctrl0, ctrl0); 181 - 182 - intr_mask.bus0 = regk_ata_yes; 183 - intr_mask.bus1 = regk_ata_yes; 184 - intr_mask.bus2 = regk_ata_yes; 185 - intr_mask.bus3 = regk_ata_yes; 186 - 187 - REG_WR(ata, regi_ata, rw_intr_mask, intr_mask); 188 - 189 - crisv32_request_dma(2, "ETRAX FS built-in ATA", DMA_VERBOSE_ON_ERROR, 0, dma_ata); 190 - crisv32_request_dma(3, "ETRAX FS built-in ATA", DMA_VERBOSE_ON_ERROR, 0, dma_ata); 191 - 192 - crisv32_pinmux_alloc_fixed(pinmux_ata); 193 - crisv32_pinmux_alloc_fixed(pinmux_ata0); 194 - crisv32_pinmux_alloc_fixed(pinmux_ata1); 195 - crisv32_pinmux_alloc_fixed(pinmux_ata2); 196 - crisv32_pinmux_alloc_fixed(pinmux_ata3); 197 - 198 - DMA_RESET(regi_dma2); 199 - DMA_ENABLE(regi_dma2); 200 - DMA_RESET(regi_dma3); 201 - DMA_ENABLE(regi_dma3); 202 - 203 - DMA_WR_CMD (regi_dma2, regk_dma_set_w_size2); 204 - DMA_WR_CMD (regi_dma3, regk_dma_set_w_size2); 205 - } 206 - 207 - static dma_descr_context mycontext __attribute__ ((__aligned__(32))); 208 - 209 - #define cris_dma_descr_type dma_descr_data 210 - #define cris_pio_read regk_ata_rd 211 - #define cris_ultra_mask 0x7 212 - #define MAX_DESCR_SIZE 0xffffffffUL 213 - 214 - static unsigned long 215 - cris_ide_get_reg(unsigned long reg) 216 - { 217 - return (reg & 0x0e000000) >> 25; 218 - } 219 - 220 - static void 221 - cris_ide_fill_descriptor(cris_dma_descr_type *d, void* buf, unsigned int len, int last) 222 - { 223 - d->buf = (char*)virt_to_phys(buf); 224 - d->after = d->buf + len; 225 - d->eol = last; 226 - } 227 - 228 - static void 229 - cris_ide_start_dma(ide_drive_t *drive, cris_dma_descr_type *d, int dir,int type,int len) 230 - { 231 - ide_hwif_t *hwif = drive->hwif; 232 - 233 - reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2, int, 234 - hwif->io_ports.data_addr); 235 - reg_ata_rw_trf_cnt trf_cnt = {0}; 236 - 237 - mycontext.saved_data = (dma_descr_data*)virt_to_phys(d); 238 - mycontext.saved_data_buf = d->buf; 239 - /* start the dma channel */ 240 - DMA_START_CONTEXT(dir ? regi_dma3 : regi_dma2, virt_to_phys(&mycontext)); 241 - 242 - /* initiate a multi word dma read using PIO handshaking */ 243 - trf_cnt.cnt = len >> 1; 244 - /* Due to a "feature" the transfer count has to be one extra word for UDMA. */ 245 - if (type == TYPE_UDMA) 246 - trf_cnt.cnt++; 247 - REG_WR(ata, regi_ata, rw_trf_cnt, trf_cnt); 248 - 249 - ctrl2.rw = dir ? regk_ata_rd : regk_ata_wr; 250 - ctrl2.trf_mode = regk_ata_dma; 251 - ctrl2.hsh = type == TYPE_PIO ? regk_ata_pio : 252 - type == TYPE_DMA ? regk_ata_dma : regk_ata_udma; 253 - ctrl2.multi = regk_ata_yes; 254 - ctrl2.dma_size = regk_ata_word; 255 - REG_WR(ata, regi_ata, rw_ctrl2, ctrl2); 256 - } 257 - 258 - static void 259 - cris_ide_wait_dma(int dir) 260 - { 261 - reg_dma_rw_stat status; 262 - do 263 - { 264 - status = REG_RD(dma, dir ? regi_dma3 : regi_dma2, rw_stat); 265 - } while(status.list_state != regk_dma_data_at_eol); 266 - } 267 - 268 - static int cris_dma_test_irq(ide_drive_t *drive) 269 - { 270 - ide_hwif_t *hwif = drive->hwif; 271 - int intr = REG_RD_INT(ata, regi_ata, r_intr); 272 - 273 - reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2, int, 274 - hwif->io_ports.data_addr); 275 - 276 - return intr & (1 << ctrl2.sel) ? 1 : 0; 277 - } 278 - 279 - static void cris_ide_initialize_dma(int dir) 280 - { 281 - } 282 - 283 - #else 284 - /* CRISv10 specifics */ 285 - #include <asm/arch/svinto.h> 286 - #include <asm/arch/io_interface_mux.h> 287 - 288 - /* PIO timing (in R_ATA_CONFIG) 289 - * 290 - * _____________________________ 291 - * ADDRESS : ________/ 292 - * 293 - * _______________ 294 - * DIOR : ____________/ \__________ 295 - * 296 - * _______________ 297 - * DATA : XXXXXXXXXXXXXXXX_______________XXXXXXXX 298 - * 299 - * 300 - * DIOR is unbuffered while address and data is buffered. 301 - * This creates two problems: 302 - * 1. The DIOR pulse is to early (because it is unbuffered) 303 - * 2. The rise time of DIOR is long 304 - * 305 - * There are at least three different plausible solutions 306 - * 1. Use a pad capable of larger currents in Etrax 307 - * 2. Use an external buffer 308 - * 3. Make the strobe pulse longer 309 - * 310 - * Some of the strobe timings below are modified to compensate 311 - * for this. This implies a slight performance decrease. 312 - * 313 - * THIS SHOULD NEVER BE CHANGED! 314 - * 315 - * TODO: Is this true for the latest LX boards still ? 316 - */ 317 - 318 - #define ATA_UDMA2_CYC 0 /* No UDMA supported, just to make it compile. */ 319 - #define ATA_UDMA2_DVS 0 320 - #define ATA_UDMA1_CYC 0 321 - #define ATA_UDMA1_DVS 0 322 - #define ATA_UDMA0_CYC 0 323 - #define ATA_UDMA0_DVS 0 324 - #define ATA_DMA2_STROBE 4 325 - #define ATA_DMA2_HOLD 0 326 - #define ATA_DMA1_STROBE 4 327 - #define ATA_DMA1_HOLD 1 328 - #define ATA_DMA0_STROBE 12 329 - #define ATA_DMA0_HOLD 9 330 - #define ATA_PIO4_SETUP 1 331 - #define ATA_PIO4_STROBE 5 332 - #define ATA_PIO4_HOLD 0 333 - #define ATA_PIO3_SETUP 1 334 - #define ATA_PIO3_STROBE 5 335 - #define ATA_PIO3_HOLD 1 336 - #define ATA_PIO2_SETUP 1 337 - #define ATA_PIO2_STROBE 6 338 - #define ATA_PIO2_HOLD 2 339 - #define ATA_PIO1_SETUP 2 340 - #define ATA_PIO1_STROBE 11 341 - #define ATA_PIO1_HOLD 4 342 - #define ATA_PIO0_SETUP 4 343 - #define ATA_PIO0_STROBE 19 344 - #define ATA_PIO0_HOLD 4 345 - 346 - int 347 - cris_ide_ack_intr(ide_hwif_t* hwif) 348 - { 349 - return 1; 350 - } 351 - 352 - static inline int 353 - cris_ide_busy(void) 354 - { 355 - return *R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy) ; 356 - } 357 - 358 - static inline int 359 - cris_ide_ready(void) 360 - { 361 - return *R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, tr_rdy) ; 362 - } 363 - 364 - static inline int 365 - cris_ide_data_available(unsigned short* data) 366 - { 367 - unsigned long status = *R_ATA_STATUS_DATA; 368 - *data = (unsigned short)status; 369 - return status & IO_MASK(R_ATA_STATUS_DATA, dav); 370 - } 371 - 372 - static void 373 - cris_ide_write_command(unsigned long command) 374 - { 375 - *R_ATA_CTRL_DATA = command; 376 - } 377 - 378 - static void 379 - cris_ide_set_speed(int type, int setup, int strobe, int hold) 380 - { 381 - static int pio_setup = ATA_PIO4_SETUP; 382 - static int pio_strobe = ATA_PIO4_STROBE; 383 - static int pio_hold = ATA_PIO4_HOLD; 384 - static int dma_strobe = ATA_DMA2_STROBE; 385 - static int dma_hold = ATA_DMA2_HOLD; 386 - 387 - if (type == TYPE_PIO) { 388 - pio_setup = setup; 389 - pio_strobe = strobe; 390 - pio_hold = hold; 391 - } else if (type == TYPE_DMA) { 392 - dma_strobe = strobe; 393 - dma_hold = hold; 394 - } 395 - *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 ) | 396 - IO_FIELD( R_ATA_CONFIG, dma_strobe, dma_strobe ) | 397 - IO_FIELD( R_ATA_CONFIG, dma_hold, dma_hold ) | 398 - IO_FIELD( R_ATA_CONFIG, pio_setup, pio_setup ) | 399 - IO_FIELD( R_ATA_CONFIG, pio_strobe, pio_strobe ) | 400 - IO_FIELD( R_ATA_CONFIG, pio_hold, pio_hold ) ); 401 - } 402 - 403 - static unsigned long 404 - cris_ide_base_address(int bus) 405 - { 406 - return IO_FIELD(R_ATA_CTRL_DATA, sel, bus); 407 - } 408 - 409 - static unsigned long 410 - cris_ide_reg_addr(unsigned long addr, int cs0, int cs1) 411 - { 412 - return IO_FIELD(R_ATA_CTRL_DATA, addr, addr) | 413 - IO_FIELD(R_ATA_CTRL_DATA, cs0, cs0) | 414 - IO_FIELD(R_ATA_CTRL_DATA, cs1, cs1); 415 - } 416 - 417 - static __init void 418 - cris_ide_reset(unsigned val) 419 - { 420 - #ifdef CONFIG_ETRAX_IDE_G27_RESET 421 - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, val); 422 - #endif 423 - #ifdef CONFIG_ETRAX_IDE_PB7_RESET 424 - port_pb_dir_shadow = port_pb_dir_shadow | 425 - IO_STATE(R_PORT_PB_DIR, dir7, output); 426 - *R_PORT_PB_DIR = port_pb_dir_shadow; 427 - REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 7, val); 428 - #endif 429 - } 430 - 431 - static __init void 432 - cris_ide_init(void) 433 - { 434 - volatile unsigned int dummy; 435 - 436 - *R_ATA_CTRL_DATA = 0; 437 - *R_ATA_TRANSFER_CNT = 0; 438 - *R_ATA_CONFIG = 0; 439 - 440 - if (cris_request_io_interface(if_ata, "ETRAX100LX IDE")) { 441 - printk(KERN_CRIT "ide: Failed to get IO interface\n"); 442 - return; 443 - } else if (cris_request_dma(ATA_TX_DMA_NBR, 444 - "ETRAX100LX IDE TX", 445 - DMA_VERBOSE_ON_ERROR, 446 - dma_ata)) { 447 - cris_free_io_interface(if_ata); 448 - printk(KERN_CRIT "ide: Failed to get Tx DMA channel\n"); 449 - return; 450 - } else if (cris_request_dma(ATA_RX_DMA_NBR, 451 - "ETRAX100LX IDE RX", 452 - DMA_VERBOSE_ON_ERROR, 453 - dma_ata)) { 454 - cris_free_dma(ATA_TX_DMA_NBR, "ETRAX100LX IDE Tx"); 455 - cris_free_io_interface(if_ata); 456 - printk(KERN_CRIT "ide: Failed to get Rx DMA channel\n"); 457 - return; 458 - } 459 - 460 - /* make a dummy read to set the ata controller in a proper state */ 461 - dummy = *R_ATA_STATUS_DATA; 462 - 463 - *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 )); 464 - *R_ATA_CTRL_DATA = ( IO_STATE( R_ATA_CTRL_DATA, rw, read) | 465 - IO_FIELD( R_ATA_CTRL_DATA, addr, 1 ) ); 466 - 467 - while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)); /* wait for busy flag*/ 468 - 469 - *R_IRQ_MASK0_SET = ( IO_STATE( R_IRQ_MASK0_SET, ata_irq0, set ) | 470 - IO_STATE( R_IRQ_MASK0_SET, ata_irq1, set ) | 471 - IO_STATE( R_IRQ_MASK0_SET, ata_irq2, set ) | 472 - IO_STATE( R_IRQ_MASK0_SET, ata_irq3, set ) ); 473 - 474 - /* reset the dma channels we will use */ 475 - 476 - RESET_DMA(ATA_TX_DMA_NBR); 477 - RESET_DMA(ATA_RX_DMA_NBR); 478 - WAIT_DMA(ATA_TX_DMA_NBR); 479 - WAIT_DMA(ATA_RX_DMA_NBR); 480 - } 481 - 482 - #define cris_dma_descr_type etrax_dma_descr 483 - #define cris_pio_read IO_STATE(R_ATA_CTRL_DATA, rw, read) 484 - #define cris_ultra_mask 0x0 485 - #define MAX_DESCR_SIZE 0x10000UL 486 - 487 - static unsigned long 488 - cris_ide_get_reg(unsigned long reg) 489 - { 490 - return (reg & 0x0e000000) >> 25; 491 - } 492 - 493 - static void 494 - cris_ide_fill_descriptor(cris_dma_descr_type *d, void* buf, unsigned int len, int last) 495 - { 496 - d->buf = virt_to_phys(buf); 497 - d->sw_len = len == MAX_DESCR_SIZE ? 0 : len; 498 - if (last) 499 - d->ctrl |= d_eol; 500 - } 501 - 502 - static void cris_ide_start_dma(ide_drive_t *drive, cris_dma_descr_type *d, int dir, int type, int len) 503 - { 504 - unsigned long cmd; 505 - 506 - if (dir) { 507 - /* need to do this before RX DMA due to a chip bug 508 - * it is enough to just flush the part of the cache that 509 - * corresponds to the buffers we start, but since HD transfers 510 - * usually are more than 8 kB, it is easier to optimize for the 511 - * normal case and just flush the entire cache. its the only 512 - * way to be sure! (OB movie quote) 513 - */ 514 - flush_etrax_cache(); 515 - *R_DMA_CH3_FIRST = virt_to_phys(d); 516 - *R_DMA_CH3_CMD = IO_STATE(R_DMA_CH3_CMD, cmd, start); 517 - 518 - } else { 519 - *R_DMA_CH2_FIRST = virt_to_phys(d); 520 - *R_DMA_CH2_CMD = IO_STATE(R_DMA_CH2_CMD, cmd, start); 521 - } 522 - 523 - /* initiate a multi word dma read using DMA handshaking */ 524 - 525 - *R_ATA_TRANSFER_CNT = 526 - IO_FIELD(R_ATA_TRANSFER_CNT, count, len >> 1); 527 - 528 - cmd = dir ? IO_STATE(R_ATA_CTRL_DATA, rw, read) : IO_STATE(R_ATA_CTRL_DATA, rw, write); 529 - cmd |= type == TYPE_PIO ? IO_STATE(R_ATA_CTRL_DATA, handsh, pio) : 530 - IO_STATE(R_ATA_CTRL_DATA, handsh, dma); 531 - *R_ATA_CTRL_DATA = 532 - cmd | 533 - IO_FIELD(R_ATA_CTRL_DATA, data, 534 - drive->hwif->io_ports.data_addr) | 535 - IO_STATE(R_ATA_CTRL_DATA, src_dst, dma) | 536 - IO_STATE(R_ATA_CTRL_DATA, multi, on) | 537 - IO_STATE(R_ATA_CTRL_DATA, dma_size, word); 538 - } 539 - 540 - static void 541 - cris_ide_wait_dma(int dir) 542 - { 543 - if (dir) 544 - WAIT_DMA(ATA_RX_DMA_NBR); 545 - else 546 - WAIT_DMA(ATA_TX_DMA_NBR); 547 - } 548 - 549 - static int cris_dma_test_irq(ide_drive_t *drive) 550 - { 551 - int intr = *R_IRQ_MASK0_RD; 552 - int bus = IO_EXTRACT(R_ATA_CTRL_DATA, sel, 553 - drive->hwif->io_ports.data_addr); 554 - 555 - return intr & (1 << (bus + IO_BITNR(R_IRQ_MASK0_RD, ata_irq0))) ? 1 : 0; 556 - } 557 - 558 - 559 - static void cris_ide_initialize_dma(int dir) 560 - { 561 - if (dir) 562 - { 563 - RESET_DMA(ATA_RX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */ 564 - WAIT_DMA(ATA_RX_DMA_NBR); 565 - } 566 - else 567 - { 568 - RESET_DMA(ATA_TX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */ 569 - WAIT_DMA(ATA_TX_DMA_NBR); 570 - } 571 - } 572 - 573 - #endif 574 - 575 - void 576 - cris_ide_outw(unsigned short data, unsigned long reg) { 577 - int timeleft; 578 - 579 - LOWDB(printk("ow: data 0x%x, reg 0x%x\n", data, reg)); 580 - 581 - /* note the lack of handling any timeouts. we stop waiting, but we don't 582 - * really notify anybody. 583 - */ 584 - 585 - timeleft = IDE_REGISTER_TIMEOUT; 586 - /* wait for busy flag */ 587 - do { 588 - timeleft--; 589 - } while(timeleft && cris_ide_busy()); 590 - 591 - /* 592 - * Fall through at a timeout, so the ongoing command will be 593 - * aborted by the write below, which is expected to be a dummy 594 - * command to the command register. This happens when a faulty 595 - * drive times out on a command. See comment on timeout in 596 - * INB. 597 - */ 598 - if(!timeleft) 599 - printk("ATA timeout reg 0x%lx := 0x%x\n", reg, data); 600 - 601 - cris_ide_write_command(reg|data); /* write data to the drive's register */ 602 - 603 - timeleft = IDE_REGISTER_TIMEOUT; 604 - /* wait for transmitter ready */ 605 - do { 606 - timeleft--; 607 - } while(timeleft && !cris_ide_ready()); 608 - } 609 - 610 - void 611 - cris_ide_outb(unsigned char data, unsigned long reg) 612 - { 613 - cris_ide_outw(data, reg); 614 - } 615 - 616 - void 617 - cris_ide_outbsync(ide_drive_t *drive, u8 addr, unsigned long port) 618 - { 619 - cris_ide_outw(addr, port); 620 - } 621 - 622 - unsigned short 623 - cris_ide_inw(unsigned long reg) { 624 - int timeleft; 625 - unsigned short val; 626 - 627 - timeleft = IDE_REGISTER_TIMEOUT; 628 - /* wait for busy flag */ 629 - do { 630 - timeleft--; 631 - } while(timeleft && cris_ide_busy()); 632 - 633 - if(!timeleft) { 634 - /* 635 - * If we're asked to read the status register, like for 636 - * example when a command does not complete for an 637 - * extended time, but the ATA interface is stuck in a 638 - * busy state at the *ETRAX* ATA interface level (as has 639 - * happened repeatedly with at least one bad disk), then 640 - * the best thing to do is to pretend that we read 641 - * "busy" in the status register, so the IDE driver will 642 - * time-out, abort the ongoing command and perform a 643 - * reset sequence. Note that the subsequent OUT_BYTE 644 - * call will also timeout on busy, but as long as the 645 - * write is still performed, everything will be fine. 646 - */ 647 - if (cris_ide_get_reg(reg) == 7) 648 - return BUSY_STAT; 649 - else 650 - /* For other rare cases we assume 0 is good enough. */ 651 - return 0; 652 - } 653 - 654 - cris_ide_write_command(reg | cris_pio_read); 655 - 656 - timeleft = IDE_REGISTER_TIMEOUT; 657 - /* wait for available */ 658 - do { 659 - timeleft--; 660 - } while(timeleft && !cris_ide_data_available(&val)); 661 - 662 - if(!timeleft) 663 - return 0; 664 - 665 - LOWDB(printk("inb: 0x%x from reg 0x%x\n", val & 0xff, reg)); 666 - 667 - return val; 668 - } 669 - 670 - unsigned char 671 - cris_ide_inb(unsigned long reg) 672 - { 673 - return (unsigned char)cris_ide_inw(reg); 674 - } 675 - 676 - static void cris_ide_input_data (ide_drive_t *drive, void *, unsigned int); 677 - static void cris_ide_output_data (ide_drive_t *drive, void *, unsigned int); 678 - static void cris_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int); 679 - static void cris_atapi_output_bytes(ide_drive_t *drive, void *, unsigned int); 680 - 681 - static void cris_dma_host_set(ide_drive_t *drive, int on) 682 - { 683 - } 684 - 685 - static void cris_set_pio_mode(ide_drive_t *drive, const u8 pio) 686 - { 687 - int setup, strobe, hold; 688 - 689 - switch(pio) 690 - { 691 - case 0: 692 - setup = ATA_PIO0_SETUP; 693 - strobe = ATA_PIO0_STROBE; 694 - hold = ATA_PIO0_HOLD; 695 - break; 696 - case 1: 697 - setup = ATA_PIO1_SETUP; 698 - strobe = ATA_PIO1_STROBE; 699 - hold = ATA_PIO1_HOLD; 700 - break; 701 - case 2: 702 - setup = ATA_PIO2_SETUP; 703 - strobe = ATA_PIO2_STROBE; 704 - hold = ATA_PIO2_HOLD; 705 - break; 706 - case 3: 707 - setup = ATA_PIO3_SETUP; 708 - strobe = ATA_PIO3_STROBE; 709 - hold = ATA_PIO3_HOLD; 710 - break; 711 - case 4: 712 - setup = ATA_PIO4_SETUP; 713 - strobe = ATA_PIO4_STROBE; 714 - hold = ATA_PIO4_HOLD; 715 - break; 716 - default: 717 - return; 718 - } 719 - 720 - cris_ide_set_speed(TYPE_PIO, setup, strobe, hold); 721 - } 722 - 723 - static void cris_set_dma_mode(ide_drive_t *drive, const u8 speed) 724 - { 725 - int cyc = 0, dvs = 0, strobe = 0, hold = 0; 726 - 727 - switch(speed) 728 - { 729 - case XFER_UDMA_0: 730 - cyc = ATA_UDMA0_CYC; 731 - dvs = ATA_UDMA0_DVS; 732 - break; 733 - case XFER_UDMA_1: 734 - cyc = ATA_UDMA1_CYC; 735 - dvs = ATA_UDMA1_DVS; 736 - break; 737 - case XFER_UDMA_2: 738 - cyc = ATA_UDMA2_CYC; 739 - dvs = ATA_UDMA2_DVS; 740 - break; 741 - case XFER_MW_DMA_0: 742 - strobe = ATA_DMA0_STROBE; 743 - hold = ATA_DMA0_HOLD; 744 - break; 745 - case XFER_MW_DMA_1: 746 - strobe = ATA_DMA1_STROBE; 747 - hold = ATA_DMA1_HOLD; 748 - break; 749 - case XFER_MW_DMA_2: 750 - strobe = ATA_DMA2_STROBE; 751 - hold = ATA_DMA2_HOLD; 752 - break; 753 - } 754 - 755 - if (speed >= XFER_UDMA_0) 756 - cris_ide_set_speed(TYPE_UDMA, cyc, dvs, 0); 757 - else 758 - cris_ide_set_speed(TYPE_DMA, 0, strobe, hold); 759 - } 760 - 761 - static void __init cris_setup_ports(hw_regs_t *hw, unsigned long base) 762 - { 763 - int i; 764 - 765 - memset(hw, 0, sizeof(*hw)); 766 - 767 - for (i = 0; i <= 7; i++) 768 - hw->io_ports_array[i] = base + cris_ide_reg_addr(i, 0, 1); 769 - 770 - /* 771 - * the IDE control register is at ATA address 6, 772 - * with CS1 active instead of CS0 773 - */ 774 - hw->io_ports.ctl_addr = base + cris_ide_reg_addr(6, 1, 0); 775 - 776 - hw->irq = ide_default_irq(0); 777 - hw->ack_intr = cris_ide_ack_intr; 778 - } 779 - 780 - static const struct ide_port_ops cris_port_ops = { 781 - .set_pio_mode = cris_set_pio_mode, 782 - .set_dma_mode = cris_set_dma_mode, 783 - }; 784 - 785 - static const struct ide_dma_ops cris_dma_ops; 786 - 787 - static const struct ide_port_info cris_port_info __initdata = { 788 - .chipset = ide_etrax100, 789 - .port_ops = &cris_port_ops, 790 - .dma_ops = &cris_dma_ops, 791 - .host_flags = IDE_HFLAG_NO_ATAPI_DMA | 792 - IDE_HFLAG_NO_DMA, /* no SFF-style DMA */ 793 - .pio_mask = ATA_PIO4, 794 - .udma_mask = cris_ultra_mask, 795 - .mwdma_mask = ATA_MWDMA2, 796 - }; 797 - 798 - static int __init init_e100_ide(void) 799 - { 800 - hw_regs_t hw; 801 - int h; 802 - u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 803 - 804 - printk("ide: ETRAX FS built-in ATA DMA controller\n"); 805 - 806 - for (h = 0; h < 4; h++) { 807 - ide_hwif_t *hwif = NULL; 808 - 809 - cris_setup_ports(&hw, cris_ide_base_address(h)); 810 - 811 - hwif = ide_find_port(); 812 - if (hwif == NULL) 813 - continue; 814 - ide_init_port_data(hwif, hwif->index); 815 - ide_init_port_hw(hwif, &hw); 816 - 817 - hwif->ata_input_data = &cris_ide_input_data; 818 - hwif->ata_output_data = &cris_ide_output_data; 819 - hwif->atapi_input_bytes = &cris_atapi_input_bytes; 820 - hwif->atapi_output_bytes = &cris_atapi_output_bytes; 821 - hwif->OUTB = &cris_ide_outb; 822 - hwif->OUTW = &cris_ide_outw; 823 - hwif->OUTBSYNC = &cris_ide_outbsync; 824 - hwif->INB = &cris_ide_inb; 825 - hwif->INW = &cris_ide_inw; 826 - hwif->cbl = ATA_CBL_PATA40; 827 - 828 - idx[h] = hwif->index; 829 - } 830 - 831 - /* Reset pulse */ 832 - cris_ide_reset(0); 833 - udelay(25); 834 - cris_ide_reset(1); 835 - 836 - cris_ide_init(); 837 - 838 - cris_ide_set_speed(TYPE_PIO, ATA_PIO4_SETUP, ATA_PIO4_STROBE, ATA_PIO4_HOLD); 839 - cris_ide_set_speed(TYPE_DMA, 0, ATA_DMA2_STROBE, ATA_DMA2_HOLD); 840 - cris_ide_set_speed(TYPE_UDMA, ATA_UDMA2_CYC, ATA_UDMA2_DVS, 0); 841 - 842 - ide_device_add(idx, &cris_port_info); 843 - 844 - return 0; 845 - } 846 - 847 - static cris_dma_descr_type mydescr __attribute__ ((__aligned__(16))); 848 - 849 - /* 850 - * The following routines are mainly used by the ATAPI drivers. 851 - * 852 - * These routines will round up any request for an odd number of bytes, 853 - * so if an odd bytecount is specified, be sure that there's at least one 854 - * extra byte allocated for the buffer. 855 - */ 856 - static void 857 - cris_atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount) 858 - { 859 - D(printk("atapi_input_bytes, buffer 0x%x, count %d\n", 860 - buffer, bytecount)); 861 - 862 - if(bytecount & 1) { 863 - printk("warning, odd bytecount in cdrom_in_bytes = %d.\n", bytecount); 864 - bytecount++; /* to round off */ 865 - } 866 - 867 - /* setup DMA and start transfer */ 868 - 869 - cris_ide_fill_descriptor(&mydescr, buffer, bytecount, 1); 870 - cris_ide_start_dma(drive, &mydescr, 1, TYPE_PIO, bytecount); 871 - 872 - /* wait for completion */ 873 - LED_DISK_READ(1); 874 - cris_ide_wait_dma(1); 875 - LED_DISK_READ(0); 876 - } 877 - 878 - static void 879 - cris_atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount) 880 - { 881 - D(printk("atapi_output_bytes, buffer 0x%x, count %d\n", 882 - buffer, bytecount)); 883 - 884 - if(bytecount & 1) { 885 - printk("odd bytecount %d in atapi_out_bytes!\n", bytecount); 886 - bytecount++; 887 - } 888 - 889 - cris_ide_fill_descriptor(&mydescr, buffer, bytecount, 1); 890 - cris_ide_start_dma(drive, &mydescr, 0, TYPE_PIO, bytecount); 891 - 892 - /* wait for completion */ 893 - 894 - LED_DISK_WRITE(1); 895 - LED_DISK_READ(1); 896 - cris_ide_wait_dma(0); 897 - LED_DISK_WRITE(0); 898 - } 899 - 900 - /* 901 - * This is used for most PIO data transfers *from* the IDE interface 902 - */ 903 - static void 904 - cris_ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount) 905 - { 906 - cris_atapi_input_bytes(drive, buffer, wcount << 2); 907 - } 908 - 909 - /* 910 - * This is used for most PIO data transfers *to* the IDE interface 911 - */ 912 - static void 913 - cris_ide_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount) 914 - { 915 - cris_atapi_output_bytes(drive, buffer, wcount << 2); 916 - } 917 - 918 - /* we only have one DMA channel on the chip for ATA, so we can keep these statically */ 919 - static cris_dma_descr_type ata_descrs[MAX_DMA_DESCRS] __attribute__ ((__aligned__(16))); 920 - static unsigned int ata_tot_size; 921 - 922 - /* 923 - * cris_ide_build_dmatable() prepares a dma request. 924 - * Returns 0 if all went okay, returns 1 otherwise. 925 - */ 926 - static int cris_ide_build_dmatable (ide_drive_t *drive) 927 - { 928 - ide_hwif_t *hwif = drive->hwif; 929 - struct scatterlist* sg; 930 - struct request *rq = drive->hwif->hwgroup->rq; 931 - unsigned long size, addr; 932 - unsigned int count = 0; 933 - int i = 0; 934 - 935 - sg = hwif->sg_table; 936 - 937 - ata_tot_size = 0; 938 - 939 - ide_map_sg(drive, rq); 940 - i = hwif->sg_nents; 941 - 942 - while(i) { 943 - /* 944 - * Determine addr and size of next buffer area. We assume that 945 - * individual virtual buffers are always composed linearly in 946 - * physical memory. For example, we assume that any 8kB buffer 947 - * is always composed of two adjacent physical 4kB pages rather 948 - * than two possibly non-adjacent physical 4kB pages. 949 - */ 950 - /* group sequential buffers into one large buffer */ 951 - addr = sg_phys(sg); 952 - size = sg_dma_len(sg); 953 - while (--i) { 954 - sg = sg_next(sg); 955 - if ((addr + size) != sg_phys(sg)) 956 - break; 957 - size += sg_dma_len(sg); 958 - } 959 - 960 - /* did we run out of descriptors? */ 961 - 962 - if(count >= MAX_DMA_DESCRS) { 963 - printk("%s: too few DMA descriptors\n", drive->name); 964 - return 1; 965 - } 966 - 967 - /* however, this case is more difficult - rw_trf_cnt cannot be more 968 - than 65536 words per transfer, so in that case we need to either 969 - 1) use a DMA interrupt to re-trigger rw_trf_cnt and continue with 970 - the descriptors, or 971 - 2) simply do the request here, and get dma_intr to only ide_end_request on 972 - those blocks that were actually set-up for transfer. 973 - */ 974 - 975 - if(ata_tot_size + size > 131072) { 976 - printk("too large total ATA DMA request, %d + %d!\n", ata_tot_size, (int)size); 977 - return 1; 978 - } 979 - 980 - /* If size > MAX_DESCR_SIZE it has to be splitted into new descriptors. Since we 981 - don't handle size > 131072 only one split is necessary */ 982 - 983 - if(size > MAX_DESCR_SIZE) { 984 - cris_ide_fill_descriptor(&ata_descrs[count], (void*)addr, MAX_DESCR_SIZE, 0); 985 - count++; 986 - ata_tot_size += MAX_DESCR_SIZE; 987 - size -= MAX_DESCR_SIZE; 988 - addr += MAX_DESCR_SIZE; 989 - } 990 - 991 - cris_ide_fill_descriptor(&ata_descrs[count], (void*)addr, size,i ? 0 : 1); 992 - count++; 993 - ata_tot_size += size; 994 - } 995 - 996 - if (count) { 997 - /* return and say all is ok */ 998 - return 0; 999 - } 1000 - 1001 - printk("%s: empty DMA table?\n", drive->name); 1002 - return 1; /* let the PIO routines handle this weirdness */ 1003 - } 1004 - 1005 - /* 1006 - * cris_dma_intr() is the handler for disk read/write DMA interrupts 1007 - */ 1008 - static ide_startstop_t cris_dma_intr (ide_drive_t *drive) 1009 - { 1010 - LED_DISK_READ(0); 1011 - LED_DISK_WRITE(0); 1012 - 1013 - return ide_dma_intr(drive); 1014 - } 1015 - 1016 - /* 1017 - * Functions below initiates/aborts DMA read/write operations on a drive. 1018 - * 1019 - * The caller is assumed to have selected the drive and programmed the drive's 1020 - * sector address using CHS or LBA. All that remains is to prepare for DMA 1021 - * and then issue the actual read/write DMA/PIO command to the drive. 1022 - * 1023 - * For ATAPI devices, we just prepare for DMA and return. The caller should 1024 - * then issue the packet command to the drive and call us again with 1025 - * cris_dma_start afterwards. 1026 - * 1027 - * Returns 0 if all went well. 1028 - * Returns 1 if DMA read/write could not be started, in which case 1029 - * the caller should revert to PIO for the current request. 1030 - */ 1031 - 1032 - static int cris_dma_end(ide_drive_t *drive) 1033 - { 1034 - drive->waiting_for_dma = 0; 1035 - return 0; 1036 - } 1037 - 1038 - static int cris_dma_setup(ide_drive_t *drive) 1039 - { 1040 - struct request *rq = drive->hwif->hwgroup->rq; 1041 - 1042 - cris_ide_initialize_dma(!rq_data_dir(rq)); 1043 - if (cris_ide_build_dmatable (drive)) { 1044 - ide_map_sg(drive, rq); 1045 - return 1; 1046 - } 1047 - 1048 - drive->waiting_for_dma = 1; 1049 - return 0; 1050 - } 1051 - 1052 - static void cris_dma_exec_cmd(ide_drive_t *drive, u8 command) 1053 - { 1054 - ide_execute_command(drive, command, &cris_dma_intr, WAIT_CMD, NULL); 1055 - } 1056 - 1057 - static void cris_dma_start(ide_drive_t *drive) 1058 - { 1059 - struct request *rq = drive->hwif->hwgroup->rq; 1060 - int writing = rq_data_dir(rq); 1061 - int type = TYPE_DMA; 1062 - 1063 - if (drive->current_speed >= XFER_UDMA_0) 1064 - type = TYPE_UDMA; 1065 - 1066 - cris_ide_start_dma(drive, &ata_descrs[0], writing ? 0 : 1, type, ata_tot_size); 1067 - 1068 - if (writing) { 1069 - LED_DISK_WRITE(1); 1070 - } else { 1071 - LED_DISK_READ(1); 1072 - } 1073 - } 1074 - 1075 - static const struct ide_dma_ops cris_dma_ops = { 1076 - .dma_host_set = cris_dma_host_set, 1077 - .dma_setup = cris_dma_setup, 1078 - .dma_exec_cmd = cris_dma_exec_cmd, 1079 - .dma_start = cris_dma_start, 1080 - .dma_end = cris_dma_end, 1081 - .dma_test_irq = cris_dma_test_irq, 1082 - }; 1083 - 1084 - module_init(init_e100_ide); 1085 - 1086 - MODULE_LICENSE("GPL");
+102 -6
drivers/ide/h8300/ide-h8300.c
··· 42 42 return r; 43 43 } 44 44 45 + static void h8300_tf_load(ide_drive_t *drive, ide_task_t *task) 46 + { 47 + ide_hwif_t *hwif = drive->hwif; 48 + struct ide_io_ports *io_ports = &hwif->io_ports; 49 + struct ide_taskfile *tf = &task->tf; 50 + u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; 51 + 52 + if (task->tf_flags & IDE_TFLAG_FLAGGED) 53 + HIHI = 0xFF; 54 + 55 + ide_set_irq(drive, 1); 56 + 57 + if (task->tf_flags & IDE_TFLAG_OUT_DATA) 58 + mm_outw((tf->hob_data << 8) | tf->data, io_ports->data_addr); 59 + 60 + if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) 61 + outb(tf->hob_feature, io_ports->feature_addr); 62 + if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) 63 + outb(tf->hob_nsect, io_ports->nsect_addr); 64 + if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) 65 + outb(tf->hob_lbal, io_ports->lbal_addr); 66 + if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) 67 + outb(tf->hob_lbam, io_ports->lbam_addr); 68 + if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) 69 + outb(tf->hob_lbah, io_ports->lbah_addr); 70 + 71 + if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) 72 + outb(tf->feature, io_ports->feature_addr); 73 + if (task->tf_flags & IDE_TFLAG_OUT_NSECT) 74 + outb(tf->nsect, io_ports->nsect_addr); 75 + if (task->tf_flags & IDE_TFLAG_OUT_LBAL) 76 + outb(tf->lbal, io_ports->lbal_addr); 77 + if (task->tf_flags & IDE_TFLAG_OUT_LBAM) 78 + outb(tf->lbam, io_ports->lbam_addr); 79 + if (task->tf_flags & IDE_TFLAG_OUT_LBAH) 80 + outb(tf->lbah, io_ports->lbah_addr); 81 + 82 + if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) 83 + outb((tf->device & HIHI) | drive->select.all, 84 + io_ports->device_addr); 85 + } 86 + 87 + static void h8300_tf_read(ide_drive_t *drive, ide_task_t *task) 88 + { 89 + ide_hwif_t *hwif = drive->hwif; 90 + struct ide_io_ports *io_ports = &hwif->io_ports; 91 + struct ide_taskfile *tf = &task->tf; 92 + 93 + if (task->tf_flags & IDE_TFLAG_IN_DATA) { 94 + u16 data = mm_inw(io_ports->data_addr); 95 + 96 + tf->data = data & 0xff; 97 + tf->hob_data = (data >> 8) & 0xff; 98 + } 99 + 100 + /* be sure we're looking at the low order bits */ 101 + outb(drive->ctl & ~0x80, io_ports->ctl_addr); 102 + 103 + if (task->tf_flags & IDE_TFLAG_IN_NSECT) 104 + tf->nsect = inb(io_ports->nsect_addr); 105 + if (task->tf_flags & IDE_TFLAG_IN_LBAL) 106 + tf->lbal = inb(io_ports->lbal_addr); 107 + if (task->tf_flags & IDE_TFLAG_IN_LBAM) 108 + tf->lbam = inb(io_ports->lbam_addr); 109 + if (task->tf_flags & IDE_TFLAG_IN_LBAH) 110 + tf->lbah = inb(io_ports->lbah_addr); 111 + if (task->tf_flags & IDE_TFLAG_IN_DEVICE) 112 + tf->device = inb(io_ports->device_addr); 113 + 114 + if (task->tf_flags & IDE_TFLAG_LBA48) { 115 + outb(drive->ctl | 0x80, io_ports->ctl_addr); 116 + 117 + if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) 118 + tf->hob_feature = inb(io_ports->feature_addr); 119 + if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) 120 + tf->hob_nsect = inb(io_ports->nsect_addr); 121 + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) 122 + tf->hob_lbal = inb(io_ports->lbal_addr); 123 + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) 124 + tf->hob_lbam = inb(io_ports->lbam_addr); 125 + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) 126 + tf->hob_lbah = inb(io_ports->lbah_addr); 127 + } 128 + } 129 + 45 130 static void mm_outsw(unsigned long addr, void *buf, u32 len) 46 131 { 47 132 unsigned short *bp = (unsigned short *)buf; ··· 139 54 unsigned short *bp = (unsigned short *)buf; 140 55 for (; len > 0; len--, bp++) 141 56 *bp = bswap(*(volatile u16 *)addr); 57 + } 58 + 59 + static void h8300_input_data(ide_drive_t *drive, struct request *rq, 60 + void *buf, unsigned int len) 61 + { 62 + mm_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); 63 + } 64 + 65 + static void h8300_output_data(ide_drive_t *drive, struct request *rq, 66 + void *buf, unsigned int len) 67 + { 68 + mm_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); 142 69 } 143 70 144 71 #define H8300_IDE_GAP (2) ··· 171 74 { 172 75 default_hwif_iops(hwif); 173 76 174 - hwif->OUTW = mm_outw; 175 - hwif->OUTSW = mm_outsw; 176 - hwif->INW = mm_inw; 177 - hwif->INSW = mm_insw; 178 - hwif->OUTSL = NULL; 179 - hwif->INSL = NULL; 77 + hwif->tf_load = h8300_tf_load; 78 + hwif->tf_read = h8300_tf_read; 79 + 80 + hwif->input_data = h8300_input_data; 81 + hwif->output_data = h8300_output_data; 180 82 } 181 83 182 84 static int __init h8300_ide_init(void)
+11 -23
drivers/ide/ide-cd.c
··· 142 142 { 143 143 unsigned long sector; 144 144 unsigned long bio_sectors; 145 - unsigned long valid; 146 145 struct cdrom_info *info = drive->driver_data; 147 146 148 147 if (!cdrom_log_sense(drive, failed_command, sense)) ··· 172 173 (sense->information[2] << 8) | 173 174 (sense->information[3]); 174 175 175 - bio_sectors = bio_sectors(failed_command->bio); 176 - if (bio_sectors < 4) 177 - bio_sectors = 4; 178 176 if (drive->queue->hardsect_size == 2048) 179 177 /* device sector size is 2K */ 180 178 sector <<= 2; 181 - sector &= ~(bio_sectors - 1); 182 - valid = (sector - failed_command->sector) << 9; 183 179 184 - if (valid < 0) 185 - valid = 0; 180 + bio_sectors = max(bio_sectors(failed_command->bio), 4U); 181 + sector &= ~(bio_sectors - 1); 182 + 186 183 if (sector < get_capacity(info->disk) && 187 184 drive->probed_capacity - sector < 4 * 75) 188 185 set_capacity(info->disk, sector); ··· 550 555 ATAPI_WAIT_PC, cdrom_timer_expiry); 551 556 return ide_started; 552 557 } else { 553 - unsigned long flags; 554 - 555 - /* packet command */ 556 - spin_lock_irqsave(&ide_lock, flags); 557 - hwif->OUTBSYNC(drive, WIN_PACKETCMD, 558 - hwif->io_ports.command_addr); 559 - ndelay(400); 560 - spin_unlock_irqrestore(&ide_lock, flags); 558 + ide_execute_pkt_cmd(drive); 561 559 562 560 return (*handler) (drive); 563 561 } ··· 601 613 cmd_len = ATAPI_MIN_CDB_BYTES; 602 614 603 615 /* send the command to the device */ 604 - HWIF(drive)->atapi_output_bytes(drive, rq->cmd, cmd_len); 616 + hwif->output_data(drive, NULL, rq->cmd, cmd_len); 605 617 606 618 /* start the DMA if need be */ 607 619 if (info->dma) ··· 617 629 { 618 630 while (len > 0) { 619 631 int dum = 0; 620 - xf(drive, &dum, sizeof(dum)); 632 + xf(drive, NULL, &dum, sizeof(dum)); 621 633 len -= sizeof(dum); 622 634 } 623 635 } ··· 627 639 while (nsects > 0) { 628 640 static char dum[SECTOR_SIZE]; 629 641 630 - drive->hwif->atapi_input_bytes(drive, dum, sizeof(dum)); 642 + drive->hwif->input_data(drive, NULL, dum, sizeof(dum)); 631 643 nsects--; 632 644 } 633 645 } ··· 654 666 printk(KERN_ERR "%s: %s: wrong transfer direction!\n", 655 667 drive->name, __func__); 656 668 657 - xf = rw ? hwif->atapi_output_bytes : hwif->atapi_input_bytes; 669 + xf = rw ? hwif->output_data : hwif->input_data; 658 670 ide_cd_pad_transfer(drive, xf, len); 659 671 } else if (rw == 0 && ireason == 1) { 660 672 /* ··· 1007 1019 1008 1020 if (ireason == 0) { 1009 1021 write = 1; 1010 - xferfunc = HWIF(drive)->atapi_output_bytes; 1022 + xferfunc = hwif->output_data; 1011 1023 } else { 1012 1024 write = 0; 1013 - xferfunc = HWIF(drive)->atapi_input_bytes; 1025 + xferfunc = hwif->input_data; 1014 1026 } 1015 1027 1016 1028 /* transfer data */ ··· 1049 1061 if (blen > thislen) 1050 1062 blen = thislen; 1051 1063 1052 - xferfunc(drive, ptr, blen); 1064 + xferfunc(drive, NULL, ptr, blen); 1053 1065 1054 1066 thislen -= blen; 1055 1067 len -= blen;
+3 -8
drivers/ide/ide-dma.c
··· 464 464 465 465 /* PRD table */ 466 466 if (hwif->mmio) 467 - writel(hwif->dmatable_dma, (void __iomem *)hwif->dma_prdtable); 467 + writel(hwif->dmatable_dma, 468 + (void __iomem *)(hwif->dma_base + ATA_DMA_TABLE_OFS)); 468 469 else 469 - outl(hwif->dmatable_dma, hwif->dma_prdtable); 470 + outl(hwif->dmatable_dma, hwif->dma_base + ATA_DMA_TABLE_OFS); 470 471 471 472 /* specify r/w */ 472 473 hwif->OUTB(reading, hwif->dma_command); ··· 859 858 860 859 if (!hwif->dma_command) 861 860 hwif->dma_command = hwif->dma_base + 0; 862 - if (!hwif->dma_vendor1) 863 - hwif->dma_vendor1 = hwif->dma_base + 1; 864 861 if (!hwif->dma_status) 865 862 hwif->dma_status = hwif->dma_base + 2; 866 - if (!hwif->dma_vendor3) 867 - hwif->dma_vendor3 = hwif->dma_base + 3; 868 - if (!hwif->dma_prdtable) 869 - hwif->dma_prdtable = hwif->dma_base + 4; 870 863 871 864 hwif->dma_ops = &sff_dma_ops; 872 865 }
+14 -13
drivers/ide/ide-floppy.c
··· 231 231 static void ide_floppy_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, 232 232 unsigned int bcount, int direction) 233 233 { 234 + ide_hwif_t *hwif = drive->hwif; 234 235 struct request *rq = pc->rq; 235 236 struct req_iterator iter; 236 237 struct bio_vec *bvec; ··· 247 246 248 247 data = bvec_kmap_irq(bvec, &flags); 249 248 if (direction) 250 - drive->hwif->atapi_output_bytes(drive, data, count); 249 + hwif->output_data(drive, NULL, data, count); 251 250 else 252 - drive->hwif->atapi_input_bytes(drive, data, count); 251 + hwif->input_data(drive, NULL, data, count); 253 252 bvec_kunmap_irq(data, &flags); 254 253 255 254 bcount -= count; ··· 262 261 if (bcount) { 263 262 printk(KERN_ERR "%s: leftover data in %s, bcount == %d\n", 264 263 drive->name, __func__, bcount); 265 - if (direction) 266 - ide_atapi_write_zeros(drive, bcount); 267 - else 268 - ide_atapi_discard_data(drive, bcount); 264 + ide_pad_transfer(drive, direction, bcount); 269 265 } 270 266 } 271 267 ··· 488 490 printk(KERN_ERR "ide-floppy: The floppy wants " 489 491 "to send us more data than expected " 490 492 "- discarding data\n"); 491 - ide_atapi_discard_data(drive, bcount); 493 + ide_pad_transfer(drive, 0, bcount); 492 494 493 495 ide_set_handler(drive, 494 496 &idefloppy_pc_intr, ··· 501 503 } 502 504 } 503 505 if (pc->flags & PC_FLAG_WRITING) 504 - xferfunc = hwif->atapi_output_bytes; 506 + xferfunc = hwif->output_data; 505 507 else 506 - xferfunc = hwif->atapi_input_bytes; 508 + xferfunc = hwif->input_data; 507 509 508 510 if (pc->buf) 509 - xferfunc(drive, pc->cur_pos, bcount); 511 + xferfunc(drive, NULL, pc->cur_pos, bcount); 510 512 else 511 513 ide_floppy_io_buffers(drive, pc, bcount, 512 514 !!(pc->flags & PC_FLAG_WRITING)); ··· 546 548 547 549 /* Set the interrupt routine */ 548 550 ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); 551 + 549 552 /* Send the actual packet */ 550 - HWIF(drive)->atapi_output_bytes(drive, floppy->pc->c, 12); 553 + hwif->output_data(drive, NULL, floppy->pc->c, 12); 554 + 551 555 return ide_started; 552 556 } 553 557 ··· 569 569 idefloppy_floppy_t *floppy = drive->driver_data; 570 570 571 571 /* Send the actual packet */ 572 - HWIF(drive)->atapi_output_bytes(drive, floppy->pc->c, 12); 572 + drive->hwif->output_data(drive, NULL, floppy->pc->c, 12); 573 + 573 574 /* Timeout for the packet command */ 574 575 return IDEFLOPPY_WAIT_CMD; 575 576 } ··· 693 692 return ide_started; 694 693 } else { 695 694 /* Issue the packet command */ 696 - hwif->OUTB(WIN_PACKETCMD, hwif->io_ports.command_addr); 695 + ide_execute_pkt_cmd(drive); 697 696 return (*pkt_xfer_routine) (drive); 698 697 } 699 698 }
+21 -47
drivers/ide/ide-io.c
··· 295 295 spin_unlock_irqrestore(&ide_lock, flags); 296 296 } 297 297 298 - void ide_tf_read(ide_drive_t *drive, ide_task_t *task) 299 - { 300 - ide_hwif_t *hwif = drive->hwif; 301 - struct ide_io_ports *io_ports = &hwif->io_ports; 302 - struct ide_taskfile *tf = &task->tf; 303 - 304 - if (task->tf_flags & IDE_TFLAG_IN_DATA) { 305 - u16 data = hwif->INW(io_ports->data_addr); 306 - 307 - tf->data = data & 0xff; 308 - tf->hob_data = (data >> 8) & 0xff; 309 - } 310 - 311 - /* be sure we're looking at the low order bits */ 312 - hwif->OUTB(drive->ctl & ~0x80, io_ports->ctl_addr); 313 - 314 - if (task->tf_flags & IDE_TFLAG_IN_NSECT) 315 - tf->nsect = hwif->INB(io_ports->nsect_addr); 316 - if (task->tf_flags & IDE_TFLAG_IN_LBAL) 317 - tf->lbal = hwif->INB(io_ports->lbal_addr); 318 - if (task->tf_flags & IDE_TFLAG_IN_LBAM) 319 - tf->lbam = hwif->INB(io_ports->lbam_addr); 320 - if (task->tf_flags & IDE_TFLAG_IN_LBAH) 321 - tf->lbah = hwif->INB(io_ports->lbah_addr); 322 - if (task->tf_flags & IDE_TFLAG_IN_DEVICE) 323 - tf->device = hwif->INB(io_ports->device_addr); 324 - 325 - if (task->tf_flags & IDE_TFLAG_LBA48) { 326 - hwif->OUTB(drive->ctl | 0x80, io_ports->ctl_addr); 327 - 328 - if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) 329 - tf->hob_feature = hwif->INB(io_ports->feature_addr); 330 - if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) 331 - tf->hob_nsect = hwif->INB(io_ports->nsect_addr); 332 - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) 333 - tf->hob_lbal = hwif->INB(io_ports->lbal_addr); 334 - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) 335 - tf->hob_lbam = hwif->INB(io_ports->lbam_addr); 336 - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) 337 - tf->hob_lbah = hwif->INB(io_ports->lbah_addr); 338 - } 339 - } 340 - 341 298 /** 342 299 * ide_end_drive_cmd - end an explicit drive command 343 300 * @drive: command ··· 330 373 tf->error = err; 331 374 tf->status = stat; 332 375 333 - ide_tf_read(drive, task); 376 + drive->hwif->tf_read(drive, task); 334 377 335 378 if (task->tf_flags & IDE_TFLAG_DYN) 336 379 kfree(task); ··· 379 422 u32 wcount = (i > 16) ? 16 : i; 380 423 381 424 i -= wcount; 382 - HWIF(drive)->ata_input_data(drive, buffer, wcount); 425 + drive->hwif->input_data(drive, NULL, buffer, wcount * 4); 383 426 } 384 427 } 385 428 ··· 459 502 460 503 if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) 461 504 /* force an abort */ 462 - hwif->OUTB(WIN_IDLEIMMEDIATE, hwif->io_ports.command_addr); 505 + hwif->OUTBSYNC(drive, WIN_IDLEIMMEDIATE, 506 + hwif->io_ports.command_addr); 463 507 464 508 if (rq->errors >= ERROR_MAX) { 465 509 ide_kill_rq(drive, rq); ··· 1637 1679 task.tf.lbam = bcount & 0xff; 1638 1680 task.tf.lbah = (bcount >> 8) & 0xff; 1639 1681 1640 - ide_tf_load(drive, &task); 1682 + ide_tf_dump(drive->name, &task.tf); 1683 + drive->hwif->tf_load(drive, &task); 1641 1684 } 1642 1685 1643 1686 EXPORT_SYMBOL_GPL(ide_pktcmd_tf_load); 1687 + 1688 + void ide_pad_transfer(ide_drive_t *drive, int write, int len) 1689 + { 1690 + ide_hwif_t *hwif = drive->hwif; 1691 + u8 buf[4] = { 0 }; 1692 + 1693 + while (len > 0) { 1694 + if (write) 1695 + hwif->output_data(drive, NULL, buf, min(4, len)); 1696 + else 1697 + hwif->input_data(drive, NULL, buf, min(4, len)); 1698 + len -= 4; 1699 + } 1700 + } 1701 + EXPORT_SYMBOL_GPL(ide_pad_transfer);
+203 -143
drivers/ide/ide-iops.c
··· 37 37 return (u8) inb(port); 38 38 } 39 39 40 - static u16 ide_inw (unsigned long port) 41 - { 42 - return (u16) inw(port); 43 - } 44 - 45 - static void ide_insw (unsigned long port, void *addr, u32 count) 46 - { 47 - insw(port, addr, count); 48 - } 49 - 50 - static void ide_insl (unsigned long port, void *addr, u32 count) 51 - { 52 - insl(port, addr, count); 53 - } 54 - 55 40 static void ide_outb (u8 val, unsigned long port) 56 41 { 57 42 outb(val, port); ··· 47 62 outb(addr, port); 48 63 } 49 64 50 - static void ide_outw (u16 val, unsigned long port) 51 - { 52 - outw(val, port); 53 - } 54 - 55 - static void ide_outsw (unsigned long port, void *addr, u32 count) 56 - { 57 - outsw(port, addr, count); 58 - } 59 - 60 - static void ide_outsl (unsigned long port, void *addr, u32 count) 61 - { 62 - outsl(port, addr, count); 63 - } 64 - 65 65 void default_hwif_iops (ide_hwif_t *hwif) 66 66 { 67 67 hwif->OUTB = ide_outb; 68 68 hwif->OUTBSYNC = ide_outbsync; 69 - hwif->OUTW = ide_outw; 70 - hwif->OUTSW = ide_outsw; 71 - hwif->OUTSL = ide_outsl; 72 69 hwif->INB = ide_inb; 73 - hwif->INW = ide_inw; 74 - hwif->INSW = ide_insw; 75 - hwif->INSL = ide_insl; 76 70 } 77 71 78 72 /* ··· 61 97 static u8 ide_mm_inb (unsigned long port) 62 98 { 63 99 return (u8) readb((void __iomem *) port); 64 - } 65 - 66 - static u16 ide_mm_inw (unsigned long port) 67 - { 68 - return (u16) readw((void __iomem *) port); 69 - } 70 - 71 - static void ide_mm_insw (unsigned long port, void *addr, u32 count) 72 - { 73 - __ide_mm_insw((void __iomem *) port, addr, count); 74 - } 75 - 76 - static void ide_mm_insl (unsigned long port, void *addr, u32 count) 77 - { 78 - __ide_mm_insl((void __iomem *) port, addr, count); 79 100 } 80 101 81 102 static void ide_mm_outb (u8 value, unsigned long port) ··· 73 124 writeb(value, (void __iomem *) port); 74 125 } 75 126 76 - static void ide_mm_outw (u16 value, unsigned long port) 77 - { 78 - writew(value, (void __iomem *) port); 79 - } 80 - 81 - static void ide_mm_outsw (unsigned long port, void *addr, u32 count) 82 - { 83 - __ide_mm_outsw((void __iomem *) port, addr, count); 84 - } 85 - 86 - static void ide_mm_outsl (unsigned long port, void *addr, u32 count) 87 - { 88 - __ide_mm_outsl((void __iomem *) port, addr, count); 89 - } 90 - 91 127 void default_hwif_mmiops (ide_hwif_t *hwif) 92 128 { 93 129 hwif->OUTB = ide_mm_outb; 94 130 /* Most systems will need to override OUTBSYNC, alas however 95 131 this one is controller specific! */ 96 132 hwif->OUTBSYNC = ide_mm_outbsync; 97 - hwif->OUTW = ide_mm_outw; 98 - hwif->OUTSW = ide_mm_outsw; 99 - hwif->OUTSL = ide_mm_outsl; 100 133 hwif->INB = ide_mm_inb; 101 - hwif->INW = ide_mm_inw; 102 - hwif->INSW = ide_mm_insw; 103 - hwif->INSL = ide_mm_insl; 104 134 } 105 135 106 136 EXPORT_SYMBOL(default_hwif_mmiops); ··· 103 175 port_ops->maskproc(drive, mask); 104 176 } 105 177 178 + static void ide_tf_load(ide_drive_t *drive, ide_task_t *task) 179 + { 180 + ide_hwif_t *hwif = drive->hwif; 181 + struct ide_io_ports *io_ports = &hwif->io_ports; 182 + struct ide_taskfile *tf = &task->tf; 183 + void (*tf_outb)(u8 addr, unsigned long port); 184 + u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; 185 + u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; 186 + 187 + if (mmio) 188 + tf_outb = ide_mm_outb; 189 + else 190 + tf_outb = ide_outb; 191 + 192 + if (task->tf_flags & IDE_TFLAG_FLAGGED) 193 + HIHI = 0xFF; 194 + 195 + ide_set_irq(drive, 1); 196 + 197 + if ((task->tf_flags & IDE_TFLAG_NO_SELECT_MASK) == 0) 198 + SELECT_MASK(drive, 0); 199 + 200 + if (task->tf_flags & IDE_TFLAG_OUT_DATA) { 201 + u16 data = (tf->hob_data << 8) | tf->data; 202 + 203 + if (mmio) 204 + writew(data, (void __iomem *)io_ports->data_addr); 205 + else 206 + outw(data, io_ports->data_addr); 207 + } 208 + 209 + if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) 210 + tf_outb(tf->hob_feature, io_ports->feature_addr); 211 + if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) 212 + tf_outb(tf->hob_nsect, io_ports->nsect_addr); 213 + if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) 214 + tf_outb(tf->hob_lbal, io_ports->lbal_addr); 215 + if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) 216 + tf_outb(tf->hob_lbam, io_ports->lbam_addr); 217 + if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) 218 + tf_outb(tf->hob_lbah, io_ports->lbah_addr); 219 + 220 + if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) 221 + tf_outb(tf->feature, io_ports->feature_addr); 222 + if (task->tf_flags & IDE_TFLAG_OUT_NSECT) 223 + tf_outb(tf->nsect, io_ports->nsect_addr); 224 + if (task->tf_flags & IDE_TFLAG_OUT_LBAL) 225 + tf_outb(tf->lbal, io_ports->lbal_addr); 226 + if (task->tf_flags & IDE_TFLAG_OUT_LBAM) 227 + tf_outb(tf->lbam, io_ports->lbam_addr); 228 + if (task->tf_flags & IDE_TFLAG_OUT_LBAH) 229 + tf_outb(tf->lbah, io_ports->lbah_addr); 230 + 231 + if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) 232 + tf_outb((tf->device & HIHI) | drive->select.all, 233 + io_ports->device_addr); 234 + } 235 + 236 + static void ide_tf_read(ide_drive_t *drive, ide_task_t *task) 237 + { 238 + ide_hwif_t *hwif = drive->hwif; 239 + struct ide_io_ports *io_ports = &hwif->io_ports; 240 + struct ide_taskfile *tf = &task->tf; 241 + void (*tf_outb)(u8 addr, unsigned long port); 242 + u8 (*tf_inb)(unsigned long port); 243 + u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; 244 + 245 + if (mmio) { 246 + tf_outb = ide_mm_outb; 247 + tf_inb = ide_mm_inb; 248 + } else { 249 + tf_outb = ide_outb; 250 + tf_inb = ide_inb; 251 + } 252 + 253 + if (task->tf_flags & IDE_TFLAG_IN_DATA) { 254 + u16 data; 255 + 256 + if (mmio) 257 + data = readw((void __iomem *)io_ports->data_addr); 258 + else 259 + data = inw(io_ports->data_addr); 260 + 261 + tf->data = data & 0xff; 262 + tf->hob_data = (data >> 8) & 0xff; 263 + } 264 + 265 + /* be sure we're looking at the low order bits */ 266 + tf_outb(drive->ctl & ~0x80, io_ports->ctl_addr); 267 + 268 + if (task->tf_flags & IDE_TFLAG_IN_NSECT) 269 + tf->nsect = tf_inb(io_ports->nsect_addr); 270 + if (task->tf_flags & IDE_TFLAG_IN_LBAL) 271 + tf->lbal = tf_inb(io_ports->lbal_addr); 272 + if (task->tf_flags & IDE_TFLAG_IN_LBAM) 273 + tf->lbam = tf_inb(io_ports->lbam_addr); 274 + if (task->tf_flags & IDE_TFLAG_IN_LBAH) 275 + tf->lbah = tf_inb(io_ports->lbah_addr); 276 + if (task->tf_flags & IDE_TFLAG_IN_DEVICE) 277 + tf->device = tf_inb(io_ports->device_addr); 278 + 279 + if (task->tf_flags & IDE_TFLAG_LBA48) { 280 + tf_outb(drive->ctl | 0x80, io_ports->ctl_addr); 281 + 282 + if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) 283 + tf->hob_feature = tf_inb(io_ports->feature_addr); 284 + if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) 285 + tf->hob_nsect = tf_inb(io_ports->nsect_addr); 286 + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) 287 + tf->hob_lbal = tf_inb(io_ports->lbal_addr); 288 + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) 289 + tf->hob_lbam = tf_inb(io_ports->lbam_addr); 290 + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) 291 + tf->hob_lbah = tf_inb(io_ports->lbah_addr); 292 + } 293 + } 294 + 106 295 /* 107 296 * Some localbus EIDE interfaces require a special access sequence 108 297 * when using 32-bit I/O instructions to transfer data. We call this ··· 227 182 * of the sector count register location, with interrupts disabled 228 183 * to ensure that the reads all happen together. 229 184 */ 230 - static void ata_vlb_sync(ide_drive_t *drive, unsigned long port) 185 + static void ata_vlb_sync(unsigned long port) 231 186 { 232 - (void) HWIF(drive)->INB(port); 233 - (void) HWIF(drive)->INB(port); 234 - (void) HWIF(drive)->INB(port); 187 + (void)inb(port); 188 + (void)inb(port); 189 + (void)inb(port); 235 190 } 236 191 237 192 /* 238 193 * This is used for most PIO data transfers *from* the IDE interface 194 + * 195 + * These routines will round up any request for an odd number of bytes, 196 + * so if an odd len is specified, be sure that there's at least one 197 + * extra byte allocated for the buffer. 239 198 */ 240 - static void ata_input_data(ide_drive_t *drive, void *buffer, u32 wcount) 199 + static void ata_input_data(ide_drive_t *drive, struct request *rq, 200 + void *buf, unsigned int len) 241 201 { 242 202 ide_hwif_t *hwif = drive->hwif; 243 203 struct ide_io_ports *io_ports = &hwif->io_ports; 204 + unsigned long data_addr = io_ports->data_addr; 244 205 u8 io_32bit = drive->io_32bit; 206 + u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; 207 + 208 + len++; 245 209 246 210 if (io_32bit) { 247 - if (io_32bit & 2) { 248 - unsigned long flags; 211 + unsigned long uninitialized_var(flags); 249 212 213 + if ((io_32bit & 2) && !mmio) { 250 214 local_irq_save(flags); 251 - ata_vlb_sync(drive, io_ports->nsect_addr); 252 - hwif->INSL(io_ports->data_addr, buffer, wcount); 215 + ata_vlb_sync(io_ports->nsect_addr); 216 + } 217 + 218 + if (mmio) 219 + __ide_mm_insl((void __iomem *)data_addr, buf, len / 4); 220 + else 221 + insl(data_addr, buf, len / 4); 222 + 223 + if ((io_32bit & 2) && !mmio) 253 224 local_irq_restore(flags); 254 - } else 255 - hwif->INSL(io_ports->data_addr, buffer, wcount); 256 - } else 257 - hwif->INSW(io_ports->data_addr, buffer, wcount << 1); 225 + 226 + if ((len & 3) >= 2) { 227 + if (mmio) 228 + __ide_mm_insw((void __iomem *)data_addr, 229 + (u8 *)buf + (len & ~3), 1); 230 + else 231 + insw(data_addr, (u8 *)buf + (len & ~3), 1); 232 + } 233 + } else { 234 + if (mmio) 235 + __ide_mm_insw((void __iomem *)data_addr, buf, len / 2); 236 + else 237 + insw(data_addr, buf, len / 2); 238 + } 258 239 } 259 240 260 241 /* 261 242 * This is used for most PIO data transfers *to* the IDE interface 262 243 */ 263 - static void ata_output_data(ide_drive_t *drive, void *buffer, u32 wcount) 244 + static void ata_output_data(ide_drive_t *drive, struct request *rq, 245 + void *buf, unsigned int len) 264 246 { 265 247 ide_hwif_t *hwif = drive->hwif; 266 248 struct ide_io_ports *io_ports = &hwif->io_ports; 249 + unsigned long data_addr = io_ports->data_addr; 267 250 u8 io_32bit = drive->io_32bit; 251 + u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; 268 252 269 253 if (io_32bit) { 270 - if (io_32bit & 2) { 271 - unsigned long flags; 254 + unsigned long uninitialized_var(flags); 272 255 256 + if ((io_32bit & 2) && !mmio) { 273 257 local_irq_save(flags); 274 - ata_vlb_sync(drive, io_ports->nsect_addr); 275 - hwif->OUTSL(io_ports->data_addr, buffer, wcount); 258 + ata_vlb_sync(io_ports->nsect_addr); 259 + } 260 + 261 + if (mmio) 262 + __ide_mm_outsl((void __iomem *)data_addr, buf, len / 4); 263 + else 264 + outsl(data_addr, buf, len / 4); 265 + 266 + if ((io_32bit & 2) && !mmio) 276 267 local_irq_restore(flags); 277 - } else 278 - hwif->OUTSL(io_ports->data_addr, buffer, wcount); 279 - } else 280 - hwif->OUTSW(io_ports->data_addr, buffer, wcount << 1); 281 - } 282 268 283 - /* 284 - * The following routines are mainly used by the ATAPI drivers. 285 - * 286 - * These routines will round up any request for an odd number of bytes, 287 - * so if an odd bytecount is specified, be sure that there's at least one 288 - * extra byte allocated for the buffer. 289 - */ 290 - 291 - static void atapi_input_bytes(ide_drive_t *drive, void *buffer, u32 bytecount) 292 - { 293 - ide_hwif_t *hwif = HWIF(drive); 294 - 295 - ++bytecount; 296 - #if defined(CONFIG_ATARI) || defined(CONFIG_Q40) 297 - if (MACH_IS_ATARI || MACH_IS_Q40) { 298 - /* Atari has a byte-swapped IDE interface */ 299 - insw_swapw(hwif->io_ports.data_addr, buffer, bytecount / 2); 300 - return; 269 + if ((len & 3) >= 2) { 270 + if (mmio) 271 + __ide_mm_outsw((void __iomem *)data_addr, 272 + (u8 *)buf + (len & ~3), 1); 273 + else 274 + outsw(data_addr, (u8 *)buf + (len & ~3), 1); 275 + } 276 + } else { 277 + if (mmio) 278 + __ide_mm_outsw((void __iomem *)data_addr, buf, len / 2); 279 + else 280 + outsw(data_addr, buf, len / 2); 301 281 } 302 - #endif /* CONFIG_ATARI || CONFIG_Q40 */ 303 - hwif->ata_input_data(drive, buffer, bytecount / 4); 304 - if ((bytecount & 0x03) >= 2) 305 - hwif->INSW(hwif->io_ports.data_addr, 306 - (u8 *)buffer + (bytecount & ~0x03), 1); 307 - } 308 - 309 - static void atapi_output_bytes(ide_drive_t *drive, void *buffer, u32 bytecount) 310 - { 311 - ide_hwif_t *hwif = HWIF(drive); 312 - 313 - ++bytecount; 314 - #if defined(CONFIG_ATARI) || defined(CONFIG_Q40) 315 - if (MACH_IS_ATARI || MACH_IS_Q40) { 316 - /* Atari has a byte-swapped IDE interface */ 317 - outsw_swapw(hwif->io_ports.data_addr, buffer, bytecount / 2); 318 - return; 319 - } 320 - #endif /* CONFIG_ATARI || CONFIG_Q40 */ 321 - hwif->ata_output_data(drive, buffer, bytecount / 4); 322 - if ((bytecount & 0x03) >= 2) 323 - hwif->OUTSW(hwif->io_ports.data_addr, 324 - (u8 *)buffer + (bytecount & ~0x03), 1); 325 282 } 326 283 327 284 void default_hwif_transport(ide_hwif_t *hwif) 328 285 { 329 - hwif->ata_input_data = ata_input_data; 330 - hwif->ata_output_data = ata_output_data; 331 - hwif->atapi_input_bytes = atapi_input_bytes; 332 - hwif->atapi_output_bytes = atapi_output_bytes; 286 + hwif->tf_load = ide_tf_load; 287 + hwif->tf_read = ide_tf_read; 288 + 289 + hwif->input_data = ata_input_data; 290 + hwif->output_data = ata_output_data; 333 291 } 334 292 335 293 void ide_fix_driveid (struct hd_driveid *id) ··· 625 577 { "TSSTcorp CDDVDW SH-S202J" , "SB01" }, 626 578 { "TSSTcorp CDDVDW SH-S202N" , "SB00" }, 627 579 { "TSSTcorp CDDVDW SH-S202N" , "SB01" }, 580 + { "TSSTcorp CDDVDW SH-S202H" , "SB00" }, 581 + { "TSSTcorp CDDVDW SH-S202H" , "SB01" }, 628 582 { NULL , NULL } 629 583 }; 630 584 ··· 691 641 SELECT_MASK(drive, 1); 692 642 ide_set_irq(drive, 1); 693 643 msleep(50); 694 - hwif->OUTB(WIN_IDENTIFY, hwif->io_ports.command_addr); 644 + hwif->OUTBSYNC(drive, WIN_IDENTIFY, hwif->io_ports.command_addr); 695 645 timeout = jiffies + WAIT_WORSTCASE; 696 646 do { 697 647 if (time_after(jiffies, timeout)) { ··· 718 668 local_irq_restore(flags); 719 669 return 0; 720 670 } 721 - hwif->ata_input_data(drive, id, SECTOR_WORDS); 671 + hwif->input_data(drive, NULL, id, SECTOR_SIZE); 722 672 (void)ide_read_status(drive); /* clear drive IRQ */ 723 673 local_irq_enable(); 724 674 local_irq_restore(flags); ··· 899 849 ndelay(400); 900 850 spin_unlock_irqrestore(&ide_lock, flags); 901 851 } 902 - 903 852 EXPORT_SYMBOL(ide_execute_command); 904 853 854 + void ide_execute_pkt_cmd(ide_drive_t *drive) 855 + { 856 + ide_hwif_t *hwif = drive->hwif; 857 + unsigned long flags; 858 + 859 + spin_lock_irqsave(&ide_lock, flags); 860 + hwif->OUTBSYNC(drive, WIN_PACKETCMD, hwif->io_ports.command_addr); 861 + ndelay(400); 862 + spin_unlock_irqrestore(&ide_lock, flags); 863 + } 864 + EXPORT_SYMBOL_GPL(ide_execute_pkt_cmd); 905 865 906 866 /* needed below */ 907 867 static ide_startstop_t do_reset1 (ide_drive_t *, int);
+1 -1
drivers/ide/ide-lib.c
··· 487 487 else 488 488 task.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_DEVICE; 489 489 490 - ide_tf_read(drive, &task); 490 + drive->hwif->tf_read(drive, &task); 491 491 492 492 if (lba48 || (tf->device & ATA_LBA)) 493 493 printk(", LBAsect=%llu",
+4 -4
drivers/ide/ide-probe.c
··· 124 124 125 125 id = drive->id; 126 126 /* read 512 bytes of id info */ 127 - hwif->ata_input_data(drive, id, SECTOR_WORDS); 127 + hwif->input_data(drive, NULL, id, SECTOR_SIZE); 128 128 129 129 drive->id_read = 1; 130 130 local_irq_enable(); ··· 293 293 hwif->OUTB(0, io_ports->feature_addr); 294 294 295 295 /* ask drive for ID */ 296 - hwif->OUTB(cmd, io_ports->command_addr); 296 + hwif->OUTBSYNC(drive, cmd, io_ports->command_addr); 297 297 298 298 timeout = ((cmd == WIN_IDENTIFY) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2; 299 299 timeout += jiffies; ··· 480 480 msleep(50); 481 481 hwif->OUTB(drive->select.all, io_ports->device_addr); 482 482 msleep(50); 483 - hwif->OUTB(WIN_SRST, io_ports->command_addr); 483 + hwif->OUTBSYNC(drive, WIN_SRST, io_ports->command_addr); 484 484 (void)ide_busy_sleep(hwif); 485 485 rc = try_to_identify(drive, cmd); 486 486 } ··· 516 516 printk("%s: enabling %s -- ", hwif->name, drive->id->model); 517 517 SELECT_DRIVE(drive); 518 518 msleep(50); 519 - hwif->OUTB(EXABYTE_ENABLE_NEST, hwif->io_ports.command_addr); 519 + hwif->OUTBSYNC(drive, EXABYTE_ENABLE_NEST, hwif->io_ports.command_addr); 520 520 521 521 if (ide_busy_sleep(hwif)) { 522 522 printk(KERN_CONT "failed (timeout)\n");
+10 -9
drivers/ide/ide-tape.c
··· 395 395 if (bh == NULL) { 396 396 printk(KERN_ERR "ide-tape: bh == NULL in " 397 397 "idetape_input_buffers\n"); 398 - ide_atapi_discard_data(drive, bcount); 398 + ide_pad_transfer(drive, 0, bcount); 399 399 return; 400 400 } 401 401 count = min( 402 402 (unsigned int)(bh->b_size - atomic_read(&bh->b_count)), 403 403 bcount); 404 - HWIF(drive)->atapi_input_bytes(drive, bh->b_data + 404 + drive->hwif->input_data(drive, NULL, bh->b_data + 405 405 atomic_read(&bh->b_count), count); 406 406 bcount -= count; 407 407 atomic_add(count, &bh->b_count); ··· 427 427 return; 428 428 } 429 429 count = min((unsigned int)pc->b_count, (unsigned int)bcount); 430 - HWIF(drive)->atapi_output_bytes(drive, pc->b_data, count); 430 + drive->hwif->output_data(drive, NULL, pc->b_data, count); 431 431 bcount -= count; 432 432 pc->b_data += count; 433 433 pc->b_count -= count; ··· 871 871 printk(KERN_ERR "ide-tape: The tape wants to " 872 872 "send us more data than expected " 873 873 "- discarding data\n"); 874 - ide_atapi_discard_data(drive, bcount); 874 + ide_pad_transfer(drive, 0, bcount); 875 875 ide_set_handler(drive, &idetape_pc_intr, 876 876 IDETAPE_WAIT_CMD, NULL); 877 877 return ide_started; ··· 880 880 "data than expected - allowing transfer\n"); 881 881 } 882 882 iobuf = &idetape_input_buffers; 883 - xferfunc = hwif->atapi_input_bytes; 883 + xferfunc = hwif->input_data; 884 884 } else { 885 885 iobuf = &idetape_output_buffers; 886 - xferfunc = hwif->atapi_output_bytes; 886 + xferfunc = hwif->output_data; 887 887 } 888 888 889 889 if (pc->bh) 890 890 iobuf(drive, pc, bcount); 891 891 else 892 - xferfunc(drive, pc->cur_pos, bcount); 892 + xferfunc(drive, NULL, pc->cur_pos, bcount); 893 893 894 894 /* Update the current position */ 895 895 pc->xferred += bcount; ··· 979 979 hwif->dma_ops->dma_start(drive); 980 980 #endif 981 981 /* Send the actual packet */ 982 - HWIF(drive)->atapi_output_bytes(drive, pc->c, 12); 982 + hwif->output_data(drive, NULL, pc->c, 12); 983 + 983 984 return ide_started; 984 985 } 985 986 ··· 1056 1055 IDETAPE_WAIT_CMD, NULL); 1057 1056 return ide_started; 1058 1057 } else { 1059 - hwif->OUTB(WIN_PACKETCMD, hwif->io_ports.command_addr); 1058 + ide_execute_pkt_cmd(drive); 1060 1059 return idetape_transfer_pc(drive); 1061 1060 } 1062 1061 }
+16 -54
drivers/ide/ide-taskfile.c
··· 33 33 #include <asm/uaccess.h> 34 34 #include <asm/io.h> 35 35 36 - void ide_tf_load(ide_drive_t *drive, ide_task_t *task) 36 + void ide_tf_dump(const char *s, struct ide_taskfile *tf) 37 37 { 38 - ide_hwif_t *hwif = drive->hwif; 39 - struct ide_io_ports *io_ports = &hwif->io_ports; 40 - struct ide_taskfile *tf = &task->tf; 41 - u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; 42 - 43 - if (task->tf_flags & IDE_TFLAG_FLAGGED) 44 - HIHI = 0xFF; 45 - 46 38 #ifdef DEBUG 47 39 printk("%s: tf: feat 0x%02x nsect 0x%02x lbal 0x%02x " 48 40 "lbam 0x%02x lbah 0x%02x dev 0x%02x cmd 0x%02x\n", 49 - drive->name, tf->feature, tf->nsect, tf->lbal, 41 + s, tf->feature, tf->nsect, tf->lbal, 50 42 tf->lbam, tf->lbah, tf->device, tf->command); 51 43 printk("%s: hob: nsect 0x%02x lbal 0x%02x " 52 44 "lbam 0x%02x lbah 0x%02x\n", 53 - drive->name, tf->hob_nsect, tf->hob_lbal, 45 + s, tf->hob_nsect, tf->hob_lbal, 54 46 tf->hob_lbam, tf->hob_lbah); 55 47 #endif 56 - 57 - ide_set_irq(drive, 1); 58 - 59 - if ((task->tf_flags & IDE_TFLAG_NO_SELECT_MASK) == 0) 60 - SELECT_MASK(drive, 0); 61 - 62 - if (task->tf_flags & IDE_TFLAG_OUT_DATA) 63 - hwif->OUTW((tf->hob_data << 8) | tf->data, io_ports->data_addr); 64 - 65 - if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) 66 - hwif->OUTB(tf->hob_feature, io_ports->feature_addr); 67 - if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) 68 - hwif->OUTB(tf->hob_nsect, io_ports->nsect_addr); 69 - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) 70 - hwif->OUTB(tf->hob_lbal, io_ports->lbal_addr); 71 - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) 72 - hwif->OUTB(tf->hob_lbam, io_ports->lbam_addr); 73 - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) 74 - hwif->OUTB(tf->hob_lbah, io_ports->lbah_addr); 75 - 76 - if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) 77 - hwif->OUTB(tf->feature, io_ports->feature_addr); 78 - if (task->tf_flags & IDE_TFLAG_OUT_NSECT) 79 - hwif->OUTB(tf->nsect, io_ports->nsect_addr); 80 - if (task->tf_flags & IDE_TFLAG_OUT_LBAL) 81 - hwif->OUTB(tf->lbal, io_ports->lbal_addr); 82 - if (task->tf_flags & IDE_TFLAG_OUT_LBAM) 83 - hwif->OUTB(tf->lbam, io_ports->lbam_addr); 84 - if (task->tf_flags & IDE_TFLAG_OUT_LBAH) 85 - hwif->OUTB(tf->lbah, io_ports->lbah_addr); 86 - 87 - if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) 88 - hwif->OUTB((tf->device & HIHI) | drive->select.all, 89 - io_ports->device_addr); 90 48 } 91 49 92 50 int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) ··· 107 149 if (task->tf_flags & IDE_TFLAG_FLAGGED) 108 150 task->tf_flags |= IDE_TFLAG_FLAGGED_SET_IN_FLAGS; 109 151 110 - if ((task->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) 111 - ide_tf_load(drive, task); 152 + if ((task->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) { 153 + ide_tf_dump(drive->name, tf); 154 + hwif->tf_load(drive, task); 155 + } 112 156 113 157 switch (task->data_phase) { 114 158 case TASKFILE_MULTI_OUT: ··· 243 283 return stat; 244 284 } 245 285 246 - static void ide_pio_sector(ide_drive_t *drive, unsigned int write) 286 + static void ide_pio_sector(ide_drive_t *drive, struct request *rq, 287 + unsigned int write) 247 288 { 248 289 ide_hwif_t *hwif = drive->hwif; 249 290 struct scatterlist *sg = hwif->sg_table; ··· 284 323 285 324 /* do the actual data transfer */ 286 325 if (write) 287 - hwif->ata_output_data(drive, buf, SECTOR_WORDS); 326 + hwif->output_data(drive, rq, buf, SECTOR_SIZE); 288 327 else 289 - hwif->ata_input_data(drive, buf, SECTOR_WORDS); 328 + hwif->input_data(drive, rq, buf, SECTOR_SIZE); 290 329 291 330 kunmap_atomic(buf, KM_BIO_SRC_IRQ); 292 331 #ifdef CONFIG_HIGHMEM ··· 294 333 #endif 295 334 } 296 335 297 - static void ide_pio_multi(ide_drive_t *drive, unsigned int write) 336 + static void ide_pio_multi(ide_drive_t *drive, struct request *rq, 337 + unsigned int write) 298 338 { 299 339 unsigned int nsect; 300 340 301 341 nsect = min_t(unsigned int, drive->hwif->nleft, drive->mult_count); 302 342 while (nsect--) 303 - ide_pio_sector(drive, write); 343 + ide_pio_sector(drive, rq, write); 304 344 } 305 345 306 346 static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, ··· 324 362 switch (drive->hwif->data_phase) { 325 363 case TASKFILE_MULTI_IN: 326 364 case TASKFILE_MULTI_OUT: 327 - ide_pio_multi(drive, write); 365 + ide_pio_multi(drive, rq, write); 328 366 break; 329 367 default: 330 - ide_pio_sector(drive, write); 368 + ide_pio_sector(drive, rq, write); 331 369 break; 332 370 } 333 371
+26
drivers/ide/legacy/falconide.c
··· 44 44 int falconide_intr_lock; 45 45 EXPORT_SYMBOL(falconide_intr_lock); 46 46 47 + static void falconide_input_data(ide_drive_t *drive, struct request *rq, 48 + void *buf, unsigned int len) 49 + { 50 + unsigned long data_addr = drive->hwif->io_ports.data_addr; 51 + 52 + if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) 53 + return insw(data_addr, buf, (len + 1) / 2); 54 + 55 + insw_swapw(data_addr, buf, (len + 1) / 2); 56 + } 57 + 58 + static void falconide_output_data(ide_drive_t *drive, struct request *rq, 59 + void *buf, unsigned int len) 60 + { 61 + unsigned long data_addr = drive->hwif->io_ports.data_addr; 62 + 63 + if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) 64 + return outsw(data_adr, buf, (len + 1) / 2); 65 + 66 + outsw_swapw(data_addr, buf, (len + 1) / 2); 67 + } 68 + 47 69 static void __init falconide_setup_ports(hw_regs_t *hw) 48 70 { 49 71 int i; ··· 111 89 112 90 ide_init_port_data(hwif, index); 113 91 ide_init_port_hw(hwif, &hw); 92 + 93 + /* Atari has a byte-swapped IDE interface */ 94 + hwif->input_data = falconide_input_data; 95 + hwif->output_data = falconide_output_data; 114 96 115 97 ide_get_lock(NULL, NULL); 116 98 ide_device_add(idx, NULL);
+3 -1
drivers/ide/legacy/ide_platform.c
··· 101 101 102 102 ide_init_port_hw(hwif, &hw); 103 103 104 - if (mmio) 104 + if (mmio) { 105 + hwif->host_flags = IDE_HFLAG_MMIO; 105 106 default_hwif_mmiops(hwif); 107 + } 106 108 107 109 idx[0] = hwif->index; 108 110
+24
drivers/ide/legacy/q40ide.c
··· 72 72 hw->ack_intr = ack_intr; 73 73 } 74 74 75 + static void q40ide_input_data(ide_drive_t *drive, struct request *rq, 76 + void *buf, unsigned int len) 77 + { 78 + unsigned long data_addr = drive->hwif->io_ports.data_addr; 75 79 80 + if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) 81 + return insw(data_addr, buf, (len + 1) / 2); 82 + 83 + insw_swapw(data_addr, buf, (len + 1) / 2); 84 + } 85 + 86 + static void q40ide_output_data(ide_drive_t *drive, struct request *rq, 87 + void *buf, unsigned int len) 88 + { 89 + unsigned long data_addr = drive->hwif->io_ports.data_addr; 90 + 91 + if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) 92 + return outsw(data_addr, buf, (len + 1) / 2); 93 + 94 + outsw_swapw(data_addr, buf, (len + 1) / 2); 95 + } 76 96 77 97 /* 78 98 * the static array is needed to have the name reported in /proc/ioports, ··· 142 122 if (hwif) { 143 123 ide_init_port_data(hwif, hwif->index); 144 124 ide_init_port_hw(hwif, &hw); 125 + 126 + /* Q40 has a byte-swapped IDE interface */ 127 + hwif->input_data = q40ide_input_data; 128 + hwif->output_data = q40ide_output_data; 145 129 146 130 idx[i] = hwif->index; 147 131 }
+13 -4
drivers/ide/mips/au1xxx-ide.c
··· 48 48 49 49 static _auide_hwif auide_hwif; 50 50 51 - static int auide_ddma_init(_auide_hwif *auide); 52 - 53 51 #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA) 54 52 55 53 void auide_insw(unsigned long port, void *addr, u32 count) ··· 86 88 ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp); 87 89 } 88 90 91 + static void au1xxx_input_data(ide_drive_t *drive, struct request *rq, 92 + void *buf, unsigned int len) 93 + { 94 + auide_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); 95 + } 96 + 97 + static void au1xxx_output_data(ide_drive_t *drive, struct request *rq, 98 + void *buf, unsigned int len) 99 + { 100 + auide_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); 101 + } 89 102 #endif 90 103 91 104 static void au1xxx_set_pio_mode(ide_drive_t *drive, const u8 pio) ··· 607 598 */ 608 599 609 600 #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA 610 - hwif->INSW = auide_insw; 611 - hwif->OUTSW = auide_outsw; 601 + hwif->input_data = au1xxx_input_data; 602 + hwif->output_data = au1xxx_output_data; 612 603 #endif 613 604 hwif->select_data = 0; /* no chipset-specific code */ 614 605 hwif->config_data = 0; /* no chipset-specific code */
+1
drivers/ide/mips/swarm.c
··· 109 109 base = ioremap(offset, size); 110 110 111 111 /* Setup MMIO ops. */ 112 + hwif->host_flags = IDE_HFLAG_MMIO; 112 113 default_hwif_mmiops(hwif); 113 114 114 115 hwif->chipset = ide_generic;
+44
drivers/ide/pci/ns87415.c
··· 63 63 return inb(port); 64 64 } 65 65 66 + static void superio_tf_read(ide_drive_t *drive, ide_task_t *task) 67 + { 68 + struct ide_io_ports *io_ports = &drive->hwif->io_ports; 69 + struct ide_taskfile *tf = &task->tf; 70 + 71 + if (task->tf_flags & IDE_TFLAG_IN_DATA) { 72 + u16 data = inw(io_ports->data_addr); 73 + 74 + tf->data = data & 0xff; 75 + tf->hob_data = (data >> 8) & 0xff; 76 + } 77 + 78 + /* be sure we're looking at the low order bits */ 79 + outb(drive->ctl & ~0x80, io_ports->ctl_addr); 80 + 81 + if (task->tf_flags & IDE_TFLAG_IN_NSECT) 82 + tf->nsect = inb(io_ports->nsect_addr); 83 + if (task->tf_flags & IDE_TFLAG_IN_LBAL) 84 + tf->lbal = inb(io_ports->lbal_addr); 85 + if (task->tf_flags & IDE_TFLAG_IN_LBAM) 86 + tf->lbam = inb(io_ports->lbam_addr); 87 + if (task->tf_flags & IDE_TFLAG_IN_LBAH) 88 + tf->lbah = inb(io_ports->lbah_addr); 89 + if (task->tf_flags & IDE_TFLAG_IN_DEVICE) 90 + tf->device = superio_ide_inb(io_ports->device_addr); 91 + 92 + if (task->tf_flags & IDE_TFLAG_LBA48) { 93 + outb(drive->ctl | 0x80, io_ports->ctl_addr); 94 + 95 + if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) 96 + tf->hob_feature = inb(io_ports->feature_addr); 97 + if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) 98 + tf->hob_nsect = inb(io_ports->nsect_addr); 99 + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) 100 + tf->hob_lbal = inb(io_ports->lbal_addr); 101 + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) 102 + tf->hob_lbam = inb(io_ports->lbam_addr); 103 + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) 104 + tf->hob_lbah = inb(io_ports->lbah_addr); 105 + } 106 + } 107 + 66 108 static void __devinit superio_ide_init_iops (struct hwif_s *hwif) 67 109 { 68 110 struct pci_dev *pdev = to_pci_dev(hwif->dev); ··· 121 79 /* Clear error/interrupt, enable dma */ 122 80 tmp = superio_ide_inb(superio_ide_dma_status[port]); 123 81 outb(tmp | 0x66, superio_ide_dma_status[port]); 82 + 83 + hwif->tf_read = superio_tf_read; 124 84 125 85 /* We need to override inb to workaround a SuperIO errata */ 126 86 hwif->INB = superio_ide_inb;
+4 -4
drivers/ide/pci/pdc202xx_new.c
··· 83 83 { 84 84 u8 value; 85 85 86 - outb(index, hwif->dma_vendor1); 87 - value = inb(hwif->dma_vendor3); 86 + outb(index, hwif->dma_base + 1); 87 + value = inb(hwif->dma_base + 3); 88 88 89 89 DBG("index[%02X] value[%02X]\n", index, value); 90 90 return value; ··· 97 97 */ 98 98 static void set_indexed_reg(ide_hwif_t *hwif, u8 index, u8 value) 99 99 { 100 - outb(index, hwif->dma_vendor1); 101 - outb(value, hwif->dma_vendor3); 100 + outb(index, hwif->dma_base + 1); 101 + outb(value, hwif->dma_base + 3); 102 102 DBG("index[%02X] value[%02X]\n", index, value); 103 103 } 104 104
+1
drivers/ide/pci/piix.c
··· 250 250 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ 251 251 { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */ 252 252 { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on Acer Aspire 2023WLMi */ 253 + { 0x2653, 0x1043, 0x82D8 }, /* ICH6M on Asus Eee 701 */ 253 254 /* end marker */ 254 255 { 0, } 255 256 };
+173 -23
drivers/ide/pci/scc_pata.c
··· 126 126 return (u8)data; 127 127 } 128 128 129 - static u16 scc_ide_inw(unsigned long port) 130 - { 131 - u32 data = in_be32((void*)port); 132 - return (u16)data; 133 - } 134 - 135 129 static void scc_ide_insw(unsigned long port, void *addr, u32 count) 136 130 { 137 131 u16 *ptr = (u16 *)addr; ··· 144 150 } 145 151 146 152 static void scc_ide_outb(u8 addr, unsigned long port) 147 - { 148 - out_be32((void*)port, addr); 149 - } 150 - 151 - static void scc_ide_outw(u16 addr, unsigned long port) 152 153 { 153 154 out_be32((void*)port, addr); 154 155 } ··· 260 271 out_be32((void __iomem *)udenvt_port, reg); 261 272 } 262 273 274 + static void scc_dma_host_set(ide_drive_t *drive, int on) 275 + { 276 + ide_hwif_t *hwif = drive->hwif; 277 + u8 unit = (drive->select.b.unit & 0x01); 278 + u8 dma_stat = scc_ide_inb(hwif->dma_status); 279 + 280 + if (on) 281 + dma_stat |= (1 << (5 + unit)); 282 + else 283 + dma_stat &= ~(1 << (5 + unit)); 284 + 285 + scc_ide_outb(dma_stat, hwif->dma_status); 286 + } 287 + 263 288 /** 264 289 * scc_ide_dma_setup - begin a DMA phase 265 290 * @drive: target device ··· 304 301 } 305 302 306 303 /* PRD table */ 307 - out_be32((void __iomem *)hwif->dma_prdtable, hwif->dmatable_dma); 304 + out_be32((void __iomem *)(hwif->dma_base + 8), hwif->dmatable_dma); 308 305 309 306 /* specify r/w */ 310 307 out_be32((void __iomem *)hwif->dma_command, reading); ··· 318 315 return 0; 319 316 } 320 317 318 + static void scc_dma_start(ide_drive_t *drive) 319 + { 320 + ide_hwif_t *hwif = drive->hwif; 321 + u8 dma_cmd = scc_ide_inb(hwif->dma_command); 322 + 323 + /* start DMA */ 324 + scc_ide_outb(dma_cmd | 1, hwif->dma_command); 325 + hwif->dma = 1; 326 + wmb(); 327 + } 328 + 329 + static int __scc_dma_end(ide_drive_t *drive) 330 + { 331 + ide_hwif_t *hwif = drive->hwif; 332 + u8 dma_stat, dma_cmd; 333 + 334 + drive->waiting_for_dma = 0; 335 + /* get DMA command mode */ 336 + dma_cmd = scc_ide_inb(hwif->dma_command); 337 + /* stop DMA */ 338 + scc_ide_outb(dma_cmd & ~1, hwif->dma_command); 339 + /* get DMA status */ 340 + dma_stat = scc_ide_inb(hwif->dma_status); 341 + /* clear the INTR & ERROR bits */ 342 + scc_ide_outb(dma_stat | 6, hwif->dma_status); 343 + /* purge DMA mappings */ 344 + ide_destroy_dmatable(drive); 345 + /* verify good DMA status */ 346 + hwif->dma = 0; 347 + wmb(); 348 + return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0; 349 + } 321 350 322 351 /** 323 352 * scc_dma_end - Stop DMA 324 353 * @drive: IDE drive 325 354 * 326 355 * Check and clear INT Status register. 327 - * Then call __ide_dma_end(). 356 + * Then call __scc_dma_end(). 328 357 */ 329 358 330 359 static int scc_dma_end(ide_drive_t *drive) ··· 460 425 break; 461 426 } 462 427 463 - dma_stat = __ide_dma_end(drive); 428 + dma_stat = __scc_dma_end(drive); 464 429 if (data_loss) 465 430 dma_stat |= 2; /* emulate DMA error (to retry command) */ 466 431 return dma_stat; ··· 653 618 return rc; 654 619 } 655 620 621 + static void scc_tf_load(ide_drive_t *drive, ide_task_t *task) 622 + { 623 + struct ide_io_ports *io_ports = &drive->hwif->io_ports; 624 + struct ide_taskfile *tf = &task->tf; 625 + u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; 626 + 627 + if (task->tf_flags & IDE_TFLAG_FLAGGED) 628 + HIHI = 0xFF; 629 + 630 + ide_set_irq(drive, 1); 631 + 632 + if (task->tf_flags & IDE_TFLAG_OUT_DATA) 633 + out_be32((void *)io_ports->data_addr, 634 + (tf->hob_data << 8) | tf->data); 635 + 636 + if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) 637 + scc_ide_outb(tf->hob_feature, io_ports->feature_addr); 638 + if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) 639 + scc_ide_outb(tf->hob_nsect, io_ports->nsect_addr); 640 + if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) 641 + scc_ide_outb(tf->hob_lbal, io_ports->lbal_addr); 642 + if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) 643 + scc_ide_outb(tf->hob_lbam, io_ports->lbam_addr); 644 + if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) 645 + scc_ide_outb(tf->hob_lbah, io_ports->lbah_addr); 646 + 647 + if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) 648 + scc_ide_outb(tf->feature, io_ports->feature_addr); 649 + if (task->tf_flags & IDE_TFLAG_OUT_NSECT) 650 + scc_ide_outb(tf->nsect, io_ports->nsect_addr); 651 + if (task->tf_flags & IDE_TFLAG_OUT_LBAL) 652 + scc_ide_outb(tf->lbal, io_ports->lbal_addr); 653 + if (task->tf_flags & IDE_TFLAG_OUT_LBAM) 654 + scc_ide_outb(tf->lbam, io_ports->lbam_addr); 655 + if (task->tf_flags & IDE_TFLAG_OUT_LBAH) 656 + scc_ide_outb(tf->lbah, io_ports->lbah_addr); 657 + 658 + if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) 659 + scc_ide_outb((tf->device & HIHI) | drive->select.all, 660 + io_ports->device_addr); 661 + } 662 + 663 + static void scc_tf_read(ide_drive_t *drive, ide_task_t *task) 664 + { 665 + struct ide_io_ports *io_ports = &drive->hwif->io_ports; 666 + struct ide_taskfile *tf = &task->tf; 667 + 668 + if (task->tf_flags & IDE_TFLAG_IN_DATA) { 669 + u16 data = (u16)in_be32((void *)io_ports->data_addr); 670 + 671 + tf->data = data & 0xff; 672 + tf->hob_data = (data >> 8) & 0xff; 673 + } 674 + 675 + /* be sure we're looking at the low order bits */ 676 + scc_ide_outb(drive->ctl & ~0x80, io_ports->ctl_addr); 677 + 678 + if (task->tf_flags & IDE_TFLAG_IN_NSECT) 679 + tf->nsect = scc_ide_inb(io_ports->nsect_addr); 680 + if (task->tf_flags & IDE_TFLAG_IN_LBAL) 681 + tf->lbal = scc_ide_inb(io_ports->lbal_addr); 682 + if (task->tf_flags & IDE_TFLAG_IN_LBAM) 683 + tf->lbam = scc_ide_inb(io_ports->lbam_addr); 684 + if (task->tf_flags & IDE_TFLAG_IN_LBAH) 685 + tf->lbah = scc_ide_inb(io_ports->lbah_addr); 686 + if (task->tf_flags & IDE_TFLAG_IN_DEVICE) 687 + tf->device = scc_ide_inb(io_ports->device_addr); 688 + 689 + if (task->tf_flags & IDE_TFLAG_LBA48) { 690 + scc_ide_outb(drive->ctl | 0x80, io_ports->ctl_addr); 691 + 692 + if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) 693 + tf->hob_feature = scc_ide_inb(io_ports->feature_addr); 694 + if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) 695 + tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr); 696 + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) 697 + tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr); 698 + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) 699 + tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr); 700 + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) 701 + tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr); 702 + } 703 + } 704 + 705 + static void scc_input_data(ide_drive_t *drive, struct request *rq, 706 + void *buf, unsigned int len) 707 + { 708 + unsigned long data_addr = drive->hwif->io_ports.data_addr; 709 + 710 + len++; 711 + 712 + if (drive->io_32bit) { 713 + scc_ide_insl(data_addr, buf, len / 4); 714 + 715 + if ((len & 3) >= 2) 716 + scc_ide_insw(data_addr, (u8 *)buf + (len & ~3), 1); 717 + } else 718 + scc_ide_insw(data_addr, buf, len / 2); 719 + } 720 + 721 + static void scc_output_data(ide_drive_t *drive, struct request *rq, 722 + void *buf, unsigned int len) 723 + { 724 + unsigned long data_addr = drive->hwif->io_ports.data_addr; 725 + 726 + len++; 727 + 728 + if (drive->io_32bit) { 729 + scc_ide_outsl(data_addr, buf, len / 4); 730 + 731 + if ((len & 3) >= 2) 732 + scc_ide_outsw(data_addr, (u8 *)buf + (len & ~3), 1); 733 + } else 734 + scc_ide_outsw(data_addr, buf, len / 2); 735 + } 736 + 656 737 /** 657 738 * init_mmio_iops_scc - set up the iops for MMIO 658 739 * @hwif: interface to set up ··· 783 632 784 633 ide_set_hwifdata(hwif, ports); 785 634 635 + hwif->tf_load = scc_tf_load; 636 + hwif->tf_read = scc_tf_read; 637 + 638 + hwif->input_data = scc_input_data; 639 + hwif->output_data = scc_output_data; 640 + 786 641 hwif->INB = scc_ide_inb; 787 - hwif->INW = scc_ide_inw; 788 - hwif->INSW = scc_ide_insw; 789 - hwif->INSL = scc_ide_insl; 790 642 hwif->OUTB = scc_ide_outb; 791 643 hwif->OUTBSYNC = scc_ide_outbsync; 792 - hwif->OUTW = scc_ide_outw; 793 - hwif->OUTSW = scc_ide_outsw; 794 - hwif->OUTSL = scc_ide_outsl; 795 644 796 645 hwif->dma_base = dma_base; 797 646 hwif->config_data = ports->ctl; ··· 838 687 839 688 hwif->dma_command = hwif->dma_base; 840 689 hwif->dma_status = hwif->dma_base + 0x04; 841 - hwif->dma_prdtable = hwif->dma_base + 0x08; 842 690 843 691 /* PTERADD */ 844 692 out_be32((void __iomem *)(hwif->dma_base + 0x018), hwif->dmatable_dma); ··· 856 706 }; 857 707 858 708 static const struct ide_dma_ops scc_dma_ops = { 859 - .dma_host_set = ide_dma_host_set, 709 + .dma_host_set = scc_dma_host_set, 860 710 .dma_setup = scc_dma_setup, 861 711 .dma_exec_cmd = ide_dma_exec_cmd, 862 - .dma_start = ide_dma_start, 712 + .dma_start = scc_dma_start, 863 713 .dma_end = scc_dma_end, 864 714 .dma_test_irq = scc_dma_test_irq, 865 715 .dma_lost_irq = ide_dma_lost_irq,
+1
drivers/ide/pci/sgiioc4.c
··· 573 573 .init_dma = ide_dma_sgiioc4, 574 574 .port_ops = &sgiioc4_port_ops, 575 575 .dma_ops = &sgiioc4_dma_ops, 576 + .host_flags = IDE_HFLAG_MMIO, 576 577 .mwdma_mask = ATA_MWDMA2_ONLY, 577 578 }; 578 579
+247 -288
drivers/ide/pci/siimage.c
··· 1 1 /* 2 2 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> 3 3 * Copyright (C) 2003 Red Hat <alan@redhat.com> 4 - * Copyright (C) 2007 MontaVista Software, Inc. 5 - * Copyright (C) 2007 Bartlomiej Zolnierkiewicz 4 + * Copyright (C) 2007-2008 MontaVista Software, Inc. 5 + * Copyright (C) 2007-2008 Bartlomiej Zolnierkiewicz 6 6 * 7 7 * May be copied or modified under the terms of the GNU General Public License 8 8 * ··· 17 17 * 18 18 * FAQ Items: 19 19 * If you are using Marvell SATA-IDE adapters with Maxtor drives 20 - * ensure the system is set up for ATA100/UDMA5 not UDMA6. 20 + * ensure the system is set up for ATA100/UDMA5, not UDMA6. 21 21 * 22 22 * If you are using WD drives with SATA bridges you must set the 23 - * drive to "Single". "Master" will hang 23 + * drive to "Single". "Master" will hang. 24 24 * 25 25 * If you have strange problems with nVidia chipset systems please 26 26 * see the SI support documentation and update your system BIOS ··· 42 42 #include <linux/hdreg.h> 43 43 #include <linux/ide.h> 44 44 #include <linux/init.h> 45 - 46 - #include <asm/io.h> 45 + #include <linux/io.h> 47 46 48 47 /** 49 48 * pdev_is_sata - check if device is SATA 50 49 * @pdev: PCI device to check 51 - * 50 + * 52 51 * Returns true if this is a SATA controller 53 52 */ 54 - 53 + 55 54 static int pdev_is_sata(struct pci_dev *pdev) 56 55 { 57 56 #ifdef CONFIG_BLK_DEV_IDE_SATA 58 - switch(pdev->device) { 59 - case PCI_DEVICE_ID_SII_3112: 60 - case PCI_DEVICE_ID_SII_1210SA: 61 - return 1; 62 - case PCI_DEVICE_ID_SII_680: 63 - return 0; 57 + switch (pdev->device) { 58 + case PCI_DEVICE_ID_SII_3112: 59 + case PCI_DEVICE_ID_SII_1210SA: 60 + return 1; 61 + case PCI_DEVICE_ID_SII_680: 62 + return 0; 64 63 } 65 64 BUG(); 66 65 #endif ··· 69 70 /** 70 71 * is_sata - check if hwif is SATA 71 72 * @hwif: interface to check 72 - * 73 + * 73 74 * Returns true if this is a SATA controller 74 75 */ 75 - 76 + 76 77 static inline int is_sata(ide_hwif_t *hwif) 77 78 { 78 79 return pdev_is_sata(to_pci_dev(hwif->dev)); ··· 85 86 * 86 87 * Turn a config register offset into the right address in either 87 88 * PCI space or MMIO space to access the control register in question 88 - * Thankfully this is a configuration operation so isnt performance 89 - * criticial. 89 + * Thankfully this is a configuration operation, so isn't performance 90 + * critical. 90 91 */ 91 - 92 + 92 93 static unsigned long siimage_selreg(ide_hwif_t *hwif, int r) 93 94 { 94 95 unsigned long base = (unsigned long)hwif->hwif_data; 96 + 95 97 base += 0xA0 + r; 96 - if(hwif->mmio) 97 - base += (hwif->channel << 6); 98 + if (hwif->mmio) 99 + base += hwif->channel << 6; 98 100 else 99 - base += (hwif->channel << 4); 101 + base += hwif->channel << 4; 100 102 return base; 101 103 } 102 - 104 + 103 105 /** 104 106 * siimage_seldev - return register base 105 107 * @hwif: interface ··· 110 110 * PCI space or MMIO space to access the control register in question 111 111 * including accounting for the unit shift. 112 112 */ 113 - 113 + 114 114 static inline unsigned long siimage_seldev(ide_drive_t *drive, int r) 115 115 { 116 116 ide_hwif_t *hwif = HWIF(drive); 117 - unsigned long base = (unsigned long)hwif->hwif_data; 117 + unsigned long base = (unsigned long)hwif->hwif_data; 118 + 118 119 base += 0xA0 + r; 119 - if(hwif->mmio) 120 - base += (hwif->channel << 6); 120 + if (hwif->mmio) 121 + base += hwif->channel << 6; 121 122 else 122 - base += (hwif->channel << 4); 123 + base += hwif->channel << 4; 123 124 base |= drive->select.b.unit << drive->select.b.unit; 124 125 return base; 126 + } 127 + 128 + static u8 sil_ioread8(struct pci_dev *dev, unsigned long addr) 129 + { 130 + u8 tmp = 0; 131 + 132 + if (pci_get_drvdata(dev)) 133 + tmp = readb((void __iomem *)addr); 134 + else 135 + pci_read_config_byte(dev, addr, &tmp); 136 + 137 + return tmp; 138 + } 139 + 140 + static u16 sil_ioread16(struct pci_dev *dev, unsigned long addr) 141 + { 142 + u16 tmp = 0; 143 + 144 + if (pci_get_drvdata(dev)) 145 + tmp = readw((void __iomem *)addr); 146 + else 147 + pci_read_config_word(dev, addr, &tmp); 148 + 149 + return tmp; 150 + } 151 + 152 + static void sil_iowrite8(struct pci_dev *dev, u8 val, unsigned long addr) 153 + { 154 + if (pci_get_drvdata(dev)) 155 + writeb(val, (void __iomem *)addr); 156 + else 157 + pci_write_config_byte(dev, addr, val); 158 + } 159 + 160 + static void sil_iowrite16(struct pci_dev *dev, u16 val, unsigned long addr) 161 + { 162 + if (pci_get_drvdata(dev)) 163 + writew(val, (void __iomem *)addr); 164 + else 165 + pci_write_config_word(dev, addr, val); 166 + } 167 + 168 + static void sil_iowrite32(struct pci_dev *dev, u32 val, unsigned long addr) 169 + { 170 + if (pci_get_drvdata(dev)) 171 + writel(val, (void __iomem *)addr); 172 + else 173 + pci_write_config_dword(dev, addr, val); 125 174 } 126 175 127 176 /** ··· 185 136 186 137 static u8 sil_pata_udma_filter(ide_drive_t *drive) 187 138 { 188 - ide_hwif_t *hwif = drive->hwif; 189 - struct pci_dev *dev = to_pci_dev(hwif->dev); 190 - unsigned long base = (unsigned long) hwif->hwif_data; 191 - u8 mask = 0, scsc = 0; 139 + ide_hwif_t *hwif = drive->hwif; 140 + struct pci_dev *dev = to_pci_dev(hwif->dev); 141 + unsigned long base = (unsigned long)hwif->hwif_data; 142 + u8 scsc, mask = 0; 192 143 193 - if (hwif->mmio) 194 - scsc = hwif->INB(base + 0x4A); 195 - else 196 - pci_read_config_byte(dev, 0x8A, &scsc); 144 + scsc = sil_ioread8(dev, base + (hwif->mmio ? 0x4A : 0x8A)); 197 145 198 - if ((scsc & 0x30) == 0x10) /* 133 */ 146 + switch (scsc & 0x30) { 147 + case 0x10: /* 133 */ 199 148 mask = ATA_UDMA6; 200 - else if ((scsc & 0x30) == 0x20) /* 2xPCI */ 149 + break; 150 + case 0x20: /* 2xPCI */ 201 151 mask = ATA_UDMA6; 202 - else if ((scsc & 0x30) == 0x00) /* 100 */ 152 + break; 153 + case 0x00: /* 100 */ 203 154 mask = ATA_UDMA5; 204 - else /* Disabled ? */ 155 + break; 156 + default: /* Disabled ? */ 205 157 BUG(); 158 + } 206 159 207 160 return mask; 208 161 } ··· 226 175 227 176 static void sil_set_pio_mode(ide_drive_t *drive, u8 pio) 228 177 { 229 - const u16 tf_speed[] = { 0x328a, 0x2283, 0x1281, 0x10c3, 0x10c1 }; 230 - const u16 data_speed[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 }; 178 + static const u16 tf_speed[] = { 0x328a, 0x2283, 0x1281, 0x10c3, 0x10c1 }; 179 + static const u16 data_speed[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 }; 231 180 232 181 ide_hwif_t *hwif = HWIF(drive); 182 + struct pci_dev *dev = to_pci_dev(hwif->dev); 233 183 ide_drive_t *pair = ide_get_paired_drive(drive); 234 184 u32 speedt = 0; 235 185 u16 speedp = 0; 236 186 unsigned long addr = siimage_seldev(drive, 0x04); 237 - unsigned long tfaddr = siimage_selreg(hwif, 0x02); 187 + unsigned long tfaddr = siimage_selreg(hwif, 0x02); 238 188 unsigned long base = (unsigned long)hwif->hwif_data; 239 189 u8 tf_pio = pio; 240 190 u8 addr_mask = hwif->channel ? (hwif->mmio ? 0xF4 : 0x84) ··· 255 203 speedp = data_speed[pio]; 256 204 speedt = tf_speed[tf_pio]; 257 205 258 - if (hwif->mmio) { 259 - hwif->OUTW(speedp, addr); 260 - hwif->OUTW(speedt, tfaddr); 261 - /* Now set up IORDY */ 262 - if (pio > 2) 263 - hwif->OUTW(hwif->INW(tfaddr-2)|0x200, tfaddr-2); 264 - else 265 - hwif->OUTW(hwif->INW(tfaddr-2)&~0x200, tfaddr-2); 206 + sil_iowrite16(dev, speedp, addr); 207 + sil_iowrite16(dev, speedt, tfaddr); 266 208 267 - mode = hwif->INB(base + addr_mask); 268 - mode &= ~(unit ? 0x30 : 0x03); 269 - mode |= (unit ? 0x10 : 0x01); 270 - hwif->OUTB(mode, base + addr_mask); 271 - } else { 272 - struct pci_dev *dev = to_pci_dev(hwif->dev); 209 + /* now set up IORDY */ 210 + speedp = sil_ioread16(dev, tfaddr - 2); 211 + speedp &= ~0x200; 212 + if (pio > 2) 213 + speedp |= 0x200; 214 + sil_iowrite16(dev, speedp, tfaddr - 2); 273 215 274 - pci_write_config_word(dev, addr, speedp); 275 - pci_write_config_word(dev, tfaddr, speedt); 276 - pci_read_config_word(dev, tfaddr - 2, &speedp); 277 - speedp &= ~0x200; 278 - /* Set IORDY for mode 3 or 4 */ 279 - if (pio > 2) 280 - speedp |= 0x200; 281 - pci_write_config_word(dev, tfaddr - 2, speedp); 282 - 283 - pci_read_config_byte(dev, addr_mask, &mode); 284 - mode &= ~(unit ? 0x30 : 0x03); 285 - mode |= (unit ? 0x10 : 0x01); 286 - pci_write_config_byte(dev, addr_mask, mode); 287 - } 216 + mode = sil_ioread8(dev, base + addr_mask); 217 + mode &= ~(unit ? 0x30 : 0x03); 218 + mode |= unit ? 0x10 : 0x01; 219 + sil_iowrite8(dev, mode, base + addr_mask); 288 220 } 289 221 290 222 /** ··· 281 245 282 246 static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed) 283 247 { 284 - u8 ultra6[] = { 0x0F, 0x0B, 0x07, 0x05, 0x03, 0x02, 0x01 }; 285 - u8 ultra5[] = { 0x0C, 0x07, 0x05, 0x04, 0x02, 0x01 }; 286 - u16 dma[] = { 0x2208, 0x10C2, 0x10C1 }; 248 + static const u8 ultra6[] = { 0x0F, 0x0B, 0x07, 0x05, 0x03, 0x02, 0x01 }; 249 + static const u8 ultra5[] = { 0x0C, 0x07, 0x05, 0x04, 0x02, 0x01 }; 250 + static const u16 dma[] = { 0x2208, 0x10C2, 0x10C1 }; 287 251 288 252 ide_hwif_t *hwif = HWIF(drive); 289 253 struct pci_dev *dev = to_pci_dev(hwif->dev); 290 254 u16 ultra = 0, multi = 0; 291 255 u8 mode = 0, unit = drive->select.b.unit; 292 256 unsigned long base = (unsigned long)hwif->hwif_data; 293 - u8 scsc = 0, addr_mask = ((hwif->channel) ? 294 - ((hwif->mmio) ? 0xF4 : 0x84) : 295 - ((hwif->mmio) ? 0xB4 : 0x80)); 296 - 257 + u8 scsc = 0, addr_mask = hwif->channel ? 258 + (hwif->mmio ? 0xF4 : 0x84) : 259 + (hwif->mmio ? 0xB4 : 0x80); 297 260 unsigned long ma = siimage_seldev(drive, 0x08); 298 261 unsigned long ua = siimage_seldev(drive, 0x0C); 299 262 300 - if (hwif->mmio) { 301 - scsc = hwif->INB(base + 0x4A); 302 - mode = hwif->INB(base + addr_mask); 303 - multi = hwif->INW(ma); 304 - ultra = hwif->INW(ua); 305 - } else { 306 - pci_read_config_byte(dev, 0x8A, &scsc); 307 - pci_read_config_byte(dev, addr_mask, &mode); 308 - pci_read_config_word(dev, ma, &multi); 309 - pci_read_config_word(dev, ua, &ultra); 310 - } 263 + scsc = sil_ioread8 (dev, base + (hwif->mmio ? 0x4A : 0x8A)); 264 + mode = sil_ioread8 (dev, base + addr_mask); 265 + multi = sil_ioread16(dev, ma); 266 + ultra = sil_ioread16(dev, ua); 311 267 312 - mode &= ~((unit) ? 0x30 : 0x03); 268 + mode &= ~(unit ? 0x30 : 0x03); 313 269 ultra &= ~0x3F; 314 270 scsc = ((scsc & 0x30) == 0x00) ? 0 : 1; 315 271 316 272 scsc = is_sata(hwif) ? 1 : scsc; 317 273 318 274 if (speed >= XFER_UDMA_0) { 319 - multi = dma[2]; 320 - ultra |= (scsc ? ultra6[speed - XFER_UDMA_0] : 321 - ultra5[speed - XFER_UDMA_0]); 322 - mode |= (unit ? 0x30 : 0x03); 275 + multi = dma[2]; 276 + ultra |= scsc ? ultra6[speed - XFER_UDMA_0] : 277 + ultra5[speed - XFER_UDMA_0]; 278 + mode |= unit ? 0x30 : 0x03; 323 279 } else { 324 280 multi = dma[speed - XFER_MW_DMA_0]; 325 - mode |= (unit ? 0x20 : 0x02); 281 + mode |= unit ? 0x20 : 0x02; 326 282 } 327 283 328 - if (hwif->mmio) { 329 - hwif->OUTB(mode, base + addr_mask); 330 - hwif->OUTW(multi, ma); 331 - hwif->OUTW(ultra, ua); 332 - } else { 333 - pci_write_config_byte(dev, addr_mask, mode); 334 - pci_write_config_word(dev, ma, multi); 335 - pci_write_config_word(dev, ua, ultra); 336 - } 284 + sil_iowrite8 (dev, mode, base + addr_mask); 285 + sil_iowrite16(dev, multi, ma); 286 + sil_iowrite16(dev, ultra, ua); 337 287 } 338 288 339 289 /* returns 1 if dma irq issued, 0 otherwise */ ··· 331 309 unsigned long addr = siimage_selreg(hwif, 1); 332 310 333 311 /* return 1 if INTR asserted */ 334 - if ((hwif->INB(hwif->dma_status) & 4) == 4) 312 + if (hwif->INB(hwif->dma_status) & 4) 335 313 return 1; 336 314 337 315 /* return 1 if Device INTR asserted */ 338 316 pci_read_config_byte(dev, addr, &dma_altstat); 339 317 if (dma_altstat & 8) 340 - return 0; //return 1; 318 + return 0; /* return 1; */ 319 + 341 320 return 0; 342 321 } 343 322 ··· 358 335 = (void __iomem *)hwif->sata_scr[SATA_ERROR_OFFSET]; 359 336 360 337 if (sata_error_addr) { 361 - unsigned long base = (unsigned long)hwif->hwif_data; 362 - u32 ext_stat = readl((void __iomem *)(base + 0x10)); 363 - u8 watchdog = 0; 338 + unsigned long base = (unsigned long)hwif->hwif_data; 339 + u32 ext_stat = readl((void __iomem *)(base + 0x10)); 340 + u8 watchdog = 0; 364 341 365 342 if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) { 366 343 u32 sata_error = readl(sata_error_addr); ··· 369 346 watchdog = (sata_error & 0x00680000) ? 1 : 0; 370 347 printk(KERN_WARNING "%s: sata_error = 0x%08x, " 371 348 "watchdog = %d, %s\n", 372 - drive->name, sata_error, watchdog, 373 - __func__); 374 - 375 - } else { 349 + drive->name, sata_error, watchdog, __func__); 350 + } else 376 351 watchdog = (ext_stat & 0x8000) ? 1 : 0; 377 - } 378 - ext_stat >>= 16; 379 352 353 + ext_stat >>= 16; 380 354 if (!(ext_stat & 0x0404) && !watchdog) 381 355 return 0; 382 356 } 383 357 384 358 /* return 1 if INTR asserted */ 385 - if ((readb((void __iomem *)hwif->dma_status) & 0x04) == 0x04) 359 + if (readb((void __iomem *)hwif->dma_status) & 0x04) 386 360 return 1; 387 361 388 362 /* return 1 if Device INTR asserted */ 389 - if ((readb((void __iomem *)addr) & 8) == 8) 390 - return 0; //return 1; 363 + if (readb((void __iomem *)addr) & 8) 364 + return 0; /* return 1; */ 391 365 392 366 return 0; 393 367 } ··· 443 423 } 444 424 445 425 /** 446 - * proc_reports_siimage - add siimage controller to proc 447 - * @dev: PCI device 448 - * @clocking: SCSC value 449 - * @name: controller name 450 - * 451 - * Report the clocking mode of the controller and add it to 452 - * the /proc interface layer 453 - */ 454 - 455 - static void proc_reports_siimage (struct pci_dev *dev, u8 clocking, const char *name) 456 - { 457 - if (!pdev_is_sata(dev)) { 458 - printk(KERN_INFO "%s: BASE CLOCK ", name); 459 - clocking &= 0x03; 460 - switch (clocking) { 461 - case 0x03: printk("DISABLED!\n"); break; 462 - case 0x02: printk("== 2X PCI\n"); break; 463 - case 0x01: printk("== 133\n"); break; 464 - case 0x00: printk("== 100\n"); break; 465 - } 466 - } 467 - } 468 - 469 - /** 470 - * setup_mmio_siimage - switch an SI controller into MMIO 426 + * setup_mmio_siimage - switch controller into MMIO mode 471 427 * @dev: PCI device we are configuring 472 428 * @name: device name 473 429 * 474 - * Attempt to put the device into mmio mode. There are some slight 475 - * complications here with certain systems where the mmio bar isnt 476 - * mapped so we have to be sure we can fall back to I/O. 430 + * Attempt to put the device into MMIO mode. There are some slight 431 + * complications here with certain systems where the MMIO BAR isn't 432 + * mapped, so we have to be sure that we can fall back to I/O. 477 433 */ 478 - 479 - static unsigned int setup_mmio_siimage (struct pci_dev *dev, const char *name) 434 + 435 + static unsigned int setup_mmio_siimage(struct pci_dev *dev, const char *name) 480 436 { 481 437 resource_size_t bar5 = pci_resource_start(dev, 5); 482 438 unsigned long barsize = pci_resource_len(dev, 5); 483 - u8 tmpbyte = 0; 484 439 void __iomem *ioaddr; 485 - u32 tmp, irq_mask; 486 440 487 441 /* 488 - * Drop back to PIO if we can't map the mmio. Some 489 - * systems seem to get terminally confused in the PCI 490 - * spaces. 442 + * Drop back to PIO if we can't map the MMIO. Some systems 443 + * seem to get terminally confused in the PCI spaces. 491 444 */ 492 - 493 - if(!request_mem_region(bar5, barsize, name)) 494 - { 495 - printk(KERN_WARNING "siimage: IDE controller MMIO ports not available.\n"); 445 + if (!request_mem_region(bar5, barsize, name)) { 446 + printk(KERN_WARNING "siimage: IDE controller MMIO ports not " 447 + "available.\n"); 496 448 return 0; 497 449 } 498 - 499 - ioaddr = ioremap(bar5, barsize); 500 450 501 - if (ioaddr == NULL) 502 - { 451 + ioaddr = ioremap(bar5, barsize); 452 + if (ioaddr == NULL) { 503 453 release_mem_region(bar5, barsize); 504 454 return 0; 505 455 } ··· 477 487 pci_set_master(dev); 478 488 pci_set_drvdata(dev, (void *) ioaddr); 479 489 480 - if (pdev_is_sata(dev)) { 481 - /* make sure IDE0/1 interrupts are not masked */ 482 - irq_mask = (1 << 22) | (1 << 23); 483 - tmp = readl(ioaddr + 0x48); 484 - if (tmp & irq_mask) { 485 - tmp &= ~irq_mask; 486 - writel(tmp, ioaddr + 0x48); 487 - readl(ioaddr + 0x48); /* flush */ 488 - } 489 - writel(0, ioaddr + 0x148); 490 - writel(0, ioaddr + 0x1C8); 491 - } 492 - 493 - writeb(0, ioaddr + 0xB4); 494 - writeb(0, ioaddr + 0xF4); 495 - tmpbyte = readb(ioaddr + 0x4A); 496 - 497 - switch(tmpbyte & 0x30) { 498 - case 0x00: 499 - /* In 100 MHz clocking, try and switch to 133 */ 500 - writeb(tmpbyte|0x10, ioaddr + 0x4A); 501 - break; 502 - case 0x10: 503 - /* On 133Mhz clocking */ 504 - break; 505 - case 0x20: 506 - /* On PCIx2 clocking */ 507 - break; 508 - case 0x30: 509 - /* Clocking is disabled */ 510 - /* 133 clock attempt to force it on */ 511 - writeb(tmpbyte & ~0x20, ioaddr + 0x4A); 512 - break; 513 - } 514 - 515 - writeb( 0x72, ioaddr + 0xA1); 516 - writew( 0x328A, ioaddr + 0xA2); 517 - writel(0x62DD62DD, ioaddr + 0xA4); 518 - writel(0x43924392, ioaddr + 0xA8); 519 - writel(0x40094009, ioaddr + 0xAC); 520 - writeb( 0x72, ioaddr + 0xE1); 521 - writew( 0x328A, ioaddr + 0xE2); 522 - writel(0x62DD62DD, ioaddr + 0xE4); 523 - writel(0x43924392, ioaddr + 0xE8); 524 - writel(0x40094009, ioaddr + 0xEC); 525 - 526 - if (pdev_is_sata(dev)) { 527 - writel(0xFFFF0000, ioaddr + 0x108); 528 - writel(0xFFFF0000, ioaddr + 0x188); 529 - writel(0x00680000, ioaddr + 0x148); 530 - writel(0x00680000, ioaddr + 0x1C8); 531 - } 532 - 533 - tmpbyte = readb(ioaddr + 0x4A); 534 - 535 - proc_reports_siimage(dev, (tmpbyte>>4), name); 536 490 return 1; 537 491 } 538 492 ··· 486 552 * @name: device name 487 553 * 488 554 * Perform the initial PCI set up for this device. Attempt to switch 489 - * to 133MHz clocking if the system isn't already set up to do it. 555 + * to 133 MHz clocking if the system isn't already set up to do it. 490 556 */ 491 557 492 - static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, const char *name) 558 + static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, 559 + const char *name) 493 560 { 494 - u8 rev = dev->revision, tmpbyte = 0, BA5_EN = 0; 561 + unsigned long base, scsc_addr; 562 + void __iomem *ioaddr = NULL; 563 + u8 rev = dev->revision, tmp, BA5_EN; 495 564 496 565 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, rev ? 1 : 255); 497 566 498 567 pci_read_config_byte(dev, 0x8A, &BA5_EN); 499 - if ((BA5_EN & 0x01) || (pci_resource_start(dev, 5))) { 500 - if (setup_mmio_siimage(dev, name)) { 501 - return 0; 568 + 569 + if ((BA5_EN & 0x01) || pci_resource_start(dev, 5)) 570 + if (setup_mmio_siimage(dev, name)) 571 + ioaddr = pci_get_drvdata(dev); 572 + 573 + base = (unsigned long)ioaddr; 574 + 575 + if (ioaddr && pdev_is_sata(dev)) { 576 + u32 tmp32, irq_mask; 577 + 578 + /* make sure IDE0/1 interrupts are not masked */ 579 + irq_mask = (1 << 22) | (1 << 23); 580 + tmp32 = readl(ioaddr + 0x48); 581 + if (tmp32 & irq_mask) { 582 + tmp32 &= ~irq_mask; 583 + writel(tmp32, ioaddr + 0x48); 584 + readl(ioaddr + 0x48); /* flush */ 502 585 } 586 + writel(0, ioaddr + 0x148); 587 + writel(0, ioaddr + 0x1C8); 503 588 } 504 589 505 - pci_write_config_byte(dev, 0x80, 0x00); 506 - pci_write_config_byte(dev, 0x84, 0x00); 507 - pci_read_config_byte(dev, 0x8A, &tmpbyte); 508 - switch(tmpbyte & 0x30) { 509 - case 0x00: 510 - /* 133 clock attempt to force it on */ 511 - pci_write_config_byte(dev, 0x8A, tmpbyte|0x10); 512 - case 0x30: 513 - /* if clocking is disabled */ 514 - /* 133 clock attempt to force it on */ 515 - pci_write_config_byte(dev, 0x8A, tmpbyte & ~0x20); 516 - case 0x10: 517 - /* 133 already */ 518 - break; 519 - case 0x20: 520 - /* BIOS set PCI x2 clocking */ 521 - break; 590 + sil_iowrite8(dev, 0, base ? (base + 0xB4) : 0x80); 591 + sil_iowrite8(dev, 0, base ? (base + 0xF4) : 0x84); 592 + 593 + scsc_addr = base ? (base + 0x4A) : 0x8A; 594 + tmp = sil_ioread8(dev, scsc_addr); 595 + 596 + switch (tmp & 0x30) { 597 + case 0x00: 598 + /* On 100 MHz clocking, try and switch to 133 MHz */ 599 + sil_iowrite8(dev, tmp | 0x10, scsc_addr); 600 + break; 601 + case 0x30: 602 + /* Clocking is disabled, attempt to force 133MHz clocking. */ 603 + sil_iowrite8(dev, tmp & ~0x20, scsc_addr); 604 + case 0x10: 605 + /* On 133Mhz clocking. */ 606 + break; 607 + case 0x20: 608 + /* On PCIx2 clocking. */ 609 + break; 522 610 } 523 611 524 - pci_read_config_byte(dev, 0x8A, &tmpbyte); 612 + tmp = sil_ioread8(dev, scsc_addr); 525 613 526 - pci_write_config_byte(dev, 0xA1, 0x72); 527 - pci_write_config_word(dev, 0xA2, 0x328A); 528 - pci_write_config_dword(dev, 0xA4, 0x62DD62DD); 529 - pci_write_config_dword(dev, 0xA8, 0x43924392); 530 - pci_write_config_dword(dev, 0xAC, 0x40094009); 531 - pci_write_config_byte(dev, 0xB1, 0x72); 532 - pci_write_config_word(dev, 0xB2, 0x328A); 533 - pci_write_config_dword(dev, 0xB4, 0x62DD62DD); 534 - pci_write_config_dword(dev, 0xB8, 0x43924392); 535 - pci_write_config_dword(dev, 0xBC, 0x40094009); 614 + sil_iowrite8 (dev, 0x72, base + 0xA1); 615 + sil_iowrite16(dev, 0x328A, base + 0xA2); 616 + sil_iowrite32(dev, 0x62DD62DD, base + 0xA4); 617 + sil_iowrite32(dev, 0x43924392, base + 0xA8); 618 + sil_iowrite32(dev, 0x40094009, base + 0xAC); 619 + sil_iowrite8 (dev, 0x72, base ? (base + 0xE1) : 0xB1); 620 + sil_iowrite16(dev, 0x328A, base ? (base + 0xE2) : 0xB2); 621 + sil_iowrite32(dev, 0x62DD62DD, base ? (base + 0xE4) : 0xB4); 622 + sil_iowrite32(dev, 0x43924392, base ? (base + 0xE8) : 0xB8); 623 + sil_iowrite32(dev, 0x40094009, base ? (base + 0xEC) : 0xBC); 536 624 537 - proc_reports_siimage(dev, (tmpbyte>>4), name); 625 + if (base && pdev_is_sata(dev)) { 626 + writel(0xFFFF0000, ioaddr + 0x108); 627 + writel(0xFFFF0000, ioaddr + 0x188); 628 + writel(0x00680000, ioaddr + 0x148); 629 + writel(0x00680000, ioaddr + 0x1C8); 630 + } 631 + 632 + /* report the clocking mode of the controller */ 633 + if (!pdev_is_sata(dev)) { 634 + static const char *clk_str[] = 635 + { "== 100", "== 133", "== 2X PCI", "DISABLED!" }; 636 + 637 + tmp >>= 4; 638 + printk(KERN_INFO "%s: BASE CLOCK %s\n", name, clk_str[tmp & 3]); 639 + } 640 + 538 641 return 0; 539 642 } 540 643 ··· 581 610 * 582 611 * The basic setup here is fairly simple, we can use standard MMIO 583 612 * operations. However we do have to set the taskfile register offsets 584 - * by hand as there isnt a standard defined layout for them this 585 - * time. 613 + * by hand as there isn't a standard defined layout for them this time. 586 614 * 587 615 * The hardware supports buffered taskfiles and also some rather nice 588 616 * extended PRD tables. For better SI3112 support use the libata driver ··· 592 622 struct pci_dev *dev = to_pci_dev(hwif->dev); 593 623 void *addr = pci_get_drvdata(dev); 594 624 u8 ch = hwif->channel; 595 - unsigned long base; 596 - 597 625 struct ide_io_ports *io_ports = &hwif->io_ports; 626 + unsigned long base; 598 627 599 628 /* 600 - * Fill in the basic HWIF bits 629 + * Fill in the basic hwif bits 601 630 */ 602 - 631 + hwif->host_flags |= IDE_HFLAG_MMIO; 603 632 default_hwif_mmiops(hwif); 604 - hwif->hwif_data = addr; 633 + hwif->hwif_data = addr; 605 634 606 635 /* 607 - * Now set up the hw. We have to do this ourselves as 608 - * the MMIO layout isnt the same as the standard port 609 - * based I/O 636 + * Now set up the hw. We have to do this ourselves as the 637 + * MMIO layout isn't the same as the standard port based I/O. 610 638 */ 611 - 612 639 memset(io_ports, 0, sizeof(*io_ports)); 613 640 614 641 base = (unsigned long)addr; ··· 615 648 base += 0x80; 616 649 617 650 /* 618 - * The buffered task file doesn't have status/control 619 - * so we can't currently use it sanely since we want to 620 - * use LBA48 mode. 621 - */ 651 + * The buffered task file doesn't have status/control, so we 652 + * can't currently use it sanely since we want to use LBA48 mode. 653 + */ 622 654 io_ports->data_addr = base; 623 655 io_ports->error_addr = base + 1; 624 656 io_ports->nsect_addr = base + 2; ··· 646 680 647 681 static int is_dev_seagate_sata(ide_drive_t *drive) 648 682 { 649 - const char *s = &drive->id->model[0]; 650 - unsigned len; 683 + const char *s = &drive->id->model[0]; 684 + unsigned len = strnlen(s, sizeof(drive->id->model)); 651 685 652 - len = strnlen(s, sizeof(drive->id->model)); 653 - 654 - if ((len > 4) && (!memcmp(s, "ST", 2))) { 686 + if ((len > 4) && (!memcmp(s, "ST", 2))) 655 687 if ((!memcmp(s + len - 2, "AS", 2)) || 656 688 (!memcmp(s + len - 3, "ASL", 3))) { 657 689 printk(KERN_INFO "%s: applying pessimistic Seagate " 658 690 "errata fix\n", drive->name); 659 691 return 1; 660 692 } 661 - } 693 + 662 694 return 0; 663 695 } 664 696 ··· 673 709 { 674 710 ide_hwif_t *hwif = drive->hwif; 675 711 676 - /* Try and raise the rqsize */ 712 + /* Try and rise the rqsize */ 677 713 if (!is_sata(hwif) || !is_dev_seagate_sata(drive)) 678 714 hwif->rqsize = 128; 679 715 } ··· 707 743 * sil_cable_detect - cable detection 708 744 * @hwif: interface to check 709 745 * 710 - * Check for the presence of an ATA66 capable cable on the 711 - * interface. 746 + * Check for the presence of an ATA66 capable cable on the interface. 712 747 */ 713 748 714 749 static u8 __devinit sil_cable_detect(ide_hwif_t *hwif) 715 750 { 716 - struct pci_dev *dev = to_pci_dev(hwif->dev); 717 - unsigned long addr = siimage_selreg(hwif, 0); 718 - u8 ata66 = 0; 719 - 720 - if (pci_get_drvdata(dev) == NULL) 721 - pci_read_config_byte(dev, addr, &ata66); 722 - else 723 - ata66 = hwif->INB(addr); 751 + struct pci_dev *dev = to_pci_dev(hwif->dev); 752 + unsigned long addr = siimage_selreg(hwif, 0); 753 + u8 ata66 = sil_ioread8(dev, addr); 724 754 725 755 return (ata66 & 0x01) ? ATA_CBL_PATA80 : ATA_CBL_PATA40; 726 756 } ··· 760 802 }; 761 803 762 804 /** 763 - * siimage_init_one - pci layer discovery entry 805 + * siimage_init_one - PCI layer discovery entry 764 806 * @dev: PCI device 765 807 * @id: ident table entry 766 808 * 767 - * Called by the PCI code when it finds an SI680 or SI3112 controller. 809 + * Called by the PCI code when it finds an SiI680 or SiI3112 controller. 768 810 * We then use the IDE PCI generic helper to do most of the work. 769 811 */ 770 - 771 - static int __devinit siimage_init_one(struct pci_dev *dev, const struct pci_device_id *id) 812 + 813 + static int __devinit siimage_init_one(struct pci_dev *dev, 814 + const struct pci_device_id *id) 772 815 { 773 816 struct ide_port_info d; 774 817 u8 idx = id->driver_data;
+1
drivers/ide/ppc/pmac.c
··· 941 941 .port_ops = &pmac_ide_port_ops, 942 942 .host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | 943 943 IDE_HFLAG_POST_SET_MODE | 944 + IDE_HFLAG_MMIO | 944 945 IDE_HFLAG_UNMASK_IRQS, 945 946 .pio_mask = ATA_PIO4, 946 947 .mwdma_mask = ATA_MWDMA2,
-1
drivers/pcmcia/Kconfig
··· 38 38 config PCMCIA 39 39 tristate "16-bit PCMCIA support" 40 40 select CRC32 41 - select HAVE_IDE 42 41 default y 43 42 ---help--- 44 43 This option enables support for 16-bit PCMCIA cards. Most older
+19 -19
drivers/scsi/ide-scsi.c
··· 134 134 static void idescsi_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, 135 135 unsigned int bcount) 136 136 { 137 + ide_hwif_t *hwif = drive->hwif; 137 138 int count; 138 139 char *buf; 139 140 ··· 146 145 local_irq_save(flags); 147 146 buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) + 148 147 pc->sg->offset; 149 - drive->hwif->atapi_input_bytes(drive, 150 - buf + pc->b_count, count); 148 + hwif->input_data(drive, NULL, buf + pc->b_count, count); 151 149 kunmap_atomic(buf - pc->sg->offset, KM_IRQ0); 152 150 local_irq_restore(flags); 153 151 } else { 154 152 buf = sg_virt(pc->sg); 155 - drive->hwif->atapi_input_bytes(drive, 156 - buf + pc->b_count, count); 153 + hwif->input_data(drive, NULL, buf + pc->b_count, count); 157 154 } 158 155 bcount -= count; pc->b_count += count; 159 156 if (pc->b_count == pc->sg->length) { ··· 164 165 165 166 if (bcount) { 166 167 printk (KERN_ERR "ide-scsi: scatter gather table too small, discarding data\n"); 167 - ide_atapi_discard_data(drive, bcount); 168 + ide_pad_transfer(drive, 0, bcount); 168 169 } 169 170 } 170 171 171 172 static void idescsi_output_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, 172 173 unsigned int bcount) 173 174 { 175 + ide_hwif_t *hwif = drive->hwif; 174 176 int count; 175 177 char *buf; 176 178 ··· 183 183 local_irq_save(flags); 184 184 buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) + 185 185 pc->sg->offset; 186 - drive->hwif->atapi_output_bytes(drive, 187 - buf + pc->b_count, count); 186 + hwif->output_data(drive, NULL, buf + pc->b_count, count); 188 187 kunmap_atomic(buf - pc->sg->offset, KM_IRQ0); 189 188 local_irq_restore(flags); 190 189 } else { 191 190 buf = sg_virt(pc->sg); 192 - drive->hwif->atapi_output_bytes(drive, 193 - buf + pc->b_count, count); 191 + hwif->output_data(drive, NULL, buf + pc->b_count, count); 194 192 } 195 193 bcount -= count; pc->b_count += count; 196 194 if (pc->b_count == pc->sg->length) { ··· 201 203 202 204 if (bcount) { 203 205 printk (KERN_ERR "ide-scsi: scatter gather table too small, padding with zeros\n"); 204 - ide_atapi_write_zeros(drive, bcount); 206 + ide_pad_transfer(drive, 1, bcount); 205 207 } 206 208 } 207 209 ··· 256 258 257 259 if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) 258 260 /* force an abort */ 259 - hwif->OUTB(WIN_IDLEIMMEDIATE, hwif->io_ports.command_addr); 261 + hwif->OUTBSYNC(drive, WIN_IDLEIMMEDIATE, 262 + hwif->io_ports.command_addr); 260 263 261 264 rq->errors++; 262 265 ··· 430 431 idescsi_input_buffers(drive, pc, 431 432 temp); 432 433 else 433 - drive->hwif->atapi_input_bytes(drive, pc->cur_pos, temp); 434 + hwif->input_data(drive, NULL, 435 + pc->cur_pos, temp); 434 436 printk(KERN_ERR "ide-scsi: transferred" 435 437 " %d of %d bytes\n", 436 438 temp, bcount); 437 439 } 438 440 pc->xferred += temp; 439 441 pc->cur_pos += temp; 440 - ide_atapi_discard_data(drive, bcount - temp); 442 + ide_pad_transfer(drive, 0, bcount - temp); 441 443 ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); 442 444 return ide_started; 443 445 } ··· 452 452 if (pc->sg) 453 453 idescsi_input_buffers(drive, pc, bcount); 454 454 else 455 - hwif->atapi_input_bytes(drive, pc->cur_pos, 456 - bcount); 455 + hwif->input_data(drive, NULL, pc->cur_pos, bcount); 457 456 } else { 458 457 pc->flags |= PC_FLAG_WRITING; 459 458 if (pc->sg) 460 459 idescsi_output_buffers(drive, pc, bcount); 461 460 else 462 - hwif->atapi_output_bytes(drive, pc->cur_pos, 463 - bcount); 461 + hwif->output_data(drive, NULL, pc->cur_pos, bcount); 464 462 } 465 463 /* Update the current position */ 466 464 pc->xferred += bcount; ··· 491 493 BUG_ON(HWGROUP(drive)->handler != NULL); 492 494 /* Set the interrupt routine */ 493 495 ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); 496 + 494 497 /* Send the actual packet */ 495 - drive->hwif->atapi_output_bytes(drive, scsi->pc->c, 12); 498 + hwif->output_data(drive, NULL, scsi->pc->c, 12); 499 + 496 500 if (pc->flags & PC_FLAG_DMA_OK) { 497 501 pc->flags |= PC_FLAG_DMA_IN_PROGRESS; 498 502 hwif->dma_ops->dma_start(drive); ··· 574 574 return ide_started; 575 575 } else { 576 576 /* Issue the packet command */ 577 - hwif->OUTB(WIN_PACKETCMD, hwif->io_ports.command_addr); 577 + ide_execute_pkt_cmd(drive); 578 578 return idescsi_transfer_pc(drive); 579 579 } 580 580 }
+14 -39
include/linux/ide.h
··· 427 427 void (*dma_timeout)(struct ide_drive_s *); 428 428 }; 429 429 430 + struct ide_task_s; 431 + 430 432 typedef struct hwif_s { 431 433 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ 432 434 struct hwif_s *mate; /* other hwif from same PCI chip */ ··· 469 467 const struct ide_port_ops *port_ops; 470 468 const struct ide_dma_ops *dma_ops; 471 469 472 - void (*ata_input_data)(ide_drive_t *, void *, u32); 473 - void (*ata_output_data)(ide_drive_t *, void *, u32); 470 + void (*tf_load)(ide_drive_t *, struct ide_task_s *); 471 + void (*tf_read)(ide_drive_t *, struct ide_task_s *); 474 472 475 - void (*atapi_input_bytes)(ide_drive_t *, void *, u32); 476 - void (*atapi_output_bytes)(ide_drive_t *, void *, u32); 473 + void (*input_data)(ide_drive_t *, struct request *, void *, unsigned); 474 + void (*output_data)(ide_drive_t *, struct request *, void *, unsigned); 477 475 478 476 void (*ide_dma_clear_irq)(ide_drive_t *drive); 479 477 480 478 void (*OUTB)(u8 addr, unsigned long port); 481 479 void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port); 482 - void (*OUTW)(u16 addr, unsigned long port); 483 - void (*OUTSW)(unsigned long port, void *addr, u32 count); 484 - void (*OUTSL)(unsigned long port, void *addr, u32 count); 485 480 486 481 u8 (*INB)(unsigned long port); 487 - u16 (*INW)(unsigned long port); 488 - void (*INSW)(unsigned long port, void *addr, u32 count); 489 - void (*INSL)(unsigned long port, void *addr, u32 count); 490 482 491 483 /* dma physical region descriptor table (cpu view) */ 492 484 unsigned int *dmatable_cpu; ··· 505 509 506 510 unsigned long dma_base; /* base addr for dma ports */ 507 511 unsigned long dma_command; /* dma command register */ 508 - unsigned long dma_vendor1; /* dma vendor 1 register */ 509 512 unsigned long dma_status; /* dma status register */ 510 - unsigned long dma_vendor3; /* dma vendor 3 register */ 511 - unsigned long dma_prdtable; /* actual prd table address */ 512 513 513 514 unsigned long config_data; /* for use by chipset-specific code */ 514 515 unsigned long select_data; /* for use by chipset-specific code */ ··· 540 547 typedef int (ide_expiry_t)(ide_drive_t *); 541 548 542 549 /* used by ide-cd, ide-floppy, etc. */ 543 - typedef void (xfer_func_t)(ide_drive_t *, void *, u32); 550 + typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned); 544 551 545 552 typedef struct hwgroup_s { 546 553 /* irq handler, if active */ ··· 822 829 void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, 823 830 ide_expiry_t *); 824 831 832 + void ide_execute_pkt_cmd(ide_drive_t *); 833 + 834 + void ide_pad_transfer(ide_drive_t *, int, int); 835 + 825 836 ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); 826 837 827 838 ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); ··· 962 965 void *special; /* valid_t generally */ 963 966 } ide_task_t; 964 967 965 - void ide_tf_load(ide_drive_t *, ide_task_t *); 966 - void ide_tf_read(ide_drive_t *, ide_task_t *); 968 + void ide_tf_dump(const char *, struct ide_taskfile *); 967 969 968 970 extern void SELECT_DRIVE(ide_drive_t *); 969 971 extern void SELECT_MASK(ide_drive_t *, int); ··· 1068 1072 IDE_HFLAG_NO_DMA = (1 << 14), 1069 1073 /* check if host is PCI IDE device before allowing DMA */ 1070 1074 IDE_HFLAG_NO_AUTODMA = (1 << 15), 1075 + /* host uses MMIO */ 1076 + IDE_HFLAG_MMIO = (1 << 16), 1071 1077 /* host is CS5510/CS5520 */ 1072 1078 IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA, 1073 1079 /* no LBA48 */ ··· 1358 1360 1359 1361 return hwif->INB(hwif->io_ports.error_addr); 1360 1362 } 1361 - 1362 - /* 1363 - * Too bad. The drive wants to send us data which we are not ready to accept. 1364 - * Just throw it away. 1365 - */ 1366 - static inline void ide_atapi_discard_data(ide_drive_t *drive, unsigned bcount) 1367 - { 1368 - ide_hwif_t *hwif = drive->hwif; 1369 - 1370 - /* FIXME: use ->atapi_input_bytes */ 1371 - while (bcount--) 1372 - (void)hwif->INB(hwif->io_ports.data_addr); 1373 - } 1374 - 1375 - static inline void ide_atapi_write_zeros(ide_drive_t *drive, unsigned bcount) 1376 - { 1377 - ide_hwif_t *hwif = drive->hwif; 1378 - 1379 - /* FIXME: use ->atapi_output_bytes */ 1380 - while (bcount--) 1381 - hwif->OUTB(0, hwif->io_ports.data_addr); 1382 - } 1383 - 1384 1363 #endif /* _IDE_H */