nexgen.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #include <linux/kernel.h>
  2. #include <linux/init.h>
  3. #include <linux/string.h>
  4. #include <asm/processor.h>
  5. #include "cpu.h"
  6. /*
  7. * Detect a NexGen CPU running without BIOS hypercode new enough
  8. * to have CPUID. (Thanks to Herbert Oppmann)
  9. */
  10. static int __init deep_magic_nexgen_probe(void)
  11. {
  12. int ret;
  13. __asm__ __volatile__ (
  14. " movw $0x5555, %%ax\n"
  15. " xorw %%dx,%%dx\n"
  16. " movw $2, %%cx\n"
  17. " divw %%cx\n"
  18. " movl $0, %%eax\n"
  19. " jnz 1f\n"
  20. " movl $1, %%eax\n"
  21. "1:\n"
  22. : "=a" (ret) : : "cx", "dx" );
  23. return ret;
  24. }
  25. static void __init init_nexgen(struct cpuinfo_x86 * c)
  26. {
  27. c->x86_cache_size = 256; /* A few had 1 MB... */
  28. }
  29. static void __init nexgen_identify(struct cpuinfo_x86 * c)
  30. {
  31. /* Detect NexGen with old hypercode */
  32. if ( deep_magic_nexgen_probe() ) {
  33. strcpy(c->x86_vendor_id, "NexGenDriven");
  34. }
  35. generic_identify(c);
  36. }
  37. static struct cpu_dev nexgen_cpu_dev __initdata = {
  38. .c_vendor = "Nexgen",
  39. .c_ident = { "NexGenDriven" },
  40. .c_models = {
  41. { .vendor = X86_VENDOR_NEXGEN,
  42. .family = 5,
  43. .model_names = { [1] = "Nx586" }
  44. },
  45. },
  46. .c_init = init_nexgen,
  47. .c_identify = nexgen_identify,
  48. };
  49. int __init nexgen_init_cpu(void)
  50. {
  51. cpu_devs[X86_VENDOR_NEXGEN] = &nexgen_cpu_dev;
  52. return 0;
  53. }
  54. //early_arch_initcall(nexgen_init_cpu);