aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/chrome
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2016-02-16 02:25:15 -0500
committerOlof Johansson <olof@lixom.net>2016-05-11 14:55:46 -0400
commit59a356d2f1e6e2fbb700c9a9cda1658f5934c7d2 (patch)
tree9e9c793ca0de797f7b4b0cc49f86ac1b87a32792 /drivers/platform/chrome
parentbff3c624dc7261a084a4d25a0b09c3fb0fec872a (diff)
platform/chrome: pstore: probe for ramoops buffer using acpi
In order to handle the firmware placing the ramoops buffer in a different location than the kernel is configured to look probe for an ACPI device specified by GOOG9999 acpi id. If no device is found or the first memory resource is not defined properly fall back to the configured base and length. Signed-off-by: Aaron Durbin <adurbin@chromium.org> Signed-off-by: Ben Zhang <benzh@chromium.org> Signed-off-by: Filipe Brandenburger <filbranden@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Olof Johansson <olofj@chromium.org> Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/platform/chrome')
-rw-r--r--drivers/platform/chrome/chromeos_pstore.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/drivers/platform/chrome/chromeos_pstore.c b/drivers/platform/chrome/chromeos_pstore.c
index 34749200e4ab..ca001926ad40 100644
--- a/drivers/platform/chrome/chromeos_pstore.c
+++ b/drivers/platform/chrome/chromeos_pstore.c
@@ -8,6 +8,7 @@
8 * the Free Software Foundation, version 2 of the License. 8 * the Free Software Foundation, version 2 of the License.
9 */ 9 */
10 10
11#include <linux/acpi.h>
11#include <linux/dmi.h> 12#include <linux/dmi.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/platform_device.h> 14#include <linux/platform_device.h>
@@ -71,9 +72,59 @@ static struct platform_device chromeos_ramoops = {
71 }, 72 },
72}; 73};
73 74
75#ifdef CONFIG_ACPI
76static const struct acpi_device_id cros_ramoops_acpi_match[] = {
77 { "GOOG9999", 0 },
78 { }
79};
80MODULE_DEVICE_TABLE(acpi, cros_ramoops_acpi_match);
81
82static struct platform_driver chromeos_ramoops_acpi = {
83 .driver = {
84 .name = "chromeos_pstore",
85 .acpi_match_table = ACPI_PTR(cros_ramoops_acpi_match),
86 },
87};
88
89static int __init chromeos_probe_acpi(struct platform_device *pdev)
90{
91 struct resource *res;
92 resource_size_t len;
93
94 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
95 if (!res)
96 return -ENOMEM;
97
98 len = resource_size(res);
99 if (!res->start || !len)
100 return -ENOMEM;
101
102 pr_info("chromeos ramoops using acpi device.\n");
103
104 chromeos_ramoops_data.mem_size = len;
105 chromeos_ramoops_data.mem_address = res->start;
106
107 return 0;
108}
109
110static bool __init chromeos_check_acpi(void)
111{
112 if (!platform_driver_probe(&chromeos_ramoops_acpi, chromeos_probe_acpi))
113 return true;
114 return false;
115}
116#else
117static inline bool chromeos_check_acpi(void) { return false; }
118#endif
119
74static int __init chromeos_pstore_init(void) 120static int __init chromeos_pstore_init(void)
75{ 121{
76 if (dmi_check_system(chromeos_pstore_dmi_table)) 122 bool acpi_dev_found;
123
124 /* First check ACPI for non-hardcoded values from firmware. */
125 acpi_dev_found = chromeos_check_acpi();
126
127 if (acpi_dev_found || dmi_check_system(chromeos_pstore_dmi_table))
77 return platform_device_register(&chromeos_ramoops); 128 return platform_device_register(&chromeos_ramoops);
78 129
79 return -ENODEV; 130 return -ENODEV;