diff options
author | Olof Johansson <olof@lixom.net> | 2013-11-12 16:32:13 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2013-11-25 15:47:24 -0500 |
commit | 9742e127cd0dd5783f8c11c62d07886003114499 (patch) | |
tree | bc327139ca43687c55f5a348ff411c0bce9cd1a6 | |
parent | 7e3528c3660a2e8602abc7858b0994d611f74bc3 (diff) |
platform/chrome: Add pstore platform_device
Add the ramoops pstore device so that we get logs of panics across reboots.
Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r-- | drivers/platform/chrome/Kconfig | 14 | ||||
-rw-r--r-- | drivers/platform/chrome/Makefile | 1 | ||||
-rw-r--r-- | drivers/platform/chrome/chromeos_pstore.c | 101 |
3 files changed, 116 insertions, 0 deletions
diff --git a/drivers/platform/chrome/Kconfig b/drivers/platform/chrome/Kconfig index b13303e75a34..440ed776efd4 100644 --- a/drivers/platform/chrome/Kconfig +++ b/drivers/platform/chrome/Kconfig | |||
@@ -25,4 +25,18 @@ config CHROMEOS_LAPTOP | |||
25 | If you have a supported Chromebook, choose Y or M here. | 25 | If you have a supported Chromebook, choose Y or M here. |
26 | The module will be called chromeos_laptop. | 26 | The module will be called chromeos_laptop. |
27 | 27 | ||
28 | config CHROMEOS_PSTORE | ||
29 | tristate "Chrome OS pstore support" | ||
30 | ---help--- | ||
31 | This module instantiates the persistent storage on x86 ChromeOS | ||
32 | devices. It can be used to store away console logs and crash | ||
33 | information across reboots. | ||
34 | |||
35 | The range of memory used is 0xf00000-0x1000000, traditionally | ||
36 | the memory used to back VGA controller memory. | ||
37 | |||
38 | If you have a supported Chromebook, choose Y or M here. | ||
39 | The module will be called chromeos_pstore. | ||
40 | |||
41 | |||
28 | endif # CHROMEOS_PLATFORMS | 42 | endif # CHROMEOS_PLATFORMS |
diff --git a/drivers/platform/chrome/Makefile b/drivers/platform/chrome/Makefile index 015e9195e226..2b860ca7450f 100644 --- a/drivers/platform/chrome/Makefile +++ b/drivers/platform/chrome/Makefile | |||
@@ -1,2 +1,3 @@ | |||
1 | 1 | ||
2 | obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o | 2 | obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o |
3 | obj-$(CONFIG_CHROMEOS_PSTORE) += chromeos_pstore.o | ||
diff --git a/drivers/platform/chrome/chromeos_pstore.c b/drivers/platform/chrome/chromeos_pstore.c new file mode 100644 index 000000000000..e0e0e65cf442 --- /dev/null +++ b/drivers/platform/chrome/chromeos_pstore.c | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * chromeos_pstore.c - Driver to instantiate Chromebook ramoops device | ||
3 | * | ||
4 | * Copyright (C) 2013 Google, Inc. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation, version 2 of the License. | ||
9 | */ | ||
10 | |||
11 | #include <linux/dmi.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/pstore_ram.h> | ||
15 | |||
16 | static struct dmi_system_id chromeos_pstore_dmi_table[] __initdata = { | ||
17 | { | ||
18 | /* | ||
19 | * Today all Chromebooks/boxes ship with GOOGLE as vendor and | ||
20 | * coreboot as bios vendor. No other systems with this | ||
21 | * combination are known to date. | ||
22 | */ | ||
23 | .matches = { | ||
24 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), | ||
25 | DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"), | ||
26 | }, | ||
27 | }, | ||
28 | { | ||
29 | /* | ||
30 | * The first Samsung Chromebox and Chromebook Series 5 550 use | ||
31 | * coreboot but with Samsung as the system vendor. | ||
32 | */ | ||
33 | .matches = { | ||
34 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG"), | ||
35 | DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"), | ||
36 | }, | ||
37 | }, | ||
38 | { | ||
39 | /* x86-alex, the first Samsung Chromebook. */ | ||
40 | .matches = { | ||
41 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | ||
42 | DMI_MATCH(DMI_PRODUCT_NAME, "Alex"), | ||
43 | }, | ||
44 | }, | ||
45 | { | ||
46 | /* x86-mario, the Cr-48 pilot device from Google. */ | ||
47 | .matches = { | ||
48 | DMI_MATCH(DMI_SYS_VENDOR, "IEC"), | ||
49 | DMI_MATCH(DMI_PRODUCT_NAME, "Mario"), | ||
50 | }, | ||
51 | }, | ||
52 | { | ||
53 | /* x86-zgb, the first Acer Chromebook. */ | ||
54 | .matches = { | ||
55 | DMI_MATCH(DMI_SYS_VENDOR, "ACER"), | ||
56 | DMI_MATCH(DMI_PRODUCT_NAME, "ZGB"), | ||
57 | }, | ||
58 | }, | ||
59 | { } | ||
60 | }; | ||
61 | MODULE_DEVICE_TABLE(dmi, chromeos_pstore_dmi_table); | ||
62 | |||
63 | /* | ||
64 | * On x86 chromebooks/boxes, the firmware will keep the legacy VGA memory | ||
65 | * range untouched across reboots, so we use that to store our pstore | ||
66 | * contents for panic logs, etc. | ||
67 | */ | ||
68 | static struct ramoops_platform_data chromeos_ramoops_data = { | ||
69 | .mem_size = 0x100000, | ||
70 | .mem_address = 0xf00000, | ||
71 | .record_size = 0x20000, | ||
72 | .console_size = 0x20000, | ||
73 | .ftrace_size = 0x20000, | ||
74 | .dump_oops = 1, | ||
75 | }; | ||
76 | |||
77 | static struct platform_device chromeos_ramoops = { | ||
78 | .name = "ramoops", | ||
79 | .dev = { | ||
80 | .platform_data = &chromeos_ramoops_data, | ||
81 | }, | ||
82 | }; | ||
83 | |||
84 | static int __init chromeos_pstore_init(void) | ||
85 | { | ||
86 | if (dmi_check_system(chromeos_pstore_dmi_table)) | ||
87 | return platform_device_register(&chromeos_ramoops); | ||
88 | |||
89 | return -ENODEV; | ||
90 | } | ||
91 | |||
92 | static void __exit chromeos_pstore_exit(void) | ||
93 | { | ||
94 | platform_device_unregister(&chromeos_ramoops); | ||
95 | } | ||
96 | |||
97 | module_init(chromeos_pstore_init); | ||
98 | module_exit(chromeos_pstore_exit); | ||
99 | |||
100 | MODULE_DESCRIPTION("Chrome OS pstore module"); | ||
101 | MODULE_LICENSE("GPL"); | ||