1 |
commit: 9a50db0860fc67bacfcb9dfde3fa567f7f3c6b4e |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Aug 2 16:51:17 2017 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Aug 2 16:51:17 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=9a50db08 |
7 |
|
8 |
Gentoo Linux support config settings and defaults. Patch to add support for namespace user.pax.* on tmpfs. Patch to enable link security restrictions by default. Patch to ensure that /dev/root doesn't appear in /proc/mounts when booting without an initramfs. Patch to enable control of the unaligned access control policy from sysctl. Workaround to enable poweroff on Mac Pro 11. See bug #601964. Kernel patch enables gcc >= v4.9 optimizations for additional CPUs. fbcondecor bootsplash patch. |
9 |
|
10 |
0000_README | 32 + |
11 |
1500_XATTR_USER_PREFIX.patch | 69 + |
12 |
...ble-link-security-restrictions-by-default.patch | 22 + |
13 |
2300_enable-poweroff-on-Mac-Pro-11.patch | 76 + |
14 |
2600_enable-key-swapping-for-apple-mac.patch | 114 ++ |
15 |
2900_dev-root-proc-mount-fix.patch | 38 + |
16 |
4200_fbcondecor.patch | 2095 ++++++++++++++++++++ |
17 |
4400_alpha-sysctl-uac.patch | 142 ++ |
18 |
...able-additional-cpu-optimizations-for-gcc.patch | 530 +++++ |
19 |
9 files changed, 3118 insertions(+) |
20 |
|
21 |
diff --git a/0000_README b/0000_README |
22 |
index 9018993..b6b8110 100644 |
23 |
--- a/0000_README |
24 |
+++ b/0000_README |
25 |
@@ -43,6 +43,38 @@ EXPERIMENTAL |
26 |
Individual Patch Descriptions: |
27 |
-------------------------------------------------------------------------- |
28 |
|
29 |
+Patch: 1500_XATTR_USER_PREFIX.patch |
30 |
+From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
31 |
+Desc: Support for namespace user.pax.* on tmpfs. |
32 |
+ |
33 |
+Patch: 1510_fs-enable-link-security-restrictions-by-default.patch |
34 |
+From: http://sources.debian.net/src/linux/3.16.7-ckt4-3/debian/patches/debian/fs-enable-link-security-restrictions-by-default.patch/ |
35 |
+Desc: Enable link security restrictions by default. |
36 |
+ |
37 |
+Patch: 2300_enable-poweroff-on-Mac-Pro-11.patch |
38 |
+From: http://kernel.ubuntu.com/git/ubuntu/ubuntu-xenial.git/patch/drivers/pci/quirks.c?id=5080ff61a438f3dd80b88b423e1a20791d8a774c |
39 |
+Desc: Workaround to enable poweroff on Mac Pro 11. See bug #601964. |
40 |
+ |
41 |
+Patch: 2600_enable-key-swapping-for-apple-mac.patch |
42 |
+From: https://github.com/free5lot/hid-apple-patched |
43 |
+Desc: This hid-apple patch enables swapping of the FN and left Control keys and some additional on some apple keyboards. See bug #622902 |
44 |
+ |
45 |
+Patch: 2900_dev-root-proc-mount-fix.patch |
46 |
+From: https://bugs.gentoo.org/show_bug.cgi?id=438380 |
47 |
+Desc: Ensure that /dev/root doesn't appear in /proc/mounts when bootint without an initramfs. |
48 |
+ |
49 |
+Patch: 4200_fbcondecor.patch |
50 |
+From: http://www.mepiscommunity.org/fbcondecor |
51 |
+Desc: Bootsplash ported by Uladzimir Bely. (Bug #596126) |
52 |
+ |
53 |
+Patch: 4400_alpha-sysctl-uac.patch |
54 |
+From: Tobias Klausmann (klausman@g.o) and http://bugs.gentoo.org/show_bug.cgi?id=217323 |
55 |
+Desc: Enable control of the unaligned access control policy from sysctl |
56 |
+ |
57 |
Patch: 4567_distro-Gentoo-Kconfig.patch |
58 |
From: Tom Wijsman <TomWij@g.o> |
59 |
Desc: Add Gentoo Linux support config settings and defaults. |
60 |
+ |
61 |
+Patch: 5010_enable-additional-cpu-optimizations-for-gcc.patch |
62 |
+From: https://github.com/graysky2/kernel_gcc_patch/ |
63 |
+Desc: Kernel patch enables gcc >= v4.9 optimizations for additional CPUs. |
64 |
|
65 |
diff --git a/1500_XATTR_USER_PREFIX.patch b/1500_XATTR_USER_PREFIX.patch |
66 |
new file mode 100644 |
67 |
index 0000000..bacd032 |
68 |
--- /dev/null |
69 |
+++ b/1500_XATTR_USER_PREFIX.patch |
70 |
@@ -0,0 +1,69 @@ |
71 |
+From: Anthony G. Basile <blueness@g.o> |
72 |
+ |
73 |
+This patch adds support for a restricted user-controlled namespace on |
74 |
+tmpfs filesystem used to house PaX flags. The namespace must be of the |
75 |
+form user.pax.* and its value cannot exceed a size of 8 bytes. |
76 |
+ |
77 |
+This is needed even on all Gentoo systems so that XATTR_PAX flags |
78 |
+are preserved for users who might build packages using portage on |
79 |
+a tmpfs system with a non-hardened kernel and then switch to a |
80 |
+hardened kernel with XATTR_PAX enabled. |
81 |
+ |
82 |
+The namespace is added to any user with Extended Attribute support |
83 |
+enabled for tmpfs. Users who do not enable xattrs will not have |
84 |
+the XATTR_PAX flags preserved. |
85 |
+ |
86 |
+diff --git a/include/uapi/linux/xattr.h b/include/uapi/linux/xattr.h |
87 |
+index 1590c49..5eab462 100644 |
88 |
+--- a/include/uapi/linux/xattr.h |
89 |
++++ b/include/uapi/linux/xattr.h |
90 |
+@@ -73,5 +73,9 @@ |
91 |
+ #define XATTR_POSIX_ACL_DEFAULT "posix_acl_default" |
92 |
+ #define XATTR_NAME_POSIX_ACL_DEFAULT XATTR_SYSTEM_PREFIX XATTR_POSIX_ACL_DEFAULT |
93 |
+ |
94 |
++/* User namespace */ |
95 |
++#define XATTR_PAX_PREFIX XATTR_USER_PREFIX "pax." |
96 |
++#define XATTR_PAX_FLAGS_SUFFIX "flags" |
97 |
++#define XATTR_NAME_PAX_FLAGS XATTR_PAX_PREFIX XATTR_PAX_FLAGS_SUFFIX |
98 |
+ |
99 |
+ #endif /* _UAPI_LINUX_XATTR_H */ |
100 |
+diff --git a/mm/shmem.c b/mm/shmem.c |
101 |
+index 440e2a7..c377172 100644 |
102 |
+--- a/mm/shmem.c |
103 |
++++ b/mm/shmem.c |
104 |
+@@ -2667,6 +2667,14 @@ static int shmem_xattr_handler_set(const struct xattr_handler *handler, |
105 |
+ struct shmem_inode_info *info = SHMEM_I(d_inode(dentry)); |
106 |
+ |
107 |
+ name = xattr_full_name(handler, name); |
108 |
++ |
109 |
++ if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) { |
110 |
++ if (strcmp(name, XATTR_NAME_PAX_FLAGS)) |
111 |
++ return -EOPNOTSUPP; |
112 |
++ if (size > 8) |
113 |
++ return -EINVAL; |
114 |
++ } |
115 |
++ |
116 |
+ return simple_xattr_set(&info->xattrs, name, value, size, flags); |
117 |
+ } |
118 |
+ |
119 |
+@@ -2682,6 +2690,12 @@ static const struct xattr_handler shmem_trusted_xattr_handler = { |
120 |
+ .set = shmem_xattr_handler_set, |
121 |
+ }; |
122 |
+ |
123 |
++static const struct xattr_handler shmem_user_xattr_handler = { |
124 |
++ .prefix = XATTR_USER_PREFIX, |
125 |
++ .get = shmem_xattr_handler_get, |
126 |
++ .set = shmem_xattr_handler_set, |
127 |
++}; |
128 |
++ |
129 |
+ static const struct xattr_handler *shmem_xattr_handlers[] = { |
130 |
+ #ifdef CONFIG_TMPFS_POSIX_ACL |
131 |
+ &posix_acl_access_xattr_handler, |
132 |
+@@ -2689,6 +2703,7 @@ static const struct xattr_handler *shmem_xattr_handlers[] = { |
133 |
+ #endif |
134 |
+ &shmem_security_xattr_handler, |
135 |
+ &shmem_trusted_xattr_handler, |
136 |
++ &shmem_user_xattr_handler, |
137 |
+ NULL |
138 |
+ }; |
139 |
+ |
140 |
|
141 |
diff --git a/1510_fs-enable-link-security-restrictions-by-default.patch b/1510_fs-enable-link-security-restrictions-by-default.patch |
142 |
new file mode 100644 |
143 |
index 0000000..639fb3c |
144 |
--- /dev/null |
145 |
+++ b/1510_fs-enable-link-security-restrictions-by-default.patch |
146 |
@@ -0,0 +1,22 @@ |
147 |
+From: Ben Hutchings <ben@××××××××××××.uk> |
148 |
+Subject: fs: Enable link security restrictions by default |
149 |
+Date: Fri, 02 Nov 2012 05:32:06 +0000 |
150 |
+Bug-Debian: https://bugs.debian.org/609455 |
151 |
+Forwarded: not-needed |
152 |
+ |
153 |
+This reverts commit 561ec64ae67ef25cac8d72bb9c4bfc955edfd415 |
154 |
+('VFS: don't do protected {sym,hard}links by default'). |
155 |
+ |
156 |
+--- a/fs/namei.c |
157 |
++++ b/fs/namei.c |
158 |
+@@ -651,8 +651,8 @@ static inline void put_link(struct namei |
159 |
+ path_put(link); |
160 |
+ } |
161 |
+ |
162 |
+-int sysctl_protected_symlinks __read_mostly = 0; |
163 |
+-int sysctl_protected_hardlinks __read_mostly = 0; |
164 |
++int sysctl_protected_symlinks __read_mostly = 1; |
165 |
++int sysctl_protected_hardlinks __read_mostly = 1; |
166 |
+ |
167 |
+ /** |
168 |
+ * may_follow_link - Check symlink following for unsafe situations |
169 |
|
170 |
diff --git a/2300_enable-poweroff-on-Mac-Pro-11.patch b/2300_enable-poweroff-on-Mac-Pro-11.patch |
171 |
new file mode 100644 |
172 |
index 0000000..063f2a1 |
173 |
--- /dev/null |
174 |
+++ b/2300_enable-poweroff-on-Mac-Pro-11.patch |
175 |
@@ -0,0 +1,76 @@ |
176 |
+From 5080ff61a438f3dd80b88b423e1a20791d8a774c Mon Sep 17 00:00:00 2001 |
177 |
+From: Chen Yu <yu.c.chen@×××××.com> |
178 |
+Date: Fri, 19 Aug 2016 10:25:57 -0700 |
179 |
+Subject: UBUNTU: SAUCE: PCI: Workaround to enable poweroff on Mac Pro 11 |
180 |
+ |
181 |
+BugLink: http://bugs.launchpad.net/bugs/1587714 |
182 |
+ |
183 |
+People reported that they can not do a poweroff nor a |
184 |
+suspend to ram on their Mac Pro 11. After some investigations |
185 |
+it was found that, once the PCI bridge 0000:00:1c.0 reassigns its |
186 |
+mm windows to ([mem 0x7fa00000-0x7fbfffff] and |
187 |
+[mem 0x7fc00000-0x7fdfffff 64bit pref]), the region of ACPI |
188 |
+io resource 0x1804 becomes unaccessible immediately, where the |
189 |
+ACPI Sleep register is located, as a result neither poweroff(S5) |
190 |
+nor suspend to ram(S3) works. |
191 |
+ |
192 |
+As suggested by Bjorn, further testing shows that, there is an |
193 |
+unreported device may be (using) conflict with above aperture, |
194 |
+which brings unpredictable result such as the failure of accessing |
195 |
+the io port, which blocks the poweroff(S5). Besides if we reassign |
196 |
+the memory aperture to the other place, the poweroff works again. |
197 |
+ |
198 |
+As we do not find any resource declared in _CRS which contain above |
199 |
+memory aperture, and Mac OS does not use this pci bridge neither, we |
200 |
+choose a simple workaround to clear the hotplug flag(suggested by |
201 |
+Yinghai Lu), thus do not allocate any resource for this pci bridge, |
202 |
+and thereby no conflict anymore. |
203 |
+ |
204 |
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=103211 |
205 |
+Cc: Bjorn Helgaas <bhelgaas@××××××.com> |
206 |
+Cc: Rafael J. Wysocki <rafael@××××××.org> |
207 |
+Cc: Lukas Wunner <lukas@××××××.de> |
208 |
+Signed-off-by: Chen Yu <yu.c.chen@×××××.com> |
209 |
+Reference: https://patchwork.kernel.org/patch/9289777/ |
210 |
+Signed-off-by: Kamal Mostafa <kamal@×××××××××.com> |
211 |
+Acked-by: Brad Figg <brad.figg@×××××××××.com> |
212 |
+Acked-by: Stefan Bader <stefan.bader@×××××××××.com> |
213 |
+Signed-off-by: Tim Gardner <tim.gardner@×××××××××.com> |
214 |
+--- |
215 |
+ drivers/pci/quirks.c | 20 ++++++++++++++++++++ |
216 |
+ 1 file changed, 20 insertions(+) |
217 |
+ |
218 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
219 |
+index 48cfaa0..23968b6 100644 |
220 |
+--- a/drivers/pci/quirks.c |
221 |
++++ b/drivers/pci/quirks.c |
222 |
+@@ -2750,6 +2750,26 @@ static void quirk_hotplug_bridge(struct pci_dev *dev) |
223 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HINT, 0x0020, quirk_hotplug_bridge); |
224 |
+ |
225 |
+ /* |
226 |
++ * Apple: Avoid programming the memory/io aperture of 00:1c.0 |
227 |
++ * |
228 |
++ * BIOS does not declare any resource for 00:1c.0, but with |
229 |
++ * hotplug flag set, thus the OS allocates: |
230 |
++ * [mem 0x7fa00000 - 0x7fbfffff] |
231 |
++ * [mem 0x7fc00000-0x7fdfffff 64bit pref] |
232 |
++ * which is conflict with an unreported device, which |
233 |
++ * causes unpredictable result such as accessing io port. |
234 |
++ * So clear the hotplug flag to work around it. |
235 |
++ */ |
236 |
++static void quirk_apple_mbp_poweroff(struct pci_dev *dev) |
237 |
++{ |
238 |
++ if (dmi_match(DMI_PRODUCT_NAME, "MacBookPro11,4") || |
239 |
++ dmi_match(DMI_PRODUCT_NAME, "MacBookPro11,5")) |
240 |
++ dev->is_hotplug_bridge = 0; |
241 |
++} |
242 |
++ |
243 |
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x8c10, quirk_apple_mbp_poweroff); |
244 |
++ |
245 |
++/* |
246 |
+ * This is a quirk for the Ricoh MMC controller found as a part of |
247 |
+ * some mulifunction chips. |
248 |
+ |
249 |
+-- |
250 |
+cgit v0.11.2 |
251 |
+ |
252 |
|
253 |
diff --git a/2600_enable-key-swapping-for-apple-mac.patch b/2600_enable-key-swapping-for-apple-mac.patch |
254 |
new file mode 100644 |
255 |
index 0000000..ab228d3 |
256 |
--- /dev/null |
257 |
+++ b/2600_enable-key-swapping-for-apple-mac.patch |
258 |
@@ -0,0 +1,114 @@ |
259 |
+--- a/drivers/hid/hid-apple.c |
260 |
++++ b/drivers/hid/hid-apple.c |
261 |
+@@ -52,6 +52,22 @@ |
262 |
+ "(For people who want to keep Windows PC keyboard muscle memory. " |
263 |
+ "[0] = as-is, Mac layout. 1 = swapped, Windows layout.)"); |
264 |
+ |
265 |
++static unsigned int swap_fn_leftctrl; |
266 |
++module_param(swap_fn_leftctrl, uint, 0644); |
267 |
++MODULE_PARM_DESC(swap_fn_leftctrl, "Swap the Fn and left Control keys. " |
268 |
++ "(For people who want to keep PC keyboard muscle memory. " |
269 |
++ "[0] = as-is, Mac layout, 1 = swapped, PC layout)"); |
270 |
++ |
271 |
++static unsigned int rightalt_as_rightctrl; |
272 |
++module_param(rightalt_as_rightctrl, uint, 0644); |
273 |
++MODULE_PARM_DESC(rightalt_as_rightctrl, "Use the right Alt key as a right Ctrl key. " |
274 |
++ "[0] = as-is, Mac layout. 1 = Right Alt is right Ctrl"); |
275 |
++ |
276 |
++static unsigned int ejectcd_as_delete; |
277 |
++module_param(ejectcd_as_delete, uint, 0644); |
278 |
++MODULE_PARM_DESC(ejectcd_as_delete, "Use Eject-CD key as Delete key. " |
279 |
++ "([0] = disabled, 1 = enabled)"); |
280 |
++ |
281 |
+ struct apple_sc { |
282 |
+ unsigned long quirks; |
283 |
+ unsigned int fn_on; |
284 |
+@@ -164,6 +180,21 @@ |
285 |
+ { } |
286 |
+ }; |
287 |
+ |
288 |
++static const struct apple_key_translation swapped_fn_leftctrl_keys[] = { |
289 |
++ { KEY_FN, KEY_LEFTCTRL }, |
290 |
++ { } |
291 |
++}; |
292 |
++ |
293 |
++static const struct apple_key_translation rightalt_as_rightctrl_keys[] = { |
294 |
++ { KEY_RIGHTALT, KEY_RIGHTCTRL }, |
295 |
++ { } |
296 |
++}; |
297 |
++ |
298 |
++static const struct apple_key_translation ejectcd_as_delete_keys[] = { |
299 |
++ { KEY_EJECTCD, KEY_DELETE }, |
300 |
++ { } |
301 |
++}; |
302 |
++ |
303 |
+ static const struct apple_key_translation *apple_find_translation( |
304 |
+ const struct apple_key_translation *table, u16 from) |
305 |
+ { |
306 |
+@@ -183,9 +214,11 @@ |
307 |
+ struct apple_sc *asc = hid_get_drvdata(hid); |
308 |
+ const struct apple_key_translation *trans, *table; |
309 |
+ |
310 |
+- if (usage->code == KEY_FN) { |
311 |
++ u16 fn_keycode = (swap_fn_leftctrl) ? (KEY_LEFTCTRL) : (KEY_FN); |
312 |
++ |
313 |
++ if (usage->code == fn_keycode) { |
314 |
+ asc->fn_on = !!value; |
315 |
+- input_event(input, usage->type, usage->code, value); |
316 |
++ input_event(input, usage->type, KEY_FN, value); |
317 |
+ return 1; |
318 |
+ } |
319 |
+ |
320 |
+@@ -264,6 +297,30 @@ |
321 |
+ } |
322 |
+ } |
323 |
+ |
324 |
++ if (swap_fn_leftctrl) { |
325 |
++ trans = apple_find_translation(swapped_fn_leftctrl_keys, usage->code); |
326 |
++ if (trans) { |
327 |
++ input_event(input, usage->type, trans->to, value); |
328 |
++ return 1; |
329 |
++ } |
330 |
++ } |
331 |
++ |
332 |
++ if (ejectcd_as_delete) { |
333 |
++ trans = apple_find_translation(ejectcd_as_delete_keys, usage->code); |
334 |
++ if (trans) { |
335 |
++ input_event(input, usage->type, trans->to, value); |
336 |
++ return 1; |
337 |
++ } |
338 |
++ } |
339 |
++ |
340 |
++ if (rightalt_as_rightctrl) { |
341 |
++ trans = apple_find_translation(rightalt_as_rightctrl_keys, usage->code); |
342 |
++ if (trans) { |
343 |
++ input_event(input, usage->type, trans->to, value); |
344 |
++ return 1; |
345 |
++ } |
346 |
++ } |
347 |
++ |
348 |
+ return 0; |
349 |
+ } |
350 |
+ |
351 |
+@@ -327,6 +384,21 @@ |
352 |
+ |
353 |
+ for (trans = apple_iso_keyboard; trans->from; trans++) |
354 |
+ set_bit(trans->to, input->keybit); |
355 |
++ |
356 |
++ if (swap_fn_leftctrl) { |
357 |
++ for (trans = swapped_fn_leftctrl_keys; trans->from; trans++) |
358 |
++ set_bit(trans->to, input->keybit); |
359 |
++ } |
360 |
++ |
361 |
++ if (ejectcd_as_delete) { |
362 |
++ for (trans = ejectcd_as_delete_keys; trans->from; trans++) |
363 |
++ set_bit(trans->to, input->keybit); |
364 |
++ } |
365 |
++ |
366 |
++ if (rightalt_as_rightctrl) { |
367 |
++ for (trans = rightalt_as_rightctrl_keys; trans->from; trans++) |
368 |
++ set_bit(trans->to, input->keybit); |
369 |
++ } |
370 |
+ } |
371 |
+ |
372 |
+ static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
373 |
|
374 |
diff --git a/2900_dev-root-proc-mount-fix.patch b/2900_dev-root-proc-mount-fix.patch |
375 |
new file mode 100644 |
376 |
index 0000000..60af1eb |
377 |
--- /dev/null |
378 |
+++ b/2900_dev-root-proc-mount-fix.patch |
379 |
@@ -0,0 +1,38 @@ |
380 |
+--- a/init/do_mounts.c 2015-08-19 10:27:16.753852576 -0400 |
381 |
++++ b/init/do_mounts.c 2015-08-19 10:34:25.473850353 -0400 |
382 |
+@@ -490,7 +490,11 @@ void __init change_floppy(char *fmt, ... |
383 |
+ va_start(args, fmt); |
384 |
+ vsprintf(buf, fmt, args); |
385 |
+ va_end(args); |
386 |
+- fd = sys_open("/dev/root", O_RDWR | O_NDELAY, 0); |
387 |
++ if (saved_root_name[0]) |
388 |
++ fd = sys_open(saved_root_name, O_RDWR | O_NDELAY, 0); |
389 |
++ else |
390 |
++ fd = sys_open("/dev/root", O_RDWR | O_NDELAY, 0); |
391 |
++ |
392 |
+ if (fd >= 0) { |
393 |
+ sys_ioctl(fd, FDEJECT, 0); |
394 |
+ sys_close(fd); |
395 |
+@@ -534,11 +538,17 @@ void __init mount_root(void) |
396 |
+ #endif |
397 |
+ #ifdef CONFIG_BLOCK |
398 |
+ { |
399 |
+- int err = create_dev("/dev/root", ROOT_DEV); |
400 |
+- |
401 |
+- if (err < 0) |
402 |
+- pr_emerg("Failed to create /dev/root: %d\n", err); |
403 |
+- mount_block_root("/dev/root", root_mountflags); |
404 |
++ if (saved_root_name[0] == '/') { |
405 |
++ int err = create_dev(saved_root_name, ROOT_DEV); |
406 |
++ if (err < 0) |
407 |
++ pr_emerg("Failed to create %s: %d\n", saved_root_name, err); |
408 |
++ mount_block_root(saved_root_name, root_mountflags); |
409 |
++ } else { |
410 |
++ int err = create_dev("/dev/root", ROOT_DEV); |
411 |
++ if (err < 0) |
412 |
++ pr_emerg("Failed to create /dev/root: %d\n", err); |
413 |
++ mount_block_root("/dev/root", root_mountflags); |
414 |
++ } |
415 |
+ } |
416 |
+ #endif |
417 |
+ } |
418 |
|
419 |
diff --git a/4200_fbcondecor.patch b/4200_fbcondecor.patch |
420 |
new file mode 100644 |
421 |
index 0000000..f7d9879 |
422 |
--- /dev/null |
423 |
+++ b/4200_fbcondecor.patch |
424 |
@@ -0,0 +1,2095 @@ |
425 |
+diff --git a/Documentation/fb/00-INDEX b/Documentation/fb/00-INDEX |
426 |
+index fe85e7c..2230930 100644 |
427 |
+--- a/Documentation/fb/00-INDEX |
428 |
++++ b/Documentation/fb/00-INDEX |
429 |
+@@ -23,6 +23,8 @@ ep93xx-fb.txt |
430 |
+ - info on the driver for EP93xx LCD controller. |
431 |
+ fbcon.txt |
432 |
+ - intro to and usage guide for the framebuffer console (fbcon). |
433 |
++fbcondecor.txt |
434 |
++ - info on the Framebuffer Console Decoration |
435 |
+ framebuffer.txt |
436 |
+ - introduction to frame buffer devices. |
437 |
+ gxfb.txt |
438 |
+diff --git a/Documentation/fb/fbcondecor.txt b/Documentation/fb/fbcondecor.txt |
439 |
+new file mode 100644 |
440 |
+index 0000000..637209e |
441 |
+--- /dev/null |
442 |
++++ b/Documentation/fb/fbcondecor.txt |
443 |
+@@ -0,0 +1,207 @@ |
444 |
++What is it? |
445 |
++----------- |
446 |
++ |
447 |
++The framebuffer decorations are a kernel feature which allows displaying a |
448 |
++background picture on selected consoles. |
449 |
++ |
450 |
++What do I need to get it to work? |
451 |
++--------------------------------- |
452 |
++ |
453 |
++To get fbcondecor up-and-running you will have to: |
454 |
++ 1) get a copy of splashutils [1] or a similar program |
455 |
++ 2) get some fbcondecor themes |
456 |
++ 3) build the kernel helper program |
457 |
++ 4) build your kernel with the FB_CON_DECOR option enabled. |
458 |
++ |
459 |
++To get fbcondecor operational right after fbcon initialization is finished, you |
460 |
++will have to include a theme and the kernel helper into your initramfs image. |
461 |
++Please refer to splashutils documentation for instructions on how to do that. |
462 |
++ |
463 |
++[1] The splashutils package can be downloaded from: |
464 |
++ http://github.com/alanhaggai/fbsplash |
465 |
++ |
466 |
++The userspace helper |
467 |
++-------------------- |
468 |
++ |
469 |
++The userspace fbcondecor helper (by default: /sbin/fbcondecor_helper) is called by the |
470 |
++kernel whenever an important event occurs and the kernel needs some kind of |
471 |
++job to be carried out. Important events include console switches and video |
472 |
++mode switches (the kernel requests background images and configuration |
473 |
++parameters for the current console). The fbcondecor helper must be accessible at |
474 |
++all times. If it's not, fbcondecor will be switched off automatically. |
475 |
++ |
476 |
++It's possible to set path to the fbcondecor helper by writing it to |
477 |
++/proc/sys/kernel/fbcondecor. |
478 |
++ |
479 |
++***************************************************************************** |
480 |
++ |
481 |
++The information below is mostly technical stuff. There's probably no need to |
482 |
++read it unless you plan to develop a userspace helper. |
483 |
++ |
484 |
++The fbcondecor protocol |
485 |
++----------------------- |
486 |
++ |
487 |
++The fbcondecor protocol defines a communication interface between the kernel and |
488 |
++the userspace fbcondecor helper. |
489 |
++ |
490 |
++The kernel side is responsible for: |
491 |
++ |
492 |
++ * rendering console text, using an image as a background (instead of a |
493 |
++ standard solid color fbcon uses), |
494 |
++ * accepting commands from the user via ioctls on the fbcondecor device, |
495 |
++ * calling the userspace helper to set things up as soon as the fb subsystem |
496 |
++ is initialized. |
497 |
++ |
498 |
++The userspace helper is responsible for everything else, including parsing |
499 |
++configuration files, decompressing the image files whenever the kernel needs |
500 |
++it, and communicating with the kernel if necessary. |
501 |
++ |
502 |
++The fbcondecor protocol specifies how communication is done in both ways: |
503 |
++kernel->userspace and userspace->helper. |
504 |
++ |
505 |
++Kernel -> Userspace |
506 |
++------------------- |
507 |
++ |
508 |
++The kernel communicates with the userspace helper by calling it and specifying |
509 |
++the task to be done in a series of arguments. |
510 |
++ |
511 |
++The arguments follow the pattern: |
512 |
++<fbcondecor protocol version> <command> <parameters> |
513 |
++ |
514 |
++All commands defined in fbcondecor protocol v2 have the following parameters: |
515 |
++ virtual console |
516 |
++ framebuffer number |
517 |
++ theme |
518 |
++ |
519 |
++Fbcondecor protocol v1 specified an additional 'fbcondecor mode' after the |
520 |
++framebuffer number. Fbcondecor protocol v1 is deprecated and should not be used. |
521 |
++ |
522 |
++Fbcondecor protocol v2 specifies the following commands: |
523 |
++ |
524 |
++getpic |
525 |
++------ |
526 |
++ The kernel issues this command to request image data. It's up to the |
527 |
++ userspace helper to find a background image appropriate for the specified |
528 |
++ theme and the current resolution. The userspace helper should respond by |
529 |
++ issuing the FBIOCONDECOR_SETPIC ioctl. |
530 |
++ |
531 |
++init |
532 |
++---- |
533 |
++ The kernel issues this command after the fbcondecor device is created and |
534 |
++ the fbcondecor interface is initialized. Upon receiving 'init', the userspace |
535 |
++ helper should parse the kernel command line (/proc/cmdline) or otherwise |
536 |
++ decide whether fbcondecor is to be activated. |
537 |
++ |
538 |
++ To activate fbcondecor on the first console the helper should issue the |
539 |
++ FBIOCONDECOR_SETCFG, FBIOCONDECOR_SETPIC and FBIOCONDECOR_SETSTATE commands, |
540 |
++ in the above-mentioned order. |
541 |
++ |
542 |
++ When the userspace helper is called in an early phase of the boot process |
543 |
++ (right after the initialization of fbcon), no filesystems will be mounted. |
544 |
++ The helper program should mount sysfs and then create the appropriate |
545 |
++ framebuffer, fbcondecor and tty0 devices (if they don't already exist) to get |
546 |
++ current display settings and to be able to communicate with the kernel side. |
547 |
++ It should probably also mount the procfs to be able to parse the kernel |
548 |
++ command line parameters. |
549 |
++ |
550 |
++ Note that the console sem is not held when the kernel calls fbcondecor_helper |
551 |
++ with the 'init' command. The fbcondecor helper should perform all ioctls with |
552 |
++ origin set to FBCON_DECOR_IO_ORIG_USER. |
553 |
++ |
554 |
++modechange |
555 |
++---------- |
556 |
++ The kernel issues this command on a mode change. The helper's response should |
557 |
++ be similar to the response to the 'init' command. Note that this time the |
558 |
++ console sem is held and all ioctls must be performed with origin set to |
559 |
++ FBCON_DECOR_IO_ORIG_KERNEL. |
560 |
++ |
561 |
++ |
562 |
++Userspace -> Kernel |
563 |
++------------------- |
564 |
++ |
565 |
++Userspace programs can communicate with fbcondecor via ioctls on the |
566 |
++fbcondecor device. These ioctls are to be used by both the userspace helper |
567 |
++(called only by the kernel) and userspace configuration tools (run by the users). |
568 |
++ |
569 |
++The fbcondecor helper should set the origin field to FBCON_DECOR_IO_ORIG_KERNEL |
570 |
++when doing the appropriate ioctls. All userspace configuration tools should |
571 |
++use FBCON_DECOR_IO_ORIG_USER. Failure to set the appropriate value in the origin |
572 |
++field when performing ioctls from the kernel helper will most likely result |
573 |
++in a console deadlock. |
574 |
++ |
575 |
++FBCON_DECOR_IO_ORIG_KERNEL instructs fbcondecor not to try to acquire the console |
576 |
++semaphore. Not surprisingly, FBCON_DECOR_IO_ORIG_USER instructs it to acquire |
577 |
++the console sem. |
578 |
++ |
579 |
++The framebuffer console decoration provides the following ioctls (all defined in |
580 |
++linux/fb.h): |
581 |
++ |
582 |
++FBIOCONDECOR_SETPIC |
583 |
++description: loads a background picture for a virtual console |
584 |
++argument: struct fbcon_decor_iowrapper*; data: struct fb_image* |
585 |
++notes: |
586 |
++If called for consoles other than the current foreground one, the picture data |
587 |
++will be ignored. |
588 |
++ |
589 |
++If the current virtual console is running in a 8-bpp mode, the cmap substruct |
590 |
++of fb_image has to be filled appropriately: start should be set to 16 (first |
591 |
++16 colors are reserved for fbcon), len to a value <= 240 and red, green and |
592 |
++blue should point to valid cmap data. The transp field is ingored. The fields |
593 |
++dx, dy, bg_color, fg_color in fb_image are ignored as well. |
594 |
++ |
595 |
++FBIOCONDECOR_SETCFG |
596 |
++description: sets the fbcondecor config for a virtual console |
597 |
++argument: struct fbcon_decor_iowrapper*; data: struct vc_decor* |
598 |
++notes: The structure has to be filled with valid data. |
599 |
++ |
600 |
++FBIOCONDECOR_GETCFG |
601 |
++description: gets the fbcondecor config for a virtual console |
602 |
++argument: struct fbcon_decor_iowrapper*; data: struct vc_decor* |
603 |
++ |
604 |
++FBIOCONDECOR_SETSTATE |
605 |
++description: sets the fbcondecor state for a virtual console |
606 |
++argument: struct fbcon_decor_iowrapper*; data: unsigned int* |
607 |
++ values: 0 = disabled, 1 = enabled. |
608 |
++ |
609 |
++FBIOCONDECOR_GETSTATE |
610 |
++description: gets the fbcondecor state for a virtual console |
611 |
++argument: struct fbcon_decor_iowrapper*; data: unsigned int* |
612 |
++ values: as in FBIOCONDECOR_SETSTATE |
613 |
++ |
614 |
++Info on used structures: |
615 |
++ |
616 |
++Definition of struct vc_decor can be found in linux/console_decor.h. It's |
617 |
++heavily commented. Note that the 'theme' field should point to a string |
618 |
++no longer than FBCON_DECOR_THEME_LEN. When FBIOCONDECOR_GETCFG call is |
619 |
++performed, the theme field should point to a char buffer of length |
620 |
++FBCON_DECOR_THEME_LEN. |
621 |
++ |
622 |
++Definition of struct fbcon_decor_iowrapper can be found in linux/fb.h. |
623 |
++The fields in this struct have the following meaning: |
624 |
++ |
625 |
++vc: |
626 |
++Virtual console number. |
627 |
++ |
628 |
++origin: |
629 |
++Specifies if the ioctl is performed as a response to a kernel request. The |
630 |
++fbcondecor helper should set this field to FBCON_DECOR_IO_ORIG_KERNEL, userspace |
631 |
++programs should set it to FBCON_DECOR_IO_ORIG_USER. This field is necessary to |
632 |
++avoid console semaphore deadlocks. |
633 |
++ |
634 |
++data: |
635 |
++Pointer to a data structure appropriate for the performed ioctl. Type of |
636 |
++the data struct is specified in the ioctls description. |
637 |
++ |
638 |
++***************************************************************************** |
639 |
++ |
640 |
++Credit |
641 |
++------ |
642 |
++ |
643 |
++Original 'bootsplash' project & implementation by: |
644 |
++ Volker Poplawski <volker@×××××××××.de>, Stefan Reinauer <stepan@××××.de>, |
645 |
++ Steffen Winterfeldt <snwint@××××.de>, Michael Schroeder <mls@××××.de>, |
646 |
++ Ken Wimer <wimer@××××.de>. |
647 |
++ |
648 |
++Fbcondecor, fbcondecor protocol design, current implementation & docs by: |
649 |
++ Michal Januszewski <michalj+fbcondecor@×××××.com> |
650 |
++ |
651 |
+diff --git a/drivers/Makefile b/drivers/Makefile |
652 |
+index 53abb4a..1721aee 100644 |
653 |
+--- a/drivers/Makefile |
654 |
++++ b/drivers/Makefile |
655 |
+@@ -17,6 +17,10 @@ obj-y += pwm/ |
656 |
+ obj-$(CONFIG_PCI) += pci/ |
657 |
+ obj-$(CONFIG_PARISC) += parisc/ |
658 |
+ obj-$(CONFIG_RAPIDIO) += rapidio/ |
659 |
++# tty/ comes before char/ so that the VT console is the boot-time |
660 |
++# default. |
661 |
++obj-y += tty/ |
662 |
++obj-y += char/ |
663 |
+ obj-y += video/ |
664 |
+ obj-y += idle/ |
665 |
+ |
666 |
+@@ -45,11 +49,6 @@ obj-$(CONFIG_REGULATOR) += regulator/ |
667 |
+ # reset controllers early, since gpu drivers might rely on them to initialize |
668 |
+ obj-$(CONFIG_RESET_CONTROLLER) += reset/ |
669 |
+ |
670 |
+-# tty/ comes before char/ so that the VT console is the boot-time |
671 |
+-# default. |
672 |
+-obj-y += tty/ |
673 |
+-obj-y += char/ |
674 |
+- |
675 |
+ # iommu/ comes before gpu as gpu are using iommu controllers |
676 |
+ obj-$(CONFIG_IOMMU_SUPPORT) += iommu/ |
677 |
+ |
678 |
+diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig |
679 |
+index 38da6e2..fe58152 100644 |
680 |
+--- a/drivers/video/console/Kconfig |
681 |
++++ b/drivers/video/console/Kconfig |
682 |
+@@ -130,6 +130,19 @@ config FRAMEBUFFER_CONSOLE_ROTATION |
683 |
+ such that other users of the framebuffer will remain normally |
684 |
+ oriented. |
685 |
+ |
686 |
++config FB_CON_DECOR |
687 |
++ bool "Support for the Framebuffer Console Decorations" |
688 |
++ depends on FRAMEBUFFER_CONSOLE=y && !FB_TILEBLITTING |
689 |
++ default n |
690 |
++ ---help--- |
691 |
++ This option enables support for framebuffer console decorations which |
692 |
++ makes it possible to display images in the background of the system |
693 |
++ consoles. Note that userspace utilities are necessary in order to take |
694 |
++ advantage of these features. Refer to Documentation/fb/fbcondecor.txt |
695 |
++ for more information. |
696 |
++ |
697 |
++ If unsure, say N. |
698 |
++ |
699 |
+ config STI_CONSOLE |
700 |
+ bool "STI text console" |
701 |
+ depends on PARISC |
702 |
+diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile |
703 |
+index 43bfa48..cc104b6 100644 |
704 |
+--- a/drivers/video/console/Makefile |
705 |
++++ b/drivers/video/console/Makefile |
706 |
+@@ -16,4 +16,5 @@ obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \ |
707 |
+ fbcon_ccw.o |
708 |
+ endif |
709 |
+ |
710 |
++obj-$(CONFIG_FB_CON_DECOR) += fbcondecor.o cfbcondecor.o |
711 |
+ obj-$(CONFIG_FB_STI) += sticore.o |
712 |
+diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c |
713 |
+index dbfe4ee..14da307 100644 |
714 |
+--- a/drivers/video/console/bitblit.c |
715 |
++++ b/drivers/video/console/bitblit.c |
716 |
+@@ -18,6 +18,7 @@ |
717 |
+ #include <linux/console.h> |
718 |
+ #include <asm/types.h> |
719 |
+ #include "fbcon.h" |
720 |
++#include "fbcondecor.h" |
721 |
+ |
722 |
+ /* |
723 |
+ * Accelerated handlers. |
724 |
+@@ -55,6 +56,13 @@ static void bit_bmove(struct vc_data *vc, struct fb_info *info, int sy, |
725 |
+ area.height = height * vc->vc_font.height; |
726 |
+ area.width = width * vc->vc_font.width; |
727 |
+ |
728 |
++ if (fbcon_decor_active(info, vc)) { |
729 |
++ area.sx += vc->vc_decor.tx; |
730 |
++ area.sy += vc->vc_decor.ty; |
731 |
++ area.dx += vc->vc_decor.tx; |
732 |
++ area.dy += vc->vc_decor.ty; |
733 |
++ } |
734 |
++ |
735 |
+ info->fbops->fb_copyarea(info, &area); |
736 |
+ } |
737 |
+ |
738 |
+@@ -379,11 +387,15 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
739 |
+ cursor.image.depth = 1; |
740 |
+ cursor.rop = ROP_XOR; |
741 |
+ |
742 |
+- if (info->fbops->fb_cursor) |
743 |
+- err = info->fbops->fb_cursor(info, &cursor); |
744 |
++ if (fbcon_decor_active(info, vc)) { |
745 |
++ fbcon_decor_cursor(info, &cursor); |
746 |
++ } else { |
747 |
++ if (info->fbops->fb_cursor) |
748 |
++ err = info->fbops->fb_cursor(info, &cursor); |
749 |
+ |
750 |
+- if (err) |
751 |
+- soft_cursor(info, &cursor); |
752 |
++ if (err) |
753 |
++ soft_cursor(info, &cursor); |
754 |
++ } |
755 |
+ |
756 |
+ ops->cursor_reset = 0; |
757 |
+ } |
758 |
+diff --git a/drivers/video/console/cfbcondecor.c b/drivers/video/console/cfbcondecor.c |
759 |
+new file mode 100644 |
760 |
+index 0000000..c262540 |
761 |
+--- /dev/null |
762 |
++++ b/drivers/video/console/cfbcondecor.c |
763 |
+@@ -0,0 +1,473 @@ |
764 |
++/* |
765 |
++ * linux/drivers/video/cfbcon_decor.c -- Framebuffer decor render functions |
766 |
++ * |
767 |
++ * Copyright (C) 2004 Michal Januszewski <michalj+fbcondecor@×××××.com> |
768 |
++ * |
769 |
++ * Code based upon "Bootdecor" (C) 2001-2003 |
770 |
++ * Volker Poplawski <volker@×××××××××.de>, |
771 |
++ * Stefan Reinauer <stepan@××××.de>, |
772 |
++ * Steffen Winterfeldt <snwint@××××.de>, |
773 |
++ * Michael Schroeder <mls@××××.de>, |
774 |
++ * Ken Wimer <wimer@××××.de>. |
775 |
++ * |
776 |
++ * This file is subject to the terms and conditions of the GNU General Public |
777 |
++ * License. See the file COPYING in the main directory of this archive for |
778 |
++ * more details. |
779 |
++ */ |
780 |
++#include <linux/module.h> |
781 |
++#include <linux/types.h> |
782 |
++#include <linux/fb.h> |
783 |
++#include <linux/selection.h> |
784 |
++#include <linux/slab.h> |
785 |
++#include <linux/vt_kern.h> |
786 |
++#include <asm/irq.h> |
787 |
++ |
788 |
++#include "fbcon.h" |
789 |
++#include "fbcondecor.h" |
790 |
++ |
791 |
++#define parse_pixel(shift, bpp, type) \ |
792 |
++ do { \ |
793 |
++ if (d & (0x80 >> (shift))) \ |
794 |
++ dd2[(shift)] = fgx; \ |
795 |
++ else \ |
796 |
++ dd2[(shift)] = transparent ? *(type *)decor_src : bgx; \ |
797 |
++ decor_src += (bpp); \ |
798 |
++ } while (0) \ |
799 |
++ |
800 |
++extern int get_color(struct vc_data *vc, struct fb_info *info, |
801 |
++ u16 c, int is_fg); |
802 |
++ |
803 |
++void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc) |
804 |
++{ |
805 |
++ int i, j, k; |
806 |
++ int minlen = min(min(info->var.red.length, info->var.green.length), |
807 |
++ info->var.blue.length); |
808 |
++ u32 col; |
809 |
++ |
810 |
++ for (j = i = 0; i < 16; i++) { |
811 |
++ k = color_table[i]; |
812 |
++ |
813 |
++ col = ((vc->vc_palette[j++] >> (8-minlen)) |
814 |
++ << info->var.red.offset); |
815 |
++ col |= ((vc->vc_palette[j++] >> (8-minlen)) |
816 |
++ << info->var.green.offset); |
817 |
++ col |= ((vc->vc_palette[j++] >> (8-minlen)) |
818 |
++ << info->var.blue.offset); |
819 |
++ ((u32 *)info->pseudo_palette)[k] = col; |
820 |
++ } |
821 |
++} |
822 |
++ |
823 |
++void fbcon_decor_renderc(struct fb_info *info, int ypos, int xpos, int height, |
824 |
++ int width, u8 *src, u32 fgx, u32 bgx, u8 transparent) |
825 |
++{ |
826 |
++ unsigned int x, y; |
827 |
++ u32 dd; |
828 |
++ int bytespp = ((info->var.bits_per_pixel + 7) >> 3); |
829 |
++ unsigned int d = ypos * info->fix.line_length + xpos * bytespp; |
830 |
++ unsigned int ds = (ypos * info->var.xres + xpos) * bytespp; |
831 |
++ u16 dd2[4]; |
832 |
++ |
833 |
++ u8 *decor_src = (u8 *)(info->bgdecor.data + ds); |
834 |
++ u8 *dst = (u8 *)(info->screen_base + d); |
835 |
++ |
836 |
++ if ((ypos + height) > info->var.yres || (xpos + width) > info->var.xres) |
837 |
++ return; |
838 |
++ |
839 |
++ for (y = 0; y < height; y++) { |
840 |
++ switch (info->var.bits_per_pixel) { |
841 |
++ |
842 |
++ case 32: |
843 |
++ for (x = 0; x < width; x++) { |
844 |
++ |
845 |
++ if ((x & 7) == 0) |
846 |
++ d = *src++; |
847 |
++ if (d & 0x80) |
848 |
++ dd = fgx; |
849 |
++ else |
850 |
++ dd = transparent ? |
851 |
++ *(u32 *)decor_src : bgx; |
852 |
++ |
853 |
++ d <<= 1; |
854 |
++ decor_src += 4; |
855 |
++ fb_writel(dd, dst); |
856 |
++ dst += 4; |
857 |
++ } |
858 |
++ break; |
859 |
++ case 24: |
860 |
++ for (x = 0; x < width; x++) { |
861 |
++ |
862 |
++ if ((x & 7) == 0) |
863 |
++ d = *src++; |
864 |
++ if (d & 0x80) |
865 |
++ dd = fgx; |
866 |
++ else |
867 |
++ dd = transparent ? |
868 |
++ (*(u32 *)decor_src & 0xffffff) : bgx; |
869 |
++ |
870 |
++ d <<= 1; |
871 |
++ decor_src += 3; |
872 |
++#ifdef __LITTLE_ENDIAN |
873 |
++ fb_writew(dd & 0xffff, dst); |
874 |
++ dst += 2; |
875 |
++ fb_writeb((dd >> 16), dst); |
876 |
++#else |
877 |
++ fb_writew(dd >> 8, dst); |
878 |
++ dst += 2; |
879 |
++ fb_writeb(dd & 0xff, dst); |
880 |
++#endif |
881 |
++ dst++; |
882 |
++ } |
883 |
++ break; |
884 |
++ case 16: |
885 |
++ for (x = 0; x < width; x += 2) { |
886 |
++ if ((x & 7) == 0) |
887 |
++ d = *src++; |
888 |
++ |
889 |
++ parse_pixel(0, 2, u16); |
890 |
++ parse_pixel(1, 2, u16); |
891 |
++#ifdef __LITTLE_ENDIAN |
892 |
++ dd = dd2[0] | (dd2[1] << 16); |
893 |
++#else |
894 |
++ dd = dd2[1] | (dd2[0] << 16); |
895 |
++#endif |
896 |
++ d <<= 2; |
897 |
++ fb_writel(dd, dst); |
898 |
++ dst += 4; |
899 |
++ } |
900 |
++ break; |
901 |
++ |
902 |
++ case 8: |
903 |
++ for (x = 0; x < width; x += 4) { |
904 |
++ if ((x & 7) == 0) |
905 |
++ d = *src++; |
906 |
++ |
907 |
++ parse_pixel(0, 1, u8); |
908 |
++ parse_pixel(1, 1, u8); |
909 |
++ parse_pixel(2, 1, u8); |
910 |
++ parse_pixel(3, 1, u8); |
911 |
++ |
912 |
++#ifdef __LITTLE_ENDIAN |
913 |
++ dd = dd2[0] | (dd2[1] << 8) | (dd2[2] << 16) | (dd2[3] << 24); |
914 |
++#else |
915 |
++ dd = dd2[3] | (dd2[2] << 8) | (dd2[1] << 16) | (dd2[0] << 24); |
916 |
++#endif |
917 |
++ d <<= 4; |
918 |
++ fb_writel(dd, dst); |
919 |
++ dst += 4; |
920 |
++ } |
921 |
++ } |
922 |
++ |
923 |
++ dst += info->fix.line_length - width * bytespp; |
924 |
++ decor_src += (info->var.xres - width) * bytespp; |
925 |
++ } |
926 |
++} |
927 |
++ |
928 |
++#define cc2cx(a) \ |
929 |
++ ((info->fix.visual == FB_VISUAL_TRUECOLOR || \ |
930 |
++ info->fix.visual == FB_VISUAL_DIRECTCOLOR) ? \ |
931 |
++ ((u32 *)info->pseudo_palette)[a] : a) |
932 |
++ |
933 |
++void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, |
934 |
++ const unsigned short *s, int count, int yy, int xx) |
935 |
++{ |
936 |
++ unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; |
937 |
++ struct fbcon_ops *ops = info->fbcon_par; |
938 |
++ int fg_color, bg_color, transparent; |
939 |
++ u8 *src; |
940 |
++ u32 bgx, fgx; |
941 |
++ u16 c = scr_readw(s); |
942 |
++ |
943 |
++ fg_color = get_color(vc, info, c, 1); |
944 |
++ bg_color = get_color(vc, info, c, 0); |
945 |
++ |
946 |
++ /* Don't paint the background image if console is blanked */ |
947 |
++ transparent = ops->blank_state ? 0 : |
948 |
++ (vc->vc_decor.bg_color == bg_color); |
949 |
++ |
950 |
++ xx = xx * vc->vc_font.width + vc->vc_decor.tx; |
951 |
++ yy = yy * vc->vc_font.height + vc->vc_decor.ty; |
952 |
++ |
953 |
++ fgx = cc2cx(fg_color); |
954 |
++ bgx = cc2cx(bg_color); |
955 |
++ |
956 |
++ while (count--) { |
957 |
++ c = scr_readw(s++); |
958 |
++ src = vc->vc_font.data + (c & charmask) * vc->vc_font.height * |
959 |
++ ((vc->vc_font.width + 7) >> 3); |
960 |
++ |
961 |
++ fbcon_decor_renderc(info, yy, xx, vc->vc_font.height, |
962 |
++ vc->vc_font.width, src, fgx, bgx, transparent); |
963 |
++ xx += vc->vc_font.width; |
964 |
++ } |
965 |
++} |
966 |
++ |
967 |
++void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor) |
968 |
++{ |
969 |
++ int i; |
970 |
++ unsigned int dsize, s_pitch; |
971 |
++ struct fbcon_ops *ops = info->fbcon_par; |
972 |
++ struct vc_data *vc; |
973 |
++ u8 *src; |
974 |
++ |
975 |
++ /* we really don't need any cursors while the console is blanked */ |
976 |
++ if (info->state != FBINFO_STATE_RUNNING || ops->blank_state) |
977 |
++ return; |
978 |
++ |
979 |
++ vc = vc_cons[ops->currcon].d; |
980 |
++ |
981 |
++ src = kmalloc(64 + sizeof(struct fb_image), GFP_ATOMIC); |
982 |
++ if (!src) |
983 |
++ return; |
984 |
++ |
985 |
++ s_pitch = (cursor->image.width + 7) >> 3; |
986 |
++ dsize = s_pitch * cursor->image.height; |
987 |
++ if (cursor->enable) { |
988 |
++ switch (cursor->rop) { |
989 |
++ case ROP_XOR: |
990 |
++ for (i = 0; i < dsize; i++) |
991 |
++ src[i] = cursor->image.data[i] ^ cursor->mask[i]; |
992 |
++ break; |
993 |
++ case ROP_COPY: |
994 |
++ default: |
995 |
++ for (i = 0; i < dsize; i++) |
996 |
++ src[i] = cursor->image.data[i] & cursor->mask[i]; |
997 |
++ break; |
998 |
++ } |
999 |
++ } else |
1000 |
++ memcpy(src, cursor->image.data, dsize); |
1001 |
++ |
1002 |
++ fbcon_decor_renderc(info, |
1003 |
++ cursor->image.dy + vc->vc_decor.ty, |
1004 |
++ cursor->image.dx + vc->vc_decor.tx, |
1005 |
++ cursor->image.height, |
1006 |
++ cursor->image.width, |
1007 |
++ (u8 *)src, |
1008 |
++ cc2cx(cursor->image.fg_color), |
1009 |
++ cc2cx(cursor->image.bg_color), |
1010 |
++ cursor->image.bg_color == vc->vc_decor.bg_color); |
1011 |
++ |
1012 |
++ kfree(src); |
1013 |
++} |
1014 |
++ |
1015 |
++static void decorset(u8 *dst, int height, int width, int dstbytes, |
1016 |
++ u32 bgx, int bpp) |
1017 |
++{ |
1018 |
++ int i; |
1019 |
++ |
1020 |
++ if (bpp == 8) |
1021 |
++ bgx |= bgx << 8; |
1022 |
++ if (bpp == 16 || bpp == 8) |
1023 |
++ bgx |= bgx << 16; |
1024 |
++ |
1025 |
++ while (height-- > 0) { |
1026 |
++ u8 *p = dst; |
1027 |
++ |
1028 |
++ switch (bpp) { |
1029 |
++ |
1030 |
++ case 32: |
1031 |
++ for (i = 0; i < width; i++) { |
1032 |
++ fb_writel(bgx, p); p += 4; |
1033 |
++ } |
1034 |
++ break; |
1035 |
++ case 24: |
1036 |
++ for (i = 0; i < width; i++) { |
1037 |
++#ifdef __LITTLE_ENDIAN |
1038 |
++ fb_writew((bgx & 0xffff), (u16 *)p); p += 2; |
1039 |
++ fb_writeb((bgx >> 16), p++); |
1040 |
++#else |
1041 |
++ fb_writew((bgx >> 8), (u16 *)p); p += 2; |
1042 |
++ fb_writeb((bgx & 0xff), p++); |
1043 |
++#endif |
1044 |
++ } |
1045 |
++ break; |
1046 |
++ case 16: |
1047 |
++ for (i = 0; i < width/4; i++) { |
1048 |
++ fb_writel(bgx, p); p += 4; |
1049 |
++ fb_writel(bgx, p); p += 4; |
1050 |
++ } |
1051 |
++ if (width & 2) { |
1052 |
++ fb_writel(bgx, p); p += 4; |
1053 |
++ } |
1054 |
++ if (width & 1) |
1055 |
++ fb_writew(bgx, (u16 *)p); |
1056 |
++ break; |
1057 |
++ case 8: |
1058 |
++ for (i = 0; i < width/4; i++) { |
1059 |
++ fb_writel(bgx, p); p += 4; |
1060 |
++ } |
1061 |
++ |
1062 |
++ if (width & 2) { |
1063 |
++ fb_writew(bgx, p); p += 2; |
1064 |
++ } |
1065 |
++ if (width & 1) |
1066 |
++ fb_writeb(bgx, (u8 *)p); |
1067 |
++ break; |
1068 |
++ |
1069 |
++ } |
1070 |
++ dst += dstbytes; |
1071 |
++ } |
1072 |
++} |
1073 |
++ |
1074 |
++void fbcon_decor_copy(u8 *dst, u8 *src, int height, int width, int linebytes, |
1075 |
++ int srclinebytes, int bpp) |
1076 |
++{ |
1077 |
++ int i; |
1078 |
++ |
1079 |
++ while (height-- > 0) { |
1080 |
++ u32 *p = (u32 *)dst; |
1081 |
++ u32 *q = (u32 *)src; |
1082 |
++ |
1083 |
++ switch (bpp) { |
1084 |
++ |
1085 |
++ case 32: |
1086 |
++ for (i = 0; i < width; i++) |
1087 |
++ fb_writel(*q++, p++); |
1088 |
++ break; |
1089 |
++ case 24: |
1090 |
++ for (i = 0; i < (width * 3 / 4); i++) |
1091 |
++ fb_writel(*q++, p++); |
1092 |
++ if ((width * 3) % 4) { |
1093 |
++ if (width & 2) { |
1094 |
++ fb_writeb(*(u8 *)q, (u8 *)p); |
1095 |
++ } else if (width & 1) { |
1096 |
++ fb_writew(*(u16 *)q, (u16 *)p); |
1097 |
++ fb_writeb(*(u8 *)((u16 *)q + 1), |
1098 |
++ (u8 *)((u16 *)p + 2)); |
1099 |
++ } |
1100 |
++ } |
1101 |
++ break; |
1102 |
++ case 16: |
1103 |
++ for (i = 0; i < width/4; i++) { |
1104 |
++ fb_writel(*q++, p++); |
1105 |
++ fb_writel(*q++, p++); |
1106 |
++ } |
1107 |
++ if (width & 2) |
1108 |
++ fb_writel(*q++, p++); |
1109 |
++ if (width & 1) |
1110 |
++ fb_writew(*(u16 *)q, (u16 *)p); |
1111 |
++ break; |
1112 |
++ case 8: |
1113 |
++ for (i = 0; i < width/4; i++) |
1114 |
++ fb_writel(*q++, p++); |
1115 |
++ |
1116 |
++ if (width & 2) { |
1117 |
++ fb_writew(*(u16 *)q, (u16 *)p); |
1118 |
++ q = (u32 *) ((u16 *)q + 1); |
1119 |
++ p = (u32 *) ((u16 *)p + 1); |
1120 |
++ } |
1121 |
++ if (width & 1) |
1122 |
++ fb_writeb(*(u8 *)q, (u8 *)p); |
1123 |
++ break; |
1124 |
++ } |
1125 |
++ |
1126 |
++ dst += linebytes; |
1127 |
++ src += srclinebytes; |
1128 |
++ } |
1129 |
++} |
1130 |
++ |
1131 |
++static void decorfill(struct fb_info *info, int sy, int sx, int height, |
1132 |
++ int width) |
1133 |
++{ |
1134 |
++ int bytespp = ((info->var.bits_per_pixel + 7) >> 3); |
1135 |
++ int d = sy * info->fix.line_length + sx * bytespp; |
1136 |
++ int ds = (sy * info->var.xres + sx) * bytespp; |
1137 |
++ |
1138 |
++ fbcon_decor_copy((u8 *)(info->screen_base + d), (u8 *)(info->bgdecor.data + ds), |
1139 |
++ height, width, info->fix.line_length, info->var.xres * bytespp, |
1140 |
++ info->var.bits_per_pixel); |
1141 |
++} |
1142 |
++ |
1143 |
++void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, |
1144 |
++ int height, int width) |
1145 |
++{ |
1146 |
++ int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; |
1147 |
++ struct fbcon_ops *ops = info->fbcon_par; |
1148 |
++ u8 *dst; |
1149 |
++ int transparent, bg_color = attr_bgcol_ec(bgshift, vc, info); |
1150 |
++ |
1151 |
++ transparent = (vc->vc_decor.bg_color == bg_color); |
1152 |
++ sy = sy * vc->vc_font.height + vc->vc_decor.ty; |
1153 |
++ sx = sx * vc->vc_font.width + vc->vc_decor.tx; |
1154 |
++ height *= vc->vc_font.height; |
1155 |
++ width *= vc->vc_font.width; |
1156 |
++ |
1157 |
++ /* Don't paint the background image if console is blanked */ |
1158 |
++ if (transparent && !ops->blank_state) { |
1159 |
++ decorfill(info, sy, sx, height, width); |
1160 |
++ } else { |
1161 |
++ dst = (u8 *)(info->screen_base + sy * info->fix.line_length + |
1162 |
++ sx * ((info->var.bits_per_pixel + 7) >> 3)); |
1163 |
++ decorset(dst, height, width, info->fix.line_length, cc2cx(bg_color), |
1164 |
++ info->var.bits_per_pixel); |
1165 |
++ } |
1166 |
++} |
1167 |
++ |
1168 |
++void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, |
1169 |
++ int bottom_only) |
1170 |
++{ |
1171 |
++ unsigned int tw = vc->vc_cols*vc->vc_font.width; |
1172 |
++ unsigned int th = vc->vc_rows*vc->vc_font.height; |
1173 |
++ |
1174 |
++ if (!bottom_only) { |
1175 |
++ /* top margin */ |
1176 |
++ decorfill(info, 0, 0, vc->vc_decor.ty, info->var.xres); |
1177 |
++ /* left margin */ |
1178 |
++ decorfill(info, vc->vc_decor.ty, 0, th, vc->vc_decor.tx); |
1179 |
++ /* right margin */ |
1180 |
++ decorfill(info, vc->vc_decor.ty, vc->vc_decor.tx + tw, th, |
1181 |
++ info->var.xres - vc->vc_decor.tx - tw); |
1182 |
++ } |
1183 |
++ decorfill(info, vc->vc_decor.ty + th, 0, |
1184 |
++ info->var.yres - vc->vc_decor.ty - th, info->var.xres); |
1185 |
++} |
1186 |
++ |
1187 |
++void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, |
1188 |
++ int sx, int dx, int width) |
1189 |
++{ |
1190 |
++ u16 *d = (u16 *) (vc->vc_origin + vc->vc_size_row * y + dx * 2); |
1191 |
++ u16 *s = d + (dx - sx); |
1192 |
++ u16 *start = d; |
1193 |
++ u16 *ls = d; |
1194 |
++ u16 *le = d + width; |
1195 |
++ u16 c; |
1196 |
++ int x = dx; |
1197 |
++ u16 attr = 1; |
1198 |
++ |
1199 |
++ do { |
1200 |
++ c = scr_readw(d); |
1201 |
++ if (attr != (c & 0xff00)) { |
1202 |
++ attr = c & 0xff00; |
1203 |
++ if (d > start) { |
1204 |
++ fbcon_decor_putcs(vc, info, start, d - start, y, x); |
1205 |
++ x += d - start; |
1206 |
++ start = d; |
1207 |
++ } |
1208 |
++ } |
1209 |
++ if (s >= ls && s < le && c == scr_readw(s)) { |
1210 |
++ if (d > start) { |
1211 |
++ fbcon_decor_putcs(vc, info, start, d - start, y, x); |
1212 |
++ x += d - start + 1; |
1213 |
++ start = d + 1; |
1214 |
++ } else { |
1215 |
++ x++; |
1216 |
++ start++; |
1217 |
++ } |
1218 |
++ } |
1219 |
++ s++; |
1220 |
++ d++; |
1221 |
++ } while (d < le); |
1222 |
++ if (d > start) |
1223 |
++ fbcon_decor_putcs(vc, info, start, d - start, y, x); |
1224 |
++} |
1225 |
++ |
1226 |
++void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank) |
1227 |
++{ |
1228 |
++ if (blank) { |
1229 |
++ decorset((u8 *)info->screen_base, info->var.yres, info->var.xres, |
1230 |
++ info->fix.line_length, 0, info->var.bits_per_pixel); |
1231 |
++ } else { |
1232 |
++ update_screen(vc); |
1233 |
++ fbcon_decor_clear_margins(vc, info, 0); |
1234 |
++ } |
1235 |
++} |
1236 |
++ |
1237 |
+diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c |
1238 |
+index b87f5cf..ce44538 100644 |
1239 |
+--- a/drivers/video/console/fbcon.c |
1240 |
++++ b/drivers/video/console/fbcon.c |
1241 |
+@@ -79,6 +79,7 @@ |
1242 |
+ #include <asm/irq.h> |
1243 |
+ |
1244 |
+ #include "fbcon.h" |
1245 |
++#include "../console/fbcondecor.h" |
1246 |
+ |
1247 |
+ #ifdef FBCONDEBUG |
1248 |
+ # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args) |
1249 |
+@@ -94,7 +95,7 @@ enum { |
1250 |
+ |
1251 |
+ static struct display fb_display[MAX_NR_CONSOLES]; |
1252 |
+ |
1253 |
+-static signed char con2fb_map[MAX_NR_CONSOLES]; |
1254 |
++signed char con2fb_map[MAX_NR_CONSOLES]; |
1255 |
+ static signed char con2fb_map_boot[MAX_NR_CONSOLES]; |
1256 |
+ |
1257 |
+ static int logo_lines; |
1258 |
+@@ -282,7 +283,7 @@ static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info) |
1259 |
+ !vt_force_oops_output(vc); |
1260 |
+ } |
1261 |
+ |
1262 |
+-static int get_color(struct vc_data *vc, struct fb_info *info, |
1263 |
++int get_color(struct vc_data *vc, struct fb_info *info, |
1264 |
+ u16 c, int is_fg) |
1265 |
+ { |
1266 |
+ int depth = fb_get_color_depth(&info->var, &info->fix); |
1267 |
+@@ -546,6 +547,9 @@ static int do_fbcon_takeover(int show_logo) |
1268 |
+ info_idx = -1; |
1269 |
+ } else { |
1270 |
+ fbcon_has_console_bind = 1; |
1271 |
++#ifdef CONFIG_FB_CON_DECOR |
1272 |
++ fbcon_decor_init(); |
1273 |
++#endif |
1274 |
+ } |
1275 |
+ |
1276 |
+ return err; |
1277 |
+@@ -1005,6 +1009,12 @@ static const char *fbcon_startup(void) |
1278 |
+ rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
1279 |
+ cols /= vc->vc_font.width; |
1280 |
+ rows /= vc->vc_font.height; |
1281 |
++ |
1282 |
++ if (fbcon_decor_active(info, vc)) { |
1283 |
++ cols = vc->vc_decor.twidth / vc->vc_font.width; |
1284 |
++ rows = vc->vc_decor.theight / vc->vc_font.height; |
1285 |
++ } |
1286 |
++ |
1287 |
+ vc_resize(vc, cols, rows); |
1288 |
+ |
1289 |
+ DPRINTK("mode: %s\n", info->fix.id); |
1290 |
+@@ -1034,7 +1044,7 @@ static void fbcon_init(struct vc_data *vc, int init) |
1291 |
+ cap = info->flags; |
1292 |
+ |
1293 |
+ if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || |
1294 |
+- (info->fix.type == FB_TYPE_TEXT)) |
1295 |
++ (info->fix.type == FB_TYPE_TEXT) || fbcon_decor_active(info, vc)) |
1296 |
+ logo = 0; |
1297 |
+ |
1298 |
+ if (var_to_display(p, &info->var, info)) |
1299 |
+@@ -1259,6 +1269,11 @@ static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height, |
1300 |
+ fbcon_clear_margins(vc, 0); |
1301 |
+ } |
1302 |
+ |
1303 |
++ if (fbcon_decor_active(info, vc)) { |
1304 |
++ fbcon_decor_clear(vc, info, sy, sx, height, width); |
1305 |
++ return; |
1306 |
++ } |
1307 |
++ |
1308 |
+ /* Split blits that cross physical y_wrap boundary */ |
1309 |
+ |
1310 |
+ y_break = p->vrows - p->yscroll; |
1311 |
+@@ -1278,10 +1293,15 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s, |
1312 |
+ struct display *p = &fb_display[vc->vc_num]; |
1313 |
+ struct fbcon_ops *ops = info->fbcon_par; |
1314 |
+ |
1315 |
+- if (!fbcon_is_inactive(vc, info)) |
1316 |
+- ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, |
1317 |
+- get_color(vc, info, scr_readw(s), 1), |
1318 |
+- get_color(vc, info, scr_readw(s), 0)); |
1319 |
++ if (!fbcon_is_inactive(vc, info)) { |
1320 |
++ |
1321 |
++ if (fbcon_decor_active(info, vc)) |
1322 |
++ fbcon_decor_putcs(vc, info, s, count, ypos, xpos); |
1323 |
++ else |
1324 |
++ ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, |
1325 |
++ get_color(vc, info, scr_readw(s), 1), |
1326 |
++ get_color(vc, info, scr_readw(s), 0)); |
1327 |
++ } |
1328 |
+ } |
1329 |
+ |
1330 |
+ static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos) |
1331 |
+@@ -1297,8 +1317,12 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) |
1332 |
+ struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; |
1333 |
+ struct fbcon_ops *ops = info->fbcon_par; |
1334 |
+ |
1335 |
+- if (!fbcon_is_inactive(vc, info)) |
1336 |
+- ops->clear_margins(vc, info, bottom_only); |
1337 |
++ if (!fbcon_is_inactive(vc, info)) { |
1338 |
++ if (fbcon_decor_active(info, vc)) |
1339 |
++ fbcon_decor_clear_margins(vc, info, bottom_only); |
1340 |
++ else |
1341 |
++ ops->clear_margins(vc, info, bottom_only); |
1342 |
++ } |
1343 |
+ } |
1344 |
+ |
1345 |
+ static void fbcon_cursor(struct vc_data *vc, int mode) |
1346 |
+@@ -1819,7 +1843,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, |
1347 |
+ count = vc->vc_rows; |
1348 |
+ if (softback_top) |
1349 |
+ fbcon_softback_note(vc, t, count); |
1350 |
+- if (logo_shown >= 0) |
1351 |
++ if (logo_shown >= 0 || fbcon_decor_active(info, vc)) |
1352 |
+ goto redraw_up; |
1353 |
+ switch (p->scrollmode) { |
1354 |
+ case SCROLL_MOVE: |
1355 |
+@@ -1912,6 +1936,8 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, |
1356 |
+ count = vc->vc_rows; |
1357 |
+ if (logo_shown >= 0) |
1358 |
+ goto redraw_down; |
1359 |
++ if (fbcon_decor_active(info, vc)) |
1360 |
++ goto redraw_down; |
1361 |
+ switch (p->scrollmode) { |
1362 |
+ case SCROLL_MOVE: |
1363 |
+ fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, |
1364 |
+@@ -2060,6 +2086,13 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s |
1365 |
+ } |
1366 |
+ return; |
1367 |
+ } |
1368 |
++ |
1369 |
++ if (fbcon_decor_active(info, vc) && sy == dy && height == 1) { |
1370 |
++ /* must use slower redraw bmove to keep background pic intact */ |
1371 |
++ fbcon_decor_bmove_redraw(vc, info, sy, sx, dx, width); |
1372 |
++ return; |
1373 |
++ } |
1374 |
++ |
1375 |
+ ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, |
1376 |
+ height, width); |
1377 |
+ } |
1378 |
+@@ -2130,8 +2163,8 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width, |
1379 |
+ var.yres = virt_h * virt_fh; |
1380 |
+ x_diff = info->var.xres - var.xres; |
1381 |
+ y_diff = info->var.yres - var.yres; |
1382 |
+- if (x_diff < 0 || x_diff > virt_fw || |
1383 |
+- y_diff < 0 || y_diff > virt_fh) { |
1384 |
++ if ((x_diff < 0 || x_diff > virt_fw || |
1385 |
++ y_diff < 0 || y_diff > virt_fh) && !vc->vc_decor.state) { |
1386 |
+ const struct fb_videomode *mode; |
1387 |
+ |
1388 |
+ DPRINTK("attempting resize %ix%i\n", var.xres, var.yres); |
1389 |
+@@ -2167,6 +2200,22 @@ static int fbcon_switch(struct vc_data *vc) |
1390 |
+ |
1391 |
+ info = registered_fb[con2fb_map[vc->vc_num]]; |
1392 |
+ ops = info->fbcon_par; |
1393 |
++ prev_console = ops->currcon; |
1394 |
++ if (prev_console != -1) |
1395 |
++ old_info = registered_fb[con2fb_map[prev_console]]; |
1396 |
++ |
1397 |
++#ifdef CONFIG_FB_CON_DECOR |
1398 |
++ if (!fbcon_decor_active_vc(vc) && info->fix.visual == FB_VISUAL_DIRECTCOLOR) { |
1399 |
++ struct vc_data *vc_curr = vc_cons[prev_console].d; |
1400 |
++ |
1401 |
++ if (vc_curr && fbcon_decor_active_vc(vc_curr)) { |
1402 |
++ // Clear the screen to avoid displaying funky colors |
1403 |
++ // during palette updates. |
1404 |
++ memset((u8 *)info->screen_base + info->fix.line_length * info->var.yoffset, |
1405 |
++ 0, info->var.yres * info->fix.line_length); |
1406 |
++ } |
1407 |
++ } |
1408 |
++#endif |
1409 |
+ |
1410 |
+ if (softback_top) { |
1411 |
+ if (softback_lines) |
1412 |
+@@ -2185,9 +2234,6 @@ static int fbcon_switch(struct vc_data *vc) |
1413 |
+ logo_shown = FBCON_LOGO_CANSHOW; |
1414 |
+ } |
1415 |
+ |
1416 |
+- prev_console = ops->currcon; |
1417 |
+- if (prev_console != -1) |
1418 |
+- old_info = registered_fb[con2fb_map[prev_console]]; |
1419 |
+ /* |
1420 |
+ * FIXME: If we have multiple fbdev's loaded, we need to |
1421 |
+ * update all info->currcon. Perhaps, we can place this |
1422 |
+@@ -2231,6 +2277,18 @@ static int fbcon_switch(struct vc_data *vc) |
1423 |
+ fbcon_del_cursor_timer(old_info); |
1424 |
+ } |
1425 |
+ |
1426 |
++ if (fbcon_decor_active_vc(vc)) { |
1427 |
++ struct vc_data *vc_curr = vc_cons[prev_console].d; |
1428 |
++ |
1429 |
++ if (!vc_curr->vc_decor.theme || |
1430 |
++ strcmp(vc->vc_decor.theme, vc_curr->vc_decor.theme) || |
1431 |
++ (fbcon_decor_active_nores(info, vc_curr) && |
1432 |
++ !fbcon_decor_active(info, vc_curr))) { |
1433 |
++ fbcon_decor_disable(vc, 0); |
1434 |
++ fbcon_decor_call_helper("modechange", vc->vc_num); |
1435 |
++ } |
1436 |
++ } |
1437 |
++ |
1438 |
+ if (fbcon_is_inactive(vc, info) || |
1439 |
+ ops->blank_state != FB_BLANK_UNBLANK) |
1440 |
+ fbcon_del_cursor_timer(info); |
1441 |
+@@ -2339,15 +2397,20 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) |
1442 |
+ } |
1443 |
+ } |
1444 |
+ |
1445 |
+- if (!fbcon_is_inactive(vc, info)) { |
1446 |
++ if (!fbcon_is_inactive(vc, info)) { |
1447 |
+ if (ops->blank_state != blank) { |
1448 |
+ ops->blank_state = blank; |
1449 |
+ fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); |
1450 |
+ ops->cursor_flash = (!blank); |
1451 |
+ |
1452 |
+- if (!(info->flags & FBINFO_MISC_USEREVENT)) |
1453 |
+- if (fb_blank(info, blank)) |
1454 |
+- fbcon_generic_blank(vc, info, blank); |
1455 |
++ if (!(info->flags & FBINFO_MISC_USEREVENT)) { |
1456 |
++ if (fb_blank(info, blank)) { |
1457 |
++ if (fbcon_decor_active(info, vc)) |
1458 |
++ fbcon_decor_blank(vc, info, blank); |
1459 |
++ else |
1460 |
++ fbcon_generic_blank(vc, info, blank); |
1461 |
++ } |
1462 |
++ } |
1463 |
+ } |
1464 |
+ |
1465 |
+ if (!blank) |
1466 |
+@@ -2522,13 +2585,22 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, |
1467 |
+ } |
1468 |
+ |
1469 |
+ if (resize) { |
1470 |
++ /* reset wrap/pan */ |
1471 |
+ int cols, rows; |
1472 |
+ |
1473 |
+ cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); |
1474 |
+ rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
1475 |
++ |
1476 |
++ if (fbcon_decor_active(info, vc)) { |
1477 |
++ info->var.xoffset = info->var.yoffset = p->yscroll = 0; |
1478 |
++ cols = vc->vc_decor.twidth; |
1479 |
++ rows = vc->vc_decor.theight; |
1480 |
++ } |
1481 |
+ cols /= w; |
1482 |
+ rows /= h; |
1483 |
++ |
1484 |
+ vc_resize(vc, cols, rows); |
1485 |
++ |
1486 |
+ if (con_is_visible(vc) && softback_buf) |
1487 |
+ fbcon_update_softback(vc); |
1488 |
+ } else if (con_is_visible(vc) |
1489 |
+@@ -2657,7 +2729,11 @@ static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table) |
1490 |
+ int i, j, k, depth; |
1491 |
+ u8 val; |
1492 |
+ |
1493 |
+- if (fbcon_is_inactive(vc, info)) |
1494 |
++ if (fbcon_is_inactive(vc, info) |
1495 |
++#ifdef CONFIG_FB_CON_DECOR |
1496 |
++ || vc->vc_num != fg_console |
1497 |
++#endif |
1498 |
++ ) |
1499 |
+ return; |
1500 |
+ |
1501 |
+ if (!con_is_visible(vc)) |
1502 |
+@@ -2683,7 +2759,47 @@ static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table) |
1503 |
+ } else |
1504 |
+ fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap); |
1505 |
+ |
1506 |
+- fb_set_cmap(&palette_cmap, info); |
1507 |
++ if (fbcon_decor_active(info, vc_cons[fg_console].d) && |
1508 |
++ info->fix.visual == FB_VISUAL_DIRECTCOLOR) { |
1509 |
++ |
1510 |
++ u16 *red, *green, *blue; |
1511 |
++ int minlen = min(min(info->var.red.length, info->var.green.length), |
1512 |
++ info->var.blue.length); |
1513 |
++ |
1514 |
++ struct fb_cmap cmap = { |
1515 |
++ .start = 0, |
1516 |
++ .len = (1 << minlen), |
1517 |
++ .red = NULL, |
1518 |
++ .green = NULL, |
1519 |
++ .blue = NULL, |
1520 |
++ .transp = NULL |
1521 |
++ }; |
1522 |
++ |
1523 |
++ red = kmalloc(256 * sizeof(u16) * 3, GFP_KERNEL); |
1524 |
++ |
1525 |
++ if (!red) |
1526 |
++ goto out; |
1527 |
++ |
1528 |
++ green = red + 256; |
1529 |
++ blue = green + 256; |
1530 |
++ cmap.red = red; |
1531 |
++ cmap.green = green; |
1532 |
++ cmap.blue = blue; |
1533 |
++ |
1534 |
++ for (i = 0; i < cmap.len; i++) |
1535 |
++ red[i] = green[i] = blue[i] = (0xffff * i)/(cmap.len-1); |
1536 |
++ |
1537 |
++ fb_set_cmap(&cmap, info); |
1538 |
++ fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d); |
1539 |
++ kfree(red); |
1540 |
++ |
1541 |
++ return; |
1542 |
++ |
1543 |
++ } else if (fbcon_decor_active(info, vc_cons[fg_console].d) && |
1544 |
++ info->var.bits_per_pixel == 8 && info->bgdecor.cmap.red != NULL) |
1545 |
++ fb_set_cmap(&info->bgdecor.cmap, info); |
1546 |
++ |
1547 |
++out: fb_set_cmap(&palette_cmap, info); |
1548 |
+ } |
1549 |
+ |
1550 |
+ static u16 *fbcon_screen_pos(struct vc_data *vc, int offset) |
1551 |
+@@ -2908,7 +3024,14 @@ static void fbcon_modechanged(struct fb_info *info) |
1552 |
+ rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
1553 |
+ cols /= vc->vc_font.width; |
1554 |
+ rows /= vc->vc_font.height; |
1555 |
+- vc_resize(vc, cols, rows); |
1556 |
++ |
1557 |
++ if (!fbcon_decor_active_nores(info, vc)) { |
1558 |
++ vc_resize(vc, cols, rows); |
1559 |
++ } else { |
1560 |
++ fbcon_decor_disable(vc, 0); |
1561 |
++ fbcon_decor_call_helper("modechange", vc->vc_num); |
1562 |
++ } |
1563 |
++ |
1564 |
+ updatescrollmode(p, info, vc); |
1565 |
+ scrollback_max = 0; |
1566 |
+ scrollback_current = 0; |
1567 |
+@@ -2953,7 +3076,8 @@ static void fbcon_set_all_vcs(struct fb_info *info) |
1568 |
+ rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
1569 |
+ cols /= vc->vc_font.width; |
1570 |
+ rows /= vc->vc_font.height; |
1571 |
+- vc_resize(vc, cols, rows); |
1572 |
++ if (!fbcon_decor_active_nores(info, vc)) |
1573 |
++ vc_resize(vc, cols, rows); |
1574 |
+ } |
1575 |
+ |
1576 |
+ if (fg != -1) |
1577 |
+@@ -3594,6 +3718,7 @@ static void fbcon_exit(void) |
1578 |
+ } |
1579 |
+ } |
1580 |
+ |
1581 |
++ fbcon_decor_exit(); |
1582 |
+ fbcon_has_exited = 1; |
1583 |
+ } |
1584 |
+ |
1585 |
+diff --git a/drivers/video/console/fbcondecor.c b/drivers/video/console/fbcondecor.c |
1586 |
+new file mode 100644 |
1587 |
+index 0000000..65cc0d3 |
1588 |
+--- /dev/null |
1589 |
++++ b/drivers/video/console/fbcondecor.c |
1590 |
+@@ -0,0 +1,549 @@ |
1591 |
++/* |
1592 |
++ * linux/drivers/video/console/fbcondecor.c -- Framebuffer console decorations |
1593 |
++ * |
1594 |
++ * Copyright (C) 2004-2009 Michal Januszewski <michalj+fbcondecor@×××××.com> |
1595 |
++ * |
1596 |
++ * Code based upon "Bootsplash" (C) 2001-2003 |
1597 |
++ * Volker Poplawski <volker@×××××××××.de>, |
1598 |
++ * Stefan Reinauer <stepan@××××.de>, |
1599 |
++ * Steffen Winterfeldt <snwint@××××.de>, |
1600 |
++ * Michael Schroeder <mls@××××.de>, |
1601 |
++ * Ken Wimer <wimer@××××.de>. |
1602 |
++ * |
1603 |
++ * Compat ioctl support by Thorsten Klein <TK@××××××××××××××.de>. |
1604 |
++ * |
1605 |
++ * This file is subject to the terms and conditions of the GNU General Public |
1606 |
++ * License. See the file COPYING in the main directory of this archive for |
1607 |
++ * more details. |
1608 |
++ * |
1609 |
++ */ |
1610 |
++#include <linux/module.h> |
1611 |
++#include <linux/kernel.h> |
1612 |
++#include <linux/string.h> |
1613 |
++#include <linux/types.h> |
1614 |
++#include <linux/fb.h> |
1615 |
++#include <linux/vt_kern.h> |
1616 |
++#include <linux/vmalloc.h> |
1617 |
++#include <linux/unistd.h> |
1618 |
++#include <linux/syscalls.h> |
1619 |
++#include <linux/init.h> |
1620 |
++#include <linux/proc_fs.h> |
1621 |
++#include <linux/workqueue.h> |
1622 |
++#include <linux/kmod.h> |
1623 |
++#include <linux/miscdevice.h> |
1624 |
++#include <linux/device.h> |
1625 |
++#include <linux/fs.h> |
1626 |
++#include <linux/compat.h> |
1627 |
++#include <linux/console.h> |
1628 |
++ |
1629 |
++#include <linux/uaccess.h> |
1630 |
++#include <asm/irq.h> |
1631 |
++ |
1632 |
++#include "fbcon.h" |
1633 |
++#include "fbcondecor.h" |
1634 |
++ |
1635 |
++extern signed char con2fb_map[]; |
1636 |
++static int fbcon_decor_enable(struct vc_data *vc); |
1637 |
++ |
1638 |
++static int initialized; |
1639 |
++ |
1640 |
++char fbcon_decor_path[KMOD_PATH_LEN] = "/sbin/fbcondecor_helper"; |
1641 |
++EXPORT_SYMBOL(fbcon_decor_path); |
1642 |
++ |
1643 |
++int fbcon_decor_call_helper(char *cmd, unsigned short vc) |
1644 |
++{ |
1645 |
++ char *envp[] = { |
1646 |
++ "HOME=/", |
1647 |
++ "PATH=/sbin:/bin", |
1648 |
++ NULL |
1649 |
++ }; |
1650 |
++ |
1651 |
++ char tfb[5]; |
1652 |
++ char tcons[5]; |
1653 |
++ unsigned char fb = (int) con2fb_map[vc]; |
1654 |
++ |
1655 |
++ char *argv[] = { |
1656 |
++ fbcon_decor_path, |
1657 |
++ "2", |
1658 |
++ cmd, |
1659 |
++ tcons, |
1660 |
++ tfb, |
1661 |
++ vc_cons[vc].d->vc_decor.theme, |
1662 |
++ NULL |
1663 |
++ }; |
1664 |
++ |
1665 |
++ snprintf(tfb, 5, "%d", fb); |
1666 |
++ snprintf(tcons, 5, "%d", vc); |
1667 |
++ |
1668 |
++ return call_usermodehelper(fbcon_decor_path, argv, envp, UMH_WAIT_EXEC); |
1669 |
++} |
1670 |
++ |
1671 |
++/* Disables fbcondecor on a virtual console; called with console sem held. */ |
1672 |
++int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw) |
1673 |
++{ |
1674 |
++ struct fb_info *info; |
1675 |
++ |
1676 |
++ if (!vc->vc_decor.state) |
1677 |
++ return -EINVAL; |
1678 |
++ |
1679 |
++ info = registered_fb[(int) con2fb_map[vc->vc_num]]; |
1680 |
++ |
1681 |
++ if (info == NULL) |
1682 |
++ return -EINVAL; |
1683 |
++ |
1684 |
++ vc->vc_decor.state = 0; |
1685 |
++ vc_resize(vc, info->var.xres / vc->vc_font.width, |
1686 |
++ info->var.yres / vc->vc_font.height); |
1687 |
++ |
1688 |
++ if (fg_console == vc->vc_num && redraw) { |
1689 |
++ redraw_screen(vc, 0); |
1690 |
++ update_region(vc, vc->vc_origin + |
1691 |
++ vc->vc_size_row * vc->vc_top, |
1692 |
++ vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2); |
1693 |
++ } |
1694 |
++ |
1695 |
++ printk(KERN_INFO "fbcondecor: switched decor state to 'off' on console %d\n", |
1696 |
++ vc->vc_num); |
1697 |
++ |
1698 |
++ return 0; |
1699 |
++} |
1700 |
++ |
1701 |
++/* Enables fbcondecor on a virtual console; called with console sem held. */ |
1702 |
++static int fbcon_decor_enable(struct vc_data *vc) |
1703 |
++{ |
1704 |
++ struct fb_info *info; |
1705 |
++ |
1706 |
++ info = registered_fb[(int) con2fb_map[vc->vc_num]]; |
1707 |
++ |
1708 |
++ if (vc->vc_decor.twidth == 0 || vc->vc_decor.theight == 0 || |
1709 |
++ info == NULL || vc->vc_decor.state || (!info->bgdecor.data && |
1710 |
++ vc->vc_num == fg_console)) |
1711 |
++ return -EINVAL; |
1712 |
++ |
1713 |
++ vc->vc_decor.state = 1; |
1714 |
++ vc_resize(vc, vc->vc_decor.twidth / vc->vc_font.width, |
1715 |
++ vc->vc_decor.theight / vc->vc_font.height); |
1716 |
++ |
1717 |
++ if (fg_console == vc->vc_num) { |
1718 |
++ redraw_screen(vc, 0); |
1719 |
++ update_region(vc, vc->vc_origin + |
1720 |
++ vc->vc_size_row * vc->vc_top, |
1721 |
++ vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2); |
1722 |
++ fbcon_decor_clear_margins(vc, info, 0); |
1723 |
++ } |
1724 |
++ |
1725 |
++ printk(KERN_INFO "fbcondecor: switched decor state to 'on' on console %d\n", |
1726 |
++ vc->vc_num); |
1727 |
++ |
1728 |
++ return 0; |
1729 |
++} |
1730 |
++ |
1731 |
++static inline int fbcon_decor_ioctl_dosetstate(struct vc_data *vc, unsigned int state, unsigned char origin) |
1732 |
++{ |
1733 |
++ int ret; |
1734 |
++ |
1735 |
++ console_lock(); |
1736 |
++ if (!state) |
1737 |
++ ret = fbcon_decor_disable(vc, 1); |
1738 |
++ else |
1739 |
++ ret = fbcon_decor_enable(vc); |
1740 |
++ console_unlock(); |
1741 |
++ |
1742 |
++ return ret; |
1743 |
++} |
1744 |
++ |
1745 |
++static inline void fbcon_decor_ioctl_dogetstate(struct vc_data *vc, unsigned int *state) |
1746 |
++{ |
1747 |
++ *state = vc->vc_decor.state; |
1748 |
++} |
1749 |
++ |
1750 |
++static int fbcon_decor_ioctl_dosetcfg(struct vc_data *vc, struct vc_decor *cfg, unsigned char origin) |
1751 |
++{ |
1752 |
++ struct fb_info *info; |
1753 |
++ int len; |
1754 |
++ char *tmp; |
1755 |
++ |
1756 |
++ info = registered_fb[(int) con2fb_map[vc->vc_num]]; |
1757 |
++ |
1758 |
++ if (info == NULL || !cfg->twidth || !cfg->theight || |
1759 |
++ cfg->tx + cfg->twidth > info->var.xres || |
1760 |
++ cfg->ty + cfg->theight > info->var.yres) |
1761 |
++ return -EINVAL; |
1762 |
++ |
1763 |
++ len = strlen_user(cfg->theme); |
1764 |
++ if (!len || len > FBCON_DECOR_THEME_LEN) |
1765 |
++ return -EINVAL; |
1766 |
++ tmp = kmalloc(len, GFP_KERNEL); |
1767 |
++ if (!tmp) |
1768 |
++ return -ENOMEM; |
1769 |
++ if (copy_from_user(tmp, (void __user *)cfg->theme, len)) |
1770 |
++ return -EFAULT; |
1771 |
++ cfg->theme = tmp; |
1772 |
++ cfg->state = 0; |
1773 |
++ |
1774 |
++ console_lock(); |
1775 |
++ if (vc->vc_decor.state) |
1776 |
++ fbcon_decor_disable(vc, 1); |
1777 |
++ kfree(vc->vc_decor.theme); |
1778 |
++ vc->vc_decor = *cfg; |
1779 |
++ console_unlock(); |
1780 |
++ |
1781 |
++ printk(KERN_INFO "fbcondecor: console %d using theme '%s'\n", |
1782 |
++ vc->vc_num, vc->vc_decor.theme); |
1783 |
++ return 0; |
1784 |
++} |
1785 |
++ |
1786 |
++static int fbcon_decor_ioctl_dogetcfg(struct vc_data *vc, |
1787 |
++ struct vc_decor *decor) |
1788 |
++{ |
1789 |
++ char __user *tmp; |
1790 |
++ |
1791 |
++ tmp = decor->theme; |
1792 |
++ *decor = vc->vc_decor; |
1793 |
++ decor->theme = tmp; |
1794 |
++ |
1795 |
++ if (vc->vc_decor.theme) { |
1796 |
++ if (copy_to_user(tmp, vc->vc_decor.theme, |
1797 |
++ strlen(vc->vc_decor.theme) + 1)) |
1798 |
++ return -EFAULT; |
1799 |
++ } else |
1800 |
++ if (put_user(0, tmp)) |
1801 |
++ return -EFAULT; |
1802 |
++ |
1803 |
++ return 0; |
1804 |
++} |
1805 |
++ |
1806 |
++static int fbcon_decor_ioctl_dosetpic(struct vc_data *vc, struct fb_image *img, |
1807 |
++ unsigned char origin) |
1808 |
++{ |
1809 |
++ struct fb_info *info; |
1810 |
++ int len; |
1811 |
++ u8 *tmp; |
1812 |
++ |
1813 |
++ if (vc->vc_num != fg_console) |
1814 |
++ return -EINVAL; |
1815 |
++ |
1816 |
++ info = registered_fb[(int) con2fb_map[vc->vc_num]]; |
1817 |
++ |
1818 |
++ if (info == NULL) |
1819 |
++ return -EINVAL; |
1820 |
++ |
1821 |
++ if (img->width != info->var.xres || img->height != info->var.yres) { |
1822 |
++ printk(KERN_ERR "fbcondecor: picture dimensions mismatch\n"); |
1823 |
++ printk(KERN_ERR "%dx%d vs %dx%d\n", img->width, img->height, |
1824 |
++ info->var.xres, info->var.yres); |
1825 |
++ return -EINVAL; |
1826 |
++ } |
1827 |
++ |
1828 |
++ if (img->depth != info->var.bits_per_pixel) { |
1829 |
++ printk(KERN_ERR "fbcondecor: picture depth mismatch\n"); |
1830 |
++ return -EINVAL; |
1831 |
++ } |
1832 |
++ |
1833 |
++ if (img->depth == 8) { |
1834 |
++ if (!img->cmap.len || !img->cmap.red || !img->cmap.green || |
1835 |
++ !img->cmap.blue) |
1836 |
++ return -EINVAL; |
1837 |
++ |
1838 |
++ tmp = vmalloc(img->cmap.len * 3 * 2); |
1839 |
++ if (!tmp) |
1840 |
++ return -ENOMEM; |
1841 |
++ |
1842 |
++ if (copy_from_user(tmp, |
1843 |
++ (void __user *)img->cmap.red, |
1844 |
++ (img->cmap.len << 1)) || |
1845 |
++ copy_from_user(tmp + (img->cmap.len << 1), |
1846 |
++ (void __user *)img->cmap.green, |
1847 |
++ (img->cmap.len << 1)) || |
1848 |
++ copy_from_user(tmp + (img->cmap.len << 2), |
1849 |
++ (void __user *)img->cmap.blue, |
1850 |
++ (img->cmap.len << 1))) { |
1851 |
++ vfree(tmp); |
1852 |
++ return -EFAULT; |
1853 |
++ } |
1854 |
++ |
1855 |
++ img->cmap.transp = NULL; |
1856 |
++ img->cmap.red = (u16 *)tmp; |
1857 |
++ img->cmap.green = img->cmap.red + img->cmap.len; |
1858 |
++ img->cmap.blue = img->cmap.green + img->cmap.len; |
1859 |
++ } else { |
1860 |
++ img->cmap.red = NULL; |
1861 |
++ } |
1862 |
++ |
1863 |
++ len = ((img->depth + 7) >> 3) * img->width * img->height; |
1864 |
++ |
1865 |
++ /* |
1866 |
++ * Allocate an additional byte so that we never go outside of the |
1867 |
++ * buffer boundaries in the rendering functions in a 24 bpp mode. |
1868 |
++ */ |
1869 |
++ tmp = vmalloc(len + 1); |
1870 |
++ |
1871 |
++ if (!tmp) |
1872 |
++ goto out; |
1873 |
++ |
1874 |
++ if (copy_from_user(tmp, (void __user *)img->data, len)) |
1875 |
++ goto out; |
1876 |
++ |
1877 |
++ img->data = tmp; |
1878 |
++ |
1879 |
++ console_lock(); |
1880 |
++ |
1881 |
++ if (info->bgdecor.data) |
1882 |
++ vfree((u8 *)info->bgdecor.data); |
1883 |
++ if (info->bgdecor.cmap.red) |
1884 |
++ vfree(info->bgdecor.cmap.red); |
1885 |
++ |
1886 |
++ info->bgdecor = *img; |
1887 |
++ |
1888 |
++ if (fbcon_decor_active_vc(vc) && fg_console == vc->vc_num) { |
1889 |
++ redraw_screen(vc, 0); |
1890 |
++ update_region(vc, vc->vc_origin + |
1891 |
++ vc->vc_size_row * vc->vc_top, |
1892 |
++ vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2); |
1893 |
++ fbcon_decor_clear_margins(vc, info, 0); |
1894 |
++ } |
1895 |
++ |
1896 |
++ console_unlock(); |
1897 |
++ |
1898 |
++ return 0; |
1899 |
++ |
1900 |
++out: |
1901 |
++ if (img->cmap.red) |
1902 |
++ vfree(img->cmap.red); |
1903 |
++ |
1904 |
++ if (tmp) |
1905 |
++ vfree(tmp); |
1906 |
++ return -ENOMEM; |
1907 |
++} |
1908 |
++ |
1909 |
++static long fbcon_decor_ioctl(struct file *filp, u_int cmd, u_long arg) |
1910 |
++{ |
1911 |
++ struct fbcon_decor_iowrapper __user *wrapper = (void __user *) arg; |
1912 |
++ struct vc_data *vc = NULL; |
1913 |
++ unsigned short vc_num = 0; |
1914 |
++ unsigned char origin = 0; |
1915 |
++ void __user *data = NULL; |
1916 |
++ |
1917 |
++ if (!access_ok(VERIFY_READ, wrapper, |
1918 |
++ sizeof(struct fbcon_decor_iowrapper))) |
1919 |
++ return -EFAULT; |
1920 |
++ |
1921 |
++ __get_user(vc_num, &wrapper->vc); |
1922 |
++ __get_user(origin, &wrapper->origin); |
1923 |
++ __get_user(data, &wrapper->data); |
1924 |
++ |
1925 |
++ if (!vc_cons_allocated(vc_num)) |
1926 |
++ return -EINVAL; |
1927 |
++ |
1928 |
++ vc = vc_cons[vc_num].d; |
1929 |
++ |
1930 |
++ switch (cmd) { |
1931 |
++ case FBIOCONDECOR_SETPIC: |
1932 |
++ { |
1933 |
++ struct fb_image img; |
1934 |
++ |
1935 |
++ if (copy_from_user(&img, (struct fb_image __user *)data, sizeof(struct fb_image))) |
1936 |
++ return -EFAULT; |
1937 |
++ |
1938 |
++ return fbcon_decor_ioctl_dosetpic(vc, &img, origin); |
1939 |
++ } |
1940 |
++ case FBIOCONDECOR_SETCFG: |
1941 |
++ { |
1942 |
++ struct vc_decor cfg; |
1943 |
++ |
1944 |
++ if (copy_from_user(&cfg, (struct vc_decor __user *)data, sizeof(struct vc_decor))) |
1945 |
++ return -EFAULT; |
1946 |
++ |
1947 |
++ return fbcon_decor_ioctl_dosetcfg(vc, &cfg, origin); |
1948 |
++ } |
1949 |
++ case FBIOCONDECOR_GETCFG: |
1950 |
++ { |
1951 |
++ int rval; |
1952 |
++ struct vc_decor cfg; |
1953 |
++ |
1954 |
++ if (copy_from_user(&cfg, (struct vc_decor __user *)data, sizeof(struct vc_decor))) |
1955 |
++ return -EFAULT; |
1956 |
++ |
1957 |
++ rval = fbcon_decor_ioctl_dogetcfg(vc, &cfg); |
1958 |
++ |
1959 |
++ if (copy_to_user(data, &cfg, sizeof(struct vc_decor))) |
1960 |
++ return -EFAULT; |
1961 |
++ return rval; |
1962 |
++ } |
1963 |
++ case FBIOCONDECOR_SETSTATE: |
1964 |
++ { |
1965 |
++ unsigned int state = 0; |
1966 |
++ |
1967 |
++ if (get_user(state, (unsigned int __user *)data)) |
1968 |
++ return -EFAULT; |
1969 |
++ return fbcon_decor_ioctl_dosetstate(vc, state, origin); |
1970 |
++ } |
1971 |
++ case FBIOCONDECOR_GETSTATE: |
1972 |
++ { |
1973 |
++ unsigned int state = 0; |
1974 |
++ |
1975 |
++ fbcon_decor_ioctl_dogetstate(vc, &state); |
1976 |
++ return put_user(state, (unsigned int __user *)data); |
1977 |
++ } |
1978 |
++ |
1979 |
++ default: |
1980 |
++ return -ENOIOCTLCMD; |
1981 |
++ } |
1982 |
++} |
1983 |
++ |
1984 |
++#ifdef CONFIG_COMPAT |
1985 |
++ |
1986 |
++static long fbcon_decor_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
1987 |
++{ |
1988 |
++ struct fbcon_decor_iowrapper32 __user *wrapper = (void __user *)arg; |
1989 |
++ struct vc_data *vc = NULL; |
1990 |
++ unsigned short vc_num = 0; |
1991 |
++ unsigned char origin = 0; |
1992 |
++ compat_uptr_t data_compat = 0; |
1993 |
++ void __user *data = NULL; |
1994 |
++ |
1995 |
++ if (!access_ok(VERIFY_READ, wrapper, |
1996 |
++ sizeof(struct fbcon_decor_iowrapper32))) |
1997 |
++ return -EFAULT; |
1998 |
++ |
1999 |
++ __get_user(vc_num, &wrapper->vc); |
2000 |
++ __get_user(origin, &wrapper->origin); |
2001 |
++ __get_user(data_compat, &wrapper->data); |
2002 |
++ data = compat_ptr(data_compat); |
2003 |
++ |
2004 |
++ if (!vc_cons_allocated(vc_num)) |
2005 |
++ return -EINVAL; |
2006 |
++ |
2007 |
++ vc = vc_cons[vc_num].d; |
2008 |
++ |
2009 |
++ switch (cmd) { |
2010 |
++ case FBIOCONDECOR_SETPIC32: |
2011 |
++ { |
2012 |
++ struct fb_image32 img_compat; |
2013 |
++ struct fb_image img; |
2014 |
++ |
2015 |
++ if (copy_from_user(&img_compat, (struct fb_image32 __user *)data, sizeof(struct fb_image32))) |
2016 |
++ return -EFAULT; |
2017 |
++ |
2018 |
++ fb_image_from_compat(img, img_compat); |
2019 |
++ |
2020 |
++ return fbcon_decor_ioctl_dosetpic(vc, &img, origin); |
2021 |
++ } |
2022 |
++ |
2023 |
++ case FBIOCONDECOR_SETCFG32: |
2024 |
++ { |
2025 |
++ struct vc_decor32 cfg_compat; |
2026 |
++ struct vc_decor cfg; |
2027 |
++ |
2028 |
++ if (copy_from_user(&cfg_compat, (struct vc_decor32 __user *)data, sizeof(struct vc_decor32))) |
2029 |
++ return -EFAULT; |
2030 |
++ |
2031 |
++ vc_decor_from_compat(cfg, cfg_compat); |
2032 |
++ |
2033 |
++ return fbcon_decor_ioctl_dosetcfg(vc, &cfg, origin); |
2034 |
++ } |
2035 |
++ |
2036 |
++ case FBIOCONDECOR_GETCFG32: |
2037 |
++ { |
2038 |
++ int rval; |
2039 |
++ struct vc_decor32 cfg_compat; |
2040 |
++ struct vc_decor cfg; |
2041 |
++ |
2042 |
++ if (copy_from_user(&cfg_compat, (struct vc_decor32 __user *)data, sizeof(struct vc_decor32))) |
2043 |
++ return -EFAULT; |
2044 |
++ cfg.theme = compat_ptr(cfg_compat.theme); |
2045 |
++ |
2046 |
++ rval = fbcon_decor_ioctl_dogetcfg(vc, &cfg); |
2047 |
++ |
2048 |
++ vc_decor_to_compat(cfg_compat, cfg); |
2049 |
++ |
2050 |
++ if (copy_to_user((struct vc_decor32 __user *)data, &cfg_compat, sizeof(struct vc_decor32))) |
2051 |
++ return -EFAULT; |
2052 |
++ return rval; |
2053 |
++ } |
2054 |
++ |
2055 |
++ case FBIOCONDECOR_SETSTATE32: |
2056 |
++ { |
2057 |
++ compat_uint_t state_compat = 0; |
2058 |
++ unsigned int state = 0; |
2059 |
++ |
2060 |
++ if (get_user(state_compat, (compat_uint_t __user *)data)) |
2061 |
++ return -EFAULT; |
2062 |
++ |
2063 |
++ state = (unsigned int)state_compat; |
2064 |
++ |
2065 |
++ return fbcon_decor_ioctl_dosetstate(vc, state, origin); |
2066 |
++ } |
2067 |
++ |
2068 |
++ case FBIOCONDECOR_GETSTATE32: |
2069 |
++ { |
2070 |
++ compat_uint_t state_compat = 0; |
2071 |
++ unsigned int state = 0; |
2072 |
++ |
2073 |
++ fbcon_decor_ioctl_dogetstate(vc, &state); |
2074 |
++ state_compat = (compat_uint_t)state; |
2075 |
++ |
2076 |
++ return put_user(state_compat, (compat_uint_t __user *)data); |
2077 |
++ } |
2078 |
++ |
2079 |
++ default: |
2080 |
++ return -ENOIOCTLCMD; |
2081 |
++ } |
2082 |
++} |
2083 |
++#else |
2084 |
++ #define fbcon_decor_compat_ioctl NULL |
2085 |
++#endif |
2086 |
++ |
2087 |
++static struct file_operations fbcon_decor_ops = { |
2088 |
++ .owner = THIS_MODULE, |
2089 |
++ .unlocked_ioctl = fbcon_decor_ioctl, |
2090 |
++ .compat_ioctl = fbcon_decor_compat_ioctl |
2091 |
++}; |
2092 |
++ |
2093 |
++static struct miscdevice fbcon_decor_dev = { |
2094 |
++ .minor = MISC_DYNAMIC_MINOR, |
2095 |
++ .name = "fbcondecor", |
2096 |
++ .fops = &fbcon_decor_ops |
2097 |
++}; |
2098 |
++ |
2099 |
++void fbcon_decor_reset(void) |
2100 |
++{ |
2101 |
++ int i; |
2102 |
++ |
2103 |
++ for (i = 0; i < num_registered_fb; i++) { |
2104 |
++ registered_fb[i]->bgdecor.data = NULL; |
2105 |
++ registered_fb[i]->bgdecor.cmap.red = NULL; |
2106 |
++ } |
2107 |
++ |
2108 |
++ for (i = 0; i < MAX_NR_CONSOLES && vc_cons[i].d; i++) { |
2109 |
++ vc_cons[i].d->vc_decor.state = vc_cons[i].d->vc_decor.twidth = |
2110 |
++ vc_cons[i].d->vc_decor.theight = 0; |
2111 |
++ vc_cons[i].d->vc_decor.theme = NULL; |
2112 |
++ } |
2113 |
++} |
2114 |
++ |
2115 |
++int fbcon_decor_init(void) |
2116 |
++{ |
2117 |
++ int i; |
2118 |
++ |
2119 |
++ fbcon_decor_reset(); |
2120 |
++ |
2121 |
++ if (initialized) |
2122 |
++ return 0; |
2123 |
++ |
2124 |
++ i = misc_register(&fbcon_decor_dev); |
2125 |
++ if (i) { |
2126 |
++ printk(KERN_ERR "fbcondecor: failed to register device\n"); |
2127 |
++ return i; |
2128 |
++ } |
2129 |
++ |
2130 |
++ fbcon_decor_call_helper("init", 0); |
2131 |
++ initialized = 1; |
2132 |
++ return 0; |
2133 |
++} |
2134 |
++ |
2135 |
++int fbcon_decor_exit(void) |
2136 |
++{ |
2137 |
++ fbcon_decor_reset(); |
2138 |
++ return 0; |
2139 |
++} |
2140 |
+diff --git a/drivers/video/console/fbcondecor.h b/drivers/video/console/fbcondecor.h |
2141 |
+new file mode 100644 |
2142 |
+index 0000000..c49386c |
2143 |
+--- /dev/null |
2144 |
++++ b/drivers/video/console/fbcondecor.h |
2145 |
+@@ -0,0 +1,77 @@ |
2146 |
++/* |
2147 |
++ * linux/drivers/video/console/fbcondecor.h -- Framebuffer Console Decoration headers |
2148 |
++ * |
2149 |
++ * Copyright (C) 2004 Michal Januszewski <michalj+fbcondecor@×××××.com> |
2150 |
++ * |
2151 |
++ */ |
2152 |
++ |
2153 |
++#ifndef __FBCON_DECOR_H |
2154 |
++#define __FBCON_DECOR_H |
2155 |
++ |
2156 |
++#ifndef _LINUX_FB_H |
2157 |
++#include <linux/fb.h> |
2158 |
++#endif |
2159 |
++ |
2160 |
++/* This is needed for vc_cons in fbcmap.c */ |
2161 |
++#include <linux/vt_kern.h> |
2162 |
++ |
2163 |
++struct fb_cursor; |
2164 |
++struct fb_info; |
2165 |
++struct vc_data; |
2166 |
++ |
2167 |
++#ifdef CONFIG_FB_CON_DECOR |
2168 |
++/* fbcondecor.c */ |
2169 |
++int fbcon_decor_init(void); |
2170 |
++int fbcon_decor_exit(void); |
2171 |
++int fbcon_decor_call_helper(char *cmd, unsigned short cons); |
2172 |
++int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw); |
2173 |
++ |
2174 |
++/* cfbcondecor.c */ |
2175 |
++void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx); |
2176 |
++void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor); |
2177 |
++void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width); |
2178 |
++void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only); |
2179 |
++void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank); |
2180 |
++void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width); |
2181 |
++void fbcon_decor_copy(u8 *dst, u8 *src, int height, int width, int linebytes, int srclinesbytes, int bpp); |
2182 |
++void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc); |
2183 |
++ |
2184 |
++/* vt.c */ |
2185 |
++void acquire_console_sem(void); |
2186 |
++void release_console_sem(void); |
2187 |
++void do_unblank_screen(int entering_gfx); |
2188 |
++ |
2189 |
++/* struct vc_data *y */ |
2190 |
++#define fbcon_decor_active_vc(y) (y->vc_decor.state && y->vc_decor.theme) |
2191 |
++ |
2192 |
++/* struct fb_info *x, struct vc_data *y */ |
2193 |
++#define fbcon_decor_active_nores(x, y) (x->bgdecor.data && fbcon_decor_active_vc(y)) |
2194 |
++ |
2195 |
++/* struct fb_info *x, struct vc_data *y */ |
2196 |
++#define fbcon_decor_active(x, y) (fbcon_decor_active_nores(x, y) && \ |
2197 |
++ x->bgdecor.width == x->var.xres && \ |
2198 |
++ x->bgdecor.height == x->var.yres && \ |
2199 |
++ x->bgdecor.depth == x->var.bits_per_pixel) |
2200 |
++ |
2201 |
++#else /* CONFIG_FB_CON_DECOR */ |
2202 |
++ |
2203 |
++static inline void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx) {} |
2204 |
++static inline void fbcon_decor_putc(struct vc_data *vc, struct fb_info *info, int c, int ypos, int xpos) {} |
2205 |
++static inline void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor) {} |
2206 |
++static inline void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width) {} |
2207 |
++static inline void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only) {} |
2208 |
++static inline void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank) {} |
2209 |
++static inline void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width) {} |
2210 |
++static inline void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc) {} |
2211 |
++static inline int fbcon_decor_call_helper(char *cmd, unsigned short cons) { return 0; } |
2212 |
++static inline int fbcon_decor_init(void) { return 0; } |
2213 |
++static inline int fbcon_decor_exit(void) { return 0; } |
2214 |
++static inline int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw) { return 0; } |
2215 |
++ |
2216 |
++#define fbcon_decor_active_vc(y) (0) |
2217 |
++#define fbcon_decor_active_nores(x, y) (0) |
2218 |
++#define fbcon_decor_active(x, y) (0) |
2219 |
++ |
2220 |
++#endif /* CONFIG_FB_CON_DECOR */ |
2221 |
++ |
2222 |
++#endif /* __FBCON_DECOR_H */ |
2223 |
+diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig |
2224 |
+index 88b008f..c84113d 100644 |
2225 |
+--- a/drivers/video/fbdev/Kconfig |
2226 |
++++ b/drivers/video/fbdev/Kconfig |
2227 |
+@@ -1216,7 +1216,6 @@ config FB_MATROX |
2228 |
+ select FB_CFB_FILLRECT |
2229 |
+ select FB_CFB_COPYAREA |
2230 |
+ select FB_CFB_IMAGEBLIT |
2231 |
+- select FB_TILEBLITTING |
2232 |
+ select FB_MACMODES if PPC_PMAC |
2233 |
+ ---help--- |
2234 |
+ Say Y here if you have a Matrox Millennium, Matrox Millennium II, |
2235 |
+diff --git a/drivers/video/fbdev/core/fbcmap.c b/drivers/video/fbdev/core/fbcmap.c |
2236 |
+index f89245b..c2c12ce 100644 |
2237 |
+--- a/drivers/video/fbdev/core/fbcmap.c |
2238 |
++++ b/drivers/video/fbdev/core/fbcmap.c |
2239 |
+@@ -17,6 +17,8 @@ |
2240 |
+ #include <linux/slab.h> |
2241 |
+ #include <linux/uaccess.h> |
2242 |
+ |
2243 |
++#include "../../console/fbcondecor.h" |
2244 |
++ |
2245 |
+ static u16 red2[] __read_mostly = { |
2246 |
+ 0x0000, 0xaaaa |
2247 |
+ }; |
2248 |
+@@ -254,9 +256,12 @@ int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *info) |
2249 |
+ break; |
2250 |
+ } |
2251 |
+ } |
2252 |
+- if (rc == 0) |
2253 |
++ if (rc == 0) { |
2254 |
+ fb_copy_cmap(cmap, &info->cmap); |
2255 |
+- |
2256 |
++ if (fbcon_decor_active(info, vc_cons[fg_console].d) && |
2257 |
++ info->fix.visual == FB_VISUAL_DIRECTCOLOR) |
2258 |
++ fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d); |
2259 |
++ } |
2260 |
+ return rc; |
2261 |
+ } |
2262 |
+ |
2263 |
+diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c |
2264 |
+index 76c1ad9..fafc0af 100644 |
2265 |
+--- a/drivers/video/fbdev/core/fbmem.c |
2266 |
++++ b/drivers/video/fbdev/core/fbmem.c |
2267 |
+@@ -1251,15 +1251,6 @@ struct fb_fix_screeninfo32 { |
2268 |
+ u16 reserved[3]; |
2269 |
+ }; |
2270 |
+ |
2271 |
+-struct fb_cmap32 { |
2272 |
+- u32 start; |
2273 |
+- u32 len; |
2274 |
+- compat_caddr_t red; |
2275 |
+- compat_caddr_t green; |
2276 |
+- compat_caddr_t blue; |
2277 |
+- compat_caddr_t transp; |
2278 |
+-}; |
2279 |
+- |
2280 |
+ static int fb_getput_cmap(struct fb_info *info, unsigned int cmd, |
2281 |
+ unsigned long arg) |
2282 |
+ { |
2283 |
+diff --git a/include/linux/console_decor.h b/include/linux/console_decor.h |
2284 |
+new file mode 100644 |
2285 |
+index 0000000..1514355 |
2286 |
+--- /dev/null |
2287 |
++++ b/include/linux/console_decor.h |
2288 |
+@@ -0,0 +1,46 @@ |
2289 |
++#ifndef _LINUX_CONSOLE_DECOR_H_ |
2290 |
++#define _LINUX_CONSOLE_DECOR_H_ 1 |
2291 |
++ |
2292 |
++/* A structure used by the framebuffer console decorations (drivers/video/console/fbcondecor.c) */ |
2293 |
++struct vc_decor { |
2294 |
++ __u8 bg_color; /* The color that is to be treated as transparent */ |
2295 |
++ __u8 state; /* Current decor state: 0 = off, 1 = on */ |
2296 |
++ __u16 tx, ty; /* Top left corner coordinates of the text field */ |
2297 |
++ __u16 twidth, theight; /* Width and height of the text field */ |
2298 |
++ char *theme; |
2299 |
++}; |
2300 |
++ |
2301 |
++#ifdef __KERNEL__ |
2302 |
++#ifdef CONFIG_COMPAT |
2303 |
++#include <linux/compat.h> |
2304 |
++ |
2305 |
++struct vc_decor32 { |
2306 |
++ __u8 bg_color; /* The color that is to be treated as transparent */ |
2307 |
++ __u8 state; /* Current decor state: 0 = off, 1 = on */ |
2308 |
++ __u16 tx, ty; /* Top left corner coordinates of the text field */ |
2309 |
++ __u16 twidth, theight; /* Width and height of the text field */ |
2310 |
++ compat_uptr_t theme; |
2311 |
++}; |
2312 |
++ |
2313 |
++#define vc_decor_from_compat(to, from) \ |
2314 |
++ (to).bg_color = (from).bg_color; \ |
2315 |
++ (to).state = (from).state; \ |
2316 |
++ (to).tx = (from).tx; \ |
2317 |
++ (to).ty = (from).ty; \ |
2318 |
++ (to).twidth = (from).twidth; \ |
2319 |
++ (to).theight = (from).theight; \ |
2320 |
++ (to).theme = compat_ptr((from).theme) |
2321 |
++ |
2322 |
++#define vc_decor_to_compat(to, from) \ |
2323 |
++ (to).bg_color = (from).bg_color; \ |
2324 |
++ (to).state = (from).state; \ |
2325 |
++ (to).tx = (from).tx; \ |
2326 |
++ (to).ty = (from).ty; \ |
2327 |
++ (to).twidth = (from).twidth; \ |
2328 |
++ (to).theight = (from).theight; \ |
2329 |
++ (to).theme = ptr_to_compat((from).theme) |
2330 |
++ |
2331 |
++#endif /* CONFIG_COMPAT */ |
2332 |
++#endif /* __KERNEL__ */ |
2333 |
++ |
2334 |
++#endif |
2335 |
+diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h |
2336 |
+index 6fd3c90..c649555 100644 |
2337 |
+--- a/include/linux/console_struct.h |
2338 |
++++ b/include/linux/console_struct.h |
2339 |
+@@ -20,6 +20,7 @@ struct vt_struct; |
2340 |
+ struct uni_pagedir; |
2341 |
+ |
2342 |
+ #define NPAR 16 |
2343 |
++#include <linux/console_decor.h> |
2344 |
+ |
2345 |
+ /* |
2346 |
+ * Example: vc_data of a console that was scrolled 3 lines down. |
2347 |
+@@ -140,6 +141,8 @@ struct vc_data { |
2348 |
+ struct uni_pagedir *vc_uni_pagedir; |
2349 |
+ struct uni_pagedir **vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ |
2350 |
+ bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */ |
2351 |
++ |
2352 |
++ struct vc_decor vc_decor; |
2353 |
+ /* additional information is in vt_kern.h */ |
2354 |
+ }; |
2355 |
+ |
2356 |
+diff --git a/include/linux/fb.h b/include/linux/fb.h |
2357 |
+index a964d07..672cc64 100644 |
2358 |
+--- a/include/linux/fb.h |
2359 |
++++ b/include/linux/fb.h |
2360 |
+@@ -238,6 +238,34 @@ struct fb_deferred_io { |
2361 |
+ }; |
2362 |
+ #endif |
2363 |
+ |
2364 |
++#ifdef __KERNEL__ |
2365 |
++#ifdef CONFIG_COMPAT |
2366 |
++struct fb_image32 { |
2367 |
++ __u32 dx; /* Where to place image */ |
2368 |
++ __u32 dy; |
2369 |
++ __u32 width; /* Size of image */ |
2370 |
++ __u32 height; |
2371 |
++ __u32 fg_color; /* Only used when a mono bitmap */ |
2372 |
++ __u32 bg_color; |
2373 |
++ __u8 depth; /* Depth of the image */ |
2374 |
++ const compat_uptr_t data; /* Pointer to image data */ |
2375 |
++ struct fb_cmap32 cmap; /* color map info */ |
2376 |
++}; |
2377 |
++ |
2378 |
++#define fb_image_from_compat(to, from) \ |
2379 |
++ (to).dx = (from).dx; \ |
2380 |
++ (to).dy = (from).dy; \ |
2381 |
++ (to).width = (from).width; \ |
2382 |
++ (to).height = (from).height; \ |
2383 |
++ (to).fg_color = (from).fg_color; \ |
2384 |
++ (to).bg_color = (from).bg_color; \ |
2385 |
++ (to).depth = (from).depth; \ |
2386 |
++ (to).data = compat_ptr((from).data); \ |
2387 |
++ fb_cmap_from_compat((to).cmap, (from).cmap) |
2388 |
++ |
2389 |
++#endif /* CONFIG_COMPAT */ |
2390 |
++#endif /* __KERNEL__ */ |
2391 |
++ |
2392 |
+ /* |
2393 |
+ * Frame buffer operations |
2394 |
+ * |
2395 |
+@@ -508,6 +536,9 @@ struct fb_info { |
2396 |
+ #define FBINFO_STATE_SUSPENDED 1 |
2397 |
+ u32 state; /* Hardware state i.e suspend */ |
2398 |
+ void *fbcon_par; /* fbcon use-only private area */ |
2399 |
++ |
2400 |
++ struct fb_image bgdecor; |
2401 |
++ |
2402 |
+ /* From here on everything is device dependent */ |
2403 |
+ void *par; |
2404 |
+ /* we need the PCI or similar aperture base/size not |
2405 |
+diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h |
2406 |
+index fb795c3..4b57c67 100644 |
2407 |
+--- a/include/uapi/linux/fb.h |
2408 |
++++ b/include/uapi/linux/fb.h |
2409 |
+@@ -8,6 +8,23 @@ |
2410 |
+ |
2411 |
+ #define FB_MAX 32 /* sufficient for now */ |
2412 |
+ |
2413 |
++struct fbcon_decor_iowrapper { |
2414 |
++ unsigned short vc; /* Virtual console */ |
2415 |
++ unsigned char origin; /* Point of origin of the request */ |
2416 |
++ void *data; |
2417 |
++}; |
2418 |
++ |
2419 |
++#ifdef __KERNEL__ |
2420 |
++#ifdef CONFIG_COMPAT |
2421 |
++#include <linux/compat.h> |
2422 |
++struct fbcon_decor_iowrapper32 { |
2423 |
++ unsigned short vc; /* Virtual console */ |
2424 |
++ unsigned char origin; /* Point of origin of the request */ |
2425 |
++ compat_uptr_t data; |
2426 |
++}; |
2427 |
++#endif /* CONFIG_COMPAT */ |
2428 |
++#endif /* __KERNEL__ */ |
2429 |
++ |
2430 |
+ /* ioctls |
2431 |
+ 0x46 is 'F' */ |
2432 |
+ #define FBIOGET_VSCREENINFO 0x4600 |
2433 |
+@@ -35,6 +52,25 @@ |
2434 |
+ #define FBIOGET_DISPINFO 0x4618 |
2435 |
+ #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) |
2436 |
+ |
2437 |
++#define FBIOCONDECOR_SETCFG _IOWR('F', 0x19, struct fbcon_decor_iowrapper) |
2438 |
++#define FBIOCONDECOR_GETCFG _IOR('F', 0x1A, struct fbcon_decor_iowrapper) |
2439 |
++#define FBIOCONDECOR_SETSTATE _IOWR('F', 0x1B, struct fbcon_decor_iowrapper) |
2440 |
++#define FBIOCONDECOR_GETSTATE _IOR('F', 0x1C, struct fbcon_decor_iowrapper) |
2441 |
++#define FBIOCONDECOR_SETPIC _IOWR('F', 0x1D, struct fbcon_decor_iowrapper) |
2442 |
++#ifdef __KERNEL__ |
2443 |
++#ifdef CONFIG_COMPAT |
2444 |
++#define FBIOCONDECOR_SETCFG32 _IOWR('F', 0x19, struct fbcon_decor_iowrapper32) |
2445 |
++#define FBIOCONDECOR_GETCFG32 _IOR('F', 0x1A, struct fbcon_decor_iowrapper32) |
2446 |
++#define FBIOCONDECOR_SETSTATE32 _IOWR('F', 0x1B, struct fbcon_decor_iowrapper32) |
2447 |
++#define FBIOCONDECOR_GETSTATE32 _IOR('F', 0x1C, struct fbcon_decor_iowrapper32) |
2448 |
++#define FBIOCONDECOR_SETPIC32 _IOWR('F', 0x1D, struct fbcon_decor_iowrapper32) |
2449 |
++#endif /* CONFIG_COMPAT */ |
2450 |
++#endif /* __KERNEL__ */ |
2451 |
++ |
2452 |
++#define FBCON_DECOR_THEME_LEN 128 /* Maximum length of a theme name */ |
2453 |
++#define FBCON_DECOR_IO_ORIG_KERNEL 0 /* Kernel ioctl origin */ |
2454 |
++#define FBCON_DECOR_IO_ORIG_USER 1 /* User ioctl origin */ |
2455 |
++ |
2456 |
+ #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ |
2457 |
+ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ |
2458 |
+ #define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */ |
2459 |
+@@ -277,6 +313,29 @@ struct fb_var_screeninfo { |
2460 |
+ __u32 reserved[4]; /* Reserved for future compatibility */ |
2461 |
+ }; |
2462 |
+ |
2463 |
++#ifdef __KERNEL__ |
2464 |
++#ifdef CONFIG_COMPAT |
2465 |
++struct fb_cmap32 { |
2466 |
++ __u32 start; |
2467 |
++ __u32 len; /* Number of entries */ |
2468 |
++ compat_uptr_t red; /* Red values */ |
2469 |
++ compat_uptr_t green; |
2470 |
++ compat_uptr_t blue; |
2471 |
++ compat_uptr_t transp; /* transparency, can be NULL */ |
2472 |
++}; |
2473 |
++ |
2474 |
++#define fb_cmap_from_compat(to, from) \ |
2475 |
++ (to).start = (from).start; \ |
2476 |
++ (to).len = (from).len; \ |
2477 |
++ (to).red = compat_ptr((from).red); \ |
2478 |
++ (to).green = compat_ptr((from).green); \ |
2479 |
++ (to).blue = compat_ptr((from).blue); \ |
2480 |
++ (to).transp = compat_ptr((from).transp) |
2481 |
++ |
2482 |
++#endif /* CONFIG_COMPAT */ |
2483 |
++#endif /* __KERNEL__ */ |
2484 |
++ |
2485 |
++ |
2486 |
+ struct fb_cmap { |
2487 |
+ __u32 start; /* First entry */ |
2488 |
+ __u32 len; /* Number of entries */ |
2489 |
+diff --git a/kernel/sysctl.c b/kernel/sysctl.c |
2490 |
+index 6ee416e..d2c2425 100644 |
2491 |
+--- a/kernel/sysctl.c |
2492 |
++++ b/kernel/sysctl.c |
2493 |
+@@ -149,6 +149,10 @@ static const int cap_last_cap = CAP_LAST_CAP; |
2494 |
+ static unsigned long hung_task_timeout_max = (LONG_MAX/HZ); |
2495 |
+ #endif |
2496 |
+ |
2497 |
++#ifdef CONFIG_FB_CON_DECOR |
2498 |
++extern char fbcon_decor_path[]; |
2499 |
++#endif |
2500 |
++ |
2501 |
+ #ifdef CONFIG_INOTIFY_USER |
2502 |
+ #include <linux/inotify.h> |
2503 |
+ #endif |
2504 |
+@@ -266,6 +270,15 @@ static struct ctl_table sysctl_base_table[] = { |
2505 |
+ .mode = 0555, |
2506 |
+ .child = dev_table, |
2507 |
+ }, |
2508 |
++#ifdef CONFIG_FB_CON_DECOR |
2509 |
++ { |
2510 |
++ .procname = "fbcondecor", |
2511 |
++ .data = &fbcon_decor_path, |
2512 |
++ .maxlen = KMOD_PATH_LEN, |
2513 |
++ .mode = 0644, |
2514 |
++ .proc_handler = &proc_dostring, |
2515 |
++ }, |
2516 |
++#endif |
2517 |
+ { } |
2518 |
+ }; |
2519 |
+ |
2520 |
|
2521 |
diff --git a/4400_alpha-sysctl-uac.patch b/4400_alpha-sysctl-uac.patch |
2522 |
new file mode 100644 |
2523 |
index 0000000..d42b4ed |
2524 |
--- /dev/null |
2525 |
+++ b/4400_alpha-sysctl-uac.patch |
2526 |
@@ -0,0 +1,142 @@ |
2527 |
+diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig |
2528 |
+index 7f312d8..1eb686b 100644 |
2529 |
+--- a/arch/alpha/Kconfig |
2530 |
++++ b/arch/alpha/Kconfig |
2531 |
+@@ -697,6 +697,33 @@ config HZ |
2532 |
+ default 1200 if HZ_1200 |
2533 |
+ default 1024 |
2534 |
+ |
2535 |
++config ALPHA_UAC_SYSCTL |
2536 |
++ bool "Configure UAC policy via sysctl" |
2537 |
++ depends on SYSCTL |
2538 |
++ default y |
2539 |
++ ---help--- |
2540 |
++ Configuring the UAC (unaligned access control) policy on a Linux |
2541 |
++ system usually involves setting a compile time define. If you say |
2542 |
++ Y here, you will be able to modify the UAC policy at runtime using |
2543 |
++ the /proc interface. |
2544 |
++ |
2545 |
++ The UAC policy defines the action Linux should take when an |
2546 |
++ unaligned memory access occurs. The action can include printing a |
2547 |
++ warning message (NOPRINT), sending a signal to the offending |
2548 |
++ program to help developers debug their applications (SIGBUS), or |
2549 |
++ disabling the transparent fixing (NOFIX). |
2550 |
++ |
2551 |
++ The sysctls will be initialized to the compile-time defined UAC |
2552 |
++ policy. You can change these manually, or with the sysctl(8) |
2553 |
++ userspace utility. |
2554 |
++ |
2555 |
++ To disable the warning messages at runtime, you would use |
2556 |
++ |
2557 |
++ echo 1 > /proc/sys/kernel/uac/noprint |
2558 |
++ |
2559 |
++ This is pretty harmless. Say Y if you're not sure. |
2560 |
++ |
2561 |
++ |
2562 |
+ source "drivers/pci/Kconfig" |
2563 |
+ source "drivers/eisa/Kconfig" |
2564 |
+ |
2565 |
+diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c |
2566 |
+index 74aceea..cb35d80 100644 |
2567 |
+--- a/arch/alpha/kernel/traps.c |
2568 |
++++ b/arch/alpha/kernel/traps.c |
2569 |
+@@ -103,6 +103,49 @@ static char * ireg_name[] = {"v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6", |
2570 |
+ "t10", "t11", "ra", "pv", "at", "gp", "sp", "zero"}; |
2571 |
+ #endif |
2572 |
+ |
2573 |
++#ifdef CONFIG_ALPHA_UAC_SYSCTL |
2574 |
++ |
2575 |
++#include <linux/sysctl.h> |
2576 |
++ |
2577 |
++static int enabled_noprint = 0; |
2578 |
++static int enabled_sigbus = 0; |
2579 |
++static int enabled_nofix = 0; |
2580 |
++ |
2581 |
++struct ctl_table uac_table[] = { |
2582 |
++ { |
2583 |
++ .procname = "noprint", |
2584 |
++ .data = &enabled_noprint, |
2585 |
++ .maxlen = sizeof (int), |
2586 |
++ .mode = 0644, |
2587 |
++ .proc_handler = &proc_dointvec, |
2588 |
++ }, |
2589 |
++ { |
2590 |
++ .procname = "sigbus", |
2591 |
++ .data = &enabled_sigbus, |
2592 |
++ .maxlen = sizeof (int), |
2593 |
++ .mode = 0644, |
2594 |
++ .proc_handler = &proc_dointvec, |
2595 |
++ }, |
2596 |
++ { |
2597 |
++ .procname = "nofix", |
2598 |
++ .data = &enabled_nofix, |
2599 |
++ .maxlen = sizeof (int), |
2600 |
++ .mode = 0644, |
2601 |
++ .proc_handler = &proc_dointvec, |
2602 |
++ }, |
2603 |
++ { } |
2604 |
++}; |
2605 |
++ |
2606 |
++static int __init init_uac_sysctl(void) |
2607 |
++{ |
2608 |
++ /* Initialize sysctls with the #defined UAC policy */ |
2609 |
++ enabled_noprint = (test_thread_flag (TS_UAC_NOPRINT)) ? 1 : 0; |
2610 |
++ enabled_sigbus = (test_thread_flag (TS_UAC_SIGBUS)) ? 1 : 0; |
2611 |
++ enabled_nofix = (test_thread_flag (TS_UAC_NOFIX)) ? 1 : 0; |
2612 |
++ return 0; |
2613 |
++} |
2614 |
++#endif |
2615 |
++ |
2616 |
+ static void |
2617 |
+ dik_show_code(unsigned int *pc) |
2618 |
+ { |
2619 |
+@@ -785,7 +828,12 @@ do_entUnaUser(void __user * va, unsigned long opcode, |
2620 |
+ /* Check the UAC bits to decide what the user wants us to do |
2621 |
+ with the unaliged access. */ |
2622 |
+ |
2623 |
++#ifndef CONFIG_ALPHA_UAC_SYSCTL |
2624 |
+ if (!(current_thread_info()->status & TS_UAC_NOPRINT)) { |
2625 |
++#else /* CONFIG_ALPHA_UAC_SYSCTL */ |
2626 |
++ if (!(current_thread_info()->status & TS_UAC_NOPRINT) && |
2627 |
++ !(enabled_noprint)) { |
2628 |
++#endif /* CONFIG_ALPHA_UAC_SYSCTL */ |
2629 |
+ if (__ratelimit(&ratelimit)) { |
2630 |
+ printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n", |
2631 |
+ current->comm, task_pid_nr(current), |
2632 |
+@@ -1090,3 +1138,6 @@ trap_init(void) |
2633 |
+ wrent(entSys, 5); |
2634 |
+ wrent(entDbg, 6); |
2635 |
+ } |
2636 |
++#ifdef CONFIG_ALPHA_UAC_SYSCTL |
2637 |
++ __initcall(init_uac_sysctl); |
2638 |
++#endif |
2639 |
+diff --git a/kernel/sysctl.c b/kernel/sysctl.c |
2640 |
+index 87b2fc3..55021a8 100644 |
2641 |
+--- a/kernel/sysctl.c |
2642 |
++++ b/kernel/sysctl.c |
2643 |
+@@ -152,6 +152,11 @@ static unsigned long hung_task_timeout_max = (LONG_MAX/HZ); |
2644 |
+ #ifdef CONFIG_INOTIFY_USER |
2645 |
+ #include <linux/inotify.h> |
2646 |
+ #endif |
2647 |
++ |
2648 |
++#ifdef CONFIG_ALPHA_UAC_SYSCTL |
2649 |
++extern struct ctl_table uac_table[]; |
2650 |
++#endif |
2651 |
++ |
2652 |
+ #ifdef CONFIG_SPARC |
2653 |
+ #endif |
2654 |
+ |
2655 |
+@@ -1844,6 +1849,13 @@ static struct ctl_table debug_table[] = { |
2656 |
+ .extra2 = &one, |
2657 |
+ }, |
2658 |
+ #endif |
2659 |
++#ifdef CONFIG_ALPHA_UAC_SYSCTL |
2660 |
++ { |
2661 |
++ .procname = "uac", |
2662 |
++ .mode = 0555, |
2663 |
++ .child = uac_table, |
2664 |
++ }, |
2665 |
++#endif /* CONFIG_ALPHA_UAC_SYSCTL */ |
2666 |
+ { } |
2667 |
+ }; |
2668 |
+ |
2669 |
|
2670 |
diff --git a/5010_enable-additional-cpu-optimizations-for-gcc.patch b/5010_enable-additional-cpu-optimizations-for-gcc.patch |
2671 |
new file mode 100644 |
2672 |
index 0000000..c68d072 |
2673 |
--- /dev/null |
2674 |
+++ b/5010_enable-additional-cpu-optimizations-for-gcc.patch |
2675 |
@@ -0,0 +1,530 @@ |
2676 |
+WARNING |
2677 |
+This patch works with gcc versions 4.9+ and with kernel version 3.15+ and should |
2678 |
+NOT be applied when compiling on older versions of gcc due to key name changes |
2679 |
+of the march flags introduced with the version 4.9 release of gcc.[1] |
2680 |
+ |
2681 |
+Use the older version of this patch hosted on the same github for older |
2682 |
+versions of gcc. |
2683 |
+ |
2684 |
+FEATURES |
2685 |
+This patch adds additional CPU options to the Linux kernel accessible under: |
2686 |
+ Processor type and features ---> |
2687 |
+ Processor family ---> |
2688 |
+ |
2689 |
+The expanded microarchitectures include: |
2690 |
+* AMD Improved K8-family |
2691 |
+* AMD K10-family |
2692 |
+* AMD Family 10h (Barcelona) |
2693 |
+* AMD Family 14h (Bobcat) |
2694 |
+* AMD Family 16h (Jaguar) |
2695 |
+* AMD Family 15h (Bulldozer) |
2696 |
+* AMD Family 15h (Piledriver) |
2697 |
+* AMD Family 15h (Steamroller) |
2698 |
+* AMD Family 15h (Excavator) |
2699 |
+* AMD Family 17h (Zen) |
2700 |
+* Intel Silvermont low-power processors |
2701 |
+* Intel 1st Gen Core i3/i5/i7 (Nehalem) |
2702 |
+* Intel 1.5 Gen Core i3/i5/i7 (Westmere) |
2703 |
+* Intel 2nd Gen Core i3/i5/i7 (Sandybridge) |
2704 |
+* Intel 3rd Gen Core i3/i5/i7 (Ivybridge) |
2705 |
+* Intel 4th Gen Core i3/i5/i7 (Haswell) |
2706 |
+* Intel 5th Gen Core i3/i5/i7 (Broadwell) |
2707 |
+* Intel 6th Gen Core i3/i5.i7 (Skylake) |
2708 |
+ |
2709 |
+It also offers to compile passing the 'native' option which, "selects the CPU |
2710 |
+to generate code for at compilation time by determining the processor type of |
2711 |
+the compiling machine. Using -march=native enables all instruction subsets |
2712 |
+supported by the local machine and will produce code optimized for the local |
2713 |
+machine under the constraints of the selected instruction set."[3] |
2714 |
+ |
2715 |
+MINOR NOTES |
2716 |
+This patch also changes 'atom' to 'bonnell' in accordance with the gcc v4.9 |
2717 |
+changes. Note that upstream is using the deprecated 'match=atom' flags when I |
2718 |
+believe it should use the newer 'march=bonnell' flag for atom processors.[2] |
2719 |
+ |
2720 |
+It is not recommended to compile on Atom-CPUs with the 'native' option.[4] The |
2721 |
+recommendation is use to the 'atom' option instead. |
2722 |
+ |
2723 |
+BENEFITS |
2724 |
+Small but real speed increases are measurable using a make endpoint comparing |
2725 |
+a generic kernel to one built with one of the respective microarchs. |
2726 |
+ |
2727 |
+See the following experimental evidence supporting this statement: |
2728 |
+https://github.com/graysky2/kernel_gcc_patch |
2729 |
+ |
2730 |
+REQUIREMENTS |
2731 |
+linux version >=3.15 |
2732 |
+gcc version >=4.9 |
2733 |
+ |
2734 |
+ACKNOWLEDGMENTS |
2735 |
+This patch builds on the seminal work by Jeroen.[5] |
2736 |
+ |
2737 |
+REFERENCES |
2738 |
+1. https://gcc.gnu.org/gcc-4.9/changes.html |
2739 |
+2. https://bugzilla.kernel.org/show_bug.cgi?id=77461 |
2740 |
+3. https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html |
2741 |
+4. https://github.com/graysky2/kernel_gcc_patch/issues/15 |
2742 |
+5. http://www.linuxforge.net/docs/linux/linux-gcc.php |
2743 |
+ |
2744 |
+--- a/arch/x86/include/asm/module.h 2017-08-02 11:41:47.442200461 -0400 |
2745 |
++++ b/arch/x86/include/asm/module.h 2017-08-02 12:14:21.204358744 -0400 |
2746 |
+@@ -15,6 +15,24 @@ |
2747 |
+ #define MODULE_PROC_FAMILY "586MMX " |
2748 |
+ #elif defined CONFIG_MCORE2 |
2749 |
+ #define MODULE_PROC_FAMILY "CORE2 " |
2750 |
++#elif defined CONFIG_MNATIVE |
2751 |
++#define MODULE_PROC_FAMILY "NATIVE " |
2752 |
++#elif defined CONFIG_MNEHALEM |
2753 |
++#define MODULE_PROC_FAMILY "NEHALEM " |
2754 |
++#elif defined CONFIG_MWESTMERE |
2755 |
++#define MODULE_PROC_FAMILY "WESTMERE " |
2756 |
++#elif defined CONFIG_MSILVERMONT |
2757 |
++#define MODULE_PROC_FAMILY "SILVERMONT " |
2758 |
++#elif defined CONFIG_MSANDYBRIDGE |
2759 |
++#define MODULE_PROC_FAMILY "SANDYBRIDGE " |
2760 |
++#elif defined CONFIG_MIVYBRIDGE |
2761 |
++#define MODULE_PROC_FAMILY "IVYBRIDGE " |
2762 |
++#elif defined CONFIG_MHASWELL |
2763 |
++#define MODULE_PROC_FAMILY "HASWELL " |
2764 |
++#elif defined CONFIG_MBROADWELL |
2765 |
++#define MODULE_PROC_FAMILY "BROADWELL " |
2766 |
++#elif defined CONFIG_MSKYLAKE |
2767 |
++#define MODULE_PROC_FAMILY "SKYLAKE " |
2768 |
+ #elif defined CONFIG_MATOM |
2769 |
+ #define MODULE_PROC_FAMILY "ATOM " |
2770 |
+ #elif defined CONFIG_M686 |
2771 |
+@@ -33,6 +51,26 @@ |
2772 |
+ #define MODULE_PROC_FAMILY "K7 " |
2773 |
+ #elif defined CONFIG_MK8 |
2774 |
+ #define MODULE_PROC_FAMILY "K8 " |
2775 |
++#elif defined CONFIG_MK8SSE3 |
2776 |
++#define MODULE_PROC_FAMILY "K8SSE3 " |
2777 |
++#elif defined CONFIG_MK10 |
2778 |
++#define MODULE_PROC_FAMILY "K10 " |
2779 |
++#elif defined CONFIG_MBARCELONA |
2780 |
++#define MODULE_PROC_FAMILY "BARCELONA " |
2781 |
++#elif defined CONFIG_MBOBCAT |
2782 |
++#define MODULE_PROC_FAMILY "BOBCAT " |
2783 |
++#elif defined CONFIG_MBULLDOZER |
2784 |
++#define MODULE_PROC_FAMILY "BULLDOZER " |
2785 |
++#elif defined CONFIG_MPILEDRIVER |
2786 |
++#define MODULE_PROC_FAMILY "PILEDRIVER " |
2787 |
++#elif defined CONFIG_MSTEAMROLLER |
2788 |
++#define MODULE_PROC_FAMILY "STEAMROLLER " |
2789 |
++#elif defined CONFIG_MJAGUAR |
2790 |
++#define MODULE_PROC_FAMILY "JAGUAR " |
2791 |
++#elif defined CONFIG_MEXCAVATOR |
2792 |
++#define MODULE_PROC_FAMILY "EXCAVATOR " |
2793 |
++#elif defined CONFIG_MZEN |
2794 |
++#define MODULE_PROC_FAMILY "ZEN " |
2795 |
+ #elif defined CONFIG_MELAN |
2796 |
+ #define MODULE_PROC_FAMILY "ELAN " |
2797 |
+ #elif defined CONFIG_MCRUSOE |
2798 |
+--- a/arch/x86/Kconfig.cpu 2017-08-02 11:41:47.443200463 -0400 |
2799 |
++++ b/arch/x86/Kconfig.cpu 2017-08-02 12:14:37.108956741 -0400 |
2800 |
+@@ -115,6 +115,7 @@ config MPENTIUMM |
2801 |
+ config MPENTIUM4 |
2802 |
+ bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon" |
2803 |
+ depends on X86_32 |
2804 |
++ select X86_P6_NOP |
2805 |
+ ---help--- |
2806 |
+ Select this for Intel Pentium 4 chips. This includes the |
2807 |
+ Pentium 4, Pentium D, P4-based Celeron and Xeon, and |
2808 |
+@@ -147,9 +148,8 @@ config MPENTIUM4 |
2809 |
+ -Paxville |
2810 |
+ -Dempsey |
2811 |
+ |
2812 |
+- |
2813 |
+ config MK6 |
2814 |
+- bool "K6/K6-II/K6-III" |
2815 |
++ bool "AMD K6/K6-II/K6-III" |
2816 |
+ depends on X86_32 |
2817 |
+ ---help--- |
2818 |
+ Select this for an AMD K6-family processor. Enables use of |
2819 |
+@@ -157,7 +157,7 @@ config MK6 |
2820 |
+ flags to GCC. |
2821 |
+ |
2822 |
+ config MK7 |
2823 |
+- bool "Athlon/Duron/K7" |
2824 |
++ bool "AMD Athlon/Duron/K7" |
2825 |
+ depends on X86_32 |
2826 |
+ ---help--- |
2827 |
+ Select this for an AMD Athlon K7-family processor. Enables use of |
2828 |
+@@ -165,12 +165,83 @@ config MK7 |
2829 |
+ flags to GCC. |
2830 |
+ |
2831 |
+ config MK8 |
2832 |
+- bool "Opteron/Athlon64/Hammer/K8" |
2833 |
++ bool "AMD Opteron/Athlon64/Hammer/K8" |
2834 |
+ ---help--- |
2835 |
+ Select this for an AMD Opteron or Athlon64 Hammer-family processor. |
2836 |
+ Enables use of some extended instructions, and passes appropriate |
2837 |
+ optimization flags to GCC. |
2838 |
+ |
2839 |
++config MK8SSE3 |
2840 |
++ bool "AMD Opteron/Athlon64/Hammer/K8 with SSE3" |
2841 |
++ ---help--- |
2842 |
++ Select this for improved AMD Opteron or Athlon64 Hammer-family processors. |
2843 |
++ Enables use of some extended instructions, and passes appropriate |
2844 |
++ optimization flags to GCC. |
2845 |
++ |
2846 |
++config MK10 |
2847 |
++ bool "AMD 61xx/7x50/PhenomX3/X4/II/K10" |
2848 |
++ ---help--- |
2849 |
++ Select this for an AMD 61xx Eight-Core Magny-Cours, Athlon X2 7x50, |
2850 |
++ Phenom X3/X4/II, Athlon II X2/X3/X4, or Turion II-family processor. |
2851 |
++ Enables use of some extended instructions, and passes appropriate |
2852 |
++ optimization flags to GCC. |
2853 |
++ |
2854 |
++config MBARCELONA |
2855 |
++ bool "AMD Barcelona" |
2856 |
++ ---help--- |
2857 |
++ Select this for AMD Family 10h Barcelona processors. |
2858 |
++ |
2859 |
++ Enables -march=barcelona |
2860 |
++ |
2861 |
++config MBOBCAT |
2862 |
++ bool "AMD Bobcat" |
2863 |
++ ---help--- |
2864 |
++ Select this for AMD Family 14h Bobcat processors. |
2865 |
++ |
2866 |
++ Enables -march=btver1 |
2867 |
++ |
2868 |
++config MJAGUAR |
2869 |
++ bool "AMD Jaguar" |
2870 |
++ ---help--- |
2871 |
++ Select this for AMD Family 16h Jaguar processors. |
2872 |
++ |
2873 |
++ Enables -march=btver2 |
2874 |
++ |
2875 |
++config MBULLDOZER |
2876 |
++ bool "AMD Bulldozer" |
2877 |
++ ---help--- |
2878 |
++ Select this for AMD Family 15h Bulldozer processors. |
2879 |
++ |
2880 |
++ Enables -march=bdver1 |
2881 |
++ |
2882 |
++config MPILEDRIVER |
2883 |
++ bool "AMD Piledriver" |
2884 |
++ ---help--- |
2885 |
++ Select this for AMD Family 15h Piledriver processors. |
2886 |
++ |
2887 |
++ Enables -march=bdver2 |
2888 |
++ |
2889 |
++config MSTEAMROLLER |
2890 |
++ bool "AMD Steamroller" |
2891 |
++ ---help--- |
2892 |
++ Select this for AMD Family 15h Steamroller processors. |
2893 |
++ |
2894 |
++ Enables -march=bdver3 |
2895 |
++ |
2896 |
++config MEXCAVATOR |
2897 |
++ bool "AMD Excavator" |
2898 |
++ ---help--- |
2899 |
++ Select this for AMD Family 15h Excavator processors. |
2900 |
++ |
2901 |
++ Enables -march=bdver4 |
2902 |
++ |
2903 |
++config MZEN |
2904 |
++ bool "AMD Zen" |
2905 |
++ ---help--- |
2906 |
++ Select this for AMD Family 17h Zen processors. |
2907 |
++ |
2908 |
++ Enables -march=znver1 |
2909 |
++ |
2910 |
+ config MCRUSOE |
2911 |
+ bool "Crusoe" |
2912 |
+ depends on X86_32 |
2913 |
+@@ -252,6 +323,7 @@ config MVIAC7 |
2914 |
+ |
2915 |
+ config MPSC |
2916 |
+ bool "Intel P4 / older Netburst based Xeon" |
2917 |
++ select X86_P6_NOP |
2918 |
+ depends on X86_64 |
2919 |
+ ---help--- |
2920 |
+ Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey |
2921 |
+@@ -261,8 +333,19 @@ config MPSC |
2922 |
+ using the cpu family field |
2923 |
+ in /proc/cpuinfo. Family 15 is an older Xeon, Family 6 a newer one. |
2924 |
+ |
2925 |
++config MATOM |
2926 |
++ bool "Intel Atom" |
2927 |
++ select X86_P6_NOP |
2928 |
++ ---help--- |
2929 |
++ |
2930 |
++ Select this for the Intel Atom platform. Intel Atom CPUs have an |
2931 |
++ in-order pipelining architecture and thus can benefit from |
2932 |
++ accordingly optimized code. Use a recent GCC with specific Atom |
2933 |
++ support in order to fully benefit from selecting this option. |
2934 |
++ |
2935 |
+ config MCORE2 |
2936 |
+- bool "Core 2/newer Xeon" |
2937 |
++ bool "Intel Core 2" |
2938 |
++ select X86_P6_NOP |
2939 |
+ ---help--- |
2940 |
+ |
2941 |
+ Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and |
2942 |
+@@ -270,14 +353,79 @@ config MCORE2 |
2943 |
+ family in /proc/cpuinfo. Newer ones have 6 and older ones 15 |
2944 |
+ (not a typo) |
2945 |
+ |
2946 |
+-config MATOM |
2947 |
+- bool "Intel Atom" |
2948 |
++ Enables -march=core2 |
2949 |
++ |
2950 |
++config MNEHALEM |
2951 |
++ bool "Intel Nehalem" |
2952 |
++ select X86_P6_NOP |
2953 |
+ ---help--- |
2954 |
+ |
2955 |
+- Select this for the Intel Atom platform. Intel Atom CPUs have an |
2956 |
+- in-order pipelining architecture and thus can benefit from |
2957 |
+- accordingly optimized code. Use a recent GCC with specific Atom |
2958 |
+- support in order to fully benefit from selecting this option. |
2959 |
++ Select this for 1st Gen Core processors in the Nehalem family. |
2960 |
++ |
2961 |
++ Enables -march=nehalem |
2962 |
++ |
2963 |
++config MWESTMERE |
2964 |
++ bool "Intel Westmere" |
2965 |
++ select X86_P6_NOP |
2966 |
++ ---help--- |
2967 |
++ |
2968 |
++ Select this for the Intel Westmere formerly Nehalem-C family. |
2969 |
++ |
2970 |
++ Enables -march=westmere |
2971 |
++ |
2972 |
++config MSILVERMONT |
2973 |
++ bool "Intel Silvermont" |
2974 |
++ select X86_P6_NOP |
2975 |
++ ---help--- |
2976 |
++ |
2977 |
++ Select this for the Intel Silvermont platform. |
2978 |
++ |
2979 |
++ Enables -march=silvermont |
2980 |
++ |
2981 |
++config MSANDYBRIDGE |
2982 |
++ bool "Intel Sandy Bridge" |
2983 |
++ select X86_P6_NOP |
2984 |
++ ---help--- |
2985 |
++ |
2986 |
++ Select this for 2nd Gen Core processors in the Sandy Bridge family. |
2987 |
++ |
2988 |
++ Enables -march=sandybridge |
2989 |
++ |
2990 |
++config MIVYBRIDGE |
2991 |
++ bool "Intel Ivy Bridge" |
2992 |
++ select X86_P6_NOP |
2993 |
++ ---help--- |
2994 |
++ |
2995 |
++ Select this for 3rd Gen Core processors in the Ivy Bridge family. |
2996 |
++ |
2997 |
++ Enables -march=ivybridge |
2998 |
++ |
2999 |
++config MHASWELL |
3000 |
++ bool "Intel Haswell" |
3001 |
++ select X86_P6_NOP |
3002 |
++ ---help--- |
3003 |
++ |
3004 |
++ Select this for 4th Gen Core processors in the Haswell family. |
3005 |
++ |
3006 |
++ Enables -march=haswell |
3007 |
++ |
3008 |
++config MBROADWELL |
3009 |
++ bool "Intel Broadwell" |
3010 |
++ select X86_P6_NOP |
3011 |
++ ---help--- |
3012 |
++ |
3013 |
++ Select this for 5th Gen Core processors in the Broadwell family. |
3014 |
++ |
3015 |
++ Enables -march=broadwell |
3016 |
++ |
3017 |
++config MSKYLAKE |
3018 |
++ bool "Intel Skylake" |
3019 |
++ select X86_P6_NOP |
3020 |
++ ---help--- |
3021 |
++ |
3022 |
++ Select this for 6th Gen Core processors in the Skylake family. |
3023 |
++ |
3024 |
++ Enables -march=skylake |
3025 |
+ |
3026 |
+ config GENERIC_CPU |
3027 |
+ bool "Generic-x86-64" |
3028 |
+@@ -286,6 +434,19 @@ config GENERIC_CPU |
3029 |
+ Generic x86-64 CPU. |
3030 |
+ Run equally well on all x86-64 CPUs. |
3031 |
+ |
3032 |
++config MNATIVE |
3033 |
++ bool "Native optimizations autodetected by GCC" |
3034 |
++ ---help--- |
3035 |
++ |
3036 |
++ GCC 4.2 and above support -march=native, which automatically detects |
3037 |
++ the optimum settings to use based on your processor. -march=native |
3038 |
++ also detects and applies additional settings beyond -march specific |
3039 |
++ to your CPU, (eg. -msse4). Unless you have a specific reason not to |
3040 |
++ (e.g. distcc cross-compiling), you should probably be using |
3041 |
++ -march=native rather than anything listed below. |
3042 |
++ |
3043 |
++ Enables -march=native |
3044 |
++ |
3045 |
+ endchoice |
3046 |
+ |
3047 |
+ config X86_GENERIC |
3048 |
+@@ -310,7 +471,7 @@ config X86_INTERNODE_CACHE_SHIFT |
3049 |
+ config X86_L1_CACHE_SHIFT |
3050 |
+ int |
3051 |
+ default "7" if MPENTIUM4 || MPSC |
3052 |
+- default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || X86_GENERIC || GENERIC_CPU |
3053 |
++ default "6" if MK7 || MK8 || MK8SSE3 || MK10 || MBARCELONA || MBOBCAT || MBULLDOZER || MPILEDRIVER || MSTEAMROLLER || MEXCAVATOR || MZEN || MJAGUAR || MPENTIUMM || MCORE2 || MNEHALEM || MWESTMERE || MSILVERMONT || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MNATIVE || MATOM || MVIAC7 || X86_GENERIC || GENERIC_CPU |
3054 |
+ default "4" if MELAN || M486 || MGEODEGX1 |
3055 |
+ default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX |
3056 |
+ |
3057 |
+@@ -341,45 +502,46 @@ config X86_ALIGNMENT_16 |
3058 |
+ |
3059 |
+ config X86_INTEL_USERCOPY |
3060 |
+ def_bool y |
3061 |
+- depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK7 || MEFFICEON || MCORE2 |
3062 |
++ depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK8SSE3 || MK7 || MEFFICEON || MCORE2 || MK10 || MBARCELONA || MNEHALEM || MWESTMERE || MSILVERMONT || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MNATIVE |
3063 |
+ |
3064 |
+ config X86_USE_PPRO_CHECKSUM |
3065 |
+ def_bool y |
3066 |
+- depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MVIAC7 || MEFFICEON || MGEODE_LX || MCORE2 || MATOM |
3067 |
++ depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MK10 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MK8SSE3 || MVIAC3_2 || MVIAC7 || MEFFICEON || MGEODE_LX || MCORE2 || MNEHALEM || MWESTMERE || MSILVERMONT || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MATOM || MNATIVE |
3068 |
+ |
3069 |
+ config X86_USE_3DNOW |
3070 |
+ def_bool y |
3071 |
+ depends on (MCYRIXIII || MK7 || MGEODE_LX) && !UML |
3072 |
+ |
3073 |
+-# |
3074 |
+-# P6_NOPs are a relatively minor optimization that require a family >= |
3075 |
+-# 6 processor, except that it is broken on certain VIA chips. |
3076 |
+-# Furthermore, AMD chips prefer a totally different sequence of NOPs |
3077 |
+-# (which work on all CPUs). In addition, it looks like Virtual PC |
3078 |
+-# does not understand them. |
3079 |
+-# |
3080 |
+-# As a result, disallow these if we're not compiling for X86_64 (these |
3081 |
+-# NOPs do work on all x86-64 capable chips); the list of processors in |
3082 |
+-# the right-hand clause are the cores that benefit from this optimization. |
3083 |
+-# |
3084 |
+ config X86_P6_NOP |
3085 |
+- def_bool y |
3086 |
+- depends on X86_64 |
3087 |
+- depends on (MCORE2 || MPENTIUM4 || MPSC) |
3088 |
++ default n |
3089 |
++ bool "Support for P6_NOPs on Intel chips" |
3090 |
++ depends on (MCORE2 || MPENTIUM4 || MPSC || MATOM || MNEHALEM || MWESTMERE || MSILVERMONT || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MNATIVE) |
3091 |
++ ---help--- |
3092 |
++ P6_NOPs are a relatively minor optimization that require a family >= |
3093 |
++ 6 processor, except that it is broken on certain VIA chips. |
3094 |
++ Furthermore, AMD chips prefer a totally different sequence of NOPs |
3095 |
++ (which work on all CPUs). In addition, it looks like Virtual PC |
3096 |
++ does not understand them. |
3097 |
++ |
3098 |
++ As a result, disallow these if we're not compiling for X86_64 (these |
3099 |
++ NOPs do work on all x86-64 capable chips); the list of processors in |
3100 |
++ the right-hand clause are the cores that benefit from this optimization. |
3101 |
++ |
3102 |
++ Say Y if you have Intel CPU newer than Pentium Pro, N otherwise. |
3103 |
+ |
3104 |
+ config X86_TSC |
3105 |
+ def_bool y |
3106 |
+- depends on (MWINCHIP3D || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2 || MATOM) || X86_64 |
3107 |
++ depends on (MWINCHIP3D || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MK8SSE3 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2 || MNEHALEM || MWESTMERE || MSILVERMONT || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MNATIVE || MATOM) || X86_64 |
3108 |
+ |
3109 |
+ config X86_CMPXCHG64 |
3110 |
+ def_bool y |
3111 |
+- depends on X86_PAE || X86_64 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MATOM |
3112 |
++ depends on X86_PAE || X86_64 || MCORE2 || MNEHALEM || MWESTMERE || MSILVERMONT || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MATOM || MNATIVE |
3113 |
+ |
3114 |
+ # this should be set for all -march=.. options where the compiler |
3115 |
+ # generates cmov. |
3116 |
+ config X86_CMOV |
3117 |
+ def_bool y |
3118 |
+- depends on (MK8 || MK7 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MCRUSOE || MEFFICEON || X86_64 || MATOM || MGEODE_LX) |
3119 |
++ depends on (MK8 || MK8SSE3 || MK10 || MBARCELONA || MBOBCAT || MBULLDOZER || MPILEDRIVER || MSTEAMROLLER || MEXCAVATOR || MZEN || MJAGUAR || MK7 || MCORE2 || MNEHALEM || MWESTMERE || MSILVERMONT || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MCRUSOE || MEFFICEON || X86_64 || MNATIVE || MATOM || MGEODE_LX) |
3120 |
+ |
3121 |
+ config X86_MINIMUM_CPU_FAMILY |
3122 |
+ int |
3123 |
+--- a/arch/x86/Makefile 2017-08-02 11:41:47.443200463 -0400 |
3124 |
++++ b/arch/x86/Makefile 2017-08-02 12:14:46.373727353 -0400 |
3125 |
+@@ -121,13 +121,40 @@ else |
3126 |
+ KBUILD_CFLAGS += $(call cc-option,-mskip-rax-setup) |
3127 |
+ |
3128 |
+ # FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu) |
3129 |
++ cflags-$(CONFIG_MNATIVE) += $(call cc-option,-march=native) |
3130 |
+ cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8) |
3131 |
++ cflags-$(CONFIG_MK8SSE3) += $(call cc-option,-march=k8-sse3,-mtune=k8) |
3132 |
++ cflags-$(CONFIG_MK10) += $(call cc-option,-march=amdfam10) |
3133 |
++ cflags-$(CONFIG_MBARCELONA) += $(call cc-option,-march=barcelona) |
3134 |
++ cflags-$(CONFIG_MBOBCAT) += $(call cc-option,-march=btver1) |
3135 |
++ cflags-$(CONFIG_MJAGUAR) += $(call cc-option,-march=btver2) |
3136 |
++ cflags-$(CONFIG_MBULLDOZER) += $(call cc-option,-march=bdver1) |
3137 |
++ cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-march=bdver2) |
3138 |
++ cflags-$(CONFIG_MSTEAMROLLER) += $(call cc-option,-march=bdver3) |
3139 |
++ cflags-$(CONFIG_MEXCAVATOR) += $(call cc-option,-march=bdver4) |
3140 |
++ cflags-$(CONFIG_MZEN) += $(call cc-option,-march=znver1) |
3141 |
+ cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona) |
3142 |
+ |
3143 |
+ cflags-$(CONFIG_MCORE2) += \ |
3144 |
+- $(call cc-option,-march=core2,$(call cc-option,-mtune=generic)) |
3145 |
+- cflags-$(CONFIG_MATOM) += $(call cc-option,-march=atom) \ |
3146 |
+- $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic)) |
3147 |
++ $(call cc-option,-march=core2,$(call cc-option,-mtune=core2)) |
3148 |
++ cflags-$(CONFIG_MNEHALEM) += \ |
3149 |
++ $(call cc-option,-march=nehalem,$(call cc-option,-mtune=nehalem)) |
3150 |
++ cflags-$(CONFIG_MWESTMERE) += \ |
3151 |
++ $(call cc-option,-march=westmere,$(call cc-option,-mtune=westmere)) |
3152 |
++ cflags-$(CONFIG_MSILVERMONT) += \ |
3153 |
++ $(call cc-option,-march=silvermont,$(call cc-option,-mtune=silvermont)) |
3154 |
++ cflags-$(CONFIG_MSANDYBRIDGE) += \ |
3155 |
++ $(call cc-option,-march=sandybridge,$(call cc-option,-mtune=sandybridge)) |
3156 |
++ cflags-$(CONFIG_MIVYBRIDGE) += \ |
3157 |
++ $(call cc-option,-march=ivybridge,$(call cc-option,-mtune=ivybridge)) |
3158 |
++ cflags-$(CONFIG_MHASWELL) += \ |
3159 |
++ $(call cc-option,-march=haswell,$(call cc-option,-mtune=haswell)) |
3160 |
++ cflags-$(CONFIG_MBROADWELL) += \ |
3161 |
++ $(call cc-option,-march=broadwell,$(call cc-option,-mtune=broadwell)) |
3162 |
++ cflags-$(CONFIG_MSKYLAKE) += \ |
3163 |
++ $(call cc-option,-march=skylake,$(call cc-option,-mtune=skylake)) |
3164 |
++ cflags-$(CONFIG_MATOM) += $(call cc-option,-march=bonnell) \ |
3165 |
++ $(call cc-option,-mtune=bonnell,$(call cc-option,-mtune=generic)) |
3166 |
+ cflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=generic) |
3167 |
+ KBUILD_CFLAGS += $(cflags-y) |
3168 |
+ |
3169 |
+--- a/arch/x86/Makefile_32.cpu 2017-08-02 11:41:47.444200464 -0400 |
3170 |
++++ b/arch/x86/Makefile_32.cpu 2017-08-02 12:23:41.636760695 -0400 |
3171 |
+@@ -22,7 +22,18 @@ cflags-$(CONFIG_MK6) += -march=k6 |
3172 |
+ # Please note, that patches that add -march=athlon-xp and friends are pointless. |
3173 |
+ # They make zero difference whatsosever to performance at this time. |
3174 |
+ cflags-$(CONFIG_MK7) += -march=athlon |
3175 |
++cflags-$(CONFIG_MNATIVE) += $(call cc-option,-march=native) |
3176 |
+ cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8,-march=athlon) |
3177 |
++cflags-$(CONFIG_MK8SSE3) += $(call cc-option,-march=k8-sse3,-march=athlon) |
3178 |
++cflags-$(CONFIG_MK10) += $(call cc-option,-march=amdfam10,-march=athlon) |
3179 |
++cflags-$(CONFIG_MBARCELONA) += $(call cc-option,-march=barcelona,-march=athlon) |
3180 |
++cflags-$(CONFIG_MBOBCAT) += $(call cc-option,-march=btver1,-march=athlon) |
3181 |
++cflags-$(CONFIG_MJAGUAR) += $(call cc-option,-march=btver2,-march=athlon) |
3182 |
++cflags-$(CONFIG_MBULLDOZER) += $(call cc-option,-march=bdver1,-march=athlon) |
3183 |
++cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-march=bdver2,-march=athlon) |
3184 |
++cflags-$(CONFIG_MSTEAMROLLER) += $(call cc-option,-march=bdver3,-march=athlon) |
3185 |
++cflags-$(CONFIG_MEXCAVATOR) += $(call cc-option,-march=bdver4,-march=athlon) |
3186 |
++cflags-$(CONFIG_MZEN) += $(call cc-option,-march=znver1,-march=athlon) |
3187 |
+ cflags-$(CONFIG_MCRUSOE) += -march=i686 -falign-functions=0 -falign-jumps=0 -falign-loops=0 |
3188 |
+ cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) -falign-functions=0 -falign-jumps=0 -falign-loops=0 |
3189 |
+ cflags-$(CONFIG_MWINCHIPC6) += $(call cc-option,-march=winchip-c6,-march=i586) |
3190 |
+@@ -31,9 +42,12 @@ cflags-$(CONFIG_MCYRIXIII) += $(call cc- |
3191 |
+ cflags-$(CONFIG_MVIAC3_2) += $(call cc-option,-march=c3-2,-march=i686) |
3192 |
+ cflags-$(CONFIG_MVIAC7) += -march=i686 |
3193 |
+ cflags-$(CONFIG_MCORE2) += -march=i686 $(call tune,core2) |
3194 |
+-cflags-$(CONFIG_MATOM) += $(call cc-option,-march=atom,$(call cc-option,-march=core2,-march=i686)) \ |
3195 |
+- $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic)) |
3196 |
+- |
3197 |
++cflags-$(CONFIG_MNEHALEM) += -march=i686 $(call tune,nehalem) |
3198 |
++cflags-$(CONFIG_MWESTMERE) += -march=i686 $(call tune,westmere) |
3199 |
++cflags-$(CONFIG_MSILVERMONT) += -march=i686 $(call tune,silvermont) |
3200 |
++cflags-$(CONFIG_MSANDYBRIDGE) += -march=i686 $(call tune,sandybridge) |
3201 |
++cflags-$(CONFIG_MIVYBRIDGE) += -march=i686 $(call tune,ivybridge) |
3202 |
++cflags-$(CONFIG_MHASWELL) += -march=i686 $(call tune,haswell) |
3203 |
+ # AMD Elan support |
3204 |
+ cflags-$(CONFIG_MELAN) += -march=i486 |
3205 |
+ |