chromeos_pstore.c 2.5 KB

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