Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c3973682 authored by H. Peter Anvin's avatar H. Peter Anvin Committed by Linus Torvalds
Browse files

Remove old i386 setup code



This removes the old i386 setup code.  This is done as a separate patch
to avoid breaking git bisect as some of the i386 code was also used by
the old x86-64 code.

Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 91a6c462
Loading
Loading
Loading
Loading

arch/i386/boot/bootsect.S

deleted100644 → 0
+0 −98
Original line number Diff line number Diff line
/*
 *	bootsect.S		Copyright (C) 1991, 1992 Linus Torvalds
 *
 *	modified by Drew Eckhardt
 *	modified by Bruce Evans (bde)
 *	modified by Chris Noe (May 1999) (as86 -> gas)
 *	gutted by H. Peter Anvin (Jan 2003)
 *
 * 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 <asm/boot.h>

SETUPSECTS	= 4			/* default nr of setup-sectors */
BOOTSEG		= 0x07C0		/* original address of boot-sector */
INITSEG		= DEF_INITSEG		/* we move boot here - out of the way */
SETUPSEG	= DEF_SETUPSEG		/* setup starts here */
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
.text

.global _start
_start:

	# Normalize the start address
	jmpl	$BOOTSEG, $start2

start2:
	movw	%cs, %ax
	movw	%ax, %ds
	movw	%ax, %es
	movw	%ax, %ss
	movw	$0x7c00, %sp
	sti
	cld

	movw	$bugger_off_msg, %si

msg_loop:
	lodsb
	andb	%al, %al
	jz	die
	movb	$0xe, %ah
	movw	$7, %bx
	int	$0x10
	jmp	msg_loop

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


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

	.org 497
setup_sects:	.byte SETUPSECTS
root_flags:	.word ROOT_RDONLY
syssize:	.word SYSSIZE
swap_dev:	.word SWAP_DEV
ram_size:	.word RAMDISK
vid_mode:	.word SVGA_MODE
root_dev:	.word ROOT_DEV
boot_flag:	.word 0xAA55

arch/i386/boot/edd.S

deleted100644 → 0
+0 −231
Original line number Diff line number Diff line
/*
 * BIOS Enhanced Disk Drive support
 * Copyright (C) 2002, 2003, 2004 Dell, Inc.
 * by Matt Domsch <Matt_Domsch@dell.com> October 2002
 * conformant to T13 Committee www.t13.org
 *   projects 1572D, 1484D, 1386D, 1226DT
 * disk signature read by Matt Domsch <Matt_Domsch@dell.com>
 *	and Andrew Wilks <Andrew_Wilks@dell.com> September 2003, June 2004
 * legacy CHS retrieval by Patrick J. LoPresti <patl@users.sourceforge.net>
 *      March 2004
 * Command line option parsing, Matt Domsch, November 2004
 */

#include <linux/edd.h>
#include <asm/setup.h>

#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)

# It is assumed that %ds == INITSEG here

	movb	$0, (EDD_MBR_SIG_NR_BUF)
	movb	$0, (EDDNR)

# Check the command line for options:
# edd=of  disables EDD completely  (edd=off)
# edd=sk  skips the MBR test    (edd=skipmbr)
# edd=on  re-enables EDD (edd=on)

	pushl	%esi
	movw	$edd_mbr_sig_start, %di	# Default to edd=on

	movl	%cs:(cmd_line_ptr), %esi
	andl	%esi, %esi
	jz	old_cl			# Old boot protocol?

# Convert to a real-mode pointer in fs:si
	movl	%esi, %eax
	shrl	$4, %eax
	movw	%ax, %fs
	andw	$0xf, %si
	jmp	have_cl_pointer

# Old-style boot protocol?
old_cl:
	push	%ds			# aka INITSEG
	pop	%fs

	cmpw	$0xa33f, (0x20)
	jne	done_cl			# No command line at all?
	movw	(0x22), %si		# Pointer relative to INITSEG

# fs:si has the pointer to the command line now
have_cl_pointer:

# Loop through kernel command line one byte at a time.  Just in
# case the loader is buggy and failed to null-terminate the command line
# terminate if we get close enough to the end of the segment that we
# cannot fit "edd=XX"...
cl_atspace:
	cmpw	$-5, %si		# Watch for segment wraparound
	jae	done_cl
	movl	%fs:(%si), %eax
	andb	%al, %al		# End of line?
	jz	done_cl
	cmpl	$EDD_CL_EQUALS, %eax
	jz	found_edd_equals
	cmpb	$0x20, %al		# <= space consider whitespace
	ja	cl_skipword
	incw	%si
	jmp	cl_atspace

cl_skipword:
	cmpw	$-5, %si		# Watch for segment wraparound
	jae	done_cl
	movb	%fs:(%si), %al		# End of string?
	andb	%al, %al
	jz	done_cl
	cmpb	$0x20, %al
	jbe	cl_atspace
	incw	%si
	jmp	cl_skipword

found_edd_equals:
# only looking at first two characters after equals
# late overrides early on the command line, so keep going after finding something
	movw	%fs:4(%si), %ax
	cmpw	$EDD_CL_OFF, %ax	# edd=of
	je	do_edd_off
	cmpw	$EDD_CL_SKIP, %ax	# edd=sk
	je	do_edd_skipmbr
	cmpw	$EDD_CL_ON, %ax		# edd=on
	je	do_edd_on
	jmp	cl_skipword
do_edd_skipmbr:
	movw	$edd_start, %di
	jmp	cl_skipword
do_edd_off:
	movw	$edd_done, %di
	jmp	cl_skipword
do_edd_on:
	movw	$edd_mbr_sig_start, %di
	jmp	cl_skipword

done_cl:
	popl	%esi
	jmpw	*%di

# Read the first sector of each BIOS disk device and store the 4-byte signature
edd_mbr_sig_start:
	movb	$0x80, %dl			# from device 80
	movw	$EDD_MBR_SIG_BUF, %bx		# store buffer ptr in bx
edd_mbr_sig_read:
	movl	$0xFFFFFFFF, %eax
	movl	%eax, (%bx)			# assume failure
	pushw	%bx
	movb	$READ_SECTORS, %ah
	movb	$1, %al				# read 1 sector
	movb	$0, %dh				# at head 0
	movw	$1, %cx				# cylinder 0, sector 0
	pushw	%es
	pushw	%ds
	popw	%es
    	movw	$EDDBUF, %bx			# disk's data goes into EDDBUF
	pushw	%dx             # work around buggy BIOSes
	stc                     # work around buggy BIOSes
	int	$0x13
	sti                     # work around buggy BIOSes
	popw	%dx
	popw	%es
	popw	%bx
	jc	edd_mbr_sig_done		# on failure, we're done.
	cmpb	$0, %ah		# some BIOSes do not set CF
	jne	edd_mbr_sig_done		# on failure, we're done.
	movl	(EDDBUF+EDD_MBR_SIG_OFFSET), %eax # read sig out of the MBR
	movl	%eax, (%bx)			# store success
	incb	(EDD_MBR_SIG_NR_BUF)		# note that we stored something
	incb	%dl				# increment to next device
	addw	$4, %bx				# increment sig buffer ptr
	cmpb	$EDD_MBR_SIG_MAX, (EDD_MBR_SIG_NR_BUF)	# Out of space?
	jb	edd_mbr_sig_read		# keep looping
edd_mbr_sig_done:

# Do the BIOS Enhanced Disk Drive calls
# This consists of two calls:
#    int 13h ah=41h "Check Extensions Present"
#    int 13h ah=48h "Get Device Parameters"
#    int 13h ah=08h "Legacy Get Device Parameters"
#
# A buffer of size EDDMAXNR*(EDDEXTSIZE+EDDPARMSIZE) is reserved for our use
# in the boot_params at EDDBUF.  The first four bytes of which are
# used to store the device number, interface support map and version
# results from fn41.  The next four bytes are used to store the legacy
# cylinders, heads, and sectors from fn08. The following 74 bytes are used to
# store the results from fn48.  Starting from device 80h, fn41, then fn48
# are called and their results stored in EDDBUF+n*(EDDEXTSIZE+EDDPARMIZE).
# Then the pointer is incremented to store the data for the next call.
# This repeats until either a device doesn't exist, or until EDDMAXNR
# devices have been stored.
# The one tricky part is that ds:si always points EDDEXTSIZE bytes into
# the structure, and the fn41 and fn08 results are stored at offsets
# from there.  This removes the need to increment the pointer for
# every store, and leaves it ready for the fn48 call.
# A second one-byte buffer, EDDNR, in the boot_params stores
# the number of BIOS devices which exist, up to EDDMAXNR.
# In setup.c, copy_edd() stores both boot_params buffers away
# for later use, as they would get overwritten otherwise.
# This code is sensitive to the size of the structs in edd.h
edd_start:
						# %ds points to the bootsector
       						# result buffer for fn48
	movw	$EDDBUF+EDDEXTSIZE, %si		# in ds:si, fn41 results
						# kept just before that
	movb	$0x80, %dl			# BIOS device 0x80

edd_check_ext:
	movb	$CHECKEXTENSIONSPRESENT, %ah    # Function 41
	movw	$EDDMAGIC1, %bx			# magic
	int	$0x13				# make the call
	jc	edd_done			# no more BIOS devices

	cmpw	$EDDMAGIC2, %bx			# is magic right?
	jne	edd_next			# nope, next...

	movb	%dl, %ds:-8(%si)		# store device number
	movb	%ah, %ds:-7(%si)		# store version
	movw	%cx, %ds:-6(%si)		# store extensions
	incb	(EDDNR)				# note that we stored something

edd_get_device_params:
	movw	$EDDPARMSIZE, %ds:(%si)		# put size
	movw	$0x0, %ds:2(%si)		# work around buggy BIOSes
	movb	$GETDEVICEPARAMETERS, %ah	# Function 48
	int	$0x13				# make the call
						# Don't check for fail return
						# it doesn't matter.
edd_get_legacy_chs:
	xorw    %ax, %ax
	movw    %ax, %ds:-4(%si)
	movw    %ax, %ds:-2(%si)
        # Ralf Brown's Interrupt List says to set ES:DI to
	# 0000h:0000h "to guard against BIOS bugs"
	pushw   %es
	movw    %ax, %es
	movw    %ax, %di
	pushw   %dx                             # legacy call clobbers %dl
	movb    $LEGACYGETDEVICEPARAMETERS, %ah # Function 08
	int     $0x13                           # make the call
	jc      edd_legacy_done                 # failed
	movb    %cl, %al                        # Low 6 bits are max
	andb    $0x3F, %al                      #   sector number
	movb	%al, %ds:-1(%si)                # Record max sect
	movb    %dh, %ds:-2(%si)                # Record max head number
	movb    %ch, %al                        # Low 8 bits of max cyl
	shr     $6, %cl
	movb    %cl, %ah                        # High 2 bits of max cyl
	movw    %ax, %ds:-4(%si)

edd_legacy_done:
	popw    %dx
	popw    %es
	movw	%si, %ax			# increment si
	addw	$EDDPARMSIZE+EDDEXTSIZE, %ax
	movw	%ax, %si

edd_next:
	incb	%dl				# increment to next device
	cmpb	$EDDMAXNR, (EDDNR) 		# Out of space?
	jb	edd_check_ext			# keep looping

edd_done:
#endif

arch/i386/boot/setup.S

deleted100644 → 0
+0 −1075

File deleted.

Preview size limit exceeded, changes collapsed.

arch/i386/boot/video.S

deleted100644 → 0
+0 −2043

File deleted.

Preview size limit exceeded, changes collapsed.

arch/i386/kernel/verify_cpu.S

deleted100644 → 0
+0 −94
Original line number Diff line number Diff line
/* Check if CPU has some minimum CPUID bits
   This runs in 16bit mode so that the caller can still use the BIOS
   to output errors on the screen */
#include <asm/cpufeature.h>
#include <asm/msr.h>

verify_cpu:
	pushfl				# Save caller passed flags
	pushl	$0			# Kill any dangerous flags
	popfl

#if CONFIG_X86_MINIMUM_CPU_FAMILY >= 4
	pushfl
	pop	%eax
	orl	$(1<<18),%eax		# try setting AC
	push	%eax
	popfl
	pushfl
	popl    %eax
	testl	$(1<<18),%eax
	jz	bad
#endif
#if REQUIRED_MASK0 != 0
	pushfl				# standard way to check for cpuid
	popl	%eax
	movl	%eax,%ebx
	xorl	$0x200000,%eax
	pushl	%eax
	popfl
	pushfl
	popl	%eax
	cmpl	%eax,%ebx
	pushfl				# standard way to check for cpuid
	popl	%eax
	movl	%eax,%ebx
	xorl	$0x200000,%eax
	pushl	%eax
	popfl
	pushfl
	popl	%eax
	cmpl	%eax,%ebx
	jz	bad			# REQUIRED_MASK0 != 0 requires CPUID

	movl	$0x0,%eax		# See if cpuid 1 is implemented
	cpuid
	cmpl	$0x1,%eax
	jb	bad			# no cpuid 1

#if REQUIRED_MASK0 & NEED_CMPXCHG64
	/* Some VIA C3s need magic MSRs to enable CX64. Do this here */
	cmpl	$0x746e6543,%ebx	# Cent
	jne	1f
	cmpl 	$0x48727561,%edx	# aurH
	jne	1f
	cmpl	$0x736c7561,%ecx	# auls
	jne	1f
	movl	$1,%eax			# check model
	cpuid
	movl	%eax,%ebx
	shr	$8,%ebx
	andl	$0xf,%ebx
	cmp	$6,%ebx			# check family == 6
	jne	1f
	shr	$4,%eax
	andl	$0xf,%eax
	cmpl	$6,%eax			# check model >= 6
	jb	1f
	# assume models >= 6 all support this MSR
	movl	$MSR_VIA_FCR,%ecx
	rdmsr
	orl	$((1<<1)|(1<<7)),%eax	# enable CMPXCHG64 and PGE
	wrmsr
1:
#endif
	movl    $0x1,%eax		# Does the cpu have what it takes
	cpuid

#if CONFIG_X86_MINIMUM_CPU_FAMILY > 4
#error	add proper model checking here
#endif

	andl	$REQUIRED_MASK0,%edx
	xorl	$REQUIRED_MASK0,%edx
	jnz	bad
#endif /* REQUIRED_MASK0 */

	popfl
	xor	%eax,%eax
	ret

bad:
	popfl
	movl	$1,%eax
	ret
Loading