From cd1011db80287eef933d1599b74cff1116c93134 Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Mon, 21 Sep 2009 11:20:31 -0500 Subject: tsec: Remove PHY command relocation fixups Signed-off-by: Peter Tyser --- drivers/net/tsec.c | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) (limited to 'drivers') diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 5c3d261ec..3f74118db 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -35,8 +35,6 @@ typedef volatile struct rtxbd { #define MAXCONTROLLERS (8) -static int relocated = 0; - static struct tsec_private *privlist[MAXCONTROLLERS]; static int num_tsecs = 0; @@ -59,7 +57,6 @@ uint read_phy_reg(struct tsec_private *priv, uint regnum); struct phy_info *get_phy_info(struct eth_device *dev); void phy_run_commands(struct tsec_private *priv, struct phy_cmd *cmd); static void adjust_link(struct eth_device *dev); -static void relocate_cmds(void); #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) \ && !defined(BITBANGMII) static int tsec_miiphy_write(char *devname, unsigned char addr, @@ -321,9 +318,6 @@ static int init_phy(struct eth_device *dev) asm("sync"); while (priv->phyregs->miimind & MIIMIND_BUSY) ; - if (0 == relocated) - relocate_cmds(); - /* Get the cmd structure corresponding to the attached * PHY */ curphy = get_phy_info(dev); @@ -1800,49 +1794,6 @@ void phy_run_commands(struct tsec_private *priv, struct phy_cmd *cmd) } } -/* Relocate the function pointers in the phy cmd lists */ -static void relocate_cmds(void) -{ - struct phy_cmd **cmdlistptr; - struct phy_cmd *cmd; - int i, j, k; - - for (i = 0; phy_info[i]; i++) { - /* First thing's first: relocate the pointers to the - * PHY command structures (the structs were done) */ - phy_info[i] = (struct phy_info *)((uint) phy_info[i] - + gd->reloc_off); - phy_info[i]->name += gd->reloc_off; - phy_info[i]->config = - (struct phy_cmd *)((uint) phy_info[i]->config - + gd->reloc_off); - phy_info[i]->startup = - (struct phy_cmd *)((uint) phy_info[i]->startup - + gd->reloc_off); - phy_info[i]->shutdown = - (struct phy_cmd *)((uint) phy_info[i]->shutdown - + gd->reloc_off); - - cmdlistptr = &phy_info[i]->config; - j = 0; - for (; cmdlistptr <= &phy_info[i]->shutdown; cmdlistptr++) { - k = 0; - for (cmd = *cmdlistptr; - cmd->mii_reg != miim_end; - cmd++) { - /* Only relocate non-NULL pointers */ - if (cmd->funct) - cmd->funct += gd->reloc_off; - - k++; - } - j++; - } - } - - relocated = 1; -} - #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) \ && !defined(BITBANGMII) -- cgit v1.2.3 From 6385b28116f775da4771b768ba9bf93c3aaaf26e Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Mon, 21 Sep 2009 11:20:32 -0500 Subject: fpga: Remove relocation fixups PPC boards are the only users of the current FPGA code which is littered with manual relocation fixups. Now that proper relocation is supported for PPC boards, remove FPGA manual relocation. Signed-off-by: Peter Tyser --- board/esd/pmc440/fpga.c | 6 +- board/gen860t/fpga.c | 5 +- board/matrix_vision/mvbc_p/fpga.c | 7 +- board/matrix_vision/mvblm7/fpga.c | 6 +- board/prodrive/alpr/fpga.c | 4 +- drivers/fpga/ACEX1K.c | 96 ------------------- drivers/fpga/altera.c | 39 -------- drivers/fpga/cyclon2.c | 91 ------------------- drivers/fpga/fpga.c | 53 +---------- drivers/fpga/spartan2.c | 187 -------------------------------------- drivers/fpga/spartan3.c | 185 ------------------------------------- drivers/fpga/stratixII.c | 24 ----- drivers/fpga/virtex2.c | 118 ------------------------ drivers/fpga/xilinx.c | 42 --------- include/ACEX1K.h | 4 - include/altera.h | 1 - include/fpga.h | 2 +- include/spartan2.h | 3 - include/spartan3.h | 3 - include/stratixII.h | 1 - include/virtex2.h | 3 - include/xilinx.h | 1 - 22 files changed, 18 insertions(+), 863 deletions(-) (limited to 'drivers') diff --git a/board/esd/pmc440/fpga.c b/board/esd/pmc440/fpga.c index a2eda32ac..f92bbff29 100644 --- a/board/esd/pmc440/fpga.c +++ b/board/esd/pmc440/fpga.c @@ -442,9 +442,9 @@ int pmc440_init_fpga(void) { char *s; - debug("%s:%d: Initialize FPGA interface (relocation offset = 0x%.8lx)\n", - __FUNCTION__, __LINE__, gd->reloc_off); - fpga_init(gd->reloc_off); + debug("%s:%d: Initialize FPGA interface\n", + __FUNCTION__, __LINE__); + fpga_init(); fpga_serialslave_init (); debug("%s:%d: Adding fpga 0\n", __FUNCTION__, __LINE__); diff --git a/board/gen860t/fpga.c b/board/gen860t/fpga.c index 29cad2ee8..d42c500ca 100644 --- a/board/gen860t/fpga.c +++ b/board/gen860t/fpga.c @@ -193,8 +193,9 @@ int gen860t_init_fpga (void) { int i; - PRINTF ("%s:%d: Initialize FPGA interface (relocation offset = 0x%.8lx)\n", __FUNCTION__, __LINE__, gd->reloc_off); - fpga_init (gd->reloc_off); + PRINTF ("%s:%d: Initialize FPGA interface\n", + __FUNCTION__, __LINE__); + fpga_init (); fpga_selectmap_init (); for (i = 0; i < CONFIG_FPGA_COUNT; i++) { diff --git a/board/matrix_vision/mvbc_p/fpga.c b/board/matrix_vision/mvbc_p/fpga.c index 356af1aa5..3ed46fe80 100644 --- a/board/matrix_vision/mvbc_p/fpga.c +++ b/board/matrix_vision/mvbc_p/fpga.c @@ -46,7 +46,6 @@ Altera_CYC2_Passive_Serial_fns altera_fns = { fpga_wr_fn, fpga_null_fn, fpga_null_fn, - 0 }; Altera_desc cyclone2 = { @@ -55,16 +54,14 @@ Altera_desc cyclone2 = { Altera_EP2C8_SIZE, (void *) &altera_fns, NULL, - 0 }; DECLARE_GLOBAL_DATA_PTR; int mvbc_p_init_fpga(void) { - fpga_debug("Initialize FPGA interface (reloc 0x%.8lx)\n", - gd->reloc_off); - fpga_init(gd->reloc_off); + fpga_debug("Initialize FPGA interface\n"); + fpga_init(); fpga_add(fpga_altera, &cyclone2); fpga_config_fn(0, 1, 0); udelay(60); diff --git a/board/matrix_vision/mvblm7/fpga.c b/board/matrix_vision/mvblm7/fpga.c index 7527d161a..7b03d6f50 100644 --- a/board/matrix_vision/mvblm7/fpga.c +++ b/board/matrix_vision/mvblm7/fpga.c @@ -46,7 +46,6 @@ Altera_CYC2_Passive_Serial_fns altera_fns = { fpga_wr_fn, fpga_null_fn, fpga_null_fn, - 0 }; Altera_desc cyclone2 = { @@ -62,9 +61,8 @@ DECLARE_GLOBAL_DATA_PTR; int mvblm7_init_fpga(void) { - fpga_debug("Initialize FPGA interface (reloc 0x%.8lx)\n", - gd->reloc_off); - fpga_init(gd->reloc_off); + fpga_debug("Initialize FPGA interface\n"); + fpga_init(); fpga_add(fpga_altera, &cyclone2); fpga_config_fn(0, 1, 0); udelay(60); diff --git a/board/prodrive/alpr/fpga.c b/board/prodrive/alpr/fpga.c index 0ecebc943..7571cd950 100644 --- a/board/prodrive/alpr/fpga.c +++ b/board/prodrive/alpr/fpga.c @@ -244,8 +244,8 @@ int alpr_fpga_init (void) { int i; - PRINTF ("%s:%d: Initialize FPGA interface (relocation offset = 0x%.8lx)\n", __FUNCTION__, __LINE__, gd->reloc_off); - fpga_init (gd->reloc_off); + PRINTF ("%s:%d: Initialize FPGA interface\n", __FUNCTION__, __LINE__); + fpga_init (); for (i = 0; i < CONFIG_FPGA_COUNT; i++) { PRINTF ("%s:%d: Adding fpga %d\n", __FUNCTION__, __LINE__, i); diff --git a/drivers/fpga/ACEX1K.c b/drivers/fpga/ACEX1K.c index 3f7967782..06b4247d8 100644 --- a/drivers/fpga/ACEX1K.c +++ b/drivers/fpga/ACEX1K.c @@ -51,7 +51,6 @@ static int ACEX1K_ps_load( Altera_desc *desc, void *buf, size_t bsize ); static int ACEX1K_ps_dump( Altera_desc *desc, void *buf, size_t bsize ); /* static int ACEX1K_ps_info( Altera_desc *desc ); */ -static int ACEX1K_ps_reloc( Altera_desc *desc, ulong reloc_offset ); /* ------------------------------------------------------------------------- */ /* ACEX1K Generic Implementation */ @@ -101,31 +100,6 @@ int ACEX1K_info( Altera_desc *desc ) } -int ACEX1K_reloc (Altera_desc * desc, ulong reloc_offset) -{ - int ret_val = FPGA_FAIL; /* assume a failure */ - - if (desc->family != Altera_ACEX1K) { - printf ("%s: Unsupported family type, %d\n", - __FUNCTION__, desc->family); - return FPGA_FAIL; - } else - switch (desc->iface) { - case passive_serial: - ret_val = ACEX1K_ps_reloc (desc, reloc_offset); - break; - - /* Add new interface types here */ - - default: - printf ("%s: Unsupported interface type, %d\n", - __FUNCTION__, desc->iface); - } - - return ret_val; -} - - /* ------------------------------------------------------------------------- */ /* ACEX1K Passive Serial Generic Implementation */ @@ -290,73 +264,3 @@ static int ACEX1K_ps_dump (Altera_desc * desc, void *buf, size_t bsize) __FUNCTION__); return FPGA_FAIL; } - -static int ACEX1K_ps_reloc (Altera_desc * desc, ulong reloc_offset) -{ - int ret_val = FPGA_FAIL; /* assume the worst */ - Altera_ACEX1K_Passive_Serial_fns *fn_r, *fn = - (Altera_ACEX1K_Passive_Serial_fns *) (desc->iface_fns); - - if (fn) { - ulong addr; - - /* Get the relocated table address */ - addr = (ulong) fn + reloc_offset; - fn_r = (Altera_ACEX1K_Passive_Serial_fns *) addr; - - if (!fn_r->relocated) { - - if (memcmp (fn_r, fn, - sizeof (Altera_ACEX1K_Passive_Serial_fns)) - == 0) { - /* good copy of the table, fix the descriptor pointer */ - desc->iface_fns = fn_r; - } else { - PRINTF ("%s: Invalid function table at 0x%p\n", - __FUNCTION__, fn_r); - return FPGA_FAIL; - } - - PRINTF ("%s: Relocating descriptor at 0x%p\n", __FUNCTION__, - desc); - - addr = (ulong) (fn->pre) + reloc_offset; - fn_r->pre = (Altera_pre_fn) addr; - - addr = (ulong) (fn->config) + reloc_offset; - fn_r->config = (Altera_config_fn) addr; - - addr = (ulong) (fn->status) + reloc_offset; - fn_r->status = (Altera_status_fn) addr; - - addr = (ulong) (fn->done) + reloc_offset; - fn_r->done = (Altera_done_fn) addr; - - addr = (ulong) (fn->clk) + reloc_offset; - fn_r->clk = (Altera_clk_fn) addr; - - addr = (ulong) (fn->data) + reloc_offset; - fn_r->data = (Altera_data_fn) addr; - - addr = (ulong) (fn->abort) + reloc_offset; - fn_r->abort = (Altera_abort_fn) addr; - - addr = (ulong) (fn->post) + reloc_offset; - fn_r->post = (Altera_post_fn) addr; - - fn_r->relocated = TRUE; - - } else { - /* this table has already been moved */ - /* XXX - should check to see if the descriptor is correct */ - desc->iface_fns = fn_r; - } - - ret_val = FPGA_SUCCESS; - } else { - printf ("%s: NULL Interface function table!\n", __FUNCTION__); - } - - return ret_val; - -} diff --git a/drivers/fpga/altera.c b/drivers/fpga/altera.c index 09dc0b22e..650f2ec73 100644 --- a/drivers/fpga/altera.c +++ b/drivers/fpga/altera.c @@ -211,45 +211,6 @@ int altera_info( Altera_desc *desc ) return ret_val; } -int altera_reloc( Altera_desc *desc, ulong reloc_offset) -{ - int ret_val = FPGA_FAIL; /* assume a failure */ - - if (!altera_validate (desc, (char *)__FUNCTION__)) { - printf ("%s: Invalid device descriptor\n", __FUNCTION__); - } else { - switch (desc->family) { - case Altera_ACEX1K: -#if defined(CONFIG_FPGA_ACEX1K) - ret_val = ACEX1K_reloc (desc, reloc_offset); -#else - printf ("%s: No support for ACEX devices.\n", - __FUNCTION__); -#endif - break; -#if defined(CONFIG_FPGA_STRATIX_II) - case Altera_StratixII: - ret_val = StratixII_reloc (desc, reloc_offset); - break; -#endif - case Altera_CYC2: -#if defined(CONFIG_FPGA_CYCLON2) - ret_val = CYC2_reloc (desc, reloc_offset); -#else - printf ("%s: No support for CYCLON II devices.\n", - __FUNCTION__); -#endif - break; - /* Add new family types here */ - default: - printf ("%s: Unsupported family type, %d\n", - __FUNCTION__, desc->family); - } - } - - return ret_val; -} - /* ------------------------------------------------------------------------- */ static int altera_validate (Altera_desc * desc, const char *fn) diff --git a/drivers/fpga/cyclon2.c b/drivers/fpga/cyclon2.c index 3ed64b279..4622b4e45 100644 --- a/drivers/fpga/cyclon2.c +++ b/drivers/fpga/cyclon2.c @@ -50,7 +50,6 @@ static int CYC2_ps_load( Altera_desc *desc, void *buf, size_t bsize ); static int CYC2_ps_dump( Altera_desc *desc, void *buf, size_t bsize ); /* static int CYC2_ps_info( Altera_desc *desc ); */ -static int CYC2_ps_reloc( Altera_desc *desc, ulong reloc_offset ); /* ------------------------------------------------------------------------- */ /* CYCLON2 Generic Implementation */ @@ -99,30 +98,6 @@ int CYC2_info( Altera_desc *desc ) return FPGA_SUCCESS; } -int CYC2_reloc (Altera_desc * desc, ulong reloc_offset) -{ - int ret_val = FPGA_FAIL; /* assume a failure */ - - if (desc->family != Altera_CYC2) { - printf ("%s: Unsupported family type, %d\n", - __FUNCTION__, desc->family); - return FPGA_FAIL; - } else - switch (desc->iface) { - case passive_serial: - ret_val = CYC2_ps_reloc (desc, reloc_offset); - break; - - /* Add new interface types here */ - - default: - printf ("%s: Unsupported interface type, %d\n", - __FUNCTION__, desc->iface); - } - - return ret_val; -} - /* ------------------------------------------------------------------------- */ /* CYCLON2 Passive Serial Generic Implementation */ static int CYC2_ps_load (Altera_desc * desc, void *buf, size_t bsize) @@ -233,69 +208,3 @@ static int CYC2_ps_dump (Altera_desc * desc, void *buf, size_t bsize) __FUNCTION__); return FPGA_FAIL; } - -static int CYC2_ps_reloc (Altera_desc * desc, ulong reloc_offset) -{ - int ret_val = FPGA_FAIL; /* assume the worst */ - Altera_CYC2_Passive_Serial_fns *fn_r, *fn = - (Altera_CYC2_Passive_Serial_fns *) (desc->iface_fns); - - if (fn) { - ulong addr; - - /* Get the relocated table address */ - addr = (ulong) fn + reloc_offset; - fn_r = (Altera_CYC2_Passive_Serial_fns *) addr; - - if (!fn_r->relocated) { - - if (memcmp (fn_r, fn, - sizeof (Altera_CYC2_Passive_Serial_fns)) - == 0) { - /* good copy of the table, fix the descriptor pointer */ - desc->iface_fns = fn_r; - } else { - PRINTF ("%s: Invalid function table at 0x%p\n", - __FUNCTION__, fn_r); - return FPGA_FAIL; - } - - PRINTF ("%s: Relocating descriptor at 0x%p\n", __FUNCTION__, - desc); - - addr = (ulong) (fn->pre) + reloc_offset; - fn_r->pre = (Altera_pre_fn) addr; - - addr = (ulong) (fn->config) + reloc_offset; - fn_r->config = (Altera_config_fn) addr; - - addr = (ulong) (fn->status) + reloc_offset; - fn_r->status = (Altera_status_fn) addr; - - addr = (ulong) (fn->done) + reloc_offset; - fn_r->done = (Altera_done_fn) addr; - - addr = (ulong) (fn->write) + reloc_offset; - fn_r->write = (Altera_write_fn) addr; - - addr = (ulong) (fn->abort) + reloc_offset; - fn_r->abort = (Altera_abort_fn) addr; - - addr = (ulong) (fn->post) + reloc_offset; - fn_r->post = (Altera_post_fn) addr; - - fn_r->relocated = TRUE; - - } else { - /* this table has already been moved */ - /* XXX - should check to see if the descriptor is correct */ - desc->iface_fns = fn_r; - } - - ret_val = FPGA_SUCCESS; - } else { - printf ("%s: NULL Interface function table!\n", __FUNCTION__); - } - - return ret_val; -} diff --git a/drivers/fpga/fpga.c b/drivers/fpga/fpga.c index 67a6c300c..565951779 100644 --- a/drivers/fpga/fpga.c +++ b/drivers/fpga/fpga.c @@ -46,7 +46,6 @@ #endif /* Local static data */ -static ulong relocation_offset = 0; static int next_desc = FPGA_INVALID_DEVICE; static fpga_desc desc_table[CONFIG_MAX_FPGA_DEVICES]; @@ -153,46 +152,12 @@ static int fpga_dev_info( int devnum ) } -/* fpga_reloc - * generic multiplexing code - */ -int fpga_reloc( fpga_type devtype, void *desc, ulong reloc_off ) -{ - int ret_val = FPGA_FAIL; - - PRINTF( "%s: Relocating Device of type %d @ 0x%p with offset %lx\n", - __FUNCTION__, devtype, desc, reloc_off ); - - switch ( devtype ) { - case fpga_xilinx: -#if defined(CONFIG_FPGA_XILINX) - ret_val = xilinx_reloc( desc, reloc_off ); -#else - fpga_no_sup( (char *)__FUNCTION__, "Xilinx devices" ); -#endif - break; - case fpga_altera: -#if defined(CONFIG_FPGA_ALTERA) - ret_val = altera_reloc( desc, reloc_off ); -#else - fpga_no_sup( (char *)__FUNCTION__, "Altera devices" ); -#endif - break; - default: - printf( "%s: Invalid or unsupported device type %d\n", - __FUNCTION__, devtype ); - } - - return ret_val; -} - /* ------------------------------------------------------------------------- */ /* fgpa_init is usually called from misc_init_r() and MUST be called * before any of the other fpga functions are used. */ -void fpga_init( ulong reloc_off ) +void fpga_init(void) { - relocation_offset = reloc_off; next_desc = 0; memset( desc_table, 0, sizeof(desc_table)); @@ -208,9 +173,7 @@ int fpga_count( void ) } /* fpga_add - * Attempts to relocate the device/board specific interface code - * to the proper RAM locations and adds the device descriptor to - * the device table. + * Add the device descriptor to the device table. */ int fpga_add( fpga_type devtype, void *desc ) { @@ -221,15 +184,9 @@ int fpga_add( fpga_type devtype, void *desc ) } else if (( devtype > fpga_min_type ) && ( devtype < fpga_undefined )) { if ( desc ) { if ( next_desc < CONFIG_MAX_FPGA_DEVICES ) { - if ( fpga_reloc( devtype, desc, relocation_offset ) - == FPGA_SUCCESS ) { - devnum = next_desc; - desc_table[next_desc].devtype = devtype; - desc_table[next_desc++].devdesc = desc; - } else { - printf( "%s: Unable to relocate device interface table!\n", - __FUNCTION__ ); - } + devnum = next_desc; + desc_table[next_desc].devtype = devtype; + desc_table[next_desc++].devdesc = desc; } else { printf( "%s: Exceeded Max FPGA device count\n", __FUNCTION__ ); } diff --git a/drivers/fpga/spartan2.c b/drivers/fpga/spartan2.c index d745334e9..cd16a9c44 100644 --- a/drivers/fpga/spartan2.c +++ b/drivers/fpga/spartan2.c @@ -51,12 +51,10 @@ static int Spartan2_sp_load( Xilinx_desc *desc, void *buf, size_t bsize ); static int Spartan2_sp_dump( Xilinx_desc *desc, void *buf, size_t bsize ); /* static int Spartan2_sp_info( Xilinx_desc *desc ); */ -static int Spartan2_sp_reloc( Xilinx_desc *desc, ulong reloc_offset ); static int Spartan2_ss_load( Xilinx_desc *desc, void *buf, size_t bsize ); static int Spartan2_ss_dump( Xilinx_desc *desc, void *buf, size_t bsize ); /* static int Spartan2_ss_info( Xilinx_desc *desc ); */ -static int Spartan2_ss_reloc( Xilinx_desc *desc, ulong reloc_offset ); /* ------------------------------------------------------------------------- */ /* Spartan-II Generic Implementation */ @@ -112,33 +110,6 @@ int Spartan2_info( Xilinx_desc *desc ) } -int Spartan2_reloc (Xilinx_desc * desc, ulong reloc_offset) -{ - int ret_val = FPGA_FAIL; /* assume a failure */ - - if (desc->family != Xilinx_Spartan2) { - printf ("%s: Unsupported family type, %d\n", - __FUNCTION__, desc->family); - return FPGA_FAIL; - } else - switch (desc->iface) { - case slave_serial: - ret_val = Spartan2_ss_reloc (desc, reloc_offset); - break; - - case slave_parallel: - ret_val = Spartan2_sp_reloc (desc, reloc_offset); - break; - - default: - printf ("%s: Unsupported interface type, %d\n", - __FUNCTION__, desc->iface); - } - - return ret_val; -} - - /* ------------------------------------------------------------------------- */ /* Spartan-II Slave Parallel Generic Implementation */ @@ -340,93 +311,6 @@ static int Spartan2_sp_dump (Xilinx_desc * desc, void *buf, size_t bsize) } -static int Spartan2_sp_reloc (Xilinx_desc * desc, ulong reloc_offset) -{ - int ret_val = FPGA_FAIL; /* assume the worst */ - Xilinx_Spartan2_Slave_Parallel_fns *fn_r, *fn = - (Xilinx_Spartan2_Slave_Parallel_fns *) (desc->iface_fns); - - if (fn) { - ulong addr; - - /* Get the relocated table address */ - addr = (ulong) fn + reloc_offset; - fn_r = (Xilinx_Spartan2_Slave_Parallel_fns *) addr; - - if (!fn_r->relocated) { - - if (memcmp (fn_r, fn, - sizeof (Xilinx_Spartan2_Slave_Parallel_fns)) - == 0) { - /* good copy of the table, fix the descriptor pointer */ - desc->iface_fns = fn_r; - } else { - PRINTF ("%s: Invalid function table at 0x%p\n", - __FUNCTION__, fn_r); - return FPGA_FAIL; - } - - PRINTF ("%s: Relocating descriptor at 0x%p\n", __FUNCTION__, - desc); - - addr = (ulong) (fn->pre) + reloc_offset; - fn_r->pre = (Xilinx_pre_fn) addr; - - addr = (ulong) (fn->pgm) + reloc_offset; - fn_r->pgm = (Xilinx_pgm_fn) addr; - - addr = (ulong) (fn->init) + reloc_offset; - fn_r->init = (Xilinx_init_fn) addr; - - addr = (ulong) (fn->done) + reloc_offset; - fn_r->done = (Xilinx_done_fn) addr; - - addr = (ulong) (fn->clk) + reloc_offset; - fn_r->clk = (Xilinx_clk_fn) addr; - - addr = (ulong) (fn->err) + reloc_offset; - fn_r->err = (Xilinx_err_fn) addr; - - addr = (ulong) (fn->cs) + reloc_offset; - fn_r->cs = (Xilinx_cs_fn) addr; - - addr = (ulong) (fn->wr) + reloc_offset; - fn_r->wr = (Xilinx_wr_fn) addr; - - addr = (ulong) (fn->rdata) + reloc_offset; - fn_r->rdata = (Xilinx_rdata_fn) addr; - - addr = (ulong) (fn->wdata) + reloc_offset; - fn_r->wdata = (Xilinx_wdata_fn) addr; - - addr = (ulong) (fn->busy) + reloc_offset; - fn_r->busy = (Xilinx_busy_fn) addr; - - addr = (ulong) (fn->abort) + reloc_offset; - fn_r->abort = (Xilinx_abort_fn) addr; - - if (fn->post) { - addr = (ulong) (fn->post) + reloc_offset; - fn_r->post = (Xilinx_post_fn) addr; - } - - fn_r->relocated = TRUE; - - } else { - /* this table has already been moved */ - /* XXX - should check to see if the descriptor is correct */ - desc->iface_fns = fn_r; - } - - ret_val = FPGA_SUCCESS; - } else { - printf ("%s: NULL Interface function table!\n", __FUNCTION__); - } - - return ret_val; - -} - /* ------------------------------------------------------------------------- */ static int Spartan2_ss_load (Xilinx_desc * desc, void *buf, size_t bsize) @@ -580,74 +464,3 @@ static int Spartan2_ss_dump (Xilinx_desc * desc, void *buf, size_t bsize) __FUNCTION__); return FPGA_FAIL; } - -static int Spartan2_ss_reloc (Xilinx_desc * desc, ulong reloc_offset) -{ - int ret_val = FPGA_FAIL; /* assume the worst */ - Xilinx_Spartan2_Slave_Serial_fns *fn_r, *fn = - (Xilinx_Spartan2_Slave_Serial_fns *) (desc->iface_fns); - - if (fn) { - ulong addr; - - /* Get the relocated table address */ - addr = (ulong) fn + reloc_offset; - fn_r = (Xilinx_Spartan2_Slave_Serial_fns *) addr; - - if (!fn_r->relocated) { - - if (memcmp (fn_r, fn, - sizeof (Xilinx_Spartan2_Slave_Serial_fns)) - == 0) { - /* good copy of the table, fix the descriptor pointer */ - desc->iface_fns = fn_r; - } else { - PRINTF ("%s: Invalid function table at 0x%p\n", - __FUNCTION__, fn_r); - return FPGA_FAIL; - } - - PRINTF ("%s: Relocating descriptor at 0x%p\n", __FUNCTION__, - desc); - - if (fn->pre) { - addr = (ulong) (fn->pre) + reloc_offset; - fn_r->pre = (Xilinx_pre_fn) addr; - } - - addr = (ulong) (fn->pgm) + reloc_offset; - fn_r->pgm = (Xilinx_pgm_fn) addr; - - addr = (ulong) (fn->init) + reloc_offset; - fn_r->init = (Xilinx_init_fn) addr; - - addr = (ulong) (fn->done) + reloc_offset; - fn_r->done = (Xilinx_done_fn) addr; - - addr = (ulong) (fn->clk) + reloc_offset; - fn_r->clk = (Xilinx_clk_fn) addr; - - addr = (ulong) (fn->wr) + reloc_offset; - fn_r->wr = (Xilinx_wr_fn) addr; - - if (fn->post) { - addr = (ulong) (fn->post) + reloc_offset; - fn_r->post = (Xilinx_post_fn) addr; - } - - fn_r->relocated = TRUE; - - } else { - /* this table has already been moved */ - /* XXX - should check to see if the descriptor is correct */ - desc->iface_fns = fn_r; - } - - ret_val = FPGA_SUCCESS; - } else { - printf ("%s: NULL Interface function table!\n", __FUNCTION__); - } - - return ret_val; - -} diff --git a/drivers/fpga/spartan3.c b/drivers/fpga/spartan3.c index 8bb244971..0fe30410a 100644 --- a/drivers/fpga/spartan3.c +++ b/drivers/fpga/spartan3.c @@ -56,12 +56,10 @@ static int Spartan3_sp_load( Xilinx_desc *desc, void *buf, size_t bsize ); static int Spartan3_sp_dump( Xilinx_desc *desc, void *buf, size_t bsize ); /* static int Spartan3_sp_info( Xilinx_desc *desc ); */ -static int Spartan3_sp_reloc( Xilinx_desc *desc, ulong reloc_offset ); static int Spartan3_ss_load( Xilinx_desc *desc, void *buf, size_t bsize ); static int Spartan3_ss_dump( Xilinx_desc *desc, void *buf, size_t bsize ); /* static int Spartan3_ss_info( Xilinx_desc *desc ); */ -static int Spartan3_ss_reloc( Xilinx_desc *desc, ulong reloc_offset ); /* ------------------------------------------------------------------------- */ /* Spartan-II Generic Implementation */ @@ -117,33 +115,6 @@ int Spartan3_info( Xilinx_desc *desc ) } -int Spartan3_reloc (Xilinx_desc * desc, ulong reloc_offset) -{ - int ret_val = FPGA_FAIL; /* assume a failure */ - - if (desc->family != Xilinx_Spartan3) { - printf ("%s: Unsupported family type, %d\n", - __FUNCTION__, desc->family); - return FPGA_FAIL; - } else - switch (desc->iface) { - case slave_serial: - ret_val = Spartan3_ss_reloc (desc, reloc_offset); - break; - - case slave_parallel: - ret_val = Spartan3_sp_reloc (desc, reloc_offset); - break; - - default: - printf ("%s: Unsupported interface type, %d\n", - __FUNCTION__, desc->iface); - } - - return ret_val; -} - - /* ------------------------------------------------------------------------- */ /* Spartan-II Slave Parallel Generic Implementation */ @@ -347,91 +318,6 @@ static int Spartan3_sp_dump (Xilinx_desc * desc, void *buf, size_t bsize) } -static int Spartan3_sp_reloc (Xilinx_desc * desc, ulong reloc_offset) -{ - int ret_val = FPGA_FAIL; /* assume the worst */ - Xilinx_Spartan3_Slave_Parallel_fns *fn_r, *fn = - (Xilinx_Spartan3_Slave_Parallel_fns *) (desc->iface_fns); - - if (fn) { - ulong addr; - - /* Get the relocated table address */ - addr = (ulong) fn + reloc_offset; - fn_r = (Xilinx_Spartan3_Slave_Parallel_fns *) addr; - - if (!fn_r->relocated) { - - if (memcmp (fn_r, fn, - sizeof (Xilinx_Spartan3_Slave_Parallel_fns)) - == 0) { - /* good copy of the table, fix the descriptor pointer */ - desc->iface_fns = fn_r; - } else { - PRINTF ("%s: Invalid function table at 0x%p\n", - __FUNCTION__, fn_r); - return FPGA_FAIL; - } - - PRINTF ("%s: Relocating descriptor at 0x%p\n", __FUNCTION__, - desc); - - addr = (ulong) (fn->pre) + reloc_offset; - fn_r->pre = (Xilinx_pre_fn) addr; - - addr = (ulong) (fn->pgm) + reloc_offset; - fn_r->pgm = (Xilinx_pgm_fn) addr; - - addr = (ulong) (fn->init) + reloc_offset; - fn_r->init = (Xilinx_init_fn) addr; - - addr = (ulong) (fn->done) + reloc_offset; - fn_r->done = (Xilinx_done_fn) addr; - - addr = (ulong) (fn->clk) + reloc_offset; - fn_r->clk = (Xilinx_clk_fn) addr; - - addr = (ulong) (fn->err) + reloc_offset; - fn_r->err = (Xilinx_err_fn) addr; - - addr = (ulong) (fn->cs) + reloc_offset; - fn_r->cs = (Xilinx_cs_fn) addr; - - addr = (ulong) (fn->wr) + reloc_offset; - fn_r->wr = (Xilinx_wr_fn) addr; - - addr = (ulong) (fn->rdata) + reloc_offset; - fn_r->rdata = (Xilinx_rdata_fn) addr; - - addr = (ulong) (fn->wdata) + reloc_offset; - fn_r->wdata = (Xilinx_wdata_fn) addr; - - addr = (ulong) (fn->busy) + reloc_offset; - fn_r->busy = (Xilinx_busy_fn) addr; - - addr = (ulong) (fn->abort) + reloc_offset; - fn_r->abort = (Xilinx_abort_fn) addr; - - addr = (ulong) (fn->post) + reloc_offset; - fn_r->post = (Xilinx_post_fn) addr; - - fn_r->relocated = TRUE; - - } else { - /* this table has already been moved */ - /* XXX - should check to see if the descriptor is correct */ - desc->iface_fns = fn_r; - } - - ret_val = FPGA_SUCCESS; - } else { - printf ("%s: NULL Interface function table!\n", __FUNCTION__); - } - - return ret_val; - -} - /* ------------------------------------------------------------------------- */ static int Spartan3_ss_load (Xilinx_desc * desc, void *buf, size_t bsize) @@ -587,74 +473,3 @@ static int Spartan3_ss_dump (Xilinx_desc * desc, void *buf, size_t bsize) __FUNCTION__); return FPGA_FAIL; } - -static int Spartan3_ss_reloc (Xilinx_desc * desc, ulong reloc_offset) -{ - int ret_val = FPGA_FAIL; /* assume the worst */ - Xilinx_Spartan3_Slave_Serial_fns *fn_r, *fn = - (Xilinx_Spartan3_Slave_Serial_fns *) (desc->iface_fns); - - if (fn) { - ulong addr; - - /* Get the relocated table address */ - addr = (ulong) fn + reloc_offset; - fn_r = (Xilinx_Spartan3_Slave_Serial_fns *) addr; - - if (!fn_r->relocated) { - - if (memcmp (fn_r, fn, - sizeof (Xilinx_Spartan3_Slave_Serial_fns)) - == 0) { - /* good copy of the table, fix the descriptor pointer */ - desc->iface_fns = fn_r; - } else { - PRINTF ("%s: Invalid function table at 0x%p\n", - __FUNCTION__, fn_r); - return FPGA_FAIL; - } - - PRINTF ("%s: Relocating descriptor at 0x%p\n", __FUNCTION__, - desc); - - if (fn->pre) { - addr = (ulong) (fn->pre) + reloc_offset; - fn_r->pre = (Xilinx_pre_fn) addr; - } - - addr = (ulong) (fn->pgm) + reloc_offset; - fn_r->pgm = (Xilinx_pgm_fn) addr; - - addr = (ulong) (fn->init) + reloc_offset; - fn_r->init = (Xilinx_init_fn) addr; - - addr = (ulong) (fn->done) + reloc_offset; - fn_r->done = (Xilinx_done_fn) addr; - - addr = (ulong) (fn->clk) + reloc_offset; - fn_r->clk = (Xilinx_clk_fn) addr; - - addr = (ulong) (fn->wr) + reloc_offset; - fn_r->wr = (Xilinx_wr_fn) addr; - - if (fn->post) { - addr = (ulong) (fn->post) + reloc_offset; - fn_r->post = (Xilinx_post_fn) addr; - } - - fn_r->relocated = TRUE; - - } else { - /* this table has already been moved */ - /* XXX - should check to see if the descriptor is correct */ - desc->iface_fns = fn_r; - } - - ret_val = FPGA_SUCCESS; - } else { - printf ("%s: NULL Interface function table!\n", __FUNCTION__); - } - - return ret_val; - -} diff --git a/drivers/fpga/stratixII.c b/drivers/fpga/stratixII.c index 7556dbfb3..8a3a7d872 100644 --- a/drivers/fpga/stratixII.c +++ b/drivers/fpga/stratixII.c @@ -77,30 +77,6 @@ int StratixII_info (Altera_desc * desc) return FPGA_SUCCESS; } -int StratixII_reloc (Altera_desc * desc, ulong reloc_offset) -{ - int i; - uint32_t dest = (uint32_t) desc & 0xff000000; - - /* we assume a relocated code and non relocated code has different upper 8 bits */ - if (dest != ((uint32_t) desc->iface_fns & 0xff000000)) { - desc->iface_fns = - (void *)((uint32_t) (desc->iface_fns) + reloc_offset); - } - for (i = 0; i < sizeof (altera_board_specific_func) / sizeof (void *); - i++) { - if (dest != - ((uint32_t) (((void **)(desc->iface_fns))[i]) & 0xff000000)) - { - ((void **)(desc->iface_fns))[i] = - (void - *)(((uint32_t) (((void **)(desc->iface_fns))[i])) + - reloc_offset); - } - } - return FPGA_SUCCESS; -} - int StratixII_ps_fpp_dump (Altera_desc * desc, void *buf, size_t bsize) { printf ("Stratix II Fast Passive Parallel dump is not implemented\n"); diff --git a/drivers/fpga/virtex2.c b/drivers/fpga/virtex2.c index 50d092184..d1b4d15b7 100644 --- a/drivers/fpga/virtex2.c +++ b/drivers/fpga/virtex2.c @@ -103,11 +103,9 @@ static int Virtex2_ssm_load (Xilinx_desc * desc, void *buf, size_t bsize); static int Virtex2_ssm_dump (Xilinx_desc * desc, void *buf, size_t bsize); -static int Virtex2_ssm_reloc (Xilinx_desc * desc, ulong reloc_offset); static int Virtex2_ss_load (Xilinx_desc * desc, void *buf, size_t bsize); static int Virtex2_ss_dump (Xilinx_desc * desc, void *buf, size_t bsize); -static int Virtex2_ss_reloc (Xilinx_desc * desc, ulong reloc_offset); int Virtex2_load (Xilinx_desc * desc, void *buf, size_t bsize) { @@ -158,31 +156,6 @@ int Virtex2_info (Xilinx_desc * desc) return FPGA_SUCCESS; } -int Virtex2_reloc (Xilinx_desc * desc, ulong reloc_offset) -{ - int ret_val = FPGA_FAIL; - - if (desc->family != Xilinx_Virtex2) { - printf ("%s: Unsupported family type, %d\n", - __FUNCTION__, desc->family); - return FPGA_FAIL; - } else - switch (desc->iface) { - case slave_serial: - ret_val = Virtex2_ss_reloc (desc, reloc_offset); - break; - - case slave_selectmap: - ret_val = Virtex2_ssm_reloc (desc, reloc_offset); - break; - - default: - printf ("%s: Unsupported interface type, %d\n", - __FUNCTION__, desc->iface); - } - return ret_val; -} - /* * Virtex-II Slave SelectMap configuration loader. Configuration via * SelectMap is as follows: @@ -448,81 +421,6 @@ static int Virtex2_ssm_dump (Xilinx_desc * desc, void *buf, size_t bsize) return ret_val; } -/* - * Relocate the addresses in the function table from FLASH (or ROM, - * or whatever) to RAM. - */ -static int Virtex2_ssm_reloc (Xilinx_desc * desc, ulong reloc_offset) -{ - ulong addr; - int ret_val = FPGA_FAIL; - Xilinx_Virtex2_Slave_SelectMap_fns *fn_r, *fn = - (Xilinx_Virtex2_Slave_SelectMap_fns *) (desc->iface_fns); - - if (fn) { - /* - * Get the relocated table address - */ - addr = (ulong) fn + reloc_offset; - fn_r = (Xilinx_Virtex2_Slave_SelectMap_fns *) addr; - - /* - * Check to see if the table has already been relocated. If not, do - * a sanity check to make sure there is a faithful copy of the - * FLASH based function table in RAM, then adjust the table. - */ - if (!fn_r->relocated) { - if (memcmp - (fn_r, fn, sizeof (Xilinx_Virtex2_Slave_SelectMap_fns)) - == 0) { - desc->iface_fns = fn_r; - } else { - PRINTF ("%s:%d: Invalid function table at 0x%p\n", - __FUNCTION__, __LINE__, fn_r); - return FPGA_FAIL; - } - - PRINTF ("%s:%d: Relocating descriptor at 0x%p\n", - __FUNCTION__, __LINE__, desc); - - addr = (ulong) (fn->pre) + reloc_offset; - fn_r->pre = (Xilinx_pre_fn) addr; - addr = (ulong) (fn->pgm) + reloc_offset; - fn_r->pgm = (Xilinx_pgm_fn) addr; - addr = (ulong) (fn->init) + reloc_offset; - fn_r->init = (Xilinx_init_fn) addr; - addr = (ulong) (fn->done) + reloc_offset; - fn_r->done = (Xilinx_done_fn) addr; - addr = (ulong) (fn->err) + reloc_offset; - fn_r->err = (Xilinx_err_fn) addr; - addr = (ulong) (fn->clk) + reloc_offset; - fn_r->clk = (Xilinx_clk_fn) addr; - addr = (ulong) (fn->cs) + reloc_offset; - fn_r->cs = (Xilinx_cs_fn) addr; - addr = (ulong) (fn->wr) + reloc_offset; - fn_r->wr = (Xilinx_wr_fn) addr; - addr = (ulong) (fn->rdata) + reloc_offset; - fn_r->rdata = (Xilinx_rdata_fn) addr; - addr = (ulong) (fn->wdata) + reloc_offset; - fn_r->wdata = (Xilinx_wdata_fn) addr; - addr = (ulong) (fn->busy) + reloc_offset; - fn_r->busy = (Xilinx_busy_fn) addr; - addr = (ulong) (fn->abort) + reloc_offset; - fn_r->abort = (Xilinx_abort_fn) addr; - addr = (ulong) (fn->post) + reloc_offset; - fn_r->post = (Xilinx_post_fn) addr; - fn_r->relocated = TRUE; - } else { - printf ("%s:%d: Function table @0x%p has already been relocated\n", __FUNCTION__, __LINE__, fn_r); - desc->iface_fns = fn_r; - } - ret_val = FPGA_SUCCESS; - } else { - printf ("%s: NULL Interface function table!\n", __FUNCTION__); - } - return ret_val; -} - static int Virtex2_ss_load (Xilinx_desc * desc, void *buf, size_t bsize) { printf ("%s: Slave Serial Loading is unsupported\n", __FUNCTION__); @@ -535,20 +433,4 @@ static int Virtex2_ss_dump (Xilinx_desc * desc, void *buf, size_t bsize) return FPGA_FAIL; } -static int Virtex2_ss_reloc (Xilinx_desc * desc, ulong reloc_offset) -{ - int ret_val = FPGA_FAIL; - Xilinx_Virtex2_Slave_Serial_fns *fn = - (Xilinx_Virtex2_Slave_Serial_fns *) (desc->iface_fns); - - if (fn) { - printf ("%s:%d: Slave Serial Loading is unsupported\n", - __FUNCTION__, __LINE__); - } else { - printf ("%s:%d: NULL Interface function table!\n", - __FUNCTION__, __LINE__); - } - return ret_val; -} - /* vim: set ts=4 tw=78: */ diff --git a/drivers/fpga/xilinx.c b/drivers/fpga/xilinx.c index 7b5e8c5bb..08dfdecde 100644 --- a/drivers/fpga/xilinx.c +++ b/drivers/fpga/xilinx.c @@ -238,48 +238,6 @@ int xilinx_info (Xilinx_desc * desc) return ret_val; } -int xilinx_reloc (Xilinx_desc * desc, ulong reloc_offset) -{ - int ret_val = FPGA_FAIL; /* assume a failure */ - - if (!xilinx_validate (desc, (char *)__FUNCTION__)) { - printf ("%s: Invalid device descriptor\n", __FUNCTION__); - } else - switch (desc->family) { - case Xilinx_Spartan2: -#if defined(CONFIG_FPGA_SPARTAN2) - ret_val = Spartan2_reloc (desc, reloc_offset); -#else - printf ("%s: No support for Spartan-II devices.\n", - __FUNCTION__); -#endif - break; - case Xilinx_Spartan3: -#if defined(CONFIG_FPGA_SPARTAN3) - ret_val = Spartan3_reloc (desc, reloc_offset); -#else - printf ("%s: No support for Spartan-III devices.\n", - __FUNCTION__); -#endif - break; - case Xilinx_Virtex2: -#if defined(CONFIG_FPGA_VIRTEX2) - ret_val = Virtex2_reloc (desc, reloc_offset); -#else - printf ("%s: No support for Virtex-II devices.\n", - __FUNCTION__); -#endif - break; - /* Add new family types here */ - default: - printf ("%s: Unsupported family type, %d\n", - __FUNCTION__, desc->family); - } - - return ret_val; -} - - /* ------------------------------------------------------------------------- */ static int xilinx_validate (Xilinx_desc * desc, char *fn) diff --git a/include/ACEX1K.h b/include/ACEX1K.h index 354e0f0e4..ae201647b 100644 --- a/include/ACEX1K.h +++ b/include/ACEX1K.h @@ -33,12 +33,10 @@ extern int ACEX1K_load( Altera_desc *desc, void *image, size_t size ); extern int ACEX1K_dump( Altera_desc *desc, void *buf, size_t bsize ); extern int ACEX1K_info( Altera_desc *desc ); -extern int ACEX1K_reloc( Altera_desc *desc, ulong reloc_off ); extern int CYC2_load( Altera_desc *desc, void *image, size_t size ); extern int CYC2_dump( Altera_desc *desc, void *buf, size_t bsize ); extern int CYC2_info( Altera_desc *desc ); -extern int CYC2_reloc( Altera_desc *desc, ulong reloc_off ); /* Slave Serial Implementation function table */ typedef struct { @@ -50,7 +48,6 @@ typedef struct { Altera_data_fn data; Altera_abort_fn abort; Altera_post_fn post; - int relocated; } Altera_ACEX1K_Passive_Serial_fns; /* Slave Serial Implementation function table */ @@ -62,7 +59,6 @@ typedef struct { Altera_write_fn write; Altera_abort_fn abort; Altera_post_fn post; - int relocated; } Altera_CYC2_Passive_Serial_fns; /* Device Image Sizes diff --git a/include/altera.h b/include/altera.h index 44a1ee563..bc21ddfff 100644 --- a/include/altera.h +++ b/include/altera.h @@ -79,7 +79,6 @@ typedef struct { /* typedef Altera_desc */ extern int altera_load( Altera_desc *desc, void *image, size_t size ); extern int altera_dump( Altera_desc *desc, void *buf, size_t bsize ); extern int altera_info( Altera_desc *desc ); -extern int altera_reloc( Altera_desc *desc, ulong reloc_offset ); /* Board specific implementation specific function types *********************************************************************/ diff --git a/include/fpga.h b/include/fpga.h index a48b89b3c..84d7b9fc1 100644 --- a/include/fpga.h +++ b/include/fpga.h @@ -71,7 +71,7 @@ typedef struct { /* typedef fpga_desc */ /* root function definitions */ -extern void fpga_init( ulong reloc_off ); +extern void fpga_init( void ); extern int fpga_add( fpga_type devtype, void *desc ); extern int fpga_count( void ); extern int fpga_load( int devnum, void *buf, size_t bsize ); diff --git a/include/spartan2.h b/include/spartan2.h index 7327857c1..8959f90f0 100644 --- a/include/spartan2.h +++ b/include/spartan2.h @@ -30,7 +30,6 @@ extern int Spartan2_load( Xilinx_desc *desc, void *image, size_t size ); extern int Spartan2_dump( Xilinx_desc *desc, void *buf, size_t bsize ); extern int Spartan2_info( Xilinx_desc *desc ); -extern int Spartan2_reloc( Xilinx_desc *desc, ulong reloc_off ); /* Slave Parallel Implementation function table */ typedef struct { @@ -47,7 +46,6 @@ typedef struct { Xilinx_busy_fn busy; Xilinx_abort_fn abort; Xilinx_post_fn post; - int relocated; } Xilinx_Spartan2_Slave_Parallel_fns; /* Slave Serial Implementation function table */ @@ -59,7 +57,6 @@ typedef struct { Xilinx_done_fn done; Xilinx_wr_fn wr; Xilinx_post_fn post; - int relocated; } Xilinx_Spartan2_Slave_Serial_fns; /* Device Image Sizes diff --git a/include/spartan3.h b/include/spartan3.h index b0fa1cdae..30b1c2d62 100644 --- a/include/spartan3.h +++ b/include/spartan3.h @@ -30,7 +30,6 @@ extern int Spartan3_load( Xilinx_desc *desc, void *image, size_t size ); extern int Spartan3_dump( Xilinx_desc *desc, void *buf, size_t bsize ); extern int Spartan3_info( Xilinx_desc *desc ); -extern int Spartan3_reloc( Xilinx_desc *desc, ulong reloc_off ); /* Slave Parallel Implementation function table */ typedef struct { @@ -47,7 +46,6 @@ typedef struct { Xilinx_busy_fn busy; Xilinx_abort_fn abort; Xilinx_post_fn post; - int relocated; } Xilinx_Spartan3_Slave_Parallel_fns; /* Slave Serial Implementation function table */ @@ -59,7 +57,6 @@ typedef struct { Xilinx_done_fn done; Xilinx_wr_fn wr; Xilinx_post_fn post; - int relocated; } Xilinx_Spartan3_Slave_Serial_fns; /* Device Image Sizes diff --git a/include/stratixII.h b/include/stratixII.h index 37abd9fa4..b8e84573c 100644 --- a/include/stratixII.h +++ b/include/stratixII.h @@ -27,6 +27,5 @@ extern int StratixII_load (Altera_desc * desc, void *image, size_t size); extern int StratixII_dump (Altera_desc * desc, void *buf, size_t bsize); extern int StratixII_info (Altera_desc * desc); -extern int StratixII_reloc (Altera_desc * desc, ulong reloc_off); #endif /* _STRATIXII_H_ */ diff --git a/include/virtex2.h b/include/virtex2.h index d1166479c..89d7d7687 100644 --- a/include/virtex2.h +++ b/include/virtex2.h @@ -31,7 +31,6 @@ extern int Virtex2_load( Xilinx_desc *desc, void *image, size_t size ); extern int Virtex2_dump( Xilinx_desc *desc, void *buf, size_t bsize ); extern int Virtex2_info( Xilinx_desc *desc ); -extern int Virtex2_reloc( Xilinx_desc *desc, ulong reloc_off ); /* * Slave SelectMap Implementation function table. @@ -50,7 +49,6 @@ typedef struct { Xilinx_busy_fn busy; Xilinx_abort_fn abort; Xilinx_post_fn post; - int relocated; } Xilinx_Virtex2_Slave_SelectMap_fns; /* Slave Serial Implementation function table */ @@ -59,7 +57,6 @@ typedef struct { Xilinx_clk_fn clk; Xilinx_rdata_fn rdata; Xilinx_wdata_fn wdata; - int relocated; } Xilinx_Virtex2_Slave_Serial_fns; /* Device Image Sizes (in bytes) diff --git a/include/xilinx.h b/include/xilinx.h index fdc358725..d0799bc57 100644 --- a/include/xilinx.h +++ b/include/xilinx.h @@ -84,7 +84,6 @@ typedef struct { /* typedef Xilinx_desc */ extern int xilinx_load( Xilinx_desc *desc, void *image, size_t size ); extern int xilinx_dump( Xilinx_desc *desc, void *buf, size_t bsize ); extern int xilinx_info( Xilinx_desc *desc ); -extern int xilinx_reloc( Xilinx_desc *desc, ulong reloc_offset ); /* Board specific implementation specific function types *********************************************************************/ -- cgit v1.2.3 From 521af04d853361b49344b61892eb0618f9f713c5 Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Mon, 21 Sep 2009 11:20:36 -0500 Subject: Conditionally perform common relocation fixups Add #ifdefs where necessary to not perform relocation fixups. This allows boards/architectures which support relocation to trim a decent chunk of code. Note that this patch doesn't add #ifdefs to architecture-specific code which does not support relocation. Signed-off-by: Peter Tyser --- common/cmd_bootm.c | 4 +++- common/cmd_date.c | 4 ++++ common/dlmalloc.c | 2 ++ common/env_common.c | 4 ++++ common/hush.c | 4 ++++ common/image.c | 6 +++++- common/serial.c | 2 ++ common/stdio.c | 5 +++-- disk/part.c | 5 ++++- drivers/mtd/nand/nand.c | 2 ++ fs/ubifs/ubifs.c | 4 ++++ include/post.h | 2 ++ post/post.c | 2 ++ 13 files changed, 41 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 365ceebdf..8f8359856 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -561,7 +561,6 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /*******************************************************************/ /* bootm - boot application image from image in memory */ /*******************************************************************/ -static int relocated = 0; int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { @@ -569,6 +568,8 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) ulong load_end = 0; int ret; boot_os_fn *boot_fn; +#ifndef CONFIG_RELOC_FIXUP_WORKS + static int relocated = 0; /* relocate boot function table */ if (!relocated) { @@ -578,6 +579,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) boot_os[i] += gd->reloc_off; relocated = 1; } +#endif /* determine if we have a sub command */ if (argc > 1) { diff --git a/common/cmd_date.c b/common/cmd_date.c index b69e93508..9f50f8956 100644 --- a/common/cmd_date.c +++ b/common/cmd_date.c @@ -35,7 +35,11 @@ const char *weekdays[] = { "Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur", }; +#ifdef CONFIG_RELOC_FIXUP_WORKS +#define RELOC(a) a +#else #define RELOC(a) ((typeof(a))((unsigned long)(a) + gd->reloc_off)) +#endif int mk_date (char *, struct rtc_time *); diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 241db8cd3..ca088a17d 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -1494,6 +1494,7 @@ static mbinptr av_[NAV * 2 + 2] = { IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127) }; +#ifndef CONFIG_RELOC_FIXUP_WORKS void malloc_bin_reloc (void) { unsigned long *p = (unsigned long *)(&av_[2]); @@ -1502,6 +1503,7 @@ void malloc_bin_reloc (void) *p++ += gd->reloc_off; } } +#endif ulong mem_malloc_start = 0; ulong mem_malloc_end = 0; diff --git a/common/env_common.c b/common/env_common.c index be64d1307..439a4a905 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -224,8 +224,10 @@ void set_default_env(void) void env_relocate (void) { +#ifndef CONFIG_RELOC_FIXUP_WORKS DEBUGF ("%s[%d] offset = 0x%lx\n", __FUNCTION__,__LINE__, gd->reloc_off); +#endif #ifdef CONFIG_AMIGAONEG3SE enable_nvram(); @@ -236,7 +238,9 @@ void env_relocate (void) * The environment buffer is embedded with the text segment, * just relocate the environment pointer */ +#ifndef CONFIG_RELOC_FIXUP_WORKS env_ptr = (env_t *)((ulong)env_ptr + gd->reloc_off); +#endif DEBUGF ("%s[%d] embedded ENV at %p\n", __FUNCTION__,__LINE__,env_ptr); #else /* diff --git a/common/hush.c b/common/hush.c index 528dd254a..06c5ff8df 100644 --- a/common/hush.c +++ b/common/hush.c @@ -3270,6 +3270,7 @@ int parse_file_outer(void) } #ifdef __U_BOOT__ +#ifndef CONFIG_RELOC_FIXUP_WORKS static void u_boot_hush_reloc(void) { unsigned long addr; @@ -3280,6 +3281,7 @@ static void u_boot_hush_reloc(void) r->literal = (char *)addr; } } +#endif int u_boot_hush_start(void) { @@ -3290,7 +3292,9 @@ int u_boot_hush_start(void) top_vars->next = 0; top_vars->flg_export = 0; top_vars->flg_read_only = 1; +#ifndef CONFIG_RELOC_FIXUP_WORKS u_boot_hush_reloc(); +#endif } return 0; } diff --git a/common/image.c b/common/image.c index d0f169d66..6eaf41eb1 100644 --- a/common/image.c +++ b/common/image.c @@ -513,7 +513,7 @@ char *get_table_entry_name (table_entry_t *table, char *msg, int id) { for (; table->id >= 0; ++table) { if (table->id == id) -#ifdef USE_HOSTCC +#if defined(USE_HOSTCC) || defined(CONFIG_RELOC_FIXUP_WORKS) return table->lname; #else return table->lname + gd->reloc_off; @@ -578,7 +578,11 @@ int get_table_entry_id (table_entry_t *table, fprintf (stderr, "\n"); #else for (t = table; t->id >= 0; ++t) { +#ifdef CONFIG_RELOC_FIXUP_WORKS + if (t->sname && strcmp(t->sname, name) == 0) +#else if (t->sname && strcmp(t->sname + gd->reloc_off, name) == 0) +#endif return (t->id); } debug ("Invalid %s Type: %s\n", table_name, name); diff --git a/common/serial.c b/common/serial.c index 41a24c2fa..b4db46b16 100644 --- a/common/serial.c +++ b/common/serial.c @@ -81,12 +81,14 @@ struct serial_device *default_serial_console(void) __attribute__((weak, alias("_ int serial_register (struct serial_device *dev) { +#ifndef CONFIG_RELOC_FIXUP_WORKS dev->init += gd->reloc_off; dev->setbrg += gd->reloc_off; dev->getc += gd->reloc_off; dev->tstc += gd->reloc_off; dev->putc += gd->reloc_off; dev->puts += gd->reloc_off; +#endif dev->next = serial_devices; serial_devices = dev; diff --git a/common/stdio.c b/common/stdio.c index 697df5a49..5e58dbe44 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -201,7 +201,8 @@ int stdio_deregister(char *devname) int stdio_init (void) { -#ifndef CONFIG_ARM /* already relocated for current ARM implementation */ +#if !defined(CONFIG_ARM) && !defined(CONFIG_RELOC_FIXUP_WORKS) + /* already relocated for current ARM implementation */ ulong relocation_offset = gd->reloc_off; int i; @@ -210,7 +211,7 @@ int stdio_init (void) stdio_names[i] = (char *) (((ulong) stdio_names[i]) + relocation_offset); } -#endif +#endif /* !ARM && !CONFIG_RELOC_FIXUP_WORKS */ /* Initialize the list */ INIT_LIST_HEAD(&(devs.list)); diff --git a/disk/part.c b/disk/part.c index b92fb45b8..9ced4527f 100644 --- a/disk/part.c +++ b/disk/part.c @@ -80,7 +80,10 @@ block_dev_desc_t *get_dev(char* ifname, int dev) block_dev_desc_t* (*reloc_get_dev)(int dev); while (drvr->name) { - reloc_get_dev = drvr->get_dev + gd->reloc_off; + reloc_get_dev = drvr->get_dev; +#ifndef CONFIG_RELOC_FIXUP_WORKS + reloc_get_dev += gd->reloc_off; +#endif if (strncmp(ifname, drvr->name, strlen(drvr->name)) == 0) return reloc_get_dev(dev); drvr++; diff --git a/drivers/mtd/nand/nand.c b/drivers/mtd/nand/nand.c index 9065fa91c..47d6872fd 100644 --- a/drivers/mtd/nand/nand.c +++ b/drivers/mtd/nand/nand.c @@ -54,8 +54,10 @@ static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand, if (nand_scan(mtd, maxchips) == 0) { if (!mtd->name) mtd->name = (char *)default_nand_name; +#ifndef CONFIG_RELOC_FIXUP_WORKS else mtd->name += gd->reloc_off; +#endif #ifdef CONFIG_MTD_DEVICE /* diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index 286739c36..82f1c547d 100644 --- a/fs/ubifs/ubifs.c +++ b/fs/ubifs/ubifs.c @@ -124,9 +124,13 @@ int ubifs_decompress(const void *in_buf, int in_len, void *out_buf, static int __init compr_init(struct ubifs_compressor *compr) { ubifs_compressors[compr->compr_type] = compr; + +#ifndef CONFIG_RELOC_FIXUP_WORKS ubifs_compressors[compr->compr_type]->name += gd->reloc_off; ubifs_compressors[compr->compr_type]->capi_name += gd->reloc_off; ubifs_compressors[compr->compr_type]->decompress += gd->reloc_off; +#endif + return 0; } diff --git a/include/post.h b/include/post.h index fe96312cb..9fcd3cec2 100644 --- a/include/post.h +++ b/include/post.h @@ -73,7 +73,9 @@ void post_output_backlog ( void ); int post_run (char *name, int flags); int post_info (char *name); int post_log (char *format, ...); +#ifndef CONFIG_RELOC_FIXUP_WORKS void post_reloc (void); +#endif unsigned long post_time_ms (unsigned long base); extern struct post_test post_list[]; diff --git a/post/post.c b/post/post.c index bc8114e51..b74e76231 100644 --- a/post/post.c +++ b/post/post.c @@ -393,6 +393,7 @@ int post_log (char *format, ...) return 0; } +#ifndef CONFIG_RELOC_FIXUP_WORKS void post_reloc (void) { unsigned int i; @@ -437,6 +438,7 @@ void post_reloc (void) } } } +#endif /* -- cgit v1.2.3