From owner-freebsd-acpi@FreeBSD.ORG Thu Nov 4 11:32:59 2004 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 06FE516A4CE; Thu, 4 Nov 2004 11:32:59 +0000 (GMT) Received: from gateway.nixsys.be (gateway.nixsys.be [195.144.77.33]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3F62143D31; Thu, 4 Nov 2004 11:32:58 +0000 (GMT) (envelope-from philip@paeps.cx) Received: from erda.home.paeps.cx (erda.home.paeps.cx [IPv6:2001:838:37f:10::1]) by gateway.nixsys.be (Postfix) with ESMTP id 5CF705D; Thu, 4 Nov 2004 12:32:56 +0100 (CET) Received: from fasolt.home.paeps.cx (fasolt.home.paeps.cx [10.0.0.2]) by erda.home.paeps.cx (Postfix) with ESMTP id 620D02103; Thu, 4 Nov 2004 12:27:43 +0100 (CET) Received: from fasolt.home.paeps.cx (philip@localhost [127.0.0.1]) by fasolt.home.paeps.cx (8.13.1/8.13.1) with ESMTP id iA4BRwT7031642; Thu, 4 Nov 2004 12:27:58 +0100 (CET) (envelope-from philip@fasolt.home.paeps.cx) Received: (from philip@localhost) by fasolt.home.paeps.cx (8.13.1/8.13.1/Submit) id iA4BRvVc031641; Thu, 4 Nov 2004 12:27:57 +0100 (CET) (envelope-from philip) Date: Thu, 4 Nov 2004 12:27:57 +0100 From: Philip Paeps To: Sebastian Schulze Struchtrup Message-ID: <20041104112757.GA31494@fasolt.home.paeps.cx> Mail-Followup-To: Sebastian Schulze Struchtrup , Sebastian Schulze Struchtrup , FreeBSD-gnats-submit@freebsd.org, acpi@freebsd.org References: <418636C1.8000801@struchtrup.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <418636C1.8000801@struchtrup.de> X-Date-in-Rome: pridie Nonas Novembres MMDCCLVII ab Urbe Condida X-PGP-Fingerprint: FA74 3C27 91A6 79D5 F6D3 FC53 BF4B D0E6 049D B879 X-Message-Flag: Get a proper mailclient! Organization: Happily Disorganized User-Agent: Mutt/1.5.6i cc: acpi@freebsd.org cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: i386/73380: [patch] kldload acpi_asus.ko causes page fault on Samsung P35 X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Nov 2004 11:32:59 -0000 On 2004-11-01 14:14:41 (+0100), Sebastian Schulze Struchtrup wrote: > Well, the patch got lost. > Here it is. Does this patch work for you? I think it's a bit simpler than yours, and it should accomplish the same thing. It also doesn't break style(9) quite so dramatically ;-) Index: acpi_asus.c =================================================================== RCS file: /home/freebsd/FreeBSD-CVS/src/sys/i386/acpica/acpi_asus.c,v retrieving revision 1.12 diff -u -r1.12 acpi_asus.c --- acpi_asus.c 2 Nov 2004 13:02:22 -0000 1.12 +++ acpi_asus.c 4 Nov 2004 09:14:47 -0000 @@ -102,7 +102,10 @@ int s_lcd; }; -/* Models we know about */ +/* + * We can identify Asus laptops from the string they return + * as a result of calling the ATK0100 'INIT' method. + */ static struct acpi_asus_model acpi_asus_models[] = { { .name = "L2D", @@ -174,6 +177,15 @@ .disp_set = "SDSP", .disp_get = "\\SSTE" }, + + { .name = NULL } +}; + +/* + * Samsung P30/P35 laptops have an Asus ATK0100 gadget interface, + * but they can't be probed quite the same way as Asus laptops. + */ +static struct acpi_asus_model acpi_samsung_models[] = { { .name = "P30", .wled_set = "WLED", @@ -254,13 +266,48 @@ Buf.Length = ACPI_ALLOCATE_BUFFER; AcpiEvaluateObject(sc->handle, "INIT", &Args, &Buf); - Obj = Buf.Pointer; + /* + * The Samsung P30 returns a null-pointer from INIT, we + * can identify it from the 'ODEM' string in the DSDT. + */ + if (Obj == NULL) { + ACPI_STATUS status; + ACPI_TABLE_HEADER th; + + status = AcpiGetTableHeader(ACPI_TABLE_DSDT, 1, &th); + if (ACPI_FAILURE(status)) { + sbuf_printf(sb, "Unsupported laptop\n"); + sbuf_finish(sb); + + device_printf(dev, sbuf_data(sb)); + + sbuf_delete(sb); + AcpiOsFree(Buf.Pointer); + return (ENXIO); + } + + if (strncmp("ODEM", th.OemTableId, 4) == 0) { + sbuf_printf(sb, "Samsung P30 Laptop Extras"); + sbuf_finish(sb); + + sc->model = &acpi_samsung_models[0]; + device_set_desc(dev, sbuf_data(sb)); + + sbuf_delete(sb); + AcpiOsFree(Buf.Pointer); + return (0); + } + } + + /* + * Asus laptops are simply identified by name, easy! + */ for (model = acpi_asus_models; model->name != NULL; model++) if (strcmp(Obj->String.Pointer, model->name) == 0) { sbuf_printf(sb, "Asus %s Laptop Extras", - Obj->String.Pointer); + Obj->String.Pointer); sbuf_finish(sb); sc->model = model; @@ -272,7 +319,7 @@ } sbuf_printf(sb, "Unsupported Asus laptop detected: %s\n", - Obj->String.Pointer); + Obj->String.Pointer); sbuf_finish(sb); device_printf(dev, sbuf_data(sb)); - Philip -- Philip Paeps Made from non-edible parts philip@freebsd.org BOFH Excuse #228: That function is not currently supported, but Bill Gates assures us it will be featured in the next upgrade.