Merge branch '2023-09-14-remove-NEEDS_MANUAL_RELOC' into next

To quote the author:

The last user of the NEEDS_MANUAL_RELOC has been removed in commit
26af162ac8f8 ("arch: m68k: Implement relocation")
Remove now unused NEEDS_MANUAL_RELOC code.

This is a follow up on way over decade old commit
2e5167ccad93 ("Replace CONFIG_RELOC_FIXUP_WORKS by CONFIG_NEEDS_MANUAL_RELOC")
"
By now, the majority of architectures have working relocation
support, so the few remaining architectures have become exceptions.
To make this more obvious, we make working relocation now the default
case, and flag the remaining cases with CONFIG_NEEDS_MANUAL_RELOC.
"
It took a bit longer than expected, but now we can really sunset
CONFIG_NEEDS_MANUAL_RELOC.

Make it so.
This commit is contained in:
Tom Rini 2023-09-14 16:23:49 -04:00
commit 2fe4b54556
50 changed files with 8 additions and 869 deletions

View File

@ -609,19 +609,5 @@ int boot_selected_os(int argc, char *const argv[], int state,
boot_os_fn *bootm_os_get_boot_func(int os)
{
#ifdef CONFIG_NEEDS_MANUAL_RELOC
static bool relocated;
if (!relocated) {
int i;
/* relocate boot function table */
for (i = 0; i < ARRAY_SIZE(boot_os); i++)
if (boot_os[i] != NULL)
boot_os[i] += gd->reloc_off;
relocated = true;
}
#endif
return boot_os[os];
}

View File

@ -57,20 +57,6 @@ struct checksum_algo *image_get_checksum_algo(const char *full_name)
int i;
const char *name;
if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) {
static bool done;
if (!done) {
done = true;
for (i = 0; i < ARRAY_SIZE(checksum_algos); i++) {
struct checksum_algo *algo = &checksum_algos[i];
MANUAL_RELOC(algo->name);
MANUAL_RELOC(algo->calculate);
}
}
}
for (i = 0; i < ARRAY_SIZE(checksum_algos); i++) {
name = checksum_algos[i].name;
/* Make sure names match and next char is a comma */
@ -87,20 +73,6 @@ struct crypto_algo *image_get_crypto_algo(const char *full_name)
struct crypto_algo *crypto, *end;
const char *name;
if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) {
static bool done;
if (!done) {
done = true;
crypto = ll_entry_start(struct crypto_algo, cryptos);
end = ll_entry_end(struct crypto_algo, cryptos);
for (; crypto < end; crypto++) {
MANUAL_RELOC(crypto->name);
MANUAL_RELOC(crypto->verify);
}
}
}
/* Move name to after the comma */
name = strchr(full_name, ',');
if (!name)

View File

@ -571,7 +571,7 @@ const char *genimg_get_cat_name(enum ih_category category, uint id)
entry = get_table_entry(table_info[category].table, id);
if (!entry)
return unknown_msg(category);
return manual_reloc(entry->lname);
return entry->lname;
}
/**
@ -591,7 +591,7 @@ const char *genimg_get_cat_short_name(enum ih_category category, uint id)
entry = get_table_entry(table_info[category].table, id);
if (!entry)
return unknown_msg(category);
return manual_reloc(entry->sname);
return entry->sname;
}
int genimg_get_cat_count(enum ih_category category)
@ -641,7 +641,7 @@ char *get_table_entry_name(const table_entry_t *table, char *msg, int id)
table = get_table_entry(table, id);
if (!table)
return msg;
return manual_reloc(table->lname);
return table->lname;
}
const char *genimg_get_os_name(uint8_t os)
@ -676,7 +676,7 @@ static const char *genimg_get_short_name(const table_entry_t *table, int val)
table = get_table_entry(table, val);
if (!table)
return "unknown";
return manual_reloc(table->sname);
return table->sname;
}
const char *genimg_get_type_short_name(uint8_t type)
@ -719,7 +719,7 @@ int get_table_entry_id(const table_entry_t *table,
const table_entry_t *t;
for (t = table; t->id >= 0; ++t) {
if (t->sname && !strcasecmp(manual_reloc(t->sname), name))
if (t->sname && !strcasecmp(t->sname, name))
return t->id;
}
debug("Invalid %s Type: %s\n", table_name, name);

View File

@ -46,24 +46,11 @@ static struct cmd_tbl cmd_blkc_sub[] = {
U_BOOT_CMD_MKENT(configure, 3, 0, blkc_configure, "", ""),
};
static __maybe_unused void blkc_reloc(void)
{
static int relocated;
if (!relocated) {
fixup_cmdtable(cmd_blkc_sub, ARRAY_SIZE(cmd_blkc_sub));
relocated = 1;
};
}
static int do_blkcache(struct cmd_tbl *cmdtp, int flag,
int argc, char *const argv[])
{
struct cmd_tbl *c;
#ifdef CONFIG_NEEDS_MANUAL_RELOC
blkc_reloc();
#endif
if (argc < 2)
return CMD_RET_USAGE;

View File

@ -123,20 +123,6 @@ int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
int states;
int ret;
#ifdef CONFIG_NEEDS_MANUAL_RELOC
static int relocated = 0;
if (!relocated) {
int i;
/* relocate names of sub-command table */
for (i = 0; i < ARRAY_SIZE(cmd_bootm_sub); i++)
cmd_bootm_sub[i].name += gd->reloc_off;
relocated = 1;
}
#endif
/* determine if we have a sub command */
argc--; argv++;
if (argc > 0) {

View File

@ -20,12 +20,6 @@ static const char * const weekdays[] = {
"Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur",
};
#ifdef CONFIG_NEEDS_MANUAL_RELOC
#define RELOC(a) ((typeof(a))((unsigned long)(a) + gd->reloc_off))
#else
#define RELOC(a) a
#endif
int mk_date (const char *, struct rtc_time *);
static struct rtc_time default_tm = { 0, 0, 0, 1, 1, 2000, 6, 0, 0 };
@ -113,7 +107,7 @@ static int do_date(struct cmd_tbl *cmdtp, int flag, int argc,
printf ("Date: %4d-%02d-%02d (%sday) Time: %2d:%02d:%02d\n",
tm.tm_year, tm.tm_mon, tm.tm_mday,
(tm.tm_wday<0 || tm.tm_wday>6) ?
"unknown " : RELOC(weekdays[tm.tm_wday]),
"unknown " : weekdays[tm.tm_wday],
tm.tm_hour, tm.tm_min, tm.tm_sec);
break;

View File

@ -1939,16 +1939,6 @@ static struct cmd_tbl cmd_i2c_sub[] = {
U_BOOT_CMD_MKENT(speed, 1, 1, do_i2c_bus_speed, "", ""),
};
static __maybe_unused void i2c_reloc(void)
{
static int relocated;
if (!relocated) {
fixup_cmdtable(cmd_i2c_sub, ARRAY_SIZE(cmd_i2c_sub));
relocated = 1;
};
}
/**
* do_i2c() - Handle the "i2c" command-line command
* @cmdtp: Command data struct pointer
@ -1963,10 +1953,6 @@ static int do_i2c(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
struct cmd_tbl *c;
#ifdef CONFIG_NEEDS_MANUAL_RELOC
i2c_reloc();
#endif
if (argc < 2)
return CMD_RET_USAGE;

View File

@ -407,11 +407,7 @@ static int print_active_callback(struct env_entry *entry)
for (i = 0, clbkp = ll_entry_start(struct env_clbk_tbl, env_clbk);
i < num_callbacks;
i++, clbkp++) {
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
if (entry->callback == clbkp->callback + gd->reloc_off)
#else
if (entry->callback == clbkp->callback)
#endif
break;
}
@ -1222,13 +1218,6 @@ static struct cmd_tbl cmd_env_sub[] = {
#endif
};
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
void env_reloc(void)
{
fixup_cmdtable(cmd_env_sub, ARRAY_SIZE(cmd_env_sub));
}
#endif
static int do_env(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
struct cmd_tbl *cp;

View File

@ -560,12 +560,6 @@ static struct cmd_tbl cmd_onenand_sub[] = {
U_BOOT_CMD_MKENT(markbad, CONFIG_SYS_MAXARGS, 0, do_onenand_markbad, "", ""),
};
#ifdef CONFIG_NEEDS_MANUAL_RELOC
void onenand_reloc(void) {
fixup_cmdtable(cmd_onenand_sub, ARRAY_SIZE(cmd_onenand_sub));
}
#endif
static int do_onenand(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{

View File

@ -299,24 +299,10 @@ static struct cmd_tbl cmd_pxe_sub[] = {
U_BOOT_CMD_MKENT(boot, 3, 1, do_pxe_boot, "", "")
};
static void __maybe_unused pxe_reloc(void)
{
static int relocated_pxe;
if (!relocated_pxe) {
fixup_cmdtable(cmd_pxe_sub, ARRAY_SIZE(cmd_pxe_sub));
relocated_pxe = 1;
}
}
static int do_pxe(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
struct cmd_tbl *cp;
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
pxe_reloc();
#endif
if (argc < 2)
return CMD_RET_USAGE;

View File

@ -81,13 +81,6 @@ struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
return bmp;
}
#ifdef CONFIG_NEEDS_MANUAL_RELOC
void bmp_reloc(void)
{
fixup_cmdtable(cmd_bmp_sub, ARRAY_SIZE(cmd_bmp_sub));
}
#endif
int bmp_info(ulong addr)
{
struct bmp_image *bmp = (struct bmp_image *)map_sysmem(addr, 0);

View File

@ -151,13 +151,6 @@ static int initr_reloc_global_data(void)
*/
gd->env_addr += gd->reloc_off;
#endif
/*
* The fdt_blob needs to be moved to new relocation address
* incase of FDT blob is embedded with in image
*/
if (IS_ENABLED(CONFIG_OF_EMBED) && IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC))
gd->fdt_blob += gd->reloc_off;
#ifdef CONFIG_EFI_LOADER
/*
* On the ARM architecture gd is mapped to a fixed register (r9 or x18).
@ -295,15 +288,6 @@ static int initr_announce(void)
return 0;
}
#ifdef CONFIG_NEEDS_MANUAL_RELOC
static int initr_manual_reloc_cmdtable(void)
{
fixup_cmdtable(ll_entry_start(struct cmd_tbl, cmd),
ll_entry_count(struct cmd_tbl, cmd));
return 0;
}
#endif
static int initr_binman(void)
{
int ret;
@ -606,9 +590,6 @@ static init_fnc_t init_sequence_r[] = {
*/
#endif
initr_reloc_global_data,
#if IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC) && CONFIG_IS_ENABLED(EVENT)
event_manual_reloc,
#endif
#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
initr_unlock_ram_in_cache,
#endif
@ -657,12 +638,6 @@ static init_fnc_t init_sequence_r[] = {
initr_watchdog,
#endif
INIT_FUNC_WATCHDOG_RESET
#if defined(CONFIG_NEEDS_MANUAL_RELOC) && defined(CONFIG_BLOCK_CACHE)
blkcache_init,
#endif
#ifdef CONFIG_NEEDS_MANUAL_RELOC
initr_manual_reloc_cmdtable,
#endif
arch_initr_trap,
#if defined(CONFIG_BOARD_EARLY_INIT_R)
board_early_init_r,
@ -806,9 +781,6 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
#endif
gd->flags &= ~GD_FLG_LOG_READY;
if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC))
initcall_manual_reloc(init_sequence_r);
if (initcall_run_list(init_sequence_r))
hang();

View File

@ -3305,19 +3305,6 @@ int parse_file_outer(void)
}
#ifdef __U_BOOT__
#ifdef CONFIG_NEEDS_MANUAL_RELOC
static void u_boot_hush_reloc(void)
{
unsigned long addr;
struct reserved_combo *r;
for (r=reserved_list; r<reserved_list+NRES; r++) {
addr = (ulong) (r->literal) + gd->reloc_off;
r->literal = (char *)addr;
}
}
#endif
int u_boot_hush_start(void)
{
if (top_vars == NULL) {
@ -3327,9 +3314,6 @@ int u_boot_hush_start(void)
top_vars->next = NULL;
top_vars->flg_export = 0;
top_vars->flg_read_only = 1;
#ifdef CONFIG_NEEDS_MANUAL_RELOC
u_boot_hush_reloc();
#endif
}
return 0;
}

View File

@ -575,19 +575,6 @@ static mbinptr av_[NAV * 2 + 2] = {
IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127)
};
#ifdef CONFIG_NEEDS_MANUAL_RELOC
static void malloc_bin_reloc(void)
{
mbinptr *p = &av_[2];
size_t i;
for (i = 2; i < ARRAY_SIZE(av_); ++i, ++p)
*p = (mbinptr)((ulong)*p + gd->reloc_off);
}
#else
static inline void malloc_bin_reloc(void) {}
#endif
#ifdef CONFIG_SYS_MALLOC_DEFAULT_TO_INIT
static void malloc_init(void);
#endif
@ -634,7 +621,6 @@ void mem_malloc_init(ulong start, ulong size)
#ifdef CONFIG_SYS_MALLOC_CLEAR_ON_INIT
memset((void *)mem_malloc_start, 0x0, size);
#endif
malloc_bin_reloc();
}
/* field-extraction macros */

View File

@ -168,20 +168,6 @@ void event_show_spy_list(void)
}
}
#if IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)
int event_manual_reloc(void)
{
struct evspy_info *spy, *end;
spy = ll_entry_start(struct evspy_info, evspy_info);
end = ll_entry_end(struct evspy_info, evspy_info);
for (; spy < end; spy++)
MANUAL_RELOC(spy->func);
return 0;
}
#endif
#if CONFIG_IS_ENABLED(EVENT_DYNAMIC)
static void spy_free(struct event_spy *spy)
{

View File

@ -36,12 +36,6 @@
#include <u-boot/sha512.h>
#include <u-boot/md5.h>
#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC)
DECLARE_GLOBAL_DATA_PTR;
#endif
static void reloc_update(void);
static int __maybe_unused hash_init_sha1(struct hash_algo *algo, void **ctxp)
{
sha1_context *ctx = malloc(sizeof(sha1_context));
@ -333,31 +327,10 @@ static struct hash_algo hash_algo[] = {
#define multi_hash() 0
#endif
static void reloc_update(void)
{
#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC)
int i;
static bool done;
if (!done) {
done = true;
for (i = 0; i < ARRAY_SIZE(hash_algo); i++) {
hash_algo[i].name += gd->reloc_off;
hash_algo[i].hash_func_ws += gd->reloc_off;
hash_algo[i].hash_init += gd->reloc_off;
hash_algo[i].hash_update += gd->reloc_off;
hash_algo[i].hash_finish += gd->reloc_off;
}
}
#endif
}
int hash_lookup_algo(const char *algo_name, struct hash_algo **algop)
{
int i;
reloc_update();
for (i = 0; i < ARRAY_SIZE(hash_algo); i++) {
if (!strcmp(algo_name, hash_algo[i].name)) {
*algop = &hash_algo[i];
@ -374,8 +347,6 @@ int hash_progressive_lookup_algo(const char *algo_name,
{
int i;
reloc_update();
for (i = 0; i < ARRAY_SIZE(hash_algo); i++) {
if (!strcmp(algo_name, hash_algo[i].name)) {
if (hash_algo[i].hash_init) {

View File

@ -293,18 +293,6 @@ int stdio_deregister_dev(struct stdio_dev *dev, int force)
int stdio_init_tables(void)
{
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
/* already relocated for current ARM implementation */
ulong relocation_offset = gd->reloc_off;
int i;
/* relocate device name pointers */
for (i = 0; i < (sizeof (stdio_names) / sizeof (char *)); ++i) {
stdio_names[i] = (char *) (((ulong) stdio_names[i]) +
relocation_offset);
}
#endif /* CONFIG_NEEDS_MANUAL_RELOC */
/* Initialize the list */
INIT_LIST_HEAD(&devs.list);

View File

@ -138,11 +138,6 @@ The POST layer will export the following interface routines:
mode the test is executed in (power-on, normal, power-fail,
manual).
o) void post_reloc(ulong offset);
This routine will be called from board_init_r() and will
relocate the POST test table.
o) int post_info(char *name);
This routine will print the list of all POST tests that can be

View File

@ -13,10 +13,6 @@
#include <linux/ctype.h>
#include <linux/list.h>
#ifdef CONFIG_NEEDS_MANUAL_RELOC
DECLARE_GLOBAL_DATA_PTR;
#endif
struct block_cache_node {
struct list_head lh;
int iftype;
@ -34,18 +30,6 @@ static struct block_cache_stats _stats = {
.max_entries = 32
};
#ifdef CONFIG_NEEDS_MANUAL_RELOC
int blkcache_init(void)
{
struct list_head *head = &block_cache;
head->next = (uintptr_t)head->next + gd->reloc_off;
head->prev = (uintptr_t)head->prev + gd->reloc_off;
return 0;
}
#endif
static struct block_cache_node *cache_find(int iftype, int devnum,
lbaint_t start, lbaint_t blkcnt,
unsigned long blksz)

View File

@ -55,81 +55,6 @@ void dm_fixup_for_gd_move(struct global_data *new_gd)
}
}
void fix_drivers(void)
{
struct driver *drv =
ll_entry_start(struct driver, driver);
const int n_ents = ll_entry_count(struct driver, driver);
struct driver *entry;
for (entry = drv; entry != drv + n_ents; entry++) {
if (entry->of_match)
entry->of_match = (const struct udevice_id *)
((ulong)entry->of_match + gd->reloc_off);
if (entry->bind)
entry->bind += gd->reloc_off;
if (entry->probe)
entry->probe += gd->reloc_off;
if (entry->remove)
entry->remove += gd->reloc_off;
if (entry->unbind)
entry->unbind += gd->reloc_off;
if (entry->of_to_plat)
entry->of_to_plat += gd->reloc_off;
if (entry->child_post_bind)
entry->child_post_bind += gd->reloc_off;
if (entry->child_pre_probe)
entry->child_pre_probe += gd->reloc_off;
if (entry->child_post_remove)
entry->child_post_remove += gd->reloc_off;
/* OPS are fixed in every uclass post_probe function */
if (entry->ops)
entry->ops += gd->reloc_off;
}
}
void fix_uclass(void)
{
struct uclass_driver *uclass =
ll_entry_start(struct uclass_driver, uclass_driver);
const int n_ents = ll_entry_count(struct uclass_driver, uclass_driver);
struct uclass_driver *entry;
for (entry = uclass; entry != uclass + n_ents; entry++) {
if (entry->post_bind)
entry->post_bind += gd->reloc_off;
if (entry->pre_unbind)
entry->pre_unbind += gd->reloc_off;
if (entry->pre_probe)
entry->pre_probe += gd->reloc_off;
if (entry->post_probe)
entry->post_probe += gd->reloc_off;
if (entry->pre_remove)
entry->pre_remove += gd->reloc_off;
if (entry->child_post_bind)
entry->child_post_bind += gd->reloc_off;
if (entry->child_pre_probe)
entry->child_pre_probe += gd->reloc_off;
if (entry->init)
entry->init += gd->reloc_off;
if (entry->destroy)
entry->destroy += gd->reloc_off;
}
}
void fix_devices(void)
{
struct driver_info *dev =
ll_entry_start(struct driver_info, driver_info);
const int n_ents = ll_entry_count(struct driver_info, driver_info);
struct driver_info *entry;
for (entry = dev; entry != dev + n_ents; entry++) {
if (entry->plat)
entry->plat += gd->reloc_off;
}
}
static int dm_setup_inst(void)
{
DM_ROOT_NON_CONST = DM_DEVICE_GET(root);
@ -181,12 +106,6 @@ int dm_init(bool of_live)
INIT_LIST_HEAD(DM_UCLASS_ROOT_NON_CONST);
}
if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) {
fix_drivers();
fix_uclass();
fix_devices();
}
if (CONFIG_IS_ENABLED(OF_PLATDATA_INST)) {
ret = dm_setup_inst();
if (ret) {

View File

@ -127,36 +127,9 @@ static int uclass_cpu_init(struct uclass *uc)
return ret;
}
static int uclass_cpu_post_bind(struct udevice *dev)
{
if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC) &&
(gd->flags & GD_FLG_RELOC)) {
struct cpu_ops *ops = cpu_get_ops(dev);
static int reloc_done;
if (!reloc_done) {
if (ops->get_desc)
MANUAL_RELOC(ops->get_desc);
if (ops->get_info)
MANUAL_RELOC(ops->get_info);
if (ops->get_count)
MANUAL_RELOC(ops->get_count);
if (ops->get_vendor)
MANUAL_RELOC(ops->get_vendor);
if (ops->is_current)
MANUAL_RELOC(ops->is_current);
reloc_done++;
}
}
return 0;
}
UCLASS_DRIVER(cpu) = {
.id = UCLASS_CPU,
.name = "cpu",
.flags = DM_UC_FLAG_SEQ_ALIAS,
.init = uclass_cpu_init,
.post_bind = uclass_cpu_post_bind,
};

View File

@ -16,24 +16,11 @@
#include <asm/io.h>
#include <linux/list.h>
#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC)
DECLARE_GLOBAL_DATA_PTR;
#endif
int rsa_mod_exp(struct udevice *dev, const uint8_t *sig, uint32_t sig_len,
struct key_prop *node, uint8_t *out)
{
struct mod_exp_ops *ops = (struct mod_exp_ops *)device_get_ops(dev);
#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC)
static bool done;
if (!done) {
done = true;
ops->mod_exp += gd->reloc_off;
}
#endif
if (!ops->mod_exp)
return -ENOSYS;

View File

@ -1498,36 +1498,6 @@ void devm_gpiod_put(struct udevice *dev, struct gpio_desc *desc)
static int gpio_post_bind(struct udevice *dev)
{
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
struct dm_gpio_ops *ops = (struct dm_gpio_ops *)device_get_ops(dev);
static int reloc_done;
if (!reloc_done) {
if (ops->request)
ops->request += gd->reloc_off;
if (ops->rfree)
ops->rfree += gd->reloc_off;
if (ops->direction_input)
ops->direction_input += gd->reloc_off;
if (ops->direction_output)
ops->direction_output += gd->reloc_off;
if (ops->get_value)
ops->get_value += gd->reloc_off;
if (ops->set_value)
ops->set_value += gd->reloc_off;
if (ops->get_function)
ops->get_function += gd->reloc_off;
if (ops->xlate)
ops->xlate += gd->reloc_off;
if (ops->set_flags)
ops->set_flags += gd->reloc_off;
if (ops->get_flags)
ops->get_flags += gd->reloc_off;
reloc_done++;
}
#endif
if (CONFIG_IS_ENABLED(GPIO_HOG) && dev_has_ofnode(dev)) {
struct udevice *child;
ofnode node;

View File

@ -123,28 +123,7 @@ int hwspinlock_unlock(struct hwspinlock *hws)
return ops->unlock(hws->dev, hws->id);
}
static int hwspinlock_post_bind(struct udevice *dev)
{
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
struct hwspinlock_ops *ops = device_get_ops(dev);
static int reloc_done;
if (!reloc_done) {
if (ops->lock)
ops->lock += gd->reloc_off;
if (ops->unlock)
ops->unlock += gd->reloc_off;
if (ops->relax)
ops->relax += gd->reloc_off;
reloc_done++;
}
#endif
return 0;
}
UCLASS_DRIVER(hwspinlock) = {
.id = UCLASS_HWSPINLOCK,
.name = "hwspinlock",
.post_bind = hwspinlock_post_bind,
};

View File

@ -96,22 +96,6 @@ static int spi_flash_post_bind(struct udevice *dev)
return log_msg_ret("bd", ret);
}
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
struct dm_spi_flash_ops *ops = sf_get_ops(dev);
static int reloc_done;
if (!reloc_done) {
if (ops->read)
ops->read += gd->reloc_off;
if (ops->write)
ops->write += gd->reloc_off;
if (ops->erase)
ops->erase += gd->reloc_off;
reloc_done++;
}
#endif
return 0;
}

View File

@ -18,10 +18,6 @@
#include <miiphy.h>
#include <asm/global_data.h>
#define BB_MII_RELOCATE(v,off) (v += (v?off:0))
DECLARE_GLOBAL_DATA_PTR;
#ifndef CONFIG_BITBANGMII_MULTI
/*
@ -110,21 +106,9 @@ int bb_miiphy_init(void)
{
int i;
for (i = 0; i < bb_miiphy_buses_num; i++) {
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
/* Relocate the hook pointers*/
BB_MII_RELOCATE(bb_miiphy_buses[i].init, gd->reloc_off);
BB_MII_RELOCATE(bb_miiphy_buses[i].mdio_active, gd->reloc_off);
BB_MII_RELOCATE(bb_miiphy_buses[i].mdio_tristate, gd->reloc_off);
BB_MII_RELOCATE(bb_miiphy_buses[i].set_mdio, gd->reloc_off);
BB_MII_RELOCATE(bb_miiphy_buses[i].get_mdio, gd->reloc_off);
BB_MII_RELOCATE(bb_miiphy_buses[i].set_mdc, gd->reloc_off);
BB_MII_RELOCATE(bb_miiphy_buses[i].delay, gd->reloc_off);
#endif
if (bb_miiphy_buses[i].init != NULL) {
for (i = 0; i < bb_miiphy_buses_num; i++)
if (bb_miiphy_buses[i].init != NULL)
bb_miiphy_buses[i].init(&bb_miiphy_buses[i]);
}
}
return 0;
}

View File

@ -463,37 +463,6 @@ U_BOOT_PHY_DRIVER(genphy) = {
.shutdown = genphy_shutdown,
};
#ifdef CONFIG_NEEDS_MANUAL_RELOC
int phy_init(void)
{
const int ll_n_ents = ll_entry_count(struct phy_driver, phy_driver);
struct phy_driver *drv, *ll_entry;
/* Perform manual relocation on linker list based PHY drivers */
ll_entry = ll_entry_start(struct phy_driver, phy_driver);
for (drv = ll_entry; drv != ll_entry + ll_n_ents; drv++) {
if (drv->probe)
drv->probe += gd->reloc_off;
if (drv->config)
drv->config += gd->reloc_off;
if (drv->startup)
drv->startup += gd->reloc_off;
if (drv->shutdown)
drv->shutdown += gd->reloc_off;
if (drv->readext)
drv->readext += gd->reloc_off;
if (drv->writeext)
drv->writeext += gd->reloc_off;
if (drv->read_mmd)
drv->read_mmd += gd->reloc_off;
if (drv->write_mmd)
drv->write_mmd += gd->reloc_off;
}
return 0;
}
#endif
int phy_set_supported(struct phy_device *phydev, u32 max_speed)
{
/* The default values for phydev->supported are provided by the PHY

View File

@ -508,28 +508,6 @@ static int serial_post_probe(struct udevice *dev)
#endif
int ret;
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
if (ops->setbrg)
ops->setbrg += gd->reloc_off;
if (ops->getc)
ops->getc += gd->reloc_off;
if (ops->putc)
ops->putc += gd->reloc_off;
if (ops->pending)
ops->pending += gd->reloc_off;
if (ops->clear)
ops->clear += gd->reloc_off;
if (ops->getconfig)
ops->getconfig += gd->reloc_off;
if (ops->setconfig)
ops->setconfig += gd->reloc_off;
#if CFG_POST & CFG_SYS_POST_UART
if (ops->loop)
ops->loop += gd->reloc_off;
#endif
if (ops->getinfo)
ops->getinfo += gd->reloc_off;
#endif
/* Set the baud rate */
if (ops->setbrg) {
ret = ops->setbrg(dev, gd->baudrate);

View File

@ -142,23 +142,6 @@ serial_initfunc(mtk_serial_initialize);
*/
void serial_register(struct serial_device *dev)
{
#ifdef CONFIG_NEEDS_MANUAL_RELOC
if (dev->start)
dev->start += gd->reloc_off;
if (dev->stop)
dev->stop += gd->reloc_off;
if (dev->setbrg)
dev->setbrg += gd->reloc_off;
if (dev->getc)
dev->getc += gd->reloc_off;
if (dev->tstc)
dev->tstc += gd->reloc_off;
if (dev->putc)
dev->putc += gd->reloc_off;
if (dev->puts)
dev->puts += gd->reloc_off;
#endif
dev->next = serial_devices;
serial_devices = dev;
}

View File

@ -196,38 +196,6 @@ static int spi_post_probe(struct udevice *bus)
spi->max_hz = dev_read_u32_default(bus, "spi-max-frequency", 0);
}
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
struct dm_spi_ops *ops = spi_get_ops(bus);
static int reloc_done;
if (!reloc_done) {
if (ops->claim_bus)
ops->claim_bus += gd->reloc_off;
if (ops->release_bus)
ops->release_bus += gd->reloc_off;
if (ops->set_wordlen)
ops->set_wordlen += gd->reloc_off;
if (ops->xfer)
ops->xfer += gd->reloc_off;
if (ops->set_speed)
ops->set_speed += gd->reloc_off;
if (ops->set_mode)
ops->set_mode += gd->reloc_off;
if (ops->cs_info)
ops->cs_info += gd->reloc_off;
if (ops->mem_ops) {
struct spi_controller_mem_ops *mem_ops =
(struct spi_controller_mem_ops *)ops->mem_ops;
if (mem_ops->adjust_op_size)
mem_ops->adjust_op_size += gd->reloc_off;
if (mem_ops->supports_op)
mem_ops->supports_op += gd->reloc_off;
if (mem_ops->exec_op)
mem_ops->exec_op += gd->reloc_off;
}
reloc_done++;
}
#endif
return 0;
}

View File

@ -158,23 +158,7 @@ int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
#endif
static int sysreset_post_bind(struct udevice *dev)
{
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
struct sysreset_ops *ops = sysreset_get_ops(dev);
static int reloc_done;
if (!reloc_done) {
if (ops->request)
ops->request += gd->reloc_off;
reloc_done++;
}
#endif
return 0;
}
UCLASS_DRIVER(sysreset) = {
.id = UCLASS_SYSRESET,
.name = "sysreset",
.post_bind = sysreset_post_bind,
};

View File

@ -51,19 +51,6 @@ unsigned long notrace timer_get_rate(struct udevice *dev)
static int timer_pre_probe(struct udevice *dev)
{
if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC) &&
(gd->flags & GD_FLG_RELOC)) {
struct timer_ops *ops = timer_get_ops(dev);
static int reloc_done;
if (!reloc_done) {
if (ops->get_count)
MANUAL_RELOC(ops->get_count);
reloc_done++;
}
}
if (CONFIG_IS_ENABLED(OF_REAL)) {
struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
struct clk timer_clk;

View File

@ -236,28 +236,6 @@ void watchdog_reset(void)
}
#endif
static int wdt_post_bind(struct udevice *dev)
{
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
struct wdt_ops *ops = (struct wdt_ops *)device_get_ops(dev);
static int reloc_done;
if (!reloc_done) {
if (ops->start)
ops->start += gd->reloc_off;
if (ops->stop)
ops->stop += gd->reloc_off;
if (ops->reset)
ops->reset += gd->reloc_off;
if (ops->expire_now)
ops->expire_now += gd->reloc_off;
reloc_done++;
}
#endif
return 0;
}
static int wdt_pre_probe(struct udevice *dev)
{
u32 timeout = WATCHDOG_TIMEOUT_SECS;
@ -295,7 +273,6 @@ UCLASS_DRIVER(wdt) = {
.id = UCLASS_WDT,
.name = "watchdog",
.flags = DM_UC_FLAG_SEQ_ALIAS,
.post_bind = wdt_post_bind,
.pre_probe = wdt_pre_probe,
.per_device_auto = sizeof(struct wdt_priv),
};

12
env/callback.c vendored
View File

@ -9,10 +9,6 @@
#include <env_internal.h>
#include <asm/global_data.h>
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
DECLARE_GLOBAL_DATA_PTR;
#endif
/*
* Look up a callback function pointer by name
*/
@ -71,11 +67,7 @@ void env_callback_init(struct env_entry *var_entry)
if (!ret && strlen(callback_name)) {
clbkp = find_env_callback(callback_name);
if (clbkp != NULL)
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
var_entry->callback = clbkp->callback + gd->reloc_off;
#else
var_entry->callback = clbkp->callback;
#endif
}
}
@ -112,11 +104,7 @@ static int set_callback(const char *name, const char *value, void *priv)
/* assign the requested callback */
clbkp = find_env_callback(value);
if (clbkp != NULL)
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
ep->callback = clbkp->callback + gd->reloc_off;
#else
ep->callback = clbkp->callback;
#endif
}
}

5
env/common.c vendored
View File

@ -428,11 +428,6 @@ int env_export(env_t *env_out)
void env_relocate(void)
{
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
env_reloc();
env_fix_drivers();
env_htab.change_ok += gd->reloc_off;
#endif
if (gd->env_valid == ENV_INVALID) {
#if defined(CONFIG_ENV_IS_NOWHERE) || defined(CONFIG_SPL_BUILD)
/* Environment not changable */

23
env/env.c vendored
View File

@ -14,29 +14,6 @@
DECLARE_GLOBAL_DATA_PTR;
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
void env_fix_drivers(void)
{
struct env_driver *drv;
const int n_ents = ll_entry_count(struct env_driver, env_driver);
struct env_driver *entry;
drv = ll_entry_start(struct env_driver, env_driver);
for (entry = drv; entry != drv + n_ents; entry++) {
if (entry->name)
entry->name += gd->reloc_off;
if (entry->load)
entry->load += gd->reloc_off;
if (entry->save)
entry->save += gd->reloc_off;
if (entry->erase)
entry->erase += gd->reloc_off;
if (entry->init)
entry->init += gd->reloc_off;
}
}
#endif
static struct env_driver *_env_driver_lookup(enum env_location loc)
{
struct env_driver *drv;

16
fs/fs.c
View File

@ -422,22 +422,6 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
{
struct fstype_info *info;
int part, i;
#ifdef CONFIG_NEEDS_MANUAL_RELOC
static int relocated;
if (!relocated) {
for (i = 0, info = fstypes; i < ARRAY_SIZE(fstypes);
i++, info++) {
info->name += gd->reloc_off;
info->probe += gd->reloc_off;
info->close += gd->reloc_off;
info->ls += gd->reloc_off;
info->read += gd->reloc_off;
info->write += gd->reloc_off;
}
relocated = 1;
}
#endif
part = part_get_info_by_dev_and_name_or_num(ifname, dev_part_str, &fs_dev_desc,
&fs_partition, 1);

View File

@ -201,12 +201,6 @@ static int __init compr_init(struct ubifs_compressor *compr)
{
ubifs_compressors[compr->compr_type] = compr;
#ifdef CONFIG_NEEDS_MANUAL_RELOC
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
if (compr->capi_name) {
compr->cc = crypto_alloc_comp(compr->capi_name, 0, 0);
if (IS_ERR(compr->cc)) {

View File

@ -105,12 +105,6 @@ struct blk_desc {
(PAD_SIZE(size, blk_desc->blksz))
#if CONFIG_IS_ENABLED(BLOCK_CACHE)
/**
* blkcache_init() - initialize the block cache list pointers
*/
int blkcache_init(void);
/**
* blkcache_read() - attempt to read a set of blocks from cache
*

View File

@ -318,24 +318,6 @@ int cmd_source_script(ulong addr, const char *fit_uname, const char *confname);
# define _CMD_HELP(x)
#endif
#ifdef CONFIG_NEEDS_MANUAL_RELOC
#define U_BOOT_SUBCMDS_RELOC(_cmdname) \
static void _cmdname##_subcmds_reloc(void) \
{ \
static int relocated; \
\
if (relocated) \
return; \
\
fixup_cmdtable(_cmdname##_subcmds, \
ARRAY_SIZE(_cmdname##_subcmds)); \
relocated = 1; \
}
#else
#define U_BOOT_SUBCMDS_RELOC(_cmdname) \
static void _cmdname##_subcmds_reloc(void) { }
#endif
#define U_BOOT_SUBCMDS_DO_CMD(_cmdname) \
static int do_##_cmdname(struct cmd_tbl *cmdtp, int flag, \
int argc, char *const argv[], \
@ -343,8 +325,6 @@ int cmd_source_script(ulong addr, const char *fit_uname, const char *confname);
{ \
struct cmd_tbl *subcmd; \
\
_cmdname##_subcmds_reloc(); \
\
/* We need at least the cmd and subcmd names. */ \
if (argc < 2 || argc > CONFIG_SYS_MAXARGS) \
return CMD_RET_USAGE; \
@ -379,7 +359,6 @@ int cmd_source_script(ulong addr, const char *fit_uname, const char *confname);
#define U_BOOT_SUBCMDS(_cmdname, ...) \
static struct cmd_tbl _cmdname##_subcmds[] = { __VA_ARGS__ }; \
U_BOOT_SUBCMDS_RELOC(_cmdname) \
U_BOOT_SUBCMDS_DO_CMD(_cmdname) \
U_BOOT_SUBCMDS_COMPLETE(_cmdname)

View File

@ -239,11 +239,6 @@ int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr);
*/
int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr);
/**
* env_fix_drivers() - Updates envdriver as per relocation
*/
void env_fix_drivers(void);
/**
* env_set_default_vars() - reset variables to their default value
*
@ -356,14 +351,6 @@ char *env_get_default(const char *name);
/* [re]set to the default environment */
void env_set_default(const char *s, int flags);
/**
* env_reloc() - Relocate the 'env' sub-commands
*
* This is used for those unfortunate archs with crappy toolchains
*/
void env_reloc(void);
/**
* env_import_fdt() - Import environment values from device tree blob
*

View File

@ -328,16 +328,6 @@ int event_register(const char *id, enum event_t type, event_handler_t func,
/** event_show_spy_list( - Show a list of event spies */
void event_show_spy_list(void);
/**
* event_manual_reloc() - Relocate event handler pointers
*
* Relocate event handler pointers for all static event spies. It is called
* during the generic board init sequence, after relocation.
*
* Return: 0 if OK
*/
int event_manual_reloc(void);
/**
* event_type_name() - Get the name of an event type
*

View File

@ -35,11 +35,4 @@ typedef int (*init_fnc_t)(void);
*/
int initcall_run_list(const init_fnc_t init_sequence[]);
/**
* initcall_manual_reloc() - Do manual relocation on an initcall sequence
*
* @init_sequence: NULL-terminated init sequence to relocate
*/
void initcall_manual_reloc(init_fnc_t init_sequence[]);
#endif

View File

@ -171,14 +171,6 @@ struct fixed_link {
int asym_pause;
};
/**
* phy_init() - Initializes the PHY drivers
* This function registers all available PHY drivers
*
* @return: 0 if OK, -ve on error
*/
int phy_init(void);
/**
* phy_reset() - Resets the specified PHY
* Issues a reset of the PHY and waits for it to complete

View File

@ -105,9 +105,6 @@ void post_bootmode_clear (void);
int post_run (char *name, int flags);
int post_info (char *name);
int post_log (char *format, ...);
#ifdef CONFIG_NEEDS_MANUAL_RELOC
void post_reloc (void);
#endif
unsigned long post_time_ms (unsigned long base);
/**

View File

@ -39,28 +39,4 @@ int clear_bss(void);
*/
int do_elf_reloc_fixups(void);
/**
* manual_reloc() - Manually relocate a pointer if needed
*
* This is a nop in almost all cases, except for the systems with a broken gcc
* which need to manually relocate some things.
*
* @ptr: Pointer to relocate
* Return: new pointer value
*/
static inline void *manual_reloc(void *ptr)
{
#ifndef USE_HOSTCC
if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC))
return ptr + gd->reloc_off;
#endif
return ptr;
}
#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC)
#define MANUAL_RELOC(ptr) (ptr) = manual_reloc(ptr)
#else
#define MANUAL_RELOC(ptr) (void)(ptr)
#endif
#endif /* _RELOCATE_H_ */

View File

@ -97,13 +97,3 @@ int initcall_run_list(const init_fnc_t init_sequence[])
return 0;
}
void initcall_manual_reloc(init_fnc_t init_sequence[])
{
init_fnc_t *ptr;
for (ptr = init_sequence; *ptr; ptr++) {
if (!initcall_is_event(*ptr))
MANUAL_RELOC(*ptr);
}
}

View File

@ -556,32 +556,6 @@ static int eth_post_probe(struct udevice *dev)
unsigned char env_enetaddr[ARP_HLEN];
char *source = "DT";
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
struct eth_ops *ops = eth_get_ops(dev);
static int reloc_done;
if (!reloc_done) {
if (ops->start)
ops->start += gd->reloc_off;
if (ops->send)
ops->send += gd->reloc_off;
if (ops->recv)
ops->recv += gd->reloc_off;
if (ops->free_pkt)
ops->free_pkt += gd->reloc_off;
if (ops->stop)
ops->stop += gd->reloc_off;
if (ops->mcast)
ops->mcast += gd->reloc_off;
if (ops->write_hwaddr)
ops->write_hwaddr += gd->reloc_off;
if (ops->read_rom_hwaddr)
ops->read_rom_hwaddr += gd->reloc_off;
reloc_done++;
}
#endif
priv->state = ETH_STATE_INIT;
priv->running = false;

View File

@ -36,10 +36,6 @@ void eth_common_init(void)
#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB)
miiphy_init();
#endif
#if defined(CONFIG_NEEDS_MANUAL_RELOC) && defined(CONFIG_PHYLIB)
phy_init();
#endif
#endif
}

View File

@ -416,54 +416,6 @@ int post_log(char *format, ...)
return 0;
}
#ifdef CONFIG_NEEDS_MANUAL_RELOC
void post_reloc(void)
{
unsigned int i;
/*
* We have to relocate the test table manually
*/
for (i = 0; i < post_list_size; i++) {
ulong addr;
struct post_test *test = post_list + i;
if (test->name) {
addr = (ulong)(test->name) + gd->reloc_off;
test->name = (char *)addr;
}
if (test->cmd) {
addr = (ulong)(test->cmd) + gd->reloc_off;
test->cmd = (char *)addr;
}
if (test->desc) {
addr = (ulong)(test->desc) + gd->reloc_off;
test->desc = (char *)addr;
}
if (test->test) {
addr = (ulong)(test->test) + gd->reloc_off;
test->test = (int (*)(int flags)) addr;
}
if (test->init_f) {
addr = (ulong)(test->init_f) + gd->reloc_off;
test->init_f = (int (*)(void)) addr;
}
if (test->reloc) {
addr = (ulong)(test->reloc) + gd->reloc_off;
test->reloc = (void (*)(void)) addr;
test->reloc();
}
}
}
#endif
/*
* Some tests (e.g. SYSMON) need the time when post_init_f started,
* but we cannot use get_timer() at this point.