FreeCalypso > hg > freecalypso-sw
changeset 226:4d706a4134b0
FFS in gsm-fw: generate the legacy block info table at run time
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Mon, 13 Jan 2014 10:15:59 +0000 |
parents | c04aa85559ed |
children | 1852900ce9ea |
files | gsm-fw/cfgmagic/feature.pirhack-ffs gsm-fw/services/ffs/cfgffs.c gsm-fw/services/ffs/drv.c gsm-fw/services/ffs/task.c |
diffstat | 4 files changed, 33 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/gsm-fw/cfgmagic/feature.pirhack-ffs Mon Jan 13 09:05:01 2014 +0000 +++ b/gsm-fw/cfgmagic/feature.pirhack-ffs Mon Jan 13 10:15:59 2014 +0000 @@ -12,6 +12,10 @@ # select: these sectors form an independent read/write bank, and are not used # for FFS by Pirelli's fw, eliminating the possibility of accidental FFS # cross-contamination between the two very different firmwares on the same hw. +# +# If you want to use some other sectors for FC FFS on the Pirelli, invoke +# feature pirhack-ffs first, then change CONFIG_PIRHACK_FFS_START and +# CONFIG_PIRHACK_FFS_NBLOCKS to taste. if [ $TARGET != pirelli ] then @@ -22,6 +26,10 @@ FFS_IN_RAM=0 CONFIG_PIRHACK_FFS=1 +CONFIG_PIRHACK_FFS_START=24 +CONFIG_PIRHACK_FFS_NBLOCKS=7 CONFIG_FLASH_WRITE=1 export_to_c CONFIG_PIRHACK_FFS +export_to_c CONFIG_PIRHACK_FFS_START +export_to_c CONFIG_PIRHACK_FFS_NBLOCKS export_to_c CONFIG_FLASH_WRITE
--- a/gsm-fw/services/ffs/cfgffs.c Mon Jan 13 09:05:01 2014 +0000 +++ b/gsm-fw/services/ffs/cfgffs.c Mon Jan 13 10:15:59 2014 +0000 @@ -16,11 +16,8 @@ #if FFS_IN_RAM -extern struct block_info_s ramffs_block_info[RAMFFS_NBLOCKS]; - struct dev_s dev = { .base = _RAMFFS_area, - .binfo = ramffs_block_info, .manufact = MANUFACT_RAM, .blocksize = RAMFFS_BLKSIZE_BYTES, .blocksize_ld = RAMFFS_BLKSIZE_LOG2, @@ -30,19 +27,8 @@ #elif CONFIG_MOKOFFS -static struct block_info_s mokoffs_blocks[7] = { - { 0x00000, 16 }, - { 0x10000, 16 }, - { 0x20000, 16 }, - { 0x30000, 16 }, - { 0x40000, 16 }, - { 0x50000, 16 }, - { 0x60000, 16 } -}; - struct dev_s dev = { .base = (char *) 0x380000, - .binfo = mokoffs_blocks, .manufact = MANUFACT_SAMSUNG, .device = 0x22A0, .blocksize = 0x10000, @@ -55,24 +41,14 @@ /* see ../../cfgmagic/feature.pirhack-ffs */ -static struct block_info_s pirhack_ffs_blocks[7] = { - { 0x600000, 18 }, - { 0x640000, 18 }, - { 0x680000, 18 }, - { 0x6C0000, 18 }, - { 0x700000, 18 }, - { 0x740000, 18 }, - { 0x780000, 18 } -}; - struct dev_s dev = { - .base = (char *) FLASH2_BASE_ADDR, - .binfo = pirhack_ffs_blocks, + .base = (char *) FLASH2_BASE_ADDR + + CONFIG_PIRHACK_FFS_START * 0x40000, .manufact = MANUFACT_AMD, .blocksize = 0x40000, .blocksize_ld = 18, .driver = FFS_DRIVER_AMD, - .numblocks = 7, + .numblocks = CONFIG_PIRHACK_FFS_NBLOCKS, }; #else
--- a/gsm-fw/services/ffs/drv.c Mon Jan 13 09:05:01 2014 +0000 +++ b/gsm-fw/services/ffs/drv.c Mon Jan 13 10:15:59 2014 +0000 @@ -11,6 +11,7 @@ #include "../../include/config.h" #include "ffs.h" #include "drv.h" +#include "core.h" /* for FFS_BLOCKS_MAX */ #include "ffstrace.h" #include "intctl.h" #include "ramffs.h" @@ -18,6 +19,13 @@ /****************************************************************************** + * "Block info" stupidity + ******************************************************************************/ + +static struct block_info_s block_info[FFS_BLOCKS_MAX]; + + +/****************************************************************************** * Macros ******************************************************************************/ @@ -125,24 +133,6 @@ * RAM Family Functions ******************************************************************************/ -struct block_info_s ramffs_block_info[RAMFFS_NBLOCKS]; - -int ffsdrv_ram_init(void) -{ - unsigned i; - uint32 offset; - - ttw(ttr(TTrDrvOther, "ffsdrv_ram_init()" NL)); - memset(_RAMFFS_area, 0xFF, RAMFFS_TOTAL_SIZE); - offset = 0; - for (i = 0; i < RAMFFS_NBLOCKS; i++) { - ramffs_block_info[i].offset = offset; - ramffs_block_info[i].size_ld = RAMFFS_BLKSIZE_LOG2; - offset += RAMFFS_BLKSIZE_BYTES; - } - return 0; -} - void ffsdrv_ram_write_halfword(volatile uint16 *dst, uint16 value) { *dst = value; @@ -399,6 +389,8 @@ effs_t ffsdrv_init(void) { int error; + unsigned i; + uint32 offset; tw(tr(TR_BEGIN, TrDrvInit, "drv_init() {\n")); ttw(str(TTrDrvOther, "ffsdrv_init() {" NL)); @@ -408,6 +400,14 @@ dev.atomsize = 1 << dev.atomlog2; dev.atomnotmask = dev.atomsize - 1; + offset = 0; + for (i = 0; i < dev.numblocks; i++) { + block_info[i].offset = offset; + block_info[i].size_ld = dev.blocksize_ld; + offset += dev.blocksize; + } + dev.binfo = block_info; + error = ffsdrv.init(); tw(tr(TR_FUNC, TrDrvInit, "dev.binfo = 0x%x\n", (unsigned int) dev.binfo));
--- a/gsm-fw/services/ffs/task.c Mon Jan 13 09:05:01 2014 +0000 +++ b/gsm-fw/services/ffs/task.c Mon Jan 13 10:15:59 2014 +0000 @@ -14,7 +14,9 @@ #include "task.h" #include "ffstrace.h" #include "intctl.h" +#include "ramffs.h" #include "../../riviera/rvm/rvm_use_id_list.h" +#include <string.h> /****************************************************************************** * Globals and function prototypes @@ -206,9 +208,9 @@ //ttr_init(TTrTask|TTrTest|TTrTestInfo|TTrDrvErase|TTrDrvWrite|TTrTaskLow|TTrApi); tmp_int_level = TCD_Interrupt_Level; // Backup Int level - TCD_Interrupt_Level = 0xC0; // The Interrups are not yet enabled... + TCD_Interrupt_Level = 0xC0; // The Interrups are not yet enabled.. #if FFS_IN_RAM - ffsdrv_ram_init(); + memset(_RAMFFS_area, 0xFF, RAMFFS_TOTAL_SIZE); #endif ffs_init_status = ffs_initialize(); TCD_Interrupt_Level = tmp_int_level; // Restore Int level