Use the new x86 code, thanks sn9 !
[openwrt/svn-archive/archive.git] / target / linux / rdc-2.6 / patches / 000-git-newsetup.patch
1 GIT 1783e2f0f21444020e3dee1be46b1e34af0ea3e7 git+ssh://master.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-newsetup.git
2
3 commit 1783e2f0f21444020e3dee1be46b1e34af0ea3e7
4 Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
5 Date: Wed Jun 20 14:12:39 2007 -0700
6
7 Use a new CPU feature word to cover all Intel features that are spread around
8
9 in different CPUID leafs like 0x5, 0x6 and 0xA. Make this
10 feature detection code common across i386 and x86_64.
11
12 Display Intel Dynamic Acceleration feature in /proc/cpuinfo. This feature
13 will be enabled automatically by current acpi-cpufreq driver.
14
15 Refer to Intel Software Developer's Manual for more details about the feature.
16
17 Thanks to hpa (H Peter Anvin) for the making the actual code detecting the
18 scattered features data-driven.
19
20 Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
21 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
22
23 commit cd19eb67cd6636a4e5c9df99631422c7c7286f59
24 Author: H. Peter Anvin <hpa@zytor.com>
25 Date: Wed Jun 20 14:33:17 2007 -0700
26
27 x86 setup: move __bss_start into the .bss segment
28
29 Move __bss_start into the .bss segment, and create __bss_end.
30
31 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
32
33 commit 100327ad6b609cd28970219be57d293847d1261d
34 Author: H. Peter Anvin <hpa@zytor.com>
35 Date: Wed Jun 6 22:07:01 2007 -0700
36
37 x86 setup: remove TSC as a required feature
38
39 Remove TSC as a required feature, in anticipation of CONFIG_X86_TSC
40 removal.
41
42 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
43
44 commit 7c91a172b8af7d4ba087f1f88ed5b155ed459ca3
45 Author: Antonino A. Daplas <adaplas@gmail.com>
46 Date: Tue Jun 5 19:21:05 2007 +0800
47
48 i386: Set 6-bit DAC channel properties in vesa video setup
49
50 If the video BIOS is not capable of switching or failed to switch the
51 hardware to 8-bit DAC, the channel properties are not set. This leads
52 to a blank (all black) display with vesafb at 8 bpp. Fix by defaulting
53 to a 6-bit DAC.
54
55 Signed-off-by: Antonino Daplas <adaplas@gmail.com>
56 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
57
58 commit 6eac2d442de8d87eac94a4ca8600bd87219fa06b
59 Author: H. Peter Anvin <hpa@zytor.com>
60 Date: Tue Jun 5 16:19:36 2007 -0700
61
62 x86 setup: arch/i386/boot/cpucheck.c whitespace cleanup
63
64 Remove stealth whitespace
65
66 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
67
68 commit f7d89f05a30433034a1b4651143afdbb2a8a9c92
69 Author: H. Peter Anvin <hpa@zytor.com>
70 Date: Thu May 24 16:56:44 2007 -0700
71
72 hd.c: remove BIOS/CMOS queries
73
74 An ST-506 disk these days is pretty much someone trying to pull ancient
75 data using an auxilliary controller. Pulling data from the BIOS or CMOS
76 is just plain wrong, since it's likely to be the primary OS disk... and
77 would be user-entered data anyway. Instead, require the user enters it
78 on the command line.
79
80 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
81
82 commit 14c2fdb3bbfd6a9a774980e446c2443150749891
83 Author: H. Peter Anvin <hpa@zytor.com>
84 Date: Thu May 24 15:25:10 2007 -0700
85
86 x86: add back pbe bit to visible CPUID flags
87
88 Add pbe back to the visible CPUID flags. We *do* correctly filter abuses
89 of this bit for 3DNow! in all the appropriate paths.
90
91 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
92
93 commit e071b068a3b9f318be314f0378e655e2eb50ac89
94 Author: H. Peter Anvin <hpa@zytor.com>
95 Date: Wed May 23 14:52:34 2007 -0700
96
97 x86 setup: VIA feature mask MSR doesn't just apply to model <= 9
98
99 The VIA feature mask MSR is known to be present on model 10, and it
100 seems likely it will continue to be supported. Since we only touch the
101 MSR if we're about to print an error message anyway, go ahead and be
102 aggressive.
103
104 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
105
106 commit abe0c5aa1827932cda9c754a3842ec22b278d704
107 Author: H. Peter Anvin <hpa@zytor.com>
108 Date: Tue May 22 17:17:41 2007 -0700
109
110 x86 setup: correct inline assembly constraints in edd.c
111
112 Fix the inline assembly constraints in edd.c. In particular, "driveno"
113 was getting clobbered on some (buggy?) BIOSes.
114
115 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
116
117 commit c2e5887ad275aab90673a3e33344f09946159cf7
118 Author: H. Peter Anvin <hpa@zytor.com>
119 Date: Fri May 18 10:02:55 2007 -0700
120
121 x86 setup: force the assembler to generate a 2-byte jump in header
122
123 The jump instruction in the header only has two bytes available, so
124 it *better* be a 2-byte jump! Unfortunately, the assembler will
125 always generate a 3/5-byte jump when the target is in a different
126 section. Deal with that by generating the jump instruction
127 explicitly from .byte's, just like we do elsewhere when we need a
128 specific binary representation of a certain instruction.
129
130 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
131
132 commit ce82e3b93eba48b6852822a03efa73c74e165d4f
133 Author: H. Peter Anvin <hpa@zytor.com>
134 Date: Thu May 17 15:44:48 2007 -0700
135
136 x86 setup: move the symbol start_of_setup into the proper section.
137
138 start_of_setup is the beginning of the executable code and should be
139 located in the appropriate section.
140
141 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
142
143 commit e5f3a529457a5bfaf8f8783fb86013221279a81c
144 Author: H. Peter Anvin <hpa@zytor.com>
145 Date: Thu May 17 15:43:19 2007 -0700
146
147 x86 setup: add an ASSERT that the header ends up in the right place
148
149 Just in case we have funnies involving the linker or people putting
150 inappropriate align statements, make the linker abort if the setup
151 header ends up in the wrong place.
152
153 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
154
155 commit d9dbde725687ab99d1f529f49f14d1e280cc5cac
156 Author: Alexander van Heukelum <heukelum@mailshack.com>
157 Date: Thu May 17 20:54:25 2007 +0200
158
159 x86 new setup: use appropriate sections for code and data
160
161 An intermediate elf file is generated for the 16-bit setup code.
162 The generated code can be viewed using objdump -m i8086 -d. As it
163 stands, it also tries to disassemble the bugger_off_msg, which
164 results in garbage. This introduces two new sections to separate
165 the code and the data part of the bootsector stub. It also moves
166 some code from the .header section (a data section) to .inittext.
167
168 Signed-off-by: Alexander van Heukelum <heukelum@mailshack.com>
169
170 commit 0d7558a81cf61e9fd2332a54897c5fd18df0d7f2
171 Author: H. Peter Anvin <hpa@zytor.com>
172 Date: Wed May 16 22:03:16 2007 -0700
173
174 x86 setup: use -include code16gcc.h instead of explicit #include
175
176 Use -include in the Makefile instead of #include to include code16gcc.h.
177 This really is more of a compiler switch than anything else, and is a lot
178 cleaner to do implicitly.
179
180 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
181
182 commit 017ce54e8a4a9628a76d6b510c7309a7e4e111a8
183 Author: H. Peter Anvin <hpa@zytor.com>
184 Date: Wed May 16 18:48:06 2007 -0700
185
186 x86 setup: enable features on Centaur (VIA) and Transmeta processors
187
188 AMD are not the only ones who sometimes mask features which the kernel
189 may very well depend on. VIA and Transmeta do, too. Add code to enable
190 these features during checking.
191
192 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
193
194 commit b794f5f9c5089709f3df38c6d91869fa38a9c1a4
195 Author: H. Peter Anvin <hpa@zytor.com>
196 Date: Wed May 16 16:37:47 2007 -0700
197
198 x86 setup: in older versions of ld, ASSERT() is an expression
199
200 Older versions of ld (pre-2.15 or so) need:
201
202 . = ASSERT(foo, "msg");
203
204 instead of:
205
206 ASSERT(foo, "msg")
207
208 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
209
210 commit 21c2b7c99c417d07015ee8e516a634ec3d98c4ee
211 Author: H. Peter Anvin <hpa@zytor.com>
212 Date: Wed May 16 10:52:41 2007 -0700
213
214 x86 setup: print a warning message if the bootloader gave us no heap.
215
216 If the bootloader is so old it doesn't set the CAN_USE_HEAP flag,
217 a lot of functionality will by necessity be disabled, so print a
218 warning message. This means either a 2.00 protocol bootloader or
219 a buggy bootloader; the Qemu bootloader falls in this category.
220
221 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
222
223 commit 52ca0431390d389a2a2246f02fe652ea84c1ddd8
224 Author: H. Peter Anvin <hpa@zytor.com>
225 Date: Wed May 16 10:51:03 2007 -0700
226
227 x86 setup: rely on a compiled-in default for load high/load low
228
229 When deciding if we should move the kernel from 0x10000 to 0x1000, as
230 is required for a zImage kernel, rely on a compiled-in default since
231 Qemu unconditionally zeroes the loadflags. This, of course, is a bug
232 in Qemu, but still...
233
234 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
235
236 commit 4db77a97793104a32e5fb83e62b943fa144b329d
237 Author: H. Peter Anvin <hpa@zytor.com>
238 Date: Wed May 16 08:45:37 2007 -0700
239
240 x86 setup: correct assembly constraints.
241
242 Double use of "d" in an asm() constraints; most gcc versions correctly
243 detect and avoid using it, but some version of gcc runs itself into
244 a brick wall instead. Fix the one "d" which should have been "a".
245
246 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
247
248 commit 4fbccbc1457d6710d3a9ce55ad70ec6cb0b75fc5
249 Author: H. Peter Anvin <hpa@zytor.com>
250 Date: Tue May 15 09:16:29 2007 -0700
251
252 x86 setup: include <asm/msr-index.h> not <asm/msr.h>
253
254 <asm/msr.h> brings in the accessor functions, which may potentially
255 bring in all other kinds of kernel headers which are inappropriate for
256 the setup code. For the setup code, include <asm/msr-index.h>
257 instead, which only includes the numeric constants.
258
259 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
260
261 commit 839cafa9c0020e7506722dd2a4fd82a71c2939cc
262 Author: H. Peter Anvin <hpa@zytor.com>
263 Date: Mon May 14 15:49:01 2007 -0700
264
265 x86 setup: protocol 2.0[01]: base for CL_OFFSET depends on setup_move_size
266
267 Handle the use of boot protocol 2.00 and 2.01: the base segment for
268 CL_OFFSET depends on the value of setup_move_size.
269
270 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
271
272 commit d60357ad68a694b03e9b952eadba5ac277c31df0
273 Author: H. Peter Anvin <hpa@zytor.com>
274 Date: Sat May 12 12:18:53 2007 -0700
275
276 x86 setup: remove unused variable
277
278 Remove unused variable
279
280 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
281
282 commit e21a2030b01081612259847321bcce13eae1e883
283 Author: Sam Ravnborg <sam@ravnborg.org>
284 Date: Sat May 12 12:17:30 2007 -0700
285
286 x86 setup: share i386 Makefile with x86_64
287
288 The boot Makefile for i386 and x86_64 are equal
289 except for the CFLAGS setting.
290 Teach x86_64 to use the Makefile from i386 and
291 make CFLAGS setting arch dependent in i386 Makefile.
292
293 Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
294 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
295
296 commit 8618d92339d0d106045f98f34833d863c3235cdb
297 Author: H. Peter Anvin <hpa@zytor.com>
298 Date: Sat May 12 00:32:12 2007 -0700
299
300 x86 setup: video-bios.c missed the pointer to the set_mode method!
301
302 We need the actual pointer to the set_mode method (oops!)
303
304 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
305
306 commit 85dfc374ea9aad33b9e0315f07a4b2722dc11e3e
307 Author: H. Peter Anvin <hpa@zytor.com>
308 Date: Sat May 12 00:14:43 2007 -0700
309
310 x86 setup: when setting unknown BIOS modes and failing, try to revert
311
312 If we set an unknown BIOS mode and fail, then explicitly try to revert
313 to the original mode.
314
315 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
316
317 commit f4f7949f126d2f152b09fa9367b1ec693f2ea818
318 Author: H. Peter Anvin <hpa@zytor.com>
319 Date: Fri May 11 11:20:59 2007 -0700
320
321 x86 setup: fix typo "video_bios" should be "video-bios"
322
323 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
324
325 commit 51ba7113ea5b07189b7f8a0534d400a072535197
326 Author: H. Peter Anvin <hpa@zytor.com>
327 Date: Fri May 11 11:09:55 2007 -0700
328
329 x86 setup: allow setting VESA modes "blind"
330
331 Apparently, people really do set VESA modes "blind". As a result, make
332 the framework for settting blind modes more general, to remove some
333 special cases.
334
335 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
336
337 commit 1b8f73d9b2bf7630a2914ddab606db16fddb509e
338 Author: H. Peter Anvin <hpa@zytor.com>
339 Date: Thu May 10 22:08:45 2007 -0700
340
341 x86_64: CONFIG_PHYSICAL_ALIGN should be 2 MB
342
343 It's not actually used yet, but set CONFIG_PHYSICAL_ALIGN to 2 MB
344 as it should be, to prevent conflicts with other works in progress.
345
346 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
347
348 commit b81f3c88923e4470cd0942d4596fafc0fb1cf4fd
349 Author: H. Peter Anvin <hpa@zytor.com>
350 Date: Thu May 10 19:11:32 2007 -0700
351
352 x86 setup: remove debugging statements
353
354 Remove debugging statements in video.c that were not meant for
355 production.
356
357 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
358
359 commit be58b6d7e9c14e482bce495e8343955999dea77f
360 Author: H. Peter Anvin <hpa@zytor.com>
361 Date: Thu May 10 18:49:40 2007 -0700
362
363 x86 setup: only restore the screen image when needed
364
365 Only restore the screen image when needed. This is how the original
366 code behaves, so it's presumably the desired behaviour.
367
368 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
369
370 commit 22f6bd8cc23b512af28e34ae7d40036982a0ac63
371 Author: H. Peter Anvin <hpa@zytor.com>
372 Date: Thu May 10 18:44:08 2007 -0700
373
374 x86 setup: correct the definition of the GDT limit
375
376 Like all other x86 segment limits, the GDT limit points to the last byte
377 that is *permitted* to access, so it needs to be sizeof(boot_gdt)-1.
378
379 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
380
381 commit 7f73f1f4aa4c97745bffe07a3ebcf226a4965b00
382 Author: H. Peter Anvin <hpa@zytor.com>
383 Date: Thu May 10 15:47:48 2007 -0700
384
385 x86 setup: Re-implement scanning for hidden video modes
386
387 Re-implement scanning for hidden video modes. Every now and then,
388 apparently, you can find them hidden like easter eggs.
389
390 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
391
392 commit 6770176714bc12ec92372311ac02c14f0d22776e
393 Author: H. Peter Anvin <hpa@zytor.com>
394 Date: Thu May 10 15:24:27 2007 -0700
395
396 x86 setup: whitespace cleanup
397
398 Clean up stealth whitespace.
399
400 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
401
402 commit ba0480a3537cf471b08bdb99dae6d0780cfb1972
403 Author: H. Peter Anvin <hpa@zytor.com>
404 Date: Wed May 9 16:54:42 2007 -0700
405
406 x86: sync the CPU feature string arrays
407
408 With <asm/cpufeature.h> unified, synchronize the CPU feature string
409 arrays. The whole kernel/cpu directory really needs to be unified.
410
411 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
412
413 commit ecb53b84efddbad3d9aa49e95598550831324348
414 Author: H. Peter Anvin <hpa@zytor.com>
415 Date: Tue May 8 22:06:04 2007 -0700
416
417 x86 setup: need to set orig_video_isVGA
418
419 After detecting a VGA console, we need to set
420 boot_params.screen_info.orig_video_isVGA.
421
422 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
423
424 commit dc97fc053faff17b984ec962686caea52bd27628
425 Author: H. Peter Anvin <hpa@zytor.com>
426 Date: Tue May 8 20:51:17 2007 -0700
427
428 x86 setup: boot sector should use ljmp, not jmpl
429
430 We have an "jmpl" instruction in the boot sector, which was meant
431 to be an "ljmp" instruction. It worked anyway because gas interpreted
432 a two-argument "jmpl" as an "ljmpl" instruction, however, use plain
433 "ljmp" (i.e. "ljmpw".)
434
435 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
436
437 commit 7907f05e9692557c53c9ac13647db5e5343c7c76
438 Author: H. Peter Anvin <hpa@zytor.com>
439 Date: Tue May 8 20:27:10 2007 -0700
440
441 x86 setup: only make VESA graphics modes selectable if CONFIG_FB
442
443 If we select a VESA graphics mode, we better have framebuffer support
444 or the user will have no console. Therefore, make these modes
445 non-selectable if CONFIG_FB is not set.
446
447 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
448
449 commit 8e509f9ebc44f45544d231454e84f10bf78d5772
450 Author: H. Peter Anvin <hpa@zytor.com>
451 Date: Tue May 8 20:24:11 2007 -0700
452
453 x86 setup: need to probe VESA EDID block 0 only
454
455 The VESA EDID BIOS call takes the EDID block number in %dx, and may
456 corrupt it by spec. Pass it in properly.
457
458 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
459
460 commit 9912b9aed7943773d1fadaa2e2e52f42af395048
461 Author: H. Peter Anvin <hpa@zytor.com>
462 Date: Mon May 7 18:22:04 2007 -0700
463
464 x86 setup: add missing file "bitops.h" missing from previous checkins
465
466 The file "bitops.h" was missing from previous checkins.
467
468 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
469
470 commit 732eb3fac2d772980e6555b8c69902c8107c72aa
471 Author: H. Peter Anvin <hpa@zytor.com>
472 Date: Mon May 7 14:59:43 2007 -0700
473
474 x86 setup: add -fno-stack-protector; other Makefile fixes
475
476 Add -fno-stack-protector for the gcc's that need that;
477 Use -ffreestanding consistently;
478 Use $(LINUXINCLUDE);
479 Handle linker scripts consistently with other Makefiles.
480
481 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
482
483 commit 2d5e47f21202e156fe97aba0a88d158d5c157a33
484 Author: H. Peter Anvin <hpa@zytor.com>
485 Date: Mon May 7 14:45:25 2007 -0700
486
487 x86 setup: swap cpu.c and cpucheck.c; rename functions
488
489 Make cpucheck.c the reusable component; the generically-named cpu.c
490 gets to be the wrapper. Accordingly, rename functions to make it
491 less confusing.
492
493 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
494
495 commit bf2a428a4e7c1ee3ab9acb23cfafb45e818887a1
496 Author: H. Peter Anvin <hpa@zytor.com>
497 Date: Mon May 7 14:09:38 2007 -0700
498
499 x86 setup: remove code moved from cpucheck.c -> cpu.c
500
501 Move all info about requirements into cpu.c.
502
503 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
504
505 commit 9ea8429fabe5df6aed6393ac3a00d0b64445ba6a
506 Author: H. Peter Anvin <hpa@zytor.com>
507 Date: Mon May 7 09:42:51 2007 -0700
508
509 x86 setup: remove double nesting of a20_test()
510
511 a20_test() was invoked as either a20_test() or a20_wait(), where the
512 latter was simply a loop around a loop. Make the count a parameter
513 instead; this is clearer and saves a couple of bytes.
514
515 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
516
517 commit 9edc55718f57195c664ee3175514d652f651cfd2
518 Author: H. Peter Anvin <hpa@zytor.com>
519 Date: Mon May 7 09:30:41 2007 -0700
520
521 x86 setup: compile with -fomit-frame-pointer
522
523 Compiling with -fomit-frame-pointer reduces the size by about 2%.
524
525 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
526
527 commit e1003433f2d491bf17c79437cd75268da220dab5
528 Author: H. Peter Anvin <hpa@zytor.com>
529 Date: Mon May 7 09:30:04 2007 -0700
530
531 x86 setup: be more paranoid about the stack setup in header.S
532
533 In particular, deal correctly with the stack pointer being zero on entry.
534 While we're at it, align the stack.
535
536 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
537
538 commit 853499c3dc3fcbeb192a613ac241d150ebc7c5a0
539 Author: H. Peter Anvin <hpa@zytor.com>
540 Date: Sun May 6 23:25:10 2007 -0700
541
542 x86 setup: Factor out the environment-independent part of the CPU check.
543
544 Factor out the environment-independent part of the CPU check so it can
545 be invoked from other parts of the kernel as well.
546
547 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
548
549 commit f235a61f6d6dff57883efad351d746540bcb8caf
550 Author: H. Peter Anvin <hpa@zytor.com>
551 Date: Sat May 5 22:16:54 2007 -0700
552
553 x86 setup: when watching the setup size, take the stack into account
554
555 When watching the setup size, we have to take the stack into account.
556 In particular, the stack is used not only by the setup code itself, but
557 by BIOS interrupt handlers and system calls. Reserve a minimum of
558 512 bytes.
559
560 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
561
562 commit 0d0e10091be48f7e4c8888e9d5c2836c704994f5
563 Author: H. Peter Anvin <hpa@zytor.com>
564 Date: Sat May 5 19:25:51 2007 -0700
565
566 x86 setup: actually check the end of the heap.
567
568 Keep track of where the heap ends and actually watch out for it.
569
570 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
571
572 commit 47aab0b8f4d012fad3c42b5b0754d3cb87961b37
573 Author: H. Peter Anvin <hpa@zytor.com>
574 Date: Sat May 5 15:47:58 2007 -0700
575
576 x86 setup: coppyright rPath, Inc.
577
578 This work was done on the dime of rPath, Inc.; they own the copyright.
579
580 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
581
582 commit d22571534d7eabf9408f29d9da423e1c6e04445f
583 Author: H. Peter Anvin <hpa@zytor.com>
584 Date: Sat May 5 15:21:11 2007 -0700
585
586 x86 setup: implement screen contents save/restore
587
588 The old setup code had screen contents save and restore, so implement
589 it for the new one as well.
590
591 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
592
593 commit e5145601a752bd998e783d159c187d3017d45d6d
594 Author: H. Peter Anvin <hpa@zytor.com>
595 Date: Sat May 5 15:20:19 2007 -0700
596
597 x86 setup: whitespace cleanup
598
599 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
600
601 commit 045ecb52f91a74eecad93ffc8791eefe59cf7fd1
602 Author: H. Peter Anvin <hpa@zytor.com>
603 Date: Sat May 5 14:22:39 2007 -0700
604
605 x86 setup: allow setting of VESA graphics modes; cleanups
606
607 - Allow setting of VESA graphics modes (used by vesafb)
608 - Clean up the macros related to the heap
609 - #if 0 copy functions that aren't actually currently being used
610
611 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
612
613 commit 58c04ed7e2d7d5979e1917a74b49bdc0f3dde211
614 Author: H. Peter Anvin <hpa@zytor.com>
615 Date: Sat May 5 12:06:14 2007 -0700
616
617 x86 setup: move all VESA-related code into video-vesa.c; add EDID
618
619 - Move all VESA-related code into video-vesa.c
620 - Add VESA EDID query support
621 - Remove some totally obsolete definitions from video.h
622
623 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
624
625 commit 07bc3931175fb98256140275c03194426d441b74
626 Author: H. Peter Anvin <hpa@zytor.com>
627 Date: Sat May 5 12:04:40 2007 -0700
628
629 x86-64: remove -traditional from AFLAGS
630
631 In arch/x86_64/boot/compressed, remove -traditional from AFLAGS.
632
633 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
634
635 commit a830f615eeef838d461cbf7bbbee8c1c84708ec8
636 Author: H. Peter Anvin <hpa@zytor.com>
637 Date: Fri May 4 18:44:38 2007 -0700
638
639 x86 setup: share code between i386 and x86-64
640
641 Share the boot (setup) code and tools between i386 and x86-64.
642 The compression code is now running in 64-bit mode in order to support
643 relocation, so do *not* share that code.
644
645 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
646
647 commit 3e159a323bdfa5d5a7be2c1f6be089ca22d598e0
648 Author: H. Peter Anvin <hpa@zytor.com>
649 Date: Fri May 4 18:43:35 2007 -0700
650
651 x86-64: use 0x1b4 as the scratch area in boot_params, not 0x3c
652
653 Use 0x1b4 as the scratch area in boot_params rather than 0x3c.
654
655 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
656
657 commit 4cf4424e7a0f29f251b781f9b5e3655b0645cb7f
658 Author: H. Peter Anvin <hpa@zytor.com>
659 Date: Fri May 4 18:26:18 2007 -0700
660
661 Revert "x86-64: Make arch/x86-64/boot a symlink to arch/i386/boot"
662
663 This reverts commit b2ad90f4969226fe8cf3edc5330711ed5fc20105.
664
665 Restore arch/x86_64/boot as a separate directory hierarchy.
666
667 Conflicts:
668
669 commit 8ed1ae1d2f94410811b7cca4b1a426e37652457f
670 Author: H. Peter Anvin <hpa@zytor.com>
671 Date: Fri May 4 17:00:33 2007 -0700
672
673 x86-64: It appears MTRR isn't a required feature after all.
674
675 MTRR was documented as a required feature, but appears to boot fine
676 without it (tested since Bochs doesn't have MTRR support.)
677
678 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
679
680 commit 7c616d098579fb790662cdc703f2a0f26ea1668c
681 Author: H. Peter Anvin <hpa@zytor.com>
682 Date: Fri May 4 16:22:57 2007 -0700
683
684 x86 setup: use 0x1e4 as scratch, instead of 0x3c
685
686 The compressed relocation needs a 4-byte scratch area to obtain
687 its own address.
688
689 0x3c is at the end of the video area, which is quite constrained -- it
690 only has 6 bytes left (12 if we recycle the obsolete fields which invade
691 this space.) Define 0x1e4 as a scratch field, and use it.
692
693 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
694
695 commit 5bc1019227e94576e4876d05ee920f59195bce90
696 Author: H. Peter Anvin <hpa@zytor.com>
697 Date: Fri May 4 16:09:15 2007 -0700
698
699 x86 setup: boot_params.e820_map is just the map, not the count; adjust
700
701 boot_params.e820_map is just a list of entries, whereas
702 "struct e820map" contains a count as well. Thus, don't use
703 "struct e820map" to describe struct boot_params.
704
705 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
706
707 commit 0f96b52497f444be2d52d1184ca90be49f713ea3
708 Author: H. Peter Anvin <hpa@zytor.com>
709 Date: Fri May 4 15:49:03 2007 -0700
710
711 x86 setup: E820MAX is a definitional constant; no need to use sizeof hacks
712
713 Now when we're using the standard headers for the setup code, we can use
714 E820MAX instead of playing sizeof games.
715
716 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
717
718 commit 3a23a428b20cbb31fd7ff5516a053b99afc447f7
719 Author: H. Peter Anvin <hpa@zytor.com>
720 Date: Fri May 4 12:08:46 2007 -0700
721
722 x86: move the bootparam structure definition into include/
723
724 Move the bootparam structure definition into include/, and make other
725 things use it. Haven't cleaned up all the macros yet, though.
726
727 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
728
729 commit e93ec58911995971aa059990f8a91a02b05f6c8f
730 Author: H. Peter Anvin <hpa@zytor.com>
731 Date: Fri May 4 12:07:50 2007 -0700
732
733 i386: change %lu to %u in arch/i386/kernel/e820.h
734
735 It's an u32, print it with %u
736
737 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
738
739 commit 2f47f004f614e2744867c0df274c55d8af2a42d5
740 Author: H. Peter Anvin <hpa@zytor.com>
741 Date: Fri May 4 12:06:04 2007 -0700
742
743 x86: fix differences between i386 and x86-64 <asm/e820.h>
744
745 Fix minor differences between i386 and x86-64 <asm/e820.h>
746
747 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
748
749 commit 56ec52f14e948f430af941052adee98019a617b7
750 Author: H. Peter Anvin <hpa@zytor.com>
751 Date: Fri May 4 11:45:17 2007 -0700
752
753 x86: fix the definition of struct screen_info
754
755 Name the fields that aren't really struct screen_info, and declare
756 the structure packed (the "capabilities" field is misaligned.)
757
758 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
759
760 commit 1d4429eaa564b0085d9ee3aa2de57e87a093a14e
761 Author: H. Peter Anvin <hpa@zytor.com>
762 Date: Fri May 4 11:43:10 2007 -0700
763
764 x86-64: Make arch/x86-64/boot a symlink to arch/i386/boot
765
766 Until such time that Kbuild allows for a cleaner solution, make
767 arch/x86-64/boot a symlink to arch/i386/boot.
768
769 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
770
771 commit 6a85f1b5fd041ea99d8604782559ce0502a60cc0
772 Author: H. Peter Anvin <hpa@zytor.com>
773 Date: Fri May 4 10:42:06 2007 -0700
774
775 x86-64: rearrange includes due to unifications and inclusion from setup
776
777 Unification caused a circular dependency between <asm/alternative.h>
778 and <asm/cpufeature.h>; resolve this.
779
780 Add #ifndef _SETUP in <asm/e820.h> so it can be included from the boot
781 code.
782
783 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
784
785 commit f6bbdc254bdbd5f7cf7a40c4cd6f9844af90824a
786 Author: H. Peter Anvin <hpa@zytor.com>
787 Date: Fri May 4 10:40:26 2007 -0700
788
789 x86: Complete <asm/cpufeature.h> with the union of i386 and x86-64
790
791 Add a feature to <asm/cpufeature.h> which was previously present
792 in x86-64 but missing in i386.
793
794 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
795
796 commit 1a0819281060489901732914f67869e0aa8f26fd
797 Author: H. Peter Anvin <hpa@zytor.com>
798 Date: Fri May 4 10:39:32 2007 -0700
799
800 x86: unify <asm/boot.h>
801
802 Unify <asm/boot.h> between i386 and x86-64
803
804 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
805
806 commit 8d9c54585f4623e0310f970fb5c6eda7ec1614df
807 Author: H. Peter Anvin <hpa@zytor.com>
808 Date: Fri May 4 10:38:35 2007 -0700
809
810 x86-64: verify_cpu.S: use new masks
811
812 Use the <asm/required-features.h> masks.
813
814 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
815
816 commit 6cf3308646bb7a3210f0f76bcb895b2dea76a93c
817 Author: H. Peter Anvin <hpa@zytor.com>
818 Date: Fri May 4 10:37:26 2007 -0700
819
820 x86-64: fix compilation errors due to required-features.h change
821
822 Fix compilation errors induced by required-features.h change.
823
824 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
825
826 commit 1324201a93ce380b46a3128826ecbd794e617e59
827 Author: H. Peter Anvin <hpa@zytor.com>
828 Date: Fri May 4 10:35:37 2007 -0700
829
830 x86-64: <asm/segment.h>: add boot segment descriptors
831
832 Add boot segment descriptors to <asm/segment.h> to match i386.
833
834 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
835
836 commit a0b15a9e79ed0310813709cd0690d6838917fe82
837 Author: H. Peter Anvin <hpa@zytor.com>
838 Date: Fri May 4 10:34:37 2007 -0700
839
840 x86-64: add CONFIG_PHYSICAL_ALIGN to match i386
841
842 Add CONFIG_PHYSICAL_ALIGN to match i386, even though we don't use it.
843
844 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
845
846 commit 8f5d14d11a7318e257351ae477392c7f7e314602
847 Author: H. Peter Anvin <hpa@zytor.com>
848 Date: Fri May 4 10:33:54 2007 -0700
849
850 x86 setup: cleanups for compatibility with x86-64
851
852 These changes are necessary to compile on x86-64.
853
854 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
855
856 commit a32f68b6d4023c1c6b1e62e8561189516c571ab9
857 Author: H. Peter Anvin <hpa@zytor.com>
858 Date: Fri May 4 08:40:07 2007 -0700
859
860 x86 setup: add missing linker script
861
862 Add linker script for the setup code, apparently missing from previous
863 checkins.
864
865 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
866
867 commit 4f34ca8e926b2d0bf3a7502b99f8dfced8cdba9d
868 Author: H. Peter Anvin <hpa@zytor.com>
869 Date: Thu May 3 17:42:29 2007 -0700
870
871 x86 setup: paranoia: clear the high half of %esp
872
873 We're invoked in 16-bit mode from an unknown bootloader. Make sure
874 we explicitly zero the upper half of %esp to avoid nasty surprises.
875
876 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
877
878 commit 19eb9b73cc1632a923003a002108b242af7a6080
879 Author: H. Peter Anvin <hpa@zytor.com>
880 Date: Thu May 3 17:35:41 2007 -0700
881
882 x86 setup: bootlin is *so* dead...
883
884 Bootlin was never able to load bzImage kernels, so who cares about it.
885
886 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
887
888 commit 3b9fb73c65151ee043bc74c333d9e3c9b1872125
889 Author: H. Peter Anvin <hpa@zytor.com>
890 Date: Thu May 3 10:56:40 2007 -0700
891
892 x86 setup: apparently $(src) is insufficient, needs $(srctree)/$(src)
893
894 For some unfanthomable reason the location of the source tree that
895 corresponds to the current directory has to be written as
896 $(srctree)/$(src) apparently. There might be a good reason for it,
897 but shorthand would be appreciated, and $(src) really should be the
898 short form.
899
900 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
901
902 commit a6d01d375a2269be1e3a6b31bcc4d426ad5a473d
903 Author: H. Peter Anvin <hpa@zytor.com>
904 Date: Thu May 3 10:51:45 2007 -0700
905
906 x86 setup: remove reference to obsolete cpureq.c
907
908 cpureq.c has been removed; remove it from the Makefile too.
909
910 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
911
912 commit cbe5b7585d800435080bcbf1b1fd242926982674
913 Author: H. Peter Anvin <hpa@zytor.com>
914 Date: Thu May 3 10:33:12 2007 -0700
915
916 x86 setup: use the required masks from <asm/required-features.h>
917
918 Use the now-uniform features from <asm/required-features.h>.
919
920 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
921
922 commit 99ed30180ecc1bb4e93f6edda5f6bad1adf3e630
923 Author: H. Peter Anvin <hpa@zytor.com>
924 Date: Thu May 3 10:31:12 2007 -0700
925
926 x86: make the handling of required features consistent
927
928 Make the handling of required features consistent between i386
929 and x86-64.
930
931 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
932
933 commit 1120d70a2be8f2deb6bda64047da288d8f86dad3
934 Author: H. Peter Anvin <hpa@zytor.com>
935 Date: Thu May 3 00:09:53 2007 -0700
936
937 x86: Kconfig.cpu: the minimum CPU model is always 3; WP_WORKS_OK = i486
938
939 The minimum CPU model number is always 3 (i386), and if we have
940 WP_WORKS_OK it means we need an i486.
941
942 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
943
944 commit ebc308c204149b86984ae2216f5b9b2e63932028
945 Author: H. Peter Anvin <hpa@zytor.com>
946 Date: Thu May 3 00:08:48 2007 -0700
947
948 x86 setup: use CONFIG_X86_MINIMUM_CPU_MODEL
949
950 Use CONFIG_X86_MINIMUM_CPU_MODEL as defined in Kconfig.cpu.
951
952 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
953
954 commit 8b50b640e015bf5d0f65502437da6fcab46c391b
955 Author: H. Peter Anvin <hpa@zytor.com>
956 Date: Wed May 2 23:45:42 2007 -0700
957
958 x86 setup: remove bogus "static"
959
960 Remove invalid "static" declarations in cpu.c
961
962 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
963
964 commit 35d23b60dfb110da81c24bcbfcda089cfc4fd264
965 Author: H. Peter Anvin <hpa@zytor.com>
966 Date: Wed May 2 23:37:50 2007 -0700
967
968 x86 setup: cpu detection cleanups
969
970 - Use <asm/processor-flags.h>
971 - Make sure %cr0 isn't in a dangerous configuration before probing the FPU
972
973 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
974
975 commit a1150a03247b355d11a4bb696b8aae1f46612992
976 Author: H. Peter Anvin <hpa@zytor.com>
977 Date: Wed May 2 23:36:55 2007 -0700
978
979 x86 setup: compile with -DSETUP
980
981 Define SETUP to make it easier to share code with the rest of the kernel.
982
983 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
984
985 commit 7eb52e8ad1bdf01886023d1a13b3313084cd7db6
986 Author: H. Peter Anvin <hpa@zytor.com>
987 Date: Wed May 2 23:34:57 2007 -0700
988
989 x86 setup: remove unused verify_cpu.S
990
991 verify_cpu.S is obsoleted by boot/cpu.c.
992
993 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
994
995 commit e90317a027c30176968220d18eb18bd6a9d9cc74
996 Author: H. Peter Anvin <hpa@zytor.com>
997 Date: Wed May 2 20:07:43 2007 -0700
998
999 x86 setup: files missing from previous checkin (cpu.c, cpureq.c)
1000
1001 These files were missing from a previous checkin; CPU feature-checking
1002 code and the list of CPU features to check for.
1003
1004 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1005
1006 commit 060f9b3db33c67b5344b2b4110bc823eb776e5cd
1007 Author: H. Peter Anvin <hpa@zytor.com>
1008 Date: Wed May 2 19:51:34 2007 -0700
1009
1010 x86 setup: whitespace cleanup
1011
1012 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1013
1014 commit 9f997a5569ec8fceaa15c2e9cf28e728e2ce118d
1015 Author: H. Peter Anvin <hpa@zytor.com>
1016 Date: Wed May 2 19:07:14 2007 -0700
1017
1018 x86 setup: add CPU feature detect/abort on insufficient featurage
1019
1020 The x86 setup is the right place to check features and abort if they
1021 are not present, since we can still get a message to the user via the
1022 firmware.
1023
1024 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1025
1026 commit de4e976376fddec340651ef40b16a45f6189619d
1027 Author: H. Peter Anvin <hpa@zytor.com>
1028 Date: Wed May 2 19:05:34 2007 -0700
1029
1030 x86 setup: whitespace cleanup
1031
1032 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1033
1034 commit bcd2d2f8de5d4568b6628aa133fce1ac40ece526
1035 Author: H. Peter Anvin <hpa@zytor.com>
1036 Date: Wed May 2 16:19:59 2007 -0700
1037
1038 x86 setup: tag functions noreturn; error message on A20 failure
1039
1040 Tag appropriate functions noreturn.
1041 If the A20 gate fails, output an error message and refuse to boot.
1042
1043 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1044
1045 commit 752aef90cbfc888084bf11fd83f8f72b6a668fc9
1046 Author: H. Peter Anvin <hpa@zytor.com>
1047 Date: Wed May 2 15:45:08 2007 -0700
1048
1049 x86 setup: clobber registers in keyboard BIOS call
1050
1051 Keyboard BIOS call to set repeat rate is known to clobber registers on
1052 "many" BIOSes.
1053
1054 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1055
1056 commit dde94003e4759aab275732cf9f1834440cd381d0
1057 Author: H. Peter Anvin <hpa@zytor.com>
1058 Date: Wed May 2 15:44:21 2007 -0700
1059
1060 x86 setup: implement APM BIOS probe
1061
1062 APM BIOS probe ported from assembly
1063
1064 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1065
1066 commit 9403917d79e3349184318704476fa080836bd52c
1067 Author: H. Peter Anvin <hpa@zytor.com>
1068 Date: Wed May 2 15:17:14 2007 -0700
1069
1070 x86 setup: remove references to obsolete probes
1071
1072 Remove "Hello, World!" as well as references to probes which are no
1073 longer used...
1074
1075 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1076
1077 commit 712f65ffbd1d4b55b4c55d68b4dcd32406c28fb8
1078 Author: H. Peter Anvin <hpa@zytor.com>
1079 Date: Wed May 2 12:17:15 2007 -0700
1080
1081 x86 setup: video.c: correct the handling of special mode numbers
1082
1083 Special mode numbers with the high bit set need to be handled *before*
1084 masking out the high bit.
1085
1086 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1087
1088 commit 9cf083204fe14cda3b09840eba8d131d2e48ccdf
1089 Author: H. Peter Anvin <hpa@zytor.com>
1090 Date: Wed May 2 11:44:16 2007 -0700
1091
1092 x86 setup: Modern ATI cards pass the probe but lacks the modes.
1093
1094 It appears modern ATI cards pass the probe for ATI-ness but lack the
1095 modes. Kill off the driver as being incorrect.
1096
1097 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1098
1099 commit 890cbe950589e30af17eac9da800efc76e35e01d
1100 Author: H. Peter Anvin <hpa@zytor.com>
1101 Date: Wed May 2 11:32:21 2007 -0700
1102
1103 x86 setup: a20.c: make empty_8042() return status
1104
1105 Make functions which could reasonably return status do so. It may
1106 be relevant in the future, and it's a lot better if the programmer
1107 doesn't have to figure out where everything should hook in.
1108
1109 Just on principle.
1110
1111 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1112
1113 commit 08a44dc655e0086d23fc3c70cb93eb51eaeec259
1114 Author: H. Peter Anvin <hpa@zytor.com>
1115 Date: Wed May 2 11:31:03 2007 -0700
1116
1117 x86 setup: video.c: clean up unused stuff
1118
1119 Clean up unused variables that we have no intent on using, as well
1120 as other cruft.
1121
1122 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1123
1124 commit 57e69acff1f577de430cae1523fd49a5d113e885
1125 Author: H. Peter Anvin <hpa@zytor.com>
1126 Date: Wed May 2 11:18:13 2007 -0700
1127
1128 x86 setup: drop video mode range checking
1129
1130 Drop video mode range checking. If someone really has, say, 12x40 mode
1131 visible through the BIOS then allow them to select it... odds are low
1132 that it will actually conflict with the very sparse allocation we have
1133 anyway.
1134
1135 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1136
1137 commit c0dda0b90f92d43872d55d295630a71cd357cfa6
1138 Author: H. Peter Anvin <hpa@zytor.com>
1139 Date: Wed May 2 11:15:53 2007 -0700
1140
1141 x86 setup: if no specific video mode ID is given, generate one
1142
1143 If we don't specify a certain video mode ID in the driver, then
1144 generate the 0xRRCC mode ID automatically.
1145
1146 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1147
1148 commit 0db5086e79810e7c5d560006b1c9a7501a02d80c
1149 Author: H. Peter Anvin <hpa@zytor.com>
1150 Date: Wed May 2 11:10:28 2007 -0700
1151
1152 x86 setup: Sadly, Cirrus removed extended text modes from their BIOS.
1153
1154 In the later era of the Cirrus 54xx series, Cirrus removed extended text
1155 modes from their BIOS. Neither Qemu nor Bochs implement them in the BIOS.
1156 If we can find a direct-register-poking method of setting them that
1157 works in Bochs/Qemu it might be worthwhile to resurrect this; the probing
1158 routine *does* work.
1159
1160 Of course, the Right Thing[TM] would be to submit such a routine to the
1161 Bochs/Qemu BIOS as a VESA text mode.
1162
1163 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1164
1165 commit 41f3fddeeb764687bf3fb0cf77fd858128571d58
1166 Author: H. Peter Anvin <hpa@zytor.com>
1167 Date: Wed May 2 10:18:07 2007 -0700
1168
1169 x86 setup: remove assembly implementation of putchar and puts
1170
1171 Already unused, remove assembly implementation of putchar and puts.
1172
1173 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1174
1175 commit dfa94cd86aca2c01d2f5e14b6e7c3e8258276195
1176 Author: H. Peter Anvin <hpa@zytor.com>
1177 Date: Tue May 1 21:41:28 2007 -0700
1178
1179 x86 setup: Call INT 15h AX=E820h properly
1180
1181 The calling convention for BIOS call 15:E820 was messed up.
1182
1183 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1184
1185 commit 2487575a36435c0a983febbb4f3751331bd2df7a
1186 Author: H. Peter Anvin <hpa@zytor.com>
1187 Date: Tue May 1 21:34:12 2007 -0700
1188
1189 x86 setup: advance one e820 descriptor at a time...
1190
1191 Adding sizeof(foo) to a foo * is not just useless, it's pretty damaging...
1192
1193 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1194
1195 commit 530d4f4f1732335ae8725c0b8c332a618e63ea1d
1196 Author: H. Peter Anvin <hpa@zytor.com>
1197 Date: Tue May 1 21:33:28 2007 -0700
1198
1199 x86 setup: fix memcmp_[fg]s()
1200
1201 Actually return a value from memcmp_[fg]s()...
1202
1203 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1204
1205 commit 8617cd56ff2e43303147da012b26c9dd46af726e
1206 Author: H. Peter Anvin <hpa@zytor.com>
1207 Date: Tue May 1 21:32:47 2007 -0700
1208
1209 x86 setup: fix missing semicolon in video-ati.c
1210
1211 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1212
1213 commit 7bbf7fa3e199b9cef4877c5a56128faff8636cc9
1214 Author: H. Peter Anvin <hpa@zytor.com>
1215 Date: Tue May 1 21:26:48 2007 -0700
1216
1217 x86 setup: make the video setup code actually do something...
1218
1219 Basic video setup now works (there is still work to be done, however.)
1220
1221 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1222
1223 commit 45bcd4406e4b812b32d317d9b3b8db2e5f135a3c
1224 Author: H. Peter Anvin <hpa@zytor.com>
1225 Date: Tue May 1 21:25:20 2007 -0700
1226
1227 x86 setup: segment descriptors need to be Present
1228
1229 The segment descriptors were missing the Present bit.
1230
1231 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1232
1233 commit a39479d4ccf4dceffb623ad2ec7e2d708c38c637
1234 Author: H. Peter Anvin <hpa@zytor.com>
1235 Date: Tue May 1 21:24:32 2007 -0700
1236
1237 build: setup sectors doesn't include the boot sector
1238
1239 The "setup sectors" field doesn't include the old boot sector,
1240 even though the two are now one module.
1241
1242 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1243
1244 commit d8f3d4928ead72e8febe2fcd740d0fee71a61f42
1245 Author: H. Peter Anvin <hpa@zytor.com>
1246 Date: Tue May 1 21:23:44 2007 -0700
1247
1248 x86 setup: in tty.c, actually tell it what character to print
1249
1250 putchar() was missing the actual passing of the character code to the
1251 BIOS call, with very silly-looking results.
1252
1253 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1254
1255 commit 4f1462ed0377e180484a223e622d62432baa64b7
1256 Author: H. Peter Anvin <hpa@zytor.com>
1257 Date: Tue May 1 21:22:46 2007 -0700
1258
1259 x86 setup: printf.c needs code16gcc.h
1260
1261 printf.c was missing code16gcc.h, with predictable consequences.
1262
1263 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1264
1265 commit a5ba7e6df198bd204b0f87fc6e3f68388b9d14c1
1266 Author: H. Peter Anvin <hpa@zytor.com>
1267 Date: Mon Apr 30 20:56:42 2007 -0700
1268
1269 MAINTAINERS: formally take responsibility for the i386 boot code
1270
1271 Change MAINTAINERS to formally take responsibility for the i386 boot code.
1272
1273 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1274
1275 commit 6c821fc005655a99eff6e86c2e4b13654de94dea
1276 Author: H. Peter Anvin <hpa@zytor.com>
1277 Date: Mon Apr 30 20:54:07 2007 -0700
1278
1279 x86 setup code rewrite: initial development snapshot
1280
1281 Clean up the setup code and rewrite it in C.
1282 This is an initial development snapshot, not a working tree.
1283
1284 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1285 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1286 ---
1287
1288 MAINTAINERS | 4
1289 arch/i386/Kconfig.cpu | 4
1290 arch/i386/boot/Makefile | 45
1291 arch/i386/boot/a20.c | 161 +
1292 arch/i386/boot/apm.c | 97
1293 arch/i386/boot/bitops.h | 45
1294 arch/i386/boot/boot.h | 290 ++
1295 arch/i386/boot/bootsect.S | 98
1296 arch/i386/boot/cmdline.c | 97
1297 arch/i386/boot/code16gcc.h | 9
1298 arch/i386/boot/compressed/Makefile | 7
1299 arch/i386/boot/compressed/head.S | 6
1300 arch/i386/boot/compressed/misc.c | 3
1301 arch/i386/boot/copy.S | 101
1302 arch/i386/boot/cpu.c | 69
1303 arch/i386/boot/cpucheck.c | 266 ++
1304 arch/i386/boot/edd.S | 231 --
1305 arch/i386/boot/edd.c | 196 +
1306 arch/i386/boot/header.S | 283 ++
1307 arch/i386/boot/main.c | 161 +
1308 arch/i386/boot/mca.c | 43
1309 arch/i386/boot/memory.c | 99
1310 arch/i386/boot/pm.c | 170 +
1311 arch/i386/boot/pmjump.S | 54
1312 arch/i386/boot/printf.c | 331 ++
1313 arch/i386/boot/setup.S | 1075 ---------
1314 arch/i386/boot/setup.ld | 54
1315 arch/i386/boot/string.c | 34
1316 arch/i386/boot/tools/build.c | 156 -
1317 arch/i386/boot/tty.c | 112
1318 arch/i386/boot/version.c | 23
1319 arch/i386/boot/vesa.h | 79
1320 arch/i386/boot/video-bios.c | 125 +
1321 arch/i386/boot/video-vesa.c | 283 ++
1322 arch/i386/boot/video-vga.c | 260 ++
1323 arch/i386/boot/video.S | 2043 ------------------
1324 arch/i386/boot/video.c | 456 ++++
1325 arch/i386/boot/video.h | 145 +
1326 arch/i386/boot/voyager.c | 46
1327 arch/i386/kernel/cpu/addon_cpuid_features.c | 50
1328 arch/i386/kernel/cpu/common.c | 2
1329 arch/i386/kernel/cpu/proc.c | 21
1330 arch/i386/kernel/e820.c | 2
1331 arch/i386/kernel/setup.c | 12
1332 arch/i386/kernel/verify_cpu.S | 94
1333 arch/x86_64/Kconfig | 4
1334 arch/x86_64/boot/Makefile | 136 -
1335 arch/x86_64/boot/bootsect.S | 98
1336 arch/x86_64/boot/compressed/Makefile | 9
1337 arch/x86_64/boot/compressed/head.S | 6
1338 arch/x86_64/boot/install.sh | 2
1339 arch/x86_64/boot/mtools.conf.in | 17
1340 arch/x86_64/boot/setup.S | 826 -------
1341 arch/x86_64/boot/tools/build.c | 185 -
1342 arch/x86_64/kernel/Makefile | 2
1343 arch/x86_64/kernel/setup.c | 21
1344 arch/x86_64/kernel/verify_cpu.S | 22
1345 drivers/ide/legacy/hd.c | 73
1346 include/asm-i386/boot.h | 6
1347 include/asm-i386/bootparam.h | 85
1348 include/asm-i386/cpufeature.h | 26
1349 include/asm-i386/e820.h | 14
1350 include/asm-i386/processor.h | 1
1351 include/asm-i386/required-features.h | 37
1352 include/asm-i386/setup.h | 10
1353 include/asm-x86_64/alternative.h | 68
1354 include/asm-x86_64/boot.h | 16
1355 include/asm-x86_64/bootparam.h | 1
1356 include/asm-x86_64/cpufeature.h | 115 -
1357 include/asm-x86_64/e820.h | 6
1358 include/asm-x86_64/processor.h | 3
1359 include/asm-x86_64/required-features.h | 46
1360 include/asm-x86_64/segment.h | 8
1361 include/linux/edd.h | 4
1362 include/linux/screen_info.h | 9
1363 75 files changed, 4594 insertions(+), 5204 deletions(-)
1364
1365 diff -puN MAINTAINERS~git-newsetup MAINTAINERS
1366 --- a/MAINTAINERS~git-newsetup
1367 +++ a/MAINTAINERS
1368 @@ -1774,8 +1774,8 @@ T: http://www.harbaum.org/till/i2c_tiny_
1369 S: Maintained
1370
1371 i386 BOOT CODE
1372 -P: Riley H. Williams
1373 -M: Riley@Williams.Name
1374 +P: H. Peter Anvin
1375 +M: hpa@zytor.com
1376 L: Linux-Kernel@vger.kernel.org
1377 S: Maintained
1378
1379 diff -puN arch/i386/Kconfig.cpu~git-newsetup arch/i386/Kconfig.cpu
1380 --- a/arch/i386/Kconfig.cpu~git-newsetup
1381 +++ a/arch/i386/Kconfig.cpu
1382 @@ -346,6 +346,6 @@ config X86_CMOV
1383
1384 config X86_MINIMUM_CPU_MODEL
1385 int
1386 - default "4" if X86_XADD || X86_CMPXCHG || X86_BSWAP
1387 - default "0"
1388 + default "4" if X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK
1389 + default "3"
1390
1391 diff -puN arch/i386/boot/Makefile~git-newsetup arch/i386/boot/Makefile
1392 --- a/arch/i386/boot/Makefile~git-newsetup
1393 +++ a/arch/i386/boot/Makefile
1394 @@ -25,27 +25,53 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
1395
1396 #RAMDISK := -DRAMDISK=512
1397
1398 -targets := vmlinux.bin bootsect bootsect.o \
1399 - setup setup.o zImage bzImage
1400 +targets := vmlinux.bin setup.bin setup.elf zImage bzImage
1401 subdir- := compressed
1402
1403 +setup-y += a20.o apm.o cmdline.o copy.o cpu.o cpucheck.o edd.o
1404 +setup-y += header.o main.o mca.o memory.o pm.o pmjump.o
1405 +setup-y += printf.o string.o tty.o video.o version.o voyager.o
1406 +
1407 +# The link order of the video-*.o modules can matter. In particular,
1408 +# video-vga.o *must* be listed first, followed by video-vesa.o.
1409 +# Hardware-specific drivers should follow in the order they should be
1410 +# probed, and video-bios.o should typically be last.
1411 +setup-y += video-vga.o
1412 +setup-y += video-vesa.o
1413 +setup-y += video-bios.o
1414 +
1415 hostprogs-y := tools/build
1416
1417 HOSTCFLAGS_build.o := $(LINUXINCLUDE)
1418
1419 # ---------------------------------------------------------------------------
1420
1421 +# How to compile the 16-bit code. Note we always compile for -march=i386,
1422 +# that way we can complain to the user if the CPU is insufficient.
1423 +cflags-i386 :=
1424 +cflags-x86_64 := -m32
1425 +CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
1426 + $(cflags-$(ARCH)) \
1427 + -Wall -Wstrict-prototypes \
1428 + -march=i386 -mregparm=3 \
1429 + -include $(srctree)/$(src)/code16gcc.h \
1430 + -fno-strict-aliasing -fomit-frame-pointer \
1431 + $(call cc-option, -ffreestanding) \
1432 + $(call cc-option, -fno-stack-protector)
1433 +AFLAGS := $(CFLAGS) -D__ASSEMBLY__
1434 +
1435 $(obj)/zImage: IMAGE_OFFSET := 0x1000
1436 $(obj)/zImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK)
1437 $(obj)/bzImage: IMAGE_OFFSET := 0x100000
1438 +$(obj)/bzImage: EXTRA_CFLAGS := -D__BIG_KERNEL__
1439 $(obj)/bzImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
1440 $(obj)/bzImage: BUILDFLAGS := -b
1441
1442 quiet_cmd_image = BUILD $@
1443 -cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \
1444 +cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/setup.bin \
1445 $(obj)/vmlinux.bin $(ROOT_DEV) > $@
1446
1447 -$(obj)/zImage $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \
1448 +$(obj)/zImage $(obj)/bzImage: $(obj)/setup.bin \
1449 $(obj)/vmlinux.bin $(obj)/tools/build FORCE
1450 $(call if_changed,image)
1451 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
1452 @@ -53,12 +79,17 @@ $(obj)/zImage $(obj)/bzImage: $(obj)/boo
1453 $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
1454 $(call if_changed,objcopy)
1455
1456 -LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
1457 -LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext
1458 +SETUP_OBJS = $(addprefix $(obj)/,$(setup-y))
1459
1460 -$(obj)/setup $(obj)/bootsect: %: %.o FORCE
1461 +LDFLAGS_setup.elf := -T
1462 +$(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE
1463 $(call if_changed,ld)
1464
1465 +OBJCOPYFLAGS_setup.bin := -O binary
1466 +
1467 +$(obj)/setup.bin: $(obj)/setup.elf FORCE
1468 + $(call if_changed,objcopy)
1469 +
1470 $(obj)/compressed/vmlinux: FORCE
1471 $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@
1472
1473 diff -puN /dev/null arch/i386/boot/a20.c
1474 --- /dev/null
1475 +++ a/arch/i386/boot/a20.c
1476 @@ -0,0 +1,161 @@
1477 +/* -*- linux-c -*- ------------------------------------------------------- *
1478 + *
1479 + * Copyright (C) 1991, 1992 Linus Torvalds
1480 + * Copyright 2007 rPath, Inc. - All Rights Reserved
1481 + *
1482 + * This file is part of the Linux kernel, and is made available under
1483 + * the terms of the GNU General Public License version 2.
1484 + *
1485 + * ----------------------------------------------------------------------- */
1486 +
1487 +/*
1488 + * arch/i386/boot/a20.c
1489 + *
1490 + * Enable A20 gate (return -1 on failure)
1491 + */
1492 +
1493 +#include "boot.h"
1494 +
1495 +#define MAX_8042_LOOPS 100000
1496 +
1497 +static int empty_8042(void)
1498 +{
1499 + u8 status;
1500 + int loops = MAX_8042_LOOPS;
1501 +
1502 + while (loops--) {
1503 + io_delay();
1504 +
1505 + status = inb(0x64);
1506 + if (status & 1) {
1507 + /* Read and discard input data */
1508 + io_delay();
1509 + (void)inb(0x60);
1510 + } else if (!(status & 2)) {
1511 + /* Buffers empty, finished! */
1512 + return 0;
1513 + }
1514 + }
1515 +
1516 + return -1;
1517 +}
1518 +
1519 +/* Returns nonzero if the A20 line is enabled. The memory address
1520 + used as a test is the int $0x80 vector, which should be safe. */
1521 +
1522 +#define A20_TEST_ADDR (4*0x80)
1523 +#define A20_TEST_SHORT 32
1524 +#define A20_TEST_LONG 2097152 /* 2^21 */
1525 +
1526 +static int a20_test(int loops)
1527 +{
1528 + int ok = 0;
1529 + int saved, ctr;
1530 +
1531 + set_fs(0x0000);
1532 + set_gs(0xffff);
1533 +
1534 + saved = ctr = rdfs32(A20_TEST_ADDR);
1535 +
1536 + while (loops--) {
1537 + wrfs32(++ctr, A20_TEST_ADDR);
1538 + io_delay(); /* Serialize and make delay constant */
1539 + ok = rdgs32(A20_TEST_ADDR+0x10) ^ ctr;
1540 + if (ok)
1541 + break;
1542 + }
1543 +
1544 + wrfs32(saved, A20_TEST_ADDR);
1545 + return ok;
1546 +}
1547 +
1548 +/* Quick test to see if A20 is already enabled */
1549 +static int a20_test_short(void)
1550 +{
1551 + return a20_test(A20_TEST_SHORT);
1552 +}
1553 +
1554 +/* Longer test that actually waits for A20 to come on line; this
1555 + is useful when dealing with the KBC or other slow external circuitry. */
1556 +static int a20_test_long(void)
1557 +{
1558 + return a20_test(A20_TEST_LONG);
1559 +}
1560 +
1561 +static void enable_a20_bios(void)
1562 +{
1563 + asm volatile("pushfl; int $0x15; popfl"
1564 + : : "a" ((u16)0x2401));
1565 +}
1566 +
1567 +static void enable_a20_kbc(void)
1568 +{
1569 + empty_8042();
1570 +
1571 + outb(0xd1, 0x64); /* Command write */
1572 + empty_8042();
1573 +
1574 + outb(0xdf, 0x60); /* A20 on */
1575 + empty_8042();
1576 +}
1577 +
1578 +static void enable_a20_fast(void)
1579 +{
1580 + u8 port_a;
1581 +
1582 + port_a = inb(0x92); /* Configuration port A */
1583 + port_a |= 0x02; /* Enable A20 */
1584 + port_a &= ~0x01; /* Do not reset machine */
1585 + outb(port_a, 0x92);
1586 +}
1587 +
1588 +/*
1589 + * Actual routine to enable A20; return 0 on ok, -1 on failure
1590 + */
1591 +
1592 +#define A20_ENABLE_LOOPS 255 /* Number of times to try */
1593 +
1594 +int enable_a20(void)
1595 +{
1596 + int loops = A20_ENABLE_LOOPS;
1597 +
1598 +#if defined(CONFIG_X86_ELAN)
1599 + /* Elan croaks if we try to touch the KBC */
1600 + enable_a20_fast();
1601 + while (!a20_test_long())
1602 + ;
1603 + return 0;
1604 +#elif defined(CONFIG_X86_VOYAGER)
1605 + /* On Voyager, a20_test() is unsafe? */
1606 + enable_a20_kbc();
1607 + return 0;
1608 +#else
1609 + while (loops--) {
1610 + /* First, check to see if A20 is already enabled
1611 + (legacy free, etc.) */
1612 + if (a20_test_short())
1613 + return 0;
1614 +
1615 + /* Next, try the BIOS (INT 0x15, AX=0x2401) */
1616 + enable_a20_bios();
1617 + if (a20_test_short())
1618 + return 0;
1619 +
1620 + /* Try enabling A20 through the keyboard controller */
1621 + empty_8042();
1622 + if (a20_test_short())
1623 + return 0; /* BIOS worked, but with delayed reaction */
1624 +
1625 + enable_a20_kbc();
1626 + if (a20_test_long())
1627 + return 0;
1628 +
1629 + /* Finally, try enabling the "fast A20 gate" */
1630 + enable_a20_fast();
1631 + if (a20_test_long())
1632 + return 0;
1633 + }
1634 +
1635 + return -1;
1636 +#endif
1637 +}
1638 diff -puN /dev/null arch/i386/boot/apm.c
1639 --- /dev/null
1640 +++ a/arch/i386/boot/apm.c
1641 @@ -0,0 +1,97 @@
1642 +/* -*- linux-c -*- ------------------------------------------------------- *
1643 + *
1644 + * Copyright (C) 1991, 1992 Linus Torvalds
1645 + * Copyright 2007 rPath, Inc. - All Rights Reserved
1646 + *
1647 + * Original APM BIOS checking by Stephen Rothwell, May 1994
1648 + * (sfr@canb.auug.org.au)
1649 + *
1650 + * This file is part of the Linux kernel, and is made available under
1651 + * the terms of the GNU General Public License version 2.
1652 + *
1653 + * ----------------------------------------------------------------------- */
1654 +
1655 +/*
1656 + * arch/i386/boot/apm.c
1657 + *
1658 + * Get APM BIOS information
1659 + */
1660 +
1661 +#include "boot.h"
1662 +
1663 +#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
1664 +
1665 +int query_apm_bios(void)
1666 +{
1667 + u16 ax, bx, cx, dx, di;
1668 + u32 ebx, esi;
1669 + u8 err;
1670 +
1671 + /* APM BIOS installation check */
1672 + ax = 0x5300;
1673 + bx = cx = 0;
1674 + asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp ; setc %0"
1675 + : "=d" (err), "+a" (ax), "+b" (bx), "+c" (cx)
1676 + : : "esi", "edi");
1677 +
1678 + if (err)
1679 + return -1; /* No APM BIOS */
1680 +
1681 + if (bx != 0x504d) /* "PM" signature */
1682 + return -1;
1683 +
1684 + if (cx & 0x02) /* 32 bits supported? */
1685 + return -1;
1686 +
1687 + /* Disconnect first, just in case */
1688 + ax = 0x5304;
1689 + asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp"
1690 + : "+a" (ax)
1691 + : : "ebx", "ecx", "edx", "esi", "edi");
1692 +
1693 + /* Paranoia */
1694 + ebx = esi = 0;
1695 + cx = dx = di = 0;
1696 +
1697 + /* 32-bit connect */
1698 + asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp ; setc %6"
1699 + : "=a" (ax), "+b" (ebx), "+c" (cx), "+d" (dx),
1700 + "+S" (esi), "+D" (di), "=m" (err)
1701 + : "a" (0x5303));
1702 +
1703 + boot_params.apm_bios_info.cseg = ax;
1704 + boot_params.apm_bios_info.offset = ebx;
1705 + boot_params.apm_bios_info.cseg_16 = cx;
1706 + boot_params.apm_bios_info.dseg = dx;
1707 + boot_params.apm_bios_info.cseg_len = (u16)esi;
1708 + boot_params.apm_bios_info.cseg_16_len = esi >> 16;
1709 + boot_params.apm_bios_info.dseg_len = di;
1710 +
1711 + if (err)
1712 + return -1;
1713 +
1714 + /* Redo the installation check as the 32-bit connect;
1715 + some BIOSes return different flags this way... */
1716 +
1717 + ax = 0x5300;
1718 + bx = cx = 0;
1719 + asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp ; setc %0"
1720 + : "=d" (err), "+a" (ax), "+b" (bx), "+c" (cx)
1721 + : : "esi", "edi");
1722 +
1723 + if (err || bx != 0x504d) {
1724 + /* Failure with 32-bit connect, try to disconect and ignore */
1725 + ax = 0x5304;
1726 + bx = 0;
1727 + asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp"
1728 + : "+a" (ax), "+b" (bx)
1729 + : : "ecx", "edx", "esi", "edi");
1730 + return -1;
1731 + }
1732 +
1733 + boot_params.apm_bios_info.version = ax;
1734 + boot_params.apm_bios_info.flags = cx;
1735 + return 0;
1736 +}
1737 +
1738 +#endif
1739 diff -puN /dev/null arch/i386/boot/bitops.h
1740 --- /dev/null
1741 +++ a/arch/i386/boot/bitops.h
1742 @@ -0,0 +1,45 @@
1743 +/* -*- linux-c -*- ------------------------------------------------------- *
1744 + *
1745 + * Copyright (C) 1991, 1992 Linus Torvalds
1746 + * Copyright 2007 rPath, Inc. - All Rights Reserved
1747 + *
1748 + * This file is part of the Linux kernel, and is made available under
1749 + * the terms of the GNU General Public License version 2.
1750 + *
1751 + * ----------------------------------------------------------------------- */
1752 +
1753 +/*
1754 + * arch/i386/boot/bitops.h
1755 + *
1756 + * Very simple bitops for the boot code.
1757 + */
1758 +
1759 +#ifndef BOOT_BITOPS_H
1760 +#define BOOT_BITOPS_H
1761 +#define _LINUX_BITOPS_H /* Inhibit inclusion of <linux/bitops.h> */
1762 +
1763 +static inline int constant_test_bit(int nr, const void *addr)
1764 +{
1765 + const u32 *p = (const u32 *)addr;
1766 + return ((1UL << (nr & 31)) & (p[nr >> 5])) != 0;
1767 +}
1768 +static inline int variable_test_bit(int nr, const void *addr)
1769 +{
1770 + u8 v;
1771 + const u32 *p = (const u32 *)addr;
1772 +
1773 + asm("btl %2,%1; setc %0" : "=qm" (v) : "m" (*p), "Ir" (nr));
1774 + return v;
1775 +}
1776 +
1777 +#define test_bit(nr,addr) \
1778 +(__builtin_constant_p(nr) ? \
1779 + constant_test_bit((nr),(addr)) : \
1780 + variable_test_bit((nr),(addr)))
1781 +
1782 +static inline void set_bit(int nr, void *addr)
1783 +{
1784 + asm("btsl %1,%0" : "+m" (*(u32 *)addr) : "Ir" (nr));
1785 +}
1786 +
1787 +#endif /* BOOT_BITOPS_H */
1788 diff -puN /dev/null arch/i386/boot/boot.h
1789 --- /dev/null
1790 +++ a/arch/i386/boot/boot.h
1791 @@ -0,0 +1,290 @@
1792 +/* -*- linux-c -*- ------------------------------------------------------- *
1793 + *
1794 + * Copyright (C) 1991, 1992 Linus Torvalds
1795 + * Copyright 2007 rPath, Inc. - All Rights Reserved
1796 + *
1797 + * This file is part of the Linux kernel, and is made available under
1798 + * the terms of the GNU General Public License version 2.
1799 + *
1800 + * ----------------------------------------------------------------------- */
1801 +
1802 +/*
1803 + * arch/i386/boot/boot.h
1804 + *
1805 + * Header file for the real-mode kernel code
1806 + */
1807 +
1808 +#ifndef BOOT_BOOT_H
1809 +#define BOOT_BOOT_H
1810 +
1811 +#ifndef __ASSEMBLY__
1812 +
1813 +#include <stdarg.h>
1814 +#include <linux/types.h>
1815 +#include <linux/edd.h>
1816 +#include <asm/boot.h>
1817 +#include <asm/bootparam.h>
1818 +
1819 +/* Useful macros */
1820 +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
1821 +
1822 +extern struct setup_header hdr;
1823 +extern struct boot_params boot_params;
1824 +
1825 +/* Basic port I/O */
1826 +static inline void outb(u8 v, u16 port)
1827 +{
1828 + asm volatile("outb %0,%1" : : "a" (v), "dN" (port));
1829 +}
1830 +static inline u8 inb(u16 port)
1831 +{
1832 + u8 v;
1833 + asm volatile("inb %1,%0" : "=a" (v) : "dN" (port));
1834 + return v;
1835 +}
1836 +
1837 +static inline void outw(u16 v, u16 port)
1838 +{
1839 + asm volatile("outw %0,%1" : : "a" (v), "dN" (port));
1840 +}
1841 +static inline u16 inw(u16 port)
1842 +{
1843 + u16 v;
1844 + asm volatile("inw %1,%0" : "=a" (v) : "dN" (port));
1845 + return v;
1846 +}
1847 +
1848 +static inline void outl(u32 v, u16 port)
1849 +{
1850 + asm volatile("outl %0,%1" : : "a" (v), "dn" (port));
1851 +}
1852 +static inline u32 inl(u32 port)
1853 +{
1854 + u32 v;
1855 + asm volatile("inl %1,%0" : "=a" (v) : "dN" (port));
1856 + return v;
1857 +}
1858 +
1859 +static inline void io_delay(void)
1860 +{
1861 + const u16 DELAY_PORT = 0x80;
1862 + asm volatile("outb %%al,%0" : : "dN" (DELAY_PORT));
1863 +}
1864 +
1865 +/* These functions are used to reference data in other segments. */
1866 +
1867 +static inline u16 ds(void)
1868 +{
1869 + u16 seg;
1870 + asm("movw %%ds,%0" : "=rm" (seg));
1871 + return seg;
1872 +}
1873 +
1874 +static inline void set_fs(u16 seg)
1875 +{
1876 + asm volatile("movw %0,%%fs" : : "rm" (seg));
1877 +}
1878 +static inline u16 fs(void)
1879 +{
1880 + u16 seg;
1881 + asm("movw %%fs,%0" : "=rm" (seg));
1882 + return seg;
1883 +}
1884 +
1885 +static inline void set_gs(u16 seg)
1886 +{
1887 + asm volatile("movw %0,%%gs" : : "rm" (seg));
1888 +}
1889 +static inline u16 gs(void)
1890 +{
1891 + u16 seg;
1892 + asm("movw %%gs,%0" : "=rm" (seg));
1893 + return seg;
1894 +}
1895 +
1896 +typedef unsigned int addr_t;
1897 +
1898 +static inline u8 rdfs8(addr_t addr)
1899 +{
1900 + u8 v;
1901 + asm("movb %%fs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr));
1902 + return v;
1903 +}
1904 +static inline u16 rdfs16(addr_t addr)
1905 +{
1906 + u16 v;
1907 + asm("movw %%fs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr));
1908 + return v;
1909 +}
1910 +static inline u32 rdfs32(addr_t addr)
1911 +{
1912 + u32 v;
1913 + asm("movl %%fs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr));
1914 + return v;
1915 +}
1916 +
1917 +static inline void wrfs8(u8 v, addr_t addr)
1918 +{
1919 + asm volatile("movb %1,%%fs:%0" : "+m" (*(u8 *)addr) : "r" (v));
1920 +}
1921 +static inline void wrfs16(u16 v, addr_t addr)
1922 +{
1923 + asm volatile("movw %1,%%fs:%0" : "+m" (*(u16 *)addr) : "r" (v));
1924 +}
1925 +static inline void wrfs32(u32 v, addr_t addr)
1926 +{
1927 + asm volatile("movl %1,%%fs:%0" : "+m" (*(u32 *)addr) : "r" (v));
1928 +}
1929 +
1930 +static inline u8 rdgs8(addr_t addr)
1931 +{
1932 + u8 v;
1933 + asm("movb %%gs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr));
1934 + return v;
1935 +}
1936 +static inline u16 rdgs16(addr_t addr)
1937 +{
1938 + u16 v;
1939 + asm("movw %%gs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr));
1940 + return v;
1941 +}
1942 +static inline u32 rdgs32(addr_t addr)
1943 +{
1944 + u32 v;
1945 + asm("movl %%gs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr));
1946 + return v;
1947 +}
1948 +
1949 +static inline void wrgs8(u8 v, addr_t addr)
1950 +{
1951 + asm volatile("movb %1,%%gs:%0" : "+m" (*(u8 *)addr) : "r" (v));
1952 +}
1953 +static inline void wrgs16(u16 v, addr_t addr)
1954 +{
1955 + asm volatile("movw %1,%%gs:%0" : "+m" (*(u16 *)addr) : "r" (v));
1956 +}
1957 +static inline void wrgs32(u32 v, addr_t addr)
1958 +{
1959 + asm volatile("movl %1,%%gs:%0" : "+m" (*(u32 *)addr) : "r" (v));
1960 +}
1961 +
1962 +/* Note: these only return true/false, not a signed return value! */
1963 +static inline int memcmp(const void *s1, const void *s2, size_t len)
1964 +{
1965 + u8 diff;
1966 + asm("repe; cmpsb; setnz %0"
1967 + : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
1968 + return diff;
1969 +}
1970 +
1971 +static inline int memcmp_fs(const void *s1, addr_t s2, size_t len)
1972 +{
1973 + u8 diff;
1974 + asm("fs; repe; cmpsb; setnz %0"
1975 + : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
1976 + return diff;
1977 +}
1978 +static inline int memcmp_gs(const void *s1, addr_t s2, size_t len)
1979 +{
1980 + u8 diff;
1981 + asm("gs; repe; cmpsb; setnz %0"
1982 + : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
1983 + return diff;
1984 +}
1985 +
1986 +/* Heap -- available for dynamic lists. */
1987 +#define STACK_SIZE 512 /* Minimum number of bytes for stack */
1988 +
1989 +extern char _end[];
1990 +extern char *HEAP;
1991 +extern char *heap_end;
1992 +#define RESET_HEAP() ((void *)( HEAP = _end ))
1993 +static inline char *__get_heap(size_t s, size_t a, size_t n)
1994 +{
1995 + char *tmp;
1996 +
1997 + HEAP = (char *)(((size_t)HEAP+(a-1)) & ~(a-1));
1998 + tmp = HEAP;
1999 + HEAP += s*n;
2000 + return tmp;
2001 +}
2002 +#define GET_HEAP(type, n) \
2003 + ((type *)__get_heap(sizeof(type),__alignof__(type),(n)))
2004 +
2005 +static inline int heap_free(void)
2006 +{
2007 + return heap_end-HEAP;
2008 +}
2009 +
2010 +/* copy.S */
2011 +
2012 +void copy_to_fs(addr_t dst, void *src, size_t len);
2013 +void *copy_from_fs(void *dst, addr_t src, size_t len);
2014 +void copy_to_gs(addr_t dst, void *src, size_t len);
2015 +void *copy_from_gs(void *dst, addr_t src, size_t len);
2016 +void *memcpy(void *dst, void *src, size_t len);
2017 +void *memset(void *dst, int c, size_t len);
2018 +
2019 +#define memcpy(d,s,l) __builtin_memcpy(d,s,l)
2020 +#define memset(d,c,l) __builtin_memset(d,c,l)
2021 +
2022 +/* a20.c */
2023 +int enable_a20(void);
2024 +
2025 +/* apm.c */
2026 +int query_apm_bios(void);
2027 +
2028 +/* cmdline.c */
2029 +int cmdline_find_option(const char *option, char *buffer, int bufsize);
2030 +
2031 +/* cpu.c, cpucheck.c */
2032 +int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr);
2033 +int validate_cpu(void);
2034 +
2035 +/* edd.c */
2036 +void query_edd(void);
2037 +
2038 +/* header.S */
2039 +void __attribute__((noreturn)) die(void);
2040 +
2041 +/* mca.c */
2042 +int query_mca(void);
2043 +
2044 +/* memory.c */
2045 +int detect_memory(void);
2046 +
2047 +/* pm.c */
2048 +void __attribute__((noreturn)) go_to_protected_mode(void);
2049 +
2050 +/* pmjump.S */
2051 +void __attribute__((noreturn))
2052 + protected_mode_jump(u32 entrypoint, u32 bootparams);
2053 +
2054 +/* printf.c */
2055 +unsigned int atou(const char *s);
2056 +int sprintf(char *buf, const char *fmt, ...);
2057 +int vsprintf(char *buf, const char *fmt, va_list args);
2058 +int printf(const char *fmt, ...);
2059 +
2060 +/* string.c */
2061 +int strcmp(const char *str1, const char *str2);
2062 +
2063 +/* tty.c */
2064 +void puts(const char *);
2065 +void putchar(int);
2066 +int getchar(void);
2067 +void kbd_flush(void);
2068 +int getchar_timeout(void);
2069 +
2070 +/* video.c */
2071 +void set_video(void);
2072 +
2073 +/* video-vesa.c */
2074 +void vesa_store_edid(void);
2075 +
2076 +/* voyager.c */
2077 +int query_voyager(void);
2078 +
2079 +#endif /* __ASSEMBLY__ */
2080 +
2081 +#endif /* BOOT_BOOT_H */
2082 diff -puN arch/i386/boot/bootsect.S~git-newsetup /dev/null
2083 --- a/arch/i386/boot/bootsect.S
2084 +++ /dev/null
2085 @@ -1,98 +0,0 @@
2086 -/*
2087 - * bootsect.S Copyright (C) 1991, 1992 Linus Torvalds
2088 - *
2089 - * modified by Drew Eckhardt
2090 - * modified by Bruce Evans (bde)
2091 - * modified by Chris Noe (May 1999) (as86 -> gas)
2092 - * gutted by H. Peter Anvin (Jan 2003)
2093 - *
2094 - * BIG FAT NOTE: We're in real mode using 64k segments. Therefore segment
2095 - * addresses must be multiplied by 16 to obtain their respective linear
2096 - * addresses. To avoid confusion, linear addresses are written using leading
2097 - * hex while segment addresses are written as segment:offset.
2098 - *
2099 - */
2100 -
2101 -#include <asm/boot.h>
2102 -
2103 -SETUPSECTS = 4 /* default nr of setup-sectors */
2104 -BOOTSEG = 0x07C0 /* original address of boot-sector */
2105 -INITSEG = DEF_INITSEG /* we move boot here - out of the way */
2106 -SETUPSEG = DEF_SETUPSEG /* setup starts here */
2107 -SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */
2108 -SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */
2109 - /* to be loaded */
2110 -ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */
2111 -SWAP_DEV = 0 /* SWAP_DEV is now written by "build" */
2112 -
2113 -#ifndef SVGA_MODE
2114 -#define SVGA_MODE ASK_VGA
2115 -#endif
2116 -
2117 -#ifndef RAMDISK
2118 -#define RAMDISK 0
2119 -#endif
2120 -
2121 -#ifndef ROOT_RDONLY
2122 -#define ROOT_RDONLY 1
2123 -#endif
2124 -
2125 -.code16
2126 -.text
2127 -
2128 -.global _start
2129 -_start:
2130 -
2131 - # Normalize the start address
2132 - jmpl $BOOTSEG, $start2
2133 -
2134 -start2:
2135 - movw %cs, %ax
2136 - movw %ax, %ds
2137 - movw %ax, %es
2138 - movw %ax, %ss
2139 - movw $0x7c00, %sp
2140 - sti
2141 - cld
2142 -
2143 - movw $bugger_off_msg, %si
2144 -
2145 -msg_loop:
2146 - lodsb
2147 - andb %al, %al
2148 - jz die
2149 - movb $0xe, %ah
2150 - movw $7, %bx
2151 - int $0x10
2152 - jmp msg_loop
2153 -
2154 -die:
2155 - # Allow the user to press a key, then reboot
2156 - xorw %ax, %ax
2157 - int $0x16
2158 - int $0x19
2159 -
2160 - # int 0x19 should never return. In case it does anyway,
2161 - # invoke the BIOS reset code...
2162 - ljmp $0xf000,$0xfff0
2163 -
2164 -
2165 -bugger_off_msg:
2166 - .ascii "Direct booting from floppy is no longer supported.\r\n"
2167 - .ascii "Please use a boot loader program instead.\r\n"
2168 - .ascii "\n"
2169 - .ascii "Remove disk and press any key to reboot . . .\r\n"
2170 - .byte 0
2171 -
2172 -
2173 - # Kernel attributes; used by setup
2174 -
2175 - .org 497
2176 -setup_sects: .byte SETUPSECTS
2177 -root_flags: .word ROOT_RDONLY
2178 -syssize: .word SYSSIZE
2179 -swap_dev: .word SWAP_DEV
2180 -ram_size: .word RAMDISK
2181 -vid_mode: .word SVGA_MODE
2182 -root_dev: .word ROOT_DEV
2183 -boot_flag: .word 0xAA55
2184 diff -puN /dev/null arch/i386/boot/cmdline.c
2185 --- /dev/null
2186 +++ a/arch/i386/boot/cmdline.c
2187 @@ -0,0 +1,97 @@
2188 +/* -*- linux-c -*- ------------------------------------------------------- *
2189 + *
2190 + * Copyright (C) 1991, 1992 Linus Torvalds
2191 + * Copyright 2007 rPath, Inc. - All Rights Reserved
2192 + *
2193 + * This file is part of the Linux kernel, and is made available under
2194 + * the terms of the GNU General Public License version 2.
2195 + *
2196 + * ----------------------------------------------------------------------- */
2197 +
2198 +/*
2199 + * arch/i386/boot/cmdline.c
2200 + *
2201 + * Simple command-line parser for early boot.
2202 + */
2203 +
2204 +#include "boot.h"
2205 +
2206 +static inline int myisspace(u8 c)
2207 +{
2208 + return c <= ' '; /* Close enough approximation */
2209 +}
2210 +
2211 +/*
2212 + * Find a non-boolean option, that is, "option=argument". In accordance
2213 + * with standard Linux practice, if this option is repeated, this returns
2214 + * the last instance on the command line.
2215 + *
2216 + * Returns the length of the argument (regardless of if it was
2217 + * truncated to fit in the buffer), or -1 on not found.
2218 + */
2219 +int cmdline_find_option(const char *option, char *buffer, int bufsize)
2220 +{
2221 + u32 cmdline_ptr = boot_params.hdr.cmd_line_ptr;
2222 + addr_t cptr;
2223 + char c;
2224 + int len = -1;
2225 + const char *opptr = NULL;
2226 + char *bufptr = buffer;
2227 + enum {
2228 + st_wordstart, /* Start of word/after whitespace */
2229 + st_wordcmp, /* Comparing this word */
2230 + st_wordskip, /* Miscompare, skip */
2231 + st_bufcpy /* Copying this to buffer */
2232 + } state = st_wordstart;
2233 +
2234 + if (!cmdline_ptr || cmdline_ptr >= 0x100000)
2235 + return -1; /* No command line, or inaccessible */
2236 +
2237 + cptr = cmdline_ptr & 0xf;
2238 + set_fs(cmdline_ptr >> 4);
2239 +
2240 + while (cptr < 0x10000 && (c = rdfs8(cptr++))) {
2241 + switch (state) {
2242 + case st_wordstart:
2243 + if (myisspace(c))
2244 + break;
2245 +
2246 + /* else */
2247 + state = st_wordcmp;
2248 + opptr = option;
2249 + /* fall through */
2250 +
2251 + case st_wordcmp:
2252 + if (c == '=' && !*opptr) {
2253 + len = 0;
2254 + bufptr = buffer;
2255 + state = st_bufcpy;
2256 + } else if (myisspace(c)) {
2257 + state = st_wordstart;
2258 + } else if (c != *opptr++) {
2259 + state = st_wordskip;
2260 + }
2261 + break;
2262 +
2263 + case st_wordskip:
2264 + if (myisspace(c))
2265 + state = st_wordstart;
2266 + break;
2267 +
2268 + case st_bufcpy:
2269 + if (myisspace(c)) {
2270 + state = st_wordstart;
2271 + } else {
2272 + if (len < bufsize-1)
2273 + *bufptr++ = c;
2274 + len++;
2275 + }
2276 + break;
2277 + }
2278 + }
2279 +
2280 + if (bufsize)
2281 + *bufptr = '\0';
2282 +
2283 + return len;
2284 +}
2285 diff -puN /dev/null arch/i386/boot/code16gcc.h
2286 --- /dev/null
2287 +++ a/arch/i386/boot/code16gcc.h
2288 @@ -0,0 +1,9 @@
2289 +/*
2290 + * code16gcc.h
2291 + *
2292 + * This file is -include'd when compiling 16-bit C code.
2293 + */
2294 +
2295 +#ifndef __ASSEMBLY__
2296 +asm(".code16gcc");
2297 +#endif
2298 diff -puN arch/i386/boot/compressed/Makefile~git-newsetup arch/i386/boot/compressed/Makefile
2299 --- a/arch/i386/boot/compressed/Makefile~git-newsetup
2300 +++ a/arch/i386/boot/compressed/Makefile
2301 @@ -9,9 +9,14 @@ targets := vmlinux vmlinux.bin vmlinux.
2302 EXTRA_AFLAGS := -traditional
2303
2304 LDFLAGS_vmlinux := -T
2305 -CFLAGS_misc.o += -fPIC
2306 hostprogs-y := relocs
2307
2308 +CFLAGS := -m32 -D__KERNEL__ $(LINUX_INCLUDE) -O2 \
2309 + -fno-strict-aliasing -fPIC \
2310 + $(call cc-option,-ffreestanding) \
2311 + $(call cc-option,-fno-stack-protector)
2312 +LDFLAGS := -m elf_i386
2313 +
2314 $(obj)/vmlinux: $(src)/vmlinux.lds $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE
2315 $(call if_changed,ld)
2316 @:
2317 diff -puN arch/i386/boot/compressed/head.S~git-newsetup arch/i386/boot/compressed/head.S
2318 --- a/arch/i386/boot/compressed/head.S~git-newsetup
2319 +++ a/arch/i386/boot/compressed/head.S
2320 @@ -45,10 +45,10 @@ startup_32:
2321 * at and where we were actually loaded at. This can only be done
2322 * with a short local call on x86. Nothing else will tell us what
2323 * address we are running at. The reserved chunk of the real-mode
2324 - * data at 0x34-0x3f are used as the stack for this calculation.
2325 - * Only 4 bytes are needed.
2326 + * data at 0x1e4 (defined as a scratch field) are used as the stack
2327 + * for this calculation. Only 4 bytes are needed.
2328 */
2329 - leal 0x40(%esi), %esp
2330 + leal (0x1e4+4)(%esi), %esp
2331 call 1f
2332 1: popl %ebp
2333 subl $1b, %ebp
2334 diff -puN arch/i386/boot/compressed/misc.c~git-newsetup arch/i386/boot/compressed/misc.c
2335 --- a/arch/i386/boot/compressed/misc.c~git-newsetup
2336 +++ a/arch/i386/boot/compressed/misc.c
2337 @@ -11,7 +11,6 @@
2338
2339 #undef CONFIG_PARAVIRT
2340 #include <linux/linkage.h>
2341 -#include <linux/vmalloc.h>
2342 #include <linux/screen_info.h>
2343 #include <asm/io.h>
2344 #include <asm/page.h>
2345 @@ -364,8 +363,10 @@ asmlinkage void decompress_kernel(void *
2346
2347 if ((u32)output & (CONFIG_PHYSICAL_ALIGN -1))
2348 error("Destination address not CONFIG_PHYSICAL_ALIGN aligned");
2349 +#ifndef CONFIG_X86_64
2350 if (end > ((-__PAGE_OFFSET-(512 <<20)-1) & 0x7fffffff))
2351 error("Destination address too large");
2352 +#endif
2353 #ifndef CONFIG_RELOCATABLE
2354 if ((u32)output != LOAD_PHYSICAL_ADDR)
2355 error("Wrong destination address");
2356 diff -puN /dev/null arch/i386/boot/copy.S
2357 --- /dev/null
2358 +++ a/arch/i386/boot/copy.S
2359 @@ -0,0 +1,101 @@
2360 +/* ----------------------------------------------------------------------- *
2361 + *
2362 + * Copyright (C) 1991, 1992 Linus Torvalds
2363 + * Copyright 2007 rPath, Inc. - All Rights Reserved
2364 + *
2365 + * This file is part of the Linux kernel, and is made available under
2366 + * the terms of the GNU General Public License version 2.
2367 + *
2368 + * ----------------------------------------------------------------------- */
2369 +
2370 +/*
2371 + * arch/i386/boot/copy.S
2372 + *
2373 + * Memory copy routines
2374 + */
2375 +
2376 + .code16gcc
2377 + .text
2378 +
2379 + .globl memcpy
2380 + .type memcpy, @function
2381 +memcpy:
2382 + pushw %si
2383 + pushw %di
2384 + movw %ax, %di
2385 + movw %dx, %si
2386 + pushw %cx
2387 + shrw $2, %cx
2388 + rep; movsl
2389 + popw %cx
2390 + andw $3, %cx
2391 + rep; movsb
2392 + popw %di
2393 + popw %si
2394 + ret
2395 + .size memcpy, .-memcpy
2396 +
2397 + .globl memset
2398 + .type memset, @function
2399 +memset:
2400 + pushw %di
2401 + movw %ax, %di
2402 + movzbl %dl, %eax
2403 + imull $0x01010101,%eax
2404 + pushw %cx
2405 + shrw $2, %cx
2406 + rep; stosl
2407 + popw %cx
2408 + andw $3, %cx
2409 + rep; stosb
2410 + popw %di
2411 + ret
2412 + .size memset, .-memset
2413 +
2414 + .globl copy_from_fs
2415 + .type copy_from_fs, @function
2416 +copy_from_fs:
2417 + pushw %ds
2418 + pushw %fs
2419 + popw %ds
2420 + call memcpy
2421 + popw %ds
2422 + ret
2423 + .size copy_from_fs, .-copy_from_fs
2424 +
2425 + .globl copy_to_fs
2426 + .type copy_to_fs, @function
2427 +copy_to_fs:
2428 + pushw %es
2429 + pushw %fs
2430 + popw %es
2431 + call memcpy
2432 + popw %es
2433 + ret
2434 + .size copy_to_fs, .-copy_to_fs
2435 +
2436 +#if 0 /* Not currently used, but can be enabled as needed */
2437 +
2438 + .globl copy_from_gs
2439 + .type copy_from_gs, @function
2440 +copy_from_gs:
2441 + pushw %ds
2442 + pushw %gs
2443 + popw %ds
2444 + call memcpy
2445 + popw %ds
2446 + ret
2447 + .size copy_from_gs, .-copy_from_gs
2448 + .globl copy_to_gs
2449 +
2450 + .type copy_to_gs, @function
2451 +copy_to_gs:
2452 + pushw %es
2453 + pushw %gs
2454 + popw %es
2455 + call memcpy
2456 + popw %es
2457 + ret
2458 + .size copy_to_gs, .-copy_to_gs
2459 +
2460 +#endif
2461 diff -puN /dev/null arch/i386/boot/cpu.c
2462 --- /dev/null
2463 +++ a/arch/i386/boot/cpu.c
2464 @@ -0,0 +1,69 @@
2465 +/* -*- linux-c -*- ------------------------------------------------------- *
2466 + *
2467 + * Copyright (C) 1991, 1992 Linus Torvalds
2468 + * Copyright 2007 rPath, Inc. - All Rights Reserved
2469 + *
2470 + * This file is part of the Linux kernel, and is made available under
2471 + * the terms of the GNU General Public License version 2.
2472 + *
2473 + * ----------------------------------------------------------------------- */
2474 +
2475 +/*
2476 + * arch/i386/boot/cpucheck.c
2477 + *
2478 + * Check for obligatory CPU features and abort if the features are not
2479 + * present.
2480 + */
2481 +
2482 +#include "boot.h"
2483 +#include "bitops.h"
2484 +#include <asm/cpufeature.h>
2485 +
2486 +static char *cpu_name(int level)
2487 +{
2488 + static char buf[6];
2489 +
2490 + if (level == 64) {
2491 + return "x86-64";
2492 + } else {
2493 + sprintf(buf, "i%d86", level);
2494 + return buf;
2495 + }
2496 +}
2497 +
2498 +int validate_cpu(void)
2499 +{
2500 + u32 *err_flags;
2501 + int cpu_level, req_level;
2502 +
2503 + check_cpu(&cpu_level, &req_level, &err_flags);
2504 +
2505 + if (cpu_level < req_level) {
2506 + printf("This kernel requires an %s CPU, ",
2507 + cpu_name(req_level));
2508 + printf("but only detected an %s CPU.\n",
2509 + cpu_name(cpu_level));
2510 + return -1;
2511 + }
2512 +
2513 + if (err_flags) {
2514 + int i, j;
2515 + puts("This kernel requires the following features "
2516 + "not present on the CPU:\n");
2517 +
2518 + for (i = 0; i < NCAPINTS; i++) {
2519 + u32 e = err_flags[i];
2520 +
2521 + for (j = 0; j < 32; j++) {
2522 + if (e & 1)
2523 + printf("%d:%d ", i, j);
2524 +
2525 + e >>= 1;
2526 + }
2527 + }
2528 + putchar('\n');
2529 + return -1;
2530 + } else {
2531 + return 0;
2532 + }
2533 +}
2534 diff -puN /dev/null arch/i386/boot/cpucheck.c
2535 --- /dev/null
2536 +++ a/arch/i386/boot/cpucheck.c
2537 @@ -0,0 +1,266 @@
2538 +/* -*- linux-c -*- ------------------------------------------------------- *
2539 + *
2540 + * Copyright (C) 1991, 1992 Linus Torvalds
2541 + * Copyright 2007 rPath, Inc. - All Rights Reserved
2542 + *
2543 + * This file is part of the Linux kernel, and is made available under
2544 + * the terms of the GNU General Public License version 2.
2545 + *
2546 + * ----------------------------------------------------------------------- */
2547 +
2548 +/*
2549 + * arch/i386/boot/cpu.c
2550 + *
2551 + * Check for obligatory CPU features and abort if the features are not
2552 + * present. This code should be compilable as 16-, 32- or 64-bit
2553 + * code, so be very careful with types and inline assembly.
2554 + *
2555 + * This code should not contain any messages; that requires an
2556 + * additional wrapper.
2557 + *
2558 + * As written, this code is not safe for inclusion into the kernel
2559 + * proper (after FPU initialization, in particular).
2560 + */
2561 +
2562 +#ifdef _SETUP
2563 +# include "boot.h"
2564 +# include "bitops.h"
2565 +#endif
2566 +#include <linux/types.h>
2567 +#include <asm/cpufeature.h>
2568 +#include <asm/processor-flags.h>
2569 +#include <asm/required-features.h>
2570 +#include <asm/msr-index.h>
2571 +
2572 +struct cpu_features {
2573 + int level;
2574 + int model;
2575 + u32 flags[NCAPINTS];
2576 +};
2577 +
2578 +static struct cpu_features cpu;
2579 +static u32 cpu_vendor[3];
2580 +static u32 err_flags[NCAPINTS];
2581 +
2582 +#ifdef CONFIG_X86_64
2583 +static const int req_level = 64;
2584 +#elif defined(CONFIG_X86_MINIMUM_CPU_MODEL)
2585 +static const int req_level = CONFIG_X86_MINIMUM_CPU_MODEL;
2586 +#else
2587 +static const int req_level = 3;
2588 +#endif
2589 +
2590 +static const u32 req_flags[NCAPINTS] =
2591 +{
2592 + REQUIRED_MASK0,
2593 + REQUIRED_MASK1,
2594 + REQUIRED_MASK2,
2595 + REQUIRED_MASK3,
2596 + REQUIRED_MASK4,
2597 + REQUIRED_MASK5,
2598 + REQUIRED_MASK6,
2599 +};
2600 +
2601 +#define A32(a,b,c,d) (((d) << 24)+((c) << 16)+((b) << 8)+(a))
2602 +
2603 +static int is_amd(void)
2604 +{
2605 + return cpu_vendor[0] == A32('A','u','t','h') &&
2606 + cpu_vendor[1] == A32('e','n','t','i') &&
2607 + cpu_vendor[2] == A32('c','A','M','D');
2608 +}
2609 +
2610 +static int is_centaur(void)
2611 +{
2612 + return cpu_vendor[0] == A32('C','e','n','t') &&
2613 + cpu_vendor[1] == A32('a','u','r','H') &&
2614 + cpu_vendor[2] == A32('a','u','l','s');
2615 +}
2616 +
2617 +static int is_transmeta(void)
2618 +{
2619 + return cpu_vendor[0] == A32('G','e','n','u') &&
2620 + cpu_vendor[1] == A32('i','n','e','T') &&
2621 + cpu_vendor[2] == A32('M','x','8','6');
2622 +}
2623 +
2624 +static int has_fpu(void)
2625 +{
2626 + u16 fcw = -1, fsw = -1;
2627 + u32 cr0;
2628 +
2629 + asm("movl %%cr0,%0" : "=r" (cr0));
2630 + if (cr0 & (X86_CR0_EM|X86_CR0_TS)) {
2631 + cr0 &= ~(X86_CR0_EM|X86_CR0_TS);
2632 + asm volatile("movl %0,%%cr0" : : "r" (cr0));
2633 + }
2634 +
2635 + asm("fninit ; fnstsw %0 ; fnstcw %1" : "+m" (fsw), "+m" (fcw));
2636 +
2637 + return fsw == 0 && (fcw & 0x103f) == 0x003f;
2638 +}
2639 +
2640 +static int has_eflag(u32 mask)
2641 +{
2642 + u32 f0, f1;
2643 +
2644 + asm("pushfl ; "
2645 + "pushfl ; "
2646 + "popl %0 ; "
2647 + "movl %0,%1 ; "
2648 + "xorl %2,%1 ; "
2649 + "pushl %1 ; "
2650 + "popfl ; "
2651 + "pushfl ; "
2652 + "popl %1 ; "
2653 + "popfl"
2654 + : "=r" (f0), "=r" (f1)
2655 + : "g" (mask));
2656 +
2657 + return !!((f0^f1) & mask);
2658 +}
2659 +
2660 +static void get_flags(void)
2661 +{
2662 + u32 max_intel_level, max_amd_level;
2663 + u32 tfms;
2664 +
2665 + if (has_fpu())
2666 + set_bit(X86_FEATURE_FPU, cpu.flags);
2667 +
2668 + if (has_eflag(X86_EFLAGS_ID)) {
2669 + asm("cpuid"
2670 + : "=a" (max_intel_level),
2671 + "=b" (cpu_vendor[0]),
2672 + "=d" (cpu_vendor[1]),
2673 + "=c" (cpu_vendor[2])
2674 + : "a" (0));
2675 +
2676 + if (max_intel_level >= 0x00000001 &&
2677 + max_intel_level <= 0x0000ffff) {
2678 + asm("cpuid"
2679 + : "=a" (tfms),
2680 + "=c" (cpu.flags[4]),
2681 + "=d" (cpu.flags[0])
2682 + : "a" (0x00000001)
2683 + : "ebx");
2684 + cpu.level = (tfms >> 8) & 15;
2685 + cpu.model = (tfms >> 4) & 15;
2686 + if (cpu.level >= 6)
2687 + cpu.model += ((tfms >> 16) & 0xf) << 4;
2688 + }
2689 +
2690 + asm("cpuid"
2691 + : "=a" (max_amd_level)
2692 + : "a" (0x80000000)
2693 + : "ebx", "ecx", "edx");
2694 +
2695 + if (max_amd_level >= 0x80000001 &&
2696 + max_amd_level <= 0x8000ffff) {
2697 + u32 eax = 0x80000001;
2698 + asm("cpuid"
2699 + : "+a" (eax),
2700 + "=c" (cpu.flags[6]),
2701 + "=d" (cpu.flags[1])
2702 + : : "ebx");
2703 + }
2704 + }
2705 +}
2706 +
2707 +/* Returns a bitmask of which words we have error bits in */
2708 +static int check_flags(void)
2709 +{
2710 + u32 err;
2711 + int i;
2712 +
2713 + err = 0;
2714 + for (i = 0; i < NCAPINTS; i++) {
2715 + err_flags[i] = req_flags[i] & ~cpu.flags[i];
2716 + if (err_flags[i])
2717 + err |= 1 << i;
2718 + }
2719 +
2720 + return err;
2721 +}
2722 +
2723 +/*
2724 + * Returns -1 on error.
2725 + *
2726 + * *cpu_level is set to the current CPU level; *req_level to the required
2727 + * level. x86-64 is considered level 64 for this purpose.
2728 + *
2729 + * *err_flags_ptr is set to the flags error array if there are flags missing.
2730 + */
2731 +int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr)
2732 +{
2733 + int err;
2734 +
2735 + memset(&cpu.flags, 0, sizeof cpu.flags);
2736 + cpu.level = 3;
2737 +
2738 + if (has_eflag(X86_EFLAGS_AC))
2739 + cpu.level = 4;
2740 +
2741 + get_flags();
2742 + err = check_flags();
2743 +
2744 + if (test_bit(X86_FEATURE_LM, cpu.flags))
2745 + cpu.level = 64;
2746 +
2747 + if (err == 0x01 &&
2748 + !(err_flags[0] &
2749 + ~((1 << X86_FEATURE_XMM)|(1 << X86_FEATURE_XMM2))) &&
2750 + is_amd()) {
2751 + /* If this is an AMD and we're only missing SSE+SSE2, try to
2752 + turn them on */
2753 +
2754 + u32 ecx = MSR_K7_HWCR;
2755 + u32 eax, edx;
2756 +
2757 + asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
2758 + eax &= ~(1 << 15);
2759 + asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
2760 +
2761 + get_flags(); /* Make sure it really did something */
2762 + err = check_flags();
2763 + } else if (err == 0x01 &&
2764 + !(err_flags[0] & ~(1 << X86_FEATURE_CX8)) &&
2765 + is_centaur() && cpu.model >= 6) {
2766 + /* If this is a VIA C3, we might have to enable CX8
2767 + explicitly */
2768 +
2769 + u32 ecx = MSR_VIA_FCR;
2770 + u32 eax, edx;
2771 +
2772 + asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
2773 + eax |= (1<<1)|(1<<7);
2774 + asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
2775 +
2776 + set_bit(X86_FEATURE_CX8, cpu.flags);
2777 + err = check_flags();
2778 + } else if (err == 0x01 && is_transmeta()) {
2779 + /* Transmeta might have masked feature bits in word 0 */
2780 +
2781 + u32 ecx = 0x80860004;
2782 + u32 eax, edx;
2783 + u32 level = 1;
2784 +
2785 + asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
2786 + asm("wrmsr" : : "a" (~0), "d" (edx), "c" (ecx));
2787 + asm("cpuid"
2788 + : "+a" (level), "=d" (cpu.flags[0])
2789 + : : "ecx", "ebx");
2790 + asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
2791 +
2792 + err = check_flags();
2793 + }
2794 +
2795 + if (err_flags_ptr)
2796 + *err_flags_ptr = err ? err_flags : NULL;
2797 + if (cpu_level_ptr)
2798 + *cpu_level_ptr = cpu.level;
2799 + if (req_level_ptr)
2800 + *req_level_ptr = req_level;
2801 +
2802 + return (cpu.level < req_level || err) ? -1 : 0;
2803 +}
2804 diff -puN arch/i386/boot/edd.S~git-newsetup /dev/null
2805 --- a/arch/i386/boot/edd.S
2806 +++ /dev/null
2807 @@ -1,231 +0,0 @@
2808 -/*
2809 - * BIOS Enhanced Disk Drive support
2810 - * Copyright (C) 2002, 2003, 2004 Dell, Inc.
2811 - * by Matt Domsch <Matt_Domsch@dell.com> October 2002
2812 - * conformant to T13 Committee www.t13.org
2813 - * projects 1572D, 1484D, 1386D, 1226DT
2814 - * disk signature read by Matt Domsch <Matt_Domsch@dell.com>
2815 - * and Andrew Wilks <Andrew_Wilks@dell.com> September 2003, June 2004
2816 - * legacy CHS retrieval by Patrick J. LoPresti <patl@users.sourceforge.net>
2817 - * March 2004
2818 - * Command line option parsing, Matt Domsch, November 2004
2819 - */
2820 -
2821 -#include <linux/edd.h>
2822 -#include <asm/setup.h>
2823 -
2824 -#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
2825 -
2826 -# It is assumed that %ds == INITSEG here
2827 -
2828 - movb $0, (EDD_MBR_SIG_NR_BUF)
2829 - movb $0, (EDDNR)
2830 -
2831 -# Check the command line for options:
2832 -# edd=of disables EDD completely (edd=off)
2833 -# edd=sk skips the MBR test (edd=skipmbr)
2834 -# edd=on re-enables EDD (edd=on)
2835 -
2836 - pushl %esi
2837 - movw $edd_mbr_sig_start, %di # Default to edd=on
2838 -
2839 - movl %cs:(cmd_line_ptr), %esi
2840 - andl %esi, %esi
2841 - jz old_cl # Old boot protocol?
2842 -
2843 -# Convert to a real-mode pointer in fs:si
2844 - movl %esi, %eax
2845 - shrl $4, %eax
2846 - movw %ax, %fs
2847 - andw $0xf, %si
2848 - jmp have_cl_pointer
2849 -
2850 -# Old-style boot protocol?
2851 -old_cl:
2852 - push %ds # aka INITSEG
2853 - pop %fs
2854 -
2855 - cmpw $0xa33f, (0x20)
2856 - jne done_cl # No command line at all?
2857 - movw (0x22), %si # Pointer relative to INITSEG
2858 -
2859 -# fs:si has the pointer to the command line now
2860 -have_cl_pointer:
2861 -
2862 -# Loop through kernel command line one byte at a time. Just in
2863 -# case the loader is buggy and failed to null-terminate the command line
2864 -# terminate if we get close enough to the end of the segment that we
2865 -# cannot fit "edd=XX"...
2866 -cl_atspace:
2867 - cmpw $-5, %si # Watch for segment wraparound
2868 - jae done_cl
2869 - movl %fs:(%si), %eax
2870 - andb %al, %al # End of line?
2871 - jz done_cl
2872 - cmpl $EDD_CL_EQUALS, %eax
2873 - jz found_edd_equals
2874 - cmpb $0x20, %al # <= space consider whitespace
2875 - ja cl_skipword
2876 - incw %si
2877 - jmp cl_atspace
2878 -
2879 -cl_skipword:
2880 - cmpw $-5, %si # Watch for segment wraparound
2881 - jae done_cl
2882 - movb %fs:(%si), %al # End of string?
2883 - andb %al, %al
2884 - jz done_cl
2885 - cmpb $0x20, %al
2886 - jbe cl_atspace
2887 - incw %si
2888 - jmp cl_skipword
2889 -
2890 -found_edd_equals:
2891 -# only looking at first two characters after equals
2892 -# late overrides early on the command line, so keep going after finding something
2893 - movw %fs:4(%si), %ax
2894 - cmpw $EDD_CL_OFF, %ax # edd=of
2895 - je do_edd_off
2896 - cmpw $EDD_CL_SKIP, %ax # edd=sk
2897 - je do_edd_skipmbr
2898 - cmpw $EDD_CL_ON, %ax # edd=on
2899 - je do_edd_on
2900 - jmp cl_skipword
2901 -do_edd_skipmbr:
2902 - movw $edd_start, %di
2903 - jmp cl_skipword
2904 -do_edd_off:
2905 - movw $edd_done, %di
2906 - jmp cl_skipword
2907 -do_edd_on:
2908 - movw $edd_mbr_sig_start, %di
2909 - jmp cl_skipword
2910 -
2911 -done_cl:
2912 - popl %esi
2913 - jmpw *%di
2914 -
2915 -# Read the first sector of each BIOS disk device and store the 4-byte signature
2916 -edd_mbr_sig_start:
2917 - movb $0x80, %dl # from device 80
2918 - movw $EDD_MBR_SIG_BUF, %bx # store buffer ptr in bx
2919 -edd_mbr_sig_read:
2920 - movl $0xFFFFFFFF, %eax
2921 - movl %eax, (%bx) # assume failure
2922 - pushw %bx
2923 - movb $READ_SECTORS, %ah
2924 - movb $1, %al # read 1 sector
2925 - movb $0, %dh # at head 0
2926 - movw $1, %cx # cylinder 0, sector 0
2927 - pushw %es
2928 - pushw %ds
2929 - popw %es
2930 - movw $EDDBUF, %bx # disk's data goes into EDDBUF
2931 - pushw %dx # work around buggy BIOSes
2932 - stc # work around buggy BIOSes
2933 - int $0x13
2934 - sti # work around buggy BIOSes
2935 - popw %dx
2936 - popw %es
2937 - popw %bx
2938 - jc edd_mbr_sig_done # on failure, we're done.
2939 - cmpb $0, %ah # some BIOSes do not set CF
2940 - jne edd_mbr_sig_done # on failure, we're done.
2941 - movl (EDDBUF+EDD_MBR_SIG_OFFSET), %eax # read sig out of the MBR
2942 - movl %eax, (%bx) # store success
2943 - incb (EDD_MBR_SIG_NR_BUF) # note that we stored something
2944 - incb %dl # increment to next device
2945 - addw $4, %bx # increment sig buffer ptr
2946 - cmpb $EDD_MBR_SIG_MAX, (EDD_MBR_SIG_NR_BUF) # Out of space?
2947 - jb edd_mbr_sig_read # keep looping
2948 -edd_mbr_sig_done:
2949 -
2950 -# Do the BIOS Enhanced Disk Drive calls
2951 -# This consists of two calls:
2952 -# int 13h ah=41h "Check Extensions Present"
2953 -# int 13h ah=48h "Get Device Parameters"
2954 -# int 13h ah=08h "Legacy Get Device Parameters"
2955 -#
2956 -# A buffer of size EDDMAXNR*(EDDEXTSIZE+EDDPARMSIZE) is reserved for our use
2957 -# in the boot_params at EDDBUF. The first four bytes of which are
2958 -# used to store the device number, interface support map and version
2959 -# results from fn41. The next four bytes are used to store the legacy
2960 -# cylinders, heads, and sectors from fn08. The following 74 bytes are used to
2961 -# store the results from fn48. Starting from device 80h, fn41, then fn48
2962 -# are called and their results stored in EDDBUF+n*(EDDEXTSIZE+EDDPARMIZE).
2963 -# Then the pointer is incremented to store the data for the next call.
2964 -# This repeats until either a device doesn't exist, or until EDDMAXNR
2965 -# devices have been stored.
2966 -# The one tricky part is that ds:si always points EDDEXTSIZE bytes into
2967 -# the structure, and the fn41 and fn08 results are stored at offsets
2968 -# from there. This removes the need to increment the pointer for
2969 -# every store, and leaves it ready for the fn48 call.
2970 -# A second one-byte buffer, EDDNR, in the boot_params stores
2971 -# the number of BIOS devices which exist, up to EDDMAXNR.
2972 -# In setup.c, copy_edd() stores both boot_params buffers away
2973 -# for later use, as they would get overwritten otherwise.
2974 -# This code is sensitive to the size of the structs in edd.h
2975 -edd_start:
2976 - # %ds points to the bootsector
2977 - # result buffer for fn48
2978 - movw $EDDBUF+EDDEXTSIZE, %si # in ds:si, fn41 results
2979 - # kept just before that
2980 - movb $0x80, %dl # BIOS device 0x80
2981 -
2982 -edd_check_ext:
2983 - movb $CHECKEXTENSIONSPRESENT, %ah # Function 41
2984 - movw $EDDMAGIC1, %bx # magic
2985 - int $0x13 # make the call
2986 - jc edd_done # no more BIOS devices
2987 -
2988 - cmpw $EDDMAGIC2, %bx # is magic right?
2989 - jne edd_next # nope, next...
2990 -
2991 - movb %dl, %ds:-8(%si) # store device number
2992 - movb %ah, %ds:-7(%si) # store version
2993 - movw %cx, %ds:-6(%si) # store extensions
2994 - incb (EDDNR) # note that we stored something
2995 -
2996 -edd_get_device_params:
2997 - movw $EDDPARMSIZE, %ds:(%si) # put size
2998 - movw $0x0, %ds:2(%si) # work around buggy BIOSes
2999 - movb $GETDEVICEPARAMETERS, %ah # Function 48
3000 - int $0x13 # make the call
3001 - # Don't check for fail return
3002 - # it doesn't matter.
3003 -edd_get_legacy_chs:
3004 - xorw %ax, %ax
3005 - movw %ax, %ds:-4(%si)
3006 - movw %ax, %ds:-2(%si)
3007 - # Ralf Brown's Interrupt List says to set ES:DI to
3008 - # 0000h:0000h "to guard against BIOS bugs"
3009 - pushw %es
3010 - movw %ax, %es
3011 - movw %ax, %di
3012 - pushw %dx # legacy call clobbers %dl
3013 - movb $LEGACYGETDEVICEPARAMETERS, %ah # Function 08
3014 - int $0x13 # make the call
3015 - jc edd_legacy_done # failed
3016 - movb %cl, %al # Low 6 bits are max
3017 - andb $0x3F, %al # sector number
3018 - movb %al, %ds:-1(%si) # Record max sect
3019 - movb %dh, %ds:-2(%si) # Record max head number
3020 - movb %ch, %al # Low 8 bits of max cyl
3021 - shr $6, %cl
3022 - movb %cl, %ah # High 2 bits of max cyl
3023 - movw %ax, %ds:-4(%si)
3024 -
3025 -edd_legacy_done:
3026 - popw %dx
3027 - popw %es
3028 - movw %si, %ax # increment si
3029 - addw $EDDPARMSIZE+EDDEXTSIZE, %ax
3030 - movw %ax, %si
3031 -
3032 -edd_next:
3033 - incb %dl # increment to next device
3034 - cmpb $EDDMAXNR, (EDDNR) # Out of space?
3035 - jb edd_check_ext # keep looping
3036 -
3037 -edd_done:
3038 -#endif
3039 diff -puN /dev/null arch/i386/boot/edd.c
3040 --- /dev/null
3041 +++ a/arch/i386/boot/edd.c
3042 @@ -0,0 +1,196 @@
3043 +/* -*- linux-c -*- ------------------------------------------------------- *
3044 + *
3045 + * Copyright (C) 1991, 1992 Linus Torvalds
3046 + * Copyright 2007 rPath, Inc. - All Rights Reserved
3047 + *
3048 + * This file is part of the Linux kernel, and is made available under
3049 + * the terms of the GNU General Public License version 2.
3050 + *
3051 + * ----------------------------------------------------------------------- */
3052 +
3053 +/*
3054 + * arch/i386/boot/edd.c
3055 + *
3056 + * Get EDD BIOS disk information
3057 + */
3058 +
3059 +#include "boot.h"
3060 +#include <linux/edd.h>
3061 +
3062 +#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
3063 +
3064 +struct edd_dapa {
3065 + u8 pkt_size;
3066 + u8 rsvd;
3067 + u16 sector_cnt;
3068 + u16 buf_off, buf_seg;
3069 + u64 lba;
3070 + u64 buf_lin_addr;
3071 +};
3072 +
3073 +/*
3074 + * Note: this uses the heap to hold the loaded sector.
3075 + */
3076 +static int read_sector(u8 devno, u64 lba, void *buf)
3077 +{
3078 + struct edd_dapa dapa;
3079 + u16 ax, bx, cx, dx, si;
3080 +
3081 + memset(&dapa, 0, sizeof dapa);
3082 + dapa.pkt_size = sizeof(dapa);
3083 + dapa.sector_cnt = 1;
3084 + dapa.buf_off = (size_t)buf;
3085 + dapa.buf_seg = ds();
3086 + dapa.lba = lba;
3087 +
3088 + ax = 0x4200; /* Extended Read */
3089 + si = (size_t)&dapa;
3090 + dx = devno;
3091 + asm("pushfl; stc; int $0x13; setc %%al; popfl"
3092 + : "+a" (ax), "+S" (si), "+d" (dx)
3093 + : "m" (dapa)
3094 + : "ebx", "ecx", "edi", "memory");
3095 +
3096 + if (!(u8)ax)
3097 + return 0; /* OK */
3098 +
3099 + ax = 0x0201; /* Legacy Read, one sector */
3100 + cx = 0x0001; /* Sector 0-0-1 */
3101 + dx = devno;
3102 + bx = (size_t)buf;
3103 + asm("pushfl; stc; int $0x13; setc %%al; popfl"
3104 + : "+a" (ax), "+c" (cx), "+d" (dx), "+b" (bx)
3105 + : : "esi", "edi", "memory");
3106 +
3107 + return -(u8)ax; /* 0 or -1 */
3108 +}
3109 +
3110 +static u32 read_mbr_sig(u8 devno, struct edd_info *ei)
3111 +{
3112 + int sector_size;
3113 + char *mbrbuf_ptr, *mbrbuf_end;
3114 + u32 mbrsig;
3115 + u32 buf_base, mbr_base;
3116 + extern char _end[];
3117 + static char mbr_buf[1024];
3118 +
3119 + sector_size = ei->params.bytes_per_sector;
3120 + if (!sector_size)
3121 + sector_size = 512; /* Best available guess */
3122 +
3123 + buf_base = (ds() << 4) + (u32)&_end;
3124 + mbr_base = (buf_base+sector_size-1) & ~(sector_size-1);
3125 + mbrbuf_ptr = mbr_buf + (mbr_base-buf_base);
3126 + mbrbuf_end = mbrbuf_ptr + sector_size;
3127 +
3128 + if (!(boot_params.hdr.loadflags & CAN_USE_HEAP))
3129 + return 0;
3130 + if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr)
3131 + return 0;
3132 +
3133 + if (read_sector(devno, 0, mbrbuf_ptr))
3134 + return 0;
3135 +
3136 + mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET];
3137 + return mbrsig;
3138 +}
3139 +
3140 +static int get_edd_info(u8 devno, struct edd_info *ei)
3141 +{
3142 + u16 ax, bx, cx, dx, di;
3143 +
3144 + memset(ei, 0, sizeof *ei);
3145 +
3146 + /* Check Extensions Present */
3147 +
3148 + ax = 0x4100;
3149 + bx = EDDMAGIC1;
3150 + dx = devno;
3151 + asm("pushfl; stc; int $0x13; setc %%al; popfl"
3152 + : "+a" (ax), "+b" (bx), "=c" (cx), "+d" (dx)
3153 + : : "esi", "edi");
3154 +
3155 + if ((u8)ax)
3156 + return -1; /* No extended information */
3157 +
3158 + if (bx != EDDMAGIC2)
3159 + return -1;
3160 +
3161 + ei->device = devno;
3162 + ei->version = ax >> 8; /* EDD version number */
3163 + ei->interface_support = cx; /* EDD functionality subsets */
3164 +
3165 + /* Extended Get Device Parameters */
3166 +
3167 + ei->params.length = sizeof(ei->params);
3168 + ax = 0x4800;
3169 + dx = devno;
3170 + asm("pushfl; int $0x13; popfl"
3171 + : "+a" (ax), "+d" (dx)
3172 + : "S" (&ei->params)
3173 + : "ebx", "ecx", "edi");
3174 +
3175 + /* Get legacy CHS parameters */
3176 +
3177 + /* Ralf Brown recommends setting ES:DI to 0:0 */
3178 + ax = 0x0800;
3179 + dx = devno;
3180 + di = 0;
3181 + asm("pushw %%es; "
3182 + "movw %%di,%%es; "
3183 + "pushfl; stc; int $0x13; setc %%al; popfl; "
3184 + "popw %%es"
3185 + : "+a" (ax), "=b" (bx), "=c" (cx), "+d" (dx), "+D" (di)
3186 + : : "esi");
3187 +
3188 + if ((u8)ax == 0) {
3189 + ei->legacy_max_cylinder = (cx >> 8) + ((cx & 0xc0) << 2);
3190 + ei->legacy_max_head = dx >> 8;
3191 + ei->legacy_sectors_per_track = cx & 0x3f;
3192 + }
3193 +
3194 + return 0;
3195 +}
3196 +
3197 +void query_edd(void)
3198 +{
3199 + char eddarg[8];
3200 + int do_mbr = 1;
3201 + int do_edd = 1;
3202 + int devno;
3203 + struct edd_info ei, *edp;
3204 +
3205 + if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) {
3206 + if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip"))
3207 + do_mbr = 0;
3208 + else if (!strcmp(eddarg, "off"))
3209 + do_edd = 0;
3210 + }
3211 +
3212 + edp = (struct edd_info *)boot_params.eddbuf;
3213 +
3214 + if (!do_edd)
3215 + return;
3216 +
3217 + for (devno = 0x80; devno < 0x80+EDD_MBR_SIG_MAX; devno++) {
3218 + /*
3219 + * Scan the BIOS-supported hard disks and query EDD
3220 + * information...
3221 + */
3222 + get_edd_info(devno, &ei);
3223 +
3224 + if (boot_params.eddbuf_entries < EDDMAXNR) {
3225 + memcpy(edp, &ei, sizeof ei);
3226 + edp++;
3227 + boot_params.eddbuf_entries++;
3228 + }
3229 +
3230 + if (do_mbr) {
3231 + u32 mbr_sig;
3232 + mbr_sig = read_mbr_sig(devno, &ei);
3233 + boot_params.edd_mbr_sig_buffer[devno-0x80] = mbr_sig;
3234 + }
3235 + }
3236 +}
3237 +
3238 +#endif
3239 diff -puN /dev/null arch/i386/boot/header.S
3240 --- /dev/null
3241 +++ a/arch/i386/boot/header.S
3242 @@ -0,0 +1,283 @@
3243 +/*
3244 + * header.S
3245 + *
3246 + * Copyright (C) 1991, 1992 Linus Torvalds
3247 + *
3248 + * Based on bootsect.S and setup.S
3249 + * modified by more people than can be counted
3250 + *
3251 + * Rewritten as a common file by H. Peter Anvin (Apr 2007)
3252 + *
3253 + * BIG FAT NOTE: We're in real mode using 64k segments. Therefore segment
3254 + * addresses must be multiplied by 16 to obtain their respective linear
3255 + * addresses. To avoid confusion, linear addresses are written using leading
3256 + * hex while segment addresses are written as segment:offset.
3257 + *
3258 + */
3259 +
3260 +#include <asm/segment.h>
3261 +#include <linux/utsrelease.h>
3262 +#include <asm/boot.h>
3263 +#include <asm/e820.h>
3264 +#include <asm/page.h>
3265 +#include <asm/setup.h>
3266 +#include "boot.h"
3267 +
3268 +SETUPSECTS = 4 /* default nr of setup-sectors */
3269 +BOOTSEG = 0x07C0 /* original address of boot-sector */
3270 +SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */
3271 +SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */
3272 + /* to be loaded */
3273 +ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */
3274 +SWAP_DEV = 0 /* SWAP_DEV is now written by "build" */
3275 +
3276 +#ifndef SVGA_MODE
3277 +#define SVGA_MODE ASK_VGA
3278 +#endif
3279 +
3280 +#ifndef RAMDISK
3281 +#define RAMDISK 0
3282 +#endif
3283 +
3284 +#ifndef ROOT_RDONLY
3285 +#define ROOT_RDONLY 1
3286 +#endif
3287 +
3288 + .code16
3289 + .section ".bstext", "ax"
3290 +
3291 + .global bootsect_start
3292 +bootsect_start:
3293 +
3294 + # Normalize the start address
3295 + ljmp $BOOTSEG, $start2
3296 +
3297 +start2:
3298 + movw %cs, %ax
3299 + movw %ax, %ds
3300 + movw %ax, %es
3301 + movw %ax, %ss
3302 + xorw %sp, %sp
3303 + sti
3304 + cld
3305 +
3306 + movw $bugger_off_msg, %si
3307 +
3308 +msg_loop:
3309 + lodsb
3310 + andb %al, %al
3311 + jz bs_die
3312 + movb $0xe, %ah
3313 + movw $7, %bx
3314 + int $0x10
3315 + jmp msg_loop
3316 +
3317 +bs_die:
3318 + # Allow the user to press a key, then reboot
3319 + xorw %ax, %ax
3320 + int $0x16
3321 + int $0x19
3322 +
3323 + # int 0x19 should never return. In case it does anyway,
3324 + # invoke the BIOS reset code...
3325 + ljmp $0xf000,$0xfff0
3326 +
3327 + .section ".bsdata", "a"
3328 +bugger_off_msg:
3329 + .ascii "Direct booting from floppy is no longer supported.\r\n"
3330 + .ascii "Please use a boot loader program instead.\r\n"
3331 + .ascii "\n"
3332 + .ascii "Remove disk and press any key to reboot . . .\r\n"
3333 + .byte 0
3334 +
3335 +
3336 + # Kernel attributes; used by setup. This is part 1 of the
3337 + # header, from the old boot sector.
3338 +
3339 + .section ".header", "a"
3340 + .globl hdr
3341 +hdr:
3342 +setup_sects: .byte SETUPSECTS
3343 +root_flags: .word ROOT_RDONLY
3344 +syssize: .long SYSSIZE
3345 +ram_size: .word RAMDISK
3346 +vid_mode: .word SVGA_MODE
3347 +root_dev: .word ROOT_DEV
3348 +boot_flag: .word 0xAA55
3349 +
3350 + # offset 512, entry point
3351 +
3352 + .globl _start
3353 +_start:
3354 + # Explicitly enter this as bytes, or the assembler
3355 + # tries to generate a 3-byte jump here, which causes
3356 + # everything else to push off to the wrong offset.
3357 + .byte 0xeb # short (2-byte) jump
3358 + .byte start_of_setup-1f
3359 +1:
3360 +
3361 + # Part 2 of the header, from the old setup.S
3362 +
3363 + .ascii "HdrS" # header signature
3364 + .word 0x0206 # header version number (>= 0x0105)
3365 + # or else old loadlin-1.5 will fail)
3366 + .globl realmode_swtch
3367 +realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
3368 +start_sys_seg: .word SYSSEG
3369 + .word kernel_version-512 # pointing to kernel version string
3370 + # above section of header is compatible
3371 + # with loadlin-1.5 (header v1.5). Don't
3372 + # change it.
3373 +
3374 +type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin,
3375 + # Bootlin, SYSLX, bootsect...)
3376 + # See Documentation/i386/boot.txt for
3377 + # assigned ids
3378 +
3379 +# flags, unused bits must be zero (RFU) bit within loadflags
3380 +loadflags:
3381 +LOADED_HIGH = 1 # If set, the kernel is loaded high
3382 +CAN_USE_HEAP = 0x80 # If set, the loader also has set
3383 + # heap_end_ptr to tell how much
3384 + # space behind setup.S can be used for
3385 + # heap purposes.
3386 + # Only the loader knows what is free
3387 +#ifndef __BIG_KERNEL__
3388 + .byte 0
3389 +#else
3390 + .byte LOADED_HIGH
3391 +#endif
3392 +
3393 +setup_move_size: .word 0x8000 # size to move, when setup is not
3394 + # loaded at 0x90000. We will move setup
3395 + # to 0x90000 then just before jumping
3396 + # into the kernel. However, only the
3397 + # loader knows how much data behind
3398 + # us also needs to be loaded.
3399 +
3400 +code32_start: # here loaders can put a different
3401 + # start address for 32-bit code.
3402 +#ifndef __BIG_KERNEL__
3403 + .long 0x1000 # 0x1000 = default for zImage
3404 +#else
3405 + .long 0x100000 # 0x100000 = default for big kernel
3406 +#endif
3407 +
3408 +ramdisk_image: .long 0 # address of loaded ramdisk image
3409 + # Here the loader puts the 32-bit
3410 + # address where it loaded the image.
3411 + # This only will be read by the kernel.
3412 +
3413 +ramdisk_size: .long 0 # its size in bytes
3414 +
3415 +bootsect_kludge:
3416 + .long 0 # obsolete
3417 +
3418 +heap_end_ptr: .word _end+1024 # (Header version 0x0201 or later)
3419 + # space from here (exclusive) down to
3420 + # end of setup code can be used by setup
3421 + # for local heap purposes.
3422 +
3423 +pad1: .word 0
3424 +cmd_line_ptr: .long 0 # (Header version 0x0202 or later)
3425 + # If nonzero, a 32-bit pointer
3426 + # to the kernel command line.
3427 + # The command line should be
3428 + # located between the start of
3429 + # setup and the end of low
3430 + # memory (0xa0000), or it may
3431 + # get overwritten before it
3432 + # gets read. If this field is
3433 + # used, there is no longer
3434 + # anything magical about the
3435 + # 0x90000 segment; the setup
3436 + # can be located anywhere in
3437 + # low memory 0x10000 or higher.
3438 +
3439 +ramdisk_max: .long (-__PAGE_OFFSET-(512 << 20)-1) & 0x7fffffff
3440 + # (Header version 0x0203 or later)
3441 + # The highest safe address for
3442 + # the contents of an initrd
3443 +
3444 +kernel_alignment: .long CONFIG_PHYSICAL_ALIGN #physical addr alignment
3445 + #required for protected mode
3446 + #kernel
3447 +#ifdef CONFIG_RELOCATABLE
3448 +relocatable_kernel: .byte 1
3449 +#else
3450 +relocatable_kernel: .byte 0
3451 +#endif
3452 +pad2: .byte 0
3453 +pad3: .word 0
3454 +
3455 +cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line,
3456 + #added with boot protocol
3457 + #version 2.06
3458 +
3459 +# End of setup header #####################################################
3460 +
3461 + .section ".inittext", "ax"
3462 +start_of_setup:
3463 +#ifdef SAFE_RESET_DISK_CONTROLLER
3464 +# Reset the disk controller.
3465 + movw $0x0000, %ax # Reset disk controller
3466 + movb $0x80, %dl # All disks
3467 + int $0x13
3468 +#endif
3469 +
3470 +# We will have entired with %cs = %ds+0x20, normalize %cs so
3471 +# it is on par with the other segments.
3472 + pushw %ds
3473 + pushw $setup2
3474 + lretw
3475 +
3476 +setup2:
3477 +# Force %es = %ds
3478 + movw %ds, %ax
3479 + movw %ax, %es
3480 + cld
3481 +
3482 +# Stack paranoia: align the stack and make sure it is good
3483 +# for both 16- and 32-bit references. In particular, if we
3484 +# were meant to have been using the full 16-bit segment, the
3485 +# caller might have set %sp to zero, which breaks %esp-based
3486 +# references.
3487 + andw $~3, %sp # dword align (might as well...)
3488 + jnz 1f
3489 + movw $0xfffc, %sp # Make sure we're not zero
3490 +1: movzwl %sp, %esp # Clear upper half of %esp
3491 + sti
3492 +
3493 +# Check signature at end of setup
3494 + cmpl $0x5a5aaa55, setup_sig
3495 + jne setup_bad
3496 +
3497 +# Zero the bss
3498 + movw $__bss_start, %di
3499 + movw $_end+3, %cx
3500 + xorl %eax, %eax
3501 + subw %di, %cx
3502 + shrw $2, %cx
3503 + rep; stosl
3504 +
3505 +# Jump to C code (should not return)
3506 + calll main
3507 +
3508 +# Setup corrupt somehow...
3509 +setup_bad:
3510 + movl $setup_corrupt, %eax
3511 + calll puts
3512 + # Fall through...
3513 +
3514 + .globl die
3515 + .type die, @function
3516 +die:
3517 + hlt
3518 + jmp die
3519 +
3520 + .size die, .-due
3521 +
3522 + .section ".initdata", "a"
3523 +setup_corrupt:
3524 + .byte 7
3525 + .string "No setup signature found..."
3526 diff -puN /dev/null arch/i386/boot/main.c
3527 --- /dev/null
3528 +++ a/arch/i386/boot/main.c
3529 @@ -0,0 +1,161 @@
3530 +/* -*- linux-c -*- ------------------------------------------------------- *
3531 + *
3532 + * Copyright (C) 1991, 1992 Linus Torvalds
3533 + * Copyright 2007 rPath, Inc. - All Rights Reserved
3534 + *
3535 + * This file is part of the Linux kernel, and is made available under
3536 + * the terms of the GNU General Public License version 2.
3537 + *
3538 + * ----------------------------------------------------------------------- */
3539 +
3540 +/*
3541 + * arch/i386/boot/main.c
3542 + *
3543 + * Main module for the real-mode kernel code
3544 + */
3545 +
3546 +#include "boot.h"
3547 +
3548 +struct boot_params boot_params __attribute__((aligned(16)));
3549 +
3550 +char *HEAP = _end;
3551 +char *heap_end = _end; /* Default end of heap = no heap */
3552 +
3553 +/*
3554 + * Copy the header into the boot parameter block. Since this
3555 + * screws up the old-style command line protocol, adjust by
3556 + * filling in the new-style command line pointer instead.
3557 + */
3558 +#define OLD_CL_MAGIC 0xA33F
3559 +#define OLD_CL_ADDRESS 0x20
3560 +
3561 +static void copy_boot_params(void)
3562 +{
3563 + struct old_cmdline {
3564 + u16 cl_magic;
3565 + u16 cl_offset;
3566 + };
3567 + const struct old_cmdline * const oldcmd =
3568 + (const struct old_cmdline *)OLD_CL_ADDRESS;
3569 +
3570 + BUILD_BUG_ON(sizeof boot_params != 4096);
3571 + memcpy(&boot_params.hdr, &hdr, sizeof hdr);
3572 +
3573 + if (!boot_params.hdr.cmd_line_ptr &&
3574 + oldcmd->cl_magic == OLD_CL_MAGIC) {
3575 + /* Old-style command line protocol. */
3576 + u16 cmdline_seg;
3577 +
3578 + /* Figure out if the command line falls in the region
3579 + of memory that an old kernel would have copied up
3580 + to 0x90000... */
3581 + if (oldcmd->cl_offset < boot_params.hdr.setup_move_size)
3582 + cmdline_seg = ds();
3583 + else
3584 + cmdline_seg = 0x9000;
3585 +
3586 + boot_params.hdr.cmd_line_ptr =