1 GIT 1783e2f0f21444020e3dee1be46b1e34af0ea3e7 git+ssh://master.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-newsetup.git
3 commit 1783e2f0f21444020e3dee1be46b1e34af0ea3e7
4 Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
5 Date: Wed Jun 20 14:12:39 2007 -0700
7 Use a new CPU feature word to cover all Intel features that are spread around
9 in different CPUID leafs like 0x5, 0x6 and 0xA. Make this
10 feature detection code common across i386 and x86_64.
12 Display Intel Dynamic Acceleration feature in /proc/cpuinfo. This feature
13 will be enabled automatically by current acpi-cpufreq driver.
15 Refer to Intel Software Developer's Manual for more details about the feature.
17 Thanks to hpa (H Peter Anvin) for the making the actual code detecting the
18 scattered features data-driven.
20 Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
21 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
23 commit cd19eb67cd6636a4e5c9df99631422c7c7286f59
24 Author: H. Peter Anvin <hpa@zytor.com>
25 Date: Wed Jun 20 14:33:17 2007 -0700
27 x86 setup: move __bss_start into the .bss segment
29 Move __bss_start into the .bss segment, and create __bss_end.
31 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
33 commit 100327ad6b609cd28970219be57d293847d1261d
34 Author: H. Peter Anvin <hpa@zytor.com>
35 Date: Wed Jun 6 22:07:01 2007 -0700
37 x86 setup: remove TSC as a required feature
39 Remove TSC as a required feature, in anticipation of CONFIG_X86_TSC
42 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
44 commit 7c91a172b8af7d4ba087f1f88ed5b155ed459ca3
45 Author: Antonino A. Daplas <adaplas@gmail.com>
46 Date: Tue Jun 5 19:21:05 2007 +0800
48 i386: Set 6-bit DAC channel properties in vesa video setup
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
55 Signed-off-by: Antonino Daplas <adaplas@gmail.com>
56 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
58 commit 6eac2d442de8d87eac94a4ca8600bd87219fa06b
59 Author: H. Peter Anvin <hpa@zytor.com>
60 Date: Tue Jun 5 16:19:36 2007 -0700
62 x86 setup: arch/i386/boot/cpucheck.c whitespace cleanup
64 Remove stealth whitespace
66 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
68 commit f7d89f05a30433034a1b4651143afdbb2a8a9c92
69 Author: H. Peter Anvin <hpa@zytor.com>
70 Date: Thu May 24 16:56:44 2007 -0700
72 hd.c: remove BIOS/CMOS queries
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
80 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
82 commit 14c2fdb3bbfd6a9a774980e446c2443150749891
83 Author: H. Peter Anvin <hpa@zytor.com>
84 Date: Thu May 24 15:25:10 2007 -0700
86 x86: add back pbe bit to visible CPUID flags
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.
91 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
93 commit e071b068a3b9f318be314f0378e655e2eb50ac89
94 Author: H. Peter Anvin <hpa@zytor.com>
95 Date: Wed May 23 14:52:34 2007 -0700
97 x86 setup: VIA feature mask MSR doesn't just apply to model <= 9
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
104 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
106 commit abe0c5aa1827932cda9c754a3842ec22b278d704
107 Author: H. Peter Anvin <hpa@zytor.com>
108 Date: Tue May 22 17:17:41 2007 -0700
110 x86 setup: correct inline assembly constraints in edd.c
112 Fix the inline assembly constraints in edd.c. In particular, "driveno"
113 was getting clobbered on some (buggy?) BIOSes.
115 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
117 commit c2e5887ad275aab90673a3e33344f09946159cf7
118 Author: H. Peter Anvin <hpa@zytor.com>
119 Date: Fri May 18 10:02:55 2007 -0700
121 x86 setup: force the assembler to generate a 2-byte jump in header
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.
130 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
132 commit ce82e3b93eba48b6852822a03efa73c74e165d4f
133 Author: H. Peter Anvin <hpa@zytor.com>
134 Date: Thu May 17 15:44:48 2007 -0700
136 x86 setup: move the symbol start_of_setup into the proper section.
138 start_of_setup is the beginning of the executable code and should be
139 located in the appropriate section.
141 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
143 commit e5f3a529457a5bfaf8f8783fb86013221279a81c
144 Author: H. Peter Anvin <hpa@zytor.com>
145 Date: Thu May 17 15:43:19 2007 -0700
147 x86 setup: add an ASSERT that the header ends up in the right place
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.
153 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
155 commit d9dbde725687ab99d1f529f49f14d1e280cc5cac
156 Author: Alexander van Heukelum <heukelum@mailshack.com>
157 Date: Thu May 17 20:54:25 2007 +0200
159 x86 new setup: use appropriate sections for code and data
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.
168 Signed-off-by: Alexander van Heukelum <heukelum@mailshack.com>
170 commit 0d7558a81cf61e9fd2332a54897c5fd18df0d7f2
171 Author: H. Peter Anvin <hpa@zytor.com>
172 Date: Wed May 16 22:03:16 2007 -0700
174 x86 setup: use -include code16gcc.h instead of explicit #include
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.
180 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
182 commit 017ce54e8a4a9628a76d6b510c7309a7e4e111a8
183 Author: H. Peter Anvin <hpa@zytor.com>
184 Date: Wed May 16 18:48:06 2007 -0700
186 x86 setup: enable features on Centaur (VIA) and Transmeta processors
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.
192 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
194 commit b794f5f9c5089709f3df38c6d91869fa38a9c1a4
195 Author: H. Peter Anvin <hpa@zytor.com>
196 Date: Wed May 16 16:37:47 2007 -0700
198 x86 setup: in older versions of ld, ASSERT() is an expression
200 Older versions of ld (pre-2.15 or so) need:
202 . = ASSERT(foo, "msg");
208 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
210 commit 21c2b7c99c417d07015ee8e516a634ec3d98c4ee
211 Author: H. Peter Anvin <hpa@zytor.com>
212 Date: Wed May 16 10:52:41 2007 -0700
214 x86 setup: print a warning message if the bootloader gave us no heap.
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.
221 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
223 commit 52ca0431390d389a2a2246f02fe652ea84c1ddd8
224 Author: H. Peter Anvin <hpa@zytor.com>
225 Date: Wed May 16 10:51:03 2007 -0700
227 x86 setup: rely on a compiled-in default for load high/load low
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...
234 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
236 commit 4db77a97793104a32e5fb83e62b943fa144b329d
237 Author: H. Peter Anvin <hpa@zytor.com>
238 Date: Wed May 16 08:45:37 2007 -0700
240 x86 setup: correct assembly constraints.
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".
246 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
248 commit 4fbccbc1457d6710d3a9ce55ad70ec6cb0b75fc5
249 Author: H. Peter Anvin <hpa@zytor.com>
250 Date: Tue May 15 09:16:29 2007 -0700
252 x86 setup: include <asm/msr-index.h> not <asm/msr.h>
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.
259 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
261 commit 839cafa9c0020e7506722dd2a4fd82a71c2939cc
262 Author: H. Peter Anvin <hpa@zytor.com>
263 Date: Mon May 14 15:49:01 2007 -0700
265 x86 setup: protocol 2.0[01]: base for CL_OFFSET depends on setup_move_size
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.
270 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
272 commit d60357ad68a694b03e9b952eadba5ac277c31df0
273 Author: H. Peter Anvin <hpa@zytor.com>
274 Date: Sat May 12 12:18:53 2007 -0700
276 x86 setup: remove unused variable
278 Remove unused variable
280 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
282 commit e21a2030b01081612259847321bcce13eae1e883
283 Author: Sam Ravnborg <sam@ravnborg.org>
284 Date: Sat May 12 12:17:30 2007 -0700
286 x86 setup: share i386 Makefile with x86_64
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.
293 Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
294 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
296 commit 8618d92339d0d106045f98f34833d863c3235cdb
297 Author: H. Peter Anvin <hpa@zytor.com>
298 Date: Sat May 12 00:32:12 2007 -0700
300 x86 setup: video-bios.c missed the pointer to the set_mode method!
302 We need the actual pointer to the set_mode method (oops!)
304 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
306 commit 85dfc374ea9aad33b9e0315f07a4b2722dc11e3e
307 Author: H. Peter Anvin <hpa@zytor.com>
308 Date: Sat May 12 00:14:43 2007 -0700
310 x86 setup: when setting unknown BIOS modes and failing, try to revert
312 If we set an unknown BIOS mode and fail, then explicitly try to revert
313 to the original mode.
315 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
317 commit f4f7949f126d2f152b09fa9367b1ec693f2ea818
318 Author: H. Peter Anvin <hpa@zytor.com>
319 Date: Fri May 11 11:20:59 2007 -0700
321 x86 setup: fix typo "video_bios" should be "video-bios"
323 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
325 commit 51ba7113ea5b07189b7f8a0534d400a072535197
326 Author: H. Peter Anvin <hpa@zytor.com>
327 Date: Fri May 11 11:09:55 2007 -0700
329 x86 setup: allow setting VESA modes "blind"
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
335 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
337 commit 1b8f73d9b2bf7630a2914ddab606db16fddb509e
338 Author: H. Peter Anvin <hpa@zytor.com>
339 Date: Thu May 10 22:08:45 2007 -0700
341 x86_64: CONFIG_PHYSICAL_ALIGN should be 2 MB
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.
346 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
348 commit b81f3c88923e4470cd0942d4596fafc0fb1cf4fd
349 Author: H. Peter Anvin <hpa@zytor.com>
350 Date: Thu May 10 19:11:32 2007 -0700
352 x86 setup: remove debugging statements
354 Remove debugging statements in video.c that were not meant for
357 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
359 commit be58b6d7e9c14e482bce495e8343955999dea77f
360 Author: H. Peter Anvin <hpa@zytor.com>
361 Date: Thu May 10 18:49:40 2007 -0700
363 x86 setup: only restore the screen image when needed
365 Only restore the screen image when needed. This is how the original
366 code behaves, so it's presumably the desired behaviour.
368 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
370 commit 22f6bd8cc23b512af28e34ae7d40036982a0ac63
371 Author: H. Peter Anvin <hpa@zytor.com>
372 Date: Thu May 10 18:44:08 2007 -0700
374 x86 setup: correct the definition of the GDT limit
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.
379 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
381 commit 7f73f1f4aa4c97745bffe07a3ebcf226a4965b00
382 Author: H. Peter Anvin <hpa@zytor.com>
383 Date: Thu May 10 15:47:48 2007 -0700
385 x86 setup: Re-implement scanning for hidden video modes
387 Re-implement scanning for hidden video modes. Every now and then,
388 apparently, you can find them hidden like easter eggs.
390 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
392 commit 6770176714bc12ec92372311ac02c14f0d22776e
393 Author: H. Peter Anvin <hpa@zytor.com>
394 Date: Thu May 10 15:24:27 2007 -0700
396 x86 setup: whitespace cleanup
398 Clean up stealth whitespace.
400 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
402 commit ba0480a3537cf471b08bdb99dae6d0780cfb1972
403 Author: H. Peter Anvin <hpa@zytor.com>
404 Date: Wed May 9 16:54:42 2007 -0700
406 x86: sync the CPU feature string arrays
408 With <asm/cpufeature.h> unified, synchronize the CPU feature string
409 arrays. The whole kernel/cpu directory really needs to be unified.
411 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
413 commit ecb53b84efddbad3d9aa49e95598550831324348
414 Author: H. Peter Anvin <hpa@zytor.com>
415 Date: Tue May 8 22:06:04 2007 -0700
417 x86 setup: need to set orig_video_isVGA
419 After detecting a VGA console, we need to set
420 boot_params.screen_info.orig_video_isVGA.
422 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
424 commit dc97fc053faff17b984ec962686caea52bd27628
425 Author: H. Peter Anvin <hpa@zytor.com>
426 Date: Tue May 8 20:51:17 2007 -0700
428 x86 setup: boot sector should use ljmp, not jmpl
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".)
435 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
437 commit 7907f05e9692557c53c9ac13647db5e5343c7c76
438 Author: H. Peter Anvin <hpa@zytor.com>
439 Date: Tue May 8 20:27:10 2007 -0700
441 x86 setup: only make VESA graphics modes selectable if CONFIG_FB
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.
447 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
449 commit 8e509f9ebc44f45544d231454e84f10bf78d5772
450 Author: H. Peter Anvin <hpa@zytor.com>
451 Date: Tue May 8 20:24:11 2007 -0700
453 x86 setup: need to probe VESA EDID block 0 only
455 The VESA EDID BIOS call takes the EDID block number in %dx, and may
456 corrupt it by spec. Pass it in properly.
458 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
460 commit 9912b9aed7943773d1fadaa2e2e52f42af395048
461 Author: H. Peter Anvin <hpa@zytor.com>
462 Date: Mon May 7 18:22:04 2007 -0700
464 x86 setup: add missing file "bitops.h" missing from previous checkins
466 The file "bitops.h" was missing from previous checkins.
468 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
470 commit 732eb3fac2d772980e6555b8c69902c8107c72aa
471 Author: H. Peter Anvin <hpa@zytor.com>
472 Date: Mon May 7 14:59:43 2007 -0700
474 x86 setup: add -fno-stack-protector; other Makefile fixes
476 Add -fno-stack-protector for the gcc's that need that;
477 Use -ffreestanding consistently;
479 Handle linker scripts consistently with other Makefiles.
481 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
483 commit 2d5e47f21202e156fe97aba0a88d158d5c157a33
484 Author: H. Peter Anvin <hpa@zytor.com>
485 Date: Mon May 7 14:45:25 2007 -0700
487 x86 setup: swap cpu.c and cpucheck.c; rename functions
489 Make cpucheck.c the reusable component; the generically-named cpu.c
490 gets to be the wrapper. Accordingly, rename functions to make it
493 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
495 commit bf2a428a4e7c1ee3ab9acb23cfafb45e818887a1
496 Author: H. Peter Anvin <hpa@zytor.com>
497 Date: Mon May 7 14:09:38 2007 -0700
499 x86 setup: remove code moved from cpucheck.c -> cpu.c
501 Move all info about requirements into cpu.c.
503 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
505 commit 9ea8429fabe5df6aed6393ac3a00d0b64445ba6a
506 Author: H. Peter Anvin <hpa@zytor.com>
507 Date: Mon May 7 09:42:51 2007 -0700
509 x86 setup: remove double nesting of a20_test()
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.
515 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
517 commit 9edc55718f57195c664ee3175514d652f651cfd2
518 Author: H. Peter Anvin <hpa@zytor.com>
519 Date: Mon May 7 09:30:41 2007 -0700
521 x86 setup: compile with -fomit-frame-pointer
523 Compiling with -fomit-frame-pointer reduces the size by about 2%.
525 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
527 commit e1003433f2d491bf17c79437cd75268da220dab5
528 Author: H. Peter Anvin <hpa@zytor.com>
529 Date: Mon May 7 09:30:04 2007 -0700
531 x86 setup: be more paranoid about the stack setup in header.S
533 In particular, deal correctly with the stack pointer being zero on entry.
534 While we're at it, align the stack.
536 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
538 commit 853499c3dc3fcbeb192a613ac241d150ebc7c5a0
539 Author: H. Peter Anvin <hpa@zytor.com>
540 Date: Sun May 6 23:25:10 2007 -0700
542 x86 setup: Factor out the environment-independent part of the CPU check.
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.
547 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
549 commit f235a61f6d6dff57883efad351d746540bcb8caf
550 Author: H. Peter Anvin <hpa@zytor.com>
551 Date: Sat May 5 22:16:54 2007 -0700
553 x86 setup: when watching the setup size, take the stack into account
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
560 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
562 commit 0d0e10091be48f7e4c8888e9d5c2836c704994f5
563 Author: H. Peter Anvin <hpa@zytor.com>
564 Date: Sat May 5 19:25:51 2007 -0700
566 x86 setup: actually check the end of the heap.
568 Keep track of where the heap ends and actually watch out for it.
570 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
572 commit 47aab0b8f4d012fad3c42b5b0754d3cb87961b37
573 Author: H. Peter Anvin <hpa@zytor.com>
574 Date: Sat May 5 15:47:58 2007 -0700
576 x86 setup: coppyright rPath, Inc.
578 This work was done on the dime of rPath, Inc.; they own the copyright.
580 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
582 commit d22571534d7eabf9408f29d9da423e1c6e04445f
583 Author: H. Peter Anvin <hpa@zytor.com>
584 Date: Sat May 5 15:21:11 2007 -0700
586 x86 setup: implement screen contents save/restore
588 The old setup code had screen contents save and restore, so implement
589 it for the new one as well.
591 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
593 commit e5145601a752bd998e783d159c187d3017d45d6d
594 Author: H. Peter Anvin <hpa@zytor.com>
595 Date: Sat May 5 15:20:19 2007 -0700
597 x86 setup: whitespace cleanup
599 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
601 commit 045ecb52f91a74eecad93ffc8791eefe59cf7fd1
602 Author: H. Peter Anvin <hpa@zytor.com>
603 Date: Sat May 5 14:22:39 2007 -0700
605 x86 setup: allow setting of VESA graphics modes; cleanups
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
611 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
613 commit 58c04ed7e2d7d5979e1917a74b49bdc0f3dde211
614 Author: H. Peter Anvin <hpa@zytor.com>
615 Date: Sat May 5 12:06:14 2007 -0700
617 x86 setup: move all VESA-related code into video-vesa.c; add EDID
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
623 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
625 commit 07bc3931175fb98256140275c03194426d441b74
626 Author: H. Peter Anvin <hpa@zytor.com>
627 Date: Sat May 5 12:04:40 2007 -0700
629 x86-64: remove -traditional from AFLAGS
631 In arch/x86_64/boot/compressed, remove -traditional from AFLAGS.
633 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
635 commit a830f615eeef838d461cbf7bbbee8c1c84708ec8
636 Author: H. Peter Anvin <hpa@zytor.com>
637 Date: Fri May 4 18:44:38 2007 -0700
639 x86 setup: share code between i386 and x86-64
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.
645 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
647 commit 3e159a323bdfa5d5a7be2c1f6be089ca22d598e0
648 Author: H. Peter Anvin <hpa@zytor.com>
649 Date: Fri May 4 18:43:35 2007 -0700
651 x86-64: use 0x1b4 as the scratch area in boot_params, not 0x3c
653 Use 0x1b4 as the scratch area in boot_params rather than 0x3c.
655 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
657 commit 4cf4424e7a0f29f251b781f9b5e3655b0645cb7f
658 Author: H. Peter Anvin <hpa@zytor.com>
659 Date: Fri May 4 18:26:18 2007 -0700
661 Revert "x86-64: Make arch/x86-64/boot a symlink to arch/i386/boot"
663 This reverts commit b2ad90f4969226fe8cf3edc5330711ed5fc20105.
665 Restore arch/x86_64/boot as a separate directory hierarchy.
669 commit 8ed1ae1d2f94410811b7cca4b1a426e37652457f
670 Author: H. Peter Anvin <hpa@zytor.com>
671 Date: Fri May 4 17:00:33 2007 -0700
673 x86-64: It appears MTRR isn't a required feature after all.
675 MTRR was documented as a required feature, but appears to boot fine
676 without it (tested since Bochs doesn't have MTRR support.)
678 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
680 commit 7c616d098579fb790662cdc703f2a0f26ea1668c
681 Author: H. Peter Anvin <hpa@zytor.com>
682 Date: Fri May 4 16:22:57 2007 -0700
684 x86 setup: use 0x1e4 as scratch, instead of 0x3c
686 The compressed relocation needs a 4-byte scratch area to obtain
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.
693 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
695 commit 5bc1019227e94576e4876d05ee920f59195bce90
696 Author: H. Peter Anvin <hpa@zytor.com>
697 Date: Fri May 4 16:09:15 2007 -0700
699 x86 setup: boot_params.e820_map is just the map, not the count; adjust
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.
705 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
707 commit 0f96b52497f444be2d52d1184ca90be49f713ea3
708 Author: H. Peter Anvin <hpa@zytor.com>
709 Date: Fri May 4 15:49:03 2007 -0700
711 x86 setup: E820MAX is a definitional constant; no need to use sizeof hacks
713 Now when we're using the standard headers for the setup code, we can use
714 E820MAX instead of playing sizeof games.
716 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
718 commit 3a23a428b20cbb31fd7ff5516a053b99afc447f7
719 Author: H. Peter Anvin <hpa@zytor.com>
720 Date: Fri May 4 12:08:46 2007 -0700
722 x86: move the bootparam structure definition into include/
724 Move the bootparam structure definition into include/, and make other
725 things use it. Haven't cleaned up all the macros yet, though.
727 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
729 commit e93ec58911995971aa059990f8a91a02b05f6c8f
730 Author: H. Peter Anvin <hpa@zytor.com>
731 Date: Fri May 4 12:07:50 2007 -0700
733 i386: change %lu to %u in arch/i386/kernel/e820.h
735 It's an u32, print it with %u
737 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
739 commit 2f47f004f614e2744867c0df274c55d8af2a42d5
740 Author: H. Peter Anvin <hpa@zytor.com>
741 Date: Fri May 4 12:06:04 2007 -0700
743 x86: fix differences between i386 and x86-64 <asm/e820.h>
745 Fix minor differences between i386 and x86-64 <asm/e820.h>
747 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
749 commit 56ec52f14e948f430af941052adee98019a617b7
750 Author: H. Peter Anvin <hpa@zytor.com>
751 Date: Fri May 4 11:45:17 2007 -0700
753 x86: fix the definition of struct screen_info
755 Name the fields that aren't really struct screen_info, and declare
756 the structure packed (the "capabilities" field is misaligned.)
758 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
760 commit 1d4429eaa564b0085d9ee3aa2de57e87a093a14e
761 Author: H. Peter Anvin <hpa@zytor.com>
762 Date: Fri May 4 11:43:10 2007 -0700
764 x86-64: Make arch/x86-64/boot a symlink to arch/i386/boot
766 Until such time that Kbuild allows for a cleaner solution, make
767 arch/x86-64/boot a symlink to arch/i386/boot.
769 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
771 commit 6a85f1b5fd041ea99d8604782559ce0502a60cc0
772 Author: H. Peter Anvin <hpa@zytor.com>
773 Date: Fri May 4 10:42:06 2007 -0700
775 x86-64: rearrange includes due to unifications and inclusion from setup
777 Unification caused a circular dependency between <asm/alternative.h>
778 and <asm/cpufeature.h>; resolve this.
780 Add #ifndef _SETUP in <asm/e820.h> so it can be included from the boot
783 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
785 commit f6bbdc254bdbd5f7cf7a40c4cd6f9844af90824a
786 Author: H. Peter Anvin <hpa@zytor.com>
787 Date: Fri May 4 10:40:26 2007 -0700
789 x86: Complete <asm/cpufeature.h> with the union of i386 and x86-64
791 Add a feature to <asm/cpufeature.h> which was previously present
792 in x86-64 but missing in i386.
794 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
796 commit 1a0819281060489901732914f67869e0aa8f26fd
797 Author: H. Peter Anvin <hpa@zytor.com>
798 Date: Fri May 4 10:39:32 2007 -0700
800 x86: unify <asm/boot.h>
802 Unify <asm/boot.h> between i386 and x86-64
804 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
806 commit 8d9c54585f4623e0310f970fb5c6eda7ec1614df
807 Author: H. Peter Anvin <hpa@zytor.com>
808 Date: Fri May 4 10:38:35 2007 -0700
810 x86-64: verify_cpu.S: use new masks
812 Use the <asm/required-features.h> masks.
814 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
816 commit 6cf3308646bb7a3210f0f76bcb895b2dea76a93c
817 Author: H. Peter Anvin <hpa@zytor.com>
818 Date: Fri May 4 10:37:26 2007 -0700
820 x86-64: fix compilation errors due to required-features.h change
822 Fix compilation errors induced by required-features.h change.
824 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
826 commit 1324201a93ce380b46a3128826ecbd794e617e59
827 Author: H. Peter Anvin <hpa@zytor.com>
828 Date: Fri May 4 10:35:37 2007 -0700
830 x86-64: <asm/segment.h>: add boot segment descriptors
832 Add boot segment descriptors to <asm/segment.h> to match i386.
834 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
836 commit a0b15a9e79ed0310813709cd0690d6838917fe82
837 Author: H. Peter Anvin <hpa@zytor.com>
838 Date: Fri May 4 10:34:37 2007 -0700
840 x86-64: add CONFIG_PHYSICAL_ALIGN to match i386
842 Add CONFIG_PHYSICAL_ALIGN to match i386, even though we don't use it.
844 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
846 commit 8f5d14d11a7318e257351ae477392c7f7e314602
847 Author: H. Peter Anvin <hpa@zytor.com>
848 Date: Fri May 4 10:33:54 2007 -0700
850 x86 setup: cleanups for compatibility with x86-64
852 These changes are necessary to compile on x86-64.
854 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
856 commit a32f68b6d4023c1c6b1e62e8561189516c571ab9
857 Author: H. Peter Anvin <hpa@zytor.com>
858 Date: Fri May 4 08:40:07 2007 -0700
860 x86 setup: add missing linker script
862 Add linker script for the setup code, apparently missing from previous
865 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
867 commit 4f34ca8e926b2d0bf3a7502b99f8dfced8cdba9d
868 Author: H. Peter Anvin <hpa@zytor.com>
869 Date: Thu May 3 17:42:29 2007 -0700
871 x86 setup: paranoia: clear the high half of %esp
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.
876 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
878 commit 19eb9b73cc1632a923003a002108b242af7a6080
879 Author: H. Peter Anvin <hpa@zytor.com>
880 Date: Thu May 3 17:35:41 2007 -0700
882 x86 setup: bootlin is *so* dead...
884 Bootlin was never able to load bzImage kernels, so who cares about it.
886 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
888 commit 3b9fb73c65151ee043bc74c333d9e3c9b1872125
889 Author: H. Peter Anvin <hpa@zytor.com>
890 Date: Thu May 3 10:56:40 2007 -0700
892 x86 setup: apparently $(src) is insufficient, needs $(srctree)/$(src)
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
900 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
902 commit a6d01d375a2269be1e3a6b31bcc4d426ad5a473d
903 Author: H. Peter Anvin <hpa@zytor.com>
904 Date: Thu May 3 10:51:45 2007 -0700
906 x86 setup: remove reference to obsolete cpureq.c
908 cpureq.c has been removed; remove it from the Makefile too.
910 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
912 commit cbe5b7585d800435080bcbf1b1fd242926982674
913 Author: H. Peter Anvin <hpa@zytor.com>
914 Date: Thu May 3 10:33:12 2007 -0700
916 x86 setup: use the required masks from <asm/required-features.h>
918 Use the now-uniform features from <asm/required-features.h>.
920 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
922 commit 99ed30180ecc1bb4e93f6edda5f6bad1adf3e630
923 Author: H. Peter Anvin <hpa@zytor.com>
924 Date: Thu May 3 10:31:12 2007 -0700
926 x86: make the handling of required features consistent
928 Make the handling of required features consistent between i386
931 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
933 commit 1120d70a2be8f2deb6bda64047da288d8f86dad3
934 Author: H. Peter Anvin <hpa@zytor.com>
935 Date: Thu May 3 00:09:53 2007 -0700
937 x86: Kconfig.cpu: the minimum CPU model is always 3; WP_WORKS_OK = i486
939 The minimum CPU model number is always 3 (i386), and if we have
940 WP_WORKS_OK it means we need an i486.
942 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
944 commit ebc308c204149b86984ae2216f5b9b2e63932028
945 Author: H. Peter Anvin <hpa@zytor.com>
946 Date: Thu May 3 00:08:48 2007 -0700
948 x86 setup: use CONFIG_X86_MINIMUM_CPU_MODEL
950 Use CONFIG_X86_MINIMUM_CPU_MODEL as defined in Kconfig.cpu.
952 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
954 commit 8b50b640e015bf5d0f65502437da6fcab46c391b
955 Author: H. Peter Anvin <hpa@zytor.com>
956 Date: Wed May 2 23:45:42 2007 -0700
958 x86 setup: remove bogus "static"
960 Remove invalid "static" declarations in cpu.c
962 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
964 commit 35d23b60dfb110da81c24bcbfcda089cfc4fd264
965 Author: H. Peter Anvin <hpa@zytor.com>
966 Date: Wed May 2 23:37:50 2007 -0700
968 x86 setup: cpu detection cleanups
970 - Use <asm/processor-flags.h>
971 - Make sure %cr0 isn't in a dangerous configuration before probing the FPU
973 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
975 commit a1150a03247b355d11a4bb696b8aae1f46612992
976 Author: H. Peter Anvin <hpa@zytor.com>
977 Date: Wed May 2 23:36:55 2007 -0700
979 x86 setup: compile with -DSETUP
981 Define SETUP to make it easier to share code with the rest of the kernel.
983 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
985 commit 7eb52e8ad1bdf01886023d1a13b3313084cd7db6
986 Author: H. Peter Anvin <hpa@zytor.com>
987 Date: Wed May 2 23:34:57 2007 -0700
989 x86 setup: remove unused verify_cpu.S
991 verify_cpu.S is obsoleted by boot/cpu.c.
993 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
995 commit e90317a027c30176968220d18eb18bd6a9d9cc74
996 Author: H. Peter Anvin <hpa@zytor.com>
997 Date: Wed May 2 20:07:43 2007 -0700
999 x86 setup: files missing from previous checkin (cpu.c, cpureq.c)
1001 These files were missing from a previous checkin; CPU feature-checking
1002 code and the list of CPU features to check for.
1004 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1006 commit 060f9b3db33c67b5344b2b4110bc823eb776e5cd
1007 Author: H. Peter Anvin <hpa@zytor.com>
1008 Date: Wed May 2 19:51:34 2007 -0700
1010 x86 setup: whitespace cleanup
1012 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1014 commit 9f997a5569ec8fceaa15c2e9cf28e728e2ce118d
1015 Author: H. Peter Anvin <hpa@zytor.com>
1016 Date: Wed May 2 19:07:14 2007 -0700
1018 x86 setup: add CPU feature detect/abort on insufficient featurage
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
1024 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1026 commit de4e976376fddec340651ef40b16a45f6189619d
1027 Author: H. Peter Anvin <hpa@zytor.com>
1028 Date: Wed May 2 19:05:34 2007 -0700
1030 x86 setup: whitespace cleanup
1032 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1034 commit bcd2d2f8de5d4568b6628aa133fce1ac40ece526
1035 Author: H. Peter Anvin <hpa@zytor.com>
1036 Date: Wed May 2 16:19:59 2007 -0700
1038 x86 setup: tag functions noreturn; error message on A20 failure
1040 Tag appropriate functions noreturn.
1041 If the A20 gate fails, output an error message and refuse to boot.
1043 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1045 commit 752aef90cbfc888084bf11fd83f8f72b6a668fc9
1046 Author: H. Peter Anvin <hpa@zytor.com>
1047 Date: Wed May 2 15:45:08 2007 -0700
1049 x86 setup: clobber registers in keyboard BIOS call
1051 Keyboard BIOS call to set repeat rate is known to clobber registers on
1054 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1056 commit dde94003e4759aab275732cf9f1834440cd381d0
1057 Author: H. Peter Anvin <hpa@zytor.com>
1058 Date: Wed May 2 15:44:21 2007 -0700
1060 x86 setup: implement APM BIOS probe
1062 APM BIOS probe ported from assembly
1064 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1066 commit 9403917d79e3349184318704476fa080836bd52c
1067 Author: H. Peter Anvin <hpa@zytor.com>
1068 Date: Wed May 2 15:17:14 2007 -0700
1070 x86 setup: remove references to obsolete probes
1072 Remove "Hello, World!" as well as references to probes which are no
1075 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1077 commit 712f65ffbd1d4b55b4c55d68b4dcd32406c28fb8
1078 Author: H. Peter Anvin <hpa@zytor.com>
1079 Date: Wed May 2 12:17:15 2007 -0700
1081 x86 setup: video.c: correct the handling of special mode numbers
1083 Special mode numbers with the high bit set need to be handled *before*
1084 masking out the high bit.
1086 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1088 commit 9cf083204fe14cda3b09840eba8d131d2e48ccdf
1089 Author: H. Peter Anvin <hpa@zytor.com>
1090 Date: Wed May 2 11:44:16 2007 -0700
1092 x86 setup: Modern ATI cards pass the probe but lacks the modes.
1094 It appears modern ATI cards pass the probe for ATI-ness but lack the
1095 modes. Kill off the driver as being incorrect.
1097 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1099 commit 890cbe950589e30af17eac9da800efc76e35e01d
1100 Author: H. Peter Anvin <hpa@zytor.com>
1101 Date: Wed May 2 11:32:21 2007 -0700
1103 x86 setup: a20.c: make empty_8042() return status
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.
1111 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1113 commit 08a44dc655e0086d23fc3c70cb93eb51eaeec259
1114 Author: H. Peter Anvin <hpa@zytor.com>
1115 Date: Wed May 2 11:31:03 2007 -0700
1117 x86 setup: video.c: clean up unused stuff
1119 Clean up unused variables that we have no intent on using, as well
1122 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1124 commit 57e69acff1f577de430cae1523fd49a5d113e885
1125 Author: H. Peter Anvin <hpa@zytor.com>
1126 Date: Wed May 2 11:18:13 2007 -0700
1128 x86 setup: drop video mode range checking
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
1135 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1137 commit c0dda0b90f92d43872d55d295630a71cd357cfa6
1138 Author: H. Peter Anvin <hpa@zytor.com>
1139 Date: Wed May 2 11:15:53 2007 -0700
1141 x86 setup: if no specific video mode ID is given, generate one
1143 If we don't specify a certain video mode ID in the driver, then
1144 generate the 0xRRCC mode ID automatically.
1146 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1148 commit 0db5086e79810e7c5d560006b1c9a7501a02d80c
1149 Author: H. Peter Anvin <hpa@zytor.com>
1150 Date: Wed May 2 11:10:28 2007 -0700
1152 x86 setup: Sadly, Cirrus removed extended text modes from their BIOS.
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.
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.
1163 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1165 commit 41f3fddeeb764687bf3fb0cf77fd858128571d58
1166 Author: H. Peter Anvin <hpa@zytor.com>
1167 Date: Wed May 2 10:18:07 2007 -0700
1169 x86 setup: remove assembly implementation of putchar and puts
1171 Already unused, remove assembly implementation of putchar and puts.
1173 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1175 commit dfa94cd86aca2c01d2f5e14b6e7c3e8258276195
1176 Author: H. Peter Anvin <hpa@zytor.com>
1177 Date: Tue May 1 21:41:28 2007 -0700
1179 x86 setup: Call INT 15h AX=E820h properly
1181 The calling convention for BIOS call 15:E820 was messed up.
1183 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1185 commit 2487575a36435c0a983febbb4f3751331bd2df7a
1186 Author: H. Peter Anvin <hpa@zytor.com>
1187 Date: Tue May 1 21:34:12 2007 -0700
1189 x86 setup: advance one e820 descriptor at a time...
1191 Adding sizeof(foo) to a foo * is not just useless, it's pretty damaging...
1193 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1195 commit 530d4f4f1732335ae8725c0b8c332a618e63ea1d
1196 Author: H. Peter Anvin <hpa@zytor.com>
1197 Date: Tue May 1 21:33:28 2007 -0700
1199 x86 setup: fix memcmp_[fg]s()
1201 Actually return a value from memcmp_[fg]s()...
1203 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1205 commit 8617cd56ff2e43303147da012b26c9dd46af726e
1206 Author: H. Peter Anvin <hpa@zytor.com>
1207 Date: Tue May 1 21:32:47 2007 -0700
1209 x86 setup: fix missing semicolon in video-ati.c
1211 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1213 commit 7bbf7fa3e199b9cef4877c5a56128faff8636cc9
1214 Author: H. Peter Anvin <hpa@zytor.com>
1215 Date: Tue May 1 21:26:48 2007 -0700
1217 x86 setup: make the video setup code actually do something...
1219 Basic video setup now works (there is still work to be done, however.)
1221 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1223 commit 45bcd4406e4b812b32d317d9b3b8db2e5f135a3c
1224 Author: H. Peter Anvin <hpa@zytor.com>
1225 Date: Tue May 1 21:25:20 2007 -0700
1227 x86 setup: segment descriptors need to be Present
1229 The segment descriptors were missing the Present bit.
1231 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1233 commit a39479d4ccf4dceffb623ad2ec7e2d708c38c637
1234 Author: H. Peter Anvin <hpa@zytor.com>
1235 Date: Tue May 1 21:24:32 2007 -0700
1237 build: setup sectors doesn't include the boot sector
1239 The "setup sectors" field doesn't include the old boot sector,
1240 even though the two are now one module.
1242 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1244 commit d8f3d4928ead72e8febe2fcd740d0fee71a61f42
1245 Author: H. Peter Anvin <hpa@zytor.com>
1246 Date: Tue May 1 21:23:44 2007 -0700
1248 x86 setup: in tty.c, actually tell it what character to print
1250 putchar() was missing the actual passing of the character code to the
1251 BIOS call, with very silly-looking results.
1253 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1255 commit 4f1462ed0377e180484a223e622d62432baa64b7
1256 Author: H. Peter Anvin <hpa@zytor.com>
1257 Date: Tue May 1 21:22:46 2007 -0700
1259 x86 setup: printf.c needs code16gcc.h
1261 printf.c was missing code16gcc.h, with predictable consequences.
1263 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1265 commit a5ba7e6df198bd204b0f87fc6e3f68388b9d14c1
1266 Author: H. Peter Anvin <hpa@zytor.com>
1267 Date: Mon Apr 30 20:56:42 2007 -0700
1269 MAINTAINERS: formally take responsibility for the i386 boot code
1271 Change MAINTAINERS to formally take responsibility for the i386 boot code.
1273 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1275 commit 6c821fc005655a99eff6e86c2e4b13654de94dea
1276 Author: H. Peter Anvin <hpa@zytor.com>
1277 Date: Mon Apr 30 20:54:07 2007 -0700
1279 x86 setup code rewrite: initial development snapshot
1281 Clean up the setup code and rewrite it in C.
1282 This is an initial development snapshot, not a working tree.
1284 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1285 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
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(-)
1365 diff -puN MAINTAINERS~git-newsetup MAINTAINERS
1366 --- a/MAINTAINERS~git-newsetup
1368 @@ -1774,8 +1774,8 @@ T: http://www.harbaum.org/till/i2c_tiny_
1372 -P: Riley H. Williams
1373 -M: Riley@Williams.Name
1376 L: Linux-Kernel@vger.kernel.org
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
1384 config X86_MINIMUM_CPU_MODEL
1386 - default "4" if X86_XADD || X86_CMPXCHG || X86_BSWAP
1388 + default "4" if X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK
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
1396 #RAMDISK := -DRAMDISK=512
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
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
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
1415 hostprogs-y := tools/build
1417 HOSTCFLAGS_build.o := $(LINUXINCLUDE)
1419 # ---------------------------------------------------------------------------
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.
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__
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
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) > $@
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)
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))
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)
1465 +OBJCOPYFLAGS_setup.bin := -O binary
1467 +$(obj)/setup.bin: $(obj)/setup.elf FORCE
1468 + $(call if_changed,objcopy)
1470 $(obj)/compressed/vmlinux: FORCE
1471 $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@
1473 diff -puN /dev/null arch/i386/boot/a20.c
1475 +++ a/arch/i386/boot/a20.c
1477 +/* -*- linux-c -*- ------------------------------------------------------- *
1479 + * Copyright (C) 1991, 1992 Linus Torvalds
1480 + * Copyright 2007 rPath, Inc. - All Rights Reserved
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.
1485 + * ----------------------------------------------------------------------- */
1488 + * arch/i386/boot/a20.c
1490 + * Enable A20 gate (return -1 on failure)
1495 +#define MAX_8042_LOOPS 100000
1497 +static int empty_8042(void)
1500 + int loops = MAX_8042_LOOPS;
1505 + status = inb(0x64);
1507 + /* Read and discard input data */
1510 + } else if (!(status & 2)) {
1511 + /* Buffers empty, finished! */
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. */
1522 +#define A20_TEST_ADDR (4*0x80)
1523 +#define A20_TEST_SHORT 32
1524 +#define A20_TEST_LONG 2097152 /* 2^21 */
1526 +static int a20_test(int loops)
1534 + saved = ctr = rdfs32(A20_TEST_ADDR);
1537 + wrfs32(++ctr, A20_TEST_ADDR);
1538 + io_delay(); /* Serialize and make delay constant */
1539 + ok = rdgs32(A20_TEST_ADDR+0x10) ^ ctr;
1544 + wrfs32(saved, A20_TEST_ADDR);
1548 +/* Quick test to see if A20 is already enabled */
1549 +static int a20_test_short(void)
1551 + return a20_test(A20_TEST_SHORT);
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)
1558 + return a20_test(A20_TEST_LONG);
1561 +static void enable_a20_bios(void)
1563 + asm volatile("pushfl; int $0x15; popfl"
1564 + : : "a" ((u16)0x2401));
1567 +static void enable_a20_kbc(void)
1571 + outb(0xd1, 0x64); /* Command write */
1574 + outb(0xdf, 0x60); /* A20 on */
1578 +static void enable_a20_fast(void)
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);
1589 + * Actual routine to enable A20; return 0 on ok, -1 on failure
1592 +#define A20_ENABLE_LOOPS 255 /* Number of times to try */
1594 +int enable_a20(void)
1596 + int loops = A20_ENABLE_LOOPS;
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())
1604 +#elif defined(CONFIG_X86_VOYAGER)
1605 + /* On Voyager, a20_test() is unsafe? */
1610 + /* First, check to see if A20 is already enabled
1611 + (legacy free, etc.) */
1612 + if (a20_test_short())
1615 + /* Next, try the BIOS (INT 0x15, AX=0x2401) */
1616 + enable_a20_bios();
1617 + if (a20_test_short())
1620 + /* Try enabling A20 through the keyboard controller */
1622 + if (a20_test_short())
1623 + return 0; /* BIOS worked, but with delayed reaction */
1626 + if (a20_test_long())
1629 + /* Finally, try enabling the "fast A20 gate" */
1630 + enable_a20_fast();
1631 + if (a20_test_long())
1638 diff -puN /dev/null arch/i386/boot/apm.c
1640 +++ a/arch/i386/boot/apm.c
1642 +/* -*- linux-c -*- ------------------------------------------------------- *
1644 + * Copyright (C) 1991, 1992 Linus Torvalds
1645 + * Copyright 2007 rPath, Inc. - All Rights Reserved
1647 + * Original APM BIOS checking by Stephen Rothwell, May 1994
1648 + * (sfr@canb.auug.org.au)
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.
1653 + * ----------------------------------------------------------------------- */
1656 + * arch/i386/boot/apm.c
1658 + * Get APM BIOS information
1663 +#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
1665 +int query_apm_bios(void)
1667 + u16 ax, bx, cx, dx, di;
1671 + /* APM BIOS installation check */
1674 + asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp ; setc %0"
1675 + : "=d" (err), "+a" (ax), "+b" (bx), "+c" (cx)
1676 + : : "esi", "edi");
1679 + return -1; /* No APM BIOS */
1681 + if (bx != 0x504d) /* "PM" signature */
1684 + if (cx & 0x02) /* 32 bits supported? */
1687 + /* Disconnect first, just in case */
1689 + asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp"
1691 + : : "ebx", "ecx", "edx", "esi", "edi");
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)
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;
1714 + /* Redo the installation check as the 32-bit connect;
1715 + some BIOSes return different flags this way... */
1719 + asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp ; setc %0"
1720 + : "=d" (err), "+a" (ax), "+b" (bx), "+c" (cx)
1721 + : : "esi", "edi");
1723 + if (err || bx != 0x504d) {
1724 + /* Failure with 32-bit connect, try to disconect and ignore */
1727 + asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp"
1728 + : "+a" (ax), "+b" (bx)
1729 + : : "ecx", "edx", "esi", "edi");
1733 + boot_params.apm_bios_info.version = ax;
1734 + boot_params.apm_bios_info.flags = cx;
1739 diff -puN /dev/null arch/i386/boot/bitops.h
1741 +++ a/arch/i386/boot/bitops.h
1743 +/* -*- linux-c -*- ------------------------------------------------------- *
1745 + * Copyright (C) 1991, 1992 Linus Torvalds
1746 + * Copyright 2007 rPath, Inc. - All Rights Reserved
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.
1751 + * ----------------------------------------------------------------------- */
1754 + * arch/i386/boot/bitops.h
1756 + * Very simple bitops for the boot code.
1759 +#ifndef BOOT_BITOPS_H
1760 +#define BOOT_BITOPS_H
1761 +#define _LINUX_BITOPS_H /* Inhibit inclusion of <linux/bitops.h> */
1763 +static inline int constant_test_bit(int nr, const void *addr)
1765 + const u32 *p = (const u32 *)addr;
1766 + return ((1UL << (nr & 31)) & (p[nr >> 5])) != 0;
1768 +static inline int variable_test_bit(int nr, const void *addr)
1771 + const u32 *p = (const u32 *)addr;
1773 + asm("btl %2,%1; setc %0" : "=qm" (v) : "m" (*p), "Ir" (nr));
1777 +#define test_bit(nr,addr) \
1778 +(__builtin_constant_p(nr) ? \
1779 + constant_test_bit((nr),(addr)) : \
1780 + variable_test_bit((nr),(addr)))
1782 +static inline void set_bit(int nr, void *addr)
1784 + asm("btsl %1,%0" : "+m" (*(u32 *)addr) : "Ir" (nr));
1787 +#endif /* BOOT_BITOPS_H */
1788 diff -puN /dev/null arch/i386/boot/boot.h
1790 +++ a/arch/i386/boot/boot.h
1792 +/* -*- linux-c -*- ------------------------------------------------------- *
1794 + * Copyright (C) 1991, 1992 Linus Torvalds
1795 + * Copyright 2007 rPath, Inc. - All Rights Reserved
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.
1800 + * ----------------------------------------------------------------------- */
1803 + * arch/i386/boot/boot.h
1805 + * Header file for the real-mode kernel code
1808 +#ifndef BOOT_BOOT_H
1809 +#define BOOT_BOOT_H
1811 +#ifndef __ASSEMBLY__
1813 +#include <stdarg.h>
1814 +#include <linux/types.h>
1815 +#include <linux/edd.h>
1816 +#include <asm/boot.h>
1817 +#include <asm/bootparam.h>
1819 +/* Useful macros */
1820 +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
1822 +extern struct setup_header hdr;
1823 +extern struct boot_params boot_params;
1825 +/* Basic port I/O */
1826 +static inline void outb(u8 v, u16 port)
1828 + asm volatile("outb %0,%1" : : "a" (v), "dN" (port));
1830 +static inline u8 inb(u16 port)
1833 + asm volatile("inb %1,%0" : "=a" (v) : "dN" (port));
1837 +static inline void outw(u16 v, u16 port)
1839 + asm volatile("outw %0,%1" : : "a" (v), "dN" (port));
1841 +static inline u16 inw(u16 port)
1844 + asm volatile("inw %1,%0" : "=a" (v) : "dN" (port));
1848 +static inline void outl(u32 v, u16 port)
1850 + asm volatile("outl %0,%1" : : "a" (v), "dn" (port));
1852 +static inline u32 inl(u32 port)
1855 + asm volatile("inl %1,%0" : "=a" (v) : "dN" (port));
1859 +static inline void io_delay(void)
1861 + const u16 DELAY_PORT = 0x80;
1862 + asm volatile("outb %%al,%0" : : "dN" (DELAY_PORT));
1865 +/* These functions are used to reference data in other segments. */
1867 +static inline u16 ds(void)
1870 + asm("movw %%ds,%0" : "=rm" (seg));
1874 +static inline void set_fs(u16 seg)
1876 + asm volatile("movw %0,%%fs" : : "rm" (seg));
1878 +static inline u16 fs(void)
1881 + asm("movw %%fs,%0" : "=rm" (seg));
1885 +static inline void set_gs(u16 seg)
1887 + asm volatile("movw %0,%%gs" : : "rm" (seg));
1889 +static inline u16 gs(void)
1892 + asm("movw %%gs,%0" : "=rm" (seg));
1896 +typedef unsigned int addr_t;
1898 +static inline u8 rdfs8(addr_t addr)
1901 + asm("movb %%fs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr));
1904 +static inline u16 rdfs16(addr_t addr)
1907 + asm("movw %%fs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr));
1910 +static inline u32 rdfs32(addr_t addr)
1913 + asm("movl %%fs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr));
1917 +static inline void wrfs8(u8 v, addr_t addr)
1919 + asm volatile("movb %1,%%fs:%0" : "+m" (*(u8 *)addr) : "r" (v));
1921 +static inline void wrfs16(u16 v, addr_t addr)
1923 + asm volatile("movw %1,%%fs:%0" : "+m" (*(u16 *)addr) : "r" (v));
1925 +static inline void wrfs32(u32 v, addr_t addr)
1927 + asm volatile("movl %1,%%fs:%0" : "+m" (*(u32 *)addr) : "r" (v));
1930 +static inline u8 rdgs8(addr_t addr)
1933 + asm("movb %%gs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr));
1936 +static inline u16 rdgs16(addr_t addr)
1939 + asm("movw %%gs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr));
1942 +static inline u32 rdgs32(addr_t addr)
1945 + asm("movl %%gs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr));
1949 +static inline void wrgs8(u8 v, addr_t addr)
1951 + asm volatile("movb %1,%%gs:%0" : "+m" (*(u8 *)addr) : "r" (v));
1953 +static inline void wrgs16(u16 v, addr_t addr)
1955 + asm volatile("movw %1,%%gs:%0" : "+m" (*(u16 *)addr) : "r" (v));
1957 +static inline void wrgs32(u32 v, addr_t addr)
1959 + asm volatile("movl %1,%%gs:%0" : "+m" (*(u32 *)addr) : "r" (v));
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)
1966 + asm("repe; cmpsb; setnz %0"
1967 + : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
1971 +static inline int memcmp_fs(const void *s1, addr_t s2, size_t len)
1974 + asm("fs; repe; cmpsb; setnz %0"
1975 + : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
1978 +static inline int memcmp_gs(const void *s1, addr_t s2, size_t len)
1981 + asm("gs; repe; cmpsb; setnz %0"
1982 + : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
1986 +/* Heap -- available for dynamic lists. */
1987 +#define STACK_SIZE 512 /* Minimum number of bytes for stack */
1989 +extern char _end[];
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)
1997 + HEAP = (char *)(((size_t)HEAP+(a-1)) & ~(a-1));
2002 +#define GET_HEAP(type, n) \
2003 + ((type *)__get_heap(sizeof(type),__alignof__(type),(n)))
2005 +static inline int heap_free(void)
2007 + return heap_end-HEAP;
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);
2019 +#define memcpy(d,s,l) __builtin_memcpy(d,s,l)
2020 +#define memset(d,c,l) __builtin_memset(d,c,l)
2023 +int enable_a20(void);
2026 +int query_apm_bios(void);
2029 +int cmdline_find_option(const char *option, char *buffer, int bufsize);
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);
2036 +void query_edd(void);
2039 +void __attribute__((noreturn)) die(void);
2042 +int query_mca(void);
2045 +int detect_memory(void);
2048 +void __attribute__((noreturn)) go_to_protected_mode(void);
2051 +void __attribute__((noreturn))
2052 + protected_mode_jump(u32 entrypoint, u32 bootparams);
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, ...);
2061 +int strcmp(const char *str1, const char *str2);
2064 +void puts(const char *);
2067 +void kbd_flush(void);
2068 +int getchar_timeout(void);
2071 +void set_video(void);
2074 +void vesa_store_edid(void);
2077 +int query_voyager(void);
2079 +#endif /* __ASSEMBLY__ */
2081 +#endif /* BOOT_BOOT_H */
2082 diff -puN arch/i386/boot/bootsect.S~git-newsetup /dev/null
2083 --- a/arch/i386/boot/bootsect.S
2087 - * bootsect.S Copyright (C) 1991, 1992 Linus Torvalds
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)
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.
2101 -#include <asm/boot.h>
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" */
2114 -#define SVGA_MODE ASK_VGA
2121 -#ifndef ROOT_RDONLY
2122 -#define ROOT_RDONLY 1
2131 - # Normalize the start address
2132 - jmpl $BOOTSEG, $start2
2143 - movw $bugger_off_msg, %si
2155 - # Allow the user to press a key, then reboot
2160 - # int 0x19 should never return. In case it does anyway,
2161 - # invoke the BIOS reset code...
2162 - ljmp $0xf000,$0xfff0
2166 - .ascii "Direct booting from floppy is no longer supported.\r\n"
2167 - .ascii "Please use a boot loader program instead.\r\n"
2169 - .ascii "Remove disk and press any key to reboot . . .\r\n"
2173 - # Kernel attributes; used by setup
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
2186 +++ a/arch/i386/boot/cmdline.c
2188 +/* -*- linux-c -*- ------------------------------------------------------- *
2190 + * Copyright (C) 1991, 1992 Linus Torvalds
2191 + * Copyright 2007 rPath, Inc. - All Rights Reserved
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.
2196 + * ----------------------------------------------------------------------- */
2199 + * arch/i386/boot/cmdline.c
2201 + * Simple command-line parser for early boot.
2206 +static inline int myisspace(u8 c)
2208 + return c <= ' '; /* Close enough approximation */
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.
2216 + * Returns the length of the argument (regardless of if it was
2217 + * truncated to fit in the buffer), or -1 on not found.
2219 +int cmdline_find_option(const char *option, char *buffer, int bufsize)
2221 + u32 cmdline_ptr = boot_params.hdr.cmd_line_ptr;
2225 + const char *opptr = NULL;
2226 + char *bufptr = buffer;
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;
2234 + if (!cmdline_ptr || cmdline_ptr >= 0x100000)
2235 + return -1; /* No command line, or inaccessible */
2237 + cptr = cmdline_ptr & 0xf;
2238 + set_fs(cmdline_ptr >> 4);
2240 + while (cptr < 0x10000 && (c = rdfs8(cptr++))) {
2242 + case st_wordstart:
2247 + state = st_wordcmp;
2249 + /* fall through */
2252 + if (c == '=' && !*opptr) {
2255 + state = st_bufcpy;
2256 + } else if (myisspace(c)) {
2257 + state = st_wordstart;
2258 + } else if (c != *opptr++) {
2259 + state = st_wordskip;
2265 + state = st_wordstart;
2269 + if (myisspace(c)) {
2270 + state = st_wordstart;
2272 + if (len < bufsize-1)
2285 diff -puN /dev/null arch/i386/boot/code16gcc.h
2287 +++ a/arch/i386/boot/code16gcc.h
2292 + * This file is -include'd when compiling 16-bit C code.
2295 +#ifndef __ASSEMBLY__
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
2304 LDFLAGS_vmlinux := -T
2305 -CFLAGS_misc.o += -fPIC
2306 hostprogs-y := relocs
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
2314 $(obj)/vmlinux: $(src)/vmlinux.lds $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE
2315 $(call if_changed,ld)
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.
2329 - leal 0x40(%esi), %esp
2330 + leal (0x1e4+4)(%esi), %esp
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
2339 #undef CONFIG_PARAVIRT
2340 #include <linux/linkage.h>
2341 -#include <linux/vmalloc.h>
2342 #include <linux/screen_info.h>
2344 #include <asm/page.h>
2345 @@ -364,8 +363,10 @@ asmlinkage void decompress_kernel(void *
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");
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
2358 +++ a/arch/i386/boot/copy.S
2360 +/* ----------------------------------------------------------------------- *
2362 + * Copyright (C) 1991, 1992 Linus Torvalds
2363 + * Copyright 2007 rPath, Inc. - All Rights Reserved
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.
2368 + * ----------------------------------------------------------------------- */
2371 + * arch/i386/boot/copy.S
2373 + * Memory copy routines
2380 + .type memcpy, @function
2395 + .size memcpy, .-memcpy
2398 + .type memset, @function
2403 + imull $0x01010101,%eax
2412 + .size memset, .-memset
2414 + .globl copy_from_fs
2415 + .type copy_from_fs, @function
2423 + .size copy_from_fs, .-copy_from_fs
2426 + .type copy_to_fs, @function
2434 + .size copy_to_fs, .-copy_to_fs
2436 +#if 0 /* Not currently used, but can be enabled as needed */
2438 + .globl copy_from_gs
2439 + .type copy_from_gs, @function
2447 + .size copy_from_gs, .-copy_from_gs
2450 + .type copy_to_gs, @function
2458 + .size copy_to_gs, .-copy_to_gs
2461 diff -puN /dev/null arch/i386/boot/cpu.c
2463 +++ a/arch/i386/boot/cpu.c
2465 +/* -*- linux-c -*- ------------------------------------------------------- *
2467 + * Copyright (C) 1991, 1992 Linus Torvalds
2468 + * Copyright 2007 rPath, Inc. - All Rights Reserved
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.
2473 + * ----------------------------------------------------------------------- */
2476 + * arch/i386/boot/cpucheck.c
2478 + * Check for obligatory CPU features and abort if the features are not
2483 +#include "bitops.h"
2484 +#include <asm/cpufeature.h>
2486 +static char *cpu_name(int level)
2488 + static char buf[6];
2490 + if (level == 64) {
2493 + sprintf(buf, "i%d86", level);
2498 +int validate_cpu(void)
2501 + int cpu_level, req_level;
2503 + check_cpu(&cpu_level, &req_level, &err_flags);
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));
2515 + puts("This kernel requires the following features "
2516 + "not present on the CPU:\n");
2518 + for (i = 0; i < NCAPINTS; i++) {
2519 + u32 e = err_flags[i];
2521 + for (j = 0; j < 32; j++) {
2523 + printf("%d:%d ", i, j);
2534 diff -puN /dev/null arch/i386/boot/cpucheck.c
2536 +++ a/arch/i386/boot/cpucheck.c
2538 +/* -*- linux-c -*- ------------------------------------------------------- *
2540 + * Copyright (C) 1991, 1992 Linus Torvalds
2541 + * Copyright 2007 rPath, Inc. - All Rights Reserved
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.
2546 + * ----------------------------------------------------------------------- */
2549 + * arch/i386/boot/cpu.c
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.
2555 + * This code should not contain any messages; that requires an
2556 + * additional wrapper.
2558 + * As written, this code is not safe for inclusion into the kernel
2559 + * proper (after FPU initialization, in particular).
2564 +# include "bitops.h"
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>
2572 +struct cpu_features {
2575 + u32 flags[NCAPINTS];
2578 +static struct cpu_features cpu;
2579 +static u32 cpu_vendor[3];
2580 +static u32 err_flags[NCAPINTS];
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;
2587 +static const int req_level = 3;
2590 +static const u32 req_flags[NCAPINTS] =
2601 +#define A32(a,b,c,d) (((d) << 24)+((c) << 16)+((b) << 8)+(a))
2603 +static int is_amd(void)
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');
2610 +static int is_centaur(void)
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');
2617 +static int is_transmeta(void)
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');
2624 +static int has_fpu(void)
2626 + u16 fcw = -1, fsw = -1;
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));
2635 + asm("fninit ; fnstsw %0 ; fnstcw %1" : "+m" (fsw), "+m" (fcw));
2637 + return fsw == 0 && (fcw & 0x103f) == 0x003f;
2640 +static int has_eflag(u32 mask)
2654 + : "=r" (f0), "=r" (f1)
2657 + return !!((f0^f1) & mask);
2660 +static void get_flags(void)
2662 + u32 max_intel_level, max_amd_level;
2666 + set_bit(X86_FEATURE_FPU, cpu.flags);
2668 + if (has_eflag(X86_EFLAGS_ID)) {
2670 + : "=a" (max_intel_level),
2671 + "=b" (cpu_vendor[0]),
2672 + "=d" (cpu_vendor[1]),
2673 + "=c" (cpu_vendor[2])
2676 + if (max_intel_level >= 0x00000001 &&
2677 + max_intel_level <= 0x0000ffff) {
2680 + "=c" (cpu.flags[4]),
2681 + "=d" (cpu.flags[0])
2682 + : "a" (0x00000001)
2684 + cpu.level = (tfms >> 8) & 15;
2685 + cpu.model = (tfms >> 4) & 15;
2686 + if (cpu.level >= 6)
2687 + cpu.model += ((tfms >> 16) & 0xf) << 4;
2691 + : "=a" (max_amd_level)
2692 + : "a" (0x80000000)
2693 + : "ebx", "ecx", "edx");
2695 + if (max_amd_level >= 0x80000001 &&
2696 + max_amd_level <= 0x8000ffff) {
2697 + u32 eax = 0x80000001;
2700 + "=c" (cpu.flags[6]),
2701 + "=d" (cpu.flags[1])
2707 +/* Returns a bitmask of which words we have error bits in */
2708 +static int check_flags(void)
2714 + for (i = 0; i < NCAPINTS; i++) {
2715 + err_flags[i] = req_flags[i] & ~cpu.flags[i];
2724 + * Returns -1 on error.
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.
2729 + * *err_flags_ptr is set to the flags error array if there are flags missing.
2731 +int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr)
2735 + memset(&cpu.flags, 0, sizeof cpu.flags);
2738 + if (has_eflag(X86_EFLAGS_AC))
2742 + err = check_flags();
2744 + if (test_bit(X86_FEATURE_LM, cpu.flags))
2747 + if (err == 0x01 &&
2749 + ~((1 << X86_FEATURE_XMM)|(1 << X86_FEATURE_XMM2))) &&
2751 + /* If this is an AMD and we're only missing SSE+SSE2, try to
2754 + u32 ecx = MSR_K7_HWCR;
2757 + asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
2758 + eax &= ~(1 << 15);
2759 + asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
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
2769 + u32 ecx = MSR_VIA_FCR;
2772 + asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
2773 + eax |= (1<<1)|(1<<7);
2774 + asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
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 */
2781 + u32 ecx = 0x80860004;
2785 + asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
2786 + asm("wrmsr" : : "a" (~0), "d" (edx), "c" (ecx));
2788 + : "+a" (level), "=d" (cpu.flags[0])
2789 + : : "ecx", "ebx");
2790 + asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
2792 + err = check_flags();
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;
2802 + return (cpu.level < req_level || err) ? -1 : 0;
2804 diff -puN arch/i386/boot/edd.S~git-newsetup /dev/null
2805 --- a/arch/i386/boot/edd.S
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>
2818 - * Command line option parsing, Matt Domsch, November 2004
2821 -#include <linux/edd.h>
2822 -#include <asm/setup.h>
2824 -#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
2826 -# It is assumed that %ds == INITSEG here
2828 - movb $0, (EDD_MBR_SIG_NR_BUF)
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)
2837 - movw $edd_mbr_sig_start, %di # Default to edd=on
2839 - movl %cs:(cmd_line_ptr), %esi
2841 - jz old_cl # Old boot protocol?
2843 -# Convert to a real-mode pointer in fs:si
2848 - jmp have_cl_pointer
2850 -# Old-style boot protocol?
2852 - push %ds # aka INITSEG
2855 - cmpw $0xa33f, (0x20)
2856 - jne done_cl # No command line at all?
2857 - movw (0x22), %si # Pointer relative to INITSEG
2859 -# fs:si has the pointer to the command line now
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"...
2867 - cmpw $-5, %si # Watch for segment wraparound
2869 - movl %fs:(%si), %eax
2870 - andb %al, %al # End of line?
2872 - cmpl $EDD_CL_EQUALS, %eax
2873 - jz found_edd_equals
2874 - cmpb $0x20, %al # <= space consider whitespace
2880 - cmpw $-5, %si # Watch for segment wraparound
2882 - movb %fs:(%si), %al # End of string?
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
2896 - cmpw $EDD_CL_SKIP, %ax # edd=sk
2898 - cmpw $EDD_CL_ON, %ax # edd=on
2902 - movw $edd_start, %di
2905 - movw $edd_done, %di
2908 - movw $edd_mbr_sig_start, %di
2915 -# Read the first sector of each BIOS disk device and store the 4-byte signature
2917 - movb $0x80, %dl # from device 80
2918 - movw $EDD_MBR_SIG_BUF, %bx # store buffer ptr in bx
2920 - movl $0xFFFFFFFF, %eax
2921 - movl %eax, (%bx) # assume failure
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
2930 - movw $EDDBUF, %bx # disk's data goes into EDDBUF
2931 - pushw %dx # work around buggy BIOSes
2932 - stc # work around buggy BIOSes
2934 - sti # work around buggy BIOSes
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
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"
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
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
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
2988 - cmpw $EDDMAGIC2, %bx # is magic right?
2989 - jne edd_next # nope, next...
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
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:
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"
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
3022 - movb %cl, %ah # High 2 bits of max cyl
3023 - movw %ax, %ds:-4(%si)
3028 - movw %si, %ax # increment si
3029 - addw $EDDPARMSIZE+EDDEXTSIZE, %ax
3033 - incb %dl # increment to next device
3034 - cmpb $EDDMAXNR, (EDDNR) # Out of space?
3035 - jb edd_check_ext # keep looping
3039 diff -puN /dev/null arch/i386/boot/edd.c
3041 +++ a/arch/i386/boot/edd.c
3043 +/* -*- linux-c -*- ------------------------------------------------------- *
3045 + * Copyright (C) 1991, 1992 Linus Torvalds
3046 + * Copyright 2007 rPath, Inc. - All Rights Reserved
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.
3051 + * ----------------------------------------------------------------------- */
3054 + * arch/i386/boot/edd.c
3056 + * Get EDD BIOS disk information
3060 +#include <linux/edd.h>
3062 +#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
3068 + u16 buf_off, buf_seg;
3074 + * Note: this uses the heap to hold the loaded sector.
3076 +static int read_sector(u8 devno, u64 lba, void *buf)
3078 + struct edd_dapa dapa;
3079 + u16 ax, bx, cx, dx, si;
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();
3088 + ax = 0x4200; /* Extended Read */
3089 + si = (size_t)&dapa;
3091 + asm("pushfl; stc; int $0x13; setc %%al; popfl"
3092 + : "+a" (ax), "+S" (si), "+d" (dx)
3094 + : "ebx", "ecx", "edi", "memory");
3097 + return 0; /* OK */
3099 + ax = 0x0201; /* Legacy Read, one sector */
3100 + cx = 0x0001; /* Sector 0-0-1 */
3103 + asm("pushfl; stc; int $0x13; setc %%al; popfl"
3104 + : "+a" (ax), "+c" (cx), "+d" (dx), "+b" (bx)
3105 + : : "esi", "edi", "memory");
3107 + return -(u8)ax; /* 0 or -1 */
3110 +static u32 read_mbr_sig(u8 devno, struct edd_info *ei)
3113 + char *mbrbuf_ptr, *mbrbuf_end;
3115 + u32 buf_base, mbr_base;
3116 + extern char _end[];
3117 + static char mbr_buf[1024];
3119 + sector_size = ei->params.bytes_per_sector;
3121 + sector_size = 512; /* Best available guess */
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;
3128 + if (!(boot_params.hdr.loadflags & CAN_USE_HEAP))
3130 + if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr)
3133 + if (read_sector(devno, 0, mbrbuf_ptr))
3136 + mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET];
3140 +static int get_edd_info(u8 devno, struct edd_info *ei)
3142 + u16 ax, bx, cx, dx, di;
3144 + memset(ei, 0, sizeof *ei);
3146 + /* Check Extensions Present */
3151 + asm("pushfl; stc; int $0x13; setc %%al; popfl"
3152 + : "+a" (ax), "+b" (bx), "=c" (cx), "+d" (dx)
3153 + : : "esi", "edi");
3156 + return -1; /* No extended information */
3158 + if (bx != EDDMAGIC2)
3161 + ei->device = devno;
3162 + ei->version = ax >> 8; /* EDD version number */
3163 + ei->interface_support = cx; /* EDD functionality subsets */
3165 + /* Extended Get Device Parameters */
3167 + ei->params.length = sizeof(ei->params);
3170 + asm("pushfl; int $0x13; popfl"
3171 + : "+a" (ax), "+d" (dx)
3172 + : "S" (&ei->params)
3173 + : "ebx", "ecx", "edi");
3175 + /* Get legacy CHS parameters */
3177 + /* Ralf Brown recommends setting ES:DI to 0:0 */
3181 + asm("pushw %%es; "
3182 + "movw %%di,%%es; "
3183 + "pushfl; stc; int $0x13; setc %%al; popfl; "
3185 + : "+a" (ax), "=b" (bx), "=c" (cx), "+d" (dx), "+D" (di)
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;
3197 +void query_edd(void)
3203 + struct edd_info ei, *edp;
3205 + if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) {
3206 + if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip"))
3208 + else if (!strcmp(eddarg, "off"))
3212 + edp = (struct edd_info *)boot_params.eddbuf;
3217 + for (devno = 0x80; devno < 0x80+EDD_MBR_SIG_MAX; devno++) {
3219 + * Scan the BIOS-supported hard disks and query EDD
3222 + get_edd_info(devno, &ei);
3224 + if (boot_params.eddbuf_entries < EDDMAXNR) {
3225 + memcpy(edp, &ei, sizeof ei);
3227 + boot_params.eddbuf_entries++;
3232 + mbr_sig = read_mbr_sig(devno, &ei);
3233 + boot_params.edd_mbr_sig_buffer[devno-0x80] = mbr_sig;
3239 diff -puN /dev/null arch/i386/boot/header.S
3241 +++ a/arch/i386/boot/header.S
3246 + * Copyright (C) 1991, 1992 Linus Torvalds
3248 + * Based on bootsect.S and setup.S
3249 + * modified by more people than can be counted
3251 + * Rewritten as a common file by H. Peter Anvin (Apr 2007)
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.
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>
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" */
3277 +#define SVGA_MODE ASK_VGA
3284 +#ifndef ROOT_RDONLY
3285 +#define ROOT_RDONLY 1
3289 + .section ".bstext", "ax"
3291 + .global bootsect_start
3294 + # Normalize the start address
3295 + ljmp $BOOTSEG, $start2
3306 + movw $bugger_off_msg, %si
3318 + # Allow the user to press a key, then reboot
3323 + # int 0x19 should never return. In case it does anyway,
3324 + # invoke the BIOS reset code...
3325 + ljmp $0xf000,$0xfff0
3327 + .section ".bsdata", "a"
3329 + .ascii "Direct booting from floppy is no longer supported.\r\n"
3330 + .ascii "Please use a boot loader program instead.\r\n"
3332 + .ascii "Remove disk and press any key to reboot . . .\r\n"
3336 + # Kernel attributes; used by setup. This is part 1 of the
3337 + # header, from the old boot sector.
3339 + .section ".header", "a"
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
3350 + # offset 512, entry point
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
3361 + # Part 2 of the header, from the old setup.S
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
3374 +type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin,
3375 + # Bootlin, SYSLX, bootsect...)
3376 + # See Documentation/i386/boot.txt for
3379 +# flags, unused bits must be zero (RFU) bit within 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
3386 + # Only the loader knows what is free
3387 +#ifndef __BIG_KERNEL__
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.
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
3405 + .long 0x100000 # 0x100000 = default for big kernel
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.
3413 +ramdisk_size: .long 0 # its size in bytes
3416 + .long 0 # obsolete
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.
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.
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
3444 +kernel_alignment: .long CONFIG_PHYSICAL_ALIGN #physical addr alignment
3445 + #required for protected mode
3447 +#ifdef CONFIG_RELOCATABLE
3448 +relocatable_kernel: .byte 1
3450 +relocatable_kernel: .byte 0
3455 +cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line,
3456 + #added with boot protocol
3459 +# End of setup header #####################################################
3461 + .section ".inittext", "ax"
3463 +#ifdef SAFE_RESET_DISK_CONTROLLER
3464 +# Reset the disk controller.
3465 + movw $0x0000, %ax # Reset disk controller
3466 + movb $0x80, %dl # All disks
3470 +# We will have entired with %cs = %ds+0x20, normalize %cs so
3471 +# it is on par with the other segments.
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
3487 + andw $~3, %sp # dword align (might as well...)
3489 + movw $0xfffc, %sp # Make sure we're not zero
3490 +1: movzwl %sp, %esp # Clear upper half of %esp
3493 +# Check signature at end of setup
3494 + cmpl $0x5a5aaa55, setup_sig
3498 + movw $__bss_start, %di
3505 +# Jump to C code (should not return)
3508 +# Setup corrupt somehow...
3510 + movl $setup_corrupt, %eax
3515 + .type die, @function
3522 + .section ".initdata", "a"
3525 + .string "No setup signature found..."
3526 diff -puN /dev/null arch/i386/boot/main.c
3528 +++ a/arch/i386/boot/main.c
3530 +/* -*- linux-c -*- ------------------------------------------------------- *
3532 + * Copyright (C) 1991, 1992 Linus Torvalds
3533 + * Copyright 2007 rPath, Inc. - All Rights Reserved
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.
3538 + * ----------------------------------------------------------------------- */
3541 + * arch/i386/boot/main.c
3543 + * Main module for the real-mode kernel code
3548 +struct boot_params boot_params __attribute__((aligned(16)));
3551 +char *heap_end = _end; /* Default end of heap = no heap */
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.
3558 +#define OLD_CL_MAGIC 0xA33F
3559 +#define OLD_CL_ADDRESS 0x20
3561 +static void copy_boot_params(void)
3563 + struct old_cmdline {
3567 + const struct old_cmdline * const oldcmd =
3568 + (const struct old_cmdline *)OLD_CL_ADDRESS;
3570 + BUILD_BUG_ON(sizeof boot_params != 4096);
3571 + memcpy(&boot_params.hdr, &hdr, sizeof hdr);
3573 + if (!boot_params.hdr.cmd_line_ptr &&
3574 + oldcmd->cl_magic == OLD_CL_MAGIC) {
3575 + /* Old-style command line protocol. */
3578 + /* Figure out if the command line falls in the region
3579 + of memory that an old kernel would have copied up
3581 + if (oldcmd->cl_offset < boot_params.hdr.setup_move_size)
3582 + cmdline_seg = ds();
3584 + cmdline_seg = 0x9000;
3586 + boot_params.hdr.cmd_line_ptr =
3587 + (cmdline_seg << 4) + oldcmd->cl_offset;
3592 + * Set the keyboard repeat rate to maximum. Unclear why this
3593 + * is done here; this might be possible to kill off as stale code.
3595 +static void keyboard_set_repeat(void)
3599 + asm volatile("int $0x16"
3600 + : "+a" (ax), "+b" (bx)
3601 + : : "ecx", "edx", "esi", "edi");
3605 + * Get Intel SpeedStep IST information.
3607 +static void query_speedstep_ist(void)
3610 + : "=a" (boot_params.speedstep_info[0]),
3611 + "=b" (boot_params.speedstep_info[1]),
3612 + "=c" (boot_params.speedstep_info[2]),
3613 + "=d" (boot_params.speedstep_info[3])
3614 + : "a" (0x0000e980), /* IST Support */
3615 + "d" (0x47534943)); /* Request value */
3619 + * Tell the BIOS what CPU mode we intend to run in.
3621 +static void set_bios_mode(void)
3623 +#ifdef CONFIG_X86_64
3628 + asm volatile("int $0x15"
3629 + : "+a" (eax), "+b" (ebx)
3630 + : : "ecx", "edx", "esi", "edi");
3636 + /* First, copy the boot header into the "zeropage" */
3637 + copy_boot_params();
3639 + /* End of heap check */
3640 + if (boot_params.hdr.loadflags & CAN_USE_HEAP) {
3641 + heap_end = (char *)(boot_params.hdr.heap_end_ptr
3642 + +0x200-STACK_SIZE);
3644 + /* Boot protocol 2.00 only, no heap available */
3645 + puts("WARNING: Ancient bootloader, some functionality "
3646 + "may be limited!\n");
3649 + /* Make sure we have all the proper CPU support */
3650 + if (validate_cpu()) {
3651 + puts("Unable to boot - please use a kernel appropriate "
3652 + "for your CPU.\n");
3656 + /* Tell the BIOS what CPU mode we intend to run in. */
3659 + /* Detect memory layout */
3662 + /* Set keyboard repeat rate (why?) */
3663 + keyboard_set_repeat();
3665 + /* Set the video mode */
3668 + /* Query MCA information */
3672 +#ifdef CONFIG_X86_VOYAGER
3676 + /* Query SpeedStep IST information */
3677 + query_speedstep_ist();
3679 + /* Query APM information */
3680 +#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
3684 + /* Query EDD information */
3685 +#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
3688 + /* Do the last things and invoke protected mode */
3689 + go_to_protected_mode();
3691 diff -puN /dev/null arch/i386/boot/mca.c
3693 +++ a/arch/i386/boot/mca.c
3695 +/* -*- linux-c -*- ------------------------------------------------------- *
3697 + * Copyright (C) 1991, 1992 Linus Torvalds
3698 + * Copyright 2007 rPath, Inc. - All Rights Reserved
3700 + * This file is part of the Linux kernel, and is made available under
3701 + * the terms of the GNU General Public License version 2.
3703 + * ----------------------------------------------------------------------- */
3706 + * arch/i386/boot/mca.c
3708 + * Get the MCA system description table
3713 +int query_mca(void)
3718 + asm("pushw %%es ; "
3721 + "movw %%es, %1 ; "
3723 + : "=acdSDm" (err), "=acdSDm" (es), "=b" (bx)
3727 + return -1; /* No MCA present */
3732 + if (len > sizeof(boot_params.sys_desc_table))
3733 + len = sizeof(boot_params.sys_desc_table);
3735 + copy_from_fs(&boot_params.sys_desc_table, bx, len);
3738 diff -puN /dev/null arch/i386/boot/memory.c
3740 +++ a/arch/i386/boot/memory.c
3742 +/* -*- linux-c -*- ------------------------------------------------------- *
3744 + * Copyright (C) 1991, 1992 Linus Torvalds
3745 + * Copyright 2007 rPath, Inc. - All Rights Reserved
3747 + * This file is part of the Linux kernel, and is made available under
3748 + * the terms of the GNU General Public License version 2.
3750 + * ----------------------------------------------------------------------- */
3753 + * arch/i386/boot/memory.c
3755 + * Memory detection code
3760 +#define SMAP 0x534d4150 /* ASCII "SMAP" */
3762 +static int detect_memory_e820(void)
3767 + struct e820entry *desc = boot_params.e820_map;
3770 + size = sizeof(struct e820entry);
3772 + asm("int $0x15; setc %0"
3773 + : "=am" (err), "+b" (next), "+d" (id), "+c" (size),
3775 + : "D" (desc), "a" (0xe820));
3777 + if (err || id != SMAP)
3780 + boot_params.e820_entries++;
3782 + } while (next && boot_params.e820_entries < E820MAX);
3784 + return boot_params.e820_entries;
3787 +static int detect_memory_e801(void)
3789 + u16 ax, bx, cx, dx;
3794 + asm("stc; int $0x15; setc %0"
3795 + : "=m" (err), "+a" (ax), "+b" (bx), "+c" (cx), "+d" (dx));
3800 + /* Do we really need to do this? */
3807 + return -1; /* Bogus! */
3809 + /* This ignores memory above 16MB if we have a memory hole
3810 + there. If someone actually finds a machine with a memory
3811 + hole at 16MB and no support for 0E820h they should probably
3812 + generate a fake e820 map. */
3813 + boot_params.alt_mem_k = (ax == 15*1024) ? (dx << 6)+ax : ax;
3818 +static int detect_memory_88(void)
3824 + asm("stc; int $0x15; setc %0" : "=bcdm" (err), "+a" (ax));
3826 + boot_params.screen_info.ext_mem_k = ax;
3831 +int detect_memory(void)
3833 + if (detect_memory_e820() > 0)
3836 + if (!detect_memory_e801())
3839 + return detect_memory_88();
3841 diff -puN /dev/null arch/i386/boot/pm.c
3843 +++ a/arch/i386/boot/pm.c
3845 +/* -*- linux-c -*- ------------------------------------------------------- *
3847 + * Copyright (C) 1991, 1992 Linus Torvalds
3848 + * Copyright 2007 rPath, Inc. - All Rights Reserved
3850 + * This file is part of the Linux kernel, and is made available under
3851 + * the terms of the GNU General Public License version 2.
3853 + * ----------------------------------------------------------------------- */
3856 + * arch/i386/boot/pm.c
3858 + * Prepare the machine for transition to protected mode.
3862 +#include <asm/segment.h>
3865 + * Invoke the realmode switch hook if present; otherwise
3866 + * disable all interrupts.
3868 +static void realmode_switch_hook(void)
3870 + if (boot_params.hdr.realmode_swtch) {
3871 + asm volatile("lcallw *%0"
3872 + : : "m" (boot_params.hdr.realmode_swtch)
3873 + : "eax", "ebx", "ecx", "edx");
3875 + asm volatile("cli");
3876 + outb(0x80, 0x70); /* Disable NMI */
3882 + * A zImage kernel is loaded at 0x10000 but wants to run at 0x1000.
3883 + * A bzImage kernel is loaded and runs at 0x100000.
3885 +static void move_kernel_around(void)
3887 + /* Note: rely on the compile-time option here rather than
3888 + the LOADED_HIGH flag. The Qemu kernel loader unconditionally
3889 + sets the loadflags to zero. */
3890 +#ifndef __BIG_KERNEL__
3891 + u16 dst_seg, src_seg;
3894 + dst_seg = 0x1000 >> 4;
3895 + src_seg = 0x10000 >> 4;
3896 + syssize = boot_params.hdr.syssize; /* Size in 16-byte paragraps */
3899 + int paras = (syssize >= 0x1000) ? 0x1000 : syssize;
3900 + int dwords = paras << 2;
3902 + asm volatile("pushw %%es ; "
3906 + "xorw %%di,%%di ; "
3907 + "xorw %%si,%%si ; "
3912 + : "rm" (dst_seg), "rm" (src_seg)
3923 + * Disable all interrupts at the legacy PIC.
3925 +static void mask_all_interrupts(void)
3927 + outb(0xff, 0xa1); /* Mask all interrupts on the seconday PIC */
3929 + outb(0xfb, 0x21); /* Mask all but cascade on the primary PIC */
3934 + * Reset IGNNE# if asserted in the FPU.
3936 +static void reset_coprocessor(void)
3947 +#define GDT_ENTRY(flags,base,limit) \
3948 + (((u64)(base & 0xff000000) << 32) | \
3949 + ((u64)flags << 40) | \
3950 + ((u64)(limit & 0x00ff0000) << 32) | \
3951 + ((u64)(base & 0x00ffff00) << 16) | \
3952 + ((u64)(limit & 0x0000ffff)))
3957 +} __attribute__((packed));
3959 +static void setup_gdt(void)
3961 + /* There are machines which are known to not boot with the GDT
3962 + being 8-byte unaligned. Intel recommends 16 byte alignment. */
3963 + static const u64 boot_gdt[] __attribute__((aligned(16))) = {
3964 + /* CS: code, read/execute, 4 GB, base 0 */
3965 + [GDT_ENTRY_BOOT_CS] = GDT_ENTRY(0xc09b, 0, 0xfffff),
3966 + /* DS: data, read/write, 4 GB, base 0 */
3967 + [GDT_ENTRY_BOOT_DS] = GDT_ENTRY(0xc093, 0, 0xfffff),
3969 + struct gdt_ptr gdt;
3971 + gdt.len = sizeof(boot_gdt)-1;
3972 + gdt.ptr = (u32)&boot_gdt + (ds() << 4);
3974 + asm volatile("lgdtl %0" : : "m" (gdt));
3980 +static void setup_idt(void)
3982 + static const struct gdt_ptr null_idt = {0, 0};
3983 + asm volatile("lidtl %0" : : "m" (null_idt));
3987 + * Actual invocation sequence
3989 +void go_to_protected_mode(void)
3991 + /* Hook before leaving real mode, also disables interrupts */
3992 + realmode_switch_hook();
3994 + /* Move the kernel/setup to their final resting places */
3995 + move_kernel_around();
3997 + /* Enable the A20 gate */
3998 + if (enable_a20()) {
3999 + puts("A20 gate not responding, unable to boot...\n");
4003 + /* Reset coprocessor (IGNNE#) */
4004 + reset_coprocessor();
4006 + /* Mask all interrupts in the PIC */
4007 + mask_all_interrupts();
4009 + /* Actual transition to protected mode... */
4012 + protected_mode_jump(boot_params.hdr.code32_start,
4013 + (u32)&boot_params + (ds() << 4));
4015 diff -puN /dev/null arch/i386/boot/pmjump.S
4017 +++ a/arch/i386/boot/pmjump.S
4019 +/* ----------------------------------------------------------------------- *
4021 + * Copyright (C) 1991, 1992 Linus Torvalds
4022 + * Copyright 2007 rPath, Inc. - All Rights Reserved
4024 + * This file is part of the Linux kernel, and is made available under
4025 + * the terms of the GNU General Public License version 2.
4027 + * ----------------------------------------------------------------------- */
4030 + * arch/i386/boot/pmjump.S
4032 + * The actual transition into protected mode
4035 +#include <asm/boot.h>
4036 +#include <asm/segment.h>
4040 + .globl protected_mode_jump
4041 + .type protected_mode_jump, @function
4046 + * void protected_mode_jump(u32 entrypoint, u32 bootparams);
4048 +protected_mode_jump:
4049 + xorl %ebx, %ebx # Flag to indicate this is a boot
4050 + movl %edx, %esi # Pointer to boot_params table
4051 + movl %eax, 2f # Patch ljmpl instruction
4052 + jmp 1f # Short jump to flush instruction q.
4055 + movw $__BOOT_DS, %cx
4058 + orb $1, %dl # Protected mode (PE) bit
4067 + # Jump to the 32-bit entrypoint
4068 + .byte 0x66, 0xea # ljmpl opcode
4069 +2: .long 0 # offset
4070 + .word __BOOT_CS # segment
4072 + .size protected_mode_jump, .-protected_mode_jump
4073 diff -puN /dev/null arch/i386/boot/printf.c
4075 +++ a/arch/i386/boot/printf.c
4077 +/* -*- linux-c -*- ------------------------------------------------------- *
4079 + * Copyright (C) 1991, 1992 Linus Torvalds
4080 + * Copyright 2007 rPath, Inc. - All Rights Reserved
4082 + * This file is part of the Linux kernel, and is made available under
4083 + * the terms of the GNU General Public License version 2.
4085 + * ----------------------------------------------------------------------- */
4088 + * arch/i386/boot/printf.c
4090 + * Oh, it's a waste of space, but oh-so-yummy for debugging. This
4091 + * version of printf() does not include 64-bit support. "Live with
4098 +static inline int isdigit(int ch)
4100 + return (ch >= '0') && (ch <= '9');
4103 +static int skip_atoi(const char **s)
4107 + while (isdigit(**s))
4108 + i = i * 10 + *((*s)++) - '0';
4112 +unsigned int atou(const char *s)
4114 + unsigned int i = 0;
4115 + while (isdigit(*s))
4116 + i = i * 10 + (*s++ - '0');
4120 +static int strnlen(const char *s, int maxlen)
4122 + const char *es = s;
4123 + while (*es && maxlen) {
4131 +#define ZEROPAD 1 /* pad with zero */
4132 +#define SIGN 2 /* unsigned/signed long */
4133 +#define PLUS 4 /* show plus */
4134 +#define SPACE 8 /* space if plus */
4135 +#define LEFT 16 /* left justified */
4136 +#define SPECIAL 32 /* 0x */
4137 +#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
4139 +#define do_div(n,base) ({ \
4141 +__res = ((unsigned long) n) % (unsigned) base; \
4142 +n = ((unsigned long) n) / (unsigned) base; \
4145 +static char *number(char *str, long num, int base, int size, int precision,
4148 + char c, sign, tmp[66];
4149 + const char *digits = "0123456789abcdefghijklmnopqrstuvwxyz";
4153 + digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
4156 + if (base < 2 || base > 36)
4158 + c = (type & ZEROPAD) ? '0' : ' ';
4160 + if (type & SIGN) {
4165 + } else if (type & PLUS) {
4168 + } else if (type & SPACE) {
4173 + if (type & SPECIAL) {
4176 + else if (base == 8)
4184 + tmp[i++] = digits[do_div(num, base)];
4185 + if (i > precision)
4187 + size -= precision;
4188 + if (!(type & (ZEROPAD + LEFT)))
4189 + while (size-- > 0)
4193 + if (type & SPECIAL) {
4196 + else if (base == 16) {
4198 + *str++ = digits[33];
4201 + if (!(type & LEFT))
4202 + while (size-- > 0)
4204 + while (i < precision--)
4208 + while (size-- > 0)
4213 +int vsprintf(char *buf, const char *fmt, va_list args)
4216 + unsigned long num;
4221 + int flags; /* flags to number() */
4223 + int field_width; /* width of output field */
4224 + int precision; /* min. # of digits for integers; max
4225 + number of chars for from string */
4226 + int qualifier; /* 'h', 'l', or 'L' for integer fields */
4228 + for (str = buf; *fmt; ++fmt) {
4229 + if (*fmt != '%') {
4234 + /* process flags */
4237 + ++fmt; /* this also skips first '%' */
4256 + /* get field width */
4258 + if (isdigit(*fmt))
4259 + field_width = skip_atoi(&fmt);
4260 + else if (*fmt == '*') {
4262 + /* it's the next argument */
4263 + field_width = va_arg(args, int);
4264 + if (field_width < 0) {
4265 + field_width = -field_width;
4270 + /* get the precision */
4272 + if (*fmt == '.') {
4274 + if (isdigit(*fmt))
4275 + precision = skip_atoi(&fmt);
4276 + else if (*fmt == '*') {
4278 + /* it's the next argument */
4279 + precision = va_arg(args, int);
4281 + if (precision < 0)
4285 + /* get the conversion qualifier */
4287 + if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') {
4292 + /* default base */
4297 + if (!(flags & LEFT))
4298 + while (--field_width > 0)
4300 + *str++ = (unsigned char)va_arg(args, int);
4301 + while (--field_width > 0)
4306 + s = va_arg(args, char *);
4307 + len = strnlen(s, precision);
4309 + if (!(flags & LEFT))
4310 + while (len < field_width--)
4312 + for (i = 0; i < len; ++i)
4314 + while (len < field_width--)
4319 + if (field_width == -1) {
4320 + field_width = 2 * sizeof(void *);
4324 + (unsigned long)va_arg(args, void *), 16,
4325 + field_width, precision, flags);
4329 + if (qualifier == 'l') {
4330 + long *ip = va_arg(args, long *);
4331 + *ip = (str - buf);
4333 + int *ip = va_arg(args, int *);
4334 + *ip = (str - buf);
4342 + /* integer number formats - set up the flags and "break" */
4367 + if (qualifier == 'l')
4368 + num = va_arg(args, unsigned long);
4369 + else if (qualifier == 'h') {
4370 + num = (unsigned short)va_arg(args, int);
4373 + } else if (flags & SIGN)
4374 + num = va_arg(args, int);
4376 + num = va_arg(args, unsigned int);
4377 + str = number(str, num, base, field_width, precision, flags);
4383 +int sprintf(char *buf, const char *fmt, ...)
4388 + va_start(args, fmt);
4389 + i = vsprintf(buf, fmt, args);
4394 +int printf(const char *fmt, ...)
4396 + char printf_buf[1024];
4400 + va_start(args, fmt);
4401 + printed = vsprintf(printf_buf, fmt, args);
4408 diff -puN arch/i386/boot/setup.S~git-newsetup /dev/null
4409 --- a/arch/i386/boot/setup.S
4413 - * setup.S Copyright (C) 1991, 1992 Linus Torvalds
4415 - * setup.s is responsible for getting the system data from the BIOS,
4416 - * and putting them into the appropriate places in system memory.
4417 - * both setup.s and system has been loaded by the bootblock.
4419 - * This code asks the bios for memory/disk/other parameters, and
4420 - * puts them in a "safe" place: 0x90000-0x901FF, ie where the
4421 - * boot-block used to be. It is then up to the protected mode
4422 - * system to read them from there before the area is overwritten
4423 - * for buffer-blocks.
4425 - * Move PS/2 aux init code to psaux.c
4426 - * (troyer@saifr00.cfsat.Honeywell.COM) 03Oct92
4428 - * some changes and additional features by Christoph Niemann,
4429 - * March 1993/June 1994 (Christoph.Niemann@linux.org)
4431 - * add APM BIOS checking by Stephen Rothwell, May 1994
4432 - * (sfr@canb.auug.org.au)
4434 - * High load stuff, initrd support and position independency
4435 - * by Hans Lermen & Werner Almesberger, February 1996
4436 - * <lermen@elserv.ffm.fgan.de>, <almesber@lrc.epfl.ch>
4438 - * Video handling moved to video.S by Martin Mares, March 1996
4439 - * <mj@k332.feld.cvut.cz>
4441 - * Extended memory detection scheme retwiddled by orc@pell.chi.il.us (david
4442 - * parsons) to avoid loadlin confusion, July 1997
4444 - * Transcribed from Intel (as86) -> AT&T (gas) by Chris Noe, May 1999.
4445 - * <stiker@northlink.com>
4447 - * Fix to work around buggy BIOSes which don't use carry bit correctly
4448 - * and/or report extended memory in CX/DX for e801h memory size detection
4449 - * call. As a result the kernel got wrong figures. The int15/e801h docs
4450 - * from Ralf Brown interrupt list seem to indicate AX/BX should be used
4451 - * anyway. So to avoid breaking many machines (presumably there was a reason
4452 - * to orginally use CX/DX instead of AX/BX), we do a kludge to see
4453 - * if CX/DX have been changed in the e801 call and if so use AX/BX .
4454 - * Michael Miller, April 2001 <michaelm@mjmm.org>
4456 - * New A20 code ported from SYSLINUX by H. Peter Anvin. AMD Elan bugfixes
4457 - * by Robert Schwebel, December 2001 <robert@schwebel.de>
4460 -#include <asm/segment.h>
4461 -#include <linux/utsrelease.h>
4462 -#include <linux/compile.h>
4463 -#include <asm/boot.h>
4464 -#include <asm/e820.h>
4465 -#include <asm/page.h>
4466 -#include <asm/setup.h>
4468 -/* Signature words to ensure LILO loaded us right */
4469 -#define SIG1 0xAA55
4470 -#define SIG2 0x5A5A
4472 -INITSEG = DEF_INITSEG # 0x9000, we move boot here, out of the way
4473 -SYSSEG = DEF_SYSSEG # 0x1000, system loaded at 0x10000 (65536).
4474 -SETUPSEG = DEF_SETUPSEG # 0x9020, this is the current segment
4475 - # ... and the former contents of CS
4477 -DELTA_INITSEG = SETUPSEG - INITSEG # 0x0020
4480 -.globl begtext, begdata, begbss, endtext, enddata, endbss
4493 -# This is the setup header, and it must start at %cs:2 (old 0x9020:2)
4495 - .ascii "HdrS" # header signature
4496 - .word 0x0206 # header version number (>= 0x0105)
4497 - # or else old loadlin-1.5 will fail)
4498 -realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
4499 -start_sys_seg: .word SYSSEG
4500 - .word kernel_version # pointing to kernel version string
4501 - # above section of header is compatible
4502 - # with loadlin-1.5 (header v1.5). Don't
4505 -type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin,
4506 - # Bootlin, SYSLX, bootsect...)
4507 - # See Documentation/i386/boot.txt for
4510 -# flags, unused bits must be zero (RFU) bit within loadflags
4512 -LOADED_HIGH = 1 # If set, the kernel is loaded high
4513 -CAN_USE_HEAP = 0x80 # If set, the loader also has set
4514 - # heap_end_ptr to tell how much
4515 - # space behind setup.S can be used for
4517 - # Only the loader knows what is free
4518 -#ifndef __BIG_KERNEL__
4524 -setup_move_size: .word 0x8000 # size to move, when setup is not
4525 - # loaded at 0x90000. We will move setup
4526 - # to 0x90000 then just before jumping
4527 - # into the kernel. However, only the
4528 - # loader knows how much data behind
4529 - # us also needs to be loaded.
4531 -code32_start: # here loaders can put a different
4532 - # start address for 32-bit code.
4533 -#ifndef __BIG_KERNEL__
4534 - .long 0x1000 # 0x1000 = default for zImage
4536 - .long 0x100000 # 0x100000 = default for big kernel
4539 -ramdisk_image: .long 0 # address of loaded ramdisk image
4540 - # Here the loader puts the 32-bit
4541 - # address where it loaded the image.
4542 - # This only will be read by the kernel.
4544 -ramdisk_size: .long 0 # its size in bytes
4547 - .long 0 # obsolete
4549 -heap_end_ptr: .word modelist+1024 # (Header version 0x0201 or later)
4550 - # space from here (exclusive) down to
4551 - # end of setup code can be used by setup
4552 - # for local heap purposes.
4555 -cmd_line_ptr: .long 0 # (Header version 0x0202 or later)
4556 - # If nonzero, a 32-bit pointer
4557 - # to the kernel command line.
4558 - # The command line should be
4559 - # located between the start of
4560 - # setup and the end of low
4561 - # memory (0xa0000), or it may
4562 - # get overwritten before it
4563 - # gets read. If this field is
4564 - # used, there is no longer
4565 - # anything magical about the
4566 - # 0x90000 segment; the setup
4567 - # can be located anywhere in
4568 - # low memory 0x10000 or higher.
4570 -ramdisk_max: .long (-__PAGE_OFFSET-(512 << 20)-1) & 0x7fffffff
4571 - # (Header version 0x0203 or later)
4572 - # The highest safe address for
4573 - # the contents of an initrd
4575 -kernel_alignment: .long CONFIG_PHYSICAL_ALIGN #physical addr alignment
4576 - #required for protected mode
4578 -#ifdef CONFIG_RELOCATABLE
4579 -relocatable_kernel: .byte 1
4581 -relocatable_kernel: .byte 0
4586 -cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line,
4587 - #added with boot protocol
4590 -trampoline: call start_of_setup
4592 - # The offset at this point is 0x240
4593 - .space (0xeff-0x240+1) # E820 & EDD space (ending at 0xeff)
4594 -# End of setup header #####################################################
4597 -# Bootlin depends on this being done early
4598 - movw $0x01500, %ax
4602 -#ifdef SAFE_RESET_DISK_CONTROLLER
4603 -# Reset the disk controller.
4609 -# Set %ds = %cs, we know that SETUPSEG = %cs at this point
4610 - movw %cs, %ax # aka SETUPSEG
4612 -# Check signature at end of setup
4613 - cmpw $SIG1, setup_sig1
4616 - cmpw $SIG2, setup_sig2
4621 -# Routine to print asciiz string at ds:si
4633 -prtsp2: call prtspc # Print double space
4634 -prtspc: movb $0x20, %al # Print single space (note: fall-thru)
4636 -# Part of above routine, this one just prints ascii al
4647 -beep: movb $0x07, %al
4650 -no_sig_mess: .string "No setup signature found ..."
4655 -# We now have to find the rest of the setup code/data
4657 - movw %cs, %ax # SETUPSEG
4658 - subw $DELTA_INITSEG, %ax # INITSEG
4661 - movb (497), %bl # get setup sect from bootsect
4662 - subw $4, %bx # LILO loads 4 sectors of setup
4663 - shlw $8, %bx # convert to words (1sect=2^8 words)
4665 - shrw $3, %bx # convert to segment
4667 - movw %bx, %cs:start_sys_seg
4668 -# Move rest of setup code/data to here
4669 - movw $2048, %di # four sectors loaded by LILO
4677 - movw %cs, %ax # aka SETUPSEG
4679 - cmpw $SIG1, setup_sig1
4682 - cmpw $SIG2, setup_sig2
4688 - lea no_sig_mess, %si
4696 - movw %cs, %ax # aka SETUPSEG
4697 - subw $DELTA_INITSEG, %ax # aka INITSEG
4699 -# Check if an old loader tries to load a big-kernel
4700 - testb $LOADED_HIGH, %cs:loadflags # Do we have a big kernel?
4701 - jz loader_ok # No, no danger for old loaders.
4703 - cmpb $0, %cs:type_of_loader # Do we have a loader that
4704 - # can deal with us?
4705 - jnz loader_ok # Yes, continue.
4707 - pushw %cs # No, we have an old loader,
4709 - lea loader_panic_mess, %si
4714 -loader_panic_mess: .string "Wrong loader, giving up..."
4716 -# check minimum cpuid
4717 -# we do this here because it is the last place we can actually
4718 -# show a user visible error message. Later the video modus
4719 -# might be already messed up.
4724 - movw %cs,%ax # aka SETUPSEG
4726 - lea cpu_panic_mess,%si
4731 - .asciz "PANIC: CPU too old for this kernel."
4733 -#include "../kernel/verify_cpu.S"
4736 -# Get memory size (extended mem, kB)
4739 - movl %eax, (0x1e0)
4740 -#ifndef STANDARD_MEMORY_BIOS_CALL
4741 - movb %al, (E820NR)
4742 -# Try three different memory detection schemes. First, try
4743 -# e820h, which lets us assemble a memory map, then try e801h,
4744 -# which returns a 32-bit memory size, and finally 88h, which
4748 -# the memory map from hell. e820h returns memory classified into
4749 -# a whole bunch of different types, and allows memory holes and
4750 -# everything. We scan through this memory map and build a list
4751 -# of the first 32 memory areas, which we return at [E820MAP].
4752 -# This is documented at http://www.acpi.info/, in the ACPI 2.0 specification.
4754 -#define SMAP 0x534d4150
4757 - xorl %ebx, %ebx # continuation counter
4758 - movw $E820MAP, %di # point into the whitelist
4759 - # so we can have the bios
4760 - # directly write into it.
4763 - movl $0x0000e820, %eax # e820, upper word zeroed
4764 - movl $SMAP, %edx # ascii 'SMAP'
4765 - movl $20, %ecx # size of the e820rec
4766 - pushw %ds # data record.
4768 - int $0x15 # make the call
4769 - jc bail820 # fall to e801 if it fails
4771 - cmpl $SMAP, %eax # check the return is `SMAP'
4772 - jne bail820 # fall to e801 if it fails
4774 -# cmpl $1, 16(%di) # is this usable memory?
4777 - # If this is usable memory, we save it by simply advancing %di by
4778 - # sizeof(e820rec).
4781 - movb (E820NR), %al # up to 128 entries
4782 - cmpb $E820MAX, %al
4790 - cmpl $0, %ebx # check to see if
4791 - jne jmpe820 # %ebx is set to EOF
4796 -# memory size is in 1k chunksizes, to avoid confusing loadlin.
4797 -# we store the 0xe801 memory size in a completely different place,
4798 -# because it will most likely be longer than 16 bits.
4799 -# (use 1e0 because that's what Larry Augustine uses in his
4800 -# alternative new memory detection scheme, and it's sensible
4801 -# to write everything into the same place.)
4804 - stc # fix to work around buggy
4805 - xorw %cx,%cx # BIOSes which don't clear/set
4806 - xorw %dx,%dx # carry on pass/error of
4807 - # e801h memory size call
4808 - # or merely pass cx,dx though
4809 - # without changing them.
4814 - cmpw $0x0, %cx # Kludge to handle BIOSes
4815 - jne e801usecxdx # which report their extended
4816 - cmpw $0x0, %dx # memory in AX/BX rather than
4817 - jne e801usecxdx # CX/DX. The spec I have read
4818 - movw %ax, %cx # seems to indicate AX/BX
4819 - movw %bx, %dx # are more reasonable anyway...
4822 - andl $0xffff, %edx # clear sign extend
4823 - shll $6, %edx # and go from 64k to 1k chunks
4824 - movl %edx, (0x1e0) # store extended memory size
4825 - andl $0xffff, %ecx # clear sign extend
4826 - addl %ecx, (0x1e0) # and add lower memory into
4829 -# Ye Olde Traditional Methode. Returns the memory size (up to 16mb or
4830 -# 64mb, depending on the bios) in ax.
4838 -# Set the keyboard repeat rate to the max
4843 -# Check for video adapter and its parameters and allow the
4844 -# user to browse video modes.
4845 - call video # NOTE: we need %ds pointing
4851 - ldsw (4 * 0x41), %si
4852 - movw %cs, %ax # aka SETUPSEG
4853 - subw $DELTA_INITSEG, %ax # aka INITSEG
4865 - ldsw (4 * 0x46), %si
4871 -# Check that there IS a hd1 :-)
4872 - movw $0x01500, %ax
4881 - movw %cs, %ax # aka SETUPSEG
4882 - subw $DELTA_INITSEG, %ax # aka INITSEG
4891 -# check for Micro Channel (MCA) bus
4892 - movw %cs, %ax # aka SETUPSEG
4893 - subw $DELTA_INITSEG, %ax # aka INITSEG
4896 - movw %ax, (0xa0) # set table length to 0
4899 - int $0x15 # moves feature table to es:bx
4905 - movw %cs, %ax # aka SETUPSEG
4906 - subw $DELTA_INITSEG, %ax # aka INITSEG
4911 - addw $2, %cx # table length is a short
4915 - movw $0x10, %cx # we keep only first 16 bytes
4921 -#ifdef CONFIG_X86_VOYAGER
4922 - movb $0xff, 0x40 # flag on config found
4925 - int $0x15 # put voyager config info at es:di
4927 - movw $0x40, %si # place voyager info in apm table
4931 - movb %es:(%di), %al
4939 -# Check for PS/2 pointing device
4940 - movw %cs, %ax # aka SETUPSEG
4941 - subw $DELTA_INITSEG, %ax # aka INITSEG
4943 - movb $0, (0x1ff) # default is no pointing device
4944 - int $0x11 # int 0x11: equipment list
4945 - testb $0x04, %al # check if mouse installed
4948 - movb $0xAA, (0x1ff) # device present
4951 -#if defined(CONFIG_X86_SPEEDSTEP_SMI) || defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
4952 - movl $0x0000E980, %eax # IST Support
4953 - movl $0x47534943, %edx # Request value
4962 -#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
4963 -# Then check for an APM BIOS...
4964 - # %ds points to the bootsector
4965 - movw $0, 0x40 # version = 0 means no APM BIOS
4966 - movw $0x05300, %ax # APM BIOS installation check
4969 - jc done_apm_bios # Nope, no APM BIOS
4971 - cmpw $0x0504d, %bx # Check for "PM" signature
4972 - jne done_apm_bios # No signature, no APM BIOS
4974 - andw $0x02, %cx # Is 32 bit supported?
4975 - je done_apm_bios # No 32-bit, no (good) APM BIOS
4977 - movw $0x05304, %ax # Disconnect first just in case
4979 - int $0x15 # ignore return code
4980 - movw $0x05303, %ax # 32 bit connect
4982 - xorw %cx, %cx # paranoia :-)
4983 - xorw %dx, %dx # ...
4984 - xorl %esi, %esi # ...
4985 - xorw %di, %di # ...
4987 - jc no_32_apm_bios # Ack, error.
4989 - movw %ax, (66) # BIOS code segment
4990 - movl %ebx, (68) # BIOS entry point offset
4991 - movw %cx, (72) # BIOS 16 bit code segment
4992 - movw %dx, (74) # BIOS data segment
4993 - movl %esi, (78) # BIOS code segment lengths
4994 - movw %di, (82) # BIOS data segment length
4995 -# Redo the installation check as the 32 bit connect
4996 -# modifies the flags returned on some BIOSs
4997 - movw $0x05300, %ax # APM BIOS installation check
4999 - xorw %cx, %cx # paranoia
5001 - jc apm_disconnect # error -> shouldn't happen
5003 - cmpw $0x0504d, %bx # check for "PM" signature
5004 - jne apm_disconnect # no sig -> shouldn't happen
5006 - movw %ax, (64) # record the APM BIOS version
5007 - movw %cx, (76) # and flags
5010 -apm_disconnect: # Tidy up
5011 - movw $0x05304, %ax # Disconnect
5013 - int $0x15 # ignore return code
5018 - andw $0xfffd, (76) # remove 32 bit support bit
5024 -# Now we want to move to protected mode ...
5025 - cmpw $0, %cs:realmode_swtch
5026 - jz rmodeswtch_normal
5028 - lcall *%cs:realmode_swtch
5030 - jmp rmodeswtch_end
5034 - call default_switch
5037 -# Now we move the system to its rightful place ... but we check if we have a
5038 -# big-kernel. In that case we *must* not move it ...
5039 - testb $LOADED_HIGH, %cs:loadflags
5040 - jz do_move0 # .. then we have a normal low
5042 - # .. or else we have a high
5044 - jmp end_move # ... and we skip moving
5047 - movw $0x100, %ax # start of destination segment
5048 - movw %cs, %bp # aka SETUPSEG
5049 - subw $DELTA_INITSEG, %bp # aka INITSEG
5050 - movw %cs:start_sys_seg, %bx # start of source segment
5053 - movw %ax, %es # destination segment
5054 - incb %ah # instead of add ax,#0x100
5055 - movw %bx, %ds # source segment
5062 - cmpw %bp, %bx # assume start_sys_seg > 0x200,
5063 - # so we will perhaps read one
5064 - # page more than needed, but
5065 - # never overwrite INITSEG
5066 - # because destination is a
5067 - # minimum one page below source
5071 -# then we load the segment descriptors
5072 - movw %cs, %ax # aka SETUPSEG
5075 -# Check whether we need to be downward compatible with version <=201
5076 - cmpl $0, cmd_line_ptr
5077 - jne end_move_self # loader uses version >=202 features
5078 - cmpb $0x20, type_of_loader
5079 - je end_move_self # bootsect loader, we know of it
5081 -# Boot loader doesnt support boot protocol version 2.02.
5082 -# If we have our code not at 0x90000, we need to move it there now.
5083 -# We also then need to move the params behind it (commandline)
5084 -# Because we would overwrite the code on the current IP, we move
5085 -# it in two steps, jumping high after the first one.
5087 - cmpw $SETUPSEG, %ax
5090 - cli # make sure we really have
5091 - # interrupts disabled !
5092 - # because after this the stack
5093 - # should not be used
5094 - subw $DELTA_INITSEG, %ax # aka INITSEG
5099 - addw $INITSEG, %dx
5100 - subw %ax, %dx # this will go into %ss after
5104 - movw $INITSEG, %ax # real INITSEG
5106 - movw %cs:setup_move_size, %cx
5107 - std # we have to move up, so we use
5108 - # direction down because the
5109 - # areas may overlap
5113 - subw $move_self_here+0x200, %cx
5116 - ljmp $SETUPSEG, $move_self_here
5119 - movw $move_self_here+0x200, %cx
5122 - movw $SETUPSEG, %ax
5125 -end_move_self: # now we are at the right place
5128 -# Enable A20. This is at the very best an annoying procedure.
5129 -# A20 code ported from SYSLINUX 1.52-1.63 by H. Peter Anvin.
5130 -# AMD Elan bug fix by Robert Schwebel.
5133 -#if defined(CONFIG_X86_ELAN)
5134 - movb $0x02, %al # alternate A20 gate
5135 - outb %al, $0x92 # this works on SC410/SC520
5143 -A20_TEST_LOOPS = 32 # Iterations per wait
5144 -A20_ENABLE_LOOPS = 255 # Total loops to try
5147 -#ifndef CONFIG_X86_VOYAGER
5150 - # First, see if we are on a system with no A20 gate.
5155 - # Next, try the BIOS (INT 0x15, AX=0x2401)
5158 - pushfl # Be paranoid about flags
5165 - # Try enabling A20 through the keyboard controller
5166 -#endif /* CONFIG_X86_VOYAGER */
5170 -#ifndef CONFIG_X86_VOYAGER
5171 - call a20_test # Just in case the BIOS worked
5172 - jnz a20_done # but had a delayed reaction.
5175 - movb $0xD1, %al # command write
5179 - movb $0xDF, %al # A20 on
5183 -#ifndef CONFIG_X86_VOYAGER
5184 - # Wait until a20 really *is* enabled; it can take a fair amount of
5185 - # time on certain systems; Toshiba Tecras are known to have this
5192 - loop a20_kbc_wait_loop
5194 - # Final attempt: use "configuration port A"
5196 - inb $0x92, %al # Configuration Port A
5197 - orb $0x02, %al # "fast A20" version
5198 - andb $0xFE, %al # don't accidentally reset
5201 - # Wait for configuration port A to take effect
5204 -a20_fast_wait_loop:
5207 - loop a20_fast_wait_loop
5209 - # A20 is still not responding. Try frobbing it again.
5214 - movw $a20_err_msg, %si
5222 - .byte A20_ENABLE_LOOPS
5225 - .ascii "linux: fatal error: A20 gate not responding!"
5228 - # If we get here, all is good
5231 -#endif /* CONFIG_X86_VOYAGER */
5232 -# set up gdt and idt and 32bit start address
5233 - lidt idt_48 # load idt with 0,0
5234 - xorl %eax, %eax # Compute gdt_base
5235 - movw %ds, %ax # (Convert %ds:gdt to a linear ptr)
5239 - movl %eax, (gdt_48+2)
5240 - lgdt gdt_48 # load gdt with whatever is
5243 -# make sure any possible coprocessor is properly reset..
5251 -# well, that went ok, I hope. Now we mask all interrupts - the rest
5252 -# is done in init_IRQ().
5253 - movb $0xFF, %al # mask all interrupts for now
5257 - movb $0xFB, %al # mask all irq's but irq2 which
5258 - outb %al, $0x21 # is cascaded
5260 -# Well, that certainly wasn't fun :-(. Hopefully it works, and we don't
5261 -# need no steenking BIOS anyway (except for the initial loading :-).
5262 -# The BIOS-routine wants lots of unnecessary data, and it's less
5263 -# "interesting" anyway. This is how REAL programmers do it.
5265 -# Well, now's the time to actually move into protected mode. To make
5266 -# things as simple as possible, we do no register set-up or anything,
5267 -# we let the gnu-compiled 32-bit programs do that. We just jump to
5268 -# absolute address 0x1000 (or the loader supplied one),
5269 -# in 32-bit protected mode.
5271 -# Note that the short jump isn't strictly needed, although there are
5272 -# reasons why it might be a good idea. It won't hurt in any case.
5273 - movw $1, %ax # protected mode (PE) bit
5274 - lmsw %ax # This is it!
5278 - xorw %bx, %bx # Flag to indicate a boot
5279 - xorl %esi, %esi # Pointer to real-mode code
5281 - subw $DELTA_INITSEG, %si
5282 - shll $4, %esi # Convert to 32-bit pointer
5284 -# jump to startup_32 in arch/i386/boot/compressed/head.S
5286 -# NOTE: For high loaded big kernels we need a
5287 -# jmpi 0x100000,__BOOT_CS
5289 -# but we yet haven't reloaded the CS register, so the default size
5290 -# of the target offset still is 16 bit.
5291 -# However, using an operand prefix (0x66), the CPU will properly
5292 -# take our 48 bit far pointer. (INTeL 80386 Programmer's Reference
5293 -# Manual, Mixing 16-bit and 32-bit code, page 16-6)
5295 - .byte 0x66, 0xea # prefix + jmpi-opcode
5296 -code32: .long startup_32 # will be set to %cs+startup_32
5300 - movl $(__BOOT_DS), %eax
5308 -1: incl %eax # check that A20 really IS enabled
5309 - movl %eax, 0x00000000 # loop forever if it isn't
5310 - cmpl %eax, 0x00100000
5313 - # Jump to the 32bit entry point
5314 - jmpl *(code32_start - start + (DELTA_INITSEG << 4))(%esi)
5317 -# Here's a bunch of information about your current kernel..
5318 -kernel_version: .ascii UTS_RELEASE
5320 - .ascii LINUX_COMPILE_BY
5322 - .ascii LINUX_COMPILE_HOST
5324 - .ascii UTS_VERSION
5327 -# This is the default real mode switch routine.
5328 -# to be called just before protected mode transition
5330 - cli # no interrupts allowed !
5331 - movb $0x80, %al # disable NMI for bootup
5337 -#ifndef CONFIG_X86_VOYAGER
5338 -# This routine tests whether or not A20 is enabled. If so, it
5339 -# exits with zf = 0.
5341 -# The memory address used, 0x200, is the int $0x80 vector, which
5344 -A20_TEST_ADDR = 4*0x80
5350 - movw %cx, %fs # Low memory
5352 - movw %cx, %gs # High memory area
5353 - movw $A20_TEST_LOOPS, %cx
5354 - movw %fs:(A20_TEST_ADDR), %ax
5358 - movw %ax, %fs:(A20_TEST_ADDR)
5359 - call delay # Serialize and make delay constant
5360 - cmpw %gs:(A20_TEST_ADDR+0x10), %ax
5361 - loope a20_test_wait
5363 - popw %fs:(A20_TEST_ADDR)
5368 -#endif /* CONFIG_X86_VOYAGER */
5370 -# This routine checks that the keyboard command queue is empty
5371 -# (after emptying the output buffers)
5373 -# Some machines have delusions that the keyboard buffer is always full
5374 -# with no keyboard attached...
5376 -# If there is no keyboard controller, we will usually get 0xff
5377 -# to all the reads. With each IO taking a microsecond and
5378 -# a timeout of 100,000 iterations, this can take about half a
5379 -# second ("delay" == outb to port 0x80). That should be ok,
5380 -# and should also be plenty of time for a real keyboard controller
5386 - movl $100000, %ecx
5390 - jz empty_8042_end_loop
5394 - inb $0x64, %al # 8042 status port
5395 - testb $1, %al # output buffer?
5399 - inb $0x60, %al # read it
5400 - jmp empty_8042_loop
5403 - testb $2, %al # is input buffer full?
5404 - jnz empty_8042_loop # yes - loop
5405 -empty_8042_end_loop:
5409 -# Read the cmos clock. Return the seconds in al
5414 - movb %dh, %al # %dh contains the seconds
5423 -# Delay is needed after doing I/O
5428 -# Descriptor tables
5430 -# NOTE: The intel manual says gdt should be sixteen bytes aligned for
5431 -# efficiency reasons. However, there are machines which are known not
5432 -# to boot with misaligned GDTs, so alter this at your peril! If you alter
5433 -# GDT_ENTRY_BOOT_CS (in asm/segment.h) remember to leave at least two
5434 -# empty GDT entries (one for NULL and one reserved).
5436 -# NOTE: On some CPUs, the GDT must be 8 byte aligned. This is
5437 -# true for the Voyager Quad CPU card which will not boot without
5438 -# This directive. 16 byte aligment is recommended by intel.
5442 - .fill GDT_ENTRY_BOOT_CS,8,0
5444 - .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
5445 - .word 0 # base address = 0
5446 - .word 0x9A00 # code read/exec
5447 - .word 0x00CF # granularity = 4096, 386
5448 - # (+5th nibble of limit)
5450 - .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
5451 - .word 0 # base address = 0
5452 - .word 0x9200 # data read/write
5453 - .word 0x00CF # granularity = 4096, 386
5454 - # (+5th nibble of limit)
5458 - .word 0 # alignment byte
5460 - .word 0 # idt limit = 0
5461 - .word 0, 0 # idt base = 0L
5463 - .word 0 # alignment byte
5465 - .word gdt_end - gdt - 1 # gdt limit
5466 - .word 0, 0 # gdt base (filled in later)
5468 -# Include video setup & detection code
5472 -# Setup signature -- must be last
5473 -setup_sig1: .word SIG1
5474 -setup_sig2: .word SIG2
5476 -# After this point, there is some free space which is used by the video mode
5477 -# handling code to store the temporary mode table (not used by the kernel).
5487 diff -puN /dev/null arch/i386/boot/setup.ld
5489 +++ a/arch/i386/boot/setup.ld
5494 + * Linker script for the i386 setup code
5496 +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
5503 + .bstext : { *(.bstext) }
5504 + .bsdata : { *(.bsdata) }
5507 + .header : { *(.header) }
5508 + .inittext : { *(.inittext) }
5509 + .initdata : { *(.initdata) }
5510 + .text : { *(.text*) }
5513 + .rodata : { *(.rodata*) }
5518 + video_cards_end = .;
5522 + .data : { *(.data*) }
5540 + /DISCARD/ : { *(.note*) }
5542 + . = ASSERT(_end <= 0x8000, "Setup too big!");
5543 + . = ASSERT(hdr == 0x1f1, "The setup header has the wrong offset!");
5545 diff -puN /dev/null arch/i386/boot/string.c
5547 +++ a/arch/i386/boot/string.c
5549 +/* -*- linux-c -*- ------------------------------------------------------- *
5551 + * Copyright (C) 1991, 1992 Linus Torvalds
5552 + * Copyright 2007 rPath, Inc. - All Rights Reserved
5554 + * This file is part of the Linux kernel, and is made available under
5555 + * the terms of the GNU General Public License version 2.
5557 + * ----------------------------------------------------------------------- */
5560 + * arch/i386/boot/string.c
5562 + * Very basic string functions
5566 +#include <linux/edd.h>
5568 +int strcmp(const char *str1, const char *str2)
5570 + const unsigned char *s1 = (const unsigned char *)str1;
5571 + const unsigned char *s2 = (const unsigned char *)str2;
5574 + while (*s1 || *s2) {
5575 + delta = *s2 - *s1;
5583 diff -puN arch/i386/boot/tools/build.c~git-newsetup arch/i386/boot/tools/build.c
5584 --- a/arch/i386/boot/tools/build.c~git-newsetup
5585 +++ a/arch/i386/boot/tools/build.c
5588 * Copyright (C) 1991, 1992 Linus Torvalds
5589 * Copyright (C) 1997 Martin Mares
5590 + * Copyright (C) 2007 H. Peter Anvin
5594 * This file builds a disk-image from three different files:
5596 - * - bootsect: compatibility mbr which prints an error message if
5597 - * someone tries to boot the kernel directly.
5598 * - setup: 8086 machine code, sets up system parm
5599 * - system: 80386 code for actual system
5602 * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
5603 * Cross compiling fixes by Gertjan van Wingerde, July 1996
5604 * Rewritten by Martin Mares, April 1997
5605 + * Substantially overhauled by H. Peter Anvin, April 2007
5610 #include <sys/sysmacros.h>
5613 +#include <sys/mman.h>
5614 #include <asm/boot.h>
5616 -typedef unsigned char byte;
5617 -typedef unsigned short word;
5618 -typedef unsigned long u32;
5619 +typedef unsigned char u8;
5620 +typedef unsigned short u16;
5621 +typedef unsigned long u32;
5623 #define DEFAULT_MAJOR_ROOT 0
5624 #define DEFAULT_MINOR_ROOT 0
5626 -/* Minimal number of setup sectors (see also bootsect.S) */
5627 -#define SETUP_SECTS 4
5628 +/* Minimal number of setup sectors */
5629 +#define SETUP_SECT_MIN 5
5630 +#define SETUP_SECT_MAX 64
5634 +/* This must be large enough to hold the entire setup */
5635 +u8 buf[SETUP_SECT_MAX*512];
5638 -void die(const char * str, ...)
5639 +static void die(const char * str, ...)
5642 va_start(args, str);
5643 @@ -57,15 +59,9 @@ void die(const char * str, ...)
5647 -void file_open(const char *name)
5648 +static void usage(void)
5650 - if ((fd = open(name, O_RDONLY, 0)) < 0)
5651 - die("Unable to open `%s': %m", name);
5656 - die("Usage: build [-b] bootsect setup system [rootdev] [> image]");
5657 + die("Usage: build [-b] setup system [rootdev] [> image]");
5660 int main(int argc, char ** argv)
5661 @@ -73,27 +69,30 @@ int main(int argc, char ** argv)
5662 unsigned int i, sz, setup_sectors;
5665 - byte major_root, minor_root;
5666 + u8 major_root, minor_root;
5672 if (argc > 2 && !strcmp(argv[1], "-b"))
5677 - if ((argc < 4) || (argc > 5))
5678 + if ((argc < 3) || (argc > 4))
5681 - if (!strcmp(argv[4], "CURRENT")) {
5683 + if (!strcmp(argv[3], "CURRENT")) {
5684 if (stat("/", &sb)) {
5686 die("Couldn't stat /");
5688 major_root = major(sb.st_dev);
5689 minor_root = minor(sb.st_dev);
5690 - } else if (strcmp(argv[4], "FLOPPY")) {
5691 - if (stat(argv[4], &sb)) {
5693 + } else if (strcmp(argv[3], "FLOPPY")) {
5694 + if (stat(argv[3], &sb)) {
5696 die("Couldn't stat root device.");
5698 major_root = major(sb.st_rdev);
5699 @@ -108,79 +107,62 @@ int main(int argc, char ** argv)
5701 fprintf(stderr, "Root device is (%d, %d)\n", major_root, minor_root);
5703 - file_open(argv[1]);
5704 - i = read(fd, buf, sizeof(buf));
5705 - fprintf(stderr,"Boot sector %d bytes.\n",i);
5707 - die("Boot block must be exactly 512 bytes");
5708 + /* Copy the setup code */
5709 + file = fopen(argv[1], "r");
5711 + die("Unable to open `%s': %m", argv[1]);
5712 + c = fread(buf, 1, sizeof(buf), file);
5714 + die("read-error on `setup'");
5716 + die("The setup must be at least 1024 bytes");
5717 if (buf[510] != 0x55 || buf[511] != 0xaa)
5718 die("Boot block hasn't got boot flag (0xAA55)");
5721 + /* Pad unused space with zeros */
5722 + setup_sectors = (c + 511) / 512;
5723 + if (setup_sectors < SETUP_SECT_MIN)
5724 + setup_sectors = SETUP_SECT_MIN;
5725 + i = setup_sectors*512;
5726 + memset(buf+c, 0, i-c);
5728 + /* Set the default root device */
5729 buf[508] = minor_root;
5730 buf[509] = major_root;
5731 - if (write(1, buf, 512) != 512)
5732 - die("Write call failed");
5735 - file_open(argv[2]); /* Copy the setup code */
5736 - for (i=0 ; (c=read(fd, buf, sizeof(buf)))>0 ; i+=c )
5737 - if (write(1, buf, c) != c)
5738 - die("Write call failed");
5740 - die("read-error on `setup'");
5743 - setup_sectors = (i + 511) / 512; /* Pad unused space with zeros */
5744 - /* for compatibility with ancient versions of LILO. */
5745 - if (setup_sectors < SETUP_SECTS)
5746 - setup_sectors = SETUP_SECTS;
5747 - fprintf(stderr, "Setup is %d bytes.\n", i);
5748 - memset(buf, 0, sizeof(buf));
5749 - while (i < setup_sectors * 512) {
5750 - c = setup_sectors * 512 - i;
5751 - if (c > sizeof(buf))
5753 - if (write(1, buf, c) != c)
5754 - die("Write call failed");
5757 + fprintf(stderr, "Setup is %d bytes (padded to %d bytes).\n", c, i);
5759 - file_open(argv[3]);
5760 - if (fstat (fd, &sb))
5761 - die("Unable to stat `%s': %m", argv[3]);
5762 + /* Open and stat the kernel file */
5763 + fd = open(argv[2], O_RDONLY);
5765 + die("Unable to open `%s': %m", argv[2]);
5766 + if (fstat(fd, &sb))
5767 + die("Unable to stat `%s': %m", argv[2]);
5769 - fprintf (stderr, "System is %d kB\n", sz/1024);
5770 + fprintf (stderr, "System is %d kB\n", (sz+1023)/1024);
5771 + kernel = mmap(NULL, sz, PROT_READ, MAP_SHARED, fd, 0);
5772 + if (kernel == MAP_FAILED)
5773 + die("Unable to mmap '%s': %m", argv[2]);
5774 sys_size = (sz + 15) / 16;
5775 if (!is_big_kernel && sys_size > DEF_SYSSIZE)
5776 die("System is too big. Try using bzImage or modules.");
5780 - l = (sz > sizeof(buf)) ? sizeof(buf) : sz;
5781 - if ((n=read(fd, buf, l)) != l) {
5783 - die("Error reading %s: %m", argv[3]);
5785 - die("%s: Unexpected EOF", argv[3]);
5787 - if (write(1, buf, l) != l)
5788 - die("Write failed");
5791 + /* Patch the setup code with the appropriate size parameters */
5792 + buf[0x1f1] = setup_sectors-1;
5793 + buf[0x1f4] = sys_size;
5794 + buf[0x1f5] = sys_size >> 8;
5795 + buf[0x1f6] = sys_size >> 16;
5796 + buf[0x1f7] = sys_size >> 24;
5798 + if (fwrite(buf, 1, i, stdout) != i)
5799 + die("Writing setup failed");
5801 + /* Copy the kernel code */
5802 + if (fwrite(kernel, 1, sz, stdout) != sz)
5803 + die("Writing kernel failed");
5806 - if (lseek(1, 497, SEEK_SET) != 497) /* Write sizes to the bootsector */
5807 - die("Output: seek failed");
5808 - buf[0] = setup_sectors;
5809 - if (write(1, buf, 1) != 1)
5810 - die("Write of setup sector count failed");
5811 - if (lseek(1, 500, SEEK_SET) != 500)
5812 - die("Output: seek failed");
5813 - buf[0] = (sys_size & 0xff);
5814 - buf[1] = ((sys_size >> 8) & 0xff);
5815 - buf[2] = ((sys_size >> 16) & 0xff);
5816 - buf[3] = ((sys_size >> 24) & 0xff);
5817 - if (write(1, buf, 4) != 4)
5818 - die("Write of image length failed");
5820 - return 0; /* Everything is OK */
5821 + /* Everything is OK */
5824 diff -puN /dev/null arch/i386/boot/tty.c
5826 +++ a/arch/i386/boot/tty.c
5828 +/* -*- linux-c -*- ------------------------------------------------------- *
5830 + * Copyright (C) 1991, 1992 Linus Torvalds
5831 + * Copyright 2007 rPath, Inc. - All Rights Reserved
5833 + * This file is part of the Linux kernel, and is made available under
5834 + * the terms of the GNU General Public License version 2.
5836 + * ----------------------------------------------------------------------- */
5839 + * arch/i386/boot/tty.c
5841 + * Very simple screen I/O
5842 + * XXX: Probably should add very simple serial I/O?
5848 + * These functions are in .inittext so they can be used to signal
5849 + * error during initialization.
5852 +void __attribute__((section(".inittext"))) putchar(int ch)
5854 + unsigned char c = ch;
5857 + putchar('\r'); /* \n -> \r\n */
5859 + /* int $0x10 is known to have bugs involving touching registers
5860 + it shouldn't. Be extra conservative... */
5861 + asm volatile("pushal; int $0x10; popal"
5862 + : : "b" (0x0007), "c" (0x0001), "a" (0x0e00|ch));
5865 +void __attribute__((section(".inittext"))) puts(const char *str)
5875 + * Read the CMOS clock through the BIOS, and return the
5879 +static u8 gettime(void)
5885 + : "+a" (ax), "=c" (cx), "=d" (dx)
5886 + : : "ebx", "esi", "edi");
5892 + * Read from the keyboard
5897 + asm("int $0x16" : "+a" (ax));
5902 +static int kbd_pending(void)
5905 + asm("int $0x16; setnz %0"
5911 +void kbd_flush(void)
5914 + if (!kbd_pending())
5920 +int getchar_timeout(void)
5928 + if (kbd_pending())
5938 + return 0; /* Timeout! */
5940 diff -puN /dev/null arch/i386/boot/version.c
5942 +++ a/arch/i386/boot/version.c
5944 +/* -*- linux-c -*- ------------------------------------------------------- *
5946 + * Copyright (C) 1991, 1992 Linus Torvalds
5947 + * Copyright 2007 rPath, Inc. - All Rights Reserved
5949 + * This file is part of the Linux kernel, and is made available under
5950 + * the terms of the GNU General Public License version 2.
5952 + * ----------------------------------------------------------------------- */
5955 + * arch/i386/boot/version.c
5957 + * Kernel version string
5961 +#include <linux/utsrelease.h>
5962 +#include <linux/compile.h>
5964 +const char kernel_version[] =
5965 + UTS_RELEASE " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") "
5967 diff -puN /dev/null arch/i386/boot/vesa.h
5969 +++ a/arch/i386/boot/vesa.h
5971 +/* ----------------------------------------------------------------------- *
5973 + * Copyright 1999-2007 H. Peter Anvin - All Rights Reserved
5975 + * This program is free software; you can redistribute it and/or modify
5976 + * it under the terms of the GNU General Public License as published by
5977 + * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
5978 + * Boston MA 02111-1307, USA; either version 2 of the License, or
5979 + * (at your option) any later version; incorporated herein by reference.
5981 + * ----------------------------------------------------------------------- */
5983 +#ifndef BOOT_VESA_H
5984 +#define BOOT_VESA_H
5990 +/* VESA General Information table */
5991 +struct vesa_general_info {
5992 + u32 signature; /* 0 Magic number = "VESA" */
5993 + u16 version; /* 4 */
5994 + far_ptr vendor_string; /* 6 */
5995 + u32 capabilities; /* 10 */
5996 + far_ptr video_mode_ptr; /* 14 */
5997 + u16 total_memory; /* 18 */
5999 + u16 oem_software_rev; /* 20 */
6000 + far_ptr oem_vendor_name_ptr; /* 22 */
6001 + far_ptr oem_product_name_ptr; /* 26 */
6002 + far_ptr oem_product_rev_ptr; /* 30 */
6004 + u8 reserved[222]; /* 34 */
6005 + u8 oem_data[256]; /* 256 */
6006 +} __attribute__((packed));
6008 +#define VESA_MAGIC ('V' + ('E' << 8) + ('S' << 16) + ('A' << 24))
6009 +#define VBE2_MAGIC ('V' + ('B' << 8) + ('E' << 16) + ('2' << 24))
6011 +struct vesa_mode_info {
6012 + u16 mode_attr; /* 0 */
6013 + u8 win_attr[2]; /* 2 */
6014 + u16 win_grain; /* 4 */
6015 + u16 win_size; /* 6 */
6016 + u16 win_seg[2]; /* 8 */
6017 + far_ptr win_scheme; /* 12 */
6018 + u16 logical_scan; /* 16 */
6020 + u16 h_res; /* 18 */
6021 + u16 v_res; /* 20 */
6022 + u8 char_width; /* 22 */
6023 + u8 char_height; /* 23 */
6024 + u8 memory_planes; /* 24 */
6026 + u8 banks; /* 26 */
6027 + u8 memory_layout; /* 27 */
6028 + u8 bank_size; /* 28 */
6029 + u8 image_planes; /* 29 */
6030 + u8 page_function; /* 30 */
6032 + u8 rmask; /* 31 */
6034 + u8 gmask; /* 33 */
6036 + u8 bmask; /* 35 */
6038 + u8 resv_mask; /* 37 */
6039 + u8 resv_pos; /* 38 */
6040 + u8 dcm_info; /* 39 */
6042 + u32 lfb_ptr; /* 40 Linear frame buffer address */
6043 + u32 offscreen_ptr; /* 44 Offscreen memory address */
6044 + u16 offscreen_size; /* 48 */
6046 + u8 reserved[206]; /* 50 */
6047 +} __attribute__((packed));
6049 +#endif /* LIB_SYS_VESA_H */
6050 diff -puN /dev/null arch/i386/boot/video-bios.c
6052 +++ a/arch/i386/boot/video-bios.c
6054 +/* -*- linux-c -*- ------------------------------------------------------- *
6056 + * Copyright (C) 1991, 1992 Linus Torvalds
6057 + * Copyright 2007 rPath, Inc. - All Rights Reserved
6059 + * This file is part of the Linux kernel, and is made available under
6060 + * the terms of the GNU General Public License version 2.
6062 + * ----------------------------------------------------------------------- */
6065 + * arch/i386/boot/video-bios.c
6067 + * Standard video BIOS modes
6069 + * We have two options for this; silent and scanned.
6075 +__videocard video_bios;
6077 +/* Set a conventional BIOS mode */
6078 +static int set_bios_mode(u8 mode);
6080 +static int bios_set_mode(struct mode_info *mi)
6082 + return set_bios_mode(mi->mode - VIDEO_FIRST_BIOS);
6085 +static int set_bios_mode(u8 mode)
6090 + ax = mode; /* AH=0x00 Set Video Mode */
6091 + asm volatile(INT10
6093 + : : "ebx", "ecx", "edx", "esi", "edi");
6095 + ax = 0x0f00; /* Get Current Video Mode */
6096 + asm volatile(INT10
6098 + : : "ebx", "ecx", "edx", "esi", "edi");
6100 + do_restore = 1; /* Assume video contents was lost */
6101 + new_mode = ax & 0x7f; /* Not all BIOSes are clean with the top bit */
6103 + if (new_mode == mode)
6104 + return 0; /* Mode change OK */
6106 + if (new_mode != boot_params.screen_info.orig_video_mode) {
6107 + /* Mode setting failed, but we didn't end up where we
6108 + started. That's bad. Try to revert to the original
6110 + ax = boot_params.screen_info.orig_video_mode;
6111 + asm volatile(INT10
6113 + : : "ebx", "ecx", "edx", "esi", "edi");
6118 +static int bios_probe(void)
6121 + u8 saved_mode = boot_params.screen_info.orig_video_mode;
6123 + struct mode_info *mi;
6126 + if (adapter != ADAPTER_EGA && adapter != ADAPTER_VGA)
6130 + crtc = vga_crtc();
6132 + video_bios.modes = GET_HEAP(struct mode_info, 0);
6134 + for (mode = 0x14; mode <= 0x7f; mode++) {
6135 + if (heap_free() < sizeof(struct mode_info))
6138 + if (mode_defined(VIDEO_FIRST_BIOS+mode))
6141 + if (set_bios_mode(mode))
6144 + /* Try to verify that it's a text mode. */
6146 + /* Attribute Controller: make graphics controller disabled */
6147 + if (in_idx(0x3c0, 0x10) & 0x01)
6150 + /* Graphics Controller: verify Alpha addressing enabled */
6151 + if (in_idx(0x3ce, 0x06) & 0x01)
6154 + /* CRTC cursor location low should be zero(?) */
6155 + if (in_idx(crtc, 0x0f))
6158 + mi = GET_HEAP(struct mode_info, 1);
6159 + mi->mode = VIDEO_FIRST_BIOS+mode;
6160 + mi->x = rdfs16(0x44a);
6161 + mi->y = rdfs8(0x484)+1;
6165 + set_bios_mode(saved_mode);
6170 +__videocard video_bios =
6172 + .card_name = "BIOS (scanned)",
6173 + .probe = bios_probe,
6174 + .set_mode = bios_set_mode,
6176 + .xmode_first = VIDEO_FIRST_BIOS,
6179 diff -puN /dev/null arch/i386/boot/video-vesa.c
6181 +++ a/arch/i386/boot/video-vesa.c
6183 +/* -*- linux-c -*- ------------------------------------------------------- *
6185 + * Copyright (C) 1991, 1992 Linus Torvalds
6186 + * Copyright 2007 rPath, Inc. - All Rights Reserved
6188 + * This file is part of the Linux kernel, and is made available under
6189 + * the terms of the GNU General Public License version 2.
6191 + * ----------------------------------------------------------------------- */
6194 + * arch/i386/boot/video-vesa.c
6203 +/* VESA information */
6204 +static struct vesa_general_info vginfo;
6205 +static struct vesa_mode_info vminfo;
6207 +__videocard video_vesa;
6209 +static void vesa_store_mode_params_graphics(void);
6211 +static int vesa_probe(void)
6213 +#ifdef CONFIG_VIDEO_VESA
6217 + struct mode_info *mi;
6220 + video_vesa.modes = GET_HEAP(struct mode_info, 0);
6222 + vginfo.signature = VBE2_MAGIC;
6224 + /* Optimistically assume a VESA BIOS is register-clean... */
6226 + asm("int $0x10" : "+a" (ax), "=m" (vginfo) : "D" (&vginfo));
6228 + if (ax != 0x004f ||
6229 + vginfo.signature != VESA_MAGIC ||
6230 + vginfo.version < 0x0102)
6231 + return 0; /* Not present */
6233 + set_fs(vginfo.video_mode_ptr.seg);
6234 + mode_ptr = vginfo.video_mode_ptr.off;
6236 + while ((mode = rdfs16(mode_ptr)) != 0xffff) {
6239 + if (heap_free() < sizeof(struct mode_info))
6240 + break; /* Heap full, can't save mode info */
6242 + if (mode & ~0x1ff)
6245 + memset(&vminfo, 0, sizeof vminfo); /* Just in case... */
6249 + : "+a" (ax), "=m" (vminfo)
6250 + : "c" (mode), "D" (&vminfo));
6255 + if ((vminfo.mode_attr & 0x15) == 0x05) {
6256 + /* Text Mode, TTY BIOS supported,
6257 + supported by hardware */
6258 + mi = GET_HEAP(struct mode_info, 1);
6259 + mi->mode = mode + VIDEO_FIRST_VESA;
6260 + mi->x = vminfo.h_res;
6261 + mi->y = vminfo.v_res;
6263 + } else if ((vminfo.mode_attr & 0x99) == 0x99) {
6265 + /* Graphics mode, color, linear frame buffer
6266 + supported -- register the mode but hide from
6267 + the menu. Only do this if framebuffer is
6268 + configured, however, otherwise the user will
6269 + be left without a screen. */
6270 + mi = GET_HEAP(struct mode_info, 1);
6271 + mi->mode = mode + VIDEO_FIRST_VESA;
6272 + mi->x = mi->y = 0;
6284 +static int vesa_set_mode(struct mode_info *mode)
6288 + u16 vesa_mode = mode->mode - VIDEO_FIRST_VESA;
6290 + memset(&vminfo, 0, sizeof vminfo); /* Just in case... */
6294 + : "+a" (ax), "=m" (vminfo)
6295 + : "c" (vesa_mode), "D" (&vminfo));
6300 + if ((vminfo.mode_attr & 0x15) == 0x05) {
6301 + /* It's a supported text mode */
6303 + } else if ((vminfo.mode_attr & 0x99) == 0x99) {
6304 + /* It's a graphics mode with linear frame buffer */
6306 + vesa_mode |= 0x4000; /* Request linear frame buffer */
6308 + return -1; /* Invalid mode */
6313 + asm volatile("int $0x10"
6315 + : "b" (vesa_mode), "D" (0));
6320 + graphic_mode = is_graphic;
6321 + if (!is_graphic) {
6323 + force_x = mode->x;
6324 + force_y = mode->y;
6327 + /* Graphics mode */
6328 + vesa_store_mode_params_graphics();
6335 +/* Switch DAC to 8-bit mode */
6336 +static void vesa_dac_set_8bits(void)
6340 + /* If possible, switch the DAC to 8-bit mode */
6341 + if (vginfo.capabilities & 1) {
6346 + asm volatile(INT10
6347 + : "+a" (ax), "+b" (bx)
6348 + : : "ecx", "edx", "esi", "edi");
6351 + dac_size = bx >> 8;
6354 + /* Set the color sizes to the DAC size, and offsets to 0 */
6355 + boot_params.screen_info.red_size = dac_size;
6356 + boot_params.screen_info.green_size = dac_size;
6357 + boot_params.screen_info.blue_size = dac_size;
6358 + boot_params.screen_info.rsvd_size = dac_size;
6360 + boot_params.screen_info.red_pos = 0;
6361 + boot_params.screen_info.green_pos = 0;
6362 + boot_params.screen_info.blue_pos = 0;
6363 + boot_params.screen_info.rsvd_pos = 0;
6366 +/* Save the VESA protected mode info */
6367 +static void vesa_store_pm_info(void)
6369 + u16 ax, bx, di, es;
6373 + asm("pushw %%es; "INT10"; movw %%es,%0; popw %%es"
6374 + : "=d" (es), "+a" (ax), "+b" (bx), "+D" (di)
6375 + : : "ecx", "esi");
6380 + boot_params.screen_info.vesapm_seg = es;
6381 + boot_params.screen_info.vesapm_off = di;
6385 + * Save video mode parameters for graphics mode
6387 +static void vesa_store_mode_params_graphics(void)
6389 + /* Tell the kernel we're in VESA graphics mode */
6390 + boot_params.screen_info.orig_video_isVGA = 0x23;
6392 + /* Mode parameters */
6393 + boot_params.screen_info.vesa_attributes = vminfo.mode_attr;
6394 + boot_params.screen_info.lfb_linelength = vminfo.logical_scan;
6395 + boot_params.screen_info.lfb_width = vminfo.h_res;
6396 + boot_params.screen_info.lfb_height = vminfo.v_res;
6397 + boot_params.screen_info.lfb_depth = vminfo.bpp;
6398 + boot_params.screen_info.pages = vminfo.image_planes;
6399 + boot_params.screen_info.lfb_base = vminfo.lfb_ptr;
6400 + memcpy(&boot_params.screen_info.red_size,
6401 + &vminfo.rmask, 8);
6403 + /* General parameters */
6404 + boot_params.screen_info.lfb_size = vginfo.total_memory;
6406 + if (vminfo.bpp <= 8)
6407 + vesa_dac_set_8bits();
6409 + vesa_store_pm_info();
6413 + * Save EDID information for the kernel; this is invoked, separately,
6414 + * after mode-setting.
6416 +void vesa_store_edid(void)
6418 +#ifdef CONFIG_FIRMWARE_EDID
6419 + u16 ax, bx, cx, dx, di;
6421 + /* Apparently used as a nonsense token... */
6422 + memset(&boot_params.edid_info, 0x13, sizeof boot_params.edid_info);
6424 + if (vginfo.version < 0x0200)
6425 + return; /* EDID requires VBE 2.0+ */
6427 + ax = 0x4f15; /* VBE DDC */
6428 + bx = 0x0000; /* Report DDC capabilities */
6429 + cx = 0; /* Controller 0 */
6430 + di = 0; /* ES:DI must be 0 by spec */
6432 + /* Note: The VBE DDC spec is different from the main VESA spec;
6433 + we genuinely have to assume all registers are destroyed here. */
6435 + asm("pushw %%es; movw %2,%%es; "INT10"; popw %%es"
6436 + : "+a" (ax), "+b" (bx)
6437 + : "c" (cx), "D" (di)
6441 + return; /* No EDID */
6443 + /* BH = time in seconds to transfer EDD information */
6444 + /* BL = DDC level supported */
6446 + ax = 0x4f15; /* VBE DDC */
6447 + bx = 0x0001; /* Read EDID */
6448 + cx = 0; /* Controller 0 */
6449 + dx = 0; /* EDID block number */
6450 + di =(size_t) &boot_params.edid_info; /* (ES:)Pointer to block */
6452 + : "+a" (ax), "+b" (bx), "+d" (dx)
6453 + : "c" (cx), "D" (di)
6455 +#endif /* CONFIG_FIRMWARE_EDID */
6458 +__videocard video_vesa =
6460 + .card_name = "VESA",
6461 + .probe = vesa_probe,
6462 + .set_mode = vesa_set_mode,
6463 + .xmode_first = VIDEO_FIRST_VESA,
6466 diff -puN /dev/null arch/i386/boot/video-vga.c
6468 +++ a/arch/i386/boot/video-vga.c
6470 +/* -*- linux-c -*- ------------------------------------------------------- *
6472 + * Copyright (C) 1991, 1992 Linus Torvalds
6473 + * Copyright 2007 rPath, Inc. - All Rights Reserved
6475 + * This file is part of the Linux kernel, and is made available under
6476 + * the terms of the GNU General Public License version 2.
6478 + * ----------------------------------------------------------------------- */
6481 + * arch/i386/boot/video-vga.c
6483 + * Common all-VGA modes
6489 +static struct mode_info vga_modes[] = {
6490 + { VIDEO_80x25, 80, 25 },
6491 + { VIDEO_8POINT, 80, 50 },
6492 + { VIDEO_80x43, 80, 43 },
6493 + { VIDEO_80x28, 80, 28 },
6494 + { VIDEO_80x30, 80, 30 },
6495 + { VIDEO_80x34, 80, 34 },
6496 + { VIDEO_80x60, 80, 60 },
6499 +static struct mode_info ega_modes[] = {
6500 + { VIDEO_80x25, 80, 25 },
6501 + { VIDEO_8POINT, 80, 43 },
6504 +static struct mode_info cga_modes[] = {
6505 + { VIDEO_80x25, 80, 25 },
6508 +__videocard video_vga;
6510 +/* Set basic 80x25 mode */
6511 +static u8 vga_set_basic_mode(void)
6517 +#ifdef CONFIG_VIDEO_400_HACK
6518 + if (adapter >= ADAPTER_VGA) {
6520 + : : "a" (0x1202), "b" (0x0030)
6521 + : "ecx", "edx", "esi", "edi");
6528 + : : "ebx", "ecx", "edx", "esi", "edi");
6533 + rows = rdfs8(0x484); /* rows minus one */
6535 +#ifndef CONFIG_VIDEO_400_HACK
6536 + if ((ax == 0x5003 || ax == 0x5007) &&
6537 + (rows == 0 || rows == 24))
6541 + if (mode != 3 && mode != 7)
6544 + /* Set the mode */
6545 + asm volatile(INT10
6547 + : "ebx", "ecx", "edx", "esi", "edi");
6552 +static void vga_set_8font(void)
6554 + /* Set 8x8 font - 80x43 on EGA, 80x50 on VGA */
6556 + /* Set 8x8 font */
6557 + asm volatile(INT10 : : "a" (0x1112), "b" (0));
6559 + /* Use alternate print screen */
6560 + asm volatile(INT10 : : "a" (0x1200), "b" (0x20));
6562 + /* Turn off cursor emulation */
6563 + asm volatile(INT10 : : "a" (0x1201), "b" (0x34));
6565 + /* Cursor is scan lines 6-7 */
6566 + asm volatile(INT10 : : "a" (0x0100), "c" (0x0607));
6569 +static void vga_set_14font(void)
6571 + /* Set 9x14 font - 80x28 on VGA */
6573 + /* Set 9x14 font */
6574 + asm volatile(INT10 : : "a" (0x1111), "b" (0));
6576 + /* Turn off cursor emulation */
6577 + asm volatile(INT10 : : "a" (0x1201), "b" (0x34));
6579 + /* Cursor is scan lines 11-12 */
6580 + asm volatile(INT10 : : "a" (0x0100), "c" (0x0b0c));
6583 +static void vga_set_80x43(void)
6585 + /* Set 80x43 mode on VGA (not EGA) */
6587 + /* Set 350 scans */
6588 + asm volatile(INT10 : : "a" (0x1201), "b" (0x30));
6590 + /* Reset video mode */
6591 + asm volatile(INT10 : : "a" (0x0003));
6596 +/* I/O address of the VGA CRTC */
6599 + return (inb(0x3cc) & 1) ? 0x3d4 : 0x3b4;
6602 +static void vga_set_480_scanlines(int end)
6607 + crtc = vga_crtc();
6609 + out_idx(0x0c, crtc, 0x11); /* Vertical sync end, unlock CR0-7 */
6610 + out_idx(0x0b, crtc, 0x06); /* Vertical total */
6611 + out_idx(0x3e, crtc, 0x07); /* Vertical overflow */
6612 + out_idx(0xea, crtc, 0x10); /* Vertical sync start */
6613 + out_idx(end, crtc, 0x12); /* Vertical display end */
6614 + out_idx(0xe7, crtc, 0x15); /* Vertical blank start */
6615 + out_idx(0x04, crtc, 0x16); /* Vertical blank end */
6616 + csel = inb(0x3cc);
6619 + outb(csel, 0x3cc);
6622 +static void vga_set_80x30(void)
6624 + vga_set_480_scanlines(0xdf);
6627 +static void vga_set_80x34(void)
6630 + vga_set_480_scanlines(0xdb);
6633 +static void vga_set_80x60(void)
6636 + vga_set_480_scanlines(0xdf);
6639 +static int vga_set_mode(struct mode_info *mode)
6641 + /* Set the basic mode */
6642 + vga_set_basic_mode();
6644 + /* Override a possibly broken BIOS */
6645 + force_x = mode->x;
6646 + force_y = mode->y;
6648 + switch (mode->mode) {
6651 + case VIDEO_8POINT:
6675 + * Note: this probe includes basic information required by all
6676 + * systems. It should be executed first, by making sure
6677 + * video-vga.c is listed first in the Makefile.
6679 +static int vga_probe(void)
6681 + static const char *card_name[] = {
6682 + "CGA/MDA/HGC", "EGA", "VGA"
6684 + static struct mode_info *mode_lists[] = {
6689 + static int mode_count[] = {
6690 + sizeof(cga_modes)/sizeof(struct mode_info),
6691 + sizeof(ega_modes)/sizeof(struct mode_info),
6692 + sizeof(vga_modes)/sizeof(struct mode_info),
6697 + : "=b" (boot_params.screen_info.orig_video_ega_bx)
6698 + : "a" (0x1200), "b" (0x10) /* Check EGA/VGA */
6699 + : "ecx", "edx", "esi", "edi");
6701 + /* If we have MDA/CGA/HGC then BL will be unchanged at 0x10 */
6702 + if ((u8)boot_params.screen_info.orig_video_ega_bx != 0x10) {
6707 + : "ebx", "ecx", "edx", "esi", "edi");
6709 + if (vga_flag == 0x1a) {
6710 + adapter = ADAPTER_VGA;
6711 + boot_params.screen_info.orig_video_isVGA = 1;
6713 + adapter = ADAPTER_EGA;
6716 + adapter = ADAPTER_CGA;
6719 + video_vga.modes = mode_lists[adapter];
6720 + video_vga.card_name = card_name[adapter];
6721 + return mode_count[adapter];
6724 +__videocard video_vga =
6726 + .card_name = "VGA",
6727 + .probe = vga_probe,
6728 + .set_mode = vga_set_mode,
6730 diff -puN arch/i386/boot/video.S~git-newsetup /dev/null
6731 --- a/arch/i386/boot/video.S
6736 - * Display adapter & video mode setup, version 2.13 (14-May-99)
6738 - * Copyright (C) 1995 -- 1998 Martin Mares <mj@ucw.cz>
6739 - * Based on the original setup.S code (C) Linus Torvalds and Mats Anderson
6741 - * Rewritten to use GNU 'as' by Chris Noe <stiker@northlink.com> May 1999
6743 - * For further information, look at Documentation/svga.txt.
6747 -/* Enable autodetection of SVGA adapters and modes. */
6748 -#undef CONFIG_VIDEO_SVGA
6750 -/* Enable autodetection of VESA modes */
6751 -#define CONFIG_VIDEO_VESA
6753 -/* Enable compacting of mode table */
6754 -#define CONFIG_VIDEO_COMPACT
6756 -/* Retain screen contents when switching modes */
6757 -#define CONFIG_VIDEO_RETAIN
6759 -/* Enable local mode list */
6760 -#undef CONFIG_VIDEO_LOCAL
6762 -/* Force 400 scan lines for standard modes (hack to fix bad BIOS behaviour */
6763 -#undef CONFIG_VIDEO_400_HACK
6765 -/* Hack that lets you force specific BIOS mode ID and specific dimensions */
6766 -#undef CONFIG_VIDEO_GFX_HACK
6767 -#define VIDEO_GFX_BIOS_AX 0x4f02 /* 800x600 on ThinkPad */
6768 -#define VIDEO_GFX_BIOS_BX 0x0102
6769 -#define VIDEO_GFX_DUMMY_RESOLUTION 0x6425 /* 100x37 */
6771 -/* This code uses an extended set of video mode numbers. These include:
6772 - * Aliases for standard modes
6774 - * EXTENDED_VGA (-2)
6776 - * Video modes numbered by menu position -- NOT RECOMMENDED because of lack
6777 - * of compatibility when extending the table. These are between 0x00 and 0xff.
6779 -#define VIDEO_FIRST_MENU 0x0000
6781 -/* Standard BIOS video modes (BIOS number + 0x0100) */
6782 -#define VIDEO_FIRST_BIOS 0x0100
6784 -/* VESA BIOS video modes (VESA number + 0x0200) */
6785 -#define VIDEO_FIRST_VESA 0x0200
6787 -/* Video7 special modes (BIOS number + 0x0900) */
6788 -#define VIDEO_FIRST_V7 0x0900
6790 -/* Special video modes */
6791 -#define VIDEO_FIRST_SPECIAL 0x0f00
6792 -#define VIDEO_80x25 0x0f00
6793 -#define VIDEO_8POINT 0x0f01
6794 -#define VIDEO_80x43 0x0f02
6795 -#define VIDEO_80x28 0x0f03
6796 -#define VIDEO_CURRENT_MODE 0x0f04
6797 -#define VIDEO_80x30 0x0f05
6798 -#define VIDEO_80x34 0x0f06
6799 -#define VIDEO_80x60 0x0f07
6800 -#define VIDEO_GFX_HACK 0x0f08
6801 -#define VIDEO_LAST_SPECIAL 0x0f09
6803 -/* Video modes given by resolution */
6804 -#define VIDEO_FIRST_RESOLUTION 0x1000
6806 -/* The "recalculate timings" flag */
6807 -#define VIDEO_RECALC 0x8000
6809 -/* Positions of various video parameters passed to the kernel */
6810 -/* (see also include/linux/tty.h) */
6811 -#define PARAM_CURSOR_POS 0x00
6812 -#define PARAM_VIDEO_PAGE 0x04
6813 -#define PARAM_VIDEO_MODE 0x06
6814 -#define PARAM_VIDEO_COLS 0x07
6815 -#define PARAM_VIDEO_EGA_BX 0x0a
6816 -#define PARAM_VIDEO_LINES 0x0e
6817 -#define PARAM_HAVE_VGA 0x0f
6818 -#define PARAM_FONT_POINTS 0x10
6820 -#define PARAM_LFB_WIDTH 0x12
6821 -#define PARAM_LFB_HEIGHT 0x14
6822 -#define PARAM_LFB_DEPTH 0x16
6823 -#define PARAM_LFB_BASE 0x18
6824 -#define PARAM_LFB_SIZE 0x1c
6825 -#define PARAM_LFB_LINELENGTH 0x24
6826 -#define PARAM_LFB_COLORS 0x26
6827 -#define PARAM_VESAPM_SEG 0x2e
6828 -#define PARAM_VESAPM_OFF 0x30
6829 -#define PARAM_LFB_PAGES 0x32
6830 -#define PARAM_VESA_ATTRIB 0x34
6831 -#define PARAM_CAPABILITIES 0x36
6833 -/* Define DO_STORE according to CONFIG_VIDEO_RETAIN */
6834 -#ifdef CONFIG_VIDEO_RETAIN
6835 -#define DO_STORE call store_screen
6838 -#endif /* CONFIG_VIDEO_RETAIN */
6840 -# This is the main entry point called by setup.S
6841 -# %ds *must* be pointing to the bootsector
6842 -video: pushw %ds # We use different segments
6843 - pushw %ds # FS contains original DS
6845 - pushw %cs # DS is equal to CS
6847 - pushw %cs # ES is equal to CS
6850 - movw %ax, %gs # GS is zero
6852 - call basic_detect # Basic adapter type testing (EGA/VGA/MDA/CGA)
6853 -#ifdef CONFIG_VIDEO_SELECT
6854 - movw %fs:(0x01fa), %ax # User selected video mode
6855 - cmpw $ASK_VGA, %ax # Bring up the menu
6858 - call mode_set # Set the mode
6861 - leaw badmdt, %si # Invalid mode ID
6863 -vid2: call mode_menu
6865 -#ifdef CONFIG_VIDEO_RETAIN
6866 - call restore_screen # Restore screen contents
6867 -#endif /* CONFIG_VIDEO_RETAIN */
6869 -#endif /* CONFIG_VIDEO_SELECT */
6870 - call mode_params # Store mode parameters
6871 - popw %ds # Restore original DS
6874 -# Detect if we have CGA, MDA, EGA or VGA and pass it to the kernel.
6876 - movb $0, %fs:(PARAM_HAVE_VGA)
6877 - movb $0x12, %ah # Check EGA/VGA
6880 - movw %bx, %fs:(PARAM_VIDEO_EGA_BX) # Identifies EGA to the kernel
6881 - cmpb $0x10, %bl # No, it's a CGA/MDA/HGA card.
6885 - movw $0x1a00, %ax # Check EGA or VGA?
6887 - cmpb $0x1a, %al # 1a means VGA...
6888 - jne basret # anything else is EGA.
6890 - incb %fs:(PARAM_HAVE_VGA) # We've detected a VGA
6894 -# Store the video mode parameters for later usage by the kernel.
6895 -# This is done by asking the BIOS except for the rows/columns
6896 -# parameters in the default 80x25 mode -- these are set directly,
6897 -# because some very obscure BIOSes supply insane values.
6899 -#ifdef CONFIG_VIDEO_SELECT
6900 - cmpb $0, graphic_mode
6903 - movb $0x03, %ah # Read cursor position
6906 - movw %dx, %fs:(PARAM_CURSOR_POS)
6907 - movb $0x0f, %ah # Read page/mode/width
6909 - movw %bx, %fs:(PARAM_VIDEO_PAGE)
6910 - movw %ax, %fs:(PARAM_VIDEO_MODE) # Video mode and screen width
6911 - cmpb $0x7, %al # MDA/HGA => segment differs
6914 - movw $0xb000, video_segment
6915 -mopar0: movw %gs:(0x485), %ax # Font size
6916 - movw %ax, %fs:(PARAM_FONT_POINTS) # (valid only on EGA/VGA)
6917 - movw force_size, %ax # Forced size?
6921 - movb %ah, %fs:(PARAM_VIDEO_COLS)
6922 - movb %al, %fs:(PARAM_VIDEO_LINES)
6925 -mopar1: movb $25, %al
6926 - cmpb $0, adapter # If we are on CGA/MDA/HGA, the
6927 - jz mopar2 # screen must have 25 lines.
6929 - movb %gs:(0x484), %al # On EGA/VGA, use the EGA+ BIOS
6930 - incb %al # location of max lines.
6931 -mopar2: movb %al, %fs:(PARAM_VIDEO_LINES)
6934 -#ifdef CONFIG_VIDEO_SELECT
6935 -# Fetching of VESA frame buffer parameters
6937 - leaw modelist+1024, %di
6938 - movb $0x23, %fs:(PARAM_HAVE_VGA)
6940 - movw %ax, %fs:(PARAM_LFB_LINELENGTH)
6942 - movw %ax, %fs:(PARAM_LFB_WIDTH)
6944 - movw %ax, %fs:(PARAM_LFB_HEIGHT)
6947 - movw %ax, %fs:(PARAM_LFB_DEPTH)
6950 - movw %ax, %fs:(PARAM_LFB_PAGES)
6951 - movl 40(%di), %eax
6952 - movl %eax, %fs:(PARAM_LFB_BASE)
6953 - movl 31(%di), %eax
6954 - movl %eax, %fs:(PARAM_LFB_COLORS)
6955 - movl 35(%di), %eax
6956 - movl %eax, %fs:(PARAM_LFB_COLORS+4)
6958 - movw %ax, %fs:(PARAM_VESA_ATTRIB)
6960 -# get video mem size
6961 - leaw modelist+1024, %di
6966 - movl %eax, %fs:(PARAM_LFB_SIZE)
6968 -# store mode capabilities
6969 - movl 10(%di), %eax
6970 - movl %eax, %fs:(PARAM_CAPABILITIES)
6972 -# switching the DAC to 8-bit is for <= 8 bpp only
6973 - movw %fs:(PARAM_LFB_DEPTH), %ax
6977 -# get DAC switching capability
6983 -# attempt to switch DAC to 8-bit
6989 - movb %bh, dac_size # store actual DAC size
6992 -# set color size to DAC size
6993 - movb dac_size, %al
6994 - movb %al, %fs:(PARAM_LFB_COLORS+0)
6995 - movb %al, %fs:(PARAM_LFB_COLORS+2)
6996 - movb %al, %fs:(PARAM_LFB_COLORS+4)
6997 - movb %al, %fs:(PARAM_LFB_COLORS+6)
6999 -# set color offsets to 0
7000 - movb $0, %fs:(PARAM_LFB_COLORS+1)
7001 - movb $0, %fs:(PARAM_LFB_COLORS+3)
7002 - movb $0, %fs:(PARAM_LFB_COLORS+5)
7003 - movb $0, %fs:(PARAM_LFB_COLORS+7)
7006 -# get protected mode interface informations
7014 - movw %es, %fs:(PARAM_VESAPM_SEG)
7015 - movw %di, %fs:(PARAM_VESAPM_OFF)
7018 -# The video mode menu
7020 - leaw keymsg, %si # "Return/Space/Timeout" message
7025 - cmpb $0x0d, %al # ENTER ?
7026 - je listm # yes - manual mode selection
7028 - cmpb $0x20, %al # SPACE ?
7029 - je defmd1 # no - repeat
7034 -defmd1: ret # No mode chosen? Default 80x25
7036 -listm: call mode_table # List mode table
7037 -listm0: leaw name_bann, %si # Print adapter name
7039 - movw card_name, %si
7044 - leaw old_name, %si
7048 - leaw ega_name, %si
7052 - leaw vga_name, %si
7056 - leaw svga_name, %si
7058 - leaw listhdr, %si # Table header
7060 - movb $0x30, %dl # DL holds mode number
7061 - leaw modelist, %si
7062 -lm1: cmpw $ASK_VGA, (%si) # End?
7065 - movb %dl, %al # Menu selection number
7069 - call prthw # Mode ID
7071 - movb 0x1(%si), %al
7072 - call prtdec # Rows
7073 - movb $0x78, %al # the letter 'x'
7076 - call prtdec # Columns
7077 - movb $0x0d, %al # New line
7081 - incb %dl # Next character
7088 -lm2: leaw prompt, %si # Mode prompt
7090 - leaw edit_buf, %di # Editor buffer
7092 - cmpb $0x0d, %al # Enter?
7095 - cmpb $0x08, %al # Backspace?
7098 - cmpb $0x20, %al # Printable?
7101 - cmpw $edit_buf+4, %di # Enough space?
7108 -lmbs: cmpw $edit_buf, %di # Backspace
7119 -lment: movb $0, (%di)
7122 - leaw edit_buf, %si
7123 - cmpb $0, (%si) # Empty string = default mode
7126 - cmpb $0, 1(%si) # One character = menu selection
7129 - cmpw $0x6373, (%si) # "scan" => mode scanning
7132 - cmpw $0x6e61, 2(%si)
7135 -lmhx: xorw %bx, %bx # Else => mode ID in hex
7154 -lmhx1: shlw $4, %bx
7158 -lmuse1: movw %bx, %ax
7161 -mnusel: lodsb # Menu selection
7169 - cmpb $0x61-0x30, %al
7172 - subb $0x61-0x30-10, %al
7176 -lmuse: call mode_set
7179 -lmbad: leaw unknt, %si
7182 -lmscan: cmpb $0, adapter # Scanning only on EGA/VGA
7185 - movw $0, mt_end # Scanning of modes is
7186 - movb $1, scanning # done as new autodetection.
7191 -# Additional parts of mode_set... (relative jumps, you know)
7192 -setv7: # Video7 extended modes
7194 - subb $VIDEO_FIRST_V7>>8, %bh
7200 -_setrec: jmp setrec # Ugly...
7201 -_set_80x25: jmp set_80x25
7203 -# Aliases for backward compatibility.
7205 - movw $VIDEO_80x25, %ax
7209 - movb $VIDEO_8POINT-VIDEO_FIRST_SPECIAL, %al
7211 - jnz setbad # Fall-through!
7213 -# Setting of user mode (AX=mode ID) => CF=success
7215 - movw %ax, %fs:(0x01fa) # Store mode for use in acpi_wakeup.S
7220 - testb $VIDEO_RECALC>>8, %ah
7223 - cmpb $VIDEO_FIRST_RESOLUTION>>8, %ah
7226 - cmpb $VIDEO_FIRST_SPECIAL>>8, %ah
7229 - cmpb $VIDEO_FIRST_V7>>8, %ah
7232 - cmpb $VIDEO_FIRST_VESA>>8, %ah
7242 - movb $0, do_restore # The screen needn't be restored
7247 - subb $VIDEO_FIRST_VESA>>8, %bh
7248 - movw $0x4f02, %ax # VESA BIOS mode set call
7250 - cmpw $0x004f, %ax # AL=4f if implemented
7251 - jnz setbad # AH=0 if OK
7258 - int $0x10 # Standard BIOS mode set call
7260 - movb $0x0f, %ah # Check if really set
7269 -setspc: xorb %bh, %bh # Set special mode
7270 - cmpb $VIDEO_LAST_SPECIAL-VIDEO_FIRST_SPECIAL, %bl
7274 - jmp *spec_inits(%bx)
7277 - orb %al, %al # 80x25 is an exception
7280 - pushw %bx # Set mode chosen from menu
7281 - call mode_table # Build the mode table
7288 - movw (%si), %ax # Fetch mode ID
7291 -setres: pushw %bx # Set mode chosen by resolution
7296 - cmpw $ASK_VGA, %ax # End of the list?
7303 - movw -4(%si), %ax # Fetch mode ID
7307 -#ifdef CONFIG_FIRMWARE_EDID
7308 - leaw modelist+1024, %di
7315 - movw %ax, vbe_version
7317 - leaw modelist+1024, %di
7318 - subb $VIDEO_FIRST_VESA>>8, %bh
7319 - movw %bx, %cx # Get mode information structure
7322 - addb $VIDEO_FIRST_VESA>>8, %bh
7326 - movb (%di), %al # Check capabilities.
7329 - jz setvesa # This is a text mode
7331 - movb (%di), %al # Check capabilities.
7334 - jnz _setbad # Doh! No linear frame buffer.
7336 - subb $VIDEO_FIRST_VESA>>8, %bh
7337 - orw $0x4000, %bx # Use linear frame buffer
7338 - movw $0x4f02, %ax # VESA BIOS mode set call
7340 - cmpw $0x004f, %ax # AL=4f if implemented
7341 - jnz _setbad # AH=0 if OK
7343 - movb $1, graphic_mode # flag graphic mode
7344 - movb $0, do_restore # no screen restore
7348 -_setbad: jmp setbad # Ugly...
7350 -# Recalculate vertical display end registers -- this fixes various
7351 -# inconsistencies of extended modes on many adapters. Called when
7352 -# the VIDEO_RECALC flag is set in the mode ID.
7354 -setrec: subb $VIDEO_RECALC>>8, %ah # Set the base mode
7358 - movw %gs:(0x485), %ax # Font size in pixels
7359 - movb %gs:(0x484), %bl # Number of rows
7361 - mulb %bl # Number of visible
7362 - decw %ax # scan lines - 1
7365 - movb $0x12, %al # Lower 8 bits
7368 - movb $0x07, %al # Bits 8 and 9 in the overflow register
7378 -rct2: movb $0x07, %al
7383 -# Table of routines for setting of the special modes.
7395 -# Set the 80x25 mode. If already set, do nothing.
7397 - movw $0x5019, force_size # Override possibly broken BIOS
7399 -#ifdef CONFIG_VIDEO_400_HACK
7400 - movw $0x1202, %ax # Force 400 scan lines
7404 - movb $0x0f, %ah # Get current mode ID
7406 - cmpw $0x5007, %ax # Mode 7 (80x25 mono) is the only one available
7407 - jz st80 # on CGA/MDA/HGA and is also available on EGAM
7409 - cmpw $0x5003, %ax # Unknown mode, force 80x25 color
7412 -st80: cmpb $0, adapter # CGA/MDA/HGA => mode 3/7 is always 80x25
7415 - movb %gs:(0x0484), %al # This is EGA+ -- beware of 80x50 etc.
7416 - orb %al, %al # Some buggy BIOS'es set 0 rows
7419 - cmpb $24, %al # It's hopefully correct
7421 -#endif /* CONFIG_VIDEO_400_HACK */
7423 - movw $0x0003, %ax # Forced set
7428 -# Set the 80x50/80x43 8-pixel mode. Simple BIOS calls.
7431 - call use_80x25 # The base is 80x25
7433 - movw $0x1112, %ax # Use 8x8 font
7436 - movw $0x1200, %ax # Use alternate print screen
7439 - movw $0x1201, %ax # Turn off cursor emulation
7442 - movb $0x01, %ah # Define cursor scan lines 6-7
7449 -# Set the 80x28 mode. This mode works on all VGA's, because it's a standard
7450 -# 80x25 mode with 14-point fonts instead of 16-point.
7453 - call use_80x25 # The base is 80x25
7454 -set14: movw $0x1111, %ax # Use 9x14 font
7457 - movb $0x01, %ah # Define cursor scan lines 11-12
7463 -# Set the 80x43 mode. This mode is works on all VGA's.
7464 -# It's a 350-scanline mode with 8-pixel font.
7467 - movw $0x1201, %ax # Set 350 scans
7470 - movw $0x0003, %ax # Reset video mode
7472 - jmp set_8pt # Use 8-pixel font
7474 -# Set the 80x30 mode (all VGA's). 480 scanlines, 16-pixel font.
7476 - call use_80x25 # Start with real 80x25
7478 - movw $0x3cc, %dx # Get CRTC port
7481 - rorb %al # Mono or color?
7485 -set48a: movw $0x0c11, %ax # Vertical sync end (also unlocks CR0-7)
7487 - movw $0x0b06, %ax # Vertical total
7489 - movw $0x3e07, %ax # (Vertical) overflow
7491 - movw $0xea10, %ax # Vertical sync start
7493 - movw $0xdf12, %ax # Vertical display end
7495 - movw $0xe715, %ax # Vertical blank start
7497 - movw $0x0416, %ax # Vertical blank end
7500 - movb $0xcc, %dl # Misc output register (read)
7502 - movb $0xc2, %dl # (write)
7503 - andb $0x0d, %al # Preserve clock select bits and color bit
7504 - orb $0xe2, %al # Set correct sync polarity
7507 - movw $0x501e, force_size
7511 -# Set the 80x34 mode (all VGA's). 480 scans, 14-pixel font.
7513 - call set_80x30 # Set 480 scans
7514 - call set14 # And 14-pt font
7515 - movw $0xdb12, %ax # VGA vertical display end
7516 - movw $0x5022, force_size
7517 -setvde: call outidx
7521 -# Set the 80x60 mode (all VGA's). 480 scans, 8-pixel font.
7523 - call set_80x30 # Set 480 scans
7524 - call set_8pt # And 8-pt font
7525 - movw $0xdf12, %ax # VGA vertical display end
7526 - movw $0x503c, force_size
7529 -# Special hack for ThinkPad graphics
7531 -#ifdef CONFIG_VIDEO_GFX_HACK
7532 - movw $VIDEO_GFX_BIOS_AX, %ax
7533 - movw $VIDEO_GFX_BIOS_BX, %bx
7535 - movw $VIDEO_GFX_DUMMY_RESOLUTION, force_size
7540 -#ifdef CONFIG_VIDEO_RETAIN
7542 -# Store screen contents to temporary buffer.
7544 - cmpb $0, do_restore # Already stored?
7547 - testb $CAN_USE_HEAP, loadflags # Have we space for storing?
7552 - pushw force_size # Don't force specific size
7553 - movw $0, force_size
7554 - call mode_params # Obtain params of current mode
7556 - movb %fs:(PARAM_VIDEO_LINES), %ah
7557 - movb %fs:(PARAM_VIDEO_COLS), %al
7558 - movw %ax, %bx # BX=dimensions
7560 - movw %ax, %cx # CX=number of characters
7561 - addw %ax, %ax # Calculate image size
7562 - addw $modelist+1024+4, %ax
7563 - cmpw heap_end_ptr, %ax
7564 - jnc sts1 # Unfortunately, out of memory
7566 - movw %fs:(PARAM_CURSOR_POS), %ax # Store mode params
7567 - leaw modelist+1024, %di
7571 - pushw %ds # Store the screen
7572 - movw video_segment, %ds
7577 - incb do_restore # Screen will be restored later
7582 -# Restore screen contents from temporary buffer.
7584 - cmpb $0, do_restore # Has the screen been stored?
7587 - call mode_params # Get parameters of current mode
7588 - movb %fs:(PARAM_VIDEO_LINES), %cl
7589 - movb %fs:(PARAM_VIDEO_COLS), %ch
7590 - leaw modelist+1024, %si # Screen buffer
7591 - lodsw # Set cursor position
7598 -res2: cmpb %ch, %dl
7603 -res3: movb $0x02, %ah
7606 - lodsw # Display size
7607 - movb %ah, %dl # DL=number of lines
7608 - movb $0, %ah # BX=phys. length of orig. line
7610 - cmpb %cl, %dl # Too many?
7621 -res4: cmpb %ch, %al # Too wide?
7624 - movb %ch, %al # AX=width of src. line
7627 - movw %cx, %bp # BP=width of dest. line
7629 - movw video_segment, %es
7630 - xorw %di, %di # Move the data
7631 - addw %bx, %bx # Convert BX and BP to _bytes_
7647 -#endif /* CONFIG_VIDEO_RETAIN */
7649 -# Write to indexed VGA register (AL=index, AH=data, DX=index reg. port)
7650 -outidx: outb %al, %dx
7659 -# Build the table of video modes (stored after the setup.S code at the
7660 -# `modelist' label. Each video mode record looks like:
7661 -# .word MODE-ID (our special mode ID (see above))
7662 -# .byte rows (number of rows)
7663 -# .byte columns (number of columns)
7664 -# Returns address of the end of the table in DI, the end is marked
7665 -# with a ASK_VGA ID.
7667 - movw mt_end, %di # Already filled?
7671 - leaw modelist, %di # Store standard modes:
7672 - movl $VIDEO_80x25 + 0x50190000, %eax # The 80x25 mode (ALL)
7674 - movb adapter, %al # CGA/MDA/HGA -- no more modes
7681 - movl $VIDEO_8POINT + 0x502b0000, %eax # The 80x43 EGA mode
7687 -mtabv: leaw vga_modes, %si # All modes for std VGA
7688 - movw $vga_modes_end-vga_modes, %cx
7689 - rep # I'm unable to use movsw as I don't know how to store a half
7690 - movsb # of the expression above to cx without using explicit shr.
7692 - cmpb $0, scanning # Mode scan requested?
7698 -#ifdef CONFIG_VIDEO_LOCAL
7700 -#endif /* CONFIG_VIDEO_LOCAL */
7702 -#ifdef CONFIG_VIDEO_VESA
7703 - call vesa_modes # Detect VESA VGA modes
7704 -#endif /* CONFIG_VIDEO_VESA */
7706 -#ifdef CONFIG_VIDEO_SVGA
7707 - cmpb $0, scanning # Bypass when scanning
7710 - call svga_modes # Detect SVGA cards & modes
7712 -#endif /* CONFIG_VIDEO_SVGA */
7716 -#ifdef CONFIG_VIDEO_COMPACT
7717 - leaw modelist, %si
7720 -cmt1: cmpw %dx, %si # Scan all modes
7723 - leaw modelist, %bx # Find in previous entries
7725 -cmt3: cmpw %bx, %si
7728 - cmpw 2(%bx), %cx # Found => don't copy this entry
7734 -cmt4: movsl # Copy entry
7737 -cmt5: addw $4, %si # Skip entry
7741 -#endif /* CONFIG_VIDEO_COMPACT */
7743 - movw $ASK_VGA, (%di) # End marker
7745 -mtab1: leaw modelist, %si # SI=mode list, DI=list end
7748 -# Modes usable on all standard VGAs
7750 - .word VIDEO_8POINT
7751 - .word 0x5032 # 80x50
7753 - .word 0x502b # 80x43
7755 - .word 0x501c # 80x28
7757 - .word 0x501e # 80x30
7759 - .word 0x5022 # 80x34
7761 - .word 0x503c # 80x60
7762 -#ifdef CONFIG_VIDEO_GFX_HACK
7763 - .word VIDEO_GFX_HACK
7764 - .word VIDEO_GFX_DUMMY_RESOLUTION
7768 -# Detect VESA modes.
7770 -#ifdef CONFIG_VIDEO_VESA
7772 - cmpb $2, adapter # VGA only
7775 - movw %di, %bp # BP=original mode table end
7776 - addw $0x200, %di # Buffer space
7777 - movw $0x4f00, %ax # VESA Get card info call
7780 - cmpw $0x004f, %ax # Successful?
7783 - cmpw $0x4556, 0x200(%di)
7786 - cmpw $0x4153, 0x202(%di)
7789 - movw $vesa_name, card_name # Set name to "VESA VGA"
7791 - lgsw 0x20e(%di), %si # GS:SI=mode list
7792 - movw $128, %cx # Iteration limit
7794 -# gas version 2.9.1, using BFD version 2.9.1.0.23 buggers the next inst.
7795 -# XXX: lodsw %gs:(%si), %ax # Get next mode in the list
7797 - cmpw $0xffff, %ax # End of the table?
7800 - cmpw $0x0080, %ax # Check validity of mode ID
7803 - orb %ah, %ah # Valid IDs: 0x0000-0x007f/0x0100-0x07ff
7804 - jz vesan # Certain BIOSes report 0x80-0xff!
7810 - movw %ax, %cx # Get mode information structure
7813 - movw %cx, %bx # BX=mode number
7814 - addb $VIDEO_FIRST_VESA>>8, %bh
7817 - jnz vesan # Don't report errors (buggy BIOSES)
7819 - movb (%di), %al # Check capabilities. We require
7820 - andb $0x19, %al # a color text mode.
7824 - cmpw $0xb800, 8(%di) # Standard video memory address required
7827 - testb $2, (%di) # Mode characteristics supplied?
7828 - movw %bx, (%di) # Store mode number
7832 - movw 0x12(%di), %bx # Width
7836 - movb %bl, 0x3(%di)
7837 - movw 0x14(%di), %ax # Height
7843 - cmpw $8193, %ax # Small enough for Linux console driver?
7848 -vesa3: subw $0x8108, %bx # This mode has no detailed info specified,
7849 - jc vesan # so it must be a standard VESA mode.
7854 - movw vesa_text_mode_table(%bx), %ax
7856 -vesaok: addw $4, %di # The mode is valid. Store it.
7857 -vesan: loop vesa1 # Next mode. Limit exceeded => error
7858 -vesae: leaw vesaer, %si
7860 - movw %bp, %di # Discard already found modes.
7864 -# Dimensions of standard VESA text modes
7865 -vesa_text_mode_table:
7866 - .byte 60, 80 # 0108
7867 - .byte 25, 132 # 0109
7868 - .byte 43, 132 # 010A
7869 - .byte 50, 132 # 010B
7870 - .byte 60, 132 # 010C
7871 -#endif /* CONFIG_VIDEO_VESA */
7873 -# Scan for video modes. A bit dirty, but should work.
7875 - movw $0x0100, %cx # Start with mode 0
7876 -scm1: movb $0, %ah # Test the mode
7882 - jnz scm2 # Mode not set
7884 - movw $0x3c0, %dx # Test if it's a text mode
7885 - movb $0x10, %al # Mode bits
7890 - movb $0xce, %dl # Another set of mode bits
7896 - movb $0xd4, %dl # Cursor location
7902 - movw %cx, %ax # Ok, store the mode
7904 - movb %gs:(0x484), %al # Number of rows
7907 - movw %gs:(0x44a), %ax # Number of columns
7912 - movw $0x0003, %ax # Return back to mode 3
7916 -tstidx: outw %ax, %dx # OUT DX,AX and inidx
7917 -inidx: outb %al, %dx # Read from indexed VGA register
7918 - incw %dx # AL=index, DX=index reg port -> AL=data
7923 -# Try to detect type of SVGA card and supply (usually approximate) video
7924 -# mode table for it.
7926 -#ifdef CONFIG_VIDEO_SVGA
7928 - leaw svga_table, %si # Test all known SVGA adapters
7930 - movw %ax, %bp # Default mode table
7934 - lodsw # Pointer to test routine
7940 - call *%ax # Call test routine
7947 - movw %bp, %si # Found, copy the modes
7948 - movb svga_prefix, %ah
7957 -didsv: movw %si, card_name # Store pointer to card name
7960 -# Table of all known SVGA cards. For each card, we store a pointer to
7961 -# a table of video modes supported by the card and a pointer to a routine
7962 -# used for testing of presence of the card. The video mode table is always
7963 -# followed by the name of the card or the chipset.
7965 - .word ati_md, ati_test
7966 - .word oak_md, oak_test
7967 - .word paradise_md, paradise_test
7968 - .word realtek_md, realtek_test
7969 - .word s3_md, s3_test
7970 - .word chips_md, chips_test
7971 - .word video7_md, video7_test
7972 - .word cirrus5_md, cirrus5_test
7973 - .word cirrus6_md, cirrus6_test
7974 - .word cirrus1_md, cirrus1_test
7975 - .word ahead_md, ahead_test
7976 - .word everex_md, everex_test
7977 - .word genoa_md, genoa_test
7978 - .word trident_md, trident_test
7979 - .word tseng_md, tseng_test
7982 -# Test routines and mode tables:
7984 -# S3 - The test algorithm was taken from the SuperProbe package
7985 -# for XFree86 1.2.1. Report bugs to Christoph.Niemann@linux.org
7987 - movw $0x0f35, %cx # we store some constants in cl/ch
7991 - movb %al, %bh # store current CRT-register 0x38
7993 - call outidx # disable writing to special regs
7994 - movb %cl, %al # check whether we can write special reg 0x35
7996 - movb %al, %bl # save the current value of CRT reg 0x35
7997 - andb $0xf0, %al # clear bits 0-3
7999 - movb %cl, %al # and write it to CRT reg 0x35
8001 - call inidx # now read it back
8002 - andb %ch, %al # clear the upper 4 bits
8003 - jz s3_2 # the first test failed. But we have a
8005 - movb %bl, %ah # second chance
8008 - jmp s3_1 # do the other tests
8010 -s3_2: movw %cx, %ax # load ah with 0xf and al with 0x35
8011 - orb %bl, %ah # set the upper 4 bits of ah with the orig value
8012 - call outidx # write ...
8013 - call inidx # ... and reread
8014 - andb %cl, %al # turn off the upper 4 bits
8016 - movb %bl, %ah # restore old value in register 0x35
8020 - cmpb %ch, %al # setting lower 4 bits was successful => bad
8021 - je no_s3 # writing is allowed => this is not an S3
8023 -s3_1: movw $0x4838, %ax # allow writing to special regs by putting
8024 - call outidx # magic number into CRT-register 0x38
8025 - movb %cl, %al # check whether we can write special reg 0x35
8034 - jnz no_s3 # no, we can't write => no S3
8042 - movb %bl, %ah # restore old value in register 0x35
8047 - jne no_s31 # writing not possible => no S3
8049 - call inidx # now get the S3 id ...
8060 -no_s3: movb $0x35, %al # restore CRT register 0x35
8063 -no_s31: xorw %bp, %bp # Detection failed
8064 -s3rest: movb %bh, %ah
8065 - movb $0x38, %al # restore old value of CRT register 0x38
8068 -idS3: .byte 0x81, 0x82, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95
8069 - .byte 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa8, 0xb0
8071 -s3_md: .byte 0x54, 0x2b, 0x84
8072 - .byte 0x55, 0x19, 0x84
8089 -idati: .ascii "761295520"
8091 -ati_md: .byte 0x23, 0x19, 0x84
8092 - .byte 0x33, 0x2c, 0x84
8093 - .byte 0x22, 0x1e, 0x64
8094 - .byte 0x21, 0x19, 0x64
8095 - .byte 0x58, 0x21, 0x50
8096 - .byte 0x5b, 0x1e, 0x50
8118 - .byte 0x22, 0x2c, 0x84
8119 - .byte 0x23, 0x19, 0x84
8120 - .byte 0x24, 0x1c, 0x84
8121 - .byte 0x2f, 0x32, 0xa0
8122 - .byte 0x32, 0x22, 0x50
8123 - .byte 0x34, 0x42, 0x50
8148 - .byte 0x60, 0x19, 0x84
8149 - .byte 0x61, 0x32, 0x84
8151 - .ascii "Chips & Technologies"
8192 -nocirr: xorw %bp, %bp
8193 -iscirr: movw $0x3d4, %dx
8202 - .byte 0x1f, 0x19, 0x84
8203 - .byte 0x20, 0x2c, 0x84
8204 - .byte 0x22, 0x1e, 0x84
8205 - .byte 0x31, 0x25, 0x64
8207 - .ascii "Cirrus Logic 5X0"
8210 -# Cirrus Logic 54XX
8215 - movb %al, %bl # BL=backup
8249 -c5fail: xorw %bp, %bp
8250 -c5done: movb $6, %al
8256 - .byte 0x14, 0x19, 0x84
8257 - .byte 0x54, 0x2b, 0x84
8259 - .ascii "Cirrus Logic 54XX"
8262 -# Cirrus Logic 64XX -- no known extra modes, but must be identified, because
8263 -# it's misidentified by the Ahead test.
8268 - movb %al, %bl # BL=backup
8280 - call inidx # 4X, 5X, 7X and 8X are valid 64XX chip ID's.
8294 -c2fail: xorw %bp, %bp
8295 -c6done: movb $0x0a, %al
8302 - .ascii "Cirrus Logic 64XX"
8320 -evtrid: leaw trident_md, %bp
8323 -noevrx: xorw %bp, %bp
8327 - .byte 0x03, 0x22, 0x50
8328 - .byte 0x04, 0x3c, 0x50
8329 - .byte 0x07, 0x2b, 0x64
8330 - .byte 0x08, 0x4b, 0x64
8331 - .byte 0x0a, 0x19, 0x84
8332 - .byte 0x0b, 0x2c, 0x84
8333 - .byte 0x16, 0x1e, 0x50
8334 - .byte 0x18, 0x1b, 0x64
8335 - .byte 0x21, 0x40, 0xa0
8336 - .byte 0x40, 0x1e, 0x84
8338 - .ascii "Everex/Trident"
8343 - leaw idgenoa, %si # Check Genoa 'clues'
8345 - movb %es:(0x37), %al
8356 - cmpb %es:(%di), %al
8364 -idgenoa: .byte 0x77, 0x00, 0x99, 0x66
8367 - .byte 0x58, 0x20, 0x50
8368 - .byte 0x5a, 0x2a, 0x64
8369 - .byte 0x60, 0x19, 0x84
8370 - .byte 0x61, 0x1d, 0x84
8371 - .byte 0x62, 0x20, 0x84
8372 - .byte 0x63, 0x2c, 0x84
8373 - .byte 0x64, 0x3c, 0x84
8374 - .byte 0x6b, 0x4f, 0x64
8375 - .byte 0x72, 0x3c, 0x50
8376 - .byte 0x74, 0x42, 0x50
8377 - .byte 0x78, 0x4b, 0x64
8384 - leaw idoakvga, %si
8394 -idoakvga: .ascii "OAK VGA "
8396 -oak_md: .byte 0x4e, 0x3c, 0x50
8397 - .byte 0x4f, 0x3c, 0x84
8398 - .byte 0x50, 0x19, 0x84
8399 - .byte 0x51, 0x2b, 0x84
8406 - leaw idparadise, %si
8416 -idparadise: .ascii "VGA="
8419 - .byte 0x41, 0x22, 0x50
8420 - .byte 0x47, 0x1c, 0x84
8421 - .byte 0x55, 0x19, 0x84
8422 - .byte 0x54, 0x2c, 0x84
8439 - movb %al, %bl # Strange thing ... in the book this wasn't
8440 - andb $0x02, %bl # necessary but it worked on my card which
8441 - jz setb2 # is a trident. Without it the screen goes
8446 -setb2: orb $0x02, %al
8447 -clrb2: outb %al, %dx
8456 - .byte 0x50, 0x1e, 0x50
8457 - .byte 0x51, 0x2b, 0x50
8458 - .byte 0x52, 0x3c, 0x50
8459 - .byte 0x57, 0x19, 0x84
8460 - .byte 0x58, 0x1e, 0x84
8461 - .byte 0x59, 0x2b, 0x84
8462 - .byte 0x5a, 0x3c, 0x84
8470 - inb %dx, %al # Could things be this simple ! :-)
8481 -isnot: xorw %bp, %bp
8485 - .byte 0x26, 0x3c, 0x50
8486 - .byte 0x2a, 0x28, 0x64
8487 - .byte 0x23, 0x19, 0x84
8488 - .byte 0x24, 0x1c, 0x84
8489 - .byte 0x22, 0x2c, 0x84
8490 - .byte 0x21, 0x3c, 0x84
8504 -even7: movb $0x0c, %al
8529 - movb $VIDEO_FIRST_V7>>8, svga_prefix # Use special mode switching
8533 - .byte 0x40, 0x2b, 0x50
8534 - .byte 0x43, 0x3c, 0x50
8535 - .byte 0x44, 0x3c, 0x64
8536 - .byte 0x41, 0x19, 0x84
8537 - .byte 0x42, 0x2c, 0x84
8538 - .byte 0x45, 0x1c, 0x84
8555 -idrtvga: .ascii "REALTEK VGA"
8558 - .byte 0x1a, 0x3c, 0x50
8559 - .byte 0x1b, 0x19, 0x84
8560 - .byte 0x1c, 0x1e, 0x84
8561 - .byte 0x1d, 0x2b, 0x84
8562 - .byte 0x1e, 0x3c, 0x84
8567 -#endif /* CONFIG_VIDEO_SVGA */
8569 -# User-defined local mode table (VGA only)
8570 -#ifdef CONFIG_VIDEO_LOCAL
8572 - leaw local_mode_table, %si
8583 -# This is the table of local video modes which can be supplied manually
8584 -# by the user. Each entry consists of mode ID (word) and dimensions
8585 -# (byte for column count and another byte for row count). These modes
8586 -# are placed before all SVGA and VESA modes and override them if table
8587 -# compacting is enabled. The table must end with a zero word followed
8588 -# by NUL-terminated video adapter name.
8590 - .word 0x0100 # Example: 40x25
8595 -#endif /* CONFIG_VIDEO_LOCAL */
8597 -# Read a key and return the ASCII code in al, scan code in ah
8598 -getkey: xorb %ah, %ah
8602 -# Read a key with a timeout of 30 seconds.
8603 -# The hardware clock is used to get the time.
8604 -getkt: call gettime
8605 - addb $30, %al # Wait 30 seconds
8612 -again: movb $0x01, %ah
8614 - jnz getkey # key pressed, so get it
8620 - movb $0x20, %al # timeout, return `space'
8623 -# Flush the keyboard buffer
8624 -flush: movb $0x01, %ah
8634 -# Print hexadecimal number.
8644 -prthn: cmpb $0x0a, %al
8648 -prth1: addb $0x30, %al
8651 -# Print decimal number in al
8663 -lt100: addb $0x30, %al
8665 -skip10: movb %ah, %al
8673 -#ifdef CONFIG_FIRMWARE_EDID
8674 - pushw %es # just save all registers
8684 - movl $0x13131313, %eax # memset block with 0x13
8691 - cmpw $0x0200, vbe_version # only do EDID on >= VBE2.0
8694 - pushw %es # save ES
8695 - xorw %di, %di # Report Capability
8697 - popw %es # ES:DI must be 0:0
8702 - popw %es # restore ES
8704 - cmpb $0x00, %ah # call successful
8707 - cmpb $0x4f, %al # function supported
8710 - movw $0x4f15, %ax # do VBE/DDC
8718 - popw %di # restore all registers
8727 -# VIDEO_SELECT-only variables
8728 -mt_end: .word 0 # End of video mode table if built
8729 -edit_buf: .space 6 # Line editor buffer
8730 -card_name: .word 0 # Pointer to adapter name
8731 -scanning: .byte 0 # Performing mode scan
8732 -do_restore: .byte 0 # Screen contents altered during mode change
8733 -svga_prefix: .byte VIDEO_FIRST_BIOS>>8 # Default prefix for BIOS modes
8734 -graphic_mode: .byte 0 # Graphic mode with a linear frame buffer
8735 -dac_size: .byte 6 # DAC bit depth
8736 -vbe_version: .word 0 # VBE bios version
8739 -keymsg: .ascii "Press <RETURN> to see video modes available, "
8740 - .ascii "<SPACE> to continue or wait 30 secs"
8741 - .byte 0x0d, 0x0a, 0
8743 -listhdr: .byte 0x0d, 0x0a
8744 - .ascii "Mode: COLSxROWS:"
8746 -crlft: .byte 0x0d, 0x0a, 0
8748 -prompt: .byte 0x0d, 0x0a
8749 - .asciz "Enter mode number or `scan': "
8751 -unknt: .asciz "Unknown mode ID. Try again."
8753 -badmdt: .ascii "You passed an undefined mode number."
8754 - .byte 0x0d, 0x0a, 0
8756 -vesaer: .ascii "Error: Scanning of VESA modes failed. Please "
8757 - .ascii "report to <mj@ucw.cz>."
8758 - .byte 0x0d, 0x0a, 0
8760 -old_name: .asciz "CGA/MDA/HGA"
8762 -ega_name: .asciz "EGA"
8764 -svga_name: .ascii " "
8766 -vga_name: .asciz "VGA"
8768 -vesa_name: .asciz "VESA"
8770 -name_bann: .asciz "Video adapter: "
8771 -#endif /* CONFIG_VIDEO_SELECT */
8774 -adapter: .byte 0 # Video adapter: 0=CGA/MDA/HGA,1=EGA,2=VGA
8775 -video_segment: .word 0xb800 # Video memory segment
8776 -force_size: .word 0 # Use this size instead of the one in BIOS vars
8777 diff -puN /dev/null arch/i386/boot/video.c
8779 +++ a/arch/i386/boot/video.c
8781 +/* -*- linux-c -*- ------------------------------------------------------- *
8783 + * Copyright (C) 1991, 1992 Linus Torvalds
8784 + * Copyright 2007 rPath, Inc. - All Rights Reserved
8786 + * This file is part of the Linux kernel, and is made available under
8787 + * the terms of the GNU General Public License version 2.
8789 + * ----------------------------------------------------------------------- */
8792 + * arch/i386/boot/video.c
8794 + * Select video mode
8802 + * Mode list variables
8804 +static struct card_info cards[]; /* List of cards to probe for */
8807 + * Common variables
8809 +int adapter; /* 0=CGA/MDA/HGC, 1=EGA, 2=VGA+ */
8811 +int force_x, force_y; /* Don't query the BIOS for cols/rows */
8813 +int do_restore = 0; /* Screen contents changed during mode flip */
8814 +int graphic_mode; /* Graphic mode with linear frame buffer */
8816 +static void store_cursor_position(void)
8824 + : "=d" (curpos), "+a" (ax), "+b" (bx)
8825 + : : "ecx", "esi", "edi");
8827 + boot_params.screen_info.orig_x = curpos;
8828 + boot_params.screen_info.orig_y = curpos >> 8;
8831 +static void store_video_mode(void)
8835 + /* N.B.: the saving of the video page here is a bit silly,
8836 + since we pretty much assume page 0 everywhere. */
8839 + : "+a" (ax), "=b" (page)
8840 + : : "ecx", "edx", "esi", "edi");
8842 + /* Not all BIOSes are clean with respect to the top bit */
8843 + boot_params.screen_info.orig_video_mode = ax & 0x7f;
8844 + boot_params.screen_info.orig_video_page = page;
8848 + * Store the video mode parameters for later usage by the kernel.
8849 + * This is done by asking the BIOS except for the rows/columns
8850 + * parameters in the default 80x25 mode -- these are set directly,
8851 + * because some very obscure BIOSes supply insane values.
8853 +static void store_mode_params(void)
8858 + /* For graphics mode, it is up to the mode-setting driver
8859 + (currently only video-vesa.c) to store the parameters */
8863 + store_cursor_position();
8864 + store_video_mode();
8866 + if (boot_params.screen_info.orig_video_mode == 0x07) {
8867 + /* MDA, HGC, or VGA in monochrome mode */
8868 + video_segment = 0xb000;
8870 + /* CGA, EGA, VGA and so forth */
8871 + video_segment = 0xb800;
8875 + font_size = rdfs16(0x485); /* Font size, BIOS area */
8876 + boot_params.screen_info.orig_video_points = font_size;
8878 + x = rdfs16(0x44a);
8879 + y = (adapter == ADAPTER_CGA) ? 25 : rdfs8(0x484)+1;
8886 + boot_params.screen_info.orig_video_cols = x;
8887 + boot_params.screen_info.orig_video_lines = y;
8890 +/* Probe the video drivers and have them generate their mode lists. */
8891 +static void probe_cards(int unsafe)
8893 + struct card_info *card;
8894 + static u8 probed[2];
8896 + if (probed[unsafe])
8899 + probed[unsafe] = 1;
8901 + for (card = video_cards; card < video_cards_end; card++) {
8902 + if (card->unsafe == unsafe) {
8904 + card->nmodes = card->probe();
8911 +/* Test if a mode is defined */
8912 +int mode_defined(u16 mode)
8914 + struct card_info *card;
8915 + struct mode_info *mi;
8918 + for (card = video_cards; card < video_cards_end; card++) {
8920 + for (i = 0; i < card->nmodes; i++, mi++) {
8921 + if (mi->mode == mode)
8929 +/* Set mode (without recalc) */
8930 +static int raw_set_mode(u16 mode)
8933 + struct card_info *card;
8934 + struct mode_info *mi;
8936 + /* Drop the recalc bit if set */
8937 + mode &= ~VIDEO_RECALC;
8939 + /* Scan for mode based on fixed ID, position, or resolution */
8941 + for (card = video_cards; card < video_cards_end; card++) {
8943 + for (i = 0; i < card->nmodes; i++, mi++) {
8944 + int visible = mi->x || mi->y;
8946 + if ((mode == nmode && visible) ||
8947 + mode == mi->mode ||
8948 + mode == (mi->y << 8)+mi->x)
8949 + return card->set_mode(mi);
8956 + /* Nothing found? Is it an "exceptional" (unprobed) mode? */
8957 + for (card = video_cards; card < video_cards_end; card++) {
8958 + if (mode >= card->xmode_first &&
8959 + mode < card->xmode_first+card->xmode_n) {
8960 + struct mode_info mix;
8962 + mix.x = mix.y = 0;
8963 + return card->set_mode(&mix);
8967 + /* Otherwise, failure... */
8972 + * Recalculate the vertical video cutoff (hack!)
8974 +static void vga_recalc_vertical(void)
8976 + unsigned int font_size, rows;
8981 + font_size = rdfs8(0x485); /* BIOS: font size (pixels) */
8982 + rows = force_y ? force_y : rdfs8(0x484)+1; /* Text rows */
8984 + rows *= font_size; /* Visible scan lines */
8985 + rows--; /* ... minus one */
8987 + crtc = vga_crtc();
8989 + out_idx((u8)rows, crtc, 0x12); /* Lower height register */
8990 + ov = in_idx(crtc, 0x07); /* Overflow register */
8992 + ov |= (rows >> (8-1)) & 0x02;
8993 + ov |= (rows >> (9-6)) & 0x40;
8994 + out_idx(ov, crtc, 0x07);
8997 +/* Set mode (with recalc if specified) */
8998 +static int set_mode(u16 mode)
9002 + /* Very special mode numbers... */
9003 + if (mode == VIDEO_CURRENT_MODE)
9004 + return 0; /* Nothing to do... */
9005 + else if (mode == NORMAL_VGA)
9006 + mode = VIDEO_80x25;
9007 + else if (mode == EXTENDED_VGA)
9008 + mode = VIDEO_8POINT;
9010 + rv = raw_set_mode(mode);
9014 + if (mode & VIDEO_RECALC)
9015 + vga_recalc_vertical();
9020 +static unsigned int get_entry(void)
9022 + char entry_buf[4];
9030 + if (key == '\b') {
9035 + } else if ((key >= '0' && key <= '9') ||
9036 + (key >= 'A' && key <= 'Z') ||
9037 + (key >= 'a' && key <= 'z')) {
9038 + if (len < sizeof entry_buf) {
9039 + entry_buf[len++] = key;
9043 + } while (key != '\r');
9047 + return VIDEO_CURRENT_MODE; /* Default */
9050 + for (i = 0; i < len; i++) {
9052 + key = entry_buf[i] | 0x20;
9053 + v += (key > '9') ? key-'a'+10 : key-'0';
9059 +static void display_menu(void)
9061 + struct card_info *card;
9062 + struct mode_info *mi;
9066 + puts("Mode: COLSxROWS:\n");
9069 + for (card = video_cards; card < video_cards_end; card++) {
9071 + for (i = 0; i < card->nmodes; i++, mi++) {
9072 + int visible = mi->x && mi->y;
9073 + u16 mode_id = mi->mode ? mi->mode :
9074 + (mi->y << 8)+mi->x;
9077 + continue; /* Hidden mode */
9079 + printf("%c %04X %3dx%-3d %s\n",
9080 + ch, mode_id, mi->x, mi->y, card->card_name);
9084 + else if (ch == 'z' || ch == ' ')
9085 + ch = ' '; /* Out of keys... */
9092 +#define H(x) ((x)-'a'+10)
9093 +#define SCAN ((H('s')<<12)+(H('c')<<8)+(H('a')<<4)+H('n'))
9095 +static unsigned int mode_menu(void)
9100 + puts("Press <ENTER> to see video modes available, "
9101 + "<SPACE> to continue, or wait 30 sec\n");
9105 + key = getchar_timeout();
9106 + if (key == ' ' || key == 0)
9107 + return VIDEO_CURRENT_MODE; /* Default */
9110 + putchar('\a'); /* Beep! */
9117 + puts("Enter a video mode or \"scan\" to scan for "
9118 + "additional modes: ");
9119 + sel = get_entry();
9127 +#ifdef CONFIG_VIDEO_RETAIN
9128 +/* Save screen content to the heap */
9129 +struct saved_screen {
9135 +static void save_screen(void)
9137 + /* Should be called after store_mode_params() */
9138 + saved.x = boot_params.screen_info.orig_video_cols;
9139 + saved.y = boot_params.screen_info.orig_video_lines;
9140 + saved.curx = boot_params.screen_info.orig_x;
9141 + saved.cury = boot_params.screen_info.orig_y;
9143 + if (heap_free() < saved.x*saved.y*sizeof(u16)+512)
9144 + return; /* Not enough heap to save the screen */
9146 + saved.data = GET_HEAP(u16, saved.x*saved.y);
9148 + set_fs(video_segment);
9149 + copy_from_fs(saved.data, 0, saved.x*saved.y*sizeof(u16));
9152 +static void restore_screen(void)
9154 + /* Should be called after store_mode_params() */
9155 + int xs = boot_params.screen_info.orig_video_cols;
9156 + int ys = boot_params.screen_info.orig_video_lines;
9159 + u16 *src = saved.data;
9163 + return; /* Can't restore onto a graphic mode */
9166 + return; /* No saved screen contents */
9168 + /* Restore screen contents */
9170 + set_fs(video_segment);
9171 + for (y = 0; y < ys; y++) {
9174 + if (y < saved.y) {
9175 + int copy = (xs < saved.x) ? xs : saved.x;
9176 + copy_to_fs(dst, src, copy*sizeof(u16));
9177 + dst += copy*sizeof(u16);
9179 + npad = (xs < saved.x) ? 0 : xs-saved.x;
9184 + /* Writes "npad" blank characters to
9185 + video_segment:dst and advances dst */
9186 + asm volatile("pushw %%es ; "
9193 + : "+D" (dst), "+c" (npad)
9194 + : "bdSm" (video_segment),
9195 + "a" (0x07200720));
9198 + /* Restore cursor position */
9199 + ax = 0x0200; /* Set cursor position */
9200 + bx = 0; /* Page number (<< 8) */
9201 + dx = (saved.cury << 8)+saved.curx;
9202 + asm volatile(INT10
9203 + : "+a" (ax), "+b" (bx), "+d" (dx)
9204 + : : "ecx", "esi", "edi");
9207 +#define save_screen() ((void)0)
9208 +#define restore_screen() ((void)0)
9211 +void set_video(void)
9213 + u16 mode = boot_params.hdr.vid_mode;
9217 + store_mode_params();
9222 + if (mode == ASK_VGA)
9223 + mode = mode_menu();
9225 + if (!set_mode(mode))
9228 + printf("Undefined video mode number: %x\n", mode);
9231 + vesa_store_edid();
9232 + store_mode_params();
9237 diff -puN /dev/null arch/i386/boot/video.h
9239 +++ a/arch/i386/boot/video.h
9241 +/* -*- linux-c -*- ------------------------------------------------------- *
9243 + * Copyright (C) 1991, 1992 Linus Torvalds
9244 + * Copyright 2007 rPath, Inc. - All Rights Reserved
9246 + * This file is part of the Linux kernel, and is made available under
9247 + * the terms of the GNU General Public License version 2.
9249 + * ----------------------------------------------------------------------- */
9252 + * arch/i386/boot/video.h
9254 + * Header file for the real-mode video probing code
9257 +#ifndef BOOT_VIDEO_H
9258 +#define BOOT_VIDEO_H
9260 +#include <linux/types.h>
9262 +/* Enable autodetection of SVGA adapters and modes. */
9263 +#undef CONFIG_VIDEO_SVGA
9265 +/* Enable autodetection of VESA modes */
9266 +#define CONFIG_VIDEO_VESA
9268 +/* Retain screen contents when switching modes */
9269 +#define CONFIG_VIDEO_RETAIN
9271 +/* Force 400 scan lines for standard modes (hack to fix bad BIOS behaviour */
9272 +#undef CONFIG_VIDEO_400_HACK
9274 +/* This code uses an extended set of video mode numbers. These include:
9275 + * Aliases for standard modes
9277 + * EXTENDED_VGA (-2)
9279 + * Video modes numbered by menu position -- NOT RECOMMENDED because of lack
9280 + * of compatibility when extending the table. These are between 0x00 and 0xff.
9282 +#define VIDEO_FIRST_MENU 0x0000
9284 +/* Standard BIOS video modes (BIOS number + 0x0100) */
9285 +#define VIDEO_FIRST_BIOS 0x0100
9287 +/* VESA BIOS video modes (VESA number + 0x0200) */
9288 +#define VIDEO_FIRST_VESA 0x0200
9290 +/* Video7 special modes (BIOS number + 0x0900) */
9291 +#define VIDEO_FIRST_V7 0x0900
9293 +/* Special video modes */
9294 +#define VIDEO_FIRST_SPECIAL 0x0f00
9295 +#define VIDEO_80x25 0x0f00
9296 +#define VIDEO_8POINT 0x0f01
9297 +#define VIDEO_80x43 0x0f02
9298 +#define VIDEO_80x28 0x0f03
9299 +#define VIDEO_CURRENT_MODE 0x0f04
9300 +#define VIDEO_80x30 0x0f05
9301 +#define VIDEO_80x34 0x0f06
9302 +#define VIDEO_80x60 0x0f07
9303 +#define VIDEO_GFX_HACK 0x0f08
9304 +#define VIDEO_LAST_SPECIAL 0x0f09
9306 +/* Video modes given by resolution */
9307 +#define VIDEO_FIRST_RESOLUTION 0x1000
9309 +/* The "recalculate timings" flag */
9310 +#define VIDEO_RECALC 0x8000
9312 +/* Define DO_STORE according to CONFIG_VIDEO_RETAIN */
9313 +#ifdef CONFIG_VIDEO_RETAIN
9314 +void store_screen(void);
9315 +#define DO_STORE() store_screen()
9317 +#define DO_STORE() ((void)0)
9318 +#endif /* CONFIG_VIDEO_RETAIN */
9321 + * Mode table structures
9325 + u16 mode; /* Mode number (vga= style) */
9326 + u8 x, y; /* Width, height */
9330 + const char *card_name;
9331 + int (*set_mode)(struct mode_info *mode);
9332 + int (*probe)(void);
9333 + struct mode_info *modes;
9334 + int nmodes; /* Number of probed modes so far */
9335 + int unsafe; /* Probing is unsafe, only do after "scan" */
9336 + u16 xmode_first; /* Unprobed modes to try to call anyway */
9337 + u16 xmode_n; /* Size of unprobed mode range */
9340 +#define __videocard struct card_info __attribute__((section(".videocards")))
9341 +extern struct card_info video_cards[], video_cards_end[];
9343 +int mode_defined(u16 mode); /* video.c */
9345 +/* Basic video information */
9346 +#define ADAPTER_CGA 0 /* CGA/MDA/HGC */
9347 +#define ADAPTER_EGA 1
9348 +#define ADAPTER_VGA 2
9350 +extern int adapter;
9351 +extern u16 video_segment;
9352 +extern int force_x, force_y; /* Don't query the BIOS for cols/rows */
9353 +extern int do_restore; /* Restore screen contents */
9354 +extern int graphic_mode; /* Graphics mode with linear frame buffer */
9357 + * int $0x10 is notorious for touching registers it shouldn't.
9358 + * gcc doesn't like %ebp being clobbered, so define it as a push/pop
9361 +#define INT10 "pushl %%ebp; int $0x10; popl %%ebp"
9363 +/* Accessing VGA indexed registers */
9364 +static inline u8 in_idx(u16 port, u8 index)
9366 + outb(index, port);
9367 + return inb(port+1);
9370 +static inline void out_idx(u8 v, u16 port, u8 index)
9372 + outw(index+(v << 8), port);
9375 +/* Writes a value to an indexed port and then reads the port again */
9376 +static inline u8 tst_idx(u8 v, u16 port, u8 index)
9378 + out_idx(port, index, v);
9379 + return in_idx(port, index);
9382 +/* Get the I/O port of the VGA CRTC */
9383 +u16 vga_crtc(void); /* video-vga.c */
9385 +#endif /* BOOT_VIDEO_H */
9386 diff -puN /dev/null arch/i386/boot/voyager.c
9388 +++ a/arch/i386/boot/voyager.c
9390 +/* -*- linux-c -*- ------------------------------------------------------- *
9392 + * Copyright (C) 1991, 1992 Linus Torvalds
9393 + * Copyright 2007 rPath, Inc. - All Rights Reserved
9395 + * This file is part of the Linux kernel, and is made available under
9396 + * the terms of the GNU General Public License version 2.
9398 + * ----------------------------------------------------------------------- */
9401 + * arch/i386/boot/voyager.c
9403 + * Get the Voyager config information
9408 +#ifdef CONFIG_X86_VOYAGER
9410 +int query_voyager(void)
9414 + /* Abuse the apm_bios_info area for this */
9415 + u8 *data_ptr = (u8 *)&boot_params.apm_bios_info;
9417 + data_ptr[0] = 0xff; /* Flag on config not found(?) */
9419 + asm("pushw %%es ; "
9422 + "movw %%es, %1 ; "
9424 + : "=qm" (err), "=rm" (es), "=D" (di)
9428 + return -1; /* Not Voyager */
9431 + copy_from_fs(data_ptr, di, 7); /* Table is 7 bytes apparently */
9435 +#endif /* CONFIG_X86_VOYAGER */
9436 diff -puN arch/i386/kernel/cpu/Makefile~git-newsetup arch/i386/kernel/cpu/Makefile
9437 diff -puN /dev/null arch/i386/kernel/cpu/addon_cpuid_features.c
9439 +++ a/arch/i386/kernel/cpu/addon_cpuid_features.c
9443 + * Routines to indentify additional cpu features that are scattered in
9447 +#include <linux/cpu.h>
9449 +#include <asm/processor.h>
9465 +void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
9469 + const struct cpuid_bit *cb;
9471 + static const struct cpuid_bit cpuid_bits[] = {
9472 + { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 },
9476 + for (cb = cpuid_bits; cb->feature; cb++) {
9478 + /* Verify that the level is valid */
9479 + max_level = cpuid_eax(cb->level & 0xffff0000);
9480 + if (max_level < cb->level ||
9481 + max_level > (cb->level | 0xffff))
9484 + cpuid(cb->level, ®s[CR_EAX], ®s[CR_EBX],
9485 + ®s[CR_ECX], ®s[CR_EDX]);
9487 + if (regs[cb->reg] & (1 << cb->bit))
9488 + set_bit(cb->feature, c->x86_capability);
9491 diff -puN arch/i386/kernel/cpu/common.c~git-newsetup arch/i386/kernel/cpu/common.c
9492 --- a/arch/i386/kernel/cpu/common.c~git-newsetup
9493 +++ a/arch/i386/kernel/cpu/common.c
9494 @@ -353,6 +353,8 @@ static void __cpuinit generic_identify(s
9495 if ( xlvl >= 0x80000004 )
9496 get_model_name(c); /* Default name */
9499 + init_scattered_cpuid_features(c);
9502 early_intel_workaround(c);
9503 diff -puN arch/i386/kernel/cpu/proc.c~git-newsetup arch/i386/kernel/cpu/proc.c
9504 --- a/arch/i386/kernel/cpu/proc.c~git-newsetup
9505 +++ a/arch/i386/kernel/cpu/proc.c
9506 @@ -29,7 +29,8 @@ static int show_cpuinfo(struct seq_file
9507 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9508 NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
9509 NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL,
9510 - NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm", "3dnowext", "3dnow",
9511 + NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm",
9512 + "3dnowext", "3dnow",
9514 /* Transmeta-defined */
9515 "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
9516 @@ -40,8 +41,9 @@ static int show_cpuinfo(struct seq_file
9517 /* Other (Linux-defined) */
9518 "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr",
9519 NULL, NULL, NULL, NULL,
9520 - "constant_tsc", "up", NULL, NULL, NULL, NULL, NULL, NULL,
9521 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9522 + "constant_tsc", "up", NULL, "arch_perfmon",
9523 + "pebs", "bts", NULL, "sync_rdtsc",
9524 + "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9525 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9527 /* Intel-defined (#2) */
9528 @@ -57,9 +59,16 @@ static int show_cpuinfo(struct seq_file
9529 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9531 /* AMD-defined (#2) */
9532 - "lahf_lm", "cmp_legacy", "svm", "extapic", "cr8legacy", "abm",
9533 - "sse4a", "misalignsse",
9534 - "3dnowprefetch", "osvw", "ibs", NULL, NULL, NULL, NULL, NULL,
9535 + "lahf_lm", "cmp_legacy", "svm", "extapic", "cr8_legacy",
9536 + "altmovcr8", "abm", "sse4a",
9537 + "misalignsse", "3dnowprefetch",
9538 + "osvw", "ibs", NULL, NULL, NULL, NULL,
9539 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9540 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9542 + /* Auxiliary (Linux-defined) */
9543 + "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9544 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9545 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9546 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9548 diff -puN arch/i386/kernel/e820.c~git-newsetup arch/i386/kernel/e820.c
9549 --- a/arch/i386/kernel/e820.c~git-newsetup
9550 +++ a/arch/i386/kernel/e820.c
9551 @@ -766,7 +766,7 @@ void __init print_memory_map(char *who)
9553 printk("(ACPI NVS)\n");
9555 - default: printk("type %lu\n", e820.map[i].type);
9556 + default: printk("type %u\n", e820.map[i].type);
9560 diff -puN arch/i386/kernel/setup.c~git-newsetup arch/i386/kernel/setup.c
9561 --- a/arch/i386/kernel/setup.c~git-newsetup
9562 +++ a/arch/i386/kernel/setup.c
9563 @@ -102,19 +102,10 @@ static unsigned int highmem_pages = -1;
9567 -struct drive_info_struct { char dummy[32]; } drive_info;
9568 -#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || \
9569 - defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
9570 -EXPORT_SYMBOL(drive_info);
9572 struct screen_info screen_info;
9573 EXPORT_SYMBOL(screen_info);
9574 struct apm_info apm_info;
9575 EXPORT_SYMBOL(apm_info);
9576 -struct sys_desc_table_struct {
9577 - unsigned short length;
9578 - unsigned char table[0];
9580 struct edid_info edid_info;
9581 EXPORT_SYMBOL_GPL(edid_info);
9582 struct ist_info ist_info;
9583 @@ -134,7 +125,7 @@ unsigned long saved_videomode;
9585 static char __initdata command_line[COMMAND_LINE_SIZE];
9587 -unsigned char __initdata boot_params[PARAM_SIZE];
9588 +struct boot_params __initdata boot_params;
9590 #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
9592 @@ -528,7 +519,6 @@ void __init setup_arch(char **cmdline_p)
9595 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
9596 - drive_info = DRIVE_INFO;
9597 screen_info = SCREEN_INFO;
9598 edid_info = EDID_INFO;
9599 apm_info.bios = APM_BIOS_INFO;
9600 diff -puN arch/i386/kernel/verify_cpu.S~git-newsetup /dev/null
9601 --- a/arch/i386/kernel/verify_cpu.S
9604 -/* Check if CPU has some minimum CPUID bits
9605 - This runs in 16bit mode so that the caller can still use the BIOS
9606 - to output errors on the screen */
9607 -#include <asm/cpufeature.h>
9608 -#include <asm/msr.h>
9611 - pushfl # Save caller passed flags
9612 - pushl $0 # Kill any dangerous flags
9615 -#if CONFIG_X86_MINIMUM_CPU_MODEL >= 4
9618 - orl $(1<<18),%eax # try setting AC
9623 - testl $(1<<18),%eax
9626 -#if REQUIRED_MASK1 != 0
9627 - pushfl # standard way to check for cpuid
9630 - xorl $0x200000,%eax
9636 - pushfl # standard way to check for cpuid
9639 - xorl $0x200000,%eax
9645 - jz bad # REQUIRED_MASK1 != 0 requires CPUID
9647 - movl $0x0,%eax # See if cpuid 1 is implemented
9650 - jb bad # no cpuid 1
9652 -#if REQUIRED_MASK1 & NEED_CMPXCHG64
9653 - /* Some VIA C3s need magic MSRs to enable CX64. Do this here */
9654 - cmpl $0x746e6543,%ebx # Cent
9656 - cmpl $0x48727561,%edx # aurH
9658 - cmpl $0x736c7561,%ecx # auls
9660 - movl $1,%eax # check model
9665 - cmp $6,%ebx # check family == 6
9669 - cmpl $6,%eax # check model >= 6
9671 - # assume models >= 6 all support this MSR
9672 - movl $MSR_VIA_FCR,%ecx
9674 - orl $((1<<1)|(1<<7)),%eax # enable CMPXCHG64 and PGE
9678 - movl $0x1,%eax # Does the cpu have what it takes
9681 -#if CONFIG_X86_MINIMUM_CPU_MODEL > 4
9682 -#error add proper model checking here
9685 - andl $REQUIRED_MASK1,%edx
9686 - xorl $REQUIRED_MASK1,%edx
9688 -#endif /* REQUIRED_MASK1 */
9698 diff -puN arch/x86_64/Kconfig~git-newsetup arch/x86_64/Kconfig
9699 --- a/arch/x86_64/Kconfig~git-newsetup
9700 +++ a/arch/x86_64/Kconfig
9701 @@ -453,6 +453,10 @@ config NR_CPUS
9702 This is purely to save memory - each supported CPU requires
9703 memory in the static kernel configuration.
9705 +config PHYSICAL_ALIGN
9707 + default "0x200000"
9710 bool "Support for suspend on SMP and hot-pluggable CPUs (EXPERIMENTAL)"
9711 depends on SMP && HOTPLUG && EXPERIMENTAL
9712 diff -puN arch/x86_64/boot/Makefile~git-newsetup arch/x86_64/boot/Makefile
9713 --- a/arch/x86_64/boot/Makefile~git-newsetup
9714 +++ a/arch/x86_64/boot/Makefile
9717 # arch/x86_64/boot/Makefile
9719 -# This file is subject to the terms and conditions of the GNU General Public
9720 -# License. See the file "COPYING" in the main directory of this archive
9721 -# for more details.
9723 -# Copyright (C) 1994 by Linus Torvalds
9726 -# ROOT_DEV specifies the default root-device when making the image.
9727 -# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
9728 -# the default of FLOPPY is used by 'build'.
9730 -ROOT_DEV := CURRENT
9732 -# If you want to preset the SVGA mode, uncomment the next line and
9733 -# set SVGA_MODE to whatever number you want.
9734 -# Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
9735 -# The number is the same as you would ordinarily press at bootup.
9737 -SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
9739 -# If you want the RAM disk device, define this to be the size in blocks.
9741 -#RAMDISK := -DRAMDISK=512
9743 -targets := vmlinux.bin bootsect bootsect.o \
9744 - setup setup.o bzImage mtools.conf
9746 -EXTRA_CFLAGS := -m32
9748 -hostprogs-y := tools/build
9749 -HOST_EXTRACFLAGS += $(LINUXINCLUDE)
9750 -subdir- := compressed/ #Let make clean descend in compressed/
9751 -# ---------------------------------------------------------------------------
9753 -$(obj)/bzImage: IMAGE_OFFSET := 0x100000
9754 -$(obj)/bzImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
9755 -$(obj)/bzImage: BUILDFLAGS := -b
9757 -quiet_cmd_image = BUILD $@
9758 -cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \
9759 - $(obj)/vmlinux.bin $(ROOT_DEV) > $@
9761 -$(obj)/bzImage: $(obj)/bootsect $(obj)/setup \
9762 - $(obj)/vmlinux.bin $(obj)/tools/build FORCE
9763 - $(call if_changed,image)
9764 - @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
9766 -$(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
9767 - $(call if_changed,objcopy)
9769 -LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
9770 -LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext
9772 -$(obj)/setup $(obj)/bootsect: %: %.o FORCE
9773 - $(call if_changed,ld)
9775 -$(obj)/compressed/vmlinux: FORCE
9776 - $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@
9778 -# Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel
9780 -# Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel
9783 -image_cmdline = default linux $(FDARGS) $(if $(FDINITRD),initrd=initrd.img,)
9785 -$(obj)/mtools.conf: $(src)/mtools.conf.in
9786 - sed -e 's|@OBJ@|$(obj)|g' < $< > $@
9788 -# This requires write access to /dev/fd0
9789 -zdisk: $(BOOTIMAGE) $(obj)/mtools.conf
9790 - MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync
9791 - syslinux /dev/fd0 ; sync
9792 - echo '$(image_cmdline)' | \
9793 - MTOOLSRC=$(obj)/mtools.conf mcopy - a:syslinux.cfg
9794 - if [ -f '$(FDINITRD)' ] ; then \
9795 - MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' a:initrd.img ; \
9797 - MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync
9799 -# These require being root or having syslinux 2.02 or higher installed
9800 -fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf
9801 - dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440
9802 - MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync
9803 - syslinux $(obj)/fdimage ; sync
9804 - echo '$(image_cmdline)' | \
9805 - MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg
9806 - if [ -f '$(FDINITRD)' ] ; then \
9807 - MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' v:initrd.img ; \
9809 - MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync
9811 -fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf
9812 - dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880
9813 - MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync
9814 - syslinux $(obj)/fdimage ; sync
9815 - echo '$(image_cmdline)' | \
9816 - MTOOLSRC=$(obj)/mtools.conf mcopy - w:syslinux.cfg
9817 - if [ -f '$(FDINITRD)' ] ; then \
9818 - MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' w:initrd.img ; \
9820 - MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync
9822 -isoimage: $(BOOTIMAGE)
9823 - -rm -rf $(obj)/isoimage
9824 - mkdir $(obj)/isoimage
9825 - for i in lib lib64 share end ; do \
9826 - if [ -f /usr/$$i/syslinux/isolinux.bin ] ; then \
9827 - cp /usr/$$i/syslinux/isolinux.bin $(obj)/isoimage ; \
9830 - if [ $$i = end ] ; then exit 1 ; fi ; \
9832 - cp $(BOOTIMAGE) $(obj)/isoimage/linux
9833 - echo '$(image_cmdline)' > $(obj)/isoimage/isolinux.cfg
9834 - if [ -f '$(FDINITRD)' ] ; then \
9835 - cp '$(FDINITRD)' $(obj)/isoimage/initrd.img ; \
9837 - mkisofs -J -r -o $(obj)/image.iso -b isolinux.bin -c boot.cat \
9838 - -no-emul-boot -boot-load-size 4 -boot-info-table \
9840 - rm -rf $(obj)/isoimage
9842 -zlilo: $(BOOTIMAGE)
9843 - if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi
9844 - if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi
9845 - cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz
9846 - cp System.map $(INSTALL_PATH)/
9847 - if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
9848 +# The actual boot code is shared with i386 including the Makefile.
9849 +# So tell kbuild that we fetch the code from i386 and include the
9850 +# Makefile from i386 too.
9853 - sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
9854 +src := arch/i386/boot
9855 +include $(src)/Makefile
9856 diff -puN arch/x86_64/boot/bootsect.S~git-newsetup /dev/null
9857 --- a/arch/x86_64/boot/bootsect.S
9861 - * bootsect.S Copyright (C) 1991, 1992 Linus Torvalds
9863 - * modified by Drew Eckhardt
9864 - * modified by Bruce Evans (bde)
9865 - * modified by Chris Noe (May 1999) (as86 -> gas)
9866 - * gutted by H. Peter Anvin (Jan 2003)
9868 - * BIG FAT NOTE: We're in real mode using 64k segments. Therefore segment
9869 - * addresses must be multiplied by 16 to obtain their respective linear
9870 - * addresses. To avoid confusion, linear addresses are written using leading
9871 - * hex while segment addresses are written as segment:offset.
9875 -#include <asm/boot.h>
9877 -SETUPSECTS = 4 /* default nr of setup-sectors */
9878 -BOOTSEG = 0x07C0 /* original address of boot-sector */
9879 -INITSEG = DEF_INITSEG /* we move boot here - out of the way */
9880 -SETUPSEG = DEF_SETUPSEG /* setup starts here */
9881 -SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */
9882 -SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */
9883 - /* to be loaded */
9884 -ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */
9885 -SWAP_DEV = 0 /* SWAP_DEV is now written by "build" */
9888 -#define SVGA_MODE ASK_VGA
9895 -#ifndef ROOT_RDONLY
9896 -#define ROOT_RDONLY 1
9905 - # Normalize the start address
9906 - jmpl $BOOTSEG, $start2
9917 - movw $bugger_off_msg, %si
9929 - # Allow the user to press a key, then reboot
9934 - # int 0x19 should never return. In case it does anyway,
9935 - # invoke the BIOS reset code...
9936 - ljmp $0xf000,$0xfff0
9940 - .ascii "Direct booting from floppy is no longer supported.\r\n"
9941 - .ascii "Please use a boot loader program instead.\r\n"
9943 - .ascii "Remove disk and press any key to reboot . . .\r\n"
9947 - # Kernel attributes; used by setup
9950 -setup_sects: .byte SETUPSECTS
9951 -root_flags: .word ROOT_RDONLY
9952 -syssize: .word SYSSIZE
9953 -swap_dev: .word SWAP_DEV
9954 -ram_size: .word RAMDISK
9955 -vid_mode: .word SVGA_MODE
9956 -root_dev: .word ROOT_DEV
9957 -boot_flag: .word 0xAA55
9958 diff -puN arch/x86_64/boot/compressed/Makefile~git-newsetup arch/x86_64/boot/compressed/Makefile
9959 --- a/arch/x86_64/boot/compressed/Makefile~git-newsetup
9960 +++ a/arch/x86_64/boot/compressed/Makefile
9964 targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
9965 -EXTRA_AFLAGS := -traditional
9967 -# cannot use EXTRA_CFLAGS because base CFLAGS contains -mkernel which conflicts with
9969 -CFLAGS := -m64 -D__KERNEL__ -Iinclude -O2 -fno-strict-aliasing -fPIC -mcmodel=small -fno-builtin
9970 +CFLAGS := -m64 -D__KERNEL__ $(LINUXINCLUDE) -O2 \
9971 + -fno-strict-aliasing -fPIC -mcmodel=small \
9972 + $(call cc-option, -ffreestanding) \
9973 + $(call cc-option, -fno-stack-protector)
9974 +AFLAGS := $(CFLAGS) -D__ASSEMBLY__
9975 LDFLAGS := -m elf_x86_64
9977 LDFLAGS_vmlinux := -T
9978 diff -puN arch/x86_64/boot/compressed/head.S~git-newsetup arch/x86_64/boot/compressed/head.S
9979 --- a/arch/x86_64/boot/compressed/head.S~git-newsetup
9980 +++ a/arch/x86_64/boot/compressed/head.S
9981 @@ -46,10 +46,10 @@ startup_32:
9982 * at and where we were actually loaded at. This can only be done
9983 * with a short local call on x86. Nothing else will tell us what
9984 * address we are running at. The reserved chunk of the real-mode
9985 - * data at 0x34-0x3f are used as the stack for this calculation.
9986 - * Only 4 bytes are needed.
9987 + * data at 0x1e4 (defined as a scratch field) are used as the stack
9988 + * for this calculation. Only 4 bytes are needed.
9990 - leal 0x40(%esi), %esp
9991 + leal (0x1e4+4)(%esi), %esp
9995 diff -puN arch/x86_64/boot/install.sh~git-newsetup /dev/null
9996 --- a/arch/x86_64/boot/install.sh
10000 -. $srctree/arch/i386/boot/install.sh
10001 diff -puN arch/x86_64/boot/mtools.conf.in~git-newsetup /dev/null
10002 --- a/arch/x86_64/boot/mtools.conf.in
10006 -# mtools configuration file for "make (b)zdisk"
10009 -# Actual floppy drive
10013 -# 1.44 MB floppy disk image
10015 - file="@OBJ@/fdimage" cylinders=80 heads=2 sectors=18 filter
10017 -# 2.88 MB floppy disk image (mostly for virtual uses)
10019 - file="@OBJ@/fdimage" cylinders=80 heads=2 sectors=36 filter
10022 diff -puN arch/x86_64/boot/setup.S~git-newsetup /dev/null
10023 --- a/arch/x86_64/boot/setup.S
10027 - * setup.S Copyright (C) 1991, 1992 Linus Torvalds
10029 - * setup.s is responsible for getting the system data from the BIOS,
10030 - * and putting them into the appropriate places in system memory.
10031 - * both setup.s and system has been loaded by the bootblock.
10033 - * This code asks the bios for memory/disk/other parameters, and
10034 - * puts them in a "safe" place: 0x90000-0x901FF, ie where the
10035 - * boot-block used to be. It is then up to the protected mode
10036 - * system to read them from there before the area is overwritten
10037 - * for buffer-blocks.
10039 - * Move PS/2 aux init code to psaux.c
10040 - * (troyer@saifr00.cfsat.Honeywell.COM) 03Oct92
10042 - * some changes and additional features by Christoph Niemann,
10043 - * March 1993/June 1994 (Christoph.Niemann@linux.org)
10045 - * add APM BIOS checking by Stephen Rothwell, May 1994
10046 - * (sfr@canb.auug.org.au)
10048 - * High load stuff, initrd support and position independency
10049 - * by Hans Lermen & Werner Almesberger, February 1996
10050 - * <lermen@elserv.ffm.fgan.de>, <almesber@lrc.epfl.ch>
10052 - * Video handling moved to video.S by Martin Mares, March 1996
10053 - * <mj@k332.feld.cvut.cz>
10055 - * Extended memory detection scheme retwiddled by orc@pell.chi.il.us (david
10056 - * parsons) to avoid loadlin confusion, July 1997
10058 - * Transcribed from Intel (as86) -> AT&T (gas) by Chris Noe, May 1999.
10059 - * <stiker@northlink.com>
10061 - * Fix to work around buggy BIOSes which don't use carry bit correctly
10062 - * and/or report extended memory in CX/DX for e801h memory size detection
10063 - * call. As a result the kernel got wrong figures. The int15/e801h docs
10064 - * from Ralf Brown interrupt list seem to indicate AX/BX should be used
10065 - * anyway. So to avoid breaking many machines (presumably there was a reason
10066 - * to orginally use CX/DX instead of AX/BX), we do a kludge to see
10067 - * if CX/DX have been changed in the e801 call and if so use AX/BX .
10068 - * Michael Miller, April 2001 <michaelm@mjmm.org>
10070 - * Added long mode checking and SSE force. March 2003, Andi Kleen.
10073 -#include <asm/segment.h>
10074 -#include <linux/utsrelease.h>
10075 -#include <linux/compile.h>
10076 -#include <asm/boot.h>
10077 -#include <asm/e820.h>
10078 -#include <asm/page.h>
10079 -#include <asm/setup.h>
10081 -/* Signature words to ensure LILO loaded us right */
10082 -#define SIG1 0xAA55
10083 -#define SIG2 0x5A5A
10085 -INITSEG = DEF_INITSEG # 0x9000, we move boot here, out of the way
10086 -SYSSEG = DEF_SYSSEG # 0x1000, system loaded at 0x10000 (65536).
10087 -SETUPSEG = DEF_SETUPSEG # 0x9020, this is the current segment
10088 - # ... and the former contents of CS
10090 -DELTA_INITSEG = SETUPSEG - INITSEG # 0x0020
10093 -.globl begtext, begdata, begbss, endtext, enddata, endbss
10106 -# This is the setup header, and it must start at %cs:2 (old 0x9020:2)
10108 - .ascii "HdrS" # header signature
10109 - .word 0x0206 # header version number (>= 0x0105)
10110 - # or else old loadlin-1.5 will fail)
10111 -realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
10112 -start_sys_seg: .word SYSSEG
10113 - .word kernel_version # pointing to kernel version string
10114 - # above section of header is compatible
10115 - # with loadlin-1.5 (header v1.5). Don't
10118 -type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin,
10119 - # Bootlin, SYSLX, bootsect...)
10120 - # See Documentation/i386/boot.txt for
10123 -# flags, unused bits must be zero (RFU) bit within loadflags
10125 -LOADED_HIGH = 1 # If set, the kernel is loaded high
10126 -CAN_USE_HEAP = 0x80 # If set, the loader also has set
10127 - # heap_end_ptr to tell how much
10128 - # space behind setup.S can be used for
10130 - # Only the loader knows what is free
10131 -#ifndef __BIG_KERNEL__
10134 - .byte LOADED_HIGH
10137 -setup_move_size: .word 0x8000 # size to move, when setup is not
10138 - # loaded at 0x90000. We will move setup
10139 - # to 0x90000 then just before jumping
10140 - # into the kernel. However, only the
10141 - # loader knows how much data behind
10142 - # us also needs to be loaded.
10144 -code32_start: # here loaders can put a different
10145 - # start address for 32-bit code.
10146 -#ifndef __BIG_KERNEL__
10147 - .long 0x1000 # 0x1000 = default for zImage
10149 - .long 0x100000 # 0x100000 = default for big kernel
10152 -ramdisk_image: .long 0 # address of loaded ramdisk image
10153 - # Here the loader puts the 32-bit
10154 - # address where it loaded the image.
10155 - # This only will be read by the kernel.
10157 -ramdisk_size: .long 0 # its size in bytes
10160 - .long 0 # obsolete
10162 -heap_end_ptr: .word modelist+1024 # (Header version 0x0201 or later)
10163 - # space from here (exclusive) down to
10164 - # end of setup code can be used by setup
10165 - # for local heap purposes.
10168 -cmd_line_ptr: .long 0 # (Header version 0x0202 or later)
10169 - # If nonzero, a 32-bit pointer
10170 - # to the kernel command line.
10171 - # The command line should be
10172 - # located between the start of
10173 - # setup and the end of low
10174 - # memory (0xa0000), or it may
10175 - # get overwritten before it
10176 - # gets read. If this field is
10177 - # used, there is no longer
10178 - # anything magical about the
10179 - # 0x90000 segment; the setup
10180 - # can be located anywhere in
10181 - # low memory 0x10000 or higher.
10183 -ramdisk_max: .long 0xffffffff
10184 -kernel_alignment: .long 0x200000 # physical addr alignment required for
10185 - # protected mode relocatable kernel
10186 -#ifdef CONFIG_RELOCATABLE
10187 -relocatable_kernel: .byte 1
10189 -relocatable_kernel: .byte 0
10194 -cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line,
10195 - #added with boot protocol
10198 -trampoline: call start_of_setup
10200 - # The offset at this point is 0x240
10201 - .space (0xeff-0x240+1) # E820 & EDD space (ending at 0xeff)
10202 -# End of setup header #####################################################
10205 -# Bootlin depends on this being done early
10206 - movw $0x01500, %ax
10210 -#ifdef SAFE_RESET_DISK_CONTROLLER
10211 -# Reset the disk controller.
10212 - movw $0x0000, %ax
10217 -# Set %ds = %cs, we know that SETUPSEG = %cs at this point
10218 - movw %cs, %ax # aka SETUPSEG
10220 -# Check signature at end of setup
10221 - cmpw $SIG1, setup_sig1
10224 - cmpw $SIG2, setup_sig2
10229 -# Routine to print asciiz string at ds:si
10241 -prtsp2: call prtspc # Print double space
10242 -prtspc: movb $0x20, %al # Print single space (note: fall-thru)
10255 -beep: movb $0x07, %al
10258 -no_sig_mess: .string "No setup signature found ..."
10263 -# We now have to find the rest of the setup code/data
10265 - movw %cs, %ax # SETUPSEG
10266 - subw $DELTA_INITSEG, %ax # INITSEG
10269 - movb (497), %bl # get setup sect from bootsect
10270 - subw $4, %bx # LILO loads 4 sectors of setup
10271 - shlw $8, %bx # convert to words (1sect=2^8 words)
10273 - shrw $3, %bx # convert to segment
10274 - addw $SYSSEG, %bx
10275 - movw %bx, %cs:start_sys_seg
10276 -# Move rest of setup code/data to here
10277 - movw $2048, %di # four sectors loaded by LILO
10279 - movw %cs, %ax # aka SETUPSEG
10281 - movw $SYSSEG, %ax
10285 - movw %cs, %ax # aka SETUPSEG
10287 - cmpw $SIG1, setup_sig1
10290 - cmpw $SIG2, setup_sig2
10296 - lea no_sig_mess, %si
10303 - movw %cs, %ax # aka SETUPSEG
10304 - subw $DELTA_INITSEG, %ax # aka INITSEG
10306 -# Check if an old loader tries to load a big-kernel
10307 - testb $LOADED_HIGH, %cs:loadflags # Do we have a big kernel?
10308 - jz loader_ok # No, no danger for old loaders.
10310 - cmpb $0, %cs:type_of_loader # Do we have a loader that
10311 - # can deal with us?
10312 - jnz loader_ok # Yes, continue.
10314 - pushw %cs # No, we have an old loader,
10316 - lea loader_panic_mess, %si
10321 -loader_panic_mess: .string "Wrong loader, giving up..."
10324 - /* check for long mode. */
10325 - /* we have to do this before the VESA setup, otherwise the user
10326 - can't see the error message. */
10338 - lea long_mode_panic,%si
10341 - jmp no_longmode_loop
10343 - .string "Your CPU does not support long mode. Use a 32bit distribution."
10346 -#include "../kernel/verify_cpu.S"
10350 -# tell BIOS we want to go to long mode
10351 - movl $0xec00,%eax # declare target operating mode
10352 - movl $2,%ebx # long mode
10355 -# Get memory size (extended mem, kB)
10358 - movl %eax, (0x1e0)
10359 -#ifndef STANDARD_MEMORY_BIOS_CALL
10360 - movb %al, (E820NR)
10361 -# Try three different memory detection schemes. First, try
10362 -# e820h, which lets us assemble a memory map, then try e801h,
10363 -# which returns a 32-bit memory size, and finally 88h, which
10367 -# the memory map from hell. e820h returns memory classified into
10368 -# a whole bunch of different types, and allows memory holes and
10369 -# everything. We scan through this memory map and build a list
10370 -# of the first 32 memory areas, which we return at [E820MAP].
10371 -# This is documented at http://www.acpi.info/, in the ACPI 2.0 specification.
10373 -#define SMAP 0x534d4150
10376 - xorl %ebx, %ebx # continuation counter
10377 - movw $E820MAP, %di # point into the whitelist
10378 - # so we can have the bios
10379 - # directly write into it.
10382 - movl $0x0000e820, %eax # e820, upper word zeroed
10383 - movl $SMAP, %edx # ascii 'SMAP'
10384 - movl $20, %ecx # size of the e820rec
10385 - pushw %ds # data record.
10387 - int $0x15 # make the call
10388 - jc bail820 # fall to e801 if it fails
10390 - cmpl $SMAP, %eax # check the return is `SMAP'
10391 - jne bail820 # fall to e801 if it fails
10393 -# cmpl $1, 16(%di) # is this usable memory?
10396 - # If this is usable memory, we save it by simply advancing %di by
10397 - # sizeof(e820rec).
10400 - movb (E820NR), %al # up to 128 entries
10401 - cmpb $E820MAX, %al
10409 - cmpl $0, %ebx # check to see if
10410 - jne jmpe820 # %ebx is set to EOF
10415 -# memory size is in 1k chunksizes, to avoid confusing loadlin.
10416 -# we store the 0xe801 memory size in a completely different place,
10417 -# because it will most likely be longer than 16 bits.
10418 -# (use 1e0 because that's what Larry Augustine uses in his
10419 -# alternative new memory detection scheme, and it's sensible
10420 -# to write everything into the same place.)
10423 - stc # fix to work around buggy
10424 - xorw %cx,%cx # BIOSes which don't clear/set
10425 - xorw %dx,%dx # carry on pass/error of
10426 - # e801h memory size call
10427 - # or merely pass cx,dx though
10428 - # without changing them.
10429 - movw $0xe801, %ax
10433 - cmpw $0x0, %cx # Kludge to handle BIOSes
10434 - jne e801usecxdx # which report their extended
10435 - cmpw $0x0, %dx # memory in AX/BX rather than
10436 - jne e801usecxdx # CX/DX. The spec I have read
10437 - movw %ax, %cx # seems to indicate AX/BX
10438 - movw %bx, %dx # are more reasonable anyway...
10441 - andl $0xffff, %edx # clear sign extend
10442 - shll $6, %edx # and go from 64k to 1k chunks
10443 - movl %edx, (0x1e0) # store extended memory size
10444 - andl $0xffff, %ecx # clear sign extend
10445 - addl %ecx, (0x1e0) # and add lower memory into
10448 -# Ye Olde Traditional Methode. Returns the memory size (up to 16mb or
10449 -# 64mb, depending on the bios) in ax.
10457 -# Set the keyboard repeat rate to the max
10458 - movw $0x0305, %ax
10462 -# Check for video adapter and its parameters and allow the
10463 -# user to browse video modes.
10464 - call video # NOTE: we need %ds pointing
10470 - ldsw (4 * 0x41), %si
10471 - movw %cs, %ax # aka SETUPSEG
10472 - subw $DELTA_INITSEG, %ax # aka INITSEG
10475 - movw $0x0080, %di
10484 - ldsw (4 * 0x46), %si
10487 - movw $0x0090, %di
10490 -# Check that there IS a hd1 :-)
10491 - movw $0x01500, %ax
10500 - movw %cs, %ax # aka SETUPSEG
10501 - subw $DELTA_INITSEG, %ax # aka INITSEG
10503 - movw $0x0090, %di
10511 -# Check for PS/2 pointing device
10512 - movw %cs, %ax # aka SETUPSEG
10513 - subw $DELTA_INITSEG, %ax # aka INITSEG
10515 - movb $0, (0x1ff) # default is no pointing device
10516 - int $0x11 # int 0x11: equipment list
10517 - testb $0x04, %al # check if mouse installed
10520 - movb $0xAA, (0x1ff) # device present
10523 -#include "../../i386/boot/edd.S"
10525 -# Now we want to move to protected mode ...
10526 - cmpw $0, %cs:realmode_swtch
10527 - jz rmodeswtch_normal
10529 - lcall *%cs:realmode_swtch
10531 - jmp rmodeswtch_end
10533 -rmodeswtch_normal:
10535 - call default_switch
10538 -# we get the code32 start address and modify the below 'jmpi'
10539 -# (loader may have changed it)
10540 - movl %cs:code32_start, %eax
10541 - movl %eax, %cs:code32
10543 -# Now we move the system to its rightful place ... but we check if we have a
10544 -# big-kernel. In that case we *must* not move it ...
10545 - testb $LOADED_HIGH, %cs:loadflags
10546 - jz do_move0 # .. then we have a normal low
10548 - # .. or else we have a high
10550 - jmp end_move # ... and we skip moving
10553 - movw $0x100, %ax # start of destination segment
10554 - movw %cs, %bp # aka SETUPSEG
10555 - subw $DELTA_INITSEG, %bp # aka INITSEG
10556 - movw %cs:start_sys_seg, %bx # start of source segment
10559 - movw %ax, %es # destination segment
10560 - incb %ah # instead of add ax,#0x100
10561 - movw %bx, %ds # source segment
10568 - cmpw %bp, %bx # assume start_sys_seg > 0x200,
10569 - # so we will perhaps read one
10570 - # page more than needed, but
10571 - # never overwrite INITSEG
10572 - # because destination is a
10573 - # minimum one page below source
10577 -# then we load the segment descriptors
10578 - movw %cs, %ax # aka SETUPSEG
10581 -# Check whether we need to be downward compatible with version <=201
10582 - cmpl $0, cmd_line_ptr
10583 - jne end_move_self # loader uses version >=202 features
10584 - cmpb $0x20, type_of_loader
10585 - je end_move_self # bootsect loader, we know of it
10587 -# Boot loader doesnt support boot protocol version 2.02.
10588 -# If we have our code not at 0x90000, we need to move it there now.
10589 -# We also then need to move the params behind it (commandline)
10590 -# Because we would overwrite the code on the current IP, we move
10591 -# it in two steps, jumping high after the first one.
10593 - cmpw $SETUPSEG, %ax
10596 - cli # make sure we really have
10597 - # interrupts disabled !
10598 - # because after this the stack
10599 - # should not be used
10600 - subw $DELTA_INITSEG, %ax # aka INITSEG
10605 - addw $INITSEG, %dx
10606 - subw %ax, %dx # this will go into %ss after
10610 - movw $INITSEG, %ax # real INITSEG
10612 - movw %cs:setup_move_size, %cx
10613 - std # we have to move up, so we use
10614 - # direction down because the
10615 - # areas may overlap
10619 - subw $move_self_here+0x200, %cx
10622 - ljmp $SETUPSEG, $move_self_here
10625 - movw $move_self_here+0x200, %cx
10628 - movw $SETUPSEG, %ax
10631 -end_move_self: # now we are at the right place
10632 - lidt idt_48 # load idt with 0,0
10633 - xorl %eax, %eax # Compute gdt_base
10634 - movw %ds, %ax # (Convert %ds:gdt to a linear ptr)
10637 - movl %eax, (gdt_48+2)
10638 - lgdt gdt_48 # load gdt with whatever is
10641 -# that was painless, now we enable a20
10644 - movb $0xD1, %al # command write
10648 - movb $0xDF, %al # A20 on
10653 -# You must preserve the other bits here. Otherwise embarrasing things
10654 -# like laptops powering off on boot happen. Corrected version by Kira
10655 -# Brown from Linux 2.2
10658 - orb $02, %al # "fast A20" version
10659 - outb %al, $0x92 # some chips have only this
10661 -# wait until a20 really *is* enabled; it can take a fair amount of
10662 -# time on certain systems; Toshiba Tecras are known to have this
10663 -# problem. The memory location used here (0x200) is the int 0x80
10664 -# vector, which should be safe to use.
10666 - xorw %ax, %ax # segment 0x0000
10668 - decw %ax # segment 0xffff (HMA)
10671 - incw %ax # unused memory location <0xfff0
10672 - movw %ax, %fs:(0x200) # we use the "int 0x80" vector
10673 - cmpw %gs:(0x210), %ax # and its corresponding HMA addr
10674 - je a20_wait # loop until no longer aliased
10676 -# make sure any possible coprocessor is properly reset..
10684 -# well, that went ok, I hope. Now we mask all interrupts - the rest
10685 -# is done in init_IRQ().
10686 - movb $0xFF, %al # mask all interrupts for now
10690 - movb $0xFB, %al # mask all irq's but irq2 which
10691 - outb %al, $0x21 # is cascaded
10693 -# Well, that certainly wasn't fun :-(. Hopefully it works, and we don't
10694 -# need no steenking BIOS anyway (except for the initial loading :-).
10695 -# The BIOS-routine wants lots of unnecessary data, and it's less
10696 -# "interesting" anyway. This is how REAL programmers do it.
10698 -# Well, now's the time to actually move into protected mode. To make
10699 -# things as simple as possible, we do no register set-up or anything,
10700 -# we let the gnu-compiled 32-bit programs do that. We just jump to
10701 -# absolute address 0x1000 (or the loader supplied one),
10702 -# in 32-bit protected mode.
10704 -# Note that the short jump isn't strictly needed, although there are
10705 -# reasons why it might be a good idea. It won't hurt in any case.
10706 - movw $1, %ax # protected mode (PE) bit
10707 - lmsw %ax # This is it!
10711 - xorw %bx, %bx # Flag to indicate a boot
10712 - xorl %esi, %esi # Pointer to real-mode code
10714 - subw $DELTA_INITSEG, %si
10715 - shll $4, %esi # Convert to 32-bit pointer
10716 -# NOTE: For high loaded big kernels we need a
10717 -# jmpi 0x100000,__KERNEL_CS
10719 -# but we yet haven't reloaded the CS register, so the default size
10720 -# of the target offset still is 16 bit.
10721 -# However, using an operand prefix (0x66), the CPU will properly
10722 -# take our 48 bit far pointer. (INTeL 80386 Programmer's Reference
10723 -# Manual, Mixing 16-bit and 32-bit code, page 16-6)
10725 - .byte 0x66, 0xea # prefix + jmpi-opcode
10726 -code32: .long 0x1000 # will be set to 0x100000
10727 - # for big kernels
10728 - .word __KERNEL_CS
10730 -# Here's a bunch of information about your current kernel..
10731 -kernel_version: .ascii UTS_RELEASE
10733 - .ascii LINUX_COMPILE_BY
10735 - .ascii LINUX_COMPILE_HOST
10737 - .ascii UTS_VERSION
10740 -# This is the default real mode switch routine.
10741 -# to be called just before protected mode transition
10743 - cli # no interrupts allowed !
10744 - movb $0x80, %al # disable NMI for bootup
10750 -# This routine checks that the keyboard command queue is empty
10751 -# (after emptying the output buffers)
10753 -# Some machines have delusions that the keyboard buffer is always full
10754 -# with no keyboard attached...
10756 -# If there is no keyboard controller, we will usually get 0xff
10757 -# to all the reads. With each IO taking a microsecond and
10758 -# a timeout of 100,000 iterations, this can take about half a
10759 -# second ("delay" == outb to port 0x80). That should be ok,
10760 -# and should also be plenty of time for a real keyboard controller
10766 - movl $100000, %ecx
10770 - jz empty_8042_end_loop
10774 - inb $0x64, %al # 8042 status port
10775 - testb $1, %al # output buffer?
10779 - inb $0x60, %al # read it
10780 - jmp empty_8042_loop
10783 - testb $2, %al # is input buffer full?
10784 - jnz empty_8042_loop # yes - loop
10785 -empty_8042_end_loop:
10789 -# Read the cmos clock. Return the seconds in al
10794 - movb %dh, %al # %dh contains the seconds
10803 -# Delay is needed after doing I/O
10808 -# Descriptor tables
10810 - .word 0, 0, 0, 0 # dummy
10812 - .word 0, 0, 0, 0 # unused
10814 - .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
10815 - .word 0 # base address = 0
10816 - .word 0x9A00 # code read/exec
10817 - .word 0x00CF # granularity = 4096, 386
10818 - # (+5th nibble of limit)
10820 - .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
10821 - .word 0 # base address = 0
10822 - .word 0x9200 # data read/write
10823 - .word 0x00CF # granularity = 4096, 386
10824 - # (+5th nibble of limit)
10827 - .word 0 # idt limit = 0
10828 - .word 0, 0 # idt base = 0L
10830 - .word gdt_end-gdt-1 # gdt limit
10831 - .word 0, 0 # gdt base (filled in later)
10833 -# Include video setup & detection code
10835 -#include "../../i386/boot/video.S"
10837 -# Setup signature -- must be last
10838 -setup_sig1: .word SIG1
10839 -setup_sig2: .word SIG2
10841 -# After this point, there is some free space which is used by the video mode
10842 -# handling code to store the temporary mode table (not used by the kernel).
10852 diff -puN arch/x86_64/boot/tools/build.c~git-newsetup /dev/null
10853 --- a/arch/x86_64/boot/tools/build.c
10857 - * Copyright (C) 1991, 1992 Linus Torvalds
10858 - * Copyright (C) 1997 Martin Mares
10862 - * This file builds a disk-image from three different files:
10864 - * - bootsect: compatibility mbr which prints an error message if
10865 - * someone tries to boot the kernel directly.
10866 - * - setup: 8086 machine code, sets up system parm
10867 - * - system: 80386 code for actual system
10869 - * It does some checking that all files are of the correct type, and
10870 - * just writes the result to stdout, removing headers and padding to
10871 - * the right amount. It also writes some system data to stderr.
10875 - * Changes by tytso to allow root device specification
10876 - * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
10877 - * Cross compiling fixes by Gertjan van Wingerde, July 1996
10878 - * Rewritten by Martin Mares, April 1997
10881 -#include <stdio.h>
10882 -#include <string.h>
10883 -#include <stdlib.h>
10884 -#include <stdarg.h>
10885 -#include <sys/types.h>
10886 -#include <sys/stat.h>
10887 -#include <sys/sysmacros.h>
10888 -#include <unistd.h>
10889 -#include <fcntl.h>
10890 -#include <asm/boot.h>
10892 -typedef unsigned char byte;
10893 -typedef unsigned short word;
10894 -typedef unsigned long u32;
10896 -#define DEFAULT_MAJOR_ROOT 0
10897 -#define DEFAULT_MINOR_ROOT 0
10899 -/* Minimal number of setup sectors (see also bootsect.S) */
10900 -#define SETUP_SECTS 4
10904 -int is_big_kernel;
10906 -void die(const char * str, ...)
10909 - va_start(args, str);
10910 - vfprintf(stderr, str, args);
10911 - fputc('\n', stderr);
10915 -void file_open(const char *name)
10917 - if ((fd = open(name, O_RDONLY, 0)) < 0)
10918 - die("Unable to open `%s': %m", name);
10923 - die("Usage: build [-b] bootsect setup system [rootdev] [> image]");
10926 -int main(int argc, char ** argv)
10928 - unsigned int i, c, sz, setup_sectors;
10930 - byte major_root, minor_root;
10933 - if (argc > 2 && !strcmp(argv[1], "-b"))
10935 - is_big_kernel = 1;
10938 - if ((argc < 4) || (argc > 5))
10941 - if (!strcmp(argv[4], "CURRENT")) {
10942 - if (stat("/", &sb)) {
10944 - die("Couldn't stat /");
10946 - major_root = major(sb.st_dev);
10947 - minor_root = minor(sb.st_dev);
10948 - } else if (strcmp(argv[4], "FLOPPY")) {
10949 - if (stat(argv[4], &sb)) {
10951 - die("Couldn't stat root device.");
10953 - major_root = major(sb.st_rdev);
10954 - minor_root = minor(sb.st_rdev);
10960 - major_root = DEFAULT_MAJOR_ROOT;
10961 - minor_root = DEFAULT_MINOR_ROOT;
10963 - fprintf(stderr, "Root device is (%d, %d)\n", major_root, minor_root);
10965 - file_open(argv[1]);
10966 - i = read(fd, buf, sizeof(buf));
10967 - fprintf(stderr,"Boot sector %d bytes.\n",i);
10969 - die("Boot block must be exactly 512 bytes");
10970 - if (buf[510] != 0x55 || buf[511] != 0xaa)
10971 - die("Boot block hasn't got boot flag (0xAA55)");
10972 - buf[508] = minor_root;
10973 - buf[509] = major_root;
10974 - if (write(1, buf, 512) != 512)
10975 - die("Write call failed");
10978 - file_open(argv[2]); /* Copy the setup code */
10979 - for (i=0 ; (c=read(fd, buf, sizeof(buf)))>0 ; i+=c )
10980 - if (write(1, buf, c) != c)
10981 - die("Write call failed");
10983 - die("read-error on `setup'");
10986 - setup_sectors = (i + 511) / 512; /* Pad unused space with zeros */
10987 - /* for compatibility with ancient versions of LILO. */
10988 - if (setup_sectors < SETUP_SECTS)
10989 - setup_sectors = SETUP_SECTS;
10990 - fprintf(stderr, "Setup is %d bytes.\n", i);
10991 - memset(buf, 0, sizeof(buf));
10992 - while (i < setup_sectors * 512) {
10993 - c = setup_sectors * 512 - i;
10994 - if (c > sizeof(buf))
10996 - if (write(1, buf, c) != c)
10997 - die("Write call failed");
11001 - file_open(argv[3]);
11002 - if (fstat (fd, &sb))
11003 - die("Unable to stat `%s': %m", argv[3]);
11005 - fprintf (stderr, "System is %d kB\n", sz/1024);
11006 - sys_size = (sz + 15) / 16;
11007 - if (!is_big_kernel && sys_size > DEF_SYSSIZE)
11008 - die("System is too big. Try using bzImage or modules.");
11012 - l = (sz > sizeof(buf)) ? sizeof(buf) : sz;
11013 - if ((n=read(fd, buf, l)) != l) {
11015 - die("Error reading %s: %m", argv[3]);
11017 - die("%s: Unexpected EOF", argv[3]);
11019 - if (write(1, buf, l) != l)
11020 - die("Write failed");
11025 - if (lseek(1, 497, SEEK_SET) != 497) /* Write sizes to the bootsector */
11026 - die("Output: seek failed");
11027 - buf[0] = setup_sectors;
11028 - if (write(1, buf, 1) != 1)
11029 - die("Write of setup sector count failed");
11030 - if (lseek(1, 500, SEEK_SET) != 500)
11031 - die("Output: seek failed");
11032 - buf[0] = (sys_size & 0xff);
11033 - buf[1] = ((sys_size >> 8) & 0xff);
11034 - buf[2] = ((sys_size >> 16) & 0xff);
11035 - buf[3] = ((sys_size >> 24) & 0xff);
11036 - if (write(1, buf, 4) != 4)
11037 - die("Write of image length failed");
11039 - return 0; /* Everything is OK */
11041 diff -puN arch/x86_64/kernel/Makefile~git-newsetup arch/x86_64/kernel/Makefile
11042 --- a/arch/x86_64/kernel/Makefile~git-newsetup
11043 +++ a/arch/x86_64/kernel/Makefile
11044 @@ -45,6 +45,7 @@ obj-$(CONFIG_PCI) += early-quirks.o
11046 obj-y += topology.o
11047 obj-y += intel_cacheinfo.o
11048 +obj-y += addon_cpuid_features.o
11049 obj-y += pcspeaker.o
11051 CFLAGS_vsyscall.o := $(PROFILING) -g0
11052 @@ -58,6 +59,7 @@ cpuid-$(subst m,y,$(CONFIG_X86_CPUID))
11053 topology-y += ../../i386/kernel/topology.o
11054 microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o
11055 intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o
11056 +addon_cpuid_features-y += ../../i386/kernel/cpu/addon_cpuid_features.o
11057 quirks-y += ../../i386/kernel/quirks.o
11058 i8237-y += ../../i386/kernel/i8237.o
11059 msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o
11060 diff -puN arch/x86_64/kernel/setup.c~git-newsetup arch/x86_64/kernel/setup.c
11061 --- a/arch/x86_64/kernel/setup.c~git-newsetup
11062 +++ a/arch/x86_64/kernel/setup.c
11063 @@ -855,6 +855,8 @@ void __cpuinit identify_cpu(struct cpuin
11064 c->x86_capability[2] = cpuid_edx(0x80860001);
11067 + init_scattered_cpuid_features(c);
11069 c->apicid = phys_pkg_id(0);
11072 @@ -940,7 +942,7 @@ static int show_cpuinfo(struct seq_file
11073 "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
11074 "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
11075 "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
11076 - "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL,
11077 + "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe",
11080 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11081 @@ -956,10 +958,11 @@ static int show_cpuinfo(struct seq_file
11082 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11084 /* Other (Linux-defined) */
11085 - "cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL,
11086 - "constant_tsc", NULL, NULL,
11087 - "up", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11088 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11089 + "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr",
11090 + NULL, NULL, NULL, NULL,
11091 + "constant_tsc", "up", NULL, "arch_perfmon",
11092 + "pebs", "bts", NULL, "sync_rdtsc",
11093 + "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11094 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11096 /* Intel-defined (#2) */
11097 @@ -970,7 +973,7 @@ static int show_cpuinfo(struct seq_file
11099 /* VIA/Cyrix/Centaur-defined */
11100 NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en",
11101 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11102 + "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL,
11103 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11104 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11106 @@ -981,6 +984,12 @@ static int show_cpuinfo(struct seq_file
11107 "osvw", "ibs", NULL, NULL, NULL, NULL,
11108 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11109 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11111 + /* Auxiliary (Linux-defined) */
11112 + "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11113 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11114 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11115 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11117 static char *x86_power_flags[] = {
11118 "ts", /* temperature sensor */
11119 diff -puN arch/x86_64/kernel/verify_cpu.S~git-newsetup arch/x86_64/kernel/verify_cpu.S
11120 --- a/arch/x86_64/kernel/verify_cpu.S~git-newsetup
11121 +++ a/arch/x86_64/kernel/verify_cpu.S
11122 @@ -37,20 +37,6 @@ verify_cpu:
11123 pushl $0 # Kill any dangerous flags
11126 - /* minimum CPUID flags for x86-64 as defined by AMD */
11127 -#define M(x) (1<<(x))
11128 -#define M2(a,b) M(a)|M(b)
11129 -#define M4(a,b,c,d) M(a)|M(b)|M(c)|M(d)
11131 -#define SSE_MASK \
11132 - (M2(X86_FEATURE_XMM,X86_FEATURE_XMM2))
11133 -#define REQUIRED_MASK1 \
11134 - (M4(X86_FEATURE_FPU,X86_FEATURE_PSE,X86_FEATURE_TSC,X86_FEATURE_MSR)|\
11135 - M4(X86_FEATURE_PAE,X86_FEATURE_CX8,X86_FEATURE_PGE,X86_FEATURE_CMOV)|\
11136 - M(X86_FEATURE_FXSR))
11137 -#define REQUIRED_MASK2 \
11138 - (M(X86_FEATURE_LM - 32))
11140 pushfl # standard way to check for cpuid
11143 @@ -79,8 +65,8 @@ verify_cpu:
11145 movl $0x1,%eax # Does the cpu have what it takes
11147 - andl $REQUIRED_MASK1,%edx
11148 - xorl $REQUIRED_MASK1,%edx
11149 + andl $REQUIRED_MASK0,%edx
11150 + xorl $REQUIRED_MASK0,%edx
11151 jnz verify_cpu_no_longmode
11153 movl $0x80000000,%eax # See if extended cpuid is implemented
11154 @@ -90,8 +76,8 @@ verify_cpu_noamd:
11156 movl $0x80000001,%eax # Does the cpu have what it takes
11158 - andl $REQUIRED_MASK2,%edx
11159 - xorl $REQUIRED_MASK2,%edx
11160 + andl $REQUIRED_MASK1,%edx
11161 + xorl $REQUIRED_MASK1,%edx
11162 jnz verify_cpu_no_longmode
11164 verify_cpu_sse_test:
11165 diff -puN drivers/ide/legacy/hd.c~git-newsetup drivers/ide/legacy/hd.c
11166 --- a/drivers/ide/legacy/hd.c~git-newsetup
11167 +++ a/drivers/ide/legacy/hd.c
11168 @@ -718,74 +718,25 @@ static int __init hd_init(void)
11169 device_timer.function = hd_times_out;
11170 blk_queue_hardsect_size(hd_queue, 512);
11174 - extern struct drive_info drive_info;
11175 - unsigned char *BIOS = (unsigned char *) &drive_info;
11176 - unsigned long flags;
11179 - for (drive=0 ; drive<2 ; drive++) {
11180 - hd_info[drive].cyl = *(unsigned short *) BIOS;
11181 - hd_info[drive].head = *(2+BIOS);
11182 - hd_info[drive].wpcom = *(unsigned short *) (5+BIOS);
11183 - hd_info[drive].ctl = *(8+BIOS);
11184 - hd_info[drive].lzone = *(unsigned short *) (12+BIOS);
11185 - hd_info[drive].sect = *(14+BIOS);
11186 -#ifdef does_not_work_for_everybody_with_scsi_but_helps_ibm_vp
11187 - if (hd_info[drive].cyl && NR_HD == drive)
11194 - We query CMOS about hard disks : it could be that
11195 - we have a SCSI/ESDI/etc controller that is BIOS
11196 - compatible with ST-506, and thus showing up in our
11197 - BIOS table, but not register compatible, and therefore
11198 - not present in CMOS.
11200 - Furthermore, we will assume that our ST-506 drives
11201 - <if any> are the primary drives in the system, and
11202 - the ones reflected as drive 1 or 2.
11204 - The first drive is stored in the high nibble of CMOS
11205 - byte 0x12, the second in the low nibble. This will be
11206 - either a 4 bit drive type or 0xf indicating use byte 0x19
11207 - for an 8 bit type, drive 1, 0x1a for drive 2 in CMOS.
11209 - Needless to say, a non-zero value means we have
11210 - an AT controller hard disk for that drive.
11212 - Currently the rtc_lock is a bit academic since this
11213 - driver is non-modular, but someday... ? Paul G.
11216 - spin_lock_irqsave(&rtc_lock, flags);
11217 - cmos_disks = CMOS_READ(0x12);
11218 - spin_unlock_irqrestore(&rtc_lock, flags);
11220 - if (cmos_disks & 0xf0) {
11221 - if (cmos_disks & 0x0f)
11227 -#endif /* __i386__ */
11230 - /* We don't know anything about the drive. This means
11232 + * We don't know anything about the drive. This means
11233 * that you *MUST* specify the drive parameters to the
11236 + * If we were on an i386, we used to read this info from
11237 + * the BIOS or CMOS. This doesn't work all that well,
11238 + * since this assumes that this is a primary or secondary
11239 + * drive, and if we're using this legacy driver, it's
11240 + * probably an auxilliary controller added to recover
11241 + * legacy data off an ST-506 drive. Either way, it's
11242 + * definitely safest to have the user explicitly specify
11243 + * the information.
11245 printk("hd: no drives specified - use hd=cyl,head,sectors"
11246 " on kernel command line\n");
11253 for (drive=0 ; drive < NR_HD ; drive++) {
11254 struct gendisk *disk = alloc_disk(64);
11255 diff -puN include/asm-i386/boot.h~git-newsetup include/asm-i386/boot.h
11256 --- a/include/asm-i386/boot.h~git-newsetup
11257 +++ a/include/asm-i386/boot.h
11259 -#ifndef _LINUX_BOOT_H
11260 -#define _LINUX_BOOT_H
11261 +#ifndef _ASM_BOOT_H
11262 +#define _ASM_BOOT_H
11264 /* Don't touch these, unless you really know what you're doing. */
11265 #define DEF_INITSEG 0x9000
11267 + (CONFIG_PHYSICAL_ALIGN - 1)) \
11268 & ~(CONFIG_PHYSICAL_ALIGN - 1))
11270 -#endif /* _LINUX_BOOT_H */
11271 +#endif /* _ASM_BOOT_H */
11272 diff -puN /dev/null include/asm-i386/bootparam.h
11274 +++ a/include/asm-i386/bootparam.h
11276 +#ifndef _ASM_BOOTPARAM_H
11277 +#define _ASM_BOOTPARAM_H
11279 +#include <linux/types.h>
11280 +#include <linux/screen_info.h>
11281 +#include <linux/apm_bios.h>
11282 +#include <asm/e820.h>
11283 +#include <linux/edd.h>
11284 +#include <video/edid.h>
11286 +struct setup_header {
11297 + u32 realmode_swtch;
11299 + u16 kernel_version;
11300 + u8 type_of_loader;
11302 +#define LOADED_HIGH 0x01
11303 +#define CAN_USE_HEAP 0x80
11304 + u16 setup_move_size;
11305 + u32 code32_start;
11306 + u32 ramdisk_image;
11307 + u32 ramdisk_size;
11308 + u32 bootsect_kludge;
11309 + u16 heap_end_ptr;
11311 + u32 cmd_line_ptr;
11312 + u32 initrd_addr_max;
11313 + u32 kernel_alignment;
11314 + u8 relocatable_kernel;
11315 +} __attribute__((packed));
11317 +struct sys_desc_table {
11325 + u32 efi_memdesc_size;
11326 + u32 efi_memdec_version;
11328 + u32 fi_memmap_size;
11332 +/* The so-called "zeropage" */
11333 +struct boot_params {
11334 + struct screen_info screen_info; /* 0x000 */
11335 + struct apm_bios_info apm_bios_info; /* 0x040 */
11336 + u8 _pad2[12]; /* 0x054 */
11337 + u32 speedstep_info[4]; /* 0x060 */
11338 + u8 _pad3[16]; /* 0x070 */
11339 + u8 hd0_info[16]; /* obsolete! */ /* 0x080 */
11340 + u8 hd1_info[16]; /* obsolete! */ /* 0x090 */
11341 + struct sys_desc_table sys_desc_table; /* 0x0a0 */
11342 + u8 _pad4[144]; /* 0x0b0 */
11343 + struct edid_info edid_info; /* 0x140 */
11344 + struct efi_info efi_info; /* 0x1c0 */
11345 + u32 alt_mem_k; /* 0x1e0 */
11346 + u32 scratch; /* Scratch field! */ /* 0x1e4 */
11347 + u8 e820_entries; /* 0x1e8 */
11348 + u8 eddbuf_entries; /* 0x1e9 */
11349 + u8 edd_mbr_sig_buf_entries; /* 0x1ea */
11350 + u8 _pad6[6]; /* 0x1eb */
11351 + struct setup_header hdr; /* setup header */ /* 0x1f1 */
11352 + u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)];
11353 + u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */
11354 + struct e820entry e820_map[E820MAX]; /* 0x2d0 */
11355 + u8 _pad8[48]; /* 0xcd0 */
11356 + struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */
11357 + u8 _pad9[276]; /* 0xeec */
11358 +} __attribute__((packed));
11360 +#endif /* _ASM_BOOTPARAM_H */
11361 diff -puN include/asm-i386/cpufeature.h~git-newsetup include/asm-i386/cpufeature.h
11362 --- a/include/asm-i386/cpufeature.h~git-newsetup
11363 +++ a/include/asm-i386/cpufeature.h
11366 #include <asm/required-features.h>
11368 -#define NCAPINTS 7 /* N 32-bit words worth of info */
11369 +#define NCAPINTS 8 /* N 32-bit words worth of info */
11371 /* Intel-defined CPU features, CPUID level 0x00000001 (edx), word 0 */
11372 #define X86_FEATURE_FPU (0*32+ 0) /* Onboard FPU */
11374 #define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */
11375 #define X86_FEATURE_LAPIC_TIMER_BROKEN (3*32+ 14) /* lapic timer broken in C1 */
11376 #define X86_FEATURE_SYNC_RDTSC (3*32+15) /* RDTSC synchronizes the CPU */
11377 +#define X86_FEATURE_REP_GOOD (3*32+16) /* rep microcode works well on this CPU */
11379 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
11380 #define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
11381 @@ -108,11 +109,24 @@
11382 #define X86_FEATURE_LAHF_LM (6*32+ 0) /* LAHF/SAHF in long mode */
11383 #define X86_FEATURE_CMP_LEGACY (6*32+ 1) /* If yes HyperThreading not valid */
11385 -#define cpu_has(c, bit) \
11386 - ((__builtin_constant_p(bit) && (bit) < 32 && \
11387 - (1UL << (bit)) & REQUIRED_MASK1) ? \
11389 - test_bit(bit, (c)->x86_capability))
11391 + * Auxiliary flags: Linux defined - For features scattered in various
11392 + * CPUID levels like 0x6, 0xA etc
11394 +#define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */
11396 +#define cpu_has(c, bit) \
11397 + (__builtin_constant_p(bit) && \
11398 + ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \
11399 + (((bit)>>5)==1 && (1UL<<((bit)&31) & REQUIRED_MASK1)) || \
11400 + (((bit)>>5)==2 && (1UL<<((bit)&31) & REQUIRED_MASK2)) || \
11401 + (((bit)>>5)==3 && (1UL<<((bit)&31) & REQUIRED_MASK3)) || \
11402 + (((bit)>>5)==4 && (1UL<<((bit)&31) & REQUIRED_MASK4)) || \
11403 + (((bit)>>5)==5 && (1UL<<((bit)&31) & REQUIRED_MASK5)) || \
11404 + (((bit)>>5)==6 && (1UL<<((bit)&31) & REQUIRED_MASK6)) || \
11405 + (((bit)>>5)==7 && (1UL<<((bit)&31) & REQUIRED_MASK7)) ) \
11407 + test_bit(bit, (c)->x86_capability))
11408 #define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit)
11410 #define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU)
11411 diff -puN include/asm-i386/e820.h~git-newsetup include/asm-i386/e820.h
11412 --- a/include/asm-i386/e820.h~git-newsetup
11413 +++ a/include/asm-i386/e820.h
11414 @@ -25,13 +25,15 @@
11416 #ifndef __ASSEMBLY__
11418 +struct e820entry {
11419 + u64 addr; /* start of memory segment */
11420 + u64 size; /* size of memory segment */
11421 + u32 type; /* type of memory segment */
11422 +} __attribute__((packed));
11426 - struct e820entry {
11427 - unsigned long long addr; /* start of memory segment */
11428 - unsigned long long size; /* size of memory segment */
11429 - unsigned long type; /* type of memory segment */
11432 + struct e820entry map[E820MAX];
11435 extern struct e820map e820;
11436 diff -puN include/asm-i386/processor.h~git-newsetup include/asm-i386/processor.h
11437 --- a/include/asm-i386/processor.h~git-newsetup
11438 +++ a/include/asm-i386/processor.h
11439 @@ -118,6 +118,7 @@ void __init cpu_detect(struct cpuinfo_x8
11440 extern void identify_boot_cpu(void);
11441 extern void identify_secondary_cpu(struct cpuinfo_x86 *);
11442 extern void print_cpu_info(struct cpuinfo_x86 *);
11443 +extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
11444 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
11445 extern unsigned short num_cache_leaves;
11447 diff -puN include/asm-i386/required-features.h~git-newsetup include/asm-i386/required-features.h
11448 --- a/include/asm-i386/required-features.h~git-newsetup
11449 +++ a/include/asm-i386/required-features.h
11452 /* Define minimum CPUID feature set for kernel These bits are checked
11453 really early to actually display a visible error message before the
11454 - kernel dies. Only add word 0 bits here
11455 + kernel dies. Make sure to assign features to the proper mask!
11457 Some requirements that are not in CPUID yet are also in the
11458 CONFIG_X86_MINIMUM_CPU mode which is checked too.
11459 @@ -11,24 +11,45 @@
11460 The real information is in arch/i386/Kconfig.cpu, this just converts
11461 the CONFIGs into a bitmask */
11463 +#ifndef CONFIG_MATH_EMULATION
11464 +# define NEED_FPU (1<<(X86_FEATURE_FPU & 31))
11466 +# define NEED_FPU 0
11469 #ifdef CONFIG_X86_PAE
11470 -#define NEED_PAE (1<<X86_FEATURE_PAE)
11471 +# define NEED_PAE (1<<(X86_FEATURE_PAE & 31))
11473 -#define NEED_PAE 0
11474 +# define NEED_PAE 0
11477 #ifdef CONFIG_X86_CMOV
11478 -#define NEED_CMOV (1<<X86_FEATURE_CMOV)
11479 +# define NEED_CMOV (1<<(X86_FEATURE_CMOV & 31))
11481 -#define NEED_CMOV 0
11482 +# define NEED_CMOV 0
11485 #ifdef CONFIG_X86_CMPXCHG64
11486 -#define NEED_CMPXCHG64 (1<<X86_FEATURE_CX8)
11487 +# define NEED_CX8 (1<<(X86_FEATURE_CX8 & 31))
11489 +# define NEED_CX8 0
11492 +#define REQUIRED_MASK0 (NEED_FPU|NEED_PAE|NEED_CMOV|NEED_CX8)
11494 +#ifdef CONFIG_X86_USE_3DNOW
11495 +# define NEED_3DNOW (1<<(X86_FEATURE_3DNOW & 31))
11497 -#define NEED_CMPXCHG64 0
11498 +# define NEED_3DNOW 0
11501 -#define REQUIRED_MASK1 (NEED_PAE|NEED_CMOV|NEED_CMPXCHG64)
11502 +#define REQUIRED_MASK1 (NEED_3DNOW)
11504 +#define REQUIRED_MASK2 0
11505 +#define REQUIRED_MASK3 0
11506 +#define REQUIRED_MASK4 0
11507 +#define REQUIRED_MASK5 0
11508 +#define REQUIRED_MASK6 0
11509 +#define REQUIRED_MASK7 0
11512 diff -puN include/asm-i386/setup.h~git-newsetup include/asm-i386/setup.h
11513 --- a/include/asm-i386/setup.h~git-newsetup
11514 +++ a/include/asm-i386/setup.h
11515 @@ -26,12 +26,15 @@
11516 #define NEW_CL_POINTER 0x228 /* Relative to real mode data */
11518 #ifndef __ASSEMBLY__
11520 +#include <asm/bootparam.h>
11523 * This is set up by the setup-routine at boot-time
11525 -extern unsigned char boot_params[PARAM_SIZE];
11526 +extern struct boot_params boot_params;
11528 -#define PARAM (boot_params)
11529 +#define PARAM ((char *)&boot_params)
11530 #define SCREEN_INFO (*(struct screen_info *) (PARAM+0))
11531 #define EXT_MEM_K (*(unsigned short *) (PARAM+2))
11532 #define ALT_MEM_K (*(unsigned long *) (PARAM+0x1e0))
11533 @@ -39,8 +42,7 @@ extern unsigned char boot_params[PARAM_S
11534 #define E820_MAP ((struct e820entry *) (PARAM+E820MAP))
11535 #define APM_BIOS_INFO (*(struct apm_bios_info *) (PARAM+0x40))
11536 #define IST_INFO (*(struct ist_info *) (PARAM+0x60))
11537 -#define DRIVE_INFO (*(struct drive_info_struct *) (PARAM+0x80))
11538 -#define SYS_DESC_TABLE (*(struct sys_desc_table_struct*)(PARAM+0xa0))
11539 +#define SYS_DESC_TABLE (*(struct sys_desc_table *)(PARAM+0xa0))
11540 #define EFI_SYSTAB ((efi_system_table_t *) *((unsigned long *)(PARAM+0x1c4)))
11541 #define EFI_MEMDESC_SIZE (*((unsigned long *) (PARAM+0x1c8)))
11542 #define EFI_MEMDESC_VERSION (*((unsigned long *) (PARAM+0x1cc)))
11543 diff -puN include/asm-x86_64/alternative.h~git-newsetup include/asm-x86_64/alternative.h
11544 --- a/include/asm-x86_64/alternative.h~git-newsetup
11545 +++ a/include/asm-x86_64/alternative.h
11548 #include <linux/types.h>
11549 #include <linux/stddef.h>
11552 + * Alternative inline assembly for SMP.
11554 + * The LOCK_PREFIX macro defined here replaces the LOCK and
11555 + * LOCK_PREFIX macros used everywhere in the source tree.
11557 + * SMP alternatives use the same data structures as the other
11558 + * alternatives and the X86_FEATURE_UP flag to indicate the case of a
11559 + * UP system running a SMP kernel. The existing apply_alternatives()
11560 + * works fine for patching a SMP kernel for UP.
11562 + * The SMP alternative tables can be kept after boot and contain both
11563 + * UP and SMP versions of the instructions to allow switching back to
11564 + * SMP at runtime, when hotplugging in a new CPU, which is especially
11565 + * useful in virtualized environments.
11567 + * The very common lock prefix is handled as special case in a
11568 + * separate table which is a pure address list without replacement ptr
11569 + * and size information. That keeps the table sizes small.
11573 +#define LOCK_PREFIX \
11574 + ".section .smp_locks,\"a\"\n" \
11576 + " .quad 661f\n" /* address */ \
11580 +#else /* ! CONFIG_SMP */
11581 +#define LOCK_PREFIX ""
11584 +/* This must be included *after* the definition of LOCK_PREFIX */
11585 #include <asm/cpufeature.h>
11588 @@ -108,39 +143,6 @@ static inline void alternatives_smp_swit
11590 #define ASM_OUTPUT2(a, b) a, b
11593 - * Alternative inline assembly for SMP.
11595 - * The LOCK_PREFIX macro defined here replaces the LOCK and
11596 - * LOCK_PREFIX macros used everywhere in the source tree.
11598 - * SMP alternatives use the same data structures as the other
11599 - * alternatives and the X86_FEATURE_UP flag to indicate the case of a
11600 - * UP system running a SMP kernel. The existing apply_alternatives()
11601 - * works fine for patching a SMP kernel for UP.
11603 - * The SMP alternative tables can be kept after boot and contain both
11604 - * UP and SMP versions of the instructions to allow switching back to
11605 - * SMP at runtime, when hotplugging in a new CPU, which is especially
11606 - * useful in virtualized environments.
11608 - * The very common lock prefix is handled as special case in a
11609 - * separate table which is a pure address list without replacement ptr
11610 - * and size information. That keeps the table sizes small.
11614 -#define LOCK_PREFIX \
11615 - ".section .smp_locks,\"a\"\n" \
11617 - " .quad 661f\n" /* address */ \
11621 -#else /* ! CONFIG_SMP */
11622 -#define LOCK_PREFIX ""
11625 struct paravirt_patch;
11626 #ifdef CONFIG_PARAVIRT
11627 void apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end);
11628 diff -puN include/asm-x86_64/boot.h~git-newsetup include/asm-x86_64/boot.h
11629 --- a/include/asm-x86_64/boot.h~git-newsetup
11630 +++ a/include/asm-x86_64/boot.h
11632 -#ifndef _LINUX_BOOT_H
11633 -#define _LINUX_BOOT_H
11635 -/* Don't touch these, unless you really know what you're doing. */
11636 -#define DEF_INITSEG 0x9000
11637 -#define DEF_SYSSEG 0x1000
11638 -#define DEF_SETUPSEG 0x9020
11639 -#define DEF_SYSSIZE 0x7F00
11641 -/* Internal svga startup constants */
11642 -#define NORMAL_VGA 0xffff /* 80x25 mode */
11643 -#define EXTENDED_VGA 0xfffe /* 80x50 mode */
11644 -#define ASK_VGA 0xfffd /* ask for it at bootup */
11647 +#include <asm-i386/boot.h>
11648 diff -puN /dev/null include/asm-x86_64/bootparam.h
11650 +++ a/include/asm-x86_64/bootparam.h
11652 +#include <asm-i386/bootparam.h>
11653 diff -puN include/asm-x86_64/cpufeature.h~git-newsetup include/asm-x86_64/cpufeature.h
11654 --- a/include/asm-x86_64/cpufeature.h~git-newsetup
11655 +++ a/include/asm-x86_64/cpufeature.h
11657 #ifndef __ASM_X8664_CPUFEATURE_H
11658 #define __ASM_X8664_CPUFEATURE_H
11660 -#define NCAPINTS 7 /* N 32-bit words worth of info */
11661 +#include <asm-i386/cpufeature.h>
11663 -/* Intel-defined CPU features, CPUID level 0x00000001, word 0 */
11664 -#define X86_FEATURE_FPU (0*32+ 0) /* Onboard FPU */
11665 -#define X86_FEATURE_VME (0*32+ 1) /* Virtual Mode Extensions */
11666 -#define X86_FEATURE_DE (0*32+ 2) /* Debugging Extensions */
11667 -#define X86_FEATURE_PSE (0*32+ 3) /* Page Size Extensions */
11668 -#define X86_FEATURE_TSC (0*32+ 4) /* Time Stamp Counter */
11669 -#define X86_FEATURE_MSR (0*32+ 5) /* Model-Specific Registers, RDMSR, WRMSR */
11670 -#define X86_FEATURE_PAE (0*32+ 6) /* Physical Address Extensions */
11671 -#define X86_FEATURE_MCE (0*32+ 7) /* Machine Check Architecture */
11672 -#define X86_FEATURE_CX8 (0*32+ 8) /* CMPXCHG8 instruction */
11673 -#define X86_FEATURE_APIC (0*32+ 9) /* Onboard APIC */
11674 -#define X86_FEATURE_SEP (0*32+11) /* SYSENTER/SYSEXIT */
11675 -#define X86_FEATURE_MTRR (0*32+12) /* Memory Type Range Registers */
11676 -#define X86_FEATURE_PGE (0*32+13) /* Page Global Enable */
11677 -#define X86_FEATURE_MCA (0*32+14) /* Machine Check Architecture */
11678 -#define X86_FEATURE_CMOV (0*32+15) /* CMOV instruction (FCMOVCC and FCOMI too if FPU present) */
11679 -#define X86_FEATURE_PAT (0*32+16) /* Page Attribute Table */
11680 -#define X86_FEATURE_PSE36 (0*32+17) /* 36-bit PSEs */
11681 -#define X86_FEATURE_PN (0*32+18) /* Processor serial number */
11682 -#define X86_FEATURE_CLFLSH (0*32+19) /* Supports the CLFLUSH instruction */
11683 -#define X86_FEATURE_DS (0*32+21) /* Debug Store */
11684 -#define X86_FEATURE_ACPI (0*32+22) /* ACPI via MSR */
11685 -#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */
11686 -#define X86_FEATURE_FXSR (0*32+24) /* FXSAVE and FXRSTOR instructions (fast save and restore */
11687 - /* of FPU context), and CR4.OSFXSR available */
11688 -#define X86_FEATURE_XMM (0*32+25) /* Streaming SIMD Extensions */
11689 -#define X86_FEATURE_XMM2 (0*32+26) /* Streaming SIMD Extensions-2 */
11690 -#define X86_FEATURE_SELFSNOOP (0*32+27) /* CPU self snoop */
11691 -#define X86_FEATURE_HT (0*32+28) /* Hyper-Threading */
11692 -#define X86_FEATURE_ACC (0*32+29) /* Automatic clock control */
11693 -#define X86_FEATURE_IA64 (0*32+30) /* IA-64 processor */
11695 -/* AMD-defined CPU features, CPUID level 0x80000001, word 1 */
11696 -/* Don't duplicate feature flags which are redundant with Intel! */
11697 -#define X86_FEATURE_SYSCALL (1*32+11) /* SYSCALL/SYSRET */
11698 -#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */
11699 -#define X86_FEATURE_FXSR_OPT (1*32+25) /* FXSR optimizations */
11700 -#define X86_FEATURE_RDTSCP (1*32+27) /* RDTSCP */
11701 -#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */
11702 -#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */
11703 -#define X86_FEATURE_3DNOW (1*32+31) /* 3DNow! */
11705 -/* Transmeta-defined CPU features, CPUID level 0x80860001, word 2 */
11706 -#define X86_FEATURE_RECOVERY (2*32+ 0) /* CPU in recovery mode */
11707 -#define X86_FEATURE_LONGRUN (2*32+ 1) /* Longrun power control */
11708 -#define X86_FEATURE_LRTI (2*32+ 3) /* LongRun table interface */
11710 -/* Other features, Linux-defined mapping, word 3 */
11711 -/* This range is used for feature bits which conflict or are synthesized */
11712 -#define X86_FEATURE_CXMMX (3*32+ 0) /* Cyrix MMX extensions */
11713 -#define X86_FEATURE_K6_MTRR (3*32+ 1) /* AMD K6 nonstandard MTRRs */
11714 -#define X86_FEATURE_CYRIX_ARR (3*32+ 2) /* Cyrix ARRs (= MTRRs) */
11715 -#define X86_FEATURE_CENTAUR_MCR (3*32+ 3) /* Centaur MCRs (= MTRRs) */
11716 -#define X86_FEATURE_REP_GOOD (3*32+ 4) /* rep microcode works well on this CPU */
11717 -#define X86_FEATURE_CONSTANT_TSC (3*32+5) /* TSC runs at constant rate */
11718 -#define X86_FEATURE_SYNC_RDTSC (3*32+6) /* RDTSC syncs CPU core */
11719 -#define X86_FEATURE_FXSAVE_LEAK (3*32+7) /* FIP/FOP/FDP leaks through FXSAVE */
11720 -#define X86_FEATURE_UP (3*32+8) /* SMP kernel running on UP */
11721 -#define X86_FEATURE_ARCH_PERFMON (3*32+9) /* Intel Architectural PerfMon */
11722 -#define X86_FEATURE_PEBS (3*32+10) /* Precise-Event Based Sampling */
11723 -#define X86_FEATURE_BTS (3*32+11) /* Branch Trace Store */
11725 -/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
11726 -#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
11727 -#define X86_FEATURE_MWAIT (4*32+ 3) /* Monitor/Mwait support */
11728 -#define X86_FEATURE_DSCPL (4*32+ 4) /* CPL Qualified Debug Store */
11729 -#define X86_FEATURE_EST (4*32+ 7) /* Enhanced SpeedStep */
11730 -#define X86_FEATURE_TM2 (4*32+ 8) /* Thermal Monitor 2 */
11731 -#define X86_FEATURE_CID (4*32+10) /* Context ID */
11732 -#define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */
11733 -#define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */
11735 -/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */
11736 -#define X86_FEATURE_XSTORE (5*32+ 2) /* on-CPU RNG present (xstore insn) */
11737 -#define X86_FEATURE_XSTORE_EN (5*32+ 3) /* on-CPU RNG enabled */
11738 -#define X86_FEATURE_XCRYPT (5*32+ 6) /* on-CPU crypto (xcrypt insn) */
11739 -#define X86_FEATURE_XCRYPT_EN (5*32+ 7) /* on-CPU crypto enabled */
11741 -/* More extended AMD flags: CPUID level 0x80000001, ecx, word 6 */
11742 -#define X86_FEATURE_LAHF_LM (6*32+ 0) /* LAHF/SAHF in long mode */
11743 -#define X86_FEATURE_CMP_LEGACY (6*32+ 1) /* If yes HyperThreading not valid */
11745 -#define cpu_has(c, bit) test_bit(bit, (c)->x86_capability)
11746 -#define boot_cpu_has(bit) test_bit(bit, boot_cpu_data.x86_capability)
11748 -#define cpu_has_fpu 1
11749 +#undef cpu_has_vme
11750 #define cpu_has_vme 0
11751 -#define cpu_has_de 1
11752 -#define cpu_has_pse 1
11753 -#define cpu_has_tsc 1
11755 +#undef cpu_has_pae
11756 #define cpu_has_pae ___BUG___
11757 -#define cpu_has_pge 1
11758 -#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)
11759 -#define cpu_has_mtrr 1
11760 -#define cpu_has_mmx 1
11761 -#define cpu_has_fxsr 1
11762 -#define cpu_has_xmm 1
11763 -#define cpu_has_xmm2 1
11764 -#define cpu_has_xmm3 boot_cpu_has(X86_FEATURE_XMM3)
11765 -#define cpu_has_ht boot_cpu_has(X86_FEATURE_HT)
11768 #define cpu_has_mp 1 /* XXX */
11770 +#undef cpu_has_k6_mtrr
11771 #define cpu_has_k6_mtrr 0
11773 +#undef cpu_has_cyrix_arr
11774 #define cpu_has_cyrix_arr 0
11776 +#undef cpu_has_centaur_mcr
11777 #define cpu_has_centaur_mcr 0
11778 -#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH)
11779 -#define cpu_has_ds boot_cpu_has(X86_FEATURE_DS)
11780 -#define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS)
11781 -#define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS)
11783 #endif /* __ASM_X8664_CPUFEATURE_H */
11784 diff -puN include/asm-x86_64/e820.h~git-newsetup include/asm-x86_64/e820.h
11785 --- a/include/asm-x86_64/e820.h~git-newsetup
11786 +++ a/include/asm-x86_64/e820.h
11788 #ifndef __E820_HEADER
11789 #define __E820_HEADER
11791 -#include <linux/mmzone.h>
11793 +# include <linux/mmzone.h>
11796 #define E820MAP 0x2d0 /* our map */
11797 #define E820MAX 128 /* number of entries in E820MAP */
11798 @@ -30,7 +32,7 @@ struct e820entry {
11799 } __attribute__((packed));
11804 struct e820entry map[E820MAX];
11807 diff -puN include/asm-x86_64/processor.h~git-newsetup include/asm-x86_64/processor.h
11808 --- a/include/asm-x86_64/processor.h~git-newsetup
11809 +++ a/include/asm-x86_64/processor.h
11810 @@ -99,6 +99,7 @@ extern char ignore_irq13;
11812 extern void identify_cpu(struct cpuinfo_x86 *);
11813 extern void print_cpu_info(struct cpuinfo_x86 *);
11814 +extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
11815 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
11816 extern unsigned short num_cache_leaves;
11818 @@ -367,8 +368,6 @@ static inline void sync_core(void)
11819 asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory");
11822 -#define cpu_has_fpu 1
11824 #define ARCH_HAS_PREFETCH
11825 static inline void prefetch(void *x)
11827 diff -puN /dev/null include/asm-x86_64/required-features.h
11829 +++ a/include/asm-x86_64/required-features.h
11831 +#ifndef _ASM_REQUIRED_FEATURES_H
11832 +#define _ASM_REQUIRED_FEATURES_H 1
11834 +/* Define minimum CPUID feature set for kernel These bits are checked
11835 + really early to actually display a visible error message before the
11836 + kernel dies. Make sure to assign features to the proper mask!
11838 + The real information is in arch/x86_64/Kconfig.cpu, this just converts
11839 + the CONFIGs into a bitmask */
11841 +/* x86-64 baseline features */
11842 +#define NEED_FPU (1<<(X86_FEATURE_FPU & 31))
11843 +#define NEED_PSE (1<<(X86_FEATURE_PSE & 31))
11844 +#define NEED_MSR (1<<(X86_FEATURE_MSR & 31))
11845 +#define NEED_PAE (1<<(X86_FEATURE_PAE & 31))
11846 +#define NEED_CX8 (1<<(X86_FEATURE_CX8 & 31))
11847 +#define NEED_PGE (1<<(X86_FEATURE_PGE & 31))
11848 +#define NEED_FXSR (1<<(X86_FEATURE_FXSR & 31))
11849 +#define NEED_CMOV (1<<(X86_FEATURE_CMOV & 31))
11850 +#define NEED_XMM (1<<(X86_FEATURE_XMM & 31))
11851 +#define NEED_XMM2 (1<<(X86_FEATURE_XMM2 & 31))
11853 +#define REQUIRED_MASK0 (NEED_FPU|NEED_PSE|NEED_MSR|NEED_PAE|\
11854 + NEED_CX8|NEED_PGE|NEED_FXSR|NEED_CMOV|\
11855 + NEED_XMM|NEED_XMM2)
11856 +#define SSE_MASK (NEED_XMM|NEED_XMM2)
11858 +/* x86-64 baseline features */
11859 +#define NEED_LM (1<<(X86_FEATURE_LM & 31))
11861 +#ifdef CONFIG_X86_USE_3DNOW
11862 +# define NEED_3DNOW (1<<(X86_FEATURE_3DNOW & 31))
11864 +# define NEED_3DNOW 0
11867 +#define REQUIRED_MASK1 (NEED_LM|NEED_3DNOW)
11869 +#define REQUIRED_MASK2 0
11870 +#define REQUIRED_MASK3 0
11871 +#define REQUIRED_MASK4 0
11872 +#define REQUIRED_MASK5 0
11873 +#define REQUIRED_MASK6 0
11874 +#define REQUIRED_MASK7 0
11877 diff -puN include/asm-x86_64/segment.h~git-newsetup include/asm-x86_64/segment.h
11878 --- a/include/asm-x86_64/segment.h~git-newsetup
11879 +++ a/include/asm-x86_64/segment.h
11882 #include <asm/cache.h>
11884 +/* Simple and small GDT entries for booting only */
11886 +#define GDT_ENTRY_BOOT_CS 2
11887 +#define __BOOT_CS (GDT_ENTRY_BOOT_CS * 8)
11889 +#define GDT_ENTRY_BOOT_DS (GDT_ENTRY_BOOT_CS + 1)
11890 +#define __BOOT_DS (GDT_ENTRY_BOOT_DS * 8)
11892 #define __KERNEL_CS 0x10
11893 #define __KERNEL_DS 0x18
11895 diff -puN include/linux/edd.h~git-newsetup include/linux/edd.h
11896 --- a/include/linux/edd.h~git-newsetup
11897 +++ a/include/linux/edd.h
11899 #define EDD_MBR_SIG_MAX 16 /* max number of signatures to store */
11900 #define EDD_MBR_SIG_NR_BUF 0x1ea /* addr of number of MBR signtaures at EDD_MBR_SIG_BUF
11901 in boot_params - treat this as 1 byte */
11902 -#define EDD_CL_EQUALS 0x3d646465 /* "edd=" */
11903 -#define EDD_CL_OFF 0x666f /* "of" for off */
11904 -#define EDD_CL_SKIP 0x6b73 /* "sk" for skipmbr */
11905 -#define EDD_CL_ON 0x6e6f /* "on" for on */
11907 #ifndef __ASSEMBLY__
11909 diff -puN include/linux/screen_info.h~git-newsetup include/linux/screen_info.h
11910 --- a/include/linux/screen_info.h~git-newsetup
11911 +++ a/include/linux/screen_info.h
11913 struct screen_info {
11914 u8 orig_x; /* 0x00 */
11915 u8 orig_y; /* 0x01 */
11916 - u16 dontuse1; /* 0x02 -- EXT_MEM_K sits here */
11917 + u16 ext_mem_k; /* 0x02 */
11918 u16 orig_video_page; /* 0x04 */
11919 u8 orig_video_mode; /* 0x06 */
11920 u8 orig_video_cols; /* 0x07 */
11921 @@ -27,7 +27,7 @@ struct screen_info {
11922 u16 lfb_depth; /* 0x16 */
11923 u32 lfb_base; /* 0x18 */
11924 u32 lfb_size; /* 0x1c */
11925 - u16 dontuse2, dontuse3; /* 0x20 -- CL_MAGIC and CL_OFFSET here */
11926 + u16 cl_magic, cl_offset; /* 0x20 */
11927 u16 lfb_linelength; /* 0x24 */
11928 u8 red_size; /* 0x26 */
11929 u8 red_pos; /* 0x27 */
11930 @@ -42,9 +42,8 @@ struct screen_info {
11931 u16 pages; /* 0x32 */
11932 u16 vesa_attributes; /* 0x34 */
11933 u32 capabilities; /* 0x36 */
11934 - /* 0x3a -- 0x3b reserved for future expansion */
11935 - /* 0x3c -- 0x3f micro stack for relocatable kernels */
11937 + u8 _reserved[6]; /* 0x3a */
11938 +} __attribute__((packed));
11940 extern struct screen_info screen_info;