diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig.debug | 12 | ||||
-rw-r--r-- | lib/Makefile | 6 | ||||
-rw-r--r-- | lib/asn1_decoder.c | 2 | ||||
-rw-r--r-- | lib/bitmap.c | 2 | ||||
-rw-r--r-- | lib/cpumask.c | 2 | ||||
-rw-r--r-- | lib/earlycpio.c | 145 | ||||
-rw-r--r-- | lib/mpi/longlong.h | 19 |
7 files changed, 174 insertions, 14 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 28e9d6c98941..e458782f3c52 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -972,7 +972,7 @@ config RCU_CPU_STALL_TIMEOUT | |||
972 | int "RCU CPU stall timeout in seconds" | 972 | int "RCU CPU stall timeout in seconds" |
973 | depends on TREE_RCU || TREE_PREEMPT_RCU | 973 | depends on TREE_RCU || TREE_PREEMPT_RCU |
974 | range 3 300 | 974 | range 3 300 |
975 | default 60 | 975 | default 21 |
976 | help | 976 | help |
977 | If a given RCU grace period extends more than the specified | 977 | If a given RCU grace period extends more than the specified |
978 | number of seconds, a CPU stall warning is printed. If the | 978 | number of seconds, a CPU stall warning is printed. If the |
@@ -1115,7 +1115,7 @@ config NOTIFIER_ERROR_INJECTION | |||
1115 | depends on DEBUG_KERNEL | 1115 | depends on DEBUG_KERNEL |
1116 | select DEBUG_FS | 1116 | select DEBUG_FS |
1117 | help | 1117 | help |
1118 | This option provides the ability to inject artifical errors to | 1118 | This option provides the ability to inject artificial errors to |
1119 | specified notifier chain callbacks. It is useful to test the error | 1119 | specified notifier chain callbacks. It is useful to test the error |
1120 | handling of notifier call chain failures. | 1120 | handling of notifier call chain failures. |
1121 | 1121 | ||
@@ -1126,7 +1126,7 @@ config CPU_NOTIFIER_ERROR_INJECT | |||
1126 | depends on HOTPLUG_CPU && NOTIFIER_ERROR_INJECTION | 1126 | depends on HOTPLUG_CPU && NOTIFIER_ERROR_INJECTION |
1127 | help | 1127 | help |
1128 | This option provides a kernel module that can be used to test | 1128 | This option provides a kernel module that can be used to test |
1129 | the error handling of the cpu notifiers by injecting artifical | 1129 | the error handling of the cpu notifiers by injecting artificial |
1130 | errors to CPU notifier chain callbacks. It is controlled through | 1130 | errors to CPU notifier chain callbacks. It is controlled through |
1131 | debugfs interface under /sys/kernel/debug/notifier-error-inject/cpu | 1131 | debugfs interface under /sys/kernel/debug/notifier-error-inject/cpu |
1132 | 1132 | ||
@@ -1150,7 +1150,7 @@ config PM_NOTIFIER_ERROR_INJECT | |||
1150 | depends on PM && NOTIFIER_ERROR_INJECTION | 1150 | depends on PM && NOTIFIER_ERROR_INJECTION |
1151 | default m if PM_DEBUG | 1151 | default m if PM_DEBUG |
1152 | help | 1152 | help |
1153 | This option provides the ability to inject artifical errors to | 1153 | This option provides the ability to inject artificial errors to |
1154 | PM notifier chain callbacks. It is controlled through debugfs | 1154 | PM notifier chain callbacks. It is controlled through debugfs |
1155 | interface /sys/kernel/debug/notifier-error-inject/pm | 1155 | interface /sys/kernel/debug/notifier-error-inject/pm |
1156 | 1156 | ||
@@ -1173,7 +1173,7 @@ config MEMORY_NOTIFIER_ERROR_INJECT | |||
1173 | tristate "Memory hotplug notifier error injection module" | 1173 | tristate "Memory hotplug notifier error injection module" |
1174 | depends on MEMORY_HOTPLUG_SPARSE && NOTIFIER_ERROR_INJECTION | 1174 | depends on MEMORY_HOTPLUG_SPARSE && NOTIFIER_ERROR_INJECTION |
1175 | help | 1175 | help |
1176 | This option provides the ability to inject artifical errors to | 1176 | This option provides the ability to inject artificial errors to |
1177 | memory hotplug notifier chain callbacks. It is controlled through | 1177 | memory hotplug notifier chain callbacks. It is controlled through |
1178 | debugfs interface under /sys/kernel/debug/notifier-error-inject/memory | 1178 | debugfs interface under /sys/kernel/debug/notifier-error-inject/memory |
1179 | 1179 | ||
@@ -1196,7 +1196,7 @@ config PSERIES_RECONFIG_NOTIFIER_ERROR_INJECT | |||
1196 | tristate "pSeries reconfig notifier error injection module" | 1196 | tristate "pSeries reconfig notifier error injection module" |
1197 | depends on PPC_PSERIES && NOTIFIER_ERROR_INJECTION | 1197 | depends on PPC_PSERIES && NOTIFIER_ERROR_INJECTION |
1198 | help | 1198 | help |
1199 | This option provides the ability to inject artifical errors to | 1199 | This option provides the ability to inject artificial errors to |
1200 | pSeries reconfig notifier chain callbacks. It is controlled | 1200 | pSeries reconfig notifier chain callbacks. It is controlled |
1201 | through debugfs interface under | 1201 | through debugfs interface under |
1202 | /sys/kernel/debug/notifier-error-inject/pSeries-reconfig/ | 1202 | /sys/kernel/debug/notifier-error-inject/pSeries-reconfig/ |
diff --git a/lib/Makefile b/lib/Makefile index 821a16229111..e2152fa7ff4d 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -12,7 +12,8 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \ | |||
12 | idr.o int_sqrt.o extable.o \ | 12 | idr.o int_sqrt.o extable.o \ |
13 | sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \ | 13 | sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \ |
14 | proportions.o flex_proportions.o prio_heap.o ratelimit.o show_mem.o \ | 14 | proportions.o flex_proportions.o prio_heap.o ratelimit.o show_mem.o \ |
15 | is_single_threaded.o plist.o decompress.o | 15 | is_single_threaded.o plist.o decompress.o kobject_uevent.o \ |
16 | earlycpio.o | ||
16 | 17 | ||
17 | lib-$(CONFIG_MMU) += ioremap.o | 18 | lib-$(CONFIG_MMU) += ioremap.o |
18 | lib-$(CONFIG_SMP) += cpumask.o | 19 | lib-$(CONFIG_SMP) += cpumask.o |
@@ -31,7 +32,6 @@ CFLAGS_kobject.o += -DDEBUG | |||
31 | CFLAGS_kobject_uevent.o += -DDEBUG | 32 | CFLAGS_kobject_uevent.o += -DDEBUG |
32 | endif | 33 | endif |
33 | 34 | ||
34 | lib-$(CONFIG_HOTPLUG) += kobject_uevent.o | ||
35 | obj-$(CONFIG_GENERIC_IOMAP) += iomap.o | 35 | obj-$(CONFIG_GENERIC_IOMAP) += iomap.o |
36 | obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o | 36 | obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o |
37 | obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o | 37 | obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o |
@@ -163,7 +163,7 @@ $(obj)/crc32table.h: $(obj)/gen_crc32table | |||
163 | # | 163 | # |
164 | obj-$(CONFIG_OID_REGISTRY) += oid_registry.o | 164 | obj-$(CONFIG_OID_REGISTRY) += oid_registry.o |
165 | 165 | ||
166 | $(obj)/oid_registry.c: $(obj)/oid_registry_data.c | 166 | $(obj)/oid_registry.o: $(obj)/oid_registry_data.c |
167 | 167 | ||
168 | $(obj)/oid_registry_data.c: $(srctree)/include/linux/oid_registry.h \ | 168 | $(obj)/oid_registry_data.c: $(srctree)/include/linux/oid_registry.h \ |
169 | $(src)/build_OID_registry | 169 | $(src)/build_OID_registry |
diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c index de2c8b5a715b..5293d2433029 100644 --- a/lib/asn1_decoder.c +++ b/lib/asn1_decoder.c | |||
@@ -91,7 +91,7 @@ next_tag: | |||
91 | 91 | ||
92 | /* Extract the length */ | 92 | /* Extract the length */ |
93 | len = data[dp++]; | 93 | len = data[dp++]; |
94 | if (len < 0x7f) { | 94 | if (len <= 0x7f) { |
95 | dp += len; | 95 | dp += len; |
96 | goto next_tag; | 96 | goto next_tag; |
97 | } | 97 | } |
diff --git a/lib/bitmap.c b/lib/bitmap.c index 06fdfa1aeba7..06f7e4fe8d2d 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c | |||
@@ -353,7 +353,7 @@ again: | |||
353 | EXPORT_SYMBOL(bitmap_find_next_zero_area); | 353 | EXPORT_SYMBOL(bitmap_find_next_zero_area); |
354 | 354 | ||
355 | /* | 355 | /* |
356 | * Bitmap printing & parsing functions: first version by Bill Irwin, | 356 | * Bitmap printing & parsing functions: first version by Nadia Yvette Chambers, |
357 | * second version by Paul Jackson, third by Joe Korty. | 357 | * second version by Paul Jackson, third by Joe Korty. |
358 | */ | 358 | */ |
359 | 359 | ||
diff --git a/lib/cpumask.c b/lib/cpumask.c index 402a54ac35cb..d327b87c99b7 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c | |||
@@ -161,6 +161,6 @@ EXPORT_SYMBOL(free_cpumask_var); | |||
161 | */ | 161 | */ |
162 | void __init free_bootmem_cpumask_var(cpumask_var_t mask) | 162 | void __init free_bootmem_cpumask_var(cpumask_var_t mask) |
163 | { | 163 | { |
164 | free_bootmem((unsigned long)mask, cpumask_size()); | 164 | free_bootmem(__pa(mask), cpumask_size()); |
165 | } | 165 | } |
166 | #endif | 166 | #endif |
diff --git a/lib/earlycpio.c b/lib/earlycpio.c new file mode 100644 index 000000000000..8078ef49cb79 --- /dev/null +++ b/lib/earlycpio.c | |||
@@ -0,0 +1,145 @@ | |||
1 | /* ----------------------------------------------------------------------- * | ||
2 | * | ||
3 | * Copyright 2012 Intel Corporation; author H. Peter Anvin | ||
4 | * | ||
5 | * This file is part of the Linux kernel, and is made available | ||
6 | * under the terms of the GNU General Public License version 2, as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but | ||
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | * General Public License for more details. | ||
13 | * | ||
14 | * ----------------------------------------------------------------------- */ | ||
15 | |||
16 | /* | ||
17 | * earlycpio.c | ||
18 | * | ||
19 | * Find a specific cpio member; must precede any compressed content. | ||
20 | * This is used to locate data items in the initramfs used by the | ||
21 | * kernel itself during early boot (before the main initramfs is | ||
22 | * decompressed.) It is the responsibility of the initramfs creator | ||
23 | * to ensure that these items are uncompressed at the head of the | ||
24 | * blob. Depending on the boot loader or package tool that may be a | ||
25 | * separate file or part of the same file. | ||
26 | */ | ||
27 | |||
28 | #include <linux/earlycpio.h> | ||
29 | #include <linux/kernel.h> | ||
30 | #include <linux/string.h> | ||
31 | |||
32 | enum cpio_fields { | ||
33 | C_MAGIC, | ||
34 | C_INO, | ||
35 | C_MODE, | ||
36 | C_UID, | ||
37 | C_GID, | ||
38 | C_NLINK, | ||
39 | C_MTIME, | ||
40 | C_FILESIZE, | ||
41 | C_MAJ, | ||
42 | C_MIN, | ||
43 | C_RMAJ, | ||
44 | C_RMIN, | ||
45 | C_NAMESIZE, | ||
46 | C_CHKSUM, | ||
47 | C_NFIELDS | ||
48 | }; | ||
49 | |||
50 | /** | ||
51 | * cpio_data find_cpio_data - Search for files in an uncompressed cpio | ||
52 | * @path: The directory to search for, including a slash at the end | ||
53 | * @data: Pointer to the the cpio archive or a header inside | ||
54 | * @len: Remaining length of the cpio based on data pointer | ||
55 | * @offset: When a matching file is found, this is the offset to the | ||
56 | * beginning of the cpio. It can be used to iterate through | ||
57 | * the cpio to find all files inside of a directory path | ||
58 | * | ||
59 | * @return: struct cpio_data containing the address, length and | ||
60 | * filename (with the directory path cut off) of the found file. | ||
61 | * If you search for a filename and not for files in a directory, | ||
62 | * pass the absolute path of the filename in the cpio and make sure | ||
63 | * the match returned an empty filename string. | ||
64 | */ | ||
65 | |||
66 | struct cpio_data __cpuinit find_cpio_data(const char *path, void *data, | ||
67 | size_t len, long *offset) | ||
68 | { | ||
69 | const size_t cpio_header_len = 8*C_NFIELDS - 2; | ||
70 | struct cpio_data cd = { NULL, 0, "" }; | ||
71 | const char *p, *dptr, *nptr; | ||
72 | unsigned int ch[C_NFIELDS], *chp, v; | ||
73 | unsigned char c, x; | ||
74 | size_t mypathsize = strlen(path); | ||
75 | int i, j; | ||
76 | |||
77 | p = data; | ||
78 | |||
79 | while (len > cpio_header_len) { | ||
80 | if (!*p) { | ||
81 | /* All cpio headers need to be 4-byte aligned */ | ||
82 | p += 4; | ||
83 | len -= 4; | ||
84 | continue; | ||
85 | } | ||
86 | |||
87 | j = 6; /* The magic field is only 6 characters */ | ||
88 | chp = ch; | ||
89 | for (i = C_NFIELDS; i; i--) { | ||
90 | v = 0; | ||
91 | while (j--) { | ||
92 | v <<= 4; | ||
93 | c = *p++; | ||
94 | |||
95 | x = c - '0'; | ||
96 | if (x < 10) { | ||
97 | v += x; | ||
98 | continue; | ||
99 | } | ||
100 | |||
101 | x = (c | 0x20) - 'a'; | ||
102 | if (x < 6) { | ||
103 | v += x + 10; | ||
104 | continue; | ||
105 | } | ||
106 | |||
107 | goto quit; /* Invalid hexadecimal */ | ||
108 | } | ||
109 | *chp++ = v; | ||
110 | j = 8; /* All other fields are 8 characters */ | ||
111 | } | ||
112 | |||
113 | if ((ch[C_MAGIC] - 0x070701) > 1) | ||
114 | goto quit; /* Invalid magic */ | ||
115 | |||
116 | len -= cpio_header_len; | ||
117 | |||
118 | dptr = PTR_ALIGN(p + ch[C_NAMESIZE], 4); | ||
119 | nptr = PTR_ALIGN(dptr + ch[C_FILESIZE], 4); | ||
120 | |||
121 | if (nptr > p + len || dptr < p || nptr < dptr) | ||
122 | goto quit; /* Buffer overrun */ | ||
123 | |||
124 | if ((ch[C_MODE] & 0170000) == 0100000 && | ||
125 | ch[C_NAMESIZE] >= mypathsize && | ||
126 | !memcmp(p, path, mypathsize)) { | ||
127 | *offset = (long)nptr - (long)data; | ||
128 | if (ch[C_NAMESIZE] - mypathsize >= MAX_CPIO_FILE_NAME) { | ||
129 | pr_warn( | ||
130 | "File %s exceeding MAX_CPIO_FILE_NAME [%d]\n", | ||
131 | p, MAX_CPIO_FILE_NAME); | ||
132 | } | ||
133 | strlcpy(cd.name, p + mypathsize, MAX_CPIO_FILE_NAME); | ||
134 | |||
135 | cd.data = (void *)dptr; | ||
136 | cd.size = ch[C_FILESIZE]; | ||
137 | return cd; /* Found it! */ | ||
138 | } | ||
139 | len -= (nptr - p); | ||
140 | p = nptr; | ||
141 | } | ||
142 | |||
143 | quit: | ||
144 | return cd; | ||
145 | } | ||
diff --git a/lib/mpi/longlong.h b/lib/mpi/longlong.h index 678ce4f1e124..095ab157a521 100644 --- a/lib/mpi/longlong.h +++ b/lib/mpi/longlong.h | |||
@@ -641,7 +641,14 @@ do { \ | |||
641 | ************** MIPS ***************** | 641 | ************** MIPS ***************** |
642 | ***************************************/ | 642 | ***************************************/ |
643 | #if defined(__mips__) && W_TYPE_SIZE == 32 | 643 | #if defined(__mips__) && W_TYPE_SIZE == 32 |
644 | #if __GNUC__ > 2 || __GNUC_MINOR__ >= 7 | 644 | #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 4 |
645 | #define umul_ppmm(w1, w0, u, v) \ | ||
646 | do { \ | ||
647 | UDItype __ll = (UDItype)(u) * (v); \ | ||
648 | w1 = __ll >> 32; \ | ||
649 | w0 = __ll; \ | ||
650 | } while (0) | ||
651 | #elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7 | ||
645 | #define umul_ppmm(w1, w0, u, v) \ | 652 | #define umul_ppmm(w1, w0, u, v) \ |
646 | __asm__ ("multu %2,%3" \ | 653 | __asm__ ("multu %2,%3" \ |
647 | : "=l" ((USItype)(w0)), \ | 654 | : "=l" ((USItype)(w0)), \ |
@@ -666,7 +673,15 @@ do { \ | |||
666 | ************** MIPS/64 ************** | 673 | ************** MIPS/64 ************** |
667 | ***************************************/ | 674 | ***************************************/ |
668 | #if (defined(__mips) && __mips >= 3) && W_TYPE_SIZE == 64 | 675 | #if (defined(__mips) && __mips >= 3) && W_TYPE_SIZE == 64 |
669 | #if __GNUC__ > 2 || __GNUC_MINOR__ >= 7 | 676 | #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 4 |
677 | #define umul_ppmm(w1, w0, u, v) \ | ||
678 | do { \ | ||
679 | typedef unsigned int __ll_UTItype __attribute__((mode(TI))); \ | ||
680 | __ll_UTItype __ll = (__ll_UTItype)(u) * (v); \ | ||
681 | w1 = __ll >> 64; \ | ||
682 | w0 = __ll; \ | ||
683 | } while (0) | ||
684 | #elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7 | ||
670 | #define umul_ppmm(w1, w0, u, v) \ | 685 | #define umul_ppmm(w1, w0, u, v) \ |
671 | __asm__ ("dmultu %2,%3" \ | 686 | __asm__ ("dmultu %2,%3" \ |
672 | : "=l" ((UDItype)(w0)), \ | 687 | : "=l" ((UDItype)(w0)), \ |