nexgen.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 __cpuinit 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 __cpuinit init_nexgen(struct cpuinfo_x86 *c)
  26. {
  27. c->x86_cache_size = 256; /* A few had 1 MB... */
  28. }
  29. static void __cpuinit 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. static struct cpu_dev nexgen_cpu_dev __cpuinitdata = {
  36. .c_vendor = "Nexgen",
  37. .c_ident = { "NexGenDriven" },
  38. .c_models = {
  39. { .vendor = X86_VENDOR_NEXGEN,
  40. .family = 5,
  41. .model_names = { [1] = "Nx586" }
  42. },
  43. },
  44. .c_init = init_nexgen,
  45. .c_identify = nexgen_identify,
  46. };
  47. int __init nexgen_init_cpu(void)
  48. {
  49. cpu_devs[X86_VENDOR_NEXGEN] = &nexgen_cpu_dev;
  50. return 0;
  51. }