Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 06 Mar 2003 17:11:41 +0900
From:      User Takawata <takawata@axe-inc.co.jp>
To:        Paul Wankadia <junyer@gmx.net>, freebsd-current@freebsd.org
Subject:   Re: Sony VAIO, psm and acpi
Message-ID:  <200303060810.RAA12070@axe-inc.co.jp>
In-Reply-To: Your message of "Thu, 06 Mar 2003 18:00:46 %2B1000." <3.0.5.16.20030306180046.2117b71c@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303060810.RAA12070>