From 96ae6ea0be1b902c28b3b463c27da42b41e2b63a Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 11 Oct 2007 11:16:45 +0200 Subject: i386: move boot Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar --- arch/i386/Makefile | 9 +- arch/i386/boot/.gitignore | 5 - arch/i386/boot/Makefile | 171 ---------------- arch/i386/boot/a20.c | 161 --------------- arch/i386/boot/apm.c | 98 --------- arch/i386/boot/bitops.h | 45 ---- arch/i386/boot/boot.h | 296 -------------------------- arch/i386/boot/cmdline.c | 97 --------- arch/i386/boot/code16gcc.h | 15 -- arch/i386/boot/copy.S | 101 --------- arch/i386/boot/cpu.c | 69 ------- arch/i386/boot/cpucheck.c | 268 ------------------------ arch/i386/boot/edd.c | 167 --------------- arch/i386/boot/header.S | 283 ------------------------- arch/i386/boot/install.sh | 61 ------ arch/i386/boot/main.c | 161 --------------- arch/i386/boot/mca.c | 43 ---- arch/i386/boot/memory.c | 118 ----------- arch/i386/boot/mtools.conf.in | 17 -- arch/i386/boot/pm.c | 174 ---------------- arch/i386/boot/pmjump.S | 54 ----- arch/i386/boot/printf.c | 307 --------------------------- arch/i386/boot/setup.ld | 54 ----- arch/i386/boot/string.c | 52 ----- arch/i386/boot/tty.c | 112 ---------- arch/i386/boot/version.c | 23 --- arch/i386/boot/vesa.h | 79 ------- arch/i386/boot/video-bios.c | 125 ----------- arch/i386/boot/video-vesa.c | 292 -------------------------- arch/i386/boot/video-vga.c | 261 ----------------------- arch/i386/boot/video.c | 467 ------------------------------------------ arch/i386/boot/video.h | 152 -------------- arch/i386/boot/voyager.c | 46 ----- arch/x86/boot/.gitignore | 5 + arch/x86/boot/Makefile | 171 ++++++++++++++++ arch/x86/boot/a20.c | 161 +++++++++++++++ arch/x86/boot/apm.c | 98 +++++++++ arch/x86/boot/bitops.h | 45 ++++ arch/x86/boot/boot.h | 296 ++++++++++++++++++++++++++ arch/x86/boot/cmdline.c | 97 +++++++++ arch/x86/boot/code16gcc.h | 15 ++ arch/x86/boot/copy.S | 101 +++++++++ arch/x86/boot/cpu.c | 69 +++++++ arch/x86/boot/cpucheck.c | 268 ++++++++++++++++++++++++ arch/x86/boot/edd.c | 167 +++++++++++++++ arch/x86/boot/header.S | 283 +++++++++++++++++++++++++ arch/x86/boot/install.sh | 61 ++++++ arch/x86/boot/main.c | 161 +++++++++++++++ arch/x86/boot/mca.c | 43 ++++ arch/x86/boot/memory.c | 118 +++++++++++ arch/x86/boot/mtools.conf.in | 17 ++ arch/x86/boot/pm.c | 174 ++++++++++++++++ arch/x86/boot/pmjump.S | 54 +++++ arch/x86/boot/printf.c | 307 +++++++++++++++++++++++++++ arch/x86/boot/setup.ld | 54 +++++ arch/x86/boot/string.c | 52 +++++ arch/x86/boot/tty.c | 112 ++++++++++ arch/x86/boot/version.c | 23 +++ arch/x86/boot/vesa.h | 79 +++++++ arch/x86/boot/video-bios.c | 125 +++++++++++ arch/x86/boot/video-vesa.c | 292 ++++++++++++++++++++++++++ arch/x86/boot/video-vga.c | 261 +++++++++++++++++++++++ arch/x86/boot/video.c | 467 ++++++++++++++++++++++++++++++++++++++++++ arch/x86/boot/video.h | 152 ++++++++++++++ arch/x86/boot/voyager.c | 46 +++++ arch/x86_64/boot/Makefile | 2 +- 66 files changed, 4381 insertions(+), 4378 deletions(-) delete mode 100644 arch/i386/boot/.gitignore delete mode 100644 arch/i386/boot/Makefile delete mode 100644 arch/i386/boot/a20.c delete mode 100644 arch/i386/boot/apm.c delete mode 100644 arch/i386/boot/bitops.h delete mode 100644 arch/i386/boot/boot.h delete mode 100644 arch/i386/boot/cmdline.c delete mode 100644 arch/i386/boot/code16gcc.h delete mode 100644 arch/i386/boot/copy.S delete mode 100644 arch/i386/boot/cpu.c delete mode 100644 arch/i386/boot/cpucheck.c delete mode 100644 arch/i386/boot/edd.c delete mode 100644 arch/i386/boot/header.S delete mode 100644 arch/i386/boot/install.sh delete mode 100644 arch/i386/boot/main.c delete mode 100644 arch/i386/boot/mca.c delete mode 100644 arch/i386/boot/memory.c delete mode 100644 arch/i386/boot/mtools.conf.in delete mode 100644 arch/i386/boot/pm.c delete mode 100644 arch/i386/boot/pmjump.S delete mode 100644 arch/i386/boot/printf.c delete mode 100644 arch/i386/boot/setup.ld delete mode 100644 arch/i386/boot/string.c delete mode 100644 arch/i386/boot/tty.c delete mode 100644 arch/i386/boot/version.c delete mode 100644 arch/i386/boot/vesa.h delete mode 100644 arch/i386/boot/video-bios.c delete mode 100644 arch/i386/boot/video-vesa.c delete mode 100644 arch/i386/boot/video-vga.c delete mode 100644 arch/i386/boot/video.c delete mode 100644 arch/i386/boot/video.h delete mode 100644 arch/i386/boot/voyager.c create mode 100644 arch/x86/boot/.gitignore create mode 100644 arch/x86/boot/Makefile create mode 100644 arch/x86/boot/a20.c create mode 100644 arch/x86/boot/apm.c create mode 100644 arch/x86/boot/bitops.h create mode 100644 arch/x86/boot/boot.h create mode 100644 arch/x86/boot/cmdline.c create mode 100644 arch/x86/boot/code16gcc.h create mode 100644 arch/x86/boot/copy.S create mode 100644 arch/x86/boot/cpu.c create mode 100644 arch/x86/boot/cpucheck.c create mode 100644 arch/x86/boot/edd.c create mode 100644 arch/x86/boot/header.S create mode 100644 arch/x86/boot/install.sh create mode 100644 arch/x86/boot/main.c create mode 100644 arch/x86/boot/mca.c create mode 100644 arch/x86/boot/memory.c create mode 100644 arch/x86/boot/mtools.conf.in create mode 100644 arch/x86/boot/pm.c create mode 100644 arch/x86/boot/pmjump.S create mode 100644 arch/x86/boot/printf.c create mode 100644 arch/x86/boot/setup.ld create mode 100644 arch/x86/boot/string.c create mode 100644 arch/x86/boot/tty.c create mode 100644 arch/x86/boot/version.c create mode 100644 arch/x86/boot/vesa.h create mode 100644 arch/x86/boot/video-bios.c create mode 100644 arch/x86/boot/video-vesa.c create mode 100644 arch/x86/boot/video-vga.c create mode 100644 arch/x86/boot/video.c create mode 100644 arch/x86/boot/video.h create mode 100644 arch/x86/boot/voyager.c (limited to 'arch') diff --git a/arch/i386/Makefile b/arch/i386/Makefile index 510df782f94..776d8dcf234 100644 --- a/arch/i386/Makefile +++ b/arch/i386/Makefile @@ -116,7 +116,7 @@ drivers-$(CONFIG_FB) += arch/i386/video/ CFLAGS += $(mflags-y) AFLAGS += $(mflags-y) -boot := arch/i386/boot +boot := arch/x86/boot PHONY += zImage bzImage compressed zlilo bzlilo \ zdisk bzdisk fdimage fdimage144 fdimage288 isoimage install @@ -125,9 +125,11 @@ all: bzImage # KBUILD_IMAGE specify target image being built KBUILD_IMAGE := $(boot)/bzImage -zImage zlilo zdisk: KBUILD_IMAGE := arch/i386/boot/zImage +zImage zlilo zdisk: KBUILD_IMAGE := arch/x86/boot/zImage zImage bzImage: vmlinux + $(Q)mkdir -p $(objtree)/arch/i386/boot + $(Q)ln -fsn $(objtree)/arch/x86/boot/bzImage $(objtree)/arch/i386/boot/bzImage $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE) compressed: zImage @@ -145,7 +147,8 @@ install: $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install archclean: - $(Q)$(MAKE) $(clean)=arch/i386/boot + $(Q)rm -rf $(objtree)/arch/i386/boot + $(Q)$(MAKE) $(clean)=arch/x86/boot define archhelp echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)' diff --git a/arch/i386/boot/.gitignore b/arch/i386/boot/.gitignore deleted file mode 100644 index 18465143cfa..00000000000 --- a/arch/i386/boot/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -bootsect -bzImage -setup -setup.bin -setup.elf diff --git a/arch/i386/boot/Makefile b/arch/i386/boot/Makefile deleted file mode 100644 index 93386a4e40b..00000000000 --- a/arch/i386/boot/Makefile +++ /dev/null @@ -1,171 +0,0 @@ -# -# arch/i386/boot/Makefile -# -# This file is subject to the terms and conditions of the GNU General Public -# License. See the file "COPYING" in the main directory of this archive -# for more details. -# -# Copyright (C) 1994 by Linus Torvalds -# - -# ROOT_DEV specifies the default root-device when making the image. -# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case -# the default of FLOPPY is used by 'build'. - -ROOT_DEV := CURRENT - -# If you want to preset the SVGA mode, uncomment the next line and -# set SVGA_MODE to whatever number you want. -# Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode. -# The number is the same as you would ordinarily press at bootup. - -SVGA_MODE := -DSVGA_MODE=NORMAL_VGA - -# If you want the RAM disk device, define this to be the size in blocks. - -#RAMDISK := -DRAMDISK=512 - -targets := vmlinux.bin setup.bin setup.elf zImage bzImage -subdir- := compressed - -setup-y += a20.o apm.o cmdline.o copy.o cpu.o cpucheck.o edd.o -setup-y += header.o main.o mca.o memory.o pm.o pmjump.o -setup-y += printf.o string.o tty.o video.o version.o voyager.o - -# The link order of the video-*.o modules can matter. In particular, -# video-vga.o *must* be listed first, followed by video-vesa.o. -# Hardware-specific drivers should follow in the order they should be -# probed, and video-bios.o should typically be last. -setup-y += video-vga.o -setup-y += video-vesa.o -setup-y += video-bios.o -targets += $(setup-y) -hostprogs-y := tools/build - -HOSTCFLAGS_build.o := $(LINUXINCLUDE) - -# --------------------------------------------------------------------------- - -# How to compile the 16-bit code. Note we always compile for -march=i386, -# that way we can complain to the user if the CPU is insufficient. -cflags-i386 := -cflags-x86_64 := -m32 -CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ - $(cflags-$(ARCH)) \ - -Wall -Wstrict-prototypes \ - -march=i386 -mregparm=3 \ - -include $(srctree)/$(src)/code16gcc.h \ - -fno-strict-aliasing -fomit-frame-pointer \ - $(call cc-option, -ffreestanding) \ - $(call cc-option, -fno-toplevel-reorder,\ - $(call cc-option, -fno-unit-at-a-time)) \ - $(call cc-option, -fno-stack-protector) \ - $(call cc-option, -mpreferred-stack-boundary=2) -AFLAGS := $(CFLAGS) -D__ASSEMBLY__ - -$(obj)/zImage: IMAGE_OFFSET := 0x1000 -$(obj)/zImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) -$(obj)/bzImage: IMAGE_OFFSET := 0x100000 -$(obj)/bzImage: EXTRA_CFLAGS := -D__BIG_KERNEL__ -$(obj)/bzImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__ -$(obj)/bzImage: BUILDFLAGS := -b - -quiet_cmd_image = BUILD $@ -cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/setup.bin \ - $(obj)/vmlinux.bin $(ROOT_DEV) > $@ - -$(obj)/zImage $(obj)/bzImage: $(obj)/setup.bin \ - $(obj)/vmlinux.bin $(obj)/tools/build FORCE - $(call if_changed,image) - @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' - -$(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE - $(call if_changed,objcopy) - -SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) - -LDFLAGS_setup.elf := -T -$(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE - $(call if_changed,ld) - -OBJCOPYFLAGS_setup.bin := -O binary - -$(obj)/setup.bin: $(obj)/setup.elf FORCE - $(call if_changed,objcopy) - -$(obj)/compressed/vmlinux: FORCE - $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@ - -# Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel -FDARGS = -# Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel -FDINITRD = - -image_cmdline = default linux $(FDARGS) $(if $(FDINITRD),initrd=initrd.img,) - -$(obj)/mtools.conf: $(src)/mtools.conf.in - sed -e 's|@OBJ@|$(obj)|g' < $< > $@ - -# This requires write access to /dev/fd0 -zdisk: $(BOOTIMAGE) $(obj)/mtools.conf - MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync - syslinux /dev/fd0 ; sync - echo '$(image_cmdline)' | \ - MTOOLSRC=$(src)/mtools.conf mcopy - a:syslinux.cfg - if [ -f '$(FDINITRD)' ] ; then \ - MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' a:initrd.img ; \ - fi - MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync - -# These require being root or having syslinux 2.02 or higher installed -fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf - dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440 - MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync - syslinux $(obj)/fdimage ; sync - echo '$(image_cmdline)' | \ - MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg - if [ -f '$(FDINITRD)' ] ; then \ - MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' v:initrd.img ; \ - fi - MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync - -fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf - dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880 - MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync - syslinux $(obj)/fdimage ; sync - echo '$(image_cmdline)' | \ - MTOOLSRC=$(obj)/mtools.conf mcopy - w:syslinux.cfg - if [ -f '$(FDINITRD)' ] ; then \ - MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' w:initrd.img ; \ - fi - MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync - -isoimage: $(BOOTIMAGE) - -rm -rf $(obj)/isoimage - mkdir $(obj)/isoimage - for i in lib lib64 share end ; do \ - if [ -f /usr/$$i/syslinux/isolinux.bin ] ; then \ - cp /usr/$$i/syslinux/isolinux.bin $(obj)/isoimage ; \ - break ; \ - fi ; \ - if [ $$i = end ] ; then exit 1 ; fi ; \ - done - cp $(BOOTIMAGE) $(obj)/isoimage/linux - echo '$(image_cmdline)' > $(obj)/isoimage/isolinux.cfg - if [ -f '$(FDINITRD)' ] ; then \ - cp '$(FDINITRD)' $(obj)/isoimage/initrd.img ; \ - fi - mkisofs -J -r -o $(obj)/image.iso -b isolinux.bin -c boot.cat \ - -no-emul-boot -boot-load-size 4 -boot-info-table \ - $(obj)/isoimage - rm -rf $(obj)/isoimage - -zlilo: $(BOOTIMAGE) - if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi - if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi - cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz - cp System.map $(INSTALL_PATH)/ - if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi - -install: - sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" diff --git a/arch/i386/boot/a20.c b/arch/i386/boot/a20.c deleted file mode 100644 index 31348d054fc..00000000000 --- a/arch/i386/boot/a20.c +++ /dev/null @@ -1,161 +0,0 @@ -/* -*- linux-c -*- ------------------------------------------------------- * - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright 2007 rPath, Inc. - All Rights Reserved - * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU General Public License version 2. - * - * ----------------------------------------------------------------------- */ - -/* - * arch/i386/boot/a20.c - * - * Enable A20 gate (return -1 on failure) - */ - -#include "boot.h" - -#define MAX_8042_LOOPS 100000 - -static int empty_8042(void) -{ - u8 status; - int loops = MAX_8042_LOOPS; - - while (loops--) { - io_delay(); - - status = inb(0x64); - if (status & 1) { - /* Read and discard input data */ - io_delay(); - (void)inb(0x60); - } else if (!(status & 2)) { - /* Buffers empty, finished! */ - return 0; - } - } - - return -1; -} - -/* Returns nonzero if the A20 line is enabled. The memory address - used as a test is the int $0x80 vector, which should be safe. */ - -#define A20_TEST_ADDR (4*0x80) -#define A20_TEST_SHORT 32 -#define A20_TEST_LONG 2097152 /* 2^21 */ - -static int a20_test(int loops) -{ - int ok = 0; - int saved, ctr; - - set_fs(0x0000); - set_gs(0xffff); - - saved = ctr = rdfs32(A20_TEST_ADDR); - - while (loops--) { - wrfs32(++ctr, A20_TEST_ADDR); - io_delay(); /* Serialize and make delay constant */ - ok = rdgs32(A20_TEST_ADDR+0x10) ^ ctr; - if (ok) - break; - } - - wrfs32(saved, A20_TEST_ADDR); - return ok; -} - -/* Quick test to see if A20 is already enabled */ -static int a20_test_short(void) -{ - return a20_test(A20_TEST_SHORT); -} - -/* Longer test that actually waits for A20 to come on line; this - is useful when dealing with the KBC or other slow external circuitry. */ -static int a20_test_long(void) -{ - return a20_test(A20_TEST_LONG); -} - -static void enable_a20_bios(void) -{ - asm volatile("pushfl; int $0x15; popfl" - : : "a" ((u16)0x2401)); -} - -static void enable_a20_kbc(void) -{ - empty_8042(); - - outb(0xd1, 0x64); /* Command write */ - empty_8042(); - - outb(0xdf, 0x60); /* A20 on */ - empty_8042(); -} - -static void enable_a20_fast(void) -{ - u8 port_a; - - port_a = inb(0x92); /* Configuration port A */ - port_a |= 0x02; /* Enable A20 */ - port_a &= ~0x01; /* Do not reset machine */ - outb(port_a, 0x92); -} - -/* - * Actual routine to enable A20; return 0 on ok, -1 on failure - */ - -#define A20_ENABLE_LOOPS 255 /* Number of times to try */ - -int enable_a20(void) -{ - int loops = A20_ENABLE_LOOPS; - -#if defined(CONFIG_X86_ELAN) - /* Elan croaks if we try to touch the KBC */ - enable_a20_fast(); - while (!a20_test_long()) - ; - return 0; -#elif defined(CONFIG_X86_VOYAGER) - /* On Voyager, a20_test() is unsafe? */ - enable_a20_kbc(); - return 0; -#else - while (loops--) { - /* First, check to see if A20 is already enabled - (legacy free, etc.) */ - if (a20_test_short()) - return 0; - - /* Next, try the BIOS (INT 0x15, AX=0x2401) */ - enable_a20_bios(); - if (a20_test_short()) - return 0; - - /* Try enabling A20 through the keyboard controller */ - empty_8042(); - if (a20_test_short()) - return 0; /* BIOS worked, but with delayed reaction */ - - enable_a20_kbc(); - if (a20_test_long()) - return 0; - - /* Finally, try enabling the "fast A20 gate" */ - enable_a20_fast(); - if (a20_test_long()) - return 0; - } - - return -1; -#endif -} diff --git a/arch/i386/boot/apm.c b/arch/i386/boot/apm.c deleted file mode 100644 index eab50c55a3a..00000000000 --- a/arch/i386/boot/apm.c +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- linux-c -*- ------------------------------------------------------- * - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright 2007 rPath, Inc. - All Rights Reserved - * - * Original APM BIOS checking by Stephen Rothwell, May 1994 - * (sfr@canb.auug.org.au) - * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU General Public License version 2. - * - * ----------------------------------------------------------------------- */ - -/* - * arch/i386/boot/apm.c - * - * Get APM BIOS information - */ - -#include "boot.h" - -#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) - -int query_apm_bios(void) -{ - u16 ax, bx, cx, dx, di; - u32 ebx, esi; - u8 err; - - /* APM BIOS installation check */ - ax = 0x5300; - bx = cx = 0; - asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp ; setc %0" - : "=d" (err), "+a" (ax), "+b" (bx), "+c" (cx) - : : "esi", "edi"); - - if (err) - return -1; /* No APM BIOS */ - - if (bx != 0x504d) /* "PM" signature */ - return -1; - - if (!(cx & 0x02)) /* 32 bits supported? */ - return -1; - - /* Disconnect first, just in case */ - ax = 0x5304; - bx = 0; - asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp" - : "+a" (ax), "+b" (bx) - : : "ecx", "edx", "esi", "edi"); - - /* Paranoia */ - ebx = esi = 0; - cx = dx = di = 0; - - /* 32-bit connect */ - asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp ; setc %6" - : "=a" (ax), "+b" (ebx), "+c" (cx), "+d" (dx), - "+S" (esi), "+D" (di), "=m" (err) - : "a" (0x5303)); - - boot_params.apm_bios_info.cseg = ax; - boot_params.apm_bios_info.offset = ebx; - boot_params.apm_bios_info.cseg_16 = cx; - boot_params.apm_bios_info.dseg = dx; - boot_params.apm_bios_info.cseg_len = (u16)esi; - boot_params.apm_bios_info.cseg_16_len = esi >> 16; - boot_params.apm_bios_info.dseg_len = di; - - if (err) - return -1; - - /* Redo the installation check as the 32-bit connect; - some BIOSes return different flags this way... */ - - ax = 0x5300; - bx = cx = 0; - asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp ; setc %0" - : "=d" (err), "+a" (ax), "+b" (bx), "+c" (cx) - : : "esi", "edi"); - - if (err || bx != 0x504d) { - /* Failure with 32-bit connect, try to disconect and ignore */ - ax = 0x5304; - bx = 0; - asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp" - : "+a" (ax), "+b" (bx) - : : "ecx", "edx", "esi", "edi"); - return -1; - } - - boot_params.apm_bios_info.version = ax; - boot_params.apm_bios_info.flags = cx; - return 0; -} - -#endif diff --git a/arch/i386/boot/bitops.h b/arch/i386/boot/bitops.h deleted file mode 100644 index 8dcc8dc7db8..00000000000 --- a/arch/i386/boot/bitops.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- linux-c -*- ------------------------------------------------------- * - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright 2007 rPath, Inc. - All Rights Reserved - * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU General Public License version 2. - * - * ----------------------------------------------------------------------- */ - -/* - * arch/i386/boot/bitops.h - * - * Very simple bitops for the boot code. - */ - -#ifndef BOOT_BITOPS_H -#define BOOT_BITOPS_H -#define _LINUX_BITOPS_H /* Inhibit inclusion of */ - -static inline int constant_test_bit(int nr, const void *addr) -{ - const u32 *p = (const u32 *)addr; - return ((1UL << (nr & 31)) & (p[nr >> 5])) != 0; -} -static inline int variable_test_bit(int nr, const void *addr) -{ - u8 v; - const u32 *p = (const u32 *)addr; - - asm("btl %2,%1; setc %0" : "=qm" (v) : "m" (*p), "Ir" (nr)); - return v; -} - -#define test_bit(nr,addr) \ -(__builtin_constant_p(nr) ? \ - constant_test_bit((nr),(addr)) : \ - variable_test_bit((nr),(addr))) - -static inline void set_bit(int nr, void *addr) -{ - asm("btsl %1,%0" : "+m" (*(u32 *)addr) : "Ir" (nr)); -} - -#endif /* BOOT_BITOPS_H */ diff --git a/arch/i386/boot/boot.h b/arch/i386/boot/boot.h deleted file mode 100644 index 20bab9431ac..00000000000 --- a/arch/i386/boot/boot.h +++ /dev/null @@ -1,296 +0,0 @@ -/* -*- linux-c -*- ------------------------------------------------------- * - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright 2007 rPath, Inc. - All Rights Reserved - * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU General Public License version 2. - * - * ----------------------------------------------------------------------- */ - -/* - * arch/i386/boot/boot.h - * - * Header file for the real-mode kernel code - */ - -#ifndef BOOT_BOOT_H -#define BOOT_BOOT_H - -#ifndef __ASSEMBLY__ - -#include -#include -#include -#include -#include - -/* Useful macros */ -#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) - -extern struct setup_header hdr; -extern struct boot_params boot_params; - -/* Basic port I/O */ -static inline void outb(u8 v, u16 port) -{ - asm volatile("outb %0,%1" : : "a" (v), "dN" (port)); -} -static inline u8 inb(u16 port) -{ - u8 v; - asm volatile("inb %1,%0" : "=a" (v) : "dN" (port)); - return v; -} - -static inline void outw(u16 v, u16 port) -{ - asm volatile("outw %0,%1" : : "a" (v), "dN" (port)); -} -static inline u16 inw(u16 port) -{ - u16 v; - asm volatile("inw %1,%0" : "=a" (v) : "dN" (port)); - return v; -} - -static inline void outl(u32 v, u16 port) -{ - asm volatile("outl %0,%1" : : "a" (v), "dN" (port)); -} -static inline u32 inl(u32 port) -{ - u32 v; - asm volatile("inl %1,%0" : "=a" (v) : "dN" (port)); - return v; -} - -static inline void io_delay(void) -{ - const u16 DELAY_PORT = 0x80; - asm volatile("outb %%al,%0" : : "dN" (DELAY_PORT)); -} - -/* These functions are used to reference data in other segments. */ - -static inline u16 ds(void) -{ - u16 seg; - asm("movw %%ds,%0" : "=rm" (seg)); - return seg; -} - -static inline void set_fs(u16 seg) -{ - asm volatile("movw %0,%%fs" : : "rm" (seg)); -} -static inline u16 fs(void) -{ - u16 seg; - asm volatile("movw %%fs,%0" : "=rm" (seg)); - return seg; -} - -static inline void set_gs(u16 seg) -{ - asm volatile("movw %0,%%gs" : : "rm" (seg)); -} -static inline u16 gs(void) -{ - u16 seg; - asm volatile("movw %%gs,%0" : "=rm" (seg)); - return seg; -} - -typedef unsigned int addr_t; - -static inline u8 rdfs8(addr_t addr) -{ - u8 v; - asm volatile("movb %%fs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr)); - return v; -} -static inline u16 rdfs16(addr_t addr) -{ - u16 v; - asm volatile("movw %%fs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr)); - return v; -} -static inline u32 rdfs32(addr_t addr) -{ - u32 v; - asm volatile("movl %%fs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr)); - return v; -} - -static inline void wrfs8(u8 v, addr_t addr) -{ - asm volatile("movb %1,%%fs:%0" : "+m" (*(u8 *)addr) : "r" (v)); -} -static inline void wrfs16(u16 v, addr_t addr) -{ - asm volatile("movw %1,%%fs:%0" : "+m" (*(u16 *)addr) : "r" (v)); -} -static inline void wrfs32(u32 v, addr_t addr) -{ - asm volatile("movl %1,%%fs:%0" : "+m" (*(u32 *)addr) : "r" (v)); -} - -static inline u8 rdgs8(addr_t addr) -{ - u8 v; - asm volatile("movb %%gs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr)); - return v; -} -static inline u16 rdgs16(addr_t addr) -{ - u16 v; - asm volatile("movw %%gs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr)); - return v; -} -static inline u32 rdgs32(addr_t addr) -{ - u32 v; - asm volatile("movl %%gs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr)); - return v; -} - -static inline void wrgs8(u8 v, addr_t addr) -{ - asm volatile("movb %1,%%gs:%0" : "+m" (*(u8 *)addr) : "r" (v)); -} -static inline void wrgs16(u16 v, addr_t addr) -{ - asm volatile("movw %1,%%gs:%0" : "+m" (*(u16 *)addr) : "r" (v)); -} -static inline void wrgs32(u32 v, addr_t addr) -{ - asm volatile("movl %1,%%gs:%0" : "+m" (*(u32 *)addr) : "r" (v)); -} - -/* Note: these only return true/false, not a signed return value! */ -static inline int memcmp(const void *s1, const void *s2, size_t len) -{ - u8 diff; - asm("repe; cmpsb; setnz %0" - : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len)); - return diff; -} - -static inline int memcmp_fs(const void *s1, addr_t s2, size_t len) -{ - u8 diff; - asm volatile("fs; repe; cmpsb; setnz %0" - : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len)); - return diff; -} -static inline int memcmp_gs(const void *s1, addr_t s2, size_t len) -{ - u8 diff; - asm volatile("gs; repe; cmpsb; setnz %0" - : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len)); - return diff; -} - -static inline int isdigit(int ch) -{ - return (ch >= '0') && (ch <= '9'); -} - -/* Heap -- available for dynamic lists. */ -#define STACK_SIZE 512 /* Minimum number of bytes for stack */ - -extern char _end[]; -extern char *HEAP; -extern char *heap_end; -#define RESET_HEAP() ((void *)( HEAP = _end )) -static inline char *__get_heap(size_t s, size_t a, size_t n) -{ - char *tmp; - - HEAP = (char *)(((size_t)HEAP+(a-1)) & ~(a-1)); - tmp = HEAP; - HEAP += s*n; - return tmp; -} -#define GET_HEAP(type, n) \ - ((type *)__get_heap(sizeof(type),__alignof__(type),(n))) - -static inline int heap_free(void) -{ - return heap_end-HEAP; -} - -/* copy.S */ - -void copy_to_fs(addr_t dst, void *src, size_t len); -void *copy_from_fs(void *dst, addr_t src, size_t len); -void copy_to_gs(addr_t dst, void *src, size_t len); -void *copy_from_gs(void *dst, addr_t src, size_t len); -void *memcpy(void *dst, void *src, size_t len); -void *memset(void *dst, int c, size_t len); - -#define memcpy(d,s,l) __builtin_memcpy(d,s,l) -#define memset(d,c,l) __builtin_memset(d,c,l) - -/* a20.c */ -int enable_a20(void); - -/* apm.c */ -int query_apm_bios(void); - -/* cmdline.c */ -int cmdline_find_option(const char *option, char *buffer, int bufsize); - -/* cpu.c, cpucheck.c */ -int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr); -int validate_cpu(void); - -/* edd.c */ -void query_edd(void); - -/* header.S */ -void __attribute__((noreturn)) die(void); - -/* mca.c */ -int query_mca(void); - -/* memory.c */ -int detect_memory(void); - -/* pm.c */ -void __attribute__((noreturn)) go_to_protected_mode(void); - -/* pmjump.S */ -void __attribute__((noreturn)) - protected_mode_jump(u32 entrypoint, u32 bootparams); - -/* printf.c */ -int sprintf(char *buf, const char *fmt, ...); -int vsprintf(char *buf, const char *fmt, va_list args); -int printf(const char *fmt, ...); - -/* string.c */ -int strcmp(const char *str1, const char *str2); -size_t strnlen(const char *s, size_t maxlen); -unsigned int atou(const char *s); - -/* tty.c */ -void puts(const char *); -void putchar(int); -int getchar(void); -void kbd_flush(void); -int getchar_timeout(void); - -/* video.c */ -void set_video(void); - -/* video-vesa.c */ -void vesa_store_edid(void); - -/* voyager.c */ -int query_voyager(void); - -#endif /* __ASSEMBLY__ */ - -#endif /* BOOT_BOOT_H */ diff --git a/arch/i386/boot/cmdline.c b/arch/i386/boot/cmdline.c deleted file mode 100644 index 34bb778c435..00000000000 --- a/arch/i386/boot/cmdline.c +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- linux-c -*- ------------------------------------------------------- * - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright 2007 rPath, Inc. - All Rights Reserved - * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU General Public License version 2. - * - * ----------------------------------------------------------------------- */ - -/* - * arch/i386/boot/cmdline.c - * - * Simple command-line parser for early boot. - */ - -#include "boot.h" - -static inline int myisspace(u8 c) -{ - return c <= ' '; /* Close enough approximation */ -} - -/* - * Find a non-boolean option, that is, "option=argument". In accordance - * with standard Linux practice, if this option is repeated, this returns - * the last instance on the command line. - * - * Returns the length of the argument (regardless of if it was - * truncated to fit in the buffer), or -1 on not found. - */ -int cmdline_find_option(const char *option, char *buffer, int bufsize) -{ - u32 cmdline_ptr = boot_params.hdr.cmd_line_ptr; - addr_t cptr; - char c; - int len = -1; - const char *opptr = NULL; - char *bufptr = buffer; - enum { - st_wordstart, /* Start of word/after whitespace */ - st_wordcmp, /* Comparing this word */ - st_wordskip, /* Miscompare, skip */ - st_bufcpy /* Copying this to buffer */ - } state = st_wordstart; - - if (!cmdline_ptr || cmdline_ptr >= 0x100000) - return -1; /* No command line, or inaccessible */ - - cptr = cmdline_ptr & 0xf; - set_fs(cmdline_ptr >> 4); - - while (cptr < 0x10000 && (c = rdfs8(cptr++))) { - switch (state) { - case st_wordstart: - if (myisspace(c)) - break; - - /* else */ - state = st_wordcmp; - opptr = option; - /* fall through */ - - case st_wordcmp: - if (c == '=' && !*opptr) { - len = 0; - bufptr = buffer; - state = st_bufcpy; - } else if (myisspace(c)) { - state = st_wordstart; - } else if (c != *opptr++) { - state = st_wordskip; - } - break; - - case st_wordskip: - if (myisspace(c)) - state = st_wordstart; - break; - - case st_bufcpy: - if (myisspace(c)) { - state = st_wordstart; - } else { - if (len < bufsize-1) - *bufptr++ = c; - len++; - } - break; - } - } - - if (bufsize) - *bufptr = '\0'; - - return len; -} diff --git a/arch/i386/boot/code16gcc.h b/arch/i386/boot/code16gcc.h deleted file mode 100644 index d93e48010b6..00000000000 --- a/arch/i386/boot/code16gcc.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * code16gcc.h - * - * This file is -include'd when compiling 16-bit C code. - * Note: this asm() needs to be emitted before gcc emits any code. - * Depending on gcc version, this requires -fno-unit-at-a-time or - * -fno-toplevel-reorder. - * - * Hopefully gcc will eventually have a real -m16 option so we can - * drop this hack long term. - */ - -#ifndef __ASSEMBLY__ -asm(".code16gcc"); -#endif diff --git a/arch/i386/boot/copy.S b/arch/i386/boot/copy.S deleted file mode 100644 index ef127e56a3c..00000000000 --- a/arch/i386/boot/copy.S +++ /dev/null @@ -1,101 +0,0 @@ -/* ----------------------------------------------------------------------- * - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright 2007 rPath, Inc. - All Rights Reserved - * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU General Public License version 2. - * - * ----------------------------------------------------------------------- */ - -/* - * arch/i386/boot/copy.S - * - * Memory copy routines - */ - - .code16gcc - .text - - .globl memcpy - .type memcpy, @function -memcpy: - pushw %si - pushw %di - movw %ax, %di - movw %dx, %si - pushw %cx - shrw $2, %cx - rep; movsl - popw %cx - andw $3, %cx - rep; movsb - popw %di - popw %si - ret - .size memcpy, .-memcpy - - .globl memset - .type memset, @function -memset: - pushw %di - movw %ax, %di - movzbl %dl, %eax - imull $0x01010101,%eax - pushw %cx - shrw $2, %cx - rep; stosl - popw %cx - andw $3, %cx - rep; stosb - popw %di - ret - .size memset, .-memset - - .globl copy_from_fs - .type copy_from_fs, @function -copy_from_fs: - pushw %ds - pushw %fs - popw %ds - call memcpy - popw %ds - ret - .size copy_from_fs, .-copy_from_fs - - .globl copy_to_fs - .type copy_to_fs, @function -copy_to_fs: - pushw %es - pushw %fs - popw %es - call memcpy - popw %es - ret - .size copy_to_fs, .-copy_to_fs - -#if 0 /* Not currently used, but can be enabled as needed */ - - .globl copy_from_gs - .type copy_from_gs, @function -copy_from_gs: - pushw %ds - pushw %gs - popw %ds - call memcpy - popw %ds - ret - .size copy_from_gs, .-copy_from_gs - .globl copy_to_gs - - .type copy_to_gs, @function -copy_to_gs: - pushw %es - pushw %gs - popw %es - call memcpy - popw %es - ret - .size copy_to_gs, .-copy_to_gs - -#endif diff --git a/arch/i386/boot/cpu.c b/arch/i386/boot/cpu.c deleted file mode 100644 index 2a5c32da585..00000000000 --- a/arch/i386/boot/cpu.c +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- linux-c -*- ------------------------------------------------------- * - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright 2007 rPath, Inc. - All Rights Reserved - * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU General Public License version 2. - * - * ----------------------------------------------------------------------- */ - -/* - * arch/i386/boot/cpu.c - * - * Check for obligatory CPU features and abort if the features are not - * present. - */ - -#include "boot.h" -#include "bitops.h" -#include - -static char *cpu_name(int level) -{ - static char buf[6]; - - if (level == 64) { - return "x86-64"; - } else { - sprintf(buf, "i%d86", level); - return buf; - } -} - -int validate_cpu(void) -{ - u32 *err_flags; - int cpu_level, req_level; - - check_cpu(&cpu_level, &req_level, &err_flags); - - if (cpu_level < req_level) { - printf("This kernel requires an %s CPU, ", - cpu_name(req_level)); - printf("but only detected an %s CPU.\n", - cpu_name(cpu_level)); - return -1; - } - - if (err_flags) { - int i, j; - puts("This kernel requires the following features " - "not present on the CPU:\n"); - - for (i = 0; i < NCAPINTS; i++) { - u32 e = err_flags[i]; - - for (j = 0; j < 32; j++) { - if (e & 1) - printf("%d:%d ", i, j); - - e >>= 1; - } - } - putchar('\n'); - return -1; - } else { - return 0; - } -} diff --git a/arch/i386/boot/cpucheck.c b/arch/i386/boot/cpucheck.c deleted file mode 100644 index e655a89c551..00000000000 --- a/arch/i386/boot/cpucheck.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -*- linux-c -*- ------------------------------------------------------- * - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright 2007 rPath, Inc. - All Rights Reserved - * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU General Public License version 2. - * - * ----------------------------------------------------------------------- */ - -/* - * arch/i386/boot/cpucheck.c - * - * Check for obligatory CPU features and abort if the features are not - * present. This code should be compilable as 16-, 32- or 64-bit - * code, so be very careful with types and inline assembly. - * - * This code should not contain any messages; that requires an - * additional wrapper. - * - * As written, this code is not safe for inclusion into the kernel - * proper (after FPU initialization, in particular). - */ - -#ifdef _SETUP -# include "boot.h" -# include "bitops.h" -#endif -#include -#include -#include -#include -#include - -struct cpu_features { - int level; /* Family, or 64 for x86-64 */ - int model; - u32 flags[NCAPINTS]; -}; - -static struct cpu_features cpu; -static u32 cpu_vendor[3]; -static u32 err_flags[NCAPINTS]; - -#ifdef CONFIG_X86_64 -static const int req_level = 64; -#elif defined(CONFIG_X86_MINIMUM_CPU_FAMILY) -static const int req_level = CONFIG_X86_MINIMUM_CPU_FAMILY; -#else -static const int req_level = 3; -#endif - -static const u32 req_flags[NCAPINTS] = -{ - REQUIRED_MASK0, - REQUIRED_MASK1, - REQUIRED_MASK2, - REQUIRED_MASK3, - REQUIRED_MASK4, - REQUIRED_MASK5, - REQUIRED_MASK6, - REQUIRED_MASK7, -}; - -#define A32(a,b,c,d) (((d) << 24)+((c) << 16)+((b) << 8)+(a)) - -static int is_amd(void) -{ - return cpu_vendor[0] == A32('A','u','t','h') && - cpu_vendor[1] == A32('e','n','t','i') && - cpu_vendor[2] == A32('c','A','M','D'); -} - -static int is_centaur(void) -{ - return cpu_vendor[0] == A32('C','e','n','t') && - cpu_vendor[1] == A32('a','u','r','H') && - cpu_vendor[2] == A32('a','u','l','s'); -} - -static int is_transmeta(void) -{ - return cpu_vendor[0] == A32('G','e','n','u') && - cpu_vendor[1] == A32('i','n','e','T') && - cpu_vendor[2] == A32('M','x','8','6'); -} - -static int has_fpu(void) -{ - u16 fcw = -1, fsw = -1; - u32 cr0; - - asm("movl %%cr0,%0" : "=r" (cr0)); - if (cr0 & (X86_CR0_EM|X86_CR0_TS)) { - cr0 &= ~(X86_CR0_EM|X86_CR0_TS); - asm volatile("movl %0,%%cr0" : : "r" (cr0)); - } - - asm volatile("fninit ; fnstsw %0 ; fnstcw %1" - : "+m" (fsw), "+m" (fcw)); - - return fsw == 0 && (fcw & 0x103f) == 0x003f; -} - -static int has_eflag(u32 mask) -{ - u32 f0, f1; - - asm("pushfl ; " - "pushfl ; " - "popl %0 ; " - "movl %0,%1 ; " - "xorl %2,%1 ; " - "pushl %1 ; " - "popfl ; " - "pushfl ; " - "popl %1 ; " - "popfl" - : "=&r" (f0), "=&r" (f1) - : "ri" (mask)); - - return !!((f0^f1) & mask); -} - -static void get_flags(void) -{ - u32 max_intel_level, max_amd_level; - u32 tfms; - - if (has_fpu()) - set_bit(X86_FEATURE_FPU, cpu.flags); - - if (has_eflag(X86_EFLAGS_ID)) { - asm("cpuid" - : "=a" (max_intel_level), - "=b" (cpu_vendor[0]), - "=d" (cpu_vendor[1]), - "=c" (cpu_vendor[2]) - : "a" (0)); - - if (max_intel_level >= 0x00000001 && - max_intel_level <= 0x0000ffff) { - asm("cpuid" - : "=a" (tfms), - "=c" (cpu.flags[4]), - "=d" (cpu.flags[0]) - : "a" (0x00000001) - : "ebx"); - cpu.level = (tfms >> 8) & 15; - cpu.model = (tfms >> 4) & 15; - if (cpu.level >= 6) - cpu.model += ((tfms >> 16) & 0xf) << 4; - } - - asm("cpuid" - : "=a" (max_amd_level) - : "a" (0x80000000) - : "ebx", "ecx", "edx"); - - if (max_amd_level >= 0x80000001 && - max_amd_level <= 0x8000ffff) { - u32 eax = 0x80000001; - asm("cpuid" - : "+a" (eax), - "=c" (cpu.flags[6]), - "=d" (cpu.flags[1]) - : : "ebx"); - } - } -} - -/* Returns a bitmask of which words we have error bits in */ -static int check_flags(void) -{ - u32 err; - int i; - - err = 0; - for (i = 0; i < NCAPINTS; i++) { - err_flags[i] = req_flags[i] & ~cpu.flags[i]; - if (err_flags[i]) - err |= 1 << i; - } - - return err; -} - -/* - * Returns -1 on error. - * - * *cpu_level is set to the current CPU level; *req_level to the required - * level. x86-64 is considered level 64 for this purpose. - * - * *err_flags_ptr is set to the flags error array if there are flags missing. - */ -int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr) -{ - int err; - - memset(&cpu.flags, 0, sizeof cpu.flags); - cpu.level = 3; - - if (has_eflag(X86_EFLAGS_AC)) - cpu.level = 4; - - get_flags(); - err = check_flags(); - - if (test_bit(X86_FEATURE_LM, cpu.flags)) - cpu.level = 64; - - if (err == 0x01 && - !(err_flags[0] & - ~((1 << X86_FEATURE_XMM)|(1 << X86_FEATURE_XMM2))) && - is_amd()) { - /* If this is an AMD and we're only missing SSE+SSE2, try to - turn them on */ - - u32 ecx = MSR_K7_HWCR; - u32 eax, edx; - - asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx)); - eax &= ~(1 << 15); - asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx)); - - get_flags(); /* Make sure it really did something */ - err = check_flags(); - } else if (err == 0x01 && - !(err_flags[0] & ~(1 << X86_FEATURE_CX8)) && - is_centaur() && cpu.model >= 6) { - /* If this is a VIA C3, we might have to enable CX8 - explicitly */ - - u32 ecx = MSR_VIA_FCR; - u32 eax, edx; - - asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx)); - eax |= (1<<1)|(1<<7); - asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx)); - - set_bit(X86_FEATURE_CX8, cpu.flags); - err = check_flags(); - } else if (err == 0x01 && is_transmeta()) { - /* Transmeta might have masked feature bits in word 0 */ - - u32 ecx = 0x80860004; - u32 eax, edx; - u32 level = 1; - - asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx)); - asm("wrmsr" : : "a" (~0), "d" (edx), "c" (ecx)); - asm("cpuid" - : "+a" (level), "=d" (cpu.flags[0]) - : : "ecx", "ebx"); - asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx)); - - err = check_flags(); - } - - if (err_flags_ptr) - *err_flags_ptr = err ? err_flags : NULL; - if (cpu_level_ptr) - *cpu_level_ptr = cpu.level; - if (req_level_ptr) - *req_level_ptr = req_level; - - return (cpu.level < req_level || err) ? -1 : 0; -} diff --git a/arch/i386/boot/edd.c b/arch/i386/boot/edd.c deleted file mode 100644 index bd138e442ec..00000000000 --- a/arch/i386/boot/edd.c +++ /dev/null @@ -1,167 +0,0 @@ -/* -*- linux-c -*- ------------------------------------------------------- * - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright 2007 rPath, Inc. - All Rights Reserved - * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU General Public License version 2. - * - * ----------------------------------------------------------------------- */ - -/* - * arch/i386/boot/edd.c - * - * Get EDD BIOS disk information - */ - -#include "boot.h" -#include - -#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) - -/* - * Read the MBR (first sector) from a specific device. - */ -static int read_mbr(u8 devno, void *buf) -{ - u16 ax, bx, cx, dx; - - ax = 0x0201; /* Legacy Read, one sector */ - cx = 0x0001; /* Sector 0-0-1 */ - dx = devno; - bx = (size_t)buf; - asm volatile("pushfl; stc; int $0x13; setc %%al; popfl" - : "+a" (ax), "+c" (cx), "+d" (dx), "+b" (bx) - : : "esi", "edi", "memory"); - - return -(u8)ax; /* 0 or -1 */ -} - -static u32 read_mbr_sig(u8 devno, struct edd_info *ei, u32 *mbrsig) -{ - int sector_size; - char *mbrbuf_ptr, *mbrbuf_end; - u32 buf_base, mbr_base; - extern char _end[]; - - sector_size = ei->params.bytes_per_sector; - if (!sector_size) - sector_size = 512; /* Best available guess */ - - /* Produce a naturally aligned buffer on the heap */ - buf_base = (ds() << 4) + (u32)&_end; - mbr_base = (buf_base+sector_size-1) & ~(sector_size-1); - mbrbuf_ptr = _end + (mbr_base-buf_base); - mbrbuf_end = mbrbuf_ptr + sector_size; - - /* Make sure we actually have space on the heap... */ - if (!(boot_params.hdr.loadflags & CAN_USE_HEAP)) - return -1; - if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr) - return -1; - - if (read_mbr(devno, mbrbuf_ptr)) - return -1; - - *mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET]; - return 0; -} - -static int get_edd_info(u8 devno, struct edd_info *ei) -{ - u16 ax, bx, cx, dx, di; - - memset(ei, 0, sizeof *ei); - - /* Check Extensions Present */ - - ax = 0x4100; - bx = EDDMAGIC1; - dx = devno; - asm("pushfl; stc; int $0x13; setc %%al; popfl" - : "+a" (ax), "+b" (bx), "=c" (cx), "+d" (dx) - : : "esi", "edi"); - - if ((u8)ax) - return -1; /* No extended information */ - - if (bx != EDDMAGIC2) - return -1; - - ei->device = devno; - ei->version = ax >> 8; /* EDD version number */ - ei->interface_support = cx; /* EDD functionality subsets */ - - /* Extended Get Device Parameters */ - - ei->params.length = sizeof(ei->params); - ax = 0x4800; - dx = devno; - asm("pushfl; int $0x13; popfl" - : "+a" (ax), "+d" (dx), "=m" (ei->params) - : "S" (&ei->params) - : "ebx", "ecx", "edi"); - - /* Get legacy CHS parameters */ - - /* Ralf Brown recommends setting ES:DI to 0:0 */ - ax = 0x0800; - dx = devno; - di = 0; - asm("pushw %%es; " - "movw %%di,%%es; " - "pushfl; stc; int $0x13; setc %%al; popfl; " - "popw %%es" - : "+a" (ax), "=b" (bx), "=c" (cx), "+d" (dx), "+D" (di) - : : "esi"); - - if ((u8)ax == 0) { - ei->legacy_max_cylinder = (cx >> 8) + ((cx & 0xc0) << 2); - ei->legacy_max_head = dx >> 8; - ei->legacy_sectors_per_track = cx & 0x3f; - } - - return 0; -} - -void query_edd(void) -{ - char eddarg[8]; - int do_mbr = 1; - int do_edd = 1; - int devno; - struct edd_info ei, *edp; - u32 *mbrptr; - - if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) { - if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) - do_mbr = 0; - else if (!strcmp(eddarg, "off")) - do_edd = 0; - } - - edp = boot_params.eddbuf; - mbrptr = boot_params.edd_mbr_sig_buffer; - - if (!do_edd) - return; - - for (devno = 0x80; devno < 0x80+EDD_MBR_SIG_MAX; devno++) { - /* - * Scan the BIOS-supported hard disks and query EDD - * information... - */ - get_edd_info(devno, &ei); - - if (boot_params.eddbuf_entries < EDDMAXNR) { - memcpy(edp, &ei, sizeof ei); - edp++; - boot_params.eddbuf_entries++; - } - - if (do_mbr && !read_mbr_sig(devno, &ei, mbrptr++)) - boot_params.edd_mbr_sig_buf_entries = devno-0x80+1; - } -} - -#endif diff --git a/arch/i386/boot/header.S b/arch/i386/boot/header.S deleted file mode 100644 index f3140e596d4..00000000000 --- a/arch/i386/boot/header.S +++ /dev/null @@ -1,283 +0,0 @@ -/* - * header.S - * - * Copyright (C) 1991, 1992 Linus Torvalds - * - * Based on bootsect.S and setup.S - * modified by more people than can be counted - * - * Rewritten as a common file by H. Peter Anvin (Apr 2007) - * - * BIG FAT NOTE: We're in real mode using 64k segments. Therefore segment - * addresses must be multiplied by 16 to obtain their respective linear - * addresses. To avoid confusion, linear addresses are written using leading - * hex while segment addresses are written as segment:offset. - * - */ - -#include -#include -#include -#include -#include -#include -#include "boot.h" - -SETUPSECTS = 4 /* default nr of setup-sectors */ -BOOTSEG = 0x07C0 /* original address of boot-sector */ -SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */ -SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */ - /* to be loaded */ -ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */ -SWAP_DEV = 0 /* SWAP_DEV is now written by "build" */ - -#ifndef SVGA_MODE -#define SVGA_MODE ASK_VGA -#endif - -#ifndef RAMDISK -#define RAMDISK 0 -#endif - -#ifndef ROOT_RDONLY -#define ROOT_RDONLY 1 -#endif - - .code16 - .section ".bstext", "ax" - - .global bootsect_start -bootsect_start: - - # Normalize the start address - ljmp $BOOTSEG, $start2 - -start2: - movw %cs, %ax - movw %ax, %ds - movw %ax, %es - movw %ax, %ss - xorw %sp, %sp - sti - cld - - movw $bugger_off_msg, %si - -msg_loop: - lodsb - andb %al, %al - jz bs_die - movb $0xe, %ah - movw $7, %bx - int $0x10 - jmp msg_loop - -bs_die: - # Allow the user to press a key, then reboot - xorw %ax, %ax - int $0x16 - int $0x19 - - # int 0x19 should never return. In case it does anyway, - # invoke the BIOS reset code... - ljmp $0xf000,$0xfff0 - - .section ".bsdata", "a" -bugger_off_msg: - .ascii "Direct booting from floppy is no longer supported.\r\n" - .ascii "Please use a boot loader program instead.\r\n" - .ascii "\n" - .ascii "Remove disk and press any key to reboot . . .\r\n" - .byte 0 - - - # Kernel attributes; used by setup. This is part 1 of the - # header, from the old boot sector. - - .section ".header", "a" - .globl hdr -hdr: -setup_sects: .byte SETUPSECTS -root_flags: .word ROOT_RDONLY -syssize: .long SYSSIZE -ram_size: .word RAMDISK -vid_mode: .word SVGA_MODE -root_dev: .word ROOT_DEV -boot_flag: .word 0xAA55 - - # offset 512, entry point - - .globl _start -_start: - # Explicitly enter this as bytes, or the assembler - # tries to generate a 3-byte jump here, which causes - # everything else to push off to the wrong offset. - .byte 0xeb # short (2-byte) jump - .byte start_of_setup-1f -1: - - # Part 2 of the header, from the old setup.S - - .ascii "HdrS" # header signature - .word 0x0206 # header version number (>= 0x0105) - # or else old loadlin-1.5 will fail) - .globl realmode_swtch -realmode_swtch: .word 0, 0 # default_switch, SETUPSEG -start_sys_seg: .word SYSSEG - .word kernel_version-512 # pointing to kernel version string - # above section of header is compatible - # with loadlin-1.5 (header v1.5). Don't - # change it. - -type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin, - # Bootlin, SYSLX, bootsect...) - # See Documentation/i386/boot.txt for - # assigned ids - -# flags, unused bits must be zero (RFU) bit within loadflags -loadflags: -LOADED_HIGH = 1 # If set, the kernel is loaded high -CAN_USE_HEAP = 0x80 # If set, the loader also has set - # heap_end_ptr to tell how much - # space behind setup.S can be used for - # heap purposes. - # Only the loader knows what is free -#ifndef __BIG_KERNEL__ - .byte 0 -#else - .byte LOADED_HIGH -#endif - -setup_move_size: .word 0x8000 # size to move, when setup is not - # loaded at 0x90000. We will move setup - # to 0x90000 then just before jumping - # into the kernel. However, only the - # loader knows how much data behind - # us also needs to be loaded. - -code32_start: # here loaders can put a different - # start address for 32-bit code. -#ifndef __BIG_KERNEL__ - .long 0x1000 # 0x1000 = default for zImage -#else - .long 0x100000 # 0x100000 = default for big kernel -#endif - -ramdisk_image: .long 0 # address of loaded ramdisk image - # Here the loader puts the 32-bit - # address where it loaded the image. - # This only will be read by the kernel. - -ramdisk_size: .long 0 # its size in bytes - -bootsect_kludge: - .long 0 # obsolete - -heap_end_ptr: .word _end+1024 # (Header version 0x0201 or later) - # space from here (exclusive) down to - # end of setup code can be used by setup - # for local heap purposes. - -pad1: .word 0 -cmd_line_ptr: .long 0 # (Header version 0x0202 or later) - # If nonzero, a 32-bit pointer - # to the kernel command line. - # The command line should be - # located between the start of - # setup and the end of low - # memory (0xa0000), or it may - # get overwritten before it - # gets read. If this field is - # used, there is no longer - # anything magical about the - # 0x90000 segment; the setup - # can be located anywhere in - # low memory 0x10000 or higher. - -ramdisk_max: .long (-__PAGE_OFFSET-(512 << 20)-1) & 0x7fffffff - # (Header version 0x0203 or later) - # The highest safe address for - # the contents of an initrd - -kernel_alignment: .long CONFIG_PHYSICAL_ALIGN #physical addr alignment - #required for protected mode - #kernel -#ifdef CONFIG_RELOCATABLE -relocatable_kernel: .byte 1 -#else -relocatable_kernel: .byte 0 -#endif -pad2: .byte 0 -pad3: .word 0 - -cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line, - #added with boot protocol - #version 2.06 - -# End of setup header ##################################################### - - .section ".inittext", "ax" -start_of_setup: -#ifdef SAFE_RESET_DISK_CONTROLLER -# Reset the disk controller. - movw $0x0000, %ax # Reset disk controller - movb $0x80, %dl # All disks - int $0x13 -#endif - -# We will have entered with %cs = %ds+0x20, normalize %cs so -# it is on par with the other segments. - pushw %ds - pushw $setup2 - lretw - -setup2: -# Force %es = %ds - movw %ds, %ax - movw %ax, %es - cld - -# Stack paranoia: align the stack and make sure it is good -# for both 16- and 32-bit references. In particular, if we -# were meant to have been using the full 16-bit segment, the -# caller might have set %sp to zero, which breaks %esp-based -# references. - andw $~3, %sp # dword align (might as well...) - jnz 1f - movw $0xfffc, %sp # Make sure we're not zero -1: movzwl %sp, %esp # Clear upper half of %esp - sti - -# Check signature at end of setup - cmpl $0x5a5aaa55, setup_sig - jne setup_bad - -# Zero the bss - movw $__bss_start, %di - movw $_end+3, %cx - xorl %eax, %eax - subw %di, %cx - shrw $2, %cx - rep; stosl - -# Jump to C code (should not return) - calll main - -# Setup corrupt somehow... -setup_bad: - movl $setup_corrupt, %eax - calll puts - # Fall through... - - .globl die - .type die, @function -die: - hlt - jmp die - - .size die, .-die - - .section ".initdata", "a" -setup_corrupt: - .byte 7 - .string "No setup signature found...\n" diff --git a/arch/i386/boot/install.sh b/arch/i386/boot/install.sh deleted file mode 100644 index 88d77761d01..00000000000 --- a/arch/i386/boot/install.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh -# -# arch/i386/boot/install.sh -# -# This file is subject to the terms and conditions of the GNU General Public -# License. See the file "COPYING" in the main directory of this archive -# for more details. -# -# Copyright (C) 1995 by Linus Torvalds -# -# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin -# -# "make install" script for i386 architecture -# -# Arguments: -# $1 - kernel version -# $2 - kernel image file -# $3 - kernel map file -# $4 - default install path (blank if root directory) -# - -verify () { - if [ ! -f "$1" ]; then - echo "" 1>&2 - echo " *** Missing file: $1" 1>&2 - echo ' *** You need to run "make" before "make install".' 1>&2 - echo "" 1>&2 - exit 1 - fi -} - -# Make sure the files actually exist -verify "$2" -verify "$3" - -# User may have a custom install script - -if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi -if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi - -# Default install - same as make zlilo - -if [ -f $4/vmlinuz ]; then - mv $4/vmlinuz $4/vmlinuz.old -fi - -if [ -f $4/System.map ]; then - mv $4/System.map $4/System.old -fi - -cat $2 > $4/vmlinuz -cp $3 $4/System.map - -if [ -x /sbin/lilo ]; then - /sbin/lilo -elif [ -x /etc/lilo/install ]; then - /etc/lilo/install -else - sync - echo "Cannot find LILO." -fi diff --git a/arch/i386/boot/main.c b/arch/i386/boot/main.c deleted file mode 100644 index 0eeef3989a1..00000000000 --- a/arch/i386/boot/main.c +++ /dev/null @@ -1,161 +0,0 @@ -/* -*- linux-c -*- ------------------------------------------------------- * - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright 2007 rPath, Inc. - All Rights Reserved - * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU General Public License version 2. - * - * ----------------------------------------------------------------------- */ - -/* - * arch/i386/boot/main.c - * - * Main module for the real-mode kernel code - */ - -#include "boot.h" - -struct boot_params boot_params __attribute__((aligned(16))); - -char *HEAP = _end; -char *heap_end = _end; /* Default end of heap = no heap */ - -/* - * Copy the header into the boot parameter block. Since this - * screws up the old-style command line protocol, adjust by - * filling in the new-style command line pointer instead. - */ -#define OLD_CL_MAGIC 0xA33F -#define OLD_CL_ADDRESS 0x20 - -static void copy_boot_params(void) -{ - struct old_cmdline { - u16 cl_magic; - u16 cl_offset; - }; - const struct old_cmdline * const oldcmd = - (const struct old_cmdline *)OLD_CL_ADDRESS; - - BUILD_BUG_ON(sizeof boot_params != 4096); - memcpy(&boot_params.hdr, &hdr, sizeof hdr); - - if (!boot_params.hdr.cmd_line_ptr && - oldcmd->cl_magic == OLD_CL_MAGIC) { - /* Old-style command line protocol. */ - u16 cmdline_seg; - - /* Figure out if the command line falls in the region - of memory that an old kernel would have copied up - to 0x90000... */ - if (oldcmd->cl_offset < boot_params.hdr.setup_move_size) - cmdline_seg = ds(); - else - cmdline_seg = 0x9000; - - boot_params.hdr.cmd_line_ptr = - (cmdline_seg << 4) + oldcmd->cl_offset; - } -} - -/* - * Set the keyboard repeat rate to maximum. Unclear why this - * is done here; this might be possible to kill off as stale code. - */ -static void keyboard_set_repeat(void) -{ - u16 ax = 0x0305; - u16 bx = 0; - asm volatile("int $0x16" - : "+a" (ax), "+b" (bx) - : : "ecx", "edx", "esi", "edi"); -} - -/* - * Get Intel SpeedStep (IST) information. - */ -static void query_ist(void) -{ - asm("int $0x15" - : "=a" (boot_params.ist_info.signature), - "=b" (boot_params.ist_info.command), - "=c" (boot_params.ist_info.event), - "=d" (boot_params.ist_info.perf_level) - : "a" (0x0000e980), /* IST Support */ - "d" (0x47534943)); /* Request value */ -} - -/* - * Tell the BIOS what CPU mode we intend to run in. - */ -static void set_bios_mode(void) -{ -#ifdef CONFIG_X86_64 - u32 eax, ebx; - - eax = 0xec00; - ebx = 2; - asm volatile("int $0x15" - : "+a" (eax), "+b" (ebx) - : : "ecx", "edx", "esi", "edi"); -#endif -} - -void main(void) -{ - /* First, copy the boot header into the "zeropage" */ - copy_boot_params(); - - /* End of heap check */ - if (boot_params.hdr.loadflags & CAN_USE_HEAP) { - heap_end = (char *)(boot_params.hdr.heap_end_ptr - +0x200-STACK_SIZE); - } else { - /* Boot protocol 2.00 only, no heap available */ - puts("WARNING: Ancient bootloader, some functionality " - "may be limited!\n"); - } - - /* Make sure we have all the proper CPU support */ - if (validate_cpu()) { - puts("Unable to boot - please use a kernel appropriate " - "for your CPU.\n"); - die(); - } - - /* Tell the BIOS what CPU mode we intend to run in. */ - set_bios_mode(); - - /* Detect memory layout */ - detect_memory(); - - /* Set keyboard repeat rate (why?) */ - keyboard_set_repeat(); - - /* Set the video mode */ - set_video(); - - /* Query MCA information */ - query_mca(); - - /* Voyager */ -#ifdef CONFIG_X86_VOYAGER - query_voyager(); -#endif - - /* Query Intel SpeedStep (IST) information */ - query_ist(); - - /* Query APM information */ -#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) - query_apm_bios(); -#endif - - /* Query EDD information */ -#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) - query_edd(); -#endif - /* Do the last things and invoke protected mode */ - go_to_protected_mode(); -} diff --git a/arch/i386/boot/mca.c b/arch/i386/boot/mca.c deleted file mode 100644 index 68222f2d4b6..00000000000 --- a/arch/i386/boot/mca.c +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- linux-c -*- ------------------------------------------------------- * - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright 2007 rPath, Inc. - All Rights Reserved - * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU General Public License version 2. - * - * ----------------------------------------------------------------------- */ - -/* - * arch/i386/boot/mca.c - * - * Get the MCA system description table - */ - -#include "boot.h" - -int query_mca(void) -{ - u8 err; - u16 es, bx, len; - - asm("pushw %%es ; " - "int $0x15 ; " - "setc %0 ; " - "movw %%es, %1 ; " - "popw %%es" - : "=acd" (err), "=acdSD" (es), "=b" (bx) - : "a" (0xc000)); - - if (err) - return -1; /* No MCA present */ - - set_fs(es); - len = rdfs16(bx); - - if (len > sizeof(boot_params.sys_desc_table)) - len = sizeof(boot_params.sys_desc_table); - - copy_from_fs(&boot_params.sys_desc_table, bx, len); - return 0; -} diff --git a/arch/i386/boot/memory.c b/arch/i386/boot/memory.c deleted file mode 100644 index 378353956b5..00000000000 --- a/arch/i386/boot/memory.c +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- linux-c -*- ------------------------------------------------------- * - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright 2007 rPath, Inc. - All Rights Reserved - * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU General Public License version 2. - * - * ----------------------------------------------------------------------- */ - -/* - * arch/i386/boot/memory.c - * - * Memory detection code - */ - -#include "boot.h" - -#define SMAP 0x534d4150 /* ASCII "SMAP" */ - -static int detect_memory_e820(void) -{ - int count = 0; - u32 next = 0; - u32 size, id; - u8 err; - struct e820entry *desc = boot_params.e820_map; - - do { - size = sizeof(struct e820entry); - - /* Important: %edx is clobbered by some BIOSes, - so it must be either used for the error output - or explicitly marked clobbered. */ - asm("int $0x15; setc %0" - : "=d" (err), "+b" (next), "=a" (id), "+c" (size), - "=m" (*desc) - : "D" (desc), "d" (SMAP), "a" (0xe820)); - - /* Some BIOSes stop returning SMAP in the middle of - the search loop. We don't know exactly how the BIOS - screwed up the map at that point, we might have a - partial map, the full map, or complete garbage, so - just return failure. */ - if (id != SMAP) { - count = 0; - break; - } - - if (err) - break; - - count++; - desc++; - } while (next && count < E820MAX); - - return boot_params.e820_entries = count; -} - -static int detect_memory_e801(void) -{ - u16 ax, bx, cx, dx; - u8 err; - - bx = cx = dx = 0; - ax = 0xe801; - asm("stc; int $0x15; setc %0" - : "=m" (err), "+a" (ax), "+b" (bx), "+c" (cx), "+d" (dx)); - - if (err) - return -1; - - /* Do we really need to do this? */ - if (cx || dx) { - ax = cx; - bx = dx; - } - - if (ax > 15*1024) - return -1; /* Bogus! */ - - /* This ignores memory above 16MB if we have a memory hole - there. If someone actually finds a machine with a memory - hole at 16MB and no support for 0E820h they should probably - generate a fake e820 map. */ - boot_params.alt_mem_k = (ax == 15*1024) ? (dx << 6)+ax : ax; - - return 0; -} - -static int detect_memory_88(void) -{ - u16 ax; - u8 err; - - ax = 0x8800; - asm("stc; int $0x15; setc %0" : "=bcdm" (err), "+a" (ax)); - - boot_params.screen_info.ext_mem_k = ax; - - return -err; -} - -int detect_memory(void) -{ - int err = -1; - - if (detect_memory_e820() > 0) - err = 0; - - if (!detect_memory_e801()) - err = 0; - - if (!detect_memory_88()) - err = 0; - - return err; -} diff --git a/arch/i386/boot/mtools.conf.in b/arch/i386/boot/mtools.conf.in deleted file mode 100644 index efd6d2490c1..00000000000 --- a/arch/i386/boot/mtools.conf.in +++ /dev/null @@ -1,17 +0,0 @@ -# -# mtools configuration file for "make (b)zdisk" -# - -# Actual floppy drive -drive a: - file="/dev/fd0" - -# 1.44 MB floppy disk image -drive v: - file="@OBJ@/fdimage" cylinders=80 heads=2 sectors=18 filter - -# 2.88 MB floppy disk image (mostly for virtual uses) -drive w: - file="@OBJ@/fdimage" cylinders=80 heads=2 sectors=36 filter - - diff --git a/arch/i386/boot/pm.c b/arch/i386/boot/pm.c deleted file mode 100644 index 09fb342cc62..00000000000 --- a/arch/i386/boot/pm.c +++ /dev/null @@ -1,174 +0,0 @@ -/* -*- linux-c -*- ------------------------------------------------------- * - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright 2007 rPath, Inc. - All Rights Reserved - * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU Gen