All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] ACPI: Ignore invalid _PSS entries, but use valid ones
@ 2012-05-04 13:46 Marco Aurelio da Costa
  2012-05-04 13:52 ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 10+ messages in thread
From: Marco Aurelio da Costa @ 2012-05-04 13:46 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-acpi, linux-kernel

From: Marco Aurelio da Costa <costa@gamic.com>
Signed-off-by: Marco Aurelio da Costa <costa@gamic.com>

The EliteBook 8560W has non-initialized entries in its _PSS ACPI
table. Instead of bailing out when the first non-initialized entry is
found, ignore it and use only  the valid entries. Only bail out if there
is no valid entry at all.

---
--- linux-3.3.3/drivers/acpi/processor_perflib.c.orig   2012-04-24
22:18:23.288041268 +0200
+++ linux-3.3.3/drivers/acpi/processor_perflib.c        2012-04-24
22:19:25.912042603 +0200
@@ -311,6 +311,7 @@ static int acpi_processor_get_performanc
       struct acpi_buffer state = { 0, NULL };
       union acpi_object *pss = NULL;
       int i;
+       int last_invalid = -1;


       status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer);
@@ -374,12 +375,30 @@ static int acpi_processor_get_performanc
                       printk(KERN_ERR FW_BUG PREFIX
                              "Invalid BIOS _PSS frequency: 0x%llx MHz\n",
                              px->core_frequency);
-                       result = -EFAULT;
-                       kfree(pr->performance->states);
-                       goto end;
+                       if (-1 == last_invalid)
+                               last_invalid = i;
+               } else {
+                       if (last_invalid != -1) {
+                               /*
+                                * Copy this valid entry over last_invalid entry
+                                */
+                               memcpy(&(pr->performance->states[last_invalid]),
+                                      px, sizeof(struct acpi_processor_px));
+                               ++last_invalid;
+                       }
               }
       }

+       if (0 == last_invalid) {
+               printk(KERN_ERR FW_BUG PREFIX
+                      "No valid BIOS _PSS frequency found\n");
+               result = -EFAULT;
+               kfree(pr->performance->states);
+       }
+
+       if (last_invalid > 0)
+               pr->performance->state_count = last_invalid;
+
      end:
       kfree(buffer.pointer);

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-05-04 16:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-04 13:46 [RFC][PATCH] ACPI: Ignore invalid _PSS entries, but use valid ones Marco Aurelio da Costa
2012-05-04 13:52 ` Konrad Rzeszutek Wilk
2012-05-04 14:13   ` Marco Aurelio da Costa
2012-05-04 14:13     ` Marco Aurelio da Costa
2012-05-04 14:39     ` Konrad Rzeszutek Wilk
2012-05-04 14:39       ` Konrad Rzeszutek Wilk
     [not found]     ` <CAEe-dwg5pG2aDHopeHA2yiACUjS3cba5Vm1GyOaM4y=gpvpmMQ@mail.gmail.com>
2012-05-04 15:25       ` [RFC][PATCH v2] " Marco Aurelio da Costa
2012-05-04 16:11         ` Konrad Rzeszutek Wilk
2012-05-04 16:21           ` Marco Aurelio da Costa
2012-05-04 16:21             ` Marco Aurelio da Costa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.