cpuinfo-pvr-full.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Support for MicroBlaze PVR (processor version register)
  3. *
  4. * Copyright (C) 2007-2009 Michal Simek <[email protected]>
  5. * Copyright (C) 2007-2009 PetaLogix
  6. * Copyright (C) 2007 John Williams <[email protected]>
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file "COPYING" in the main directory of this archive
  10. * for more details.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/string.h>
  14. #include <asm/pvr.h>
  15. #include <asm/cpuinfo.h>
  16. /*
  17. * Helper macro to map between fields in our struct cpuinfo, and
  18. * the PVR macros in pvr.h.
  19. */
  20. #define CI(c, p) { ci->c = PVR_##p(pvr); }
  21. #define err_printk(x) \
  22. pr_err("ERROR: Microblaze " x "-different for PVR and DTS\n");
  23. void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu)
  24. {
  25. struct pvr_s pvr;
  26. u32 temp; /* for saving temp value */
  27. get_pvr(&pvr);
  28. CI(ver_code, VERSION);
  29. if (!ci->ver_code) {
  30. pr_err("ERROR: MB has broken PVR regs -> use DTS setting\n");
  31. return;
  32. }
  33. temp = PVR_USE_BARREL(pvr) | PVR_USE_MSR_INSTR(pvr) |
  34. PVR_USE_PCMP_INSTR(pvr) | PVR_USE_DIV(pvr);
  35. if (ci->use_instr != temp)
  36. err_printk("BARREL, MSR, PCMP or DIV");
  37. ci->use_instr = temp;
  38. temp = PVR_USE_HW_MUL(pvr) | PVR_USE_MUL64(pvr);
  39. if (ci->use_mult != temp)
  40. err_printk("HW_MUL");
  41. ci->use_mult = temp;
  42. temp = PVR_USE_FPU(pvr) | PVR_USE_FPU2(pvr);
  43. if (ci->use_fpu != temp)
  44. err_printk("HW_FPU");
  45. ci->use_fpu = temp;
  46. ci->use_exc = PVR_OPCODE_0x0_ILLEGAL(pvr) |
  47. PVR_UNALIGNED_EXCEPTION(pvr) |
  48. PVR_ILL_OPCODE_EXCEPTION(pvr) |
  49. PVR_IOPB_BUS_EXCEPTION(pvr) |
  50. PVR_DOPB_BUS_EXCEPTION(pvr) |
  51. PVR_DIV_ZERO_EXCEPTION(pvr) |
  52. PVR_FPU_EXCEPTION(pvr) |
  53. PVR_FSL_EXCEPTION(pvr);
  54. CI(pvr_user1, USER1);
  55. CI(pvr_user2, USER2);
  56. CI(mmu, USE_MMU);
  57. CI(mmu_privins, MMU_PRIVINS);
  58. CI(endian, ENDIAN);
  59. CI(use_icache, USE_ICACHE);
  60. CI(icache_tagbits, ICACHE_ADDR_TAG_BITS);
  61. CI(icache_write, ICACHE_ALLOW_WR);
  62. ci->icache_line_length = PVR_ICACHE_LINE_LEN(pvr) << 2;
  63. CI(icache_size, ICACHE_BYTE_SIZE);
  64. CI(icache_base, ICACHE_BASEADDR);
  65. CI(icache_high, ICACHE_HIGHADDR);
  66. CI(use_dcache, USE_DCACHE);
  67. CI(dcache_tagbits, DCACHE_ADDR_TAG_BITS);
  68. CI(dcache_write, DCACHE_ALLOW_WR);
  69. ci->dcache_line_length = PVR_DCACHE_LINE_LEN(pvr) << 2;
  70. CI(dcache_size, DCACHE_BYTE_SIZE);
  71. CI(dcache_base, DCACHE_BASEADDR);
  72. CI(dcache_high, DCACHE_HIGHADDR);
  73. temp = PVR_DCACHE_USE_WRITEBACK(pvr);
  74. if (ci->dcache_wb != temp)
  75. err_printk("DCACHE WB");
  76. ci->dcache_wb = temp;
  77. CI(use_dopb, D_OPB);
  78. CI(use_iopb, I_OPB);
  79. CI(use_dlmb, D_LMB);
  80. CI(use_ilmb, I_LMB);
  81. CI(num_fsl, FSL_LINKS);
  82. CI(irq_edge, INTERRUPT_IS_EDGE);
  83. CI(irq_positive, EDGE_IS_POSITIVE);
  84. CI(area_optimised, AREA_OPTIMISED);
  85. CI(hw_debug, DEBUG_ENABLED);
  86. CI(num_pc_brk, NUMBER_OF_PC_BRK);
  87. CI(num_rd_brk, NUMBER_OF_RD_ADDR_BRK);
  88. CI(num_wr_brk, NUMBER_OF_WR_ADDR_BRK);
  89. CI(fpga_family_code, TARGET_FAMILY);
  90. }