lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 4 Aug 2007 15:35:02 +0200
From:	Pierre Ossman <drzeus-list@...eus.cx>
To:	David Vrabel <david.vrabel@....com>
Cc:	linux-kernel@...r.kernel.org, David Vrabel <david.vrabel@....com>
Subject: Re: sdio: extend sdio_readsb() and friends to handle any length of
 buffer

On Tue, 31 Jul 2007 16:36:33 +0100
David Vrabel <david.vrabel@....com> wrote:

> Extend sdio_readsb(), sdio_writesb(), sdio_memcpy_fromio(), and
> sdio_memcpy_toio() to handle any length of buffer by splitting the
> transfer into several IO_RW_EXTENDED commands. Typically, a transfer
> would be split into a single block mode transfer followed by a byte
> mode transfer for the remainder.
> 
> For this to work the block size must be limited to the maximum size
> of a byte mode transfer (512 bytes).  This limitation could be
> revisited if there are any cards out there that require a block size
> > 512.
> 
> Signed-off-by: David Vrabel <david.vrabel@....com>
> 

*snip*

> @@ -228,6 +235,39 @@ void sdio_writeb(struct sdio_func *func,
> unsigned char b, unsigned int addr, 
>  EXPORT_SYMBOL_GPL(sdio_writeb);
>  
> +/* Split an arbitrarily sized data transfer into several
> + * IO_RW_EXTENDED commands. */
> +static int sdio_io_rw_ext_helper(struct sdio_func *func, int write,
> +	unsigned fn, unsigned addr, int incr_addr, u8 *buf, unsigned
> size) +{
> +	unsigned remainder = size;
> +	int ret;
> +
> +	while (remainder > func->block_size) {
> +		unsigned blocks;
> +
> +		blocks = remainder % func->block_size;
> +		if (blocks > 511)
> +			blocks = 511;

You need to check how many blocks the host supports in one go. Also,
the total size of the transfer might exceed the host's capabilities.

> @@ -113,18 +112,22 @@ int mmc_io_rw_extended(struct mmc_card *card,
> int write, unsigned fn, cmd.opcode = SD_IO_RW_EXTENDED;
>  	cmd.arg = write ? 0x80000000 : 0x00000000;
>  	cmd.arg |= fn << 28;
> -	cmd.arg |= bang ? 0x00000000 : 0x04000000;
> +	cmd.arg |= incr_addr ? 0x04000000 : 0x00000000;
>  	cmd.arg |= addr << 9;
> -	cmd.arg |= (size == 512) ? 0 : size;
> +	if (blocks > 1) {
> +		cmd.arg |= 0x08000000;
> +		cmd.arg |= blocks;
> +	} else
> +		cmd.arg |= (blksz == 512) ? 0 : blksz;
>  	cmd.flags = MMC_RSP_R5 | MMC_CMD_ADTC;
>  

Until this function is made complete, I'd like some kind of test that
blksz <= 512 when blocks == 1.

-- 
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  PulseAudio, core developer          http://pulseaudio.org
  rdesktop, core developer          http://www.rdesktop.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ