mirror of
https://github.com/torvalds/linux.git
synced 2024-11-28 07:01:32 +00:00
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>
This commit is contained in:
parent
bff3c624dc
commit
59a356d2f1
@ -8,6 +8,7 @@
|
||||
* the Free Software Foundation, version 2 of the License.
|
||||
*/
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/dmi.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
@ -71,9 +72,59 @@ static struct platform_device chromeos_ramoops = {
|
||||
},
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
static const struct acpi_device_id cros_ramoops_acpi_match[] = {
|
||||
{ "GOOG9999", 0 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(acpi, cros_ramoops_acpi_match);
|
||||
|
||||
static struct platform_driver chromeos_ramoops_acpi = {
|
||||
.driver = {
|
||||
.name = "chromeos_pstore",
|
||||
.acpi_match_table = ACPI_PTR(cros_ramoops_acpi_match),
|
||||
},
|
||||
};
|
||||
|
||||
static int __init chromeos_probe_acpi(struct platform_device *pdev)
|
||||
{
|
||||
struct resource *res;
|
||||
resource_size_t len;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res)
|
||||
return -ENOMEM;
|
||||
|
||||
len = resource_size(res);
|
||||
if (!res->start || !len)
|
||||
return -ENOMEM;
|
||||
|
||||
pr_info("chromeos ramoops using acpi device.\n");
|
||||
|
||||
chromeos_ramoops_data.mem_size = len;
|
||||
chromeos_ramoops_data.mem_address = res->start;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool __init chromeos_check_acpi(void)
|
||||
{
|
||||
if (!platform_driver_probe(&chromeos_ramoops_acpi, chromeos_probe_acpi))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
static inline bool chromeos_check_acpi(void) { return false; }
|
||||
#endif
|
||||
|
||||
static int __init chromeos_pstore_init(void)
|
||||
{
|
||||
if (dmi_check_system(chromeos_pstore_dmi_table))
|
||||
bool acpi_dev_found;
|
||||
|
||||
/* First check ACPI for non-hardcoded values from firmware. */
|
||||
acpi_dev_found = chromeos_check_acpi();
|
||||
|
||||
if (acpi_dev_found || dmi_check_system(chromeos_pstore_dmi_table))
|
||||
return platform_device_register(&chromeos_ramoops);
|
||||
|
||||
return -ENODEV;
|
||||
|
Loading…
Reference in New Issue
Block a user