cpuinfo.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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;
  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;
  46. u32 dcache_size;
  47. unsigned long dcache_base;
  48. unsigned long dcache_high;
  49. /* Bus connections */
  50. u32 use_dopb;
  51. u32 use_iopb;
  52. u32 use_dlmb;
  53. u32 use_ilmb;
  54. u32 num_fsl;
  55. /* CPU interrupt line info */
  56. u32 irq_edge;
  57. u32 irq_positive;
  58. u32 area_optimised;
  59. /* HW debug support */
  60. u32 hw_debug;
  61. u32 num_pc_brk;
  62. u32 num_rd_brk;
  63. u32 num_wr_brk;
  64. u32 cpu_clock_freq; /* store real freq of cpu */
  65. u32 freq_div_hz; /* store freq/HZ */
  66. /* FPGA family */
  67. u32 fpga_family_code;
  68. /* User define */
  69. u32 pvr_user1;
  70. u32 pvr_user2;
  71. };
  72. extern struct cpuinfo cpuinfo;
  73. /* fwd declarations of the various CPUinfo populators */
  74. void setup_cpuinfo(void);
  75. void set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu);
  76. void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu);
  77. static inline unsigned int fcpu(struct device_node *cpu, char *n)
  78. {
  79. int *val;
  80. return (val = (int *) of_get_property(cpu, n, NULL)) ? *val : 0;
  81. }
  82. #endif /* _ASM_MICROBLAZE_CPUINFO_H */