Commit 05f0adef authored by Ondrej Zary's avatar Ondrej Zary Committed by Damien Le Moal
Browse files

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: default avatarOndrej Zary <linux@zary.sk>
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
parent 5e4696d5
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -305,9 +305,15 @@ static size_t parport_pc_epp_read_data(struct parport *port, void *buf,
		}
		return got;
	}
	if ((flags & PARPORT_EPP_FAST) && (length > 1)) {
		if (!(((long)buf | length) & 0x03))
	if ((length > 1) && ((flags & PARPORT_EPP_FAST_32)
			   || flags & PARPORT_EPP_FAST_16
			   || flags & PARPORT_EPP_FAST_8)) {
		if ((flags & PARPORT_EPP_FAST_32)
		    && !(((long)buf | length) & 0x03))
			insl(EPPDATA(port), buf, (length >> 2));
		else if ((flags & PARPORT_EPP_FAST_16)
			 && !(((long)buf | length) & 0x01))
			insw(EPPDATA(port), buf, length >> 1);
		else
			insb(EPPDATA(port), buf, length);
		if (inb(STATUS(port)) & 0x01) {
@@ -334,9 +340,15 @@ static size_t parport_pc_epp_write_data(struct parport *port, const void *buf,
{
	size_t written = 0;

	if ((flags & PARPORT_EPP_FAST) && (length > 1)) {
		if (!(((long)buf | length) & 0x03))
	if ((length > 1) && ((flags & PARPORT_EPP_FAST_32)
			   || flags & PARPORT_EPP_FAST_16
			   || flags & PARPORT_EPP_FAST_8)) {
		if ((flags & PARPORT_EPP_FAST_32)
		    && !(((long)buf | length) & 0x03))
			outsl(EPPDATA(port), buf, (length >> 2));
		else if ((flags & PARPORT_EPP_FAST_16)
			 && !(((long)buf | length) & 0x01))
			outsw(EPPDATA(port), buf, length >> 1);
		else
			outsb(EPPDATA(port), buf, length);
		if (inb(STATUS(port)) & 0x01) {
+3 −0
Original line number Diff line number Diff line
@@ -90,6 +90,9 @@ typedef enum {
/* Flags for block transfer operations. */
#define PARPORT_EPP_FAST		(1<<0) /* Unreliable counts. */
#define PARPORT_W91284PIC		(1<<1) /* have a Warp9 w91284pic in the device */
#define PARPORT_EPP_FAST_32		PARPORT_EPP_FAST /* 32-bit EPP transfers */
#define PARPORT_EPP_FAST_16		(1<<2) /* 16-bit EPP transfers */
#define PARPORT_EPP_FAST_8		(1<<3) /* 8-bit EPP transfers */

/* The rest is for the kernel only */
#endif /* _UAPI_PARPORT_H_ */