_mali_osk_errcode_t mali_dlbu_add_group(struct mali_dlbu_core *dlbu, struct mali_group *group) { _mali_osk_errcode_t err = _MALI_OSK_ERR_FAULT; u32 wval, rval; struct mali_pp_core *pp_core = mali_group_get_pp_core(group); /* find the core id and set the mask */ if (NULL != pp_core) { wval = mali_pp_core_get_id(pp_core); rval = mali_hw_core_register_read(&dlbu->hw_core, MALI_DLBU_REGISTER_PP_ENABLE_MASK); mali_hw_core_register_write(&dlbu->hw_core, MALI_DLBU_REGISTER_PP_ENABLE_MASK, (wval << 0x1) | rval); err = _MALI_OSK_ERR_OK; } return err; }
int mali_sysfs_register(struct mali_dev *device, dev_t dev, const char *mali_dev_name) { int err = 0; device->mali_class = class_create(THIS_MODULE, mali_dev_name); if (IS_ERR(device->mali_class)) { err = PTR_ERR(device->mali_class); goto init_class_err; } mali_device = device_create(device->mali_class, NULL, dev, NULL, mali_dev_name); if (IS_ERR(mali_device)) { err = PTR_ERR(mali_device); goto init_mdev_err; } mali_debugfs_dir = debugfs_create_dir(mali_dev_name, NULL); if(ERR_PTR(-ENODEV) == mali_debugfs_dir) { /* Debugfs not supported. */ mali_debugfs_dir = NULL; } else { if(NULL != mali_debugfs_dir) { /* Debugfs directory created successfully; create files now */ struct dentry *mali_power_dir; struct dentry *mali_gp_dir; struct dentry *mali_pp_dir; struct dentry *mali_l2_dir; #if MALI_INTERNAL_TIMELINE_PROFILING_ENABLED struct dentry *mali_profiling_dir; #endif mali_power_dir = debugfs_create_dir("power", mali_debugfs_dir); if (mali_power_dir != NULL) { debugfs_create_file("power_events", 0400, mali_power_dir, NULL, &power_events_fops); } mali_gp_dir = debugfs_create_dir("gp", mali_debugfs_dir); if (mali_gp_dir != NULL) { struct dentry *mali_gp_all_dir; u32 ci; struct mali_cluster *cluster; mali_gp_all_dir = debugfs_create_dir("all", mali_gp_dir); if (mali_gp_all_dir != NULL) { debugfs_create_file("counter_src0", 0400, mali_gp_all_dir, NULL, &gp_all_counter_src0_fops); debugfs_create_file("counter_src1", 0400, mali_gp_all_dir, NULL, &gp_all_counter_src1_fops); } ci = 0; cluster = mali_cluster_get_global_cluster(ci); while (NULL != cluster) { u32 gi = 0; struct mali_group *group = mali_cluster_get_group(cluster, gi); while (NULL != group) { struct mali_gp_core *gp_core = mali_group_get_gp_core(group); if (NULL != gp_core) { struct dentry *mali_gp_gpx_dir; mali_gp_gpx_dir = debugfs_create_dir("gp0", mali_gp_dir); if (NULL != mali_gp_gpx_dir) { debugfs_create_file("counter_src0", 0600, mali_gp_gpx_dir, gp_core, &gp_gpx_counter_src0_fops); debugfs_create_file("counter_src1", 0600, mali_gp_gpx_dir, gp_core, &gp_gpx_counter_src1_fops); } break; /* no need to look for any other GP cores */ } /* try next group */ gi++; group = mali_cluster_get_group(cluster, gi); } /* try next cluster */ ci++; cluster = mali_cluster_get_global_cluster(ci); } } mali_pp_dir = debugfs_create_dir("pp", mali_debugfs_dir); if (mali_pp_dir != NULL) { struct dentry *mali_pp_all_dir; u32 ci; struct mali_cluster *cluster; mali_pp_all_dir = debugfs_create_dir("all", mali_pp_dir); if (mali_pp_all_dir != NULL) { debugfs_create_file("counter_src0", 0400, mali_pp_all_dir, NULL, &pp_all_counter_src0_fops); debugfs_create_file("counter_src1", 0400, mali_pp_all_dir, NULL, &pp_all_counter_src1_fops); } ci = 0; cluster = mali_cluster_get_global_cluster(ci); while (NULL != cluster) { u32 gi = 0; struct mali_group *group = mali_cluster_get_group(cluster, gi); while (NULL != group) { struct mali_pp_core *pp_core = mali_group_get_pp_core(group); if (NULL != pp_core) { char buf[16]; struct dentry *mali_pp_ppx_dir; _mali_osk_snprintf(buf, sizeof(buf), "pp%u", mali_pp_core_get_id(pp_core)); mali_pp_ppx_dir = debugfs_create_dir(buf, mali_pp_dir); if (NULL != mali_pp_ppx_dir) { debugfs_create_file("counter_src0", 0600, mali_pp_ppx_dir, pp_core, &pp_ppx_counter_src0_fops); debugfs_create_file("counter_src1", 0600, mali_pp_ppx_dir, pp_core, &pp_ppx_counter_src1_fops); } } /* try next group */ gi++; group = mali_cluster_get_group(cluster, gi); } /* try next cluster */ ci++; cluster = mali_cluster_get_global_cluster(ci); } } mali_l2_dir = debugfs_create_dir("l2", mali_debugfs_dir); if (mali_l2_dir != NULL) { struct dentry *mali_l2_all_dir; u32 l2_id; struct mali_l2_cache_core *l2_cache; mali_l2_all_dir = debugfs_create_dir("all", mali_l2_dir); if (mali_l2_all_dir != NULL) { debugfs_create_file("counter_src0", 0400, mali_l2_all_dir, NULL, &l2_all_counter_src0_fops); debugfs_create_file("counter_src1", 0400, mali_l2_all_dir, NULL, &l2_all_counter_src1_fops); } l2_id = 0; l2_cache = mali_l2_cache_core_get_glob_l2_core(l2_id); while (NULL != l2_cache) { char buf[16]; struct dentry *mali_l2_l2x_dir; _mali_osk_snprintf(buf, sizeof(buf), "l2%u", l2_id); mali_l2_l2x_dir = debugfs_create_dir(buf, mali_l2_dir); if (NULL != mali_l2_l2x_dir) { debugfs_create_file("counter_src0", 0600, mali_l2_l2x_dir, l2_cache, &l2_l2x_counter_src0_fops); debugfs_create_file("counter_src1", 0600, mali_l2_l2x_dir, l2_cache, &l2_l2x_counter_src1_fops); } /* try next L2 */ l2_id++; l2_cache = mali_l2_cache_core_get_glob_l2_core(l2_id); } } debugfs_create_file("memory_usage", 0400, mali_debugfs_dir, NULL, &memory_usage_fops); #if MALI_INTERNAL_TIMELINE_PROFILING_ENABLED mali_profiling_dir = debugfs_create_dir("profiling", mali_debugfs_dir); if (mali_profiling_dir != NULL) { struct dentry *mali_profiling_proc_dir = debugfs_create_dir("proc", mali_profiling_dir); if (mali_profiling_proc_dir != NULL) { struct dentry *mali_profiling_proc_default_dir = debugfs_create_dir("default", mali_profiling_proc_dir); if (mali_profiling_proc_default_dir != NULL) { debugfs_create_file("enable", 0600, mali_profiling_proc_default_dir, (void*)_MALI_UK_USER_SETTING_SW_EVENTS_ENABLE, &user_settings_fops); } } debugfs_create_file("record", 0600, mali_profiling_dir, NULL, &profiling_record_fops); debugfs_create_file("events", 0400, mali_profiling_dir, NULL, &profiling_events_fops); } #endif #if MALI_STATE_TRACKING debugfs_create_file("state_dump", 0400, mali_debugfs_dir, NULL, &mali_seq_internal_state_fops); #endif if (mali_sysfs_user_settings_register()) { /* Failed to create the debugfs entries for the user settings DB. */ MALI_DEBUG_PRINT(2, ("Failed to create user setting debugfs files. Ignoring...\n")); } } } /* Success! */ return 0; /* Error handling */ init_mdev_err: class_destroy(device->mali_class); init_class_err: return err; }