cpu.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef ARCH_X86_CPU_H
  3. #define ARCH_X86_CPU_H
  4. /* attempt to consolidate cpu attributes */
  5. struct cpu_dev {
  6. const char *c_vendor;
  7. /* some have two possibilities for cpuid string */
  8. const char *c_ident[2];
  9. void (*c_early_init)(struct cpuinfo_x86 *);
  10. void (*c_bsp_init)(struct cpuinfo_x86 *);
  11. void (*c_init)(struct cpuinfo_x86 *);
  12. void (*c_identify)(struct cpuinfo_x86 *);
  13. void (*c_detect_tlb)(struct cpuinfo_x86 *);
  14. void (*c_bsp_resume)(struct cpuinfo_x86 *);
  15. int c_x86_vendor;
  16. #ifdef CONFIG_X86_32
  17. /* Optional vendor specific routine to obtain the cache size. */
  18. unsigned int (*legacy_cache_size)(struct cpuinfo_x86 *,
  19. unsigned int);
  20. /* Family/stepping-based lookup table for model names. */
  21. struct legacy_cpu_model_info {
  22. int family;
  23. const char *model_names[16];
  24. } legacy_models[5];
  25. #endif
  26. };
  27. struct _tlb_table {
  28. unsigned char descriptor;
  29. char tlb_type;
  30. unsigned int entries;
  31. /* unsigned int ways; */
  32. char info[128];
  33. };
  34. #define cpu_dev_register(cpu_devX) \
  35. static const struct cpu_dev *const __cpu_dev_##cpu_devX __used \
  36. __attribute__((__section__(".x86_cpu_dev.init"))) = \
  37. &cpu_devX;
  38. extern const struct cpu_dev *const __x86_cpu_dev_start[],
  39. *const __x86_cpu_dev_end[];
  40. extern void get_cpu_cap(struct cpuinfo_x86 *c);
  41. extern void cpu_detect_cache_sizes(struct cpuinfo_x86 *c);
  42. unsigned int aperfmperf_get_khz(int cpu);
  43. #endif /* ARCH_X86_CPU_H */