summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>2009-12-11 12:36:59 +0000
committernyan <nyan@FreeBSD.org>2009-12-11 12:36:59 +0000
commit0c487f55f0f4714916606b976e51f30eefde5457 (patch)
tree0ea2796723fdd7fb27296ac312e913994c64c8dc
parent283e12cf4eb77bb1d3344ecd256d80cd3b882534 (diff)
downloadFreeBSD-src-0c487f55f0f4714916606b976e51f30eefde5457.zip
FreeBSD-src-0c487f55f0f4714916606b976e51f30eefde5457.tar.gz
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. MFC after: 1 week
-rw-r--r--sys/boot/pc98/boot2/Makefile6
-rw-r--r--sys/boot/pc98/boot2/bios.S94
-rw-r--r--sys/boot/pc98/boot2/boot.c5
-rw-r--r--sys/boot/pc98/boot2/boot.h5
-rw-r--r--sys/boot/pc98/boot2/disk.c3
-rw-r--r--sys/boot/pc98/boot2/io.c24
-rw-r--r--sys/boot/pc98/boot2/serial_16550.S1
-rw-r--r--sys/boot/pc98/boot2/sys.c44
8 files changed, 18 insertions, 164 deletions
diff --git a/sys/boot/pc98/boot2/Makefile b/sys/boot/pc98/boot2/Makefile
index f5da55d..4d62a8e 100644
--- a/sys/boot/pc98/boot2/Makefile
+++ b/sys/boot/pc98/boot2/Makefile
@@ -28,6 +28,12 @@ CFLAGS+= -DCOMCONSOLE=${BOOT_COMCONSOLE_PORT} \
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
diff --git a/sys/boot/pc98/boot2/bios.S b/sys/boot/pc98/boot2/bios.S
index 8a884d6..0b38dff 100644
--- a/sys/boot/pc98/boot2/bios.S
+++ b/sys/boot/pc98/boot2/bios.S
@@ -91,8 +91,6 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "asm.h"
.text
-#ifndef CDBOOT
-
/*
* PC-9801/PC-9821 SCSI MO booting
* 2002/06/05-07/03 Kawanobe Koh <kawanobe@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
diff --git a/sys/boot/pc98/boot2/boot.c b/sys/boot/pc98/boot2/boot.c
index 4bdfbef..c1a13de 100644
--- a/sys/boot/pc98/boot2/boot.c
+++ b/sys/boot/pc98/boot2/boot.c
@@ -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
diff --git a/sys/boot/pc98/boot2/boot.h b/sys/boot/pc98/boot2/boot.h
index e39fee5..3ca8b41 100644
--- a/sys/boot/pc98/boot2/boot.h
+++ b/sys/boot/pc98/boot2/boot.h
@@ -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);
diff --git a/sys/boot/pc98/boot2/disk.c b/sys/boot/pc98/boot2/disk.c
index f9706ca..90ea121 100644
--- a/sys/boot/pc98/boot2/disk.c
+++ b/sys/boot/pc98/boot2/disk.c
@@ -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;
}
diff --git a/sys/boot/pc98/boot2/io.c b/sys/boot/pc98/boot2/io.c
index a6b9bdc..d2f8797 100644
--- a/sys/boot/pc98/boot2/io.c
+++ b/sys/boot/pc98/boot2/io.c
@@ -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
diff --git a/sys/boot/pc98/boot2/serial_16550.S b/sys/boot/pc98/boot2/serial_16550.S
index 114a369..9da9cd3 100644
--- a/sys/boot/pc98/boot2/serial_16550.S
+++ b/sys/boot/pc98/boot2/serial_16550.S
@@ -67,7 +67,6 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.file "serial.S"
-#include <dev/sio/sioreg.h>
#include "asm.h"
.text
diff --git a/sys/boot/pc98/boot2/sys.c b/sys/boot/pc98/boot2/sys.c
index c8d4304..a848ca9 100644
--- a/sys/boot/pc98/boot2/sys.c
+++ b/sys/boot/pc98/boot2/sys.c
@@ -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;
}
OpenPOWER on IntegriCloud