chromeos_pstore.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. #include <linux/dmi.h>
  11. #include <linux/module.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/pstore_ram.h>
  14. static struct dmi_system_id chromeos_pstore_dmi_table[] __initdata = {
  15. {
  16. /*
  17. * Today all Chromebooks/boxes ship with Google_* as version and
  18. * coreboot as bios vendor. No other systems with this
  19. * combination are known to date.
  20. */
  21. .matches = {
  22. DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"),
  23. DMI_MATCH(DMI_BIOS_VERSION, "Google_"),
  24. },
  25. },
  26. {
  27. /* x86-alex, the first Samsung Chromebook. */
  28. .matches = {
  29. DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
  30. DMI_MATCH(DMI_PRODUCT_NAME, "Alex"),
  31. },
  32. },
  33. {
  34. /* x86-mario, the Cr-48 pilot device from Google. */
  35. .matches = {
  36. DMI_MATCH(DMI_SYS_VENDOR, "IEC"),
  37. DMI_MATCH(DMI_PRODUCT_NAME, "Mario"),
  38. },
  39. },
  40. {
  41. /* x86-zgb, the first Acer Chromebook. */
  42. .matches = {
  43. DMI_MATCH(DMI_SYS_VENDOR, "ACER"),
  44. DMI_MATCH(DMI_PRODUCT_NAME, "ZGB"),
  45. },
  46. },
  47. { }
  48. };
  49. MODULE_DEVICE_TABLE(dmi, chromeos_pstore_dmi_table);
  50. /*
  51. * On x86 chromebooks/boxes, the firmware will keep the legacy VGA memory
  52. * range untouched across reboots, so we use that to store our pstore
  53. * contents for panic logs, etc.
  54. */
  55. static struct ramoops_platform_data chromeos_ramoops_data = {
  56. .mem_size = 0x100000,
  57. .mem_address = 0xf00000,
  58. .record_size = 0x20000,
  59. .console_size = 0x20000,
  60. .ftrace_size = 0x20000,
  61. .dump_oops = 1,
  62. };
  63. static struct platform_device chromeos_ramoops = {
  64. .name = "ramoops",
  65. .dev = {
  66. .platform_data = &chromeos_ramoops_data,
  67. },
  68. };
  69. static int __init chromeos_pstore_init(void)
  70. {
  71. if (dmi_check_system(chromeos_pstore_dmi_table))
  72. return platform_device_register(&chromeos_ramoops);
  73. return -ENODEV;
  74. }
  75. static void __exit chromeos_pstore_exit(void)
  76. {
  77. platform_device_unregister(&chromeos_ramoops);
  78. }
  79. module_init(chromeos_pstore_init);
  80. module_exit(chromeos_pstore_exit);
  81. MODULE_DESCRIPTION("Chrome OS pstore module");
  82. MODULE_LICENSE("GPL");