cpu.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef ARCH_X86_CPU_H
  2. #define ARCH_X86_CPU_H
  3. struct cpu_model_info {
  4. int vendor;
  5. int family;
  6. const char *model_names[16];
  7. };
  8. /* attempt to consolidate cpu attributes */
  9. struct cpu_dev {
  10. const char *c_vendor;
  11. /* some have two possibilities for cpuid string */
  12. const char *c_ident[2];
  13. struct cpu_model_info c_models[4];
  14. void (*c_early_init)(struct cpuinfo_x86 *);
  15. void (*c_bsp_init)(struct cpuinfo_x86 *);
  16. void (*c_init)(struct cpuinfo_x86 *);
  17. void (*c_identify)(struct cpuinfo_x86 *);
  18. void (*c_detect_tlb)(struct cpuinfo_x86 *);
  19. unsigned int (*c_size_cache)(struct cpuinfo_x86 *, unsigned int);
  20. int c_x86_vendor;
  21. };
  22. struct _tlb_table {
  23. unsigned char descriptor;
  24. char tlb_type;
  25. unsigned int entries;
  26. /* unsigned int ways; */
  27. char info[128];
  28. };
  29. #define cpu_dev_register(cpu_devX) \
  30. static const struct cpu_dev *const __cpu_dev_##cpu_devX __used \
  31. __attribute__((__section__(".x86_cpu_dev.init"))) = \
  32. &cpu_devX;
  33. extern const struct cpu_dev *const __x86_cpu_dev_start[],
  34. *const __x86_cpu_dev_end[];
  35. extern void get_cpu_cap(struct cpuinfo_x86 *c);
  36. extern void cpu_detect_cache_sizes(struct cpuinfo_x86 *c);
  37. #endif /* ARCH_X86_CPU_H */