| OLD | NEW |
| 1 /* | 1 /* |
| 2 * ChromeOS platform support code. Glue layer between higher level functions | 2 * ChromeOS platform support code. Glue layer between higher level functions |
| 3 * and per-platform firmware interfaces. | 3 * and per-platform firmware interfaces. |
| 4 * | 4 * |
| 5 * Copyright (C) 2010 The Chromium OS Authors | 5 * Copyright (C) 2010 The Chromium OS Authors |
| 6 * | 6 * |
| 7 * This program is free software; you can redistribute it and/or modify | 7 * This program is free software; you can redistribute it and/or modify |
| 8 * it under the terms of the GNU General Public License as published by | 8 * it under the terms of the GNU General Public License as published by |
| 9 * the Free Software Foundation; either version 2 of the License, or | 9 * the Free Software Foundation; either version 2 of the License, or |
| 10 * (at your option) any later version. | 10 * (at your option) any later version. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include <linux/kernel.h> | 27 #include <linux/kernel.h> |
| 28 #include <linux/module.h> | 28 #include <linux/module.h> |
| 29 #include <linux/nvram.h> | 29 #include <linux/nvram.h> |
| 30 #include <linux/types.h> | 30 #include <linux/types.h> |
| 31 #include <linux/chromeos_platform.h> | 31 #include <linux/chromeos_platform.h> |
| 32 | 32 |
| 33 #include "chromeos_acpi.h" | 33 #include "chromeos_acpi.h" |
| 34 | 34 |
| 35 /* Values set at probe time */ |
| 36 int chromeos_acpi_chnv = -1; |
| 37 EXPORT_SYMBOL_GPL(chromeos_acpi_chnv); |
| 38 |
| 39 int chromeos_acpi_chsw = -1; |
| 40 EXPORT_SYMBOL_GPL(chromeos_acpi_chsw); |
| 41 |
| 42 bool chromeos_acpi_available; |
| 43 EXPORT_SYMBOL_GPL(chromeos_acpi_available); |
| 44 |
| 35 static bool chromeos_inited; | 45 static bool chromeos_inited; |
| 36 | 46 |
| 37 static void chromeos_set_nvram_flag(int index, unsigned char flag) | 47 static void chromeos_set_nvram_flag(int index, unsigned char flag) |
| 38 { | 48 { |
| 39 unsigned char cur; | 49 unsigned char cur; |
| 40 | 50 |
| 41 cur = nvram_read_byte(index); | 51 cur = nvram_read_byte(index); |
| 42 /* already set. */ | 52 /* already set. */ |
| 43 if (cur & flag) | 53 if (cur & flag) |
| 44 return; | 54 return; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 57 return (chsw < 0) || (chsw & CHSW_DEVELOPER_MODE); | 67 return (chsw < 0) || (chsw & CHSW_DEVELOPER_MODE); |
| 58 } | 68 } |
| 59 EXPORT_SYMBOL(chromeos_is_devmode); | 69 EXPORT_SYMBOL(chromeos_is_devmode); |
| 60 | 70 |
| 61 int chromeos_set_need_recovery(void) | 71 int chromeos_set_need_recovery(void) |
| 62 { | 72 { |
| 63 if (!chromeos_inited) | 73 if (!chromeos_inited) |
| 64 return -ENODEV; | 74 return -ENODEV; |
| 65 | 75 |
| 66 if (chromeos_acpi_chnv < 0) { | 76 if (chromeos_acpi_chnv < 0) { |
| 67 » » pr_warning("chromeos_set_need_recovery(): Can't write to nvram\n
"); | 77 » » pr_warning("%s: Can't write to nvram\n", __func__); |
| 68 return -ENODEV; | 78 return -ENODEV; |
| 69 } | 79 } |
| 70 | 80 |
| 71 chromeos_set_nvram_flag(chromeos_acpi_chnv, CHNV_RECOVERY_FLAG); | 81 chromeos_set_nvram_flag(chromeos_acpi_chnv, CHNV_RECOVERY_FLAG); |
| 72 | 82 |
| 73 return 0; | 83 return 0; |
| 74 } | 84 } |
| 75 EXPORT_SYMBOL(chromeos_set_need_recovery); | 85 EXPORT_SYMBOL(chromeos_set_need_recovery); |
| 76 | 86 |
| 77 bool chromeos_initialized(void) | 87 bool chromeos_initialized(void) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 88 printk(KERN_INFO "Chrome OS platform detected\n"); | 98 printk(KERN_INFO "Chrome OS platform detected\n"); |
| 89 chromeos_inited = true; | 99 chromeos_inited = true; |
| 90 return 0; | 100 return 0; |
| 91 } | 101 } |
| 92 subsys_initcall_sync(chromeos_init); | 102 subsys_initcall_sync(chromeos_init); |
| 93 | 103 |
| 94 | 104 |
| 95 MODULE_AUTHOR("The Chromium OS Authors"); | 105 MODULE_AUTHOR("The Chromium OS Authors"); |
| 96 MODULE_DESCRIPTION("Chrome OS Platform Extras"); | 106 MODULE_DESCRIPTION("Chrome OS Platform Extras"); |
| 97 MODULE_LICENSE("GPL"); | 107 MODULE_LICENSE("GPL"); |
| OLD | NEW |