Subject: Re: CPUID patch for recent Intel processors
To: Bang Jun-Young <junyoung@netbsd.org>
From: JORDIVVZ <JORDIVVZ@terra.es>
List: port-i386
Date: 12/18/2002 12:01:28
This is a multi-part message in MIME format.
----1b994ed9317776b3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Sorry for being late, seems to work fine here. I'll atach the dmesg,
maybe it's usefull. Wanna thank Bang Jun-Young for his support and patch.
Thank you.
----- Mensaje Original -----
De: Bang Jun-Young <junyoung@netbsd.org>
Fecha: Viernes, Diciembre 6, 2002 7:44 am
Asunto: CPUID patch for recent Intel processors
> Hi,
>
> People have complaint that NetBSD doesn't properly identify their
> Intelprocessors. I made a patch to address that, here it is:
>
> Index: machdep.c
> ===================================================================
> RCS file: /cvsroot/syssrc/syretrieving revision 1.502
> diff -u -r1.502 machdep.c
> --- machdep.c 2002/12/06 05:03:02 1.502
> +++ machdep.c 2002/12/06 06:42:06
> @@ -315,8 +315,17 @@
> "Celeron", /* Intel (R) Celeron (TM) processor */
> "Pentium III", /* Intel (R) Pentium (R) III
> processor */
> "Pentium III Xeon", /* Intel (R) Pentium (R) III Xeon
> (TM) processor */
> - "", "", "", /* Reserved */
> - "Pentium 4" /* Intel (R) Pentium (R) 4
> processor */
> + "Pentium III", /* Intel (R) Pentium (R) III
> processor */
> + "", /* Reserved */
> + "Mobile Pentium III", /* Mobile Intel (R) Pentium (R) III
> processor-M */
> + "Mobile Celeron", /* Mobile Intel (R) Celeron (R)
> processor */
> + "Pentium 4", /* Intel (R) Pentium (R) 4
> processor */
> + "Pentium 4", /* Intel (R) Pentium (R) 4
> processor */
> + "Celeron", /* Intel (R) Celeron (TM) processor */
> + "Xeon", /* Intel (R) Xeon (TM)
> processor */
> + "Xeon MP", /* Intel (R) Xeon (TM) processor MP */
> + "Mobile Pentium 4", /* Mobile Intel (R) Pentium (R) 4
> processor-M */
> + "Mobile Celeron", /* Mobile Intel (R) Celeron (R)
> processor */
> };
>
> /*
> @@ -344,6 +353,8 @@
> static void via_cpu_probe __P((struct cpu_info *));
> static void amd_family6_probe __P((struct cpu_info *));
>
> +static const char *intel_family6_name __P((struct cpu_info *));
> +
> static void transmeta_cpu_info __P((struct cpu_info *));
> static void amd_cpu_cacheinfo __P((struct cpu_info *));
>
> @@ -1122,6 +1133,62 @@
> }
> }
>
> +const char *
> +intel_family6_name(struct cpu_info *ci)
> +{
> + int model = CPUID2MODEL(ci->ci_signature);
> + const char *ret = NULL;
> + u_int l2cache = ci->ci_cinfo[CAI_L2CACHE].cai_totalsize;
> +
> + switch (model) {
> + case 5:
> + switch (l2cache) {
> + case 0:
> + case 128 * 1024:
> + ret = "Celeron (Covington)";
> + break;
> + case 256 * 1024:
> + ret = "Mobile Pentium II (Dixon)";
> + break;
> + case 512 * 1024:
> + ret = "Pentium II";
> + break;
> + case 1 * 1024 * 1024:
> + case 2 * 1024 * 1024:
> + ret = "Pentium II Xeon";
> + break;
> + }
> + break;
> + case 6:
> + switch (l2cache) {
> + case 256 * 1024:
> + ret = "Mobile Pentium II";
> + break;
> + case 512 * 1024:
> + ret = "Mobile Pentium II w/512 KB L2 cache";
> + break;
> + }
> + break;
> + case 7:
> + switch (l2cache) {
> + case 512 * 1024:
> + ret = "Pentium III";
> + break;
> + case 1 * 1024 * 1024:
> + case 2 * 1024 * 1024:
> + ret = "Pentium III Xeon";
> + break;
> + }
> + break;
> + case 8:
> + if (ci->ci_brand_id && ci->ci_brand_id < 0x10)
> + ret = i386_intel_brand[ci->ci_brand_id];
> + break;
> + }
> +
> + return (ret);
> +}
> +
> static void
> cpu_probe_base_features(struct cpu_info *ci)
> {
> @@ -1724,7 +1791,7 @@
> } else {
> max = sizeof (i386_cpuid_cpus) / sizeof
> (i386_cpuid_cpus[0]); modif = (ci->ci_signature >>
> 12) & 0x3;
> - family = (ci->ci_signature >> 8) & 0xf;
> + family = CPUID2FAMILY(ci->ci_signature);
> if (family < CPU_MINFAMILY)
> panic("identifycpu: strange family value");
> model = CPUID2MODEL(ci->ci_signature);
> @@ -1772,14 +1839,12 @@
> ci->cpu_setup = cpufam->cpu_setup;
> ci->ci_info = cpufam->cpu_info;
>
> - /*
> - * Intel processors family >= 6, model 8
> allow to
> - * recognize brand by Brand ID value.
> - */
> - if (vendor == CPUVENDOR_INTEL && family
> >= 6 &&
> - model >= 8 && ci->ci_brand_id &&
> - ci->ci_brand_id < 8)
> - brand = i386_intel_brand[ci-
> >ci_brand_id];+ if (vendor ==
> CPUVENDOR_INTEL && family == 6 &&
> + model >= 5 && model <= 8) {
> + const char *tmp =
> intel_family6_name(ci);+ if (tmp !=
> NULL)+ name = tmp;
> + }
>
> if (vendor == CPUVENDOR_AMD && family ==
> 6 &&
> model >= 6) {
>
> Since I have no Intel processor based machine at home, I can't
> test the
> patch myself. I'd appreciate it if you Intel users would do it.
>
> Jun-Young
>
> --
> Bang Jun-Young <junyoung@netbsd.org>
>
----1b994ed9317776b3
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="dmesg.current"
TmV0QlNEIDEuNksgKEdFTkVSSUMpICMwOiBXZWQgRGVjIDE4IDEyOjM3OjI4IENFVCAyMDAy
CiAgICByb290QG5vdGVib29rLnZ2ei54czRhbGwubmw6L3Vzci9zcmMvc3lzL2FyY2gvaTM4
Ni9jb21waWxlL0dFTkVSSUMKdG90YWwgbWVtb3J5ID0gMTI3IE1CCmF2YWlsIG1lbW9yeSA9
IDExMSBNQgp1c2luZyAxNjU4IGJ1ZmZlcnMgY29udGFpbmluZyA2NjMyIEtCIG9mIG1lbW9y
eQpCSU9TMzIgcmV2LiAwIGZvdW5kIGF0IDB4ZjAwMDAKbWFpbmJ1czAgKHJvb3QpCmNwdTAg
YXQgbWFpbmJ1czA6ICh1bmlwcm9jZXNzb3IpCmNwdTA6IEludGVsIE1vYmlsZSBQZW50aXVt
IElJICg2ODYtY2xhc3MpLCAzMzMuMzcgTUh6LCBpZCAweDY2YQpjcHUwOiBmZWF0dXJlcyAx
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