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("chromeos_set_need_recovery():" |
78 » » » " Can't write to nvram\n"); | |
Olof Johansson
2011/03/14 21:24:32
%s with __func__ allows this to still be a one-li
vb
2011/03/14 22:00:04
Done.
| |
68 return -ENODEV; | 79 return -ENODEV; |
69 } | 80 } |
70 | 81 |
71 chromeos_set_nvram_flag(chromeos_acpi_chnv, CHNV_RECOVERY_FLAG); | 82 chromeos_set_nvram_flag(chromeos_acpi_chnv, CHNV_RECOVERY_FLAG); |
72 | 83 |
73 return 0; | 84 return 0; |
74 } | 85 } |
75 EXPORT_SYMBOL(chromeos_set_need_recovery); | 86 EXPORT_SYMBOL(chromeos_set_need_recovery); |
76 | 87 |
77 bool chromeos_initialized(void) | 88 bool chromeos_initialized(void) |
(...skipping 10 matching lines...) Expand all Loading... | |
88 printk(KERN_INFO "Chrome OS platform detected\n"); | 99 printk(KERN_INFO "Chrome OS platform detected\n"); |
89 chromeos_inited = true; | 100 chromeos_inited = true; |
90 return 0; | 101 return 0; |
91 } | 102 } |
92 subsys_initcall_sync(chromeos_init); | 103 subsys_initcall_sync(chromeos_init); |
93 | 104 |
94 | 105 |
95 MODULE_AUTHOR("The Chromium OS Authors"); | 106 MODULE_AUTHOR("The Chromium OS Authors"); |
96 MODULE_DESCRIPTION("Chrome OS Platform Extras"); | 107 MODULE_DESCRIPTION("Chrome OS Platform Extras"); |
97 MODULE_LICENSE("GPL"); | 108 MODULE_LICENSE("GPL"); |
OLD | NEW |