STATIC void cmd_esw_dma_set_count_size(uint32 count, uint32 size) { var_unset(CMD_ESW_DMA_BYTES, TRUE, FALSE, FALSE); var_unset(CMD_ESW_DMA_SHORTS, TRUE, FALSE, FALSE); var_unset(CMD_ESW_DMA_WORDS, TRUE, FALSE, FALSE); switch (size) { case 1: var_set(CMD_ESW_DMA_SIZE, "b", TRUE, FALSE); var_set_integer(CMD_ESW_DMA_BYTES, count, TRUE, FALSE); break; case 2: var_set(CMD_ESW_DMA_SIZE, "h", TRUE, FALSE); var_set_integer(CMD_ESW_DMA_SHORTS, count, TRUE, FALSE); break; case 4: var_set(CMD_ESW_DMA_SIZE, "w", TRUE, FALSE); var_set_integer(CMD_ESW_DMA_WORDS, count, TRUE, FALSE); break; default: var_set(CMD_ESW_DMA_SIZE, "?", TRUE, FALSE); break; } }
void var_table_delete(bombyx_env_t *env, var_table_t *hashtable, int reset_only) { var_t *list, *temp; if (hashtable == NULL) return; for (unsigned int i = 0; i < hashtable->size; i++) { list = hashtable->table[i]; while (list != NULL) { temp = list; list = list->next; if (temp->v.name) free(temp->v.name); var_unset(env, &temp->v); free(temp); } } if (reset_only) { memset(hashtable->table, 0, sizeof(var_t *) * hashtable->size); } else { free(hashtable->table); free(hashtable); } }
/* Must be called before the level is left */ void stack_clear(bombyx_env_t *env) { while (env->bc_stack_size) { if (env->bc_stack[env->bc_stack_size - 1].level < env->gl_level) return; var_unset(env, &env->bc_stack[--env->bc_stack_size]); } }
int test_test_init(int u, test_t *test, args_t *a, void **fp) /* * Function: test_test_init * Purpose: Run initialization scripts and routines for a specified test. * Parameters: u - unit # * test - pointer to test description. * a - pointer to arguments. * fp - cookie passed back to test routine. * Returns: 0 - success * -1 - failed. */ { int rv = 0; *fp = NULL; if (sh_set_rctest && (test->t_flags & T_F_RC)) { var_set_integer("testinit", test->t_test, 0, 0); #if defined(BCM_ESW_SUPPORT) #ifndef NO_SAL_APPL if (SOC_IS_XGS(u)) { if (diag_rc_load(u) != CMD_OK) { cli_out("Test: ERROR: RC init script for test %d (%s) failed\n", test->t_test, test->t_name); rv = -1; } } #endif #endif #if defined(BCM_ROBO_SUPPORT) /* * Do stat init before a specified test for ROBO chips * ESW do this by RC init script(rc.soc) */ if (SOC_IS_ROBO(u)) { bcm_stat_init(u); } #endif /* BCM_ROBO_SUPPORT */ var_unset("testinit", 0, 1, 0); if (rv) { return(rv); } } if (test->t_init_f) { /* Call init function */ rv = test->t_init_f(u, a, fp); /* check if return value is != BCM_E_UNAVAIL because the memory test on the internal * memories will return BCM_E_UNAVAIL if External TCAM is present. Those memories shouldn't * be tested instead should be skipped. */ if (rv && (rv != BCM_E_UNAVAIL)) { cli_out("Test: ERROR: Init function for test %d (%s) failed\n", test->t_test, test->t_name); rv = -1; } } return(rv); }
int test_test_init(int u, test_t *test, args_t *a, void **fp) /* * Function: test_test_init * Purpose: Run initialization scripts and routines for a specified test. * Parameters: u - unit # * test - pointer to test description. * a - pointer to arguments. * fp - cookie passed back to test routine. * Returns: 0 - success * -1 - failed. */ { int rv = 0; *fp = NULL; if (sh_set_rctest && (test->t_flags & T_F_RC)) { var_set_integer("testinit", test->t_test, 0, 0); #if defined(BCM_ESW_SUPPORT) #ifndef NO_SAL_APPL if (SOC_IS_XGS(u)) { if (diag_rc_load(u) != CMD_OK) { printk("Test: ERROR: RC init script for test %d (%s) failed\n", test->t_test, test->t_name); rv = -1; } } #endif #endif #if defined(BCM_ROBO_SUPPORT) /* * Do stat init before a specified test for ROBO chips * ESW do this by RC init script(rc.soc) */ if (SOC_IS_ROBO(u)) { bcm_stat_init(u); } #endif /* BCM_ROBO_SUPPORT */ var_unset("testinit", 0, 1, 0); if (rv) { return(rv); } } if (test->t_init_f) { /* Call init function */ if (test->t_init_f(u, a, fp)) { printk("Test: ERROR: Init function for test %d (%s) failed\n", test->t_test, test->t_name); rv = -1; } } return(rv); }