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

ata: parport_pc: add 16-bit and 8-bit fast EPP transfer flags

PARPORT_EPP_FAST flag currently uses 32-bit I/O port access for data
read/write (insl/outsl).
Add PARPORT_EPP_FAST_16 and PARPORT_EPP_FAST_8 that use insw/outsw
and insb/outsb (and PARPORT_EPP_FAST_32 as alias for PARPORT_EPP_FAST).

Signed-off-by: Ondrej Zary <linux@zary.sk>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

authored by

Ondrej Zary and committed by
Damien Le Moal
05f0adef 5e4696d5

+19 -4
+16 -4
drivers/parport/parport_pc.c
··· 305 305 } 306 306 return got; 307 307 } 308 - if ((flags & PARPORT_EPP_FAST) && (length > 1)) { 309 - if (!(((long)buf | length) & 0x03)) 308 + if ((length > 1) && ((flags & PARPORT_EPP_FAST_32) 309 + || flags & PARPORT_EPP_FAST_16 310 + || flags & PARPORT_EPP_FAST_8)) { 311 + if ((flags & PARPORT_EPP_FAST_32) 312 + && !(((long)buf | length) & 0x03)) 310 313 insl(EPPDATA(port), buf, (length >> 2)); 314 + else if ((flags & PARPORT_EPP_FAST_16) 315 + && !(((long)buf | length) & 0x01)) 316 + insw(EPPDATA(port), buf, length >> 1); 311 317 else 312 318 insb(EPPDATA(port), buf, length); 313 319 if (inb(STATUS(port)) & 0x01) { ··· 340 334 { 341 335 size_t written = 0; 342 336 343 - if ((flags & PARPORT_EPP_FAST) && (length > 1)) { 344 - if (!(((long)buf | length) & 0x03)) 337 + if ((length > 1) && ((flags & PARPORT_EPP_FAST_32) 338 + || flags & PARPORT_EPP_FAST_16 339 + || flags & PARPORT_EPP_FAST_8)) { 340 + if ((flags & PARPORT_EPP_FAST_32) 341 + && !(((long)buf | length) & 0x03)) 345 342 outsl(EPPDATA(port), buf, (length >> 2)); 343 + else if ((flags & PARPORT_EPP_FAST_16) 344 + && !(((long)buf | length) & 0x01)) 345 + outsw(EPPDATA(port), buf, length >> 1); 346 346 else 347 347 outsb(EPPDATA(port), buf, length); 348 348 if (inb(STATUS(port)) & 0x01) {
+3
include/uapi/linux/parport.h
··· 90 90 /* Flags for block transfer operations. */ 91 91 #define PARPORT_EPP_FAST (1<<0) /* Unreliable counts. */ 92 92 #define PARPORT_W91284PIC (1<<1) /* have a Warp9 w91284pic in the device */ 93 + #define PARPORT_EPP_FAST_32 PARPORT_EPP_FAST /* 32-bit EPP transfers */ 94 + #define PARPORT_EPP_FAST_16 (1<<2) /* 16-bit EPP transfers */ 95 + #define PARPORT_EPP_FAST_8 (1<<3) /* 8-bit EPP transfers */ 93 96 94 97 /* The rest is for the kernel only */ 95 98 #endif /* _UAPI_PARPORT_H_ */