system/corennnnn
Revision | fb5933318d51d7ecf9ef35a6a4504a2c337f00c4 (tree) |
---|---|
Time | 2016-09-29 12:32:06 |
Author | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
Merge remote-tracking branch 'x86/marshmallow-x86' into cm-13.0-x86
Conflicts:
init/devices.cpp
init/init.cpp
@@ -38,6 +38,7 @@ include $(BUILD_STATIC_LIBRARY) | ||
38 | 38 | |
39 | 39 | include $(CLEAR_VARS) |
40 | 40 | LOCAL_CPPFLAGS := $(init_cflags) |
41 | +LOCAL_CPPFLAGS += -DTARGET_PRODUCT=\"$(PRODUCT_RELEASE_NAME)\" | |
41 | 42 | LOCAL_SRC_FILES:= \ |
42 | 43 | bootchart.cpp \ |
43 | 44 | builtins.cpp \ |
@@ -115,6 +115,7 @@ struct module_alias_node { | ||
115 | 115 | |
116 | 116 | struct module_blacklist_node { |
117 | 117 | char *name; |
118 | + bool deferred; | |
118 | 119 | struct listnode list; |
119 | 120 | }; |
120 | 121 |
@@ -852,7 +853,7 @@ static void handle_generic_device_event(struct uevent *uevent) | ||
852 | 853 | uevent->major, uevent->minor, links); |
853 | 854 | } |
854 | 855 | |
855 | -static int is_module_blacklisted(const char *name) | |
856 | +static int is_module_blacklisted_or_deferred(const char *name, bool need_deferred) | |
856 | 857 | { |
857 | 858 | struct listnode *blklst_node; |
858 | 859 | struct module_blacklist_node *blacklist; |
@@ -867,7 +868,7 @@ static int is_module_blacklisted(const char *name) | ||
867 | 868 | list); |
868 | 869 | if (!strcmp(name, blacklist->name)) { |
869 | 870 | INFO("modules %s is blacklisted\n", name); |
870 | - ret = 1; | |
871 | + ret = blacklist->deferred ? (need_deferred ? 2 : 0) : 1; | |
871 | 872 | goto out; |
872 | 873 | } |
873 | 874 | } |
@@ -876,7 +877,7 @@ out: | ||
876 | 877 | return ret; |
877 | 878 | } |
878 | 879 | |
879 | -static int load_module_by_device_modalias(const char *id) | |
880 | +static int load_module_by_device_modalias(const char *id, bool need_deferred) | |
880 | 881 | { |
881 | 882 | struct listnode *alias_node; |
882 | 883 | struct module_alias_node *alias; |
@@ -889,8 +890,9 @@ static int load_module_by_device_modalias(const char *id) | ||
889 | 890 | if (fnmatch(alias->pattern, id, 0) == 0) { |
890 | 891 | INFO("trying to load module %s due to uevents\n", alias->name); |
891 | 892 | |
892 | - if (!is_module_blacklisted(alias->name)) { | |
893 | - if (insmod_by_dep(alias->name, "", NULL, 0, NULL)) { | |
893 | + ret = is_module_blacklisted_or_deferred(alias->name, need_deferred); | |
894 | + if (ret == 0) { | |
895 | + if ((ret = insmod_by_dep(alias->name, "", NULL, 0, NULL))) { | |
894 | 896 | /* cannot load module. try another one since |
895 | 897 | * there may be another match. |
896 | 898 | */ |
@@ -899,8 +901,9 @@ static int load_module_by_device_modalias(const char *id) | ||
899 | 901 | } else { |
900 | 902 | /* loading was successful */ |
901 | 903 | INFO("loaded module %s due to uevents\n", alias->name); |
902 | - ret = 0; | |
903 | 904 | } |
905 | + } else { | |
906 | + NOTICE("blacklisted module %s: %d\n", alias->name, ret); | |
904 | 907 | } |
905 | 908 | } |
906 | 909 | } |
@@ -924,7 +927,7 @@ static void handle_deferred_module_loading() | ||
924 | 927 | |
925 | 928 | if (alias && alias->pattern) { |
926 | 929 | INFO("deferred loading of module for %s\n", alias->pattern); |
927 | - load_module_by_device_modalias(alias->pattern); | |
930 | + load_module_by_device_modalias(alias->pattern, false); | |
928 | 931 | free(alias->pattern); |
929 | 932 | list_remove(node); |
930 | 933 | free(alias); |
@@ -942,7 +945,12 @@ int module_probe(const char *modalias) | ||
942 | 945 | return -1; |
943 | 946 | } |
944 | 947 | |
945 | - return modalias ? load_module_by_device_modalias(modalias) : -1; | |
948 | + return modalias ? load_module_by_device_modalias(modalias, false) : -1; | |
949 | +} | |
950 | + | |
951 | +static int is_booting(void) | |
952 | +{ | |
953 | + return access("/dev/.booting", F_OK) == 0; | |
946 | 954 | } |
947 | 955 | |
948 | 956 | static void handle_module_loading(const char *modalias) |
@@ -955,13 +963,13 @@ static void handle_module_loading(const char *modalias) | ||
955 | 963 | if (list_empty(&modules_aliases_map)) { |
956 | 964 | if (read_modules_aliases() == 0) { |
957 | 965 | read_modules_blacklist(); |
958 | - handle_deferred_module_loading(); | |
959 | 966 | } |
960 | 967 | } |
961 | 968 | |
962 | 969 | if (!modalias) return; |
963 | 970 | |
964 | - if (list_empty(&modules_aliases_map)) { | |
971 | + if (list_empty(&modules_aliases_map) || | |
972 | + load_module_by_device_modalias(modalias, is_booting()) == 2) { | |
965 | 973 | /* if module alias mapping is empty, |
966 | 974 | * queue it for loading later |
967 | 975 | */ |
@@ -978,8 +986,6 @@ static void handle_module_loading(const char *modalias) | ||
978 | 986 | } else { |
979 | 987 | ERROR("failed to allocate memory to store device id for deferred module loading.\n"); |
980 | 988 | } |
981 | - } else { | |
982 | - load_module_by_device_modalias(modalias); | |
983 | 989 | } |
984 | 990 | |
985 | 991 | } |
@@ -1045,11 +1051,6 @@ static int load_firmware(int fw_fd, gzFile gz_fd, int loading_fd, int data_fd) | ||
1045 | 1051 | return ret; |
1046 | 1052 | } |
1047 | 1053 | |
1048 | -static int is_booting(void) | |
1049 | -{ | |
1050 | - return access("/dev/.booting", F_OK) == 0; | |
1051 | -} | |
1052 | - | |
1053 | 1054 | gzFile fw_gzopen(const char *fname, const char *mode) |
1054 | 1055 | { |
1055 | 1056 | char *file1 = NULL; |
@@ -1190,6 +1191,7 @@ static void parse_line_module_alias(struct parse_state *state, int nargs, char * | ||
1190 | 1191 | static void parse_line_module_blacklist(struct parse_state *state, int nargs, char **args) |
1191 | 1192 | { |
1192 | 1193 | struct module_blacklist_node *node; |
1194 | + bool deferred; | |
1193 | 1195 | |
1194 | 1196 | if (!args || |
1195 | 1197 | (nargs != 2) || |
@@ -1198,8 +1200,13 @@ static void parse_line_module_blacklist(struct parse_state *state, int nargs, ch | ||
1198 | 1200 | return; |
1199 | 1201 | } |
1200 | 1202 | |
1201 | - /* this line does not being with "blacklist" */ | |
1202 | - if (strncmp(args[0], "blacklist", 9)) return; | |
1203 | + /* this line should be with "blacklist" or "deferred" */ | |
1204 | + if (!strncmp(args[0], "blacklist", 9)) | |
1205 | + deferred = false; | |
1206 | + else if (!strncmp(args[0], "deferred", 8)) | |
1207 | + deferred = true; | |
1208 | + else | |
1209 | + return; | |
1203 | 1210 | |
1204 | 1211 | node = (module_blacklist_node *) calloc(1, sizeof(*node)); |
1205 | 1212 | if (!node) return; |
@@ -1209,6 +1216,7 @@ static void parse_line_module_blacklist(struct parse_state *state, int nargs, ch | ||
1209 | 1216 | free(node); |
1210 | 1217 | return; |
1211 | 1218 | } |
1219 | + node->deferred = deferred; | |
1212 | 1220 | |
1213 | 1221 | list_add_tail(&modules_blacklist, &node->list); |
1214 | 1222 | } |
@@ -1406,6 +1414,7 @@ void device_init(bool child) | ||
1406 | 1414 | coldboot("/sys/class"); |
1407 | 1415 | coldboot("/sys/block"); |
1408 | 1416 | coldboot("/sys/devices"); |
1417 | + handle_deferred_module_loading(); | |
1409 | 1418 | close(open(COLDBOOT_DONE, O_WRONLY|O_CREAT|O_CLOEXEC, 0000)); |
1410 | 1419 | NOTICE("Coldboot took %.2fs.\n", t.duration()); |
1411 | 1420 | } |
@@ -818,7 +818,7 @@ static void export_kernel_boot_props() { | ||
818 | 818 | { "ro.boot.mode", "ro.bootmode", "unknown", }, |
819 | 819 | { "ro.boot.baseband", "ro.baseband", "unknown", }, |
820 | 820 | { "ro.boot.bootloader", "ro.bootloader", "unknown", }, |
821 | - { "ro.boot.hardware", "ro.hardware", "unknown", }, | |
821 | + { "ro.boot.hardware", "ro.hardware", TARGET_PRODUCT, }, | |
822 | 822 | #ifndef IGNORE_RO_BOOT_REVISION |
823 | 823 | { "ro.boot.revision", "ro.revision", "0", }, |
824 | 824 | #endif |