net: wifi: rockchip: update broadcom drivers for kernel4.4
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / midgard / mali_kbase_cpuprops.c
old mode 100755 (executable)
new mode 100644 (file)
index a1ef010..5b62539
@@ -1,6 +1,6 @@
 /*
  *
- * (C) COPYRIGHT ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2011-2015 ARM Limited. All rights reserved.
  *
  * This program is free software and is provided to you under the terms of the
  * GNU General Public License version 2 as published by the Free Software
@@ -15,8 +15,7 @@
 
 
 
-/**
- * @file mali_kbase_cpuprops.c
+/*
  * Base kernel property query APIs
  */
 
@@ -26,6 +25,7 @@
 #include "mali_kbase_cpuprops.h"
 #include "mali_kbase_uku.h"
 #include <mali_kbase_config.h>
+#include <mali_kbase_config_defaults.h>
 #include <linux/cache.h>
 #include <linux/cpufreq.h>
 #if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
@@ -36,9 +36,9 @@
 
 #define L1_DCACHE_LINE_SIZE_LOG2 L1_CACHE_SHIFT
 
-/**
- * @brief Macros used to extract cpu id info
- * @see Doc's for Main ID register
+/*
+ * Macros used to extract cpu id info
+ * see documentation for Main ID register
  */
 #define KBASE_CPUPROPS_ID_GET_REV(cpuid)    ((cpuid) & 0x0F)          /* [3:0]   Revision                            */
 #define KBASE_CPUPROPS_ID_GET_PART_NR(cpuid)(((cpuid) >>  4) & 0xFFF) /* [15:4]  Part number                         */
 #define L1_DCACHE_SIZE ((u32)0x00008000)
 
 /**
- * @brief Retrieves detailed CPU info from given cpu_val ( ID reg )
- *
- * @param kbase_props CPU props to be filled-in with cpu id info
+ * kbasep_cpuprops_uk_get_cpu_id_info - Retrieves detailed CPU info from given
+ *                                      cpu_val ( ID reg )
+ * @kbase_props: CPU props to be filled-in with cpu id info
  *
  */
-#if defined(CONFIG_ARM) || defined(CONFIG_ARM64) 
+#if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
 static void kbasep_cpuprops_uk_get_cpu_id_info(struct kbase_uk_cpuprops * const kbase_props)
 {
        kbase_props->props.cpu_id.id           = read_cpuid_id();
@@ -80,7 +80,7 @@ static void kbasep_cpuprops_uk_get_cpu_id_info(struct kbase_uk_cpuprops * const
 }
 #endif
 
-/**
+/*
  * This function (and file!) is kept for the backward compatibility reasons.
  * It shall be removed as soon as KBASE_FUNC_CPU_PROPS_REG_DUMP_OBSOLETE
  * (previously KBASE_FUNC_CPU_PROPS_REG_DUMP) ioctl call
@@ -88,37 +88,38 @@ static void kbasep_cpuprops_uk_get_cpu_id_info(struct kbase_uk_cpuprops * const
  * the function for reading cpu properties moved from base to osu.
  */
 
-mali_error kbase_cpuprops_uk_get_props(struct kbase_context *kctx, struct kbase_uk_cpuprops * const kbase_props)
+int kbase_cpuprops_uk_get_props(struct kbase_context *kctx,
+               struct kbase_uk_cpuprops * const props)
 {
        unsigned int max_cpu_freq;
 
-       kbase_props->props.cpu_l1_dcache_line_size_log2 = L1_DCACHE_LINE_SIZE_LOG2;
-       kbase_props->props.cpu_l1_dcache_size = L1_DCACHE_SIZE;
-       kbase_props->props.cpu_flags = BASE_CPU_PROPERTY_FLAG_LITTLE_ENDIAN;
+       props->props.cpu_l1_dcache_line_size_log2 = L1_DCACHE_LINE_SIZE_LOG2;
+       props->props.cpu_l1_dcache_size = L1_DCACHE_SIZE;
+       props->props.cpu_flags = BASE_CPU_PROPERTY_FLAG_LITTLE_ENDIAN;
 
-       kbase_props->props.nr_cores = NR_CPUS;
-       kbase_props->props.cpu_page_size_log2 = PAGE_SHIFT;
-       kbase_props->props.available_memory_size = totalram_pages << PAGE_SHIFT;
+       props->props.nr_cores = num_possible_cpus();
+       props->props.cpu_page_size_log2 = PAGE_SHIFT;
+       props->props.available_memory_size = totalram_pages << PAGE_SHIFT;
 
-       kbasep_cpuprops_uk_get_cpu_id_info(kbase_props);
+       kbasep_cpuprops_uk_get_cpu_id_info(props);
 
        /* check if kernel supports dynamic frequency scaling */
        max_cpu_freq = cpufreq_quick_get_max(KBASE_DEFAULT_CPU_NUM);
        if (max_cpu_freq != 0) {
                /* convert from kHz to mHz */
-               kbase_props->props.max_cpu_clock_speed_mhz = max_cpu_freq / 1000;
+               props->props.max_cpu_clock_speed_mhz = max_cpu_freq / 1000;
        } else {
                /* fallback if CONFIG_CPU_FREQ turned off */
-               int result;
-               kbase_cpuprops_clock_speed_function kbase_cpuprops_uk_get_clock_speed;
+               int err;
+               kbase_cpu_clk_speed_func get_clock_speed;
 
-               kbase_cpuprops_uk_get_clock_speed = (kbase_cpuprops_clock_speed_function) kbasep_get_config_value(kctx->kbdev, kctx->kbdev->config_attributes, KBASE_CONFIG_ATTR_CPU_SPEED_FUNC);
-               result = kbase_cpuprops_uk_get_clock_speed(&kbase_props->props.max_cpu_clock_speed_mhz);
-               if (result != 0)
-                       return MALI_ERROR_FUNCTION_FAILED;
+               get_clock_speed = (kbase_cpu_clk_speed_func) CPU_SPEED_FUNC;
+               err = get_clock_speed(&props->props.max_cpu_clock_speed_mhz);
+               if (err)
+                       return err;
        }
 
-       return MALI_ERROR_NONE;
+       return 0;
 }
 
 #endif /* BASE_LEGACY_UK7_SUPPORT */