Re: Sony VAIO, psm and acpi

2003-03-06 Thread User Takawata
In message [EMAIL PROTECTED], 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 -  1.83
+++ acpi.c  23 Jan 2003 23:17:05 -
@@ -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)
 {
 intresult;
-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 [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Re: Sony VAIO, psm and acpi

2003-03-06 Thread Paul Wankadia
At 05:11 PM 6/03/03 +0900, User Takawata [EMAIL PROTECTED] wrote:

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.

Aye, I did this on my VAIO (PCG-GRX5P) and it seems to work fine...





--- acpi.c.old  Thu Mar  6 18:48:48 2003
+++ acpi.c  Thu Mar  6 19:03:29 2003
@@ -107,6 +107,7 @@
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_logicalid(device_t dev);
+static u_int32_t acpi_isa_get_compatid(device_t dev);
 static int acpi_isa_pnp_probe(device_t bus, device_t child, struct
isa_pnp_id *ids);
 
 static voidacpi_probe_children(device_t bus);
@@ -719,11 +720,38 @@
 return_VALUE(pnpid);
 }
 
+static u_int32_t
+acpi_isa_get_compatid(device_t dev)
+{
+ACPI_HANDLEh;
+ACPI_DEVICE_INFO   devinfo;
+ACPI_STATUSerror;
+u_int32_t  pnpid;
+ACPI_LOCK_DECL;
+
+ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
+
+pnpid = 0;
+ACPI_LOCK;
+
+/* fetch and validate the HID */
+if ((h = acpi_get_handle(dev)) == NULL)
+   goto out;
+if (ACPI_FAILURE(error = AcpiGetObjectInfo(h, devinfo)))
+   goto out;
+if (ACPI_FAILURE(error = acpi_EvaluateInteger(h, _CID, pnpid)))
+   goto out;
+
+out:
+ACPI_UNLOCK;
+return_VALUE(pnpid);
+}
+
 static int
 acpi_isa_pnp_probe(device_t bus, device_t child, struct isa_pnp_id *ids)
 {
 intresult;
-u_int32_t  pnpid;
+u_int32_t  lid, cid;
 
 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
@@ -735,9 +763,10 @@
 result = ENXIO;
 
 /* scan the supplied IDs for a match */
-pnpid = acpi_isa_get_logicalid(child);
+lid = acpi_isa_get_logicalid(child);
+cid = acpi_isa_get_compatid(child);
 while (ids  ids-ip_id) {
-   if (pnpid == ids-ip_id) {
+   if (lid == ids-ip_id || cid == ids-ip_id) {
result = 0;
goto out;
}



To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Re: Sony VAIO, psm and acpi

2003-03-06 Thread Ollivier Robert
According to User Takawata:
 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.

It is nice to see that ACPI is working for some VAIO users :(
My Z600TEK is still freezing while trying to suspend under ACPI and
also if I try to suspend under X when using APM...
-- 
Ollivier ROBERT -=- FreeBSD: The Power to Serve! -=- [EMAIL PROTECTED]
FreeBSD keltia.freenix.fr 5.0-CURRENT #80: Sun Jun  4 22:44:19 CEST 2000

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Sony VAIO, psm and acpi

2003-03-05 Thread Paul Wankadia
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.)


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message