svn commit: r202356 - stable/6/sys/boot/pc98/boot2

Takahashi Yoshihiro nyan at FreeBSD.org
Fri Jan 15 12:52:46 UTC 2010


Author: nyan
Date: Fri Jan 15 12:52:45 2010
New Revision: 202356
URL: http://svn.freebsd.org/changeset/base/202356

Log:
  MFC: revision 200407
  
    Cleanups the boot2 for pc98.  There is no functional change.
      - Make setting machine type and getting geom conditional for future.
      - Remove unused RAWBOOT and CDBOOT supports.
      - Remove unneeded include.
      - Fix warnings.
  
  This change is directly merged into stable/6 because stable/[78] have
  new boot2.

Modified:
  stable/6/sys/boot/pc98/boot2/Makefile
  stable/6/sys/boot/pc98/boot2/bios.S
  stable/6/sys/boot/pc98/boot2/boot.c
  stable/6/sys/boot/pc98/boot2/boot.h
  stable/6/sys/boot/pc98/boot2/disk.c
  stable/6/sys/boot/pc98/boot2/io.c
  stable/6/sys/boot/pc98/boot2/serial_16550.S
  stable/6/sys/boot/pc98/boot2/sys.c
Directory Properties:
  stable/6/sys/   (props changed)
  stable/6/sys/contrib/pf/   (props changed)
  stable/6/sys/dev/cxgb/   (props changed)

Modified: stable/6/sys/boot/pc98/boot2/Makefile
==============================================================================
--- stable/6/sys/boot/pc98/boot2/Makefile	Fri Jan 15 12:45:23 2010	(r202355)
+++ stable/6/sys/boot/pc98/boot2/Makefile	Fri Jan 15 12:52:45 2010	(r202356)
@@ -29,6 +29,12 @@ CFLAGS+=	-DCOMCONSOLE=${BOOT_COMCONSOLE_
 BOOT_COMCONSOLE_SPEED?=9600
 CFLAGS+=	-DCOMSPEED=${BOOT_COMCONSOLE_SPEED}
 
+# Set machine type to PC98_SYSTEM_PARAMETER
+CFLAGS+=	-DSET_MACHINE_TYPE
+
+# Initialize the bi_bios_geom using the BIOS geometry
+CFLAGS+=	-DGET_BIOSGEOM
+
 # Enable code to take the default boot string from a fixed location on the
 # disk.  See nextboot(8) and README.386BSD for more info.
 #CFLAGS+=	-DNAMEBLOCK

Modified: stable/6/sys/boot/pc98/boot2/bios.S
==============================================================================
--- stable/6/sys/boot/pc98/boot2/bios.S	Fri Jan 15 12:45:23 2010	(r202355)
+++ stable/6/sys/boot/pc98/boot2/bios.S	Fri Jan 15 12:52:45 2010	(r202356)
@@ -91,8 +91,6 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT
 #include "asm.h"
 	.text
 
-#ifndef CDBOOT
-
 /*
  *  PC-9801/PC-9821 SCSI MO booting
  *    2002/06/05-07/03 Kawanobe Koh <kawanobe at st.rim.or.jp>
@@ -198,98 +196,6 @@ read_end:
 
 	ret
 
-#else /* CDBOOT */
-
-
-/*
- * int
- * getbootspec(struct specpacket *offset)
- *
- * Read CD-ROM boot specification packet to "offset".
- */
-ENTRY(getbootspec)
-	push	%ebp
-	mov	%esp, %ebp
-
-	push	%esi
-	push	%ebx
-
-	movw	0x8(%ebp), %si
-	mov	$0x7f, %edx
-
-	/* prot_to_real will set %es to BOOTSEG */
-	call	EXT(prot_to_real)	/* enter real mode */
-	movw	$0x4b01, %ax		/* (do not) terminate disk emulation */
-	movb	$0x7f, %dl		/* any drive */
-
-	sti
-	int	$0x13
-	cli
-
-	/* save return value (actually movw %ax, %bx) */
-	mov	%eax, %ebx
-
-	data32
-	call	EXT(real_to_prot)	/* back to protected mode */
-
-	xor	%eax, %eax
-	movb	%bh, %al		/* return value in %ax */
-
-	pop	%ebx
-	pop	%esi
-	pop	%ebp
-
-	ret
-
-
-/*
- * int
- * biosreadlba(struct daddrpacket *daddr)
- *	Read sectors using the BIOS "read extended" function
- * BIOS call "INT 0x13 Function 0x42" to read sectors from disk into memory
- *	Call with	%ah = 0x42
- *			%dl = drive (0x0 for floppy disk, or emulated CD)
- *			%ds:%si = ptr to disk address packet
- *	Return:
- *			%ah = 0x0 on success; err code on failure
- */
-
-ENTRY(biosreadlba)
-	push	%ebp
-	mov	%esp, %ebp
-
-	push	%ebx
-	push	%esi
-
-	movw	8(%ebp), %si
-	movl	$0, %edx		/* emulated CD is always drive 0 */
-
-	/* prot_to_real will set %es to BOOTSEG */
-	call	EXT(prot_to_real)	/* enter real mode */
-	movw	$0x4200, %ax		/* subfunction */
-	movb	$0, %dl
-
-	sti
-	int	$0x13
-	cli
-
-	/* save return value (actually movw %ax, %bx) */
-	mov	%eax, %ebx
-
-	data32
-	call	EXT(real_to_prot)	/* back to protected mode */
-
-	xor	%eax, %eax
-	movb	%bh, %al		/* return value in %ax */
-
-	pop	%esi
-	pop	%ebx
-	pop	%ebp
-
-	ret
-
-#endif /* !CDBOOT */
-
 /*
  * getc()
  * BIOS call "INT 18H Function 00H" to read character from keyboard

Modified: stable/6/sys/boot/pc98/boot2/boot.c
==============================================================================
--- stable/6/sys/boot/pc98/boot2/boot.c	Fri Jan 15 12:45:23 2010	(r202355)
+++ stable/6/sys/boot/pc98/boot2/boot.c	Fri Jan 15 12:52:45 2010	(r202356)
@@ -85,12 +85,13 @@ boot(int drive)
 	unsigned char disk_equips;
 
 	/* Pick up the story from the Bios on geometry of disks */
-
+#ifdef GET_BIOSGEOM
 	for(ret = 0; ret < 2; ret ++) {
 		if (*(unsigned char*)V(0xA155d) & (1 << ret)) {
 			bootinfo.bi_bios_geom[ret] = get_diskinfo(ret + 0x80);
 		}
 	}
+#endif
 
 	bootinfo.bi_basemem = memsize(0);
 	bootinfo.bi_extmem = memsize(1);
@@ -98,8 +99,10 @@ boot(int drive)
 
 	gateA20();
 
+#ifdef SET_MACHINE_TYPE
 	/* set machine type to PC98_SYSTEM_PARAMETER */
 	machine_check();
+#endif
 
 	/*
 	 * The default boot device is the first partition in the

Modified: stable/6/sys/boot/pc98/boot2/boot.h
==============================================================================
--- stable/6/sys/boot/pc98/boot2/boot.h	Fri Jan 15 12:45:23 2010	(r202355)
+++ stable/6/sys/boot/pc98/boot2/boot.h	Fri Jan 15 12:52:45 2010	(r202356)
@@ -51,7 +51,7 @@ extern int loadflags;
 extern struct disklabel disklabel;
 
 /* asm.S */
-#if ASM_ONLY
+#ifdef ASM_ONLY
 void real_to_prot(void);
 void prot_to_real(void);
 #endif
@@ -84,9 +84,6 @@ void putchar(int c);
 void delay1ms(void);
 int gets(char *buf);
 int strcmp(const char *s1, const char *s2);
-#ifdef CDBOOT
-int strcasecmp(const char *s1, const char *s2);
-#endif /* !CDBOOT */
 void memcpy(const void *from, void *to, size_t len);
 void twiddle(void);
 void machine_check(void);

Modified: stable/6/sys/boot/pc98/boot2/disk.c
==============================================================================
--- stable/6/sys/boot/pc98/boot2/disk.c	Fri Jan 15 12:45:23 2010	(r202355)
+++ stable/6/sys/boot/pc98/boot2/disk.c	Fri Jan 15 12:52:45 2010	(r202356)
@@ -87,7 +87,6 @@ devopen(void)
 	di = get_diskinfo(dosdev_copy);
 	spc = (spt = SPT(di)) * HEADS(di);
 
-#ifndef RAWBOOT
 	if ((dosdev_copy & 0xf0) == 0x90)
 	{
 		boff = 0;
@@ -119,7 +118,7 @@ devopen(void)
 		boff = dl->d_partitions[part].p_offset -
 			dl->d_partitions[2].p_offset + sector;
 	}
-#endif /* RAWBOOT */
+
 	return 0;
 }
 

Modified: stable/6/sys/boot/pc98/boot2/io.c
==============================================================================
--- stable/6/sys/boot/pc98/boot2/io.c	Fri Jan 15 12:45:23 2010	(r202355)
+++ stable/6/sys/boot/pc98/boot2/io.c	Fri Jan 15 12:52:45 2010	(r202356)
@@ -162,7 +162,7 @@ delay1ms(void)
 	    (void)outb(0x5f,0);		/* about 600ns */
 }
 
-static __inline int
+static int
 isch(void)
 {
 	int isc;
@@ -182,7 +182,7 @@ isch(void)
 	return (serial_ischar());
 }
 
-static __inline unsigned
+static unsigned
 pword(unsigned physaddr)
 {
 	static int counter = 0;
@@ -246,24 +246,6 @@ strcmp(const char *s1, const char *s2)
 	return 1;
 }
 
-#ifdef CDBOOT
-int
-strcasecmp(const char *s1, const char *s2)
-{
-	/*
-	 * We only consider ASCII chars and don't anticipate
-	 * control characters (they are invalid in filenames
-	 * anyway).
-	 */
-	while ((*s1 & 0x5f) == (*s2 & 0x5f)) {
-		if (!*s1++)
-			return 0;
-		s2++;
-	}
-	return 1;
-}
-#endif /* !CDBOOT */
-
 void
 memcpy(const void *from, void *to, size_t len)
 {
@@ -349,6 +331,7 @@ void putc(int c)
 	outb(0x60, pos >> 8);
 }
 
+#ifdef SET_MACHINE_TYPE
 void machine_check(void)
 {
 	int	ret;
@@ -394,3 +377,4 @@ void machine_check(void)
 
 	(*(unsigned long *)V(0xA1620)) = ret;
 }
+#endif

Modified: stable/6/sys/boot/pc98/boot2/serial_16550.S
==============================================================================
--- stable/6/sys/boot/pc98/boot2/serial_16550.S	Fri Jan 15 12:45:23 2010	(r202355)
+++ stable/6/sys/boot/pc98/boot2/serial_16550.S	Fri Jan 15 12:52:45 2010	(r202356)
@@ -67,7 +67,6 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT
 
 	.file	"serial.S"
 
-#include <dev/sio/sioreg.h>
 #include "asm.h"
 
 	.text

Modified: stable/6/sys/boot/pc98/boot2/sys.c
==============================================================================
--- stable/6/sys/boot/pc98/boot2/sys.c	Fri Jan 15 12:45:23 2010	(r202355)
+++ stable/6/sys/boot/pc98/boot2/sys.c	Fri Jan 15 12:52:45 2010	(r202356)
@@ -53,10 +53,6 @@ static int mapblock;
 
 int poff;
 
-#ifdef RAWBOOT
-#define STARTBYTE	8192	/* Where on the media the kernel starts */
-#endif
-
 static int block_map(int file_block);
 static int find(char *path);
 
@@ -74,7 +70,6 @@ xread(char *addr, int size)
 	}
 }
 
-#ifndef RAWBOOT
 void
 read(char *buffer, int count)
 {
@@ -102,40 +97,6 @@ read(char *buffer, int count)
 		poff += size;
 	}
 }
-#else
-void
-read(char *buffer, int count)
-{
-	int cnt, bnum, off, size;
-
-	off = STARTBYTE + poff;
-	poff += count;
-
-	/* Read any unaligned bit at the front */
-	cnt = off & 511;
-	if (cnt) {
-		size = 512-cnt;
-		if (count < size)
-			size = count;
-		devread(iobuf, off >> 9, 512);
-		memcpy(iobuf+cnt, buffer, size);
-		count -= size;
-		off += size;
-		buffer += size;
-	}
-	size = count & (~511);
-	if (size && (off & (~511))) {
-		devread(buffer, off >> 9, size);
-		off += size;
-		count -= size;
-		buffer += size;
-	}
-	if (count) {
-		devread(iobuf, off >> 9, 512);
-		memcpy(iobuf, buffer, count);
-	}
-}
-#endif
 
 static int
 find(char *path)
@@ -263,7 +224,7 @@ openrd(void)
 	biosdrive = biosdrivedigit - '0';
 	if (biosdrivedigit == '\0') {
 		biosdrive = dosdev & 0x0f;
-#if BOOT_HD_BIAS > 0
+#if defined(BOOT_HD_BIAS) && (BOOT_HD_BIAS > 0)
 		/* XXX */
 		if (maj == 4)
 			biosdrive += BOOT_HD_BIAS;
@@ -299,7 +260,6 @@ openrd(void)
 	if (devopen())
 		return 1;
 
-#ifndef RAWBOOT
 	/***********************************************\
 	* Load Filesystem info (mount the device)	*
 	\***********************************************/
@@ -316,6 +276,6 @@ openrd(void)
 		return -1;
 	}
 	poff = 0;
-#endif /* RAWBOOT */
+
 	return 0;
 }


More information about the svn-src-stable-6 mailing list