diff options
Diffstat (limited to 'drivers/staging/tidspbridge/pmgr')
-rw-r--r-- | drivers/staging/tidspbridge/pmgr/cmm.c | 12 | ||||
-rw-r--r-- | drivers/staging/tidspbridge/pmgr/cod.c | 63 | ||||
-rw-r--r-- | drivers/staging/tidspbridge/pmgr/dbll.c | 33 | ||||
-rw-r--r-- | drivers/staging/tidspbridge/pmgr/dmm.c | 4 |
4 files changed, 58 insertions, 54 deletions
diff --git a/drivers/staging/tidspbridge/pmgr/cmm.c b/drivers/staging/tidspbridge/pmgr/cmm.c index d054e5389eb3..4861c51e16bb 100644 --- a/drivers/staging/tidspbridge/pmgr/cmm.c +++ b/drivers/staging/tidspbridge/pmgr/cmm.c @@ -149,7 +149,7 @@ static struct cmm_mnode *get_free_block(struct cmm_allocator *allocator, static struct cmm_mnode *get_node(struct cmm_object *cmm_mgr_obj, u32 dw_pa, u32 dw_va, u32 ul_size); /* get available slot for new allocator */ -static s32 get_slot(struct cmm_object *hcmm_mgr); +static s32 get_slot(struct cmm_object *cmm_mgr_obj); static void un_register_gppsm_seg(struct cmm_allocator *psma); /* @@ -540,7 +540,7 @@ int cmm_register_gppsm_seg(struct cmm_object *hcmm_mgr, u32 dw_gpp_base_pa, u32 ul_size, u32 dsp_addr_offset, s8 c_factor, u32 dw_dsp_base, u32 ul_dsp_size, - u32 *sgmt_id, u32 dw_gpp_base_va) + u32 *sgmt_id, u32 gpp_base_va) { struct cmm_object *cmm_mgr_obj = (struct cmm_object *)hcmm_mgr; struct cmm_allocator *psma = NULL; @@ -551,13 +551,13 @@ int cmm_register_gppsm_seg(struct cmm_object *hcmm_mgr, DBC_REQUIRE(ul_size > 0); DBC_REQUIRE(sgmt_id != NULL); DBC_REQUIRE(dw_gpp_base_pa != 0); - DBC_REQUIRE(dw_gpp_base_va != 0); + DBC_REQUIRE(gpp_base_va != 0); DBC_REQUIRE((c_factor <= CMM_ADDTODSPPA) && (c_factor >= CMM_SUBFROMDSPPA)); dev_dbg(bridge, "%s: dw_gpp_base_pa %x ul_size %x dsp_addr_offset %x " - "dw_dsp_base %x ul_dsp_size %x dw_gpp_base_va %x\n", __func__, + "dw_dsp_base %x ul_dsp_size %x gpp_base_va %x\n", __func__, dw_gpp_base_pa, ul_size, dsp_addr_offset, dw_dsp_base, - ul_dsp_size, dw_gpp_base_va); + ul_dsp_size, gpp_base_va); if (!hcmm_mgr) { status = -EFAULT; return status; @@ -585,7 +585,7 @@ int cmm_register_gppsm_seg(struct cmm_object *hcmm_mgr, psma->hcmm_mgr = hcmm_mgr; /* ref to parent */ psma->shm_base = dw_gpp_base_pa; /* SM Base phys */ psma->ul_sm_size = ul_size; /* SM segment size in bytes */ - psma->dw_vm_base = dw_gpp_base_va; + psma->dw_vm_base = gpp_base_va; psma->dw_dsp_phys_addr_offset = dsp_addr_offset; psma->c_factor = c_factor; psma->dw_dsp_base = dw_dsp_base; diff --git a/drivers/staging/tidspbridge/pmgr/cod.c b/drivers/staging/tidspbridge/pmgr/cod.c index d9501eb675de..21aad312b549 100644 --- a/drivers/staging/tidspbridge/pmgr/cod.c +++ b/drivers/staging/tidspbridge/pmgr/cod.c @@ -215,7 +215,7 @@ void cod_close(struct cod_libraryobj *lib) * dynamically loaded object files. * */ -int cod_create(OUT struct cod_manager **mgr, char *str_dummy_file, +int cod_create(OUT struct cod_manager **mgr, char *str_zl_file, IN OPTIONAL CONST struct cod_attrs *attrs) { struct cod_manager *mgr_new; @@ -281,23 +281,24 @@ int cod_create(OUT struct cod_manager **mgr, char *str_dummy_file, * Purpose: * Delete a code manager object. */ -void cod_delete(struct cod_manager *hmgr) +void cod_delete(struct cod_manager *cod_mgr_obj) { DBC_REQUIRE(refs > 0); - DBC_REQUIRE(IS_VALID(hmgr)); + DBC_REQUIRE(IS_VALID(cod_mgr_obj)); - if (hmgr->base_lib) { - if (hmgr->loaded) - hmgr->fxns.unload_fxn(hmgr->base_lib, &hmgr->attrs); + if (cod_mgr_obj->base_lib) { + if (cod_mgr_obj->loaded) + cod_mgr_obj->fxns.unload_fxn(cod_mgr_obj->base_lib, + &cod_mgr_obj->attrs); - hmgr->fxns.close_fxn(hmgr->base_lib); + cod_mgr_obj->fxns.close_fxn(cod_mgr_obj->base_lib); } - if (hmgr->target) { - hmgr->fxns.delete_fxn(hmgr->target); - hmgr->fxns.exit_fxn(); + if (cod_mgr_obj->target) { + cod_mgr_obj->fxns.delete_fxn(cod_mgr_obj->target); + cod_mgr_obj->fxns.exit_fxn(); } - hmgr->ul_magic = ~MAGIC; - kfree(hmgr); + cod_mgr_obj->ul_magic = ~MAGIC; + kfree(cod_mgr_obj); } /* @@ -432,23 +433,24 @@ int cod_get_section(struct cod_libraryobj *lib, IN char *str_sect, * C symbol. * */ -int cod_get_sym_value(struct cod_manager *hmgr, char *str_sym, +int cod_get_sym_value(struct cod_manager *cod_mgr_obj, char *str_sym, u32 *pul_value) { struct dbll_sym_val *dbll_sym; DBC_REQUIRE(refs > 0); - DBC_REQUIRE(IS_VALID(hmgr)); + DBC_REQUIRE(IS_VALID(cod_mgr_obj)); DBC_REQUIRE(str_sym != NULL); DBC_REQUIRE(pul_value != NULL); - dev_dbg(bridge, "%s: hmgr: %p str_sym: %s pul_value: %p\n", - __func__, hmgr, str_sym, pul_value); - if (hmgr->base_lib) { - if (!hmgr->fxns. - get_addr_fxn(hmgr->base_lib, str_sym, &dbll_sym)) { - if (!hmgr->fxns. - get_c_addr_fxn(hmgr->base_lib, str_sym, &dbll_sym)) + dev_dbg(bridge, "%s: cod_mgr_obj: %p str_sym: %s pul_value: %p\n", + __func__, cod_mgr_obj, str_sym, pul_value); + if (cod_mgr_obj->base_lib) { + if (!cod_mgr_obj->fxns. + get_addr_fxn(cod_mgr_obj->base_lib, str_sym, &dbll_sym)) { + if (!cod_mgr_obj->fxns. + get_c_addr_fxn(cod_mgr_obj->base_lib, str_sym, + &dbll_sym)) return -ESPIPE; } } else { @@ -492,7 +494,7 @@ bool cod_init(void) * recalculated to reflect this. In this way, we can support NULL * terminating args arrays, if num_argc is very large. */ -int cod_load_base(struct cod_manager *hmgr, u32 num_argc, char *args[], +int cod_load_base(struct cod_manager *cod_mgr_obj, u32 num_argc, char *args[], cod_writefxn pfn_write, void *arb, char *envp[]) { dbll_flags flags; @@ -502,12 +504,12 @@ int cod_load_base(struct cod_manager *hmgr, u32 num_argc, char *args[], u32 i; DBC_REQUIRE(refs > 0); - DBC_REQUIRE(IS_VALID(hmgr)); + DBC_REQUIRE(IS_VALID(cod_mgr_obj)); DBC_REQUIRE(num_argc > 0); DBC_REQUIRE(args != NULL); DBC_REQUIRE(args[0] != NULL); DBC_REQUIRE(pfn_write != NULL); - DBC_REQUIRE(hmgr->base_lib != NULL); + DBC_REQUIRE(cod_mgr_obj->base_lib != NULL); /* * Make sure every argv[] stated in argc has a value, or change argc to @@ -521,7 +523,7 @@ int cod_load_base(struct cod_manager *hmgr, u32 num_argc, char *args[], } /* set the write function for this operation */ - hmgr->fxns.get_attrs_fxn(hmgr->target, &save_attrs); + cod_mgr_obj->fxns.get_attrs_fxn(cod_mgr_obj->target, &save_attrs); new_attrs = save_attrs; new_attrs.write = (dbll_write_fxn) pfn_write; @@ -533,15 +535,16 @@ int cod_load_base(struct cod_manager *hmgr, u32 num_argc, char *args[], /* Load the image */ flags = DBLL_CODE | DBLL_DATA | DBLL_SYMB; - status = hmgr->fxns.load_fxn(hmgr->base_lib, flags, &new_attrs, - &hmgr->ul_entry); + status = cod_mgr_obj->fxns.load_fxn(cod_mgr_obj->base_lib, flags, + &new_attrs, + &cod_mgr_obj->ul_entry); if (DSP_FAILED(status)) - hmgr->fxns.close_fxn(hmgr->base_lib); + cod_mgr_obj->fxns.close_fxn(cod_mgr_obj->base_lib); if (DSP_SUCCEEDED(status)) - hmgr->loaded = true; + cod_mgr_obj->loaded = true; else - hmgr->base_lib = NULL; + cod_mgr_obj->base_lib = NULL; return status; } diff --git a/drivers/staging/tidspbridge/pmgr/dbll.c b/drivers/staging/tidspbridge/pmgr/dbll.c index cb4d2a7ceef5..16dbde8cf886 100644 --- a/drivers/staging/tidspbridge/pmgr/dbll.c +++ b/drivers/staging/tidspbridge/pmgr/dbll.c @@ -140,7 +140,8 @@ struct dbll_symbol { static void dof_close(struct dbll_library_obj *zl_lib); static int dof_open(struct dbll_library_obj *zl_lib); static s32 no_op(struct dynamic_loader_initialize *thisptr, void *bufr, - ldr_addr locn, struct ldr_section_info *info, unsigned bytsiz); + ldr_addr locn, struct ldr_section_info *info, + unsigned bytsize); /* * Functions called by dynamic loader @@ -176,20 +177,20 @@ static void rmm_dealloc(struct dynamic_loader_allocate *this, static int connect(struct dynamic_loader_initialize *this); static int read_mem(struct dynamic_loader_initialize *this, void *buf, ldr_addr addr, struct ldr_section_info *info, - unsigned nbytes); + unsigned bytes); static int write_mem(struct dynamic_loader_initialize *this, void *buf, ldr_addr addr, struct ldr_section_info *info, unsigned nbytes); static int fill_mem(struct dynamic_loader_initialize *this, ldr_addr addr, - struct ldr_section_info *info, unsigned nbytes, + struct ldr_section_info *info, unsigned bytes, unsigned val); static int execute(struct dynamic_loader_initialize *this, ldr_addr start); static void release(struct dynamic_loader_initialize *this); /* symbol table hash functions */ -static u16 name_hash(void *name, u16 max_bucket); -static bool name_match(void *name, void *sp); -static void sym_delete(void *sp); +static u16 name_hash(void *key, u16 max_bucket); +static bool name_match(void *key, void *sp); +static void sym_delete(void *value); static u32 refs; /* module reference count */ @@ -728,7 +729,7 @@ func_cont: * Get the content of a COFF section. */ int dbll_read_sect(struct dbll_library_obj *lib, char *name, - char *content, u32 size) + char *buf, u32 size) { struct dbll_library_obj *zl_lib = (struct dbll_library_obj *)lib; bool opened_doff = false; @@ -740,7 +741,7 @@ int dbll_read_sect(struct dbll_library_obj *lib, char *name, DBC_REQUIRE(refs > 0); DBC_REQUIRE(zl_lib); DBC_REQUIRE(name != NULL); - DBC_REQUIRE(content != NULL); + DBC_REQUIRE(buf != NULL); DBC_REQUIRE(size != 0); /* If DOFF file is not open, we open it. */ @@ -768,7 +769,7 @@ int dbll_read_sect(struct dbll_library_obj *lib, char *name, } /* * Ensure the supplied buffer size is sufficient to store - * the section content to be read. + * the section buf to be read. */ ul_sect_size = sect->size * byte_size; /* Make sure size is even for good swap */ @@ -780,7 +781,7 @@ int dbll_read_sect(struct dbll_library_obj *lib, char *name, if (ul_sect_size > size) { status = -EPERM; } else { - if (!dload_get_section(zl_lib->desc, sect, content)) + if (!dload_get_section(zl_lib->desc, sect, buf)) status = -EBADF; } @@ -790,8 +791,8 @@ func_cont: opened_doff = false; } - dev_dbg(bridge, "%s: lib: %p name: %s content: %p size: 0x%x, " - "status 0x%x\n", __func__, lib, name, content, size, status); + dev_dbg(bridge, "%s: lib: %p name: %s buf: %p size: 0x%x, " + "status 0x%x\n", __func__, lib, name, buf, size, status); return status; } @@ -935,13 +936,13 @@ static u16 name_hash(void *key, u16 max_bucket) /* * ======== name_match ======== */ -static bool name_match(void *key, void *value) +static bool name_match(void *key, void *sp) { DBC_REQUIRE(key != NULL); - DBC_REQUIRE(value != NULL); + DBC_REQUIRE(sp != NULL); - if ((key != NULL) && (value != NULL)) { - if (strcmp((char *)key, ((struct dbll_symbol *)value)->name) == + if ((key != NULL) && (sp != NULL)) { + if (strcmp((char *)key, ((struct dbll_symbol *)sp)->name) == 0) return true; } diff --git a/drivers/staging/tidspbridge/pmgr/dmm.c b/drivers/staging/tidspbridge/pmgr/dmm.c index c661e5869ad2..c4d6cbc4a31c 100644 --- a/drivers/staging/tidspbridge/pmgr/dmm.c +++ b/drivers/staging/tidspbridge/pmgr/dmm.c @@ -405,14 +405,14 @@ int dmm_un_reserve_memory(struct dmm_object *dmm_mgr, u32 rsv_addr) * Purpose: * Returns a region containing the specified memory region */ -static struct map_page *get_region(u32 addrs) +static struct map_page *get_region(u32 addr) { struct map_page *curr_region = NULL; u32 i = 0; if (virtual_mapping_table != NULL) { /* find page mapped by this address */ - i = DMM_ADDR_TO_INDEX(addrs); + i = DMM_ADDR_TO_INDEX(addr); if (i < table_size) curr_region = virtual_mapping_table + i; } |