PATCH - acpi psm0 not working
Nate Lawson
nate at root.org
Tue Dec 16 23:12:03 PST 2003
If your mouse or other device is not working, this patch may help. To see
if you need it, dump your ASL and do:
grep _CID foo.asl | grep Package
If you get output from this command, this patch may help. It enables
package evaluation for the _CID object. If it helps you, please send me
the dmesg it adds, something like this:
acpi cids: 1 - 0x130fd041,
Thanks,
Nate
Index: sys/dev/acpica/acpi.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/acpica/acpi.c,v
retrieving revision 1.109
diff -u -r1.109 acpi.c
--- sys/dev/acpica/acpi.c 9 Dec 2003 06:29:57 -0000 1.109
+++ sys/dev/acpica/acpi.c 17 Dec 2003 07:03:07 -0000
@@ -105,8 +105,8 @@
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 uint32_t acpi_isa_get_logicalid(device_t dev);
+static int acpi_isa_get_compatid(device_t dev, uint32_t *cids, int count);
static int acpi_isa_pnp_probe(device_t bus, device_t child,
struct isa_pnp_id *ids);
static void acpi_probe_children(device_t bus);
@@ -800,12 +800,12 @@
| (PNP_HEXTONUM(s[6]) << 24) \
| (PNP_HEXTONUM(s[5]) << 28))
-static u_int32_t
+static uint32_t
acpi_isa_get_logicalid(device_t dev)
{
- ACPI_HANDLE h;
ACPI_DEVICE_INFO devinfo;
ACPI_BUFFER buf = {sizeof(devinfo), &devinfo};
+ ACPI_HANDLE h;
ACPI_STATUS error;
u_int32_t pnpid;
ACPI_LOCK_DECL;
@@ -827,40 +827,65 @@
pnpid = PNP_EISAID(devinfo.HardwareId.Value);
out:
+ /* XXX leaking memory for devinfo.CompatibilityId.Id array? */
ACPI_UNLOCK;
return_VALUE (pnpid);
}
-static u_int32_t
-acpi_isa_get_compatid(device_t dev)
+static int
+acpi_isa_get_compatid(device_t dev, uint32_t *cids, int count)
{
+ ACPI_DEVICE_INFO devinfo;
+ ACPI_BUFFER buf = {sizeof(devinfo), &devinfo};
ACPI_HANDLE h;
ACPI_STATUS error;
- u_int32_t pnpid;
+ uint32_t *pnpid;
+ int valid, i;
ACPI_LOCK_DECL;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
- pnpid = 0;
+ pnpid = cids;
+ valid = 0;
ACPI_LOCK;
- /* Fetch and validate the HID */
+ /* Fetch and validate the CID */
if ((h = acpi_get_handle(dev)) == NULL)
goto out;
- if (ACPI_FAILURE(error = acpi_EvaluateInteger(h, "_CID", &pnpid)))
+ error = AcpiGetObjectInfo(h, &buf);
+ if (ACPI_FAILURE(error))
goto out;
+ if ((devinfo.Valid & ACPI_VALID_CID) == 0)
+ goto out;
+
+ if (devinfo.CompatibilityId.Count < count)
+ count = devinfo.CompatibilityId.Count;
+ for (i = 0; i < count; i++) {
+ if (strncmp(devinfo.CompatibilityId.Id[i].Value, "PNP", 3) != 0)
+ continue;
+ *pnpid++ = PNP_EISAID(devinfo.CompatibilityId.Id[i].Value);
+ valid++;
+ }
+
+ /* XXX */
+ if (valid == 0)
+ goto out;
+ printf("acpi cids: %d - ", valid);
+ for (i = 0; i < valid; i++)
+ printf("%#x, ", cids[i]);
+ printf("\n");
out:
+ /* XXX leaking memory for devinfo.CompatibilityId.Id array? */
ACPI_UNLOCK;
- return_VALUE (pnpid);
+ return_VALUE (valid);
}
-
static int
acpi_isa_pnp_probe(device_t bus, device_t child, struct isa_pnp_id *ids)
{
- int result;
- u_int32_t lid, cid;
+ int result, cid_count, i;
+ uint32_t lid, cids[8];
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
@@ -873,17 +898,23 @@
/* Scan the supplied IDs for a match */
lid = acpi_isa_get_logicalid(child);
- cid = acpi_isa_get_compatid(child);
+ cid_count = acpi_isa_get_compatid(child, cids, 8);
while (ids && ids->ip_id) {
- if (lid == ids->ip_id || cid == ids->ip_id) {
+ if (lid == ids->ip_id) {
result = 0;
goto out;
}
+ for (i = 0; i < cid_count; i++) {
+ if (cids[i] == ids->ip_id) {
+ result = 0;
+ goto out;
+ }
+ }
ids++;
}
out:
- return_VALUE(result);
+ return_VALUE (result);
}
/*
More information about the freebsd-current
mailing list