[Cbe-oss-dev] [patch 3/5] cell: updated driver for DDR2 memory on AXON

Christophe Lamoureux clamoure at mc.com
Tue Jun 26 21:25:25 EST 2007


> +/**
> + * axon_ram_direct_access - direct_access() method for block device
> + * @device, @sector, @data: see block_device_operations method
> + */
> +static int
> +axon_ram_direct_access(struct block_device *device, sector_t sector,
> + unsigned long *data)
> +{
> + struct axon_ram_bank *bank = device->bd_disk->private_data;
> + loff_t offset;
> +
> + offset = sector << AXON_RAM_SECTOR_SHIFT;
> + if (offset >= bank->size) {
> + dev_err(&bank->device->dev, "Access outside of address space\n");
> + return -ERANGE;
> + }
> +
> + *data = bank->ph_addr + offset;
> +
> + return 0;
> +}

Hi, 

By looking the ext2 implementation in 2.6.21 and doing some trials ( this is 
the only file-system that looks to use the direct_access method of block 
device )  I do not understand how this direct access function ( 
axon_ram_direct_access ) implementation could work. 

The value of *data returned is a physical address of the DDR as seen from the 
PPU ( something like 0x100_0000_0000+ offset )

The method ext2_clear_xip_target() will call clear_page() with this physical 
address. This does not work. 

There is the same kind of issue later in method ext2_get_xip_page() with 
virt_to_page() with the physical address. 

Note, that if the line 

	*data = bank->ph_addr + offset;

in axon_ram_direct_access is changed to

	*data = bank->io_addr + offset; 

the issue in ext2_clear_xip_target()  --> clear_page() would be corrected but 
the  ext2_get_xip_page() --> virt_to_page() would not work as the virtual 
address given would be the result of a ioremap_flags(). 

Did I misunderstood or miss something ? 

Thanks, 

Christophe. 

 







More information about the cbe-oss-dev mailing list