From owner-freebsd-current Thu Mar 6 0:10:19 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E0DFD37B401 for ; Thu, 6 Mar 2003 00:10:16 -0800 (PST) Received: from axe-inc.co.jp (axegw.axe-inc.co.jp [61.199.217.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6E4F043FAF for ; Thu, 6 Mar 2003 00:10:13 -0800 (PST) (envelope-from takawata@axe-inc.co.jp) Received: from axe-inc.co.jp ([192.47.224.47]) by axe-inc.co.jp (8.9.3+3.2W/3.7W) with ESMTP id RAA12070; Thu, 6 Mar 2003 17:10:00 +0900 (JST) Message-Id: <200303060810.RAA12070@axe-inc.co.jp> To: Paul Wankadia , freebsd-current@freebsd.org Subject: Re: Sony VAIO, psm and acpi In-reply-to: Your message of "Thu, 06 Mar 2003 18:00:46 +1000." <3.0.5.16.20030306180046.2117b71c@localhost> Date: Thu, 06 Mar 2003 17:11:41 +0900 From: User Takawata Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <3.0.5.16.20030306180046.2117b71c@localhost>, Paul Wankadia wrote: >After seeing the "yet another Sony Vaio PS/2 mouse ID" commits to >src/sys/isa/psm.c from six weeks ago, I've hacked my >src/sys/dev/acpica/acpi.c so now acpi_isa_pnp_probe() will try the >compatibility ID like isa_pnp_probe() does in src/sys/isa/isa_common.c. >It's quite trivial, so is there some reason why an acpi_isa_get_compatid() >wasn't written before? (Please Cc: to me.) I also wrote it before. But I didn't commit because I don't tested it. If you tested your patch, I'll willing to commit. Here is my patch. == Index: acpi.c =================================================================== RCS file: /home/ncvs/src/sys/dev/acpica/acpi.c,v retrieving revision 1.83 diff -u -r1.83 acpi.c --- acpi.c 28 Dec 2002 14:58:50 -0000 1.83 +++ acpi.c 23 Jan 2003 23:17:05 -0000 @@ -113,6 +113,7 @@ static struct resource *acpi_alloc_resource(device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); static int acpi_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r); +static u_int32_t acpi_isa_get_compatid(device_t dev); static u_int32_t acpi_isa_get_logicalid(device_t dev); static int acpi_isa_pnp_probe(device_t bus, device_t child, struct isa_pnp_id *ids); @@ -590,10 +591,11 @@ /* ISA compatibility */ case ISA_IVAR_VENDORID: case ISA_IVAR_SERIAL: - case ISA_IVAR_COMPATID: *(int *)result = -1; break; - + case ISA_IVAR_COMPATID: + *(int *)result = acpi_isa_get_compatid(child); + break; case ISA_IVAR_LOGICALID: *(int *)result = acpi_isa_get_logicalid(child); break; @@ -697,7 +699,32 @@ | (PNP_HEXTONUM(s[3]) << 20) \ | (PNP_HEXTONUM(s[6]) << 24) \ | (PNP_HEXTONUM(s[5]) << 28)) +#define MAX_VALID_EISAID 9 +static u_int32_t +acpi_isa_get_compatid(device_t dev) +{ + ACPI_HANDLE h; + ACPI_OBJECT *obj; + ACPI_BUFFER resbuf; + char resbufbody[sizeof(ACPI_OBJECT) + MAX_VALID_EISAID +1]; + + /* + *resbuf size is allocated so that it can hold ACPI_OBJECT + *with EISAID string + */ + obj = (ACPI_OBJECT *)resbufbody; + resbuf.Length = sizeof(resbufbody); + resbuf.Pointer = resbufbody; + h = acpi_get_handle(dev); + if(ACPI_FAILURE(AcpiEvaluateObject(h, "_CID", NULL, &resbuf))) + return 0; + if(obj->Type == ACPI_TYPE_INTEGER) + return obj->Integer.Value; + else if(obj->Type == ACPI_TYPE_STRING) + return PNP_EISAID(obj->String.Pointer); + return 0; +} static u_int32_t acpi_isa_get_logicalid(device_t dev) { --- acpi.c.prev Fri Jan 24 10:14:10 2003 +++ acpi.c Fri Jan 24 10:15:24 2003 @@ -757,7 +757,7 @@ acpi_isa_pnp_probe(device_t bus, device_t child, struct isa_pnp_id *ids) { int result; - u_int32_t pnpid; + u_int32_t pnpid, compatid; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -770,8 +770,10 @@ /* scan the supplied IDs for a match */ pnpid = acpi_isa_get_logicalid(child); + compatid = acpi_isa_get_compatid(child); while (ids && ids->ip_id) { - if (pnpid == ids->ip_id) { + if (pnpid == ids->ip_id|| + compatid == ids->ip_id) { result = 0; goto out; } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message