|
@@ -202,9 +202,6 @@ void dbll_close(struct dbll_library_obj *zl_lib)
|
|
|
{
|
|
|
struct dbll_tar_obj *zl_target;
|
|
|
|
|
|
- DBC_REQUIRE(refs > 0);
|
|
|
- DBC_REQUIRE(zl_lib);
|
|
|
- DBC_REQUIRE(zl_lib->open_ref > 0);
|
|
|
zl_target = zl_lib->target_obj;
|
|
|
zl_lib->open_ref--;
|
|
|
if (zl_lib->open_ref == 0) {
|
|
@@ -241,10 +238,6 @@ int dbll_create(struct dbll_tar_obj **target_obj,
|
|
|
struct dbll_tar_obj *pzl_target;
|
|
|
int status = 0;
|
|
|
|
|
|
- DBC_REQUIRE(refs > 0);
|
|
|
- DBC_REQUIRE(pattrs != NULL);
|
|
|
- DBC_REQUIRE(target_obj != NULL);
|
|
|
-
|
|
|
/* Allocate DBL target object */
|
|
|
pzl_target = kzalloc(sizeof(struct dbll_tar_obj), GFP_KERNEL);
|
|
|
if (target_obj != NULL) {
|
|
@@ -255,8 +248,6 @@ int dbll_create(struct dbll_tar_obj **target_obj,
|
|
|
pzl_target->attrs = *pattrs;
|
|
|
*target_obj = (struct dbll_tar_obj *)pzl_target;
|
|
|
}
|
|
|
- DBC_ENSURE((!status && *target_obj) ||
|
|
|
- (status && *target_obj == NULL));
|
|
|
}
|
|
|
|
|
|
return status;
|
|
@@ -269,9 +260,6 @@ void dbll_delete(struct dbll_tar_obj *target)
|
|
|
{
|
|
|
struct dbll_tar_obj *zl_target = (struct dbll_tar_obj *)target;
|
|
|
|
|
|
- DBC_REQUIRE(refs > 0);
|
|
|
- DBC_REQUIRE(zl_target);
|
|
|
-
|
|
|
kfree(zl_target);
|
|
|
|
|
|
}
|
|
@@ -282,14 +270,10 @@ void dbll_delete(struct dbll_tar_obj *target)
|
|
|
*/
|
|
|
void dbll_exit(void)
|
|
|
{
|
|
|
- DBC_REQUIRE(refs > 0);
|
|
|
-
|
|
|
refs--;
|
|
|
|
|
|
if (refs == 0)
|
|
|
gh_exit();
|
|
|
-
|
|
|
- DBC_ENSURE(refs >= 0);
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -302,12 +286,6 @@ bool dbll_get_addr(struct dbll_library_obj *zl_lib, char *name,
|
|
|
struct dbll_symbol *sym;
|
|
|
bool status = false;
|
|
|
|
|
|
- DBC_REQUIRE(refs > 0);
|
|
|
- DBC_REQUIRE(zl_lib);
|
|
|
- DBC_REQUIRE(name != NULL);
|
|
|
- DBC_REQUIRE(sym_val != NULL);
|
|
|
- DBC_REQUIRE(zl_lib->sym_tab != NULL);
|
|
|
-
|
|
|
sym = (struct dbll_symbol *)gh_find(zl_lib->sym_tab, name);
|
|
|
if (sym != NULL) {
|
|
|
*sym_val = &sym->value;
|
|
@@ -327,10 +305,6 @@ void dbll_get_attrs(struct dbll_tar_obj *target, struct dbll_attrs *pattrs)
|
|
|
{
|
|
|
struct dbll_tar_obj *zl_target = (struct dbll_tar_obj *)target;
|
|
|
|
|
|
- DBC_REQUIRE(refs > 0);
|
|
|
- DBC_REQUIRE(zl_target);
|
|
|
- DBC_REQUIRE(pattrs != NULL);
|
|
|
-
|
|
|
if ((pattrs != NULL) && (zl_target != NULL))
|
|
|
*pattrs = zl_target->attrs;
|
|
|
|
|
@@ -347,12 +321,6 @@ bool dbll_get_c_addr(struct dbll_library_obj *zl_lib, char *name,
|
|
|
char cname[MAXEXPR + 1];
|
|
|
bool status = false;
|
|
|
|
|
|
- DBC_REQUIRE(refs > 0);
|
|
|
- DBC_REQUIRE(zl_lib);
|
|
|
- DBC_REQUIRE(sym_val != NULL);
|
|
|
- DBC_REQUIRE(zl_lib->sym_tab != NULL);
|
|
|
- DBC_REQUIRE(name != NULL);
|
|
|
-
|
|
|
cname[0] = '_';
|
|
|
|
|
|
strncpy(cname + 1, name, sizeof(cname) - 2);
|
|
@@ -382,12 +350,6 @@ int dbll_get_sect(struct dbll_library_obj *lib, char *name, u32 *paddr,
|
|
|
struct dbll_library_obj *zl_lib = (struct dbll_library_obj *)lib;
|
|
|
int status = 0;
|
|
|
|
|
|
- DBC_REQUIRE(refs > 0);
|
|
|
- DBC_REQUIRE(name != NULL);
|
|
|
- DBC_REQUIRE(paddr != NULL);
|
|
|
- DBC_REQUIRE(psize != NULL);
|
|
|
- DBC_REQUIRE(zl_lib);
|
|
|
-
|
|
|
/* If DOFF file is not open, we open it. */
|
|
|
if (zl_lib != NULL) {
|
|
|
if (zl_lib->fp == NULL) {
|
|
@@ -434,8 +396,6 @@ int dbll_get_sect(struct dbll_library_obj *lib, char *name, u32 *paddr,
|
|
|
*/
|
|
|
bool dbll_init(void)
|
|
|
{
|
|
|
- DBC_REQUIRE(refs >= 0);
|
|
|
-
|
|
|
if (refs == 0)
|
|
|
gh_init();
|
|
|
|
|
@@ -456,10 +416,6 @@ int dbll_load(struct dbll_library_obj *lib, dbll_flags flags,
|
|
|
s32 err;
|
|
|
int status = 0;
|
|
|
bool opened_doff = false;
|
|
|
- DBC_REQUIRE(refs > 0);
|
|
|
- DBC_REQUIRE(zl_lib);
|
|
|
- DBC_REQUIRE(entry != NULL);
|
|
|
- DBC_REQUIRE(attrs != NULL);
|
|
|
|
|
|
/*
|
|
|
* Load if not already loaded.
|
|
@@ -558,8 +514,6 @@ int dbll_load(struct dbll_library_obj *lib, dbll_flags flags,
|
|
|
if (opened_doff)
|
|
|
dof_close(zl_lib);
|
|
|
|
|
|
- DBC_ENSURE(status || zl_lib->load_ref > 0);
|
|
|
-
|
|
|
dev_dbg(bridge, "%s: lib: %p flags: 0x%x entry: %p, status 0x%x\n",
|
|
|
__func__, lib, flags, entry, status);
|
|
|
|
|
@@ -577,12 +531,6 @@ int dbll_open(struct dbll_tar_obj *target, char *file, dbll_flags flags,
|
|
|
s32 err;
|
|
|
int status = 0;
|
|
|
|
|
|
- DBC_REQUIRE(refs > 0);
|
|
|
- DBC_REQUIRE(zl_target);
|
|
|
- DBC_REQUIRE(zl_target->attrs.fopen != NULL);
|
|
|
- DBC_REQUIRE(file != NULL);
|
|
|
- DBC_REQUIRE(lib_obj != NULL);
|
|
|
-
|
|
|
zl_lib = zl_target->head;
|
|
|
while (zl_lib != NULL) {
|
|
|
if (strcmp(zl_lib->file_name, file) == 0) {
|
|
@@ -699,8 +647,6 @@ func_cont:
|
|
|
dbll_close((struct dbll_library_obj *)zl_lib);
|
|
|
|
|
|
}
|
|
|
- DBC_ENSURE((!status && (zl_lib->open_ref > 0) && *lib_obj)
|
|
|
- || (status && *lib_obj == NULL));
|
|
|
|
|
|
dev_dbg(bridge, "%s: target: %p file: %s lib_obj: %p, status 0x%x\n",
|
|
|
__func__, target, file, lib_obj, status);
|
|
@@ -722,12 +668,6 @@ int dbll_read_sect(struct dbll_library_obj *lib, char *name,
|
|
|
const struct ldr_section_info *sect = NULL;
|
|
|
int status = 0;
|
|
|
|
|
|
- DBC_REQUIRE(refs > 0);
|
|
|
- DBC_REQUIRE(zl_lib);
|
|
|
- DBC_REQUIRE(name != NULL);
|
|
|
- DBC_REQUIRE(buf != NULL);
|
|
|
- DBC_REQUIRE(size != 0);
|
|
|
-
|
|
|
/* If DOFF file is not open, we open it. */
|
|
|
if (zl_lib != NULL) {
|
|
|
if (zl_lib->fp == NULL) {
|
|
@@ -788,14 +728,11 @@ void dbll_unload(struct dbll_library_obj *lib, struct dbll_attrs *attrs)
|
|
|
struct dbll_library_obj *zl_lib = (struct dbll_library_obj *)lib;
|
|
|
s32 err = 0;
|
|
|
|
|
|
- DBC_REQUIRE(refs > 0);
|
|
|
- DBC_REQUIRE(zl_lib);
|
|
|
- DBC_REQUIRE(zl_lib->load_ref > 0);
|
|
|
dev_dbg(bridge, "%s: lib: %p\n", __func__, lib);
|
|
|
zl_lib->load_ref--;
|
|
|
/* Unload only if reference count is 0 */
|
|
|
if (zl_lib->load_ref != 0)
|
|
|
- goto func_end;
|
|
|
+ return;
|
|
|
|
|
|
zl_lib->target_obj->attrs = *attrs;
|
|
|
if (zl_lib->dload_mod_obj) {
|
|
@@ -814,8 +751,6 @@ void dbll_unload(struct dbll_library_obj *lib, struct dbll_attrs *attrs)
|
|
|
/* delete DOFF desc since it holds *lots* of host OS
|
|
|
* resources */
|
|
|
dof_close(zl_lib);
|
|
|
-func_end:
|
|
|
- DBC_ENSURE(zl_lib->load_ref >= 0);
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -874,8 +809,6 @@ static u16 name_hash(void *key, u16 max_bucket)
|
|
|
u16 hash;
|
|
|
char *name = (char *)key;
|
|
|
|
|
|
- DBC_REQUIRE(name != NULL);
|
|
|
-
|
|
|
hash = 0;
|
|
|
|
|
|
while (*name) {
|
|
@@ -893,9 +826,6 @@ static u16 name_hash(void *key, u16 max_bucket)
|
|
|
*/
|
|
|
static bool name_match(void *key, void *sp)
|
|
|
{
|
|
|
- DBC_REQUIRE(key != NULL);
|
|
|
- DBC_REQUIRE(sp != NULL);
|
|
|
-
|
|
|
if ((key != NULL) && (sp != NULL)) {
|
|
|
if (strcmp((char *)key, ((struct dbll_symbol *)sp)->name) ==
|
|
|
0)
|
|
@@ -938,10 +868,7 @@ static int dbll_read_buffer(struct dynamic_loader_stream *this, void *buffer,
|
|
|
struct dbll_library_obj *lib;
|
|
|
int bytes_read = 0;
|
|
|
|
|
|
- DBC_REQUIRE(this != NULL);
|
|
|
lib = pstream->lib;
|
|
|
- DBC_REQUIRE(lib);
|
|
|
-
|
|
|
if (lib != NULL) {
|
|
|
bytes_read =
|
|
|
(*(lib->target_obj->attrs.fread)) (buffer, 1, bufsize,
|
|
@@ -960,10 +887,7 @@ static int dbll_set_file_posn(struct dynamic_loader_stream *this,
|
|
|
struct dbll_library_obj *lib;
|
|
|
int status = 0; /* Success */
|
|
|
|
|
|
- DBC_REQUIRE(this != NULL);
|
|
|
lib = pstream->lib;
|
|
|
- DBC_REQUIRE(lib);
|
|
|
-
|
|
|
if (lib != NULL) {
|
|
|
status = (*(lib->target_obj->attrs.fseek)) (lib->fp, (long)pos,
|
|
|
SEEK_SET);
|
|
@@ -986,10 +910,7 @@ static struct dynload_symbol *dbll_find_symbol(struct dynamic_loader_sym *this,
|
|
|
struct dbll_sym_val *dbll_sym = NULL;
|
|
|
bool status = false; /* Symbol not found yet */
|
|
|
|
|
|
- DBC_REQUIRE(this != NULL);
|
|
|
lib = ldr_sym->lib;
|
|
|
- DBC_REQUIRE(lib);
|
|
|
-
|
|
|
if (lib != NULL) {
|
|
|
if (lib->target_obj->attrs.sym_lookup) {
|
|
|
/* Check current lib + base lib + dep lib +
|
|
@@ -1034,11 +955,7 @@ static struct dynload_symbol *find_in_symbol_table(struct dynamic_loader_sym
|
|
|
struct dbll_library_obj *lib;
|
|
|
struct dbll_symbol *sym;
|
|
|
|
|
|
- DBC_REQUIRE(this != NULL);
|
|
|
lib = ldr_sym->lib;
|
|
|
- DBC_REQUIRE(lib);
|
|
|
- DBC_REQUIRE(lib->sym_tab != NULL);
|
|
|
-
|
|
|
sym = (struct dbll_symbol *)gh_find(lib->sym_tab, (char *)name);
|
|
|
|
|
|
ret_sym = (struct dynload_symbol *)&sym->value;
|
|
@@ -1059,10 +976,7 @@ static struct dynload_symbol *dbll_add_to_symbol_table(struct dynamic_loader_sym
|
|
|
struct dbll_library_obj *lib;
|
|
|
struct dynload_symbol *ret;
|
|
|
|
|
|
- DBC_REQUIRE(this != NULL);
|
|
|
- DBC_REQUIRE(name);
|
|
|
lib = ldr_sym->lib;
|
|
|
- DBC_REQUIRE(lib);
|
|
|
|
|
|
/* Check to see if symbol is already defined in symbol table */
|
|
|
if (!(lib->target_obj->attrs.base_image)) {
|
|
@@ -1111,10 +1025,7 @@ static void dbll_purge_symbol_table(struct dynamic_loader_sym *this,
|
|
|
struct ldr_symbol *ldr_sym = (struct ldr_symbol *)this;
|
|
|
struct dbll_library_obj *lib;
|
|
|
|
|
|
- DBC_REQUIRE(this != NULL);
|
|
|
lib = ldr_sym->lib;
|
|
|
- DBC_REQUIRE(lib);
|
|
|
-
|
|
|
/* May not need to do anything */
|
|
|
}
|
|
|
|
|
@@ -1127,9 +1038,7 @@ static void *allocate(struct dynamic_loader_sym *this, unsigned memsize)
|
|
|
struct dbll_library_obj *lib;
|
|
|
void *buf;
|
|
|
|
|
|
- DBC_REQUIRE(this != NULL);
|
|
|
lib = ldr_sym->lib;
|
|
|
- DBC_REQUIRE(lib);
|
|
|
|
|
|
buf = kzalloc(memsize, GFP_KERNEL);
|
|
|
|
|
@@ -1144,9 +1053,7 @@ static void deallocate(struct dynamic_loader_sym *this, void *mem_ptr)
|
|
|
struct ldr_symbol *ldr_sym = (struct ldr_symbol *)this;
|
|
|
struct dbll_library_obj *lib;
|
|
|
|
|
|
- DBC_REQUIRE(this != NULL);
|
|
|
lib = ldr_sym->lib;
|
|
|
- DBC_REQUIRE(lib);
|
|
|
|
|
|
kfree(mem_ptr);
|
|
|
}
|
|
@@ -1161,9 +1068,7 @@ static void dbll_err_report(struct dynamic_loader_sym *this, const char *errstr,
|
|
|
struct dbll_library_obj *lib;
|
|
|
char temp_buf[MAXEXPR];
|
|
|
|
|
|
- DBC_REQUIRE(this != NULL);
|
|
|
lib = ldr_sym->lib;
|
|
|
- DBC_REQUIRE(lib);
|
|
|
vsnprintf((char *)temp_buf, MAXEXPR, (char *)errstr, args);
|
|
|
dev_dbg(bridge, "%s\n", temp_buf);
|
|
|
}
|
|
@@ -1195,9 +1100,7 @@ static int dbll_rmm_alloc(struct dynamic_loader_allocate *this,
|
|
|
u32 alloc_size = 0;
|
|
|
u32 run_addr_flag = 0;
|
|
|
|
|
|
- DBC_REQUIRE(this != NULL);
|
|
|
lib = dbll_alloc_obj->lib;
|
|
|
- DBC_REQUIRE(lib);
|
|
|
|
|
|
mem_sect_type =
|
|
|
(stype == DLOAD_TEXT) ? DBLL_CODE : (stype ==
|
|
@@ -1206,7 +1109,6 @@ static int dbll_rmm_alloc(struct dynamic_loader_allocate *this,
|
|
|
|
|
|
/* Attempt to extract the segment ID and requirement information from
|
|
|
the name of the section */
|
|
|
- DBC_REQUIRE(info->name);
|
|
|
token_len = strlen((char *)(info->name)) + 1;
|
|
|
|
|
|
sz_sect_name = kzalloc(token_len, GFP_KERNEL);
|
|
@@ -1307,9 +1209,7 @@ static void rmm_dealloc(struct dynamic_loader_allocate *this,
|
|
|
(stype == DLOAD_TEXT) ? DBLL_CODE : (stype ==
|
|
|
DLOAD_BSS) ? DBLL_BSS :
|
|
|
DBLL_DATA;
|
|
|
- DBC_REQUIRE(this != NULL);
|
|
|
lib = dbll_alloc_obj->lib;
|
|
|
- DBC_REQUIRE(lib);
|
|
|
/* segid was set by alloc function */
|
|
|
segid = (u32) info->context;
|
|
|
if (mem_sect_type == DBLL_CODE)
|
|
@@ -1347,9 +1247,7 @@ static int read_mem(struct dynamic_loader_initialize *this, void *buf,
|
|
|
struct dbll_library_obj *lib;
|
|
|
int bytes_read = 0;
|
|
|
|
|
|
- DBC_REQUIRE(this != NULL);
|
|
|
lib = init_obj->lib;
|
|
|
- DBC_REQUIRE(lib);
|
|
|
/* Need bridge_brd_read function */
|
|
|
return bytes_read;
|
|
|
}
|
|
@@ -1368,7 +1266,6 @@ static int write_mem(struct dynamic_loader_initialize *this, void *buf,
|
|
|
u32 mem_sect_type;
|
|
|
bool ret = true;
|
|
|
|
|
|
- DBC_REQUIRE(this != NULL);
|
|
|
lib = init_obj->lib;
|
|
|
if (!lib)
|
|
|
return false;
|
|
@@ -1415,7 +1312,6 @@ static int fill_mem(struct dynamic_loader_initialize *this, ldr_addr addr,
|
|
|
struct dbll_library_obj *lib;
|
|
|
struct dbll_init_obj *init_obj = (struct dbll_init_obj *)this;
|
|
|
|
|
|
- DBC_REQUIRE(this != NULL);
|
|
|
lib = init_obj->lib;
|
|
|
pbuf = NULL;
|
|
|
/* Pass the NULL pointer to write_mem to get the start address of Shared
|
|
@@ -1439,9 +1335,7 @@ static int execute(struct dynamic_loader_initialize *this, ldr_addr start)
|
|
|
struct dbll_library_obj *lib;
|
|
|
bool ret = true;
|
|
|
|
|
|
- DBC_REQUIRE(this != NULL);
|
|
|
lib = init_obj->lib;
|
|
|
- DBC_REQUIRE(lib);
|
|
|
/* Save entry point */
|
|
|
if (lib != NULL)
|
|
|
lib->entry = (u32) start;
|