Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi Add DMI quirk support via pmf_get_platform(9). ...



details:   https://anonhg.NetBSD.org/src/rev/a8d09fdcb3ed
branches:  trunk
changeset: 762861:a8d09fdcb3ed
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Thu Mar 03 19:24:43 2011 +0000

description:
Add DMI quirk support via pmf_get_platform(9). If any of the listed models
are matched, the whole driver will be prevented from attaching. The first
entry is Supermicro PDSMi-LN4+ (a BIOS bug with bogus P-state entries).

diffstat:

 sys/dev/acpi/acpi_cpu.c |  29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diffs (62 lines):

diff -r 7fdb37ff38e5 -r a8d09fdcb3ed sys/dev/acpi/acpi_cpu.c
--- a/sys/dev/acpi/acpi_cpu.c   Thu Mar 03 18:44:58 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu.c   Thu Mar 03 19:24:43 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.35 2011/03/02 06:17:08 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.36 2011/03/03 19:24:43 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.35 2011/03/02 06:17:08 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.36 2011/03/03 19:24:43 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -78,6 +78,14 @@
 static bool              acpicpu_dynamic = true;
 static bool              acpicpu_passive = true;
 
+static const struct {
+       const char       *manu;
+       const char       *prod;
+       const char       *vers;
+} acpicpu_quirks[] = {
+       { "Supermicro", "PDSMi-LN4", "0123456789" },
+};
+
 static const char * const acpicpu_hid[] = {
        "ACPI0007",
        NULL
@@ -89,11 +97,28 @@
 static int
 acpicpu_match(device_t parent, cfdata_t match, void *aux)
 {
+       const char *manu, *prod, *vers;
        struct cpu_info *ci;
+       size_t i;
 
        if (acpi_softc == NULL)
                return 0;
 
+       manu = pmf_get_platform("system-manufacturer");
+       prod = pmf_get_platform("system-product-name");
+       vers = pmf_get_platform("system-version");
+
+       if (manu != NULL && prod != NULL && vers != NULL) {
+
+               for (i = 0; i < __arraycount(acpicpu_quirks); i++) {
+
+                       if (strcasecmp(acpicpu_quirks[i].manu, manu) == 0 &&
+                           strcasecmp(acpicpu_quirks[i].prod, prod) == 0 &&
+                           strcasecmp(acpicpu_quirks[i].vers, vers) == 0)
+                               return 0;
+               }
+       }
+
        ci = acpicpu_md_match(parent, match, aux);
 
        if (ci == NULL)



Home | Main Index | Thread Index | Old Index