Re: oops with asus_acpi on P30/P35

Christian Aichinger
2005-09-21T09:08:10Z

[-- Attachment #1: Type: text/plain, Size: 3562 bytes --]

On Sun, Aug 21, 2005 at 04:36:17PM +0200, Timo Hoenig wrote:
> Hi,
>
> On Fri, 2005-08-19 at 17:49 +0200, Hanno Böck wrote:
>
> [...]
>
> > This is still not fixed within 2.6.13_rc6. As 2.6.13 seems to be on the way
> > and this bug is really grave/makes a piece of hardware unusable, can this be
> > pushed to the kernel tree as soon as possible?
>
> This patch does fix the Samsung P30 but this fix will also break support
> for other systems (like the ASUS W5A), too. To get the W5A working
> again, it needs something like the attached patch.
>
> I assume that other models will stop working, too.

OK, it's getting a little frustrating that this still isn't fixed.
I've now written a patch that tests for ACPI_TYPE_INTEGER, and it
tests for possible return values from P35's INIT.

Since the relevant part hasn't changed between P30 -> P35's DSDT, I
assume that there has been some change in the Linux ACPI code, that
causes integer returns now instead of no returns. This means we
could get rid of the P30 code in the (!buffer.pointer) path. I don't
have a P30 around to test this though :-/

I got the -1/0x58/0x38 values from my DSDT:
INIT there calls WLED, which calls \_SB.PCI0.LPCB.EC0.STC5, last
call with arg 0x58 or 0x38. That function then returns with either
Ones (which I gathered is ~0, i.e. -1) or with Arg0. That's the last
return that happens within the INIT call, so I thought that might be
the result of the call as a whole.

That fits nicely, since 0x58 is really returned on my laptop.

If this fix still breaks other laptops I'd really be puzzled, since
currently the value is dereferenced later when doing the string
comparisons. So the patch at least shouldn't break it more than it
already is ;)

I can resubmit my patch with a proper changelog entry and
Signed-off-by line if it should be merged.

Cheers,
Christian Aichinger

---
c51f431351c648519a9b91de3c5e1d636246d7bc
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -1006,6 +1006,24 @@ static int __init asus_hotk_get_info(voi
}

model = (union acpi_object *)buffer.pointer;
+
+ /* INIT on Samsung's P35 returns an integer, possible return
+ * values are tested below */
+ if (model->type == ACPI_TYPE_INTEGER) {
+ if (model->integer.value == -1 ||
+ model->integer.value == 0x58 ||
+ model->integer.value == 0x38) {
+ hotk->model = P30;
+ printk(KERN_NOTICE
+ " Samsung P35 detected, supported\n");
+ goto out_known;
+ } else {
+ printk(KERN_WARNING
+ " unknown integer returned by INIT\n");
+ goto out_unknown;
+ }
+ }
+
if (model->type == ACPI_TYPE_STRING) {
printk(KERN_NOTICE " %s model detected, ",
model->string.pointer);
@@ -1057,9 +1075,7 @@ static int __init asus_hotk_get_info(voi
hotk->model = L5x;

if (hotk->model == END_MODEL) {
- printk("unsupported, trying default values, supply the "
- "developers with your DSDT\n");
- hotk->model = M2E;
+ goto out_unknown;
} else {
printk("supported\n");
}
@@ -1088,6 +1104,15 @@ static int __init asus_hotk_get_info(voi
acpi_os_free(model);

return AE_OK;
+
+out_unknown:
+ printk(KERN_WARNING " unsupported, trying default values, "
+ "supply the developers with your DSDT\n");
+ hotk->model = M2E;
+out_known:
+ hotk->methods = &model_conf[hotk->model];
+ acpi_os_free(model);
+ return AE_OK;
}

static int __init asus_hotk_check(void)

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]