diff --git a/sys/boot/pc98/libpc98/biosdisk.c b/sys/boot/pc98/libpc98/biosdisk.c index 20b774e672b7..4bc91ae4f5c4 100644 --- a/sys/boot/pc98/libpc98/biosdisk.c +++ b/sys/boot/pc98/libpc98/biosdisk.c @@ -94,7 +94,7 @@ static struct bdinfo int bd_flags; int bd_type; /* BIOS 'drive type' (floppy only) */ #ifdef PC98 - int bd_da_unit; /* kernel unit number for da */ + int bd_da_unit; /* kernel unit number for da */ #endif } bdinfo [MAXBDDEV]; static int nbdinfo = 0; @@ -227,6 +227,7 @@ bd_init(void) static int bd_int13probe(struct bdinfo *bd) { + #ifdef PC98 int addr; if (bd->bd_flags & BD_FLOPPY){ @@ -535,6 +536,7 @@ bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev) od->od_boff = sector; /* no partition, must be after the slice */ DEBUG("opening raw slice"); } else { + if (bd_read(od, sector + LABELSECTOR, 1, buf)) { DEBUG("error reading disklabel"); error = EIO; @@ -596,7 +598,7 @@ bd_bestslice(struct dos_partition *dptr) int i; int preflevel, pref; - + #ifndef PC98 /* * Check for the historically bogus MBR found on true dedicated disks @@ -938,6 +940,37 @@ bd_getgeom(struct open_disk *od) return(0); } +#ifndef PC98 +/* + * Return the BIOS geometry of a given "fixed drive" in a format + * suitable for the legacy bootinfo structure. Since the kernel is + * expecting raw int 0x13/0x8 values for N_BIOS_GEOM drives, we + * prefer to get the information directly, rather than rely on being + * able to put it together from information already maintained for + * different purposes and for a probably different number of drives. + * + * For valid drives, the geometry is expected in the format (31..0) + * "000000cc cccccccc hhhhhhhh 00ssssss"; and invalid drives are + * indicated by returning the geometry of a "1.2M" PC-format floppy + * disk. And, incidentally, what is returned is not the geometry as + * such but the highest valid cylinder, head, and sector numbers. + */ +u_int32_t +bd_getbigeom(int bunit) +{ + + v86.ctl = V86_FLAGS; + v86.addr = 0x13; + v86.eax = 0x800; + v86.edx = 0x80 + bunit; + v86int(); + if (v86.efl & 0x1) + return 0x4f010f; + return ((v86.ecx & 0xc0) << 18) | ((v86.ecx & 0xff00) << 8) | + (v86.edx & 0xff00) | (v86.ecx & 0x3f); +} +#endif + /* * Return a suitable dev_t value for (dev). * diff --git a/sys/boot/pc98/libpc98/biosmem.c b/sys/boot/pc98/libpc98/biosmem.c index f473935f962c..72bfae129437 100644 --- a/sys/boot/pc98/libpc98/biosmem.c +++ b/sys/boot/pc98/libpc98/biosmem.c @@ -1,5 +1,7 @@ /* * mjs copyright + * + * $FreeBSD$ */ /* @@ -41,7 +43,7 @@ int getextmem(void) { int extkb; - + #ifdef PC98 extkb = *(u_char *)PTOV(0xA1401)*128 + *(unsigned short *)PTOV(0xA1594)*1024; #else @@ -51,6 +53,7 @@ getextmem(void) v86int(); extkb = v86.eax & 0xffff; #endif + /* Set memtop to actual top or 16M, whicheve is less */ memtop = min((0x100000 + (extkb * 1024)), (16 * 1024 * 1024)); diff --git a/sys/boot/pc98/libpc98/bootinfo.c b/sys/boot/pc98/libpc98/bootinfo.c index 6b780f1767ec..e224536c3004 100644 --- a/sys/boot/pc98/libpc98/bootinfo.c +++ b/sys/boot/pc98/libpc98/bootinfo.c @@ -242,13 +242,10 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip) struct i386_devdesc *rootdev; vm_offset_t addr, bootinfo_addr; char *rootdevname; - int bootdevnr; + int bootdevnr, i; u_int pad; char *kernelname; const char *kernelpath; -#ifdef PC98 - int i; -#endif *howtop = bi_getboothowto(args); @@ -289,10 +286,12 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip) bi.bi_kernelname = 0; /* XXX char * -> kernel name */ bi.bi_nfs_diskless = 0; /* struct nfs_diskless * */ bi.bi_n_bios_used = 0; /* XXX would have to hook biosdisk driver for these */ - /* bi.bi_bios_geom[] */ #ifdef PC98 for(i = 0; i < N_BIOS_GEOM; i++) bi.bi_bios_geom[i] = initial_bootinfo->bi_bios_geom[i]; +#else + for (i = 0; i < N_BIOS_GEOM; i++) + bi.bi_bios_geom[i] = bd_getbigeom(i); #endif bi.bi_size = sizeof(bi); bi.bi_memsizes_valid = 1; diff --git a/sys/boot/pc98/libpc98/time.c b/sys/boot/pc98/libpc98/time.c index 4643d6520ddb..3895a4278606 100644 --- a/sys/boot/pc98/libpc98/time.c +++ b/sys/boot/pc98/libpc98/time.c @@ -1,5 +1,7 @@ /* * mjs copyright + * + * $FreeBSD$ */ #include @@ -21,8 +23,9 @@ time(time_t *t) { static time_t lasttime, now; int hr, min, sec; + #ifdef PC98 - unsigned char bios_time[6]; + unsigned char bios_time[6]; #endif v86.ctl = 0; diff --git a/sys/boot/pc98/libpc98/vidconsole.c b/sys/boot/pc98/libpc98/vidconsole.c index db62063a4328..71b9d5ce561b 100644 --- a/sys/boot/pc98/libpc98/vidconsole.c +++ b/sys/boot/pc98/libpc98/vidconsole.c @@ -646,6 +646,7 @@ vidc_ischar(void) } #if KEYBOARD_PROBE + #ifdef PC98 static int probe_keyboard(void)