Path: blob/master/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
26481 views
/*1* Support for MicroBlaze PVR (processor version register)2*3* Copyright (C) 2007-2009 Michal Simek <[email protected]>4* Copyright (C) 2007-2009 PetaLogix5* Copyright (C) 2007 John Williams <[email protected]>6*7* This file is subject to the terms and conditions of the GNU General Public8* License. See the file "COPYING" in the main directory of this archive9* for more details.10*/1112#include <linux/init.h>13#include <linux/string.h>14#include <asm/pvr.h>15#include <asm/cpuinfo.h>1617/*18* Helper macro to map between fields in our struct cpuinfo, and19* the PVR macros in pvr.h.20*/2122#define CI(c, p) { ci->c = PVR_##p(pvr); }2324#define err_printk(x) \25pr_err("ERROR: Microblaze " x "-different for PVR and DTS\n");2627void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu)28{29struct pvr_s pvr;30u32 temp; /* for saving temp value */31get_pvr(&pvr);3233CI(ver_code, VERSION);34if (!ci->ver_code) {35pr_err("ERROR: MB has broken PVR regs -> use DTS setting\n");36return;37}3839temp = PVR_USE_BARREL(pvr) | PVR_USE_MSR_INSTR(pvr) |40PVR_USE_PCMP_INSTR(pvr) | PVR_USE_DIV(pvr);41if (ci->use_instr != temp)42err_printk("BARREL, MSR, PCMP or DIV");43ci->use_instr = temp;4445temp = PVR_USE_HW_MUL(pvr) | PVR_USE_MUL64(pvr);46if (ci->use_mult != temp)47err_printk("HW_MUL");48ci->use_mult = temp;4950temp = PVR_USE_FPU(pvr) | PVR_USE_FPU2(pvr);51if (ci->use_fpu != temp)52err_printk("HW_FPU");53ci->use_fpu = temp;5455ci->use_exc = PVR_OPCODE_0x0_ILLEGAL(pvr) |56PVR_UNALIGNED_EXCEPTION(pvr) |57PVR_ILL_OPCODE_EXCEPTION(pvr) |58PVR_IOPB_BUS_EXCEPTION(pvr) |59PVR_DOPB_BUS_EXCEPTION(pvr) |60PVR_DIV_ZERO_EXCEPTION(pvr) |61PVR_FPU_EXCEPTION(pvr) |62PVR_FSL_EXCEPTION(pvr);6364CI(pvr_user1, USER1);65CI(pvr_user2, USER2);6667CI(mmu, USE_MMU);68CI(mmu_privins, MMU_PRIVINS);69CI(endian, ENDIAN);7071CI(use_icache, USE_ICACHE);72CI(icache_tagbits, ICACHE_ADDR_TAG_BITS);73CI(icache_write, ICACHE_ALLOW_WR);74ci->icache_line_length = PVR_ICACHE_LINE_LEN(pvr) << 2;75CI(icache_size, ICACHE_BYTE_SIZE);76CI(icache_base, ICACHE_BASEADDR);77CI(icache_high, ICACHE_HIGHADDR);7879CI(use_dcache, USE_DCACHE);80CI(dcache_tagbits, DCACHE_ADDR_TAG_BITS);81CI(dcache_write, DCACHE_ALLOW_WR);82ci->dcache_line_length = PVR_DCACHE_LINE_LEN(pvr) << 2;83CI(dcache_size, DCACHE_BYTE_SIZE);84CI(dcache_base, DCACHE_BASEADDR);85CI(dcache_high, DCACHE_HIGHADDR);8687temp = PVR_DCACHE_USE_WRITEBACK(pvr);88if (ci->dcache_wb != temp)89err_printk("DCACHE WB");90ci->dcache_wb = temp;9192CI(use_dopb, D_OPB);93CI(use_iopb, I_OPB);94CI(use_dlmb, D_LMB);95CI(use_ilmb, I_LMB);96CI(num_fsl, FSL_LINKS);9798CI(irq_edge, INTERRUPT_IS_EDGE);99CI(irq_positive, EDGE_IS_POSITIVE);100101CI(area_optimised, AREA_OPTIMISED);102103CI(hw_debug, DEBUG_ENABLED);104CI(num_pc_brk, NUMBER_OF_PC_BRK);105CI(num_rd_brk, NUMBER_OF_RD_ADDR_BRK);106CI(num_wr_brk, NUMBER_OF_WR_ADDR_BRK);107108CI(fpga_family_code, TARGET_FAMILY);109}110111112