Index: io/flash/current/ChangeLog =================================================================== RCS file: /cvs/ecos/ecos/packages/io/flash/current/ChangeLog,v retrieving revision 1.38.2.3 diff -u -r1.38.2.3 ChangeLog --- io/flash/current/ChangeLog 12 Aug 2004 18:57:38 -0000 1.38.2.3 +++ io/flash/current/ChangeLog 16 Aug 2004 08:32:34 -0000 @@ -1,9 +1,17 @@ +2004-08-13 Andrew Lunn + + * src/flash.c: Make the flock lock/unlock code compile without + warnings. + * src/flashiodev.c (flashiodev_lookup): Only initialize the device + if we have not already been initialized via cyg_set_config(). + This stopped redboots mount -f working. + 2004-08-09 Andrew Lunn * src/flashiodev.c (flashiodev_lookup): Moved most of the flashiodev_init into this new function. This fixed the ordering issue with redboot startup. When doing a FIS name lookup in - flashiodev_init, redboot was not yet initialized so lookup + flashiodev_init, redboot was not yet nitialised so lookup failed. Moving this into flashiodev_lookup solves this problem. Its now possible for redboot to mount the jffs2 filesystem with -d /dev/flash1. Index: io/flash/current/src/flash.c =================================================================== RCS file: /cvs/ecos/ecos/packages/io/flash/current/src/flash.c,v retrieving revision 1.26.2.1 diff -u -r1.26.2.1 flash.c --- io/flash/current/src/flash.c 5 Aug 2004 13:50:02 -0000 1.26.2.1 +++ io/flash/current/src/flash.c 16 Aug 2004 08:32:35 -0000 @@ -713,7 +713,7 @@ stat = dev->funs->flash_hwr_map_error(dev,stat); if (CYG_FLASH_ERR_OK != stat && err_address) { - *err_address = (void *)block; + *err_address = block; break; } block += flash_block_size(dev, addr); @@ -765,7 +765,7 @@ dev=dev->next) ; if (!dev) return CYG_FLASH_ERR_INVALID; - if (!dev->funs->flash_block_lock) return CYG_FLASH_ERR_INVALID; + if (!dev->funs->flash_block_unlock) return CYG_FLASH_ERR_INVALID; #ifdef CYGPKG_KERNEL cyg_mutex_lock(&dev->mutex); @@ -790,7 +790,7 @@ stat = dev->funs->flash_hwr_map_error(dev,stat); if (CYG_FLASH_ERR_OK != stat && err_address) { - *err_address = (void *)block; + *err_address = block; break; } block += flash_block_size(dev, addr); Index: io/flash/current/src/flashiodev.c =================================================================== RCS file: /cvs/ecos/ecos/packages/io/flash/current/src/flashiodev.c,v retrieving revision 1.8.2.3 diff -u -r1.8.2.3 flashiodev.c --- io/flash/current/src/flashiodev.c 12 Aug 2004 18:57:38 -0000 1.8.2.3 +++ io/flash/current/src/flashiodev.c 16 Aug 2004 08:32:35 -0000 @@ -73,6 +73,7 @@ cyg_bool use_offset; char * fis_name; cyg_uint32 block_size; + cyg_bool init; }; static int dummy_printf( const char *fmt, ... ) {return 0;} @@ -95,6 +96,10 @@ cyg_uint32 i; int stat; + if (dev->init) + return ENOERR; + dev->init = 1; + if (dev->use_fis) { CYG_ADDRESS flash_base; unsigned long size; @@ -288,6 +293,8 @@ for (i=0; i < info.num_block_infos; i++){ dev->block_size = MAX(dev->block_size, info.block_info[i].block_size); } + dev->init = 1; + return ENOERR; } default: @@ -298,39 +305,37 @@ // get_config/set_config should be added later to provide the other flash // operations possible, like erase etc. +#define CYG_FLASHIODEV_DEV(start, end, fis, static, offset, name) \ + { start, end, fis, static, offset, name, 0, 0 } + #ifdef CYGNUM_IO_FLASH_BLOCK_CFG_FIS_1 -static struct flashiodev_priv_t priv1 = { +static struct flashiodev_priv_t priv1 = CYG_FLASHIODEV_DEV( 0, // start 0, // end 1, // use_fis 0, // use_static 0, // use_offset - CYGDAT_IO_FLASH_BLOCK_FIS_NAME_1, - 0 // blocksize -}; - + CYGDAT_IO_FLASH_BLOCK_FIS_NAME_1); #endif + #ifdef CYGNUM_IO_FLASH_BLOCK_CFG_STATIC_ABSOLUTE_1 -static struct flashiodev_priv_t priv1 = { +static struct flashiodev_priv_t priv1 = CYG_FLASHIODEV_DEV( CYGNUM_IO_FLASH_BLOCK_ABSOLUTE_START_1, // start CYGNUM_IO_FLASH_BLOCK_ABSOLUTE_START_1 + CYGNUM_IO_FLASH_BLOCK_ABSOLUTE_LENGTH_1, 0, // use_fis 1, // use_static 0, // use_offset - "", // fis_name - 0 // blocksize -}; + ""); // fis_name #endif + #ifdef CYGNUM_IO_FLASH_BLOCK_CFG_STATIC_1 -static struct flashiodev_priv_t priv1 = { +static struct flashiodev_priv_t priv1 = CYG_FLASHIODEV_DEV( CYGNUM_IO_FLASH_BLOCK_OFFSET_1, // start CYGNUM_IO_FLASH_BLOCK_LENGTH_1, // end 0, // use_fis 0, // use_static 1, // use_offset - "", // fis_name - 0 // blocksize -}; + ""); // fis_name #endif BLOCK_DEVIO_TABLE( cyg_io_flashdev1_ops, @@ -350,40 +355,35 @@ &flashiodev_lookup, &priv1 ); - #ifdef CYGSEM_IO_FLASH_BLOCK_DEVICE_2 #ifdef CYGNUM_IO_FLASH_BLOCK_CFG_FIS_2 -static struct flashiodev_priv_t priv2 = { +static struct flashiodev_priv_t priv2 = CYG_FLASHIODEV_DEV( 0, // start 0, // end 1, // use_fis 0, // use_static 0, // use_offset - CYGDAT_IO_FLASH_BLOCK_FIS_NAME_2, - 0 // blocksize -}; + CYGDAT_IO_FLASH_BLOCK_FIS_NAME_2); #endif + #ifdef CYGNUM_IO_FLASH_BLOCK_CFG_STATIC_ABSOLUTE_2 -static struct flashiodev_priv_t priv2 = { +static struct flashiodev_priv_t priv2 = CYG_FLASHIODEV_DEV( CYGNUM_IO_FLASH_BLOCK_ABSOLUTE_START_2, // start CYGNUM_IO_FLASH_BLOCK_ABSOLUTE_START_2 + CYGNUM_IO_FLASH_BLOCK_ABSOLUTE_LENGTH_2, 0, // use_fis 1, // use_static 0, // use_offset - "", // fis_name - 0 // blocksize -}; + ""); // fis_name #endif + #ifdef CYGNUM_IO_FLASH_BLOCK_CFG_STATIC_2 -static struct flashiodev_priv_t priv2 = { +static struct flashiodev_priv_t priv2 = CYG_FLASHIODEV_DEV( CYGNUM_IO_FLASH_BLOCK_OFFSET_2, // start CYGNUM_IO_FLASH_BLOCK_LENGTH_2, // end 0, // use_fis 0, // use_static 1, // use_offset - "", // fis_name - 0 // blocksize -}; + ""); // fis_name #endif BLOCK_DEVTAB_ENTRY( cyg_io_flashdev2,