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