MFamd64: Break up the probe logic in the mem_drvinit routines so it's

a bit easier to parse.
This commit is contained in:
jhb 2008-03-12 21:44:46 +00:00
parent 0794c13d8e
commit 93c9f42d65
2 changed files with 18 additions and 13 deletions

View File

@ -653,12 +653,15 @@ static void
i686_mem_drvinit(void *unused)
{
/* Try for i686 MTRRs */
if (!mtrrs_disabled && (cpu_feature & CPUID_MTRR) &&
((cpu_id & 0xf00) == 0x600 || (cpu_id & 0xf00) == 0xf00) &&
((strcmp(cpu_vendor, "GenuineIntel") == 0) ||
(strcmp(cpu_vendor, "AuthenticAMD") == 0))) {
mem_range_softc.mr_op = &i686_mrops;
}
if (mtrrs_disabled)
return;
if (!(cpu_feature & CPUID_MTRR))
return;
if ((cpu_id & 0xf00) != 0x600 && (cpu_id & 0xf00) != 0xf00)
return;
if ((strcmp(cpu_vendor, "GenuineIntel") != 0) &&
(strcmp(cpu_vendor, "AuthenticAMD") != 0))
return;
mem_range_softc.mr_op = &i686_mrops;
}
SYSINIT(i686memdev, SI_SUB_DRIVERS, SI_ORDER_FIRST, i686_mem_drvinit, NULL);

View File

@ -175,11 +175,13 @@ static void
k6_mem_drvinit(void *unused)
{
if (!strcmp(cpu_vendor, "AuthenticAMD") &&
(cpu_id & 0xf00) == 0x500 &&
((cpu_id & 0xf0) > 0x80 ||
((cpu_id & 0xf0) == 0x80 &&
(cpu_id & 0xf) > 0x7)))
mem_range_softc.mr_op = &k6_mrops;
if (strcmp(cpu_vendor, "AuthenticAMD") != 0)
return;
if ((cpu_id & 0xf00) != 0x500)
return;
if ((cpu_id & 0xf0) < 0x80 ||
(cpu_id & 0xf0) == 0x80 && (cpu_id & 0xf) <= 0x7)
return;
mem_range_softc.mr_op = &k6_mrops;
}
SYSINIT(k6memdev, SI_SUB_DRIVERS, SI_ORDER_FIRST, k6_mem_drvinit, NULL);