From venglin@freebsd.lublin.pl  Mon Apr 30 12:34:53 2001
Return-Path: <venglin@freebsd.lublin.pl>
Received: from yeti.ismedia.pl (yeti.ismedia.pl [212.182.96.18])
	by hub.freebsd.org (Postfix) with SMTP id 6CB7537B423
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 30 Apr 2001 12:34:51 -0700 (PDT)
	(envelope-from venglin@freebsd.lublin.pl)
Received: (qmail 88550 invoked from network); 30 Apr 2001 19:35:53 -0000
Received: from unknown (HELO lagoon.freebsd.lublin.pl) (212.182.115.11)
  by 0 with SMTP; 30 Apr 2001 19:35:53 -0000
Received: (qmail 1173 invoked from network); 30 Apr 2001 19:34:49 -0000
Received: from unknown (HELO riget.scene.pl) ()
  by 0 with SMTP; 30 Apr 2001 19:34:49 -0000
Received: (qmail 1169 invoked by uid 1001); 30 Apr 2001 19:34:48 -0000
Message-Id: <20010430193448.1168.qmail@riget.scene.pl>
Date: 30 Apr 2001 19:34:48 -0000
From: venglin@freebsd.lublin.pl
Reply-To: venglin@freebsd.lublin.pl
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: AMD Athlon Thunderbird not known to identcpu.c
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         26994
>Category:       i386
>Synopsis:       AMD Athlon Thunderbird not known to identcpu.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    obrien
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 30 12:40:00 PDT 2001
>Closed-Date:    Tue Jun 22 14:54:49 GMT 2004
>Last-Modified:  Tue Jun 22 14:54:49 GMT 2004
>Originator:     Przemyslaw Frasunek
>Release:        FreeBSD 4.3-STABLE i386
>Organization:
czuby.net
>Environment:
System: FreeBSD riget.scene.pl 4.3-STABLE FreeBSD 4.3-STABLE #0: Sun Apr 29 11:48:19 CEST 2001 venglin@riget.scene.pl:/mnt/lagoon/usr/src/sys/compile/RIGET i386

>Description:

	AMD Athlon Thunderbird isn't detected by identcpu.c:

	CPU: \^F (908.09-MHz 686-class CPU)
	  Origin = "AuthenticAMD"  Id = 0x642  Stepping = 2

>How-To-Repeat:

	dmesg(8) on machine with Thunderbird installed.
	
>Fix:

	Patch sys/i386/i386/identcpu.c
>Release-Note:
>Audit-Trail:

From: Brian Mitchell <bem@atlanta-bsd.org>
To: freebsd-gnats-submit@FreeBSD.org, venglin@freebsd.lublin.pl
Cc: freebsd-hackers@iss.net
Subject: Re: i386/26994: AMD Athlon Thunderbird not known to identcpu.c
Date: Sat, 16 Jun 2001 17:32:06 -0400

 I don't have a thundrbird, but has far as I know, k6-2+ supports the extended 
 cpuid functions, so something like the following may be appropriate. This 
 worked on my k6-2 and didnt break on any of my other machines (without the 
 #if defined guards, in my case), but I don't know if there are some oddball 
 686es that either dont support cpuid or dont support service 0x80000000 AND 
 do bad things when recieving it.
 
 
 *** identcpu.c.old	Sat Jun 16 16:39:34 2001
 --- identcpu.c	Sat Jun 16 17:19:16 2001
 ***************
 *** 75,80 ****
 --- 75,81 ----
   static void print_AMD_info(u_int amd_maxregs);
   static void print_AMD_assoc(int i);
   static void do_cpuid(u_int ax, u_int *p);
 + static int do_ExtendedCPUID(char *buff);
   
   u_int	cyrix_did;		/* Device ID of Cyrix CPU */
   int cpu_class = CPUCLASS_386;	/* least common denominator */
 ***************
 *** 214,220 ****
   					cpu = CPU_PIII;
   					break;
   				default:
 ! 				        strcat(cpu_model, "Unknown 80686");
   					break;
   				}
   				break;
 --- 215,222 ----
   					cpu = CPU_PIII;
   					break;
   				default:
 ! 					if(do_ExtendedCPUID(cpu_model) < 0)
 ! 				        	strcat(cpu_model, "Unknown 80686");
   					break;
   				}
   				break;
 ***************
 *** 223,229 ****
   				cpu = CPU_P4;
   				break;
   			default:
 ! 				strcat(cpu_model, "unknown");
   				break;
   			}
   
 --- 225,232 ----
   				cpu = CPU_P4;
   				break;
   			default:
 ! 				if(do_ExtendedCPUID(cpu_model) < 0)
 ! 					strcat(cpu_model, "unknown");
   				break;
   			}
   
 ***************
 *** 303,309 ****
   			strcat(cpu_model, "K6-III");
   			break;
   		default:
 ! 			strcat(cpu_model, "Unknown");
   			break;
   		}
   #if defined(I586_CPU) && defined(CPU_WT_ALLOC)
 --- 306,313 ----
   			strcat(cpu_model, "K6-III");
   			break;
   		default:
 ! 			if(do_ExtendedCPUID(cpu_model) < 0)
 ! 				strcat(cpu_model, "Unknown");
   			break;
   		}
   #if defined(I586_CPU) && defined(CPU_WT_ALLOC)
 ***************
 *** 1001,1003 ****
 --- 1005,1078 ----
   		"\0403DNow!"
   		);
   }
 + 
 + /*
 +  * Get the model of the cpu if it is supported by the processor. This
 +  * is probably the ideal way to determine the name of the cpu, if it
 +  * is supported.
 +  *
 +  * Documentation on this can be found at:
 +  * 
 http://developer.intel.com/design/processor/future/manuals/Cpuid_supplement.pdf
 +  */
 + static int
 + do_ExtendedCPUID(char *buff)
 + {
 + #if defined(I686_CPU)
 + 	char cpustring[128];
 + 	unsigned int extCpuidFunc=0;
 + 
 + 	/* get the highest cpuid extended func supported */
 + 	__asm ("
 + 	movl $0x80000000, %%eax
 + 	cpuid
 + 	movl %%eax, %0"
 + 	: "=g" (extCpuidFunc)
 + 	:
 + 	: "eax");
 + 
 + 	/*
 + 	 * if 0x80000002 - 0x80000004 are not supported, than this processor
 + 	 * will not supply us the information we need. We should gracefully
 + 	 * exit in that case.
 + 	 */
 + 	if(extCpuidFunc < 0x80000004)
 + #endif
 + 		return -1;
 + #if defined(I686_CPU)
 + 
 + 	/*
 + 	 * we can now use cpuid services 0x80000002-0x80000004 in order to
 + 	 * fill our buffer 16 bytes at a time (total buffer provided can
 + 	 * be up to 48 bytes).
 + 	 */
 + 	__asm ("
 + 	cld
 + 	lea (%0), %%edi
 + 	movl $0x80000002, %%eax
 + 	cpuid
 + 	movl %%eax, (%%edi)
 + 	movl %%ebx, 4(%%edi)
 + 	movl %%ecx, 8(%%edi)
 + 	movl %%edx, 12(%%edi)
 + 	addl $16, %%edi
 + 	movl $0x80000003, %%edi
 + 	cpuid
 + 	movl %%eax, (%%edi)
 + 	movl %%ebx, 4(%%edi)
 + 	movl %%ecx, 8(%%edi)
 + 	movl %%edx, 12(%%edi)
 + 	addl $16, %%edi
 + 	movl $0x80000004, %%eax
 + 	cpuid
 + 	movl %%eax, (%%edi)
 + 	movl %%ebx, 4(%%edi)
 + 	movl %%ecx, 8(%%edi)
 + 	movl %%edx, 12(%%edi)"
 + 	:
 + 	: "g" (cpustring)
 + 	: "eax", "ebx", "ecx", "edx", "esp");
 + 	strcat(buff, cpustring);
 + 	return 0;
 + #endif
 + }
 + 
Responsible-Changed-From-To: freebsd-bugs->obrien 
Responsible-Changed-By: obrien 
Responsible-Changed-When: Sun Sep 2 10:02:27 PDT 2001 
Responsible-Changed-Why:  
I have an Athon 
. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=26994 

From: Giorgos Keramidas <keramida@freebsd.org>
To: venglin@freebsd.lublin.pl
Cc: bug-followup@freebsd.org
Subject: Re: i386/26994: AMD Athlon Thunderbird not known to identcpu.c
Date: Mon, 8 Apr 2002 23:22:50 +0300

 Adding to audit trail:
 
 > Date: Mon, 1 Apr 2002 09:43:26 +0200
 > From: Przemyslaw Frasunek <venglin@freebsd.lublin.pl>
 >
 >  This PR can be closed now.
 
State-Changed-From-To: open->closed 
State-Changed-By: bms 
State-Changed-When: Tue Jun 22 14:54:34 GMT 2004 
State-Changed-Why:  
Closed at submitter's request 

http://www.freebsd.org/cgi/query-pr.cgi?pr=26994 
>Unformatted:
