cpuinfo.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Generic support for queying CPU info
  3. *
  4. * Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu>
  5. * Copyright (C) 2007-2009 PetaLogix
  6. * Copyright (C) 2007 John Williams <jwilliams@itee.uq.edu.au>
  7. *
  8. * This file is subject to the terms and conditions of the GNU General
  9. * Public License. See the file COPYING in the main directory of this
  10. * archive for more details.
  11. */
  12. #ifndef _ASM_MICROBLAZE_CPUINFO_H
  13. #define _ASM_MICROBLAZE_CPUINFO_H
  14. #include <asm/prom.h>
  15. /* CPU Version and FPGA Family code conversion table type */
  16. struct cpu_ver_key {
  17. const char *s;
  18. const unsigned k;
  19. };
  20. extern const struct cpu_ver_key cpu_ver_lookup[];
  21. struct family_string_key {
  22. const char *s;
  23. const unsigned k;
  24. };
  25. extern const struct family_string_key family_string_lookup[];
  26. struct cpuinfo {
  27. /* Core CPU configuration */
  28. u32 use_instr;
  29. u32 use_mult;
  30. u32 use_fpu;
  31. u32 use_exc;
  32. u32 ver_code;
  33. u32 mmu;
  34. /* CPU caches */
  35. u32 use_icache;
  36. u32 icache_tagbits;
  37. u32 icache_write;
  38. u32 icache_line_length;
  39. u32 icache_size;
  40. unsigned long icache_base;
  41. unsigned long icache_high;
  42. u32 use_dcache;
  43. u32 dcache_tagbits;
  44. u32 dcache_write;
  45. u32 dcache_line_length;
  46. u32 dcache_size;
  47. u32 dcache_wb;
  48. unsigned long dcache_base;
  49. unsigned long dcache_high;
  50. /* Bus connections */
  51. u32 use_dopb;
  52. u32 use_iopb;
  53. u32 use_dlmb;
  54. u32 use_ilmb;
  55. u32 num_fsl;
  56. /* CPU interrupt line info */
  57. u32 irq_edge;
  58. u32 irq_positive;
  59. u32 area_optimised;
  60. /* HW debug support */
  61. u32 hw_debug;
  62. u32 num_pc_brk;
  63. u32 num_rd_brk;
  64. u32 num_wr_brk;
  65. u32 cpu_clock_freq; /* store real freq of cpu */
  66. u32 freq_div_hz; /* store freq/HZ */
  67. /* FPGA family */
  68. u32 fpga_family_code;
  69. /* User define */
  70. u32 pvr_user1;
  71. u32 pvr_user2;
  72. };
  73. extern struct cpuinfo cpuinfo;
  74. /* fwd declarations of the various CPUinfo populators */
  75. void setup_cpuinfo(void);
  76. void set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu);
  77. void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu);
  78. static inline unsigned int fcpu(struct device_node *cpu, char *n)
  79. {
  80. int *val;
  81. return (val = (int *) of_get_property(cpu, n, NULL)) ? *val : 0;
  82. }
  83. #endif /* _ASM_MICROBLAZE_CPUINFO_H */