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(-)
1367 @@ -1750,8 +1750,8 @@
1371 -P: Riley H. Williams
1372 -M: Riley@Williams.Name
1375 L: Linux-Kernel@vger.kernel.org
1378 --- a/arch/i386/Kconfig.cpu
1379 +++ b/arch/i386/Kconfig.cpu
1382 config X86_MINIMUM_CPU_MODEL
1384 - default "4" if X86_XADD || X86_CMPXCHG || X86_BSWAP
1386 + default "4" if X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK
1389 --- a/arch/i386/boot/Makefile
1390 +++ b/arch/i386/boot/Makefile
1393 #RAMDISK := -DRAMDISK=512
1395 -targets := vmlinux.bin bootsect bootsect.o \
1396 - setup setup.o zImage bzImage
1397 +targets := vmlinux.bin setup.bin setup.elf zImage bzImage
1398 subdir- := compressed
1400 +setup-y += a20.o apm.o cmdline.o copy.o cpu.o cpucheck.o edd.o
1401 +setup-y += header.o main.o mca.o memory.o pm.o pmjump.o
1402 +setup-y += printf.o string.o tty.o video.o version.o voyager.o
1404 +# The link order of the video-*.o modules can matter. In particular,
1405 +# video-vga.o *must* be listed first, followed by video-vesa.o.
1406 +# Hardware-specific drivers should follow in the order they should be
1407 +# probed, and video-bios.o should typically be last.
1408 +setup-y += video-vga.o
1409 +setup-y += video-vesa.o
1410 +setup-y += video-bios.o
1412 hostprogs-y := tools/build
1414 HOSTCFLAGS_build.o := $(LINUXINCLUDE)
1416 # ---------------------------------------------------------------------------
1418 +# How to compile the 16-bit code. Note we always compile for -march=i386,
1419 +# that way we can complain to the user if the CPU is insufficient.
1421 +cflags-x86_64 := -m32
1422 +CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
1423 + $(cflags-$(ARCH)) \
1424 + -Wall -Wstrict-prototypes \
1425 + -march=i386 -mregparm=3 \
1426 + -include $(srctree)/$(src)/code16gcc.h \
1427 + -fno-strict-aliasing -fomit-frame-pointer \
1428 + $(call cc-option, -ffreestanding) \
1429 + $(call cc-option, -fno-stack-protector)
1430 +AFLAGS := $(CFLAGS) -D__ASSEMBLY__
1432 $(obj)/zImage: IMAGE_OFFSET := 0x1000
1433 $(obj)/zImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK)
1434 $(obj)/bzImage: IMAGE_OFFSET := 0x100000
1435 +$(obj)/bzImage: EXTRA_CFLAGS := -D__BIG_KERNEL__
1436 $(obj)/bzImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
1437 $(obj)/bzImage: BUILDFLAGS := -b
1439 quiet_cmd_image = BUILD $@
1440 -cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \
1441 +cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/setup.bin \
1442 $(obj)/vmlinux.bin $(ROOT_DEV) > $@
1444 -$(obj)/zImage $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \
1445 +$(obj)/zImage $(obj)/bzImage: $(obj)/setup.bin \
1446 $(obj)/vmlinux.bin $(obj)/tools/build FORCE
1447 $(call if_changed,image)
1448 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
1450 $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
1451 $(call if_changed,objcopy)
1453 -LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
1454 -LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext
1455 +SETUP_OBJS = $(addprefix $(obj)/,$(setup-y))
1457 -$(obj)/setup $(obj)/bootsect: %: %.o FORCE
1458 +LDFLAGS_setup.elf := -T
1459 +$(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE
1460 $(call if_changed,ld)
1462 +OBJCOPYFLAGS_setup.bin := -O binary
1464 +$(obj)/setup.bin: $(obj)/setup.elf FORCE
1465 + $(call if_changed,objcopy)
1467 $(obj)/compressed/vmlinux: FORCE
1468 $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@
1471 +++ b/arch/i386/boot/a20.c
1473 +/* -*- linux-c -*- ------------------------------------------------------- *
1475 + * Copyright (C) 1991, 1992 Linus Torvalds
1476 + * Copyright 2007 rPath, Inc. - All Rights Reserved
1478 + * This file is part of the Linux kernel, and is made available under
1479 + * the terms of the GNU General Public License version 2.
1481 + * ----------------------------------------------------------------------- */
1484 + * arch/i386/boot/a20.c
1486 + * Enable A20 gate (return -1 on failure)
1491 +#define MAX_8042_LOOPS 100000
1493 +static int empty_8042(void)
1496 + int loops = MAX_8042_LOOPS;
1501 + status = inb(0x64);
1503 + /* Read and discard input data */
1506 + } else if (!(status & 2)) {
1507 + /* Buffers empty, finished! */
1515 +/* Returns nonzero if the A20 line is enabled. The memory address
1516 + used as a test is the int $0x80 vector, which should be safe. */
1518 +#define A20_TEST_ADDR (4*0x80)
1519 +#define A20_TEST_SHORT 32
1520 +#define A20_TEST_LONG 2097152 /* 2^21 */
1522 +static int a20_test(int loops)
1530 + saved = ctr = rdfs32(A20_TEST_ADDR);
1533 + wrfs32(++ctr, A20_TEST_ADDR);
1534 + io_delay(); /* Serialize and make delay constant */
1535 + ok = rdgs32(A20_TEST_ADDR+0x10) ^ ctr;
1540 + wrfs32(saved, A20_TEST_ADDR);
1544 +/* Quick test to see if A20 is already enabled */
1545 +static int a20_test_short(void)
1547 + return a20_test(A20_TEST_SHORT);
1550 +/* Longer test that actually waits for A20 to come on line; this
1551 + is useful when dealing with the KBC or other slow external circuitry. */
1552 +static int a20_test_long(void)
1554 + return a20_test(A20_TEST_LONG);
1557 +static void enable_a20_bios(void)
1559 + asm volatile("pushfl; int $0x15; popfl"
1560 + : : "a" ((u16)0x2401));
1563 +static void enable_a20_kbc(void)
1567 + outb(0xd1, 0x64); /* Command write */
1570 + outb(0xdf, 0x60); /* A20 on */
1574 +static void enable_a20_fast(void)
1578 + port_a = inb(0x92); /* Configuration port A */
1579 + port_a |= 0x02; /* Enable A20 */
1580 + port_a &= ~0x01; /* Do not reset machine */
1581 + outb(port_a, 0x92);
1585 + * Actual routine to enable A20; return 0 on ok, -1 on failure
1588 +#define A20_ENABLE_LOOPS 255 /* Number of times to try */
1590 +int enable_a20(void)
1592 + int loops = A20_ENABLE_LOOPS;
1594 +#if defined(CONFIG_X86_ELAN)
1595 + /* Elan croaks if we try to touch the KBC */
1596 + enable_a20_fast();
1597 + while (!a20_test_long())
1600 +#elif defined(CONFIG_X86_VOYAGER)
1601 + /* On Voyager, a20_test() is unsafe? */
1606 + /* First, check to see if A20 is already enabled
1607 + (legacy free, etc.) */
1608 + if (a20_test_short())
1611 + /* Next, try the BIOS (INT 0x15, AX=0x2401) */
1612 + enable_a20_bios();
1613 + if (a20_test_short())
1616 + /* Try enabling A20 through the keyboard controller */
1618 + if (a20_test_short())
1619 + return 0; /* BIOS worked, but with delayed reaction */
1622 + if (a20_test_long())
1625 + /* Finally, try enabling the "fast A20 gate" */
1626 + enable_a20_fast();
1627 + if (a20_test_long())
1635 +++ b/arch/i386/boot/apm.c
1637 +/* -*- linux-c -*- ------------------------------------------------------- *
1639 + * Copyright (C) 1991, 1992 Linus Torvalds
1640 + * Copyright 2007 rPath, Inc. - All Rights Reserved
1642 + * Original APM BIOS checking by Stephen Rothwell, May 1994
1643 + * (sfr@canb.auug.org.au)
1645 + * This file is part of the Linux kernel, and is made available under
1646 + * the terms of the GNU General Public License version 2.
1648 + * ----------------------------------------------------------------------- */
1651 + * arch/i386/boot/apm.c
1653 + * Get APM BIOS information
1658 +#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
1660 +int query_apm_bios(void)
1662 + u16 ax, bx, cx, dx, di;
1666 + /* APM BIOS installation check */
1669 + asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp ; setc %0"
1670 + : "=d" (err), "+a" (ax), "+b" (bx), "+c" (cx)
1671 + : : "esi", "edi");
1674 + return -1; /* No APM BIOS */
1676 + if (bx != 0x504d) /* "PM" signature */
1679 + if (cx & 0x02) /* 32 bits supported? */
1682 + /* Disconnect first, just in case */
1684 + asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp"
1686 + : : "ebx", "ecx", "edx", "esi", "edi");
1692 + /* 32-bit connect */
1693 + asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp ; setc %6"
1694 + : "=a" (ax), "+b" (ebx), "+c" (cx), "+d" (dx),
1695 + "+S" (esi), "+D" (di), "=m" (err)
1698 + boot_params.apm_bios_info.cseg = ax;
1699 + boot_params.apm_bios_info.offset = ebx;
1700 + boot_params.apm_bios_info.cseg_16 = cx;
1701 + boot_params.apm_bios_info.dseg = dx;
1702 + boot_params.apm_bios_info.cseg_len = (u16)esi;
1703 + boot_params.apm_bios_info.cseg_16_len = esi >> 16;
1704 + boot_params.apm_bios_info.dseg_len = di;
1709 + /* Redo the installation check as the 32-bit connect;
1710 + some BIOSes return different flags this way... */
1714 + asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp ; setc %0"
1715 + : "=d" (err), "+a" (ax), "+b" (bx), "+c" (cx)
1716 + : : "esi", "edi");
1718 + if (err || bx != 0x504d) {
1719 + /* Failure with 32-bit connect, try to disconect and ignore */
1722 + asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp"
1723 + : "+a" (ax), "+b" (bx)
1724 + : : "ecx", "edx", "esi", "edi");
1728 + boot_params.apm_bios_info.version = ax;
1729 + boot_params.apm_bios_info.flags = cx;
1735 +++ b/arch/i386/boot/bitops.h
1737 +/* -*- linux-c -*- ------------------------------------------------------- *
1739 + * Copyright (C) 1991, 1992 Linus Torvalds
1740 + * Copyright 2007 rPath, Inc. - All Rights Reserved
1742 + * This file is part of the Linux kernel, and is made available under
1743 + * the terms of the GNU General Public License version 2.
1745 + * ----------------------------------------------------------------------- */
1748 + * arch/i386/boot/bitops.h
1750 + * Very simple bitops for the boot code.
1753 +#ifndef BOOT_BITOPS_H
1754 +#define BOOT_BITOPS_H
1755 +#define _LINUX_BITOPS_H /* Inhibit inclusion of <linux/bitops.h> */
1757 +static inline int constant_test_bit(int nr, const void *addr)
1759 + const u32 *p = (const u32 *)addr;
1760 + return ((1UL << (nr & 31)) & (p[nr >> 5])) != 0;
1762 +static inline int variable_test_bit(int nr, const void *addr)
1765 + const u32 *p = (const u32 *)addr;
1767 + asm("btl %2,%1; setc %0" : "=qm" (v) : "m" (*p), "Ir" (nr));
1771 +#define test_bit(nr,addr) \
1772 +(__builtin_constant_p(nr) ? \
1773 + constant_test_bit((nr),(addr)) : \
1774 + variable_test_bit((nr),(addr)))
1776 +static inline void set_bit(int nr, void *addr)
1778 + asm("btsl %1,%0" : "+m" (*(u32 *)addr) : "Ir" (nr));
1781 +#endif /* BOOT_BITOPS_H */
1783 +++ b/arch/i386/boot/boot.h
1785 +/* -*- linux-c -*- ------------------------------------------------------- *
1787 + * Copyright (C) 1991, 1992 Linus Torvalds
1788 + * Copyright 2007 rPath, Inc. - All Rights Reserved
1790 + * This file is part of the Linux kernel, and is made available under
1791 + * the terms of the GNU General Public License version 2.
1793 + * ----------------------------------------------------------------------- */
1796 + * arch/i386/boot/boot.h
1798 + * Header file for the real-mode kernel code
1801 +#ifndef BOOT_BOOT_H
1802 +#define BOOT_BOOT_H
1804 +#ifndef __ASSEMBLY__
1806 +#include <stdarg.h>
1807 +#include <linux/types.h>
1808 +#include <linux/edd.h>
1809 +#include <asm/boot.h>
1810 +#include <asm/bootparam.h>
1812 +/* Useful macros */
1813 +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
1815 +extern struct setup_header hdr;
1816 +extern struct boot_params boot_params;
1818 +/* Basic port I/O */
1819 +static inline void outb(u8 v, u16 port)
1821 + asm volatile("outb %0,%1" : : "a" (v), "dN" (port));
1823 +static inline u8 inb(u16 port)
1826 + asm volatile("inb %1,%0" : "=a" (v) : "dN" (port));
1830 +static inline void outw(u16 v, u16 port)
1832 + asm volatile("outw %0,%1" : : "a" (v), "dN" (port));
1834 +static inline u16 inw(u16 port)
1837 + asm volatile("inw %1,%0" : "=a" (v) : "dN" (port));
1841 +static inline void outl(u32 v, u16 port)
1843 + asm volatile("outl %0,%1" : : "a" (v), "dn" (port));
1845 +static inline u32 inl(u32 port)
1848 + asm volatile("inl %1,%0" : "=a" (v) : "dN" (port));
1852 +static inline void io_delay(void)
1854 + const u16 DELAY_PORT = 0x80;
1855 + asm volatile("outb %%al,%0" : : "dN" (DELAY_PORT));
1858 +/* These functions are used to reference data in other segments. */
1860 +static inline u16 ds(void)
1863 + asm("movw %%ds,%0" : "=rm" (seg));
1867 +static inline void set_fs(u16 seg)
1869 + asm volatile("movw %0,%%fs" : : "rm" (seg));
1871 +static inline u16 fs(void)
1874 + asm("movw %%fs,%0" : "=rm" (seg));
1878 +static inline void set_gs(u16 seg)
1880 + asm volatile("movw %0,%%gs" : : "rm" (seg));
1882 +static inline u16 gs(void)
1885 + asm("movw %%gs,%0" : "=rm" (seg));
1889 +typedef unsigned int addr_t;
1891 +static inline u8 rdfs8(addr_t addr)
1894 + asm("movb %%fs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr));
1897 +static inline u16 rdfs16(addr_t addr)
1900 + asm("movw %%fs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr));
1903 +static inline u32 rdfs32(addr_t addr)
1906 + asm("movl %%fs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr));
1910 +static inline void wrfs8(u8 v, addr_t addr)
1912 + asm volatile("movb %1,%%fs:%0" : "+m" (*(u8 *)addr) : "r" (v));
1914 +static inline void wrfs16(u16 v, addr_t addr)
1916 + asm volatile("movw %1,%%fs:%0" : "+m" (*(u16 *)addr) : "r" (v));
1918 +static inline void wrfs32(u32 v, addr_t addr)
1920 + asm volatile("movl %1,%%fs:%0" : "+m" (*(u32 *)addr) : "r" (v));
1923 +static inline u8 rdgs8(addr_t addr)
1926 + asm("movb %%gs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr));
1929 +static inline u16 rdgs16(addr_t addr)
1932 + asm("movw %%gs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr));
1935 +static inline u32 rdgs32(addr_t addr)
1938 + asm("movl %%gs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr));
1942 +static inline void wrgs8(u8 v, addr_t addr)
1944 + asm volatile("movb %1,%%gs:%0" : "+m" (*(u8 *)addr) : "r" (v));
1946 +static inline void wrgs16(u16 v, addr_t addr)
1948 + asm volatile("movw %1,%%gs:%0" : "+m" (*(u16 *)addr) : "r" (v));
1950 +static inline void wrgs32(u32 v, addr_t addr)
1952 + asm volatile("movl %1,%%gs:%0" : "+m" (*(u32 *)addr) : "r" (v));
1955 +/* Note: these only return true/false, not a signed return value! */
1956 +static inline int memcmp(const void *s1, const void *s2, size_t len)
1959 + asm("repe; cmpsb; setnz %0"
1960 + : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
1964 +static inline int memcmp_fs(const void *s1, addr_t s2, size_t len)
1967 + asm("fs; repe; cmpsb; setnz %0"
1968 + : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
1971 +static inline int memcmp_gs(const void *s1, addr_t s2, size_t len)
1974 + asm("gs; repe; cmpsb; setnz %0"
1975 + : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
1979 +/* Heap -- available for dynamic lists. */
1980 +#define STACK_SIZE 512 /* Minimum number of bytes for stack */
1982 +extern char _end[];
1984 +extern char *heap_end;
1985 +#define RESET_HEAP() ((void *)( HEAP = _end ))
1986 +static inline char *__get_heap(size_t s, size_t a, size_t n)
1990 + HEAP = (char *)(((size_t)HEAP+(a-1)) & ~(a-1));
1995 +#define GET_HEAP(type, n) \
1996 + ((type *)__get_heap(sizeof(type),__alignof__(type),(n)))
1998 +static inline int heap_free(void)
2000 + return heap_end-HEAP;
2005 +void copy_to_fs(addr_t dst, void *src, size_t len);
2006 +void *copy_from_fs(void *dst, addr_t src, size_t len);
2007 +void copy_to_gs(addr_t dst, void *src, size_t len);
2008 +void *copy_from_gs(void *dst, addr_t src, size_t len);
2009 +void *memcpy(void *dst, void *src, size_t len);
2010 +void *memset(void *dst, int c, size_t len);
2012 +#define memcpy(d,s,l) __builtin_memcpy(d,s,l)
2013 +#define memset(d,c,l) __builtin_memset(d,c,l)
2016 +int enable_a20(void);
2019 +int query_apm_bios(void);
2022 +int cmdline_find_option(const char *option, char *buffer, int bufsize);
2024 +/* cpu.c, cpucheck.c */
2025 +int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr);
2026 +int validate_cpu(void);
2029 +void query_edd(void);
2032 +void __attribute__((noreturn)) die(void);
2035 +int query_mca(void);
2038 +int detect_memory(void);
2041 +void __attribute__((noreturn)) go_to_protected_mode(void);
2044 +void __attribute__((noreturn))
2045 + protected_mode_jump(u32 entrypoint, u32 bootparams);
2048 +unsigned int atou(const char *s);
2049 +int sprintf(char *buf, const char *fmt, ...);
2050 +int vsprintf(char *buf, const char *fmt, va_list args);
2051 +int printf(const char *fmt, ...);
2054 +int strcmp(const char *str1, const char *str2);
2057 +void puts(const char *);
2060 +void kbd_flush(void);
2061 +int getchar_timeout(void);
2064 +void set_video(void);
2067 +void vesa_store_edid(void);
2070 +int query_voyager(void);
2072 +#endif /* __ASSEMBLY__ */
2074 +#endif /* BOOT_BOOT_H */
2075 --- a/arch/i386/boot/bootsect.S
2079 - * bootsect.S Copyright (C) 1991, 1992 Linus Torvalds
2081 - * modified by Drew Eckhardt
2082 - * modified by Bruce Evans (bde)
2083 - * modified by Chris Noe (May 1999) (as86 -> gas)
2084 - * gutted by H. Peter Anvin (Jan 2003)
2086 - * BIG FAT NOTE: We're in real mode using 64k segments. Therefore segment
2087 - * addresses must be multiplied by 16 to obtain their respective linear
2088 - * addresses. To avoid confusion, linear addresses are written using leading
2089 - * hex while segment addresses are written as segment:offset.
2093 -#include <asm/boot.h>
2095 -SETUPSECTS = 4 /* default nr of setup-sectors */
2096 -BOOTSEG = 0x07C0 /* original address of boot-sector */
2097 -INITSEG = DEF_INITSEG /* we move boot here - out of the way */
2098 -SETUPSEG = DEF_SETUPSEG /* setup starts here */
2099 -SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */
2100 -SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */
2101 - /* to be loaded */
2102 -ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */
2103 -SWAP_DEV = 0 /* SWAP_DEV is now written by "build" */
2106 -#define SVGA_MODE ASK_VGA
2113 -#ifndef ROOT_RDONLY
2114 -#define ROOT_RDONLY 1
2123 - # Normalize the start address
2124 - jmpl $BOOTSEG, $start2
2135 - movw $bugger_off_msg, %si
2147 - # Allow the user to press a key, then reboot
2152 - # int 0x19 should never return. In case it does anyway,
2153 - # invoke the BIOS reset code...
2154 - ljmp $0xf000,$0xfff0
2158 - .ascii "Direct booting from floppy is no longer supported.\r\n"
2159 - .ascii "Please use a boot loader program instead.\r\n"
2161 - .ascii "Remove disk and press any key to reboot . . .\r\n"
2165 - # Kernel attributes; used by setup
2168 -setup_sects: .byte SETUPSECTS
2169 -root_flags: .word ROOT_RDONLY
2170 -syssize: .word SYSSIZE
2171 -swap_dev: .word SWAP_DEV
2172 -ram_size: .word RAMDISK
2173 -vid_mode: .word SVGA_MODE
2174 -root_dev: .word ROOT_DEV
2175 -boot_flag: .word 0xAA55
2177 +++ b/arch/i386/boot/cmdline.c
2179 +/* -*- linux-c -*- ------------------------------------------------------- *
2181 + * Copyright (C) 1991, 1992 Linus Torvalds
2182 + * Copyright 2007 rPath, Inc. - All Rights Reserved
2184 + * This file is part of the Linux kernel, and is made available under
2185 + * the terms of the GNU General Public License version 2.
2187 + * ----------------------------------------------------------------------- */
2190 + * arch/i386/boot/cmdline.c
2192 + * Simple command-line parser for early boot.
2197 +static inline int myisspace(u8 c)
2199 + return c <= ' '; /* Close enough approximation */
2203 + * Find a non-boolean option, that is, "option=argument". In accordance
2204 + * with standard Linux practice, if this option is repeated, this returns
2205 + * the last instance on the command line.
2207 + * Returns the length of the argument (regardless of if it was
2208 + * truncated to fit in the buffer), or -1 on not found.
2210 +int cmdline_find_option(const char *option, char *buffer, int bufsize)
2212 + u32 cmdline_ptr = boot_params.hdr.cmd_line_ptr;
2216 + const char *opptr = NULL;
2217 + char *bufptr = buffer;
2219 + st_wordstart, /* Start of word/after whitespace */
2220 + st_wordcmp, /* Comparing this word */
2221 + st_wordskip, /* Miscompare, skip */
2222 + st_bufcpy /* Copying this to buffer */
2223 + } state = st_wordstart;
2225 + if (!cmdline_ptr || cmdline_ptr >= 0x100000)
2226 + return -1; /* No command line, or inaccessible */
2228 + cptr = cmdline_ptr & 0xf;
2229 + set_fs(cmdline_ptr >> 4);
2231 + while (cptr < 0x10000 && (c = rdfs8(cptr++))) {
2233 + case st_wordstart:
2238 + state = st_wordcmp;
2240 + /* fall through */
2243 + if (c == '=' && !*opptr) {
2246 + state = st_bufcpy;
2247 + } else if (myisspace(c)) {
2248 + state = st_wordstart;
2249 + } else if (c != *opptr++) {
2250 + state = st_wordskip;
2256 + state = st_wordstart;
2260 + if (myisspace(c)) {
2261 + state = st_wordstart;
2263 + if (len < bufsize-1)
2277 +++ b/arch/i386/boot/code16gcc.h
2282 + * This file is -include'd when compiling 16-bit C code.
2285 +#ifndef __ASSEMBLY__
2288 --- a/arch/i386/boot/compressed/Makefile
2289 +++ b/arch/i386/boot/compressed/Makefile
2291 EXTRA_AFLAGS := -traditional
2293 LDFLAGS_vmlinux := -T
2294 -CFLAGS_misc.o += -fPIC
2295 hostprogs-y := relocs
2297 +CFLAGS := -m32 -D__KERNEL__ $(LINUX_INCLUDE) -O2 \
2298 + -fno-strict-aliasing -fPIC \
2299 + $(call cc-option,-ffreestanding) \
2300 + $(call cc-option,-fno-stack-protector)
2301 +LDFLAGS := -m elf_i386
2303 $(obj)/vmlinux: $(src)/vmlinux.lds $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE
2304 $(call if_changed,ld)
2306 --- a/arch/i386/boot/compressed/head.S
2307 +++ b/arch/i386/boot/compressed/head.S
2309 * at and where we were actually loaded at. This can only be done
2310 * with a short local call on x86. Nothing else will tell us what
2311 * address we are running at. The reserved chunk of the real-mode
2312 - * data at 0x34-0x3f are used as the stack for this calculation.
2313 - * Only 4 bytes are needed.
2314 + * data at 0x1e4 (defined as a scratch field) are used as the stack
2315 + * for this calculation. Only 4 bytes are needed.
2317 - leal 0x40(%esi), %esp
2318 + leal (0x1e4+4)(%esi), %esp
2322 --- a/arch/i386/boot/compressed/misc.c
2323 +++ b/arch/i386/boot/compressed/misc.c
2326 #undef CONFIG_PARAVIRT
2327 #include <linux/linkage.h>
2328 -#include <linux/vmalloc.h>
2329 #include <linux/screen_info.h>
2331 #include <asm/page.h>
2332 @@ -364,8 +363,10 @@
2334 if ((u32)output & (CONFIG_PHYSICAL_ALIGN -1))
2335 error("Destination address not CONFIG_PHYSICAL_ALIGN aligned");
2336 +#ifndef CONFIG_X86_64
2337 if (end > ((-__PAGE_OFFSET-(512 <<20)-1) & 0x7fffffff))
2338 error("Destination address too large");
2340 #ifndef CONFIG_RELOCATABLE
2341 if ((u32)output != LOAD_PHYSICAL_ADDR)
2342 error("Wrong destination address");
2344 +++ b/arch/i386/boot/copy.S
2346 +/* ----------------------------------------------------------------------- *
2348 + * Copyright (C) 1991, 1992 Linus Torvalds
2349 + * Copyright 2007 rPath, Inc. - All Rights Reserved
2351 + * This file is part of the Linux kernel, and is made available under
2352 + * the terms of the GNU General Public License version 2.
2354 + * ----------------------------------------------------------------------- */
2357 + * arch/i386/boot/copy.S
2359 + * Memory copy routines
2366 + .type memcpy, @function
2381 + .size memcpy, .-memcpy
2384 + .type memset, @function
2389 + imull $0x01010101,%eax
2398 + .size memset, .-memset
2400 + .globl copy_from_fs
2401 + .type copy_from_fs, @function
2409 + .size copy_from_fs, .-copy_from_fs
2412 + .type copy_to_fs, @function
2420 + .size copy_to_fs, .-copy_to_fs
2422 +#if 0 /* Not currently used, but can be enabled as needed */
2424 + .globl copy_from_gs
2425 + .type copy_from_gs, @function
2433 + .size copy_from_gs, .-copy_from_gs
2436 + .type copy_to_gs, @function
2444 + .size copy_to_gs, .-copy_to_gs
2448 +++ b/arch/i386/boot/cpu.c
2450 +/* -*- linux-c -*- ------------------------------------------------------- *
2452 + * Copyright (C) 1991, 1992 Linus Torvalds
2453 + * Copyright 2007 rPath, Inc. - All Rights Reserved
2455 + * This file is part of the Linux kernel, and is made available under
2456 + * the terms of the GNU General Public License version 2.
2458 + * ----------------------------------------------------------------------- */
2461 + * arch/i386/boot/cpucheck.c
2463 + * Check for obligatory CPU features and abort if the features are not
2468 +#include "bitops.h"
2469 +#include <asm/cpufeature.h>
2471 +static char *cpu_name(int level)
2473 + static char buf[6];
2475 + if (level == 64) {
2478 + sprintf(buf, "i%d86", level);
2483 +int validate_cpu(void)
2486 + int cpu_level, req_level;
2488 + check_cpu(&cpu_level, &req_level, &err_flags);
2490 + if (cpu_level < req_level) {
2491 + printf("This kernel requires an %s CPU, ",
2492 + cpu_name(req_level));
2493 + printf("but only detected an %s CPU.\n",
2494 + cpu_name(cpu_level));
2500 + puts("This kernel requires the following features "
2501 + "not present on the CPU:\n");
2503 + for (i = 0; i < NCAPINTS; i++) {
2504 + u32 e = err_flags[i];
2506 + for (j = 0; j < 32; j++) {
2508 + printf("%d:%d ", i, j);
2520 +++ b/arch/i386/boot/cpucheck.c
2522 +/* -*- linux-c -*- ------------------------------------------------------- *
2524 + * Copyright (C) 1991, 1992 Linus Torvalds
2525 + * Copyright 2007 rPath, Inc. - All Rights Reserved
2527 + * This file is part of the Linux kernel, and is made available under
2528 + * the terms of the GNU General Public License version 2.
2530 + * ----------------------------------------------------------------------- */
2533 + * arch/i386/boot/cpu.c
2535 + * Check for obligatory CPU features and abort if the features are not
2536 + * present. This code should be compilable as 16-, 32- or 64-bit
2537 + * code, so be very careful with types and inline assembly.
2539 + * This code should not contain any messages; that requires an
2540 + * additional wrapper.
2542 + * As written, this code is not safe for inclusion into the kernel
2543 + * proper (after FPU initialization, in particular).
2548 +# include "bitops.h"
2550 +#include <linux/types.h>
2551 +#include <asm/cpufeature.h>
2552 +#include <asm/processor-flags.h>
2553 +#include <asm/required-features.h>
2554 +#include <asm/msr-index.h>
2556 +struct cpu_features {
2559 + u32 flags[NCAPINTS];
2562 +static struct cpu_features cpu;
2563 +static u32 cpu_vendor[3];
2564 +static u32 err_flags[NCAPINTS];
2566 +#ifdef CONFIG_X86_64
2567 +static const int req_level = 64;
2568 +#elif defined(CONFIG_X86_MINIMUM_CPU_MODEL)
2569 +static const int req_level = CONFIG_X86_MINIMUM_CPU_MODEL;
2571 +static const int req_level = 3;
2574 +static const u32 req_flags[NCAPINTS] =
2585 +#define A32(a,b,c,d) (((d) << 24)+((c) << 16)+((b) << 8)+(a))
2587 +static int is_amd(void)
2589 + return cpu_vendor[0] == A32('A','u','t','h') &&
2590 + cpu_vendor[1] == A32('e','n','t','i') &&
2591 + cpu_vendor[2] == A32('c','A','M','D');
2594 +static int is_centaur(void)
2596 + return cpu_vendor[0] == A32('C','e','n','t') &&
2597 + cpu_vendor[1] == A32('a','u','r','H') &&
2598 + cpu_vendor[2] == A32('a','u','l','s');
2601 +static int is_transmeta(void)
2603 + return cpu_vendor[0] == A32('G','e','n','u') &&
2604 + cpu_vendor[1] == A32('i','n','e','T') &&
2605 + cpu_vendor[2] == A32('M','x','8','6');
2608 +static int has_fpu(void)
2610 + u16 fcw = -1, fsw = -1;
2613 + asm("movl %%cr0,%0" : "=r" (cr0));
2614 + if (cr0 & (X86_CR0_EM|X86_CR0_TS)) {
2615 + cr0 &= ~(X86_CR0_EM|X86_CR0_TS);
2616 + asm volatile("movl %0,%%cr0" : : "r" (cr0));
2619 + asm("fninit ; fnstsw %0 ; fnstcw %1" : "+m" (fsw), "+m" (fcw));
2621 + return fsw == 0 && (fcw & 0x103f) == 0x003f;
2624 +static int has_eflag(u32 mask)
2638 + : "=r" (f0), "=r" (f1)
2641 + return !!((f0^f1) & mask);
2644 +static void get_flags(void)
2646 + u32 max_intel_level, max_amd_level;
2650 + set_bit(X86_FEATURE_FPU, cpu.flags);
2652 + if (has_eflag(X86_EFLAGS_ID)) {
2654 + : "=a" (max_intel_level),
2655 + "=b" (cpu_vendor[0]),
2656 + "=d" (cpu_vendor[1]),
2657 + "=c" (cpu_vendor[2])
2660 + if (max_intel_level >= 0x00000001 &&
2661 + max_intel_level <= 0x0000ffff) {
2664 + "=c" (cpu.flags[4]),
2665 + "=d" (cpu.flags[0])
2666 + : "a" (0x00000001)
2668 + cpu.level = (tfms >> 8) & 15;
2669 + cpu.model = (tfms >> 4) & 15;
2670 + if (cpu.level >= 6)
2671 + cpu.model += ((tfms >> 16) & 0xf) << 4;
2675 + : "=a" (max_amd_level)
2676 + : "a" (0x80000000)
2677 + : "ebx", "ecx", "edx");
2679 + if (max_amd_level >= 0x80000001 &&
2680 + max_amd_level <= 0x8000ffff) {
2681 + u32 eax = 0x80000001;
2684 + "=c" (cpu.flags[6]),
2685 + "=d" (cpu.flags[1])
2691 +/* Returns a bitmask of which words we have error bits in */
2692 +static int check_flags(void)
2698 + for (i = 0; i < NCAPINTS; i++) {
2699 + err_flags[i] = req_flags[i] & ~cpu.flags[i];
2708 + * Returns -1 on error.
2710 + * *cpu_level is set to the current CPU level; *req_level to the required
2711 + * level. x86-64 is considered level 64 for this purpose.
2713 + * *err_flags_ptr is set to the flags error array if there are flags missing.
2715 +int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr)
2719 + memset(&cpu.flags, 0, sizeof cpu.flags);
2722 + if (has_eflag(X86_EFLAGS_AC))
2726 + err = check_flags();
2728 + if (test_bit(X86_FEATURE_LM, cpu.flags))
2731 + if (err == 0x01 &&
2733 + ~((1 << X86_FEATURE_XMM)|(1 << X86_FEATURE_XMM2))) &&
2735 + /* If this is an AMD and we're only missing SSE+SSE2, try to
2738 + u32 ecx = MSR_K7_HWCR;
2741 + asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
2742 + eax &= ~(1 << 15);
2743 + asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
2745 + get_flags(); /* Make sure it really did something */
2746 + err = check_flags();
2747 + } else if (err == 0x01 &&
2748 + !(err_flags[0] & ~(1 << X86_FEATURE_CX8)) &&
2749 + is_centaur() && cpu.model >= 6) {
2750 + /* If this is a VIA C3, we might have to enable CX8
2753 + u32 ecx = MSR_VIA_FCR;
2756 + asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
2757 + eax |= (1<<1)|(1<<7);
2758 + asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
2760 + set_bit(X86_FEATURE_CX8, cpu.flags);
2761 + err = check_flags();
2762 + } else if (err == 0x01 && is_transmeta()) {
2763 + /* Transmeta might have masked feature bits in word 0 */
2765 + u32 ecx = 0x80860004;
2769 + asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
2770 + asm("wrmsr" : : "a" (~0), "d" (edx), "c" (ecx));
2772 + : "+a" (level), "=d" (cpu.flags[0])
2773 + : : "ecx", "ebx");
2774 + asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
2776 + err = check_flags();
2779 + if (err_flags_ptr)
2780 + *err_flags_ptr = err ? err_flags : NULL;
2781 + if (cpu_level_ptr)
2782 + *cpu_level_ptr = cpu.level;
2783 + if (req_level_ptr)
2784 + *req_level_ptr = req_level;
2786 + return (cpu.level < req_level || err) ? -1 : 0;
2788 --- a/arch/i386/boot/edd.S
2792 - * BIOS Enhanced Disk Drive support
2793 - * Copyright (C) 2002, 2003, 2004 Dell, Inc.
2794 - * by Matt Domsch <Matt_Domsch@dell.com> October 2002
2795 - * conformant to T13 Committee www.t13.org
2796 - * projects 1572D, 1484D, 1386D, 1226DT
2797 - * disk signature read by Matt Domsch <Matt_Domsch@dell.com>
2798 - * and Andrew Wilks <Andrew_Wilks@dell.com> September 2003, June 2004
2799 - * legacy CHS retrieval by Patrick J. LoPresti <patl@users.sourceforge.net>
2801 - * Command line option parsing, Matt Domsch, November 2004
2804 -#include <linux/edd.h>
2805 -#include <asm/setup.h>
2807 -#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
2809 -# It is assumed that %ds == INITSEG here
2811 - movb $0, (EDD_MBR_SIG_NR_BUF)
2814 -# Check the command line for options:
2815 -# edd=of disables EDD completely (edd=off)
2816 -# edd=sk skips the MBR test (edd=skipmbr)
2817 -# edd=on re-enables EDD (edd=on)
2820 - movw $edd_mbr_sig_start, %di # Default to edd=on
2822 - movl %cs:(cmd_line_ptr), %esi
2824 - jz old_cl # Old boot protocol?
2826 -# Convert to a real-mode pointer in fs:si
2831 - jmp have_cl_pointer
2833 -# Old-style boot protocol?
2835 - push %ds # aka INITSEG
2838 - cmpw $0xa33f, (0x20)
2839 - jne done_cl # No command line at all?
2840 - movw (0x22), %si # Pointer relative to INITSEG
2842 -# fs:si has the pointer to the command line now
2845 -# Loop through kernel command line one byte at a time. Just in
2846 -# case the loader is buggy and failed to null-terminate the command line
2847 -# terminate if we get close enough to the end of the segment that we
2848 -# cannot fit "edd=XX"...
2850 - cmpw $-5, %si # Watch for segment wraparound
2852 - movl %fs:(%si), %eax
2853 - andb %al, %al # End of line?
2855 - cmpl $EDD_CL_EQUALS, %eax
2856 - jz found_edd_equals
2857 - cmpb $0x20, %al # <= space consider whitespace
2863 - cmpw $-5, %si # Watch for segment wraparound
2865 - movb %fs:(%si), %al # End of string?
2874 -# only looking at first two characters after equals
2875 -# late overrides early on the command line, so keep going after finding something
2876 - movw %fs:4(%si), %ax
2877 - cmpw $EDD_CL_OFF, %ax # edd=of
2879 - cmpw $EDD_CL_SKIP, %ax # edd=sk
2881 - cmpw $EDD_CL_ON, %ax # edd=on
2885 - movw $edd_start, %di
2888 - movw $edd_done, %di
2891 - movw $edd_mbr_sig_start, %di
2898 -# Read the first sector of each BIOS disk device and store the 4-byte signature
2900 - movb $0x80, %dl # from device 80
2901 - movw $EDD_MBR_SIG_BUF, %bx # store buffer ptr in bx
2903 - movl $0xFFFFFFFF, %eax
2904 - movl %eax, (%bx) # assume failure
2906 - movb $READ_SECTORS, %ah
2907 - movb $1, %al # read 1 sector
2908 - movb $0, %dh # at head 0
2909 - movw $1, %cx # cylinder 0, sector 0
2913 - movw $EDDBUF, %bx # disk's data goes into EDDBUF
2914 - pushw %dx # work around buggy BIOSes
2915 - stc # work around buggy BIOSes
2917 - sti # work around buggy BIOSes
2921 - jc edd_mbr_sig_done # on failure, we're done.
2922 - cmpb $0, %ah # some BIOSes do not set CF
2923 - jne edd_mbr_sig_done # on failure, we're done.
2924 - movl (EDDBUF+EDD_MBR_SIG_OFFSET), %eax # read sig out of the MBR
2925 - movl %eax, (%bx) # store success
2926 - incb (EDD_MBR_SIG_NR_BUF) # note that we stored something
2927 - incb %dl # increment to next device
2928 - addw $4, %bx # increment sig buffer ptr
2929 - cmpb $EDD_MBR_SIG_MAX, (EDD_MBR_SIG_NR_BUF) # Out of space?
2930 - jb edd_mbr_sig_read # keep looping
2933 -# Do the BIOS Enhanced Disk Drive calls
2934 -# This consists of two calls:
2935 -# int 13h ah=41h "Check Extensions Present"
2936 -# int 13h ah=48h "Get Device Parameters"
2937 -# int 13h ah=08h "Legacy Get Device Parameters"
2939 -# A buffer of size EDDMAXNR*(EDDEXTSIZE+EDDPARMSIZE) is reserved for our use
2940 -# in the boot_params at EDDBUF. The first four bytes of which are
2941 -# used to store the device number, interface support map and version
2942 -# results from fn41. The next four bytes are used to store the legacy
2943 -# cylinders, heads, and sectors from fn08. The following 74 bytes are used to
2944 -# store the results from fn48. Starting from device 80h, fn41, then fn48
2945 -# are called and their results stored in EDDBUF+n*(EDDEXTSIZE+EDDPARMIZE).
2946 -# Then the pointer is incremented to store the data for the next call.
2947 -# This repeats until either a device doesn't exist, or until EDDMAXNR
2948 -# devices have been stored.
2949 -# The one tricky part is that ds:si always points EDDEXTSIZE bytes into
2950 -# the structure, and the fn41 and fn08 results are stored at offsets
2951 -# from there. This removes the need to increment the pointer for
2952 -# every store, and leaves it ready for the fn48 call.
2953 -# A second one-byte buffer, EDDNR, in the boot_params stores
2954 -# the number of BIOS devices which exist, up to EDDMAXNR.
2955 -# In setup.c, copy_edd() stores both boot_params buffers away
2956 -# for later use, as they would get overwritten otherwise.
2957 -# This code is sensitive to the size of the structs in edd.h
2959 - # %ds points to the bootsector
2960 - # result buffer for fn48
2961 - movw $EDDBUF+EDDEXTSIZE, %si # in ds:si, fn41 results
2962 - # kept just before that
2963 - movb $0x80, %dl # BIOS device 0x80
2966 - movb $CHECKEXTENSIONSPRESENT, %ah # Function 41
2967 - movw $EDDMAGIC1, %bx # magic
2968 - int $0x13 # make the call
2969 - jc edd_done # no more BIOS devices
2971 - cmpw $EDDMAGIC2, %bx # is magic right?
2972 - jne edd_next # nope, next...
2974 - movb %dl, %ds:-8(%si) # store device number
2975 - movb %ah, %ds:-7(%si) # store version
2976 - movw %cx, %ds:-6(%si) # store extensions
2977 - incb (EDDNR) # note that we stored something
2979 -edd_get_device_params:
2980 - movw $EDDPARMSIZE, %ds:(%si) # put size
2981 - movw $0x0, %ds:2(%si) # work around buggy BIOSes
2982 - movb $GETDEVICEPARAMETERS, %ah # Function 48
2983 - int $0x13 # make the call
2984 - # Don't check for fail return
2985 - # it doesn't matter.
2986 -edd_get_legacy_chs:
2988 - movw %ax, %ds:-4(%si)
2989 - movw %ax, %ds:-2(%si)
2990 - # Ralf Brown's Interrupt List says to set ES:DI to
2991 - # 0000h:0000h "to guard against BIOS bugs"
2995 - pushw %dx # legacy call clobbers %dl
2996 - movb $LEGACYGETDEVICEPARAMETERS, %ah # Function 08
2997 - int $0x13 # make the call
2998 - jc edd_legacy_done # failed
2999 - movb %cl, %al # Low 6 bits are max
3000 - andb $0x3F, %al # sector number
3001 - movb %al, %ds:-1(%si) # Record max sect
3002 - movb %dh, %ds:-2(%si) # Record max head number
3003 - movb %ch, %al # Low 8 bits of max cyl
3005 - movb %cl, %ah # High 2 bits of max cyl
3006 - movw %ax, %ds:-4(%si)
3011 - movw %si, %ax # increment si
3012 - addw $EDDPARMSIZE+EDDEXTSIZE, %ax
3016 - incb %dl # increment to next device
3017 - cmpb $EDDMAXNR, (EDDNR) # Out of space?
3018 - jb edd_check_ext # keep looping
3023 +++ b/arch/i386/boot/edd.c
3025 +/* -*- linux-c -*- ------------------------------------------------------- *
3027 + * Copyright (C) 1991, 1992 Linus Torvalds
3028 + * Copyright 2007 rPath, Inc. - All Rights Reserved
3030 + * This file is part of the Linux kernel, and is made available under
3031 + * the terms of the GNU General Public License version 2.
3033 + * ----------------------------------------------------------------------- */
3036 + * arch/i386/boot/edd.c
3038 + * Get EDD BIOS disk information
3042 +#include <linux/edd.h>
3044 +#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
3050 + u16 buf_off, buf_seg;
3056 + * Note: this uses the heap to hold the loaded sector.
3058 +static int read_sector(u8 devno, u64 lba, void *buf)
3060 + struct edd_dapa dapa;
3061 + u16 ax, bx, cx, dx, si;
3063 + memset(&dapa, 0, sizeof dapa);
3064 + dapa.pkt_size = sizeof(dapa);
3065 + dapa.sector_cnt = 1;
3066 + dapa.buf_off = (size_t)buf;
3067 + dapa.buf_seg = ds();
3070 + ax = 0x4200; /* Extended Read */
3071 + si = (size_t)&dapa;
3073 + asm("pushfl; stc; int $0x13; setc %%al; popfl"
3074 + : "+a" (ax), "+S" (si), "+d" (dx)
3076 + : "ebx", "ecx", "edi", "memory");
3079 + return 0; /* OK */
3081 + ax = 0x0201; /* Legacy Read, one sector */
3082 + cx = 0x0001; /* Sector 0-0-1 */
3085 + asm("pushfl; stc; int $0x13; setc %%al; popfl"
3086 + : "+a" (ax), "+c" (cx), "+d" (dx), "+b" (bx)
3087 + : : "esi", "edi", "memory");
3089 + return -(u8)ax; /* 0 or -1 */
3092 +static u32 read_mbr_sig(u8 devno, struct edd_info *ei)
3095 + char *mbrbuf_ptr, *mbrbuf_end;
3097 + u32 buf_base, mbr_base;
3098 + extern char _end[];
3099 + static char mbr_buf[1024];
3101 + sector_size = ei->params.bytes_per_sector;
3103 + sector_size = 512; /* Best available guess */
3105 + buf_base = (ds() << 4) + (u32)&_end;
3106 + mbr_base = (buf_base+sector_size-1) & ~(sector_size-1);
3107 + mbrbuf_ptr = mbr_buf + (mbr_base-buf_base);
3108 + mbrbuf_end = mbrbuf_ptr + sector_size;
3110 + if (!(boot_params.hdr.loadflags & CAN_USE_HEAP))
3112 + if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr)
3115 + if (read_sector(devno, 0, mbrbuf_ptr))
3118 + mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET];
3122 +static int get_edd_info(u8 devno, struct edd_info *ei)
3124 + u16 ax, bx, cx, dx, di;
3126 + memset(ei, 0, sizeof *ei);
3128 + /* Check Extensions Present */
3133 + asm("pushfl; stc; int $0x13; setc %%al; popfl"
3134 + : "+a" (ax), "+b" (bx), "=c" (cx), "+d" (dx)
3135 + : : "esi", "edi");
3138 + return -1; /* No extended information */
3140 + if (bx != EDDMAGIC2)
3143 + ei->device = devno;
3144 + ei->version = ax >> 8; /* EDD version number */
3145 + ei->interface_support = cx; /* EDD functionality subsets */
3147 + /* Extended Get Device Parameters */
3149 + ei->params.length = sizeof(ei->params);
3152 + asm("pushfl; int $0x13; popfl"
3153 + : "+a" (ax), "+d" (dx)
3154 + : "S" (&ei->params)
3155 + : "ebx", "ecx", "edi");
3157 + /* Get legacy CHS parameters */
3159 + /* Ralf Brown recommends setting ES:DI to 0:0 */
3163 + asm("pushw %%es; "
3164 + "movw %%di,%%es; "
3165 + "pushfl; stc; int $0x13; setc %%al; popfl; "
3167 + : "+a" (ax), "=b" (bx), "=c" (cx), "+d" (dx), "+D" (di)
3170 + if ((u8)ax == 0) {
3171 + ei->legacy_max_cylinder = (cx >> 8) + ((cx & 0xc0) << 2);
3172 + ei->legacy_max_head = dx >> 8;
3173 + ei->legacy_sectors_per_track = cx & 0x3f;
3179 +void query_edd(void)
3185 + struct edd_info ei, *edp;
3187 + if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) {
3188 + if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip"))
3190 + else if (!strcmp(eddarg, "off"))
3194 + edp = (struct edd_info *)boot_params.eddbuf;
3199 + for (devno = 0x80; devno < 0x80+EDD_MBR_SIG_MAX; devno++) {
3201 + * Scan the BIOS-supported hard disks and query EDD
3204 + get_edd_info(devno, &ei);
3206 + if (boot_params.eddbuf_entries < EDDMAXNR) {
3207 + memcpy(edp, &ei, sizeof ei);
3209 + boot_params.eddbuf_entries++;
3214 + mbr_sig = read_mbr_sig(devno, &ei);
3215 + boot_params.edd_mbr_sig_buffer[devno-0x80] = mbr_sig;
3222 +++ b/arch/i386/boot/header.S
3227 + * Copyright (C) 1991, 1992 Linus Torvalds
3229 + * Based on bootsect.S and setup.S
3230 + * modified by more people than can be counted
3232 + * Rewritten as a common file by H. Peter Anvin (Apr 2007)
3234 + * BIG FAT NOTE: We're in real mode using 64k segments. Therefore segment
3235 + * addresses must be multiplied by 16 to obtain their respective linear
3236 + * addresses. To avoid confusion, linear addresses are written using leading
3237 + * hex while segment addresses are written as segment:offset.
3241 +#include <asm/segment.h>
3242 +#include <linux/utsrelease.h>
3243 +#include <asm/boot.h>
3244 +#include <asm/e820.h>
3245 +#include <asm/page.h>
3246 +#include <asm/setup.h>
3249 +SETUPSECTS = 4 /* default nr of setup-sectors */
3250 +BOOTSEG = 0x07C0 /* original address of boot-sector */
3251 +SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */
3252 +SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */
3253 + /* to be loaded */
3254 +ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */
3255 +SWAP_DEV = 0 /* SWAP_DEV is now written by "build" */
3258 +#define SVGA_MODE ASK_VGA
3265 +#ifndef ROOT_RDONLY
3266 +#define ROOT_RDONLY 1
3270 + .section ".bstext", "ax"
3272 + .global bootsect_start
3275 + # Normalize the start address
3276 + ljmp $BOOTSEG, $start2
3287 + movw $bugger_off_msg, %si
3299 + # Allow the user to press a key, then reboot
3304 + # int 0x19 should never return. In case it does anyway,
3305 + # invoke the BIOS reset code...
3306 + ljmp $0xf000,$0xfff0
3308 + .section ".bsdata", "a"
3310 + .ascii "Direct booting from floppy is no longer supported.\r\n"
3311 + .ascii "Please use a boot loader program instead.\r\n"
3313 + .ascii "Remove disk and press any key to reboot . . .\r\n"
3317 + # Kernel attributes; used by setup. This is part 1 of the
3318 + # header, from the old boot sector.
3320 + .section ".header", "a"
3323 +setup_sects: .byte SETUPSECTS
3324 +root_flags: .word ROOT_RDONLY
3325 +syssize: .long SYSSIZE
3326 +ram_size: .word RAMDISK
3327 +vid_mode: .word SVGA_MODE
3328 +root_dev: .word ROOT_DEV
3329 +boot_flag: .word 0xAA55
3331 + # offset 512, entry point
3335 + # Explicitly enter this as bytes, or the assembler
3336 + # tries to generate a 3-byte jump here, which causes
3337 + # everything else to push off to the wrong offset.
3338 + .byte 0xeb # short (2-byte) jump
3339 + .byte start_of_setup-1f
3342 + # Part 2 of the header, from the old setup.S
3344 + .ascii "HdrS" # header signature
3345 + .word 0x0206 # header version number (>= 0x0105)
3346 + # or else old loadlin-1.5 will fail)
3347 + .globl realmode_swtch
3348 +realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
3349 +start_sys_seg: .word SYSSEG
3350 + .word kernel_version-512 # pointing to kernel version string
3351 + # above section of header is compatible
3352 + # with loadlin-1.5 (header v1.5). Don't
3355 +type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin,
3356 + # Bootlin, SYSLX, bootsect...)
3357 + # See Documentation/i386/boot.txt for
3360 +# flags, unused bits must be zero (RFU) bit within loadflags
3362 +LOADED_HIGH = 1 # If set, the kernel is loaded high
3363 +CAN_USE_HEAP = 0x80 # If set, the loader also has set
3364 + # heap_end_ptr to tell how much
3365 + # space behind setup.S can be used for
3367 + # Only the loader knows what is free
3368 +#ifndef __BIG_KERNEL__
3374 +setup_move_size: .word 0x8000 # size to move, when setup is not
3375 + # loaded at 0x90000. We will move setup
3376 + # to 0x90000 then just before jumping
3377 + # into the kernel. However, only the
3378 + # loader knows how much data behind
3379 + # us also needs to be loaded.
3381 +code32_start: # here loaders can put a different
3382 + # start address for 32-bit code.
3383 +#ifndef __BIG_KERNEL__
3384 + .long 0x1000 # 0x1000 = default for zImage
3386 + .long 0x100000 # 0x100000 = default for big kernel
3389 +ramdisk_image: .long 0 # address of loaded ramdisk image
3390 + # Here the loader puts the 32-bit
3391 + # address where it loaded the image.
3392 + # This only will be read by the kernel.
3394 +ramdisk_size: .long 0 # its size in bytes
3397 + .long 0 # obsolete
3399 +heap_end_ptr: .word _end+1024 # (Header version 0x0201 or later)
3400 + # space from here (exclusive) down to
3401 + # end of setup code can be used by setup
3402 + # for local heap purposes.
3405 +cmd_line_ptr: .long 0 # (Header version 0x0202 or later)
3406 + # If nonzero, a 32-bit pointer
3407 + # to the kernel command line.
3408 + # The command line should be
3409 + # located between the start of
3410 + # setup and the end of low
3411 + # memory (0xa0000), or it may
3412 + # get overwritten before it
3413 + # gets read. If this field is
3414 + # used, there is no longer
3415 + # anything magical about the
3416 + # 0x90000 segment; the setup
3417 + # can be located anywhere in
3418 + # low memory 0x10000 or higher.
3420 +ramdisk_max: .long (-__PAGE_OFFSET-(512 << 20)-1) & 0x7fffffff
3421 + # (Header version 0x0203 or later)
3422 + # The highest safe address for
3423 + # the contents of an initrd
3425 +kernel_alignment: .long CONFIG_PHYSICAL_ALIGN #physical addr alignment
3426 + #required for protected mode
3428 +#ifdef CONFIG_RELOCATABLE
3429 +relocatable_kernel: .byte 1
3431 +relocatable_kernel: .byte 0
3436 +cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line,
3437 + #added with boot protocol
3440 +# End of setup header #####################################################
3442 + .section ".inittext", "ax"
3444 +#ifdef SAFE_RESET_DISK_CONTROLLER
3445 +# Reset the disk controller.
3446 + movw $0x0000, %ax # Reset disk controller
3447 + movb $0x80, %dl # All disks
3451 +# We will have entired with %cs = %ds+0x20, normalize %cs so
3452 +# it is on par with the other segments.
3463 +# Stack paranoia: align the stack and make sure it is good
3464 +# for both 16- and 32-bit references. In particular, if we
3465 +# were meant to have been using the full 16-bit segment, the
3466 +# caller might have set %sp to zero, which breaks %esp-based
3468 + andw $~3, %sp # dword align (might as well...)
3470 + movw $0xfffc, %sp # Make sure we're not zero
3471 +1: movzwl %sp, %esp # Clear upper half of %esp
3474 +# Check signature at end of setup
3475 + cmpl $0x5a5aaa55, setup_sig
3479 + movw $__bss_start, %di
3486 +# Jump to C code (should not return)
3489 +# Setup corrupt somehow...
3491 + movl $setup_corrupt, %eax
3496 + .type die, @function
3503 + .section ".initdata", "a"
3506 + .string "No setup signature found..."
3508 +++ b/arch/i386/boot/main.c
3510 +/* -*- linux-c -*- ------------------------------------------------------- *
3512 + * Copyright (C) 1991, 1992 Linus Torvalds
3513 + * Copyright 2007 rPath, Inc. - All Rights Reserved
3515 + * This file is part of the Linux kernel, and is made available under
3516 + * the terms of the GNU General Public License version 2.
3518 + * ----------------------------------------------------------------------- */
3521 + * arch/i386/boot/main.c
3523 + * Main module for the real-mode kernel code
3528 +struct boot_params boot_params __attribute__((aligned(16)));
3531 +char *heap_end = _end; /* Default end of heap = no heap */
3534 + * Copy the header into the boot parameter block. Since this
3535 + * screws up the old-style command line protocol, adjust by
3536 + * filling in the new-style command line pointer instead.
3538 +#define OLD_CL_MAGIC 0xA33F
3539 +#define OLD_CL_ADDRESS 0x20
3541 +static void copy_boot_params(void)
3543 + struct old_cmdline {
3547 + const struct old_cmdline * const oldcmd =
3548 + (const struct old_cmdline *)OLD_CL_ADDRESS;
3550 + BUILD_BUG_ON(sizeof boot_params != 4096);
3551 + memcpy(&boot_params.hdr, &hdr, sizeof hdr);
3553 + if (!boot_params.hdr.cmd_line_ptr &&
3554 + oldcmd->cl_magic == OLD_CL_MAGIC) {
3555 + /* Old-style command line protocol. */
3558 + /* Figure out if the command line falls in the region
3559 + of memory that an old kernel would have copied up
3561 + if (oldcmd->cl_offset < boot_params.hdr.setup_move_size)
3562 + cmdline_seg = ds();
3564 + cmdline_seg = 0x9000;
3566 + boot_params.hdr.cmd_line_ptr =
3567 + (cmdline_seg << 4) + oldcmd->cl_offset;
3572 + * Set the keyboard repeat rate to maximum. Unclear why this
3573 + * is done here; this might be possible to kill off as stale code.
3575 +static void keyboard_set_repeat(void)
3579 + asm volatile("int $0x16"
3580 + : "+a" (ax), "+b" (bx)
3581 + : : "ecx", "edx", "esi", "edi");
3585 + * Get Intel SpeedStep IST information.
3587 +static void query_speedstep_ist(void)
3590 + : "=a" (boot_params.speedstep_info[0]),
3591 + "=b" (boot_params.speedstep_info[1]),
3592 + "=c" (boot_params.speedstep_info[2]),
3593 + "=d" (boot_params.speedstep_info[3])
3594 + : "a" (0x0000e980), /* IST Support */
3595 + "d" (0x47534943)); /* Request value */
3599 + * Tell the BIOS what CPU mode we intend to run in.
3601 +static void set_bios_mode(void)
3603 +#ifdef CONFIG_X86_64
3608 + asm volatile("int $0x15"
3609 + : "+a" (eax), "+b" (ebx)
3610 + : : "ecx", "edx", "esi", "edi");
3616 + /* First, copy the boot header into the "zeropage" */
3617 + copy_boot_params();
3619 + /* End of heap check */
3620 + if (boot_params.hdr.loadflags & CAN_USE_HEAP) {
3621 + heap_end = (char *)(boot_params.hdr.heap_end_ptr
3622 + +0x200-STACK_SIZE);
3624 + /* Boot protocol 2.00 only, no heap available */
3625 + puts("WARNING: Ancient bootloader, some functionality "
3626 + "may be limited!\n");
3629 + /* Make sure we have all the proper CPU support */
3630 + if (validate_cpu()) {
3631 + puts("Unable to boot - please use a kernel appropriate "
3632 + "for your CPU.\n");
3636 + /* Tell the BIOS what CPU mode we intend to run in. */
3639 + /* Detect memory layout */
3642 + /* Set keyboard repeat rate (why?) */
3643 + keyboard_set_repeat();
3645 + /* Set the video mode */
3648 + /* Query MCA information */
3652 +#ifdef CONFIG_X86_VOYAGER
3656 + /* Query SpeedStep IST information */
3657 + query_speedstep_ist();
3659 + /* Query APM information */
3660 +#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
3664 + /* Query EDD information */
3665 +#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
3668 + /* Do the last things and invoke protected mode */
3669 + go_to_protected_mode();
3672 +++ b/arch/i386/boot/mca.c
3674 +/* -*- linux-c -*- ------------------------------------------------------- *
3676 + * Copyright (C) 1991, 1992 Linus Torvalds
3677 + * Copyright 2007 rPath, Inc. - All Rights Reserved
3679 + * This file is part of the Linux kernel, and is made available under
3680 + * the terms of the GNU General Public License version 2.
3682 + * ----------------------------------------------------------------------- */
3685 + * arch/i386/boot/mca.c
3687 + * Get the MCA system description table
3692 +int query_mca(void)
3697 + asm("pushw %%es ; "
3700 + "movw %%es, %1 ; "
3702 + : "=acdSDm" (err), "=acdSDm" (es), "=b" (bx)
3706 + return -1; /* No MCA present */
3711 + if (len > sizeof(boot_params.sys_desc_table))
3712 + len = sizeof(boot_params.sys_desc_table);
3714 + copy_from_fs(&boot_params.sys_desc_table, bx, len);
3718 +++ b/arch/i386/boot/memory.c
3720 +/* -*- linux-c -*- ------------------------------------------------------- *
3722 + * Copyright (C) 1991, 1992 Linus Torvalds
3723 + * Copyright 2007 rPath, Inc. - All Rights Reserved
3725 + * This file is part of the Linux kernel, and is made available under
3726 + * the terms of the GNU General Public License version 2.
3728 + * ----------------------------------------------------------------------- */
3731 + * arch/i386/boot/memory.c
3733 + * Memory detection code
3738 +#define SMAP 0x534d4150 /* ASCII "SMAP" */
3740 +static int detect_memory_e820(void)
3745 + struct e820entry *desc = boot_params.e820_map;
3748 + size = sizeof(struct e820entry);
3750 + asm("int $0x15; setc %0"
3751 + : "=am" (err), "+b" (next), "+d" (id), "+c" (size),
3753 + : "D" (desc), "a" (0xe820));
3755 + if (err || id != SMAP)
3758 + boot_params.e820_entries++;
3760 + } while (next && boot_params.e820_entries < E820MAX);
3762 + return boot_params.e820_entries;
3765 +static int detect_memory_e801(void)
3767 + u16 ax, bx, cx, dx;
3772 + asm("stc; int $0x15; setc %0"
3773 + : "=m" (err), "+a" (ax), "+b" (bx), "+c" (cx), "+d" (dx));
3778 + /* Do we really need to do this? */
3785 + return -1; /* Bogus! */
3787 + /* This ignores memory above 16MB if we have a memory hole
3788 + there. If someone actually finds a machine with a memory
3789 + hole at 16MB and no support for 0E820h they should probably
3790 + generate a fake e820 map. */
3791 + boot_params.alt_mem_k = (ax == 15*1024) ? (dx << 6)+ax : ax;
3796 +static int detect_memory_88(void)
3802 + asm("stc; int $0x15; setc %0" : "=bcdm" (err), "+a" (ax));
3804 + boot_params.screen_info.ext_mem_k = ax;
3809 +int detect_memory(void)
3811 + if (detect_memory_e820() > 0)
3814 + if (!detect_memory_e801())
3817 + return detect_memory_88();
3820 +++ b/arch/i386/boot/pm.c
3822 +/* -*- linux-c -*- ------------------------------------------------------- *
3824 + * Copyright (C) 1991, 1992 Linus Torvalds
3825 + * Copyright 2007 rPath, Inc. - All Rights Reserved
3827 + * This file is part of the Linux kernel, and is made available under
3828 + * the terms of the GNU General Public License version 2.
3830 + * ----------------------------------------------------------------------- */
3833 + * arch/i386/boot/pm.c
3835 + * Prepare the machine for transition to protected mode.
3839 +#include <asm/segment.h>
3842 + * Invoke the realmode switch hook if present; otherwise
3843 + * disable all interrupts.
3845 +static void realmode_switch_hook(void)
3847 + if (boot_params.hdr.realmode_swtch) {
3848 + asm volatile("lcallw *%0"
3849 + : : "m" (boot_params.hdr.realmode_swtch)
3850 + : "eax", "ebx", "ecx", "edx");
3852 + asm volatile("cli");
3853 + outb(0x80, 0x70); /* Disable NMI */
3859 + * A zImage kernel is loaded at 0x10000 but wants to run at 0x1000.
3860 + * A bzImage kernel is loaded and runs at 0x100000.
3862 +static void move_kernel_around(void)
3864 + /* Note: rely on the compile-time option here rather than
3865 + the LOADED_HIGH flag. The Qemu kernel loader unconditionally
3866 + sets the loadflags to zero. */
3867 +#ifndef __BIG_KERNEL__
3868 + u16 dst_seg, src_seg;
3871 + dst_seg = 0x1000 >> 4;
3872 + src_seg = 0x10000 >> 4;
3873 + syssize = boot_params.hdr.syssize; /* Size in 16-byte paragraps */
3876 + int paras = (syssize >= 0x1000) ? 0x1000 : syssize;
3877 + int dwords = paras << 2;
3879 + asm volatile("pushw %%es ; "
3883 + "xorw %%di,%%di ; "
3884 + "xorw %%si,%%si ; "
3889 + : "rm" (dst_seg), "rm" (src_seg)
3900 + * Disable all interrupts at the legacy PIC.
3902 +static void mask_all_interrupts(void)
3904 + outb(0xff, 0xa1); /* Mask all interrupts on the seconday PIC */
3906 + outb(0xfb, 0x21); /* Mask all but cascade on the primary PIC */
3911 + * Reset IGNNE# if asserted in the FPU.
3913 +static void reset_coprocessor(void)
3924 +#define GDT_ENTRY(flags,base,limit) \
3925 + (((u64)(base & 0xff000000) << 32) | \
3926 + ((u64)flags << 40) | \
3927 + ((u64)(limit & 0x00ff0000) << 32) | \
3928 + ((u64)(base & 0x00ffff00) << 16) | \
3929 + ((u64)(limit & 0x0000ffff)))
3934 +} __attribute__((packed));
3936 +static void setup_gdt(void)
3938 + /* There are machines which are known to not boot with the GDT
3939 + being 8-byte unaligned. Intel recommends 16 byte alignment. */
3940 + static const u64 boot_gdt[] __attribute__((aligned(16))) = {
3941 + /* CS: code, read/execute, 4 GB, base 0 */
3942 + [GDT_ENTRY_BOOT_CS] = GDT_ENTRY(0xc09b, 0, 0xfffff),
3943 + /* DS: data, read/write, 4 GB, base 0 */
3944 + [GDT_ENTRY_BOOT_DS] = GDT_ENTRY(0xc093, 0, 0xfffff),
3946 + struct gdt_ptr gdt;
3948 + gdt.len = sizeof(boot_gdt)-1;
3949 + gdt.ptr = (u32)&boot_gdt + (ds() << 4);
3951 + asm volatile("lgdtl %0" : : "m" (gdt));
3957 +static void setup_idt(void)
3959 + static const struct gdt_ptr null_idt = {0, 0};
3960 + asm volatile("lidtl %0" : : "m" (null_idt));
3964 + * Actual invocation sequence
3966 +void go_to_protected_mode(void)
3968 + /* Hook before leaving real mode, also disables interrupts */
3969 + realmode_switch_hook();
3971 + /* Move the kernel/setup to their final resting places */
3972 + move_kernel_around();
3974 + /* Enable the A20 gate */
3975 + if (enable_a20()) {
3976 + puts("A20 gate not responding, unable to boot...\n");
3980 + /* Reset coprocessor (IGNNE#) */
3981 + reset_coprocessor();
3983 + /* Mask all interrupts in the PIC */
3984 + mask_all_interrupts();
3986 + /* Actual transition to protected mode... */
3989 + protected_mode_jump(boot_params.hdr.code32_start,
3990 + (u32)&boot_params + (ds() << 4));
3993 +++ b/arch/i386/boot/pmjump.S
3995 +/* ----------------------------------------------------------------------- *
3997 + * Copyright (C) 1991, 1992 Linus Torvalds
3998 + * Copyright 2007 rPath, Inc. - All Rights Reserved
4000 + * This file is part of the Linux kernel, and is made available under
4001 + * the terms of the GNU General Public License version 2.
4003 + * ----------------------------------------------------------------------- */
4006 + * arch/i386/boot/pmjump.S
4008 + * The actual transition into protected mode
4011 +#include <asm/boot.h>
4012 +#include <asm/segment.h>
4016 + .globl protected_mode_jump
4017 + .type protected_mode_jump, @function
4022 + * void protected_mode_jump(u32 entrypoint, u32 bootparams);
4024 +protected_mode_jump:
4025 + xorl %ebx, %ebx # Flag to indicate this is a boot
4026 + movl %edx, %esi # Pointer to boot_params table
4027 + movl %eax, 2f # Patch ljmpl instruction
4028 + jmp 1f # Short jump to flush instruction q.
4031 + movw $__BOOT_DS, %cx
4034 + orb $1, %dl # Protected mode (PE) bit
4043 + # Jump to the 32-bit entrypoint
4044 + .byte 0x66, 0xea # ljmpl opcode
4045 +2: .long 0 # offset
4046 + .word __BOOT_CS # segment
4048 + .size protected_mode_jump, .-protected_mode_jump
4050 +++ b/arch/i386/boot/printf.c
4052 +/* -*- linux-c -*- ------------------------------------------------------- *
4054 + * Copyright (C) 1991, 1992 Linus Torvalds
4055 + * Copyright 2007 rPath, Inc. - All Rights Reserved
4057 + * This file is part of the Linux kernel, and is made available under
4058 + * the terms of the GNU General Public License version 2.
4060 + * ----------------------------------------------------------------------- */
4063 + * arch/i386/boot/printf.c
4065 + * Oh, it's a waste of space, but oh-so-yummy for debugging. This
4066 + * version of printf() does not include 64-bit support. "Live with
4073 +static inline int isdigit(int ch)
4075 + return (ch >= '0') && (ch <= '9');
4078 +static int skip_atoi(const char **s)
4082 + while (isdigit(**s))
4083 + i = i * 10 + *((*s)++) - '0';
4087 +unsigned int atou(const char *s)
4089 + unsigned int i = 0;
4090 + while (isdigit(*s))
4091 + i = i * 10 + (*s++ - '0');
4095 +static int strnlen(const char *s, int maxlen)
4097 + const char *es = s;
4098 + while (*es && maxlen) {
4106 +#define ZEROPAD 1 /* pad with zero */
4107 +#define SIGN 2 /* unsigned/signed long */
4108 +#define PLUS 4 /* show plus */
4109 +#define SPACE 8 /* space if plus */
4110 +#define LEFT 16 /* left justified */
4111 +#define SPECIAL 32 /* 0x */
4112 +#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
4114 +#define do_div(n,base) ({ \
4116 +__res = ((unsigned long) n) % (unsigned) base; \
4117 +n = ((unsigned long) n) / (unsigned) base; \
4120 +static char *number(char *str, long num, int base, int size, int precision,
4123 + char c, sign, tmp[66];
4124 + const char *digits = "0123456789abcdefghijklmnopqrstuvwxyz";
4128 + digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
4131 + if (base < 2 || base > 36)
4133 + c = (type & ZEROPAD) ? '0' : ' ';
4135 + if (type & SIGN) {
4140 + } else if (type & PLUS) {
4143 + } else if (type & SPACE) {
4148 + if (type & SPECIAL) {
4151 + else if (base == 8)
4159 + tmp[i++] = digits[do_div(num, base)];
4160 + if (i > precision)
4162 + size -= precision;
4163 + if (!(type & (ZEROPAD + LEFT)))
4164 + while (size-- > 0)
4168 + if (type & SPECIAL) {
4171 + else if (base == 16) {
4173 + *str++ = digits[33];
4176 + if (!(type & LEFT))
4177 + while (size-- > 0)
4179 + while (i < precision--)
4183 + while (size-- > 0)
4188 +int vsprintf(char *buf, const char *fmt, va_list args)
4191 + unsigned long num;
4196 + int flags; /* flags to number() */
4198 + int field_width; /* width of output field */
4199 + int precision; /* min. # of digits for integers; max
4200 + number of chars for from string */
4201 + int qualifier; /* 'h', 'l', or 'L' for integer fields */
4203 + for (str = buf; *fmt; ++fmt) {
4204 + if (*fmt != '%') {
4209 + /* process flags */
4212 + ++fmt; /* this also skips first '%' */
4231 + /* get field width */
4233 + if (isdigit(*fmt))
4234 + field_width = skip_atoi(&fmt);
4235 + else if (*fmt == '*') {
4237 + /* it's the next argument */
4238 + field_width = va_arg(args, int);
4239 + if (field_width < 0) {
4240 + field_width = -field_width;
4245 + /* get the precision */
4247 + if (*fmt == '.') {
4249 + if (isdigit(*fmt))
4250 + precision = skip_atoi(&fmt);
4251 + else if (*fmt == '*') {
4253 + /* it's the next argument */
4254 + precision = va_arg(args, int);
4256 + if (precision < 0)
4260 + /* get the conversion qualifier */
4262 + if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') {
4267 + /* default base */
4272 + if (!(flags & LEFT))
4273 + while (--field_width > 0)
4275 + *str++ = (unsigned char)va_arg(args, int);
4276 + while (--field_width > 0)
4281 + s = va_arg(args, char *);
4282 + len = strnlen(s, precision);
4284 + if (!(flags & LEFT))
4285 + while (len < field_width--)
4287 + for (i = 0; i < len; ++i)
4289 + while (len < field_width--)
4294 + if (field_width == -1) {
4295 + field_width = 2 * sizeof(void *);
4299 + (unsigned long)va_arg(args, void *), 16,
4300 + field_width, precision, flags);
4304 + if (qualifier == 'l') {
4305 + long *ip = va_arg(args, long *);
4306 + *ip = (str - buf);
4308 + int *ip = va_arg(args, int *);
4309 + *ip = (str - buf);
4317 + /* integer number formats - set up the flags and "break" */
4342 + if (qualifier == 'l')
4343 + num = va_arg(args, unsigned long);
4344 + else if (qualifier == 'h') {
4345 + num = (unsigned short)va_arg(args, int);
4348 + } else if (flags & SIGN)
4349 + num = va_arg(args, int);
4351 + num = va_arg(args, unsigned int);
4352 + str = number(str, num, base, field_width, precision, flags);
4358 +int sprintf(char *buf, const char *fmt, ...)
4363 + va_start(args, fmt);
4364 + i = vsprintf(buf, fmt, args);
4369 +int printf(const char *fmt, ...)
4371 + char printf_buf[1024];
4375 + va_start(args, fmt);
4376 + printed = vsprintf(printf_buf, fmt, args);
4383 --- a/arch/i386/boot/setup.S
4387 - * setup.S Copyright (C) 1991, 1992 Linus Torvalds
4389 - * setup.s is responsible for getting the system data from the BIOS,
4390 - * and putting them into the appropriate places in system memory.
4391 - * both setup.s and system has been loaded by the bootblock.
4393 - * This code asks the bios for memory/disk/other parameters, and
4394 - * puts them in a "safe" place: 0x90000-0x901FF, ie where the
4395 - * boot-block used to be. It is then up to the protected mode
4396 - * system to read them from there before the area is overwritten
4397 - * for buffer-blocks.
4399 - * Move PS/2 aux init code to psaux.c
4400 - * (troyer@saifr00.cfsat.Honeywell.COM) 03Oct92
4402 - * some changes and additional features by Christoph Niemann,
4403 - * March 1993/June 1994 (Christoph.Niemann@linux.org)
4405 - * add APM BIOS checking by Stephen Rothwell, May 1994
4406 - * (sfr@canb.auug.org.au)
4408 - * High load stuff, initrd support and position independency
4409 - * by Hans Lermen & Werner Almesberger, February 1996
4410 - * <lermen@elserv.ffm.fgan.de>, <almesber@lrc.epfl.ch>
4412 - * Video handling moved to video.S by Martin Mares, March 1996
4413 - * <mj@k332.feld.cvut.cz>
4415 - * Extended memory detection scheme retwiddled by orc@pell.chi.il.us (david
4416 - * parsons) to avoid loadlin confusion, July 1997
4418 - * Transcribed from Intel (as86) -> AT&T (gas) by Chris Noe, May 1999.
4419 - * <stiker@northlink.com>
4421 - * Fix to work around buggy BIOSes which don't use carry bit correctly
4422 - * and/or report extended memory in CX/DX for e801h memory size detection
4423 - * call. As a result the kernel got wrong figures. The int15/e801h docs
4424 - * from Ralf Brown interrupt list seem to indicate AX/BX should be used
4425 - * anyway. So to avoid breaking many machines (presumably there was a reason
4426 - * to orginally use CX/DX instead of AX/BX), we do a kludge to see
4427 - * if CX/DX have been changed in the e801 call and if so use AX/BX .
4428 - * Michael Miller, April 2001 <michaelm@mjmm.org>
4430 - * New A20 code ported from SYSLINUX by H. Peter Anvin. AMD Elan bugfixes
4431 - * by Robert Schwebel, December 2001 <robert@schwebel.de>
4434 -#include <asm/segment.h>
4435 -#include <linux/utsrelease.h>
4436 -#include <linux/compile.h>
4437 -#include <asm/boot.h>
4438 -#include <asm/e820.h>
4439 -#include <asm/page.h>
4440 -#include <asm/setup.h>
4442 -/* Signature words to ensure LILO loaded us right */
4443 -#define SIG1 0xAA55
4444 -#define SIG2 0x5A5A
4446 -INITSEG = DEF_INITSEG # 0x9000, we move boot here, out of the way
4447 -SYSSEG = DEF_SYSSEG # 0x1000, system loaded at 0x10000 (65536).
4448 -SETUPSEG = DEF_SETUPSEG # 0x9020, this is the current segment
4449 - # ... and the former contents of CS
4451 -DELTA_INITSEG = SETUPSEG - INITSEG # 0x0020
4454 -.globl begtext, begdata, begbss, endtext, enddata, endbss
4467 -# This is the setup header, and it must start at %cs:2 (old 0x9020:2)
4469 - .ascii "HdrS" # header signature
4470 - .word 0x0206 # header version number (>= 0x0105)
4471 - # or else old loadlin-1.5 will fail)
4472 -realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
4473 -start_sys_seg: .word SYSSEG
4474 - .word kernel_version # pointing to kernel version string
4475 - # above section of header is compatible
4476 - # with loadlin-1.5 (header v1.5). Don't
4479 -type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin,
4480 - # Bootlin, SYSLX, bootsect...)
4481 - # See Documentation/i386/boot.txt for
4484 -# flags, unused bits must be zero (RFU) bit within loadflags
4486 -LOADED_HIGH = 1 # If set, the kernel is loaded high
4487 -CAN_USE_HEAP = 0x80 # If set, the loader also has set
4488 - # heap_end_ptr to tell how much
4489 - # space behind setup.S can be used for
4491 - # Only the loader knows what is free
4492 -#ifndef __BIG_KERNEL__
4498 -setup_move_size: .word 0x8000 # size to move, when setup is not
4499 - # loaded at 0x90000. We will move setup
4500 - # to 0x90000 then just before jumping
4501 - # into the kernel. However, only the
4502 - # loader knows how much data behind
4503 - # us also needs to be loaded.
4505 -code32_start: # here loaders can put a different
4506 - # start address for 32-bit code.
4507 -#ifndef __BIG_KERNEL__
4508 - .long 0x1000 # 0x1000 = default for zImage
4510 - .long 0x100000 # 0x100000 = default for big kernel
4513 -ramdisk_image: .long 0 # address of loaded ramdisk image
4514 - # Here the loader puts the 32-bit
4515 - # address where it loaded the image.
4516 - # This only will be read by the kernel.
4518 -ramdisk_size: .long 0 # its size in bytes
4521 - .long 0 # obsolete
4523 -heap_end_ptr: .word modelist+1024 # (Header version 0x0201 or later)
4524 - # space from here (exclusive) down to
4525 - # end of setup code can be used by setup
4526 - # for local heap purposes.
4529 -cmd_line_ptr: .long 0 # (Header version 0x0202 or later)
4530 - # If nonzero, a 32-bit pointer
4531 - # to the kernel command line.
4532 - # The command line should be
4533 - # located between the start of
4534 - # setup and the end of low
4535 - # memory (0xa0000), or it may
4536 - # get overwritten before it
4537 - # gets read. If this field is
4538 - # used, there is no longer
4539 - # anything magical about the
4540 - # 0x90000 segment; the setup
4541 - # can be located anywhere in
4542 - # low memory 0x10000 or higher.
4544 -ramdisk_max: .long (-__PAGE_OFFSET-(512 << 20)-1) & 0x7fffffff
4545 - # (Header version 0x0203 or later)
4546 - # The highest safe address for
4547 - # the contents of an initrd
4549 -kernel_alignment: .long CONFIG_PHYSICAL_ALIGN #physical addr alignment
4550 - #required for protected mode
4552 -#ifdef CONFIG_RELOCATABLE
4553 -relocatable_kernel: .byte 1
4555 -relocatable_kernel: .byte 0
4560 -cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line,
4561 - #added with boot protocol
4564 -trampoline: call start_of_setup
4566 - # The offset at this point is 0x240
4567 - .space (0xeff-0x240+1) # E820 & EDD space (ending at 0xeff)
4568 -# End of setup header #####################################################
4571 -# Bootlin depends on this being done early
4572 - movw $0x01500, %ax
4576 -#ifdef SAFE_RESET_DISK_CONTROLLER
4577 -# Reset the disk controller.
4583 -# Set %ds = %cs, we know that SETUPSEG = %cs at this point
4584 - movw %cs, %ax # aka SETUPSEG
4586 -# Check signature at end of setup
4587 - cmpw $SIG1, setup_sig1
4590 - cmpw $SIG2, setup_sig2
4595 -# Routine to print asciiz string at ds:si
4607 -prtsp2: call prtspc # Print double space
4608 -prtspc: movb $0x20, %al # Print single space (note: fall-thru)
4610 -# Part of above routine, this one just prints ascii al
4621 -beep: movb $0x07, %al
4624 -no_sig_mess: .string "No setup signature found ..."
4629 -# We now have to find the rest of the setup code/data
4631 - movw %cs, %ax # SETUPSEG
4632 - subw $DELTA_INITSEG, %ax # INITSEG
4635 - movb (497), %bl # get setup sect from bootsect
4636 - subw $4, %bx # LILO loads 4 sectors of setup
4637 - shlw $8, %bx # convert to words (1sect=2^8 words)
4639 - shrw $3, %bx # convert to segment
4641 - movw %bx, %cs:start_sys_seg
4642 -# Move rest of setup code/data to here
4643 - movw $2048, %di # four sectors loaded by LILO
4651 - movw %cs, %ax # aka SETUPSEG
4653 - cmpw $SIG1, setup_sig1
4656 - cmpw $SIG2, setup_sig2
4662 - lea no_sig_mess, %si
4670 - movw %cs, %ax # aka SETUPSEG
4671 - subw $DELTA_INITSEG, %ax # aka INITSEG
4673 -# Check if an old loader tries to load a big-kernel
4674 - testb $LOADED_HIGH, %cs:loadflags # Do we have a big kernel?
4675 - jz loader_ok # No, no danger for old loaders.
4677 - cmpb $0, %cs:type_of_loader # Do we have a loader that
4678 - # can deal with us?
4679 - jnz loader_ok # Yes, continue.
4681 - pushw %cs # No, we have an old loader,
4683 - lea loader_panic_mess, %si
4688 -loader_panic_mess: .string "Wrong loader, giving up..."
4690 -# check minimum cpuid
4691 -# we do this here because it is the last place we can actually
4692 -# show a user visible error message. Later the video modus
4693 -# might be already messed up.
4698 - movw %cs,%ax # aka SETUPSEG
4700 - lea cpu_panic_mess,%si
4705 - .asciz "PANIC: CPU too old for this kernel."
4707 -#include "../kernel/verify_cpu.S"
4710 -# Get memory size (extended mem, kB)
4713 - movl %eax, (0x1e0)
4714 -#ifndef STANDARD_MEMORY_BIOS_CALL
4715 - movb %al, (E820NR)
4716 -# Try three different memory detection schemes. First, try
4717 -# e820h, which lets us assemble a memory map, then try e801h,
4718 -# which returns a 32-bit memory size, and finally 88h, which
4722 -# the memory map from hell. e820h returns memory classified into
4723 -# a whole bunch of different types, and allows memory holes and
4724 -# everything. We scan through this memory map and build a list
4725 -# of the first 32 memory areas, which we return at [E820MAP].
4726 -# This is documented at http://www.acpi.info/, in the ACPI 2.0 specification.
4728 -#define SMAP 0x534d4150
4731 - xorl %ebx, %ebx # continuation counter
4732 - movw $E820MAP, %di # point into the whitelist
4733 - # so we can have the bios
4734 - # directly write into it.
4737 - movl $0x0000e820, %eax # e820, upper word zeroed
4738 - movl $SMAP, %edx # ascii 'SMAP'
4739 - movl $20, %ecx # size of the e820rec
4740 - pushw %ds # data record.
4742 - int $0x15 # make the call
4743 - jc bail820 # fall to e801 if it fails
4745 - cmpl $SMAP, %eax # check the return is `SMAP'
4746 - jne bail820 # fall to e801 if it fails
4748 -# cmpl $1, 16(%di) # is this usable memory?
4751 - # If this is usable memory, we save it by simply advancing %di by
4752 - # sizeof(e820rec).
4755 - movb (E820NR), %al # up to 128 entries
4756 - cmpb $E820MAX, %al
4764 - cmpl $0, %ebx # check to see if
4765 - jne jmpe820 # %ebx is set to EOF
4770 -# memory size is in 1k chunksizes, to avoid confusing loadlin.
4771 -# we store the 0xe801 memory size in a completely different place,
4772 -# because it will most likely be longer than 16 bits.
4773 -# (use 1e0 because that's what Larry Augustine uses in his
4774 -# alternative new memory detection scheme, and it's sensible
4775 -# to write everything into the same place.)
4778 - stc # fix to work around buggy
4779 - xorw %cx,%cx # BIOSes which don't clear/set
4780 - xorw %dx,%dx # carry on pass/error of
4781 - # e801h memory size call
4782 - # or merely pass cx,dx though
4783 - # without changing them.
4788 - cmpw $0x0, %cx # Kludge to handle BIOSes
4789 - jne e801usecxdx # which report their extended
4790 - cmpw $0x0, %dx # memory in AX/BX rather than
4791 - jne e801usecxdx # CX/DX. The spec I have read
4792 - movw %ax, %cx # seems to indicate AX/BX
4793 - movw %bx, %dx # are more reasonable anyway...
4796 - andl $0xffff, %edx # clear sign extend
4797 - shll $6, %edx # and go from 64k to 1k chunks
4798 - movl %edx, (0x1e0) # store extended memory size
4799 - andl $0xffff, %ecx # clear sign extend
4800 - addl %ecx, (0x1e0) # and add lower memory into
4803 -# Ye Olde Traditional Methode. Returns the memory size (up to 16mb or
4804 -# 64mb, depending on the bios) in ax.
4812 -# Set the keyboard repeat rate to the max
4817 -# Check for video adapter and its parameters and allow the
4818 -# user to browse video modes.
4819 - call video # NOTE: we need %ds pointing
4825 - ldsw (4 * 0x41), %si
4826 - movw %cs, %ax # aka SETUPSEG
4827 - subw $DELTA_INITSEG, %ax # aka INITSEG
4839 - ldsw (4 * 0x46), %si
4845 -# Check that there IS a hd1 :-)
4846 - movw $0x01500, %ax
4855 - movw %cs, %ax # aka SETUPSEG
4856 - subw $DELTA_INITSEG, %ax # aka INITSEG
4865 -# check for Micro Channel (MCA) bus
4866 - movw %cs, %ax # aka SETUPSEG
4867 - subw $DELTA_INITSEG, %ax # aka INITSEG
4870 - movw %ax, (0xa0) # set table length to 0
4873 - int $0x15 # moves feature table to es:bx
4879 - movw %cs, %ax # aka SETUPSEG
4880 - subw $DELTA_INITSEG, %ax # aka INITSEG
4885 - addw $2, %cx # table length is a short
4889 - movw $0x10, %cx # we keep only first 16 bytes
4895 -#ifdef CONFIG_X86_VOYAGER
4896 - movb $0xff, 0x40 # flag on config found
4899 - int $0x15 # put voyager config info at es:di
4901 - movw $0x40, %si # place voyager info in apm table
4905 - movb %es:(%di), %al
4913 -# Check for PS/2 pointing device
4914 - movw %cs, %ax # aka SETUPSEG
4915 - subw $DELTA_INITSEG, %ax # aka INITSEG
4917 - movb $0, (0x1ff) # default is no pointing device
4918 - int $0x11 # int 0x11: equipment list
4919 - testb $0x04, %al # check if mouse installed
4922 - movb $0xAA, (0x1ff) # device present
4925 -#if defined(CONFIG_X86_SPEEDSTEP_SMI) || defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
4926 - movl $0x0000E980, %eax # IST Support
4927 - movl $0x47534943, %edx # Request value
4936 -#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
4937 -# Then check for an APM BIOS...
4938 - # %ds points to the bootsector
4939 - movw $0, 0x40 # version = 0 means no APM BIOS
4940 - movw $0x05300, %ax # APM BIOS installation check
4943 - jc done_apm_bios # Nope, no APM BIOS
4945 - cmpw $0x0504d, %bx # Check for "PM" signature
4946 - jne done_apm_bios # No signature, no APM BIOS
4948 - andw $0x02, %cx # Is 32 bit supported?
4949 - je done_apm_bios # No 32-bit, no (good) APM BIOS
4951 - movw $0x05304, %ax # Disconnect first just in case
4953 - int $0x15 # ignore return code
4954 - movw $0x05303, %ax # 32 bit connect
4956 - xorw %cx, %cx # paranoia :-)
4957 - xorw %dx, %dx # ...
4958 - xorl %esi, %esi # ...
4959 - xorw %di, %di # ...
4961 - jc no_32_apm_bios # Ack, error.
4963 - movw %ax, (66) # BIOS code segment
4964 - movl %ebx, (68) # BIOS entry point offset
4965 - movw %cx, (72) # BIOS 16 bit code segment
4966 - movw %dx, (74) # BIOS data segment
4967 - movl %esi, (78) # BIOS code segment lengths
4968 - movw %di, (82) # BIOS data segment length
4969 -# Redo the installation check as the 32 bit connect
4970 -# modifies the flags returned on some BIOSs
4971 - movw $0x05300, %ax # APM BIOS installation check
4973 - xorw %cx, %cx # paranoia
4975 - jc apm_disconnect # error -> shouldn't happen
4977 - cmpw $0x0504d, %bx # check for "PM" signature
4978 - jne apm_disconnect # no sig -> shouldn't happen
4980 - movw %ax, (64) # record the APM BIOS version
4981 - movw %cx, (76) # and flags
4984 -apm_disconnect: # Tidy up
4985 - movw $0x05304, %ax # Disconnect
4987 - int $0x15 # ignore return code
4992 - andw $0xfffd, (76) # remove 32 bit support bit
4998 -# Now we want to move to protected mode ...
4999 - cmpw $0, %cs:realmode_swtch
5000 - jz rmodeswtch_normal
5002 - lcall *%cs:realmode_swtch
5004 - jmp rmodeswtch_end
5008 - call default_switch
5011 -# Now we move the system to its rightful place ... but we check if we have a
5012 -# big-kernel. In that case we *must* not move it ...
5013 - testb $LOADED_HIGH, %cs:loadflags
5014 - jz do_move0 # .. then we have a normal low
5016 - # .. or else we have a high
5018 - jmp end_move # ... and we skip moving
5021 - movw $0x100, %ax # start of destination segment
5022 - movw %cs, %bp # aka SETUPSEG
5023 - subw $DELTA_INITSEG, %bp # aka INITSEG
5024 - movw %cs:start_sys_seg, %bx # start of source segment
5027 - movw %ax, %es # destination segment
5028 - incb %ah # instead of add ax,#0x100
5029 - movw %bx, %ds # source segment
5036 - cmpw %bp, %bx # assume start_sys_seg > 0x200,
5037 - # so we will perhaps read one
5038 - # page more than needed, but
5039 - # never overwrite INITSEG
5040 - # because destination is a
5041 - # minimum one page below source
5045 -# then we load the segment descriptors
5046 - movw %cs, %ax # aka SETUPSEG
5049 -# Check whether we need to be downward compatible with version <=201
5050 - cmpl $0, cmd_line_ptr
5051 - jne end_move_self # loader uses version >=202 features
5052 - cmpb $0x20, type_of_loader
5053 - je end_move_self # bootsect loader, we know of it
5055 -# Boot loader doesnt support boot protocol version 2.02.
5056 -# If we have our code not at 0x90000, we need to move it there now.
5057 -# We also then need to move the params behind it (commandline)
5058 -# Because we would overwrite the code on the current IP, we move
5059 -# it in two steps, jumping high after the first one.
5061 - cmpw $SETUPSEG, %ax
5064 - cli # make sure we really have
5065 - # interrupts disabled !
5066 - # because after this the stack
5067 - # should not be used
5068 - subw $DELTA_INITSEG, %ax # aka INITSEG
5073 - addw $INITSEG, %dx
5074 - subw %ax, %dx # this will go into %ss after
5078 - movw $INITSEG, %ax # real INITSEG
5080 - movw %cs:setup_move_size, %cx
5081 - std # we have to move up, so we use
5082 - # direction down because the
5083 - # areas may overlap
5087 - subw $move_self_here+0x200, %cx
5090 - ljmp $SETUPSEG, $move_self_here
5093 - movw $move_self_here+0x200, %cx
5096 - movw $SETUPSEG, %ax
5099 -end_move_self: # now we are at the right place
5102 -# Enable A20. This is at the very best an annoying procedure.
5103 -# A20 code ported from SYSLINUX 1.52-1.63 by H. Peter Anvin.
5104 -# AMD Elan bug fix by Robert Schwebel.
5107 -#if defined(CONFIG_X86_ELAN)
5108 - movb $0x02, %al # alternate A20 gate
5109 - outb %al, $0x92 # this works on SC410/SC520
5117 -A20_TEST_LOOPS = 32 # Iterations per wait
5118 -A20_ENABLE_LOOPS = 255 # Total loops to try
5121 -#ifndef CONFIG_X86_VOYAGER
5124 - # First, see if we are on a system with no A20 gate.
5129 - # Next, try the BIOS (INT 0x15, AX=0x2401)
5132 - pushfl # Be paranoid about flags
5139 - # Try enabling A20 through the keyboard controller
5140 -#endif /* CONFIG_X86_VOYAGER */
5144 -#ifndef CONFIG_X86_VOYAGER
5145 - call a20_test # Just in case the BIOS worked
5146 - jnz a20_done # but had a delayed reaction.
5149 - movb $0xD1, %al # command write
5153 - movb $0xDF, %al # A20 on
5157 -#ifndef CONFIG_X86_VOYAGER
5158 - # Wait until a20 really *is* enabled; it can take a fair amount of
5159 - # time on certain systems; Toshiba Tecras are known to have this
5166 - loop a20_kbc_wait_loop
5168 - # Final attempt: use "configuration port A"
5170 - inb $0x92, %al # Configuration Port A
5171 - orb $0x02, %al # "fast A20" version
5172 - andb $0xFE, %al # don't accidentally reset
5175 - # Wait for configuration port A to take effect
5178 -a20_fast_wait_loop:
5181 - loop a20_fast_wait_loop
5183 - # A20 is still not responding. Try frobbing it again.
5188 - movw $a20_err_msg, %si
5196 - .byte A20_ENABLE_LOOPS
5199 - .ascii "linux: fatal error: A20 gate not responding!"
5202 - # If we get here, all is good
5205 -#endif /* CONFIG_X86_VOYAGER */
5206 -# set up gdt and idt and 32bit start address
5207 - lidt idt_48 # load idt with 0,0
5208 - xorl %eax, %eax # Compute gdt_base
5209 - movw %ds, %ax # (Convert %ds:gdt to a linear ptr)
5213 - movl %eax, (gdt_48+2)
5214 - lgdt gdt_48 # load gdt with whatever is
5217 -# make sure any possible coprocessor is properly reset..
5225 -# well, that went ok, I hope. Now we mask all interrupts - the rest
5226 -# is done in init_IRQ().
5227 - movb $0xFF, %al # mask all interrupts for now
5231 - movb $0xFB, %al # mask all irq's but irq2 which
5232 - outb %al, $0x21 # is cascaded
5234 -# Well, that certainly wasn't fun :-(. Hopefully it works, and we don't
5235 -# need no steenking BIOS anyway (except for the initial loading :-).
5236 -# The BIOS-routine wants lots of unnecessary data, and it's less
5237 -# "interesting" anyway. This is how REAL programmers do it.
5239 -# Well, now's the time to actually move into protected mode. To make
5240 -# things as simple as possible, we do no register set-up or anything,
5241 -# we let the gnu-compiled 32-bit programs do that. We just jump to
5242 -# absolute address 0x1000 (or the loader supplied one),
5243 -# in 32-bit protected mode.
5245 -# Note that the short jump isn't strictly needed, although there are
5246 -# reasons why it might be a good idea. It won't hurt in any case.
5247 - movw $1, %ax # protected mode (PE) bit
5248 - lmsw %ax # This is it!
5252 - xorw %bx, %bx # Flag to indicate a boot
5253 - xorl %esi, %esi # Pointer to real-mode code
5255 - subw $DELTA_INITSEG, %si
5256 - shll $4, %esi # Convert to 32-bit pointer
5258 -# jump to startup_32 in arch/i386/boot/compressed/head.S
5260 -# NOTE: For high loaded big kernels we need a
5261 -# jmpi 0x100000,__BOOT_CS
5263 -# but we yet haven't reloaded the CS register, so the default size
5264 -# of the target offset still is 16 bit.
5265 -# However, using an operand prefix (0x66), the CPU will properly
5266 -# take our 48 bit far pointer. (INTeL 80386 Programmer's Reference
5267 -# Manual, Mixing 16-bit and 32-bit code, page 16-6)
5269 - .byte 0x66, 0xea # prefix + jmpi-opcode
5270 -code32: .long startup_32 # will be set to %cs+startup_32
5274 - movl $(__BOOT_DS), %eax
5282 -1: incl %eax # check that A20 really IS enabled
5283 - movl %eax, 0x00000000 # loop forever if it isn't
5284 - cmpl %eax, 0x00100000
5287 - # Jump to the 32bit entry point
5288 - jmpl *(code32_start - start + (DELTA_INITSEG << 4))(%esi)
5291 -# Here's a bunch of information about your current kernel..
5292 -kernel_version: .ascii UTS_RELEASE
5294 - .ascii LINUX_COMPILE_BY
5296 - .ascii LINUX_COMPILE_HOST
5298 - .ascii UTS_VERSION
5301 -# This is the default real mode switch routine.
5302 -# to be called just before protected mode transition
5304 - cli # no interrupts allowed !
5305 - movb $0x80, %al # disable NMI for bootup
5311 -#ifndef CONFIG_X86_VOYAGER
5312 -# This routine tests whether or not A20 is enabled. If so, it
5313 -# exits with zf = 0.
5315 -# The memory address used, 0x200, is the int $0x80 vector, which
5318 -A20_TEST_ADDR = 4*0x80
5324 - movw %cx, %fs # Low memory
5326 - movw %cx, %gs # High memory area
5327 - movw $A20_TEST_LOOPS, %cx
5328 - movw %fs:(A20_TEST_ADDR), %ax
5332 - movw %ax, %fs:(A20_TEST_ADDR)
5333 - call delay # Serialize and make delay constant
5334 - cmpw %gs:(A20_TEST_ADDR+0x10), %ax
5335 - loope a20_test_wait
5337 - popw %fs:(A20_TEST_ADDR)
5342 -#endif /* CONFIG_X86_VOYAGER */
5344 -# This routine checks that the keyboard command queue is empty
5345 -# (after emptying the output buffers)
5347 -# Some machines have delusions that the keyboard buffer is always full
5348 -# with no keyboard attached...
5350 -# If there is no keyboard controller, we will usually get 0xff
5351 -# to all the reads. With each IO taking a microsecond and
5352 -# a timeout of 100,000 iterations, this can take about half a
5353 -# second ("delay" == outb to port 0x80). That should be ok,
5354 -# and should also be plenty of time for a real keyboard controller
5360 - movl $100000, %ecx
5364 - jz empty_8042_end_loop
5368 - inb $0x64, %al # 8042 status port
5369 - testb $1, %al # output buffer?
5373 - inb $0x60, %al # read it
5374 - jmp empty_8042_loop
5377 - testb $2, %al # is input buffer full?
5378 - jnz empty_8042_loop # yes - loop
5379 -empty_8042_end_loop:
5383 -# Read the cmos clock. Return the seconds in al
5388 - movb %dh, %al # %dh contains the seconds
5397 -# Delay is needed after doing I/O
5402 -# Descriptor tables
5404 -# NOTE: The intel manual says gdt should be sixteen bytes aligned for
5405 -# efficiency reasons. However, there are machines which are known not
5406 -# to boot with misaligned GDTs, so alter this at your peril! If you alter
5407 -# GDT_ENTRY_BOOT_CS (in asm/segment.h) remember to leave at least two
5408 -# empty GDT entries (one for NULL and one reserved).
5410 -# NOTE: On some CPUs, the GDT must be 8 byte aligned. This is
5411 -# true for the Voyager Quad CPU card which will not boot without
5412 -# This directive. 16 byte aligment is recommended by intel.
5416 - .fill GDT_ENTRY_BOOT_CS,8,0
5418 - .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
5419 - .word 0 # base address = 0
5420 - .word 0x9A00 # code read/exec
5421 - .word 0x00CF # granularity = 4096, 386
5422 - # (+5th nibble of limit)
5424 - .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
5425 - .word 0 # base address = 0
5426 - .word 0x9200 # data read/write
5427 - .word 0x00CF # granularity = 4096, 386
5428 - # (+5th nibble of limit)
5432 - .word 0 # alignment byte
5434 - .word 0 # idt limit = 0
5435 - .word 0, 0 # idt base = 0L
5437 - .word 0 # alignment byte
5439 - .word gdt_end - gdt - 1 # gdt limit
5440 - .word 0, 0 # gdt base (filled in later)
5442 -# Include video setup & detection code
5446 -# Setup signature -- must be last
5447 -setup_sig1: .word SIG1
5448 -setup_sig2: .word SIG2
5450 -# After this point, there is some free space which is used by the video mode
5451 -# handling code to store the temporary mode table (not used by the kernel).
5462 +++ b/arch/i386/boot/setup.ld
5467 + * Linker script for the i386 setup code
5469 +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
5476 + .bstext : { *(.bstext) }
5477 + .bsdata : { *(.bsdata) }
5480 + .header : { *(.header) }
5481 + .inittext : { *(.inittext) }
5482 + .initdata : { *(.initdata) }
5483 + .text : { *(.text*) }
5486 + .rodata : { *(.rodata*) }
5491 + video_cards_end = .;
5495 + .data : { *(.data*) }
5513 + /DISCARD/ : { *(.note*) }
5515 + . = ASSERT(_end <= 0x8000, "Setup too big!");
5516 + . = ASSERT(hdr == 0x1f1, "The setup header has the wrong offset!");
5519 +++ b/arch/i386/boot/string.c
5521 +/* -*- linux-c -*- ------------------------------------------------------- *
5523 + * Copyright (C) 1991, 1992 Linus Torvalds
5524 + * Copyright 2007 rPath, Inc. - All Rights Reserved
5526 + * This file is part of the Linux kernel, and is made available under
5527 + * the terms of the GNU General Public License version 2.
5529 + * ----------------------------------------------------------------------- */
5532 + * arch/i386/boot/string.c
5534 + * Very basic string functions
5538 +#include <linux/edd.h>
5540 +int strcmp(const char *str1, const char *str2)
5542 + const unsigned char *s1 = (const unsigned char *)str1;
5543 + const unsigned char *s2 = (const unsigned char *)str2;
5546 + while (*s1 || *s2) {
5547 + delta = *s2 - *s1;
5555 --- a/arch/i386/boot/tools/build.c
5556 +++ b/arch/i386/boot/tools/build.c
5559 * Copyright (C) 1991, 1992 Linus Torvalds
5560 * Copyright (C) 1997 Martin Mares
5561 + * Copyright (C) 2007 H. Peter Anvin
5565 * This file builds a disk-image from three different files:
5567 - * - bootsect: compatibility mbr which prints an error message if
5568 - * someone tries to boot the kernel directly.
5569 * - setup: 8086 machine code, sets up system parm
5570 * - system: 80386 code for actual system
5573 * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
5574 * Cross compiling fixes by Gertjan van Wingerde, July 1996
5575 * Rewritten by Martin Mares, April 1997
5576 + * Substantially overhauled by H. Peter Anvin, April 2007
5581 #include <sys/sysmacros.h>
5584 +#include <sys/mman.h>
5585 #include <asm/boot.h>
5587 -typedef unsigned char byte;
5588 -typedef unsigned short word;
5589 -typedef unsigned long u32;
5590 +typedef unsigned char u8;
5591 +typedef unsigned short u16;
5592 +typedef unsigned long u32;
5594 #define DEFAULT_MAJOR_ROOT 0
5595 #define DEFAULT_MINOR_ROOT 0
5597 -/* Minimal number of setup sectors (see also bootsect.S) */
5598 -#define SETUP_SECTS 4
5599 +/* Minimal number of setup sectors */
5600 +#define SETUP_SECT_MIN 5
5601 +#define SETUP_SECT_MAX 64
5605 +/* This must be large enough to hold the entire setup */
5606 +u8 buf[SETUP_SECT_MAX*512];
5609 -void die(const char * str, ...)
5610 +static void die(const char * str, ...)
5613 va_start(args, str);
5618 -void file_open(const char *name)
5619 +static void usage(void)
5621 - if ((fd = open(name, O_RDONLY, 0)) < 0)
5622 - die("Unable to open `%s': %m", name);
5627 - die("Usage: build [-b] bootsect setup system [rootdev] [> image]");
5628 + die("Usage: build [-b] setup system [rootdev] [> image]");
5631 int main(int argc, char ** argv)
5633 unsigned int i, sz, setup_sectors;
5636 - byte major_root, minor_root;
5637 + u8 major_root, minor_root;
5643 if (argc > 2 && !strcmp(argv[1], "-b"))
5648 - if ((argc < 4) || (argc > 5))
5649 + if ((argc < 3) || (argc > 4))
5652 - if (!strcmp(argv[4], "CURRENT")) {
5654 + if (!strcmp(argv[3], "CURRENT")) {
5655 if (stat("/", &sb)) {
5657 die("Couldn't stat /");
5659 major_root = major(sb.st_dev);
5660 minor_root = minor(sb.st_dev);
5661 - } else if (strcmp(argv[4], "FLOPPY")) {
5662 - if (stat(argv[4], &sb)) {
5664 + } else if (strcmp(argv[3], "FLOPPY")) {
5665 + if (stat(argv[3], &sb)) {
5667 die("Couldn't stat root device.");
5669 major_root = major(sb.st_rdev);
5670 @@ -108,79 +107,62 @@
5672 fprintf(stderr, "Root device is (%d, %d)\n", major_root, minor_root);
5674 - file_open(argv[1]);
5675 - i = read(fd, buf, sizeof(buf));
5676 - fprintf(stderr,"Boot sector %d bytes.\n",i);
5678 - die("Boot block must be exactly 512 bytes");
5679 + /* Copy the setup code */
5680 + file = fopen(argv[1], "r");
5682 + die("Unable to open `%s': %m", argv[1]);
5683 + c = fread(buf, 1, sizeof(buf), file);
5685 + die("read-error on `setup'");
5687 + die("The setup must be at least 1024 bytes");
5688 if (buf[510] != 0x55 || buf[511] != 0xaa)
5689 die("Boot block hasn't got boot flag (0xAA55)");
5692 + /* Pad unused space with zeros */
5693 + setup_sectors = (c + 511) / 512;
5694 + if (setup_sectors < SETUP_SECT_MIN)
5695 + setup_sectors = SETUP_SECT_MIN;
5696 + i = setup_sectors*512;
5697 + memset(buf+c, 0, i-c);
5699 + /* Set the default root device */
5700 buf[508] = minor_root;
5701 buf[509] = major_root;
5702 - if (write(1, buf, 512) != 512)
5703 - die("Write call failed");
5706 - file_open(argv[2]); /* Copy the setup code */
5707 - for (i=0 ; (c=read(fd, buf, sizeof(buf)))>0 ; i+=c )
5708 - if (write(1, buf, c) != c)
5709 - die("Write call failed");
5711 - die("read-error on `setup'");
5714 - setup_sectors = (i + 511) / 512; /* Pad unused space with zeros */
5715 - /* for compatibility with ancient versions of LILO. */
5716 - if (setup_sectors < SETUP_SECTS)
5717 - setup_sectors = SETUP_SECTS;
5718 - fprintf(stderr, "Setup is %d bytes.\n", i);
5719 - memset(buf, 0, sizeof(buf));
5720 - while (i < setup_sectors * 512) {
5721 - c = setup_sectors * 512 - i;
5722 - if (c > sizeof(buf))
5724 - if (write(1, buf, c) != c)
5725 - die("Write call failed");
5728 + fprintf(stderr, "Setup is %d bytes (padded to %d bytes).\n", c, i);
5730 - file_open(argv[3]);
5731 - if (fstat (fd, &sb))
5732 - die("Unable to stat `%s': %m", argv[3]);
5733 + /* Open and stat the kernel file */
5734 + fd = open(argv[2], O_RDONLY);
5736 + die("Unable to open `%s': %m", argv[2]);
5737 + if (fstat(fd, &sb))
5738 + die("Unable to stat `%s': %m", argv[2]);
5740 - fprintf (stderr, "System is %d kB\n", sz/1024);
5741 + fprintf (stderr, "System is %d kB\n", (sz+1023)/1024);
5742 + kernel = mmap(NULL, sz, PROT_READ, MAP_SHARED, fd, 0);
5743 + if (kernel == MAP_FAILED)
5744 + die("Unable to mmap '%s': %m", argv[2]);
5745 sys_size = (sz + 15) / 16;
5746 if (!is_big_kernel && sys_size > DEF_SYSSIZE)
5747 die("System is too big. Try using bzImage or modules.");
5751 - l = (sz > sizeof(buf)) ? sizeof(buf) : sz;
5752 - if ((n=read(fd, buf, l)) != l) {
5754 - die("Error reading %s: %m", argv[3]);
5756 - die("%s: Unexpected EOF", argv[3]);
5758 - if (write(1, buf, l) != l)
5759 - die("Write failed");
5762 + /* Patch the setup code with the appropriate size parameters */
5763 + buf[0x1f1] = setup_sectors-1;
5764 + buf[0x1f4] = sys_size;
5765 + buf[0x1f5] = sys_size >> 8;
5766 + buf[0x1f6] = sys_size >> 16;
5767 + buf[0x1f7] = sys_size >> 24;
5769 + if (fwrite(buf, 1, i, stdout) != i)
5770 + die("Writing setup failed");
5772 + /* Copy the kernel code */
5773 + if (fwrite(kernel, 1, sz, stdout) != sz)
5774 + die("Writing kernel failed");
5777 - if (lseek(1, 497, SEEK_SET) != 497) /* Write sizes to the bootsector */
5778 - die("Output: seek failed");
5779 - buf[0] = setup_sectors;
5780 - if (write(1, buf, 1) != 1)
5781 - die("Write of setup sector count failed");
5782 - if (lseek(1, 500, SEEK_SET) != 500)
5783 - die("Output: seek failed");
5784 - buf[0] = (sys_size & 0xff);
5785 - buf[1] = ((sys_size >> 8) & 0xff);
5786 - buf[2] = ((sys_size >> 16) & 0xff);
5787 - buf[3] = ((sys_size >> 24) & 0xff);
5788 - if (write(1, buf, 4) != 4)
5789 - die("Write of image length failed");
5791 - return 0; /* Everything is OK */
5792 + /* Everything is OK */
5796 +++ b/arch/i386/boot/tty.c
5798 +/* -*- linux-c -*- ------------------------------------------------------- *
5800 + * Copyright (C) 1991, 1992 Linus Torvalds
5801 + * Copyright 2007 rPath, Inc. - All Rights Reserved
5803 + * This file is part of the Linux kernel, and is made available under
5804 + * the terms of the GNU General Public License version 2.
5806 + * ----------------------------------------------------------------------- */
5809 + * arch/i386/boot/tty.c
5811 + * Very simple screen I/O
5812 + * XXX: Probably should add very simple serial I/O?
5818 + * These functions are in .inittext so they can be used to signal
5819 + * error during initialization.
5822 +void __attribute__((section(".inittext"))) putchar(int ch)
5824 + unsigned char c = ch;
5827 + putchar('\r'); /* \n -> \r\n */
5829 + /* int $0x10 is known to have bugs involving touching registers
5830 + it shouldn't. Be extra conservative... */
5831 + asm volatile("pushal; int $0x10; popal"
5832 + : : "b" (0x0007), "c" (0x0001), "a" (0x0e00|ch));
5835 +void __attribute__((section(".inittext"))) puts(const char *str)
5845 + * Read the CMOS clock through the BIOS, and return the
5849 +static u8 gettime(void)
5855 + : "+a" (ax), "=c" (cx), "=d" (dx)
5856 + : : "ebx", "esi", "edi");
5862 + * Read from the keyboard
5867 + asm("int $0x16" : "+a" (ax));
5872 +static int kbd_pending(void)
5875 + asm("int $0x16; setnz %0"
5881 +void kbd_flush(void)
5884 + if (!kbd_pending())
5890 +int getchar_timeout(void)
5898 + if (kbd_pending())
5908 + return 0; /* Timeout! */
5911 +++ b/arch/i386/boot/version.c
5913 +/* -*- linux-c -*- ------------------------------------------------------- *
5915 + * Copyright (C) 1991, 1992 Linus Torvalds
5916 + * Copyright 2007 rPath, Inc. - All Rights Reserved
5918 + * This file is part of the Linux kernel, and is made available under
5919 + * the terms of the GNU General Public License version 2.
5921 + * ----------------------------------------------------------------------- */
5924 + * arch/i386/boot/version.c
5926 + * Kernel version string
5930 +#include <linux/utsrelease.h>
5931 +#include <linux/compile.h>
5933 +const char kernel_version[] =
5934 + UTS_RELEASE " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") "
5937 +++ b/arch/i386/boot/vesa.h
5939 +/* ----------------------------------------------------------------------- *
5941 + * Copyright 1999-2007 H. Peter Anvin - All Rights Reserved
5943 + * This program is free software; you can redistribute it and/or modify
5944 + * it under the terms of the GNU General Public License as published by
5945 + * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
5946 + * Boston MA 02111-1307, USA; either version 2 of the License, or
5947 + * (at your option) any later version; incorporated herein by reference.
5949 + * ----------------------------------------------------------------------- */
5951 +#ifndef BOOT_VESA_H
5952 +#define BOOT_VESA_H
5958 +/* VESA General Information table */
5959 +struct vesa_general_info {
5960 + u32 signature; /* 0 Magic number = "VESA" */
5961 + u16 version; /* 4 */
5962 + far_ptr vendor_string; /* 6 */
5963 + u32 capabilities; /* 10 */
5964 + far_ptr video_mode_ptr; /* 14 */
5965 + u16 total_memory; /* 18 */
5967 + u16 oem_software_rev; /* 20 */
5968 + far_ptr oem_vendor_name_ptr; /* 22 */
5969 + far_ptr oem_product_name_ptr; /* 26 */
5970 + far_ptr oem_product_rev_ptr; /* 30 */
5972 + u8 reserved[222]; /* 34 */
5973 + u8 oem_data[256]; /* 256 */
5974 +} __attribute__((packed));
5976 +#define VESA_MAGIC ('V' + ('E' << 8) + ('S' << 16) + ('A' << 24))
5977 +#define VBE2_MAGIC ('V' + ('B' << 8) + ('E' << 16) + ('2' << 24))
5979 +struct vesa_mode_info {
5980 + u16 mode_attr; /* 0 */
5981 + u8 win_attr[2]; /* 2 */
5982 + u16 win_grain; /* 4 */
5983 + u16 win_size; /* 6 */
5984 + u16 win_seg[2]; /* 8 */
5985 + far_ptr win_scheme; /* 12 */
5986 + u16 logical_scan; /* 16 */
5988 + u16 h_res; /* 18 */
5989 + u16 v_res; /* 20 */
5990 + u8 char_width; /* 22 */
5991 + u8 char_height; /* 23 */
5992 + u8 memory_planes; /* 24 */
5994 + u8 banks; /* 26 */
5995 + u8 memory_layout; /* 27 */
5996 + u8 bank_size; /* 28 */
5997 + u8 image_planes; /* 29 */
5998 + u8 page_function; /* 30 */
6000 + u8 rmask; /* 31 */
6002 + u8 gmask; /* 33 */
6004 + u8 bmask; /* 35 */
6006 + u8 resv_mask; /* 37 */
6007 + u8 resv_pos; /* 38 */
6008 + u8 dcm_info; /* 39 */
6010 + u32 lfb_ptr; /* 40 Linear frame buffer address */
6011 + u32 offscreen_ptr; /* 44 Offscreen memory address */
6012 + u16 offscreen_size; /* 48 */
6014 + u8 reserved[206]; /* 50 */
6015 +} __attribute__((packed));
6017 +#endif /* LIB_SYS_VESA_H */
6019 +++ b/arch/i386/boot/video-bios.c
6021 +/* -*- linux-c -*- ------------------------------------------------------- *
6023 + * Copyright (C) 1991, 1992 Linus Torvalds
6024 + * Copyright 2007 rPath, Inc. - All Rights Reserved
6026 + * This file is part of the Linux kernel, and is made available under
6027 + * the terms of the GNU General Public License version 2.
6029 + * ----------------------------------------------------------------------- */
6032 + * arch/i386/boot/video-bios.c
6034 + * Standard video BIOS modes
6036 + * We have two options for this; silent and scanned.
6042 +__videocard video_bios;
6044 +/* Set a conventional BIOS mode */
6045 +static int set_bios_mode(u8 mode);
6047 +static int bios_set_mode(struct mode_info *mi)
6049 + return set_bios_mode(mi->mode - VIDEO_FIRST_BIOS);
6052 +static int set_bios_mode(u8 mode)
6057 + ax = mode; /* AH=0x00 Set Video Mode */
6058 + asm volatile(INT10
6060 + : : "ebx", "ecx", "edx", "esi", "edi");
6062 + ax = 0x0f00; /* Get Current Video Mode */
6063 + asm volatile(INT10
6065 + : : "ebx", "ecx", "edx", "esi", "edi");
6067 + do_restore = 1; /* Assume video contents was lost */
6068 + new_mode = ax & 0x7f; /* Not all BIOSes are clean with the top bit */
6070 + if (new_mode == mode)
6071 + return 0; /* Mode change OK */
6073 + if (new_mode != boot_params.screen_info.orig_video_mode) {
6074 + /* Mode setting failed, but we didn't end up where we
6075 + started. That's bad. Try to revert to the original
6077 + ax = boot_params.screen_info.orig_video_mode;
6078 + asm volatile(INT10
6080 + : : "ebx", "ecx", "edx", "esi", "edi");
6085 +static int bios_probe(void)
6088 + u8 saved_mode = boot_params.screen_info.orig_video_mode;
6090 + struct mode_info *mi;
6093 + if (adapter != ADAPTER_EGA && adapter != ADAPTER_VGA)
6097 + crtc = vga_crtc();
6099 + video_bios.modes = GET_HEAP(struct mode_info, 0);
6101 + for (mode = 0x14; mode <= 0x7f; mode++) {
6102 + if (heap_free() < sizeof(struct mode_info))
6105 + if (mode_defined(VIDEO_FIRST_BIOS+mode))
6108 + if (set_bios_mode(mode))
6111 + /* Try to verify that it's a text mode. */
6113 + /* Attribute Controller: make graphics controller disabled */
6114 + if (in_idx(0x3c0, 0x10) & 0x01)
6117 + /* Graphics Controller: verify Alpha addressing enabled */
6118 + if (in_idx(0x3ce, 0x06) & 0x01)
6121 + /* CRTC cursor location low should be zero(?) */
6122 + if (in_idx(crtc, 0x0f))
6125 + mi = GET_HEAP(struct mode_info, 1);
6126 + mi->mode = VIDEO_FIRST_BIOS+mode;
6127 + mi->x = rdfs16(0x44a);
6128 + mi->y = rdfs8(0x484)+1;
6132 + set_bios_mode(saved_mode);
6137 +__videocard video_bios =
6139 + .card_name = "BIOS (scanned)",
6140 + .probe = bios_probe,
6141 + .set_mode = bios_set_mode,
6143 + .xmode_first = VIDEO_FIRST_BIOS,
6147 +++ b/arch/i386/boot/video-vesa.c
6149 +/* -*- linux-c -*- ------------------------------------------------------- *
6151 + * Copyright (C) 1991, 1992 Linus Torvalds
6152 + * Copyright 2007 rPath, Inc. - All Rights Reserved
6154 + * This file is part of the Linux kernel, and is made available under
6155 + * the terms of the GNU General Public License version 2.
6157 + * ----------------------------------------------------------------------- */
6160 + * arch/i386/boot/video-vesa.c
6169 +/* VESA information */
6170 +static struct vesa_general_info vginfo;
6171 +static struct vesa_mode_info vminfo;
6173 +__videocard video_vesa;
6175 +static void vesa_store_mode_params_graphics(void);
6177 +static int vesa_probe(void)
6179 +#ifdef CONFIG_VIDEO_VESA
6183 + struct mode_info *mi;
6186 + video_vesa.modes = GET_HEAP(struct mode_info, 0);
6188 + vginfo.signature = VBE2_MAGIC;
6190 + /* Optimistically assume a VESA BIOS is register-clean... */
6192 + asm("int $0x10" : "+a" (ax), "=m" (vginfo) : "D" (&vginfo));
6194 + if (ax != 0x004f ||
6195 + vginfo.signature != VESA_MAGIC ||
6196 + vginfo.version < 0x0102)
6197 + return 0; /* Not present */
6199 + set_fs(vginfo.video_mode_ptr.seg);
6200 + mode_ptr = vginfo.video_mode_ptr.off;
6202 + while ((mode = rdfs16(mode_ptr)) != 0xffff) {
6205 + if (heap_free() < sizeof(struct mode_info))
6206 + break; /* Heap full, can't save mode info */
6208 + if (mode & ~0x1ff)
6211 + memset(&vminfo, 0, sizeof vminfo); /* Just in case... */
6215 + : "+a" (ax), "=m" (vminfo)
6216 + : "c" (mode), "D" (&vminfo));
6221 + if ((vminfo.mode_attr & 0x15) == 0x05) {
6222 + /* Text Mode, TTY BIOS supported,
6223 + supported by hardware */
6224 + mi = GET_HEAP(struct mode_info, 1);
6225 + mi->mode = mode + VIDEO_FIRST_VESA;
6226 + mi->x = vminfo.h_res;
6227 + mi->y = vminfo.v_res;
6229 + } else if ((vminfo.mode_attr & 0x99) == 0x99) {
6231 + /* Graphics mode, color, linear frame buffer
6232 + supported -- register the mode but hide from
6233 + the menu. Only do this if framebuffer is
6234 + configured, however, otherwise the user will
6235 + be left without a screen. */
6236 + mi = GET_HEAP(struct mode_info, 1);
6237 + mi->mode = mode + VIDEO_FIRST_VESA;
6238 + mi->x = mi->y = 0;
6250 +static int vesa_set_mode(struct mode_info *mode)
6254 + u16 vesa_mode = mode->mode - VIDEO_FIRST_VESA;
6256 + memset(&vminfo, 0, sizeof vminfo); /* Just in case... */
6260 + : "+a" (ax), "=m" (vminfo)
6261 + : "c" (vesa_mode), "D" (&vminfo));
6266 + if ((vminfo.mode_attr & 0x15) == 0x05) {
6267 + /* It's a supported text mode */
6269 + } else if ((vminfo.mode_attr & 0x99) == 0x99) {
6270 + /* It's a graphics mode with linear frame buffer */
6272 + vesa_mode |= 0x4000; /* Request linear frame buffer */
6274 + return -1; /* Invalid mode */
6279 + asm volatile("int $0x10"
6281 + : "b" (vesa_mode), "D" (0));
6286 + graphic_mode = is_graphic;
6287 + if (!is_graphic) {
6289 + force_x = mode->x;
6290 + force_y = mode->y;
6293 + /* Graphics mode */
6294 + vesa_store_mode_params_graphics();
6301 +/* Switch DAC to 8-bit mode */
6302 +static void vesa_dac_set_8bits(void)
6306 + /* If possible, switch the DAC to 8-bit mode */
6307 + if (vginfo.capabilities & 1) {
6312 + asm volatile(INT10
6313 + : "+a" (ax), "+b" (bx)
6314 + : : "ecx", "edx", "esi", "edi");
6317 + dac_size = bx >> 8;
6320 + /* Set the color sizes to the DAC size, and offsets to 0 */
6321 + boot_params.screen_info.red_size = dac_size;
6322 + boot_params.screen_info.green_size = dac_size;
6323 + boot_params.screen_info.blue_size = dac_size;
6324 + boot_params.screen_info.rsvd_size = dac_size;
6326 + boot_params.screen_info.red_pos = 0;
6327 + boot_params.screen_info.green_pos = 0;
6328 + boot_params.screen_info.blue_pos = 0;
6329 + boot_params.screen_info.rsvd_pos = 0;
6332 +/* Save the VESA protected mode info */
6333 +static void vesa_store_pm_info(void)
6335 + u16 ax, bx, di, es;
6339 + asm("pushw %%es; "INT10"; movw %%es,%0; popw %%es"
6340 + : "=d" (es), "+a" (ax), "+b" (bx), "+D" (di)
6341 + : : "ecx", "esi");
6346 + boot_params.screen_info.vesapm_seg = es;
6347 + boot_params.screen_info.vesapm_off = di;
6351 + * Save video mode parameters for graphics mode
6353 +static void vesa_store_mode_params_graphics(void)
6355 + /* Tell the kernel we're in VESA graphics mode */
6356 + boot_params.screen_info.orig_video_isVGA = 0x23;
6358 + /* Mode parameters */
6359 + boot_params.screen_info.vesa_attributes = vminfo.mode_attr;
6360 + boot_params.screen_info.lfb_linelength = vminfo.logical_scan;
6361 + boot_params.screen_info.lfb_width = vminfo.h_res;
6362 + boot_params.screen_info.lfb_height = vminfo.v_res;
6363 + boot_params.screen_info.lfb_depth = vminfo.bpp;
6364 + boot_params.screen_info.pages = vminfo.image_planes;
6365 + boot_params.screen_info.lfb_base = vminfo.lfb_ptr;
6366 + memcpy(&boot_params.screen_info.red_size,
6367 + &vminfo.rmask, 8);
6369 + /* General parameters */
6370 + boot_params.screen_info.lfb_size = vginfo.total_memory;
6372 + if (vminfo.bpp <= 8)
6373 + vesa_dac_set_8bits();
6375 + vesa_store_pm_info();
6379 + * Save EDID information for the kernel; this is invoked, separately,
6380 + * after mode-setting.
6382 +void vesa_store_edid(void)
6384 +#ifdef CONFIG_FIRMWARE_EDID
6385 + u16 ax, bx, cx, dx, di;
6387 + /* Apparently used as a nonsense token... */
6388 + memset(&boot_params.edid_info, 0x13, sizeof boot_params.edid_info);
6390 + if (vginfo.version < 0x0200)
6391 + return; /* EDID requires VBE 2.0+ */
6393 + ax = 0x4f15; /* VBE DDC */
6394 + bx = 0x0000; /* Report DDC capabilities */
6395 + cx = 0; /* Controller 0 */
6396 + di = 0; /* ES:DI must be 0 by spec */
6398 + /* Note: The VBE DDC spec is different from the main VESA spec;
6399 + we genuinely have to assume all registers are destroyed here. */
6401 + asm("pushw %%es; movw %2,%%es; "INT10"; popw %%es"
6402 + : "+a" (ax), "+b" (bx)
6403 + : "c" (cx), "D" (di)
6407 + return; /* No EDID */
6409 + /* BH = time in seconds to transfer EDD information */
6410 + /* BL = DDC level supported */
6412 + ax = 0x4f15; /* VBE DDC */
6413 + bx = 0x0001; /* Read EDID */
6414 + cx = 0; /* Controller 0 */
6415 + dx = 0; /* EDID block number */
6416 + di =(size_t) &boot_params.edid_info; /* (ES:)Pointer to block */
6418 + : "+a" (ax), "+b" (bx), "+d" (dx)
6419 + : "c" (cx), "D" (di)
6421 +#endif /* CONFIG_FIRMWARE_EDID */
6424 +__videocard video_vesa =
6426 + .card_name = "VESA",
6427 + .probe = vesa_probe,
6428 + .set_mode = vesa_set_mode,
6429 + .xmode_first = VIDEO_FIRST_VESA,
6433 +++ b/arch/i386/boot/video-vga.c
6435 +/* -*- linux-c -*- ------------------------------------------------------- *
6437 + * Copyright (C) 1991, 1992 Linus Torvalds
6438 + * Copyright 2007 rPath, Inc. - All Rights Reserved
6440 + * This file is part of the Linux kernel, and is made available under
6441 + * the terms of the GNU General Public License version 2.
6443 + * ----------------------------------------------------------------------- */
6446 + * arch/i386/boot/video-vga.c
6448 + * Common all-VGA modes
6454 +static struct mode_info vga_modes[] = {
6455 + { VIDEO_80x25, 80, 25 },
6456 + { VIDEO_8POINT, 80, 50 },
6457 + { VIDEO_80x43, 80, 43 },
6458 + { VIDEO_80x28, 80, 28 },
6459 + { VIDEO_80x30, 80, 30 },
6460 + { VIDEO_80x34, 80, 34 },
6461 + { VIDEO_80x60, 80, 60 },
6464 +static struct mode_info ega_modes[] = {
6465 + { VIDEO_80x25, 80, 25 },
6466 + { VIDEO_8POINT, 80, 43 },
6469 +static struct mode_info cga_modes[] = {
6470 + { VIDEO_80x25, 80, 25 },
6473 +__videocard video_vga;
6475 +/* Set basic 80x25 mode */
6476 +static u8 vga_set_basic_mode(void)
6482 +#ifdef CONFIG_VIDEO_400_HACK
6483 + if (adapter >= ADAPTER_VGA) {
6485 + : : "a" (0x1202), "b" (0x0030)
6486 + : "ecx", "edx", "esi", "edi");
6493 + : : "ebx", "ecx", "edx", "esi", "edi");
6498 + rows = rdfs8(0x484); /* rows minus one */
6500 +#ifndef CONFIG_VIDEO_400_HACK
6501 + if ((ax == 0x5003 || ax == 0x5007) &&
6502 + (rows == 0 || rows == 24))
6506 + if (mode != 3 && mode != 7)
6509 + /* Set the mode */
6510 + asm volatile(INT10
6512 + : "ebx", "ecx", "edx", "esi", "edi");
6517 +static void vga_set_8font(void)
6519 + /* Set 8x8 font - 80x43 on EGA, 80x50 on VGA */
6521 + /* Set 8x8 font */
6522 + asm volatile(INT10 : : "a" (0x1112), "b" (0));
6524 + /* Use alternate print screen */
6525 + asm volatile(INT10 : : "a" (0x1200), "b" (0x20));
6527 + /* Turn off cursor emulation */
6528 + asm volatile(INT10 : : "a" (0x1201), "b" (0x34));
6530 + /* Cursor is scan lines 6-7 */
6531 + asm volatile(INT10 : : "a" (0x0100), "c" (0x0607));
6534 +static void vga_set_14font(void)
6536 + /* Set 9x14 font - 80x28 on VGA */
6538 + /* Set 9x14 font */
6539 + asm volatile(INT10 : : "a" (0x1111), "b" (0));
6541 + /* Turn off cursor emulation */
6542 + asm volatile(INT10 : : "a" (0x1201), "b" (0x34));
6544 + /* Cursor is scan lines 11-12 */
6545 + asm volatile(INT10 : : "a" (0x0100), "c" (0x0b0c));
6548 +static void vga_set_80x43(void)
6550 + /* Set 80x43 mode on VGA (not EGA) */
6552 + /* Set 350 scans */
6553 + asm volatile(INT10 : : "a" (0x1201), "b" (0x30));
6555 + /* Reset video mode */
6556 + asm volatile(INT10 : : "a" (0x0003));
6561 +/* I/O address of the VGA CRTC */
6564 + return (inb(0x3cc) & 1) ? 0x3d4 : 0x3b4;
6567 +static void vga_set_480_scanlines(int end)
6572 + crtc = vga_crtc();
6574 + out_idx(0x0c, crtc, 0x11); /* Vertical sync end, unlock CR0-7 */
6575 + out_idx(0x0b, crtc, 0x06); /* Vertical total */
6576 + out_idx(0x3e, crtc, 0x07); /* Vertical overflow */
6577 + out_idx(0xea, crtc, 0x10); /* Vertical sync start */
6578 + out_idx(end, crtc, 0x12); /* Vertical display end */
6579 + out_idx(0xe7, crtc, 0x15); /* Vertical blank start */
6580 + out_idx(0x04, crtc, 0x16); /* Vertical blank end */
6581 + csel = inb(0x3cc);
6584 + outb(csel, 0x3cc);
6587 +static void vga_set_80x30(void)
6589 + vga_set_480_scanlines(0xdf);
6592 +static void vga_set_80x34(void)
6595 + vga_set_480_scanlines(0xdb);
6598 +static void vga_set_80x60(void)
6601 + vga_set_480_scanlines(0xdf);
6604 +static int vga_set_mode(struct mode_info *mode)
6606 + /* Set the basic mode */
6607 + vga_set_basic_mode();
6609 + /* Override a possibly broken BIOS */
6610 + force_x = mode->x;
6611 + force_y = mode->y;
6613 + switch (mode->mode) {
6616 + case VIDEO_8POINT:
6640 + * Note: this probe includes basic information required by all
6641 + * systems. It should be executed first, by making sure
6642 + * video-vga.c is listed first in the Makefile.
6644 +static int vga_probe(void)
6646 + static const char *card_name[] = {
6647 + "CGA/MDA/HGC", "EGA", "VGA"
6649 + static struct mode_info *mode_lists[] = {
6654 + static int mode_count[] = {
6655 + sizeof(cga_modes)/sizeof(struct mode_info),
6656 + sizeof(ega_modes)/sizeof(struct mode_info),
6657 + sizeof(vga_modes)/sizeof(struct mode_info),
6662 + : "=b" (boot_params.screen_info.orig_video_ega_bx)
6663 + : "a" (0x1200), "b" (0x10) /* Check EGA/VGA */
6664 + : "ecx", "edx", "esi", "edi");
6666 + /* If we have MDA/CGA/HGC then BL will be unchanged at 0x10 */
6667 + if ((u8)boot_params.screen_info.orig_video_ega_bx != 0x10) {
6672 + : "ebx", "ecx", "edx", "esi", "edi");
6674 + if (vga_flag == 0x1a) {
6675 + adapter = ADAPTER_VGA;
6676 + boot_params.screen_info.orig_video_isVGA = 1;
6678 + adapter = ADAPTER_EGA;
6681 + adapter = ADAPTER_CGA;
6684 + video_vga.modes = mode_lists[adapter];
6685 + video_vga.card_name = card_name[adapter];
6686 + return mode_count[adapter];
6689 +__videocard video_vga =
6691 + .card_name = "VGA",
6692 + .probe = vga_probe,
6693 + .set_mode = vga_set_mode,
6695 --- a/arch/i386/boot/video.S
6700 - * Display adapter & video mode setup, version 2.13 (14-May-99)
6702 - * Copyright (C) 1995 -- 1998 Martin Mares <mj@ucw.cz>
6703 - * Based on the original setup.S code (C) Linus Torvalds and Mats Anderson
6705 - * Rewritten to use GNU 'as' by Chris Noe <stiker@northlink.com> May 1999
6707 - * For further information, look at Documentation/svga.txt.
6711 -/* Enable autodetection of SVGA adapters and modes. */
6712 -#undef CONFIG_VIDEO_SVGA
6714 -/* Enable autodetection of VESA modes */
6715 -#define CONFIG_VIDEO_VESA
6717 -/* Enable compacting of mode table */
6718 -#define CONFIG_VIDEO_COMPACT
6720 -/* Retain screen contents when switching modes */
6721 -#define CONFIG_VIDEO_RETAIN
6723 -/* Enable local mode list */
6724 -#undef CONFIG_VIDEO_LOCAL
6726 -/* Force 400 scan lines for standard modes (hack to fix bad BIOS behaviour */
6727 -#undef CONFIG_VIDEO_400_HACK
6729 -/* Hack that lets you force specific BIOS mode ID and specific dimensions */
6730 -#undef CONFIG_VIDEO_GFX_HACK
6731 -#define VIDEO_GFX_BIOS_AX 0x4f02 /* 800x600 on ThinkPad */
6732 -#define VIDEO_GFX_BIOS_BX 0x0102
6733 -#define VIDEO_GFX_DUMMY_RESOLUTION 0x6425 /* 100x37 */
6735 -/* This code uses an extended set of video mode numbers. These include:
6736 - * Aliases for standard modes
6738 - * EXTENDED_VGA (-2)
6740 - * Video modes numbered by menu position -- NOT RECOMMENDED because of lack
6741 - * of compatibility when extending the table. These are between 0x00 and 0xff.
6743 -#define VIDEO_FIRST_MENU 0x0000
6745 -/* Standard BIOS video modes (BIOS number + 0x0100) */
6746 -#define VIDEO_FIRST_BIOS 0x0100
6748 -/* VESA BIOS video modes (VESA number + 0x0200) */
6749 -#define VIDEO_FIRST_VESA 0x0200
6751 -/* Video7 special modes (BIOS number + 0x0900) */
6752 -#define VIDEO_FIRST_V7 0x0900
6754 -/* Special video modes */
6755 -#define VIDEO_FIRST_SPECIAL 0x0f00
6756 -#define VIDEO_80x25 0x0f00
6757 -#define VIDEO_8POINT 0x0f01
6758 -#define VIDEO_80x43 0x0f02
6759 -#define VIDEO_80x28 0x0f03
6760 -#define VIDEO_CURRENT_MODE 0x0f04
6761 -#define VIDEO_80x30 0x0f05
6762 -#define VIDEO_80x34 0x0f06
6763 -#define VIDEO_80x60 0x0f07
6764 -#define VIDEO_GFX_HACK 0x0f08
6765 -#define VIDEO_LAST_SPECIAL 0x0f09
6767 -/* Video modes given by resolution */
6768 -#define VIDEO_FIRST_RESOLUTION 0x1000
6770 -/* The "recalculate timings" flag */
6771 -#define VIDEO_RECALC 0x8000
6773 -/* Positions of various video parameters passed to the kernel */
6774 -/* (see also include/linux/tty.h) */
6775 -#define PARAM_CURSOR_POS 0x00
6776 -#define PARAM_VIDEO_PAGE 0x04
6777 -#define PARAM_VIDEO_MODE 0x06
6778 -#define PARAM_VIDEO_COLS 0x07
6779 -#define PARAM_VIDEO_EGA_BX 0x0a
6780 -#define PARAM_VIDEO_LINES 0x0e
6781 -#define PARAM_HAVE_VGA 0x0f
6782 -#define PARAM_FONT_POINTS 0x10
6784 -#define PARAM_LFB_WIDTH 0x12
6785 -#define PARAM_LFB_HEIGHT 0x14
6786 -#define PARAM_LFB_DEPTH 0x16
6787 -#define PARAM_LFB_BASE 0x18
6788 -#define PARAM_LFB_SIZE 0x1c
6789 -#define PARAM_LFB_LINELENGTH 0x24
6790 -#define PARAM_LFB_COLORS 0x26
6791 -#define PARAM_VESAPM_SEG 0x2e
6792 -#define PARAM_VESAPM_OFF 0x30
6793 -#define PARAM_LFB_PAGES 0x32
6794 -#define PARAM_VESA_ATTRIB 0x34
6795 -#define PARAM_CAPABILITIES 0x36
6797 -/* Define DO_STORE according to CONFIG_VIDEO_RETAIN */
6798 -#ifdef CONFIG_VIDEO_RETAIN
6799 -#define DO_STORE call store_screen
6802 -#endif /* CONFIG_VIDEO_RETAIN */
6804 -# This is the main entry point called by setup.S
6805 -# %ds *must* be pointing to the bootsector
6806 -video: pushw %ds # We use different segments
6807 - pushw %ds # FS contains original DS
6809 - pushw %cs # DS is equal to CS
6811 - pushw %cs # ES is equal to CS
6814 - movw %ax, %gs # GS is zero
6816 - call basic_detect # Basic adapter type testing (EGA/VGA/MDA/CGA)
6817 -#ifdef CONFIG_VIDEO_SELECT
6818 - movw %fs:(0x01fa), %ax # User selected video mode
6819 - cmpw $ASK_VGA, %ax # Bring up the menu
6822 - call mode_set # Set the mode
6825 - leaw badmdt, %si # Invalid mode ID
6827 -vid2: call mode_menu
6829 -#ifdef CONFIG_VIDEO_RETAIN
6830 - call restore_screen # Restore screen contents
6831 -#endif /* CONFIG_VIDEO_RETAIN */
6833 -#endif /* CONFIG_VIDEO_SELECT */
6834 - call mode_params # Store mode parameters
6835 - popw %ds # Restore original DS
6838 -# Detect if we have CGA, MDA, EGA or VGA and pass it to the kernel.
6840 - movb $0, %fs:(PARAM_HAVE_VGA)
6841 - movb $0x12, %ah # Check EGA/VGA
6844 - movw %bx, %fs:(PARAM_VIDEO_EGA_BX) # Identifies EGA to the kernel
6845 - cmpb $0x10, %bl # No, it's a CGA/MDA/HGA card.
6849 - movw $0x1a00, %ax # Check EGA or VGA?
6851 - cmpb $0x1a, %al # 1a means VGA...
6852 - jne basret # anything else is EGA.
6854 - incb %fs:(PARAM_HAVE_VGA) # We've detected a VGA
6858 -# Store the video mode parameters for later usage by the kernel.
6859 -# This is done by asking the BIOS except for the rows/columns
6860 -# parameters in the default 80x25 mode -- these are set directly,
6861 -# because some very obscure BIOSes supply insane values.
6863 -#ifdef CONFIG_VIDEO_SELECT
6864 - cmpb $0, graphic_mode
6867 - movb $0x03, %ah # Read cursor position
6870 - movw %dx, %fs:(PARAM_CURSOR_POS)
6871 - movb $0x0f, %ah # Read page/mode/width
6873 - movw %bx, %fs:(PARAM_VIDEO_PAGE)
6874 - movw %ax, %fs:(PARAM_VIDEO_MODE) # Video mode and screen width
6875 - cmpb $0x7, %al # MDA/HGA => segment differs
6878 - movw $0xb000, video_segment
6879 -mopar0: movw %gs:(0x485), %ax # Font size
6880 - movw %ax, %fs:(PARAM_FONT_POINTS) # (valid only on EGA/VGA)
6881 - movw force_size, %ax # Forced size?
6885 - movb %ah, %fs:(PARAM_VIDEO_COLS)
6886 - movb %al, %fs:(PARAM_VIDEO_LINES)
6889 -mopar1: movb $25, %al
6890 - cmpb $0, adapter # If we are on CGA/MDA/HGA, the
6891 - jz mopar2 # screen must have 25 lines.
6893 - movb %gs:(0x484), %al # On EGA/VGA, use the EGA+ BIOS
6894 - incb %al # location of max lines.
6895 -mopar2: movb %al, %fs:(PARAM_VIDEO_LINES)
6898 -#ifdef CONFIG_VIDEO_SELECT
6899 -# Fetching of VESA frame buffer parameters
6901 - leaw modelist+1024, %di
6902 - movb $0x23, %fs:(PARAM_HAVE_VGA)
6904 - movw %ax, %fs:(PARAM_LFB_LINELENGTH)
6906 - movw %ax, %fs:(PARAM_LFB_WIDTH)
6908 - movw %ax, %fs:(PARAM_LFB_HEIGHT)
6911 - movw %ax, %fs:(PARAM_LFB_DEPTH)
6914 - movw %ax, %fs:(PARAM_LFB_PAGES)
6915 - movl 40(%di), %eax
6916 - movl %eax, %fs:(PARAM_LFB_BASE)
6917 - movl 31(%di), %eax
6918 - movl %eax, %fs:(PARAM_LFB_COLORS)
6919 - movl 35(%di), %eax
6920 - movl %eax, %fs:(PARAM_LFB_COLORS+4)
6922 - movw %ax, %fs:(PARAM_VESA_ATTRIB)
6924 -# get video mem size
6925 - leaw modelist+1024, %di
6930 - movl %eax, %fs:(PARAM_LFB_SIZE)
6932 -# store mode capabilities
6933 - movl 10(%di), %eax
6934 - movl %eax, %fs:(PARAM_CAPABILITIES)
6936 -# switching the DAC to 8-bit is for <= 8 bpp only
6937 - movw %fs:(PARAM_LFB_DEPTH), %ax
6941 -# get DAC switching capability
6947 -# attempt to switch DAC to 8-bit
6953 - movb %bh, dac_size # store actual DAC size
6956 -# set color size to DAC size
6957 - movb dac_size, %al
6958 - movb %al, %fs:(PARAM_LFB_COLORS+0)
6959 - movb %al, %fs:(PARAM_LFB_COLORS+2)
6960 - movb %al, %fs:(PARAM_LFB_COLORS+4)
6961 - movb %al, %fs:(PARAM_LFB_COLORS+6)
6963 -# set color offsets to 0
6964 - movb $0, %fs:(PARAM_LFB_COLORS+1)
6965 - movb $0, %fs:(PARAM_LFB_COLORS+3)
6966 - movb $0, %fs:(PARAM_LFB_COLORS+5)
6967 - movb $0, %fs:(PARAM_LFB_COLORS+7)
6970 -# get protected mode interface informations
6978 - movw %es, %fs:(PARAM_VESAPM_SEG)
6979 - movw %di, %fs:(PARAM_VESAPM_OFF)
6982 -# The video mode menu
6984 - leaw keymsg, %si # "Return/Space/Timeout" message
6989 - cmpb $0x0d, %al # ENTER ?
6990 - je listm # yes - manual mode selection
6992 - cmpb $0x20, %al # SPACE ?
6993 - je defmd1 # no - repeat
6998 -defmd1: ret # No mode chosen? Default 80x25
7000 -listm: call mode_table # List mode table
7001 -listm0: leaw name_bann, %si # Print adapter name
7003 - movw card_name, %si
7008 - leaw old_name, %si
7012 - leaw ega_name, %si
7016 - leaw vga_name, %si
7020 - leaw svga_name, %si
7022 - leaw listhdr, %si # Table header
7024 - movb $0x30, %dl # DL holds mode number
7025 - leaw modelist, %si
7026 -lm1: cmpw $ASK_VGA, (%si) # End?
7029 - movb %dl, %al # Menu selection number
7033 - call prthw # Mode ID
7035 - movb 0x1(%si), %al
7036 - call prtdec # Rows
7037 - movb $0x78, %al # the letter 'x'
7040 - call prtdec # Columns
7041 - movb $0x0d, %al # New line
7045 - incb %dl # Next character
7052 -lm2: leaw prompt, %si # Mode prompt
7054 - leaw edit_buf, %di # Editor buffer
7056 - cmpb $0x0d, %al # Enter?
7059 - cmpb $0x08, %al # Backspace?
7062 - cmpb $0x20, %al # Printable?
7065 - cmpw $edit_buf+4, %di # Enough space?
7072 -lmbs: cmpw $edit_buf, %di # Backspace
7083 -lment: movb $0, (%di)
7086 - leaw edit_buf, %si
7087 - cmpb $0, (%si) # Empty string = default mode
7090 - cmpb $0, 1(%si) # One character = menu selection
7093 - cmpw $0x6373, (%si) # "scan" => mode scanning
7096 - cmpw $0x6e61, 2(%si)
7099 -lmhx: xorw %bx, %bx # Else => mode ID in hex
7118 -lmhx1: shlw $4, %bx
7122 -lmuse1: movw %bx, %ax
7125 -mnusel: lodsb # Menu selection
7133 - cmpb $0x61-0x30, %al
7136 - subb $0x61-0x30-10, %al
7140 -lmuse: call mode_set
7143 -lmbad: leaw unknt, %si
7146 -lmscan: cmpb $0, adapter # Scanning only on EGA/VGA
7149 - movw $0, mt_end # Scanning of modes is
7150 - movb $1, scanning # done as new autodetection.
7155 -# Additional parts of mode_set... (relative jumps, you know)
7156 -setv7: # Video7 extended modes
7158 - subb $VIDEO_FIRST_V7>>8, %bh
7164 -_setrec: jmp setrec # Ugly...
7165 -_set_80x25: jmp set_80x25
7167 -# Aliases for backward compatibility.
7169 - movw $VIDEO_80x25, %ax
7173 - movb $VIDEO_8POINT-VIDEO_FIRST_SPECIAL, %al
7175 - jnz setbad # Fall-through!
7177 -# Setting of user mode (AX=mode ID) => CF=success
7179 - movw %ax, %fs:(0x01fa) # Store mode for use in acpi_wakeup.S
7184 - testb $VIDEO_RECALC>>8, %ah
7187 - cmpb $VIDEO_FIRST_RESOLUTION>>8, %ah
7190 - cmpb $VIDEO_FIRST_SPECIAL>>8, %ah
7193 - cmpb $VIDEO_FIRST_V7>>8, %ah
7196 - cmpb $VIDEO_FIRST_VESA>>8, %ah
7206 - movb $0, do_restore # The screen needn't be restored
7211 - subb $VIDEO_FIRST_VESA>>8, %bh
7212 - movw $0x4f02, %ax # VESA BIOS mode set call
7214 - cmpw $0x004f, %ax # AL=4f if implemented
7215 - jnz setbad # AH=0 if OK
7222 - int $0x10 # Standard BIOS mode set call
7224 - movb $0x0f, %ah # Check if really set
7233 -setspc: xorb %bh, %bh # Set special mode
7234 - cmpb $VIDEO_LAST_SPECIAL-VIDEO_FIRST_SPECIAL, %bl
7238 - jmp *spec_inits(%bx)
7241 - orb %al, %al # 80x25 is an exception
7244 - pushw %bx # Set mode chosen from menu
7245 - call mode_table # Build the mode table
7252 - movw (%si), %ax # Fetch mode ID
7255 -setres: pushw %bx # Set mode chosen by resolution
7260 - cmpw $ASK_VGA, %ax # End of the list?
7267 - movw -4(%si), %ax # Fetch mode ID
7271 -#ifdef CONFIG_FIRMWARE_EDID
7272 - leaw modelist+1024, %di
7279 - movw %ax, vbe_version
7281 - leaw modelist+1024, %di
7282 - subb $VIDEO_FIRST_VESA>>8, %bh
7283 - movw %bx, %cx # Get mode information structure
7286 - addb $VIDEO_FIRST_VESA>>8, %bh
7290 - movb (%di), %al # Check capabilities.
7293 - jz setvesa # This is a text mode
7295 - movb (%di), %al # Check capabilities.
7298 - jnz _setbad # Doh! No linear frame buffer.
7300 - subb $VIDEO_FIRST_VESA>>8, %bh
7301 - orw $0x4000, %bx # Use linear frame buffer
7302 - movw $0x4f02, %ax # VESA BIOS mode set call
7304 - cmpw $0x004f, %ax # AL=4f if implemented
7305 - jnz _setbad # AH=0 if OK
7307 - movb $1, graphic_mode # flag graphic mode
7308 - movb $0, do_restore # no screen restore
7312 -_setbad: jmp setbad # Ugly...
7314 -# Recalculate vertical display end registers -- this fixes various
7315 -# inconsistencies of extended modes on many adapters. Called when
7316 -# the VIDEO_RECALC flag is set in the mode ID.
7318 -setrec: subb $VIDEO_RECALC>>8, %ah # Set the base mode
7322 - movw %gs:(0x485), %ax # Font size in pixels
7323 - movb %gs:(0x484), %bl # Number of rows
7325 - mulb %bl # Number of visible
7326 - decw %ax # scan lines - 1
7329 - movb $0x12, %al # Lower 8 bits
7332 - movb $0x07, %al # Bits 8 and 9 in the overflow register
7342 -rct2: movb $0x07, %al
7347 -# Table of routines for setting of the special modes.
7359 -# Set the 80x25 mode. If already set, do nothing.
7361 - movw $0x5019, force_size # Override possibly broken BIOS
7363 -#ifdef CONFIG_VIDEO_400_HACK
7364 - movw $0x1202, %ax # Force 400 scan lines
7368 - movb $0x0f, %ah # Get current mode ID
7370 - cmpw $0x5007, %ax # Mode 7 (80x25 mono) is the only one available
7371 - jz st80 # on CGA/MDA/HGA and is also available on EGAM
7373 - cmpw $0x5003, %ax # Unknown mode, force 80x25 color
7376 -st80: cmpb $0, adapter # CGA/MDA/HGA => mode 3/7 is always 80x25
7379 - movb %gs:(0x0484), %al # This is EGA+ -- beware of 80x50 etc.
7380 - orb %al, %al # Some buggy BIOS'es set 0 rows
7383 - cmpb $24, %al # It's hopefully correct
7385 -#endif /* CONFIG_VIDEO_400_HACK */
7387 - movw $0x0003, %ax # Forced set
7392 -# Set the 80x50/80x43 8-pixel mode. Simple BIOS calls.
7395 - call use_80x25 # The base is 80x25
7397 - movw $0x1112, %ax # Use 8x8 font
7400 - movw $0x1200, %ax # Use alternate print screen
7403 - movw $0x1201, %ax # Turn off cursor emulation
7406 - movb $0x01, %ah # Define cursor scan lines 6-7
7413 -# Set the 80x28 mode. This mode works on all VGA's, because it's a standard
7414 -# 80x25 mode with 14-point fonts instead of 16-point.
7417 - call use_80x25 # The base is 80x25
7418 -set14: movw $0x1111, %ax # Use 9x14 font
7421 - movb $0x01, %ah # Define cursor scan lines 11-12
7427 -# Set the 80x43 mode. This mode is works on all VGA's.
7428 -# It's a 350-scanline mode with 8-pixel font.
7431 - movw $0x1201, %ax # Set 350 scans
7434 - movw $0x0003, %ax # Reset video mode
7436 - jmp set_8pt # Use 8-pixel font
7438 -# Set the 80x30 mode (all VGA's). 480 scanlines, 16-pixel font.
7440 - call use_80x25 # Start with real 80x25
7442 - movw $0x3cc, %dx # Get CRTC port
7445 - rorb %al # Mono or color?
7449 -set48a: movw $0x0c11, %ax # Vertical sync end (also unlocks CR0-7)
7451 - movw $0x0b06, %ax # Vertical total
7453 - movw $0x3e07, %ax # (Vertical) overflow
7455 - movw $0xea10, %ax # Vertical sync start
7457 - movw $0xdf12, %ax # Vertical display end
7459 - movw $0xe715, %ax # Vertical blank start
7461 - movw $0x0416, %ax # Vertical blank end
7464 - movb $0xcc, %dl # Misc output register (read)
7466 - movb $0xc2, %dl # (write)
7467 - andb $0x0d, %al # Preserve clock select bits and color bit
7468 - orb $0xe2, %al # Set correct sync polarity
7471 - movw $0x501e, force_size
7475 -# Set the 80x34 mode (all VGA's). 480 scans, 14-pixel font.
7477 - call set_80x30 # Set 480 scans
7478 - call set14 # And 14-pt font
7479 - movw $0xdb12, %ax # VGA vertical display end
7480 - movw $0x5022, force_size
7481 -setvde: call outidx
7485 -# Set the 80x60 mode (all VGA's). 480 scans, 8-pixel font.
7487 - call set_80x30 # Set 480 scans
7488 - call set_8pt # And 8-pt font
7489 - movw $0xdf12, %ax # VGA vertical display end
7490 - movw $0x503c, force_size
7493 -# Special hack for ThinkPad graphics
7495 -#ifdef CONFIG_VIDEO_GFX_HACK
7496 - movw $VIDEO_GFX_BIOS_AX, %ax
7497 - movw $VIDEO_GFX_BIOS_BX, %bx
7499 - movw $VIDEO_GFX_DUMMY_RESOLUTION, force_size
7504 -#ifdef CONFIG_VIDEO_RETAIN
7506 -# Store screen contents to temporary buffer.
7508 - cmpb $0, do_restore # Already stored?
7511 - testb $CAN_USE_HEAP, loadflags # Have we space for storing?
7516 - pushw force_size # Don't force specific size
7517 - movw $0, force_size
7518 - call mode_params # Obtain params of current mode
7520 - movb %fs:(PARAM_VIDEO_LINES), %ah
7521 - movb %fs:(PARAM_VIDEO_COLS), %al
7522 - movw %ax, %bx # BX=dimensions
7524 - movw %ax, %cx # CX=number of characters
7525 - addw %ax, %ax # Calculate image size
7526 - addw $modelist+1024+4, %ax
7527 - cmpw heap_end_ptr, %ax
7528 - jnc sts1 # Unfortunately, out of memory
7530 - movw %fs:(PARAM_CURSOR_POS), %ax # Store mode params
7531 - leaw modelist+1024, %di
7535 - pushw %ds # Store the screen
7536 - movw video_segment, %ds
7541 - incb do_restore # Screen will be restored later
7546 -# Restore screen contents from temporary buffer.
7548 - cmpb $0, do_restore # Has the screen been stored?
7551 - call mode_params # Get parameters of current mode
7552 - movb %fs:(PARAM_VIDEO_LINES), %cl
7553 - movb %fs:(PARAM_VIDEO_COLS), %ch
7554 - leaw modelist+1024, %si # Screen buffer
7555 - lodsw # Set cursor position
7562 -res2: cmpb %ch, %dl
7567 -res3: movb $0x02, %ah
7570 - lodsw # Display size
7571 - movb %ah, %dl # DL=number of lines
7572 - movb $0, %ah # BX=phys. length of orig. line
7574 - cmpb %cl, %dl # Too many?
7585 -res4: cmpb %ch, %al # Too wide?
7588 - movb %ch, %al # AX=width of src. line
7591 - movw %cx, %bp # BP=width of dest. line
7593 - movw video_segment, %es
7594 - xorw %di, %di # Move the data
7595 - addw %bx, %bx # Convert BX and BP to _bytes_
7611 -#endif /* CONFIG_VIDEO_RETAIN */
7613 -# Write to indexed VGA register (AL=index, AH=data, DX=index reg. port)
7614 -outidx: outb %al, %dx
7623 -# Build the table of video modes (stored after the setup.S code at the
7624 -# `modelist' label. Each video mode record looks like:
7625 -# .word MODE-ID (our special mode ID (see above))
7626 -# .byte rows (number of rows)
7627 -# .byte columns (number of columns)
7628 -# Returns address of the end of the table in DI, the end is marked
7629 -# with a ASK_VGA ID.
7631 - movw mt_end, %di # Already filled?
7635 - leaw modelist, %di # Store standard modes:
7636 - movl $VIDEO_80x25 + 0x50190000, %eax # The 80x25 mode (ALL)
7638 - movb adapter, %al # CGA/MDA/HGA -- no more modes
7645 - movl $VIDEO_8POINT + 0x502b0000, %eax # The 80x43 EGA mode
7651 -mtabv: leaw vga_modes, %si # All modes for std VGA
7652 - movw $vga_modes_end-vga_modes, %cx
7653 - rep # I'm unable to use movsw as I don't know how to store a half
7654 - movsb # of the expression above to cx without using explicit shr.
7656 - cmpb $0, scanning # Mode scan requested?
7662 -#ifdef CONFIG_VIDEO_LOCAL
7664 -#endif /* CONFIG_VIDEO_LOCAL */
7666 -#ifdef CONFIG_VIDEO_VESA
7667 - call vesa_modes # Detect VESA VGA modes
7668 -#endif /* CONFIG_VIDEO_VESA */
7670 -#ifdef CONFIG_VIDEO_SVGA
7671 - cmpb $0, scanning # Bypass when scanning
7674 - call svga_modes # Detect SVGA cards & modes
7676 -#endif /* CONFIG_VIDEO_SVGA */
7680 -#ifdef CONFIG_VIDEO_COMPACT
7681 - leaw modelist, %si
7684 -cmt1: cmpw %dx, %si # Scan all modes
7687 - leaw modelist, %bx # Find in previous entries
7689 -cmt3: cmpw %bx, %si
7692 - cmpw 2(%bx), %cx # Found => don't copy this entry
7698 -cmt4: movsl # Copy entry
7701 -cmt5: addw $4, %si # Skip entry
7705 -#endif /* CONFIG_VIDEO_COMPACT */
7707 - movw $ASK_VGA, (%di) # End marker
7709 -mtab1: leaw modelist, %si # SI=mode list, DI=list end
7712 -# Modes usable on all standard VGAs
7714 - .word VIDEO_8POINT
7715 - .word 0x5032 # 80x50
7717 - .word 0x502b # 80x43
7719 - .word 0x501c # 80x28
7721 - .word 0x501e # 80x30
7723 - .word 0x5022 # 80x34
7725 - .word 0x503c # 80x60
7726 -#ifdef CONFIG_VIDEO_GFX_HACK
7727 - .word VIDEO_GFX_HACK
7728 - .word VIDEO_GFX_DUMMY_RESOLUTION
7732 -# Detect VESA modes.
7734 -#ifdef CONFIG_VIDEO_VESA
7736 - cmpb $2, adapter # VGA only
7739 - movw %di, %bp # BP=original mode table end
7740 - addw $0x200, %di # Buffer space
7741 - movw $0x4f00, %ax # VESA Get card info call
7744 - cmpw $0x004f, %ax # Successful?
7747 - cmpw $0x4556, 0x200(%di)
7750 - cmpw $0x4153, 0x202(%di)
7753 - movw $vesa_name, card_name # Set name to "VESA VGA"
7755 - lgsw 0x20e(%di), %si # GS:SI=mode list
7756 - movw $128, %cx # Iteration limit
7758 -# gas version 2.9.1, using BFD version 2.9.1.0.23 buggers the next inst.
7759 -# XXX: lodsw %gs:(%si), %ax # Get next mode in the list
7761 - cmpw $0xffff, %ax # End of the table?
7764 - cmpw $0x0080, %ax # Check validity of mode ID
7767 - orb %ah, %ah # Valid IDs: 0x0000-0x007f/0x0100-0x07ff
7768 - jz vesan # Certain BIOSes report 0x80-0xff!
7774 - movw %ax, %cx # Get mode information structure
7777 - movw %cx, %bx # BX=mode number
7778 - addb $VIDEO_FIRST_VESA>>8, %bh
7781 - jnz vesan # Don't report errors (buggy BIOSES)
7783 - movb (%di), %al # Check capabilities. We require
7784 - andb $0x19, %al # a color text mode.
7788 - cmpw $0xb800, 8(%di) # Standard video memory address required
7791 - testb $2, (%di) # Mode characteristics supplied?
7792 - movw %bx, (%di) # Store mode number
7796 - movw 0x12(%di), %bx # Width
7800 - movb %bl, 0x3(%di)
7801 - movw 0x14(%di), %ax # Height
7807 - cmpw $8193, %ax # Small enough for Linux console driver?
7812 -vesa3: subw $0x8108, %bx # This mode has no detailed info specified,
7813 - jc vesan # so it must be a standard VESA mode.
7818 - movw vesa_text_mode_table(%bx), %ax
7820 -vesaok: addw $4, %di # The mode is valid. Store it.
7821 -vesan: loop vesa1 # Next mode. Limit exceeded => error
7822 -vesae: leaw vesaer, %si
7824 - movw %bp, %di # Discard already found modes.
7828 -# Dimensions of standard VESA text modes
7829 -vesa_text_mode_table:
7830 - .byte 60, 80 # 0108
7831 - .byte 25, 132 # 0109
7832 - .byte 43, 132 # 010A
7833 - .byte 50, 132 # 010B
7834 - .byte 60, 132 # 010C
7835 -#endif /* CONFIG_VIDEO_VESA */
7837 -# Scan for video modes. A bit dirty, but should work.
7839 - movw $0x0100, %cx # Start with mode 0
7840 -scm1: movb $0, %ah # Test the mode
7846 - jnz scm2 # Mode not set
7848 - movw $0x3c0, %dx # Test if it's a text mode
7849 - movb $0x10, %al # Mode bits
7854 - movb $0xce, %dl # Another set of mode bits
7860 - movb $0xd4, %dl # Cursor location
7866 - movw %cx, %ax # Ok, store the mode
7868 - movb %gs:(0x484), %al # Number of rows
7871 - movw %gs:(0x44a), %ax # Number of columns
7876 - movw $0x0003, %ax # Return back to mode 3
7880 -tstidx: outw %ax, %dx # OUT DX,AX and inidx
7881 -inidx: outb %al, %dx # Read from indexed VGA register
7882 - incw %dx # AL=index, DX=index reg port -> AL=data
7887 -# Try to detect type of SVGA card and supply (usually approximate) video
7888 -# mode table for it.
7890 -#ifdef CONFIG_VIDEO_SVGA
7892 - leaw svga_table, %si # Test all known SVGA adapters
7894 - movw %ax, %bp # Default mode table
7898 - lodsw # Pointer to test routine
7904 - call *%ax # Call test routine
7911 - movw %bp, %si # Found, copy the modes
7912 - movb svga_prefix, %ah
7921 -didsv: movw %si, card_name # Store pointer to card name
7924 -# Table of all known SVGA cards. For each card, we store a pointer to
7925 -# a table of video modes supported by the card and a pointer to a routine
7926 -# used for testing of presence of the card. The video mode table is always
7927 -# followed by the name of the card or the chipset.
7929 - .word ati_md, ati_test
7930 - .word oak_md, oak_test
7931 - .word paradise_md, paradise_test
7932 - .word realtek_md, realtek_test
7933 - .word s3_md, s3_test
7934 - .word chips_md, chips_test
7935 - .word video7_md, video7_test
7936 - .word cirrus5_md, cirrus5_test
7937 - .word cirrus6_md, cirrus6_test
7938 - .word cirrus1_md, cirrus1_test
7939 - .word ahead_md, ahead_test
7940 - .word everex_md, everex_test
7941 - .word genoa_md, genoa_test
7942 - .word trident_md, trident_test
7943 - .word tseng_md, tseng_test
7946 -# Test routines and mode tables:
7948 -# S3 - The test algorithm was taken from the SuperProbe package
7949 -# for XFree86 1.2.1. Report bugs to Christoph.Niemann@linux.org
7951 - movw $0x0f35, %cx # we store some constants in cl/ch
7955 - movb %al, %bh # store current CRT-register 0x38
7957 - call outidx # disable writing to special regs
7958 - movb %cl, %al # check whether we can write special reg 0x35
7960 - movb %al, %bl # save the current value of CRT reg 0x35
7961 - andb $0xf0, %al # clear bits 0-3
7963 - movb %cl, %al # and write it to CRT reg 0x35
7965 - call inidx # now read it back
7966 - andb %ch, %al # clear the upper 4 bits
7967 - jz s3_2 # the first test failed. But we have a
7969 - movb %bl, %ah # second chance
7972 - jmp s3_1 # do the other tests
7974 -s3_2: movw %cx, %ax # load ah with 0xf and al with 0x35
7975 - orb %bl, %ah # set the upper 4 bits of ah with the orig value
7976 - call outidx # write ...
7977 - call inidx # ... and reread
7978 - andb %cl, %al # turn off the upper 4 bits
7980 - movb %bl, %ah # restore old value in register 0x35
7984 - cmpb %ch, %al # setting lower 4 bits was successful => bad
7985 - je no_s3 # writing is allowed => this is not an S3
7987 -s3_1: movw $0x4838, %ax # allow writing to special regs by putting
7988 - call outidx # magic number into CRT-register 0x38
7989 - movb %cl, %al # check whether we can write special reg 0x35
7998 - jnz no_s3 # no, we can't write => no S3
8006 - movb %bl, %ah # restore old value in register 0x35
8011 - jne no_s31 # writing not possible => no S3
8013 - call inidx # now get the S3 id ...
8024 -no_s3: movb $0x35, %al # restore CRT register 0x35
8027 -no_s31: xorw %bp, %bp # Detection failed
8028 -s3rest: movb %bh, %ah
8029 - movb $0x38, %al # restore old value of CRT register 0x38
8032 -idS3: .byte 0x81, 0x82, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95
8033 - .byte 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa8, 0xb0
8035 -s3_md: .byte 0x54, 0x2b, 0x84
8036 - .byte 0x55, 0x19, 0x84
8053 -idati: .ascii "761295520"
8055 -ati_md: .byte 0x23, 0x19, 0x84
8056 - .byte 0x33, 0x2c, 0x84
8057 - .byte 0x22, 0x1e, 0x64
8058 - .byte 0x21, 0x19, 0x64
8059 - .byte 0x58, 0x21, 0x50
8060 - .byte 0x5b, 0x1e, 0x50
8082 - .byte 0x22, 0x2c, 0x84
8083 - .byte 0x23, 0x19, 0x84
8084 - .byte 0x24, 0x1c, 0x84
8085 - .byte 0x2f, 0x32, 0xa0
8086 - .byte 0x32, 0x22, 0x50
8087 - .byte 0x34, 0x42, 0x50
8112 - .byte 0x60, 0x19, 0x84
8113 - .byte 0x61, 0x32, 0x84
8115 - .ascii "Chips & Technologies"
8156 -nocirr: xorw %bp, %bp
8157 -iscirr: movw $0x3d4, %dx
8166 - .byte 0x1f, 0x19, 0x84
8167 - .byte 0x20, 0x2c, 0x84
8168 - .byte 0x22, 0x1e, 0x84
8169 - .byte 0x31, 0x25, 0x64
8171 - .ascii "Cirrus Logic 5X0"
8174 -# Cirrus Logic 54XX
8179 - movb %al, %bl # BL=backup
8213 -c5fail: xorw %bp, %bp
8214 -c5done: movb $6, %al
8220 - .byte 0x14, 0x19, 0x84
8221 - .byte 0x54, 0x2b, 0x84
8223 - .ascii "Cirrus Logic 54XX"
8226 -# Cirrus Logic 64XX -- no known extra modes, but must be identified, because
8227 -# it's misidentified by the Ahead test.
8232 - movb %al, %bl # BL=backup
8244 - call inidx # 4X, 5X, 7X and 8X are valid 64XX chip ID's.
8258 -c2fail: xorw %bp, %bp
8259 -c6done: movb $0x0a, %al
8266 - .ascii "Cirrus Logic 64XX"
8284 -evtrid: leaw trident_md, %bp
8287 -noevrx: xorw %bp, %bp
8291 - .byte 0x03, 0x22, 0x50
8292 - .byte 0x04, 0x3c, 0x50
8293 - .byte 0x07, 0x2b, 0x64
8294 - .byte 0x08, 0x4b, 0x64
8295 - .byte 0x0a, 0x19, 0x84
8296 - .byte 0x0b, 0x2c, 0x84
8297 - .byte 0x16, 0x1e, 0x50
8298 - .byte 0x18, 0x1b, 0x64
8299 - .byte 0x21, 0x40, 0xa0
8300 - .byte 0x40, 0x1e, 0x84
8302 - .ascii "Everex/Trident"
8307 - leaw idgenoa, %si # Check Genoa 'clues'
8309 - movb %es:(0x37), %al
8320 - cmpb %es:(%di), %al
8328 -idgenoa: .byte 0x77, 0x00, 0x99, 0x66
8331 - .byte 0x58, 0x20, 0x50
8332 - .byte 0x5a, 0x2a, 0x64
8333 - .byte 0x60, 0x19, 0x84
8334 - .byte 0x61, 0x1d, 0x84
8335 - .byte 0x62, 0x20, 0x84
8336 - .byte 0x63, 0x2c, 0x84
8337 - .byte 0x64, 0x3c, 0x84
8338 - .byte 0x6b, 0x4f, 0x64
8339 - .byte 0x72, 0x3c, 0x50
8340 - .byte 0x74, 0x42, 0x50
8341 - .byte 0x78, 0x4b, 0x64
8348 - leaw idoakvga, %si
8358 -idoakvga: .ascii "OAK VGA "
8360 -oak_md: .byte 0x4e, 0x3c, 0x50
8361 - .byte 0x4f, 0x3c, 0x84
8362 - .byte 0x50, 0x19, 0x84
8363 - .byte 0x51, 0x2b, 0x84
8370 - leaw idparadise, %si
8380 -idparadise: .ascii "VGA="
8383 - .byte 0x41, 0x22, 0x50
8384 - .byte 0x47, 0x1c, 0x84
8385 - .byte 0x55, 0x19, 0x84
8386 - .byte 0x54, 0x2c, 0x84
8403 - movb %al, %bl # Strange thing ... in the book this wasn't
8404 - andb $0x02, %bl # necessary but it worked on my card which
8405 - jz setb2 # is a trident. Without it the screen goes
8410 -setb2: orb $0x02, %al
8411 -clrb2: outb %al, %dx
8420 - .byte 0x50, 0x1e, 0x50
8421 - .byte 0x51, 0x2b, 0x50
8422 - .byte 0x52, 0x3c, 0x50
8423 - .byte 0x57, 0x19, 0x84
8424 - .byte 0x58, 0x1e, 0x84
8425 - .byte 0x59, 0x2b, 0x84
8426 - .byte 0x5a, 0x3c, 0x84
8434 - inb %dx, %al # Could things be this simple ! :-)
8445 -isnot: xorw %bp, %bp
8449 - .byte 0x26, 0x3c, 0x50
8450 - .byte 0x2a, 0x28, 0x64
8451 - .byte 0x23, 0x19, 0x84
8452 - .byte 0x24, 0x1c, 0x84
8453 - .byte 0x22, 0x2c, 0x84
8454 - .byte 0x21, 0x3c, 0x84
8468 -even7: movb $0x0c, %al
8493 - movb $VIDEO_FIRST_V7>>8, svga_prefix # Use special mode switching
8497 - .byte 0x40, 0x2b, 0x50
8498 - .byte 0x43, 0x3c, 0x50
8499 - .byte 0x44, 0x3c, 0x64
8500 - .byte 0x41, 0x19, 0x84
8501 - .byte 0x42, 0x2c, 0x84
8502 - .byte 0x45, 0x1c, 0x84
8519 -idrtvga: .ascii "REALTEK VGA"
8522 - .byte 0x1a, 0x3c, 0x50
8523 - .byte 0x1b, 0x19, 0x84
8524 - .byte 0x1c, 0x1e, 0x84
8525 - .byte 0x1d, 0x2b, 0x84
8526 - .byte 0x1e, 0x3c, 0x84
8531 -#endif /* CONFIG_VIDEO_SVGA */
8533 -# User-defined local mode table (VGA only)
8534 -#ifdef CONFIG_VIDEO_LOCAL
8536 - leaw local_mode_table, %si
8547 -# This is the table of local video modes which can be supplied manually
8548 -# by the user. Each entry consists of mode ID (word) and dimensions
8549 -# (byte for column count and another byte for row count). These modes
8550 -# are placed before all SVGA and VESA modes and override them if table
8551 -# compacting is enabled. The table must end with a zero word followed
8552 -# by NUL-terminated video adapter name.
8554 - .word 0x0100 # Example: 40x25
8559 -#endif /* CONFIG_VIDEO_LOCAL */
8561 -# Read a key and return the ASCII code in al, scan code in ah
8562 -getkey: xorb %ah, %ah
8566 -# Read a key with a timeout of 30 seconds.
8567 -# The hardware clock is used to get the time.
8568 -getkt: call gettime
8569 - addb $30, %al # Wait 30 seconds
8576 -again: movb $0x01, %ah
8578 - jnz getkey # key pressed, so get it
8584 - movb $0x20, %al # timeout, return `space'
8587 -# Flush the keyboard buffer
8588 -flush: movb $0x01, %ah
8598 -# Print hexadecimal number.
8608 -prthn: cmpb $0x0a, %al
8612 -prth1: addb $0x30, %al
8615 -# Print decimal number in al
8627 -lt100: addb $0x30, %al
8629 -skip10: movb %ah, %al
8637 -#ifdef CONFIG_FIRMWARE_EDID
8638 - pushw %es # just save all registers
8648 - movl $0x13131313, %eax # memset block with 0x13
8655 - cmpw $0x0200, vbe_version # only do EDID on >= VBE2.0
8658 - pushw %es # save ES
8659 - xorw %di, %di # Report Capability
8661 - popw %es # ES:DI must be 0:0
8666 - popw %es # restore ES
8668 - cmpb $0x00, %ah # call successful
8671 - cmpb $0x4f, %al # function supported
8674 - movw $0x4f15, %ax # do VBE/DDC
8682 - popw %di # restore all registers
8691 -# VIDEO_SELECT-only variables
8692 -mt_end: .word 0 # End of video mode table if built
8693 -edit_buf: .space 6 # Line editor buffer
8694 -card_name: .word 0 # Pointer to adapter name
8695 -scanning: .byte 0 # Performing mode scan
8696 -do_restore: .byte 0 # Screen contents altered during mode change
8697 -svga_prefix: .byte VIDEO_FIRST_BIOS>>8 # Default prefix for BIOS modes
8698 -graphic_mode: .byte 0 # Graphic mode with a linear frame buffer
8699 -dac_size: .byte 6 # DAC bit depth
8700 -vbe_version: .word 0 # VBE bios version
8703 -keymsg: .ascii "Press <RETURN> to see video modes available, "
8704 - .ascii "<SPACE> to continue or wait 30 secs"
8705 - .byte 0x0d, 0x0a, 0
8707 -listhdr: .byte 0x0d, 0x0a
8708 - .ascii "Mode: COLSxROWS:"
8710 -crlft: .byte 0x0d, 0x0a, 0
8712 -prompt: .byte 0x0d, 0x0a
8713 - .asciz "Enter mode number or `scan': "
8715 -unknt: .asciz "Unknown mode ID. Try again."
8717 -badmdt: .ascii "You passed an undefined mode number."
8718 - .byte 0x0d, 0x0a, 0
8720 -vesaer: .ascii "Error: Scanning of VESA modes failed. Please "
8721 - .ascii "report to <mj@ucw.cz>."
8722 - .byte 0x0d, 0x0a, 0
8724 -old_name: .asciz "CGA/MDA/HGA"
8726 -ega_name: .asciz "EGA"
8728 -svga_name: .ascii " "
8730 -vga_name: .asciz "VGA"
8732 -vesa_name: .asciz "VESA"
8734 -name_bann: .asciz "Video adapter: "
8735 -#endif /* CONFIG_VIDEO_SELECT */
8738 -adapter: .byte 0 # Video adapter: 0=CGA/MDA/HGA,1=EGA,2=VGA
8739 -video_segment: .word 0xb800 # Video memory segment
8740 -force_size: .word 0 # Use this size instead of the one in BIOS vars
8742 +++ b/arch/i386/boot/video.c
8744 +/* -*- linux-c -*- ------------------------------------------------------- *
8746 + * Copyright (C) 1991, 1992 Linus Torvalds
8747 + * Copyright 2007 rPath, Inc. - All Rights Reserved
8749 + * This file is part of the Linux kernel, and is made available under
8750 + * the terms of the GNU General Public License version 2.
8752 + * ----------------------------------------------------------------------- */
8755 + * arch/i386/boot/video.c
8757 + * Select video mode
8765 + * Mode list variables
8767 +static struct card_info cards[]; /* List of cards to probe for */
8770 + * Common variables
8772 +int adapter; /* 0=CGA/MDA/HGC, 1=EGA, 2=VGA+ */
8774 +int force_x, force_y; /* Don't query the BIOS for cols/rows */
8776 +int do_restore = 0; /* Screen contents changed during mode flip */
8777 +int graphic_mode; /* Graphic mode with linear frame buffer */
8779 +static void store_cursor_position(void)
8787 + : "=d" (curpos), "+a" (ax), "+b" (bx)
8788 + : : "ecx", "esi", "edi");
8790 + boot_params.screen_info.orig_x = curpos;
8791 + boot_params.screen_info.orig_y = curpos >> 8;
8794 +static void store_video_mode(void)
8798 + /* N.B.: the saving of the video page here is a bit silly,
8799 + since we pretty much assume page 0 everywhere. */
8802 + : "+a" (ax), "=b" (page)
8803 + : : "ecx", "edx", "esi", "edi");
8805 + /* Not all BIOSes are clean with respect to the top bit */
8806 + boot_params.screen_info.orig_video_mode = ax & 0x7f;
8807 + boot_params.screen_info.orig_video_page = page;
8811 + * Store the video mode parameters for later usage by the kernel.
8812 + * This is done by asking the BIOS except for the rows/columns
8813 + * parameters in the default 80x25 mode -- these are set directly,
8814 + * because some very obscure BIOSes supply insane values.
8816 +static void store_mode_params(void)
8821 + /* For graphics mode, it is up to the mode-setting driver
8822 + (currently only video-vesa.c) to store the parameters */
8826 + store_cursor_position();
8827 + store_video_mode();
8829 + if (boot_params.screen_info.orig_video_mode == 0x07) {
8830 + /* MDA, HGC, or VGA in monochrome mode */
8831 + video_segment = 0xb000;
8833 + /* CGA, EGA, VGA and so forth */
8834 + video_segment = 0xb800;
8838 + font_size = rdfs16(0x485); /* Font size, BIOS area */
8839 + boot_params.screen_info.orig_video_points = font_size;
8841 + x = rdfs16(0x44a);
8842 + y = (adapter == ADAPTER_CGA) ? 25 : rdfs8(0x484)+1;
8849 + boot_params.screen_info.orig_video_cols = x;
8850 + boot_params.screen_info.orig_video_lines = y;
8853 +/* Probe the video drivers and have them generate their mode lists. */
8854 +static void probe_cards(int unsafe)
8856 + struct card_info *card;
8857 + static u8 probed[2];
8859 + if (probed[unsafe])
8862 + probed[unsafe] = 1;
8864 + for (card = video_cards; card < video_cards_end; card++) {
8865 + if (card->unsafe == unsafe) {
8867 + card->nmodes = card->probe();
8874 +/* Test if a mode is defined */
8875 +int mode_defined(u16 mode)
8877 + struct card_info *card;
8878 + struct mode_info *mi;
8881 + for (card = video_cards; card < video_cards_end; card++) {
8883 + for (i = 0; i < card->nmodes; i++, mi++) {
8884 + if (mi->mode == mode)
8892 +/* Set mode (without recalc) */
8893 +static int raw_set_mode(u16 mode)
8896 + struct card_info *card;
8897 + struct mode_info *mi;
8899 + /* Drop the recalc bit if set */
8900 + mode &= ~VIDEO_RECALC;
8902 + /* Scan for mode based on fixed ID, position, or resolution */
8904 + for (card = video_cards; card < video_cards_end; card++) {
8906 + for (i = 0; i < card->nmodes; i++, mi++) {
8907 + int visible = mi->x || mi->y;
8909 + if ((mode == nmode && visible) ||
8910 + mode == mi->mode ||
8911 + mode == (mi->y << 8)+mi->x)
8912 + return card->set_mode(mi);
8919 + /* Nothing found? Is it an "exceptional" (unprobed) mode? */
8920 + for (card = video_cards; card < video_cards_end; card++) {
8921 + if (mode >= card->xmode_first &&
8922 + mode < card->xmode_first+card->xmode_n) {
8923 + struct mode_info mix;
8925 + mix.x = mix.y = 0;
8926 + return card->set_mode(&mix);
8930 + /* Otherwise, failure... */
8935 + * Recalculate the vertical video cutoff (hack!)
8937 +static void vga_recalc_vertical(void)
8939 + unsigned int font_size, rows;
8944 + font_size = rdfs8(0x485); /* BIOS: font size (pixels) */
8945 + rows = force_y ? force_y : rdfs8(0x484)+1; /* Text rows */
8947 + rows *= font_size; /* Visible scan lines */
8948 + rows--; /* ... minus one */
8950 + crtc = vga_crtc();
8952 + out_idx((u8)rows, crtc, 0x12); /* Lower height register */
8953 + ov = in_idx(crtc, 0x07); /* Overflow register */
8955 + ov |= (rows >> (8-1)) & 0x02;
8956 + ov |= (rows >> (9-6)) & 0x40;
8957 + out_idx(ov, crtc, 0x07);
8960 +/* Set mode (with recalc if specified) */
8961 +static int set_mode(u16 mode)
8965 + /* Very special mode numbers... */
8966 + if (mode == VIDEO_CURRENT_MODE)
8967 + return 0; /* Nothing to do... */
8968 + else if (mode == NORMAL_VGA)
8969 + mode = VIDEO_80x25;
8970 + else if (mode == EXTENDED_VGA)
8971 + mode = VIDEO_8POINT;
8973 + rv = raw_set_mode(mode);
8977 + if (mode & VIDEO_RECALC)
8978 + vga_recalc_vertical();
8983 +static unsigned int get_entry(void)
8985 + char entry_buf[4];
8993 + if (key == '\b') {
8998 + } else if ((key >= '0' && key <= '9') ||
8999 + (key >= 'A' && key <= 'Z') ||
9000 + (key >= 'a' && key <= 'z')) {
9001 + if (len < sizeof entry_buf) {
9002 + entry_buf[len++] = key;
9006 + } while (key != '\r');
9010 + return VIDEO_CURRENT_MODE; /* Default */
9013 + for (i = 0; i < len; i++) {
9015 + key = entry_buf[i] | 0x20;
9016 + v += (key > '9') ? key-'a'+10 : key-'0';
9022 +static void display_menu(void)
9024 + struct card_info *card;
9025 + struct mode_info *mi;
9029 + puts("Mode: COLSxROWS:\n");
9032 + for (card = video_cards; card < video_cards_end; card++) {
9034 + for (i = 0; i < card->nmodes; i++, mi++) {
9035 + int visible = mi->x && mi->y;
9036 + u16 mode_id = mi->mode ? mi->mode :
9037 + (mi->y << 8)+mi->x;
9040 + continue; /* Hidden mode */
9042 + printf("%c %04X %3dx%-3d %s\n",
9043 + ch, mode_id, mi->x, mi->y, card->card_name);
9047 + else if (ch == 'z' || ch == ' ')
9048 + ch = ' '; /* Out of keys... */
9055 +#define H(x) ((x)-'a'+10)
9056 +#define SCAN ((H('s')<<12)+(H('c')<<8)+(H('a')<<4)+H('n'))
9058 +static unsigned int mode_menu(void)
9063 + puts("Press <ENTER> to see video modes available, "
9064 + "<SPACE> to continue, or wait 30 sec\n");
9068 + key = getchar_timeout();
9069 + if (key == ' ' || key == 0)
9070 + return VIDEO_CURRENT_MODE; /* Default */
9073 + putchar('\a'); /* Beep! */
9080 + puts("Enter a video mode or \"scan\" to scan for "
9081 + "additional modes: ");
9082 + sel = get_entry();
9090 +#ifdef CONFIG_VIDEO_RETAIN
9091 +/* Save screen content to the heap */
9092 +struct saved_screen {
9098 +static void save_screen(void)
9100 + /* Should be called after store_mode_params() */
9101 + saved.x = boot_params.screen_info.orig_video_cols;
9102 + saved.y = boot_params.screen_info.orig_video_lines;
9103 + saved.curx = boot_params.screen_info.orig_x;
9104 + saved.cury = boot_params.screen_info.orig_y;
9106 + if (heap_free() < saved.x*saved.y*sizeof(u16)+512)
9107 + return; /* Not enough heap to save the screen */
9109 + saved.data = GET_HEAP(u16, saved.x*saved.y);
9111 + set_fs(video_segment);
9112 + copy_from_fs(saved.data, 0, saved.x*saved.y*sizeof(u16));
9115 +static void restore_screen(void)
9117 + /* Should be called after store_mode_params() */
9118 + int xs = boot_params.screen_info.orig_video_cols;
9119 + int ys = boot_params.screen_info.orig_video_lines;
9122 + u16 *src = saved.data;
9126 + return; /* Can't restore onto a graphic mode */
9129 + return; /* No saved screen contents */
9131 + /* Restore screen contents */
9133 + set_fs(video_segment);
9134 + for (y = 0; y < ys; y++) {
9137 + if (y < saved.y) {
9138 + int copy = (xs < saved.x) ? xs : saved.x;
9139 + copy_to_fs(dst, src, copy*sizeof(u16));
9140 + dst += copy*sizeof(u16);
9142 + npad = (xs < saved.x) ? 0 : xs-saved.x;
9147 + /* Writes "npad" blank characters to
9148 + video_segment:dst and advances dst */
9149 + asm volatile("pushw %%es ; "
9156 + : "+D" (dst), "+c" (npad)
9157 + : "bdSm" (video_segment),
9158 + "a" (0x07200720));
9161 + /* Restore cursor position */
9162 + ax = 0x0200; /* Set cursor position */
9163 + bx = 0; /* Page number (<< 8) */
9164 + dx = (saved.cury << 8)+saved.curx;
9165 + asm volatile(INT10
9166 + : "+a" (ax), "+b" (bx), "+d" (dx)
9167 + : : "ecx", "esi", "edi");
9170 +#define save_screen() ((void)0)
9171 +#define restore_screen() ((void)0)
9174 +void set_video(void)
9176 + u16 mode = boot_params.hdr.vid_mode;
9180 + store_mode_params();
9185 + if (mode == ASK_VGA)
9186 + mode = mode_menu();
9188 + if (!set_mode(mode))
9191 + printf("Undefined video mode number: %x\n", mode);
9194 + vesa_store_edid();
9195 + store_mode_params();
9201 +++ b/arch/i386/boot/video.h
9203 +/* -*- linux-c -*- ------------------------------------------------------- *
9205 + * Copyright (C) 1991, 1992 Linus Torvalds
9206 + * Copyright 2007 rPath, Inc. - All Rights Reserved
9208 + * This file is part of the Linux kernel, and is made available under
9209 + * the terms of the GNU General Public License version 2.
9211 + * ----------------------------------------------------------------------- */
9214 + * arch/i386/boot/video.h
9216 + * Header file for the real-mode video probing code
9219 +#ifndef BOOT_VIDEO_H
9220 +#define BOOT_VIDEO_H
9222 +#include <linux/types.h>
9224 +/* Enable autodetection of SVGA adapters and modes. */
9225 +#undef CONFIG_VIDEO_SVGA
9227 +/* Enable autodetection of VESA modes */
9228 +#define CONFIG_VIDEO_VESA
9230 +/* Retain screen contents when switching modes */
9231 +#define CONFIG_VIDEO_RETAIN
9233 +/* Force 400 scan lines for standard modes (hack to fix bad BIOS behaviour */
9234 +#undef CONFIG_VIDEO_400_HACK
9236 +/* This code uses an extended set of video mode numbers. These include:
9237 + * Aliases for standard modes
9239 + * EXTENDED_VGA (-2)
9241 + * Video modes numbered by menu position -- NOT RECOMMENDED because of lack
9242 + * of compatibility when extending the table. These are between 0x00 and 0xff.
9244 +#define VIDEO_FIRST_MENU 0x0000
9246 +/* Standard BIOS video modes (BIOS number + 0x0100) */
9247 +#define VIDEO_FIRST_BIOS 0x0100
9249 +/* VESA BIOS video modes (VESA number + 0x0200) */
9250 +#define VIDEO_FIRST_VESA 0x0200
9252 +/* Video7 special modes (BIOS number + 0x0900) */
9253 +#define VIDEO_FIRST_V7 0x0900
9255 +/* Special video modes */
9256 +#define VIDEO_FIRST_SPECIAL 0x0f00
9257 +#define VIDEO_80x25 0x0f00
9258 +#define VIDEO_8POINT 0x0f01
9259 +#define VIDEO_80x43 0x0f02
9260 +#define VIDEO_80x28 0x0f03
9261 +#define VIDEO_CURRENT_MODE 0x0f04
9262 +#define VIDEO_80x30 0x0f05
9263 +#define VIDEO_80x34 0x0f06
9264 +#define VIDEO_80x60 0x0f07
9265 +#define VIDEO_GFX_HACK 0x0f08
9266 +#define VIDEO_LAST_SPECIAL 0x0f09
9268 +/* Video modes given by resolution */
9269 +#define VIDEO_FIRST_RESOLUTION 0x1000
9271 +/* The "recalculate timings" flag */
9272 +#define VIDEO_RECALC 0x8000
9274 +/* Define DO_STORE according to CONFIG_VIDEO_RETAIN */
9275 +#ifdef CONFIG_VIDEO_RETAIN
9276 +void store_screen(void);
9277 +#define DO_STORE() store_screen()
9279 +#define DO_STORE() ((void)0)
9280 +#endif /* CONFIG_VIDEO_RETAIN */
9283 + * Mode table structures
9287 + u16 mode; /* Mode number (vga= style) */
9288 + u8 x, y; /* Width, height */
9292 + const char *card_name;
9293 + int (*set_mode)(struct mode_info *mode);
9294 + int (*probe)(void);
9295 + struct mode_info *modes;
9296 + int nmodes; /* Number of probed modes so far */
9297 + int unsafe; /* Probing is unsafe, only do after "scan" */
9298 + u16 xmode_first; /* Unprobed modes to try to call anyway */
9299 + u16 xmode_n; /* Size of unprobed mode range */
9302 +#define __videocard struct card_info __attribute__((section(".videocards")))
9303 +extern struct card_info video_cards[], video_cards_end[];
9305 +int mode_defined(u16 mode); /* video.c */
9307 +/* Basic video information */
9308 +#define ADAPTER_CGA 0 /* CGA/MDA/HGC */
9309 +#define ADAPTER_EGA 1
9310 +#define ADAPTER_VGA 2
9312 +extern int adapter;
9313 +extern u16 video_segment;
9314 +extern int force_x, force_y; /* Don't query the BIOS for cols/rows */
9315 +extern int do_restore; /* Restore screen contents */
9316 +extern int graphic_mode; /* Graphics mode with linear frame buffer */
9319 + * int $0x10 is notorious for touching registers it shouldn't.
9320 + * gcc doesn't like %ebp being clobbered, so define it as a push/pop
9323 +#define INT10 "pushl %%ebp; int $0x10; popl %%ebp"
9325 +/* Accessing VGA indexed registers */
9326 +static inline u8 in_idx(u16 port, u8 index)
9328 + outb(index, port);
9329 + return inb(port+1);
9332 +static inline void out_idx(u8 v, u16 port, u8 index)
9334 + outw(index+(v << 8), port);
9337 +/* Writes a value to an indexed port and then reads the port again */
9338 +static inline u8 tst_idx(u8 v, u16 port, u8 index)
9340 + out_idx(port, index, v);
9341 + return in_idx(port, index);
9344 +/* Get the I/O port of the VGA CRTC */
9345 +u16 vga_crtc(void); /* video-vga.c */
9347 +#endif /* BOOT_VIDEO_H */
9349 +++ b/arch/i386/boot/voyager.c
9351 +/* -*- linux-c -*- ------------------------------------------------------- *
9353 + * Copyright (C) 1991, 1992 Linus Torvalds
9354 + * Copyright 2007 rPath, Inc. - All Rights Reserved
9356 + * This file is part of the Linux kernel, and is made available under
9357 + * the terms of the GNU General Public License version 2.
9359 + * ----------------------------------------------------------------------- */
9362 + * arch/i386/boot/voyager.c
9364 + * Get the Voyager config information
9369 +#ifdef CONFIG_X86_VOYAGER
9371 +int query_voyager(void)
9375 + /* Abuse the apm_bios_info area for this */
9376 + u8 *data_ptr = (u8 *)&boot_params.apm_bios_info;
9378 + data_ptr[0] = 0xff; /* Flag on config not found(?) */
9380 + asm("pushw %%es ; "
9383 + "movw %%es, %1 ; "
9385 + : "=qm" (err), "=rm" (es), "=D" (di)
9389 + return -1; /* Not Voyager */
9392 + copy_from_fs(data_ptr, di, 7); /* Table is 7 bytes apparently */
9396 +#endif /* CONFIG_X86_VOYAGER */
9398 +++ b/arch/i386/kernel/cpu/addon_cpuid_features.c
9402 + * Routines to indentify additional cpu features that are scattered in
9406 +#include <linux/cpu.h>
9408 +#include <asm/processor.h>
9424 +void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
9428 + const struct cpuid_bit *cb;
9430 + static const struct cpuid_bit cpuid_bits[] = {
9431 + { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 },
9435 + for (cb = cpuid_bits; cb->feature; cb++) {
9437 + /* Verify that the level is valid */
9438 + max_level = cpuid_eax(cb->level & 0xffff0000);
9439 + if (max_level < cb->level ||
9440 + max_level > (cb->level | 0xffff))
9443 + cpuid(cb->level, ®s[CR_EAX], ®s[CR_EBX],
9444 + ®s[CR_ECX], ®s[CR_EDX]);
9446 + if (regs[cb->reg] & (1 << cb->bit))
9447 + set_bit(cb->feature, c->x86_capability);
9450 --- a/arch/i386/kernel/cpu/common.c
9451 +++ b/arch/i386/kernel/cpu/common.c
9453 if ( xlvl >= 0x80000004 )
9454 get_model_name(c); /* Default name */
9457 + init_scattered_cpuid_features(c);
9460 early_intel_workaround(c);
9461 --- a/arch/i386/kernel/cpu/proc.c
9462 +++ b/arch/i386/kernel/cpu/proc.c
9464 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9465 NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
9466 NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL,
9467 - NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm", "3dnowext", "3dnow",
9468 + NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm",
9469 + "3dnowext", "3dnow",
9471 /* Transmeta-defined */
9472 "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
9474 /* Other (Linux-defined) */
9475 "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr",
9476 NULL, NULL, NULL, NULL,
9477 - "constant_tsc", "up", NULL, NULL, NULL, NULL, NULL, NULL,
9478 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9479 + "constant_tsc", "up", NULL, "arch_perfmon",
9480 + "pebs", "bts", NULL, "sync_rdtsc",
9481 + "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9482 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9484 /* Intel-defined (#2) */
9486 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9488 /* AMD-defined (#2) */
9489 - "lahf_lm", "cmp_legacy", "svm", "extapic", "cr8legacy", "abm",
9490 - "sse4a", "misalignsse",
9491 - "3dnowprefetch", "osvw", "ibs", NULL, NULL, NULL, NULL, NULL,
9492 + "lahf_lm", "cmp_legacy", "svm", "extapic", "cr8_legacy",
9493 + "altmovcr8", "abm", "sse4a",
9494 + "misalignsse", "3dnowprefetch",
9495 + "osvw", "ibs", NULL, NULL, NULL, NULL,
9496 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9497 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9499 + /* Auxiliary (Linux-defined) */
9500 + "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9501 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9502 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9503 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
9505 --- a/arch/i386/kernel/e820.c
9506 +++ b/arch/i386/kernel/e820.c
9509 printk("(ACPI NVS)\n");
9511 - default: printk("type %lu\n", e820.map[i].type);
9512 + default: printk("type %u\n", e820.map[i].type);
9516 --- a/arch/i386/kernel/setup.c
9517 +++ b/arch/i386/kernel/setup.c
9518 @@ -102,19 +102,10 @@
9522 -struct drive_info_struct { char dummy[32]; } drive_info;
9523 -#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || \
9524 - defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
9525 -EXPORT_SYMBOL(drive_info);
9527 struct screen_info screen_info;
9528 EXPORT_SYMBOL(screen_info);
9529 struct apm_info apm_info;
9530 EXPORT_SYMBOL(apm_info);
9531 -struct sys_desc_table_struct {
9532 - unsigned short length;
9533 - unsigned char table[0];
9535 struct edid_info edid_info;
9536 EXPORT_SYMBOL_GPL(edid_info);
9537 struct ist_info ist_info;
9540 static char __initdata command_line[COMMAND_LINE_SIZE];
9542 -unsigned char __initdata boot_params[PARAM_SIZE];
9543 +struct boot_params __initdata boot_params;
9545 #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
9550 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
9551 - drive_info = DRIVE_INFO;
9552 screen_info = SCREEN_INFO;
9553 edid_info = EDID_INFO;
9554 apm_info.bios = APM_BIOS_INFO;
9555 --- a/arch/i386/kernel/verify_cpu.S
9558 -/* Check if CPU has some minimum CPUID bits
9559 - This runs in 16bit mode so that the caller can still use the BIOS
9560 - to output errors on the screen */
9561 -#include <asm/cpufeature.h>
9562 -#include <asm/msr.h>
9565 - pushfl # Save caller passed flags
9566 - pushl $0 # Kill any dangerous flags
9569 -#if CONFIG_X86_MINIMUM_CPU_MODEL >= 4
9572 - orl $(1<<18),%eax # try setting AC
9577 - testl $(1<<18),%eax
9580 -#if REQUIRED_MASK1 != 0
9581 - pushfl # standard way to check for cpuid
9584 - xorl $0x200000,%eax
9590 - pushfl # standard way to check for cpuid
9593 - xorl $0x200000,%eax
9599 - jz bad # REQUIRED_MASK1 != 0 requires CPUID
9601 - movl $0x0,%eax # See if cpuid 1 is implemented
9604 - jb bad # no cpuid 1
9606 -#if REQUIRED_MASK1 & NEED_CMPXCHG64
9607 - /* Some VIA C3s need magic MSRs to enable CX64. Do this here */
9608 - cmpl $0x746e6543,%ebx # Cent
9610 - cmpl $0x48727561,%edx # aurH
9612 - cmpl $0x736c7561,%ecx # auls
9614 - movl $1,%eax # check model
9619 - cmp $6,%ebx # check family == 6
9623 - cmpl $6,%eax # check model >= 6
9625 - # assume models >= 6 all support this MSR
9626 - movl $MSR_VIA_FCR,%ecx
9628 - orl $((1<<1)|(1<<7)),%eax # enable CMPXCHG64 and PGE
9632 - movl $0x1,%eax # Does the cpu have what it takes
9635 -#if CONFIG_X86_MINIMUM_CPU_MODEL > 4
9636 -#error add proper model checking here
9639 - andl $REQUIRED_MASK1,%edx
9640 - xorl $REQUIRED_MASK1,%edx
9642 -#endif /* REQUIRED_MASK1 */
9652 --- a/arch/x86_64/Kconfig
9653 +++ b/arch/x86_64/Kconfig
9654 @@ -427,6 +427,10 @@
9655 This is purely to save memory - each supported CPU requires
9656 memory in the static kernel configuration.
9658 +config PHYSICAL_ALIGN
9660 + default "0x200000"
9663 bool "Support for suspend on SMP and hot-pluggable CPUs (EXPERIMENTAL)"
9664 depends on SMP && HOTPLUG && EXPERIMENTAL
9665 --- a/arch/x86_64/boot/Makefile
9666 +++ b/arch/x86_64/boot/Makefile
9669 # arch/x86_64/boot/Makefile
9671 -# This file is subject to the terms and conditions of the GNU General Public
9672 -# License. See the file "COPYING" in the main directory of this archive
9673 -# for more details.
9675 -# Copyright (C) 1994 by Linus Torvalds
9678 -# ROOT_DEV specifies the default root-device when making the image.
9679 -# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
9680 -# the default of FLOPPY is used by 'build'.
9682 -ROOT_DEV := CURRENT
9684 -# If you want to preset the SVGA mode, uncomment the next line and
9685 -# set SVGA_MODE to whatever number you want.
9686 -# Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
9687 -# The number is the same as you would ordinarily press at bootup.
9689 -SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
9691 -# If you want the RAM disk device, define this to be the size in blocks.
9693 -#RAMDISK := -DRAMDISK=512
9695 -targets := vmlinux.bin bootsect bootsect.o \
9696 - setup setup.o bzImage mtools.conf
9698 -EXTRA_CFLAGS := -m32
9700 -hostprogs-y := tools/build
9701 -HOST_EXTRACFLAGS += $(LINUXINCLUDE)
9702 -subdir- := compressed/ #Let make clean descend in compressed/
9703 -# ---------------------------------------------------------------------------
9705 -$(obj)/bzImage: IMAGE_OFFSET := 0x100000
9706 -$(obj)/bzImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
9707 -$(obj)/bzImage: BUILDFLAGS := -b
9709 -quiet_cmd_image = BUILD $@
9710 -cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \
9711 - $(obj)/vmlinux.bin $(ROOT_DEV) > $@
9713 -$(obj)/bzImage: $(obj)/bootsect $(obj)/setup \
9714 - $(obj)/vmlinux.bin $(obj)/tools/build FORCE
9715 - $(call if_changed,image)
9716 - @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
9718 -$(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
9719 - $(call if_changed,objcopy)
9721 -LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
9722 -LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext
9724 -$(obj)/setup $(obj)/bootsect: %: %.o FORCE
9725 - $(call if_changed,ld)
9727 -$(obj)/compressed/vmlinux: FORCE
9728 - $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@
9730 -# Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel
9732 -# Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel
9735 -image_cmdline = default linux $(FDARGS) $(if $(FDINITRD),initrd=initrd.img,)
9737 -$(obj)/mtools.conf: $(src)/mtools.conf.in
9738 - sed -e 's|@OBJ@|$(obj)|g' < $< > $@
9740 -# This requires write access to /dev/fd0
9741 -zdisk: $(BOOTIMAGE) $(obj)/mtools.conf
9742 - MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync
9743 - syslinux /dev/fd0 ; sync
9744 - echo '$(image_cmdline)' | \
9745 - MTOOLSRC=$(obj)/mtools.conf mcopy - a:syslinux.cfg
9746 - if [ -f '$(FDINITRD)' ] ; then \
9747 - MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' a:initrd.img ; \
9749 - MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync
9751 -# These require being root or having syslinux 2.02 or higher installed
9752 -fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf
9753 - dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440
9754 - MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync
9755 - syslinux $(obj)/fdimage ; sync
9756 - echo '$(image_cmdline)' | \
9757 - MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg
9758 - if [ -f '$(FDINITRD)' ] ; then \
9759 - MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' v:initrd.img ; \
9761 - MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync
9763 -fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf
9764 - dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880
9765 - MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync
9766 - syslinux $(obj)/fdimage ; sync
9767 - echo '$(image_cmdline)' | \
9768 - MTOOLSRC=$(obj)/mtools.conf mcopy - w:syslinux.cfg
9769 - if [ -f '$(FDINITRD)' ] ; then \
9770 - MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' w:initrd.img ; \
9772 - MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync
9774 -isoimage: $(BOOTIMAGE)
9775 - -rm -rf $(obj)/isoimage
9776 - mkdir $(obj)/isoimage
9777 - for i in lib lib64 share end ; do \
9778 - if [ -f /usr/$$i/syslinux/isolinux.bin ] ; then \
9779 - cp /usr/$$i/syslinux/isolinux.bin $(obj)/isoimage ; \
9782 - if [ $$i = end ] ; then exit 1 ; fi ; \
9784 - cp $(BOOTIMAGE) $(obj)/isoimage/linux
9785 - echo '$(image_cmdline)' > $(obj)/isoimage/isolinux.cfg
9786 - if [ -f '$(FDINITRD)' ] ; then \
9787 - cp '$(FDINITRD)' $(obj)/isoimage/initrd.img ; \
9789 - mkisofs -J -r -o $(obj)/image.iso -b isolinux.bin -c boot.cat \
9790 - -no-emul-boot -boot-load-size 4 -boot-info-table \
9792 - rm -rf $(obj)/isoimage
9794 -zlilo: $(BOOTIMAGE)
9795 - if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi
9796 - if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi
9797 - cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz
9798 - cp System.map $(INSTALL_PATH)/
9799 - if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
9800 +# The actual boot code is shared with i386 including the Makefile.
9801 +# So tell kbuild that we fetch the code from i386 and include the
9802 +# Makefile from i386 too.
9805 - sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
9806 +src := arch/i386/boot
9807 +include $(src)/Makefile
9808 --- a/arch/x86_64/boot/bootsect.S
9812 - * bootsect.S Copyright (C) 1991, 1992 Linus Torvalds
9814 - * modified by Drew Eckhardt
9815 - * modified by Bruce Evans (bde)
9816 - * modified by Chris Noe (May 1999) (as86 -> gas)
9817 - * gutted by H. Peter Anvin (Jan 2003)
9819 - * BIG FAT NOTE: We're in real mode using 64k segments. Therefore segment
9820 - * addresses must be multiplied by 16 to obtain their respective linear
9821 - * addresses. To avoid confusion, linear addresses are written using leading
9822 - * hex while segment addresses are written as segment:offset.
9826 -#include <asm/boot.h>
9828 -SETUPSECTS = 4 /* default nr of setup-sectors */
9829 -BOOTSEG = 0x07C0 /* original address of boot-sector */
9830 -INITSEG = DEF_INITSEG /* we move boot here - out of the way */
9831 -SETUPSEG = DEF_SETUPSEG /* setup starts here */
9832 -SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */
9833 -SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */
9834 - /* to be loaded */
9835 -ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */
9836 -SWAP_DEV = 0 /* SWAP_DEV is now written by "build" */
9839 -#define SVGA_MODE ASK_VGA
9846 -#ifndef ROOT_RDONLY
9847 -#define ROOT_RDONLY 1
9856 - # Normalize the start address
9857 - jmpl $BOOTSEG, $start2
9868 - movw $bugger_off_msg, %si
9880 - # Allow the user to press a key, then reboot
9885 - # int 0x19 should never return. In case it does anyway,
9886 - # invoke the BIOS reset code...
9887 - ljmp $0xf000,$0xfff0
9891 - .ascii "Direct booting from floppy is no longer supported.\r\n"
9892 - .ascii "Please use a boot loader program instead.\r\n"
9894 - .ascii "Remove disk and press any key to reboot . . .\r\n"
9898 - # Kernel attributes; used by setup
9901 -setup_sects: .byte SETUPSECTS
9902 -root_flags: .word ROOT_RDONLY
9903 -syssize: .word SYSSIZE
9904 -swap_dev: .word SWAP_DEV
9905 -ram_size: .word RAMDISK
9906 -vid_mode: .word SVGA_MODE
9907 -root_dev: .word ROOT_DEV
9908 -boot_flag: .word 0xAA55
9909 --- a/arch/x86_64/boot/compressed/Makefile
9910 +++ b/arch/x86_64/boot/compressed/Makefile
9914 targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
9915 -EXTRA_AFLAGS := -traditional
9917 -# cannot use EXTRA_CFLAGS because base CFLAGS contains -mkernel which conflicts with
9919 -CFLAGS := -m64 -D__KERNEL__ -Iinclude -O2 -fno-strict-aliasing -fPIC -mcmodel=small -fno-builtin
9920 +CFLAGS := -m64 -D__KERNEL__ $(LINUXINCLUDE) -O2 \
9921 + -fno-strict-aliasing -fPIC -mcmodel=small \
9922 + $(call cc-option, -ffreestanding) \
9923 + $(call cc-option, -fno-stack-protector)
9924 +AFLAGS := $(CFLAGS) -D__ASSEMBLY__
9925 LDFLAGS := -m elf_x86_64
9927 LDFLAGS_vmlinux := -T
9928 --- a/arch/x86_64/boot/compressed/head.S
9929 +++ b/arch/x86_64/boot/compressed/head.S
9931 * at and where we were actually loaded at. This can only be done
9932 * with a short local call on x86. Nothing else will tell us what
9933 * address we are running at. The reserved chunk of the real-mode
9934 - * data at 0x34-0x3f are used as the stack for this calculation.
9935 - * Only 4 bytes are needed.
9936 + * data at 0x1e4 (defined as a scratch field) are used as the stack
9937 + * for this calculation. Only 4 bytes are needed.
9939 - leal 0x40(%esi), %esp
9940 + leal (0x1e4+4)(%esi), %esp
9944 --- a/arch/x86_64/boot/install.sh
9948 -. $srctree/arch/i386/boot/install.sh
9949 --- a/arch/x86_64/boot/mtools.conf.in
9953 -# mtools configuration file for "make (b)zdisk"
9956 -# Actual floppy drive
9960 -# 1.44 MB floppy disk image
9962 - file="@OBJ@/fdimage" cylinders=80 heads=2 sectors=18 filter
9964 -# 2.88 MB floppy disk image (mostly for virtual uses)
9966 - file="@OBJ@/fdimage" cylinders=80 heads=2 sectors=36 filter
9969 --- a/arch/x86_64/boot/setup.S
9973 - * setup.S Copyright (C) 1991, 1992 Linus Torvalds
9975 - * setup.s is responsible for getting the system data from the BIOS,
9976 - * and putting them into the appropriate places in system memory.
9977 - * both setup.s and system has been loaded by the bootblock.
9979 - * This code asks the bios for memory/disk/other parameters, and
9980 - * puts them in a "safe" place: 0x90000-0x901FF, ie where the
9981 - * boot-block used to be. It is then up to the protected mode
9982 - * system to read them from there before the area is overwritten
9983 - * for buffer-blocks.
9985 - * Move PS/2 aux init code to psaux.c
9986 - * (troyer@saifr00.cfsat.Honeywell.COM) 03Oct92
9988 - * some changes and additional features by Christoph Niemann,
9989 - * March 1993/June 1994 (Christoph.Niemann@linux.org)
9991 - * add APM BIOS checking by Stephen Rothwell, May 1994
9992 - * (sfr@canb.auug.org.au)
9994 - * High load stuff, initrd support and position independency
9995 - * by Hans Lermen & Werner Almesberger, February 1996
9996 - * <lermen@elserv.ffm.fgan.de>, <almesber@lrc.epfl.ch>
9998 - * Video handling moved to video.S by Martin Mares, March 1996
9999 - * <mj@k332.feld.cvut.cz>
10001 - * Extended memory detection scheme retwiddled by orc@pell.chi.il.us (david
10002 - * parsons) to avoid loadlin confusion, July 1997
10004 - * Transcribed from Intel (as86) -> AT&T (gas) by Chris Noe, May 1999.
10005 - * <stiker@northlink.com>
10007 - * Fix to work around buggy BIOSes which don't use carry bit correctly
10008 - * and/or report extended memory in CX/DX for e801h memory size detection
10009 - * call. As a result the kernel got wrong figures. The int15/e801h docs
10010 - * from Ralf Brown interrupt list seem to indicate AX/BX should be used
10011 - * anyway. So to avoid breaking many machines (presumably there was a reason
10012 - * to orginally use CX/DX instead of AX/BX), we do a kludge to see
10013 - * if CX/DX have been changed in the e801 call and if so use AX/BX .
10014 - * Michael Miller, April 2001 <michaelm@mjmm.org>
10016 - * Added long mode checking and SSE force. March 2003, Andi Kleen.
10019 -#include <asm/segment.h>
10020 -#include <linux/utsrelease.h>
10021 -#include <linux/compile.h>
10022 -#include <asm/boot.h>
10023 -#include <asm/e820.h>
10024 -#include <asm/page.h>
10025 -#include <asm/setup.h>
10027 -/* Signature words to ensure LILO loaded us right */
10028 -#define SIG1 0xAA55
10029 -#define SIG2 0x5A5A
10031 -INITSEG = DEF_INITSEG # 0x9000, we move boot here, out of the way
10032 -SYSSEG = DEF_SYSSEG # 0x1000, system loaded at 0x10000 (65536).
10033 -SETUPSEG = DEF_SETUPSEG # 0x9020, this is the current segment
10034 - # ... and the former contents of CS
10036 -DELTA_INITSEG = SETUPSEG - INITSEG # 0x0020
10039 -.globl begtext, begdata, begbss, endtext, enddata, endbss
10052 -# This is the setup header, and it must start at %cs:2 (old 0x9020:2)
10054 - .ascii "HdrS" # header signature
10055 - .word 0x0206 # header version number (>= 0x0105)
10056 - # or else old loadlin-1.5 will fail)
10057 -realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
10058 -start_sys_seg: .word SYSSEG
10059 - .word kernel_version # pointing to kernel version string
10060 - # above section of header is compatible
10061 - # with loadlin-1.5 (header v1.5). Don't
10064 -type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin,
10065 - # Bootlin, SYSLX, bootsect...)
10066 - # See Documentation/i386/boot.txt for
10069 -# flags, unused bits must be zero (RFU) bit within loadflags
10071 -LOADED_HIGH = 1 # If set, the kernel is loaded high
10072 -CAN_USE_HEAP = 0x80 # If set, the loader also has set
10073 - # heap_end_ptr to tell how much
10074 - # space behind setup.S can be used for
10076 - # Only the loader knows what is free
10077 -#ifndef __BIG_KERNEL__
10080 - .byte LOADED_HIGH
10083 -setup_move_size: .word 0x8000 # size to move, when setup is not
10084 - # loaded at 0x90000. We will move setup
10085 - # to 0x90000 then just before jumping
10086 - # into the kernel. However, only the
10087 - # loader knows how much data behind
10088 - # us also needs to be loaded.
10090 -code32_start: # here loaders can put a different
10091 - # start address for 32-bit code.
10092 -#ifndef __BIG_KERNEL__
10093 - .long 0x1000 # 0x1000 = default for zImage
10095 - .long 0x100000 # 0x100000 = default for big kernel
10098 -ramdisk_image: .long 0 # address of loaded ramdisk image
10099 - # Here the loader puts the 32-bit
10100 - # address where it loaded the image.
10101 - # This only will be read by the kernel.
10103 -ramdisk_size: .long 0 # its size in bytes
10106 - .long 0 # obsolete
10108 -heap_end_ptr: .word modelist+1024 # (Header version 0x0201 or later)
10109 - # space from here (exclusive) down to
10110 - # end of setup code can be used by setup
10111 - # for local heap purposes.
10114 -cmd_line_ptr: .long 0 # (Header version 0x0202 or later)
10115 - # If nonzero, a 32-bit pointer
10116 - # to the kernel command line.
10117 - # The command line should be
10118 - # located between the start of
10119 - # setup and the end of low
10120 - # memory (0xa0000), or it may
10121 - # get overwritten before it
10122 - # gets read. If this field is
10123 - # used, there is no longer
10124 - # anything magical about the
10125 - # 0x90000 segment; the setup
10126 - # can be located anywhere in
10127 - # low memory 0x10000 or higher.
10129 -ramdisk_max: .long 0xffffffff
10130 -kernel_alignment: .long 0x200000 # physical addr alignment required for
10131 - # protected mode relocatable kernel
10132 -#ifdef CONFIG_RELOCATABLE
10133 -relocatable_kernel: .byte 1
10135 -relocatable_kernel: .byte 0
10140 -cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line,
10141 - #added with boot protocol
10144 -trampoline: call start_of_setup
10146 - # The offset at this point is 0x240
10147 - .space (0xeff-0x240+1) # E820 & EDD space (ending at 0xeff)
10148 -# End of setup header #####################################################
10151 -# Bootlin depends on this being done early
10152 - movw $0x01500, %ax
10156 -#ifdef SAFE_RESET_DISK_CONTROLLER
10157 -# Reset the disk controller.
10158 - movw $0x0000, %ax
10163 -# Set %ds = %cs, we know that SETUPSEG = %cs at this point
10164 - movw %cs, %ax # aka SETUPSEG
10166 -# Check signature at end of setup
10167 - cmpw $SIG1, setup_sig1
10170 - cmpw $SIG2, setup_sig2
10175 -# Routine to print asciiz string at ds:si
10187 -prtsp2: call prtspc # Print double space
10188 -prtspc: movb $0x20, %al # Print single space (note: fall-thru)
10201 -beep: movb $0x07, %al
10204 -no_sig_mess: .string "No setup signature found ..."
10209 -# We now have to find the rest of the setup code/data
10211 - movw %cs, %ax # SETUPSEG
10212 - subw $DELTA_INITSEG, %ax # INITSEG
10215 - movb (497), %bl # get setup sect from bootsect
10216 - subw $4, %bx # LILO loads 4 sectors of setup
10217 - shlw $8, %bx # convert to words (1sect=2^8 words)
10219 - shrw $3, %bx # convert to segment
10220 - addw $SYSSEG, %bx
10221 - movw %bx, %cs:start_sys_seg
10222 -# Move rest of setup code/data to here
10223 - movw $2048, %di # four sectors loaded by LILO
10225 - movw %cs, %ax # aka SETUPSEG
10227 - movw $SYSSEG, %ax
10231 - movw %cs, %ax # aka SETUPSEG
10233 - cmpw $SIG1, setup_sig1
10236 - cmpw $SIG2, setup_sig2
10242 - lea no_sig_mess, %si
10249 - movw %cs, %ax # aka SETUPSEG
10250 - subw $DELTA_INITSEG, %ax # aka INITSEG
10252 -# Check if an old loader tries to load a big-kernel
10253 - testb $LOADED_HIGH, %cs:loadflags # Do we have a big kernel?
10254 - jz loader_ok # No, no danger for old loaders.
10256 - cmpb $0, %cs:type_of_loader # Do we have a loader that
10257 - # can deal with us?
10258 - jnz loader_ok # Yes, continue.
10260 - pushw %cs # No, we have an old loader,
10262 - lea loader_panic_mess, %si
10267 -loader_panic_mess: .string "Wrong loader, giving up..."
10270 - /* check for long mode. */
10271 - /* we have to do this before the VESA setup, otherwise the user
10272 - can't see the error message. */
10284 - lea long_mode_panic,%si
10287 - jmp no_longmode_loop
10289 - .string "Your CPU does not support long mode. Use a 32bit distribution."
10292 -#include "../kernel/verify_cpu.S"
10296 -# tell BIOS we want to go to long mode
10297 - movl $0xec00,%eax # declare target operating mode
10298 - movl $2,%ebx # long mode
10301 -# Get memory size (extended mem, kB)
10304 - movl %eax, (0x1e0)
10305 -#ifndef STANDARD_MEMORY_BIOS_CALL
10306 - movb %al, (E820NR)
10307 -# Try three different memory detection schemes. First, try
10308 -# e820h, which lets us assemble a memory map, then try e801h,
10309 -# which returns a 32-bit memory size, and finally 88h, which
10313 -# the memory map from hell. e820h returns memory classified into
10314 -# a whole bunch of different types, and allows memory holes and
10315 -# everything. We scan through this memory map and build a list
10316 -# of the first 32 memory areas, which we return at [E820MAP].
10317 -# This is documented at http://www.acpi.info/, in the ACPI 2.0 specification.
10319 -#define SMAP 0x534d4150
10322 - xorl %ebx, %ebx # continuation counter
10323 - movw $E820MAP, %di # point into the whitelist
10324 - # so we can have the bios
10325 - # directly write into it.
10328 - movl $0x0000e820, %eax # e820, upper word zeroed
10329 - movl $SMAP, %edx # ascii 'SMAP'
10330 - movl $20, %ecx # size of the e820rec
10331 - pushw %ds # data record.
10333 - int $0x15 # make the call
10334 - jc bail820 # fall to e801 if it fails
10336 - cmpl $SMAP, %eax # check the return is `SMAP'
10337 - jne bail820 # fall to e801 if it fails
10339 -# cmpl $1, 16(%di) # is this usable memory?
10342 - # If this is usable memory, we save it by simply advancing %di by
10343 - # sizeof(e820rec).
10346 - movb (E820NR), %al # up to 128 entries
10347 - cmpb $E820MAX, %al
10355 - cmpl $0, %ebx # check to see if
10356 - jne jmpe820 # %ebx is set to EOF
10361 -# memory size is in 1k chunksizes, to avoid confusing loadlin.
10362 -# we store the 0xe801 memory size in a completely different place,
10363 -# because it will most likely be longer than 16 bits.
10364 -# (use 1e0 because that's what Larry Augustine uses in his
10365 -# alternative new memory detection scheme, and it's sensible
10366 -# to write everything into the same place.)
10369 - stc # fix to work around buggy
10370 - xorw %cx,%cx # BIOSes which don't clear/set
10371 - xorw %dx,%dx # carry on pass/error of
10372 - # e801h memory size call
10373 - # or merely pass cx,dx though
10374 - # without changing them.
10375 - movw $0xe801, %ax
10379 - cmpw $0x0, %cx # Kludge to handle BIOSes
10380 - jne e801usecxdx # which report their extended
10381 - cmpw $0x0, %dx # memory in AX/BX rather than
10382 - jne e801usecxdx # CX/DX. The spec I have read
10383 - movw %ax, %cx # seems to indicate AX/BX
10384 - movw %bx, %dx # are more reasonable anyway...
10387 - andl $0xffff, %edx # clear sign extend
10388 - shll $6, %edx # and go from 64k to 1k chunks
10389 - movl %edx, (0x1e0) # store extended memory size
10390 - andl $0xffff, %ecx # clear sign extend
10391 - addl %ecx, (0x1e0) # and add lower memory into
10394 -# Ye Olde Traditional Methode. Returns the memory size (up to 16mb or
10395 -# 64mb, depending on the bios) in ax.
10403 -# Set the keyboard repeat rate to the max
10404 - movw $0x0305, %ax
10408 -# Check for video adapter and its parameters and allow the
10409 -# user to browse video modes.
10410 - call video # NOTE: we need %ds pointing
10416 - ldsw (4 * 0x41), %si
10417 - movw %cs, %ax # aka SETUPSEG
10418 - subw $DELTA_INITSEG, %ax # aka INITSEG
10421 - movw $0x0080, %di
10430 - ldsw (4 * 0x46), %si
10433 - movw $0x0090, %di
10436 -# Check that there IS a hd1 :-)
10437 - movw $0x01500, %ax
10446 - movw %cs, %ax # aka SETUPSEG
10447 - subw $DELTA_INITSEG, %ax # aka INITSEG
10449 - movw $0x0090, %di
10457 -# Check for PS/2 pointing device
10458 - movw %cs, %ax # aka SETUPSEG
10459 - subw $DELTA_INITSEG, %ax # aka INITSEG
10461 - movb $0, (0x1ff) # default is no pointing device
10462 - int $0x11 # int 0x11: equipment list
10463 - testb $0x04, %al # check if mouse installed
10466 - movb $0xAA, (0x1ff) # device present
10469 -#include "../../i386/boot/edd.S"
10471 -# Now we want to move to protected mode ...
10472 - cmpw $0, %cs:realmode_swtch
10473 - jz rmodeswtch_normal
10475 - lcall *%cs:realmode_swtch
10477 - jmp rmodeswtch_end
10479 -rmodeswtch_normal:
10481 - call default_switch
10484 -# we get the code32 start address and modify the below 'jmpi'
10485 -# (loader may have changed it)
10486 - movl %cs:code32_start, %eax
10487 - movl %eax, %cs:code32
10489 -# Now we move the system to its rightful place ... but we check if we have a
10490 -# big-kernel. In that case we *must* not move it ...
10491 - testb $LOADED_HIGH, %cs:loadflags
10492 - jz do_move0 # .. then we have a normal low
10494 - # .. or else we have a high
10496 - jmp end_move # ... and we skip moving
10499 - movw $0x100, %ax # start of destination segment
10500 - movw %cs, %bp # aka SETUPSEG
10501 - subw $DELTA_INITSEG, %bp # aka INITSEG
10502 - movw %cs:start_sys_seg, %bx # start of source segment
10505 - movw %ax, %es # destination segment
10506 - incb %ah # instead of add ax,#0x100
10507 - movw %bx, %ds # source segment
10514 - cmpw %bp, %bx # assume start_sys_seg > 0x200,
10515 - # so we will perhaps read one
10516 - # page more than needed, but
10517 - # never overwrite INITSEG
10518 - # because destination is a
10519 - # minimum one page below source
10523 -# then we load the segment descriptors
10524 - movw %cs, %ax # aka SETUPSEG
10527 -# Check whether we need to be downward compatible with version <=201
10528 - cmpl $0, cmd_line_ptr
10529 - jne end_move_self # loader uses version >=202 features
10530 - cmpb $0x20, type_of_loader
10531 - je end_move_self # bootsect loader, we know of it
10533 -# Boot loader doesnt support boot protocol version 2.02.
10534 -# If we have our code not at 0x90000, we need to move it there now.
10535 -# We also then need to move the params behind it (commandline)
10536 -# Because we would overwrite the code on the current IP, we move
10537 -# it in two steps, jumping high after the first one.
10539 - cmpw $SETUPSEG, %ax
10542 - cli # make sure we really have
10543 - # interrupts disabled !
10544 - # because after this the stack
10545 - # should not be used
10546 - subw $DELTA_INITSEG, %ax # aka INITSEG
10551 - addw $INITSEG, %dx
10552 - subw %ax, %dx # this will go into %ss after
10556 - movw $INITSEG, %ax # real INITSEG
10558 - movw %cs:setup_move_size, %cx
10559 - std # we have to move up, so we use
10560 - # direction down because the
10561 - # areas may overlap
10565 - subw $move_self_here+0x200, %cx
10568 - ljmp $SETUPSEG, $move_self_here
10571 - movw $move_self_here+0x200, %cx
10574 - movw $SETUPSEG, %ax
10577 -end_move_self: # now we are at the right place
10578 - lidt idt_48 # load idt with 0,0
10579 - xorl %eax, %eax # Compute gdt_base
10580 - movw %ds, %ax # (Convert %ds:gdt to a linear ptr)
10583 - movl %eax, (gdt_48+2)
10584 - lgdt gdt_48 # load gdt with whatever is
10587 -# that was painless, now we enable a20
10590 - movb $0xD1, %al # command write
10594 - movb $0xDF, %al # A20 on
10599 -# You must preserve the other bits here. Otherwise embarrasing things
10600 -# like laptops powering off on boot happen. Corrected version by Kira
10601 -# Brown from Linux 2.2
10604 - orb $02, %al # "fast A20" version
10605 - outb %al, $0x92 # some chips have only this
10607 -# wait until a20 really *is* enabled; it can take a fair amount of
10608 -# time on certain systems; Toshiba Tecras are known to have this
10609 -# problem. The memory location used here (0x200) is the int 0x80
10610 -# vector, which should be safe to use.
10612 - xorw %ax, %ax # segment 0x0000
10614 - decw %ax # segment 0xffff (HMA)
10617 - incw %ax # unused memory location <0xfff0
10618 - movw %ax, %fs:(0x200) # we use the "int 0x80" vector
10619 - cmpw %gs:(0x210), %ax # and its corresponding HMA addr
10620 - je a20_wait # loop until no longer aliased
10622 -# make sure any possible coprocessor is properly reset..
10630 -# well, that went ok, I hope. Now we mask all interrupts - the rest
10631 -# is done in init_IRQ().
10632 - movb $0xFF, %al # mask all interrupts for now
10636 - movb $0xFB, %al # mask all irq's but irq2 which
10637 - outb %al, $0x21 # is cascaded
10639 -# Well, that certainly wasn't fun :-(. Hopefully it works, and we don't
10640 -# need no steenking BIOS anyway (except for the initial loading :-).
10641 -# The BIOS-routine wants lots of unnecessary data, and it's less
10642 -# "interesting" anyway. This is how REAL programmers do it.
10644 -# Well, now's the time to actually move into protected mode. To make
10645 -# things as simple as possible, we do no register set-up or anything,
10646 -# we let the gnu-compiled 32-bit programs do that. We just jump to
10647 -# absolute address 0x1000 (or the loader supplied one),
10648 -# in 32-bit protected mode.
10650 -# Note that the short jump isn't strictly needed, although there are
10651 -# reasons why it might be a good idea. It won't hurt in any case.
10652 - movw $1, %ax # protected mode (PE) bit
10653 - lmsw %ax # This is it!
10657 - xorw %bx, %bx # Flag to indicate a boot
10658 - xorl %esi, %esi # Pointer to real-mode code
10660 - subw $DELTA_INITSEG, %si
10661 - shll $4, %esi # Convert to 32-bit pointer
10662 -# NOTE: For high loaded big kernels we need a
10663 -# jmpi 0x100000,__KERNEL_CS
10665 -# but we yet haven't reloaded the CS register, so the default size
10666 -# of the target offset still is 16 bit.
10667 -# However, using an operand prefix (0x66), the CPU will properly
10668 -# take our 48 bit far pointer. (INTeL 80386 Programmer's Reference
10669 -# Manual, Mixing 16-bit and 32-bit code, page 16-6)
10671 - .byte 0x66, 0xea # prefix + jmpi-opcode
10672 -code32: .long 0x1000 # will be set to 0x100000
10673 - # for big kernels
10674 - .word __KERNEL_CS
10676 -# Here's a bunch of information about your current kernel..
10677 -kernel_version: .ascii UTS_RELEASE
10679 - .ascii LINUX_COMPILE_BY
10681 - .ascii LINUX_COMPILE_HOST
10683 - .ascii UTS_VERSION
10686 -# This is the default real mode switch routine.
10687 -# to be called just before protected mode transition
10689 - cli # no interrupts allowed !
10690 - movb $0x80, %al # disable NMI for bootup
10696 -# This routine checks that the keyboard command queue is empty
10697 -# (after emptying the output buffers)
10699 -# Some machines have delusions that the keyboard buffer is always full
10700 -# with no keyboard attached...
10702 -# If there is no keyboard controller, we will usually get 0xff
10703 -# to all the reads. With each IO taking a microsecond and
10704 -# a timeout of 100,000 iterations, this can take about half a
10705 -# second ("delay" == outb to port 0x80). That should be ok,
10706 -# and should also be plenty of time for a real keyboard controller
10712 - movl $100000, %ecx
10716 - jz empty_8042_end_loop
10720 - inb $0x64, %al # 8042 status port
10721 - testb $1, %al # output buffer?
10725 - inb $0x60, %al # read it
10726 - jmp empty_8042_loop
10729 - testb $2, %al # is input buffer full?
10730 - jnz empty_8042_loop # yes - loop
10731 -empty_8042_end_loop:
10735 -# Read the cmos clock. Return the seconds in al
10740 - movb %dh, %al # %dh contains the seconds
10749 -# Delay is needed after doing I/O
10754 -# Descriptor tables
10756 - .word 0, 0, 0, 0 # dummy
10758 - .word 0, 0, 0, 0 # unused
10760 - .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
10761 - .word 0 # base address = 0
10762 - .word 0x9A00 # code read/exec
10763 - .word 0x00CF # granularity = 4096, 386
10764 - # (+5th nibble of limit)
10766 - .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
10767 - .word 0 # base address = 0
10768 - .word 0x9200 # data read/write
10769 - .word 0x00CF # granularity = 4096, 386
10770 - # (+5th nibble of limit)
10773 - .word 0 # idt limit = 0
10774 - .word 0, 0 # idt base = 0L
10776 - .word gdt_end-gdt-1 # gdt limit
10777 - .word 0, 0 # gdt base (filled in later)
10779 -# Include video setup & detection code
10781 -#include "../../i386/boot/video.S"
10783 -# Setup signature -- must be last
10784 -setup_sig1: .word SIG1
10785 -setup_sig2: .word SIG2
10787 -# After this point, there is some free space which is used by the video mode
10788 -# handling code to store the temporary mode table (not used by the kernel).
10798 --- a/arch/x86_64/boot/tools/build.c
10802 - * Copyright (C) 1991, 1992 Linus Torvalds
10803 - * Copyright (C) 1997 Martin Mares
10807 - * This file builds a disk-image from three different files:
10809 - * - bootsect: compatibility mbr which prints an error message if
10810 - * someone tries to boot the kernel directly.
10811 - * - setup: 8086 machine code, sets up system parm
10812 - * - system: 80386 code for actual system
10814 - * It does some checking that all files are of the correct type, and
10815 - * just writes the result to stdout, removing headers and padding to
10816 - * the right amount. It also writes some system data to stderr.
10820 - * Changes by tytso to allow root device specification
10821 - * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
10822 - * Cross compiling fixes by Gertjan van Wingerde, July 1996
10823 - * Rewritten by Martin Mares, April 1997
10826 -#include <stdio.h>
10827 -#include <string.h>
10828 -#include <stdlib.h>
10829 -#include <stdarg.h>
10830 -#include <sys/types.h>
10831 -#include <sys/stat.h>
10832 -#include <sys/sysmacros.h>
10833 -#include <unistd.h>
10834 -#include <fcntl.h>
10835 -#include <asm/boot.h>
10837 -typedef unsigned char byte;
10838 -typedef unsigned short word;
10839 -typedef unsigned long u32;
10841 -#define DEFAULT_MAJOR_ROOT 0
10842 -#define DEFAULT_MINOR_ROOT 0
10844 -/* Minimal number of setup sectors (see also bootsect.S) */
10845 -#define SETUP_SECTS 4
10849 -int is_big_kernel;
10851 -void die(const char * str, ...)
10854 - va_start(args, str);
10855 - vfprintf(stderr, str, args);
10856 - fputc('\n', stderr);
10860 -void file_open(const char *name)
10862 - if ((fd = open(name, O_RDONLY, 0)) < 0)
10863 - die("Unable to open `%s': %m", name);
10868 - die("Usage: build [-b] bootsect setup system [rootdev] [> image]");
10871 -int main(int argc, char ** argv)
10873 - unsigned int i, c, sz, setup_sectors;
10875 - byte major_root, minor_root;
10878 - if (argc > 2 && !strcmp(argv[1], "-b"))
10880 - is_big_kernel = 1;
10883 - if ((argc < 4) || (argc > 5))
10886 - if (!strcmp(argv[4], "CURRENT")) {
10887 - if (stat("/", &sb)) {
10889 - die("Couldn't stat /");
10891 - major_root = major(sb.st_dev);
10892 - minor_root = minor(sb.st_dev);
10893 - } else if (strcmp(argv[4], "FLOPPY")) {
10894 - if (stat(argv[4], &sb)) {
10896 - die("Couldn't stat root device.");
10898 - major_root = major(sb.st_rdev);
10899 - minor_root = minor(sb.st_rdev);
10905 - major_root = DEFAULT_MAJOR_ROOT;
10906 - minor_root = DEFAULT_MINOR_ROOT;
10908 - fprintf(stderr, "Root device is (%d, %d)\n", major_root, minor_root);
10910 - file_open(argv[1]);
10911 - i = read(fd, buf, sizeof(buf));
10912 - fprintf(stderr,"Boot sector %d bytes.\n",i);
10914 - die("Boot block must be exactly 512 bytes");
10915 - if (buf[510] != 0x55 || buf[511] != 0xaa)
10916 - die("Boot block hasn't got boot flag (0xAA55)");
10917 - buf[508] = minor_root;
10918 - buf[509] = major_root;
10919 - if (write(1, buf, 512) != 512)
10920 - die("Write call failed");
10923 - file_open(argv[2]); /* Copy the setup code */
10924 - for (i=0 ; (c=read(fd, buf, sizeof(buf)))>0 ; i+=c )
10925 - if (write(1, buf, c) != c)
10926 - die("Write call failed");
10928 - die("read-error on `setup'");
10931 - setup_sectors = (i + 511) / 512; /* Pad unused space with zeros */
10932 - /* for compatibility with ancient versions of LILO. */
10933 - if (setup_sectors < SETUP_SECTS)
10934 - setup_sectors = SETUP_SECTS;
10935 - fprintf(stderr, "Setup is %d bytes.\n", i);
10936 - memset(buf, 0, sizeof(buf));
10937 - while (i < setup_sectors * 512) {
10938 - c = setup_sectors * 512 - i;
10939 - if (c > sizeof(buf))
10941 - if (write(1, buf, c) != c)
10942 - die("Write call failed");
10946 - file_open(argv[3]);
10947 - if (fstat (fd, &sb))
10948 - die("Unable to stat `%s': %m", argv[3]);
10950 - fprintf (stderr, "System is %d kB\n", sz/1024);
10951 - sys_size = (sz + 15) / 16;
10952 - if (!is_big_kernel && sys_size > DEF_SYSSIZE)
10953 - die("System is too big. Try using bzImage or modules.");
10957 - l = (sz > sizeof(buf)) ? sizeof(buf) : sz;
10958 - if ((n=read(fd, buf, l)) != l) {
10960 - die("Error reading %s: %m", argv[3]);
10962 - die("%s: Unexpected EOF", argv[3]);
10964 - if (write(1, buf, l) != l)
10965 - die("Write failed");
10970 - if (lseek(1, 497, SEEK_SET) != 497) /* Write sizes to the bootsector */
10971 - die("Output: seek failed");
10972 - buf[0] = setup_sectors;
10973 - if (write(1, buf, 1) != 1)
10974 - die("Write of setup sector count failed");
10975 - if (lseek(1, 500, SEEK_SET) != 500)
10976 - die("Output: seek failed");
10977 - buf[0] = (sys_size & 0xff);
10978 - buf[1] = ((sys_size >> 8) & 0xff);
10979 - buf[2] = ((sys_size >> 16) & 0xff);
10980 - buf[3] = ((sys_size >> 24) & 0xff);
10981 - if (write(1, buf, 4) != 4)
10982 - die("Write of image length failed");
10984 - return 0; /* Everything is OK */
10986 --- a/arch/x86_64/kernel/Makefile
10987 +++ b/arch/x86_64/kernel/Makefile
10990 obj-y += topology.o
10991 obj-y += intel_cacheinfo.o
10992 +obj-y += addon_cpuid_features.o
10993 obj-y += pcspeaker.o
10995 CFLAGS_vsyscall.o := $(PROFILING) -g0
10997 topology-y += ../../i386/kernel/topology.o
10998 microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o
10999 intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o
11000 +addon_cpuid_features-y += ../../i386/kernel/cpu/addon_cpuid_features.o
11001 quirks-y += ../../i386/kernel/quirks.o
11002 i8237-y += ../../i386/kernel/i8237.o
11003 msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o
11004 --- a/arch/x86_64/kernel/setup.c
11005 +++ b/arch/x86_64/kernel/setup.c
11006 @@ -846,6 +846,8 @@
11007 c->x86_capability[2] = cpuid_edx(0x80860001);
11010 + init_scattered_cpuid_features(c);
11012 c->apicid = phys_pkg_id(0);
11015 @@ -931,7 +933,7 @@
11016 "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
11017 "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
11018 "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
11019 - "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL,
11020 + "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe",
11023 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11024 @@ -947,10 +949,11 @@
11025 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11027 /* Other (Linux-defined) */
11028 - "cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL,
11029 - "constant_tsc", NULL, NULL,
11030 - "up", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11031 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11032 + "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr",
11033 + NULL, NULL, NULL, NULL,
11034 + "constant_tsc", "up", NULL, "arch_perfmon",
11035 + "pebs", "bts", NULL, "sync_rdtsc",
11036 + "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11037 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11039 /* Intel-defined (#2) */
11040 @@ -961,7 +964,7 @@
11042 /* VIA/Cyrix/Centaur-defined */
11043 NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en",
11044 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11045 + "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL,
11046 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11047 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11049 @@ -972,6 +975,12 @@
11050 "osvw", "ibs", NULL, NULL, NULL, NULL,
11051 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11052 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11054 + /* Auxiliary (Linux-defined) */
11055 + "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11056 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11057 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11058 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11060 static char *x86_power_flags[] = {
11061 "ts", /* temperature sensor */
11062 --- a/arch/x86_64/kernel/verify_cpu.S
11063 +++ b/arch/x86_64/kernel/verify_cpu.S
11065 pushl $0 # Kill any dangerous flags
11068 - /* minimum CPUID flags for x86-64 as defined by AMD */
11069 -#define M(x) (1<<(x))
11070 -#define M2(a,b) M(a)|M(b)
11071 -#define M4(a,b,c,d) M(a)|M(b)|M(c)|M(d)
11073 -#define SSE_MASK \
11074 - (M2(X86_FEATURE_XMM,X86_FEATURE_XMM2))
11075 -#define REQUIRED_MASK1 \
11076 - (M4(X86_FEATURE_FPU,X86_FEATURE_PSE,X86_FEATURE_TSC,X86_FEATURE_MSR)|\
11077 - M4(X86_FEATURE_PAE,X86_FEATURE_CX8,X86_FEATURE_PGE,X86_FEATURE_CMOV)|\
11078 - M(X86_FEATURE_FXSR))
11079 -#define REQUIRED_MASK2 \
11080 - (M(X86_FEATURE_LM - 32))
11082 pushfl # standard way to check for cpuid
11087 movl $0x1,%eax # Does the cpu have what it takes
11089 - andl $REQUIRED_MASK1,%edx
11090 - xorl $REQUIRED_MASK1,%edx
11091 + andl $REQUIRED_MASK0,%edx
11092 + xorl $REQUIRED_MASK0,%edx
11093 jnz verify_cpu_no_longmode
11095 movl $0x80000000,%eax # See if extended cpuid is implemented
11098 movl $0x80000001,%eax # Does the cpu have what it takes
11100 - andl $REQUIRED_MASK2,%edx
11101 - xorl $REQUIRED_MASK2,%edx
11102 + andl $REQUIRED_MASK1,%edx
11103 + xorl $REQUIRED_MASK1,%edx
11104 jnz verify_cpu_no_longmode
11106 verify_cpu_sse_test:
11107 --- a/drivers/ide/legacy/hd.c
11108 +++ b/drivers/ide/legacy/hd.c
11109 @@ -718,74 +718,25 @@
11110 device_timer.function = hd_times_out;
11111 blk_queue_hardsect_size(hd_queue, 512);
11115 - extern struct drive_info drive_info;
11116 - unsigned char *BIOS = (unsigned char *) &drive_info;
11117 - unsigned long flags;
11120 - for (drive=0 ; drive<2 ; drive++) {
11121 - hd_info[drive].cyl = *(unsigned short *) BIOS;
11122 - hd_info[drive].head = *(2+BIOS);
11123 - hd_info[drive].wpcom = *(unsigned short *) (5+BIOS);
11124 - hd_info[drive].ctl = *(8+BIOS);
11125 - hd_info[drive].lzone = *(unsigned short *) (12+BIOS);
11126 - hd_info[drive].sect = *(14+BIOS);
11127 -#ifdef does_not_work_for_everybody_with_scsi_but_helps_ibm_vp
11128 - if (hd_info[drive].cyl && NR_HD == drive)
11135 - We query CMOS about hard disks : it could be that
11136 - we have a SCSI/ESDI/etc controller that is BIOS
11137 - compatible with ST-506, and thus showing up in our
11138 - BIOS table, but not register compatible, and therefore
11139 - not present in CMOS.
11141 - Furthermore, we will assume that our ST-506 drives
11142 - <if any> are the primary drives in the system, and
11143 - the ones reflected as drive 1 or 2.
11145 - The first drive is stored in the high nibble of CMOS
11146 - byte 0x12, the second in the low nibble. This will be
11147 - either a 4 bit drive type or 0xf indicating use byte 0x19
11148 - for an 8 bit type, drive 1, 0x1a for drive 2 in CMOS.
11150 - Needless to say, a non-zero value means we have
11151 - an AT controller hard disk for that drive.
11153 - Currently the rtc_lock is a bit academic since this
11154 - driver is non-modular, but someday... ? Paul G.
11157 - spin_lock_irqsave(&rtc_lock, flags);
11158 - cmos_disks = CMOS_READ(0x12);
11159 - spin_unlock_irqrestore(&rtc_lock, flags);
11161 - if (cmos_disks & 0xf0) {
11162 - if (cmos_disks & 0x0f)
11168 -#endif /* __i386__ */
11171 - /* We don't know anything about the drive. This means
11173 + * We don't know anything about the drive. This means
11174 * that you *MUST* specify the drive parameters to the
11177 + * If we were on an i386, we used to read this info from
11178 + * the BIOS or CMOS. This doesn't work all that well,
11179 + * since this assumes that this is a primary or secondary
11180 + * drive, and if we're using this legacy driver, it's
11181 + * probably an auxilliary controller added to recover
11182 + * legacy data off an ST-506 drive. Either way, it's
11183 + * definitely safest to have the user explicitly specify
11184 + * the information.
11186 printk("hd: no drives specified - use hd=cyl,head,sectors"
11187 " on kernel command line\n");
11194 for (drive=0 ; drive < NR_HD ; drive++) {
11195 struct gendisk *disk = alloc_disk(64);
11196 --- a/include/asm-i386/boot.h
11197 +++ b/include/asm-i386/boot.h
11199 -#ifndef _LINUX_BOOT_H
11200 -#define _LINUX_BOOT_H
11201 +#ifndef _ASM_BOOT_H
11202 +#define _ASM_BOOT_H
11204 /* Don't touch these, unless you really know what you're doing. */
11205 #define DEF_INITSEG 0x9000
11207 + (CONFIG_PHYSICAL_ALIGN - 1)) \
11208 & ~(CONFIG_PHYSICAL_ALIGN - 1))
11210 -#endif /* _LINUX_BOOT_H */
11211 +#endif /* _ASM_BOOT_H */
11213 +++ b/include/asm-i386/bootparam.h
11215 +#ifndef _ASM_BOOTPARAM_H
11216 +#define _ASM_BOOTPARAM_H
11218 +#include <linux/types.h>
11219 +#include <linux/screen_info.h>
11220 +#include <linux/apm_bios.h>
11221 +#include <asm/e820.h>
11222 +#include <linux/edd.h>
11223 +#include <video/edid.h>
11225 +struct setup_header {
11236 + u32 realmode_swtch;
11238 + u16 kernel_version;
11239 + u8 type_of_loader;
11241 +#define LOADED_HIGH 0x01
11242 +#define CAN_USE_HEAP 0x80
11243 + u16 setup_move_size;
11244 + u32 code32_start;
11245 + u32 ramdisk_image;
11246 + u32 ramdisk_size;
11247 + u32 bootsect_kludge;
11248 + u16 heap_end_ptr;
11250 + u32 cmd_line_ptr;
11251 + u32 initrd_addr_max;
11252 + u32 kernel_alignment;
11253 + u8 relocatable_kernel;
11254 +} __attribute__((packed));
11256 +struct sys_desc_table {
11264 + u32 efi_memdesc_size;
11265 + u32 efi_memdec_version;
11267 + u32 fi_memmap_size;
11271 +/* The so-called "zeropage" */
11272 +struct boot_params {
11273 + struct screen_info screen_info; /* 0x000 */
11274 + struct apm_bios_info apm_bios_info; /* 0x040 */
11275 + u8 _pad2[12]; /* 0x054 */
11276 + u32 speedstep_info[4]; /* 0x060 */
11277 + u8 _pad3[16]; /* 0x070 */
11278 + u8 hd0_info[16]; /* obsolete! */ /* 0x080 */
11279 + u8 hd1_info[16]; /* obsolete! */ /* 0x090 */
11280 + struct sys_desc_table sys_desc_table; /* 0x0a0 */
11281 + u8 _pad4[144]; /* 0x0b0 */
11282 + struct edid_info edid_info; /* 0x140 */
11283 + struct efi_info efi_info; /* 0x1c0 */
11284 + u32 alt_mem_k; /* 0x1e0 */
11285 + u32 scratch; /* Scratch field! */ /* 0x1e4 */
11286 + u8 e820_entries; /* 0x1e8 */
11287 + u8 eddbuf_entries; /* 0x1e9 */
11288 + u8 edd_mbr_sig_buf_entries; /* 0x1ea */
11289 + u8 _pad6[6]; /* 0x1eb */
11290 + struct setup_header hdr; /* setup header */ /* 0x1f1 */
11291 + u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)];
11292 + u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */
11293 + struct e820entry e820_map[E820MAX]; /* 0x2d0 */
11294 + u8 _pad8[48]; /* 0xcd0 */
11295 + struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */
11296 + u8 _pad9[276]; /* 0xeec */
11297 +} __attribute__((packed));
11299 +#endif /* _ASM_BOOTPARAM_H */
11300 --- a/include/asm-i386/cpufeature.h
11301 +++ b/include/asm-i386/cpufeature.h
11304 #include <asm/required-features.h>
11306 -#define NCAPINTS 7 /* N 32-bit words worth of info */
11307 +#define NCAPINTS 8 /* N 32-bit words worth of info */
11309 /* Intel-defined CPU features, CPUID level 0x00000001 (edx), word 0 */
11310 #define X86_FEATURE_FPU (0*32+ 0) /* Onboard FPU */
11312 #define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */
11314 #define X86_FEATURE_SYNC_RDTSC (3*32+15) /* RDTSC synchronizes the CPU */
11315 +#define X86_FEATURE_REP_GOOD (3*32+16) /* rep microcode works well on this CPU */
11317 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
11318 #define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
11319 @@ -108,11 +109,24 @@
11320 #define X86_FEATURE_LAHF_LM (6*32+ 0) /* LAHF/SAHF in long mode */
11321 #define X86_FEATURE_CMP_LEGACY (6*32+ 1) /* If yes HyperThreading not valid */
11323 -#define cpu_has(c, bit) \
11324 - ((__builtin_constant_p(bit) && (bit) < 32 && \
11325 - (1UL << (bit)) & REQUIRED_MASK1) ? \
11327 - test_bit(bit, (c)->x86_capability))
11329 + * Auxiliary flags: Linux defined - For features scattered in various
11330 + * CPUID levels like 0x6, 0xA etc
11332 +#define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */
11334 +#define cpu_has(c, bit) \
11335 + (__builtin_constant_p(bit) && \
11336 + ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \
11337 + (((bit)>>5)==1 && (1UL<<((bit)&31) & REQUIRED_MASK1)) || \
11338 + (((bit)>>5)==2 && (1UL<<((bit)&31) & REQUIRED_MASK2)) || \
11339 + (((bit)>>5)==3 && (1UL<<((bit)&31) & REQUIRED_MASK3)) || \
11340 + (((bit)>>5)==4 && (1UL<<((bit)&31) & REQUIRED_MASK4)) || \
11341 + (((bit)>>5)==5 && (1UL<<((bit)&31) & REQUIRED_MASK5)) || \
11342 + (((bit)>>5)==6 && (1UL<<((bit)&31) & REQUIRED_MASK6)) || \
11343 + (((bit)>>5)==7 && (1UL<<((bit)&31) & REQUIRED_MASK7)) ) \
11345 + test_bit(bit, (c)->x86_capability))
11346 #define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit)
11348 #define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU)
11349 --- a/include/asm-i386/e820.h
11350 +++ b/include/asm-i386/e820.h
11351 @@ -25,13 +25,15 @@
11353 #ifndef __ASSEMBLY__
11355 +struct e820entry {
11356 + u64 addr; /* start of memory segment */
11357 + u64 size; /* size of memory segment */
11358 + u32 type; /* type of memory segment */
11359 +} __attribute__((packed));
11363 - struct e820entry {
11364 - unsigned long long addr; /* start of memory segment */
11365 - unsigned long long size; /* size of memory segment */
11366 - unsigned long type; /* type of memory segment */
11369 + struct e820entry map[E820MAX];
11372 extern struct e820map e820;
11373 --- a/include/asm-i386/processor.h
11374 +++ b/include/asm-i386/processor.h
11375 @@ -119,6 +119,7 @@
11376 extern void identify_boot_cpu(void);
11377 extern void identify_secondary_cpu(struct cpuinfo_x86 *);
11378 extern void print_cpu_info(struct cpuinfo_x86 *);
11379 +extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
11380 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
11381 extern unsigned short num_cache_leaves;
11383 --- a/include/asm-i386/required-features.h
11384 +++ b/include/asm-i386/required-features.h
11387 /* Define minimum CPUID feature set for kernel These bits are checked
11388 really early to actually display a visible error message before the
11389 - kernel dies. Only add word 0 bits here
11390 + kernel dies. Make sure to assign features to the proper mask!
11392 Some requirements that are not in CPUID yet are also in the
11393 CONFIG_X86_MINIMUM_CPU mode which is checked too.
11394 @@ -11,24 +11,45 @@
11395 The real information is in arch/i386/Kconfig.cpu, this just converts
11396 the CONFIGs into a bitmask */
11398 +#ifndef CONFIG_MATH_EMULATION
11399 +# define NEED_FPU (1<<(X86_FEATURE_FPU & 31))
11401 +# define NEED_FPU 0
11404 #ifdef CONFIG_X86_PAE
11405 -#define NEED_PAE (1<<X86_FEATURE_PAE)
11406 +# define NEED_PAE (1<<(X86_FEATURE_PAE & 31))
11408 -#define NEED_PAE 0
11409 +# define NEED_PAE 0
11412 #ifdef CONFIG_X86_CMOV
11413 -#define NEED_CMOV (1<<X86_FEATURE_CMOV)
11414 +# define NEED_CMOV (1<<(X86_FEATURE_CMOV & 31))
11416 -#define NEED_CMOV 0
11417 +# define NEED_CMOV 0
11420 #ifdef CONFIG_X86_CMPXCHG64
11421 -#define NEED_CMPXCHG64 (1<<X86_FEATURE_CX8)
11422 +# define NEED_CX8 (1<<(X86_FEATURE_CX8 & 31))
11424 +# define NEED_CX8 0
11427 +#define REQUIRED_MASK0 (NEED_FPU|NEED_PAE|NEED_CMOV|NEED_CX8)
11429 +#ifdef CONFIG_X86_USE_3DNOW
11430 +# define NEED_3DNOW (1<<(X86_FEATURE_3DNOW & 31))
11432 -#define NEED_CMPXCHG64 0
11433 +# define NEED_3DNOW 0
11436 -#define REQUIRED_MASK1 (NEED_PAE|NEED_CMOV|NEED_CMPXCHG64)
11437 +#define REQUIRED_MASK1 (NEED_3DNOW)
11439 +#define REQUIRED_MASK2 0
11440 +#define REQUIRED_MASK3 0
11441 +#define REQUIRED_MASK4 0
11442 +#define REQUIRED_MASK5 0
11443 +#define REQUIRED_MASK6 0
11444 +#define REQUIRED_MASK7 0
11447 --- a/include/asm-i386/setup.h
11448 +++ b/include/asm-i386/setup.h
11449 @@ -26,12 +26,15 @@
11450 #define NEW_CL_POINTER 0x228 /* Relative to real mode data */
11452 #ifndef __ASSEMBLY__
11454 +#include <asm/bootparam.h>
11457 * This is set up by the setup-routine at boot-time
11459 -extern unsigned char boot_params[PARAM_SIZE];
11460 +extern struct boot_params boot_params;
11462 -#define PARAM (boot_params)
11463 +#define PARAM ((char *)&boot_params)
11464 #define SCREEN_INFO (*(struct screen_info *) (PARAM+0))
11465 #define EXT_MEM_K (*(unsigned short *) (PARAM+2))
11466 #define ALT_MEM_K (*(unsigned long *) (PARAM+0x1e0))
11468 #define E820_MAP ((struct e820entry *) (PARAM+E820MAP))
11469 #define APM_BIOS_INFO (*(struct apm_bios_info *) (PARAM+0x40))
11470 #define IST_INFO (*(struct ist_info *) (PARAM+0x60))
11471 -#define DRIVE_INFO (*(struct drive_info_struct *) (PARAM+0x80))
11472 -#define SYS_DESC_TABLE (*(struct sys_desc_table_struct*)(PARAM+0xa0))
11473 +#define SYS_DESC_TABLE (*(struct sys_desc_table *)(PARAM+0xa0))
11474 #define EFI_SYSTAB ((efi_system_table_t *) *((unsigned long *)(PARAM+0x1c4)))
11475 #define EFI_MEMDESC_SIZE (*((unsigned long *) (PARAM+0x1c8)))
11476 #define EFI_MEMDESC_VERSION (*((unsigned long *) (PARAM+0x1cc)))
11477 --- a/include/asm-x86_64/alternative.h
11478 +++ b/include/asm-x86_64/alternative.h
11481 #include <linux/types.h>
11482 #include <linux/stddef.h>
11485 + * Alternative inline assembly for SMP.
11487 + * The LOCK_PREFIX macro defined here replaces the LOCK and
11488 + * LOCK_PREFIX macros used everywhere in the source tree.
11490 + * SMP alternatives use the same data structures as the other
11491 + * alternatives and the X86_FEATURE_UP flag to indicate the case of a
11492 + * UP system running a SMP kernel. The existing apply_alternatives()
11493 + * works fine for patching a SMP kernel for UP.
11495 + * The SMP alternative tables can be kept after boot and contain both
11496 + * UP and SMP versions of the instructions to allow switching back to
11497 + * SMP at runtime, when hotplugging in a new CPU, which is especially
11498 + * useful in virtualized environments.
11500 + * The very common lock prefix is handled as special case in a
11501 + * separate table which is a pure address list without replacement ptr
11502 + * and size information. That keeps the table sizes small.
11506 +#define LOCK_PREFIX \
11507 + ".section .smp_locks,\"a\"\n" \
11509 + " .quad 661f\n" /* address */ \
11513 +#else /* ! CONFIG_SMP */
11514 +#define LOCK_PREFIX ""
11517 +/* This must be included *after* the definition of LOCK_PREFIX */
11518 #include <asm/cpufeature.h>
11521 @@ -108,39 +143,6 @@
11523 #define ASM_OUTPUT2(a, b) a, b
11526 - * Alternative inline assembly for SMP.
11528 - * The LOCK_PREFIX macro defined here replaces the LOCK and
11529 - * LOCK_PREFIX macros used everywhere in the source tree.
11531 - * SMP alternatives use the same data structures as the other
11532 - * alternatives and the X86_FEATURE_UP flag to indicate the case of a
11533 - * UP system running a SMP kernel. The existing apply_alternatives()
11534 - * works fine for patching a SMP kernel for UP.
11536 - * The SMP alternative tables can be kept after boot and contain both
11537 - * UP and SMP versions of the instructions to allow switching back to
11538 - * SMP at runtime, when hotplugging in a new CPU, which is especially
11539 - * useful in virtualized environments.
11541 - * The very common lock prefix is handled as special case in a
11542 - * separate table which is a pure address list without replacement ptr
11543 - * and size information. That keeps the table sizes small.
11547 -#define LOCK_PREFIX \
11548 - ".section .smp_locks,\"a\"\n" \
11550 - " .quad 661f\n" /* address */ \
11554 -#else /* ! CONFIG_SMP */
11555 -#define LOCK_PREFIX ""
11558 struct paravirt_patch;
11559 #ifdef CONFIG_PARAVIRT
11560 void apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end);
11561 --- a/include/asm-x86_64/boot.h
11562 +++ b/include/asm-x86_64/boot.h
11564 -#ifndef _LINUX_BOOT_H
11565 -#define _LINUX_BOOT_H
11567 -/* Don't touch these, unless you really know what you're doing. */
11568 -#define DEF_INITSEG 0x9000
11569 -#define DEF_SYSSEG 0x1000
11570 -#define DEF_SETUPSEG 0x9020
11571 -#define DEF_SYSSIZE 0x7F00
11573 -/* Internal svga startup constants */
11574 -#define NORMAL_VGA 0xffff /* 80x25 mode */
11575 -#define EXTENDED_VGA 0xfffe /* 80x50 mode */
11576 -#define ASK_VGA 0xfffd /* ask for it at bootup */
11579 +#include <asm-i386/boot.h>
11581 +++ b/include/asm-x86_64/bootparam.h
11583 +#include <asm-i386/bootparam.h>
11584 --- a/include/asm-x86_64/cpufeature.h
11585 +++ b/include/asm-x86_64/cpufeature.h
11587 #ifndef __ASM_X8664_CPUFEATURE_H
11588 #define __ASM_X8664_CPUFEATURE_H
11590 -#define NCAPINTS 7 /* N 32-bit words worth of info */
11591 +#include <asm-i386/cpufeature.h>
11593 -/* Intel-defined CPU features, CPUID level 0x00000001, word 0 */
11594 -#define X86_FEATURE_FPU (0*32+ 0) /* Onboard FPU */
11595 -#define X86_FEATURE_VME (0*32+ 1) /* Virtual Mode Extensions */
11596 -#define X86_FEATURE_DE (0*32+ 2) /* Debugging Extensions */
11597 -#define X86_FEATURE_PSE (0*32+ 3) /* Page Size Extensions */
11598 -#define X86_FEATURE_TSC (0*32+ 4) /* Time Stamp Counter */
11599 -#define X86_FEATURE_MSR (0*32+ 5) /* Model-Specific Registers, RDMSR, WRMSR */
11600 -#define X86_FEATURE_PAE (0*32+ 6) /* Physical Address Extensions */
11601 -#define X86_FEATURE_MCE (0*32+ 7) /* Machine Check Architecture */
11602 -#define X86_FEATURE_CX8 (0*32+ 8) /* CMPXCHG8 instruction */
11603 -#define X86_FEATURE_APIC (0*32+ 9) /* Onboard APIC */
11604 -#define X86_FEATURE_SEP (0*32+11) /* SYSENTER/SYSEXIT */
11605 -#define X86_FEATURE_MTRR (0*32+12) /* Memory Type Range Registers */
11606 -#define X86_FEATURE_PGE (0*32+13) /* Page Global Enable */
11607 -#define X86_FEATURE_MCA (0*32+14) /* Machine Check Architecture */
11608 -#define X86_FEATURE_CMOV (0*32+15) /* CMOV instruction (FCMOVCC and FCOMI too if FPU present) */
11609 -#define X86_FEATURE_PAT (0*32+16) /* Page Attribute Table */
11610 -#define X86_FEATURE_PSE36 (0*32+17) /* 36-bit PSEs */
11611 -#define X86_FEATURE_PN (0*32+18) /* Processor serial number */
11612 -#define X86_FEATURE_CLFLSH (0*32+19) /* Supports the CLFLUSH instruction */
11613 -#define X86_FEATURE_DS (0*32+21) /* Debug Store */
11614 -#define X86_FEATURE_ACPI (0*32+22) /* ACPI via MSR */
11615 -#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */
11616 -#define X86_FEATURE_FXSR (0*32+24) /* FXSAVE and FXRSTOR instructions (fast save and restore */
11617 - /* of FPU context), and CR4.OSFXSR available */
11618 -#define X86_FEATURE_XMM (0*32+25) /* Streaming SIMD Extensions */
11619 -#define X86_FEATURE_XMM2 (0*32+26) /* Streaming SIMD Extensions-2 */
11620 -#define X86_FEATURE_SELFSNOOP (0*32+27) /* CPU self snoop */
11621 -#define X86_FEATURE_HT (0*32+28) /* Hyper-Threading */
11622 -#define X86_FEATURE_ACC (0*32+29) /* Automatic clock control */
11623 -#define X86_FEATURE_IA64 (0*32+30) /* IA-64 processor */
11625 -/* AMD-defined CPU features, CPUID level 0x80000001, word 1 */
11626 -/* Don't duplicate feature flags which are redundant with Intel! */
11627 -#define X86_FEATURE_SYSCALL (1*32+11) /* SYSCALL/SYSRET */
11628 -#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */
11629 -#define X86_FEATURE_FXSR_OPT (1*32+25) /* FXSR optimizations */
11630 -#define X86_FEATURE_RDTSCP (1*32+27) /* RDTSCP */
11631 -#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */
11632 -#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */
11633 -#define X86_FEATURE_3DNOW (1*32+31) /* 3DNow! */
11635 -/* Transmeta-defined CPU features, CPUID level 0x80860001, word 2 */
11636 -#define X86_FEATURE_RECOVERY (2*32+ 0) /* CPU in recovery mode */
11637 -#define X86_FEATURE_LONGRUN (2*32+ 1) /* Longrun power control */
11638 -#define X86_FEATURE_LRTI (2*32+ 3) /* LongRun table interface */
11640 -/* Other features, Linux-defined mapping, word 3 */
11641 -/* This range is used for feature bits which conflict or are synthesized */
11642 -#define X86_FEATURE_CXMMX (3*32+ 0) /* Cyrix MMX extensions */
11643 -#define X86_FEATURE_K6_MTRR (3*32+ 1) /* AMD K6 nonstandard MTRRs */
11644 -#define X86_FEATURE_CYRIX_ARR (3*32+ 2) /* Cyrix ARRs (= MTRRs) */
11645 -#define X86_FEATURE_CENTAUR_MCR (3*32+ 3) /* Centaur MCRs (= MTRRs) */
11646 -#define X86_FEATURE_REP_GOOD (3*32+ 4) /* rep microcode works well on this CPU */
11647 -#define X86_FEATURE_CONSTANT_TSC (3*32+5) /* TSC runs at constant rate */
11648 -#define X86_FEATURE_SYNC_RDTSC (3*32+6) /* RDTSC syncs CPU core */
11649 -#define X86_FEATURE_FXSAVE_LEAK (3*32+7) /* FIP/FOP/FDP leaks through FXSAVE */
11650 -#define X86_FEATURE_UP (3*32+8) /* SMP kernel running on UP */
11651 -#define X86_FEATURE_ARCH_PERFMON (3*32+9) /* Intel Architectural PerfMon */
11652 -#define X86_FEATURE_PEBS (3*32+10) /* Precise-Event Based Sampling */
11653 -#define X86_FEATURE_BTS (3*32+11) /* Branch Trace Store */
11655 -/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
11656 -#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
11657 -#define X86_FEATURE_MWAIT (4*32+ 3) /* Monitor/Mwait support */
11658 -#define X86_FEATURE_DSCPL (4*32+ 4) /* CPL Qualified Debug Store */
11659 -#define X86_FEATURE_EST (4*32+ 7) /* Enhanced SpeedStep */
11660 -#define X86_FEATURE_TM2 (4*32+ 8) /* Thermal Monitor 2 */
11661 -#define X86_FEATURE_CID (4*32+10) /* Context ID */
11662 -#define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */
11663 -#define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */
11665 -/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */
11666 -#define X86_FEATURE_XSTORE (5*32+ 2) /* on-CPU RNG present (xstore insn) */
11667 -#define X86_FEATURE_XSTORE_EN (5*32+ 3) /* on-CPU RNG enabled */
11668 -#define X86_FEATURE_XCRYPT (5*32+ 6) /* on-CPU crypto (xcrypt insn) */
11669 -#define X86_FEATURE_XCRYPT_EN (5*32+ 7) /* on-CPU crypto enabled */
11671 -/* More extended AMD flags: CPUID level 0x80000001, ecx, word 6 */
11672 -#define X86_FEATURE_LAHF_LM (6*32+ 0) /* LAHF/SAHF in long mode */
11673 -#define X86_FEATURE_CMP_LEGACY (6*32+ 1) /* If yes HyperThreading not valid */
11675 -#define cpu_has(c, bit) test_bit(bit, (c)->x86_capability)
11676 -#define boot_cpu_has(bit) test_bit(bit, boot_cpu_data.x86_capability)
11678 -#define cpu_has_fpu 1
11679 +#undef cpu_has_vme
11680 #define cpu_has_vme 0
11681 -#define cpu_has_de 1
11682 -#define cpu_has_pse 1
11683 -#define cpu_has_tsc 1
11685 +#undef cpu_has_pae
11686 #define cpu_has_pae ___BUG___
11687 -#define cpu_has_pge 1
11688 -#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)
11689 -#define cpu_has_mtrr 1
11690 -#define cpu_has_mmx 1
11691 -#define cpu_has_fxsr 1
11692 -#define cpu_has_xmm 1
11693 -#define cpu_has_xmm2 1
11694 -#define cpu_has_xmm3 boot_cpu_has(X86_FEATURE_XMM3)
11695 -#define cpu_has_ht boot_cpu_has(X86_FEATURE_HT)
11698 #define cpu_has_mp 1 /* XXX */
11700 +#undef cpu_has_k6_mtrr
11701 #define cpu_has_k6_mtrr 0
11703 +#undef cpu_has_cyrix_arr
11704 #define cpu_has_cyrix_arr 0
11706 +#undef cpu_has_centaur_mcr
11707 #define cpu_has_centaur_mcr 0
11708 -#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH)
11709 -#define cpu_has_ds boot_cpu_has(X86_FEATURE_DS)
11710 -#define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS)
11711 -#define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS)
11713 #endif /* __ASM_X8664_CPUFEATURE_H */
11714 --- a/include/asm-x86_64/e820.h
11715 +++ b/include/asm-x86_64/e820.h
11717 #ifndef __E820_HEADER
11718 #define __E820_HEADER
11720 -#include <linux/mmzone.h>
11722 +# include <linux/mmzone.h>
11725 #define E820MAP 0x2d0 /* our map */
11726 #define E820MAX 128 /* number of entries in E820MAP */
11728 } __attribute__((packed));
11733 struct e820entry map[E820MAX];
11736 --- a/include/asm-x86_64/processor.h
11737 +++ b/include/asm-x86_64/processor.h
11738 @@ -100,6 +100,7 @@
11740 extern void identify_cpu(struct cpuinfo_x86 *);
11741 extern void print_cpu_info(struct cpuinfo_x86 *);
11742 +extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
11743 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
11744 extern unsigned short num_cache_leaves;
11746 @@ -368,8 +369,6 @@
11747 asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory");
11750 -#define cpu_has_fpu 1
11752 #define ARCH_HAS_PREFETCH
11753 static inline void prefetch(void *x)
11756 +++ b/include/asm-x86_64/required-features.h
11758 +#ifndef _ASM_REQUIRED_FEATURES_H
11759 +#define _ASM_REQUIRED_FEATURES_H 1
11761 +/* Define minimum CPUID feature set for kernel These bits are checked
11762 + really early to actually display a visible error message before the
11763 + kernel dies. Make sure to assign features to the proper mask!
11765 + The real information is in arch/x86_64/Kconfig.cpu, this just converts
11766 + the CONFIGs into a bitmask */
11768 +/* x86-64 baseline features */
11769 +#define NEED_FPU (1<<(X86_FEATURE_FPU & 31))
11770 +#define NEED_PSE (1<<(X86_FEATURE_PSE & 31))
11771 +#define NEED_MSR (1<<(X86_FEATURE_MSR & 31))
11772 +#define NEED_PAE (1<<(X86_FEATURE_PAE & 31))
11773 +#define NEED_CX8 (1<<(X86_FEATURE_CX8 & 31))
11774 +#define NEED_PGE (1<<(X86_FEATURE_PGE & 31))
11775 +#define NEED_FXSR (1<<(X86_FEATURE_FXSR & 31))
11776 +#define NEED_CMOV (1<<(X86_FEATURE_CMOV & 31))
11777 +#define NEED_XMM (1<<(X86_FEATURE_XMM & 31))
11778 +#define NEED_XMM2 (1<<(X86_FEATURE_XMM2 & 31))
11780 +#define REQUIRED_MASK0 (NEED_FPU|NEED_PSE|NEED_MSR|NEED_PAE|\
11781 + NEED_CX8|NEED_PGE|NEED_FXSR|NEED_CMOV|\
11782 + NEED_XMM|NEED_XMM2)
11783 +#define SSE_MASK (NEED_XMM|NEED_XMM2)
11785 +/* x86-64 baseline features */
11786 +#define NEED_LM (1<<(X86_FEATURE_LM & 31))
11788 +#ifdef CONFIG_X86_USE_3DNOW
11789 +# define NEED_3DNOW (1<<(X86_FEATURE_3DNOW & 31))
11791 +# define NEED_3DNOW 0
11794 +#define REQUIRED_MASK1 (NEED_LM|NEED_3DNOW)
11796 +#define REQUIRED_MASK2 0
11797 +#define REQUIRED_MASK3 0
11798 +#define REQUIRED_MASK4 0
11799 +#define REQUIRED_MASK5 0
11800 +#define REQUIRED_MASK6 0
11801 +#define REQUIRED_MASK7 0
11804 --- a/include/asm-x86_64/segment.h
11805 +++ b/include/asm-x86_64/segment.h
11808 #include <asm/cache.h>
11810 +/* Simple and small GDT entries for booting only */
11812 +#define GDT_ENTRY_BOOT_CS 2
11813 +#define __BOOT_CS (GDT_ENTRY_BOOT_CS * 8)
11815 +#define GDT_ENTRY_BOOT_DS (GDT_ENTRY_BOOT_CS + 1)
11816 +#define __BOOT_DS (GDT_ENTRY_BOOT_DS * 8)
11818 #define __KERNEL_CS 0x10
11819 #define __KERNEL_DS 0x18
11821 --- a/include/linux/edd.h
11822 +++ b/include/linux/edd.h
11824 #define EDD_MBR_SIG_MAX 16 /* max number of signatures to store */
11825 #define EDD_MBR_SIG_NR_BUF 0x1ea /* addr of number of MBR signtaures at EDD_MBR_SIG_BUF
11826 in boot_params - treat this as 1 byte */
11827 -#define EDD_CL_EQUALS 0x3d646465 /* "edd=" */
11828 -#define EDD_CL_OFF 0x666f /* "of" for off */
11829 -#define EDD_CL_SKIP 0x6b73 /* "sk" for skipmbr */
11830 -#define EDD_CL_ON 0x6e6f /* "on" for on */
11832 #ifndef __ASSEMBLY__
11834 --- a/include/linux/screen_info.h
11835 +++ b/include/linux/screen_info.h
11837 struct screen_info {
11838 u8 orig_x; /* 0x00 */
11839 u8 orig_y; /* 0x01 */
11840 - u16 dontuse1; /* 0x02 -- EXT_MEM_K sits here */
11841 + u16 ext_mem_k; /* 0x02 */
11842 u16 orig_video_page; /* 0x04 */
11843 u8 orig_video_mode; /* 0x06 */
11844 u8 orig_video_cols; /* 0x07 */
11846 u16 lfb_depth; /* 0x16 */
11847 u32 lfb_base; /* 0x18 */
11848 u32 lfb_size; /* 0x1c */
11849 - u16 dontuse2, dontuse3; /* 0x20 -- CL_MAGIC and CL_OFFSET here */
11850 + u16 cl_magic, cl_offset; /* 0x20 */
11851 u16 lfb_linelength; /* 0x24 */
11852 u8 red_size; /* 0x26 */
11853 u8 red_pos; /* 0x27 */
11855 u16 pages; /* 0x32 */
11856 u16 vesa_attributes; /* 0x34 */
11857 u32 capabilities; /* 0x36 */
11858 - /* 0x3a -- 0x3b reserved for future expansion */
11859 - /* 0x3c -- 0x3f micro stack for relocatable kernels */
11861 + u8 _reserved[6]; /* 0x3a */
11862 +} __attribute__((packed));
11864 extern struct screen_info screen_info;