* along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <linux/acpi.h>
 #include <linux/cacheinfo.h>
 #include <linux/of.h>
 
 
 static int __init_cache_level(unsigned int cpu)
 {
-       unsigned int ctype, level, leaves, of_level;
+       unsigned int ctype, level, leaves, fw_level;
        struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
 
        for (level = 1, leaves = 0; level <= MAX_CACHE_LEVEL; level++) {
                leaves += (ctype == CACHE_TYPE_SEPARATE) ? 2 : 1;
        }
 
-       of_level = of_find_last_cache_level(cpu);
-       if (level < of_level) {
+       if (acpi_disabled)
+               fw_level = of_find_last_cache_level(cpu);
+       else
+               fw_level = acpi_find_last_cache_level(cpu);
+
+       if (level < fw_level) {
                /*
                 * some external caches not specified in CLIDR_EL1
                 * the information may be available in the device tree
                 * only unified external caches are considered here
                 */
-               leaves += (of_level - level);
-               level = of_level;
+               leaves += (fw_level - level);
+               level = fw_level;
        }
 
        this_cpu_ci->num_levels = level;